[
  {
    "path": ".gitattributes",
    "content": "# Linguist ignore\nwebsite/lib/* linguist-vendored=false\nenvironment/core/json.hpp linguist-vendored=false\nenvironment/tclap/* linguist-vendored=false\n\n# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n"
  },
  {
    "path": ".gitignore",
    "content": "###################\n## Visual Studio ##\n###################\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbuild/\nbld/\n[Bb]in/\n[Oo]bj/\n\n# Visual Studo 2015 cache/options directory\n.vs/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n*.cachefile\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding addin-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# TODO: Comment the next line if you want to checkin your web deploy settings\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/packages/*\n# except build/, which is used as an MSBuild target.\n!**/packages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/packages/repositories.config\n\n# Windows Azure Build Output\ncsx/\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Others\n*.[Cc]ache\nClientBin/\n[Ss]tyle[Cc]op.*\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.pfx\n*.publishsettings\nnode_modules/\nbower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\n*.mdf\n*.ldf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n#Java\n*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.jar\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n\n#Doc Ordner\n*.class\n*.pkh\n*.ctxt\n*.bluej\n.DS_Store\n\n#Friggin VS\n*.sln\n*.vcxproj\n*.vcxproj.filters\n*.vcxproj.user\n*.vcxproj\nHalite/Visualizer/Visualizer.vcxproj\nHalite/Visualizer/Visualizer.exe\n\n############\n## Python ##\n############\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\neggs/\n.eggs/\n\n*.o\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n# Usually these files are written by a python script from a template\n# before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*,cover\n.hypothesis/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n#############\n## Clojure ##\n#############\npom.xml\n*jar\nairesources/Clojure/lib\nnative\n.lein-failures\ncheckouts\n.lein-deps-sum\n\n#############\n## Node.js ##\n#############\n\n# Logs\nlogs\nnpm-debug.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules\njspm_packages\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n##############\n## Composer ##\n##############\ncomposer.phar\nvendor/\ncomposer.lock\n\n##########\n## Atom ##\n##########\n.atom-build.yml\n\n##########\n## Rust ##\n##########\ntarget/\nCargo.lock\n**/*.rs.bk\n\n###########\n## OCaml ##\n###########\n*.annot\n*.cmo\n*.cma\n*.cmi\n*.a\n*.o\n*.cmx\n*.cmxs\n*.cmxa\n\n# ocamlbuild working directory\n_build/\n\n# ocamlbuild targets\n*.byte\n*.native\n\n# oasis generated files\nsetup.data\nsetup.log\n\n\n############\n## Halite ##\n############\nValues.sql\nstorage/\nconfig.php\nworkingPath/\n\n*.ini\n!travisTests.ini\n\n*.swp\n*.gch\n*.exe\nenvironment/halite\nworker/halite\ngit_pull.php\n\n*.zip\n*.7z\n*.gz\n!BasicJavaBot.zip\n\n# VS Code\n.vscode\n\nairesources/C++/MyBot\nairesources/C++/BasicBot\nairesources/*/halite\n\nleaderboard.png\n\nworker/[0-9]*\n\nenvironment/visualizer\nenvironment/shaders\nenvironment/fonts\n\nHaliteEnvironment-Mac\nHaliteEnvironment-Debian\n\ndownloads/\nkeys/\nstarterpackages/\n\n*.pem\n*.ppk\n\n*.hlt\n!interestingGame.hlt\n\ngoogle*.html\n\nscreenlog.*\n\n*.dll\n\nnode_modules\n/dist\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: required\n\ndist: trusty\n\nlanguage: cpp\n\nservices: \n  - mysql\n\naddons:\n  apt:\n    packages:\n    - mysql-server-5.6\n    - mysql-client-core-5.6\n    - mysql-client-5.6\n\ninstall:\n  - cd ~/build/HaliteChallenge/Halite/tests\n  - cp travisTests.ini tests.ini\n  - cp travisTests.ini ../halite.ini\n \n  - cd ~/build/HaliteChallenge/Halite/website\n  - sudo ./install.sh\n\n  - cd ~/build/HaliteChallenge/Halite/worker\n  - sudo ./install.sh 123\n\n  - cd ~/build/HaliteChallenge/Halite/tests\n  - sudo ./install.sh\n\n  - export CXX=\"g++-4.9\"\n\nscript:\n  - cd ~/build/HaliteChallenge/Halite/tests/\n  - sudo ./runTests.sh\n\nnotifications:\n    slack: halite:HnrNM3effc9q8ZVvT7PqsSYC\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Halite Contributing Guide\n\nIf you find a bug or have a feature request, please [open an issue](https://github.com/HaliteChallenge/Halite/issues/new).\n\nWant to help out? Have you implemented a patch or a new feature? Send us a pull request! If you are looking for things to do, check out [our open issues](https://github.com/HaliteChallenge/Halite/issues).\n\n## Common Contributions \n\n### Writing a Starter Package\n\nIf you'd like to write a starter package for a new language, see this [guide](https://halite.io/advanced_writing_sp.php).\n\n### Adding Your Company or University\n\nEdit [this whitelist](https://github.com/HaliteChallenge/Halite/edit/master/website/organizationWhitelist.txt) and send us a pull request. If you need to change your email, head [here](https://halite.io/email.php). We'll make sure to tag all members of your organization who have already signed up.\n\n## Folder Contents\n\n- `admin/` - A collection of administrative resources (ex. a technical specification)\n- `airesources/` - The language-specific starter kits for writing bots\n- `environment/` - The halite game engine \n- `tests/` - All of the project's unit and integration tests\n- `website/` - The website that hosts the competition. Includes the API that manages the game servers.\n- `worker/` - The source for the worker servers that compile bots and run games safely\n\n## Installing the website on Ubuntu\n\nClone the repo:\n\n    git clone https://github.com/HaliteChallenge/Halite.git\n\nRun the website install script with root user permissions. This will install php, apache, python (and some python modules), and composer (and some composer packages):\n\n    cd website; sudo ./install.sh\n\nRun the database install script with root user permissions. This will install mysql and insert our schema into a database titled Halite.\n\n    cd sql; sudo ./install.sh\n\nCreate a `halite.ini` file using your favorite text editor in the root project directory. Place information about your local database setup in there. Your `halite.ini` file should look like this;\n    \n    [database]\n    hostname = 127.0.0.1 \n    username = YOUR_LOCAL_MYSQL_USERNAME\n    password = YOUR_LOCAL_MYSQL_PASSWORD\n    name = Halite\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2016 Michael Truell and Benjamin Spector\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n"
  },
  {
    "path": "README.md",
    "content": "# Halite\n\n[![Travis Badge](https://travis-ci.org/HaliteChallenge/Halite.svg?branch=master)](https://travis-ci.org/HaliteChallenge/Halite)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/HaliteChallenge/Halite/master/LICENSE)\n\nHalite is a programming competition. Contestants write bots to play an original multi-player turn-based strategy game played on a rectangular grid. For more information about the game, visit [our website](http://halite.io).\n\n## Contributing\n\nSee [the Contributing Guide](CONTRIBUTING.md).\n\n## Questions\n\nSee [the Forums](http://2016.forums.halite.io) and [our Discord chat](https://discordapp.com/invite/rbVDB4n).\n\n## Authors\n\nHalite was primarily created by [Ben Spector](https://github.com/Sydriax) and [Michael Truell](https://github.com/truell20) for Two Sigma during their summer 2016 internship. \n\nMany others contributed to Halite's developement, including [Matt Adereth](https://github.com/adereth), [Trammell Hudson](https://github.com/osresearch), and Jaques Clapauch from Two Sigma and [Arnaud Sahuguet](https://github.com/sahuguet) and [Scot Spinner](https://github.com/awesomescot) from Cornell Tech. Halite's participants, including [Nick Malaguti](https://github.com/nmalaguti), [Travis Erdman](https://github.com/erdman), and [Janzert](https://github.com/janzert), have also been instrumental to the project.\n"
  },
  {
    "path": "admin/checkTaskCompletion.py",
    "content": "#!/usr/bin/env python3\n\nimport configparser\nimport time\nfrom datetime import datetime\n\nimport pymysql\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\n\nDB_CONFIG = parser[\"database\"]\n\ndef check_compiles(db):\n    db.begin()\n    with db.cursor() as cursor:\n        cursor.execute(\"SELECT COUNT(*) FROM User WHERE compileStatus != 0\")\n        return cursor.fetchone()['COUNT(*)']\n\ndef check_workers(db, start_time):\n    db.begin()\n    with db.cursor() as cursor:\n        cursor.execute(\"SELECT workerID, lastRequestTime FROM Worker ORDER BY workerID\")\n        workers = cursor.fetchall()\n    waiting = list()\n    for w in workers:\n        if w[\"lastRequestTime\"] < start_time:\n            waiting.append(w)\n    return waiting\n\ndef main():\n    if (\"compState\" not in parser or \"noGameTasks\" not in parser[\"compState\"] or\n            not parser[\"compState\"][\"noGameTasks\"]):\n        print(parser[\"compState\"][\"noGameTasks\"])\n        print(\"Game tasks still activated. Disable in halite.ini [compState] noGameTasks\")\n        return\n    start_time = datetime.now()\n    db = pymysql.connect(host=DB_CONFIG['hostname'], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)\n\n    compiles = 1\n    workers = [1]\n    while compiles or workers:\n        compiles = check_compiles(db)\n        workers = check_workers(db, start_time)\n        if compiles:\n            print(\"Waiting for %d more compiles to complete.\" % (compiles,))\n        if workers:\n            print(\"Waiting for workers: \", end=\"\")\n            print(\", \".join(str(w[\"workerID\"]) for w in workers[:5]), end=\"\")\n            if len(workers) > 5:\n                print(\" and %d more\" % (len(workers) - 5,))\n            else:\n                print()\n        time.sleep(5)\n    db.begin()\n    with db.cursor() as cursor:\n        cursor.execute(\"SELECT MAX(gameID) FROM Game\")\n        max_game = cursor.fetchone()[\"MAX(gameID)\"]\n    print(\"All tasks completed, last gameID %d.\" % (max_game,))\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "admin/commandRunner.py",
    "content": "import pymysql\nimport threading\nimport configparser\nimport sys\nimport os\nimport os.path\n\ndef runOnWorker(worker, keyPath, command):\n    print(\"########\"+worker['ipAddress']+\"########\")\n    os.system(\"ssh -oStrictHostKeyChecking=no -i \\\"\"+keyPath+\"\\\" ubuntu@\"+worker['ipAddress']+\" '\"+command+\"'\")\n    print(\"########\"+worker['ipAddress']+\"########\")\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\nDB_CONFIG = parser[\"database\"]\n\nkeyPath = os.path.join(\"../\", parser[\"aws\"][\"keyfilepath\"])\n\ndb = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)\ncursor = db.cursor()\n\ncursor.execute(\"select * from Worker\")\nworkers = cursor.fetchall()\n\ncommand = sys.argv[1]\n\nisAsync = False if len(sys.argv) < 3 else int(sys.argv[2]) == 1\n\nif isAsync:\n    threads = []\n    for worker in workers:\n        t = threading.Thread(target=runOnWorker, args = (worker, keyPath, command))\n        t.daemon = True\n        t.start()\n        threads.append(t)\n\n    for t in threads:\n        t.join()\nelse:\n    for worker in workers:\n        runOnWorker(worker, keyPath, command)\n"
  },
  {
    "path": "admin/cost.py",
    "content": "dimensions = [(1, 20), (2, 25), (3, 30), (4, 35), (3, 40), (2, 45), (1, 50)]\naveragePlayersPerGame = 4\nplayersPerServers = 15.6\nperServerCost = 3*4.68\naveragePlayers = 4000\ntotalTime = 0\ntotalMatches = 0\nfor dimension in dimensions:\n    totalMatches += dimension[0]\n    totalTime += dimension[0] * (15000 + pow(dimension[1], 3)*10/3)\n\n\ntimePerPlayerPerMatch = totalTime*averagePlayers/(averagePlayersPerGame*(averagePlayers/playersPerServers)*totalMatches)\nprint(\"Time per match per player in minutes: \" + str(timePerPlayerPerMatch/(60*1000)))\ncostPerPlayer = perServerCost/playersPerServers\nprint(\"Cost per player: \" + str(costPerPlayer))\ntotalCost = perServerCost*(averagePlayers/playersPerServers)\nprint(\"Total cost: \" + str(totalCost))\n"
  },
  {
    "path": "admin/cron/haliteEmailer.py",
    "content": "import smtplib\nfrom email.mime.text import MIMEText\n\ndef sendEmail(senderEmail, senderPassword, subject, body, recipient):\n    print(\"Sending email\")\n\n    msg = MIMEText(body, \"html\")\n    msg['Subject'] = subject\n    msg['From'] = senderEmail\n    msg['To'] = recipient\n\n    s = smtplib.SMTP('smtp.gmail.com:587')\n    s.ehlo()\n    s.starttls();\n    s.login(senderEmail, senderPassword)\n    s.sendmail(senderEmail, [recipient], msg.as_string())\n    s.quit()\n"
  },
  {
    "path": "admin/cron/install.sh",
    "content": "apt-get update\napt-get install -y python3 python3-pip linkchecker\npip3 install configparser pymysql \n"
  },
  {
    "path": "admin/cron/linkChecker.py",
    "content": "#!/usr/bin/env python3\n\nimport configparser\nimport subprocess\nimport haliteEmailer\n\nparser = configparser.ConfigParser()\nparser.read(\"../../halite.ini\")\n\nHALITE_EMAIL = parser[\"email\"][\"email\"]\nHALITE_EMAIL_PASSWORD = parser[\"email\"][\"password\"]\n\ncommand = 'linkchecker --ignore-url=^mailto: --timeout=20 https://halite.io/'\nproc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nstdout, stderr = proc.communicate()\nstdout = stdout.decode('utf-8')\nstderr = stderr.decode('utf-8')\n\nif stdout.split(\"\\n\")[-3].find(\"0 errors\") == -1:\n        haliteEmailer.sendEmail(HALITE_EMAIL, HALITE_EMAIL_PASSWORD, \"LINK ALERT\", \"There seem to be some broken links on http://halite.io/.<br>Here is what was given as the output of <b>\\\"\"+command+\"\\\"</b> (<b>You will probably want more verbose output and so will have to run the command yourself</b>).<br><br>STDOUT:<br>\"+stderr+\"<br><br>STDERR:<br>\"+stderr+\"\", HALITE_EMAIL)\n"
  },
  {
    "path": "admin/cron/workerChecker.py",
    "content": "#!/usr/bin/env python3\n\nimport configparser\nimport pymysql\n\nimport haliteEmailer\n\nparser = configparser.ConfigParser()\nparser.read(\"../../halite.ini\")\n\nDB_CONFIG = parser[\"database\"]\nHALITE_EMAIL = parser[\"email\"][\"email\"]\nHALITE_EMAIL_PASSWORD = parser[\"email\"][\"password\"]\n\ndb = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'])\ncursor = db.cursor()\ncursor.execute(\"select * from Worker WHERE TIMESTAMPDIFF(MINUTE, lastRequestTime, NOW()) > 30\")\nresults = cursor.fetchall()\n\nif len(results) == 0:\n    print(\"All good!\")\nelse:\n    message = \"Some workers haven't communicated with the manager in a while!<br><br>\"\n    haliteEmailer.sendEmail(HALITE_EMAIL, HALITE_EMAIL_PASSWORD, str(len(results))+\" workers down\", message, HALITE_EMAIL)\n"
  },
  {
    "path": "admin/md/DISASTER.md",
    "content": "# Disaster Scenarios\n\n### Restarting each component \n\n#### Mysql DB\n\nSSH into the AWS instance hosting the database.\n\n    $ sudo service mysql restart\n\n#### Website backend and Manger\n\nSSH into the AWS instance hosting the website and manager.\n\n    $ sudo service apache2 restart\n\n#### Workers\n\nOn your local machine, assuming that your halite.ini is configured correctly and the database is up:\n\n    $ cd admin\n    $ python3 commandRunner.py 'cd Halite/worker; sudo ./stopWorkerScreen.sh; ./startWorkerScreen.sh'\n\nLet's go over that last line. The `commandRunner.py` script uses ssh to run arbitrary bash commands on all of our workers. You pass it your desired bash command as a command line arguement (in this case `cd Halite/worker; ...`). The `sudo ./stopWorkerScreen.sh` command will kill all of the screens on a worker (and therefore the process that is running `worker.py`) and will stop and remove all docker containers on a worker. `./startWorkerScreen.sh` starts a detached screen and runs `python3 worker.py` in it.\n\n***Note:*** This will have to be updated soon. AWS doesn't let you login as root over ssh.\n\n### Bad bot submitted\n\n### Account DDOS\n\n### Renew/Reinstall SSL\n\nRun:\n\n    $ certbot-auto --apache -d halite.io -d www.halite.io\n    \nYou will be presented with a couple of cursese menus. Renewing the certificate should be tried first. \"Easy\" (both http and https) should be picked instead of \"Secure.\"\n\n### Restarting from MySQL database backup\n\n***These steps will delete all data in the production db***\n\nLogin to the backup server over SFTP using your favorite SFTP client ([Filezilla](https://filezilla-project.org/) is quite good). Navigate into the `/backup/db` folder. Grab the newest file (also the file that starts with the biggest number as these files are named by the timestamp when they were created).\n\nTransfer this file to the home directory of the DB server directly or by downloading it to your local computer, logging into the DB server over SFTP, and then uploading it to the DB server.\n\nSSH into the db server, and:\n\n    $ echo \"drop database Halite; create database Halite;\" | mysql -u root -p\n    $ mysql -u root -p Halite < NAME_OF_THE_SQL_FILE.sql\n"
  },
  {
    "path": "admin/md/INSTALL.md",
    "content": "# Installation\n\nIf you have not already:\n\n    git clone https://github.com/HaliteChallenge/Halite.git\n\n### Website/Manager Server Setup\n\n    $ cd website && ./install.sh\n\nCheck that you are on php >= 5.6 and mysql >= 5.6.5: \n\n    $ `php -v; mysql -V\n    \nSymlink the repo to /var/www:\n\n    ln -s ~/Halite /var/www\n\nCreate and write a halite.ini file in the root directory of the project\n\nFinish Apache setup:\n\n * [Allow the following of symlinks by apache](http://superuser.com/questions/244245/how-do-i-get-apache-to-follow-symlinks)\n * [Allow .htaccess override](http://stackoverflow.com/a/22526144)\n * [Redirect root directory to website directory](http://serverfault.com/questions/9992/how-to-get-apache2-to-redirect-to-a-subdirectory)\n * [Increase your max file upload size (worker's posting large replays, users posting big bot archives)](http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size)\n\nTo setup automatic backups on the website server, copy the `backupWebsite` file in the `Halite/website/cron` folder into the server's `/etc/cron.hourly` folder, change the IP address in the file to that of the backup server, and make sure that the ssh key of the website server is in the `~/.ssh/authorized_keys` file on the backup server. Once copied, mark the `backupWebsite` file as executable and give cron permission to execute it like so:\n\n    cd /etc/cron.hourly\n    chmod +x backupWebsite\n    chmod 755 backupWebsite\n\n### Database server setup\n\n    $ cd website/sql && ./install.sh\n    \nAdd a superuser by wildcarding its host and allowing remote login. In the MySQL shell:\n\n    CREATE USER 'superuser'@'%' IDENTIFIED BY 'SOME_RANDOM_PASSWORD';\n    GRANT ALL PRIVILEGES ON *.* TO 'superuser'@'%' IDENTIFIED BY 'SOME_RANDOM_PASSWORD' WITH GRANT OPTION;\n    FLUSH PRIVILEGES;\n\nTo finish superuser setup, comment out `bind-address = 127.0.0.1` in `/etc/mysql/my.cnf`, and:\n \n    $ sudo service mysql restart\n\nFor ease of use of the mysql on the command line and for install scripts to be guranteed to run smoothly, please edit your `~/.my.cnf` to include these lines:\n\n    [mysqldump]\n    user=MYSQL_USERNAME\n    password=MYSQL_PASSWORD\n\n    [client]\n    user=MYSQL_USERNAME\n    password=MYSQL_PASSWORD\n\nTo setup automatic backups on the db server, copy the `backupDatabase` file in the `Halite/website/cron` folder into the server's `/etc/cron.hourly` folder, change the IP address in the file to the one of the backup server, and make sure that the ssh key of the db server is in the `~/.ssh/authorized_keys` file on the backup server. Once copied, mark the `backupDatabase` file as executable and give anyone permission to execute it like so:\n\n    cd /etc/cron.hourly\n    chmod +x backupDatabase\n    chmod 755 backupDatabase\n\n### Worker server setup\n***Note:*** Make sure that your `halite.ini` file points to the proper AWS key pair.\n\nOn your local machine:\n\n    $ cd website/php && python3 openNewWorker.py\n\n"
  },
  {
    "path": "admin/md/SPEC.md",
    "content": "# Halite Specification\n\nHalite is an online programming challenge. Users write bots to play a simple, original game with the following rule set:\n\n* Bots may move their pieces either north, south, east, or west every turn or choose to remain still.\n* If a piece stays still, it gains strength equal to the production value of the current tile that it is on.\n* If a piece moves onto a piece with the same owner, their strengths combine. Strength values are cut off at 255.\n* A piece inflicts damage equal to its strength onto all adjacent pieces that are not maps squares but have a different owner and onto to all coinciding pieces that have a different owner (this includes map squares).\n* When a piece has a strength &lt; 0, it dies.\n\nUsers develop their bots locally using our game engine, zip and submit their source to our website when they are ready to test out their bot, and watch as their bot plays against others and is ranked on our leaderboard.\n\n**Note:** This spec details how the project currently fuctions. Changes will be made before the public launch.\n\n\n### Environment\nThe environment is written in C++ with no dependencies. The environment starts bot processes using the start commands given to it through the command line. It then communicates with bots over stdin and stdout, sending them the map and recieving their moves. A switch to using sockets for bot communication is planned. The environment outputs a replay file, with the `hlt` extension, which may be visualized [here](http://halite.io/game.php).\n\n### Website\n\nThe frontend of halite.io is written in HTML, CSS, and Javascript. The Bootstrap 3 CSS library is used for styling. The Pixi javascript library is used for our game visualizer. The JQuery library is used for DOM manipulation and for AJAX calls. HTML files are classified as PHP files to allow the easy including of repeating HTML elements (i.e. the navigation bar). No templating is used at all on the frontend. All interactions with our backend are done through REST calls made through the JQuery AJAX library.\n\nThe backend is written in PHP. Apache is used as its webserver.\n\nThe server on which the website is hosted also hosts the manager.\n\nTo update the version of the site on the server, just: \n\n    cd ~/Halite && git pull\n\n### HCE\n\nThe \"HCE\"(Halite Competition Environment) is what we call the system of servers that compiles the source code of each contestant, runs games between bots, and ranks each submission. The system consists of many worker servers and one manager server.\n\nWorker servers query the manager server for tasks, either a compile task or a game task. If there is any bot that needs to be compiled, the manager will respond with a compile task. If there are no compile tasks, the manager will respond with a game task, which is chosen like so:\n\n* A seed plager is chosen by picking the bot with the highest `rand()*(sigma^2)`. \"Sigma\" is the level of uncertainty in the Trueskill score of a bot\n* An allowed rank difference `d` is computed as: `5 / rand()^0.65`\n* The number of players `n` is picked at random from a range of 2-6\n* The other `n-1` players are chosen at random from the players within `d`\n* The width and height of the map is chosen from a range of 20-50\n\nOnce given the ID of the bot(s) that they are compiling/running, workers query the manager for the executables and source of each bot. After compilation, the resulting binary+source mix is posted to the manager. These are removed from the disk on the worker server on completion of a task.\n\nDuring both compilation and runtime, bots are run within their own Docker container. Networking, RAM, CPU, and disk access is limited.\n\n### Database\n\nA MySQL server (5.7.1) is used as the database for the project. Our MySQL server runs on RDS. \n\n### File Storage\n\nError logs, replay files, and bot source are hosted on AWS S3 standard storage.\n\n### Forums\n\n[The discourse forum software](https://www.discourse.org/) is used. User authentication is handled on our end through [discourse's sso](https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045). The forums are run on their own server (2 GB of RAM, Ubuntu 14.04 64 bit). Automated emails are sent through halite@halite.io, using gmail as a service provider. We will migrate away from gmail for the public launch since they have quite a low cap on the number of messages per day.\n\n### Backups\n\nRDS backups are turned on.\n\n### Admin Tools\n\nA simple python script (`manager/commandRunner.py`) is used to run arbitrary commands on all of the workers listed in the `halite.ini` file.\n\nA status page located at `halite.io/status.php` includes the time since every worker has queried the manager, the throughput of the HCE, and general stats about our user base. Google analytics is included on the site.\n\n### Monitoring Tools\n\nWe use a series of cron jobs to alert us if one of the workers hasn't responded for a number of minutes and to alert us if there are any broken links on the site.\n\nWe plan on setting up pingdom/pagerduty to alert us of downtime.\n\n### Configuration Files\n\nAn INI file, titled `halite.ini` and located in the root directory of the project, is used for all of our project configurations. Here is a sample halite.ini file:\n\n```\n[hce]\nmanagerURl = http://localhost/manager/\napiKey = 1234\nsecretFolder = FAKE_FOLDER_NAME\n\n[workerIPs]\nFAKE_WORKER_NAME = 123.456.789.000\n\n[email]\nemail = FAKE_EMAIL\npassword = FAKE_PASSWORD\n\n[database]\nhostname = localhost\nusername = root\npassword = pass123\nname = MAIN_DB_NAME\n\n[sso]\nsecret = SECRET_KEY_FORUMS\nurl = SINGLE_SIGN_ON_FORUMS\n\n[forums]\napiUsername = FAKE_USERNAME\napiKey = 1234567890\n\n[encrypt]\nsalt = abc123456789\n\n[aws]\naccesskey = 1234556\nsecretaccesskey = 1234561238378\namiid = ami-2d39803a\nkeyname = RandomKeyName\ninstancetype = t2.nano\nsecuritygroupname = security-group-name\nkeyfilepath = NameOfKeyFile.pem\n```\n\n### Server Setup\n\nEach of our servers run Ubuntu 14.04. A brief textual description of our server setup:\n\n* One server runs the website and manager.\n* Another server runs the database.\n* Another server runs the forums.\n* Another server runs a series of cron jobs that check for broken links or downed workers.\n* Each worker runs is on its own server.\n\nBelow is a basic diagram of our server setup.\n\n![Server Architecture Diagram](components.png)\n"
  },
  {
    "path": "admin/md/STARTER_PACKAGE_CHECKLIST.md",
    "content": "Starter Package Checklist\n\n* Make sure all proper files are present (MyBot, RandomBot, runGame.sh, runGame.bat)\n* Add dependencies to docker file\n* Test on game servers\n* Add to archive script\n* Add to downloads\n* Update game server reference\n"
  },
  {
    "path": "admin/rankReset.py",
    "content": "#!/usr/bin/env python3\n\nimport configparser\nimport pymysql\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\n\nDB_CONFIG = parser[\"database\"]\n\ndef main():\n    confirm = input(\"This will clear all current ranks, are you sure? [y/N] \")\n    if confirm != \"y\":\n        return\n    db = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)\n    cursor = db.cursor()\n    cursor.execute(\"SELECT COUNT(*) FROM User WHERE isRunning=1\")\n    num_active = cursor.fetchone()['COUNT(*)']\n    cursor.execute(\"INSERT INTO UserHistory (userID, versionNumber, lastRank, lastNumPlayers, lastNumGames) SELECT userID, numSubmissions, rank, %d, numGames FROM User WHERE isRunning=1\" % (num_active,))\n    cursor.execute(\"UPDATE User SET numSubmissions=numSubmissions+1, numGames=0, mu=25.0, sigma=8.333 WHERE isRunning=1\")\n    db.commit()\n    db.close()\n    print(\"All ranks successfully reset.\")\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "admin/updateOrgs.py",
    "content": "import configparser\nimport pymysql\nimport urllib.request\n\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\n\nDB_CONFIG = parser[\"database\"]\n\ndb = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)\ncursor = db.cursor()\ncursor.execute(\"select email, userID, organization from User\")\nusers = cursor.fetchall()\n\norgs = [line.strip().split(\" - \") for line in open(\"../website/organizationWhitelist.txt\").readlines()]\n\nfor user in users:\n    if user[\"email\"] == None:\n        continue\n\n    realUserOrg = \"Other\"\n    try:\n        emailDomain = user[\"email\"].split(\"@\")[1]\n    except:\n        pass\n    for org in orgs:\n        if emailDomain == org[1]:\n            realUserOrg = org[0]\n            break\n    if (realUserOrg != \"Other\" or user[\"organization\"] == \"\") and realUserOrg != user[\"organization\"]:\n        print(\"%s, %s, %s\" % (realUserOrg, user[\"organization\"], user[\"email\"]))\n        cursor.execute(\"update User set organization = '\"+realUserOrg+\"' where userID=\"+str(user[\"userID\"]))\n        db.commit()\n"
  },
  {
    "path": "airesources/C/MyBot.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\n#include \"hlt.h\"\n\n#define BOT_NAME \"MyCBot\"\n\nint main(void) {\n\n    GAME game;\n    int x, y, direction;\n\n    srand(time(NULL));\n\n    game = GetInit();\n    SendInit(BOT_NAME);\n\n    while (1) {\n\n        GetFrame(game);\n\n        for (x = 0 ; x < game.width ; x++) {\n            for (y = 0 ; y < game.height ; y++) {\n                if (game.owner[x][y] == game.playertag) {\n                    direction = rand() % 5;\n                    SetMove(game, x, y, direction);\n                }\n            }\n        }\n\n        SendFrame(game);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "airesources/C/RandomBot.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\n#include \"hlt.h\"\n\n#define BOT_NAME \"RandomCBot\"\n\nint main(void) {\n\n    GAME game;\n    int x, y, direction;\n\n    srand(time(NULL));\n\n    game = GetInit();\n    SendInit(BOT_NAME);\n\n    while (1) {\n\n        GetFrame(game);\n\n        for (x = 0 ; x < game.width ; x++) {\n            for (y = 0 ; y < game.height ; y++) {\n                if (game.owner[x][y] == game.playertag) {\n                    direction = rand() % 5;\n                    SetMove(game, x, y, direction);\n                }\n            }\n        }\n\n        SendFrame(game);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "airesources/C/hlt.h",
    "content": "/*\n    In general, none of the public functions return pointers,\n    nor do they take pointer arguments.\n\n    Useful functions:\n\n        GAME GetInit()\n        void SendInit(char *botname)\n        void GetFrame(GAME game)\n        void SetMove(GAME game, int x, int y, int direction)\n        void SendFrame(GAME game)\n\n    Convenience functions:\n\n        SITE GetSiteFromXY(GAME game, int x, int y)\n        SITE GetSiteFromMovement(GAME game, int src_x, int src_y, int direction)\n\n    Pssst! More documentation and some better bots are at:\n    https://github.com/fohristiwhirl/chalite\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#define STILL 0\n#define NORTH 1\n#define EAST 2\n#define SOUTH 3\n#define WEST 4\n\ntypedef struct Site_struct {\n    int x;\n    int y;\n    int owner;\n    int strength;\n    int production;\n} SITE;\n\ntypedef struct Game_struct {\n    int width;\n    int height;\n    int playertag;\n    int ** moves;\n    int ** owner;\n    int ** production;\n    int ** strength;\n} GAME;\n\nint ** __new_2d_int_array(int width, int height) {\n\n    int x;\n    int **result;\n\n    result = malloc(sizeof(int*) * width);\n    if (result == NULL) {\n        printf(\"Malloc 1 failed in __new_2d_int_array()\\n\");\n        exit(1);\n    }\n\n    for (x = 0 ; x < width ; x++) {\n        result[x] = malloc(sizeof(int) * height);\n        if (result[x] == NULL) {\n            printf(\"Malloc 2 failed in __new_2d_int_array()\\n\");\n            exit(1);\n        }\n    }\n\n    return result;\n}\n\nint __getnextint() {\n\n    int ch;\n\n    int result = 0;\n    int seen_any_digits = 0;\n\n    while (1) {\n        ch = getchar();\n        if (ch == EOF) {\n            printf(\"EOF received. Halite engine quit?\\n\");\n            exit(1);\n        }\n        if (ch >= 48 && ch <= 57) {\n            seen_any_digits = 1;\n            result *= 10;\n            result += ch - 48;\n        } else {\n            if (seen_any_digits) {\n                return result;\n            }\n        }\n    }\n\n    return 54321;       // Never get here.\n}\n\nvoid __parseproduction(GAME game) {\n\n    int x, y;\n\n    for (y = 0 ; y < game.height ; y++) {\n        for (x = 0 ; x < game.width ; x++) {\n            game.production[x][y] = __getnextint();\n        }\n    }\n    return;\n}\n\nvoid __parsemap(GAME game) {\n\n    int x, y;\n    int run;\n    int owner;\n    int total_set;\n    int set_this_run;\n\n    x = 0;\n    y = 0;\n    total_set = 0;\n    set_this_run = 0;\n    while (total_set < game.width * game.height) {\n\n        run = __getnextint();\n        owner = __getnextint();\n\n        for (set_this_run = 0 ; set_this_run < run ; set_this_run++) {\n\n            game.owner[x][y] = owner;\n            total_set++;\n\n            x++;\n            if (x == game.width) {\n                x = 0;\n                y += 1;\n            }\n        }\n    }\n\n    for (y = 0 ; y < game.height ; y++) {\n        for (x = 0 ; x < game.width ; x++) {\n            game.strength[x][y] = __getnextint();\n        }\n    }\n\n    return;\n}\n\nGAME GetInit() {\n\n    GAME game;\n\n    game.playertag = __getnextint();\n    game.width = __getnextint();\n    game.height = __getnextint();\n\n    game.moves = __new_2d_int_array(game.width, game.height);\n    game.owner = __new_2d_int_array(game.width, game.height);\n    game.production = __new_2d_int_array(game.width, game.height);\n    game.strength = __new_2d_int_array(game.width, game.height);\n\n    __parseproduction(game);\n    __parsemap(game);\n\n    return game;\n}\n\nvoid SendInit(char *botname) {\n    printf(\"%s\\n\", botname);\n    fflush(stdout);\n}\n\nvoid GetFrame(GAME game) {\n\n    int x, y;\n\n    __parsemap(game);\n\n    // Reset the moves array while we're at it.\n\n    for (x = 0 ; x < game.width ; x++) {\n        for (y = 0 ; y < game.height ; y++) {\n            game.moves[x][y] = STILL;\n        }\n    }\n\n    return;\n}\n\nint __sanitise_x(GAME game, int x) {\n    if (x < 0) {\n        x += -(x / game.width) * game.width + game.width;      // Can make x == width, so must still use % next\n    }\n    x %= game.width;\n    return x;\n}\n\nint __sanitise_y(GAME game, int y) {\n    if (y < 0) {\n        y += -(y / game.height) * game.height + game.height;   // Can make y == height, so must still use % next\n    }\n    y %= game.height;\n    return y;\n}\n\nSITE GetSiteFromXY(GAME game, int x, int y) {\n\n    SITE result;\n\n    x = __sanitise_x(game, x);\n    y = __sanitise_y(game, y);\n\n    result.x = x;\n    result.y = y;\n\n    result.owner = game.owner[result.x][result.y];\n    result.production = game.production[result.x][result.y];\n    result.strength = game.strength[result.x][result.y];\n\n    return result;\n}\n\nSITE GetSiteFromMovement(GAME game, int src_x, int src_y, int direction) {\n\n    SITE result;\n    int x, y;\n\n    x = src_x;\n    y = src_y;\n\n    switch (direction) {\n    case NORTH:\n        y--;\n        break;\n    case EAST:\n        x++;\n        break;\n    case SOUTH:\n        y++;\n        break;\n    case WEST:\n        x--;\n        break;\n    }\n\n    x = __sanitise_x(game, x);\n    y = __sanitise_y(game, y);\n\n    result = GetSiteFromXY(game, x, y);\n\n    return result;\n}\n\nvoid SetMove(GAME game, int x, int y, int direction) {\n    x = __sanitise_x(game, x);\n    y = __sanitise_y(game, y);\n    game.moves[x][y] = direction;\n    return;\n}\n\nvoid SendFrame(GAME game) {\n\n    int x, y;\n\n    for (x = 0 ; x < game.width ; x++) {\n        for (y = 0 ; y < game.height ; y++) {\n            if (game.moves[x][y] != STILL && game.owner[x][y] == game.playertag) {\n                printf(\"%d %d %d \", x, y, game.moves[x][y]);\n            }\n        }\n    }\n\n    printf(\"\\n\");\n    fflush(stdout);\n\n    return;\n}\n"
  },
  {
    "path": "airesources/C/runGame.bat",
    "content": "gcc MyBot.c -o MyBot.exe\ngcc RandomBot.c -o RandomBot.exe\n.\\halite.exe -d \"30 30\" \"MyBot.exe\" \"RandomBot.exe\"\n"
  },
  {
    "path": "airesources/C/runGame.sh",
    "content": "#!/bin/bash\n\ngcc MyBot.c -o MyBot.o\ngcc RandomBot.c -o RandomBot.o\n./halite -d \"30 30\" \"./MyBot.o\" \"./RandomBot.o\"\n"
  },
  {
    "path": "airesources/C++/MyBot.cpp",
    "content": "#include <stdlib.h>\n#include <time.h>\n#include <cstdlib>\n#include <ctime>\n#include <time.h>\n#include <set>\n#include <fstream>\n\n#include \"hlt.hpp\"\n#include \"networking.hpp\"\n\nint main() {\n    srand(time(NULL));\n\n    std::cout.sync_with_stdio(0);\n\n    unsigned char myID;\n    hlt::GameMap presentMap;\n    getInit(myID, presentMap);\n    sendInit(\"MyC++Bot\");\n\n    std::set<hlt::Move> moves;\n    while(true) {\n        moves.clear();\n\n        getFrame(presentMap);\n\n        for(unsigned short a = 0; a < presentMap.height; a++) {\n            for(unsigned short b = 0; b < presentMap.width; b++) {\n                if (presentMap.getSite({ b, a }).owner == myID) {\n                    moves.insert({ { b, a }, (unsigned char)(rand() % 5) });\n                }\n            }\n        }\n\n        sendFrame(moves);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "airesources/C++/RandomBot.cpp",
    "content": "#include <stdlib.h>\n#include <time.h>\n#include <cstdlib>\n#include <ctime>\n#include <time.h>\n#include <set>\n#include <fstream>\n\n#include \"hlt.hpp\"\n#include \"networking.hpp\"\n\nint main() {\n    srand(time(NULL));\n\n    std::cout.sync_with_stdio(0);\n\n    unsigned char myID;\n    hlt::GameMap presentMap;\n    getInit(myID, presentMap);\n    sendInit(\"RandomC++Bot\");\n\n    std::set<hlt::Move> moves;\n    while(true) {\n        moves.clear();\n\n        getFrame(presentMap);\n\n        for(unsigned short a = 0; a < presentMap.height; a++) {\n            for(unsigned short b = 0; b < presentMap.width; b++) {\n                if (presentMap.getSite({ b, a }).owner == myID) {\n                    moves.insert({ { b, a }, (unsigned char)(rand() % 5) });\n                }\n            }\n        }\n\n        sendFrame(moves);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "airesources/C++/hlt.hpp",
    "content": "#ifndef HLT_H\n#define HLT_H\n\n#include <list>\n#include <vector>\n#include <random>\n\n#define STILL 0\n#define NORTH 1\n#define EAST 2\n#define SOUTH 3\n#define WEST 4\n\nconst int DIRECTIONS[] = {STILL, NORTH, EAST, SOUTH, WEST};\nconst int CARDINALS[] = {NORTH, EAST, SOUTH, WEST};\n\nnamespace hlt{\n    struct Location{\n        unsigned short x, y;\n    };\n    static bool operator<(const Location& l1, const Location& l2) {\n        return ((l1.x + l1.y)*((unsigned int)l1.x + l1.y + 1) / 2) + l1.y < ((l2.x + l2.y)*((unsigned int)l2.x + l2.y + 1) / 2) + l2.y;\n    }\n\n    struct Site{\n        unsigned char owner;\n        unsigned char strength;\n        unsigned char production;\n    };\n\n    class GameMap{\n    public:\n        std::vector< std::vector<Site> > contents;\n        unsigned short width, height; //Number of rows & columns, NOT maximum index.\n\n        GameMap() {\n            width = 0;\n            height = 0;\n            contents = std::vector< std::vector<Site> >(height, std::vector<Site>(width, { 0, 0, 0 }));\n        }\n        GameMap(const GameMap &otherMap) {\n            width = otherMap.width;\n            height = otherMap.height;\n            contents = otherMap.contents;\n        }\n        GameMap(int w, int h) {\n            width = w;\n            height = h;\n            contents = std::vector< std::vector<Site> >(height, std::vector<Site>(width, { 0, 0, 0 }));\n        }\n\n        bool inBounds(Location l) {\n            return l.x < width && l.y < height;\n        }\n        float getDistance(Location l1, Location l2) {\n            short dx = abs(l1.x - l2.x), dy = abs(l1.y - l2.y);\n            if(dx > width / 2) dx = width - dx;\n            if(dy > height / 2) dy = height - dy;\n            return dx + dy;\n        }\n        float getAngle(Location l1, Location l2) {\n            short dx = l2.x - l1.x, dy = l2.y - l1.y;\n            if(dx > width - dx) dx -= width;\n            else if(-dx > width + dx) dx += width;\n            if(dy > height - dy) dy -= height;\n            else if(-dy > height + dy) dy += height;\n            return atan2(dy, dx);\n        }\n\n        Location getLocation(Location l, unsigned char direction) {\n            if(direction != STILL) {\n                if(direction == NORTH) {\n                    if(l.y == 0) l.y = height - 1;\n                    else l.y--;\n                }\n                else if(direction == EAST) {\n                    if(l.x == width - 1) l.x = 0;\n                    else l.x++;\n                }\n                else if(direction == SOUTH) {\n                    if(l.y == height - 1) l.y = 0;\n                    else l.y++;\n                }\n                else if(direction == WEST) {\n                    if(l.x == 0) l.x = width - 1;\n                    else l.x--;\n                }\n            }\n            return l;\n        }\n        Site& getSite(Location l, unsigned char direction = STILL) {\n            l = getLocation(l, direction);\n            return contents[l.y][l.x];\n        }\n    };\n\n    struct Move{\n        Location loc; unsigned char dir;\n    };\n    static bool operator<(const Move& m1, const Move& m2) {\n        unsigned int l1Prod = ((m1.loc.x + m1.loc.y)*((unsigned int)m1.loc.x + m1.loc.y + 1) / 2) + m1.loc.y, l2Prod = ((m2.loc.x + m2.loc.y)*((unsigned int)m2.loc.x + m2.loc.y + 1) / 2) + m2.loc.y;\n        return ((l1Prod + m1.dir)*(l1Prod + m1.dir + 1) / 2) + m1.dir < ((l2Prod + m2.dir)*(l2Prod + m2.dir + 1) / 2) + m2.dir;\n    }\n}\n\n#endif\n"
  },
  {
    "path": "airesources/C++/networking.hpp",
    "content": "#ifndef AI_NETWORKING_H\n#define AI_NETWORKING_H\n\n#include <iostream>\n#include <time.h>\n#include <set>\n#include <cfloat>\n#include <fstream>\n#include <string>\n#include <sstream>\n#include <algorithm>\n#include <bitset>\n\n#ifdef _WIN32\n#include <sys/types.h>\n#include <Winsock2.h>\n#include <Ws2tcpip.h>\n#define WINSOCKVERSION MAKEWORD(2,2)\n#else\n#include <sys/socket.h>\n#include <sys/ioctl.h>\n#include <arpa/inet.h>\n#include <unistd.h>\n#include <time.h>\n#endif\n\n#include \"hlt.hpp\"\n\nnamespace detail{\n    static std::vector< std::vector<unsigned char> > productions;\n    static int width, height;\n\n    static std::string serializeMoveSet(const std::set<hlt::Move> &moves) {\n        std::ostringstream oss;\n        for(auto a = moves.begin(); a != moves.end(); ++a) oss << a->loc.x << \" \" << a->loc.y << \" \" << (int)a->dir << \" \";\n        return oss.str();\n    }\n\n    static void deserializeMapSize(const std::string & inputString) {\n        std::stringstream iss(inputString);\n        iss >> width >> height;\n    }\n\n    static void deserializeProductions(const std::string & inputString) {\n        std::stringstream iss(inputString);\n        productions.resize(height);\n        short temp;\n        for(auto a = productions.begin(); a != productions.end(); a++) {\n            a->resize(width);\n            for(auto b = a->begin(); b != a->end(); b++) {\n                iss >> temp;\n                *b = temp;\n            }\n        }\n    }\n\n    static hlt::GameMap deserializeMap(const std::string & inputString) {\n        std::stringstream iss(inputString);\n\n        hlt::GameMap map(width, height);\n\n        //Set productions\n        for(int a = 0; a < map.height; a++) {\n            for(int b = 0; b < map.width; b++) {\n                map.contents[a][b].production = productions[a][b];\n            }\n        }\n\n        //Run-length encode of owners\n        unsigned short y = 0, x = 0;\n        unsigned short counter = 0, owner = 0;\n        while(y != map.height) {\n            for(iss >> counter >> owner; counter; counter--) {\n                map.contents[y][x].owner = owner;\n                x++;\n                if(x == map.width) {\n                    x = 0;\n                    y++;\n                }\n            }\n        }\n\n        for (int a = 0; a < map.contents.size(); a++) {\n            for (int b = 0; b < map.contents[a].size(); b++) {\n                short strengthShort;\n                iss >> strengthShort;\n                map.contents[a][b].strength = strengthShort;\n            }\n        }\n\n        return map;\n    }\n    static void sendString(const std::string & sendString) {\n        if(sendString.length() < 1) std::cout << ' ' << std::endl; //Automatically flushes.\n        else std::cout << sendString << std::endl; //Automatically flushes.\n    }\n\n    static std::string getString() {\n        std::string newString;\n        std::getline(std::cin, newString);\n        return newString;\n    }\n}\n\nstatic void getInit(unsigned char& playerTag, hlt::GameMap& m) {\n    playerTag = (unsigned char)std::stoi(detail::getString());\n    detail::deserializeMapSize(detail::getString());\n    detail::deserializeProductions(detail::getString());\n    m = detail::deserializeMap(detail::getString());\n\n}\n\nstatic void sendInit(std::string name) {\n    detail::sendString(name);\n}\n\nstatic void getFrame(hlt::GameMap& m) {\n    m = detail::deserializeMap(detail::getString());\n}\nstatic void sendFrame(const std::set<hlt::Move> &moves) {\n    detail::sendString(detail::serializeMoveSet(moves));\n}\n\n#endif\n"
  },
  {
    "path": "airesources/C++/runGame.bat",
    "content": "g++ -std=c++11 MyBot.cpp -o MyBot.exe\ng++ -std=c++11 RandomBot.cpp -o RandomBot.exe\n.\\halite.exe -d \"30 30\" \"MyBot.exe\" \"RandomBot.exe\"\n"
  },
  {
    "path": "airesources/C++/runGame.sh",
    "content": "#!/bin/bash\n\ng++ -std=c++11 MyBot.cpp -o MyBot.o\ng++ -std=c++11 RandomBot.cpp -o RandomBot.o\n./halite -d \"30 30\" \"./MyBot.o\" \"./RandomBot.o\"\n"
  },
  {
    "path": "airesources/CSharp/Halite.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{1460A17A-7E8B-4643-B0A9-06A1B86F07E9}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Halite</RootNamespace>\n    <AssemblyName>Halite</AssemblyName>\n    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup>\n    <StartupObject>Halite.MyBot</StartupObject>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"HaliteHelper.cs\" />\n    <Compile Include=\"MyBot.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>\n"
  },
  {
    "path": "airesources/CSharp/HaliteHelper.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Sockets;\n\n/// <summary>\n/// Helpful for debugging.\n/// </summary>\npublic static class Log\n{\n    private static string _logPath;\n\n    /// <summary>\n    /// File must exist\n    /// </summary>\n    public static void Setup(string logPath) {\n        _logPath = logPath;\n    }\n\n    public static void Information(string message) {\n        if (!string.IsNullOrEmpty(_logPath))\n            File.AppendAllLines(_logPath, new[] {string.Format(\"{0}: {1}\", DateTime.Now.ToShortTimeString(), message)});\n    }\n    \n    public static void Error(Exception exception) {\n        Log.Information(string.Format(\"ERROR: {0} {1}\", exception.Message, exception.StackTrace));\n    }\n}\n\npublic static class Networking\n{\n    private static string ReadNextLine() {\n        var str = Console.ReadLine();\n        if (str == null) throw new ApplicationException(\"Could not read next line from stdin\");\n        return str;\n    }\n\n    private static void SendString(string str) {\n        Console.WriteLine(str);\n    }\n\n    /// <summary>\n    /// Call once at the start of a game to load the map and player tag from the first four stdin lines.\n    /// </summary>\n    public static Map getInit(out ushort playerTag) {\n\n        // Line 1: Player tag\n        if (!ushort.TryParse(ReadNextLine(), out playerTag))\n            throw new ApplicationException(\"Could not get player tag from stdin during init\");\n\n        // Lines 2-4: Map\n        var map = Map.ParseMap(ReadNextLine(), ReadNextLine(), ReadNextLine());\n        return map;\n    }\n\n    /// <summary>\n    /// Call every frame to update the map to the next one provided by the environment.\n    /// </summary>\n    public static void getFrame(ref Map map) {\n        map.Update(ReadNextLine());\n    }\n\n\n    /// <summary>\n    /// Call to acknowledge the initail game map and start the game.\n    /// </summary>\n    public static void SendInit(string botName) {\n        SendString(botName);\n    }\n\n    /// <summary>\n    /// Call to send your move orders and complete your turn.\n    /// </summary>\n    public static void SendMoves(IEnumerable<Move> moves) {\n        SendString(Move.MovesToString(moves));\n    }\n}\n\npublic enum Direction\n{\n    Still = 0,\n    North = 1,\n    East = 2,\n    South = 3,\n    West = 4\n}\n\npublic struct Site\n{\n    public ushort Owner { get; internal set; }\n    public ushort Strength { get; internal set; }\n    public ushort Production { get; internal set; }\n}\n\npublic struct Location\n{\n    public ushort X;\n    public ushort Y;\n}\n\npublic struct Move\n{\n    public Location Location;\n    public Direction Direction;\n\n    internal static string MovesToString(IEnumerable<Move> moves) {\n        return string.Join(\" \", moves.Select(m => string.Format(\"{0} {1} {2}\", m.Location.X, m.Location.Y, (int)m.Direction)));\n    }\n}\n\n/// <summary>\n/// State of the game at every turn. Use <see cref=\"GetInitialMap\"/> to get the map for a new game from\n/// stdin, and use <see cref=\"NextTurn\"/> to update the map after orders for a turn have been executed.\n/// </summary>\npublic class Map\n{\n    public void Update(string gameMapStr) {\n        var gameMapValues = new Queue<string>(gameMapStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries));\n\n        ushort x = 0, y = 0;\n        while (y < Height) {\n            ushort counter, owner;\n            if (!ushort.TryParse(gameMapValues.Dequeue(), out counter))\n                throw new ApplicationException(\"Could not get some counter from stdin\");\n            if (!ushort.TryParse(gameMapValues.Dequeue(), out owner))\n                throw new ApplicationException(\"Could not get some owner from stdin\");\n            while (counter > 0) {\n                _sites[x, y].Owner = owner;\n                x++;\n                if (x == Width) {\n                    x = 0;\n                    y++;\n                }\n                counter--;\n            }\n        }\n\n        var strengthValues = gameMapValues; // Referencing same queue, but using a name that is more clear\n        for (y = 0; y < Height; y++) {\n            for (x = 0; x < Width; x++) {\n                ushort strength;\n                if (!ushort.TryParse(strengthValues.Dequeue(), out strength))\n                    throw new ApplicationException(\"Could not get some strength value from stdin\");\n                _sites[x, y].Strength = strength;\n            }\n        }\n    }\n\n    /// <summary>\n    /// Get a read-only structure representing the current state of the site at the supplied coordinates.\n    /// </summary>\n    public Site this[ushort x, ushort y] {\n        get {\n            if (x >= Width)\n                throw new IndexOutOfRangeException(string.Format(\"Cannot get site at ({0},{1}) beacuse width is only {2}\", x, y, Width));\n            if (y >= Height)\n                throw new IndexOutOfRangeException(string.Format(\"Cannot get site at ({0},{1}) beacuse height is only {2}\", x, y, Height));\n            return _sites[x, y];\n        }\n    }\n\n    /// <summary>\n    /// Get a read-only structure representing the current state of the site at the supplied location.\n    /// </summary>\n    public Site this[Location location] => this[location.X, location.Y];\n\n    /// <summary>\n    /// Returns the width of the map.\n    /// </summary>\n    public ushort Width => (ushort)_sites.GetLength(0);\n\n    /// <summary>\n    ///  Returns the height of the map.\n    /// </summary>\n    public ushort Height => (ushort)_sites.GetLength(1);\n\n    #region Implementation\n\n    private readonly Site[,] _sites;\n\n    private Map(ushort width, ushort height) {\n        _sites = new Site[width, height];\n        for (ushort x = 0; x < width; x++) {\n            for (ushort y = 0; y < height; y++) {\n                _sites[x, y] = new Site();\n            }\n        }\n    }\n\n    private static Tuple<ushort, ushort> ParseMapSize(string mapSizeStr) {\n        ushort width, height;\n        var parts = mapSizeStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n        if (parts.Length != 2 || !ushort.TryParse(parts[0], out width) || !ushort.TryParse(parts[1], out height))\n            throw new ApplicationException(\"Could not get map size from stdin during init\");\n        return Tuple.Create(width, height);\n    }\n\n    public static Map ParseMap(string mapSizeStr, string productionMapStr, string gameMapStr) {\n        var mapSize = ParseMapSize(mapSizeStr);\n        var map = new Map(mapSize.Item1, mapSize.Item2);\n\n        var productionValues = new Queue<string>(productionMapStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries));\n\n        ushort x, y;\n        for (y = 0; y < map.Height; y++) {\n            for (x = 0; x < map.Width; x++) {\n                ushort production;\n                if (!ushort.TryParse(productionValues.Dequeue(), out production))\n                    throw new ApplicationException(\"Could not get some production value from stdin\");\n                map._sites[x, y].Production = production;\n            }\n        }\n\n        map.Update(gameMapStr);\n\n        return map;\n    }\n\n    #endregion\n\n}\n"
  },
  {
    "path": "airesources/CSharp/MyBot.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class MyBot\n{\n    public const string MyBotName = \"MyC#Bot\";\n\n    public static void Main(string[] args) {\n        Console.SetIn(Console.In);\n        Console.SetOut(Console.Out);\n\n        ushort myID;\n        var map = Networking.getInit(out myID);\n\n        /* ------\n            Do more prep work, see rules for time limit\n        ------ */\n\n        Networking.SendInit(MyBotName); // Acknoweldge the init and begin the game\n\n        var random = new Random();\n        while (true) {\n            Networking.getFrame(ref map); // Update the map to reflect the moves before this turn\n\n            var moves = new List<Move>();\n            for (ushort x = 0; x < map.Width; x++) {\n                for (ushort y = 0; y < map.Height; y++) {\n                    if (map[x, y].Owner == myID) {\n                        moves.Add(new Move {\n                            Location = new Location {X = x, Y = y},\n                            Direction = (Direction)random.Next(5)\n                        });\n                    }\n                }\n            }\n\n            Networking.SendMoves(moves); // Send moves\n        }\n    }\n}\n"
  },
  {
    "path": "airesources/CSharp/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"Halite\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"Halite\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2016\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"1460a17a-7e8b-4643-b0a9-06a1b86f07e9\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "airesources/CSharp/RandomBot.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class MyBot\n{\n    public const string RandomBotName = \"RandomC#Bot\";\n\n    public static void Main(string[] args) {\n        Console.SetIn(Console.In);\n        Console.SetOut(Console.Out);\n\n        ushort myID;\n        var map = Networking.getInit(out myID);\n        \n        Networking.SendInit(RandomBotName);\n\n        var random = new Random();\n        while (true) {\n            Networking.getFrame(ref map);\n\n            var moves = new List<Move>();\n            for (ushort x = 0; x < map.Width; x++) {\n                for (ushort y = 0; y < map.Height; y++) {\n                    if (map[x, y].Owner == myID) {\n                        moves.Add(new Move {\n                            Location = new Location {X = x, Y = y},\n                            Direction = (Direction)random.Next(5)\n                        });\n                    }\n                }\n            }\n\n            Networking.SendMoves(moves); // Send moves\n        }\n    }\n}\n"
  },
  {
    "path": "airesources/CSharp/runGame.bat",
    "content": "csc /t:library /out:HaliteHelper.dll HaliteHelper.cs\ncsc /reference:HaliteHelper.dll -out:MyBot.exe MyBot.cs\ncsc /reference:HaliteHelper.dll -out:RandomBot.exe RandomBot.cs \nhalite -d \"30 30\" \"MyBot.exe\" \"RandomBot.exe\"\n"
  },
  {
    "path": "airesources/CSharp/runGame.sh",
    "content": "#!/bin/bash\n\nmcs -t:library -out:HaliteHelper.dll HaliteHelper.cs\nmcs -reference:HaliteHelper.dll -out:MyBot.o MyBot.cs\nmcs -reference:HaliteHelper.dll -out:RandomBot.o RandomBot.cs \n./halite -d \"30 30\" \"./MyBot.o\" \"./RandomBot.o\"\n"
  },
  {
    "path": "airesources/Clojure/.gitignore",
    "content": "/target\n/classes\n/checkouts\npom.xml\npom.xml.asc\n*.jar\n*.class\n/.lein-*\n/.nrepl-port\n.hgignore\n.hg/\n"
  },
  {
    "path": "airesources/Clojure/README.md",
    "content": "# halite-clj\n\nA Clojure implementation of a random Halite bot.\n\n## Usage\n\nFirst, copy the \"halite\" executable to the root of your project.  Build using \"lein uberjar\" and run:\n\n./halite -d \"30 30\" \"java -cp target/MyBot.jar MyBot\" \"java -cp target/MyBot.jar RandomBot\"\n"
  },
  {
    "path": "airesources/Clojure/project.clj",
    "content": "(defproject halite-clj \"0.1.0-SNAPSHOT\"\n  :description \"FIXME: write description\"\n  :url \"http://example.com/FIXME\"\n  :license {:name \"Eclipse Public License\"\n            :url \"http://www.eclipse.org/legal/epl-v10.html\"}\n  :dependencies [[org.clojure/clojure \"1.8.0\"]]\n  :uberjar-name \"MyBot.jar\"\n  :main MyBot\n  :profiles {:uberjar {:aot :all}}\n  )\n"
  },
  {
    "path": "airesources/Clojure/runGame.bat",
    "content": "call lein uberjar\n\nhalite.exe -d \"30 30\" \"java -cp target/MyBot.jar MyBot\" \"java -cp target/MyBot.jar RandomBot\"\n"
  },
  {
    "path": "airesources/Clojure/runGame.sh",
    "content": "#!/bin/bash\n\nlein uberjar\n\n./halite -d \"30 30\" \"java -cp target/MyBot.jar MyBot\" \"java -cp target/MyBot.jar RandomBot\"\n"
  },
  {
    "path": "airesources/Clojure/src/MyBot.clj",
    "content": "(ns MyBot\n  (:require [game]\n            [io])\n  (:gen-class))\n\n(def bot-name \"MyFirstClojureBot\")\n\n(defn random-moves\n  \"Takes a 2D vector of sites and returns a list of [site, direction] pairs\"\n  [my-id game-map]\n  (let [my-sites (->> game-map\n                      flatten\n                      (filter #(= (:owner %) my-id)))]\n    (map vector my-sites (repeatedly #(rand-nth game/directions)))))\n\n(defn -main []\n  (let [{:keys [my-id productions width height game-map]} (io/get-init!)]\n\n    ;; Do any initialization you want with the starting game-map before submitting the bot-name\n\n    (println bot-name)\n\n    (doseq [turn (range)]\n      (let [game-map (io/create-game-map width height productions (io/read-ints!))]\n        (io/send-moves! (random-moves my-id game-map))))))\n"
  },
  {
    "path": "airesources/Clojure/src/RandomBot.clj",
    "content": "(ns RandomBot\n  (:require [game]\n            [io])\n  (:gen-class))\n\n(def bot-name \"RandomClojureBot\")\n\n(defn random-moves\n  \"Takes a 2D vector of sites and returns a list of [site, direction] pairs\"\n  [my-id game-map]\n  (let [my-sites (->> game-map\n                      flatten\n                      (filter #(= (:owner %) my-id)))]\n    (map vector my-sites (repeatedly #(rand-nth game/directions)))))\n\n(defn -main []\n  (let [{:keys [my-id productions width height game-map]} (io/get-init!)]\n\n    ;; Do any initialization you want with the starting game-map before submitting the bot-name\n\n    (println bot-name)\n\n    (doseq [turn (range)]\n      (let [game-map (io/create-game-map width height productions (io/read-ints!))]\n        (io/send-moves! (random-moves my-id game-map))))))\n"
  },
  {
    "path": "airesources/Clojure/src/game.clj",
    "content": "(ns game\n  (:gen-class))\n\n;; The map is represented by a 2D vector of Sites\n(defrecord Site [^int x ^int y ^int production ^int strength ^int owner])\n\n(def directions [:still :north :east :south :west])\n(def cardinal-directions (rest directions))\n\n(defn adjacent-site [game-map site direction]\n  (let [width (count (first game-map))\n        height (count game-map)\n        new-x (condp = direction\n                :west (mod (dec (:x site)) width)\n                :east (mod (inc (:x site)) width)\n                (:x site))\n        new-y (condp = direction\n                :north (mod (dec (:y site)) height)\n                :south (mod (inc (:y site)) height)\n                (:y site))]\n    (get-in game-map [new-y new-x])))\n\n(defn single-dimension-distance\n  \"Computes the distance between two integers mod m\"\n  [p1 p2 m]\n  (let [unwrapped-distance (Math/abs (- p1 p2))]\n    (min unwrapped-distance (- m unwrapped-distance))))\n\n(defn distance [game-map site1 site2]\n  (+ (single-dimension-distance (:x site1) (:x site2) (count (first game-map)))\n     (single-dimension-distance (:y site1) (:y site2) (count game-map))))\n"
  },
  {
    "path": "airesources/Clojure/src/io.clj",
    "content": "(ns io\n  (:require clojure.string\n            game)\n  (:gen-class))\n\n(defn create-game-map\n  \"Parses the run-length encoded format of the map into a 2D vector of Sites\"\n  [width height productions compressed-map]\n  (let [total-size (* width height)\n        potential-owner-run-pairs (partition 2 compressed-map)\n        owner-pair-count (->> potential-owner-run-pairs\n                              (map first)\n                              (reductions + 0)\n                              (take-while #(not= total-size %))\n                              (count))\n        owners (->> potential-owner-run-pairs\n                    (take owner-pair-count)\n                    (mapcat #(repeat (first %) (second %))))\n        strengths (->> compressed-map\n                       (drop (* 2 owner-pair-count)))\n        flat-sites (map game/->Site\n                        (cycle (range width))\n                        (mapcat #(repeat width %) (range))\n                        productions\n                        strengths\n                        owners)]\n    (mapv vec (partition width flat-sites))))\n\n(defn read-ints!\n  \"Reads a sequence of space-delimited integers from *in*\"\n  []\n  (map #(Integer/parseInt %)\n       (clojure.string/split (read-line) #\" \")))\n\n(defn get-init!\n  \"Reads all the initialization data provided by the Halite environment process\"\n  []\n  (let [my-id (Integer/parseInt (read-line))\n        [width height] (read-ints!)\n        productions (read-ints!)\n        game-map (create-game-map width height productions (read-ints!))]\n    {:my-id my-id :width width :height height :productions productions :game-map game-map}))\n\n\n(def direction->int (zipmap game/directions (range)))\n\n(defn- format-moves-for-output [moves]\n  (clojure.string/join \" \"\n                       (for [[site direction] moves]\n                         (clojure.string/join \" \" [(:x site) (:y site) (direction->int direction)]))))\n\n(defn send-moves!\n  \"Submits a list of [site, direction] pairs to the Halite enviroment process\"\n  [moves]\n  (println (format-moves-for-output moves)))\n"
  },
  {
    "path": "airesources/Go/MyBot.go",
    "content": "package main\n\nimport (\n\t\"hlt\"\n\n\t\"math/rand\"\n)\n\nfunc main() {\n\tconn, gameMap := hlt.NewConnection()\n\tconn.SendName(\"MyBot\")\n\tfor {\n\t\tvar moves hlt.MoveSet\n\t\tgameMap = conn.GetFrame()\n\t\tfor y := 0; y < gameMap.Height; y++ {\n\t\t\tfor x := 0; x < gameMap.Width; x++ {\n\t\t\t\tloc := hlt.NewLocation(x, y)\n\t\t\t\tif gameMap.GetSite(loc, hlt.STILL).Owner == conn.PlayerTag {\n\t\t\t\t\tmoves = append(moves, hlt.Move{\n\t\t\t\t\t\tLocation:  loc,\n\t\t\t\t\t\tDirection: hlt.Direction(rand.Int() % 5),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconn.SendFrame(moves)\n\n\t}\n}\n"
  },
  {
    "path": "airesources/Go/RandomBot.go",
    "content": "package main\n\nimport (\n\t\"hlt\"\n\n\t\"math/rand\"\n)\n\nfunc main() {\n\tconn, gameMap := hlt.NewConnection()\n\tconn.SendName(\"RandomBot\")\n\tfor {\n\t\tvar moves hlt.MoveSet\n\t\tgameMap = conn.GetFrame()\n\t\tfor y := 0; y < gameMap.Height; y++ {\n\t\t\tfor x := 0; x < gameMap.Width; x++ {\n\t\t\t\tloc := hlt.NewLocation(x, y)\n\t\t\t\tif gameMap.GetSite(loc, hlt.STILL).Owner == conn.PlayerTag {\n\t\t\t\t\tmoves = append(moves, hlt.Move{\n\t\t\t\t\t\tLocation:  loc,\n\t\t\t\t\t\tDirection: hlt.Direction(rand.Int() % 5),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconn.SendFrame(moves)\n\n\t}\n}\n"
  },
  {
    "path": "airesources/Go/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"go run MyBot.go\" \"go run RandomBot.go\"\n"
  },
  {
    "path": "airesources/Go/runGame.sh",
    "content": "#!/bin/bash\n\nexport GOPATH=\"$(pwd)\"\n\n./halite -d \"30 30\" \"go run MyBot.go\" \"go run RandomBot.go\"\n"
  },
  {
    "path": "airesources/Go/src/hlt/gamemap.go",
    "content": "package hlt\n\nimport (\n\t\"log\"\n\t\"math\"\n\t\"strconv\"\n)\n\ntype GameMap struct {\n\tWidth, Height int\n\tContents\t  [][]Site\n}\n\nfunc NewGameMap(width, height int) GameMap {\n\tgameMap := GameMap{\n\t\tWidth:\twidth,\n\t\tHeight: height,\n\t}\n\tgameMap.Contents = make([][]Site, height)\n\tfor y := 0; y < height; y++ {\n\t\tgameMap.Contents[y] = make([]Site, width)\n\t\tfor x := 0; x < width; x++ {\n\t\t\tgameMap.Contents[y][x] = Site{}\n\t\t}\n\t}\n\n\treturn gameMap\n}\n\nfunc int_str_array_pop(input []string) (int, []string) {\n\tret, err := strconv.Atoi(input[0])\n\tinput = input[1:]\n\tif err != nil {\n\t\tlog.Printf(\"Whoopse\", err)\n\t}\n\treturn ret, input\n}\n\nfunc (m *GameMap) InBounds(loc Location) bool {\n\treturn loc.X >= 0 && loc.X < m.Width && loc.Y >= 0 && loc.Y < m.Height\n}\n\nfunc (m *GameMap) GetDistance(loc1, loc2 Location) int {\n\tdx := int(math.Abs(float64(loc1.X) - float64(loc2.X)))\n\tdy := int(math.Abs(float64(loc1.Y) - float64(loc2.Y)))\n\tif dx > m.Width/2 {\n\t\tdx = m.Width - dx\n\t}\n\tif dy > m.Width/2 {\n\t\tdy = m.Height - dy\n\t}\n\treturn dx + dy\n}\n\nfunc (m *GameMap) GetAngle(loc1, loc2 Location) float64 {\n\tdx := loc2.X - loc1.X\n\tdy := loc2.Y - loc1.Y\n\n\tif dx > m.Width-dx {\n\t\tdx -= m.Width\n\t} else if -dx > m.Width+dx {\n\t\tdx += m.Width\n\t}\n\tif dy > m.Height-dy {\n\t\tdx -= m.Height\n\t} else if -dy > m.Height+dy {\n\t\tdy += m.Height\n\t}\n\n\treturn math.Atan2(float64(dy), float64(dx))\n\n}\n\nfunc (m *GameMap) GetLocation(loc Location, direction Direction) Location {\n\tswitch direction {\n\tcase NORTH:\n\t\tif loc.Y == 0 {\n\t\t\tloc.Y = m.Height - 1\n\t\t} else {\n\t\t\tloc.Y -= 1\n\t\t}\n\tcase EAST:\n\t\tif loc.X == m.Width-1 {\n\t\t\tloc.X = 0\n\t\t} else {\n\t\t\tloc.X += 1\n\t\t}\n\tcase SOUTH:\n\t\tif loc.Y == m.Height-1 {\n\t\t\tloc.Y = 0\n\t\t} else {\n\t\t\tloc.Y += 1\n\t\t}\n\tcase WEST:\n\t\tif loc.X == 0 {\n\t\t\tloc.X = m.Width - 1\n\t\t} else {\n\t\t\tloc.X -= 1\n\t\t}\n\t}\n\treturn loc\n}\n\nfunc (m *GameMap) GetSite(loc Location, direction Direction) Site {\n\tloc = m.GetLocation(loc, direction)\n\treturn m.Contents[loc.Y][loc.X]\n}\n"
  },
  {
    "path": "airesources/Go/src/hlt/networking.go",
    "content": "package hlt\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n)\n\ntype Direction int\n\nconst (\n\tSTILL Direction = iota\n\tNORTH\n\tEAST\n\tSOUTH\n\tWEST\n)\n\nvar Directions = []Direction{STILL, NORTH, EAST, SOUTH, WEST}\nvar CARDINALS = []Direction{NORTH, EAST, SOUTH, WEST}\n\ntype Site struct {\n\tOwner      int\n\tStrength   int\n\tProduction int\n}\n\ntype Location struct {\n\tY, X int\n}\n\nfunc NewLocation(x, y int) Location {\n\treturn Location{\n\t\tX: x,\n\t\tY: y,\n\t}\n}\n\ntype Move struct {\n\tLocation  Location\n\tDirection Direction\n}\n\ntype MoveSet []Move\n\nfunc (ms MoveSet) serialize() string {\n\tvar retstr string\n\tfor _, move := range ms {\n\t\tretstr = fmt.Sprintf(\"%s %d %d %d\", retstr, move.Location.X, move.Location.Y, move.Direction)\n\t}\n\treturn retstr\n}\n\ntype Connection struct {\n\twidth, height int\n\tPlayerTag     int\n\tproductions   [][]int\n\treader        *bufio.Reader\n\twriter        io.Writer\n}\n\nfunc (c *Connection) deserializeMap() GameMap {\n\tsplitString := strings.Split(c.getString(), \" \")\n\n\tm := NewGameMap(c.width, c.height)\n\n\tvar x, y, owner, counter int\n\tfor y != m.Height {\n\t\tcounter, splitString = int_str_array_pop(splitString)\n\t\towner, splitString = int_str_array_pop(splitString)\n\t\tfor a := 0; a < counter; a++ {\n\t\t\tm.Contents[y][x].Owner = owner\n\n\t\t\tx += 1\n\t\t\tif x == m.Width {\n\t\t\t\tx = 0\n\t\t\t\ty += 1\n\t\t\t}\n\t\t}\n\t}\n\n\tfor y := 0; y < m.Height; y++ {\n\t\tfor x := 0; x < m.Width; x++ {\n\t\t\tm.Contents[y][x].Strength, splitString = int_str_array_pop(splitString)\n\t\t\tm.Contents[y][x].Production = c.productions[y][x]\n\t\t}\n\t}\n\n\treturn m\n}\n\nfunc (c *Connection) sendString(input string) {\n\tfmt.Println(input)\n}\n\nfunc (c *Connection) getString() string {\n\tretstr, _ := c.reader.ReadString('\\n')\n\tretstr = strings.TrimSpace(retstr)\n\treturn retstr\n}\n\nfunc (c *Connection) getInt() int {\n\ti, err := strconv.Atoi(c.getString())\n\tif err != nil {\n\t\tlog.Printf(\"Whoopse\", err)\n\t}\n\treturn i\n}\n\nfunc (c *Connection) deserializeMapSize() {\n\tsplitString := strings.Split(c.getString(), \" \")\n\tc.width, splitString = int_str_array_pop(splitString)\n\tc.height, splitString = int_str_array_pop(splitString)\n}\n\nfunc (c *Connection) deserializeProductions() {\n\tsplitString := strings.Split(c.getString(), \" \")\n\n\tc.productions = make([][]int, c.height)\n\tfor y := 0; y < c.height; y++ {\n\t\tc.productions[y] = make([]int, c.width)\n\t\tfor x := 0; x < c.width; x++ {\n\t\t\tc.productions[y][x], splitString = int_str_array_pop(splitString)\n\t\t}\n\t}\n}\n\nfunc NewConnection() (Connection, GameMap) {\n\tconn := Connection{\n\t\treader: bufio.NewReader(os.Stdin),\n\t\twriter: os.Stdout,\n\t}\n\tconn.PlayerTag = conn.getInt()\n\tconn.deserializeMapSize()\n\tconn.deserializeProductions()\n\treturn conn, conn.deserializeMap()\n}\n\nfunc (c *Connection) SendName(name string) {\n\tc.sendString(name)\n}\n\nfunc (c *Connection) GetFrame() GameMap {\n\treturn c.deserializeMap()\n}\n\nfunc (c *Connection) SendFrame(moves MoveSet) {\n\tc.sendString(moves.serialize())\n}\n"
  },
  {
    "path": "airesources/Java/Direction.java",
    "content": "import java.util.Random;\n\npublic enum Direction {\n    STILL, NORTH, EAST, SOUTH, WEST;\n\n    public static final Direction[] DIRECTIONS = new Direction[]{STILL, NORTH, EAST, SOUTH, WEST};\n    public static final Direction[] CARDINALS = new Direction[]{NORTH, EAST, SOUTH, WEST};\n\n    public static Direction randomDirection() {\n        Direction[] values = values();\n        return values[new Random().nextInt(values.length)];\n    }\n}\n"
  },
  {
    "path": "airesources/Java/GameMap.java",
    "content": "import java.util.ArrayList;\npublic class GameMap{\n\n    private final Site[][] contents;\n    private final Location[][] locations;\n    public final int width, height;\n\n    public GameMap(int width, int height, int[][] productions) {\n\n        this.width = width;\n        this.height = height;\n        this.contents = new Site[width][height];\n        this.locations = new Location[width][height];\n\n        for (int y = 0; y < height; y++) {\n            for(int x = 0; x < width; x++) {\n                final Site site = new Site(productions[x][y]);\n                contents[x][y] = site;\n                locations[x][y] = new Location(x, y, site);\n            }\n        }\n    }\n\n    public boolean inBounds(Location loc) {\n        return loc.x < width && loc.x >= 0 && loc.y < height && loc.y >= 0;\n    }\n\n    public double getDistance(Location loc1, Location loc2) {\n        int dx = Math.abs(loc1.x - loc2.x);\n        int dy = Math.abs(loc1.y - loc2.y);\n\n        if(dx > width / 2.0) dx = width - dx;\n        if(dy > height / 2.0) dy = height - dy;\n\n        return dx + dy;\n    }\n\n    public double getAngle(Location loc1, Location loc2) {\n        int dx = loc1.x - loc2.x;\n\n        // Flip order because 0,0 is top left\n        // and want atan2 to look as it would on the unit circle\n        int dy = loc2.y - loc1.y;\n\n        if(dx > width - dx) dx -= width;\n        if(-dx > width + dx) dx += width;\n\n        if(dy > height - dy) dy -= height;\n        if(-dy > height + dy) dy += height;\n\n        return Math.atan2(dy, dx);\n    }\n\n    public Location getLocation(Location location, Direction direction) {\n        switch (direction) {\n            case STILL:\n                return location;\n            case NORTH:\n                return locations[location.getX()][(location.getY() == 0 ? height : location.getY()) -1];\n            case EAST:\n                return locations[location.getX() == width - 1 ? 0 : location.getX() + 1][location.getY()];\n            case SOUTH:\n                return locations[location.getX()][location.getY() == height - 1 ? 0 : location.getY() + 1];\n            case WEST:\n                return locations[(location.getX() == 0 ? width : location.getX()) - 1][location.getY()];\n            default:\n                throw new IllegalArgumentException(String.format(\"Unknown direction %s encountered\", direction));\n        }\n    }\n\n    public Site getSite(Location loc, Direction dir) {\n        return getLocation(loc, dir).getSite();\n    }\n\n    public Site getSite(Location loc) {\n        return loc.getSite();\n    }\n\n    public Location getLocation(int x, int y) {\n        return locations[x][y];\n    }\n\n    void reset() {\n        for (int y = 0; y < height; y++) {\n            for (int x = 0; x < width; x++) {\n                final Site site = contents[x][y];\n                site.owner = 0;\n                site.strength = 0;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "airesources/Java/InitPackage.java",
    "content": "\npublic class InitPackage {\n    public int myID;\n    public GameMap map;\n}\n"
  },
  {
    "path": "airesources/Java/Location.java",
    "content": "public class Location {\n\n    // Public for backward compability\n    public final int x, y;\n    private final Site site;\n\n    public Location(int x, int y, Site site) {\n        this.x = x;\n        this.y = y;\n        this.site = site;\n    }\n\n    public int getX() {\n        return x;\n    }\n\n    public int getY() {\n        return y;\n    }\n\n    public Site getSite() {\n        return site;\n    }\n}\n"
  },
  {
    "path": "airesources/Java/Move.java",
    "content": "public class Move {\n    public Location loc;\n    public Direction dir;\n\n    public Move(Location loc_, Direction dir_) {\n        loc = loc_;\n        dir = dir_;\n    }\n}\n"
  },
  {
    "path": "airesources/Java/MyBot.java",
    "content": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class MyBot {\n    public static void main(String[] args) throws java.io.IOException {\n\n        final InitPackage iPackage = Networking.getInit();\n        final int myID = iPackage.myID;\n        final GameMap gameMap = iPackage.map;\n\n        Networking.sendInit(\"MyJavaBot\");\n\n        while(true) {\n            List<Move> moves = new ArrayList<Move>();\n\n            Networking.updateFrame(gameMap);\n\n            for (int y = 0; y < gameMap.height; y++) {\n                for (int x = 0; x < gameMap.width; x++) {\n                    final Location location = gameMap.getLocation(x, y);\n                    final Site site = location.getSite();\n                    if(site.owner == myID) {\n                        moves.add(new Move(location, Direction.randomDirection()));\n                    }\n                }\n            }\n            Networking.sendFrame(moves);\n        }\n    }\n}\n"
  },
  {
    "path": "airesources/Java/Networking.java",
    "content": "import java.net.*;\nimport java.io.*;\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\nimport java.util.List;\n\npublic class Networking {\n\n    static int[][] deserializeProductions(String inputString, int width, int height) {\n        String[] inputStringComponents = inputString.split(\" \");\n\n        int index = 0;\n        int[][] productions = new int[width][height];\n\n        for (int y = 0; y < height; y++) {\n            for (int x = 0; x < width; x++) {\n                productions[x][y] = Integer.parseInt(inputStringComponents[index]);\n                index++;\n            }\n        }\n\n        return productions;\n    }\n\n    static String serializeMoveList(List<Move> moves) {\n        StringBuilder builder = new StringBuilder();\n        for (Move move : moves) {\n            builder.append(move.loc.x)\n                .append(\" \")\n                .append(move.loc.y)\n                .append(\" \")\n                .append(move.dir.ordinal())\n                .append(\" \");\n        }\n        return builder.toString();\n    }\n\n    static GameMap deserializeGameMap(String inputString, GameMap map) {\n        String[] inputStringComponents = inputString.split(\" \");\n\n        // Run-length encode of owners\n        int y = 0, x = 0;\n        int counter = 0, owner = 0;\n        int currentIndex = 0;\n\n\n        while (y != map.height) {\n\n            counter = Integer.parseInt(inputStringComponents[currentIndex]);\n            owner = Integer.parseInt(inputStringComponents[currentIndex + 1]);\n\n            currentIndex += 2;\n            for (int a = 0; a < counter; a++) {\n\n                map.getLocation(x,y).getSite().owner = owner;\n                ++x;\n                if(x == map.width) {\n                    x = 0;\n                    ++y;\n                }\n            }\n        }\n\n        for (int b = 0; b < map.height; b++) {\n            for (int a = 0; a < map.width; a++) {\n                int strengthInt = Integer.parseInt(inputStringComponents[currentIndex]);\n                currentIndex++;\n                map.getLocation(a,b).getSite().strength = strengthInt;\n            }\n        }\n\n        return map;\n    }\n\n    static void sendString(String sendString) {\n        System.out.print(sendString+'\\n');\n        System.out.flush();\n    }\n\n    static String getString() {\n        try {\n            StringBuilder builder = new StringBuilder();\n            int buffer;\n            while ((buffer = System.in.read()) >= 0) {\n                if (buffer == '\\n') {\n                    break;\n                } else {\n                    builder = builder.append((char)buffer);\n                }\n            }\n\t    if(builder.charAt(builder.length()-1) == '\\r') builder.setLength(builder.length()-1); //Removes a carriage return if on windows for manual testing.\n            return builder.toString();\n        } catch(Exception e) {\n            System.exit(1);\n            return null; // the java compiler is stupid\n        }\n    }\n\n    static InitPackage getInit() {\n\n        InitPackage initPackage = new InitPackage();\n        initPackage.myID = (int)Integer.parseInt(getString());\n\n        // Deserialize width and height:\n        final String[] inputStringComponents = getString().split(\" \");\n\n        int width = Integer.parseInt(inputStringComponents[0]);\n        int height = Integer.parseInt(inputStringComponents[1]);\n\n        int[][] productions = deserializeProductions(getString(), width, height);\n\n        GameMap map = new GameMap(width, height, productions);\n        deserializeGameMap(getString(), map);\n\n        initPackage.map = map;\n\n        return initPackage;\n    }\n\n    static void sendInit(String name) {\n        sendString(name);\n    }\n\n    static void updateFrame(GameMap map) {\n        map.reset();\n        deserializeGameMap(getString(), map);\n    }\n\n    static void sendFrame(List<Move> moves) {\n        sendString(serializeMoveList(moves));\n    }\n\n}\n"
  },
  {
    "path": "airesources/Java/RandomBot.java",
    "content": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class RandomBot {\n    public static void main(String[] args) throws java.io.IOException {\n\n        final InitPackage iPackage = Networking.getInit();\n        final int myID = iPackage.myID;\n        final GameMap gameMap = iPackage.map;\n\n        Networking.sendInit(\"RandomJavaBot\");\n\n        while(true) {\n            List<Move> moves = new ArrayList<Move>();\n\n            Networking.updateFrame(gameMap);\n\n            for (int y = 0; y < gameMap.height; y++) {\n                for (int x = 0; x < gameMap.width; x++) {\n                    final Location location = gameMap.getLocation(x, y);\n                    final Site site = location.getSite();\n                    if(site.owner == myID) {\n                        moves.add(new Move(location, Direction.randomDirection()));\n                    }\n                }\n            }\n            Networking.sendFrame(moves);\n        }\n    }\n}\n"
  },
  {
    "path": "airesources/Java/Site.java",
    "content": "public class Site {\n\n    public final int production;\n    public int owner, strength;\n\n    public Site(int production) {\n        this.production = production;\n    }\n}\n"
  },
  {
    "path": "airesources/Java/runGame.bat",
    "content": "javac MyBot.java\njavac RandomBot.java\n.\\halite.exe -d \"30 30\" \"java MyBot\" \"java RandomBot\"\n"
  },
  {
    "path": "airesources/Java/runGame.sh",
    "content": "#!/bin/bash\n\njavac MyBot.java\njavac RandomBot.java\n./halite -d \"30 30\" \"java MyBot\" \"java RandomBot\"\n"
  },
  {
    "path": "airesources/JavaScript/MyBot.js",
    "content": "const {\n  Move,\n} = require('./hlt');\nconst Networking = require('./networking');\n\nconst network = new Networking('MyJavaScriptBot');\n\nnetwork.on('map', (gameMap, id) => {\n  const moves = [];\n\n  for (let y = 0; y < gameMap.height; y++) {\n    for (let x = 0; x < gameMap.width; x++) {\n      const loc = { x, y };\n      const { owner } = gameMap.getSite(loc);\n      if (owner === id) {\n        moves.push(new Move(loc, Math.floor(Math.random() * 5)));\n      }\n    }\n  }\n\n  network.sendMoves(moves);\n});\n"
  },
  {
    "path": "airesources/JavaScript/RandomBot.js",
    "content": "const {\n  Move,\n} = require('./hlt');\nconst Networking = require('./networking');\n\nconst network = new Networking('RandomJavaScriptBot');\n\nnetwork.on('map', (gameMap, id) => {\n  const moves = [];\n\n  for (let y = 0; y < gameMap.height; y++) {\n    for (let x = 0; x < gameMap.width; x++) {\n      const loc = { x, y };\n      const { owner } = gameMap.getSite(loc);\n      if (owner === id) {\n        moves.push(new Move(loc, Math.floor(Math.random() * 5)));\n      }\n    }\n  }\n\n  network.sendMoves(moves);\n});\n"
  },
  {
    "path": "airesources/JavaScript/hlt.js",
    "content": "const STILL = 0;\nconst NORTH = 1;\nconst EAST  = 2;\nconst SOUTH = 3;\nconst WEST  = 4;\n\nconst DIRECTIONS = [STILL, NORTH, EAST, SOUTH, WEST];\nconst CARDINALS = [NORTH, EAST, SOUTH, WEST];\n\nconst ATTACK = 0;\nconst STOP_ATTACK = 1;\n\nclass Location {\n  constructor(x = 0, y = 0) {\n    this.x = x;\n    this.y = y;\n  }\n}\n\nclass Site {\n  constructor(owner = 0, strength = 0, production = 0) {\n    this.owner = owner;\n    this.strength = strength;\n    this.production = production;\n  }\n}\n\nclass Move {\n  constructor(loc = new Location(), direction = STILL) {\n    this.loc = loc;\n    this.direction = direction;\n  }\n}\n\nclass GameMap {\n  constructor(width = 0, height = 0, numberOfPlayers = 0) {\n    this.width = width;\n    this.height = height;\n    this.numberOfPlayers = numberOfPlayers;\n    this.contents = [];\n\n    for (let y = 0; y < this.height; y++) {\n      const row = [];\n      for (let x = 0; x < this.width; x++) {\n        row.push(new Site(0, 0, 0));\n      }\n      this.contents.push(row);\n    }\n  }\n\n  inBounds(l) {\n    return l.x >= 0 && l.x < this.width && l.y >= 0 && l.y < this.height;\n  }\n\n  getDistance(l1, l2) {\n    let dx = Math.abs(l1.x - l2.x);\n    let dy = Math.abs(l1.y - l2.y);\n\n    if (dx > (this.width / 2)) {\n      dx = this.width - dx;\n    }\n\n    if (dy > (this.height / 2)) {\n      dy = this.height - dy;\n    }\n\n    return dx + dy;\n  }\n\n  getAngle(l1, l2) {\n    let dx = l2.x - l1.x;\n    let dy = l2.y - l1.y;\n\n    if (dx > (this.width - dx)) {\n      dx -= this.width;\n    } else if (-dx > (this.width + dx)) {\n      dx += this.width;\n    }\n\n    if (dy > (this.height - dy)) {\n      dy -= this.height;\n    } else if (-dy > (this.height + dy)) {\n      dy += this.height;\n    }\n\n    return Math.atan2(dy, dx);\n  }\n\n  getLocation(loc, direction) {\n    let { x, y } = loc;\n    if (direction === STILL) {\n      // nothing\n    } else if (direction === NORTH) {\n      y -= 1;\n    } else if (direction === EAST) {\n      x += 1;\n    } else if (direction === SOUTH) {\n      y += 1;\n    } else if (direction === WEST) {\n      x -= 1;\n    }\n\n    if (x < 0) {\n      x = this.width - 1;\n    } else {\n      x %= this.width;\n    }\n\n    if (y < 0) {\n      y = this.height - 1;\n    } else {\n      y %= this.height;\n    }\n\n    return { x, y };\n  }\n\n  getSite(l, direction = STILL) {\n    const { x, y } = this.getLocation(l, direction);\n    return this.contents[y][x];\n  }\n}\n\nmodule.exports = {\n  STILL,\n  NORTH,\n  EAST,\n  SOUTH,\n  WEST,\n  DIRECTIONS,\n  CARDINALS,\n  ATTACK,\n  STOP_ATTACK,\n  Location,\n  Site,\n  Move,\n  GameMap\n};\n"
  },
  {
    "path": "airesources/JavaScript/networking.js",
    "content": "const EventEmitter = require('events');\nconst readline = require('readline');\nconst { GameMap } = require('./hlt.js');\n\nclass Networking extends EventEmitter {\n  constructor(botName) {\n    super();\n\n    this.messageCount = 0;\n    this.width = 0;\n    this.height = 0;\n    this.productions = [];\n\n    this.rl = readline.createInterface({\n      input: process.stdin\n    });\n\n    this.rl.on('line', (line) => {\n      switch (this.messageCount++) {\n        case 0:\n          // first line is the player ID\n          this.id = parseInt(line, 10);\n          break;\n        case 1:\n          // second line is the map dimensions\n          this.deserializeMapSize(line);\n          break;\n        case 2:\n          // third line is the productions\n          this.deserializeProductions(line);\n          break;\n        case 3:\n          // fourth line is the initial map\n          break;\n        default:\n          // everything after is map updates\n          return this.emit('map', this.deserializeMap(line), this.id);\n      }\n    });\n\n    Networking.sendString(botName);\n  }\n\n  sendMoves(moves) {\n    Networking.sendString(Networking.serializeMoveSet(moves));\n  }\n\n  deserializeMapSize(inputString) {\n    [this.width, this.height] = splitToInts(inputString);\n  }\n\n  deserializeProductions(inputString) {\n    const flatProductions = splitToInts(inputString);\n    for (let i = 0; i < this.height; i++) {\n      const start = i * this.width;\n      const end = (i + 1) * this.width;\n      this.productions.push(flatProductions.slice(start, end));\n    }\n  }\n\n  deserializeMap(inputString) {\n    const flatMap = splitToInts(inputString);\n\n    const m = new GameMap(this.width, this.height);\n    let x = 0;\n    let y = 0;\n    let counter = 0;\n    let owner = 0;\n    let rest = flatMap;\n\n    while (y !== m.height) {\n      [counter, owner, ...rest] = rest;\n      for (let i = 0; i < counter; i++) {\n        m.contents[y][x].owner = owner;\n        x += 1;\n        if (x === m.width) {\n          x = 0;\n          y += 1;\n        }\n      }\n    }\n\n    for (y = 0; y < m.height; y++) {\n      for (x = 0; x < m.width; x++) {\n        m.contents[y][x].strength = rest.shift();\n        m.contents[y][x].production = this.productions[y][x];\n      }\n    }\n\n    return m;\n  }\n}\n\nNetworking.sendString = function sendString(toBeSent) {\n  process.stdout.write(`${toBeSent}\\n`);\n};\n\nNetworking.serializeMoveSet = function serializeMoveSet(moves) {\n  return moves\n    .map((move) => `${move.loc.x} ${move.loc.y} ${move.direction}`)\n    .join(' ');\n};\n\nfunction splitToInts(inputString) {\n  return inputString.split(' ').map((value) => parseInt(value, 10));\n}\n\nmodule.exports = Networking;\n"
  },
  {
    "path": "airesources/JavaScript/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"node MyBot.js\" \"node RandomBot.js\"\n"
  },
  {
    "path": "airesources/JavaScript/runGame.sh",
    "content": "#!/bin/bash\n\n./halite -d \"30 30\" \"node MyBot.js\" \"node RandomBot.js\"\n"
  },
  {
    "path": "airesources/Julia/MyBot.jl",
    "content": "include(\"hlt.jl\")\ninclude(\"networking.jl\")\n\nmyID, gameMap = getInit()\nsendInit(\"MyJuliaBot\")\n\nwhile true\n  moves = Vector{Move}()\n  gameMap = getFrame()\n  for y in 0:gameMap.height-1\n    for x in 0:gameMap.width-1\n      if getSite(gameMap, Location(x, y)).owner == myID\n        push!(moves, Move(Location(x, y), rand(0:4)))\n      end\n    end\n  end\n  sendFrame(moves)\nend\n"
  },
  {
    "path": "airesources/Julia/RandomBot.jl",
    "content": "include(\"hlt.jl\")\ninclude(\"networking.jl\")\n\nmyID, gameMap = getInit()\nsendInit(\"RandomJuliaBot\")\n\nwhile true\n  moves = Vector{Move}()\n  gameMap = getFrame()\n  for y in 0:gameMap.height-1\n    for x in 0:gameMap.width-1\n      if getSite(gameMap, Location(x, y)).owner == myID\n        push!(moves, Move(Location(x, y), rand(0:4)))\n      end\n    end\n  end\n  sendFrame(moves)\nend\n"
  },
  {
    "path": "airesources/Julia/hlt.jl",
    "content": "const STILL = 0\nconst NORTH = 1\nconst EAST = 2\nconst SOUTH = 3\nconst WEST = 4\n\nconst DIRECTIONS = [a for a in 0:4]\nconst CARDINALS = [a for a in 1:4]\n\nconst ATTACK = 0\nconst STOP_ATTACK = 1\n\ntype Location\n  x :: Int64\n  y :: Int64\n  Location(x::Int64, y::Int64) = new(x, y)\n  Location() = Location(0, 0)\nend\n\ntype Site\n  owner :: Int64\n  strength :: Int64\n  production :: Int64\n  Site(owner::Int64, strength::Int64, production::Int64) = new(owner, strength, production)\n  Site() = Site(0, 0, 0)\nend\n\ntype Move\n  loc :: Location\n  direction :: Int64\n  Move(loc::Location, direction::Int64) = new(loc, direction)\n  Move() = Move(Location(), 0)\nend\n\ntype GameMap\n  width :: Int64\n  height :: Int64\n  contents :: Vector{Vector{Site}}\n  function GameMap(width::Int64, height::Int64)\n    contents = Vector{Vector{Site}}()\n    for y in 0:height-1\n      row = Vector{Site}()\n      for x in 0:width-1\n        push!(row, Site(0, 0, 0))\n      end\n      push!(contents, row)\n    end\n    new(width, height, contents)\n  end\n  GameMap() = GameMap(0, 0)\nend\n\nisBounds(gm::GameMap, l::Location) = l.x >= 0 && l.x < gm.width && l.y >= 0 && l.y < gm.height\n\nfunction getDistance(gm::GameMap, l1::Location, l2::Location)\n  dx = abs(l1.x - l2.x)\n  dy = abs(l1.y - l2.y)\n\n  if dx > gm.width / 2\n    dx = gm.width - dx\n  end\n  \n  if dy > gm.height / 2\n    dy = gm.height - dy\n  end\n  \n  dx + dy\nend\n\nfunction getAngle(gm::GameMap, l1::Location, l2::Location)\n  dx = l2.x - l1.x\n  dy = l2.y - l1.y\n\n  if dx > gm.width - dx\n    dx -= gm.width\n  elseif -dx > gm.width + dx\n    dx += gm.width\n  end\n\n  if dy > gm.height - dy\n    dy -= gm.height\n  elseif -dy > gm.height + dy\n    dy += gm.height\n  end\n  \n  atan2(dy, dx)\nend\n\nfunction getLocation(gm::GameMap, loc::Location, direction::Int64)\n  l = deepcopy(loc)\n  if direction != STILL\n    if direction == NORTH\n      if l.y == 0\n        l.y = gm.height - 1\n      else\n        l.y = l.y - 1\n      end\n    elseif direction == EAST\n      if l.x == gm.width - 1\n        l.x = 0\n      else\n        l.x = l.x + 1\n      end\n    elseif direction == SOUTH\n      if l.y == gm.height - 1\n        l.y = 0\n      else\n        l.y = l.y + 1\n      end\n    elseif direction == WEST\n      if l.x == 0\n        l.x = gm.width - 1\n      else\n        l.x = l.x - 1\n      end\n    end\n  end\n  l\nend\n\nfunction getSite(gm::GameMap, l::Location, direction::Int64=STILL)\n  l = getLocation(gm, l, direction)\n  gm.contents[l.y + 1][l.x + 1]\nend\n"
  },
  {
    "path": "airesources/Julia/networking.jl",
    "content": "_productions = Vector{Vector{Int64}}()\n_width = nothing\n_height = nothing\n\nfunction serializeMoveSet(moves::Vector{Move})\n  returnString = \"\"\n  for move in moves\n    returnString *= string(move.loc.x) * \" \" * string(move.loc.y) * \" \" * string(move.direction) * \" \"\n  end\n  returnString\nend\n\nfunction deserializeMapSize(inputString::String)\n  splitString = reverse(split(inputString, \" \"))\n\n  global _width, _height\n  _width = parse(pop!(splitString))\n  _height = parse(pop!(splitString))\nend\n\nfunction deserializeProductions(inputString::String)\n  splitString = reverse(split(inputString, \" \"))\n\n  for a in 1:_height\n    row = Vector{Int64}()\n    for b in 1:_width\n      push!(row, parse(pop!(splitString)))\n    end\n    push!(_productions, row)\n  end\nend\n\nfunction deserializeMap(inputString::String)\n  splitString = reverse(split(inputString, \" \"))\n\n  m = GameMap(_width, _height)\n\n  y = 1\n  x = 1\n  counter = 0\n  owner = 0\n  while ~(y > m.height)\n    counter = parse(pop!(splitString))\n    owner = parse(pop!(splitString))\n    for a in 0:counter-1\n      m.contents[y][x].owner = owner\n      x += 1\n      if x > m.width\n        x = 1\n        y += 1\n      end\n    end\n  end\n\n  for a in 1:_height\n    for b in 1:_width\n      m.contents[a][b].strength = parse(pop!(splitString))\n      m.contents[a][b].production = _productions[a][b]\n    end\n  end\n\n  m\nend\n\nfunction sendString(toBeSent::String)\n  toBeSent *= \"\\n\"\n\n  write(STDOUT, toBeSent)\n  flush(STDOUT)\nend\n\nfunction getString()\n  rstrip(readline(), '\\n')\nend\n\nfunction getInit()\n  playerTag = parse(getString())\n  deserializeMapSize(getString())\n  deserializeProductions(getString())\n  m = deserializeMap(getString())\n\n  (playerTag, m)\nend\n\nfunction sendInit(name::String)\n  sendString(name)\nend\n\nfunction getFrame()\n  return deserializeMap(getString())\nend\n\nfunction sendFrame(moves::Vector{Move})\n  sendString(serializeMoveSet(moves))\nend\n"
  },
  {
    "path": "airesources/Julia/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"julia MyBot.jl\" \"julia RandomBot.jl\"\n"
  },
  {
    "path": "airesources/Julia/runGame.sh",
    "content": "#!/bin/bash\n\n./halite -d \"30 30\" \"julia MyBot.jl\" \"julia RandomBot.jl\"\n"
  },
  {
    "path": "airesources/OCaml/MyBot.ml",
    "content": "(* OCaml Starter for Halite on Halite.io\n   This code is public domain. There is no warranty.\n *)\n\nopen Td;;\n\nlet random_move state row col =\n  let dir = Halite.direction_of_int (Random.int 5) in\n  let loc = {\n    row = row;\n    col = col;\n  } in\n    {\n      loc = loc;\n      direction = dir;\n    }\n;;\n\nlet random_moves state =\n  let moves = ref [] in\n    Array.iteri (fun ir row -> Array.iteri (fun ic site ->\n      if site.owner = state.my_id then\n        moves := (random_move state ir ic) :: !moves\n    ) row) state.game_map.contents;\n    !moves\n;;\n\nlet mybot_function state =\n  begin try\n   (\n    Halite.get_init state;\n    Halite.send_init \"MyOCamlBot\";\n    while true do\n      Halite.get_frame state;\n      let moves = random_moves state in\n        Halite.send_frame moves\n    done\n   )\n  with exc ->\n   (\n    Debug.debug (Printf.sprintf\n       \"Exception in turn %d :\\n\" state.round);\n    Debug.debug (Printexc.to_string exc);\n    raise exc\n   )\n  end;\n;;\n\nlet run_bot bot =\n  let game_state = Halite.init () in\n    bot game_state\n;;\n\nrun_bot mybot_function\n\n"
  },
  {
    "path": "airesources/OCaml/README.md",
    "content": "Halite OCaml Starter Package\n----------------------------\n\nThis is an OCaml starter package for Halite on halite.io\n\nIt uses lowercase letters and underscores for variable and function names (following the OCaml convention), but otherwise matches the API seen in other starter packages.\n\n"
  },
  {
    "path": "airesources/OCaml/RandomBot.ml",
    "content": "(* OCaml Starter for Halite on Halite.io\n   This code is public domain. There is no warranty.\n *)\n\nopen Td;;\n\nlet random_move state row col =\n  let dir = Halite.direction_of_int (Random.int 5) in\n  let loc = {\n    row = row;\n    col = col;\n  } in\n    {\n      loc = loc;\n      direction = dir;\n    }\n;;\n\nlet random_moves state =\n  let moves = ref [] in\n    Array.iteri (fun ir row -> Array.iteri (fun ic site ->\n      if site.owner = state.my_id then\n        moves := (random_move state ir ic) :: !moves\n    ) row) state.game_map.contents;\n    !moves\n;;\n\nlet mybot_function state =\n  begin try\n   (\n    Halite.get_init state;\n    Halite.send_init \"RandomOCamlBot\";\n    while true do\n      Halite.get_frame state;\n      let moves = random_moves state in\n        Halite.send_frame moves\n    done\n   )\n  with exc ->\n   (\n    Debug.debug (Printf.sprintf\n       \"Exception in turn %d :\\n\" state.round);\n    Debug.debug (Printexc.to_string exc);\n    raise exc\n   )\n  end;\n;;\n\nlet run_bot bot =\n  let game_state = Halite.init () in\n    bot game_state\n;;\n\nrun_bot mybot_function\n\n"
  },
  {
    "path": "airesources/OCaml/debug.ml",
    "content": "(* OCaml Starter for Halite on Halite.io\n   This code is public domain. There is no warranty.\n *)\n\nlet out_chan = open_out \"mybot_err.log\" ;;\n\nlet debug s = \n  output_string out_chan s; \n  flush out_chan\n;;\n\nlet error s = \n  output_string out_chan (\"ERROR: \" ^ s ^ \"\\n\"); \n  flush out_chan\n;;\n\n(* Replace the functions above with these to silence all logging\n\nlet out_chan = stdout;;\n\nlet debug s = () ;;\n\nlet error s = () ;;\n\n*)\n\n"
  },
  {
    "path": "airesources/OCaml/halite.ml",
    "content": "(* OCaml Starter for Halite on Halite.io\n   This code is public domain. There is no warranty.\n *)\n\nopen Td;;\nopen Debug;;\n\n(* Some useful things *)\n\nlet time_first_turn = 15000.0;;\nlet time_per_turn = 1000.0;;\nlet list_directions = [`Still; `North; `East; `South; `West];;\nlet list_cardinals = [`North; `East; `South; `West];;\nlet (array_directions:t_direction array) = \n  [| `Still; `North; `East; `South; `West |]\n;;\nlet (array_cardinals:t_direction array) = [| `North; `East; `South; `West |];;\n\n\n(* Some boolean reference cells to track init status *)\nlet first_turn = ref false;;\nlet init_my_id_done = ref false;;\nlet init_size_done = ref false;;\nlet init_production_done = ref false;;\nlet init_map_done = ref false;;\nlet all_init_done = ref false;;\nlet sent_init = ref false;;\n\nlet get_time () = Unix.gettimeofday ();;\n\n(* input processing *)\n\nlet new_site () = \n {\n  owner = -1;\n  strength = -1;\n  production = -1;\n }\n;;\n\nlet new_blank_game_map width height =\n  let v = Array.make_matrix height width 0 in\n    Array.map (Array.map (fun _ -> new_site())) v\n;;\n\nlet clear_state state =\n  state.game_map.contents <- \n    new_blank_game_map state.game_map.width state.game_map.height;\n  state.round <- 0;\n;;\n\n(* tokenizer from rosetta code *)\nlet split_char sep str =\n  let string_index_from i =\n    try Some (String.index_from str i sep)\n    with Not_found -> None\n  in\n  let rec aux i acc = match string_index_from i with\n    | Some i' ->\n        let w = String.sub str i (i' - i) in\n        aux (succ i') (w::acc)\n    | None ->\n        let w = String.sub str i (String.length str - i) in\n        List.rev (w::acc)\n  in\n  aux 0 []\n;;\n\nlet get_2d_coords state coord =\n  let row = coord / state.game_map.width in\n  let col = coord mod state.game_map.width in\n    row, col\n;;\n\nlet set_owner state coord owner =\n  let row, col = get_2d_coords state coord in\n    state.game_map.contents.(row).(col).owner <- owner\n;;\n\nlet set_strength state coord v =\n  let row, col = get_2d_coords state coord in\n    state.game_map.contents.(row).(col).strength <- v\n;;\n\nlet set_production state coord v =\n  let row, col = get_2d_coords state coord in\n    state.game_map.contents.(row).(col).production <- v\n;;\n\nlet set_owners state start repeat owner =\n  for coord = start to (start + repeat - 1) do\n    set_owner state coord owner\n  done\n;;\n\nlet total_size state = state.game_map.width * state.game_map.height;;\n\nlet deserialize_map state tokens =\n  let count = ref 0 in\n  let repeat = ref 0 in\n  let ready = ref false in\n  let num_sites = total_size state in\n  List.iter (fun token ->\n    if !count < num_sites then (\n      if !ready then (\n        set_owners state !count !repeat (int_of_string token);\n        count := !count + !repeat;\n        ready := false;\n      ) else (\n        repeat := int_of_string token;\n        ready := true;\n      )\n    )\n    else (\n      set_strength state (!count mod num_sites) (int_of_string token);\n      count := !count + 1;\n    )\n  ) tokens\n;;\n\nlet init_production state tokens =\n  List.iteri (fun i s ->\n    set_production state i (int_of_string s)\n  ) tokens\n;;\n\nlet init_size state tokens =\n  match tokens with\n  | w :: h :: [] ->\n    let width = int_of_string w in\n    let height = int_of_string h in\n    state.game_map.width <- width;\n    state.game_map.height <- height;\n    state.max_rounds <- (int_of_float (sqrt (float_of_int(width * height)))) * 10;\n    clear_state state;\n  | _ -> \n    let s = \n      List.fold_left (fun acc t -> acc ^ \" \" ^ t) \" \" tokens \n    in\n    Debug.error (\"incorrect input for init_size \" ^ s ^ \"\\n\")\n;;\n\nlet init_my_id state tokens =\n  match tokens with\n  | id :: [] ->\n    state.my_id <- int_of_string id\n  | _ -> Debug.error (\"incorrect input for init_my_id\\n\")\n;;\n\nlet process_line state line =\n  let tokens = split_char ' ' (String.trim line) in\n    if !all_init_done then (\n      deserialize_map state tokens;\n    ) else if not !init_my_id_done then (\n      init_my_id state tokens;\n      init_my_id_done := true;\n\n    ) else if not !init_size_done then (\n      init_size state tokens;\n      init_size_done := true;\n\n    ) else if not !init_production_done then (\n      init_production state tokens;\n      init_production_done := true;\n\n    ) else if not !init_map_done then (\n      deserialize_map state tokens;\n      init_map_done := true;\n      all_init_done := true;\n    )\n\n    else Debug.error \"Impossible condition: all_init_done not set when all init done\"\n\n;;\n\nlet get_frame state =\n  state.round <- state.round + 1;\n  state.last_update <- get_time();\n  let line = read_line () in\n    process_line state line\n;;\n\nlet read_lines bot state =\n  while true do\n    let line = read_line () in\n      process_line state line;\n  done\n;;\n\nlet get_init state =\n  let finished = ref false in\n  while not !finished do\n    let line = read_line () in\n      process_line state line;\n      if !all_init_done then\n        finished := true\n  done\n;;\n\n(* End input section *)\n\n(* output section *)\n\nlet char_of_dir = function\n| `Still -> '0'\n| `North -> '1'\n| `East -> '2'\n| `South -> '3'\n| `West -> '4'\n;;\n\nlet serialize_move move =\n  Printf.sprintf \"%i %i %c\" move.loc.col move.loc.row (char_of_dir move.direction)\n;;\n\nlet send_frame moves =\n  List.iter (fun move ->\n    Printf.printf \"%s \" (serialize_move move)\n  ) moves;\n  Printf.printf \"\\n\";\n  flush stdout;\n;;\n\nlet send_init name =\n  print_string (name ^ \"\\n\");\n  flush stdout;\n  sent_init := true;\n;;\n\n(* End output section *)\n\n(* Utility functions *)\n\nlet random_from_list lst =\n  let len = List.length lst in\n    List.nth lst (Random.int len)\n;;\n\nlet in_bounds state row col =\n  (row >= 0) && (col >= 0)\n  && \n  (row < state.game_map.height) && (col < state.game_map.width)\n;;\n\nlet get_distance state l1 l2 =\n  let pd_col = abs (l1.col - l2.col) in\n  let pd_row = abs (l1.row - l2.row) in\n  let d_col = \n    if pd_col > state.game_map.width / 2 then state.game_map.width - pd_col else pd_col\n  in\n  let d_row = \n    if pd_row > state.game_map.height / 2 then state.game_map.height - pd_row else pd_row\n  in\n    d_row + d_col\n;;\n\nlet get_angle state l1 l2 =\n  let pd_col = l2.col - l1.col in\n  let pd_row = l2.row - l1.row in\n  let d_col =\n    if pd_col > state.game_map.width - pd_col then pd_col - state.game_map.width\n    else if (-pd_col) > state.game_map.width + pd_col then\n      pd_col + state.game_map.width\n    else pd_col\n  in\n  let d_row =\n    if pd_row > state.game_map.height - pd_row then \n      pd_row - state.game_map.height\n    else if (-pd_row) > state.game_map.height + pd_row then\n      pd_row + state.game_map.height\n    else pd_row\n  in\n    atan2 (float_of_int d_row) (float_of_int d_col)\n;;\n\nlet wrap_loc state loc =\n  let wrap v bound =\n    if v < 0 then bound + v\n    else if v >= bound then v - bound\n    else v\n  in\n  let w_row = wrap loc.row state.game_map.height in\n  let w_col = wrap loc.col state.game_map.width in\n    {row = w_row; col = w_col}\n;;\n\nlet get_location state loc direction =\n  let (o_row, o_col) =\n    match direction with\n    | `Still -> (0, 0)\n    | `North -> (-1, 0)\n    | `East -> (0, 1)\n    | `South -> (1, 0)\n    | `West -> (0, -1)\n  in\n  let row = loc.row + o_row in\n  let col = loc.col + o_col in\n    wrap_loc state {row = row; col = col}\n;;\n\nlet get_site state loc direction =\n  let l = get_location state loc direction in\n    state.game_map.contents.(l.row).(l.col)\n;;\n\nlet time_elapsed_this_turn state =\n  (get_time() -. state.last_update) *. 1000.\n;;\n\nlet time_remaining state =\n  let turntime = if !first_turn then time_first_turn else time_per_turn in\n  (turntime -. time_elapsed_this_turn state)\n;;\n\nlet direction_of_int = function\n| 0 -> `Still\n| 1 -> `North\n| 2 -> `East\n| 3 -> `South\n| 4 -> `West\n| n -> failwith (\"Invalid direction_of_int: \" ^ (string_of_int n) ^ \"\\n\")\n;;\n\nlet debug_block state f =\n  Array.iter (fun row ->\n    Debug.debug \"\\n\";\n    Array.iter (fun site -> \n      Debug.debug (f site)\n    ) row\n  ) state.game_map.contents;\n  Debug.debug \"\\n\"\n;;\n\nlet debug_productions state =\n  debug_block state (fun site -> \n    Printf.sprintf \"%2d\" site.production\n  )\n;;\n\nlet debug_owners state =\n  debug_block state (fun site -> \n    (string_of_int site.owner) ^ \" \"\n  )\n;;\n\nlet debug_strength state =\n  debug_block state (fun site -> \n    Printf.sprintf \"%3d \" site.strength\n  )\n;;\n\nlet debug_game_map state =\n  debug_owners state;\n  debug_strength state;\n  debug_productions state;\n;;\n\n(* End utility *)\n\nlet init () =\n  Random.self_init (); \n  let gmap =\n   {\n    width = (-1);\n    height = (-1);\n    contents = [|[| |]|];\n   }\n  in\n  let state =\n   {\n    my_id = (-1);\n    round = 0;\n    max_rounds = 0;\n    last_update = (-1.0);\n    game_map = gmap;\n   }\n  in\n    state \n;;\n\n\n"
  },
  {
    "path": "airesources/OCaml/runGame.bat",
    "content": "ocamlbuild -lib unix MyBot.native\nocamlbuild -lib unix RandomBot.native\n.\\halite.exe -d \"30 30\" \".\\MyBot.exe\" \".\\RandomBot.exe\"\n\n\n\n"
  },
  {
    "path": "airesources/OCaml/runGame.sh",
    "content": "#!/bin/bash\n\nocamlbuild -lib unix MyBot.native\nocamlbuild -lib unix RandomBot.native\n./halite -d \"30 30\" \"./MyBot.native\" \"./RandomBot.native\"\n"
  },
  {
    "path": "airesources/OCaml/td.ml",
    "content": "(* OCaml Starter for Halite on Halite.io\n   This code is public domain. There is no warranty.\n *)\n\ntype t_direction = [ `Still | `North | `East  | `South | `West ] ;;\n\ntype location = \n {\n  mutable row : int;\n  mutable col : int;\n }\n;;\n\ntype site =\n {\n  mutable owner : int;\n  mutable strength : int;\n  mutable production : int;\n }\n;;\n\ntype move =\n {\n  mutable loc : location;\n  mutable direction : t_direction;\n }\n;;\n\ntype game_map =\n {\n  mutable width : int;\n  mutable height : int;\n  mutable contents : site array array;\n }\n;;\n\ntype game_state =\n {\n  mutable my_id : int;\n  mutable round : int;\n  mutable max_rounds : int;\n  mutable last_update : float;\n  mutable game_map : game_map;\n }\n;;\n\n\n"
  },
  {
    "path": "airesources/PHP/MyBot.php",
    "content": "<?php\n\nrequire_once 'hlt.php';\nrequire_once 'networking.php';\n\nlist($myID, $gameMap) = getInit();\nsendInit('myPHPBot');\n\nwhile (true) {\n    $moves = [];\n    $gameMap = getFrame();\n    for ($y = 0; $y < $gameMap->height; ++$y) {\n        for ($x = 0; $x < $gameMap->width; ++$x) {\n            if ($gameMap->getSite(new Location($x, $y))->owner === $myID) {\n                $moves[] = new Move(new Location($x, $y), rand(0, 4));\n            }\n        }\n    }\n    sendFrame($moves);\n}\n"
  },
  {
    "path": "airesources/PHP/RandomBot.php",
    "content": "<?php\n\nrequire_once 'hlt.php';\nrequire_once 'networking.php';\n\nlist($myID, $gameMap) = getInit();\nsendInit('RandomPHPBot');\n\nwhile (true) {\n    $moves = [];\n    $gameMap = getFrame();\n    for ($y = 0; $y < $gameMap->height; ++$y) {\n        for ($x = 0; $x < $gameMap->width; ++$x) {\n            if ($gameMap->getSite(new Location($x, $y))->owner === $myID) {\n                $moves[] = new Move(new Location($x, $y), rand(0, 4));\n            }\n        }\n    }\n    sendFrame($moves);\n}\n"
  },
  {
    "path": "airesources/PHP/hlt.php",
    "content": "<?php\n\ndefine('STILL', 0);\ndefine('NORTH', 1);\ndefine('EAST', 2);\ndefine('SOUTH', 3);\ndefine('WEST', 4);\n\nconst DIRECTIONS = array(0, 1, 2, 3, 4);\nconst CARDINALS = array(1, 2, 3, 4);\n\ndefine('ATTACK', 0);\ndefine('STOP_ATTACK', 1);\n\nclass Location\n{\n    public $x;\n    public $y;\n\n    public function __construct($x = 0, $y = 0)\n    {\n        $this->x = $x;\n        $this->y = $y;\n    }\n}\n\nclass Site\n{\n    public $owner;\n    public $strength;\n    public $production;\n\n    public function __construct($owner = 0, $strength = 0, $production = 0)\n    {\n        $this->owner = $owner;\n        $this->strength = $strength;\n        $this->production = $production;\n    }\n}\n\nclass Move\n{\n    public $loc;\n    public $direction;\n\n    public function __construct(Location $loc, $direction = STILL)\n    {\n        $this->loc = $loc;\n        $this->direction = $direction;\n    }\n}\n\nclass GameMap\n{\n    public $width;\n    public $height;\n    public $contents;\n\n    public function __construct($width = 0, $height = 0, $numberOfPlayers = 0)\n    {\n        $this->width = $width;\n        $this->height = $height;\n        $this->contents = [];\n\n        for ($y = 0; $y < $this->height; ++$y) {\n            $row = [];\n            for ($x = 0; $x < $this->width; ++$x) {\n                $row[] = new Site(0, 0, 0);\n            }\n            $this->contents[] = $row;\n        }\n    }\n\n    public function inBounds(Location $l)\n    {\n        return $l->x >= 0 && $l->x < $this->width && $l->y >= 0 && $l->y < $this->height;\n    }\n\n    public function getDistance(Location $l1, Location $l2)\n    {\n        $dx = abs($l1->x - $l2->x);\n        $dy = abs($l1->y - $l2->y);\n        if ($dx > $this->width / 2) {\n            $dx = $this->width - $dx;\n        }\n        if ($dy > $this->height / 2) {\n            $dy = $this->height - $dy;\n        }\n        return $dx + $dy;\n    }\n\n    public function getAngle(Location $l1, Location $l2)\n    {\n        $dx = $l2->x - $l1->x;\n        $dy = $l2->y - $l1->y;\n\n        if ($dx > $this->width - $dx) {\n            $dx -= $this->width;\n        } elseif (-$dx > $this->width + $dx) {\n            $dx += $this->width;\n        }\n\n        if ($dy > $this->height - $dy) {\n            $dy -= $this->height;\n        } elseif (-$dy > $this->height + $dy) {\n            $dy += $this->height;\n        }\n        return atan2($dy, $dx);\n    }\n\n    public function getLocation(Location $loc, $direction)\n    {\n        $l = clone $loc;\n        if ($direction !== STILL) {\n            if ($direction === NORTH) {\n                if ($l->y === 0) {\n                    $l->y = $this->height - 1;\n                } else {\n                    $l->y -= 1;\n                }\n            } elseif ($direction === EAST) {\n                if ($l->x === $this->width - 1) {\n                    $l->x = 0;\n                } else {\n                    $l->x += 1;\n                }\n            } elseif ($direction === SOUTH) {\n                if ($l->y === $this->height - 1) {\n                    $l->y = 0;\n                } else {\n                    $l->y += 1;\n                }\n            } elseif ($direction === WEST) {\n                if ($l->x === 0) {\n                    $l->x = $this->width - 1;\n                } else {\n                    $l->x -= 1;\n                }\n            }\n        }\n        return $l;\n    }\n\n    public function getSite(Location $l, $direction = STILL)\n    {\n        $l = $this->getLocation($l, $direction);\n        return $this->contents[$l->y][$l->x];\n    }\n}\n"
  },
  {
    "path": "airesources/PHP/networking.php",
    "content": "<?php\n\n$_productions = [];\n$_width = -1;\n$_height = -1;\n\nfunction serializeMoveSet(array $moves)\n{\n    $returnString = '';\n    foreach ($moves as $move) {\n        $returnString .= $move->loc->x . ' ' . $move->loc->y . ' ' . $move->direction . ' ';\n    }\n    return $returnString;\n}\n\nfunction deserializeMapSize($inputString)\n{\n    global $_width, $_height;\n\n    $splitString = explode(' ', $inputString);\n\n    $_width = (int)array_shift($splitString);\n    $_height = (int)array_shift($splitString);\n}\n\nfunction deserializeProductions($inputString)\n{\n    global $_width, $_height, $_productions;\n\n    $splitString = explode(' ', $inputString);\n\n    for ($a = 0; $a < $_height; ++$a) {\n        $row = [];\n        for ($b = 0; $b < $_width; ++$b) {\n            $row[] = (int)array_shift($splitString);\n        }\n        $_productions[] = $row;\n    }\n}\n\nfunction deserializeMap($inputString)\n{\n    global $_width, $_height, $_productions;\n\n    $splitString = explode(' ', $inputString);\n\n    $m = new GameMap($_width, $_height);\n\n    $y = 0;\n    $x = 0;\n    while ($y !== $m->height) {\n        $counter = (int)array_shift($splitString);\n        $owner = (int)array_shift($splitString);\n        for ($a = 0; $a < $counter; ++$a) {\n            $m->contents[$y][$x]->owner = $owner;\n            $x += 1;\n            if ($x === $m->width) {\n                $x = 0;\n                $y += 1;\n            }\n        }\n    }\n\n    for ($a = 0; $a < $_height; ++$a) {\n        for ($b = 0; $b < $_width; ++$b) {\n            $m->contents[$a][$b]->strength = (int)array_shift($splitString);\n            $m->contents[$a][$b]->production = $_productions[$a][$b];\n        }\n    }\n\n    return $m;\n}\n\nfunction sendString($toBeSent)\n{\n    $toBeSent .= \"\\n\";\n\n    fwrite(STDOUT, $toBeSent);\n}\n\nfunction getString()\n{\n    $input = fgets(STDIN);\n\n    if ($input === false) {\n        exit;\n    }\n\n    return rtrim($input, \"\\n\");\n}\n\n\nfunction getInit()\n{\n    $playerTag = (int)getString();\n    deserializeMapSize(getString());\n    deserializeProductions(getString());\n    $m = deserializeMap(getString());\n\n    return [$playerTag, $m];\n}\n\nfunction sendInit($name)\n{\n    sendString($name);\n}\n\nfunction getFrame()\n{\n    return deserializeMap(getString());\n}\n\nfunction sendFrame(array $moves)\n{\n    sendString(serializeMoveSet($moves));\n}\n"
  },
  {
    "path": "airesources/PHP/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"php MyBot.php\" \"php RandomBot.php\"\n"
  },
  {
    "path": "airesources/PHP/runGame.sh",
    "content": "#!/bin/bash\n\n./halite -d \"30 30\" \"php MyBot.php\" \"php RandomBot.php\"\n"
  },
  {
    "path": "airesources/Python/MyBot.py",
    "content": "import hlt\nfrom hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square\nimport random\n\n\nmyID, game_map = hlt.get_init()\nhlt.send_init(\"MyPythonBot\")\n\nwhile True:\n    game_map.get_frame()\n    moves = [Move(square, random.choice((NORTH, EAST, SOUTH, WEST, STILL))) for square in game_map if square.owner == myID]\n    hlt.send_frame(moves)\n"
  },
  {
    "path": "airesources/Python/RandomBot.py",
    "content": "import hlt\nfrom hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square\nimport random\n\n\nmyID, game_map = hlt.get_init()\nhlt.send_init(\"RandomPythonBot\")\n\nwhile True:\n    game_map.get_frame()\n    moves = [Move(square, random.choice((NORTH, EAST, SOUTH, WEST, STILL))) for square in game_map if square.owner == myID]\n    hlt.send_frame(moves)\n"
  },
  {
    "path": "airesources/Python/hlt.py",
    "content": "import sys\nfrom collections import namedtuple\nfrom itertools import chain, zip_longest\n\n\ndef grouper(iterable, n, fillvalue=None):\n    \"Collect data into fixed-length chunks or blocks\"\n    # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx\"\n    args = [iter(iterable)] * n\n    return zip_longest(*args, fillvalue=fillvalue)\n\n\nNORTH, EAST, SOUTH, WEST, STILL = range(5)\n\n\ndef opposite_cardinal(direction):\n    \"Returns the opposing cardinal direction.\"\n    return (direction + 2) % 4 if direction != STILL else STILL\n\n\nSquare = namedtuple('Square', 'x y owner strength production')\n\n\nMove = namedtuple('Move', 'square direction')\n\n\nclass GameMap:\n    def __init__(self, size_string, production_string, map_string=None):\n        self.width, self.height = tuple(map(int, size_string.split()))\n        self.production = tuple(tuple(map(int, substring)) for substring in grouper(production_string.split(), self.width))\n        self.contents = None\n        self.get_frame(map_string)\n        self.starting_player_count = len(set(square.owner for square in self)) - 1\n\n    def get_frame(self, map_string=None):\n        \"Updates the map information from the latest frame provided by the Halite game environment.\"\n        if map_string is None:\n            map_string = get_string()\n        split_string = map_string.split()\n        owners = list()\n        while len(owners) < self.width * self.height:\n            counter = int(split_string.pop(0))\n            owner = int(split_string.pop(0))\n            owners.extend([owner] * counter)\n        assert len(owners) == self.width * self.height\n        assert len(split_string) == self.width * self.height\n        self.contents = [[Square(x, y, owner, strength, production)\n                          for x, (owner, strength, production)\n                          in enumerate(zip(owner_row, strength_row, production_row))]\n                         for y, (owner_row, strength_row, production_row)\n                         in enumerate(zip(grouper(owners, self.width),\n                                          grouper(map(int, split_string), self.width),\n                                          self.production))]\n\n    def __iter__(self):\n        \"Allows direct iteration over all squares in the GameMap instance.\"\n        return chain.from_iterable(self.contents)\n\n    def neighbors(self, square, n=1, include_self=False):\n        \"Iterable over the n-distance neighbors of a given square.  For single-step neighbors, the enumeration index provides the direction associated with the neighbor.\"\n        assert isinstance(include_self, bool)\n        assert isinstance(n, int) and n > 0\n        if n == 1:\n            combos = ((0, -1), (1, 0), (0, 1), (-1, 0), (0, 0))   # NORTH, EAST, SOUTH, WEST, STILL ... matches indices provided by enumerate(game_map.neighbors(square))\n        else:\n            combos = ((dx, dy) for dy in range(-n, n+1) for dx in range(-n, n+1) if abs(dx) + abs(dy) <= n)\n        return (self.contents[(square.y + dy) % self.height][(square.x + dx) % self.width] for dx, dy in combos if include_self or dx or dy)\n\n    def get_target(self, square, direction):\n        \"Returns a single, one-step neighbor in a given direction.\"\n        dx, dy = ((0, -1), (1, 0), (0, 1), (-1, 0), (0, 0))[direction]\n        return self.contents[(square.y + dy) % self.height][(square.x + dx) % self.width]\n\n    def get_distance(self, sq1, sq2):\n        \"Returns Manhattan distance between two squares.\"\n        dx = min(abs(sq1.x - sq2.x), sq1.x + self.width - sq2.x, sq2.x + self.width - sq1.x)\n        dy = min(abs(sq1.y - sq2.y), sq1.y + self.height - sq2.y, sq2.y + self.height - sq1.y)\n        return dx + dy\n\n#################################################################\n# Functions for communicating with the Halite game environment  #\n#################################################################\n\n\ndef send_string(s):\n    sys.stdout.write(s)\n    sys.stdout.write('\\n')\n    sys.stdout.flush()\n\n\ndef get_string():\n    return sys.stdin.readline().rstrip('\\n')\n\n\ndef get_init():\n    playerID = int(get_string())\n    m = GameMap(get_string(), get_string())\n    return playerID, m\n\n\ndef send_init(name):\n    send_string(name)\n\n\ndef translate_cardinal(direction):\n    \"Translate direction constants used by this Python-based bot framework to that used by the official Halite game environment.\"\n    return (direction + 1) % 5\n\n\ndef send_frame(moves):\n    send_string(' '.join(str(move.square.x) + ' ' + str(move.square.y) + ' ' + str(translate_cardinal(move.direction)) for move in moves))\n"
  },
  {
    "path": "airesources/Python/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"python MyBot.py\" \"python RandomBot.py\"\n"
  },
  {
    "path": "airesources/Python/runGame.sh",
    "content": "#!/bin/bash\n\nif hash python3 2>/dev/null; then\n    ./halite -d \"30 30\" \"python3 MyBot.py\" \"python3 RandomBot.py\"\nelse\n    ./halite -d \"30 30\" \"python MyBot.py\" \"python RandomBot.py\"\nfi\n"
  },
  {
    "path": "airesources/Ruby/MyBot.rb",
    "content": "$:.unshift(File.dirname(__FILE__))\nrequire 'networking'\n\nnetwork = Networking.new(\"RubyBot\")\ntag, map = network.configure\n\nwhile true\n  moves = []\n  map = network.frame\n\n  (0...map.height).each do |y|\n    (0...map.width).each do |x|\n      loc = Location.new(x, y)\n      site = map.site(loc)\n\n      if site.owner == tag\n        moves << Move.new(loc, GameMap::DIRECTIONS.shuffle.first)\n      end\n    end\n  end\n\n  network.send_moves(moves)\nend\n\n"
  },
  {
    "path": "airesources/Ruby/RandomBot.rb",
    "content": "$:.unshift(File.dirname(__FILE__))\nrequire 'networking'\n\nnetwork = Networking.new(\"RandomRubyBot\")\ntag, map = network.configure\n\nwhile true\n  moves = []\n  map = network.frame\n\n  (0...map.height).each do |y|\n    (0...map.width).each do |x|\n      loc = Location.new(x, y)\n      site = map.site(loc)\n\n      if site.owner == tag\n        moves << Move.new(loc, GameMap::DIRECTIONS.shuffle.first)\n      end\n    end\n  end\n\n  network.send_moves(moves)\nend\n\n"
  },
  {
    "path": "airesources/Ruby/game_map.rb",
    "content": "class GameMap\n\n  CARDINALS = [:north, :east, :south, :west]\n  DIRECTIONS = [:still] + CARDINALS\n\n  attr_reader :width, :height\n  attr_reader :content\n\n  def initialize(options = {})\n    @width = options[:width]\n    @height = options[:height]\n    @content = []\n\n    options[:owners].each_with_index do |owner, idx|\n      site = Site.new(owner, options[:strengths][idx], options[:production][idx])\n      y, x = idx.divmod(@width)\n\n      @content[y] ||= []\n      @content[y][x] = site\n    end\n  end\n\n  def site(location, direction = :still)\n    new_location = find_location(location, direction)\n    content[new_location.y][new_location.x]\n  end\n\n  def find_location(location, direction)\n    x, y = location.x, location.y\n\n    case direction\n    when :north\n      y = y == 0 ? height - 1 : y - 1\n    when :east\n      x = x == width - 1 ? 0 : x + 1\n    when :south\n      y = y == height - 1 ? 0 : y + 1\n    when :west\n      x = x == 0 ? width - 1 : x - 1\n    end\n\n    Location.new(x, y)\n  end\n\n  def distance_between(from, to)\n    dx = (from.x - to.x).abs\n    dy = (from.y - to.y).abs\n\n    dx = width - dx if dx > width / 2\n    dy = height - dy if dy > height / 2\n\n    dx + dy\n  end\n\n  def angle_between(from, to)\n    dx = to.x - from.x\n    dy = to.y - from.y\n\n    if dx > width - dx\n      dx -= width\n    elsif -dx > width + dx\n      dx += width\n    end\n\n    if dy > height - dy\n      dy -= height\n    elsif -dy > height + dy\n      dy += height\n    end\n\n    Math.atan2(dy, dx)\n  end\n\n  def in_bounds(loc)\n    loc.x.between?(0, width - 1) && loc.y.between?(0, height - 1)\n  end\n\nend\n"
  },
  {
    "path": "airesources/Ruby/location.rb",
    "content": "class Location\n\n  attr_reader :x, :y\n\n  def initialize(x, y)\n    @x, @y = x, y\n  end\n\nend\n"
  },
  {
    "path": "airesources/Ruby/move.rb",
    "content": "class Move\n\n  attr_reader :location, :direction\n\n  def initialize(location, direction)\n    @location = location\n    @direction = GameMap::DIRECTIONS.index(direction)\n  end\n\n  def to_s\n    [location.x, location.y, direction].join(' ')\n  end\n\nend\n"
  },
  {
    "path": "airesources/Ruby/networking.rb",
    "content": "require 'logger'\n\nrequire 'location'\nrequire 'move'\nrequire 'site'\nrequire 'game_map'\n\nclass Networking\n\n  attr_reader :player_tag\n  attr_reader :width, :height, :size\n  attr_reader :production\n  attr_reader :name\n\n  def initialize(name)\n    # implicit IO flush\n    $stdout.sync = true\n\n    @name = name\n\n    init_player_tag\n    init_map_size\n    init_map_production\n    init_map\n  end\n\n  # getInit/sendInit\n  def configure\n    write_to_output(name)\n    [player_tag, @map]\n  end\n\n  # getFrame\n  def frame\n    init_map\n  end\n\n  # sendMoves\n  def send_moves(moves = [])\n    write_to_output(moves.join(' '))\n  end\n\n  def logger\n    @logger ||= Logger.new(\"bot-#{name}.log\").tap do |l|\n      l.formatter = proc do |severity, datetime, progname, msg|\n        \"#{datetime.strftime(\"%Y-%m-%d %H:%M:%S.%6N\")} - #{severity} - #{msg}\\n\"\n      end\n    end\n  end\n\n  def log(msg, severity = :info)\n    logger.send(severity, msg)\n  end\n\n  private\n\n  def init_player_tag\n    @player_tag = Integer(read_from_input)\n    log(\"player tag: #{@player_tag}\")\n  end\n\n  def init_map_size\n    @width, @height = read_ints_from_input\n    @size = @width * @height\n    log(\"width: #{@width} - height: #{@height} - size: #{@size}\")\n  end\n\n  def init_map_production\n    @production = read_ints_from_input\n  end\n\n  def init_map\n    data = read_ints_from_input\n\n    owners_map = []\n    until owners_map.size == size\n      counter = data.shift\n      owner = data.shift\n      owners_map += [owner] * counter\n    end\n\n    @map = GameMap.new( width: width,\n                        height: height,\n                        owners: owners_map,\n                        strengths: data,\n                        production: production)\n  end\n\n  def read_from_input\n    $stdin.gets.strip\n  end\n\n  def read_ints_from_input\n    read_from_input.split(' ').map { |v| Integer(v) }\n  end\n\n  def write_to_output(data)\n    data = \"#{data.strip}\\n\"\n    log(\"Sending: #{data.inspect}\")\n    $stdout.puts(data)\n  end\n\nend\n"
  },
  {
    "path": "airesources/Ruby/runGame.bat",
    "content": ".\\halite.exe -d \"30 30\" \"ruby MyBot.rb\" \"ruby RandomBot.rb\"\n"
  },
  {
    "path": "airesources/Ruby/runGame.sh",
    "content": "#!/bin/bash\n\n./halite -d \"30 30\" \"ruby MyBot.rb\" \"ruby RandomBot.rb\"\n"
  },
  {
    "path": "airesources/Ruby/site.rb",
    "content": "class Site\n\n  attr_reader :owner, :strength, :production\n\n  def initialize(owner = 0, strength = 0, production = 0)\n    @owner, @strength, @production = owner, strength, production\n  end\n\nend\n"
  },
  {
    "path": "airesources/Rust/Cargo.toml",
    "content": "[package]\nname = \"Rust\"\nversion = \"0.1.0\"\nauthors = [\"Benjamin Spector <benjaminfspector@gmail.com>\"]\n\npublish = false\nvcs = \"None\"\n\n[dependencies]\nrand = \"*\"\ntext_io = \"*\"\n\n[[bin]]\npath = \"src/MyBot.rs\"\nname = \"MyBot\"\n\n[[bin]]\npath = \"src/RandomBot.rs\"\nname = \"RandomBot\"\n"
  },
  {
    "path": "airesources/Rust/runGame.bat",
    "content": "cargo build\n.\\halite.exe -d \"30 30\" \"target/debug/MyBot\" \"target/debug/RandomBot\"\n"
  },
  {
    "path": "airesources/Rust/runGame.sh",
    "content": "#!/bin/bash\n\ncargo build\n./halite -d \"30 30\" \"target/debug/MyBot\" \"target/debug/RandomBot\"\n"
  },
  {
    "path": "airesources/Rust/src/MyBot.rs",
    "content": "#![allow(non_snake_case)]\n#![allow(warnings)]\n\nextern crate rand;\n#[macro_use] extern crate text_io;\n\n//Notice: due to Rust's extreme dislike of (even private!) global mutables, we do not reset the production values of each tile during get_frame.\n//If you change them, you may not be able to recover the actual production values of the map, so we recommend not editing them.\n//However, if your code calls for it, you're welcome to edit the production values of the sites of the map - just do so at your own risk.\n\nmod hlt;\nuse hlt::{ networking, types };\nuse std::collections::HashMap;\nuse rand::Rng;\n\nfn main() {\n    let (my_id, mut game_map) = networking::get_init();\n    let mut rng = rand::thread_rng();\n    networking::send_init(format!(\"{}{}\", \"RustBot\".to_string(), my_id.to_string()));\n    loop {\n        networking::get_frame(&mut game_map);\n        let mut moves = HashMap::new();\n        for a in 0..game_map.height {\n            for b in 0..game_map.width {\n                let l = hlt::types::Location { x: b, y: a };\n                if game_map.get_site(l, types::STILL).owner == my_id {\n                    moves.insert(l, (rng.gen::<u32>() % 5) as u8);\n                }\n            }\n        }\n        networking::send_frame(moves);\n    }\n}\n"
  },
  {
    "path": "airesources/Rust/src/RandomBot.rs",
    "content": "#![allow(non_snake_case)]\n#![allow(warnings)]\n\nextern crate rand;\n#[macro_use] extern crate text_io;\n\n//Notice: due to Rust's extreme dislike of (even private!) global mutables, we do not reset the production values of each tile during get_frame.\n//If you change them, you may not be able to recover the actual production values of the map, so we recommend not editing them.\n//However, if your code calls for it, you're welcome to edit the production values of the sites of the map - just do so at your own risk.\n\nmod hlt;\nuse hlt::{ networking, types };\nuse std::collections::HashMap;\nuse rand::Rng;\n\nfn main() {\n    let (my_id, mut game_map) = networking::get_init();\n    let mut rng = rand::thread_rng();\n    networking::send_init(format!(\"{}{}\", \"RustBot\".to_string(), my_id.to_string()));\n    loop {\n        networking::get_frame(&mut game_map);\n        let mut moves = HashMap::new();\n        for a in 0..game_map.height {\n            for b in 0..game_map.width {\n                let l = hlt::types::Location { x: b, y: a };\n                if game_map.get_site(l, types::STILL).owner == my_id {\n                    moves.insert(l, (rng.gen::<u32>() % 5) as u8);\n                }\n            }\n        }\n        networking::send_frame(moves);\n    }\n}\n"
  },
  {
    "path": "airesources/Rust/src/hlt/mod.rs",
    "content": "#![allow(warnings)]\n\npub mod networking;\npub mod types;\n"
  },
  {
    "path": "airesources/Rust/src/hlt/networking.rs",
    "content": "#![allow(warnings)]\n\nuse hlt::types;\nuse std::io;\nuse std::collections::HashMap;\nuse std::io::Write;\nuse std::str::FromStr;\n\n//Persistant between moves, that way if the user screws up the map it won't persist.\nstatic mut _width: u16 = 0;\nstatic mut _height: u16 = 0;\n\nfn serialize_move_set(moves: HashMap<types::Location, u8>) -> String {\n    let mut s: String = String::new();\n    for (l, d) in moves {\n        s = format!(\"{}{} {} {} \", s, l.x, l.y, d);\n    }\n    s\n}\n\nfn deserialize_map_size(s: String) -> () {\n    let splt: Vec<&str> = s.split(\" \").collect();\n    unsafe {\n        _width = u16::from_str(splt[0]).unwrap();\n        _height = u16::from_str(splt[1]).unwrap();\n    }\n}\n\nfn deserialize_productions(s: String) -> types::GameMap {\n    let splt: Vec<&str> = s.split(\" \").collect();\n    let mut gmp = types::GameMap { width: 0, height: 0, contents: Vec::new() };\n    unsafe {\n        gmp.width = _width;\n        gmp.height= _height;\n    }\n    gmp.contents.resize(gmp.height as usize, Vec::new());\n    let mut loc = 0;\n    for v in &mut gmp.contents {\n        for x in 0..gmp.width {\n            v.push(types::Site { owner: 0, strength: 0, production: u8::from_str(splt[loc]).unwrap() });\n            loc += 1;\n        }\n    }\n    gmp\n}\n\nfn deserialize_map(s: String, gmp: &mut types::GameMap) -> () {\n    let splt: Vec<&str> = s.split(\" \").collect();\n    unsafe {\n        let mut counter = 0;\n        let mut owner = 0;\n        let mut loc: usize = 0;\n        for a in 0.._height {\n            for b in 0.._width {\n                if counter == 0 {\n                    counter = u16::from_str(splt[loc]).unwrap();\n                    loc += 1;\n                    owner = u8::from_str(splt[loc]).unwrap();\n                    loc += 1;\n                }\n                gmp.get_site(types::Location { x: b, y: a }, types::STILL).owner = owner;\n                counter -= 1;\n            }\n        }\n        for a in 0.._height {\n            for b in 0.._width {\n                gmp.get_site(types::Location { x: b, y: a }, types::STILL).strength = u8::from_str(splt[loc]).unwrap();\n                loc += 1;\n            }\n        }\n    }\n}\n\n\nfn send_string(s: String) -> () {\n    println!(\"{}\", s);\n    io::stdout().flush();\n}\n\nfn get_string() -> String {\n    read!(\"{}\\n\")\n}\n\npub fn get_init() -> (u8, types::GameMap) {\n    let playerTag: u8 = u8::from_str(&get_string()).unwrap();\n    deserialize_map_size(get_string());\n    let mut gmp = deserialize_productions(get_string());\n    deserialize_map(get_string(), &mut gmp);\n    (playerTag, gmp)\n}\n\npub fn send_init(name: String) -> () {\n    send_string(name);\n}\n\npub fn get_frame(gmp: &mut types::GameMap) -> () {\n    deserialize_map(get_string(), gmp);\n}\n\npub fn send_frame(moves: HashMap<types::Location, u8>) -> () {\n    send_string(serialize_move_set(moves));\n}\n"
  },
  {
    "path": "airesources/Rust/src/hlt/types.rs",
    "content": "#![allow(warnings)]\n\npub const STILL: u8 = 0;\npub const NORTH: u8 = 1;\npub const EAST: u8 = 2;\npub const SOUTH: u8 = 3;\npub const WEST: u8 = 4;\n\npub const DIRECTIONS: [u8; 5] = [STILL, NORTH, EAST, SOUTH, WEST];\npub const CARDINALS: [u8; 4] = [NORTH, EAST, SOUTH, WEST];\n\n#[derive(Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord, Debug)]\npub struct Location {\n    pub x: u16,\n    pub y: u16,\n}\n\n#[derive(Copy, Clone, Eq, Debug, PartialEq)]\npub struct Site {\n    pub owner: u8,\n    pub strength: u8,\n    pub production: u8,\n}\n\n#[derive(Clone, Debug)]\npub struct GameMap {\n    pub width: u16, //Number of columns.\n    pub height: u16, //Number of rows.\n    pub contents: Vec< Vec<Site> >,\n}\n\nimpl GameMap {\n    pub fn in_bounds(&self, l: Location) -> bool {\n        l.x < self.width && l.y < self.height\n    }\n    pub fn get_distance(&self, l1: Location, l2: Location) -> u16 {\n        let mut dx = (l1.x as i16 - l2.x as i16).abs();\n        let mut dy = (l1.y as i16 - l2.y as i16).abs();\n        if dx > self.width as i16 / 2 { dx = self.width as i16 - dx; }\n        if dy > self.height as i16 / 2 { dy = self.height as i16 - dy; }\n        (dx + dy) as u16\n    }\n    pub fn get_angle(&self, l1: Location, l2: Location) -> f64 {\n        let mut dx = l2.x as i16- l1.x as i16;\n        let mut dy = l2.y as i16 - l1.y as i16;\n        if dx > self.width as i16 - dx { dx -= self.width as i16; }\n        else if-dx > self.width as i16 + dx { dx += self.width as i16; }\n        if dy > self.height as i16 - dy { dy -= self.height as i16; }\n        else if -dy > self.height as i16 + dy { dy += self.height as i16; }\n        (dy as f64).atan2(dx as f64)\n    }\n    pub fn get_location(&self, l: Location, d: u8) -> Location {\n        let mut loc = Location { x: l.x, y: l.y };\n        if d == NORTH {\n            if loc.y == 0 { loc.y = self.height - 1; }\n            else { loc.y -= 1; }\n        } else if d == EAST {\n            if loc.x == self.width - 1 { loc.x = 0; }\n            else { loc.x += 1; }\n        } else if d == SOUTH {\n            if loc.y == self.height - 1 { loc.y = 0; }\n            else { loc.y += 1; }\n        } else if d == WEST {\n            if loc.x == 0 { loc.x = self.width - 1; }\n            else { loc.x -= 1; }\n        }\n        loc\n    }\n    pub fn get_site(&mut self, l: Location, d: u8) -> &mut Site {\n        let loc = self.get_location(l, d);\n        &mut self.contents[loc.y as usize][loc.x as usize]\n    }\n    pub fn get_site_ref(&self, l: Location, d: u8) -> &Site {\n        let loc = self.get_location(l, d);\n        &self.contents[loc.y as usize][loc.x as usize]\n    }\n}\n"
  },
  {
    "path": "airesources/Scala/Bot.scala",
    "content": "trait Bot {\n  def getMoves(grid: Grid): Iterable[Move]\n}\n\ntrait BotFactory {\n  def make(id: Int): Bot\n}\n\n"
  },
  {
    "path": "airesources/Scala/Direction.scala",
    "content": "import scala.util.Random\n\nobject Direction {\n  private val random = new Random()\n  val CARDINALS = Seq(North, East, South, West)\n  val ALL = Seq(Still, North, East, South, West)\n\n  def getRandomDir: Direction = ALL(random.nextInt(5))\n  def getRandomCard: Direction = CARDINALS(random.nextInt(4))\n}\n\nclass Direction(value: Int) {\n  def getValue = value\n}\n\ncase object Still extends Direction(0)\ncase object North extends Direction(1)\ncase object East extends Direction(2)\ncase object South extends Direction(3)\ncase object West extends Direction(4)\n"
  },
  {
    "path": "airesources/Scala/Env.scala",
    "content": "object Env {\n  def readId(): Int = {\n    read().toInt\n  }\n\n  def readInit(): Grid = {\n    val dims = read().split(\" \")\n    val width = dims(0).toInt\n    val height = dims(1).toInt\n\n    val locations = Array.ofDim[Location](height, width)\n    val productions = read().split(\" \")\n\n    for (y <- 0 until height) {\n      for (x <- 0 until width) {\n        locations(y)(x) = Location(x, y, productions(y * width + x).toInt)\n      }\n    }\n\n    val occupants = readFrame(width, height)\n    new Grid(width, height, locations, occupants)\n  }\n\n  def readFrame(width: Int, height: Int): Array[Array[Occupant]] = {\n    val ownersStrengths = read().split(\" \")\n    val strengthsIndex = ownersStrengths.length - width * height\n\n    var y, x, count = 0\n    var owner, cur, i = 0\n\n    val occupants = Array.ofDim[Occupant](height, width)\n    while (y < height) {\n      if (cur < count) {\n        occupants(y)(x) = Occupant(owner, ownersStrengths(strengthsIndex + y * width + x).toInt)\n        if (x == width - 1) {\n          x = 0\n          y += 1\n        } else {\n          x += 1\n        }\n        cur += 1\n      } else {\n        count = ownersStrengths(i).toInt\n        owner = ownersStrengths(i + 1).toInt\n        cur = 0\n        i += 2\n      }\n    }\n\n    occupants\n  }\n\n  def writeFrame(moves: Iterable[Move]): Unit = {\n    val builder = new StringBuilder()\n    moves foreach { m =>\n      builder.append(m.location.x)\n      builder.append(\" \")\n      builder.append(m.location.y)\n      builder.append(\" \")\n      builder.append(m.direction.getValue)\n      builder.append(\" \")\n    }\n    writeString(builder.toString())\n  }\n\n  def writeInit(name: String): Unit = {\n    writeString(name)\n  }\n\n  private def writeString(s: String): Unit = {\n    System.out.print(s + '\\n')\n    System.out.flush()\n  }\n\n  private def read(): String = {\n    val buffer = new StringBuilder()\n    var next = System.in.read()\n    while (next != '\\n' && next != 0) {\n      buffer.append(next.asInstanceOf[Char])\n      next = System.in.read()\n    }\n    buffer.toString\n  }\n}\n"
  },
  {
    "path": "airesources/Scala/Grid.scala",
    "content": "object Grid {\n  val NEUTRAL = 0\n}\n\nclass Grid(width: Int, height: Int, locations: Array[Array[Location]], var occupants: Array[Array[Occupant]]) {\n  def update(occupants: Array[Array[Occupant]]) = this.occupants = occupants\n\n  def getWidth = width\n  def getHeight = height\n\n  def getOccupant(x: Int, y: Int): Occupant = occupants(y)(x)\n  def getLocation(x: Int, y: Int): Location = locations(y)(x)\n  def getSite(x: Int, y: Int): Site = Site(getLocation(x, y), getOccupant(x, y))\n\n  def getSites: Seq[Site] = {\n    for {\n      x <- 0 until width\n      y <- 0 until height\n    } yield getSite(x, y)\n  }\n\n  def getMine(id: Int): Seq[Site] = {\n    for {\n      x <- 0 until width\n      y <- 0 until height\n      if getOccupant(x, y).id == id\n    } yield getSite(x, y)\n  }\n\n  def getDistance(first: Location, second: Location): Int = {\n    var dx = Math.abs(first.x - second.x)\n    var dy = Math.abs(first.y - second.y)\n\n    if (dx > width / 2.0) {\n      dx = width - dx\n    }\n\n    if (dy > height / 2.0) {\n      dy = height - dy\n    }\n\n    dx + dy\n  }\n\n  def getAngle(first: Location, second: Location): Double = {\n    var dx = first.x - second.x\n\n    // Flip order because 0,0 is top left\n    // and want atan2 to look as it would on the unit circle\n    var dy = second.y - first.y\n\n    if (dx > width - dx) {\n      dx -= width\n    }\n    if (-dx > width + dx) {\n      dx += width\n    }\n\n    if (dy > height - dy) {\n      dy -= height\n    }\n    if (-dy > height + dy) {\n      dy += height\n    }\n\n    Math.atan2(dy, dx)\n  }\n\n  def getNeighbor(location: Location, direction: Direction): Neighbor = {\n    val x = location.x\n    val y = location.y\n    direction match {\n      case North => Neighbor(getSite(x, if (y == 0) height - 1 else y - 1), North)\n      case East => Neighbor(getSite(if (x == width - 1) 0 else x + 1, y), East)\n      case South => Neighbor(getSite(x, if (y == height - 1) 0 else y + 1), South)\n      case West => Neighbor(getSite(if (x == 0) width - 1 else x - 1, y), West)\n      case Still => Neighbor(getSite(x, y), Still)\n    }\n  }\n\n  def getNeighbors(location: Location): Seq[Neighbor] = {\n    Direction.CARDINALS map (d => getNeighbor(location, d))\n  }\n\n  def getMyNeighbors(id: Int, location: Location): Seq[Neighbor] = {\n    getNeighbors(location).filter(_.site.occupant.id == id)\n  }\n}\n\ncase class Location(x: Int, y: Int, production: Int)\ncase class Occupant(id: Int, strength: Int)\ncase class Site(location: Location, occupant: Occupant)\ncase class Neighbor(site: Site, direction: Direction)\n"
  },
  {
    "path": "airesources/Scala/Move.scala",
    "content": "case class Move(location: Location, direction: Direction)"
  },
  {
    "path": "airesources/Scala/MyBot.scala",
    "content": "object MyBot extends BotFactory {\n  def main(args: Array[String]): Unit = {\n    Runner.run(\"scalaMyBot\", this)\n  }\n\n  override def make(id: Int): Bot = new MyBot(id)\n}\n\nclass MyBot(myId: Int) extends Bot {\n  override def getMoves(grid: Grid): Iterable[Move] = {\n    for {\n      site <- grid.getMine(myId)\n    } yield Move(site.location, Direction.getRandomDir)\n  }\n}"
  },
  {
    "path": "airesources/Scala/RandomBot.scala",
    "content": "object RandomBot extends BotFactory {\n  def main(args: Array[String]): Unit = {\n    Runner.run(\"scalaRandom\", this)\n  }\n\n  override def make(id: Int): Bot = new RandomBot(id)\n}\n\nclass RandomBot(myId: Int) extends Bot {\n  override def getMoves(grid: Grid): Iterable[Move] = {\n    for {\n      site <- grid.getMine(myId)\n    } yield Move(site.location, Direction.getRandomDir)\n  }\n}"
  },
  {
    "path": "airesources/Scala/Runner.scala",
    "content": "object Runner {\n  def run(name: String, botFactory: BotFactory): Unit = {\n    val id = Env.readId()\n    val grid = Env.readInit()\n\n    val bot = botFactory.make(id)\n    Env.writeInit(name)\n\n    while (true) {\n      val occupants = Env.readFrame(grid.getWidth, grid.getHeight)\n      grid.update(occupants)\n      val moves = bot.getMoves(grid)\n      Env.writeFrame(moves)\n    }\n  }\n}\n"
  },
  {
    "path": "airesources/Scala/runGame.bat",
    "content": "javac *.java\nscalac HaliteBot.scala\nscalac MyBot.scala\nscalac RandomBot.scala\n\n\\halite.exe -d \"30 30\" \"scala MyBot\" \"scala RandomBot\"\n"
  },
  {
    "path": "airesources/Scala/runGame.sh",
    "content": "#!/bin/bash\n\nscalac *.scala\n\n./halite -d \"30 30\" \"scala MyBot\" \"scala RandomBot\"\n"
  },
  {
    "path": "airesources/Sockets/HaliteSocketHelper.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Sockets;\n\n/*\n * Note: For reasons presently unclear this networking package\n * does not appear to be working with the pipe_socket_translator.py\n * also provided. Please see the forums for a temporary workaround\n * while we fix this issue. Thank you.\n */\n\n/// <summary>\n/// Helpful for debugging.\n/// </summary>\npublic static class Log\n{\n    private static string _logPath;\n\n    /// <summary>\n    /// File must exist\n    /// </summary>\n    public static void Setup(string logPath) {\n        _logPath = logPath;\n    }\n\n    public static void Information(string message) {\n        if (!string.IsNullOrEmpty(_logPath))\n            File.AppendAllLines(_logPath, new[] {string.Format(\"{0}: {1}\", DateTime.Now.ToShortTimeString(), message)});\n    }\n    \n    public static void Error(Exception exception) {\n        Log.Information(string.Format(\"ERROR: {0} {1}\", exception.Message, exception.StackTrace));\n    }\n}\n\npublic static class Networking\n{\n    /// Socket input stream.\n    private static StreamReader _streamReader;\n    private static StreamWriter _streamWriter;\n\n    private static string ReadNextLine() {\n        var str = _streamReader.ReadLine();\n        if (str == null) throw new ApplicationException(\"Could not read next line from socket\");\n        return str;\n    }\n\n    private static void SendString(string str) {\n        _streamWriter.WriteLine(str);\n    }\n\n    /// <summary>\n    /// Call once at the start of a game to load the map and player tag from the first four stdin lines.\n    /// </summary>\n    public static Map getInit(out ushort playerTag) {\n        Console.WriteLine(\"Enter the port on which to connect: \");\n        var client = new TcpClient(\"127.0.0.1\", int.Parse(Console.ReadLine()));\n        var networkStream = client.GetStream();\n        _streamReader = new StreamReader(new BufferedStream(networkStream));\n        _streamWriter = new StreamWriter(networkStream) {AutoFlush = true};\n\n        // Line 1: Player tag\n        if (!ushort.TryParse(ReadNextLine(), out playerTag))\n            throw new ApplicationException(\"Could not get player tag from socket during init\");\n\n        // Lines 2-4: Map\n        var map = Map.ParseMap(ReadNextLine(), ReadNextLine(), ReadNextLine());\n        return map;\n    }\n\n    /// <summary>\n    /// Call every frame to update the map to the next one provided by the environment.\n    /// </summary>\n    public static void getFrame(ref Map map) {\n        map.Update(ReadNextLine());\n    }\n\n    /// <summary>\n    /// Call to acknowledge the initail game map and start the game.\n    /// </summary>\n    public static void SendInit(string botName) {\n        SendString(botName);\n    }\n\n    /// <summary>\n    /// Call to send your move orders and complete your turn.\n    /// </summary>\n    public static void SendMoves(IEnumerable<Move> moves) {\n        SendString(Move.MovesToString(moves));\n    }\n}\n\npublic enum Direction\n{\n    Still = 0,\n    North = 1,\n    East = 2,\n    South = 3,\n    West = 4\n}\n\npublic struct Site\n{\n    public ushort Owner { get; internal set; }\n    public ushort Strength { get; internal set; }\n    public ushort Production { get; internal set; }\n}\n\npublic struct Location\n{\n    public ushort X;\n    public ushort Y;\n}\n\npublic struct Move\n{\n    public Location Location;\n    public Direction Direction;\n\n    internal static string MovesToString(IEnumerable<Move> moves) {\n        return string.Join(\" \", moves.Select(m => string.Format(\"{0} {1} {2}\", m.Location.X, m.Location.Y, (int)m.Direction)));\n    }\n}\n\n/// <summary>\n/// State of the game at every turn. Use <see cref=\"GetInitialMap\"/> to get the map for a new game from\n/// stdin, and use <see cref=\"NextTurn\"/> to update the map after orders for a turn have been executed.\n/// </summary>\npublic class Map\n{\n    public void Update(string gameMapStr) {\n        var gameMapValues = new Queue<string>(gameMapStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries));\n\n        ushort x = 0, y = 0;\n        while (y < Height) {\n            ushort counter, owner;\n            if (!ushort.TryParse(gameMapValues.Dequeue(), out counter))\n                throw new ApplicationException(\"Could not get some counter from stdin\");\n            if (!ushort.TryParse(gameMapValues.Dequeue(), out owner))\n                throw new ApplicationException(\"Could not get some owner from stdin\");\n            while (counter > 0) {\n                _sites[x, y] = new Site {Owner = owner};\n                x++;\n                if (x == Width) {\n                    x = 0;\n                    y++;\n                }\n                counter--;\n            }\n        }\n\n        var strengthValues = gameMapValues; // Referencing same queue, but using a name that is more clear\n        for (x = 0; x < Width; x++) {\n            for (y = 0; y < Height; y++) {\n                ushort strength;\n                if (!ushort.TryParse(strengthValues.Dequeue(), out strength))\n                    throw new ApplicationException(\"Could not get some strength value from stdin\");\n                _sites[x, y].Strength = strength;\n            }\n        }\n    }\n\n    /// <summary>\n    /// Get a read-only structure representing the current state of the site at the supplied coordinates.\n    /// </summary>\n    public Site this[ushort x, ushort y] {\n        get {\n            if (x >= Width)\n                throw new IndexOutOfRangeException(string.Format(\"Cannot get site at ({0},{1}) beacuse width is only {2}\", x, y, Width));\n            if (y >= Height)\n                throw new IndexOutOfRangeException(string.Format(\"Cannot get site at ({0},{1}) beacuse height is only {2}\", x, y, Height));\n            return _sites[x, y];\n        }\n    }\n\n    /// <summary>\n    /// Get a read-only structure representing the current state of the site at the supplied location.\n    /// </summary>\n    public Site this[Location location] => this[location.X, location.Y];\n\n    /// <summary>\n    /// Returns the width of the map.\n    /// </summary>\n    public ushort Width => (ushort)_sites.GetLength(0);\n\n    /// <summary>\n    ///  Returns the height of the map.\n    /// </summary>\n    public ushort Height => (ushort)_sites.GetLength(1);\n\n    #region Implementation\n\n    private readonly Site[,] _sites;\n\n    private Map(ushort width, ushort height) {\n        _sites = new Site[width, height];\n        for (ushort x = 0; x < width; x++) {\n            for (ushort y = 0; y < height; y++) {\n                _sites[x, y] = new Site();\n            }\n        }\n    }\n\n    private static Tuple<ushort, ushort> ParseMapSize(string mapSizeStr) {\n        ushort width, height;\n        var parts = mapSizeStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n        if (parts.Length != 2 || !ushort.TryParse(parts[0], out width) || !ushort.TryParse(parts[1], out height))\n            throw new ApplicationException(\"Could not get map size from stdin during init\");\n        return Tuple.Create(width, height);\n    }\n\n    public static Map ParseMap(string mapSizeStr, string productionMapStr, string gameMapStr) {\n        var mapSize = ParseMapSize(mapSizeStr);\n        var map = new Map(mapSize.Item1, mapSize.Item2);\n\n        var productionValues = new Queue<string>(productionMapStr.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries));\n\n        ushort x, y;\n        for (x = 0; x < map.Width; x++) {\n            for (y = 0; y < map.Height; y++) {\n                ushort production;\n                if (!ushort.TryParse(productionValues.Dequeue(), out production))\n                    throw new ApplicationException(\"Could not get some production value from stdin\");\n                map._sites[x, y].Production = production;\n            }\n        }\n\n        map.Update(gameMapStr);\n\n        return map;\n    }\n\n    #endregion\n\n}\n"
  },
  {
    "path": "airesources/Sockets/SocketNetworking.java",
    "content": "import java.net.*;\nimport java.io.*;\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\n\npublic class SocketNetworking {\n    public static final int SIZE_OF_INTEGER_PREFIX = 4;\n    public static final int CHAR_SIZE = 1;\n    private static BufferedReader _in;\n    private static PrintWriter _out;\n    private static int _width, _height;\n    private static ArrayList< ArrayList<Integer> > _productions;\n\n    private static void deserializeGameMapSize(String inputString) {\n        String[] inputStringComponents = inputString.split(\" \");\n\n        _width = Integer.parseInt(inputStringComponents[0]);\n        _height = Integer.parseInt(inputStringComponents[1]);\n    }\n\n\n    private static void deserializeProductions(String inputString) {\n        String[] inputStringComponents = inputString.split(\" \");\n\n        int index = 0;\n        _productions = new ArrayList< ArrayList<Integer> >();\n        for(int a = 0; a < _height; a++) {\n            ArrayList<Integer> row = new ArrayList<Integer>();\n            for(int b = 0; b < _width; b++) {\n                row.add(Integer.parseInt(inputStringComponents[index]));\n                index++;\n            }\n            _productions.add(row);\n        }\n    }\n\n    private static String serializeMoveList(ArrayList<Move> moves) {\n        StringBuilder builder = new StringBuilder();\n        for(Move move : moves) builder.append(move.loc.x + \" \" + move.loc.y + \" \" + move.dir.ordinal() + \" \");\n        return builder.toString();\n    }\n\n    private static GameMap deserializeGameMap(String inputString) {\n        String[] inputStringComponents = inputString.split(\" \");\n\n        GameMap map = new GameMap(_width, _height);\n\n        // Run-length encode of owners\n        int y = 0, x = 0;\n        int counter = 0, owner = 0;\n        int currentIndex = 0;\n        while(y != map.height) {\n            counter = Integer.parseInt(inputStringComponents[currentIndex]);\n            owner = Integer.parseInt(inputStringComponents[currentIndex + 1]);\n            currentIndex += 2;\n            for(int a = 0; a < counter; ++a) {\n                map.contents.get(y).get(x).owner = owner;\n                ++x;\n                if(x == map.width) {\n                    x = 0;\n                    ++y;\n                }\n            }\n        }\n\n        for (int a = 0; a < map.contents.size(); ++a) {\n            for (int b = 0; b < map.contents.get(a).size(); ++b) {\n                int strengthInt = Integer.parseInt(inputStringComponents[currentIndex]);\n                currentIndex++;\n                map.contents.get(a).get(b).strength = strengthInt;\n                map.contents.get(a).get(b).production = _productions.get(a).get(b);\n            }\n        }\n\n        return map;\n    }\n\n    private static void sendString(String sendString) throws java.io.IOException {\n        _out.println(sendString);\n        _out.flush();\n    }\n\n    private static String getString() throws java.io.IOException {\n        return _in.readLine();\n    }\n\n    public static InitPackage getInit() throws java.io.IOException {\n        //Set up connection\n        System.out.print(\"Enter the port on which to connect: \");\n        Scanner in = new Scanner(System.in);\n        int port = in.nextInt();\n        Socket connection = new Socket(\"127.0.0.1\", port);\n        System.out.println(\"Connected to intermediary on port #\" + port);\n        _in = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n        _out = new PrintWriter(connection.getOutputStream(), false);\n\n        InitPackage initPackage = new InitPackage();\n        initPackage.myID = (int)Long.parseLong(getString());\n        deserializeGameMapSize(getString());\n        deserializeProductions(getString());\n        initPackage.map = deserializeGameMap(getString());\n\n        return initPackage;\n    }\n\n    public static void sendInit(String name) throws java.io.IOException {\n        sendString(name);\n    }\n\n    public static GameMap getFrame() throws java.io.IOException {\n        return deserializeGameMap(getString());\n    }\n\n    public static void sendFrame(ArrayList<Move> moves) throws java.io.IOException {\n        sendString(serializeMoveList(moves));\n    }\n\n}\n"
  },
  {
    "path": "airesources/Sockets/pipe_socket_translator.py",
    "content": "import socket\nimport sys\n\n# Connect\nsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nsocket.bind(('localhost', int(sys.argv[1])))\nsocket.listen(1)\nconnection, _ = socket.accept()\n\n# IO Functions\ndef sendStringPipe(toBeSent):\n    sys.stdout.write(toBeSent+'\\n')\n    sys.stdout.flush()\ndef getStringPipe():\n    str =  sys.stdin.readline().rstrip('\\n')\n    return(str)\ndef sendStringSocket(toBeSent):\n    global connection\n    toBeSent += '\\n'\n    connection.sendall(bytes(toBeSent, 'ascii'))\ndef getStringSocket():\n    global connection\n    newString = \"\"\n    buffer = '\\0'\n    while True:\n        buffer = connection.recv(1).decode('ascii')\n        if buffer != '\\n':\n            newString += str(buffer)\n        else:\n            return newString\n\n# Handle Init IO\nsendStringSocket(getStringPipe()) # Player ID\nsendStringSocket(getStringPipe()) # Map Dimensions\nsendStringSocket(getStringPipe()) # Productions\nsendStringSocket(getStringPipe()) # Starting Map\nsendStringPipe(getStringSocket()) # Player Name / Ready Response\n\n# Run Frame Loop\nwhile True:\n    sendStringSocket(getStringPipe()) # Frame Map\n    sendStringPipe(getStringSocket()) # Move List\n"
  },
  {
    "path": "airesources/Sockets/socket_networking.hpp",
    "content": "#ifndef AI_NETWORKING_H\n#define AI_NETWORKING_H\n\n#include <iostream>\n#include <time.h>\n#include <set>\n#include <cfloat>\n#include <fstream>\n#include <string>\n#include <sstream>\n#include <algorithm>\n#include <bitset>\n#include <assert.h>\n\n#ifdef _WIN32\n    #include <sys/types.h>\n    #include <Winsock2.h>\n    #include <Ws2tcpip.h>\n#else\n    #include <sys/socket.h>\n    #include <sys/ioctl.h>\n    #include <arpa/inet.h>\n    #include <unistd.h>\n    #include <time.h>\n    #include <stdio.h>\n    #include <stdlib.h>\n    #include <netdb.h>\n    #include <netinet/in.h>\n    #include <string.h>\n    #include <sys/types.h>\n#endif\n\n#include \"hlt.hpp\"\n\nnamespace detail {\nstatic std::vector< std::vector<unsigned char> > productions;\nstatic int width, height;\n#ifdef _WIN32\nstatic SOCKET connection = INVALID_SOCKET;\n#else\nstatic int connection;\n#endif\n\nstatic std::string serializeMoveSet(const std::set<hlt::Move> &moves) {\n    std::ostringstream oss;\n    for(auto a = moves.begin(); a != moves.end(); ++a) oss << a->loc.x << \" \" << a->loc.y << \" \" << (int)a->dir << \" \";\n    return oss.str();\n}\n\nstatic void deserializeMapSize(const std::string & inputString) {\n    std::stringstream iss(inputString);\n    iss >> width >> height;\n}\n\nstatic void deserializeProductions(const std::string & inputString) {\n    std::stringstream iss(inputString);\n    productions.resize(height);\n    short temp;\n    for(auto a = productions.begin(); a != productions.end(); a++) {\n        a->resize(width);\n        for(auto b = a->begin(); b != a->end(); b++) {\n            iss >> temp;\n            *b = temp;\n        }\n    }\n}\n\nstatic hlt::GameMap deserializeMap(const std::string & inputString) {\n    std::stringstream iss(inputString);\n\n    hlt::GameMap map(width, height);\n\n    //Set productions\n    for(int a = 0; a < map.height; a++) {\n        for(int b = 0; b < map.width; b++) {\n            map.contents[a][b].production = productions[a][b];\n        }\n    }\n\n    //Run-length encode of owners\n    unsigned short y = 0, x = 0;\n    unsigned short counter = 0, owner = 0;\n    while(y != map.height) {\n        for(iss >> counter >> owner; counter; counter--) {\n            map.contents[y][x].owner = owner;\n            x++;\n            if(x == map.width) {\n                x = 0;\n                y++;\n            }\n        }\n    }\n\n    for (int a = 0; a < map.contents.size(); a++) {\n        for (int b = 0; b < map.contents[a].size(); b++) {\n            short strengthShort;\n            iss >> strengthShort;\n            map.contents[a][b].strength = strengthShort;\n        }\n    }\n\n    return map;\n}\nstatic void sendString(std::string & sendString) {\n    sendString.push_back('\\n');\n#ifdef _WIN32\n\tint result = send(connection, sendString.c_str(), sendString.size(), 0);\n\tassert(result != SOCKET_ERROR);\n#else\n    int result = write(connection, sendString.c_str(), sendString.size());\n\tassert(result >= 1); //Should be at least 1, as at least a newline should get written.\n#endif\n    sendString.pop_back(); //Remove newline.\n}\n\nstatic std::string getString() {\n    std::string newString;\n    char buffer = 0;\n    while(buffer != '\\n') {\n#ifdef _WIN32\n\t\tint result = recv(connection, &buffer, 1, 0);\n\t\tassert(result != SOCKET_ERROR);\n#else\n\t\tint result = read(connection, &buffer, 1);\n        assert(result >= 0);\n#endif\n        newString.push_back(buffer);\n    }\n    return newString;\n}\n}\n\nstatic void getInit(unsigned char& playerTag, hlt::GameMap& m) {\n    int port;\n    std::cout << \"Enter the port on which to connect: \";\n    std::cin >> port;\n#ifdef _WIN32\n\tWSADATA wsaData;\n    int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);\n\tassert(iResult == 0); //Confirms that Winsock started up correctly.\n\tstruct addrinfo hints, * result;\n    ZeroMemory(&hints, sizeof(hints));\n    hints.ai_family = AF_UNSPEC;\n    hints.ai_socktype = SOCK_STREAM;\n    hints.ai_protocol = IPPROTO_TCP;\n\tiResult = getaddrinfo(\"127.0.0.1\", std::to_string(port).c_str(), &hints, &result);\n\tassert(iResult == 0); //Confirms that getaddrinfo did not fail.\n\tdetail::connection = socket(result->ai_family, result->ai_socktype, result->ai_protocol); //Creates socket.\n\tassert(detail::connection != INVALID_SOCKET); //Confirms connection is a valid socket.\n\tiResult = connect(detail::connection, result->ai_addr, int(result->ai_addrlen));\n\tassert(iResult != SOCKET_ERROR); //Confirms that there was a successful connection.\n\tfreeaddrinfo(result);\n#else\n    //Connect to port\n    connection = socket(AF_INET, SOCK_STREAM, 0);\n    assert(detail::connection >= 0);\n    struct hostent *server;\n    server = gethostbyname(\"127.0.0.1\");\n    assert(server != NULL);\n    struct sockaddr_in serverAddr;\n    bzero((char *) &serverAddr, sizeof(serverAddr));\n    serverAddr.sin_family = AF_INET;\n    bcopy((char *)server->h_addr, (char *)&serverAddr.sin_addr.s_addr, server->h_length);\n    serverAddr.sin_port = htons(port);\n    assert(connect(detail::connection, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) >= 0);\n#endif\n\tstd::cout << \"Connected to intermediary on port #\" << port << std::endl;\n    playerTag = (unsigned char)std::stoi(detail::getString());\n    detail::deserializeMapSize(detail::getString());\n    detail::deserializeProductions(detail::getString());\n    m = detail::deserializeMap(detail::getString());\n}\n\nstatic void sendInit(std::string name) {\n    detail::sendString(name);\n}\n\nstatic void getFrame(hlt::GameMap& m) {\n    m = detail::deserializeMap(detail::getString());\n}\nstatic void sendFrame(const std::set<hlt::Move> &moves) {\n    std::string serializedMoves = detail::serializeMoveSet(moves);\n    detail::sendString(serializedMoves);\n}\n\n#endif\n"
  },
  {
    "path": "airesources/Sockets/socket_networking.py",
    "content": "from hlt import *\nimport socket\nimport traceback\nimport struct\nfrom ctypes import *\nimport sys\n\n_productions = []\n_width = -1\n_height = -1\n_connection = None\n\ndef serializeMoveSet(moves):\n    returnString = \"\"\n    for move in moves:\n        returnString += str(move.loc.x) + \" \" + str(move.loc.y) + \" \" + str(move.direction) + \" \"\n    return returnString\n\ndef deserializeMapSize(inputString):\n    splitString = inputString.split(\" \")\n\n    global _width, _height\n    _width = int(splitString.pop(0))\n    _height = int(splitString.pop(0))\n\ndef deserializeProductions(inputString):\n    splitString = inputString.split(\" \")\n\n    for a in range(0, _height):\n        row = []\n        for b in range(0, _width):\n            row.append(int(splitString.pop(0)))\n        _productions.append(row)\n\ndef deserializeMap(inputString):\n    splitString = inputString.split(\" \")\n\n    m = GameMap(_width, _height)\n\n    y = 0\n    x = 0\n    counter = 0\n    owner = 0\n    while y != m.height:\n        counter = int(splitString.pop(0))\n        owner = int(splitString.pop(0))\n        for a in range(0, counter):\n            m.contents[y][x].owner = owner\n            x += 1\n            if x == m.width:\n                x = 0\n                y += 1\n\n    for a in range(0, _height):\n        for b in range(0, _width):\n            m.contents[a][b].strength = int(splitString.pop(0))\n            m.contents[a][b].production = _productions[a][b]\n\n    return m\n\ndef sendString(toBeSent):\n    global _connection\n    toBeSent += '\\n'\n    _connection.sendall(bytes(toBeSent, 'ascii'))\n\ndef getString():\n    global _connection\n    newString = \"\"\n    buffer = '\\0'\n    while True:\n        buffer = _connection.recv(1).decode('ascii')\n        if buffer != '\\n':\n            newString += str(buffer)\n        else:\n            return newString\n\ndef getInit():\n    # Connect to environment.\n    global _connection\n    _connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n    port = int(input('Enter the port on which to connect: '))\n    _connection.connect(('localhost', port))\n    print('Connected to intermediary on port #' + str(port))\n\n    playerTag = int(getString())\n    deserializeMapSize(getString())\n    deserializeProductions(getString())\n    m = deserializeMap(getString())\n\n    return (playerTag, m)\n\ndef sendInit(name):\n    sendString(name)\n\ndef getFrame():\n    return deserializeMap(getString())\n\ndef sendFrame(moves):\n    sendString(serializeMoveSet(moves))\n"
  },
  {
    "path": "appveyor.yml",
    "content": "# Specify version format\nversion: \"{build}\"\n\nonly_commits:\n  message: /build/\n\n# Build worker image (VM template)\nimage: Windows Server 2012 R2\n\n# clone directory\nclone_folder: C:\\Halite\n\n# branches to build\nbranches:\n  only:\n    - master\n\n#before_build:\n#  - dir \\s\n\n# scripts that run after cloning repository\nbuild_script:\n  - cd C:\\Halite\\environment\n  - .\\make.bat\n\nartifacts:\n  - path: environment\\halite.exe\n    name: halite.exe\n"
  },
  {
    "path": "environment/Makefile",
    "content": "CXXFLAGS += -std=c++11 -pthread -I ./\nINSTALL_PATH?=/usr/local\nSOURCES=$(shell find . -name \"*.cpp\")\nOBJECTS=$(SOURCES:%.cpp=%.o)\nTARGET=halite\n\n.PHONY: all\nall: $(TARGET)\n\n$(TARGET): $(OBJECTS)\n\t$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@\n\n.PHONY: clean\nclean:\n\trm -f $(TARGET) $(OBJECTS)\n\n.PHONY: install\ninstall:\n\tinstall -m 0755 halite $(INSTALL_PATH)/bin\n"
  },
  {
    "path": "environment/core/Halite.cpp",
    "content": "#include \"Halite.hpp\"\n\n#include \"limits.h\"\n\n#define F_NEWLINE '\\n'\n\n//Private Functions ------------------\n\nstd::vector<bool> Halite::processNextFrame(std::vector<bool> alive) {\n\n    //Update alive frame counts\n    for(unsigned char a = 0; a < number_of_players; a++) if(alive[a]) alive_frame_count[a]++;\n\n    //Create threads to send/receive data to/from players. The threads should return a float of how much time passed between the end of their message being sent and the end of the AI's message being received.\n    std::vector< std::future<int> > frameThreads(std::count(alive.begin(), alive.end(), true));\n    unsigned char threadLocation = 0; //Represents place in frameThreads.\n\n    //Get the messages sent by bots this frame\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        if(alive[a]) {\n            frameThreads[threadLocation] = std::async(&Networking::handleFrameNetworking, &networking, a + 1, turn_number, game_map, ignore_timeout, &player_moves[a]);\n            threadLocation++;\n        }\n    }\n\n    full_player_moves.push_back(std::vector< std::vector<int> >(game_map.map_height, std::vector<int>(game_map.map_width, 0)));\n\n    //Join threads. Figure out if the player responded in an allowable amount of time or if the player has timed out.\n    threadLocation = 0; //Represents place in frameThreads.\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        if(alive[a]) {\n            int time = frameThreads[threadLocation].get();\n            if(time == -1) {\n                networking.killPlayer(a + 1);\n                timeout_tags.insert(a + 1);\n                //Give their pieces to the neutral player.\n                for(unsigned short b = 0; b < game_map.map_height; b++) for(unsigned short c = 0; c < game_map.map_width; c++) if(game_map.contents[b][c].owner == a + 1) game_map.contents[b][c].owner = 0;\n            }\n            else total_frame_response_times[a] += time;\n            threadLocation++;\n        }\n    }\n\n    std::vector< std::map<hlt::Location, unsigned char> > pieces(number_of_players);\n\n    //For each player, use their moves to create the pieces map.\n    for(unsigned char a = 0; a < number_of_players; a++) if(alive[a]) {\n        //Add in pieces according to their moves. Also add in a second piece corresponding to the piece left behind.\n        for(auto b = player_moves[a].begin(); b != player_moves[a].end(); b++) if(game_map.inBounds(b->first) && game_map.getSite(b->first).owner == a + 1) {\n            if(b->second == STILL) {\n                if(game_map.getSite(b->first).strength + game_map.getSite(b->first).production <= 255) game_map.getSite(b->first).strength += game_map.getSite(b->first).production;\n                else game_map.getSite(b->first).strength = 255;\n                //Update full still count\n                full_still_count[a]++;\n                //Add to full production\n                full_production_count[a] += game_map.getSite(b->first).production;\n            }\n            //Update full caridnal count.\n            else full_cardinal_count[a]++;\n\n            //Update moves\n            full_player_moves.back()[b->first.y][b->first.x] = b->second;\n\n            hlt::Location newLoc = game_map.getLocation(b->first, b->second);\n            if(pieces[a].count(newLoc)) {\n                if(short(pieces[a][newLoc]) + game_map.getSite(b->first).strength <= 255) pieces[a][newLoc] += game_map.getSite(b->first).strength;\n                else pieces[a][newLoc] = 255;\n            }\n            else {\n                pieces[a].insert(std::pair<hlt::Location, unsigned char>(newLoc, game_map.getSite(b->first).strength));\n            }\n\n            //Add in a new piece with a strength of 0 if necessary.\n            if(!pieces[a].count(b->first)) {\n                pieces[a].insert(std::pair<hlt::Location, unsigned char>(b->first, 0));\n            }\n\n            //Erase from the game map so that the player can't make another move with the same piece.\n            game_map.getSite(b->first).owner = 0;\n            game_map.getSite(b->first).strength = 0;\n        }\n    }\n\n    //Add in all of the remaining pieces whose moves weren't specified.\n    for(unsigned short a = 0; a < game_map.map_height; a++) for(unsigned short b = 0; b < game_map.map_width; b++) {\n        hlt::Site & s = game_map.contents[a][b];\n        if(s.owner != 0) {\n            hlt::Location l = { b, a };\n            if(short(s.strength) + s.production <= 255) {\n                s.strength += s.production;\n            }\n            else s.strength = 255;\n            if(pieces[s.owner - 1].count(l)) {\n                if(short(pieces[s.owner - 1][l]) + s.strength <= 255) pieces[s.owner - 1][l] += s.strength;\n                else pieces[s.owner - 1][l] = 255;\n            }\n            else {\n                pieces[s.owner - 1].insert(std::pair<hlt::Location, unsigned char>(l, s.strength));\n            }\n            //Add to full production\n            full_production_count[s.owner - 1] += s.production;\n            //Update full still count\n            full_still_count[s.owner - 1]++;\n            //Erase from game map.\n            s.owner = 0;\n            s.strength = 0;\n        }\n    }\n\n    std::vector< std::map<hlt::Location, unsigned short> > toInjure(number_of_players);\n    std::vector< std::vector<unsigned short> > injureMap(game_map.map_height, std::vector<unsigned short>(game_map.map_width, 0));\n\n    //Sweep through locations and find the correct damage for each piece. Start by applying damage within only the active strengths.\n    for(unsigned char a = 0; a != game_map.map_height; a++) for(unsigned short b = 0; b < game_map.map_width; b++) {\n        hlt::Location l = { b, a };\n        for(unsigned short c = 0; c < number_of_players; c++) if(alive[c] && pieces[c].count(l)) {\n            for(unsigned short d = 0; d < number_of_players; d++) if(d != c && alive[d]) {\n                hlt::Location tempLoc = l;\n                //Check 'STILL' square. We also need to deal with the threshold here:\n                if(pieces[d].count(tempLoc)) {\n                    //Apply damage, but not more than they have strength:\n                    if(toInjure[d].count(tempLoc)) toInjure[d][tempLoc] += pieces[c][l];\n                    else toInjure[d].insert(std::pair<hlt::Location, unsigned short>(tempLoc, pieces[c][l]));\n                }\n                //Check 'NORTH' square:\n                tempLoc = game_map.getLocation(l, NORTH);\n                if(pieces[d].count(tempLoc)) {\n                    //Apply damage, but not more than they have strength:\n                    if(toInjure[d].count(tempLoc)) toInjure[d][tempLoc] += pieces[c][l];\n                    else toInjure[d].insert(std::pair<hlt::Location, unsigned short>(tempLoc, pieces[c][l]));\n                }\n                //Check 'EAST' square:\n                tempLoc = game_map.getLocation(l, EAST);\n                if(pieces[d].count(tempLoc)) {\n                    //Apply damage, but not more than they have strength:\n                    if(toInjure[d].count(tempLoc)) toInjure[d][tempLoc] += pieces[c][l];\n                    else toInjure[d].insert(std::pair<hlt::Location, unsigned short>(tempLoc, pieces[c][l]));\n                }\n                //Check 'SOUTH' square:\n                tempLoc = game_map.getLocation(l, SOUTH);\n                if(pieces[d].count(tempLoc)) {\n                    //Apply damage, but not more than they have strength:\n                    if(toInjure[d].count(tempLoc)) toInjure[d][tempLoc] += pieces[c][l];\n                    else toInjure[d].insert(std::pair<hlt::Location, unsigned short>(tempLoc, pieces[c][l]));\n                }\n                //Check 'WEST' square:\n                tempLoc = game_map.getLocation(l, WEST);\n                if(pieces[d].count(tempLoc)) {\n                    //Apply damage, but not more than they have strength:\n                    if(toInjure[d].count(tempLoc)) toInjure[d][tempLoc] += pieces[c][l];\n                    else toInjure[d].insert(std::pair<hlt::Location, unsigned short>(tempLoc, pieces[c][l]));\n                }\n            }\n            if(game_map.getSite(l).strength > 0) {\n                if(toInjure[c].count(l)) toInjure[c][l] += game_map.getSite(l).strength;\n                else toInjure[c].insert(std::pair<hlt::Location, unsigned short>(l, game_map.getSite(l).strength));\n                injureMap[l.y][l.x] += pieces[c][l];\n            }\n        }\n    }\n\n    //Injure and/or delete pieces. Note >= rather than > indicates that pieces with a strength of 0 are killed.\n    for(unsigned char a = 0; a < number_of_players; a++) if(alive[a]) {\n        for(auto b = toInjure[a].begin(); b != toInjure[a].end(); b++) {\n            //Apply damage.\n            if(b->second >= pieces[a][b->first]) pieces[a].erase(b->first);\n            else pieces[a][b->first] -= b->second;\n        }\n    }\n\n    //Apply damage to map pieces.\n    for(int a = 0; a < game_map.map_height; a++) for(int b = 0; b < game_map.map_width; b++) {\n        if(game_map.contents[a][b].strength < injureMap[a][b]) game_map.contents[a][b].strength = 0;\n        else game_map.contents[a][b].strength -= injureMap[a][b];\n        game_map.contents[a][b].owner = 0;\n    }\n\n\n    //Add pieces back into the map.\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        for(auto b = pieces[a].begin(); b != pieces[a].end(); b++) {\n            game_map.getSite(b->first).owner = a + 1;\n            game_map.getSite(b->first).strength = b->second;\n        }\n    }\n\n    //Add to full game:\n    full_frames.push_back(hlt::Map(game_map));\n\n    //Check if the game is over:\n    std::vector<bool> stillAlive(number_of_players, false);\n\n    for(auto a = last_territory_count.begin(); a != last_territory_count.end(); a++) *a = 0;\n    for(unsigned short a = 0; a < game_map.map_height; a++) for(unsigned short b = 0; b < game_map.map_width; b++) if(game_map.contents[a][b].owner != 0) {\n        last_territory_count[game_map.contents[a][b].owner - 1]++;\n        full_territory_count[game_map.contents[a][b].owner - 1]++;\n        full_strength_count[game_map.contents[a][b].owner - 1] += game_map.contents[a][b].strength;\n        full_production_count[game_map.contents[a][b].owner - 1] += game_map.contents[a][b].strength;\n\n        stillAlive[game_map.contents[a][b].owner - 1] = true;\n    }\n\n    return stillAlive;\n}\n\n//Public Functions -------------------\nHalite::Halite(unsigned short width_, unsigned short height_, unsigned int seed_, unsigned short n_players_for_map_creation, Networking networking_, bool shouldIgnoreTimeout) {\n    networking = networking_;\n    // number_of_players is the number of active bots to start the match; it is constant throughout game\n    number_of_players = networking.numberOfPlayers();\n\n    //Initialize map\n    game_map = hlt::Map(width_, height_, n_players_for_map_creation, seed_);\n\n    //If this is single-player mode, remove all the extra players (they were automatically inserted in map, just 0 them out)\n    if (number_of_players == 1){\n        for(unsigned short b = 0; b < game_map.map_height; b++) for(unsigned short c = 0; c < game_map.map_width; c++) if(game_map.contents[b][c].owner > 1) game_map.contents[b][c].owner = 0;\n    }\n\n    //Default initialize\n    player_moves = std::vector< std::map<hlt::Location, unsigned char> >();\n    turn_number = 0;\n    player_names = std::vector< std::string >(number_of_players);\n\n    //Add to full game:\n    full_frames.push_back(hlt::Map(game_map));\n\n    //Initialize player moves vector\n    player_moves.resize(number_of_players);\n\n    //Check if timeout should be ignored.\n    ignore_timeout = shouldIgnoreTimeout;\n\n    //Init statistics\n    productive_squares_remaining = 1;   // just more than zero to get through the game_loop the first time\n    alive_frame_count = std::vector<unsigned short>(number_of_players, 1);\n    last_territory_count = std::vector<unsigned int>(number_of_players, 1);\n    full_territory_count = std::vector<unsigned int>(number_of_players, 1);\n    full_strength_count = std::vector<unsigned int>(number_of_players, 255);\n    full_production_count = std::vector<unsigned int>(number_of_players);\n    full_still_count = std::vector<unsigned int>(number_of_players);\n    full_cardinal_count = std::vector<unsigned int>(number_of_players);\n    init_response_times = std::vector<unsigned int>(number_of_players);\n    total_frame_response_times = std::vector<unsigned int>(number_of_players);\n    timeout_tags = std::set<unsigned short>();\n}\n\nvoid Halite::output(std::string filename) {\n    std::ofstream gameFile;\n    gameFile.open(filename, std::ios_base::binary);\n    if(!gameFile.is_open()) throw std::runtime_error(\"Could not open file for replay\");\n\n    nlohmann::json j;\n\n    //This is version 11.\n    j[\"version\"] = 11;\n\n    //Encode some details about the game that will make it convenient to parse.\n    j[\"width\"] = game_map.map_width;\n    j[\"height\"] = game_map.map_height;\n    j[\"num_players\"] = player_names.size();\n    j[\"num_frames\"] = full_frames.size();\n\n    //Encode player names.\n    j[\"player_names\"] = nlohmann::json(player_names);\n\n    //Encode the production map.\n    std::vector< std::vector<int> > productions(game_map.map_height, std::vector<int>(game_map.map_width));\n    for(int a = 0; a < game_map.map_height; a++) {\n        for(int b = 0; b < game_map.map_width; b++) {\n            productions[a][b] = (game_map.contents[a][b].production);\n        }\n    }\n    j[\"productions\"] = nlohmann::json(productions);\n\n    //Encode the frames. Note that there is no moves field for the last frame.\n    std::vector< std::vector< std::vector< std::vector<int> > > > frames;\n    std::vector< std::vector< std::vector<int> > > moves;\n    frames.reserve(full_frames.size());\n    moves.reserve(full_frames.size() - 1);\n    for(int a = 0; a < full_frames.size(); a++) {\n        std::vector< std::vector< std::vector<int> > > frame(game_map.map_height, std::vector< std::vector<int> >(game_map.map_width));\n        for(int b = 0; b < game_map.map_height; b++) {\n            for(int c = 0; c < game_map.map_width; c++) {\n                frame[b][c].push_back(full_frames[a].contents[b][c].owner);\n                frame[b][c].push_back(full_frames[a].contents[b][c].strength);\n            }\n        }\n        frames.push_back(frame);\n    }\n    for(int a = 0; a < full_frames.size() - 1; a++) {\n        std::vector< std::vector<int> > move_frame(game_map.map_height, std::vector<int>(game_map.map_width));\n        for(int b = 0; b < game_map.map_height; b++) {\n            for(int c = 0; c < game_map.map_width; c++) {\n                move_frame[b][c] = full_player_moves[a][b][c];\n            }\n        }\n        moves.push_back(move_frame);\n    }\n    j[\"frames\"] = nlohmann::json(frames);\n    j[\"moves\"] = nlohmann::json(moves);\n\n    gameFile << j;\n\n    gameFile.flush();\n    gameFile.close();\n}\n\nGameStatistics Halite::runGame(std::vector<std::string> * names_, unsigned int seed, unsigned int id, bool enabledReplay, std::string replayDirectory) {\n    //For rankings\n    std::vector<bool> result(number_of_players, true);\n    std::vector<unsigned char> rankings;\n    //Send initial package\n    std::vector< std::future<int> > initThreads(number_of_players);\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        initThreads[a] = std::async(&Networking::handleInitNetworking, &networking, static_cast<unsigned char>(a + 1), game_map, ignore_timeout, &player_names[a]);\n    }\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        int time = initThreads[a].get();\n        if(time == -1) {\n            networking.killPlayer(a + 1);\n            timeout_tags.insert(a + 1);\n            result[a] = false;\n            rankings.push_back(a);\n            for(unsigned short b = 0; b < game_map.map_height; b++) for(unsigned short c = 0; c < game_map.map_width; c++) if(game_map.contents[b][c].owner == a + 1) game_map.contents[b][c].owner = 0;\n        }\n        else init_response_times[a] = time;\n    }\n    //Override player names with the provided ones if appropriate.\n    if(names_ != NULL) {\n        player_names.clear();\n        for(auto a = names_->begin(); a != names_->end(); a++) player_names.push_back(a->substr(0, 30));\n    }\n    const int maxTurnNumber = sqrt(game_map.map_width * game_map.map_height) * 10;\n    while(turn_number < maxTurnNumber && (std::count(result.begin(), result.end(), true) > 1 || (number_of_players == 1 && productive_squares_remaining > 0))) {\n        //Increment turn number:\n        turn_number++;\n        if(!quiet_output) std::cout << \"Turn \" << turn_number << \"\\n\";\n        //Frame logic.\n        std::vector<bool> newResult = processNextFrame(result);\n        //Add to vector of players that should be dead.\n        std::vector<unsigned int> newRankings;\n        for(unsigned char a = 0; a < number_of_players; a++) if(result[a] && !newResult[a]) {\n            newRankings.push_back(a);\n        }\n        //Sort newRankings by last territory count. If it's the same, use the territory integral instead to break that tie.\n        std::stable_sort(newRankings.begin(), newRankings.end(), [&](const unsigned int & u1, const unsigned int & u2) -> bool {\n            if(last_territory_count[u1] == last_territory_count[u2]) return full_territory_count[u1] < full_territory_count[u2];\n            return last_territory_count[u1] < last_territory_count[u2];\n        });\n        for(auto a = newRankings.begin(); a != newRankings.end(); a++) rankings.push_back(*a);\n\n        //Count productive squares remaining for Halite single-player game\n        productive_squares_remaining = 0;\n        for(unsigned short b = 0; b < game_map.map_height; b++) for(unsigned short c = 0; c < game_map.map_width; c++) if(game_map.contents[b][c].owner == 0 && game_map.contents[b][c].production > 0) productive_squares_remaining++;\n        result = newResult;\n    }\n    std::vector<unsigned int> newRankings;\n    for(int a = 0; a < number_of_players; a++) if(result[a]) newRankings.push_back(a);\n    //Sort newRankings by last territory count. If it's the same, use the territory integral instead to break that tie.\n    std::stable_sort(newRankings.begin(), newRankings.end(), [&](const unsigned int & u1, const unsigned int & u2) -> bool {\n        if(last_territory_count[u1] == last_territory_count[u2]) return full_territory_count[u1] < full_territory_count[u2];\n        return last_territory_count[u1] < last_territory_count[u2];\n    });\n    for(auto a = newRankings.begin(); a != newRankings.end(); a++) rankings.push_back(*a);\n    std::reverse(rankings.begin(), rankings.end()); //Best player first rather than last.\n    GameStatistics stats;\n    int chunkSize = game_map.map_width * game_map.map_height / number_of_players;\n    for(unsigned char a = 0; a < number_of_players; a++) {\n        PlayerStatistics p;\n        p.tag = a + 1;\n        p.rank = std::distance(rankings.begin(), std::find(rankings.begin(), rankings.end(), a)) + 1;\n        // alive_frame_count counts frames, but the frames are 0-base indexed (at least in the visualizer), so everyone needs -1 to find the frame # where last_alive\n        // however, the first place player and 2nd place player always have the same reported alive_frame_count (not sure why)\n        // it turns out to make \"last_frame_alive\" match what is seen in replayer, we have to -2 from all but finishers who are alive in last frame of game who only need -1\n        p.last_frame_alive = alive_frame_count[a] - 2 + result[a];\n        p.average_territory_count = full_territory_count[a] / double(chunkSize * alive_frame_count[a]);\n        p.average_strength_count = full_strength_count[a] / double(chunkSize * alive_frame_count[a]);\n        p.average_production_count = alive_frame_count[a] > 1 ? full_production_count[a] / double(chunkSize * (alive_frame_count[a] - 1)) : 0; //For this, we want turns rather than frames.\n        p.still_percentage = full_cardinal_count[a] + full_still_count[a] > 0 ? full_still_count[a] / double(full_cardinal_count[a] + full_still_count[a]) : 0;\n        p.init_response_time = init_response_times[a];\n        p.average_frame_response_time = total_frame_response_times[a] / double(alive_frame_count[a]); //In milliseconds.\n        stats.player_statistics.push_back(p);\n    }\n    stats.timeout_tags = timeout_tags;\n    stats.timeout_log_filenames = std::vector<std::string>(timeout_tags.size());\n    //Output gamefile. First try the replays folder; if that fails, just use the straight filename.\n    if (enabledReplay) {\n      stats.output_filename = replayDirectory + \"Replays/\" + std::to_string(id) + '-' + std::to_string(seed) + \".hlt\";\n      try {\n\toutput(stats.output_filename);\n      }\n      catch(std::runtime_error & e) {\n\tstats.output_filename = replayDirectory + std::to_string(id) + '-' + std::to_string(seed) + \".hlt\";\n\toutput(stats.output_filename);\n      }\n      if(!quiet_output) std::cout << \"Map seed was \" << seed << std::endl << \"Opening a file at \" << stats.output_filename << std::endl;\n      else std::cout << stats.output_filename << ' ' << seed << std::endl;\n    }\n    //Output logs for players that timed out or errored.\n    int timeoutIndex = 0;\n    for(auto a = timeout_tags.begin(); a != timeout_tags.end(); a++) {\n        stats.timeout_log_filenames[timeoutIndex] = std::to_string(*a) + '-' + std::to_string(id) + \".log\";\n        std::ofstream file(stats.timeout_log_filenames[timeoutIndex], std::ios_base::binary);\n        file << networking.player_logs[*a - 1];\n        file.flush();\n        file.close();\n        timeoutIndex++;\n    }\n    return stats;\n}\n\nstd::string Halite::getName(unsigned char playerTag) {\n    return player_names[playerTag - 1];\n}\n\nHalite::~Halite() {\n    //Get rid of dynamically allocated memory:\n    for(int a = 0; a < number_of_players; a++) networking.killPlayer(a+1);\n}\n"
  },
  {
    "path": "environment/core/Halite.hpp",
    "content": "#ifndef HALITE_H\n#define HALITE_H\n\n#include <fstream>\n#include <string>\n#include <map>\n#include <set>\n#include <algorithm>\n#include <iostream>\n#include <thread>\n#include <future>\n\n#include \"hlt.hpp\"\n#include \"json.hpp\"\n#include \"../networking/Networking.hpp\"\n\nextern bool quiet_output;\n\nstruct PlayerStatistics {\n    int tag;\n    int rank;\n    int last_frame_alive;\n    double average_territory_count;\n    double average_strength_count;\n    double average_production_count;\n    double still_percentage;\n    int init_response_time;\n    double average_frame_response_time;\n};\nstatic std::ostream & operator<<(std::ostream & o, const PlayerStatistics & p) {\n    o << p.tag << ' ' << p.rank << ' ' << p.last_frame_alive;// << ' ' << p.average_territory_count << ' ' << p.average_strength_count << ' ' << p.average_production_count << ' ' << p.still_percentage << ' ' << p.average_response_time;\n    return o;\n}\n\nstruct GameStatistics {\n    std::vector<PlayerStatistics> player_statistics;\n    std::string output_filename;\n    std::set<unsigned short> timeout_tags;\n    std::vector<std::string> timeout_log_filenames;\n};\nstatic std::ostream & operator<<(std::ostream & o, const GameStatistics & g) {\n    for(auto a = g.player_statistics.begin(); a != g.player_statistics.end(); a++) o << (*a) << std::endl;\n    for(auto a = g.timeout_tags.begin(); a != g.timeout_tags.end(); a++) o << (*a) << ' ';\n    if(g.timeout_tags.empty()) o << ' ';\n    std::cout << std::endl;\n    for(auto a = g.timeout_log_filenames.begin(); a != g.timeout_log_filenames.end(); a++) o << (*a) << ' ';\n    if(g.timeout_log_filenames.empty()) o << ' ';\n    return o;\n}\n\nclass Halite {\nprivate:\n    //Networking\n    Networking networking;\n\n    //Game state\n    unsigned short turn_number;\n    unsigned short number_of_players;\n    unsigned short productive_squares_remaining;\n    unsigned short n_players_for_map_creation;\n    bool ignore_timeout;\n    hlt::Map game_map;\n    std::vector<std::string> player_names;\n    std::vector< std::map<hlt::Location, unsigned char> > player_moves;\n\n    //Statistics\n    std::vector<unsigned short> alive_frame_count;\n    std::vector<unsigned int> last_territory_count;\n    std::vector<unsigned int> full_territory_count;\n    std::vector<unsigned int> full_strength_count;\n    std::vector<unsigned int> full_production_count;\n    std::vector<unsigned int> full_still_count;\n    std::vector<unsigned int> full_cardinal_count;\n    std::vector<unsigned int> init_response_times;\n    std::vector<unsigned int> total_frame_response_times;\n    std::set<unsigned short> timeout_tags;\n\n    //Full game\n    std::vector<hlt::Map> full_frames; //All the maps!\n    std::vector< std::vector< std::vector<int> > > full_player_moves; //Each inner 2d array represents the moves across the map for the corresponding frame\n                                                                      //and is guaranteed to have an outer size of map_height and an inner size of map_width\n\n    std::vector<bool> processNextFrame(std::vector<bool> alive);\n    void output(std::string filename);\npublic:\n    Halite(unsigned short width_, unsigned short height_, unsigned int seed_, unsigned short n_players_for_map_creation, Networking networking_, bool shouldIgnoreTimeout);\n\n  GameStatistics runGame(std::vector<std::string> * names_, unsigned int seed, unsigned int id, bool enabledReplay, std::string replayDirectory);\n    std::string getName(unsigned char playerTag);\n\n    ~Halite();\n};\n\n#endif\n"
  },
  {
    "path": "environment/core/hlt.hpp",
    "content": "#pragma once\n\n#include <list>\n#include <vector>\n#include <random>\n#include <functional>\n#include <iostream>\n#include <fstream>\n#include <assert.h>\n\n#define STILL 0\n#define NORTH 1\n#define EAST 2\n#define SOUTH 3\n#define WEST 4\n\nextern bool quiet_output;\n\nstruct Color {\n    float r, g, b;\n};\n\nnamespace hlt{\n    struct Location{\n        unsigned short x, y;\n    };\n    static bool operator<(const Location & l1, const Location & l2) {\n        return ((l1.x + l1.y)*((unsigned int)l1.x + l1.y + 1) / 2) + l1.y < ((l2.x + l2.y)*((unsigned int)l2.x + l2.y + 1) / 2) + l2.y;\n    }\n    static bool operator==(const Location & l1, const Location & l2) {\n        return l1.x == l2.x && l1.y == l2.y;\n    }\n\n    struct Site {\n        unsigned char owner;\n        unsigned char strength;\n        unsigned char production;\n    };\n\n    class Map{\n    public:\n        std::vector< std::vector<Site> > contents;\n        unsigned short map_width, map_height; //Number of rows and columns, NOT maximum index.\n\n        Map() {\n            map_width = 0;\n            map_height = 0;\n            contents = std::vector< std::vector<Site> >(map_height, std::vector<Site>(map_width, { 0, 0 }));\n        }\n        Map(const Map &otherMap) {\n            map_width = otherMap.map_width;\n            map_height = otherMap.map_height;\n            contents = otherMap.contents;\n        }\n        Map(short width, short height, unsigned char numberOfPlayers, unsigned int seed) {\n            //Pseudorandom number generator.\n            std::mt19937 prg(seed);\n            std::uniform_real_distribution<double> urd(0.0, 1.0);\n\n            //Decides whether to put more players along the horizontal or the vertical.\n            bool preferHorizontal = prg() % 2;\n\n            int dw, dh;\n            //Find number closest to square that makes the match symmetric.\n            if(preferHorizontal) {\n                dh = sqrt(numberOfPlayers);\n                while(numberOfPlayers % dh != 0) dh--;\n                dw = numberOfPlayers / dh;\n            }\n            else {\n                dw = sqrt(numberOfPlayers);\n                while(numberOfPlayers % dw != 0) dw--;\n                dh = numberOfPlayers / dw;\n            }\n\n            //Figure out chunk width and height accordingly.\n            //Matches width and height as closely as it can, but is not guaranteed to match exactly.\n            //It is guaranteed to be smaller if not the same size, however.\n            int cw = width / dw;\n            int ch = height / dh;\n\n            //Ensure that we'll be able to move the tesselation by a uniform amount.\n            if(preferHorizontal) while(ch % numberOfPlayers != 0) ch--;\n            else while(cw % numberOfPlayers != 0) cw--;\n\n            map_width = cw * dw;\n            map_height = ch * dh;\n\n            const std::function<double()> rud = [&]() -> double { return urd(prg); };\n\n            class Region {\n            private:\n                double factor;\n            public:\n                std::vector< std::vector<Region * > > children; //Tries to make it 4x4.\n                Region(int _w, int _h, const std::function<double()> & _rud) {\n                    factor = pow(_rud(), 1.5);\n                    children.clear();\n                    const int CHUNK_SIZE = 4;\n                    if(_w == 1 && _h == 1) return;\n                    int cw = _w / CHUNK_SIZE, ch = _h / CHUNK_SIZE;\n                    int difW = _w - CHUNK_SIZE * cw, difH = _h - CHUNK_SIZE * ch;\n                    for(int a = 0; a < CHUNK_SIZE; a++) {\n                        int tch = a < difH ? ch + 1 : ch;\n                        if(tch > 0) {\n                            children.push_back(std::vector<Region * >());\n                            for(int b = 0; b < CHUNK_SIZE; b++) {\n                                int tcw = b < difW ? cw + 1 : cw;\n                                if(tcw > 0) {\n                                    children.back().push_back(new Region(tcw, tch, _rud));\n                                }\n                            }\n                        }\n                    }\n                    const double OWN_WEIGHT = 0.75;\n                    for(int z = 0; z < 1; z++) { //1 iterations found by experiment.\n                        std::vector< std::vector<double> > blurredFactors(children.size(), std::vector<double>(children.front().size(), 0));\n                        for(int a = 0; a < children.size(); a++) {\n                            int mh = a - 1, ph = a + 1;\n                            if(mh < 0) mh += children.size();\n                            if(ph == children.size()) ph = 0;\n                            for(int b = 0; b < children.front().size(); b++) {\n                                int mw = b - 1, pw = b + 1;\n                                if(mw < 0) mw += children.front().size();\n                                if(pw == children.front().size()) pw = 0;\n                                blurredFactors[a][b] += children[a][b]->factor * OWN_WEIGHT;\n                                blurredFactors[a][b] += children[mh][b]->factor * (1 - OWN_WEIGHT) / 4;\n                                blurredFactors[a][b] += children[ph][b]->factor * (1 - OWN_WEIGHT) / 4;\n                                blurredFactors[a][b] += children[a][mw]->factor * (1 - OWN_WEIGHT) / 4;\n                                blurredFactors[a][b] += children[a][pw]->factor * (1 - OWN_WEIGHT) / 4;\n                            }\n                        }\n                         for(int a = 0; a < children.size(); a++) for(int b = 0; b < children.front().size(); b++) children[a][b]->factor = blurredFactors[a][b]; //Set factors.\n                    }\n                }\n                std::vector< std::vector<double> > getFactors() {\n                    if(children.size() == 0) return std::vector< std::vector<double> >(1, std::vector<double>(1, factor));\n                    std::vector< std::vector< std::vector< std::vector<double> > > > childrenFactors(children.size(), std::vector< std::vector< std::vector<double> > >(children.front().size()));\n                    for(int a = 0; a < children.size(); a++) {\n                        for(int b = 0; b < children.front().size(); b++) {\n                            childrenFactors[a][b] = children[a][b]->getFactors();\n                        }\n                    }\n                    int width = 0, height = 0;\n                    for(int a = 0; a < children.size(); a++) height += childrenFactors[a].front().size();\n                    for(int b = 0; b < children.front().size(); b++) width += childrenFactors.front()[b].front().size();\n                    std::vector< std::vector<double> > factors(height, std::vector<double>(width));\n                    int x = 0, y = 0;\n                    for(int my = 0; my < children.size(); my++) {\n                        for(int iy = 0; iy < childrenFactors[my].front().size(); iy++) {\n                            for(int mx = 0; mx < children.front().size(); mx++) {\n                                for(int ix = 0; ix < childrenFactors.front()[mx].front().size(); ix++) {\n                                    factors[y][x] = childrenFactors[my][mx][iy][ix] * factor;\n                                    x++;\n                                }\n                            }\n                            y++;\n                            x = 0;\n                        }\n                    }\n                    return factors;\n                }\n                ~Region() { for(auto a = children.begin(); a != children.end(); a++) for(auto b = a->begin(); b != a->end(); b++) delete *b; }\n            };\n\n            Region prodRegion(cw, ch, rud);\n            std::vector< std::vector<double> > prodChunk = prodRegion.getFactors();\n\n            Region strengthRegion(cw, ch, rud);\n            std::vector< std::vector<double> > strengthChunk = strengthRegion.getFactors();\n\n            struct SiteD {\n                unsigned char owner;\n                double strength;\n                double production;\n            };\n\n            //We'll first tesselate the map; we'll apply our various translations and transformations later.\n            std::vector< std::vector<SiteD> > tesselation = std::vector< std::vector<SiteD> >(map_height, std::vector<SiteD>(map_width, { 0, 0, 0 }));\n            for(int a = 0; a < dh; a++) {\n                for(int b = 0; b < dw; b++) {\n                    for(int c = 0; c < ch; c++) {\n                        for(int d = 0; d < cw; d++) {\n                            tesselation[a * ch + c][b * cw + d].production = prodChunk[c][d];\n                            tesselation[a * ch + c][b * cw + d].strength = strengthChunk[c][d];\n                        }\n                    }\n                    tesselation[a * ch + ch / 2][b * cw + cw / 2].owner = a * dw + b + 1; //Set owners.\n                }\n            }\n\n            //We'll now apply the reflections to the map.\n            bool reflectVertical = dh % 2 == 0, reflectHorizontal = dw % 2 == 0; //Am I going to reflect in the horizontal vertical directions at all?\n            std::vector< std::vector<SiteD> > reflections = std::vector< std::vector<SiteD> >(map_height, std::vector<SiteD>(map_width, { 0, 0, 0 }));\n            for(int a = 0; a < dh; a++) {\n                for(int b = 0; b < dw; b++) {\n                    bool vRef = reflectVertical && a % 2 != 0, hRef = reflectHorizontal && b % 2 != 0; //Do I reflect this chunk at all?\n                    for(int c = 0; c < ch; c++) {\n                        for(int d = 0; d < cw; d++) {\n                            reflections[a * ch + c][b * cw + d] = tesselation[a * ch + (vRef ? ch - c - 1 : c)][b * cw + (hRef ? cw - d - 1 : d)];\n                        }\n                    }\n                }\n            }\n\n            \n            //Next, let's apply our shifts to create the shifts map.\n            std::vector< std::vector<SiteD> > shifts = std::vector< std::vector<SiteD> >(map_height, std::vector<SiteD>(map_width, { 0, 0, 0 }));\n            if(numberOfPlayers == 6) shifts = reflections;\n            else if(preferHorizontal) {\n                int shift = (prg() % dw) * (map_height / dw); //A vertical shift.\n                for(int a = 0; a < dh; a++) {\n                    for(int b = 0; b < dw; b++) {\n                        for(int c = 0; c < ch; c++) {\n                            for(int d = 0; d < cw; d++) {\n                                shifts[a * ch + c][b * cw + d] = reflections[(a * ch + b * shift + c) % map_height][b * cw + d];\n                            }\n                        }\n                    }\n                }\n            }\n            else {\n                int shift = (prg() % dh) * (map_width / dh); //A horizontal shift.\n                for(int a = 0; a < dh; a++) {\n                    for(int b = 0; b < dw; b++) {\n                        for(int c = 0; c < ch; c++) {\n                            for(int d = 0; d < cw; d++) {\n                                shifts[a * ch + c][b * cw + d] = reflections[a * ch + c][(b * cw + a * shift + d) % map_width];\n                            }\n                        }\n                    }\n                }\n            }\n\n            //Apply a final blur to create the blur map. This will fix the edges where our transformations have created jumps or gaps.\n            const double OWN_WEIGHT = 0.66667;\n            std::vector< std::vector<SiteD> > blur = shifts;\n            for(int z = 0; z <= 2 * sqrt(map_width * map_height) / 10; z++) {\n                std::vector< std::vector<SiteD> > newBlur = blur;\n                for(int a = 0; a < map_height; a++) {\n                    int mh = a - 1, ph = a + 1;\n                    if(mh < 0) mh += map_height;\n                    if(ph == map_height) ph = 0;\n                    for(int b = 0; b < map_width; b++) {\n                        int mw = b - 1, pw = b + 1;\n                        if(mw < 0) mw += map_width;\n                        if(pw == map_width) pw = 0;\n                        newBlur[a][b].production *= OWN_WEIGHT;\n                        newBlur[a][b].production += blur[mh][b].production * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].production += blur[ph][b].production * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].production += blur[a][mw].production * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].production += blur[a][pw].production * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].strength *= OWN_WEIGHT;\n                        newBlur[a][b].strength += blur[mh][b].strength * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].strength += blur[ph][b].strength * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].strength += blur[a][mw].strength * (1 - OWN_WEIGHT) / 4;\n                        newBlur[a][b].strength += blur[a][pw].strength * (1 - OWN_WEIGHT) / 4;\n                    }\n                }\n                blur = newBlur;\n            }\n\n            //Let's now normalize the map values.\n            double maxProd = 0, maxStr = 0;\n            std::vector< std::vector<SiteD> > normalized = blur;\n            for(auto a = normalized.begin(); a != normalized.end(); a++) for(auto b = a->begin(); b != a->end(); b++) {\n                if(b->production > maxProd) maxProd = b->production;\n                if(b->strength > maxStr) maxStr = b->strength;\n            }\n            for(auto a = normalized.begin(); a != normalized.end(); a++) for(auto b = a->begin(); b != a->end(); b++) {\n                b->production /= maxProd;\n                b->strength /= maxStr;\n            }\n\n            //Finally, fill in the contents vector.\n            const int TOP_PROD = prg() % 10 + 6, TOP_STR = prg() % 106 + 150;\n            contents = std::vector< std::vector<Site> >(map_height, std::vector<Site>(map_width));\n            for(int a = 0; a < map_height; a++) for(int b = 0; b < map_width; b++) {\n                contents[a][b].owner = normalized[a][b].owner;\n                contents[a][b].strength = round(normalized[a][b].strength * TOP_STR);\n                contents[a][b].production = round(normalized[a][b].production * TOP_PROD);\n                if(contents[a][b].owner != 0 && contents[a][b].production == 0) contents[a][b].production = 1;\n            }\n            std::cout << map_width << \" \" << map_height << std::endl;\n        }\n\n        bool inBounds(Location l) const {\n            return l.x < map_width && l.y < map_height;\n        }\n        float getDistance(Location l1, Location l2) const {\n            short dx = abs(l1.x - l2.x), dy = abs(l1.y - l2.y);\n            if (dx > map_width / 2) dx = map_width - dx;\n            if (dy > map_height / 2) dy = map_height - dy;\n            return sqrt((dx*dx) + (dy*dy));\n        }\n        float getAngle(Location l1, Location l2) const {\n            short dx = l2.x - l1.x, dy = l2.y - l1.y;\n            if (dx > map_width - dx) dx -= map_width;\n            else if (-dx > map_width + dx) dx += map_width;\n            if (dy > map_height - dy) dy -= map_height;\n            else if (-dy > map_height + dy) dy += map_height;\n            return atan2(dy, dx);\n        }\n\n        Location getLocation(Location l, unsigned char direction) const {\n            if(direction != STILL) {\n                if(direction == NORTH) {\n                    if(l.y == 0) l.y = map_height - 1;\n                    else l.y--;\n                }\n                else if(direction == EAST) {\n                    if(l.x == map_width - 1) l.x = 0;\n                    else l.x++;\n                }\n                else if(direction == SOUTH) {\n                    if(l.y == map_height - 1) l.y = 0;\n                    else l.y++;\n                }\n                else if(direction == WEST) {\n                    if(l.x == 0) l.x = map_width - 1;\n                    else l.x--;\n                }\n            }\n            return l;\n        }\n        Site& getSite(Location l, unsigned char direction = STILL) {\n            l = getLocation(l, direction);\n            return contents[l.y][l.x];\n        }\n    };\n\n    static Map ppmToMap(std::string filename, int numplayers) {\n        std::ifstream in(filename, std::ios_base::binary);\n        assert(in.is_open());\n        int width, height, max_color;\n        assert(in.get() == 'P');\n        assert(in.get() == '6');\n        in >> width >> height >> max_color;\n        assert(max_color < 256);\n        in.get(); //Get whitespace character.\n        Map m;\n        m.map_width = width;\n        m.map_height = height;\n        m.contents = std::vector< std::vector<Site> >(height, std::vector<Site>(width, { 0, 0, 0 }));\n        const unsigned char MAX_PROD = 15;//7 + rand() % 9;\n        int counter = 1;\n        for(int a = 0; a < m.map_height; a++) for(int b = 0; b < m.map_width; b++) {\n            if(a == height / 2 && (b % (width / numplayers + 1) == 0)) {\n                m.contents[a][b].owner = counter;\n                counter++;\n            }\n            m.contents[a][b].production = (in.get() + in.get() + in.get()) / 765.0 * MAX_PROD;\n            m.contents[a][b].strength = 15 * m.contents[a][b].production;\n        }\n        if(!quiet_output) std::cout << \"Loaded ppm\" << std::endl;\n        return m;\n    }\n}\n"
  },
  {
    "path": "environment/core/json.hpp",
    "content": "/*\n    __ _____ _____ _____\n __|  |   __|     |   | |  JSON for Modern C++\n|  |  |__   |  |  | | | |  version 2.0.2\n|_____|_____|_____|_|___|  https://github.com/nlohmann/json\n\nLicensed under the MIT License <http://opensource.org/licenses/MIT>.\nCopyright (c) 2013-2016 Niels Lohmann <http://nlohmann.me>.\n\nPermission is hereby  granted, free of charge, to any  person obtaining a copy\nof this software and associated  documentation files (the \"Software\"), to deal\nin the Software  without restriction, including without  limitation the rights\nto  use, copy,  modify, merge,  publish, distribute,  sublicense, and/or  sell\ncopies  of  the Software,  and  to  permit persons  to  whom  the Software  is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE  IS PROVIDED \"AS  IS\", WITHOUT WARRANTY  OF ANY KIND,  EXPRESS OR\nIMPLIED,  INCLUDING BUT  NOT  LIMITED TO  THE  WARRANTIES OF  MERCHANTABILITY,\nFITNESS FOR  A PARTICULAR PURPOSE AND  NONINFRINGEMENT. IN NO EVENT  SHALL THE\nAUTHORS  OR COPYRIGHT  HOLDERS  BE  LIABLE FOR  ANY  CLAIM,  DAMAGES OR  OTHER\nLIABILITY, WHETHER IN AN ACTION OF  CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE  OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\n#ifndef NLOHMANN_JSON_HPP\n#define NLOHMANN_JSON_HPP\n\n#include <algorithm>\n#include <array>\n#include <cassert>\n#include <ciso646>\n#include <cmath>\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <functional>\n#include <initializer_list>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <limits>\n#include <locale>\n#include <map>\n#include <memory>\n#include <numeric>\n#include <sstream>\n#include <stdexcept>\n#include <string>\n#include <type_traits>\n#include <utility>\n#include <vector>\n\n// exclude unsupported compilers\n#if defined(__clang__)\n    #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)\n    #if CLANG_VERSION < 30400\n        #error \"unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers\"\n    #endif\n#elif defined(__GNUC__)\n    #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)\n    #if GCC_VERSION < 40900\n        #error \"unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers\"\n    #endif\n#endif\n\n// disable float-equal warnings on GCC/clang\n#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)\n    #pragma GCC diagnostic push\n    #pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n\n/*!\n@brief namespace for Niels Lohmann\n@see https://github.com/nlohmann\n@since version 1.0.0\n*/\nnamespace nlohmann\n{\n\n\n/*!\n@brief unnamed namespace with internal helper functions\n@since version 1.0.0\n*/\nnamespace\n{\n/*!\n@brief Helper to determine whether there's a key_type for T.\n\nThus helper is used to tell associative containers apart from other containers\nsuch as sequence containers. For instance, `std::map` passes the test as it\ncontains a `mapped_type`, whereas `std::vector` fails the test.\n\n@sa http://stackoverflow.com/a/7728728/266378\n@since version 1.0.0\n*/\ntemplate<typename T>\nstruct has_mapped_type\n{\n  private:\n    template<typename C> static char test(typename C::mapped_type*);\n    template<typename C> static char (&test(...))[2];\n  public:\n    static constexpr bool value = sizeof(test<T>(0)) == 1;\n};\n\n/*!\n@brief helper class to create locales with decimal point\n\nThis struct is used a default locale during the JSON serialization. JSON\nrequires the decimal point to be `.`, so this function overloads the\n`do_decimal_point()` function to return `.`. This function is called by\nfloat-to-string conversions to retrieve the decimal separator between integer\nand fractional parts.\n\n@sa https://github.com/nlohmann/json/issues/51#issuecomment-86869315\n@since version 2.0.0\n*/\nstruct DecimalSeparator : std::numpunct<char>\n{\n    char do_decimal_point() const\n    {\n        return '.';\n    }\n};\n\n}\n\n/*!\n@brief a class to store JSON values\n\n@tparam ObjectType type for JSON objects (`std::map` by default; will be used\nin @ref object_t)\n@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used\nin @ref array_t)\n@tparam StringType type for JSON strings and object keys (`std::string` by\ndefault; will be used in @ref string_t)\n@tparam BooleanType type for JSON booleans (`bool` by default; will be used\nin @ref boolean_t)\n@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by\ndefault; will be used in @ref number_integer_t)\n@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c\n`uint64_t` by default; will be used in @ref number_unsigned_t)\n@tparam NumberFloatType type for JSON floating-point numbers (`double` by\ndefault; will be used in @ref number_float_t)\n@tparam AllocatorType type of the allocator to use (`std::allocator` by\ndefault)\n\n@requirement The class satisfies the following concept requirements:\n- Basic\n - [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible):\n   JSON values can be default constructed. The result will be a JSON null value.\n - [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible):\n   A JSON value can be constructed from an rvalue argument.\n - [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible):\n   A JSON value can be copy-constructed from an lvalue expression.\n - [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable):\n   A JSON value van be assigned from an rvalue argument.\n - [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable):\n   A JSON value can be copy-assigned from an lvalue expression.\n - [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible):\n   JSON values can be destructed.\n- Layout\n - [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType):\n   JSON values have\n   [standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout):\n   All non-static data members are private and standard layout types, the class\n   has no virtual functions or (virtual) base classes.\n- Library-wide\n - [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable):\n   JSON values can be compared with `==`, see @ref\n   operator==(const_reference,const_reference).\n - [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable):\n   JSON values can be compared with `<`, see @ref\n   operator<(const_reference,const_reference).\n - [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable):\n   Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of\n   other compatible types, using unqualified function call @ref swap().\n - [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer):\n   JSON values can be compared against `std::nullptr_t` objects which are used\n   to model the `null` value.\n- Container\n - [Container](http://en.cppreference.com/w/cpp/concept/Container):\n   JSON values can be used like STL containers and provide iterator access.\n - [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer);\n   JSON values can be used like STL containers and provide reverse iterator\n   access.\n\n@invariant The member variables @a m_value and @a m_type have the following\nrelationship:\n- If `m_type == value_t::object`, then `m_value.object != nullptr`.\n- If `m_type == value_t::array`, then `m_value.array != nullptr`.\n- If `m_type == value_t::string`, then `m_value.string != nullptr`.\nThe invariants are checked by member function assert_invariant().\n\n@internal\n@note ObjectType trick from http://stackoverflow.com/a/9860911\n@endinternal\n\n@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange\nFormat](http://rfc7159.net/rfc7159)\n\n@since version 1.0.0\n\n@nosubgrouping\n*/\ntemplate <\n    template<typename U, typename V, typename... Args> class ObjectType = std::map,\n    template<typename U, typename... Args> class ArrayType = std::vector,\n    class StringType = std::string,\n    class BooleanType = bool,\n    class NumberIntegerType = std::int64_t,\n    class NumberUnsignedType = std::uint64_t,\n    class NumberFloatType = double,\n    template<typename U> class AllocatorType = std::allocator\n    >\nclass basic_json\n{\n  private:\n    /// workaround type for MSVC\n    using basic_json_t = basic_json<ObjectType, ArrayType, StringType,\n          BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType,\n          AllocatorType>;\n\n  public:\n    // forward declarations\n    template<typename Base> class json_reverse_iterator;\n    class json_pointer;\n\n    /////////////////////\n    // container types //\n    /////////////////////\n\n    /// @name container types\n    /// The canonic container types to use @ref basic_json like any other STL\n    /// container.\n    /// @{\n\n    /// the type of elements in a basic_json container\n    using value_type = basic_json;\n\n    /// the type of an element reference\n    using reference = value_type&;\n    /// the type of an element const reference\n    using const_reference = const value_type&;\n\n    /// a type to represent differences between iterators\n    using difference_type = std::ptrdiff_t;\n    /// a type to represent container sizes\n    using size_type = std::size_t;\n\n    /// the allocator type\n    using allocator_type = AllocatorType<basic_json>;\n\n    /// the type of an element pointer\n    using pointer = typename std::allocator_traits<allocator_type>::pointer;\n    /// the type of an element const pointer\n    using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;\n\n    /// an iterator for a basic_json container\n    class iterator;\n    /// a const iterator for a basic_json container\n    class const_iterator;\n    /// a reverse iterator for a basic_json container\n    using reverse_iterator = json_reverse_iterator<typename basic_json::iterator>;\n    /// a const reverse iterator for a basic_json container\n    using const_reverse_iterator = json_reverse_iterator<typename basic_json::const_iterator>;\n\n    /// @}\n\n\n    /*!\n    @brief returns the allocator associated with the container\n    */\n    static allocator_type get_allocator()\n    {\n        return allocator_type();\n    }\n\n\n    ///////////////////////////\n    // JSON value data types //\n    ///////////////////////////\n\n    /// @name JSON value data types\n    /// The data types to store a JSON value. These types are derived from\n    /// the template arguments passed to class @ref basic_json.\n    /// @{\n\n    /*!\n    @brief a type for an object\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows:\n    > An object is an unordered collection of zero or more name/value pairs,\n    > where a name is a string and a value is a string, number, boolean, null,\n    > object, or array.\n\n    To store objects in C++, a type is defined by the template parameters\n    described below.\n\n    @tparam ObjectType  the container to store objects (e.g., `std::map` or\n    `std::unordered_map`)\n    @tparam StringType the type of the keys or names (e.g., `std::string`).\n    The comparison function `std::less<StringType>` is used to order elements\n    inside the container.\n    @tparam AllocatorType the allocator to use for objects (e.g.,\n    `std::allocator`)\n\n    #### Default type\n\n    With the default values for @a ObjectType (`std::map`), @a StringType\n    (`std::string`), and @a AllocatorType (`std::allocator`), the default\n    value for @a object_t is:\n\n    @code {.cpp}\n    std::map<\n      std::string, // key_type\n      basic_json, // value_type\n      std::less<std::string>, // key_compare\n      std::allocator<std::pair<const std::string, basic_json>> // allocator_type\n    >\n    @endcode\n\n    #### Behavior\n\n    The choice of @a object_t influences the behavior of the JSON class. With\n    the default type, objects have the following behavior:\n\n    - When all names are unique, objects will be interoperable in the sense\n      that all software implementations receiving that object will agree on\n      the name-value mappings.\n    - When the names within an object are not unique, later stored name/value\n      pairs overwrite previously stored name/value pairs, leaving the used\n      names unique. For instance, `{\"key\": 1}` and `{\"key\": 2, \"key\": 1}` will\n      be treated as equal and both stored as `{\"key\": 1}`.\n    - Internally, name/value pairs are stored in lexicographical order of the\n      names. Objects will also be serialized (see @ref dump) in this order.\n      For instance, `{\"b\": 1, \"a\": 2}` and `{\"a\": 2, \"b\": 1}` will be stored\n      and serialized as `{\"a\": 2, \"b\": 1}`.\n    - When comparing objects, the order of the name/value pairs is irrelevant.\n      This makes objects interoperable in the sense that they will not be\n      affected by these differences. For instance, `{\"b\": 1, \"a\": 2}` and\n      `{\"a\": 2, \"b\": 1}` will be treated as equal.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the maximum depth of nesting.\n\n    In this class, the object's limit of nesting is not constraint explicitly.\n    However, a maximum depth of nesting may be introduced by the compiler or\n    runtime environment. A theoretical limit can be queried by calling the\n    @ref max_size function of a JSON object.\n\n    #### Storage\n\n    Objects are stored as pointers in a @ref basic_json type. That is, for any\n    access to object values, a pointer of type `object_t*` must be\n    dereferenced.\n\n    @sa @ref array_t -- type for an array value\n\n    @since version 1.0.0\n\n    @note The order name/value pairs are added to the object is *not*\n    preserved by the library. Therefore, iterating an object may return\n    name/value pairs in a different order than they were originally stored. In\n    fact, keys will be traversed in alphabetical order as `std::map` with\n    `std::less` is used by default. Please note this behavior conforms to [RFC\n    7159](http://rfc7159.net/rfc7159), because any order implements the\n    specified \"unordered\" nature of JSON objects.\n    */\n    using object_t = ObjectType<StringType,\n          basic_json,\n          std::less<StringType>,\n          AllocatorType<std::pair<const StringType,\n          basic_json>>>;\n\n    /*!\n    @brief a type for an array\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows:\n    > An array is an ordered sequence of zero or more values.\n\n    To store objects in C++, a type is defined by the template parameters\n    explained below.\n\n    @tparam ArrayType  container type to store arrays (e.g., `std::vector` or\n    `std::list`)\n    @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`)\n\n    #### Default type\n\n    With the default values for @a ArrayType (`std::vector`) and @a\n    AllocatorType (`std::allocator`), the default value for @a array_t is:\n\n    @code {.cpp}\n    std::vector<\n      basic_json, // value_type\n      std::allocator<basic_json> // allocator_type\n    >\n    @endcode\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the maximum depth of nesting.\n\n    In this class, the array's limit of nesting is not constraint explicitly.\n    However, a maximum depth of nesting may be introduced by the compiler or\n    runtime environment. A theoretical limit can be queried by calling the\n    @ref max_size function of a JSON array.\n\n    #### Storage\n\n    Arrays are stored as pointers in a @ref basic_json type. That is, for any\n    access to array values, a pointer of type `array_t*` must be dereferenced.\n\n    @sa @ref object_t -- type for an object value\n\n    @since version 1.0.0\n    */\n    using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;\n\n    /*!\n    @brief a type for a string\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows:\n    > A string is a sequence of zero or more Unicode characters.\n\n    To store objects in C++, a type is defined by the template parameter\n    described below. Unicode values are split by the JSON class into\n    byte-sized characters during deserialization.\n\n    @tparam StringType  the container to store strings (e.g., `std::string`).\n    Note this container is used for keys/names in objects, see @ref object_t.\n\n    #### Default type\n\n    With the default values for @a StringType (`std::string`), the default\n    value for @a string_t is:\n\n    @code {.cpp}\n    std::string\n    @endcode\n\n    #### String comparison\n\n    [RFC 7159](http://rfc7159.net/rfc7159) states:\n    > Software implementations are typically required to test names of object\n    > members for equality. Implementations that transform the textual\n    > representation into sequences of Unicode code units and then perform the\n    > comparison numerically, code unit by code unit, are interoperable in the\n    > sense that implementations will agree in all cases on equality or\n    > inequality of two strings. For example, implementations that compare\n    > strings with escaped characters unconverted may incorrectly find that\n    > `\"a\\\\b\"` and `\"a\\u005Cb\"` are not equal.\n\n    This implementation is interoperable as it does compare strings code unit\n    by code unit.\n\n    #### Storage\n\n    String values are stored as pointers in a @ref basic_json type. That is,\n    for any access to string values, a pointer of type `string_t*` must be\n    dereferenced.\n\n    @since version 1.0.0\n    */\n    using string_t = StringType;\n\n    /*!\n    @brief a type for a boolean\n\n    [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a\n    type which differentiates the two literals `true` and `false`.\n\n    To store objects in C++, a type is defined by the template parameter @a\n    BooleanType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a BooleanType (`bool`), the default value for\n    @a boolean_t is:\n\n    @code {.cpp}\n    bool\n    @endcode\n\n    #### Storage\n\n    Boolean values are stored directly inside a @ref basic_json type.\n\n    @since version 1.0.0\n    */\n    using boolean_t = BooleanType;\n\n    /*!\n    @brief a type for a number (integer)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store integer numbers in C++, a type is defined by the template\n    parameter @a NumberIntegerType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberIntegerType (`int64_t`), the default\n    value for @a number_integer_t is:\n\n    @code {.cpp}\n    int64_t\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in integer literals lead to an interpretation as octal\n      number. Internally, the value will be stored as decimal number. For\n      instance, the C++ integer literal `010` will be serialized to `8`.\n      During deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the range and precision of numbers.\n\n    When the default type is used, the maximal integer number that can be\n    stored is `9223372036854775807` (INT64_MAX) and the minimal integer number\n    that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers\n    that are out of range will yield over/underflow when used in a\n    constructor. During deserialization, too large or small integer numbers\n    will be automatically be stored as @ref number_unsigned_t or @ref\n    number_float_t.\n\n    [RFC 7159](http://rfc7159.net/rfc7159) further states:\n    > Note that when such software is used, numbers that are integers and are\n    > in the range \\f$[-2^{53}+1, 2^{53}-1]\\f$ are interoperable in the sense\n    > that implementations will agree exactly on their numeric values.\n\n    As this range is a subrange of the exactly supported range [INT64_MIN,\n    INT64_MAX], this class's integer type is interoperable.\n\n    #### Storage\n\n    Integer number values are stored directly inside a @ref basic_json type.\n\n    @sa @ref number_float_t -- type for number values (floating-point)\n\n    @sa @ref number_unsigned_t -- type for number values (unsigned integer)\n\n    @since version 1.0.0\n    */\n    using number_integer_t = NumberIntegerType;\n\n    /*!\n    @brief a type for a number (unsigned)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store unsigned integer numbers in C++, a type is defined by the\n    template parameter @a NumberUnsignedType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberUnsignedType (`uint64_t`), the\n    default value for @a number_unsigned_t is:\n\n    @code {.cpp}\n    uint64_t\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in integer literals lead to an interpretation as octal\n      number. Internally, the value will be stored as decimal number. For\n      instance, the C++ integer literal `010` will be serialized to `8`.\n      During deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) specifies:\n    > An implementation may set limits on the range and precision of numbers.\n\n    When the default type is used, the maximal integer number that can be\n    stored is `18446744073709551615` (UINT64_MAX) and the minimal integer\n    number that can be stored is `0`. Integer numbers that are out of range\n    will yield over/underflow when used in a constructor. During\n    deserialization, too large or small integer numbers will be automatically\n    be stored as @ref number_integer_t or @ref number_float_t.\n\n    [RFC 7159](http://rfc7159.net/rfc7159) further states:\n    > Note that when such software is used, numbers that are integers and are\n    > in the range \\f$[-2^{53}+1, 2^{53}-1]\\f$ are interoperable in the sense\n    > that implementations will agree exactly on their numeric values.\n\n    As this range is a subrange (when considered in conjunction with the\n    number_integer_t type) of the exactly supported range [0, UINT64_MAX],\n    this class's integer type is interoperable.\n\n    #### Storage\n\n    Integer number values are stored directly inside a @ref basic_json type.\n\n    @sa @ref number_float_t -- type for number values (floating-point)\n    @sa @ref number_integer_t -- type for number values (integer)\n\n    @since version 2.0.0\n    */\n    using number_unsigned_t = NumberUnsignedType;\n\n    /*!\n    @brief a type for a number (floating-point)\n\n    [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:\n    > The representation of numbers is similar to that used in most\n    > programming languages. A number is represented in base 10 using decimal\n    > digits. It contains an integer component that may be prefixed with an\n    > optional minus sign, which may be followed by a fraction part and/or an\n    > exponent part. Leading zeros are not allowed. (...) Numeric values that\n    > cannot be represented in the grammar below (such as Infinity and NaN)\n    > are not permitted.\n\n    This description includes both integer and floating-point numbers.\n    However, C++ allows more precise storage if it is known whether the number\n    is a signed integer, an unsigned integer or a floating-point number.\n    Therefore, three different types, @ref number_integer_t, @ref\n    number_unsigned_t and @ref number_float_t are used.\n\n    To store floating-point numbers in C++, a type is defined by the template\n    parameter @a NumberFloatType which chooses the type to use.\n\n    #### Default type\n\n    With the default values for @a NumberFloatType (`double`), the default\n    value for @a number_float_t is:\n\n    @code {.cpp}\n    double\n    @endcode\n\n    #### Default behavior\n\n    - The restrictions about leading zeros is not enforced in C++. Instead,\n      leading zeros in floating-point literals will be ignored. Internally,\n      the value will be stored as decimal number. For instance, the C++\n      floating-point literal `01.2` will be serialized to `1.2`. During\n      deserialization, leading zeros yield an error.\n    - Not-a-number (NaN) values will be serialized to `null`.\n\n    #### Limits\n\n    [RFC 7159](http://rfc7159.net/rfc7159) states:\n    > This specification allows implementations to set limits on the range and\n    > precision of numbers accepted. Since software that implements IEEE\n    > 754-2008 binary64 (double precision) numbers is generally available and\n    > widely used, good interoperability can be achieved by implementations\n    > that expect no more precision or range than these provide, in the sense\n    > that implementations will approximate JSON numbers within the expected\n    > precision.\n\n    This implementation does exactly follow this approach, as it uses double\n    precision floating-point numbers. Note values smaller than\n    `-1.79769313486232e+308` and values greater than `1.79769313486232e+308`\n    will be stored as NaN internally and be serialized to `null`.\n\n    #### Storage\n\n    Floating-point number values are stored directly inside a @ref basic_json\n    type.\n\n    @sa @ref number_integer_t -- type for number values (integer)\n\n    @sa @ref number_unsigned_t -- type for number values (unsigned integer)\n\n    @since version 1.0.0\n    */\n    using number_float_t = NumberFloatType;\n\n    /// @}\n\n\n    ///////////////////////////\n    // JSON type enumeration //\n    ///////////////////////////\n\n    /*!\n    @brief the JSON type enumeration\n\n    This enumeration collects the different JSON types. It is internally used\n    to distinguish the stored values, and the functions @ref is_null(), @ref\n    is_object(), @ref is_array(), @ref is_string(), @ref is_boolean(), @ref\n    is_number() (with @ref is_number_integer(), @ref is_number_unsigned(), and\n    @ref is_number_float()), @ref is_discarded(), @ref is_primitive(), and\n    @ref is_structured() rely on it.\n\n    @note There are three enumeration entries (number_integer,\n    number_unsigned, and number_float), because the library distinguishes\n    these three types for numbers: @ref number_unsigned_t is used for unsigned\n    integers, @ref number_integer_t is used for signed integers, and @ref\n    number_float_t is used for floating-point numbers or to approximate\n    integers which do not fit in the limits of their respective type.\n\n    @sa @ref basic_json(const value_t value_type) -- create a JSON value with\n    the default value for a given type\n\n    @since version 1.0.0\n    */\n    enum class value_t : uint8_t\n    {\n        null,            ///< null value\n        object,          ///< object (unordered set of name/value pairs)\n        array,           ///< array (ordered collection of values)\n        string,          ///< string value\n        boolean,         ///< boolean value\n        number_integer,  ///< number value (signed integer)\n        number_unsigned, ///< number value (unsigned integer)\n        number_float,    ///< number value (floating-point)\n        discarded        ///< discarded by the the parser callback function\n    };\n\n\n  private:\n\n    /// helper for exception-safe object creation\n    template<typename T, typename... Args>\n    static T* create(Args&& ... args)\n    {\n        AllocatorType<T> alloc;\n        auto deleter = [&](T * object)\n        {\n            alloc.deallocate(object, 1);\n        };\n        std::unique_ptr<T, decltype(deleter)> object(alloc.allocate(1), deleter);\n        alloc.construct(object.get(), std::forward<Args>(args)...);\n        assert(object.get() != nullptr);\n        return object.release();\n    }\n\n    ////////////////////////\n    // JSON value storage //\n    ////////////////////////\n\n    /*!\n    @brief a JSON value\n\n    The actual storage for a JSON value of the @ref basic_json class. This\n    union combines the different storage types for the JSON value types\n    defined in @ref value_t.\n\n    JSON type | value_t type    | used type\n    --------- | --------------- | ------------------------\n    object    | object          | pointer to @ref object_t\n    array     | array           | pointer to @ref array_t\n    string    | string          | pointer to @ref string_t\n    boolean   | boolean         | @ref boolean_t\n    number    | number_integer  | @ref number_integer_t\n    number    | number_unsigned | @ref number_unsigned_t\n    number    | number_float    | @ref number_float_t\n    null      | null            | *no value is stored*\n\n    @note Variable-length types (objects, arrays, and strings) are stored as\n    pointers. The size of the union should not exceed 64 bits if the default\n    value types are used.\n\n    @since version 1.0.0\n    */\n    union json_value\n    {\n        /// object (stored with pointer to save storage)\n        object_t* object;\n        /// array (stored with pointer to save storage)\n        array_t* array;\n        /// string (stored with pointer to save storage)\n        string_t* string;\n        /// boolean\n        boolean_t boolean;\n        /// number (integer)\n        number_integer_t number_integer;\n        /// number (unsigned integer)\n        number_unsigned_t number_unsigned;\n        /// number (floating-point)\n        number_float_t number_float;\n\n        /// default constructor (for null values)\n        json_value() = default;\n        /// constructor for booleans\n        json_value(boolean_t v) noexcept : boolean(v) {}\n        /// constructor for numbers (integer)\n        json_value(number_integer_t v) noexcept : number_integer(v) {}\n        /// constructor for numbers (unsigned)\n        json_value(number_unsigned_t v) noexcept : number_unsigned(v) {}\n        /// constructor for numbers (floating-point)\n        json_value(number_float_t v) noexcept : number_float(v) {}\n        /// constructor for empty values of a given type\n        json_value(value_t t)\n        {\n            switch (t)\n            {\n                case value_t::object:\n                {\n                    object = create<object_t>();\n                    break;\n                }\n\n                case value_t::array:\n                {\n                    array = create<array_t>();\n                    break;\n                }\n\n                case value_t::string:\n                {\n                    string = create<string_t>(\"\");\n                    break;\n                }\n\n                case value_t::boolean:\n                {\n                    boolean = boolean_t(false);\n                    break;\n                }\n\n                case value_t::number_integer:\n                {\n                    number_integer = number_integer_t(0);\n                    break;\n                }\n\n                case value_t::number_unsigned:\n                {\n                    number_unsigned = number_unsigned_t(0);\n                    break;\n                }\n\n                case value_t::number_float:\n                {\n                    number_float = number_float_t(0.0);\n                    break;\n                }\n\n                default:\n                {\n                    break;\n                }\n            }\n        }\n\n        /// constructor for strings\n        json_value(const string_t& value)\n        {\n            string = create<string_t>(value);\n        }\n\n        /// constructor for objects\n        json_value(const object_t& value)\n        {\n            object = create<object_t>(value);\n        }\n\n        /// constructor for arrays\n        json_value(const array_t& value)\n        {\n            array = create<array_t>(value);\n        }\n    };\n\n    /*!\n    @brief checks the class invariants\n\n    This function asserts the class invariants. It needs to be called at the\n    end of every constructor to make sure that created objects respect the\n    invariant. Furthermore, it has to be called each time the type of a JSON\n    value is changed, because the invariant expresses a relationship between\n    @a m_type and @a m_value.\n    */\n    void assert_invariant() const\n    {\n        assert(m_type != value_t::object or m_value.object != nullptr);\n        assert(m_type != value_t::array or m_value.array != nullptr);\n        assert(m_type != value_t::string or m_value.string != nullptr);\n    }\n\n  public:\n    //////////////////////////\n    // JSON parser callback //\n    //////////////////////////\n\n    /*!\n    @brief JSON callback events\n\n    This enumeration lists the parser events that can trigger calling a\n    callback function of type @ref parser_callback_t during parsing.\n\n    @image html callback_events.png \"Example when certain parse events are triggered\"\n\n    @since version 1.0.0\n    */\n    enum class parse_event_t : uint8_t\n    {\n        /// the parser read `{` and started to process a JSON object\n        object_start,\n        /// the parser read `}` and finished processing a JSON object\n        object_end,\n        /// the parser read `[` and started to process a JSON array\n        array_start,\n        /// the parser read `]` and finished processing a JSON array\n        array_end,\n        /// the parser read a key of a value in an object\n        key,\n        /// the parser finished reading a JSON value\n        value\n    };\n\n    /*!\n    @brief per-element parser callback type\n\n    With a parser callback function, the result of parsing a JSON text can be\n    influenced. When passed to @ref parse(std::istream&, const\n    parser_callback_t) or @ref parse(const string_t&, const parser_callback_t),\n    it is called on certain events (passed as @ref parse_event_t via parameter\n    @a event) with a set recursion depth @a depth and context JSON value\n    @a parsed. The return value of the callback function is a boolean\n    indicating whether the element that emitted the callback shall be kept or\n    not.\n\n    We distinguish six scenarios (determined by the event type) in which the\n    callback function can be called. The following table describes the values\n    of the parameters @a depth, @a event, and @a parsed.\n\n    parameter @a event | description | parameter @a depth | parameter @a parsed\n    ------------------ | ----------- | ------------------ | -------------------\n    parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded\n    parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key\n    parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object\n    parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded\n    parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array\n    parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value\n\n    @image html callback_events.png \"Example when certain parse events are triggered\"\n\n    Discarding a value (i.e., returning `false`) has different effects\n    depending on the context in which function was called:\n\n    - Discarded values in structured types are skipped. That is, the parser\n      will behave as if the discarded value was never read.\n    - In case a value outside a structured type is skipped, it is replaced\n      with `null`. This case happens if the top-level element is skipped.\n\n    @param[in] depth  the depth of the recursion during parsing\n\n    @param[in] event  an event of type parse_event_t indicating the context in\n    the callback function has been called\n\n    @param[in,out] parsed  the current intermediate parse result; note that\n    writing to this value has no effect for parse_event_t::key events\n\n    @return Whether the JSON value which called the function during parsing\n    should be kept (`true`) or not (`false`). In the latter case, it is either\n    skipped completely or replaced by an empty discarded object.\n\n    @sa @ref parse(std::istream&, parser_callback_t) or\n    @ref parse(const string_t&, parser_callback_t) for examples\n\n    @since version 1.0.0\n    */\n    using parser_callback_t = std::function<bool(int depth,\n                              parse_event_t event,\n                              basic_json& parsed)>;\n\n\n    //////////////////\n    // constructors //\n    //////////////////\n\n    /// @name constructors and destructors\n    /// Constructors of class @ref basic_json, copy/move constructor, copy\n    /// assignment, static functions creating objects, and the destructor.\n    /// @{\n\n    /*!\n    @brief create an empty value with a given type\n\n    Create an empty JSON value with a given type. The value will be default\n    initialized with an empty value which depends on the type:\n\n    Value type  | initial value\n    ----------- | -------------\n    null        | `null`\n    boolean     | `false`\n    string      | `\"\"`\n    number      | `0`\n    object      | `{}`\n    array       | `[]`\n\n    @param[in] value_type  the type of the value to create\n\n    @complexity Constant.\n\n    @throw std::bad_alloc if allocation for object, array, or string value\n    fails\n\n    @liveexample{The following code shows the constructor for different @ref\n    value_t values,basic_json__value_t}\n\n    @sa @ref basic_json(std::nullptr_t) -- create a `null` value\n    @sa @ref basic_json(boolean_t value) -- create a boolean value\n    @sa @ref basic_json(const string_t&) -- create a string value\n    @sa @ref basic_json(const object_t&) -- create a object value\n    @sa @ref basic_json(const array_t&) -- create a array value\n    @sa @ref basic_json(const number_float_t) -- create a number\n    (floating-point) value\n    @sa @ref basic_json(const number_integer_t) -- create a number (integer)\n    value\n    @sa @ref basic_json(const number_unsigned_t) -- create a number (unsigned)\n    value\n\n    @since version 1.0.0\n    */\n    basic_json(const value_t value_type)\n        : m_type(value_type), m_value(value_type)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a null object (implicitly)\n\n    Create a `null` JSON value. This is the implicit version of the `null`\n    value constructor as it takes no parameters.\n\n    @note The class invariant is satisfied, because it poses no requirements\n    for null values.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this constructor never throws\n    exceptions.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - As postcondition, it holds: `basic_json().empty() == true`.\n\n    @liveexample{The following code shows the constructor for a `null` JSON\n    value.,basic_json}\n\n    @sa @ref basic_json(std::nullptr_t) -- create a `null` value\n\n    @since version 1.0.0\n    */\n    basic_json() = default;\n\n    /*!\n    @brief create a null object (explicitly)\n\n    Create a `null` JSON value. This is the explicitly version of the `null`\n    value constructor as it takes a null pointer as parameter. It allows to\n    create `null` values by explicitly assigning a `nullptr` to a JSON value.\n    The passed null pointer itself is not read -- it is only used to choose\n    the right constructor.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this constructor never throws\n    exceptions.\n\n    @liveexample{The following code shows the constructor with null pointer\n    parameter.,basic_json__nullptr_t}\n\n    @sa @ref basic_json() -- default constructor (implicitly creating a `null`\n    value)\n\n    @since version 1.0.0\n    */\n    basic_json(std::nullptr_t) noexcept\n        : basic_json(value_t::null)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an object (explicit)\n\n    Create an object JSON value with a given content.\n\n    @param[in] val  a value for the object\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for object value fails\n\n    @liveexample{The following code shows the constructor with an @ref\n    object_t parameter.,basic_json__object_t}\n\n    @sa @ref basic_json(const CompatibleObjectType&) -- create an object value\n    from a compatible STL container\n\n    @since version 1.0.0\n    */\n    basic_json(const object_t& val)\n        : m_type(value_t::object), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an object (implicit)\n\n    Create an object JSON value with a given content. This constructor allows\n    any type @a CompatibleObjectType that can be used to construct values of\n    type @ref object_t.\n\n    @tparam CompatibleObjectType An object type whose `key_type` and\n    `value_type` is compatible to @ref object_t. Examples include `std::map`,\n    `std::unordered_map`, `std::multimap`, and `std::unordered_multimap` with\n    a `key_type` of `std::string`, and a `value_type` from which a @ref\n    basic_json value can be constructed.\n\n    @param[in] val  a value for the object\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for object value fails\n\n    @liveexample{The following code shows the constructor with several\n    compatible object type parameters.,basic_json__CompatibleObjectType}\n\n    @sa @ref basic_json(const object_t&) -- create an object value\n\n    @since version 1.0.0\n    */\n    template <class CompatibleObjectType, typename\n              std::enable_if<\n                  std::is_constructible<typename object_t::key_type, typename CompatibleObjectType::key_type>::value and\n                  std::is_constructible<basic_json, typename CompatibleObjectType::mapped_type>::value, int>::type\n              = 0>\n    basic_json(const CompatibleObjectType& val)\n        : m_type(value_t::object)\n    {\n        using std::begin;\n        using std::end;\n        m_value.object = create<object_t>(begin(val), end(val));\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an array (explicit)\n\n    Create an array JSON value with a given content.\n\n    @param[in] val  a value for the array\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for array value fails\n\n    @liveexample{The following code shows the constructor with an @ref array_t\n    parameter.,basic_json__array_t}\n\n    @sa @ref basic_json(const CompatibleArrayType&) -- create an array value\n    from a compatible STL containers\n\n    @since version 1.0.0\n    */\n    basic_json(const array_t& val)\n        : m_type(value_t::array), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an array (implicit)\n\n    Create an array JSON value with a given content. This constructor allows\n    any type @a CompatibleArrayType that can be used to construct values of\n    type @ref array_t.\n\n    @tparam CompatibleArrayType An object type whose `value_type` is\n    compatible to @ref array_t. Examples include `std::vector`, `std::deque`,\n    `std::list`, `std::forward_list`, `std::array`, `std::set`,\n    `std::unordered_set`, `std::multiset`, and `unordered_multiset` with a\n    `value_type` from which a @ref basic_json value can be constructed.\n\n    @param[in] val  a value for the array\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for array value fails\n\n    @liveexample{The following code shows the constructor with several\n    compatible array type parameters.,basic_json__CompatibleArrayType}\n\n    @sa @ref basic_json(const array_t&) -- create an array value\n\n    @since version 1.0.0\n    */\n    template <class CompatibleArrayType, typename\n              std::enable_if<\n                  not std::is_same<CompatibleArrayType, typename basic_json_t::iterator>::value and\n                  not std::is_same<CompatibleArrayType, typename basic_json_t::const_iterator>::value and\n                  not std::is_same<CompatibleArrayType, typename basic_json_t::reverse_iterator>::value and\n                  not std::is_same<CompatibleArrayType, typename basic_json_t::const_reverse_iterator>::value and\n                  not std::is_same<CompatibleArrayType, typename array_t::iterator>::value and\n                  not std::is_same<CompatibleArrayType, typename array_t::const_iterator>::value and\n                  std::is_constructible<basic_json, typename CompatibleArrayType::value_type>::value, int>::type\n              = 0>\n    basic_json(const CompatibleArrayType& val)\n        : m_type(value_t::array)\n    {\n        using std::begin;\n        using std::end;\n        m_value.array = create<array_t>(begin(val), end(val));\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a string (explicit)\n\n    Create an string JSON value with a given content.\n\n    @param[in] val  a value for the string\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for string value fails\n\n    @liveexample{The following code shows the constructor with an @ref\n    string_t parameter.,basic_json__string_t}\n\n    @sa @ref basic_json(const typename string_t::value_type*) -- create a\n    string value from a character pointer\n    @sa @ref basic_json(const CompatibleStringType&) -- create a string value\n    from a compatible string container\n\n    @since version 1.0.0\n    */\n    basic_json(const string_t& val)\n        : m_type(value_t::string), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a string (explicit)\n\n    Create a string JSON value with a given content.\n\n    @param[in] val  a literal value for the string\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for string value fails\n\n    @liveexample{The following code shows the constructor with string literal\n    parameter.,basic_json__string_t_value_type}\n\n    @sa @ref basic_json(const string_t&) -- create a string value\n    @sa @ref basic_json(const CompatibleStringType&) -- create a string value\n    from a compatible string container\n\n    @since version 1.0.0\n    */\n    basic_json(const typename string_t::value_type* val)\n        : basic_json(string_t(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a string (implicit)\n\n    Create a string JSON value with a given content.\n\n    @param[in] val  a value for the string\n\n    @tparam CompatibleStringType an string type which is compatible to @ref\n    string_t, for instance `std::string`.\n\n    @complexity Linear in the size of the passed @a val.\n\n    @throw std::bad_alloc if allocation for string value fails\n\n    @liveexample{The following code shows the construction of a string value\n    from a compatible type.,basic_json__CompatibleStringType}\n\n    @sa @ref basic_json(const string_t&) -- create a string value\n    @sa @ref basic_json(const typename string_t::value_type*) -- create a\n    string value from a character pointer\n\n    @since version 1.0.0\n    */\n    template <class CompatibleStringType, typename\n              std::enable_if<\n                  std::is_constructible<string_t, CompatibleStringType>::value, int>::type\n              = 0>\n    basic_json(const CompatibleStringType& val)\n        : basic_json(string_t(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a boolean (explicit)\n\n    Creates a JSON boolean type from a given value.\n\n    @param[in] val  a boolean value to store\n\n    @complexity Constant.\n\n    @liveexample{The example below demonstrates boolean\n    values.,basic_json__boolean_t}\n\n    @since version 1.0.0\n    */\n    basic_json(boolean_t val) noexcept\n        : m_type(value_t::boolean), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an integer number (explicit)\n\n    Create an integer number JSON value with a given content.\n\n    @tparam T A helper type to remove this function via SFINAE in case @ref\n    number_integer_t is the same as `int`. In this case, this constructor\n    would have the same signature as @ref basic_json(const int value). Note\n    the helper type @a T is not visible in this constructor's interface.\n\n    @param[in] val  an integer to create a JSON number from\n\n    @complexity Constant.\n\n    @liveexample{The example below shows the construction of an integer\n    number value.,basic_json__number_integer_t}\n\n    @sa @ref basic_json(const int) -- create a number value (integer)\n    @sa @ref basic_json(const CompatibleNumberIntegerType) -- create a number\n    value (integer) from a compatible number type\n\n    @since version 1.0.0\n    */\n    template<typename T,\n             typename std::enable_if<\n                 not (std::is_same<T, int>::value)\n                 and std::is_same<T, number_integer_t>::value\n                 , int>::type\n             = 0>\n    basic_json(const number_integer_t val) noexcept\n        : m_type(value_t::number_integer), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an integer number from an enum type (explicit)\n\n    Create an integer number JSON value with a given content.\n\n    @param[in] val  an integer to create a JSON number from\n\n    @note This constructor allows to pass enums directly to a constructor. As\n    C++ has no way of specifying the type of an anonymous enum explicitly, we\n    can only rely on the fact that such values implicitly convert to int. As\n    int may already be the same type of number_integer_t, we may need to\n    switch off the constructor @ref basic_json(const number_integer_t).\n\n    @complexity Constant.\n\n    @liveexample{The example below shows the construction of an integer\n    number value from an anonymous enum.,basic_json__const_int}\n\n    @sa @ref basic_json(const number_integer_t) -- create a number value\n    (integer)\n    @sa @ref basic_json(const CompatibleNumberIntegerType) -- create a number\n    value (integer) from a compatible number type\n\n    @since version 1.0.0\n    */\n    basic_json(const int val) noexcept\n        : m_type(value_t::number_integer),\n          m_value(static_cast<number_integer_t>(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an integer number (implicit)\n\n    Create an integer number JSON value with a given content. This constructor\n    allows any type @a CompatibleNumberIntegerType that can be used to\n    construct values of type @ref number_integer_t.\n\n    @tparam CompatibleNumberIntegerType An integer type which is compatible to\n    @ref number_integer_t. Examples include the types `int`, `int32_t`,\n    `long`, and `short`.\n\n    @param[in] val  an integer to create a JSON number from\n\n    @complexity Constant.\n\n    @liveexample{The example below shows the construction of several integer\n    number values from compatible\n    types.,basic_json__CompatibleIntegerNumberType}\n\n    @sa @ref basic_json(const number_integer_t) -- create a number value\n    (integer)\n    @sa @ref basic_json(const int) -- create a number value (integer)\n\n    @since version 1.0.0\n    */\n    template<typename CompatibleNumberIntegerType, typename\n             std::enable_if<\n                 std::is_constructible<number_integer_t, CompatibleNumberIntegerType>::value and\n                 std::numeric_limits<CompatibleNumberIntegerType>::is_integer and\n                 std::numeric_limits<CompatibleNumberIntegerType>::is_signed,\n                 CompatibleNumberIntegerType>::type\n             = 0>\n    basic_json(const CompatibleNumberIntegerType val) noexcept\n        : m_type(value_t::number_integer),\n          m_value(static_cast<number_integer_t>(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an unsigned integer number (explicit)\n\n    Create an unsigned integer number JSON value with a given content.\n\n    @tparam T  helper type to compare number_unsigned_t and unsigned int (not\n    visible in) the interface.\n\n    @param[in] val  an integer to create a JSON number from\n\n    @complexity Constant.\n\n    @sa @ref basic_json(const CompatibleNumberUnsignedType) -- create a number\n    value (unsigned integer) from a compatible number type\n\n    @since version 2.0.0\n    */\n    template<typename T,\n             typename std::enable_if<\n                 not (std::is_same<T, int>::value)\n                 and std::is_same<T, number_unsigned_t>::value\n                 , int>::type\n             = 0>\n    basic_json(const number_unsigned_t val) noexcept\n        : m_type(value_t::number_unsigned), m_value(val)\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an unsigned number (implicit)\n\n    Create an unsigned number JSON value with a given content. This\n    constructor allows any type @a CompatibleNumberUnsignedType that can be\n    used to construct values of type @ref number_unsigned_t.\n\n    @tparam CompatibleNumberUnsignedType An integer type which is compatible\n    to @ref number_unsigned_t. Examples may include the types `unsigned int`,\n    `uint32_t`, or `unsigned short`.\n\n    @param[in] val  an unsigned integer to create a JSON number from\n\n    @complexity Constant.\n\n    @sa @ref basic_json(const number_unsigned_t) -- create a number value\n    (unsigned)\n\n    @since version 2.0.0\n    */\n    template <typename CompatibleNumberUnsignedType, typename\n              std::enable_if <\n                  std::is_constructible<number_unsigned_t, CompatibleNumberUnsignedType>::value and\n                  std::numeric_limits<CompatibleNumberUnsignedType>::is_integer and\n                  not std::numeric_limits<CompatibleNumberUnsignedType>::is_signed,\n                  CompatibleNumberUnsignedType>::type\n              = 0>\n    basic_json(const CompatibleNumberUnsignedType val) noexcept\n        : m_type(value_t::number_unsigned),\n          m_value(static_cast<number_unsigned_t>(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a floating-point number (explicit)\n\n    Create a floating-point number JSON value with a given content.\n\n    @param[in] val  a floating-point value to create a JSON number from\n\n    @note [RFC 7159](http://www.rfc-editor.org/rfc/rfc7159.txt), section 6\n    disallows NaN values:\n    > Numeric values that cannot be represented in the grammar below (such as\n    > Infinity and NaN) are not permitted.\n    In case the parameter @a val is not a number, a JSON null value is created\n    instead.\n\n    @complexity Constant.\n\n    @liveexample{The following example creates several floating-point\n    values.,basic_json__number_float_t}\n\n    @sa @ref basic_json(const CompatibleNumberFloatType) -- create a number\n    value (floating-point) from a compatible number type\n\n    @since version 1.0.0\n    */\n    basic_json(const number_float_t val) noexcept\n        : m_type(value_t::number_float), m_value(val)\n    {\n        // replace infinity and NAN by null\n        if (not std::isfinite(val))\n        {\n            m_type = value_t::null;\n            m_value = json_value();\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief create an floating-point number (implicit)\n\n    Create an floating-point number JSON value with a given content. This\n    constructor allows any type @a CompatibleNumberFloatType that can be used\n    to construct values of type @ref number_float_t.\n\n    @tparam CompatibleNumberFloatType A floating-point type which is\n    compatible to @ref number_float_t. Examples may include the types `float`\n    or `double`.\n\n    @param[in] val  a floating-point to create a JSON number from\n\n    @note [RFC 7159](http://www.rfc-editor.org/rfc/rfc7159.txt), section 6\n    disallows NaN values:\n    > Numeric values that cannot be represented in the grammar below (such as\n    > Infinity and NaN) are not permitted.\n    In case the parameter @a val is not a number, a JSON null value is\n    created instead.\n\n    @complexity Constant.\n\n    @liveexample{The example below shows the construction of several\n    floating-point number values from compatible\n    types.,basic_json__CompatibleNumberFloatType}\n\n    @sa @ref basic_json(const number_float_t) -- create a number value\n    (floating-point)\n\n    @since version 1.0.0\n    */\n    template<typename CompatibleNumberFloatType, typename = typename\n             std::enable_if<\n                 std::is_constructible<number_float_t, CompatibleNumberFloatType>::value and\n                 std::is_floating_point<CompatibleNumberFloatType>::value>::type\n             >\n    basic_json(const CompatibleNumberFloatType val) noexcept\n        : basic_json(number_float_t(val))\n    {\n        assert_invariant();\n    }\n\n    /*!\n    @brief create a container (array or object) from an initializer list\n\n    Creates a JSON value of type array or object from the passed initializer\n    list @a init. In case @a type_deduction is `true` (default), the type of\n    the JSON value to be created is deducted from the initializer list @a init\n    according to the following rules:\n\n    1. If the list is empty, an empty JSON object value `{}` is created.\n    2. If the list consists of pairs whose first element is a string, a JSON\n       object value is created where the first elements of the pairs are\n       treated as keys and the second elements are as values.\n    3. In all other cases, an array is created.\n\n    The rules aim to create the best fit between a C++ initializer list and\n    JSON values. The rationale is as follows:\n\n    1. The empty initializer list is written as `{}` which is exactly an empty\n       JSON object.\n    2. C++ has now way of describing mapped types other than to list a list of\n       pairs. As JSON requires that keys must be of type string, rule 2 is the\n       weakest constraint one can pose on initializer lists to interpret them\n       as an object.\n    3. In all other cases, the initializer list could not be interpreted as\n       JSON object type, so interpreting it as JSON array type is safe.\n\n    With the rules described above, the following JSON values cannot be\n    expressed by an initializer list:\n\n    - the empty array (`[]`): use @ref array(std::initializer_list<basic_json>)\n      with an empty initializer list in this case\n    - arrays whose elements satisfy rule 2: use @ref\n      array(std::initializer_list<basic_json>) with the same initializer list\n      in this case\n\n    @note When used without parentheses around an empty initializer list, @ref\n    basic_json() is called instead of this function, yielding the JSON null\n    value.\n\n    @param[in] init  initializer list with JSON values\n\n    @param[in] type_deduction internal parameter; when set to `true`, the type\n    of the JSON value is deducted from the initializer list @a init; when set\n    to `false`, the type provided via @a manual_type is forced. This mode is\n    used by the functions @ref array(std::initializer_list<basic_json>) and\n    @ref object(std::initializer_list<basic_json>).\n\n    @param[in] manual_type internal parameter; when @a type_deduction is set\n    to `false`, the created JSON value will use the provided type (only @ref\n    value_t::array and @ref value_t::object are valid); when @a type_deduction\n    is set to `true`, this parameter has no effect\n\n    @throw std::domain_error if @a type_deduction is `false`, @a manual_type\n    is `value_t::object`, but @a init contains an element which is not a pair\n    whose first element is a string; example: `\"cannot create object from\n    initializer list\"`\n\n    @complexity Linear in the size of the initializer list @a init.\n\n    @liveexample{The example below shows how JSON values are created from\n    initializer lists.,basic_json__list_init_t}\n\n    @sa @ref array(std::initializer_list<basic_json>) -- create a JSON array\n    value from an initializer list\n    @sa @ref object(std::initializer_list<basic_json>) -- create a JSON object\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    basic_json(std::initializer_list<basic_json> init,\n               bool type_deduction = true,\n               value_t manual_type = value_t::array)\n    {\n        // check if each element is an array with two elements whose first\n        // element is a string\n        bool is_an_object = std::all_of(init.begin(), init.end(),\n                                        [](const basic_json & element)\n        {\n            return element.is_array() and element.size() == 2 and element[0].is_string();\n        });\n\n        // adjust type if type deduction is not wanted\n        if (not type_deduction)\n        {\n            // if array is wanted, do not create an object though possible\n            if (manual_type == value_t::array)\n            {\n                is_an_object = false;\n            }\n\n            // if object is wanted but impossible, throw an exception\n            if (manual_type == value_t::object and not is_an_object)\n            {\n                throw std::domain_error(\"cannot create object from initializer list\");\n            }\n        }\n\n        if (is_an_object)\n        {\n            // the initializer list is a list of pairs -> create object\n            m_type = value_t::object;\n            m_value = value_t::object;\n\n            std::for_each(init.begin(), init.end(), [this](const basic_json & element)\n            {\n                m_value.object->emplace(*(element[0].m_value.string), element[1]);\n            });\n        }\n        else\n        {\n            // the initializer list describes an array -> create array\n            m_type = value_t::array;\n            m_value.array = create<array_t>(init);\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief explicitly create an array from an initializer list\n\n    Creates a JSON array value from a given initializer list. That is, given a\n    list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the\n    initializer list is empty, the empty array `[]` is created.\n\n    @note This function is only needed to express two edge cases that cannot\n    be realized with the initializer list constructor (@ref\n    basic_json(std::initializer_list<basic_json>, bool, value_t)). These cases\n    are:\n    1. creating an array whose elements are all pairs whose first element is a\n    string -- in this case, the initializer list constructor would create an\n    object, taking the first elements as keys\n    2. creating an empty array -- passing the empty initializer list to the\n    initializer list constructor yields an empty object\n\n    @param[in] init  initializer list with JSON values to create an array from\n    (optional)\n\n    @return JSON array value\n\n    @complexity Linear in the size of @a init.\n\n    @liveexample{The following code shows an example for the `array`\n    function.,array}\n\n    @sa @ref basic_json(std::initializer_list<basic_json>, bool, value_t) --\n    create a JSON value from an initializer list\n    @sa @ref object(std::initializer_list<basic_json>) -- create a JSON object\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    static basic_json array(std::initializer_list<basic_json> init =\n                                std::initializer_list<basic_json>())\n    {\n        return basic_json(init, false, value_t::array);\n    }\n\n    /*!\n    @brief explicitly create an object from an initializer list\n\n    Creates a JSON object value from a given initializer list. The initializer\n    lists elements must be pairs, and their first elements must be strings. If\n    the initializer list is empty, the empty object `{}` is created.\n\n    @note This function is only added for symmetry reasons. In contrast to the\n    related function @ref array(std::initializer_list<basic_json>), there are\n    no cases which can only be expressed by this function. That is, any\n    initializer list @a init can also be passed to the initializer list\n    constructor @ref basic_json(std::initializer_list<basic_json>, bool,\n    value_t).\n\n    @param[in] init  initializer list to create an object from (optional)\n\n    @return JSON object value\n\n    @throw std::domain_error if @a init is not a pair whose first elements are\n    strings; thrown by\n    @ref basic_json(std::initializer_list<basic_json>, bool, value_t)\n\n    @complexity Linear in the size of @a init.\n\n    @liveexample{The following code shows an example for the `object`\n    function.,object}\n\n    @sa @ref basic_json(std::initializer_list<basic_json>, bool, value_t) --\n    create a JSON value from an initializer list\n    @sa @ref array(std::initializer_list<basic_json>) -- create a JSON array\n    value from an initializer list\n\n    @since version 1.0.0\n    */\n    static basic_json object(std::initializer_list<basic_json> init =\n                                 std::initializer_list<basic_json>())\n    {\n        return basic_json(init, false, value_t::object);\n    }\n\n    /*!\n    @brief construct an array with count copies of given value\n\n    Constructs a JSON array value by creating @a cnt copies of a passed value.\n    In case @a cnt is `0`, an empty array is created. As postcondition,\n    `std::distance(begin(),end()) == cnt` holds.\n\n    @param[in] cnt  the number of JSON copies of @a val to create\n    @param[in] val  the JSON value to copy\n\n    @complexity Linear in @a cnt.\n\n    @liveexample{The following code shows examples for the @ref\n    basic_json(size_type\\, const basic_json&)\n    constructor.,basic_json__size_type_basic_json}\n\n    @since version 1.0.0\n    */\n    basic_json(size_type cnt, const basic_json& val)\n        : m_type(value_t::array)\n    {\n        m_value.array = create<array_t>(cnt, val);\n        assert_invariant();\n    }\n\n    /*!\n    @brief construct a JSON container given an iterator range\n\n    Constructs the JSON value with the contents of the range `[first, last)`.\n    The semantics depends on the different types a JSON value can have:\n    - In case of primitive types (number, boolean, or string), @a first must\n      be `begin()` and @a last must be `end()`. In this case, the value is\n      copied. Otherwise, std::out_of_range is thrown.\n    - In case of structured types (array, object), the constructor behaves as\n      similar versions for `std::vector`.\n    - In case of a null type, std::domain_error is thrown.\n\n    @tparam InputIT an input iterator type (@ref iterator or @ref\n    const_iterator)\n\n    @param[in] first begin of the range to copy from (included)\n    @param[in] last end of the range to copy from (excluded)\n\n    @pre Iterators @a first and @a last must be initialized.\n\n    @throw std::domain_error if iterators are not compatible; that is, do not\n    belong to the same JSON value; example: `\"iterators are not compatible\"`\n    @throw std::out_of_range if iterators are for a primitive type (number,\n    boolean, or string) where an out of range error can be detected easily;\n    example: `\"iterators out of range\"`\n    @throw std::bad_alloc if allocation for object, array, or string fails\n    @throw std::domain_error if called with a null value; example: `\"cannot\n    use construct with iterators from null\"`\n\n    @complexity Linear in distance between @a first and @a last.\n\n    @liveexample{The example below shows several ways to create JSON values by\n    specifying a subrange with iterators.,basic_json__InputIt_InputIt}\n\n    @since version 1.0.0\n    */\n    template <class InputIT, typename\n              std::enable_if<\n                  std::is_same<InputIT, typename basic_json_t::iterator>::value or\n                  std::is_same<InputIT, typename basic_json_t::const_iterator>::value\n                  , int>::type\n              = 0>\n    basic_json(InputIT first, InputIT last)\n    {\n        assert(first.m_object != nullptr);\n        assert(last.m_object != nullptr);\n\n        // make sure iterator fits the current value\n        if (first.m_object != last.m_object)\n        {\n            throw std::domain_error(\"iterators are not compatible\");\n        }\n\n        // copy type from first iterator\n        m_type = first.m_object->m_type;\n\n        // check if iterator range is complete for primitive values\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            {\n                if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())\n                {\n                    throw std::out_of_range(\"iterators out of range\");\n                }\n                break;\n            }\n\n            default:\n            {\n                break;\n            }\n        }\n\n        switch (m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_value.number_integer = first.m_object->m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value.number_unsigned = first.m_object->m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value.number_float = first.m_object->m_value.number_float;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value.boolean = first.m_object->m_value.boolean;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value = *first.m_object->m_value.string;\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_value.object = create<object_t>(first.m_it.object_iterator, last.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value.array = create<array_t>(first.m_it.array_iterator, last.m_it.array_iterator);\n                break;\n            }\n\n            default:\n            {\n                throw std::domain_error(\"cannot use construct with iterators from \" + first.m_object->type_name());\n            }\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief construct a JSON value given an input stream\n\n    @param[in,out] i  stream to read a serialized JSON value from\n    @param[in] cb a parser callback function of type @ref parser_callback_t\n    which is used to control the deserialization by filtering unwanted values\n    (optional)\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser. The complexity can be higher if the parser callback function\n    @a cb has a super-linear complexity.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates constructing a JSON value from\n    a `std::stringstream` with and without callback\n    function.,basic_json__istream}\n\n    @since version 2.0.0\n    */\n    explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr)\n    {\n        *this = parser(i, cb).parse();\n        assert_invariant();\n    }\n\n    ///////////////////////////////////////\n    // other constructors and destructor //\n    ///////////////////////////////////////\n\n    /*!\n    @brief copy constructor\n\n    Creates a copy of a given JSON value.\n\n    @param[in] other  the JSON value to copy\n\n    @complexity Linear in the size of @a other.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is linear.\n    - As postcondition, it holds: `other == basic_json(other)`.\n\n    @throw std::bad_alloc if allocation for object, array, or string fails.\n\n    @liveexample{The following code shows an example for the copy\n    constructor.,basic_json__basic_json}\n\n    @since version 1.0.0\n    */\n    basic_json(const basic_json& other)\n        : m_type(other.m_type)\n    {\n        // check of passed value is valid\n        other.assert_invariant();\n\n        switch (m_type)\n        {\n            case value_t::object:\n            {\n                m_value = *other.m_value.object;\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value = *other.m_value.array;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value = *other.m_value.string;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value = other.m_value.boolean;\n                break;\n            }\n\n            case value_t::number_integer:\n            {\n                m_value = other.m_value.number_integer;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value = other.m_value.number_unsigned;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value = other.m_value.number_float;\n                break;\n            }\n\n            default:\n            {\n                break;\n            }\n        }\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief move constructor\n\n    Move constructor. Constructs a JSON value with the contents of the given\n    value @a other using move semantics. It \"steals\" the resources from @a\n    other and leaves it as JSON null value.\n\n    @param[in,out] other  value to move to this object\n\n    @post @a other is a JSON null value\n\n    @complexity Constant.\n\n    @liveexample{The code below shows the move constructor explicitly called\n    via std::move.,basic_json__moveconstructor}\n\n    @since version 1.0.0\n    */\n    basic_json(basic_json&& other) noexcept\n        : m_type(std::move(other.m_type)),\n          m_value(std::move(other.m_value))\n    {\n        // check that passed value is valid\n        other.assert_invariant();\n\n        // invalidate payload\n        other.m_type = value_t::null;\n        other.m_value = {};\n\n        assert_invariant();\n    }\n\n    /*!\n    @brief copy assignment\n\n    Copy assignment operator. Copies a JSON value via the \"copy and swap\"\n    strategy: It is expressed in terms of the copy constructor, destructor,\n    and the swap() member function.\n\n    @param[in] other  value to copy from\n\n    @complexity Linear.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is linear.\n\n    @liveexample{The code below shows and example for the copy assignment. It\n    creates a copy of value `a` which is then swapped with `b`. Finally\\, the\n    copy of `a` (which is the null value after the swap) is\n    destroyed.,basic_json__copyassignment}\n\n    @since version 1.0.0\n    */\n    reference& operator=(basic_json other) noexcept (\n        std::is_nothrow_move_constructible<value_t>::value and\n        std::is_nothrow_move_assignable<value_t>::value and\n        std::is_nothrow_move_constructible<json_value>::value and\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        // check that passed value is valid\n        other.assert_invariant();\n\n        using std::swap;\n        swap(m_type, other.m_type);\n        swap(m_value, other.m_value);\n\n        assert_invariant();\n        return *this;\n    }\n\n    /*!\n    @brief destructor\n\n    Destroys the JSON value and frees all allocated memory.\n\n    @complexity Linear.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is linear.\n    - All stored elements are destroyed and all memory is freed.\n\n    @since version 1.0.0\n    */\n    ~basic_json()\n    {\n        assert_invariant();\n\n        switch (m_type)\n        {\n            case value_t::object:\n            {\n                AllocatorType<object_t> alloc;\n                alloc.destroy(m_value.object);\n                alloc.deallocate(m_value.object, 1);\n                break;\n            }\n\n            case value_t::array:\n            {\n                AllocatorType<array_t> alloc;\n                alloc.destroy(m_value.array);\n                alloc.deallocate(m_value.array, 1);\n                break;\n            }\n\n            case value_t::string:\n            {\n                AllocatorType<string_t> alloc;\n                alloc.destroy(m_value.string);\n                alloc.deallocate(m_value.string, 1);\n                break;\n            }\n\n            default:\n            {\n                // all other types need no specific destructor\n                break;\n            }\n        }\n    }\n\n    /// @}\n\n  public:\n    ///////////////////////\n    // object inspection //\n    ///////////////////////\n\n    /// @name object inspection\n    /// Functions to inspect the type of a JSON value.\n    /// @{\n\n    /*!\n    @brief serialization\n\n    Serialization function for JSON values. The function tries to mimic\n    Python's `json.dumps()` function, and currently supports its @a indent\n    parameter.\n\n    @param[in] indent If indent is nonnegative, then array elements and object\n    members will be pretty-printed with that indent level. An indent level of\n    `0` will only insert newlines. `-1` (the default) selects the most compact\n    representation.\n\n    @return string containing the serialization of the JSON value\n\n    @complexity Linear.\n\n    @liveexample{The following example shows the effect of different @a indent\n    parameters to the result of the serialization.,dump}\n\n    @see https://docs.python.org/2/library/json.html#json.dump\n\n    @since version 1.0.0\n    */\n    string_t dump(const int indent = -1) const\n    {\n        std::stringstream ss;\n        // fix locale problems\n        ss.imbue(std::locale(std::locale(), new DecimalSeparator));\n\n        // 6, 15 or 16 digits of precision allows round-trip IEEE 754\n        // string->float->string, string->double->string or string->long\n        // double->string; to be safe, we read this value from\n        // std::numeric_limits<number_float_t>::digits10\n        ss.precision(std::numeric_limits<double>::digits10);\n\n        if (indent >= 0)\n        {\n            dump(ss, true, static_cast<unsigned int>(indent));\n        }\n        else\n        {\n            dump(ss, false, 0);\n        }\n\n        return ss.str();\n    }\n\n    /*!\n    @brief return the type of the JSON value (explicit)\n\n    Return the type of the JSON value as a value from the @ref value_t\n    enumeration.\n\n    @return the type of the JSON value\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `type()` for all JSON\n    types.,type}\n\n    @since version 1.0.0\n    */\n    constexpr value_t type() const noexcept\n    {\n        return m_type;\n    }\n\n    /*!\n    @brief return whether type is primitive\n\n    This function returns true iff the JSON type is primitive (string, number,\n    boolean, or null).\n\n    @return `true` if type is primitive (string, number, boolean, or null),\n    `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_primitive()` for all JSON\n    types.,is_primitive}\n\n    @sa @ref is_structured() -- returns whether JSON value is structured\n    @sa @ref is_null() -- returns whether JSON value is `null`\n    @sa @ref is_string() -- returns whether JSON value is a string\n    @sa @ref is_boolean() -- returns whether JSON value is a boolean\n    @sa @ref is_number() -- returns whether JSON value is a number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_primitive() const noexcept\n    {\n        return is_null() or is_string() or is_boolean() or is_number();\n    }\n\n    /*!\n    @brief return whether type is structured\n\n    This function returns true iff the JSON type is structured (array or\n    object).\n\n    @return `true` if type is structured (array or object), `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_structured()` for all JSON\n    types.,is_structured}\n\n    @sa @ref is_primitive() -- returns whether value is primitive\n    @sa @ref is_array() -- returns whether value is an array\n    @sa @ref is_object() -- returns whether value is an object\n\n    @since version 1.0.0\n    */\n    constexpr bool is_structured() const noexcept\n    {\n        return is_array() or is_object();\n    }\n\n    /*!\n    @brief return whether value is null\n\n    This function returns true iff the JSON value is null.\n\n    @return `true` if type is null, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_null()` for all JSON\n    types.,is_null}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_null() const noexcept\n    {\n        return m_type == value_t::null;\n    }\n\n    /*!\n    @brief return whether value is a boolean\n\n    This function returns true iff the JSON value is a boolean.\n\n    @return `true` if type is boolean, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_boolean()` for all JSON\n    types.,is_boolean}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_boolean() const noexcept\n    {\n        return m_type == value_t::boolean;\n    }\n\n    /*!\n    @brief return whether value is a number\n\n    This function returns true iff the JSON value is a number. This includes\n    both integer and floating-point values.\n\n    @return `true` if type is number (regardless whether integer, unsigned\n    integer or floating-type), `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number()` for all JSON\n    types.,is_number}\n\n    @sa @ref is_number_integer() -- check if value is an integer or unsigned\n    integer number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number() const noexcept\n    {\n        return is_number_integer() or is_number_float();\n    }\n\n    /*!\n    @brief return whether value is an integer number\n\n    This function returns true iff the JSON value is an integer or unsigned\n    integer number. This excludes floating-point values.\n\n    @return `true` if type is an integer or unsigned integer number, `false`\n    otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_integer()` for all\n    JSON types.,is_number_integer}\n\n    @sa @ref is_number() -- check if value is a number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number_integer() const noexcept\n    {\n        return m_type == value_t::number_integer or m_type == value_t::number_unsigned;\n    }\n\n    /*!\n    @brief return whether value is an unsigned integer number\n\n    This function returns true iff the JSON value is an unsigned integer\n    number. This excludes floating-point and (signed) integer values.\n\n    @return `true` if type is an unsigned integer number, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_unsigned()` for all\n    JSON types.,is_number_unsigned}\n\n    @sa @ref is_number() -- check if value is a number\n    @sa @ref is_number_integer() -- check if value is an integer or unsigned\n    integer number\n    @sa @ref is_number_float() -- check if value is a floating-point number\n\n    @since version 2.0.0\n    */\n    constexpr bool is_number_unsigned() const noexcept\n    {\n        return m_type == value_t::number_unsigned;\n    }\n\n    /*!\n    @brief return whether value is a floating-point number\n\n    This function returns true iff the JSON value is a floating-point number.\n    This excludes integer and unsigned integer values.\n\n    @return `true` if type is a floating-point number, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_number_float()` for all\n    JSON types.,is_number_float}\n\n    @sa @ref is_number() -- check if value is number\n    @sa @ref is_number_integer() -- check if value is an integer number\n    @sa @ref is_number_unsigned() -- check if value is an unsigned integer\n    number\n\n    @since version 1.0.0\n    */\n    constexpr bool is_number_float() const noexcept\n    {\n        return m_type == value_t::number_float;\n    }\n\n    /*!\n    @brief return whether value is an object\n\n    This function returns true iff the JSON value is an object.\n\n    @return `true` if type is object, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_object()` for all JSON\n    types.,is_object}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_object() const noexcept\n    {\n        return m_type == value_t::object;\n    }\n\n    /*!\n    @brief return whether value is an array\n\n    This function returns true iff the JSON value is an array.\n\n    @return `true` if type is array, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_array()` for all JSON\n    types.,is_array}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_array() const noexcept\n    {\n        return m_type == value_t::array;\n    }\n\n    /*!\n    @brief return whether value is a string\n\n    This function returns true iff the JSON value is a string.\n\n    @return `true` if type is string, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_string()` for all JSON\n    types.,is_string}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_string() const noexcept\n    {\n        return m_type == value_t::string;\n    }\n\n    /*!\n    @brief return whether value is discarded\n\n    This function returns true iff the JSON value was discarded during parsing\n    with a callback function (see @ref parser_callback_t).\n\n    @note This function will always be `false` for JSON values after parsing.\n    That is, discarded values can only occur during parsing, but will be\n    removed when inside a structured value or replaced by null in other cases.\n\n    @return `true` if type is discarded, `false` otherwise.\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies `is_discarded()` for all JSON\n    types.,is_discarded}\n\n    @since version 1.0.0\n    */\n    constexpr bool is_discarded() const noexcept\n    {\n        return m_type == value_t::discarded;\n    }\n\n    /*!\n    @brief return the type of the JSON value (implicit)\n\n    Implicitly return the type of the JSON value as a value from the @ref\n    value_t enumeration.\n\n    @return the type of the JSON value\n\n    @complexity Constant.\n\n    @exceptionsafety No-throw guarantee: this member function never throws\n    exceptions.\n\n    @liveexample{The following code exemplifies the @ref value_t operator for\n    all JSON types.,operator__value_t}\n\n    @since version 1.0.0\n    */\n    constexpr operator value_t() const noexcept\n    {\n        return m_type;\n    }\n\n    /// @}\n\n  private:\n    //////////////////\n    // value access //\n    //////////////////\n\n    /// get an object (explicit)\n    template <class T, typename\n              std::enable_if<\n                  std::is_convertible<typename object_t::key_type, typename T::key_type>::value and\n                  std::is_convertible<basic_json_t, typename T::mapped_type>::value\n                  , int>::type = 0>\n    T get_impl(T*) const\n    {\n        if (is_object())\n        {\n            return T(m_value.object->begin(), m_value.object->end());\n        }\n        else\n        {\n            throw std::domain_error(\"type must be object, but is \" + type_name());\n        }\n    }\n\n    /// get an object (explicit)\n    object_t get_impl(object_t*) const\n    {\n        if (is_object())\n        {\n            return *(m_value.object);\n        }\n        else\n        {\n            throw std::domain_error(\"type must be object, but is \" + type_name());\n        }\n    }\n\n    /// get an array (explicit)\n    template <class T, typename\n              std::enable_if<\n                  std::is_convertible<basic_json_t, typename T::value_type>::value and\n                  not std::is_same<basic_json_t, typename T::value_type>::value and\n                  not std::is_arithmetic<T>::value and\n                  not std::is_convertible<std::string, T>::value and\n                  not has_mapped_type<T>::value\n                  , int>::type = 0>\n    T get_impl(T*) const\n    {\n        if (is_array())\n        {\n            T to_vector;\n            std::transform(m_value.array->begin(), m_value.array->end(),\n                           std::inserter(to_vector, to_vector.end()), [](basic_json i)\n            {\n                return i.get<typename T::value_type>();\n            });\n            return to_vector;\n        }\n        else\n        {\n            throw std::domain_error(\"type must be array, but is \" + type_name());\n        }\n    }\n\n    /// get an array (explicit)\n    template <class T, typename\n              std::enable_if<\n                  std::is_convertible<basic_json_t, T>::value and\n                  not std::is_same<basic_json_t, T>::value\n                  , int>::type = 0>\n    std::vector<T> get_impl(std::vector<T>*) const\n    {\n        if (is_array())\n        {\n            std::vector<T> to_vector;\n            to_vector.reserve(m_value.array->size());\n            std::transform(m_value.array->begin(), m_value.array->end(),\n                           std::inserter(to_vector, to_vector.end()), [](basic_json i)\n            {\n                return i.get<T>();\n            });\n            return to_vector;\n        }\n        else\n        {\n            throw std::domain_error(\"type must be array, but is \" + type_name());\n        }\n    }\n\n    /// get an array (explicit)\n    template <class T, typename\n              std::enable_if<\n                  std::is_same<basic_json, typename T::value_type>::value and\n                  not has_mapped_type<T>::value\n                  , int>::type = 0>\n    T get_impl(T*) const\n    {\n        if (is_array())\n        {\n            return T(m_value.array->begin(), m_value.array->end());\n        }\n        else\n        {\n            throw std::domain_error(\"type must be array, but is \" + type_name());\n        }\n    }\n\n    /// get an array (explicit)\n    array_t get_impl(array_t*) const\n    {\n        if (is_array())\n        {\n            return *(m_value.array);\n        }\n        else\n        {\n            throw std::domain_error(\"type must be array, but is \" + type_name());\n        }\n    }\n\n    /// get a string (explicit)\n    template <typename T, typename\n              std::enable_if<\n                  std::is_convertible<string_t, T>::value\n                  , int>::type = 0>\n    T get_impl(T*) const\n    {\n        if (is_string())\n        {\n            return *m_value.string;\n        }\n        else\n        {\n            throw std::domain_error(\"type must be string, but is \" + type_name());\n        }\n    }\n\n    /// get a number (explicit)\n    template<typename T, typename\n             std::enable_if<\n                 std::is_arithmetic<T>::value\n                 , int>::type = 0>\n    T get_impl(T*) const\n    {\n        switch (m_type)\n        {\n            case value_t::number_integer:\n            {\n                return static_cast<T>(m_value.number_integer);\n            }\n\n            case value_t::number_unsigned:\n            {\n                return static_cast<T>(m_value.number_unsigned);\n            }\n\n            case value_t::number_float:\n            {\n                return static_cast<T>(m_value.number_float);\n            }\n\n            default:\n            {\n                throw std::domain_error(\"type must be number, but is \" + type_name());\n            }\n        }\n    }\n\n    /// get a boolean (explicit)\n    constexpr boolean_t get_impl(boolean_t*) const\n    {\n        return is_boolean()\n               ? m_value.boolean\n               : throw std::domain_error(\"type must be boolean, but is \" + type_name());\n    }\n\n    /// get a pointer to the value (object)\n    object_t* get_impl_ptr(object_t*) noexcept\n    {\n        return is_object() ? m_value.object : nullptr;\n    }\n\n    /// get a pointer to the value (object)\n    constexpr const object_t* get_impl_ptr(const object_t*) const noexcept\n    {\n        return is_object() ? m_value.object : nullptr;\n    }\n\n    /// get a pointer to the value (array)\n    array_t* get_impl_ptr(array_t*) noexcept\n    {\n        return is_array() ? m_value.array : nullptr;\n    }\n\n    /// get a pointer to the value (array)\n    constexpr const array_t* get_impl_ptr(const array_t*) const noexcept\n    {\n        return is_array() ? m_value.array : nullptr;\n    }\n\n    /// get a pointer to the value (string)\n    string_t* get_impl_ptr(string_t*) noexcept\n    {\n        return is_string() ? m_value.string : nullptr;\n    }\n\n    /// get a pointer to the value (string)\n    constexpr const string_t* get_impl_ptr(const string_t*) const noexcept\n    {\n        return is_string() ? m_value.string : nullptr;\n    }\n\n    /// get a pointer to the value (boolean)\n    boolean_t* get_impl_ptr(boolean_t*) noexcept\n    {\n        return is_boolean() ? &m_value.boolean : nullptr;\n    }\n\n    /// get a pointer to the value (boolean)\n    constexpr const boolean_t* get_impl_ptr(const boolean_t*) const noexcept\n    {\n        return is_boolean() ? &m_value.boolean : nullptr;\n    }\n\n    /// get a pointer to the value (integer number)\n    number_integer_t* get_impl_ptr(number_integer_t*) noexcept\n    {\n        return is_number_integer() ? &m_value.number_integer : nullptr;\n    }\n\n    /// get a pointer to the value (integer number)\n    constexpr const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept\n    {\n        return is_number_integer() ? &m_value.number_integer : nullptr;\n    }\n\n    /// get a pointer to the value (unsigned number)\n    number_unsigned_t* get_impl_ptr(number_unsigned_t*) noexcept\n    {\n        return is_number_unsigned() ? &m_value.number_unsigned : nullptr;\n    }\n\n    /// get a pointer to the value (unsigned number)\n    constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t*) const noexcept\n    {\n        return is_number_unsigned() ? &m_value.number_unsigned : nullptr;\n    }\n\n    /// get a pointer to the value (floating-point number)\n    number_float_t* get_impl_ptr(number_float_t*) noexcept\n    {\n        return is_number_float() ? &m_value.number_float : nullptr;\n    }\n\n    /// get a pointer to the value (floating-point number)\n    constexpr const number_float_t* get_impl_ptr(const number_float_t*) const noexcept\n    {\n        return is_number_float() ? &m_value.number_float : nullptr;\n    }\n\n    /*!\n    @brief helper function to implement get_ref()\n\n    This funcion helps to implement get_ref() without code duplication for\n    const and non-const overloads\n\n    @tparam ThisType will be deduced as `basic_json` or `const basic_json`\n\n    @throw std::domain_error if ReferenceType does not match underlying value\n    type of the current JSON\n    */\n    template<typename ReferenceType, typename ThisType>\n    static ReferenceType get_ref_impl(ThisType& obj)\n    {\n        // helper type\n        using PointerType = typename std::add_pointer<ReferenceType>::type;\n\n        // delegate the call to get_ptr<>()\n        auto ptr = obj.template get_ptr<PointerType>();\n\n        if (ptr != nullptr)\n        {\n            return *ptr;\n        }\n        else\n        {\n            throw std::domain_error(\"incompatible ReferenceType for get_ref, actual type is \" +\n                                    obj.type_name());\n        }\n    }\n\n  public:\n\n    /// @name value access\n    /// Direct access to the stored value of a JSON value.\n    /// @{\n\n    /*!\n    @brief get a value (explicit)\n\n    Explicit type conversion between the JSON value and a compatible value.\n\n    @tparam ValueType non-pointer type compatible to the JSON value, for\n    instance `int` for JSON integer numbers, `bool` for JSON booleans, or\n    `std::vector` types for JSON arrays\n\n    @return copy of the JSON value, converted to type @a ValueType\n\n    @throw std::domain_error in case passed type @a ValueType is incompatible\n    to JSON; example: `\"type must be object, but is null\"`\n\n    @complexity Linear in the size of the JSON value.\n\n    @liveexample{The example below shows several conversions from JSON values\n    to other types. There a few things to note: (1) Floating-point numbers can\n    be converted to integers\\, (2) A JSON array can be converted to a standard\n    `std::vector<short>`\\, (3) A JSON object can be converted to C++\n    associative containers such as `std::unordered_map<std::string\\,\n    json>`.,get__ValueType_const}\n\n    @internal\n    The idea of using a casted null pointer to choose the correct\n    implementation is from <http://stackoverflow.com/a/8315197/266378>.\n    @endinternal\n\n    @sa @ref operator ValueType() const for implicit conversion\n    @sa @ref get() for pointer-member access\n\n    @since version 1.0.0\n    */\n    template<typename ValueType, typename\n             std::enable_if<\n                 not std::is_pointer<ValueType>::value\n                 , int>::type = 0>\n    ValueType get() const\n    {\n        return get_impl(static_cast<ValueType*>(nullptr));\n    }\n\n    /*!\n    @brief get a pointer value (explicit)\n\n    Explicit pointer access to the internally stored JSON value. No copies are\n    made.\n\n    @warning The pointer becomes invalid if the underlying JSON object\n    changes.\n\n    @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref\n    object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,\n    @ref number_unsigned_t, or @ref number_float_t.\n\n    @return pointer to the internally stored JSON value if the requested\n    pointer type @a PointerType fits to the JSON value; `nullptr` otherwise\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how pointers to internal values of a\n    JSON value can be requested. Note that no type conversions are made and a\n    `nullptr` is returned if the value and the requested pointer type does not\n    match.,get__PointerType}\n\n    @sa @ref get_ptr() for explicit pointer-member access\n\n    @since version 1.0.0\n    */\n    template<typename PointerType, typename\n             std::enable_if<\n                 std::is_pointer<PointerType>::value\n                 , int>::type = 0>\n    PointerType get() noexcept\n    {\n        // delegate the call to get_ptr\n        return get_ptr<PointerType>();\n    }\n\n    /*!\n    @brief get a pointer value (explicit)\n    @copydoc get()\n    */\n    template<typename PointerType, typename\n             std::enable_if<\n                 std::is_pointer<PointerType>::value\n                 , int>::type = 0>\n    constexpr const PointerType get() const noexcept\n    {\n        // delegate the call to get_ptr\n        return get_ptr<PointerType>();\n    }\n\n    /*!\n    @brief get a pointer value (implicit)\n\n    Implicit pointer access to the internally stored JSON value. No copies are\n    made.\n\n    @warning Writing data to the pointee of the result yields an undefined\n    state.\n\n    @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref\n    object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,\n    @ref number_unsigned_t, or @ref number_float_t. Enforced by a static\n    assertion.\n\n    @return pointer to the internally stored JSON value if the requested\n    pointer type @a PointerType fits to the JSON value; `nullptr` otherwise\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how pointers to internal values of a\n    JSON value can be requested. Note that no type conversions are made and a\n    `nullptr` is returned if the value and the requested pointer type does not\n    match.,get_ptr}\n\n    @since version 1.0.0\n    */\n    template<typename PointerType, typename\n             std::enable_if<\n                 std::is_pointer<PointerType>::value\n                 , int>::type = 0>\n    PointerType get_ptr() noexcept\n    {\n        // get the type of the PointerType (remove pointer and const)\n        using pointee_t = typename std::remove_const<typename\n                          std::remove_pointer<typename\n                          std::remove_const<PointerType>::type>::type>::type;\n        // make sure the type matches the allowed types\n        static_assert(\n            std::is_same<object_t, pointee_t>::value\n            or std::is_same<array_t, pointee_t>::value\n            or std::is_same<string_t, pointee_t>::value\n            or std::is_same<boolean_t, pointee_t>::value\n            or std::is_same<number_integer_t, pointee_t>::value\n            or std::is_same<number_unsigned_t, pointee_t>::value\n            or std::is_same<number_float_t, pointee_t>::value\n            , \"incompatible pointer type\");\n\n        // delegate the call to get_impl_ptr<>()\n        return get_impl_ptr(static_cast<PointerType>(nullptr));\n    }\n\n    /*!\n    @brief get a pointer value (implicit)\n    @copydoc get_ptr()\n    */\n    template<typename PointerType, typename\n             std::enable_if<\n                 std::is_pointer<PointerType>::value\n                 and std::is_const<typename std::remove_pointer<PointerType>::type>::value\n                 , int>::type = 0>\n    constexpr const PointerType get_ptr() const noexcept\n    {\n        // get the type of the PointerType (remove pointer and const)\n        using pointee_t = typename std::remove_const<typename\n                          std::remove_pointer<typename\n                          std::remove_const<PointerType>::type>::type>::type;\n        // make sure the type matches the allowed types\n        static_assert(\n            std::is_same<object_t, pointee_t>::value\n            or std::is_same<array_t, pointee_t>::value\n            or std::is_same<string_t, pointee_t>::value\n            or std::is_same<boolean_t, pointee_t>::value\n            or std::is_same<number_integer_t, pointee_t>::value\n            or std::is_same<number_unsigned_t, pointee_t>::value\n            or std::is_same<number_float_t, pointee_t>::value\n            , \"incompatible pointer type\");\n\n        // delegate the call to get_impl_ptr<>() const\n        return get_impl_ptr(static_cast<const PointerType>(nullptr));\n    }\n\n    /*!\n    @brief get a reference value (implicit)\n\n    Implict reference access to the internally stored JSON value. No copies\n    are made.\n\n    @warning Writing data to the referee of the result yields an undefined\n    state.\n\n    @tparam ReferenceType reference type; must be a reference to @ref array_t,\n    @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or\n    @ref number_float_t. Enforced by static assertion.\n\n    @return reference to the internally stored JSON value if the requested\n    reference type @a ReferenceType fits to the JSON value; throws\n    std::domain_error otherwise\n\n    @throw std::domain_error in case passed type @a ReferenceType is\n    incompatible with the stored JSON value\n\n    @complexity Constant.\n\n    @liveexample{The example shows several calls to `get_ref()`.,get_ref}\n\n    @since version 1.1.0\n    */\n    template<typename ReferenceType, typename\n             std::enable_if<\n                 std::is_reference<ReferenceType>::value\n                 , int>::type = 0>\n    ReferenceType get_ref()\n    {\n        // delegate call to get_ref_impl\n        return get_ref_impl<ReferenceType>(*this);\n    }\n\n    /*!\n    @brief get a reference value (implicit)\n    @copydoc get_ref()\n    */\n    template<typename ReferenceType, typename\n             std::enable_if<\n                 std::is_reference<ReferenceType>::value\n                 and std::is_const<typename std::remove_reference<ReferenceType>::type>::value\n                 , int>::type = 0>\n    ReferenceType get_ref() const\n    {\n        // delegate call to get_ref_impl\n        return get_ref_impl<ReferenceType>(*this);\n    }\n\n    /*!\n    @brief get a value (implicit)\n\n    Implicit type conversion between the JSON value and a compatible value.\n    The call is realized by calling @ref get() const.\n\n    @tparam ValueType non-pointer type compatible to the JSON value, for\n    instance `int` for JSON integer numbers, `bool` for JSON booleans, or\n    `std::vector` types for JSON arrays. The character type of @ref string_t\n    as well as an initializer list of this type is excluded to avoid\n    ambiguities as these types implicitly convert to `std::string`.\n\n    @return copy of the JSON value, converted to type @a ValueType\n\n    @throw std::domain_error in case passed type @a ValueType is incompatible\n    to JSON, thrown by @ref get() const\n\n    @complexity Linear in the size of the JSON value.\n\n    @liveexample{The example below shows several conversions from JSON values\n    to other types. There a few things to note: (1) Floating-point numbers can\n    be converted to integers\\, (2) A JSON array can be converted to a standard\n    `std::vector<short>`\\, (3) A JSON object can be converted to C++\n    associative containers such as `std::unordered_map<std::string\\,\n    json>`.,operator__ValueType}\n\n    @since version 1.0.0\n    */\n    template < typename ValueType, typename\n               std::enable_if <\n                   not std::is_pointer<ValueType>::value\n                   and not std::is_same<ValueType, typename string_t::value_type>::value\n#ifndef _MSC_VER  // Fix for issue #167 operator<< abiguity under VS2015\n                   and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value\n#endif\n                   , int >::type = 0 >\n    operator ValueType() const\n    {\n        // delegate the call to get<>() const\n        return get<ValueType>();\n    }\n\n    /// @}\n\n\n    ////////////////////\n    // element access //\n    ////////////////////\n\n    /// @name element access\n    /// Access to the JSON value.\n    /// @{\n\n    /*!\n    @brief access specified array element with bounds checking\n\n    Returns a reference to the element at specified location @a idx, with\n    bounds checking.\n\n    @param[in] idx  index of the element to access\n\n    @return reference to the element at index @a idx\n\n    @throw std::domain_error if the JSON value is not an array; example:\n    `\"cannot use at() with string\"`\n    @throw std::out_of_range if the index @a idx is out of range of the array;\n    that is, `idx >= size()`; example: `\"array index 7 is out of range\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how array elements can be read and\n    written using `at()`.,at__size_type}\n\n    @since version 1.0.0\n    */\n    reference at(size_type idx)\n    {\n        // at only works for arrays\n        if (is_array())\n        {\n            try\n            {\n                return m_value.array->at(idx);\n            }\n            catch (std::out_of_range&)\n            {\n                // create better exception explanation\n                throw std::out_of_range(\"array index \" + std::to_string(idx) + \" is out of range\");\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use at() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified array element with bounds checking\n\n    Returns a const reference to the element at specified location @a idx,\n    with bounds checking.\n\n    @param[in] idx  index of the element to access\n\n    @return const reference to the element at index @a idx\n\n    @throw std::domain_error if the JSON value is not an array; example:\n    `\"cannot use at() with string\"`\n    @throw std::out_of_range if the index @a idx is out of range of the array;\n    that is, `idx >= size()`; example: `\"array index 7 is out of range\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how array elements can be read using\n    `at()`.,at__size_type_const}\n\n    @since version 1.0.0\n    */\n    const_reference at(size_type idx) const\n    {\n        // at only works for arrays\n        if (is_array())\n        {\n            try\n            {\n                return m_value.array->at(idx);\n            }\n            catch (std::out_of_range&)\n            {\n                // create better exception explanation\n                throw std::out_of_range(\"array index \" + std::to_string(idx) + \" is out of range\");\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use at() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified object element with bounds checking\n\n    Returns a reference to the element at with specified key @a key, with\n    bounds checking.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw std::domain_error if the JSON value is not an object; example:\n    `\"cannot use at() with boolean\"`\n    @throw std::out_of_range if the key @a key is is not stored in the object;\n    that is, `find(key) == end()`; example: `\"key \"the fast\" not found\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using `at()`.,at__object_t_key_type}\n\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    reference at(const typename object_t::key_type& key)\n    {\n        // at only works for objects\n        if (is_object())\n        {\n            try\n            {\n                return m_value.object->at(key);\n            }\n            catch (std::out_of_range&)\n            {\n                // create better exception explanation\n                throw std::out_of_range(\"key '\" + key + \"' not found\");\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use at() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified object element with bounds checking\n\n    Returns a const reference to the element at with specified key @a key,\n    with bounds checking.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @throw std::domain_error if the JSON value is not an object; example:\n    `\"cannot use at() with boolean\"`\n    @throw std::out_of_range if the key @a key is is not stored in the object;\n    that is, `find(key) == end()`; example: `\"key \"the fast\" not found\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    `at()`.,at__object_t_key_type_const}\n\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    const_reference at(const typename object_t::key_type& key) const\n    {\n        // at only works for objects\n        if (is_object())\n        {\n            try\n            {\n                return m_value.object->at(key);\n            }\n            catch (std::out_of_range&)\n            {\n                // create better exception explanation\n                throw std::out_of_range(\"key '\" + key + \"' not found\");\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use at() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified array element\n\n    Returns a reference to the element at specified location @a idx.\n\n    @note If @a idx is beyond the range of the array (i.e., `idx >= size()`),\n    then the array is silently filled up with `null` values to make `idx` a\n    valid reference to the last stored element.\n\n    @param[in] idx  index of the element to access\n\n    @return reference to the element at index @a idx\n\n    @throw std::domain_error if JSON is not an array or null; example:\n    `\"cannot use operator[] with string\"`\n\n    @complexity Constant if @a idx is in the range of the array. Otherwise\n    linear in `idx - size()`.\n\n    @liveexample{The example below shows how array elements can be read and\n    written using `[]` operator. Note the addition of `null`\n    values.,operatorarray__size_type}\n\n    @since version 1.0.0\n    */\n    reference operator[](size_type idx)\n    {\n        // implicitly convert null value to an empty array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value.array = create<array_t>();\n            assert_invariant();\n        }\n\n        // operator[] only works for arrays\n        if (is_array())\n        {\n            // fill up array with null values if given idx is outside range\n            if (idx >= m_value.array->size())\n            {\n                m_value.array->insert(m_value.array->end(),\n                                      idx - m_value.array->size() + 1,\n                                      basic_json());\n            }\n\n            return m_value.array->operator[](idx);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified array element\n\n    Returns a const reference to the element at specified location @a idx.\n\n    @param[in] idx  index of the element to access\n\n    @return const reference to the element at index @a idx\n\n    @throw std::domain_error if JSON is not an array; example: `\"cannot use\n    operator[] with null\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how array elements can be read using\n    the `[]` operator.,operatorarray__size_type_const}\n\n    @since version 1.0.0\n    */\n    const_reference operator[](size_type idx) const\n    {\n        // const operator[] only works for arrays\n        if (is_array())\n        {\n            return m_value.array->operator[](idx);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified object element\n\n    Returns a reference to the element at with specified key @a key.\n\n    @note If @a key is not found in the object, then it is silently added to\n    the object and filled with a `null` value to make `key` a valid reference.\n    In case the value was `null` before, it is converted to an object.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object or null; example:\n    `\"cannot use operator[] with string\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using the `[]` operator.,operatorarray__key_type}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    reference operator[](const typename object_t::key_type& key)\n    {\n        // implicitly convert null value to an empty object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value.object = create<object_t>();\n            assert_invariant();\n        }\n\n        // operator[] only works for objects\n        if (is_object())\n        {\n            return m_value.object->operator[](key);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief read-only access specified object element\n\n    Returns a const reference to the element at with specified key @a key. No\n    bounds checking is performed.\n\n    @warning If the element with key @a key does not exist, the behavior is\n    undefined.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object; example: `\"cannot use\n    operator[] with null\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    the `[]` operator.,operatorarray__key_type_const}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    const_reference operator[](const typename object_t::key_type& key) const\n    {\n        // const operator[] only works for objects\n        if (is_object())\n        {\n            assert(m_value.object->find(key) != m_value.object->end());\n            return m_value.object->find(key)->second;\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified object element\n\n    Returns a reference to the element at with specified key @a key.\n\n    @note If @a key is not found in the object, then it is silently added to\n    the object and filled with a `null` value to make `key` a valid reference.\n    In case the value was `null` before, it is converted to an object.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object or null; example:\n    `\"cannot use operator[] with string\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using the `[]` operator.,operatorarray__key_type}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    template<typename T, std::size_t n>\n    reference operator[](T * (&key)[n])\n    {\n        return operator[](static_cast<const T>(key));\n    }\n\n    /*!\n    @brief read-only access specified object element\n\n    Returns a const reference to the element at with specified key @a key. No\n    bounds checking is performed.\n\n    @warning If the element with key @a key does not exist, the behavior is\n    undefined.\n\n    @note This function is required for compatibility reasons with Clang.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object; example: `\"cannot use\n    operator[] with null\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    the `[]` operator.,operatorarray__key_type_const}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.0.0\n    */\n    template<typename T, std::size_t n>\n    const_reference operator[](T * (&key)[n]) const\n    {\n        return operator[](static_cast<const T>(key));\n    }\n\n    /*!\n    @brief access specified object element\n\n    Returns a reference to the element at with specified key @a key.\n\n    @note If @a key is not found in the object, then it is silently added to\n    the object and filled with a `null` value to make `key` a valid reference.\n    In case the value was `null` before, it is converted to an object.\n\n    @param[in] key  key of the element to access\n\n    @return reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object or null; example:\n    `\"cannot use operator[] with string\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read and\n    written using the `[]` operator.,operatorarray__key_type}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.1.0\n    */\n    template<typename T>\n    reference operator[](T* key)\n    {\n        // implicitly convert null to object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // at only works for objects\n        if (is_object())\n        {\n            return m_value.object->operator[](key);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief read-only access specified object element\n\n    Returns a const reference to the element at with specified key @a key. No\n    bounds checking is performed.\n\n    @warning If the element with key @a key does not exist, the behavior is\n    undefined.\n\n    @param[in] key  key of the element to access\n\n    @return const reference to the element at key @a key\n\n    @throw std::domain_error if JSON is not an object; example: `\"cannot use\n    operator[] with null\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be read using\n    the `[]` operator.,operatorarray__key_type_const}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref value() for access by value with a default value\n\n    @since version 1.1.0\n    */\n    template<typename T>\n    const_reference operator[](T* key) const\n    {\n        // at only works for objects\n        if (is_object())\n        {\n            assert(m_value.object->find(key) != m_value.object->end());\n            return m_value.object->find(key)->second;\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use operator[] with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief access specified object element with default value\n\n    Returns either a copy of an object's element at the specified key @a key\n    or a given default value if no element with key @a key exists.\n\n    The function is basically equivalent to executing\n    @code {.cpp}\n    try {\n        return at(key);\n    } catch(std::out_of_range) {\n        return default_value;\n    }\n    @endcode\n\n    @note Unlike @ref at(const typename object_t::key_type&), this function\n    does not throw if the given key @a key was not found.\n\n    @note Unlike @ref operator[](const typename object_t::key_type& key), this\n    function does not implicitly add an element to the position defined by @a\n    key. This function is furthermore also applicable to const objects.\n\n    @param[in] key  key of the element to access\n    @param[in] default_value  the value to return if @a key is not found\n\n    @tparam ValueType type compatible to JSON values, for instance `int` for\n    JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for\n    JSON arrays. Note the type of the expected value at @a key and the default\n    value @a default_value must be compatible.\n\n    @return copy of the element at key @a key or @a default_value if @a key\n    is not found\n\n    @throw std::domain_error if JSON is not an object; example: `\"cannot use\n    value() with null\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be queried\n    with a default value.,basic_json__value}\n\n    @sa @ref at(const typename object_t::key_type&) for access by reference\n    with range checking\n    @sa @ref operator[](const typename object_t::key_type&) for unchecked\n    access by reference\n\n    @since version 1.0.0\n    */\n    template <class ValueType, typename\n              std::enable_if<\n                  std::is_convertible<basic_json_t, ValueType>::value\n                  , int>::type = 0>\n    ValueType value(const typename object_t::key_type& key, ValueType default_value) const\n    {\n        // at only works for objects\n        if (is_object())\n        {\n            // if key is found, return value and given default value otherwise\n            const auto it = find(key);\n            if (it != end())\n            {\n                return *it;\n            }\n            else\n            {\n                return default_value;\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use value() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief overload for a default value of type const char*\n    @copydoc basic_json::value(const typename object_t::key_type&, ValueType) const\n    */\n    string_t value(const typename object_t::key_type& key, const char* default_value) const\n    {\n        return value(key, string_t(default_value));\n    }\n\n    /*!\n    @brief access specified object element via JSON Pointer with default value\n\n    Returns either a copy of an object's element at the specified key @a key\n    or a given default value if no element with key @a key exists.\n\n    The function is basically equivalent to executing\n    @code {.cpp}\n    try {\n        return at(ptr);\n    } catch(std::out_of_range) {\n        return default_value;\n    }\n    @endcode\n\n    @note Unlike @ref at(const json_pointer&), this function does not throw\n    if the given key @a key was not found.\n\n    @param[in] ptr  a JSON pointer to the element to access\n    @param[in] default_value  the value to return if @a ptr found no value\n\n    @tparam ValueType type compatible to JSON values, for instance `int` for\n    JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for\n    JSON arrays. Note the type of the expected value at @a key and the default\n    value @a default_value must be compatible.\n\n    @return copy of the element at key @a key or @a default_value if @a key\n    is not found\n\n    @throw std::domain_error if JSON is not an object; example: `\"cannot use\n    value() with null\"`\n\n    @complexity Logarithmic in the size of the container.\n\n    @liveexample{The example below shows how object elements can be queried\n    with a default value.,basic_json__value_ptr}\n\n    @sa @ref operator[](const json_pointer&) for unchecked access by reference\n\n    @since version 2.0.2\n    */\n    template <class ValueType, typename\n              std::enable_if<\n                  std::is_convertible<basic_json_t, ValueType>::value\n                  , int>::type = 0>\n    ValueType value(const json_pointer& ptr, ValueType default_value) const\n    {\n        // at only works for objects\n        if (is_object())\n        {\n            // if pointer resolves a value, return it or use default value\n            try\n            {\n                return ptr.get_checked(this);\n            }\n            catch (std::out_of_range&)\n            {\n                return default_value;\n            }\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use value() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief overload for a default value of type const char*\n    @copydoc basic_json::value(const json_pointer&, ValueType) const\n    */\n    string_t value(const json_pointer& ptr, const char* default_value) const\n    {\n        return value(ptr, string_t(default_value));\n    }\n\n    /*!\n    @brief access the first element\n\n    Returns a reference to the first element in the container. For a JSON\n    container `c`, the expression `c.front()` is equivalent to `*c.begin()`.\n\n    @return In case of a structured type (array or object), a reference to the\n    first element is returned. In cast of number, string, or boolean values, a\n    reference to the value is returned.\n\n    @complexity Constant.\n\n    @pre The JSON value must not be `null` (would throw `std::out_of_range`)\n    or an empty array or object (undefined behavior, guarded by assertions).\n    @post The JSON value remains unchanged.\n\n    @throw std::out_of_range when called on `null` value\n\n    @liveexample{The following code shows an example for `front()`.,front}\n\n    @sa @ref back() -- access the last element\n\n    @since version 1.0.0\n    */\n    reference front()\n    {\n        return *begin();\n    }\n\n    /*!\n    @copydoc basic_json::front()\n    */\n    const_reference front() const\n    {\n        return *cbegin();\n    }\n\n    /*!\n    @brief access the last element\n\n    Returns a reference to the last element in the container. For a JSON\n    container `c`, the expression `c.back()` is equivalent to\n    @code {.cpp}\n    auto tmp = c.end();\n    --tmp;\n    return *tmp;\n    @endcode\n\n    @return In case of a structured type (array or object), a reference to the\n    last element is returned. In cast of number, string, or boolean values, a\n    reference to the value is returned.\n\n    @complexity Constant.\n\n    @pre The JSON value must not be `null` (would throw `std::out_of_range`)\n    or an empty array or object (undefined behavior, guarded by assertions).\n    @post The JSON value remains unchanged.\n\n    @throw std::out_of_range when called on `null` value.\n\n    @liveexample{The following code shows an example for `back()`.,back}\n\n    @sa @ref front() -- access the first element\n\n    @since version 1.0.0\n    */\n    reference back()\n    {\n        auto tmp = end();\n        --tmp;\n        return *tmp;\n    }\n\n    /*!\n    @copydoc basic_json::back()\n    */\n    const_reference back() const\n    {\n        auto tmp = cend();\n        --tmp;\n        return *tmp;\n    }\n\n    /*!\n    @brief remove element given an iterator\n\n    Removes the element specified by iterator @a pos. The iterator @a pos must\n    be valid and dereferenceable. Thus the `end()` iterator (which is valid,\n    but is not dereferenceable) cannot be used as a value for @a pos.\n\n    If called on a primitive type other than `null`, the resulting JSON value\n    will be `null`.\n\n    @param[in] pos iterator to the element to remove\n    @return Iterator following the last removed element. If the iterator @a\n    pos refers to the last element, the `end()` iterator is returned.\n\n    @tparam InteratorType an @ref iterator or @ref const_iterator\n\n    @post Invalidates iterators and references at or after the point of the\n    erase, including the `end()` iterator.\n\n    @throw std::domain_error if called on a `null` value; example: `\"cannot\n    use erase() with null\"`\n    @throw std::domain_error if called on an iterator which does not belong to\n    the current JSON value; example: `\"iterator does not fit current value\"`\n    @throw std::out_of_range if called on a primitive type with invalid\n    iterator (i.e., any iterator which is not `begin()`); example: `\"iterator\n    out of range\"`\n\n    @complexity The complexity depends on the type:\n    - objects: amortized constant\n    - arrays: linear in distance between pos and the end of the container\n    - strings: linear in the length of the string\n    - other types: constant\n\n    @liveexample{The example shows the result of `erase()` for different JSON\n    types.,erase__IteratorType}\n\n    @sa @ref erase(InteratorType, InteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    template <class InteratorType, typename\n              std::enable_if<\n                  std::is_same<InteratorType, typename basic_json_t::iterator>::value or\n                  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value\n                  , int>::type\n              = 0>\n    InteratorType erase(InteratorType pos)\n    {\n        // make sure iterator fits the current value\n        if (this != pos.m_object)\n        {\n            throw std::domain_error(\"iterator does not fit current value\");\n        }\n\n        InteratorType result = end();\n\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            {\n                if (not pos.m_it.primitive_iterator.is_begin())\n                {\n                    throw std::out_of_range(\"iterator out of range\");\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    alloc.destroy(m_value.string);\n                    alloc.deallocate(m_value.string, 1);\n                    m_value.string = nullptr;\n                }\n\n                m_type = value_t::null;\n                assert_invariant();\n                break;\n            }\n\n            case value_t::object:\n            {\n                result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);\n                break;\n            }\n\n            default:\n            {\n                throw std::domain_error(\"cannot use erase() with \" + type_name());\n            }\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief remove elements given an iterator range\n\n    Removes the element specified by the range `[first; last)`. The iterator\n    @a first does not need to be dereferenceable if `first == last`: erasing\n    an empty range is a no-op.\n\n    If called on a primitive type other than `null`, the resulting JSON value\n    will be `null`.\n\n    @param[in] first iterator to the beginning of the range to remove\n    @param[in] last iterator past the end of the range to remove\n    @return Iterator following the last removed element. If the iterator @a\n    second refers to the last element, the `end()` iterator is returned.\n\n    @tparam InteratorType an @ref iterator or @ref const_iterator\n\n    @post Invalidates iterators and references at or after the point of the\n    erase, including the `end()` iterator.\n\n    @throw std::domain_error if called on a `null` value; example: `\"cannot\n    use erase() with null\"`\n    @throw std::domain_error if called on iterators which does not belong to\n    the current JSON value; example: `\"iterators do not fit current value\"`\n    @throw std::out_of_range if called on a primitive type with invalid\n    iterators (i.e., if `first != begin()` and `last != end()`); example:\n    `\"iterators out of range\"`\n\n    @complexity The complexity depends on the type:\n    - objects: `log(size()) + std::distance(first, last)`\n    - arrays: linear in the distance between @a first and @a last, plus linear\n      in the distance between @a last and end of the container\n    - strings: linear in the length of the string\n    - other types: constant\n\n    @liveexample{The example shows the result of `erase()` for different JSON\n    types.,erase__IteratorType_IteratorType}\n\n    @sa @ref erase(InteratorType) -- removes the element at a given position\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    template <class InteratorType, typename\n              std::enable_if<\n                  std::is_same<InteratorType, typename basic_json_t::iterator>::value or\n                  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value\n                  , int>::type\n              = 0>\n    InteratorType erase(InteratorType first, InteratorType last)\n    {\n        // make sure iterator fits the current value\n        if (this != first.m_object or this != last.m_object)\n        {\n            throw std::domain_error(\"iterators do not fit current value\");\n        }\n\n        InteratorType result = end();\n\n        switch (m_type)\n        {\n            case value_t::boolean:\n            case value_t::number_float:\n            case value_t::number_integer:\n            case value_t::number_unsigned:\n            case value_t::string:\n            {\n                if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())\n                {\n                    throw std::out_of_range(\"iterators out of range\");\n                }\n\n                if (is_string())\n                {\n                    AllocatorType<string_t> alloc;\n                    alloc.destroy(m_value.string);\n                    alloc.deallocate(m_value.string, 1);\n                    m_value.string = nullptr;\n                }\n\n                m_type = value_t::null;\n                assert_invariant();\n                break;\n            }\n\n            case value_t::object:\n            {\n                result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,\n                                              last.m_it.object_iterator);\n                break;\n            }\n\n            case value_t::array:\n            {\n                result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,\n                                             last.m_it.array_iterator);\n                break;\n            }\n\n            default:\n            {\n                throw std::domain_error(\"cannot use erase() with \" + type_name());\n            }\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief remove element from a JSON object given a key\n\n    Removes elements from a JSON object with the key value @a key.\n\n    @param[in] key value of the elements to remove\n\n    @return Number of elements removed. If @a ObjectType is the default\n    `std::map` type, the return value will always be `0` (@a key was not\n    found) or `1` (@a key was found).\n\n    @post References and iterators to the erased elements are invalidated.\n    Other references and iterators are not affected.\n\n    @throw std::domain_error when called on a type other than JSON object;\n    example: `\"cannot use erase() with null\"`\n\n    @complexity `log(size()) + count(key)`\n\n    @liveexample{The example shows the effect of `erase()`.,erase__key_type}\n\n    @sa @ref erase(InteratorType) -- removes the element at a given position\n    @sa @ref erase(InteratorType, InteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const size_type) -- removes the element from an array at\n    the given index\n\n    @since version 1.0.0\n    */\n    size_type erase(const typename object_t::key_type& key)\n    {\n        // this erase only works for objects\n        if (is_object())\n        {\n            return m_value.object->erase(key);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use erase() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief remove element from a JSON array given an index\n\n    Removes element from a JSON array at the index @a idx.\n\n    @param[in] idx index of the element to remove\n\n    @throw std::domain_error when called on a type other than JSON array;\n    example: `\"cannot use erase() with null\"`\n    @throw std::out_of_range when `idx >= size()`; example: `\"array index 17\n    is out of range\"`\n\n    @complexity Linear in distance between @a idx and the end of the container.\n\n    @liveexample{The example shows the effect of `erase()`.,erase__size_type}\n\n    @sa @ref erase(InteratorType) -- removes the element at a given position\n    @sa @ref erase(InteratorType, InteratorType) -- removes the elements in\n    the given range\n    @sa @ref erase(const typename object_t::key_type&) -- removes the element\n    from an object at the given key\n\n    @since version 1.0.0\n    */\n    void erase(const size_type idx)\n    {\n        // this erase only works for arrays\n        if (is_array())\n        {\n            if (idx >= size())\n            {\n                throw std::out_of_range(\"array index \" + std::to_string(idx) + \" is out of range\");\n            }\n\n            m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use erase() with \" + type_name());\n        }\n    }\n\n    /// @}\n\n\n    ////////////\n    // lookup //\n    ////////////\n\n    /// @name lookup\n    /// @{\n\n    /*!\n    @brief find an element in a JSON object\n\n    Finds an element in a JSON object with key equivalent to @a key. If the\n    element is not found or the JSON value is not an object, end() is\n    returned.\n\n    @param[in] key key value of the element to search for\n\n    @return Iterator to an element with key equivalent to @a key. If no such\n    element is found, past-the-end (see end()) iterator is returned.\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The example shows how `find()` is used.,find__key_type}\n\n    @since version 1.0.0\n    */\n    iterator find(typename object_t::key_type key)\n    {\n        auto result = end();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_value.object->find(key);\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief find an element in a JSON object\n    @copydoc find(typename object_t::key_type)\n    */\n    const_iterator find(typename object_t::key_type key) const\n    {\n        auto result = cend();\n\n        if (is_object())\n        {\n            result.m_it.object_iterator = m_value.object->find(key);\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief returns the number of occurrences of a key in a JSON object\n\n    Returns the number of elements with key @a key. If ObjectType is the\n    default `std::map` type, the return value will always be `0` (@a key was\n    not found) or `1` (@a key was found).\n\n    @param[in] key key value of the element to count\n\n    @return Number of elements with key @a key. If the JSON value is not an\n    object, the return value will be `0`.\n\n    @complexity Logarithmic in the size of the JSON object.\n\n    @liveexample{The example shows how `count()` is used.,count}\n\n    @since version 1.0.0\n    */\n    size_type count(typename object_t::key_type key) const\n    {\n        // return 0 for all nonobject types\n        return is_object() ? m_value.object->count(key) : 0;\n    }\n\n    /// @}\n\n\n    ///////////////\n    // iterators //\n    ///////////////\n\n    /// @name iterators\n    /// @{\n\n    /*!\n    @brief returns an iterator to the first element\n\n    Returns an iterator to the first element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return iterator to the first element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n\n    @liveexample{The following code shows an example for `begin()`.,begin}\n\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref cend() -- returns a const iterator to the end\n\n    @since version 1.0.0\n    */\n    iterator begin() noexcept\n    {\n        iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /*!\n    @copydoc basic_json::cbegin()\n    */\n    const_iterator begin() const noexcept\n    {\n        return cbegin();\n    }\n\n    /*!\n    @brief returns a const iterator to the first element\n\n    Returns a const iterator to the first element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return const iterator to the first element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).begin()`.\n\n    @liveexample{The following code shows an example for `cbegin()`.,cbegin}\n\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref cend() -- returns a const iterator to the end\n\n    @since version 1.0.0\n    */\n    const_iterator cbegin() const noexcept\n    {\n        const_iterator result(this);\n        result.set_begin();\n        return result;\n    }\n\n    /*!\n    @brief returns an iterator to one past the last element\n\n    Returns an iterator to one past the last element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return iterator one past the last element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n\n    @liveexample{The following code shows an example for `end()`.,end}\n\n    @sa @ref cend() -- returns a const iterator to the end\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n\n    @since version 1.0.0\n    */\n    iterator end() noexcept\n    {\n        iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /*!\n    @copydoc basic_json::cend()\n    */\n    const_iterator end() const noexcept\n    {\n        return cend();\n    }\n\n    /*!\n    @brief returns a const iterator to one past the last element\n\n    Returns a const iterator to one past the last element.\n\n    @image html range-begin-end.svg \"Illustration from cppreference.com\"\n\n    @return const iterator one past the last element\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).end()`.\n\n    @liveexample{The following code shows an example for `cend()`.,cend}\n\n    @sa @ref end() -- returns an iterator to the end\n    @sa @ref begin() -- returns an iterator to the beginning\n    @sa @ref cbegin() -- returns a const iterator to the beginning\n\n    @since version 1.0.0\n    */\n    const_iterator cend() const noexcept\n    {\n        const_iterator result(this);\n        result.set_end();\n        return result;\n    }\n\n    /*!\n    @brief returns an iterator to the reverse-beginning\n\n    Returns an iterator to the reverse-beginning; that is, the last element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `reverse_iterator(end())`.\n\n    @liveexample{The following code shows an example for `rbegin()`.,rbegin}\n\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref crend() -- returns a const reverse iterator to the end\n\n    @since version 1.0.0\n    */\n    reverse_iterator rbegin() noexcept\n    {\n        return reverse_iterator(end());\n    }\n\n    /*!\n    @copydoc basic_json::crbegin()\n    */\n    const_reverse_iterator rbegin() const noexcept\n    {\n        return crbegin();\n    }\n\n    /*!\n    @brief returns an iterator to the reverse-end\n\n    Returns an iterator to the reverse-end; that is, one before the first\n    element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `reverse_iterator(begin())`.\n\n    @liveexample{The following code shows an example for `rend()`.,rend}\n\n    @sa @ref crend() -- returns a const reverse iterator to the end\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n\n    @since version 1.0.0\n    */\n    reverse_iterator rend() noexcept\n    {\n        return reverse_iterator(begin());\n    }\n\n    /*!\n    @copydoc basic_json::crend()\n    */\n    const_reverse_iterator rend() const noexcept\n    {\n        return crend();\n    }\n\n    /*!\n    @brief returns a const reverse iterator to the last element\n\n    Returns a const iterator to the reverse-beginning; that is, the last\n    element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.\n\n    @liveexample{The following code shows an example for `crbegin()`.,crbegin}\n\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref crend() -- returns a const reverse iterator to the end\n\n    @since version 1.0.0\n    */\n    const_reverse_iterator crbegin() const noexcept\n    {\n        return const_reverse_iterator(cend());\n    }\n\n    /*!\n    @brief returns a const reverse iterator to one before the first\n\n    Returns a const reverse iterator to the reverse-end; that is, one before\n    the first element.\n\n    @image html range-rbegin-rend.svg \"Illustration from cppreference.com\"\n\n    @complexity Constant.\n\n    @requirement This function helps `basic_json` satisfying the\n    [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `const_cast<const basic_json&>(*this).rend()`.\n\n    @liveexample{The following code shows an example for `crend()`.,crend}\n\n    @sa @ref rend() -- returns a reverse iterator to the end\n    @sa @ref rbegin() -- returns a reverse iterator to the beginning\n    @sa @ref crbegin() -- returns a const reverse iterator to the beginning\n\n    @since version 1.0.0\n    */\n    const_reverse_iterator crend() const noexcept\n    {\n        return const_reverse_iterator(cbegin());\n    }\n\n  private:\n    // forward declaration\n    template<typename IteratorType> class iteration_proxy;\n\n  public:\n    /*!\n    @brief wrapper to access iterator member functions in range-based for\n\n    This function allows to access @ref iterator::key() and @ref\n    iterator::value() during range-based for loops. In these loops, a\n    reference to the JSON values is returned, so there is no access to the\n    underlying iterator.\n\n    @note The name of this function is not yet final and may change in the\n    future.\n    */\n    static iteration_proxy<iterator> iterator_wrapper(reference cont)\n    {\n        return iteration_proxy<iterator>(cont);\n    }\n\n    /*!\n    @copydoc iterator_wrapper(reference)\n    */\n    static iteration_proxy<const_iterator> iterator_wrapper(const_reference cont)\n    {\n        return iteration_proxy<const_iterator>(cont);\n    }\n\n    /// @}\n\n\n    //////////////\n    // capacity //\n    //////////////\n\n    /// @name capacity\n    /// @{\n\n    /*!\n    @brief checks whether the container is empty\n\n    Checks if a JSON value has no elements.\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `true`\n            boolean     | `false`\n            string      | `false`\n            number      | `false`\n            object      | result of function `object_t::empty()`\n            array       | result of function `array_t::empty()`\n\n    @note This function does not return whether a string stored as JSON value\n    is empty - it returns whether the JSON container itself is empty which is\n    false in the case of a string.\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their `empty()` functions have constant\n    complexity.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `begin() == end()`.\n\n    @liveexample{The following code uses `empty()` to check if a JSON\n    object contains any elements.,empty}\n\n    @sa @ref size() -- returns the number of elements\n\n    @since version 1.0.0\n    */\n    bool empty() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::null:\n            {\n                // null values are empty\n                return true;\n            }\n\n            case value_t::array:\n            {\n                // delegate call to array_t::empty()\n                return m_value.array->empty();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::empty()\n                return m_value.object->empty();\n            }\n\n            default:\n            {\n                // all other types are nonempty\n                return false;\n            }\n        }\n    }\n\n    /*!\n    @brief returns the number of elements\n\n    Returns the number of elements in a JSON value.\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `0`\n            boolean     | `1`\n            string      | `1`\n            number      | `1`\n            object      | result of function object_t::size()\n            array       | result of function array_t::size()\n\n    @note This function does not return the length of a string stored as JSON\n    value - it returns the number of elements in the JSON value which is 1 in\n    the case of a string.\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their size() functions have constant\n    complexity.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of `std::distance(begin(), end())`.\n\n    @liveexample{The following code calls `size()` on the different value\n    types.,size}\n\n    @sa @ref empty() -- checks whether the container is empty\n    @sa @ref max_size() -- returns the maximal number of elements\n\n    @since version 1.0.0\n    */\n    size_type size() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::null:\n            {\n                // null values are empty\n                return 0;\n            }\n\n            case value_t::array:\n            {\n                // delegate call to array_t::size()\n                return m_value.array->size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::size()\n                return m_value.object->size();\n            }\n\n            default:\n            {\n                // all other types have size 1\n                return 1;\n            }\n        }\n    }\n\n    /*!\n    @brief returns the maximum possible number of elements\n\n    Returns the maximum number of elements a JSON value is able to hold due to\n    system or library implementation limitations, i.e. `std::distance(begin(),\n    end())` for the JSON value.\n\n    @return The return value depends on the different types and is\n            defined as follows:\n            Value type  | return value\n            ----------- | -------------\n            null        | `0` (same as `size()`)\n            boolean     | `1` (same as `size()`)\n            string      | `1` (same as `size()`)\n            number      | `1` (same as `size()`)\n            object      | result of function `object_t::max_size()`\n            array       | result of function `array_t::max_size()`\n\n    @complexity Constant, as long as @ref array_t and @ref object_t satisfy\n    the Container concept; that is, their `max_size()` functions have constant\n    complexity.\n\n    @requirement This function helps `basic_json` satisfying the\n    [Container](http://en.cppreference.com/w/cpp/concept/Container)\n    requirements:\n    - The complexity is constant.\n    - Has the semantics of returning `b.size()` where `b` is the largest\n      possible JSON value.\n\n    @liveexample{The following code calls `max_size()` on the different value\n    types. Note the output is implementation specific.,max_size}\n\n    @sa @ref size() -- returns the number of elements\n\n    @since version 1.0.0\n    */\n    size_type max_size() const noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::array:\n            {\n                // delegate call to array_t::max_size()\n                return m_value.array->max_size();\n            }\n\n            case value_t::object:\n            {\n                // delegate call to object_t::max_size()\n                return m_value.object->max_size();\n            }\n\n            default:\n            {\n                // all other types have max_size() == size()\n                return size();\n            }\n        }\n    }\n\n    /// @}\n\n\n    ///////////////\n    // modifiers //\n    ///////////////\n\n    /// @name modifiers\n    /// @{\n\n    /*!\n    @brief clears the contents\n\n    Clears the content of a JSON value and resets it to the default value as\n    if @ref basic_json(value_t) would have been called:\n\n    Value type  | initial value\n    ----------- | -------------\n    null        | `null`\n    boolean     | `false`\n    string      | `\"\"`\n    number      | `0`\n    object      | `{}`\n    array       | `[]`\n\n    @note Floating-point numbers are set to `0.0` which will be serialized to\n    `0`. The vale type remains @ref number_float_t.\n\n    @complexity Linear in the size of the JSON value.\n\n    @liveexample{The example below shows the effect of `clear()` to different\n    JSON types.,clear}\n\n    @since version 1.0.0\n    */\n    void clear() noexcept\n    {\n        switch (m_type)\n        {\n            case value_t::number_integer:\n            {\n                m_value.number_integer = 0;\n                break;\n            }\n\n            case value_t::number_unsigned:\n            {\n                m_value.number_unsigned = 0;\n                break;\n            }\n\n            case value_t::number_float:\n            {\n                m_value.number_float = 0.0;\n                break;\n            }\n\n            case value_t::boolean:\n            {\n                m_value.boolean = false;\n                break;\n            }\n\n            case value_t::string:\n            {\n                m_value.string->clear();\n                break;\n            }\n\n            case value_t::array:\n            {\n                m_value.array->clear();\n                break;\n            }\n\n            case value_t::object:\n            {\n                m_value.object->clear();\n                break;\n            }\n\n            default:\n            {\n                break;\n            }\n        }\n    }\n\n    /*!\n    @brief add an object to an array\n\n    Appends the given element @a val to the end of the JSON value. If the\n    function is called on a JSON null value, an empty array is created before\n    appending @a val.\n\n    @param[in] val the value to add to the JSON array\n\n    @throw std::domain_error when called on a type other than JSON array or\n    null; example: `\"cannot use push_back() with number\"`\n\n    @complexity Amortized constant.\n\n    @liveexample{The example shows how `push_back()` and `+=` can be used to\n    add elements to a JSON array. Note how the `null` value was silently\n    converted to a JSON array.,push_back}\n\n    @since version 1.0.0\n    */\n    void push_back(basic_json&& val)\n    {\n        // push_back only works for null objects or arrays\n        if (not(is_null() or is_array()))\n        {\n            throw std::domain_error(\"cannot use push_back() with \" + type_name());\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array (move semantics)\n        m_value.array->push_back(std::move(val));\n        // invalidate object\n        val.m_type = value_t::null;\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    reference operator+=(basic_json&& val)\n    {\n        push_back(std::move(val));\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    void push_back(const basic_json& val)\n    {\n        // push_back only works for null objects or arrays\n        if (not(is_null() or is_array()))\n        {\n            throw std::domain_error(\"cannot use push_back() with \" + type_name());\n        }\n\n        // transform null object into an array\n        if (is_null())\n        {\n            m_type = value_t::array;\n            m_value = value_t::array;\n            assert_invariant();\n        }\n\n        // add element to array\n        m_value.array->push_back(val);\n    }\n\n    /*!\n    @brief add an object to an array\n    @copydoc push_back(basic_json&&)\n    */\n    reference operator+=(const basic_json& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an object\n\n    Inserts the given element @a val to the JSON object. If the function is\n    called on a JSON null value, an empty object is created before inserting\n    @a val.\n\n    @param[in] val the value to add to the JSON object\n\n    @throw std::domain_error when called on a type other than JSON object or\n    null; example: `\"cannot use push_back() with number\"`\n\n    @complexity Logarithmic in the size of the container, O(log(`size()`)).\n\n    @liveexample{The example shows how `push_back()` and `+=` can be used to\n    add elements to a JSON object. Note how the `null` value was silently\n    converted to a JSON object.,push_back__object_t__value}\n\n    @since version 1.0.0\n    */\n    void push_back(const typename object_t::value_type& val)\n    {\n        // push_back only works for null objects or objects\n        if (not(is_null() or is_object()))\n        {\n            throw std::domain_error(\"cannot use push_back() with \" + type_name());\n        }\n\n        // transform null object into an object\n        if (is_null())\n        {\n            m_type = value_t::object;\n            m_value = value_t::object;\n            assert_invariant();\n        }\n\n        // add element to array\n        m_value.object->insert(val);\n    }\n\n    /*!\n    @brief add an object to an object\n    @copydoc push_back(const typename object_t::value_type&)\n    */\n    reference operator+=(const typename object_t::value_type& val)\n    {\n        push_back(val);\n        return *this;\n    }\n\n    /*!\n    @brief add an object to an object\n\n    This function allows to use `push_back` with an initializer list. In case\n\n    1. the current value is an object,\n    2. the initializer list @a init contains only two elements, and\n    3. the first element of @a init is a string,\n\n    @a init is converted into an object element and added using\n    @ref push_back(const typename object_t::value_type&). Otherwise, @a init\n    is converted to a JSON value and added using @ref push_back(basic_json&&).\n\n    @param init  an initializer list\n\n    @complexity Linear in the size of the initializer list @a init.\n\n    @note This function is required to resolve an ambiguous overload error,\n          because pairs like `{\"key\", \"value\"}` can be both interpreted as\n          `object_t::value_type` or `std::initializer_list<basic_json>`, see\n          https://github.com/nlohmann/json/issues/235 for more information.\n\n    @liveexample{The example shows how initializer lists are treated as\n    objects when possible.,push_back__initializer_list}\n    */\n    void push_back(std::initializer_list<basic_json> init)\n    {\n        if (is_object() and init.size() == 2 and init.begin()->is_string())\n        {\n            const string_t key = *init.begin();\n            push_back(typename object_t::value_type(key, *(init.begin() + 1)));\n        }\n        else\n        {\n            push_back(basic_json(init));\n        }\n    }\n\n    /*!\n    @brief add an object to an object\n    @copydoc push_back(std::initializer_list<basic_json>)\n    */\n    reference operator+=(std::initializer_list<basic_json> init)\n    {\n        push_back(init);\n        return *this;\n    }\n\n    /*!\n    @brief inserts element\n\n    Inserts element @a val before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] val element to insert\n    @return iterator pointing to the inserted @a val.\n\n    @throw std::domain_error if called on JSON values other than arrays;\n    example: `\"cannot use insert() with string\"`\n    @throw std::domain_error if @a pos is not an iterator of *this; example:\n    `\"iterator does not fit current value\"`\n\n    @complexity Constant plus linear in the distance between pos and end of the\n    container.\n\n    @liveexample{The example shows how `insert()` is used.,insert}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, const basic_json& val)\n    {\n        // insert only works for arrays\n        if (is_array())\n        {\n            // check if iterator pos fits to this JSON value\n            if (pos.m_object != this)\n            {\n                throw std::domain_error(\"iterator does not fit current value\");\n            }\n\n            // insert to array and return iterator\n            iterator result(this);\n            result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val);\n            return result;\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use insert() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief inserts element\n    @copydoc insert(const_iterator, const basic_json&)\n    */\n    iterator insert(const_iterator pos, basic_json&& val)\n    {\n        return insert(pos, val);\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts @a cnt copies of @a val before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] cnt number of copies of @a val to insert\n    @param[in] val element to insert\n    @return iterator pointing to the first element inserted, or @a pos if\n    `cnt==0`\n\n    @throw std::domain_error if called on JSON values other than arrays;\n    example: `\"cannot use insert() with string\"`\n    @throw std::domain_error if @a pos is not an iterator of *this; example:\n    `\"iterator does not fit current value\"`\n\n    @complexity Linear in @a cnt plus linear in the distance between @a pos\n    and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__count}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, size_type cnt, const basic_json& val)\n    {\n        // insert only works for arrays\n        if (is_array())\n        {\n            // check if iterator pos fits to this JSON value\n            if (pos.m_object != this)\n            {\n                throw std::domain_error(\"iterator does not fit current value\");\n            }\n\n            // insert to array and return iterator\n            iterator result(this);\n            result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);\n            return result;\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use insert() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts elements from range `[first, last)` before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] first begin of the range of elements to insert\n    @param[in] last end of the range of elements to insert\n\n    @throw std::domain_error if called on JSON values other than arrays;\n    example: `\"cannot use insert() with string\"`\n    @throw std::domain_error if @a pos is not an iterator of *this; example:\n    `\"iterator does not fit current value\"`\n    @throw std::domain_error if @a first and @a last do not belong to the same\n    JSON value; example: `\"iterators do not fit\"`\n    @throw std::domain_error if @a first or @a last are iterators into\n    container for which insert is called; example: `\"passed iterators may not\n    belong to container\"`\n\n    @return iterator pointing to the first element inserted, or @a pos if\n    `first==last`\n\n    @complexity Linear in `std::distance(first, last)` plus linear in the\n    distance between @a pos and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__range}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, const_iterator first, const_iterator last)\n    {\n        // insert only works for arrays\n        if (not is_array())\n        {\n            throw std::domain_error(\"cannot use insert() with \" + type_name());\n        }\n\n        // check if iterator pos fits to this JSON value\n        if (pos.m_object != this)\n        {\n            throw std::domain_error(\"iterator does not fit current value\");\n        }\n\n        // check if range iterators belong to the same JSON object\n        if (first.m_object != last.m_object)\n        {\n            throw std::domain_error(\"iterators do not fit\");\n        }\n\n        if (first.m_object == this or last.m_object == this)\n        {\n            throw std::domain_error(\"passed iterators may not belong to container\");\n        }\n\n        // insert to array and return iterator\n        iterator result(this);\n        result.m_it.array_iterator = m_value.array->insert(\n                                         pos.m_it.array_iterator,\n                                         first.m_it.array_iterator,\n                                         last.m_it.array_iterator);\n        return result;\n    }\n\n    /*!\n    @brief inserts elements\n\n    Inserts elements from initializer list @a ilist before iterator @a pos.\n\n    @param[in] pos iterator before which the content will be inserted; may be\n    the end() iterator\n    @param[in] ilist initializer list to insert the values from\n\n    @throw std::domain_error if called on JSON values other than arrays;\n    example: `\"cannot use insert() with string\"`\n    @throw std::domain_error if @a pos is not an iterator of *this; example:\n    `\"iterator does not fit current value\"`\n\n    @return iterator pointing to the first element inserted, or @a pos if\n    `ilist` is empty\n\n    @complexity Linear in `ilist.size()` plus linear in the distance between\n    @a pos and end of the container.\n\n    @liveexample{The example shows how `insert()` is used.,insert__ilist}\n\n    @since version 1.0.0\n    */\n    iterator insert(const_iterator pos, std::initializer_list<basic_json> ilist)\n    {\n        // insert only works for arrays\n        if (not is_array())\n        {\n            throw std::domain_error(\"cannot use insert() with \" + type_name());\n        }\n\n        // check if iterator pos fits to this JSON value\n        if (pos.m_object != this)\n        {\n            throw std::domain_error(\"iterator does not fit current value\");\n        }\n\n        // insert to array and return iterator\n        iterator result(this);\n        result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);\n        return result;\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of the JSON value with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other JSON value to exchange the contents with\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how JSON values can be swapped with\n    `swap()`.,swap__reference}\n\n    @since version 1.0.0\n    */\n    void swap(reference other) noexcept (\n        std::is_nothrow_move_constructible<value_t>::value and\n        std::is_nothrow_move_assignable<value_t>::value and\n        std::is_nothrow_move_constructible<json_value>::value and\n        std::is_nothrow_move_assignable<json_value>::value\n    )\n    {\n        std::swap(m_type, other.m_type);\n        std::swap(m_value, other.m_value);\n        assert_invariant();\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON array with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other array to exchange the contents with\n\n    @throw std::domain_error when JSON value is not an array; example: `\"cannot\n    use swap() with string\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how arrays can be swapped with\n    `swap()`.,swap__array_t}\n\n    @since version 1.0.0\n    */\n    void swap(array_t& other)\n    {\n        // swap only works for arrays\n        if (is_array())\n        {\n            std::swap(*(m_value.array), other);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use swap() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON object with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other object to exchange the contents with\n\n    @throw std::domain_error when JSON value is not an object; example:\n    `\"cannot use swap() with string\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how objects can be swapped with\n    `swap()`.,swap__object_t}\n\n    @since version 1.0.0\n    */\n    void swap(object_t& other)\n    {\n        // swap only works for objects\n        if (is_object())\n        {\n            std::swap(*(m_value.object), other);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use swap() with \" + type_name());\n        }\n    }\n\n    /*!\n    @brief exchanges the values\n\n    Exchanges the contents of a JSON string with those of @a other. Does not\n    invoke any move, copy, or swap operations on individual elements. All\n    iterators and references remain valid. The past-the-end iterator is\n    invalidated.\n\n    @param[in,out] other string to exchange the contents with\n\n    @throw std::domain_error when JSON value is not a string; example: `\"cannot\n    use swap() with boolean\"`\n\n    @complexity Constant.\n\n    @liveexample{The example below shows how strings can be swapped with\n    `swap()`.,swap__string_t}\n\n    @since version 1.0.0\n    */\n    void swap(string_t& other)\n    {\n        // swap only works for strings\n        if (is_string())\n        {\n            std::swap(*(m_value.string), other);\n        }\n        else\n        {\n            throw std::domain_error(\"cannot use swap() with \" + type_name());\n        }\n    }\n\n    /// @}\n\n\n    //////////////////////////////////////////\n    // lexicographical comparison operators //\n    //////////////////////////////////////////\n\n    /// @name lexicographical comparison operators\n    /// @{\n\n  private:\n    /*!\n    @brief comparison operator for JSON types\n\n    Returns an ordering that is similar to Python:\n    - order: null < boolean < number < object < array < string\n    - furthermore, each type is not smaller than itself\n\n    @since version 1.0.0\n    */\n    friend bool operator<(const value_t lhs, const value_t rhs) noexcept\n    {\n        static constexpr std::array<uint8_t, 8> order = {{\n                0, // null\n                3, // object\n                4, // array\n                5, // string\n                1, // boolean\n                2, // integer\n                2, // unsigned\n                2, // float\n            }\n        };\n\n        // discarded values are not comparable\n        if (lhs == value_t::discarded or rhs == value_t::discarded)\n        {\n            return false;\n        }\n\n        return order[static_cast<std::size_t>(lhs)] < order[static_cast<std::size_t>(rhs)];\n    }\n\n  public:\n    /*!\n    @brief comparison: equal\n\n    Compares two JSON values for equality according to the following rules:\n    - Two JSON values are equal if (1) they are from the same type and (2)\n      their stored values are the same.\n    - Integer and floating-point numbers are automatically converted before\n      comparison. Floating-point numbers are compared indirectly: two\n      floating-point numbers `f1` and `f2` are considered equal if neither\n      `f1 > f2` nor `f2 > f1` holds.\n    - Two JSON null values are equal.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether the values @a lhs and @a rhs are equal\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__equal}\n\n    @since version 1.0.0\n    */\n    friend bool operator==(const_reference lhs, const_reference rhs) noexcept\n    {\n        const auto lhs_type = lhs.type();\n        const auto rhs_type = rhs.type();\n\n        if (lhs_type == rhs_type)\n        {\n            switch (lhs_type)\n            {\n                case value_t::array:\n                {\n                    return *lhs.m_value.array == *rhs.m_value.array;\n                }\n                case value_t::object:\n                {\n                    return *lhs.m_value.object == *rhs.m_value.object;\n                }\n                case value_t::null:\n                {\n                    return true;\n                }\n                case value_t::string:\n                {\n                    return *lhs.m_value.string == *rhs.m_value.string;\n                }\n                case value_t::boolean:\n                {\n                    return lhs.m_value.boolean == rhs.m_value.boolean;\n                }\n                case value_t::number_integer:\n                {\n                    return lhs.m_value.number_integer == rhs.m_value.number_integer;\n                }\n                case value_t::number_unsigned:\n                {\n                    return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;\n                }\n                case value_t::number_float:\n                {\n                    return lhs.m_value.number_float == rhs.m_value.number_float;\n                }\n                default:\n                {\n                    return false;\n                }\n            }\n        }\n        else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)\n        {\n            return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_integer);\n        }\n        else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)\n        {\n            return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;\n        }\n        else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_integer == static_cast<number_integer_t>(rhs.m_value.number_unsigned);\n        }\n\n        return false;\n    }\n\n    /*!\n    @brief comparison: equal\n\n    The functions compares the given JSON value against a null pointer. As the\n    null pointer can be used to initialize a JSON value to null, a comparison\n    of JSON value @a v with a null pointer should be equivalent to call\n    `v.is_null()`.\n\n    @param[in] v  JSON value to consider\n    @return whether @a v is null\n\n    @complexity Constant.\n\n    @liveexample{The example compares several JSON types to the null pointer.\n    ,operator__equal__nullptr_t}\n\n    @since version 1.0.0\n    */\n    friend bool operator==(const_reference v, std::nullptr_t) noexcept\n    {\n        return v.is_null();\n    }\n\n    /*!\n    @brief comparison: equal\n    @copydoc operator==(const_reference, std::nullptr_t)\n    */\n    friend bool operator==(std::nullptr_t, const_reference v) noexcept\n    {\n        return v.is_null();\n    }\n\n    /*!\n    @brief comparison: not equal\n\n    Compares two JSON values for inequality by calculating `not (lhs == rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether the values @a lhs and @a rhs are not equal\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__notequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator!=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return not (lhs == rhs);\n    }\n\n    /*!\n    @brief comparison: not equal\n\n    The functions compares the given JSON value against a null pointer. As the\n    null pointer can be used to initialize a JSON value to null, a comparison\n    of JSON value @a v with a null pointer should be equivalent to call\n    `not v.is_null()`.\n\n    @param[in] v  JSON value to consider\n    @return whether @a v is not null\n\n    @complexity Constant.\n\n    @liveexample{The example compares several JSON types to the null pointer.\n    ,operator__notequal__nullptr_t}\n\n    @since version 1.0.0\n    */\n    friend bool operator!=(const_reference v, std::nullptr_t) noexcept\n    {\n        return not v.is_null();\n    }\n\n    /*!\n    @brief comparison: not equal\n    @copydoc operator!=(const_reference, std::nullptr_t)\n    */\n    friend bool operator!=(std::nullptr_t, const_reference v) noexcept\n    {\n        return not v.is_null();\n    }\n\n    /*!\n    @brief comparison: less than\n\n    Compares whether one JSON value @a lhs is less than another JSON value @a\n    rhs according to the following rules:\n    - If @a lhs and @a rhs have the same type, the values are compared using\n      the default `<` operator.\n    - Integer and floating-point numbers are automatically converted before\n      comparison\n    - In case @a lhs and @a rhs have different types, the values are ignored\n      and the order of the types is considered, see\n      @ref operator<(const value_t, const value_t).\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is less than @a rhs\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__less}\n\n    @since version 1.0.0\n    */\n    friend bool operator<(const_reference lhs, const_reference rhs) noexcept\n    {\n        const auto lhs_type = lhs.type();\n        const auto rhs_type = rhs.type();\n\n        if (lhs_type == rhs_type)\n        {\n            switch (lhs_type)\n            {\n                case value_t::array:\n                {\n                    return *lhs.m_value.array < *rhs.m_value.array;\n                }\n                case value_t::object:\n                {\n                    return *lhs.m_value.object < *rhs.m_value.object;\n                }\n                case value_t::null:\n                {\n                    return false;\n                }\n                case value_t::string:\n                {\n                    return *lhs.m_value.string < *rhs.m_value.string;\n                }\n                case value_t::boolean:\n                {\n                    return lhs.m_value.boolean < rhs.m_value.boolean;\n                }\n                case value_t::number_integer:\n                {\n                    return lhs.m_value.number_integer < rhs.m_value.number_integer;\n                }\n                case value_t::number_unsigned:\n                {\n                    return lhs.m_value.number_unsigned < rhs.m_value.number_unsigned;\n                }\n                case value_t::number_float:\n                {\n                    return lhs.m_value.number_float < rhs.m_value.number_float;\n                }\n                default:\n                {\n                    return false;\n                }\n            }\n        }\n        else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)\n        {\n            return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_integer);\n        }\n        else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)\n        {\n            return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;\n        }\n        else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)\n        {\n            return lhs.m_value.number_integer < static_cast<number_integer_t>(rhs.m_value.number_unsigned);\n        }\n        else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)\n        {\n            return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;\n        }\n\n        // We only reach this line if we cannot compare values. In that case,\n        // we compare types. Note we have to call the operator explicitly,\n        // because MSVC has problems otherwise.\n        return operator<(lhs_type, rhs_type);\n    }\n\n    /*!\n    @brief comparison: less than or equal\n\n    Compares whether one JSON value @a lhs is less than or equal to another\n    JSON value by calculating `not (rhs < lhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is less than or equal to @a rhs\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__greater}\n\n    @since version 1.0.0\n    */\n    friend bool operator<=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return not (rhs < lhs);\n    }\n\n    /*!\n    @brief comparison: greater than\n\n    Compares whether one JSON value @a lhs is greater than another\n    JSON value by calculating `not (lhs <= rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is greater than to @a rhs\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__lessequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator>(const_reference lhs, const_reference rhs) noexcept\n    {\n        return not (lhs <= rhs);\n    }\n\n    /*!\n    @brief comparison: greater than or equal\n\n    Compares whether one JSON value @a lhs is greater than or equal to another\n    JSON value by calculating `not (lhs < rhs)`.\n\n    @param[in] lhs  first JSON value to consider\n    @param[in] rhs  second JSON value to consider\n    @return whether @a lhs is greater than or equal to @a rhs\n\n    @complexity Linear.\n\n    @liveexample{The example demonstrates comparing several JSON\n    types.,operator__greaterequal}\n\n    @since version 1.0.0\n    */\n    friend bool operator>=(const_reference lhs, const_reference rhs) noexcept\n    {\n        return not (lhs < rhs);\n    }\n\n    /// @}\n\n\n    ///////////////////\n    // serialization //\n    ///////////////////\n\n    /// @name serialization\n    /// @{\n\n    /*!\n    @brief serialize to stream\n\n    Serialize the given JSON value @a j to the output stream @a o. The JSON\n    value will be serialized using the @ref dump member function. The\n    indentation of the output can be controlled with the member variable\n    `width` of the output stream @a o. For instance, using the manipulator\n    `std::setw(4)` on @a o sets the indentation level to `4` and the\n    serialization result is the same as calling `dump(4)`.\n\n    @note During serializaion, the locale and the precision of the output\n    stream @a o are changed. The original values are restored when the\n    function returns.\n\n    @param[in,out] o  stream to serialize to\n    @param[in] j  JSON value to serialize\n\n    @return the stream @a o\n\n    @complexity Linear.\n\n    @liveexample{The example below shows the serialization with different\n    parameters to `width` to adjust the indentation level.,operator_serialize}\n\n    @since version 1.0.0\n    */\n    friend std::ostream& operator<<(std::ostream& o, const basic_json& j)\n    {\n        // read width member and use it as indentation parameter if nonzero\n        const bool pretty_print = (o.width() > 0);\n        const auto indentation = (pretty_print ? o.width() : 0);\n\n        // reset width to 0 for subsequent calls to this stream\n        o.width(0);\n\n        // fix locale problems\n        const auto old_locale = o.imbue(std::locale(std::locale(), new DecimalSeparator));\n        // set precision\n\n        // 6, 15 or 16 digits of precision allows round-trip IEEE 754\n        // string->float->string, string->double->string or string->long\n        // double->string; to be safe, we read this value from\n        // std::numeric_limits<number_float_t>::digits10\n        const auto old_precision = o.precision(std::numeric_limits<double>::digits10);\n\n        // do the actual serialization\n        j.dump(o, pretty_print, static_cast<unsigned int>(indentation));\n\n        // reset locale and precision\n        o.imbue(old_locale);\n        o.precision(old_precision);\n        return o;\n    }\n\n    /*!\n    @brief serialize to stream\n    @copydoc operator<<(std::ostream&, const basic_json&)\n    */\n    friend std::ostream& operator>>(const basic_json& j, std::ostream& o)\n    {\n        return o << j;\n    }\n\n    /// @}\n\n\n    /////////////////////\n    // deserialization //\n    /////////////////////\n\n    /// @name deserialization\n    /// @{\n\n    /*!\n    @brief deserialize from string\n\n    @param[in] s  string to read a serialized JSON value from\n    @param[in] cb a parser callback function of type @ref parser_callback_t\n    which is used to control the deserialization by filtering unwanted values\n    (optional)\n\n    @return result of the deserialization\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser. The complexity can be higher if the parser callback function\n    @a cb has a super-linear complexity.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates the `parse()` function with\n    and without callback function.,parse__string__parser_callback_t}\n\n    @sa @ref parse(std::istream&, const parser_callback_t) for a version that\n    reads from an input stream\n\n    @since version 1.0.0\n    */\n    static basic_json parse(const string_t& s,\n                            const parser_callback_t cb = nullptr)\n    {\n        return parser(s, cb).parse();\n    }\n\n    /*!\n    @brief deserialize from stream\n\n    @param[in,out] i  stream to read a serialized JSON value from\n    @param[in] cb a parser callback function of type @ref parser_callback_t\n    which is used to control the deserialization by filtering unwanted values\n    (optional)\n\n    @return result of the deserialization\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser. The complexity can be higher if the parser callback function\n    @a cb has a super-linear complexity.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below demonstrates the `parse()` function with\n    and without callback function.,parse__istream__parser_callback_t}\n\n    @sa @ref parse(const string_t&, const parser_callback_t) for a version\n    that reads from a string\n\n    @since version 1.0.0\n    */\n    static basic_json parse(std::istream& i,\n                            const parser_callback_t cb = nullptr)\n    {\n        return parser(i, cb).parse();\n    }\n\n    /*!\n    @copydoc parse(std::istream&, const parser_callback_t)\n    */\n    static basic_json parse(std::istream&& i,\n                            const parser_callback_t cb = nullptr)\n    {\n        return parser(i, cb).parse();\n    }\n\n    /*!\n    @brief deserialize from stream\n\n    Deserializes an input stream to a JSON value.\n\n    @param[in,out] i  input stream to read a serialized JSON value from\n    @param[in,out] j  JSON value to write the deserialized input to\n\n    @throw std::invalid_argument in case of parse errors\n\n    @complexity Linear in the length of the input. The parser is a predictive\n    LL(1) parser.\n\n    @note A UTF-8 byte order mark is silently ignored.\n\n    @liveexample{The example below shows how a JSON value is constructed by\n    reading a serialization from a stream.,operator_deserialize}\n\n    @sa parse(std::istream&, const parser_callback_t) for a variant with a\n    parser callback function to filter values while parsing\n\n    @since version 1.0.0\n    */\n    friend std::istream& operator<<(basic_json& j, std::istream& i)\n    {\n        j = parser(i).parse();\n        return i;\n    }\n\n    /*!\n    @brief deserialize from stream\n    @copydoc operator<<(basic_json&, std::istream&)\n    */\n    friend std::istream& operator>>(std::istream& i, basic_json& j)\n    {\n        j = parser(i).parse();\n        return i;\n    }\n\n    /// @}\n\n\n  private:\n    ///////////////////////////\n    // convenience functions //\n    ///////////////////////////\n\n    /*!\n    @brief return the type as string\n\n    Returns the type name as string to be used in error messages - usually to\n    indicate that a function was called on a wrong JSON type.\n\n    @return basically a string representation of a the @ref m_type member\n\n    @complexity Constant.\n\n    @since version 1.0.0\n    */\n    std::string type_name() const\n    {\n        switch (m_type)\n        {\n            case value_t::null:\n                return \"null\";\n            case value_t::object:\n                return \"object\";\n            case value_t::array:\n                return \"array\";\n            case value_t::string:\n                return \"string\";\n            case value_t::boolean:\n                return \"boolean\";\n            case value_t::discarded:\n                return \"discarded\";\n            default:\n                return \"number\";\n        }\n    }\n\n    /*!\n    @brief calculates the extra space to escape a JSON string\n\n    @param[in] s  the string to escape\n    @return the number of characters required to escape string @a s\n\n    @complexity Linear in the length of string @a s.\n    */\n    static std::size_t extra_space(const string_t& s) noexcept\n    {\n        return std::accumulate(s.begin(), s.end(), size_t{},\n                               [](size_t res, typename string_t::value_type c)\n        {\n            switch (c)\n            {\n                case '\"':\n                case '\\\\':\n                case '\\b':\n                case '\\f':\n                case '\\n':\n                case '\\r':\n                case '\\t':\n                {\n                    // from c (1 byte) to \\x (2 bytes)\n                    return res + 1;\n                }\n\n                default:\n                {\n                    if (c >= 0x00 and c <= 0x1f)\n                    {\n                        // from c (1 byte) to \\uxxxx (6 bytes)\n                        return res + 5;\n                    }\n                    else\n                    {\n                        return res;\n                    }\n                }\n            }\n        });\n    }\n\n    /*!\n    @brief escape a string\n\n    Escape a string by replacing certain special characters by a sequence of\n    an escape character (backslash) and another character and other control\n    characters by a sequence of \"\\u\" followed by a four-digit hex\n    representation.\n\n    @param[in] s  the string to escape\n    @return  the escaped string\n\n    @complexity Linear in the length of string @a s.\n    */\n    static string_t escape_string(const string_t& s)\n    {\n        const auto space = extra_space(s);\n        if (space == 0)\n        {\n            return s;\n        }\n\n        // create a result string of necessary size\n        string_t result(s.size() + space, '\\\\');\n        std::size_t pos = 0;\n\n        for (const auto& c : s)\n        {\n            switch (c)\n            {\n                // quotation mark (0x22)\n                case '\"':\n                {\n                    result[pos + 1] = '\"';\n                    pos += 2;\n                    break;\n                }\n\n                // reverse solidus (0x5c)\n                case '\\\\':\n                {\n                    // nothing to change\n                    pos += 2;\n                    break;\n                }\n\n                // backspace (0x08)\n                case '\\b':\n                {\n                    result[pos + 1] = 'b';\n                    pos += 2;\n                    break;\n                }\n\n                // formfeed (0x0c)\n                case '\\f':\n                {\n                    result[pos + 1] = 'f';\n                    pos += 2;\n                    break;\n                }\n\n                // newline (0x0a)\n                case '\\n':\n                {\n                    result[pos + 1] = 'n';\n                    pos += 2;\n                    break;\n                }\n\n                // carriage return (0x0d)\n                case '\\r':\n                {\n                    result[pos + 1] = 'r';\n                    pos += 2;\n                    break;\n                }\n\n                // horizontal tab (0x09)\n                case '\\t':\n                {\n                    result[pos + 1] = 't';\n                    pos += 2;\n                    break;\n                }\n\n                default:\n                {\n                    if (c >= 0x00 and c <= 0x1f)\n                    {\n                        // convert a number 0..15 to its hex representation\n                        // (0..f)\n                        static const char hexify[16] =\n                        {\n                            '0', '1', '2', '3', '4', '5', '6', '7',\n                            '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'\n                        };\n\n                        // print character c as \\uxxxx\n                        for (const char m :\n                    { 'u', '0', '0', hexify[c >> 4], hexify[c & 0x0f]\n                        })\n                        {\n                            result[++pos] = m;\n                        }\n\n                        ++pos;\n                    }\n                    else\n                    {\n                        // all other characters are added as-is\n                        result[pos++] = c;\n                    }\n                    break;\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief internal implementation of the serialization function\n\n    This function is called by the public member function dump and organizes\n    the serialization internally. The indentation level is propagated as\n    additional parameter. In case of arrays and objects, the function is\n    called recursively. Note that\n\n    - strings and object keys are escaped using `escape_string()`\n    - integer numbers are converted implicitly via `operator<<`\n    - floating-point numbers are converted to a string using `\"%g\"` format\n\n    @param[out] o              stream to write to\n    @param[in] pretty_print    whether the output shall be pretty-printed\n    @param[in] indent_step     the indent level\n    @param[in] current_indent  the current indent level (only used internally)\n    */\n    void dump(std::ostream& o,\n              const bool pretty_print,\n              const unsigned int indent_step,\n              const unsigned int current_indent = 0) const\n    {\n        // variable to hold indentation for recursive calls\n        unsigned int new_indent = current_indent;\n\n        switch (m_type)\n        {\n            case value_t::object:\n            {\n                if (m_value.object->empty())\n                {\n                    o << \"{}\";\n                    return;\n                }\n\n                o << \"{\";\n\n                // increase indentation\n                if (pretty_print)\n                {\n                    new_indent += indent_step;\n                    o << \"\\n\";\n                }\n\n                for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i)\n                {\n                    if (i != m_value.object->cbegin())\n                    {\n                        o << (pretty_print ? \",\\n\" : \",\");\n                    }\n                    o << string_t(new_indent, ' ') << \"\\\"\"\n                      << escape_string(i->first) << \"\\\":\"\n                      << (pretty_print ? \" \" : \"\");\n                    i->second.dump(o, pretty_print, indent_step, new_indent);\n                }\n\n                // decrease indentation\n                if (pretty_print)\n                {\n                    new_indent -= indent_step;\n                    o << \"\\n\";\n                }\n\n                o << string_t(new_indent, ' ') + \"}\";\n                return;\n            }\n\n            case value_t::array:\n            {\n                if (m_value.array->empty())\n                {\n                    o << \"[]\";\n                    return;\n                }\n\n                o << \"[\";\n\n                // increase indentation\n                if (pretty_print)\n                {\n                    new_indent += indent_step;\n                    o << \"\\n\";\n                }\n\n                for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i)\n                {\n                    if (i != m_value.array->cbegin())\n                    {\n                        o << (pretty_print ? \",\\n\" : \",\");\n                    }\n                    o << string_t(new_indent, ' ');\n                    i->dump(o, pretty_print, indent_step, new_indent);\n                }\n\n                // decrease indentation\n                if (pretty_print)\n                {\n                    new_indent -= indent_step;\n                    o << \"\\n\";\n                }\n\n                o << string_t(new_indent, ' ') << \"]\";\n                return;\n            }\n\n            case value_t::string:\n            {\n                o << string_t(\"\\\"\") << escape_string(*m_value.string) << \"\\\"\";\n                return;\n            }\n\n            case value_t::boolean:\n            {\n                o << (m_value.boolean ? \"true\" : \"false\");\n                return;\n            }\n\n            case value_t::number_integer:\n            {\n                o << m_value.number_integer;\n                return;\n            }\n\n            case value_t::number_unsigned:\n            {\n                o << m_value.number_unsigned;\n                return;\n            }\n\n            case value_t::number_float:\n            {\n                if (m_value.number_float == 0)\n                {\n                    // special case for zero to get \"0.0\"/\"-0.0\"\n                    o << (std::signbit(m_value.number_float) ? \"-0.0\" : \"0.0\");\n                }\n                else\n                {\n                    o << m_value.number_float;\n                }\n                return;\n            }\n\n            case value_t::discarded:\n            {\n                o << \"<discarded>\";\n                return;\n            }\n\n            case value_t::null:\n            {\n                o << \"null\";\n                return;\n            }\n        }\n    }\n\n  private:\n    //////////////////////\n    // member variables //\n    //////////////////////\n\n    /// the type of the current element\n    value_t m_type = value_t::null;\n\n    /// the value of the current element\n    json_value m_value = {};\n\n\n  private:\n    ///////////////\n    // iterators //\n    ///////////////\n\n    /*!\n    @brief an iterator for primitive JSON types\n\n    This class models an iterator for primitive JSON types (boolean, number,\n    string). It's only purpose is to allow the iterator/const_iterator classes\n    to \"iterate\" over primitive values. Internally, the iterator is modeled by\n    a `difference_type` variable. Value begin_value (`0`) models the begin,\n    end_value (`1`) models past the end.\n    */\n    class primitive_iterator_t\n    {\n      public:\n        /// set iterator to a defined beginning\n        void set_begin() noexcept\n        {\n            m_it = begin_value;\n        }\n\n        /// set iterator to a defined past the end\n        void set_end() noexcept\n        {\n            m_it = end_value;\n        }\n\n        /// return whether the iterator can be dereferenced\n        constexpr bool is_begin() const noexcept\n        {\n            return (m_it == begin_value);\n        }\n\n        /// return whether the iterator is at end\n        constexpr bool is_end() const noexcept\n        {\n            return (m_it == end_value);\n        }\n\n        /// return reference to the value to change and compare\n        operator difference_type& () noexcept\n        {\n            return m_it;\n        }\n\n        /// return value to compare\n        constexpr operator difference_type () const noexcept\n        {\n            return m_it;\n        }\n\n      private:\n        static constexpr difference_type begin_value = 0;\n        static constexpr difference_type end_value = begin_value + 1;\n\n        /// iterator as signed integer type\n        difference_type m_it = std::numeric_limits<std::ptrdiff_t>::denorm_min();\n    };\n\n    /*!\n    @brief an iterator value\n\n    @note This structure could easily be a union, but MSVC currently does not\n    allow unions members with complex constructors, see\n    https://github.com/nlohmann/json/pull/105.\n    */\n    struct internal_iterator\n    {\n        /// iterator for JSON objects\n        typename object_t::iterator object_iterator;\n        /// iterator for JSON arrays\n        typename array_t::iterator array_iterator;\n        /// generic iterator for all other types\n        primitive_iterator_t primitive_iterator;\n\n        /// create an uninitialized internal_iterator\n        internal_iterator() noexcept\n            : object_iterator(), array_iterator(), primitive_iterator()\n        {}\n    };\n\n    /// proxy class for the iterator_wrapper functions\n    template<typename IteratorType>\n    class iteration_proxy\n    {\n      private:\n        /// helper class for iteration\n        class iteration_proxy_internal\n        {\n          private:\n            /// the iterator\n            IteratorType anchor;\n            /// an index for arrays (used to create key names)\n            size_t array_index = 0;\n\n          public:\n            explicit iteration_proxy_internal(IteratorType it) noexcept\n                : anchor(it)\n            {}\n\n            /// dereference operator (needed for range-based for)\n            iteration_proxy_internal& operator*()\n            {\n                return *this;\n            }\n\n            /// increment operator (needed for range-based for)\n            iteration_proxy_internal& operator++()\n            {\n                ++anchor;\n                ++array_index;\n\n                return *this;\n            }\n\n            /// inequality operator (needed for range-based for)\n            bool operator!= (const iteration_proxy_internal& o) const\n            {\n                return anchor != o.anchor;\n            }\n\n            /// return key of the iterator\n            typename basic_json::string_t key() const\n            {\n                assert(anchor.m_object != nullptr);\n\n                switch (anchor.m_object->type())\n                {\n                    // use integer array index as key\n                    case value_t::array:\n                    {\n                        return std::to_string(array_index);\n                    }\n\n                    // use key from the object\n                    case value_t::object:\n                    {\n                        return anchor.key();\n                    }\n\n                    // use an empty key for all primitive types\n                    default:\n                    {\n                        return \"\";\n                    }\n                }\n            }\n\n            /// return value of the iterator\n            typename IteratorType::reference value() const\n            {\n                return anchor.value();\n            }\n        };\n\n        /// the container to iterate\n        typename IteratorType::reference container;\n\n      public:\n        /// construct iteration proxy from a container\n        explicit iteration_proxy(typename IteratorType::reference cont)\n            : container(cont)\n        {}\n\n        /// return iterator begin (needed for range-based for)\n        iteration_proxy_internal begin() noexcept\n        {\n            return iteration_proxy_internal(container.begin());\n        }\n\n        /// return iterator end (needed for range-based for)\n        iteration_proxy_internal end() noexcept\n        {\n            return iteration_proxy_internal(container.end());\n        }\n    };\n\n  public:\n    /*!\n    @brief a const random access iterator for the @ref basic_json class\n\n    This class implements a const iterator for the @ref basic_json class. From\n    this class, the @ref iterator class is derived.\n\n    @note An iterator is called *initialized* when a pointer to a JSON value\n          has been set (e.g., by a constructor or a copy assignment). If the\n          iterator is default-constructed, it is *uninitialized* and most\n          methods are undefined. The library uses assertions to detect calls\n          on uninitialized iterators.\n\n    @requirement The class satisfies the following concept requirements:\n    - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):\n      The iterator that can be moved to point (forward and backward) to any\n      element in constant time.\n\n    @since version 1.0.0\n    */\n    class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>\n    {\n        /// allow basic_json to access private members\n        friend class basic_json;\n\n      public:\n        /// the type of the values when the iterator is dereferenced\n        using value_type = typename basic_json::value_type;\n        /// a type to represent differences between iterators\n        using difference_type = typename basic_json::difference_type;\n        /// defines a pointer to the type iterated over (value_type)\n        using pointer = typename basic_json::const_pointer;\n        /// defines a reference to the type iterated over (value_type)\n        using reference = typename basic_json::const_reference;\n        /// the category of the iterator\n        using iterator_category = std::bidirectional_iterator_tag;\n\n        /// default constructor\n        const_iterator() = default;\n\n        /*!\n        @brief constructor for a given JSON instance\n        @param[in] object  pointer to a JSON object for this iterator\n        @pre object != nullptr\n        @post The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        explicit const_iterator(pointer object) noexcept\n            : m_object(object)\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    m_it.object_iterator = typename object_t::iterator();\n                    break;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    m_it.array_iterator = typename array_t::iterator();\n                    break;\n                }\n\n                default:\n                {\n                    m_it.primitive_iterator = primitive_iterator_t();\n                    break;\n                }\n            }\n        }\n\n        /*!\n        @brief copy constructor given a non-const iterator\n        @param[in] other  iterator to copy from\n        @note It is not checked whether @a other is initialized.\n        */\n        explicit const_iterator(const iterator& other) noexcept\n            : m_object(other.m_object)\n        {\n            if (m_object != nullptr)\n            {\n                switch (m_object->m_type)\n                {\n                    case basic_json::value_t::object:\n                    {\n                        m_it.object_iterator = other.m_it.object_iterator;\n                        break;\n                    }\n\n                    case basic_json::value_t::array:\n                    {\n                        m_it.array_iterator = other.m_it.array_iterator;\n                        break;\n                    }\n\n                    default:\n                    {\n                        m_it.primitive_iterator = other.m_it.primitive_iterator;\n                        break;\n                    }\n                }\n            }\n        }\n\n        /*!\n        @brief copy constructor\n        @param[in] other  iterator to copy from\n        @note It is not checked whether @a other is initialized.\n        */\n        const_iterator(const const_iterator& other) noexcept\n            : m_object(other.m_object), m_it(other.m_it)\n        {}\n\n        /*!\n        @brief copy assignment\n        @param[in,out] other  iterator to copy from\n        @note It is not checked whether @a other is initialized.\n        */\n        const_iterator& operator=(const_iterator other) noexcept(\n            std::is_nothrow_move_constructible<pointer>::value and\n            std::is_nothrow_move_assignable<pointer>::value and\n            std::is_nothrow_move_constructible<internal_iterator>::value and\n            std::is_nothrow_move_assignable<internal_iterator>::value\n        )\n        {\n            std::swap(m_object, other.m_object);\n            std::swap(m_it, other.m_it);\n            return *this;\n        }\n\n      private:\n        /*!\n        @brief set the iterator to the first value\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        void set_begin() noexcept\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    m_it.object_iterator = m_object->m_value.object->begin();\n                    break;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    m_it.array_iterator = m_object->m_value.array->begin();\n                    break;\n                }\n\n                case basic_json::value_t::null:\n                {\n                    // set to end so begin()==end() is true: null is empty\n                    m_it.primitive_iterator.set_end();\n                    break;\n                }\n\n                default:\n                {\n                    m_it.primitive_iterator.set_begin();\n                    break;\n                }\n            }\n        }\n\n        /*!\n        @brief set the iterator past the last value\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        void set_end() noexcept\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    m_it.object_iterator = m_object->m_value.object->end();\n                    break;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    m_it.array_iterator = m_object->m_value.array->end();\n                    break;\n                }\n\n                default:\n                {\n                    m_it.primitive_iterator.set_end();\n                    break;\n                }\n            }\n        }\n\n      public:\n        /*!\n        @brief return a reference to the value pointed to by the iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        reference operator*() const\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    assert(m_it.object_iterator != m_object->m_value.object->end());\n                    return m_it.object_iterator->second;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    assert(m_it.array_iterator != m_object->m_value.array->end());\n                    return *m_it.array_iterator;\n                }\n\n                case basic_json::value_t::null:\n                {\n                    throw std::out_of_range(\"cannot get value\");\n                }\n\n                default:\n                {\n                    if (m_it.primitive_iterator.is_begin())\n                    {\n                        return *m_object;\n                    }\n                    else\n                    {\n                        throw std::out_of_range(\"cannot get value\");\n                    }\n                }\n            }\n        }\n\n        /*!\n        @brief dereference the iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        pointer operator->() const\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    assert(m_it.object_iterator != m_object->m_value.object->end());\n                    return &(m_it.object_iterator->second);\n                }\n\n                case basic_json::value_t::array:\n                {\n                    assert(m_it.array_iterator != m_object->m_value.array->end());\n                    return &*m_it.array_iterator;\n                }\n\n                default:\n                {\n                    if (m_it.primitive_iterator.is_begin())\n                    {\n                        return m_object;\n                    }\n                    else\n                    {\n                        throw std::out_of_range(\"cannot get value\");\n                    }\n                }\n            }\n        }\n\n        /*!\n        @brief post-increment (it++)\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator operator++(int)\n        {\n            auto result = *this;\n            ++(*this);\n            return result;\n        }\n\n        /*!\n        @brief pre-increment (++it)\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator& operator++()\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    std::advance(m_it.object_iterator, 1);\n                    break;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    std::advance(m_it.array_iterator, 1);\n                    break;\n                }\n\n                default:\n                {\n                    ++m_it.primitive_iterator;\n                    break;\n                }\n            }\n\n            return *this;\n        }\n\n        /*!\n        @brief post-decrement (it--)\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator operator--(int)\n        {\n            auto result = *this;\n            --(*this);\n            return result;\n        }\n\n        /*!\n        @brief pre-decrement (--it)\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator& operator--()\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    std::advance(m_it.object_iterator, -1);\n                    break;\n                }\n\n                case basic_json::value_t::array:\n                {\n                    std::advance(m_it.array_iterator, -1);\n                    break;\n                }\n\n                default:\n                {\n                    --m_it.primitive_iterator;\n                    break;\n                }\n            }\n\n            return *this;\n        }\n\n        /*!\n        @brief  comparison: equal\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator==(const const_iterator& other) const\n        {\n            // if objects are not the same, the comparison is undefined\n            if (m_object != other.m_object)\n            {\n                throw std::domain_error(\"cannot compare iterators of different containers\");\n            }\n\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    return (m_it.object_iterator == other.m_it.object_iterator);\n                }\n\n                case basic_json::value_t::array:\n                {\n                    return (m_it.array_iterator == other.m_it.array_iterator);\n                }\n\n                default:\n                {\n                    return (m_it.primitive_iterator == other.m_it.primitive_iterator);\n                }\n            }\n        }\n\n        /*!\n        @brief  comparison: not equal\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator!=(const const_iterator& other) const\n        {\n            return not operator==(other);\n        }\n\n        /*!\n        @brief  comparison: smaller\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator<(const const_iterator& other) const\n        {\n            // if objects are not the same, the comparison is undefined\n            if (m_object != other.m_object)\n            {\n                throw std::domain_error(\"cannot compare iterators of different containers\");\n            }\n\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    throw std::domain_error(\"cannot compare order of object iterators\");\n                }\n\n                case basic_json::value_t::array:\n                {\n                    return (m_it.array_iterator < other.m_it.array_iterator);\n                }\n\n                default:\n                {\n                    return (m_it.primitive_iterator < other.m_it.primitive_iterator);\n                }\n            }\n        }\n\n        /*!\n        @brief  comparison: less than or equal\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator<=(const const_iterator& other) const\n        {\n            return not other.operator < (*this);\n        }\n\n        /*!\n        @brief  comparison: greater than\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator>(const const_iterator& other) const\n        {\n            return not operator<=(other);\n        }\n\n        /*!\n        @brief  comparison: greater than or equal\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        bool operator>=(const const_iterator& other) const\n        {\n            return not operator<(other);\n        }\n\n        /*!\n        @brief  add to iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator& operator+=(difference_type i)\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    throw std::domain_error(\"cannot use offsets with object iterators\");\n                }\n\n                case basic_json::value_t::array:\n                {\n                    std::advance(m_it.array_iterator, i);\n                    break;\n                }\n\n                default:\n                {\n                    m_it.primitive_iterator += i;\n                    break;\n                }\n            }\n\n            return *this;\n        }\n\n        /*!\n        @brief  subtract from iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator& operator-=(difference_type i)\n        {\n            return operator+=(-i);\n        }\n\n        /*!\n        @brief  add to iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator operator+(difference_type i)\n        {\n            auto result = *this;\n            result += i;\n            return result;\n        }\n\n        /*!\n        @brief  subtract from iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        const_iterator operator-(difference_type i)\n        {\n            auto result = *this;\n            result -= i;\n            return result;\n        }\n\n        /*!\n        @brief  return difference\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        difference_type operator-(const const_iterator& other) const\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    throw std::domain_error(\"cannot use offsets with object iterators\");\n                }\n\n                case basic_json::value_t::array:\n                {\n                    return m_it.array_iterator - other.m_it.array_iterator;\n                }\n\n                default:\n                {\n                    return m_it.primitive_iterator - other.m_it.primitive_iterator;\n                }\n            }\n        }\n\n        /*!\n        @brief  access to successor\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        reference operator[](difference_type n) const\n        {\n            assert(m_object != nullptr);\n\n            switch (m_object->m_type)\n            {\n                case basic_json::value_t::object:\n                {\n                    throw std::domain_error(\"cannot use operator[] for object iterators\");\n                }\n\n                case basic_json::value_t::array:\n                {\n                    return *std::next(m_it.array_iterator, n);\n                }\n\n                case basic_json::value_t::null:\n                {\n                    throw std::out_of_range(\"cannot get value\");\n                }\n\n                default:\n                {\n                    if (m_it.primitive_iterator == -n)\n                    {\n                        return *m_object;\n                    }\n                    else\n                    {\n                        throw std::out_of_range(\"cannot get value\");\n                    }\n                }\n            }\n        }\n\n        /*!\n        @brief  return the key of an object iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        typename object_t::key_type key() const\n        {\n            assert(m_object != nullptr);\n\n            if (m_object->is_object())\n            {\n                return m_it.object_iterator->first;\n            }\n            else\n            {\n                throw std::domain_error(\"cannot use key() for non-object iterators\");\n            }\n        }\n\n        /*!\n        @brief  return the value of an iterator\n        @pre The iterator is initialized; i.e. `m_object != nullptr`.\n        */\n        reference value() const\n        {\n            return operator*();\n        }\n\n      private:\n        /// associated JSON instance\n        pointer m_object = nullptr;\n        /// the actual iterator of the associated instance\n        internal_iterator m_it = internal_iterator();\n    };\n\n    /*!\n    @brief a mutable random access iterator for the @ref basic_json class\n\n    @requirement The class satisfies the following concept requirements:\n    - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):\n      The iterator that can be moved to point (forward and backward) to any\n      element in constant time.\n    - [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):\n      It is possible to write to the pointed-to element.\n\n    @since version 1.0.0\n    */\n    class iterator : public const_iterator\n    {\n      public:\n        using base_iterator = const_iterator;\n        using pointer = typename basic_json::pointer;\n        using reference = typename basic_json::reference;\n\n        /// default constructor\n        iterator() = default;\n\n        /// constructor for a given JSON instance\n        explicit iterator(pointer object) noexcept\n            : base_iterator(object)\n        {}\n\n        /// copy constructor\n        iterator(const iterator& other) noexcept\n            : base_iterator(other)\n        {}\n\n        /// copy assignment\n        iterator& operator=(iterator other) noexcept(\n            std::is_nothrow_move_constructible<pointer>::value and\n            std::is_nothrow_move_assignable<pointer>::value and\n            std::is_nothrow_move_constructible<internal_iterator>::value and\n            std::is_nothrow_move_assignable<internal_iterator>::value\n        )\n        {\n            base_iterator::operator=(other);\n            return *this;\n        }\n\n        /// return a reference to the value pointed to by the iterator\n        reference operator*() const\n        {\n            return const_cast<reference>(base_iterator::operator*());\n        }\n\n        /// dereference the iterator\n        pointer operator->() const\n        {\n            return const_cast<pointer>(base_iterator::operator->());\n        }\n\n        /// post-increment (it++)\n        iterator operator++(int)\n        {\n            iterator result = *this;\n            base_iterator::operator++();\n            return result;\n        }\n\n        /// pre-increment (++it)\n        iterator& operator++()\n        {\n            base_iterator::operator++();\n            return *this;\n        }\n\n        /// post-decrement (it--)\n        iterator operator--(int)\n        {\n            iterator result = *this;\n            base_iterator::operator--();\n            return result;\n        }\n\n        /// pre-decrement (--it)\n        iterator& operator--()\n        {\n            base_iterator::operator--();\n            return *this;\n        }\n\n        /// add to iterator\n        iterator& operator+=(difference_type i)\n        {\n            base_iterator::operator+=(i);\n            return *this;\n        }\n\n        /// subtract from iterator\n        iterator& operator-=(difference_type i)\n        {\n            base_iterator::operator-=(i);\n            return *this;\n        }\n\n        /// add to iterator\n        iterator operator+(difference_type i)\n        {\n            auto result = *this;\n            result += i;\n            return result;\n        }\n\n        /// subtract from iterator\n        iterator operator-(difference_type i)\n        {\n            auto result = *this;\n            result -= i;\n            return result;\n        }\n\n        /// return difference\n        difference_type operator-(const iterator& other) const\n        {\n            return base_iterator::operator-(other);\n        }\n\n        /// access to successor\n        reference operator[](difference_type n) const\n        {\n            return const_cast<reference>(base_iterator::operator[](n));\n        }\n\n        /// return the value of an iterator\n        reference value() const\n        {\n            return const_cast<reference>(base_iterator::value());\n        }\n    };\n\n    /*!\n    @brief a template for a reverse iterator class\n\n    @tparam Base the base iterator type to reverse. Valid types are @ref\n    iterator (to create @ref reverse_iterator) and @ref const_iterator (to\n    create @ref const_reverse_iterator).\n\n    @requirement The class satisfies the following concept requirements:\n    - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):\n      The iterator that can be moved to point (forward and backward) to any\n      element in constant time.\n    - [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):\n      It is possible to write to the pointed-to element (only if @a Base is\n      @ref iterator).\n\n    @since version 1.0.0\n    */\n    template<typename Base>\n    class json_reverse_iterator : public std::reverse_iterator<Base>\n    {\n      public:\n        /// shortcut to the reverse iterator adaptor\n        using base_iterator = std::reverse_iterator<Base>;\n        /// the reference type for the pointed-to element\n        using reference = typename Base::reference;\n\n        /// create reverse iterator from iterator\n        json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept\n            : base_iterator(it)\n        {}\n\n        /// create reverse iterator from base class\n        json_reverse_iterator(const base_iterator& it) noexcept\n            : base_iterator(it)\n        {}\n\n        /// post-increment (it++)\n        json_reverse_iterator operator++(int)\n        {\n            return base_iterator::operator++(1);\n        }\n\n        /// pre-increment (++it)\n        json_reverse_iterator& operator++()\n        {\n            base_iterator::operator++();\n            return *this;\n        }\n\n        /// post-decrement (it--)\n        json_reverse_iterator operator--(int)\n        {\n            return base_iterator::operator--(1);\n        }\n\n        /// pre-decrement (--it)\n        json_reverse_iterator& operator--()\n        {\n            base_iterator::operator--();\n            return *this;\n        }\n\n        /// add to iterator\n        json_reverse_iterator& operator+=(difference_type i)\n        {\n            base_iterator::operator+=(i);\n            return *this;\n        }\n\n        /// add to iterator\n        json_reverse_iterator operator+(difference_type i) const\n        {\n            auto result = *this;\n            result += i;\n            return result;\n        }\n\n        /// subtract from iterator\n        json_reverse_iterator operator-(difference_type i) const\n        {\n            auto result = *this;\n            result -= i;\n            return result;\n        }\n\n        /// return difference\n        difference_type operator-(const json_reverse_iterator& other) const\n        {\n            return this->base() - other.base();\n        }\n\n        /// access to successor\n        reference operator[](difference_type n) const\n        {\n            return *(this->operator+(n));\n        }\n\n        /// return the key of an object iterator\n        typename object_t::key_type key() const\n        {\n            auto it = --this->base();\n            return it.key();\n        }\n\n        /// return the value of an iterator\n        reference value() const\n        {\n            auto it = --this->base();\n            return it.operator * ();\n        }\n    };\n\n\n  private:\n    //////////////////////\n    // lexer and parser //\n    //////////////////////\n\n    /*!\n    @brief lexical analysis\n\n    This class organizes the lexical analysis during JSON deserialization. The\n    core of it is a scanner generated by [re2c](http://re2c.org) that\n    processes a buffer and recognizes tokens according to RFC 7159.\n    */\n    class lexer\n    {\n      public:\n        /// token types for the parser\n        enum class token_type\n        {\n            uninitialized,   ///< indicating the scanner is uninitialized\n            literal_true,    ///< the `true` literal\n            literal_false,   ///< the `false` literal\n            literal_null,    ///< the `null` literal\n            value_string,    ///< a string -- use get_string() for actual value\n            value_number,    ///< a number -- use get_number() for actual value\n            begin_array,     ///< the character for array begin `[`\n            begin_object,    ///< the character for object begin `{`\n            end_array,       ///< the character for array end `]`\n            end_object,      ///< the character for object end `}`\n            name_separator,  ///< the name separator `:`\n            value_separator, ///< the value separator `,`\n            parse_error,     ///< indicating a parse error\n            end_of_input     ///< indicating the end of the input buffer\n        };\n\n        /// the char type to use in the lexer\n        using lexer_char_t = unsigned char;\n\n        /// constructor with a given buffer\n        explicit lexer(const string_t& s) noexcept\n            : m_stream(nullptr), m_buffer(s)\n        {\n            m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());\n            assert(m_content != nullptr);\n            m_start = m_cursor = m_content;\n            m_limit = m_content + s.size();\n        }\n\n        /// constructor with a given stream\n        explicit lexer(std::istream* s) noexcept\n            : m_stream(s), m_buffer()\n        {\n            assert(m_stream != nullptr);\n            std::getline(*m_stream, m_buffer);\n            m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());\n            assert(m_content != nullptr);\n            m_start = m_cursor = m_content;\n            m_limit = m_content + m_buffer.size();\n        }\n\n        /// default constructor\n        lexer() = default;\n\n        // switch off unwanted functions\n        lexer(const lexer&) = delete;\n        lexer operator=(const lexer&) = delete;\n\n        /*!\n        @brief create a string from one or two Unicode code points\n\n        There are two cases: (1) @a codepoint1 is in the Basic Multilingual\n        Plane (U+0000 through U+FFFF) and @a codepoint2 is 0, or (2)\n        @a codepoint1 and @a codepoint2 are a UTF-16 surrogate pair to\n        represent a code point above U+FFFF.\n\n        @param[in] codepoint1  the code point (can be high surrogate)\n        @param[in] codepoint2  the code point (can be low surrogate or 0)\n\n        @return string representation of the code point; the length of the\n        result string is between 1 and 4 characters.\n\n        @throw std::out_of_range if code point is > 0x10ffff; example: `\"code\n        points above 0x10FFFF are invalid\"`\n        @throw std::invalid_argument if the low surrogate is invalid; example:\n        `\"\"missing or wrong low surrogate\"\"`\n\n        @complexity Constant.\n\n        @see <http://en.wikipedia.org/wiki/UTF-8#Sample_code>\n        */\n        static string_t to_unicode(const std::size_t codepoint1,\n                                   const std::size_t codepoint2 = 0)\n        {\n            // calculate the code point from the given code points\n            std::size_t codepoint = codepoint1;\n\n            // check if codepoint1 is a high surrogate\n            if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)\n            {\n                // check if codepoint2 is a low surrogate\n                if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)\n                {\n                    codepoint =\n                        // high surrogate occupies the most significant 22 bits\n                        (codepoint1 << 10)\n                        // low surrogate occupies the least significant 15 bits\n                        + codepoint2\n                        // there is still the 0xD800, 0xDC00 and 0x10000 noise\n                        // in the result so we have to subtract with:\n                        // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00\n                        - 0x35FDC00;\n                }\n                else\n                {\n                    throw std::invalid_argument(\"missing or wrong low surrogate\");\n                }\n            }\n\n            string_t result;\n\n            if (codepoint < 0x80)\n            {\n                // 1-byte characters: 0xxxxxxx (ASCII)\n                result.append(1, static_cast<typename string_t::value_type>(codepoint));\n            }\n            else if (codepoint <= 0x7ff)\n            {\n                // 2-byte characters: 110xxxxx 10xxxxxx\n                result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));\n            }\n            else if (codepoint <= 0xffff)\n            {\n                // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx\n                result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));\n            }\n            else if (codepoint <= 0x10ffff)\n            {\n                // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n                result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));\n                result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));\n            }\n            else\n            {\n                throw std::out_of_range(\"code points above 0x10FFFF are invalid\");\n            }\n\n            return result;\n        }\n\n        /// return name of values of type token_type (only used for errors)\n        static std::string token_type_name(const token_type t)\n        {\n            switch (t)\n            {\n                case token_type::uninitialized:\n                    return \"<uninitialized>\";\n                case token_type::literal_true:\n                    return \"true literal\";\n                case token_type::literal_false:\n                    return \"false literal\";\n                case token_type::literal_null:\n                    return \"null literal\";\n                case token_type::value_string:\n                    return \"string literal\";\n                case token_type::value_number:\n                    return \"number literal\";\n                case token_type::begin_array:\n                    return \"'['\";\n                case token_type::begin_object:\n                    return \"'{'\";\n                case token_type::end_array:\n                    return \"']'\";\n                case token_type::end_object:\n                    return \"'}'\";\n                case token_type::name_separator:\n                    return \"':'\";\n                case token_type::value_separator:\n                    return \"','\";\n                case token_type::parse_error:\n                    return \"<parse error>\";\n                case token_type::end_of_input:\n                    return \"end of input\";\n                default:\n                {\n                    // catch non-enum values\n                    return \"unknown token\"; // LCOV_EXCL_LINE\n                }\n            }\n        }\n\n        /*!\n        This function implements a scanner for JSON. It is specified using\n        regular expressions that try to follow RFC 7159 as close as possible.\n        These regular expressions are then translated into a minimized\n        deterministic finite automaton (DFA) by the tool\n        [re2c](http://re2c.org). As a result, the translated code for this\n        function consists of a large block of code with `goto` jumps.\n\n        @return the class of the next token read from the buffer\n\n        @complexity Linear in the length of the input.\\n\n\n        Proposition: The loop below will always terminate for finite input.\\n\n\n        Proof (by contradiction): Assume a finite input. To loop forever, the\n        loop must never hit code with a `break` statement. The only code\n        snippets without a `break` statement are the continue statements for\n        whitespace and byte-order-marks. To loop forever, the input must be an\n        infinite sequence of whitespace or byte-order-marks. This contradicts\n        the assumption of finite input, q.e.d.\n        */\n        token_type scan() noexcept\n        {\n            while (true)\n            {\n                // pointer for backtracking information\n                m_marker = nullptr;\n\n                // remember the begin of the token\n                m_start = m_cursor;\n                assert(m_start != nullptr);\n\n\n                {\n                    lexer_char_t yych;\n                    unsigned int yyaccept = 0;\n                    static const unsigned char yybm[] =\n                    {\n                        0,   0,   0,   0,   0,   0,   0,   0,\n                        0,  32,  32,   0,   0,  32,   0,   0,\n                        0,   0,   0,   0,   0,   0,   0,   0,\n                        0,   0,   0,   0,   0,   0,   0,   0,\n                        160, 128,   0, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        192, 192, 192, 192, 192, 192, 192, 192,\n                        192, 192, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128,   0, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                        128, 128, 128, 128, 128, 128, 128, 128,\n                    };\n                    if ((m_limit - m_cursor) < 5)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yybm[0 + yych] & 32)\n                    {\n                        goto basic_json_parser_6;\n                    }\n                    if (yych <= '\\\\')\n                    {\n                        if (yych <= '-')\n                        {\n                            if (yych <= '\"')\n                            {\n                                if (yych <= 0x00)\n                                {\n                                    goto basic_json_parser_2;\n                                }\n                                if (yych <= '!')\n                                {\n                                    goto basic_json_parser_4;\n                                }\n                                goto basic_json_parser_9;\n                            }\n                            else\n                            {\n                                if (yych <= '+')\n                                {\n                                    goto basic_json_parser_4;\n                                }\n                                if (yych <= ',')\n                                {\n                                    goto basic_json_parser_10;\n                                }\n                                goto basic_json_parser_12;\n                            }\n                        }\n                        else\n                        {\n                            if (yych <= '9')\n                            {\n                                if (yych <= '/')\n                                {\n                                    goto basic_json_parser_4;\n                                }\n                                if (yych <= '0')\n                                {\n                                    goto basic_json_parser_13;\n                                }\n                                goto basic_json_parser_15;\n                            }\n                            else\n                            {\n                                if (yych <= ':')\n                                {\n                                    goto basic_json_parser_17;\n                                }\n                                if (yych == '[')\n                                {\n                                    goto basic_json_parser_19;\n                                }\n                                goto basic_json_parser_4;\n                            }\n                        }\n                    }\n                    else\n                    {\n                        if (yych <= 't')\n                        {\n                            if (yych <= 'f')\n                            {\n                                if (yych <= ']')\n                                {\n                                    goto basic_json_parser_21;\n                                }\n                                if (yych <= 'e')\n                                {\n                                    goto basic_json_parser_4;\n                                }\n                                goto basic_json_parser_23;\n                            }\n                            else\n                            {\n                                if (yych == 'n')\n                                {\n                                    goto basic_json_parser_24;\n                                }\n                                if (yych <= 's')\n                                {\n                                    goto basic_json_parser_4;\n                                }\n                                goto basic_json_parser_25;\n                            }\n                        }\n                        else\n                        {\n                            if (yych <= '|')\n                            {\n                                if (yych == '{')\n                                {\n                                    goto basic_json_parser_26;\n                                }\n                                goto basic_json_parser_4;\n                            }\n                            else\n                            {\n                                if (yych <= '}')\n                                {\n                                    goto basic_json_parser_28;\n                                }\n                                if (yych == 0xEF)\n                                {\n                                    goto basic_json_parser_30;\n                                }\n                                goto basic_json_parser_4;\n                            }\n                        }\n                    }\nbasic_json_parser_2:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::end_of_input;\n                        break;\n                    }\nbasic_json_parser_4:\n                    ++m_cursor;\nbasic_json_parser_5:\n                    {\n                        last_token_type = token_type::parse_error;\n                        break;\n                    }\nbasic_json_parser_6:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yybm[0 + yych] & 32)\n                    {\n                        goto basic_json_parser_6;\n                    }\n                    {\n                        continue;\n                    }\nbasic_json_parser_9:\n                    yyaccept = 0;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych <= 0x1F)\n                    {\n                        goto basic_json_parser_5;\n                    }\n                    goto basic_json_parser_32;\nbasic_json_parser_10:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::value_separator;\n                        break;\n                    }\nbasic_json_parser_12:\n                    yych = *++m_cursor;\n                    if (yych <= '/')\n                    {\n                        goto basic_json_parser_5;\n                    }\n                    if (yych <= '0')\n                    {\n                        goto basic_json_parser_13;\n                    }\n                    if (yych <= '9')\n                    {\n                        goto basic_json_parser_15;\n                    }\n                    goto basic_json_parser_5;\nbasic_json_parser_13:\n                    yyaccept = 1;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych <= 'D')\n                    {\n                        if (yych == '.')\n                        {\n                            goto basic_json_parser_37;\n                        }\n                    }\n                    else\n                    {\n                        if (yych <= 'E')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                        if (yych == 'e')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                    }\nbasic_json_parser_14:\n                    {\n                        last_token_type = token_type::value_number;\n                        break;\n                    }\nbasic_json_parser_15:\n                    yyaccept = 1;\n                    m_marker = ++m_cursor;\n                    if ((m_limit - m_cursor) < 3)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yybm[0 + yych] & 64)\n                    {\n                        goto basic_json_parser_15;\n                    }\n                    if (yych <= 'D')\n                    {\n                        if (yych == '.')\n                        {\n                            goto basic_json_parser_37;\n                        }\n                        goto basic_json_parser_14;\n                    }\n                    else\n                    {\n                        if (yych <= 'E')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                        if (yych == 'e')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                        goto basic_json_parser_14;\n                    }\nbasic_json_parser_17:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::name_separator;\n                        break;\n                    }\nbasic_json_parser_19:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::begin_array;\n                        break;\n                    }\nbasic_json_parser_21:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::end_array;\n                        break;\n                    }\nbasic_json_parser_23:\n                    yyaccept = 0;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych == 'a')\n                    {\n                        goto basic_json_parser_39;\n                    }\n                    goto basic_json_parser_5;\nbasic_json_parser_24:\n                    yyaccept = 0;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych == 'u')\n                    {\n                        goto basic_json_parser_40;\n                    }\n                    goto basic_json_parser_5;\nbasic_json_parser_25:\n                    yyaccept = 0;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych == 'r')\n                    {\n                        goto basic_json_parser_41;\n                    }\n                    goto basic_json_parser_5;\nbasic_json_parser_26:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::begin_object;\n                        break;\n                    }\nbasic_json_parser_28:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::end_object;\n                        break;\n                    }\nbasic_json_parser_30:\n                    yyaccept = 0;\n                    yych = *(m_marker = ++m_cursor);\n                    if (yych == 0xBB)\n                    {\n                        goto basic_json_parser_42;\n                    }\n                    goto basic_json_parser_5;\nbasic_json_parser_31:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\nbasic_json_parser_32:\n                    if (yybm[0 + yych] & 128)\n                    {\n                        goto basic_json_parser_31;\n                    }\n                    if (yych <= 0x1F)\n                    {\n                        goto basic_json_parser_33;\n                    }\n                    if (yych <= '\"')\n                    {\n                        goto basic_json_parser_34;\n                    }\n                    goto basic_json_parser_36;\nbasic_json_parser_33:\n                    m_cursor = m_marker;\n                    if (yyaccept == 0)\n                    {\n                        goto basic_json_parser_5;\n                    }\n                    else\n                    {\n                        goto basic_json_parser_14;\n                    }\nbasic_json_parser_34:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::value_string;\n                        break;\n                    }\nbasic_json_parser_36:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= 'e')\n                    {\n                        if (yych <= '/')\n                        {\n                            if (yych == '\"')\n                            {\n                                goto basic_json_parser_31;\n                            }\n                            if (yych <= '.')\n                            {\n                                goto basic_json_parser_33;\n                            }\n                            goto basic_json_parser_31;\n                        }\n                        else\n                        {\n                            if (yych <= '\\\\')\n                            {\n                                if (yych <= '[')\n                                {\n                                    goto basic_json_parser_33;\n                                }\n                                goto basic_json_parser_31;\n                            }\n                            else\n                            {\n                                if (yych == 'b')\n                                {\n                                    goto basic_json_parser_31;\n                                }\n                                goto basic_json_parser_33;\n                            }\n                        }\n                    }\n                    else\n                    {\n                        if (yych <= 'q')\n                        {\n                            if (yych <= 'f')\n                            {\n                                goto basic_json_parser_31;\n                            }\n                            if (yych == 'n')\n                            {\n                                goto basic_json_parser_31;\n                            }\n                            goto basic_json_parser_33;\n                        }\n                        else\n                        {\n                            if (yych <= 's')\n                            {\n                                if (yych <= 'r')\n                                {\n                                    goto basic_json_parser_31;\n                                }\n                                goto basic_json_parser_33;\n                            }\n                            else\n                            {\n                                if (yych <= 't')\n                                {\n                                    goto basic_json_parser_31;\n                                }\n                                if (yych <= 'u')\n                                {\n                                    goto basic_json_parser_43;\n                                }\n                                goto basic_json_parser_33;\n                            }\n                        }\n                    }\nbasic_json_parser_37:\n                    yych = *++m_cursor;\n                    if (yych <= '/')\n                    {\n                        goto basic_json_parser_33;\n                    }\n                    if (yych <= '9')\n                    {\n                        goto basic_json_parser_44;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_38:\n                    yych = *++m_cursor;\n                    if (yych <= ',')\n                    {\n                        if (yych == '+')\n                        {\n                            goto basic_json_parser_46;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                    else\n                    {\n                        if (yych <= '-')\n                        {\n                            goto basic_json_parser_46;\n                        }\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_47;\n                        }\n                        goto basic_json_parser_33;\n                    }\nbasic_json_parser_39:\n                    yych = *++m_cursor;\n                    if (yych == 'l')\n                    {\n                        goto basic_json_parser_49;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_40:\n                    yych = *++m_cursor;\n                    if (yych == 'l')\n                    {\n                        goto basic_json_parser_50;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_41:\n                    yych = *++m_cursor;\n                    if (yych == 'u')\n                    {\n                        goto basic_json_parser_51;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_42:\n                    yych = *++m_cursor;\n                    if (yych == 0xBF)\n                    {\n                        goto basic_json_parser_52;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_43:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= '@')\n                    {\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_54;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                    else\n                    {\n                        if (yych <= 'F')\n                        {\n                            goto basic_json_parser_54;\n                        }\n                        if (yych <= '`')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= 'f')\n                        {\n                            goto basic_json_parser_54;\n                        }\n                        goto basic_json_parser_33;\n                    }\nbasic_json_parser_44:\n                    yyaccept = 1;\n                    m_marker = ++m_cursor;\n                    if ((m_limit - m_cursor) < 3)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= 'D')\n                    {\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_14;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_44;\n                        }\n                        goto basic_json_parser_14;\n                    }\n                    else\n                    {\n                        if (yych <= 'E')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                        if (yych == 'e')\n                        {\n                            goto basic_json_parser_38;\n                        }\n                        goto basic_json_parser_14;\n                    }\nbasic_json_parser_46:\n                    yych = *++m_cursor;\n                    if (yych <= '/')\n                    {\n                        goto basic_json_parser_33;\n                    }\n                    if (yych >= ':')\n                    {\n                        goto basic_json_parser_33;\n                    }\nbasic_json_parser_47:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= '/')\n                    {\n                        goto basic_json_parser_14;\n                    }\n                    if (yych <= '9')\n                    {\n                        goto basic_json_parser_47;\n                    }\n                    goto basic_json_parser_14;\nbasic_json_parser_49:\n                    yych = *++m_cursor;\n                    if (yych == 's')\n                    {\n                        goto basic_json_parser_55;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_50:\n                    yych = *++m_cursor;\n                    if (yych == 'l')\n                    {\n                        goto basic_json_parser_56;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_51:\n                    yych = *++m_cursor;\n                    if (yych == 'e')\n                    {\n                        goto basic_json_parser_58;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_52:\n                    ++m_cursor;\n                    {\n                        continue;\n                    }\nbasic_json_parser_54:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= '@')\n                    {\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_60;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                    else\n                    {\n                        if (yych <= 'F')\n                        {\n                            goto basic_json_parser_60;\n                        }\n                        if (yych <= '`')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= 'f')\n                        {\n                            goto basic_json_parser_60;\n                        }\n                        goto basic_json_parser_33;\n                    }\nbasic_json_parser_55:\n                    yych = *++m_cursor;\n                    if (yych == 'e')\n                    {\n                        goto basic_json_parser_61;\n                    }\n                    goto basic_json_parser_33;\nbasic_json_parser_56:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::literal_null;\n                        break;\n                    }\nbasic_json_parser_58:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::literal_true;\n                        break;\n                    }\nbasic_json_parser_60:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= '@')\n                    {\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_63;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                    else\n                    {\n                        if (yych <= 'F')\n                        {\n                            goto basic_json_parser_63;\n                        }\n                        if (yych <= '`')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= 'f')\n                        {\n                            goto basic_json_parser_63;\n                        }\n                        goto basic_json_parser_33;\n                    }\nbasic_json_parser_61:\n                    ++m_cursor;\n                    {\n                        last_token_type = token_type::literal_false;\n                        break;\n                    }\nbasic_json_parser_63:\n                    ++m_cursor;\n                    if (m_limit <= m_cursor)\n                    {\n                        yyfill();    // LCOV_EXCL_LINE;\n                    }\n                    yych = *m_cursor;\n                    if (yych <= '@')\n                    {\n                        if (yych <= '/')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= '9')\n                        {\n                            goto basic_json_parser_31;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                    else\n                    {\n                        if (yych <= 'F')\n                        {\n                            goto basic_json_parser_31;\n                        }\n                        if (yych <= '`')\n                        {\n                            goto basic_json_parser_33;\n                        }\n                        if (yych <= 'f')\n                        {\n                            goto basic_json_parser_31;\n                        }\n                        goto basic_json_parser_33;\n                    }\n                }\n\n            }\n\n            return last_token_type;\n        }\n\n        /// append data from the stream to the internal buffer\n        void yyfill() noexcept\n        {\n            if (m_stream == nullptr or not * m_stream)\n            {\n                return;\n            }\n\n            const auto offset_start = m_start - m_content;\n            const auto offset_marker = m_marker - m_start;\n            const auto offset_cursor = m_cursor - m_start;\n\n            m_buffer.erase(0, static_cast<size_t>(offset_start));\n            std::string line;\n            assert(m_stream != nullptr);\n            std::getline(*m_stream, line);\n            m_buffer += \"\\n\" + line; // add line with newline symbol\n\n            m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());\n            assert(m_content != nullptr);\n            m_start  = m_content;\n            m_marker = m_start + offset_marker;\n            m_cursor = m_start + offset_cursor;\n            m_limit  = m_start + m_buffer.size() - 1;\n        }\n\n        /// return string representation of last read token\n        string_t get_token_string() const\n        {\n            assert(m_start != nullptr);\n            return string_t(reinterpret_cast<typename string_t::const_pointer>(m_start),\n                            static_cast<size_t>(m_cursor - m_start));\n        }\n\n        /*!\n        @brief return string value for string tokens\n\n        The function iterates the characters between the opening and closing\n        quotes of the string value. The complete string is the range\n        [m_start,m_cursor). Consequently, we iterate from m_start+1 to\n        m_cursor-1.\n\n        We differentiate two cases:\n\n        1. Escaped characters. In this case, a new character is constructed\n           according to the nature of the escape. Some escapes create new\n           characters (e.g., `\"\\\\n\"` is replaced by `\"\\n\"`), some are copied\n           as is (e.g., `\"\\\\\\\\\"`). Furthermore, Unicode escapes of the shape\n           `\"\\\\uxxxx\"` need special care. In this case, to_unicode takes care\n           of the construction of the values.\n        2. Unescaped characters are copied as is.\n\n        @pre `m_cursor - m_start >= 2`, meaning the length of the last token\n        is at least 2 bytes which is trivially true for any string (which\n        consists of at least two quotes).\n\n            \" c1 c2 c3 ... \"\n            ^                ^\n            m_start          m_cursor\n\n        @complexity Linear in the length of the string.\\n\n\n        Lemma: The loop body will always terminate.\\n\n\n        Proof (by contradiction): Assume the loop body does not terminate. As\n        the loop body does not contain another loop, one of the called\n        functions must never return. The called functions are `std::strtoul`\n        and to_unicode. Neither function can loop forever, so the loop body\n        will never loop forever which contradicts the assumption that the loop\n        body does not terminate, q.e.d.\\n\n\n        Lemma: The loop condition for the for loop is eventually false.\\n\n\n        Proof (by contradiction): Assume the loop does not terminate. Due to\n        the above lemma, this can only be due to a tautological loop\n        condition; that is, the loop condition i < m_cursor - 1 must always be\n        true. Let x be the change of i for any loop iteration. Then\n        m_start + 1 + x < m_cursor - 1 must hold to loop indefinitely. This\n        can be rephrased to m_cursor - m_start - 2 > x. With the\n        precondition, we x <= 0, meaning that the loop condition holds\n        indefinitly if i is always decreased. However, observe that the value\n        of i is strictly increasing with each iteration, as it is incremented\n        by 1 in the iteration expression and never decremented inside the loop\n        body. Hence, the loop condition will eventually be false which\n        contradicts the assumption that the loop condition is a tautology,\n        q.e.d.\n\n        @return string value of current token without opening and closing\n        quotes\n        @throw std::out_of_range if to_unicode fails\n        */\n        string_t get_string() const\n        {\n            assert(m_cursor - m_start >= 2);\n\n            string_t result;\n            result.reserve(static_cast<size_t>(m_cursor - m_start - 2));\n\n            // iterate the result between the quotes\n            for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)\n            {\n                // process escaped characters\n                if (*i == '\\\\')\n                {\n                    // read next character\n                    ++i;\n\n                    switch (*i)\n                    {\n                        // the default escapes\n                        case 't':\n                        {\n                            result += \"\\t\";\n                            break;\n                        }\n                        case 'b':\n                        {\n                            result += \"\\b\";\n                            break;\n                        }\n                        case 'f':\n                        {\n                            result += \"\\f\";\n                            break;\n                        }\n                        case 'n':\n                        {\n                            result += \"\\n\";\n                            break;\n                        }\n                        case 'r':\n                        {\n                            result += \"\\r\";\n                            break;\n                        }\n                        case '\\\\':\n                        {\n                            result += \"\\\\\";\n                            break;\n                        }\n                        case '/':\n                        {\n                            result += \"/\";\n                            break;\n                        }\n                        case '\"':\n                        {\n                            result += \"\\\"\";\n                            break;\n                        }\n\n                        // unicode\n                        case 'u':\n                        {\n                            // get code xxxx from uxxxx\n                            auto codepoint = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>(i + 1),\n                                                          4).c_str(), nullptr, 16);\n\n                            // check if codepoint is a high surrogate\n                            if (codepoint >= 0xD800 and codepoint <= 0xDBFF)\n                            {\n                                // make sure there is a subsequent unicode\n                                if ((i + 6 >= m_limit) or * (i + 5) != '\\\\' or * (i + 6) != 'u')\n                                {\n                                    throw std::invalid_argument(\"missing low surrogate\");\n                                }\n\n                                // get code yyyy from uxxxx\\uyyyy\n                                auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>\n                                                               (i + 7), 4).c_str(), nullptr, 16);\n                                result += to_unicode(codepoint, codepoint2);\n                                // skip the next 10 characters (xxxx\\uyyyy)\n                                i += 10;\n                            }\n                            else\n                            {\n                                // add unicode character(s)\n                                result += to_unicode(codepoint);\n                                // skip the next four characters (xxxx)\n                                i += 4;\n                            }\n                            break;\n                        }\n                    }\n                }\n                else\n                {\n                    // all other characters are just copied to the end of the\n                    // string\n                    result.append(1, static_cast<typename string_t::value_type>(*i));\n                }\n            }\n\n            return result;\n        }\n\n        /*!\n        @brief parse floating point number\n\n        This function (and its overloads) serves to select the most approprate\n        standard floating point number parsing function based on the type\n        supplied via the first parameter.  Set this to @a\n        static_cast<number_float_t*>(nullptr).\n\n        @param[in] type  the @ref number_float_t in use\n\n        @param[in,out] endptr recieves a pointer to the first character after\n        the number\n\n        @return the floating point number\n        */\n        long double str_to_float_t(long double* /* type */, char** endptr) const\n        {\n            return std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);\n        }\n\n        /*!\n        @brief parse floating point number\n\n        This function (and its overloads) serves to select the most approprate\n        standard floating point number parsing function based on the type\n        supplied via the first parameter.  Set this to @a\n        static_cast<number_float_t*>(nullptr).\n\n        @param[in] type  the @ref number_float_t in use\n\n        @param[in,out] endptr  recieves a pointer to the first character after\n        the number\n\n        @return the floating point number\n        */\n        double str_to_float_t(double* /* type */, char** endptr) const\n        {\n            return std::strtod(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);\n        }\n\n        /*!\n        @brief parse floating point number\n\n        This function (and its overloads) serves to select the most approprate\n        standard floating point number parsing function based on the type\n        supplied via the first parameter.  Set this to @a\n        static_cast<number_float_t*>(nullptr).\n\n        @param[in] type  the @ref number_float_t in use\n\n        @param[in,out] endptr  recieves a pointer to the first character after\n        the number\n\n        @return the floating point number\n        */\n        float str_to_float_t(float* /* type */, char** endptr) const\n        {\n            return std::strtof(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);\n        }\n\n        /*!\n        @brief return number value for number tokens\n\n        This function translates the last token into the most appropriate\n        number type (either integer, unsigned integer or floating point),\n        which is passed back to the caller via the result parameter.\n\n        This function parses the integer component up to the radix point or\n        exponent while collecting information about the 'floating point\n        representation', which it stores in the result parameter. If there is\n        no radix point or exponent, and the number can fit into a @ref\n        number_integer_t or @ref number_unsigned_t then it sets the result\n        parameter accordingly.\n\n        If the number is a floating point number the number is then parsed\n        using @a std:strtod (or @a std:strtof or @a std::strtold).\n\n        @param[out] result  @ref basic_json object to receive the number, or\n        NAN if the conversion read past the current token. The latter case\n        needs to be treated by the caller function.\n        */\n        void get_number(basic_json& result) const\n        {\n            assert(m_start != nullptr);\n\n            const lexer::lexer_char_t* curptr = m_start;\n\n            // accumulate the integer conversion result (unsigned for now)\n            number_unsigned_t value = 0;\n\n            // maximum absolute value of the relevant integer type\n            number_unsigned_t max;\n\n            // temporarily store the type to avoid unecessary bitfield access\n            value_t type;\n\n            // look for sign\n            if (*curptr == '-')\n            {\n                type = value_t::number_integer;\n                max = static_cast<uint64_t>((std::numeric_limits<number_integer_t>::max)()) + 1;\n                curptr++;\n            }\n            else\n            {\n                type = value_t::number_unsigned;\n                max = static_cast<uint64_t>((std::numeric_limits<number_unsigned_t>::max)());\n            }\n\n            // count the significant figures\n            for (; curptr < m_cursor; curptr++)\n            {\n                // quickly skip tests if a digit\n                if (*curptr < '0' || *curptr > '9')\n                {\n                    if (*curptr == '.')\n                    {\n                        // don't count '.' but change to float\n                        type = value_t::number_float;\n                        continue;\n                    }\n                    // assume exponent (if not then will fail parse): change to\n                    // float, stop counting and record exponent details\n                    type = value_t::number_float;\n                    break;\n                }\n\n                // skip if definitely not an integer\n                if (type != value_t::number_float)\n                {\n                    // multiply last value by ten and add the new digit\n                    auto temp = value * 10 + *curptr - '0';\n\n                    // test for overflow\n                    if (temp < value || temp > max)\n                    {\n                        // overflow\n                        type = value_t::number_float;\n                    }\n                    else\n                    {\n                        // no overflow - save it\n                        value = temp;\n                    }\n                }\n            }\n\n            // save the value (if not a float)\n            if (type == value_t::number_unsigned)\n            {\n                result.m_value.number_unsigned = value;\n            }\n            else if (type == value_t::number_integer)\n            {\n                result.m_value.number_integer = -static_cast<number_integer_t>(value);\n            }\n            else\n            {\n                // parse with strtod\n                result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);\n            }\n\n            // save the type\n            result.m_type = type;\n        }\n\n      private:\n        /// optional input stream\n        std::istream* m_stream = nullptr;\n        /// the buffer\n        string_t m_buffer;\n        /// the buffer pointer\n        const lexer_char_t* m_content = nullptr;\n        /// pointer to the beginning of the current symbol\n        const lexer_char_t* m_start = nullptr;\n        /// pointer for backtracking information\n        const lexer_char_t* m_marker = nullptr;\n        /// pointer to the current symbol\n        const lexer_char_t* m_cursor = nullptr;\n        /// pointer to the end of the buffer\n        const lexer_char_t* m_limit = nullptr;\n        /// the last token type\n        token_type last_token_type = token_type::end_of_input;\n    };\n\n    /*!\n    @brief syntax analysis\n\n    This class implements a recursive decent parser.\n    */\n    class parser\n    {\n      public:\n        /// constructor for strings\n        parser(const string_t& s, const parser_callback_t cb = nullptr) noexcept\n            : callback(cb), m_lexer(s)\n        {\n            // read first token\n            get_token();\n        }\n\n        /// a parser reading from an input stream\n        parser(std::istream& _is, const parser_callback_t cb = nullptr) noexcept\n            : callback(cb), m_lexer(&_is)\n        {\n            // read first token\n            get_token();\n        }\n\n        /// public parser interface\n        basic_json parse()\n        {\n            basic_json result = parse_internal(true);\n            result.assert_invariant();\n\n            expect(lexer::token_type::end_of_input);\n\n            // return parser result and replace it with null in case the\n            // top-level value was discarded by the callback function\n            return result.is_discarded() ? basic_json() : std::move(result);\n        }\n\n      private:\n        /// the actual parser\n        basic_json parse_internal(bool keep)\n        {\n            auto result = basic_json(value_t::discarded);\n\n            switch (last_token)\n            {\n                case lexer::token_type::begin_object:\n                {\n                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))\n                    {\n                        // explicitly set result to object to cope with {}\n                        result.m_type = value_t::object;\n                        result.m_value = value_t::object;\n                    }\n\n                    // read next token\n                    get_token();\n\n                    // closing } -> we are done\n                    if (last_token == lexer::token_type::end_object)\n                    {\n                        get_token();\n                        if (keep and callback and not callback(--depth, parse_event_t::object_end, result))\n                        {\n                            result = basic_json(value_t::discarded);\n                        }\n                        return result;\n                    }\n\n                    // no comma is expected here\n                    unexpect(lexer::token_type::value_separator);\n\n                    // otherwise: parse key-value pairs\n                    do\n                    {\n                        // ugly, but could be fixed with loop reorganization\n                        if (last_token == lexer::token_type::value_separator)\n                        {\n                            get_token();\n                        }\n\n                        // store key\n                        expect(lexer::token_type::value_string);\n                        const auto key = m_lexer.get_string();\n\n                        bool keep_tag = false;\n                        if (keep)\n                        {\n                            if (callback)\n                            {\n                                basic_json k(key);\n                                keep_tag = callback(depth, parse_event_t::key, k);\n                            }\n                            else\n                            {\n                                keep_tag = true;\n                            }\n                        }\n\n                        // parse separator (:)\n                        get_token();\n                        expect(lexer::token_type::name_separator);\n\n                        // parse and add value\n                        get_token();\n                        auto value = parse_internal(keep);\n                        if (keep and keep_tag and not value.is_discarded())\n                        {\n                            result[key] = std::move(value);\n                        }\n                    }\n                    while (last_token == lexer::token_type::value_separator);\n\n                    // closing }\n                    expect(lexer::token_type::end_object);\n                    get_token();\n                    if (keep and callback and not callback(--depth, parse_event_t::object_end, result))\n                    {\n                        result = basic_json(value_t::discarded);\n                    }\n\n                    return result;\n                }\n\n                case lexer::token_type::begin_array:\n                {\n                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))\n                    {\n                        // explicitly set result to object to cope with []\n                        result.m_type = value_t::array;\n                        result.m_value = value_t::array;\n                    }\n\n                    // read next token\n                    get_token();\n\n                    // closing ] -> we are done\n                    if (last_token == lexer::token_type::end_array)\n                    {\n                        get_token();\n                        if (callback and not callback(--depth, parse_event_t::array_end, result))\n                        {\n                            result = basic_json(value_t::discarded);\n                        }\n                        return result;\n                    }\n\n                    // no comma is expected here\n                    unexpect(lexer::token_type::value_separator);\n\n                    // otherwise: parse values\n                    do\n                    {\n                        // ugly, but could be fixed with loop reorganization\n                        if (last_token == lexer::token_type::value_separator)\n                        {\n                            get_token();\n                        }\n\n                        // parse value\n                        auto value = parse_internal(keep);\n                        if (keep and not value.is_discarded())\n                        {\n                            result.push_back(std::move(value));\n                        }\n                    }\n                    while (last_token == lexer::token_type::value_separator);\n\n                    // closing ]\n                    expect(lexer::token_type::end_array);\n                    get_token();\n                    if (keep and callback and not callback(--depth, parse_event_t::array_end, result))\n                    {\n                        result = basic_json(value_t::discarded);\n                    }\n\n                    return result;\n                }\n\n                case lexer::token_type::literal_null:\n                {\n                    get_token();\n                    result.m_type = value_t::null;\n                    break;\n                }\n\n                case lexer::token_type::value_string:\n                {\n                    const auto s = m_lexer.get_string();\n                    get_token();\n                    result = basic_json(s);\n                    break;\n                }\n\n                case lexer::token_type::literal_true:\n                {\n                    get_token();\n                    result.m_type = value_t::boolean;\n                    result.m_value = true;\n                    break;\n                }\n\n                case lexer::token_type::literal_false:\n                {\n                    get_token();\n                    result.m_type = value_t::boolean;\n                    result.m_value = false;\n                    break;\n                }\n\n                case lexer::token_type::value_number:\n                {\n                    m_lexer.get_number(result);\n                    get_token();\n                    break;\n                }\n\n                default:\n                {\n                    // the last token was unexpected\n                    unexpect(last_token);\n                }\n            }\n\n            if (keep and callback and not callback(depth, parse_event_t::value, result))\n            {\n                result = basic_json(value_t::discarded);\n            }\n            return result;\n        }\n\n        /// get next token from lexer\n        typename lexer::token_type get_token() noexcept\n        {\n            last_token = m_lexer.scan();\n            return last_token;\n        }\n\n        void expect(typename lexer::token_type t) const\n        {\n            if (t != last_token)\n            {\n                std::string error_msg = \"parse error - unexpected \";\n                error_msg += (last_token == lexer::token_type::parse_error ? (\"'\" +  m_lexer.get_token_string() +\n                              \"'\") :\n                              lexer::token_type_name(last_token));\n                error_msg += \"; expected \" + lexer::token_type_name(t);\n                throw std::invalid_argument(error_msg);\n            }\n        }\n\n        void unexpect(typename lexer::token_type t) const\n        {\n            if (t == last_token)\n            {\n                std::string error_msg = \"parse error - unexpected \";\n                error_msg += (last_token == lexer::token_type::parse_error ? (\"'\" +  m_lexer.get_token_string() +\n                              \"'\") :\n                              lexer::token_type_name(last_token));\n                throw std::invalid_argument(error_msg);\n            }\n        }\n\n      private:\n        /// current level of recursion\n        int depth = 0;\n        /// callback function\n        const parser_callback_t callback = nullptr;\n        /// the type of the last read token\n        typename lexer::token_type last_token = lexer::token_type::uninitialized;\n        /// the lexer\n        lexer m_lexer;\n    };\n\n  public:\n    /*!\n    @brief JSON Pointer\n\n    A JSON pointer defines a string syntax for identifying a specific value\n    within a JSON document. It can be used with functions `at` and\n    `operator[]`. Furthermore, JSON pointers are the base for JSON patches.\n\n    @sa [RFC 6901](https://tools.ietf.org/html/rfc6901)\n\n    @since version 2.0.0\n    */\n    class json_pointer\n    {\n        /// allow basic_json to access private members\n        friend class basic_json;\n\n      public:\n        /*!\n        @brief create JSON pointer\n\n        Create a JSON pointer according to the syntax described in\n        [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3).\n\n        @param[in] s  string representing the JSON pointer; if omitted, the\n                      empty string is assumed which references the whole JSON\n                      value\n\n        @throw std::domain_error if reference token is nonempty and does not\n        begin with a slash (`/`); example: `\"JSON pointer must be empty or\n        begin with /\"`\n        @throw std::domain_error if a tilde (`~`) is not followed by `0`\n        (representing `~`) or `1` (representing `/`); example: `\"escape error:\n        ~ must be followed with 0 or 1\"`\n\n        @liveexample{The example shows the construction several valid JSON\n        pointers as well as the exceptional behavior.,json_pointer}\n\n        @since version 2.0.0\n        */\n        explicit json_pointer(const std::string& s = \"\")\n            : reference_tokens(split(s))\n        {}\n\n        /*!\n        @brief return a string representation of the JSON pointer\n\n        @invariant For each JSON pointer `ptr`, it holds:\n        @code {.cpp}\n        ptr == json_pointer(ptr.to_string());\n        @endcode\n\n        @return a string representation of the JSON pointer\n\n        @liveexample{The example shows the result of `to_string`.,\n        json_pointer__to_string}\n\n        @since version 2.0.0\n        */\n        std::string to_string() const noexcept\n        {\n            return std::accumulate(reference_tokens.begin(),\n                                   reference_tokens.end(), std::string{},\n                                   [](const std::string & a, const std::string & b)\n            {\n                return a + \"/\" + escape(b);\n            });\n        }\n\n        /// @copydoc to_string()\n        operator std::string() const\n        {\n            return to_string();\n        }\n\n      private:\n        /// remove and return last reference pointer\n        std::string pop_back()\n        {\n            if (is_root())\n            {\n                throw std::domain_error(\"JSON pointer has no parent\");\n            }\n\n            auto last = reference_tokens.back();\n            reference_tokens.pop_back();\n            return last;\n        }\n\n        /// return whether pointer points to the root document\n        bool is_root() const\n        {\n            return reference_tokens.empty();\n        }\n\n        json_pointer top() const\n        {\n            if (is_root())\n            {\n                throw std::domain_error(\"JSON pointer has no parent\");\n            }\n\n            json_pointer result = *this;\n            result.reference_tokens = {reference_tokens[0]};\n            return result;\n        }\n\n        /*!\n        @brief create and return a reference to the pointed to value\n\n        @complexity Linear in the number of reference tokens.\n        */\n        reference get_and_create(reference j) const\n        {\n            pointer result = &j;\n\n            // in case no reference tokens exist, return a reference to the\n            // JSON value j which will be overwritten by a primitive value\n            for (const auto& reference_token : reference_tokens)\n            {\n                switch (result->m_type)\n                {\n                    case value_t::null:\n                    {\n                        if (reference_token == \"0\")\n                        {\n                            // start a new array if reference token is 0\n                            result = &result->operator[](0);\n                        }\n                        else\n                        {\n                            // start a new object otherwise\n                            result = &result->operator[](reference_token);\n                        }\n                        break;\n                    }\n\n                    case value_t::object:\n                    {\n                        // create an entry in the object\n                        result = &result->operator[](reference_token);\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        // create an entry in the array\n                        result = &result->operator[](static_cast<size_type>(std::stoi(reference_token)));\n                        break;\n                    }\n\n                    /*\n                    The following code is only reached if there exists a\n                    reference token _and_ the current value is primitive. In\n                    this case, we have an error situation, because primitive\n                    values may only occur as single value; that is, with an\n                    empty list of reference tokens.\n                    */\n                    default:\n                    {\n                        throw std::domain_error(\"invalid value to unflatten\");\n                    }\n                }\n            }\n\n            return *result;\n        }\n\n        /*!\n        @brief return a reference to the pointed to value\n\n        @param[in] ptr  a JSON value\n\n        @return reference to the JSON value pointed to by the JSON pointer\n\n        @complexity Linear in the length of the JSON pointer.\n\n        @throw std::out_of_range      if the JSON pointer can not be resolved\n        @throw std::domain_error      if an array index begins with '0'\n        @throw std::invalid_argument  if an array index was not a number\n        */\n        reference get_unchecked(pointer ptr) const\n        {\n            for (const auto& reference_token : reference_tokens)\n            {\n                switch (ptr->m_type)\n                {\n                    case value_t::object:\n                    {\n                        // use unchecked object access\n                        ptr = &ptr->operator[](reference_token);\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        // error condition (cf. RFC 6901, Sect. 4)\n                        if (reference_token.size() > 1 and reference_token[0] == '0')\n                        {\n                            throw std::domain_error(\"array index must not begin with '0'\");\n                        }\n\n                        if (reference_token == \"-\")\n                        {\n                            // explicityly treat \"-\" as index beyond the end\n                            ptr = &ptr->operator[](ptr->m_value.array->size());\n                        }\n                        else\n                        {\n                            // convert array index to number; unchecked access\n                            ptr = &ptr->operator[](static_cast<size_type>(std::stoi(reference_token)));\n                        }\n                        break;\n                    }\n\n                    default:\n                    {\n                        throw std::out_of_range(\"unresolved reference token '\" + reference_token + \"'\");\n                    }\n                }\n            }\n\n            return *ptr;\n        }\n\n        reference get_checked(pointer ptr) const\n        {\n            for (const auto& reference_token : reference_tokens)\n            {\n                switch (ptr->m_type)\n                {\n                    case value_t::object:\n                    {\n                        // note: at performs range check\n                        ptr = &ptr->at(reference_token);\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        if (reference_token == \"-\")\n                        {\n                            // \"-\" always fails the range check\n                            throw std::out_of_range(\"array index '-' (\" +\n                                                    std::to_string(ptr->m_value.array->size()) +\n                                                    \") is out of range\");\n                        }\n\n                        // error condition (cf. RFC 6901, Sect. 4)\n                        if (reference_token.size() > 1 and reference_token[0] == '0')\n                        {\n                            throw std::domain_error(\"array index must not begin with '0'\");\n                        }\n\n                        // note: at performs range check\n                        ptr = &ptr->at(static_cast<size_type>(std::stoi(reference_token)));\n                        break;\n                    }\n\n                    default:\n                    {\n                        throw std::out_of_range(\"unresolved reference token '\" + reference_token + \"'\");\n                    }\n                }\n            }\n\n            return *ptr;\n        }\n\n        /*!\n        @brief return a const reference to the pointed to value\n\n        @param[in] ptr  a JSON value\n\n        @return const reference to the JSON value pointed to by the JSON\n                pointer\n        */\n        const_reference get_unchecked(const_pointer ptr) const\n        {\n            for (const auto& reference_token : reference_tokens)\n            {\n                switch (ptr->m_type)\n                {\n                    case value_t::object:\n                    {\n                        // use unchecked object access\n                        ptr = &ptr->operator[](reference_token);\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        if (reference_token == \"-\")\n                        {\n                            // \"-\" cannot be used for const access\n                            throw std::out_of_range(\"array index '-' (\" +\n                                                    std::to_string(ptr->m_value.array->size()) +\n                                                    \") is out of range\");\n                        }\n\n                        // error condition (cf. RFC 6901, Sect. 4)\n                        if (reference_token.size() > 1 and reference_token[0] == '0')\n                        {\n                            throw std::domain_error(\"array index must not begin with '0'\");\n                        }\n\n                        // use unchecked array access\n                        ptr = &ptr->operator[](static_cast<size_type>(std::stoi(reference_token)));\n                        break;\n                    }\n\n                    default:\n                    {\n                        throw std::out_of_range(\"unresolved reference token '\" + reference_token + \"'\");\n                    }\n                }\n            }\n\n            return *ptr;\n        }\n\n        const_reference get_checked(const_pointer ptr) const\n        {\n            for (const auto& reference_token : reference_tokens)\n            {\n                switch (ptr->m_type)\n                {\n                    case value_t::object:\n                    {\n                        // note: at performs range check\n                        ptr = &ptr->at(reference_token);\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        if (reference_token == \"-\")\n                        {\n                            // \"-\" always fails the range check\n                            throw std::out_of_range(\"array index '-' (\" +\n                                                    std::to_string(ptr->m_value.array->size()) +\n                                                    \") is out of range\");\n                        }\n\n                        // error condition (cf. RFC 6901, Sect. 4)\n                        if (reference_token.size() > 1 and reference_token[0] == '0')\n                        {\n                            throw std::domain_error(\"array index must not begin with '0'\");\n                        }\n\n                        // note: at performs range check\n                        ptr = &ptr->at(static_cast<size_type>(std::stoi(reference_token)));\n                        break;\n                    }\n\n                    default:\n                    {\n                        throw std::out_of_range(\"unresolved reference token '\" + reference_token + \"'\");\n                    }\n                }\n            }\n\n            return *ptr;\n        }\n\n        /// split the string input to reference tokens\n        static std::vector<std::string> split(std::string reference_string)\n        {\n            std::vector<std::string> result;\n\n            // special case: empty reference string -> no reference tokens\n            if (reference_string.empty())\n            {\n                return result;\n            }\n\n            // check if nonempty reference string begins with slash\n            if (reference_string[0] != '/')\n            {\n                throw std::domain_error(\"JSON pointer must be empty or begin with '/'\");\n            }\n\n            // extract the reference tokens:\n            // - slash: position of the last read slash (or end of string)\n            // - start: position after the previous slash\n            for (\n                // search for the first slash after the first character\n                size_t slash = reference_string.find_first_of(\"/\", 1),\n                // set the beginning of the first reference token\n                start = 1;\n                // we can stop if start == string::npos+1 = 0\n                start != 0;\n                // set the beginning of the next reference token\n                // (will eventually be 0 if slash == std::string::npos)\n                start = slash + 1,\n                // find next slash\n                slash = reference_string.find_first_of(\"/\", start))\n            {\n                // use the text between the beginning of the reference token\n                // (start) and the last slash (slash).\n                auto reference_token = reference_string.substr(start, slash - start);\n\n                // check reference tokens are properly escaped\n                for (size_t pos = reference_token.find_first_of(\"~\");\n                        pos != std::string::npos;\n                        pos = reference_token.find_first_of(\"~\", pos + 1))\n                {\n                    assert(reference_token[pos] == '~');\n\n                    // ~ must be followed by 0 or 1\n                    if (pos == reference_token.size() - 1 or\n                            (reference_token[pos + 1] != '0' and\n                             reference_token[pos + 1] != '1'))\n                    {\n                        throw std::domain_error(\"escape error: '~' must be followed with '0' or '1'\");\n                    }\n                }\n\n                // finally, store the reference token\n                unescape(reference_token);\n                result.push_back(reference_token);\n            }\n\n            return result;\n        }\n\n      private:\n        /*!\n        @brief replace all occurrences of a substring by another string\n\n        @param[in,out] s  the string to manipulate\n        @param[in]     f  the substring to replace with @a t\n        @param[in]     t  the string to replace @a f\n\n        @return The string @a s where all occurrences of @a f are replaced\n                with @a t.\n\n        @pre The search string @a f must not be empty.\n\n        @since version 2.0.0\n        */\n        static void replace_substring(std::string& s,\n                                      const std::string& f,\n                                      const std::string& t)\n        {\n            assert(not f.empty());\n\n            for (\n                size_t pos = s.find(f);         // find first occurrence of f\n                pos != std::string::npos;       // make sure f was found\n                s.replace(pos, f.size(), t),    // replace with t\n                pos = s.find(f, pos + t.size()) // find next occurrence of f\n            );\n        }\n\n        /// escape tilde and slash\n        static std::string escape(std::string s)\n        {\n            // escape \"~\"\" to \"~0\" and \"/\" to \"~1\"\n            replace_substring(s, \"~\", \"~0\");\n            replace_substring(s, \"/\", \"~1\");\n            return s;\n        }\n\n        /// unescape tilde and slash\n        static void unescape(std::string& s)\n        {\n            // first transform any occurrence of the sequence '~1' to '/'\n            replace_substring(s, \"~1\", \"/\");\n            // then transform any occurrence of the sequence '~0' to '~'\n            replace_substring(s, \"~0\", \"~\");\n        }\n\n        /*!\n        @param[in] reference_string  the reference string to the current value\n        @param[in] value             the value to consider\n        @param[in,out] result        the result object to insert values to\n\n        @note Empty objects or arrays are flattened to `null`.\n        */\n        static void flatten(const std::string& reference_string,\n                            const basic_json& value,\n                            basic_json& result)\n        {\n            switch (value.m_type)\n            {\n                case value_t::array:\n                {\n                    if (value.m_value.array->empty())\n                    {\n                        // flatten empty array as null\n                        result[reference_string] = nullptr;\n                    }\n                    else\n                    {\n                        // iterate array and use index as reference string\n                        for (size_t i = 0; i < value.m_value.array->size(); ++i)\n                        {\n                            flatten(reference_string + \"/\" + std::to_string(i),\n                                    value.m_value.array->operator[](i), result);\n                        }\n                    }\n                    break;\n                }\n\n                case value_t::object:\n                {\n                    if (value.m_value.object->empty())\n                    {\n                        // flatten empty object as null\n                        result[reference_string] = nullptr;\n                    }\n                    else\n                    {\n                        // iterate object and use keys as reference string\n                        for (const auto& element : *value.m_value.object)\n                        {\n                            flatten(reference_string + \"/\" + escape(element.first),\n                                    element.second, result);\n                        }\n                    }\n                    break;\n                }\n\n                default:\n                {\n                    // add primitive value with its reference string\n                    result[reference_string] = value;\n                    break;\n                }\n            }\n        }\n\n        /*!\n        @param[in] value  flattened JSON\n\n        @return unflattened JSON\n        */\n        static basic_json unflatten(const basic_json& value)\n        {\n            if (not value.is_object())\n            {\n                throw std::domain_error(\"only objects can be unflattened\");\n            }\n\n            basic_json result;\n\n            // iterate the JSON object values\n            for (const auto& element : *value.m_value.object)\n            {\n                if (not element.second.is_primitive())\n                {\n                    throw std::domain_error(\"values in object must be primitive\");\n                }\n\n                // assign value to reference pointed to by JSON pointer; Note\n                // that if the JSON pointer is \"\" (i.e., points to the whole\n                // value), function get_and_create returns a reference to\n                // result itself. An assignment will then create a primitive\n                // value.\n                json_pointer(element.first).get_and_create(result) = element.second;\n            }\n\n            return result;\n        }\n\n      private:\n        /// the reference tokens\n        std::vector<std::string> reference_tokens {};\n    };\n\n    //////////////////////////\n    // JSON Pointer support //\n    //////////////////////////\n\n    /// @name JSON Pointer functions\n    /// @{\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Uses a JSON pointer to retrieve a reference to the respective JSON value.\n    No bound checking is performed. Similar to @ref operator[](const typename\n    object_t::key_type&), `null` values are created in arrays and objects if\n    necessary.\n\n    In particular:\n    - If the JSON pointer points to an object key that does not exist, it\n      is created an filled with a `null` value before a reference to it\n      is returned.\n    - If the JSON pointer points to an array index that does not exist, it\n      is created an filled with a `null` value before a reference to it\n      is returned. All indices between the current maximum and the given\n      index are also filled with `null`.\n    - The special value `-` is treated as a synonym for the index past the\n      end.\n\n    @param[in] ptr  a JSON pointer\n\n    @return reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw std::out_of_range      if the JSON pointer can not be resolved\n    @throw std::domain_error      if an array index begins with '0'\n    @throw std::invalid_argument  if an array index was not a number\n\n    @liveexample{The behavior is shown in the example.,operatorjson_pointer}\n\n    @since version 2.0.0\n    */\n    reference operator[](const json_pointer& ptr)\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Uses a JSON pointer to retrieve a reference to the respective JSON value.\n    No bound checking is performed. The function does not change the JSON\n    value; no `null` values are created. In particular, the the special value\n    `-` yields an exception.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return const reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw std::out_of_range      if the JSON pointer can not be resolved\n    @throw std::domain_error      if an array index begins with '0'\n    @throw std::invalid_argument  if an array index was not a number\n\n    @liveexample{The behavior is shown in the example.,operatorjson_pointer_const}\n\n    @since version 2.0.0\n    */\n    const_reference operator[](const json_pointer& ptr) const\n    {\n        return ptr.get_unchecked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Returns a reference to the element at with specified JSON pointer @a ptr,\n    with bounds checking.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw std::out_of_range      if the JSON pointer can not be resolved\n    @throw std::domain_error      if an array index begins with '0'\n    @throw std::invalid_argument  if an array index was not a number\n\n    @liveexample{The behavior is shown in the example.,at_json_pointer}\n\n    @since version 2.0.0\n    */\n    reference at(const json_pointer& ptr)\n    {\n        return ptr.get_checked(this);\n    }\n\n    /*!\n    @brief access specified element via JSON Pointer\n\n    Returns a const reference to the element at with specified JSON pointer @a\n    ptr, with bounds checking.\n\n    @param[in] ptr  JSON pointer to the desired element\n\n    @return reference to the element pointed to by @a ptr\n\n    @complexity Constant.\n\n    @throw std::out_of_range      if the JSON pointer can not be resolved\n    @throw std::domain_error      if an array index begins with '0'\n    @throw std::invalid_argument  if an array index was not a number\n\n    @liveexample{The behavior is shown in the example.,at_json_pointer_const}\n\n    @since version 2.0.0\n    */\n    const_reference at(const json_pointer& ptr) const\n    {\n        return ptr.get_checked(this);\n    }\n\n    /*!\n    @brief return flattened JSON value\n\n    The function creates a JSON object whose keys are JSON pointers (see [RFC\n    6901](https://tools.ietf.org/html/rfc6901)) and whose values are all\n    primitive. The original JSON value can be restored using the @ref\n    unflatten() function.\n\n    @return an object that maps JSON pointers to primitve values\n\n    @note Empty objects and arrays are flattened to `null` and will not be\n          reconstructed correctly by the @ref unflatten() function.\n\n    @complexity Linear in the size the JSON value.\n\n    @liveexample{The following code shows how a JSON object is flattened to an\n    object whose keys consist of JSON pointers.,flatten}\n\n    @sa @ref unflatten() for the reverse function\n\n    @since version 2.0.0\n    */\n    basic_json flatten() const\n    {\n        basic_json result(value_t::object);\n        json_pointer::flatten(\"\", *this, result);\n        return result;\n    }\n\n    /*!\n    @brief unflatten a previously flattened JSON value\n\n    The function restores the arbitrary nesting of a JSON value that has been\n    flattened before using the @ref flatten() function. The JSON value must\n    meet certain constraints:\n    1. The value must be an object.\n    2. The keys must be JSON pointers (see\n       [RFC 6901](https://tools.ietf.org/html/rfc6901))\n    3. The mapped values must be primitive JSON types.\n\n    @return the original JSON from a flattened version\n\n    @note Empty objects and arrays are flattened by @ref flatten() to `null`\n          values and can not unflattened to their original type. Apart from\n          this example, for a JSON value `j`, the following is always true:\n          `j == j.flatten().unflatten()`.\n\n    @complexity Linear in the size the JSON value.\n\n    @liveexample{The following code shows how a flattened JSON object is\n    unflattened into the original nested JSON object.,unflatten}\n\n    @sa @ref flatten() for the reverse function\n\n    @since version 2.0.0\n    */\n    basic_json unflatten() const\n    {\n        return json_pointer::unflatten(*this);\n    }\n\n    /// @}\n\n    //////////////////////////\n    // JSON Patch functions //\n    //////////////////////////\n\n    /// @name JSON Patch functions\n    /// @{\n\n    /*!\n    @brief applies a JSON patch\n\n    [JSON Patch](http://jsonpatch.com) defines a JSON document structure for\n    expressing a sequence of operations to apply to a JSON) document. With\n    this funcion, a JSON Patch is applied to the current JSON value by\n    executing all operations from the patch.\n\n    @param[in] json_patch  JSON patch document\n    @return patched document\n\n    @note The application of a patch is atomic: Either all operations succeed\n          and the patched document is returned or an exception is thrown. In\n          any case, the original value is not changed: the patch is applied\n          to a copy of the value.\n\n    @throw std::out_of_range if a JSON pointer inside the patch could not\n    be resolved successfully in the current JSON value; example: `\"key baz\n    not found\"`\n    @throw invalid_argument if the JSON patch is malformed (e.g., mandatory\n    attributes are missing); example: `\"operation add must have member path\"`\n\n    @complexity Linear in the size of the JSON value and the length of the\n    JSON patch. As usually only a fraction of the JSON value is affected by\n    the patch, the complexity can usually be neglected.\n\n    @liveexample{The following code shows how a JSON patch is applied to a\n    value.,patch}\n\n    @sa @ref diff -- create a JSON patch by comparing two JSON values\n\n    @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)\n    @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901)\n\n    @since version 2.0.0\n    */\n    basic_json patch(const basic_json& json_patch) const\n    {\n        // make a working copy to apply the patch to\n        basic_json result = *this;\n\n        // the valid JSON Patch operations\n        enum class patch_operations {add, remove, replace, move, copy, test, invalid};\n\n        const auto get_op = [](const std::string op)\n        {\n            if (op == \"add\")\n            {\n                return patch_operations::add;\n            }\n            if (op == \"remove\")\n            {\n                return patch_operations::remove;\n            }\n            if (op == \"replace\")\n            {\n                return patch_operations::replace;\n            }\n            if (op == \"move\")\n            {\n                return patch_operations::move;\n            }\n            if (op == \"copy\")\n            {\n                return patch_operations::copy;\n            }\n            if (op == \"test\")\n            {\n                return patch_operations::test;\n            }\n\n            return patch_operations::invalid;\n        };\n\n        // wrapper for \"add\" operation; add value at ptr\n        const auto operation_add = [&result](json_pointer & ptr, basic_json val)\n        {\n            // adding to the root of the target document means replacing it\n            if (ptr.is_root())\n            {\n                result = val;\n            }\n            else\n            {\n                // make sure the top element of the pointer exists\n                json_pointer top_pointer = ptr.top();\n                if (top_pointer != ptr)\n                {\n                    basic_json& x = result.at(top_pointer);\n                }\n\n                // get reference to parent of JSON pointer ptr\n                const auto last_path = ptr.pop_back();\n                basic_json& parent = result[ptr];\n\n                switch (parent.m_type)\n                {\n                    case value_t::null:\n                    case value_t::object:\n                    {\n                        // use operator[] to add value\n                        parent[last_path] = val;\n                        break;\n                    }\n\n                    case value_t::array:\n                    {\n                        if (last_path == \"-\")\n                        {\n                            // special case: append to back\n                            parent.push_back(val);\n                        }\n                        else\n                        {\n                            const auto idx = std::stoi(last_path);\n                            if (static_cast<size_type>(idx) > parent.size())\n                            {\n                                // avoid undefined behavior\n                                throw std::out_of_range(\"array index \" + std::to_string(idx) + \" is out of range\");\n                            }\n                            else\n                            {\n                                // default case: insert add offset\n                                parent.insert(parent.begin() + static_cast<difference_type>(idx), val);\n                            }\n                        }\n                        break;\n                    }\n\n                    default:\n                    {\n                        // if there exists a parent it cannot be primitive\n                        assert(false);  // LCOV_EXCL_LINE\n                    }\n                }\n            }\n        };\n\n        // wrapper for \"remove\" operation; remove value at ptr\n        const auto operation_remove = [&result](json_pointer & ptr)\n        {\n            // get reference to parent of JSON pointer ptr\n            const auto last_path = ptr.pop_back();\n            basic_json& parent = result.at(ptr);\n\n            // remove child\n            if (parent.is_object())\n            {\n                // perform range check\n                auto it = parent.find(last_path);\n                if (it != parent.end())\n                {\n                    parent.erase(it);\n                }\n                else\n                {\n                    throw std::out_of_range(\"key '\" + last_path + \"' not found\");\n                }\n            }\n            else if (parent.is_array())\n            {\n                // note erase performs range check\n                parent.erase(static_cast<size_type>(std::stoi(last_path)));\n            }\n        };\n\n        // type check\n        if (not json_patch.is_array())\n        {\n            // a JSON patch must be an array of objects\n            throw std::invalid_argument(\"JSON patch must be an array of objects\");\n        }\n\n        // iterate and apply th eoperations\n        for (const auto& val : json_patch)\n        {\n            // wrapper to get a value for an operation\n            const auto get_value = [&val](const std::string & op,\n                                          const std::string & member,\n                                          bool string_type) -> basic_json&\n            {\n                // find value\n                auto it = val.m_value.object->find(member);\n\n                // context-sensitive error message\n                const auto error_msg = (op == \"op\") ? \"operation\" : \"operation '\" + op + \"'\";\n\n                // check if desired value is present\n                if (it == val.m_value.object->end())\n                {\n                    throw std::invalid_argument(error_msg + \" must have member '\" + member + \"'\");\n                }\n\n                // check if result is of type string\n                if (string_type and not it->second.is_string())\n                {\n                    throw std::invalid_argument(error_msg + \" must have string member '\" + member + \"'\");\n                }\n\n                // no error: return value\n                return it->second;\n            };\n\n            // type check\n            if (not val.is_object())\n            {\n                throw std::invalid_argument(\"JSON patch must be an array of objects\");\n            }\n\n            // collect mandatory members\n            const std::string op = get_value(\"op\", \"op\", true);\n            const std::string path = get_value(op, \"path\", true);\n            json_pointer ptr(path);\n\n            switch (get_op(op))\n            {\n                case patch_operations::add:\n                {\n                    operation_add(ptr, get_value(\"add\", \"value\", false));\n                    break;\n                }\n\n                case patch_operations::remove:\n                {\n                    operation_remove(ptr);\n                    break;\n                }\n\n                case patch_operations::replace:\n                {\n                    // the \"path\" location must exist - use at()\n                    result.at(ptr) = get_value(\"replace\", \"value\", false);\n                    break;\n                }\n\n                case patch_operations::move:\n                {\n                    const std::string from_path = get_value(\"move\", \"from\", true);\n                    json_pointer from_ptr(from_path);\n\n                    // the \"from\" location must exist - use at()\n                    basic_json v = result.at(from_ptr);\n\n                    // The move operation is functionally identical to a\n                    // \"remove\" operation on the \"from\" location, followed\n                    // immediately by an \"add\" operation at the target\n                    // location with the value that was just removed.\n                    operation_remove(from_ptr);\n                    operation_add(ptr, v);\n                    break;\n                }\n\n                case patch_operations::copy:\n                {\n                    const std::string from_path = get_value(\"copy\", \"from\", true);;\n                    const json_pointer from_ptr(from_path);\n\n                    // the \"from\" location must exist - use at()\n                    result[ptr] = result.at(from_ptr);\n                    break;\n                }\n\n                case patch_operations::test:\n                {\n                    bool success = false;\n                    try\n                    {\n                        // check if \"value\" matches the one at \"path\"\n                        // the \"path\" location must exist - use at()\n                        success = (result.at(ptr) == get_value(\"test\", \"value\", false));\n                    }\n                    catch (std::out_of_range&)\n                    {\n                        // ignore out of range errors: success remains false\n                    }\n\n                    // throw an exception if test fails\n                    if (not success)\n                    {\n                        throw std::domain_error(\"unsuccessful: \" + val.dump());\n                    }\n\n                    break;\n                }\n\n                case patch_operations::invalid:\n                {\n                    // op must be \"add\", \"remove\", \"replace\", \"move\", \"copy\", or\n                    // \"test\"\n                    throw std::invalid_argument(\"operation value '\" + op + \"' is invalid\");\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /*!\n    @brief creates a diff as a JSON patch\n\n    Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can\n    be changed into the value @a target by calling @ref patch function.\n\n    @invariant For two JSON values @a source and @a target, the following code\n    yields always `true`:\n    @code {.cpp}\n    source.patch(diff(source, target)) == target;\n    @endcode\n\n    @note Currently, only `remove`, `add`, and `replace` operations are\n          generated.\n\n    @param[in] source  JSON value to copare from\n    @param[in] target  JSON value to copare against\n    @param[in] path    helper value to create JSON pointers\n\n    @return a JSON patch to convert the @a source to @a target\n\n    @complexity Linear in the lengths of @a source and @a target.\n\n    @liveexample{The following code shows how a JSON patch is created as a\n    diff for two JSON values.,diff}\n\n    @sa @ref patch -- apply a JSON patch\n\n    @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)\n\n    @since version 2.0.0\n    */\n    static basic_json diff(const basic_json& source,\n                           const basic_json& target,\n                           std::string path = \"\")\n    {\n        // the patch\n        basic_json result(value_t::array);\n\n        // if the values are the same, return empty patch\n        if (source == target)\n        {\n            return result;\n        }\n\n        if (source.type() != target.type())\n        {\n            // different types: replace value\n            result.push_back(\n            {\n                {\"op\", \"replace\"},\n                {\"path\", path},\n                {\"value\", target}\n            });\n        }\n        else\n        {\n            switch (source.type())\n            {\n                case value_t::array:\n                {\n                    // first pass: traverse common elements\n                    size_t i = 0;\n                    while (i < source.size() and i < target.size())\n                    {\n                        // recursive call to compare array values at index i\n                        auto temp_diff = diff(source[i], target[i], path + \"/\" + std::to_string(i));\n                        result.insert(result.end(), temp_diff.begin(), temp_diff.end());\n                        ++i;\n                    }\n\n                    // i now reached the end of at least one array\n                    // in a second pass, traverse the remaining elements\n\n                    // remove my remaining elements\n                    const auto end_index = static_cast<difference_type>(result.size());\n                    while (i < source.size())\n                    {\n                        // add operations in reverse order to avoid invalid\n                        // indices\n                        result.insert(result.begin() + end_index, object(\n                        {\n                            {\"op\", \"remove\"},\n                            {\"path\", path + \"/\" + std::to_string(i)}\n                        }));\n                        ++i;\n                    }\n\n                    // add other remaining elements\n                    while (i < target.size())\n                    {\n                        result.push_back(\n                        {\n                            {\"op\", \"add\"},\n                            {\"path\", path + \"/\" + std::to_string(i)},\n                            {\"value\", target[i]}\n                        });\n                        ++i;\n                    }\n\n                    break;\n                }\n\n                case value_t::object:\n                {\n                    // first pass: traverse this object's elements\n                    for (auto it = source.begin(); it != source.end(); ++it)\n                    {\n                        // escape the key name to be used in a JSON patch\n                        const auto key = json_pointer::escape(it.key());\n\n                        if (target.find(it.key()) != target.end())\n                        {\n                            // recursive call to compare object values at key it\n                            auto temp_diff = diff(it.value(), target[it.key()], path + \"/\" + key);\n                            result.insert(result.end(), temp_diff.begin(), temp_diff.end());\n                        }\n                        else\n                        {\n                            // found a key that is not in o -> remove it\n                            result.push_back(object(\n                            {\n                                {\"op\", \"remove\"},\n                                {\"path\", path + \"/\" + key}\n                            }));\n                        }\n                    }\n\n                    // second pass: traverse other object's elements\n                    for (auto it = target.begin(); it != target.end(); ++it)\n                    {\n                        if (source.find(it.key()) == source.end())\n                        {\n                            // found a key that is not in this -> add it\n                            const auto key = json_pointer::escape(it.key());\n                            result.push_back(\n                            {\n                                {\"op\", \"add\"},\n                                {\"path\", path + \"/\" + key},\n                                {\"value\", it.value()}\n                            });\n                        }\n                    }\n\n                    break;\n                }\n\n                default:\n                {\n                    // both primitive type: replace value\n                    result.push_back(\n                    {\n                        {\"op\", \"replace\"},\n                        {\"path\", path},\n                        {\"value\", target}\n                    });\n                    break;\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /// @}\n};\n\n\n/////////////\n// presets //\n/////////////\n\n/*!\n@brief default JSON class\n\nThis type is the default specialization of the @ref basic_json class which\nuses the standard template types.\n\n@since version 1.0.0\n*/\nusing json = basic_json<>;\n}\n\n\n///////////////////////\n// nonmember support //\n///////////////////////\n\n// specialization of std::swap, and std::hash\nnamespace std\n{\n/*!\n@brief exchanges the values of two JSON objects\n\n@since version 1.0.0\n*/\ntemplate <>\ninline void swap(nlohmann::json& j1,\n                 nlohmann::json& j2) noexcept(\n                     is_nothrow_move_constructible<nlohmann::json>::value and\n                     is_nothrow_move_assignable<nlohmann::json>::value\n                 )\n{\n    j1.swap(j2);\n}\n\n/// hash value for JSON objects\ntemplate <>\nstruct hash<nlohmann::json>\n{\n    /*!\n    @brief return a hash value for a JSON object\n\n    @since version 1.0.0\n    */\n    std::size_t operator()(const nlohmann::json& j) const\n    {\n        // a naive hashing via the string representation\n        const auto& h = hash<nlohmann::json::string_t>();\n        return h(j.dump());\n    }\n};\n}\n\n/*!\n@brief user-defined string literal for JSON values\n\nThis operator implements a user-defined string literal for JSON objects. It\ncan be used by adding `\"_json\"` to a string literal and returns a JSON object\nif no parse error occurred.\n\n@param[in] s  a string representation of a JSON object\n@return a JSON object\n\n@since version 1.0.0\n*/\ninline nlohmann::json operator \"\" _json(const char* s, std::size_t)\n{\n    return nlohmann::json::parse(reinterpret_cast<const nlohmann::json::string_t::value_type*>(s));\n}\n\n/*!\n@brief user-defined string literal for JSON pointer\n\nThis operator implements a user-defined string literal for JSON Pointers. It\ncan be used by adding `\"_json\"` to a string literal and returns a JSON pointer\nobject if no parse error occurred.\n\n@param[in] s  a string representation of a JSON Pointer\n@return a JSON pointer object\n\n@since version 2.0.0\n*/\ninline nlohmann::json::json_pointer operator \"\" _json_pointer(const char* s, std::size_t)\n{\n    return nlohmann::json::json_pointer(s);\n}\n\n// restore GCC/clang diagnostic settings\n#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)\n    #pragma GCC diagnostic pop\n#endif\n\n#endif"
  },
  {
    "path": "environment/install.sh",
    "content": "# Install Halite environment\ncurl \"https://halite.io/downloads/environment/HaliteEnvironment-Source.zip\" -o \"HaliteEnvironment-Source.zip\"\nmkdir HaliteEnvironment-Source\nunzip HaliteEnvironment-Source.zip -d HaliteEnvironment-Source\nrm HaliteEnvironment-Source.zip\ncd HaliteEnvironment-Source\nmake\nmv halite ../\ncd ../\nrm -r HaliteEnvironment-Source \n"
  },
  {
    "path": "environment/main.cpp",
    "content": "#include <iostream>\n#include <cctype>\n#include <chrono>\n#include <list>\n#include <string.h>\n\n#include \"core/Halite.hpp\"\n\ninline std::istream & operator>>(std::istream & i, std::pair<signed int, signed int> & p) {\n    i >> p.first >> p.second;\n    return i;\n}\ninline std::ostream & operator<<(std::ostream & o, const std::pair<signed int, signed int> & p) {\n    o << p.first << ' ' << p.second;\n    return o;\n}\n#include <tclap/CmdLine.h>\n\nnamespace TCLAP {\ntemplate<> struct ArgTraits< std::pair<signed int, signed int> > {\n    typedef TCLAP::ValueLike ValueCategory;\n};\n}\n\nbool quiet_output = false; //Need to be passed to a bunch of classes; extern is cleaner.\nHalite * my_game; //Is a pointer to avoid problems with assignment, dynamic memory, and default constructors.\n\nNetworking promptNetworking();\nvoid promptDimensions(unsigned short & w, unsigned short & h);\n\nint main(int argc, char ** argv) {\n    srand(time(NULL)); //For all non-seeded randomness.\n\n    Networking networking;\n    std::vector<std::string> * names = NULL;\n    unsigned int id = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock().now().time_since_epoch()).count();\n\n    TCLAP::CmdLine cmd(\"Halite Game Environment\", ' ', \"1.2\");\n\n    //Switch Args.\n    TCLAP::SwitchArg quietSwitch(\"q\", \"quiet\", \"Runs game in quiet mode, producing machine-parsable output.\", cmd, false);\n    TCLAP::SwitchArg overrideSwitch(\"o\", \"override\", \"Overrides player-sent names using cmd args [SERVER ONLY].\", cmd, false);\n    TCLAP::SwitchArg timeoutSwitch(\"t\", \"timeout\", \"Causes game environment to ignore timeouts (give all bots infinite time).\", cmd, false);\n    TCLAP::SwitchArg noReplaySwitch(\"r\", \"noreplay\", \"Turns off the replay generation.\", cmd, false);\n\n    //Value Args\n    TCLAP::ValueArg<unsigned int> nPlayersArg(\"n\", \"nplayers\", \"Create a map that will accommodate n players [SINGLE PLAYER MODE ONLY].\", false, 1, \"{1,2,3,4,5,6}\", cmd);\n    TCLAP::ValueArg< std::pair<signed int, signed int> > dimensionArgs(\"d\", \"dimensions\", \"The dimensions of the map.\", false, { 0, 0 }, \"a string containing two space-seprated positive integers\", cmd);\n    TCLAP::ValueArg<unsigned int> seedArg(\"s\", \"seed\", \"The seed for the map generator.\", false, 0, \"positive integer\", cmd);\n    TCLAP::ValueArg<std::string> replayDirectoryArg(\"i\", \"replaydirectory\", \"The path to directory for replay output.\", false, \".\", \"path to directory\", cmd);\n\n    //Remaining Args, be they start commands and/or override names. Description only includes start commands since it will only be seen on local testing.\n    TCLAP::UnlabeledMultiArg<std::string> otherArgs(\"NonspecifiedArgs\", \"Start commands for bots.\", false, \"Array of strings\", cmd);\n\n    cmd.parse(argc, argv);\n\n    unsigned short mapWidth = dimensionArgs.getValue().first;\n    unsigned short mapHeight = dimensionArgs.getValue().second;\n\n    unsigned int seed;\n    if(seedArg.getValue() != 0) seed = seedArg.getValue();\n    else seed = (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 4294967295);\n\n    unsigned short n_players_for_map_creation = nPlayersArg.getValue();\n\n    quiet_output = quietSwitch.getValue();\n    bool override_names = overrideSwitch.getValue();\n    bool ignore_timeout = timeoutSwitch.getValue();\n\n    std::vector<std::string> unlabeledArgsVector = otherArgs.getValue();\n    std::list<std::string> unlabeledArgs;\n    for(auto a = unlabeledArgsVector.begin(); a != unlabeledArgsVector.end(); a++) {\n        unlabeledArgs.push_back(*a);\n    }\n\n    if(mapWidth == 0 && mapHeight == 0) {\n        std::vector<unsigned short> mapSizeChoices = {20, 25, 25, 30, 30, 30, 35, 35, 35, 35, 40, 40, 40, 45, 45, 50};\n        mapWidth = mapSizeChoices[rand() % mapSizeChoices.size()];\n        mapHeight = mapWidth;\n    }\n\n    if(override_names) {\n        if(unlabeledArgs.size() < 4 || unlabeledArgs.size() % 2 != 0) {\n            std::cout << \"Invalid number of player parameters with override switch enabled.  Override intended for server use only.\" << std::endl;\n            exit(1);\n        }\n        else {\n            try {\n                names = new std::vector<std::string>();\n                while(!unlabeledArgs.empty()) {\n                    networking.startAndConnectBot(unlabeledArgs.front());\n                    unlabeledArgs.pop_front();\n                    names->push_back(unlabeledArgs.front());\n                    unlabeledArgs.pop_front();\n                }\n            }\n            catch(...) {\n                std::cout << \"Invalid player parameters with override switch enabled.  Override intended for server use only.\" << std::endl;\n                delete names;\n                names = NULL;\n                exit(1);\n            }\n        }\n    }\n    else {\n        if(unlabeledArgs.size() < 1) {\n            std::cout << \"Please provide the launch command string for at least one bot.\" << std::endl\n            << \"Use the --help flag for usage details.\\n\";\n            exit(1);\n        }\n        try {\n            while(!unlabeledArgs.empty()) {\n                std::cout << unlabeledArgs.front() << std::endl;\n                networking.startAndConnectBot(unlabeledArgs.front());\n                unlabeledArgs.pop_front();\n            }\n        }\n        catch(...) {\n            std::cout << \"One or more of your bot launch command strings failed.  Please check for correctness and try again.\" << std::endl;\n            exit(1);\n        }\n    }\n\n    if(networking.numberOfPlayers() > 1 && n_players_for_map_creation != 1) {\n        std::cout << std::endl << \"Only single-player mode enables specified n-player maps.  When entering multiple bots, please do not try to specify n.\" << std::endl << std::endl;\n        exit(1);\n    }\n\n    if(networking.numberOfPlayers() > 1) n_players_for_map_creation = networking.numberOfPlayers();\n\n    if(n_players_for_map_creation > 6 || n_players_for_map_creation < 1) {\n        std::cout << std::endl << \"A map can only accommodate between 1 and 6 players.\" << std::endl << std::endl;\n        exit(1);\n    }\n\n\n\n    //Create game. Null parameters will be ignored.\n    my_game = new Halite(mapWidth, mapHeight, seed, n_players_for_map_creation, networking, ignore_timeout);\n\n    std::string outputFilename = replayDirectoryArg.getValue();\n#ifdef _WIN32\n    if(outputFilename.back() != '\\\\') outputFilename.push_back('\\\\');\n#else\n    if(outputFilename.back() != '/') outputFilename.push_back('/');\n#endif\n    GameStatistics stats = my_game->runGame(names, seed, id, !noReplaySwitch.getValue(), outputFilename);\n    if(names != NULL) delete names;\n\n    std::string victoryOut;\n    if(quiet_output) {\n        std::cout << stats;\n    }\n    else {\n        for(unsigned int a = 0; a < stats.player_statistics.size(); a++) std::cout << \"Player #\" << stats.player_statistics[a].tag << \", \" << my_game->getName(stats.player_statistics[a].tag) << \", came in rank #\" << stats.player_statistics[a].rank << \" and was last alive on frame #\" << stats.player_statistics[a].last_frame_alive << \"!\\n\";\n    }\n\n    delete my_game;\n\n    return 0;\n}\n"
  },
  {
    "path": "environment/make.bat",
    "content": "SET PATH=C:\\Program Files (x86)\\MSBuild\\14.0\\Bin;%PATH%\nCALL \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" amd64\ncd environment\ncl.exe /O2 /MT /EHsc main.cpp core/Halite.cpp /I . networking/Networking.cpp /link /out:halite.exe\n"
  },
  {
    "path": "environment/networking/Networking.cpp",
    "content": "#include \"Networking.hpp\"\n\n#include <fstream>\n#include <sstream>\n#include <algorithm>\n#include <stdio.h>\n#include <chrono>\n#include <thread>\n#include <mutex>\n\nstd::mutex coutMutex;\n\nstd::string serializeMapSize(const hlt::Map & map) {\n    std::string returnString = \"\";\n    std::ostringstream oss;\n    oss << map.map_width << ' ' << map.map_height << ' ';\n    returnString = oss.str();\n    return returnString;\n}\n\nstd::string serializeProductions(const hlt::Map & map) {\n    std::string returnString = \"\";\n    std::ostringstream oss;\n    for(auto a = map.contents.begin(); a != map.contents.end(); a++) {\n        for(auto b = a->begin(); b != a->end(); b++) {\n            oss << (unsigned short)(b->production) << ' ';\n        }\n    }\n    returnString = oss.str();\n    return returnString;\n}\n\nstd::string Networking::serializeMap(const hlt::Map & map) {\n    std::string returnString = \"\";\n    std::ostringstream oss;\n\n    //Run-length encode of owners\n    unsigned short currentOwner = map.contents[0][0].owner;\n    unsigned short counter = 0;\n    for(int a = 0; a < map.contents.size(); ++a) {\n        for(int b = 0; b < map.contents[a].size(); ++b) {\n            if(map.contents[a][b].owner == currentOwner) {\n                counter++;\n            }\n            else {\n                oss << (unsigned short)counter << ' ' << (unsigned short)currentOwner << ' ';\n                counter = 1;\n                currentOwner = map.contents[a][b].owner;\n            }\n        }\n    }\n    //Place the last run into the string\n    oss << (unsigned short)counter << ' ' << (unsigned short)currentOwner << ' ';\n\n    //Encoding of ages\n    for(int a = 0; a < map.contents.size(); ++a) {\n        for(int b = 0; b < map.contents[a].size(); ++b) {\n            oss << (unsigned short)map.contents[a][b].strength << ' ';\n        }\n    }\n\n    returnString = oss.str();\n\n    return returnString;\n}\n\nstd::map<hlt::Location, unsigned char> Networking::deserializeMoveSet(std::string & inputString, const hlt::Map & m) {\n    std::map<hlt::Location, unsigned char> moves = std::map<hlt::Location, unsigned char>();\n\n    if(std::find_if(inputString.begin(), inputString.end(), [](const char & c) -> bool { return (c < '0' || c > '9') && c != ' '; }) != inputString.end()) {\n        if(!quiet_output) {\n            std::string errorMessage = \"Bot sent an invalid character - ejecting from game.\\n\";\n\n            std::lock_guard<std::mutex> guard(coutMutex);\n            std::cout << errorMessage;\n        }\n        throw inputString;\n    }\n\n    std::stringstream iss(inputString);\n    hlt::Location l;\n    int d;\n    while (iss >> l.x >> l.y >> d && m.inBounds(l)) moves[l] = d;\n\n    return moves;\n}\n\nvoid Networking::sendString(unsigned char playerTag, std::string &sendString) {\n    //End message with newline character\n    sendString += '\\n';\n\n#ifdef _WIN32\n    WinConnection connection = connections[playerTag - 1];\n\n    DWORD charsWritten;\n    bool success;\n    success = WriteFile(connection.write, sendString.c_str(), sendString.length(), &charsWritten, NULL);\n    if(!success || charsWritten == 0) {\n        if(!quiet_output) std::cout << \"Problem writing to pipe\\n\";\n        throw 1;\n    }\n#else\n    UniConnection connection = connections[playerTag - 1];\n    ssize_t charsWritten = write(connection.write, sendString.c_str(), sendString.length());\n    if(charsWritten < sendString.length()) {\n        if(!quiet_output) std::cout << \"Problem writing to pipe\\n\";\n        throw 1;\n    }\n#endif\n}\n\nstd::string Networking::getString(unsigned char playerTag, const unsigned int timeoutMillis) {\n\n    std::string newString;\n    int timeoutMillisRemaining = timeoutMillis;\n    std::chrono::high_resolution_clock::time_point tp = std::chrono::high_resolution_clock::now();\n    \n#ifdef _WIN32\n    WinConnection connection = connections[playerTag - 1];\n\n    DWORD charsRead;\n    bool success;\n    char buffer;\n\n    //Keep reading char by char until a newline\n    while(true) {\n        timeoutMillisRemaining = timeoutMillis - std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - tp).count();\n        if(timeoutMillisRemaining < 0) throw newString;\n        //Check to see that there are bytes in the pipe before reading\n        //Throw error if no bytes in alloted time\n        //Check for bytes before sampling clock, because reduces latency (vast majority the pipe is alread full)\n        DWORD bytesAvailable = 0;\n        PeekNamedPipe(connection.read, NULL, 0, NULL, &bytesAvailable, NULL);\n        if(bytesAvailable < 1) {\n            std::chrono::high_resolution_clock::time_point initialTime = std::chrono::high_resolution_clock::now();\n            while (bytesAvailable < 1) {\n                if(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - initialTime).count() > timeoutMillisRemaining) throw newString;\n                PeekNamedPipe(connection.read, NULL, 0, NULL, &bytesAvailable, NULL);\n            }\n        }\n\n        success = ReadFile(connection.read, &buffer, 1, &charsRead, NULL);\n        if(!success || charsRead < 1) {\n            if(!quiet_output) {\n                std::string errorMessage = \"Bot #\" + std::to_string(playerTag) + \" timed out or errored (Windows)\\n\";\n                std::lock_guard<std::mutex> guard(coutMutex);\n                std::cout << errorMessage;\n            }\n            throw newString;\n        }\n        if(buffer == '\\n') break;\n        else newString += buffer;\n    }\n#else\n    UniConnection connection = connections[playerTag - 1];\n\n    fd_set set;\n    FD_ZERO(&set); /* clear the set */\n    FD_SET(connection.read, &set); /* add our file descriptor to the set */\n    char buffer;\n\n    //Keep reading char by char until a newline\n    while(true) {\n\n        //Check if there are bytes in the pipe\n        timeoutMillisRemaining = timeoutMillis - std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - tp).count();\n        if(timeoutMillisRemaining < 0) throw newString;\n        struct timeval timeout;\n        timeout.tv_sec = timeoutMillisRemaining / 1000.0;\n        timeout.tv_usec = (timeoutMillisRemaining % 1000)*1000;\n        int selectionResult = select(connection.read+1, &set, NULL, NULL, &timeout);\n\n        if(selectionResult > 0) {\n            read(connection.read, &buffer, 1);\n\n            if(buffer == '\\n') break;\n            else newString += buffer;\n        } else {\n            if(!quiet_output) {\n                std::string errorMessage = \"Bot #\" + std::to_string(playerTag) + \" timeout or error (Unix) \" + std::to_string(selectionResult) + '\\n';\n                std::lock_guard<std::mutex> guard(coutMutex);\n                std::cout << errorMessage;\n            }\n            throw newString;\n        }\n    }\n#endif\n    //Python turns \\n into \\r\\n\n    if(newString.back() == '\\r') newString.pop_back();\n\n    return newString;\n}\n\nvoid Networking::startAndConnectBot(std::string command) {\n#ifdef _WIN32\n\n    command = \"/C \" + command;\n\n    WinConnection parentConnection, childConnection;\n\n    SECURITY_ATTRIBUTES saAttr;\n    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);\n    saAttr.bInheritHandle = TRUE;\n    saAttr.lpSecurityDescriptor = NULL;\n\n    //Child stdout pipe\n    if(!CreatePipe(&parentConnection.read, &childConnection.write, &saAttr, 0)) {\n        if(!quiet_output) std::cout << \"Could not create pipe\\n\";\n        throw 1;\n    }\n    if(!SetHandleInformation(parentConnection.read, HANDLE_FLAG_INHERIT, 0)) throw 1;\n\n    //Child stdin pipe\n    if(!CreatePipe(&childConnection.read, &parentConnection.write, &saAttr, 0)) {\n        if(!quiet_output) std::cout << \"Could not create pipe\\n\";\n        throw 1;\n    }\n    if(!SetHandleInformation(parentConnection.write, HANDLE_FLAG_INHERIT, 0)) throw 1;\n\n    //MAKE SURE THIS MEMORY IS ERASED\n    PROCESS_INFORMATION piProcInfo;\n    ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));\n\n    STARTUPINFO siStartInfo;\n    ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));\n    siStartInfo.cb = sizeof(STARTUPINFO);\n    siStartInfo.hStdError = childConnection.write;\n    siStartInfo.hStdOutput = childConnection.write;\n    siStartInfo.hStdInput = childConnection.read;\n    siStartInfo.dwFlags |= STARTF_USESTDHANDLES;\n\n    //C:/xampp/htdocs/Halite/Halite/Debug/ExampleBot.exe\n    //C:/Users/Michael/Anaconda3/python.exe\n    //C:/Program Files/Java/jre7/bin/java.exe -cp C:/xampp/htdocs/Halite/AIResources/Java MyBot\n    bool success = CreateProcess(\n        \"C:\\\\windows\\\\system32\\\\cmd.exe\",\n        LPSTR(command.c_str()),     //command line\n        NULL,          //process security attributes\n        NULL,          //primary thread security attributes\n        TRUE,          //handles are inherited\n        0,             //creation flags\n        NULL,          //use parent's environment\n        NULL,          //use parent's current directory\n        &siStartInfo,  //STARTUPINFO pointer\n        &piProcInfo\n    );  //receives PROCESS_INFORMATION\n    if(!success) {\n        if(!quiet_output) std::cout << \"Could not start process\\n\";\n        throw 1;\n    }\n    else {\n        CloseHandle(piProcInfo.hProcess);\n        CloseHandle(piProcInfo.hThread);\n\n        processes.push_back(piProcInfo.hProcess);\n        connections.push_back(parentConnection);\n    }\n\n#else\n\n    if(!quiet_output) std::cout << command << \"\\n\";\n\n    pid_t pid;\n    int writePipe[2];\n    int readPipe[2];\n\n    if(pipe(writePipe)) {\n        if(!quiet_output) std::cout << \"Error creating pipe\\n\";\n        throw 1;\n    }\n    if(pipe(readPipe)) {\n        if(!quiet_output) std::cout << \"Error creating pipe\\n\";\n        throw 1;\n    }\n\n    pid_t ppid_before_fork = getpid();\n\n    //Fork a child process\n    pid = fork();\n    if(pid == 0) { //This is the child\n        setpgid(getpid(), getpid());\n\n#ifdef __linux__\n        // install a parent death signal\n        // http://stackoverflow.com/a/36945270\n        int r = prctl(PR_SET_PDEATHSIG, SIGTERM);\n        if (r == -1)\n        {\n            if(!quiet_output) std::cout << \"Error installing parent death signal\\n\";\n            throw 1;\n        }\n        if (getppid() != ppid_before_fork)\n            exit(1);\n#endif\n\n        dup2(writePipe[0], STDIN_FILENO);\n\n        dup2(readPipe[1], STDOUT_FILENO);\n        dup2(readPipe[1], STDERR_FILENO);\n\n        execl(\"/bin/sh\", \"sh\", \"-c\", command.c_str(), (char*) NULL);\n\n        //Nothing past the execl should be run\n\n        exit(1);\n    } else if(pid < 0) {\n        if(!quiet_output) std::cout << \"Fork failed\\n\";\n        throw 1;\n    }\n\n    UniConnection connection;\n    connection.read = readPipe[0];\n    connection.write = writePipe[1];\n\n    connections.push_back(connection);\n    processes.push_back(pid);\n\n#endif\n\n    player_logs.push_back(std::string());\n}\n\nint Networking::handleInitNetworking(unsigned char playerTag, const hlt::Map & m, bool ignoreTimeout, std::string * playerName) {\n\n    const int ALLOTTED_MILLIS = ignoreTimeout ? 2147483647 : 30000;\n\n    std::string response;\n    try {\n        std::string playerTagString = std::to_string(playerTag), mapSizeString = serializeMapSize(m), mapString = serializeMap(m), prodString = serializeProductions(m);\n        sendString(playerTag, playerTagString);\n        sendString(playerTag, mapSizeString);\n        sendString(playerTag, prodString);\n        sendString(playerTag, mapString);\n        std::string outMessage = \"Init Message sent to player \" + std::to_string(int(playerTag)) + \".\\n\";\n        if(!quiet_output) std::cout << outMessage;\n\n        player_logs[playerTag - 1] += \" --- Init ---\\n\";\n\n        std::chrono::high_resolution_clock::time_point initialTime = std::chrono::high_resolution_clock::now();\n        response = getString(playerTag, ALLOTTED_MILLIS);\n        unsigned int millisTaken = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - initialTime).count();\n\n        player_logs[playerTag - 1] += response + \"\\n --- Bot used \" + std::to_string(millisTaken) + \" milliseconds ---\";\n\n        *playerName = response.substr(0, 30);\n        if(!quiet_output) {\n            std::string inMessage = \"Init Message received from player \" + std::to_string(int(playerTag)) + \", \" + *playerName + \".\\n\";\n            std::cout << inMessage;\n        }\n\n        return millisTaken;\n    }\n    catch(std::string s) {\n        if(s.empty()) player_logs[playerTag - 1] += \"\\nERRORED!\\nNo response received.\";\n        else player_logs[playerTag - 1] += \"\\nERRORED!\\nResponse received (if any):\\n\" + s;\n        *playerName = \"Bot #\" + std::to_string(playerTag) + \"; timed out during Init\";\n    }\n    catch(...) {\n        if(response.empty()) player_logs[playerTag - 1] += \"\\nERRORED!\\nNo response received.\";\n        else player_logs[playerTag - 1] += \"\\nERRORED!\\nResponse received (if any):\\n\" + response;\n        *playerName = \"Bot #\" + std::to_string(playerTag) + \"; timed out during Init\";\n    }\n    return -1;\n}\n\nint Networking::handleFrameNetworking(unsigned char playerTag, const unsigned short & turnNumber, const hlt::Map & m, bool ignoreTimeout, std::map<hlt::Location, unsigned char> * moves) {\n\n    const int ALLOTTED_MILLIS = ignoreTimeout ? 2147483647 : 1500;\n\n    std::string response;\n    try {\n        if(isProcessDead(playerTag)) return -1;\n\n        //Send this bot the game map and the messages addressed to this bot\n        std::string mapString = serializeMap(m);\n        sendString(playerTag, mapString);\n\n        moves->clear();\n\n        player_logs[playerTag - 1] += \"\\n-----------------------------------------------------------------------------\\n --- Frame #\" + std::to_string(turnNumber) + \" ---\\n\";\n\n        std::chrono::high_resolution_clock::time_point initialTime = std::chrono::high_resolution_clock::now();\n        response = getString(playerTag, ALLOTTED_MILLIS);\n        unsigned int millisTaken = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - initialTime).count();\n\n        player_logs[playerTag - 1] += response + \"\\n --- Bot used \" + std::to_string(millisTaken) + \" milliseconds ---\";\n\n        *moves = deserializeMoveSet(response, m);\n\n        return millisTaken;\n    }\n    catch(std::string s) {\n        if(s.empty()) player_logs[playerTag - 1] += \"\\nERRORED!\\nNo response received.\";\n        else player_logs[playerTag - 1] += \"\\nERRORED!\\nResponse received (if any):\\n\" + s;\n        *moves = std::map<hlt::Location, unsigned char>();\n    }\n    catch(...) {\n        if(response.empty()) player_logs[playerTag - 1] += \"\\nERRORED!\\nNo response received.\";\n        else player_logs[playerTag - 1] += \"\\nERRORED!\\nResponse received (if any):\\n\" + response;\n        *moves = std::map<hlt::Location, unsigned char>();\n    }\n    return -1;\n}\n\nvoid Networking::killPlayer(unsigned char playerTag) {\n    if(isProcessDead(playerTag)) return;\n\n    std::string newString;\n    const int PER_CHAR_WAIT = 10; //millis\n    const int MAX_READ_TIME = 1000; //millis\n\n#ifdef _WIN32\n\n    //Try to read entire contents of pipe.\n    WinConnection connection = connections[playerTag - 1];\n    DWORD charsRead;\n    bool success;\n    char buffer;\n    std::chrono::high_resolution_clock::time_point tp = std::chrono::high_resolution_clock::now();\n    while(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - tp).count() < MAX_READ_TIME) {\n        DWORD bytesAvailable = 0;\n        PeekNamedPipe(connection.read, NULL, 0, NULL, &bytesAvailable, NULL);\n        if(bytesAvailable < 1) {\n            std::chrono::high_resolution_clock::time_point initialTime = std::chrono::high_resolution_clock::now();\n            while(bytesAvailable < 1) {\n                if(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - initialTime).count() > PER_CHAR_WAIT) break;\n                PeekNamedPipe(connection.read, NULL, 0, NULL, &bytesAvailable, NULL);\n            }\n            if(bytesAvailable < 1) break; //Took too long to get a character; breaking.\n        }\n\n        success = ReadFile(connection.read, &buffer, 1, &charsRead, NULL);\n        if(!success || charsRead < 1) {\n            if(!quiet_output) {\n                std::string errorMessage = \"Bot #\" + std::to_string(playerTag) + \" timed out or errored (Windows)\\n\";\n                std::lock_guard<std::mutex> guard(coutMutex);\n                std::cout << errorMessage;\n            }\n            break;\n        }\n        newString += buffer;\n    }\n\n    HANDLE process = processes[playerTag - 1];\n\n    TerminateProcess(process, 0);\n\n    processes[playerTag - 1] = NULL;\n    connections[playerTag - 1].read = NULL;\n    connections[playerTag - 1].write = NULL;\n\n    std::string deadMessage = \"Player \" + std::to_string(playerTag) + \" is dead\\n\";\n    if(!quiet_output) std::cout << deadMessage;\n\n#else\n\n    //Try to read entire contents of pipe.\n    UniConnection connection = connections[playerTag - 1];\n    fd_set set;\n    FD_ZERO(&set); /* clear the set */\n    FD_SET(connection.read, &set); /* add our file descriptor to the set */\n    char buffer;\n    std::chrono::high_resolution_clock::time_point tp = std::chrono::high_resolution_clock::now();\n    while(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - tp).count() < MAX_READ_TIME) {\n        struct timeval timeout;\n        timeout.tv_sec = PER_CHAR_WAIT / 1000;\n        timeout.tv_usec = (PER_CHAR_WAIT % 1000)*1000;\n        int selectionResult = select(connection.read+1, &set, NULL, NULL, &timeout);\n        if(selectionResult > 0) {\n            read(connection.read, &buffer, 1);\n            newString += buffer;\n        }\n        else break;\n    }\n\n    kill(-processes[playerTag - 1], SIGKILL);\n\n    processes[playerTag - 1] = -1;\n    connections[playerTag - 1].read = -1;\n    connections[playerTag - 1].write = -1;\n#endif\n\n    if(!newString.empty()) player_logs[playerTag - 1] += \"\\n --- Bot was killed. Below is the rest of its output (if any): ---\\n\" + newString + \"\\n --- End bot output ---\";\n}\n\nbool Networking::isProcessDead(unsigned char playerTag) {\n#ifdef _WIN32\n    return processes[playerTag - 1] == NULL;\n#else\n    return processes[playerTag - 1] == -1;\n#endif\n}\n\nint Networking::numberOfPlayers() {\n#ifdef _WIN32\n    return connections.size();\n#else\n    return connections.size();\n#endif\n}\n"
  },
  {
    "path": "environment/networking/Networking.hpp",
    "content": "#ifndef NETWORKING_H\n#define NETWORKING_H\n\n#include <iostream>\n#include <map>\n\n#ifdef _WIN32\n    #include <windows.h>\n    #include <tchar.h>\n    #include <stdio.h>\n    #include <strsafe.h>\n#else\n    #include <signal.h>\n    #include <time.h>\n    #include <sys/types.h>\n    #include <sys/stat.h>\n    #include <fcntl.h>\n    #include <sys/select.h>\n#ifdef __linux__\n    #include <sys/prctl.h>\n#endif\n    #include <unistd.h>\n#endif\n\n#include \"../core/hlt.hpp\"\n\nextern bool quiet_output;\n\nclass Networking {\npublic:\n    void startAndConnectBot(std::string command);\n    int handleInitNetworking(unsigned char playerTag, const hlt::Map & m, bool ignoreTimeout, std::string * playerName);\n    int handleFrameNetworking(unsigned char playerTag, const unsigned short & turnNumber, const hlt::Map & m, bool ignoreTimeout, std::map<hlt::Location, unsigned char> * moves);\n    void killPlayer(unsigned char playerTag);\n    bool isProcessDead(unsigned char playerTag);\n    int numberOfPlayers();\n\n    std::vector<std::string> player_logs;\n\nprivate:\n#ifdef _WIN32\n    struct WinConnection {\n        HANDLE write, read;\n    };\n    std::vector<WinConnection> connections;\n    std::vector<HANDLE> processes;\n#else\n    struct UniConnection {\n        int read, write;\n    };\n    std::vector< UniConnection > connections;\n    std::vector<int> processes;\n#endif\n\n    std::string serializeMap(const hlt::Map & map);\n    std::map<hlt::Location, unsigned char> deserializeMoveSet(std::string & inputString, const hlt::Map & m);\n\n    void sendString(unsigned char playerTag, std::string &sendString);\n    std::string getString(unsigned char playerTag, unsigned int timoutMillis);\n};\n\n#endif\n"
  },
  {
    "path": "environment/tclap/Arg.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/******************************************************************************\n *\n *  file:  Arg.h\n *\n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *\n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n *  DEALINGS IN THE SOFTWARE.\n *\n *****************************************************************************/\n\n\n#ifndef TCLAP_ARGUMENT_H\n#define TCLAP_ARGUMENT_H\n\n#ifdef HAVE_CONFIG_H\n#include <config.h>\n#else\n#define HAVE_SSTREAM\n#endif\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <iomanip>\n#include <cstdio>\n\n#if defined(HAVE_SSTREAM)\n#include <sstream>\ntypedef std::istringstream istringstream;\n#elif defined(HAVE_STRSTREAM)\n#include <strstream>\ntypedef std::istrstream istringstream;\n#else\n#error \"Need a stringstream (sstream or strstream) to compile!\"\n#endif\n\n#include <tclap/ArgException.h>\n#include <tclap/Visitor.h>\n#include <tclap/CmdLineInterface.h>\n#include <tclap/ArgTraits.h>\n#include <tclap/StandardTraits.h>\n\nnamespace TCLAP {\n\n/**\n * A virtual base class that defines the essential data for all arguments.\n * This class, or one of its existing children, must be subclassed to do\n * anything.\n */\nclass Arg\n{\n\tprivate:\n\t\t/**\n\t\t * Prevent accidental copying.\n\t\t */\n\t\tArg(const Arg& rhs);\n\n\t\t/**\n\t\t * Prevent accidental copying.\n\t\t */\n\t\tArg& operator=(const Arg& rhs);\n\n\t\t/**\n\t\t * Indicates whether the rest of the arguments should be ignored.\n\t\t */\n\t\tstatic bool& ignoreRestRef() { static bool ign = false; return ign; }\n\n\t\t/**\n\t\t * The delimiter that separates an argument flag/name from the\n\t\t * value.\n\t\t */\n\t\tstatic char& delimiterRef() { static char delim = ' '; return delim; }\n\n\tprotected:\n\n\t\t/**\n\t\t * The single char flag used to identify the argument.\n\t\t * This value (preceded by a dash {-}), can be used to identify\n\t\t * an argument on the command line.  The _flag can be blank,\n\t\t * in fact this is how unlabeled args work.  Unlabeled args must\n\t\t * override appropriate functions to get correct handling. Note\n\t\t * that the _flag does NOT include the dash as part of the flag.\n\t\t */\n\t\tstd::string _flag;\n\n\t\t/**\n\t\t * A single work namd indentifying the argument.\n\t\t * This value (preceded by two dashed {--}) can also be used\n\t\t * to identify an argument on the command line.  Note that the\n\t\t * _name does NOT include the two dashes as part of the _name. The\n\t\t * _name cannot be blank.\n\t\t */\n\t\tstd::string _name;\n\n\t\t/**\n\t\t * Description of the argument.\n\t\t */\n\t\tstd::string _description;\n\n\t\t/**\n\t\t * Indicating whether the argument is required.\n\t\t */\n\t\tbool _required;\n\n\t\t/**\n\t\t * Label to be used in usage description.  Normally set to\n\t\t * \"required\", but can be changed when necessary.\n\t\t */\n\t\tstd::string _requireLabel;\n\n\t\t/**\n\t\t * Indicates whether a value is required for the argument.\n\t\t * Note that the value may be required but the argument/value\n\t\t * combination may not be, as specified by _required.\n\t\t */\n\t\tbool _valueRequired;\n\n\t\t/**\n\t\t * Indicates whether the argument has been set.\n\t\t * Indicates that a value on the command line has matched the\n\t\t * name/flag of this argument and the values have been set accordingly.\n\t\t */\n\t\tbool _alreadySet;\n\n\t\t/**\n\t\t * A pointer to a vistitor object.\n\t\t * The visitor allows special handling to occur as soon as the\n\t\t * argument is matched.  This defaults to NULL and should not\n\t\t * be used unless absolutely necessary.\n\t\t */\n\t\tVisitor* _visitor;\n\n\t\t/**\n\t\t * Whether this argument can be ignored, if desired.\n\t\t */\n\t\tbool _ignoreable;\n\n\t\t/**\n\t\t * Indicates that the arg was set as part of an XOR and not on the\n\t\t * command line.\n\t\t */\n\t\tbool _xorSet;\n\n\t\tbool _acceptsMultipleValues;\n\n\t\t/**\n\t\t * Performs the special handling described by the Vistitor.\n\t\t */\n\t\tvoid _checkWithVisitor() const;\n\n\t\t/**\n\t\t * Primary constructor. YOU (yes you) should NEVER construct an Arg\n\t\t * directly, this is a base class that is extended by various children\n\t\t * that are meant to be used.  Use SwitchArg, ValueArg, MultiArg,\n\t\t * UnlabeledValueArg, or UnlabeledMultiArg instead.\n\t\t *\n\t\t * \\param flag - The flag identifying the argument.\n\t\t * \\param name - The name identifying the argument.\n\t\t * \\param desc - The description of the argument, used in the usage.\n\t\t * \\param req - Whether the argument is required.\n\t\t * \\param valreq - Whether the a value is required for the argument.\n\t\t * \\param v - The visitor checked by the argument. Defaults to NULL.\n\t\t */\n \t\tArg( const std::string& flag,\n\t\t\t const std::string& name,\n\t\t\t const std::string& desc,\n\t\t\t bool req,\n\t\t\t bool valreq,\n\t\t\t Visitor* v = NULL );\n\n\tpublic:\n\t\t/**\n\t\t * Destructor.\n\t\t */\n\t\tvirtual ~Arg();\n\n\t\t/**\n\t\t * Adds this to the specified list of Args.\n\t\t * \\param argList - The list to add this to.\n\t\t */\n\t\tvirtual void addToList( std::list<Arg*>& argList ) const;\n\n\t\t/**\n\t\t * Begin ignoring arguments since the \"--\" argument was specified.\n\t\t */\n\t\tstatic void beginIgnoring() { ignoreRestRef() = true; }\n\n\t\t/**\n\t\t * Whether to ignore the rest.\n\t\t */\n\t\tstatic bool ignoreRest() { return ignoreRestRef(); }\n\n\t\t/**\n\t\t * The delimiter that separates an argument flag/name from the\n\t\t * value.\n\t\t */\n\t\tstatic char delimiter() { return delimiterRef(); }\n\n\t\t/**\n\t\t * The char used as a place holder when SwitchArgs are combined.\n\t\t * Currently set to the bell char (ASCII 7).\n\t\t */\n\t\tstatic char blankChar() { return (char)7; }\n\n\t\t/**\n\t\t * The char that indicates the beginning of a flag.  Defaults to '-', but\n\t\t * clients can define TCLAP_FLAGSTARTCHAR to override.\n\t\t */\n#ifndef TCLAP_FLAGSTARTCHAR\n#define TCLAP_FLAGSTARTCHAR '-'\n#endif\n\t\tstatic char flagStartChar() { return TCLAP_FLAGSTARTCHAR; }\n\n\t\t/**\n\t\t * The sting that indicates the beginning of a flag.  Defaults to \"-\", but\n\t\t * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same\n\t\t * as TCLAP_FLAGSTARTCHAR.\n\t\t */\n#ifndef TCLAP_FLAGSTARTSTRING\n#define TCLAP_FLAGSTARTSTRING \"-\"\n#endif\n\t\tstatic const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; }\n\n\t\t/**\n\t\t * The sting that indicates the beginning of a name.  Defaults to \"--\", but\n\t\t *  clients can define TCLAP_NAMESTARTSTRING to override.\n\t\t */\n#ifndef TCLAP_NAMESTARTSTRING\n#define TCLAP_NAMESTARTSTRING \"--\"\n#endif\n\t\tstatic const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; }\n\n\t\t/**\n\t\t * The name used to identify the ignore rest argument.\n\t\t */\n\t\tstatic const std::string ignoreNameString() { return \"ignore_rest\"; }\n\n\t\t/**\n\t\t * Sets the delimiter for all arguments.\n\t\t * \\param c - The character that delimits flags/names from values.\n\t\t */\n\t\tstatic void setDelimiter( char c ) { delimiterRef() = c; }\n\n\t\t/**\n\t\t * Pure virtual method meant to handle the parsing and value assignment\n\t\t * of the string on the command line.\n\t\t * \\param i - Pointer the the current argument in the list.\n\t\t * \\param args - Mutable list of strings. What is\n\t\t * passed in from main.\n\t\t */\n\t\tvirtual bool processArg(int *i, std::vector<std::string>& args) = 0;\n\n\t\t/**\n\t\t * Operator ==.\n\t\t * Equality operator. Must be virtual to handle unlabeled args.\n\t\t * \\param a - The Arg to be compared to this.\n\t\t */\n\t\tvirtual bool operator==(const Arg& a) const;\n\n\t\t/**\n\t\t * Returns the argument flag.\n\t\t */\n\t\tconst std::string& getFlag() const;\n\n\t\t/**\n\t\t * Returns the argument name.\n\t\t */\n\t\tconst std::string& getName() const;\n\n\t\t/**\n\t\t * Returns the argument description.\n\t\t */\n\t\tstd::string getDescription() const;\n\n\t\t/**\n\t\t * Indicates whether the argument is required.\n\t\t */\n\t\tvirtual bool isRequired() const;\n\n\t\t/**\n\t\t * Sets _required to true. This is used by the XorHandler.\n\t\t * You really have no reason to ever use it.\n\t\t */\n\t\tvoid forceRequired();\n\n\t\t/**\n\t\t * Sets the _alreadySet value to true.  This is used by the XorHandler.\n\t\t * You really have no reason to ever use it.\n\t\t */\n\t\tvoid xorSet();\n\n\t\t/**\n\t\t * Indicates whether a value must be specified for argument.\n\t\t */\n\t\tbool isValueRequired() const;\n\n\t\t/**\n\t\t * Indicates whether the argument has already been set.  Only true\n\t\t * if the arg has been matched on the command line.\n\t\t */\n\t\tbool isSet() const;\n\n\t\t/**\n\t\t * Indicates whether the argument can be ignored, if desired.\n\t\t */\n\t\tbool isIgnoreable() const;\n\n\t\t/**\n\t\t * A method that tests whether a string matches this argument.\n\t\t * This is generally called by the processArg() method.  This\n\t\t * method could be re-implemented by a child to change how\n\t\t * arguments are specified on the command line.\n\t\t * \\param s - The string to be compared to the flag/name to determine\n\t\t * whether the arg matches.\n\t\t */\n\t\tvirtual bool argMatches( const std::string& s ) const;\n\n\t\t/**\n\t\t * Returns a simple string representation of the argument.\n\t\t * Primarily for debugging.\n\t\t */\n\t\tvirtual std::string toString() const;\n\n\t\t/**\n\t\t * Returns a short ID for the usage.\n\t\t * \\param valueId - The value used in the id.\n\t\t */\n\t\tvirtual std::string shortID( const std::string& valueId = \"val\" ) const;\n\n\t\t/**\n\t\t * Returns a long ID for the usage.\n\t\t * \\param valueId - The value used in the id.\n\t\t */\n\t\tvirtual std::string longID( const std::string& valueId = \"val\" ) const;\n\n\t\t/**\n\t\t * Trims a value off of the flag.\n\t\t * \\param flag - The string from which the flag and value will be\n\t\t * trimmed. Contains the flag once the value has been trimmed.\n\t\t * \\param value - Where the value trimmed from the string will\n\t\t * be stored.\n\t\t */\n\t\tvirtual void trimFlag( std::string& flag, std::string& value ) const;\n\n\t\t/**\n\t\t * Checks whether a given string has blank chars, indicating that\n\t\t * it is a combined SwitchArg.  If so, return true, otherwise return\n\t\t * false.\n\t\t * \\param s - string to be checked.\n\t\t */\n\t\tbool _hasBlanks( const std::string& s ) const;\n\n\t\t/**\n\t\t * Sets the requireLabel. Used by XorHandler.  You shouldn't ever\n\t\t * use this.\n\t\t * \\param s - Set the requireLabel to this value.\n\t\t */\n\t\tvoid setRequireLabel( const std::string& s );\n\n\t\t/**\n\t\t * Used for MultiArgs and XorHandler to determine whether args\n\t\t * can still be set.\n\t\t */\n\t\tvirtual bool allowMore();\n\n\t\t/**\n\t\t * Use by output classes to determine whether an Arg accepts\n\t\t * multiple values.\n\t\t */\n\t\tvirtual bool acceptsMultipleValues();\n\n\t\t/**\n\t\t * Clears the Arg object and allows it to be reused by new\n\t\t * command lines.\n\t\t */\n\t\t virtual void reset();\n};\n\n/**\n * Typedef of an Arg list iterator.\n */\ntypedef std::list<Arg*>::iterator ArgListIterator;\n\n/**\n * Typedef of an Arg vector iterator.\n */\ntypedef std::vector<Arg*>::iterator ArgVectorIterator;\n\n/**\n * Typedef of a Visitor list iterator.\n */\ntypedef std::list<Visitor*>::iterator VisitorListIterator;\n\n/*\n * Extract a value of type T from it's string representation contained\n * in strVal. The ValueLike parameter used to select the correct\n * specialization of ExtractValue depending on the value traits of T.\n * ValueLike traits use operator>> to assign the value from strVal.\n */\ntemplate<typename T> void\nExtractValue(T &destVal, const std::string& strVal, ValueLike vl)\n{\n    static_cast<void>(vl); // Avoid warning about unused vl\n    std::istringstream is(strVal);\n\n    int valuesRead = 0;\n    while ( is.good() ) {\n\tif ( is.peek() != EOF )\n#ifdef TCLAP_SETBASE_ZERO\n\t    is >> std::setbase(0) >> destVal;\n#else\n\t    is >> destVal;\n#endif\n\telse\n\t    break;\n\n\tvaluesRead++;\n    }\n\n    if ( is.fail() )\n\tthrow( ArgParseException(\"Couldn't read argument value \"\n\t\t\t\t \"from string '\" + strVal + \"'\"));\n\n\n    if ( valuesRead > 1 )\n\tthrow( ArgParseException(\"More than one valid value parsed from \"\n\t\t\t\t \"string '\" + strVal + \"'\"));\n\n}\n\n/*\n * Extract a value of type T from it's string representation contained\n * in strVal. The ValueLike parameter used to select the correct\n * specialization of ExtractValue depending on the value traits of T.\n * StringLike uses assignment (operator=) to assign from strVal.\n */\ntemplate<typename T> void\nExtractValue(T &destVal, const std::string& strVal, StringLike sl)\n{\n    static_cast<void>(sl); // Avoid warning about unused sl\n    SetString(destVal, strVal);\n}\n\n//////////////////////////////////////////////////////////////////////\n//BEGIN Arg.cpp\n//////////////////////////////////////////////////////////////////////\n\ninline Arg::Arg(const std::string& flag,\n         const std::string& name,\n         const std::string& desc,\n         bool req,\n         bool valreq,\n         Visitor* v) :\n  _flag(flag),\n  _name(name),\n  _description(desc),\n  _required(req),\n  _requireLabel(\"required\"),\n  _valueRequired(valreq),\n  _alreadySet(false),\n  _visitor( v ),\n  _ignoreable(true),\n  _xorSet(false),\n  _acceptsMultipleValues(false)\n{\n\tif ( _flag.length() > 1 )\n\t\tthrow(SpecificationException(\n\t\t\t\t\"Argument flag can only be one character long\", toString() ) );\n\n\tif ( _name != ignoreNameString() &&\n\t\t ( _flag == Arg::flagStartString() ||\n\t\t   _flag == Arg::nameStartString() ||\n\t\t   _flag == \" \" ) )\n\t\tthrow(SpecificationException(\"Argument flag cannot be either '\" +\n\t\t\t\t\t\t\tArg::flagStartString() + \"' or '\" +\n\t\t\t\t\t\t\tArg::nameStartString() + \"' or a space.\",\n\t\t\t\t\t\t\ttoString() ) );\n\n\tif ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) ||\n\t\t ( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) ||\n\t\t ( _name.find( \" \", 0 ) != std::string::npos ) )\n\t\tthrow(SpecificationException(\"Argument name begin with either '\" +\n\t\t\t\t\t\t\tArg::flagStartString() + \"' or '\" +\n\t\t\t\t\t\t\tArg::nameStartString() + \"' or space.\",\n\t\t\t\t\t\t\ttoString() ) );\n\n}\n\ninline Arg::~Arg() { }\n\ninline std::string Arg::shortID( const std::string& valueId ) const\n{\n\tstd::string id = \"\";\n\n\tif ( _flag != \"\" )\n\t\tid = Arg::flagStartString() + _flag;\n\telse\n\t\tid = Arg::nameStartString() + _name;\n\n\tif ( _valueRequired )\n\t\tid += std::string( 1, Arg::delimiter() ) + \"<\" + valueId  + \">\";\n\n\tif ( !_required )\n\t\tid = \"[\" + id + \"]\";\n\n\treturn id;\n}\n\ninline std::string Arg::longID( const std::string& valueId ) const\n{\n\tstd::string id = \"\";\n\n\tif ( _flag != \"\" )\n\t{\n\t\tid += Arg::flagStartString() + _flag;\n\n\t\tif ( _valueRequired )\n\t\t\tid += std::string( 1, Arg::delimiter() ) + \"<\" + valueId + \">\";\n\n\t\tid += \",  \";\n\t}\n\n\tid += Arg::nameStartString() + _name;\n\n\tif ( _valueRequired )\n\t\tid += std::string( 1, Arg::delimiter() ) + \"<\" + valueId + \">\";\n\n\treturn id;\n\n}\n\ninline bool Arg::operator==(const Arg& a) const\n{\n\tif ( ( _flag != \"\" && _flag == a._flag ) || _name == a._name)\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ninline std::string Arg::getDescription() const\n{\n\tstd::string desc = \"\";\n\tif ( _required )\n\t\tdesc = \"(\" + _requireLabel + \")  \";\n\n//\tif ( _valueRequired )\n//\t\tdesc += \"(value required)  \";\n\n\tdesc += _description;\n\treturn desc;\n}\n\ninline const std::string& Arg::getFlag() const { return _flag; }\n\ninline const std::string& Arg::getName() const { return _name; }\n\ninline bool Arg::isRequired() const { return _required; }\n\ninline bool Arg::isValueRequired() const { return _valueRequired; }\n\ninline bool Arg::isSet() const\n{\n\tif ( _alreadySet && !_xorSet )\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ninline bool Arg::isIgnoreable() const { return _ignoreable; }\n\ninline void Arg::setRequireLabel( const std::string& s)\n{\n\t_requireLabel = s;\n}\n\ninline bool Arg::argMatches( const std::string& argFlag ) const\n{\n\tif ( ( argFlag == Arg::flagStartString() + _flag && _flag != \"\" ) ||\n\t       argFlag == Arg::nameStartString() + _name )\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ninline std::string Arg::toString() const\n{\n\tstd::string s = \"\";\n\n\tif ( _flag != \"\" )\n\t\ts += Arg::flagStartString() + _flag + \" \";\n\n\ts += \"(\" + Arg::nameStartString() + _name + \")\";\n\n\treturn s;\n}\n\ninline void Arg::_checkWithVisitor() const\n{\n\tif ( _visitor != NULL )\n\t\t_visitor->visit();\n}\n\n/**\n * Implementation of trimFlag.\n */\ninline void Arg::trimFlag(std::string& flag, std::string& value) const\n{\n\tint stop = 0;\n\tfor ( int i = 0; static_cast<unsigned int>(i) < flag.length(); i++ )\n\t\tif ( flag[i] == Arg::delimiter() )\n\t\t{\n\t\t\tstop = i;\n\t\t\tbreak;\n\t\t}\n\n\tif ( stop > 1 )\n\t{\n\t\tvalue = flag.substr(stop+1);\n\t\tflag = flag.substr(0,stop);\n\t}\n\n}\n\n/**\n * Implementation of _hasBlanks.\n */\ninline bool Arg::_hasBlanks( const std::string& s ) const\n{\n\tfor ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )\n\t\tif ( s[i] == Arg::blankChar() )\n\t\t\treturn true;\n\n\treturn false;\n}\n\ninline void Arg::forceRequired()\n{\n\t_required = true;\n}\n\ninline void Arg::xorSet()\n{\n\t_alreadySet = true;\n\t_xorSet = true;\n}\n\n/**\n * Overridden by Args that need to added to the end of the list.\n */\ninline void Arg::addToList( std::list<Arg*>& argList ) const\n{\n\targList.push_front( const_cast<Arg*>(this) );\n}\n\ninline bool Arg::allowMore()\n{\n\treturn false;\n}\n\ninline bool Arg::acceptsMultipleValues()\n{\n\treturn _acceptsMultipleValues;\n}\n\ninline void Arg::reset()\n{\n\t_xorSet = false;\n\t_alreadySet = false;\n}\n\n//////////////////////////////////////////////////////////////////////\n//END Arg.cpp\n//////////////////////////////////////////////////////////////////////\n\n} //namespace TCLAP\n\n#endif\n\n"
  },
  {
    "path": "environment/tclap/ArgException.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/****************************************************************************** \n * \n *  file:  ArgException.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_ARG_EXCEPTION_H\n#define TCLAP_ARG_EXCEPTION_H\n\n#include <string>\n#include <exception>\n\nnamespace TCLAP {\n\n/**\n * A simple class that defines and argument exception.  Should be caught\n * whenever a CmdLine is created and parsed.\n */\nclass ArgException : public std::exception\n{\n\tpublic:\n\t\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param text - The text of the exception.\n\t\t * \\param id - The text identifying the argument source.\n\t\t * \\param td - Text describing the type of ArgException it is.\n\t\t * of the exception.\n\t\t */\n\t\tArgException( const std::string& text = \"undefined exception\", \n\t\t\t\t\t  const std::string& id = \"undefined\",\n\t\t\t\t\t  const std::string& td = \"Generic ArgException\")\n\t\t\t: std::exception(), \n\t\t\t  _errorText(text), \n\t\t\t  _argId( id ), \n\t\t\t  _typeDescription(td)\n\t\t{ } \n\t\t\n\t\t/**\n\t\t * Destructor.\n\t\t */\n\t\tvirtual ~ArgException() throw() { }\n\n\t\t/**\n\t\t * Returns the error text.\n\t\t */\n\t\tstd::string error() const { return ( _errorText ); }\n\n\t\t/**\n\t\t * Returns the argument id.\n\t\t */\n\t\tstd::string argId() const  \n\t\t{ \n\t\t\tif ( _argId == \"undefined\" )\n\t\t\t\treturn \" \";\n\t\t\telse\n\t\t\t\treturn ( \"Argument: \" + _argId ); \n\t\t}\n\n\t\t/**\n\t\t * Returns the arg id and error text. \n\t\t */\n\t\tconst char* what() const throw() \n\t\t{\n\t\t\tstatic std::string ex; \n\t\t\tex = _argId + \" -- \" + _errorText;\n\t\t\treturn ex.c_str();\n\t\t}\n\n\t\t/**\n\t\t * Returns the type of the exception.  Used to explain and distinguish\n\t\t * between different child exceptions.\n\t\t */\n\t\tstd::string typeDescription() const\n\t\t{\n\t\t\treturn _typeDescription; \n\t\t}\n\n\n\tprivate:\n\n\t\t/**\n\t\t * The text of the exception message.\n\t\t */\n\t\tstd::string _errorText;\n\n\t\t/**\n\t\t * The argument related to this exception.\n\t\t */\n\t\tstd::string _argId;\n\n\t\t/**\n\t\t * Describes the type of the exception.  Used to distinguish\n\t\t * between different child exceptions.\n\t\t */\n\t\tstd::string _typeDescription;\n\n};\n\n/**\n * Thrown from within the child Arg classes when it fails to properly\n * parse the argument it has been passed.\n */\nclass ArgParseException : public ArgException\n{ \n\tpublic:\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param text - The text of the exception.\n\t\t * \\param id - The text identifying the argument source \n\t\t * of the exception.\n\t\t */\n\t\tArgParseException( const std::string& text = \"undefined exception\", \n\t\t\t\t\t       const std::string& id = \"undefined\" )\n\t\t\t: ArgException( text, \n\t\t\t                id, \n\t\t\t\t\t\t\tstd::string( \"Exception found while parsing \" ) + \n\t\t\t\t\t\t\tstd::string( \"the value the Arg has been passed.\" ))\n\t\t\t{ }\n};\n\n/**\n * Thrown from CmdLine when the arguments on the command line are not\n * properly specified, e.g. too many arguments, required argument missing, etc.\n */\nclass CmdLineParseException : public ArgException\n{\n\tpublic:\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param text - The text of the exception.\n\t\t * \\param id - The text identifying the argument source \n\t\t * of the exception.\n\t\t */\n\t\tCmdLineParseException( const std::string& text = \"undefined exception\", \n\t\t\t\t\t           const std::string& id = \"undefined\" )\n\t\t\t: ArgException( text, \n\t\t\t                id,\n\t\t\t\t\t\t\tstd::string( \"Exception found when the values \") +\n\t\t\t\t\t\t\tstd::string( \"on the command line do not meet \") +\n\t\t\t\t\t\t\tstd::string( \"the requirements of the defined \") +\n\t\t\t\t\t\t\tstd::string( \"Args.\" ))\n\t\t{ }\n};\n\n/**\n * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. \n * same flag as another Arg, same name, etc.\n */\nclass SpecificationException : public ArgException\n{\n\tpublic:\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param text - The text of the exception.\n\t\t * \\param id - The text identifying the argument source \n\t\t * of the exception.\n\t\t */\n\t\tSpecificationException( const std::string& text = \"undefined exception\",\n\t\t\t\t\t            const std::string& id = \"undefined\" )\n\t\t\t: ArgException( text, \n\t\t\t                id,\n\t\t\t\t\t\t\tstd::string(\"Exception found when an Arg object \")+\n\t\t\t\t\t\t\tstd::string(\"is improperly defined by the \") +\n\t\t\t\t\t\t\tstd::string(\"developer.\" )) \n\t\t{ }\n\n};\n\nclass ExitException {\npublic:\n\tExitException(int estat) : _estat(estat) {}\n\n\tint getExitStatus() const { return _estat; }\n\nprivate:\n\tint _estat;\n};\n\n} // namespace TCLAP\n\n#endif\n\n"
  },
  {
    "path": "environment/tclap/ArgTraits.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/******************************************************************************\n *\n *  file:  ArgTraits.h\n *\n *  Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *\n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n *  DEALINGS IN THE SOFTWARE.\n *\n *****************************************************************************/\n\n// This is an internal tclap file, you should probably not have to\n// include this directly\n\n#ifndef TCLAP_ARGTRAITS_H\n#define TCLAP_ARGTRAITS_H\n\nnamespace TCLAP {\n\n// We use two empty structs to get compile type specialization\n// function to work\n\n/**\n * A value like argument value type is a value that can be set using\n * operator>>. This is the default value type.\n */\nstruct ValueLike {\n    typedef ValueLike ValueCategory;\n\tvirtual ~ValueLike() {}\n};\n\n/**\n * A string like argument value type is a value that can be set using\n * operator=(string). Usefull if the value type contains spaces which\n * will be broken up into individual tokens by operator>>.\n */\nstruct StringLike {\n\tvirtual ~StringLike() {}\n};\n\n/**\n * A class can inherit from this object to make it have string like\n * traits. This is a compile time thing and does not add any overhead\n * to the inherenting class.\n */\nstruct StringLikeTrait {\n    typedef StringLike ValueCategory;\n\tvirtual ~StringLikeTrait() {}\n};\n\n/**\n * A class can inherit from this object to make it have value like\n * traits. This is a compile time thing and does not add any overhead\n * to the inherenting class.\n */\nstruct ValueLikeTrait {\n    typedef ValueLike ValueCategory;\n\tvirtual ~ValueLikeTrait() {}\n};\n\n/**\n * Arg traits are used to get compile type specialization when parsing\n * argument values. Using an ArgTraits you can specify the way that\n * values gets assigned to any particular type during parsing. The two\n * supported types are StringLike and ValueLike.\n */\ntemplate<typename T>\nstruct ArgTraits {\n    typedef typename T::ValueCategory ValueCategory;\n\tvirtual ~ArgTraits() {}\n    //typedef ValueLike ValueCategory;\n};\n\n#endif\n\n} // namespace\n"
  },
  {
    "path": "environment/tclap/CmdLine.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/******************************************************************************\n *\n *  file:  CmdLine.h\n *\n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *\n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n *  DEALINGS IN THE SOFTWARE.\n *\n *****************************************************************************/\n\n#ifndef TCLAP_CMDLINE_H\n#define TCLAP_CMDLINE_H\n\n#include <tclap/SwitchArg.h>\n#include <tclap/MultiSwitchArg.h>\n#include <tclap/UnlabeledValueArg.h>\n#include <tclap/UnlabeledMultiArg.h>\n\n#include <tclap/XorHandler.h>\n#include <tclap/HelpVisitor.h>\n#include <tclap/VersionVisitor.h>\n#include <tclap/IgnoreRestVisitor.h>\n\n#include <tclap/CmdLineOutput.h>\n#include <tclap/StdOutput.h>\n\n#include <tclap/Constraint.h>\n#include <tclap/ValuesConstraint.h>\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <iomanip>\n#include <algorithm>\n#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.\n\nnamespace TCLAP {\n\ntemplate<typename T> void DelPtr(T ptr)\n{\n\tdelete ptr;\n}\n\ntemplate<typename C> void ClearContainer(C &c)\n{\n\ttypedef typename C::value_type value_type;\n\tstd::for_each(c.begin(), c.end(), DelPtr<value_type>);\n\tc.clear();\n}\n\n\n/**\n * The base class that manages the command line definition and passes\n * along the parsing to the appropriate Arg classes.\n */\nclass CmdLine : public CmdLineInterface\n{\n\tprotected:\n\n\t\t/**\n\t\t * The list of arguments that will be tested against the\n\t\t * command line.\n\t\t */\n\t\tstd::list<Arg*> _argList;\n\n\t\t/**\n\t\t * The name of the program.  Set to argv[0].\n\t\t */\n\t\tstd::string _progName;\n\n\t\t/**\n\t\t * A message used to describe the program.  Used in the usage output.\n\t\t */\n\t\tstd::string _message;\n\n\t\t/**\n\t\t * The version to be displayed with the --version switch.\n\t\t */\n\t\tstd::string _version;\n\n\t\t/**\n\t\t * The number of arguments that are required to be present on\n\t\t * the command line. This is set dynamically, based on the\n\t\t * Args added to the CmdLine object.\n\t\t */\n\t\tint _numRequired;\n\n\t\t/**\n\t\t * The character that is used to separate the argument flag/name\n\t\t * from the value.  Defaults to ' ' (space).\n\t\t */\n\t\tchar _delimiter;\n\n\t\t/**\n\t\t * The handler that manages xoring lists of args.\n\t\t */\n\t\tXorHandler _xorHandler;\n\n\t\t/**\n\t\t * A list of Args to be explicitly deleted when the destructor\n\t\t * is called.  At the moment, this only includes the three default\n\t\t * Args.\n\t\t */\n\t\tstd::list<Arg*> _argDeleteOnExitList;\n\n\t\t/**\n\t\t * A list of Visitors to be explicitly deleted when the destructor\n\t\t * is called.  At the moment, these are the Vistors created for the\n\t\t * default Args.\n\t\t */\n\t\tstd::list<Visitor*> _visitorDeleteOnExitList;\n\n\t\t/**\n\t\t * Object that handles all output for the CmdLine.\n\t\t */\n\t\tCmdLineOutput* _output;\n\n\t\t/**\n\t\t * Should CmdLine handle parsing exceptions internally?\n\t\t */\n\t\tbool _handleExceptions;\n\n\t\t/**\n\t\t * Throws an exception listing the missing args.\n\t\t */\n\t\tvoid missingArgsException();\n\n\t\t/**\n\t\t * Checks whether a name/flag string matches entirely matches\n\t\t * the Arg::blankChar.  Used when multiple switches are combined\n\t\t * into a single argument.\n\t\t * \\param s - The message to be used in the usage.\n\t\t */\n\t\tbool _emptyCombined(const std::string& s);\n\n\t\t/**\n\t\t * Perform a delete ptr; operation on ptr when this object is deleted.\n\t\t */\n\t\tvoid deleteOnExit(Arg* ptr);\n\n\t\t/**\n\t\t * Perform a delete ptr; operation on ptr when this object is deleted.\n\t\t */\n\t\tvoid deleteOnExit(Visitor* ptr);\n\nprivate:\n\n\t\t/**\n\t\t * Prevent accidental copying.\n\t\t */\n\t\tCmdLine(const CmdLine& rhs);\n\t\tCmdLine& operator=(const CmdLine& rhs);\n\n\t\t/**\n\t\t * Encapsulates the code common to the constructors\n\t\t * (which is all of it).\n\t\t */\n\t\tvoid _constructor();\n\n\n\t\t/**\n\t\t * Is set to true when a user sets the output object. We use this so\n\t\t * that we don't delete objects that are created outside of this lib.\n\t\t */\n\t\tbool _userSetOutput;\n\n\t\t/**\n\t\t * Whether or not to automatically create help and version switches.\n\t\t */\n\t\tbool _helpAndVersion;\n\n\tpublic:\n\n\t\t/**\n\t\t * Command line constructor. Defines how the arguments will be\n\t\t * parsed.\n\t\t * \\param message - The message to be used in the usage\n\t\t * output.\n\t\t * \\param delimiter - The character that is used to separate\n\t\t * the argument flag/name from the value.  Defaults to ' ' (space).\n\t\t * \\param version - The version number to be used in the\n\t\t * --version switch.\n\t\t * \\param helpAndVersion - Whether or not to create the Help and\n\t\t * Version switches. Defaults to true.\n\t\t */\n\t\tCmdLine(const std::string& message,\n\t\t\t\tconst char delimiter = ' ',\n\t\t\t\tconst std::string& version = \"none\",\n\t\t\t\tbool helpAndVersion = true);\n\n\t\t/**\n\t\t * Deletes any resources allocated by a CmdLine object.\n\t\t */\n\t\tvirtual ~CmdLine();\n\n\t\t/**\n\t\t * Adds an argument to the list of arguments to be parsed.\n\t\t * \\param a - Argument to be added.\n\t\t */\n\t\tvoid add( Arg& a );\n\n\t\t/**\n\t\t * An alternative add.  Functionally identical.\n\t\t * \\param a - Argument to be added.\n\t\t */\n\t\tvoid add( Arg* a );\n\n\t\t/**\n\t\t * Add two Args that will be xor'd.  If this method is used, add does\n\t\t * not need to be called.\n\t\t * \\param a - Argument to be added and xor'd.\n\t\t * \\param b - Argument to be added and xor'd.\n\t\t */\n\t\tvoid xorAdd( Arg& a, Arg& b );\n\n\t\t/**\n\t\t * Add a list of Args that will be xor'd.  If this method is used,\n\t\t * add does not need to be called.\n\t\t * \\param xors - List of Args to be added and xor'd.\n\t\t */\n\t\tvoid xorAdd( std::vector<Arg*>& xors );\n\n\t\t/**\n\t\t * Parses the command line.\n\t\t * \\param argc - Number of arguments.\n\t\t * \\param argv - Array of arguments.\n\t\t */\n\t\tvoid parse(int argc, const char * const * argv);\n\n\t\t/**\n\t\t * Parses the command line.\n\t\t * \\param args - A vector of strings representing the args.\n\t\t * args[0] is still the program name.\n\t\t */\n\t\tvoid parse(std::vector<std::string>& args);\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tCmdLineOutput* getOutput();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tvoid setOutput(CmdLineOutput* co);\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tstd::string& getVersion();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tstd::string& getProgramName();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tstd::list<Arg*>& getArgList();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tXorHandler& getXorHandler();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tchar getDelimiter();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tstd::string& getMessage();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\tbool hasHelpAndVersion();\n\n\t\t/**\n\t\t * Disables or enables CmdLine's internal parsing exception handling.\n\t\t *\n\t\t * @param state Should CmdLine handle parsing exceptions internally?\n\t\t */\n\t\tvoid setExceptionHandling(const bool state);\n\n\t\t/**\n\t\t * Returns the current state of the internal exception handling.\n\t\t *\n\t\t * @retval true Parsing exceptions are handled internally.\n\t\t * @retval false Parsing exceptions are propagated to the caller.\n\t\t */\n\t\tbool getExceptionHandling() const;\n\n\t\t/**\n\t\t * Allows the CmdLine object to be reused.\n\t\t */\n\t\tvoid reset();\n\n};\n\n\n///////////////////////////////////////////////////////////////////////////////\n//Begin CmdLine.cpp\n///////////////////////////////////////////////////////////////////////////////\n\ninline CmdLine::CmdLine(const std::string& m,\n                        char delim,\n                        const std::string& v,\n                        bool help )\n    :\n  _argList(std::list<Arg*>()),\n  _progName(\"not_set_yet\"),\n  _message(m),\n  _version(v),\n  _numRequired(0),\n  _delimiter(delim),\n  _xorHandler(XorHandler()),\n  _argDeleteOnExitList(std::list<Arg*>()),\n  _visitorDeleteOnExitList(std::list<Visitor*>()),\n  _output(0),\n  _handleExceptions(true),\n  _userSetOutput(false),\n  _helpAndVersion(help)\n{\n\t_constructor();\n}\n\ninline CmdLine::~CmdLine()\n{\n\tClearContainer(_argDeleteOnExitList);\n\tClearContainer(_visitorDeleteOnExitList);\n\n\tif ( !_userSetOutput ) {\n\t\tdelete _output;\n\t\t_output = 0;\n\t}\n}\n\ninline void CmdLine::_constructor()\n{\n\t_output = new StdOutput;\n\n\tArg::setDelimiter( _delimiter );\n\n\tVisitor* v;\n\n\tif ( _helpAndVersion )\n\t{\n\t\tv = new HelpVisitor( this, &_output );\n\t\tSwitchArg* help = new SwitchArg(\"h\",\"help\",\n\t\t                      \"Displays usage information and exits.\",\n\t\t                      false, v);\n\t\tadd( help );\n\t\tdeleteOnExit(help);\n\t\tdeleteOnExit(v);\n\n\t\tv = new VersionVisitor( this, &_output );\n\t\tSwitchArg* vers = new SwitchArg(\"\",\"version\",\n\t\t                      \"Displays version information and exits.\",\n\t\t                      false, v);\n\t\tadd( vers );\n\t\tdeleteOnExit(vers);\n\t\tdeleteOnExit(v);\n\t}\n\n\tv = new IgnoreRestVisitor();\n\tSwitchArg* ignore  = new SwitchArg(Arg::flagStartString(),\n\t          Arg::ignoreNameString(),\n\t          \"Ignores the rest of the labeled arguments following this flag.\",\n\t          false, v);\n\tadd( ignore );\n\tdeleteOnExit(ignore);\n\tdeleteOnExit(v);\n}\n\ninline void CmdLine::xorAdd( std::vector<Arg*>& ors )\n{\n\t_xorHandler.add( ors );\n\n\tfor (ArgVectorIterator it = ors.begin(); it != ors.end(); it++)\n\t{\n\t\t(*it)->forceRequired();\n\t\t(*it)->setRequireLabel( \"OR required\" );\n\t\tadd( *it );\n\t}\n}\n\ninline void CmdLine::xorAdd( Arg& a, Arg& b )\n{\n\tstd::vector<Arg*> ors;\n\tors.push_back( &a );\n\tors.push_back( &b );\n\txorAdd( ors );\n}\n\ninline void CmdLine::add( Arg& a )\n{\n\tadd( &a );\n}\n\ninline void CmdLine::add( Arg* a )\n{\n\tfor( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )\n\t\tif ( *a == *(*it) )\n\t\t\tthrow( SpecificationException(\n\t\t\t        \"Argument with same flag/name already exists!\",\n\t\t\t        a->longID() ) );\n\n\ta->addToList( _argList );\n\n\tif ( a->isRequired() )\n\t\t_numRequired++;\n}\n\n\ninline void CmdLine::parse(int argc, const char * const * argv)\n{\n\t\t// this step is necessary so that we have easy access to\n\t\t// mutable strings.\n\t\tstd::vector<std::string> args;\n\t\tfor (int i = 0; i < argc; i++)\n\t\t\targs.push_back(argv[i]);\n\n\t\tparse(args);\n}\n\ninline void CmdLine::parse(std::vector<std::string>& args)\n{\n\tbool shouldExit = false;\n\tint estat = 0;\n\n\ttry {\n\t\t_progName = args.front();\n\t\targs.erase(args.begin());\n\n\t\tint requiredCount = 0;\n\n\t\tfor (int i = 0; static_cast<unsigned int>(i) < args.size(); i++) \n\t\t{\n\t\t\tbool matched = false;\n\t\t\tfor (ArgListIterator it = _argList.begin();\n\t\t\t     it != _argList.end(); it++) {\n\t\t\t\tif ( (*it)->processArg( &i, args ) )\n\t\t\t\t{\n\t\t\t\t\trequiredCount += _xorHandler.check( *it );\n\t\t\t\t\tmatched = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// checks to see if the argument is an empty combined\n\t\t\t// switch and if so, then we've actually matched it\n\t\t\tif ( !matched && _emptyCombined( args[i] ) )\n\t\t\t\tmatched = true;\n\n\t\t\tif ( !matched && !Arg::ignoreRest() )\n\t\t\t\tthrow(CmdLineParseException(\"Couldn't find match \"\n\t\t\t\t                            \"for argument\",\n\t\t\t\t                            args[i]));\n\t\t}\n\n\t\tif ( requiredCount < _numRequired )\n\t\t\tmissingArgsException();\n\n\t\tif ( requiredCount > _numRequired )\n\t\t\tthrow(CmdLineParseException(\"Too many arguments!\"));\n\n\t} catch ( ArgException& e ) {\n\t\t// If we're not handling the exceptions, rethrow.\n\t\tif ( !_handleExceptions) {\n\t\t\tthrow;\n\t\t}\n\n\t\ttry {\n\t\t\t_output->failure(*this,e);\n\t\t} catch ( ExitException &ee ) {\n\t\t\testat = ee.getExitStatus();\n\t\t\tshouldExit = true;\n\t\t}\n\t} catch (ExitException &ee) {\n\t\t// If we're not handling the exceptions, rethrow.\n\t\tif ( !_handleExceptions) {\n\t\t\tthrow;\n\t\t}\n\n\t\testat = ee.getExitStatus();\n\t\tshouldExit = true;\n\t}\n\n\tif (shouldExit)\n\t\texit(estat);\n}\n\ninline bool CmdLine::_emptyCombined(const std::string& s)\n{\n\tif ( s.length() > 0 && s[0] != Arg::flagStartChar() )\n\t\treturn false;\n\n\tfor ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )\n\t\tif ( s[i] != Arg::blankChar() )\n\t\t\treturn false;\n\n\treturn true;\n}\n\ninline void CmdLine::missingArgsException()\n{\n\t\tint count = 0;\n\n\t\tstd::string missingArgList;\n\t\tfor (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)\n\t\t{\n\t\t\tif ( (*it)->isRequired() && !(*it)->isSet() )\n\t\t\t{\n\t\t\t\tmissingArgList += (*it)->getName();\n\t\t\t\tmissingArgList += \", \";\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tmissingArgList = missingArgList.substr(0,missingArgList.length()-2);\n\n\t\tstd::string msg;\n\t\tif ( count > 1 )\n\t\t\tmsg = \"Required arguments missing: \";\n\t\telse\n\t\t\tmsg = \"Required argument missing: \";\n\n\t\tmsg += missingArgList;\n\n\t\tthrow(CmdLineParseException(msg));\n}\n\ninline void CmdLine::deleteOnExit(Arg* ptr)\n{\n\t_argDeleteOnExitList.push_back(ptr);\n}\n\ninline void CmdLine::deleteOnExit(Visitor* ptr)\n{\n\t_visitorDeleteOnExitList.push_back(ptr);\n}\n\ninline CmdLineOutput* CmdLine::getOutput()\n{\n\treturn _output;\n}\n\ninline void CmdLine::setOutput(CmdLineOutput* co)\n{\n\tif ( !_userSetOutput )\n\t\tdelete _output;\n\t_userSetOutput = true;\n\t_output = co;\n}\n\ninline std::string& CmdLine::getVersion()\n{\n\treturn _version;\n}\n\ninline std::string& CmdLine::getProgramName()\n{\n\treturn _progName;\n}\n\ninline std::list<Arg*>& CmdLine::getArgList()\n{\n\treturn _argList;\n}\n\ninline XorHandler& CmdLine::getXorHandler()\n{\n\treturn _xorHandler;\n}\n\ninline char CmdLine::getDelimiter()\n{\n\treturn _delimiter;\n}\n\ninline std::string& CmdLine::getMessage()\n{\n\treturn _message;\n}\n\ninline bool CmdLine::hasHelpAndVersion()\n{\n\treturn _helpAndVersion;\n}\n\ninline void CmdLine::setExceptionHandling(const bool state)\n{\n\t_handleExceptions = state;\n}\n\ninline bool CmdLine::getExceptionHandling() const\n{\n\treturn _handleExceptions;\n}\n\ninline void CmdLine::reset()\n{\n\tfor( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )\n\t\t(*it)->reset();\n\t\n\t_progName.clear();\n}\n\n///////////////////////////////////////////////////////////////////////////////\n//End CmdLine.cpp\n///////////////////////////////////////////////////////////////////////////////\n\n\n\n} //namespace TCLAP\n#endif\n"
  },
  {
    "path": "environment/tclap/CmdLineInterface.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  CmdLineInterface.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_COMMANDLINE_INTERFACE_H\n#define TCLAP_COMMANDLINE_INTERFACE_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <algorithm>\n\n\nnamespace TCLAP {\n     \nclass Arg;\nclass CmdLineOutput;\nclass XorHandler;\n\n/**\n * The base class that manages the command line definition and passes\n * along the parsing to the appropriate Arg classes.\n */\nclass CmdLineInterface\n{\n\tpublic:\n\n\t\t/**\n\t\t * Destructor\n\t\t */\n\t\tvirtual ~CmdLineInterface() {}\n\n\t\t/**\n\t\t * Adds an argument to the list of arguments to be parsed.\n\t\t * \\param a - Argument to be added. \n\t\t */\n\t\tvirtual void add( Arg& a )=0;\n\n\t\t/**\n\t\t * An alternative add.  Functionally identical.\n\t\t * \\param a - Argument to be added. \n\t\t */\n\t\tvirtual void add( Arg* a )=0;\n\n\t\t/**\n\t\t * Add two Args that will be xor'd.  \n\t\t * If this method is used, add does\n\t\t * not need to be called.\n\t\t * \\param a - Argument to be added and xor'd. \n\t\t * \\param b - Argument to be added and xor'd. \n\t\t */\n\t\tvirtual void xorAdd( Arg& a, Arg& b )=0;\n\n\t\t/**\n\t\t * Add a list of Args that will be xor'd.  If this method is used, \n\t\t * add does not need to be called.\n\t\t * \\param xors - List of Args to be added and xor'd. \n\t\t */\n\t\tvirtual void xorAdd( std::vector<Arg*>& xors )=0;\n\n\t\t/**\n\t\t * Parses the command line.\n\t\t * \\param argc - Number of arguments.\n\t\t * \\param argv - Array of arguments.\n\t\t */\n\t\tvirtual void parse(int argc, const char * const * argv)=0;\n\n        /**\n         * Parses the command line.\n         * \\param args - A vector of strings representing the args. \n         * args[0] is still the program name.\n         */\n        void parse(std::vector<std::string>& args);\n\n\t\t/**\n\t\t * Returns the CmdLineOutput object.\n\t\t */\n\t\tvirtual CmdLineOutput* getOutput()=0;\n\n\t\t/**\n\t\t * \\param co - CmdLineOutput object that we want to use instead. \n\t\t */\n\t\tvirtual void setOutput(CmdLineOutput* co)=0;\n\n\t\t/**\n\t\t * Returns the version string.\n\t\t */\n\t\tvirtual std::string& getVersion()=0;\n\n\t\t/**\n\t\t * Returns the program name string.\n\t\t */\n\t\tvirtual std::string& getProgramName()=0;\n\n\t\t/**\n\t\t * Returns the argList. \n\t\t */\n\t\tvirtual std::list<Arg*>& getArgList()=0;\n\n\t\t/**\n\t\t * Returns the XorHandler. \n\t\t */\n\t\tvirtual XorHandler& getXorHandler()=0;\n\n\t\t/**\n\t\t * Returns the delimiter string.\n\t\t */\n\t\tvirtual char getDelimiter()=0;\n\n\t\t/**\n\t\t * Returns the message string.\n\t\t */\n\t\tvirtual std::string& getMessage()=0;\n\n\t\t/**\n\t\t * Indicates whether or not the help and version switches were created\n\t\t * automatically.\n\t\t */\n\t\tvirtual bool hasHelpAndVersion()=0;\n\n\t\t/** \n\t\t * Resets the instance as if it had just been constructed so that the\n\t\t * instance can be reused. \n\t\t */\n\t\tvirtual void reset()=0;\n};\n\n} //namespace\n\n\n#endif \n"
  },
  {
    "path": "environment/tclap/CmdLineOutput.h",
    "content": "\n\n/****************************************************************************** \n * \n *  file:  CmdLineOutput.h\n * \n *  Copyright (c) 2004, Michael E. Smoot\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_CMDLINEOUTPUT_H\n#define TCLAP_CMDLINEOUTPUT_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <iomanip>\n#include <algorithm>\n\nnamespace TCLAP {\n\nclass CmdLineInterface;\nclass ArgException;\n\n/**\n * The interface that any output object must implement.\n */\nclass CmdLineOutput \n{\n\n\tpublic:\n\n\t\t/**\n\t\t * Virtual destructor.\n\t\t */\n\t\tvirtual ~CmdLineOutput() {}\n\n\t\t/**\n\t\t * Generates some sort of output for the USAGE. \n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void usage(CmdLineInterface& c)=0;\n\n\t\t/**\n\t\t * Generates some sort of output for the version. \n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void version(CmdLineInterface& c)=0;\n\n\t\t/**\n\t\t * Generates some sort of output for a failure. \n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t * \\param e - The ArgException that caused the failure. \n\t\t */\n\t\tvirtual void failure( CmdLineInterface& c, \n\t\t\t\t\t\t      ArgException& e )=0;\n\n};\n\n} //namespace TCLAP\n#endif \n"
  },
  {
    "path": "environment/tclap/Constraint.h",
    "content": "\n/******************************************************************************\n *\n *  file:  Constraint.h\n *\n *  Copyright (c) 2005, Michael E. Smoot\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *\n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n *  DEALINGS IN THE SOFTWARE.\n *\n *****************************************************************************/\n\n#ifndef TCLAP_CONSTRAINT_H\n#define TCLAP_CONSTRAINT_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <iomanip>\n#include <algorithm>\n\nnamespace TCLAP {\n\n/**\n * The interface that defines the interaction between the Arg and Constraint.\n */\ntemplate<class T>\nclass Constraint\n{\n\n\tpublic:\n\t\t/**\n\t\t * Returns a description of the Constraint.\n\t\t */\n\t\tvirtual std::string description() const =0;\n\n\t\t/**\n\t\t * Returns the short ID for the Constraint.\n\t\t */\n\t\tvirtual std::string shortID() const =0;\n\n\t\t/**\n\t\t * The method used to verify that the value parsed from the command\n\t\t * line meets the constraint.\n\t\t * \\param value - The value that will be checked.\n\t\t */\n\t\tvirtual bool check(const T& value) const =0;\n\n\t\t/**\n\t\t * Destructor.\n\t\t * Silences warnings about Constraint being a base class with virtual\n\t\t * functions but without a virtual destructor.\n\t\t */\n\t\tvirtual ~Constraint() { ; }\n};\n\n} //namespace TCLAP\n#endif\n"
  },
  {
    "path": "environment/tclap/DocBookOutput.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/****************************************************************************** \n * \n *  file:  DocBookOutput.h\n * \n *  Copyright (c) 2004, Michael E. Smoot\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_DOCBOOKOUTPUT_H\n#define TCLAP_DOCBOOKOUTPUT_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <algorithm>\n\n#include <tclap/CmdLineInterface.h>\n#include <tclap/CmdLineOutput.h>\n#include <tclap/XorHandler.h>\n#include <tclap/Arg.h>\n\nnamespace TCLAP {\n\n/**\n * A class that generates DocBook output for usage() method for the \n * given CmdLine and its Args.\n */\nclass DocBookOutput : public CmdLineOutput\n{\n\n\tpublic:\n\n\t\t/**\n\t\t * Prints the usage to stdout.  Can be overridden to \n\t\t * produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void usage(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints the version to stdout. Can be overridden \n\t\t * to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void version(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints (to stderr) an error message, short usage \n\t\t * Can be overridden to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t * \\param e - The ArgException that caused the failure. \n\t\t */\n\t\tvirtual void failure(CmdLineInterface& c, \n\t\t\t\t\t\t     ArgException& e );\n\n\tprotected:\n\n\t\t/**\n\t\t * Substitutes the char r for string x in string s.\n\t\t * \\param s - The string to operate on. \n\t\t * \\param r - The char to replace. \n\t\t * \\param x - What to replace r with. \n\t\t */\n\t\tvoid substituteSpecialChars( std::string& s, char r, std::string& x );\n\t\tvoid removeChar( std::string& s, char r);\n\t\tvoid basename( std::string& s );\n\n\t\tvoid printShortArg(Arg* it);\n\t\tvoid printLongArg(Arg* it);\n\n\t\tchar theDelimiter;\n};\n\n\ninline void DocBookOutput::version(CmdLineInterface& _cmd) \n{ \n\tstd::cout << _cmd.getVersion() << std::endl;\n}\n\ninline void DocBookOutput::usage(CmdLineInterface& _cmd ) \n{\n\tstd::list<Arg*> argList = _cmd.getArgList();\n\tstd::string progName = _cmd.getProgramName();\n\tstd::string xversion = _cmd.getVersion();\n\ttheDelimiter = _cmd.getDelimiter();\n\tXorHandler xorHandler = _cmd.getXorHandler();\n\tstd::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();\n\tbasename(progName);\n\n\tstd::cout << \"<?xml version='1.0'?>\" << std::endl;\n\tstd::cout << \"<!DOCTYPE refentry PUBLIC \\\"-//OASIS//DTD DocBook XML V4.2//EN\\\"\" << std::endl;\n\tstd::cout << \"\\t\\\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\\\">\" << std::endl << std::endl;\n\n\tstd::cout << \"<refentry>\" << std::endl;\n\n\tstd::cout << \"<refmeta>\" << std::endl;\n\tstd::cout << \"<refentrytitle>\" << progName << \"</refentrytitle>\" << std::endl;\n\tstd::cout << \"<manvolnum>1</manvolnum>\" << std::endl;\n\tstd::cout << \"</refmeta>\" << std::endl;\n\n\tstd::cout << \"<refnamediv>\" << std::endl;\n\tstd::cout << \"<refname>\" << progName << \"</refname>\" << std::endl;\n\tstd::cout << \"<refpurpose>\" << _cmd.getMessage() << \"</refpurpose>\" << std::endl;\n\tstd::cout << \"</refnamediv>\" << std::endl;\n\n\tstd::cout << \"<refsynopsisdiv>\" << std::endl;\n\tstd::cout << \"<cmdsynopsis>\" << std::endl;\n\n\tstd::cout << \"<command>\" << progName << \"</command>\" << std::endl;\n\n\t// xor\n\tfor ( int i = 0; (unsigned int)i < xorList.size(); i++ )\n\t{\n\t\tstd::cout << \"<group choice='req'>\" << std::endl;\n\t\tfor ( ArgVectorIterator it = xorList[i].begin(); \n\t\t\t\t\t\tit != xorList[i].end(); it++ )\n\t\t\tprintShortArg((*it));\n\n\t\tstd::cout << \"</group>\" << std::endl;\n\t}\n\t\n\t// rest of args\n\tfor (ArgListIterator it = argList.begin(); it != argList.end(); it++)\n\t\tif ( !xorHandler.contains( (*it) ) )\n\t\t\tprintShortArg((*it));\n\n \tstd::cout << \"</cmdsynopsis>\" << std::endl;\n\tstd::cout << \"</refsynopsisdiv>\" << std::endl;\n\n\tstd::cout << \"<refsect1>\" << std::endl;\n\tstd::cout << \"<title>Description</title>\" << std::endl;\n\tstd::cout << \"<para>\" << std::endl;\n\tstd::cout << _cmd.getMessage() << std::endl; \n\tstd::cout << \"</para>\" << std::endl;\n\tstd::cout << \"</refsect1>\" << std::endl;\n\n\tstd::cout << \"<refsect1>\" << std::endl;\n\tstd::cout << \"<title>Options</title>\" << std::endl;\n\n\tstd::cout << \"<variablelist>\" << std::endl;\n\t\n\tfor (ArgListIterator it = argList.begin(); it != argList.end(); it++)\n\t\tprintLongArg((*it));\n\n\tstd::cout << \"</variablelist>\" << std::endl;\n\tstd::cout << \"</refsect1>\" << std::endl;\n\n\tstd::cout << \"<refsect1>\" << std::endl;\n\tstd::cout << \"<title>Version</title>\" << std::endl;\n\tstd::cout << \"<para>\" << std::endl;\n\tstd::cout << xversion << std::endl; \n\tstd::cout << \"</para>\" << std::endl;\n\tstd::cout << \"</refsect1>\" << std::endl;\n\t\n\tstd::cout << \"</refentry>\" << std::endl;\n\n}\n\ninline void DocBookOutput::failure( CmdLineInterface& _cmd,\n\t\t\t\t    ArgException& e ) \n{ \n\tstatic_cast<void>(_cmd); // unused\n\tstd::cout << e.what() << std::endl;\n\tthrow ExitException(1);\n}\n\ninline void DocBookOutput::substituteSpecialChars( std::string& s,\n\t\t\t\t                                   char r,\n\t\t\t\t\t\t\t\t\t\t\t\t   std::string& x )\n{\n\tsize_t p;\n\twhile ( (p = s.find_first_of(r)) != std::string::npos )\n\t{\n\t\ts.erase(p,1);\n\t\ts.insert(p,x);\n\t}\n}\n\ninline void DocBookOutput::removeChar( std::string& s, char r)\n{\n\tsize_t p;\n\twhile ( (p = s.find_first_of(r)) != std::string::npos )\n\t{\n\t\ts.erase(p,1);\n\t}\n}\n\ninline void DocBookOutput::basename( std::string& s )\n{\n\tsize_t p = s.find_last_of('/');\n\tif ( p != std::string::npos )\n\t{\n\t\ts.erase(0, p + 1);\n\t}\n}\n\ninline void DocBookOutput::printShortArg(Arg* a)\n{\n\tstd::string lt = \"&lt;\"; \n\tstd::string gt = \"&gt;\"; \n\n\tstd::string id = a->shortID();\n\tsubstituteSpecialChars(id,'<',lt);\n\tsubstituteSpecialChars(id,'>',gt);\n\tremoveChar(id,'[');\n\tremoveChar(id,']');\n\t\n\tstd::string choice = \"opt\";\n\tif ( a->isRequired() )\n\t\tchoice = \"plain\";\n\n\tstd::cout << \"<arg choice='\" << choice << '\\'';\n\tif ( a->acceptsMultipleValues() )\n\t\tstd::cout << \" rep='repeat'\";\n\n\n\tstd::cout << '>';\n\tif ( !a->getFlag().empty() )\n\t\tstd::cout << a->flagStartChar() << a->getFlag();\n\telse\n\t\tstd::cout << a->nameStartString() << a->getName();\n\tif ( a->isValueRequired() )\n\t{\n\t\tstd::string arg = a->shortID();\n\t\tremoveChar(arg,'[');\n\t\tremoveChar(arg,']');\n\t\tremoveChar(arg,'<');\n\t\tremoveChar(arg,'>');\n\t\targ.erase(0, arg.find_last_of(theDelimiter) + 1);\n\t\tstd::cout << theDelimiter;\n\t\tstd::cout << \"<replaceable>\" << arg << \"</replaceable>\";\n\t}\n\tstd::cout << \"</arg>\" << std::endl;\n\n}\n\ninline void DocBookOutput::printLongArg(Arg* a)\n{\n\tstd::string lt = \"&lt;\"; \n\tstd::string gt = \"&gt;\"; \n\n\tstd::string desc = a->getDescription();\n\tsubstituteSpecialChars(desc,'<',lt);\n\tsubstituteSpecialChars(desc,'>',gt);\n\n\tstd::cout << \"<varlistentry>\" << std::endl;\n\n\tif ( !a->getFlag().empty() )\n\t{\n\t\tstd::cout << \"<term>\" << std::endl;\n\t\tstd::cout << \"<option>\";\n\t\tstd::cout << a->flagStartChar() << a->getFlag();\n\t\tstd::cout << \"</option>\" << std::endl;\n\t\tstd::cout << \"</term>\" << std::endl;\n\t}\n\n\tstd::cout << \"<term>\" << std::endl;\n\tstd::cout << \"<option>\";\n\tstd::cout << a->nameStartString() << a->getName();\n\tif ( a->isValueRequired() )\n\t{\n\t\tstd::string arg = a->shortID();\n\t\tremoveChar(arg,'[');\n\t\tremoveChar(arg,']');\n\t\tremoveChar(arg,'<');\n\t\tremoveChar(arg,'>');\n\t\targ.erase(0, arg.find_last_of(theDelimiter) + 1);\n\t\tstd::cout << theDelimiter;\n\t\tstd::cout << \"<replaceable>\" << arg << \"</replaceable>\";\n\t}\n\tstd::cout << \"</option>\" << std::endl;\n\tstd::cout << \"</term>\" << std::endl;\n\n\tstd::cout << \"<listitem>\" << std::endl;\n\tstd::cout << \"<para>\" << std::endl;\n\tstd::cout << desc << std::endl;\n\tstd::cout << \"</para>\" << std::endl;\n\tstd::cout << \"</listitem>\" << std::endl;\n\n\tstd::cout << \"</varlistentry>\" << std::endl;\n}\n\n} //namespace TCLAP\n#endif \n"
  },
  {
    "path": "environment/tclap/HelpVisitor.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  HelpVisitor.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_HELP_VISITOR_H\n#define TCLAP_HELP_VISITOR_H\n\n#include <tclap/CmdLineInterface.h>\n#include <tclap/CmdLineOutput.h>\n#include <tclap/Visitor.h>\n\nnamespace TCLAP {\n\n/**\n * A Visitor object that calls the usage method of the given CmdLineOutput\n * object for the specified CmdLine object.\n */\nclass HelpVisitor: public Visitor\n{\n\tprivate:\n\t\t/**\n\t\t * Prevent accidental copying.\n\t\t */\n\t\tHelpVisitor(const HelpVisitor& rhs);\n\t\tHelpVisitor& operator=(const HelpVisitor& rhs);\n\n\tprotected:\n\n\t\t/**\n\t\t * The CmdLine the output will be generated for. \n\t\t */\n\t\tCmdLineInterface* _cmd;\n\n\t\t/**\n\t\t * The output object. \n\t\t */\n\t\tCmdLineOutput** _out;\n\n\tpublic:\n\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param cmd - The CmdLine the output will be generated for.\n\t\t * \\param out - The type of output. \n\t\t */\n\t\tHelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) \n\t\t\t\t: Visitor(), _cmd( cmd ), _out( out ) { }\n\n\t\t/**\n\t\t * Calls the usage method of the CmdLineOutput for the \n\t\t * specified CmdLine.\n\t\t */\n\t\tvoid visit() { (*_out)->usage(*_cmd); throw ExitException(0); }\n\t\t\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "environment/tclap/IgnoreRestVisitor.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  IgnoreRestVisitor.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_IGNORE_REST_VISITOR_H\n#define TCLAP_IGNORE_REST_VISITOR_H\n\n#include <tclap/Visitor.h>\n#include <tclap/Arg.h>\n\nnamespace TCLAP {\n\n/**\n * A Vistor that tells the CmdLine to begin ignoring arguments after\n * this one is parsed.\n */\nclass IgnoreRestVisitor: public Visitor\n{\n\tpublic:\n\n\t\t/**\n\t\t * Constructor.\n\t\t */\n\t\tIgnoreRestVisitor() : Visitor() {}\n\n\t\t/**\n\t\t * Sets Arg::_ignoreRest.\n\t\t */\n\t\tvoid visit() { Arg::beginIgnoring();  }\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "environment/tclap/Makefile.am",
    "content": "\nlibtclapincludedir = $(includedir)/tclap\n\nlibtclapinclude_HEADERS = \\\n\t\t\t CmdLineInterface.h \\\n\t\t\t ArgException.h \\\n\t\t\t CmdLine.h \\\n\t\t\t XorHandler.h \\\n\t\t\t MultiArg.h \\\n\t\t\t UnlabeledMultiArg.h \\\n\t\t\t ValueArg.h \\\n\t\t\t UnlabeledValueArg.h \\\n\t\t\t Visitor.h Arg.h \\\n\t\t\t HelpVisitor.h \\\n\t\t\t SwitchArg.h \\\n\t\t\t MultiSwitchArg.h \\\n\t\t\t VersionVisitor.h \\\n\t\t\t IgnoreRestVisitor.h \\\n\t\t\t CmdLineOutput.h \\\n\t\t\t StdOutput.h \\\n\t\t\t DocBookOutput.h \\\n\t\t\t ZshCompletionOutput.h \\\n\t\t\t OptionalUnlabeledTracker.h \\\n\t\t\t Constraint.h \\\n\t\t\t ValuesConstraint.h \\\n\t\t\t ArgTraits.h \\\n\t\t\t StandardTraits.h\n\n"
  },
  {
    "path": "environment/tclap/Makefile.in",
    "content": "# Makefile.in generated by automake 1.10 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nsubdir = include/tclap\nDIST_COMMON = $(libtclapinclude_HEADERS) $(srcdir)/Makefile.am \\\n\t$(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \\\n\t$(top_srcdir)/config/ac_cxx_have_sstream.m4 \\\n\t$(top_srcdir)/config/ac_cxx_have_strstream.m4 \\\n\t$(top_srcdir)/config/ac_cxx_namespaces.m4 \\\n\t$(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \\\n\t$(top_srcdir)/config/bb_enable_doxygen.m4 \\\n\t$(top_srcdir)/configure.in\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/config/config.h\nCONFIG_CLEAN_FILES =\nSOURCES =\nDIST_SOURCES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = `echo $$p | sed -e 's|^.*/||'`;\nam__installdirs = \"$(DESTDIR)$(libtclapincludedir)\"\nlibtclapincludeHEADERS_INSTALL = $(INSTALL_HEADER)\nHEADERS = $(libtclapinclude_HEADERS)\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDOT = @DOT@\nDOXYGEN = @DOXYGEN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLDFLAGS = @LDFLAGS@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLTLIBOBJS = @LTLIBOBJS@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nOBJEXT = @OBJEXT@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nRANLIB = @RANLIB@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nWARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@\nWARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CXX = @ac_ct_CXX@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild_alias = @build_alias@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost_alias = @host_alias@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget_alias = @target_alias@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nlibtclapincludedir = $(includedir)/tclap\nlibtclapinclude_HEADERS = \\\n\t\t\t CmdLineInterface.h \\\n\t\t\t ArgException.h \\\n\t\t\t CmdLine.h \\\n\t\t\t XorHandler.h \\\n\t\t\t MultiArg.h \\\n\t\t\t UnlabeledMultiArg.h \\\n\t\t\t ValueArg.h \\\n\t\t\t UnlabeledValueArg.h \\\n\t\t\t Visitor.h Arg.h \\\n\t\t\t HelpVisitor.h \\\n\t\t\t SwitchArg.h \\\n\t\t\t MultiSwitchArg.h \\\n\t\t\t VersionVisitor.h \\\n\t\t\t IgnoreRestVisitor.h \\\n\t\t\t CmdLineOutput.h \\\n\t\t\t StdOutput.h \\\n\t\t\t DocBookOutput.h \\\n\t\t\t ZshCompletionOutput.h \\\n\t\t\t OptionalUnlabeledTracker.h \\\n\t\t\t Constraint.h \\\n\t\t\t ValuesConstraint.h \\\n\t\t\t ArgTraits.h \\\n\t\t\t StandardTraits.h\n\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \\\n\t\t&& exit 0; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/tclap/Makefile'; \\\n\tcd $(top_srcdir) && \\\n\t  $(AUTOMAKE) --gnu  include/tclap/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure:  $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4):  $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\ninstall-libtclapincludeHEADERS: $(libtclapinclude_HEADERS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(libtclapincludedir)\" || $(MKDIR_P) \"$(DESTDIR)$(libtclapincludedir)\"\n\t@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  f=$(am__strip_dir) \\\n\t  echo \" $(libtclapincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtclapincludedir)/$$f'\"; \\\n\t  $(libtclapincludeHEADERS_INSTALL) \"$$d$$p\" \"$(DESTDIR)$(libtclapincludedir)/$$f\"; \\\n\tdone\n\nuninstall-libtclapincludeHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(libtclapinclude_HEADERS)'; for p in $$list; do \\\n\t  f=$(am__strip_dir) \\\n\t  echo \" rm -f '$(DESTDIR)$(libtclapincludedir)/$$f'\"; \\\n\t  rm -f \"$(DESTDIR)$(libtclapincludedir)/$$f\"; \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '    { files[$$0] = 1; } \\\n\t       END { for (i in files) print i; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\ttags=; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '    { files[$$0] = 1; } \\\n\t       END { for (i in files) print i; }'`; \\\n\tif test -z \"$(ETAGS_ARGS)$$tags$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t    $$tags $$unique; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\ttags=; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '    { files[$$0] = 1; } \\\n\t       END { for (i in files) print i; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$tags$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$tags $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && cd $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) $$here\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \\\n\t    fi; \\\n\t    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \\\n\t  else \\\n\t    test -f $(distdir)/$$file \\\n\t    || cp -p $$d/$$file $(distdir)/$$file \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(HEADERS)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(libtclapincludedir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic distclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-libtclapincludeHEADERS\n\ninstall-dvi: install-dvi-am\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-info: install-info-am\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-ps: install-ps-am\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-libtclapincludeHEADERS\n\n.MAKE: install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \\\n\tctags distclean distclean-generic distclean-tags distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-libtclapincludeHEADERS \\\n\tinstall-man install-pdf install-pdf-am install-ps \\\n\tinstall-ps-am install-strip installcheck installcheck-am \\\n\tinstalldirs maintainer-clean maintainer-clean-generic \\\n\tmostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \\\n\tuninstall uninstall-am uninstall-libtclapincludeHEADERS\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "environment/tclap/MultiArg.h",
    "content": "/****************************************************************************** \n * \n *  file:  MultiArg.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/\n\n\n#ifndef TCLAP_MULTIPLE_ARGUMENT_H\n#define TCLAP_MULTIPLE_ARGUMENT_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/Arg.h>\n#include <tclap/Constraint.h>\n\nnamespace TCLAP {\n/**\n * An argument that allows multiple values of type T to be specified.  Very\n * similar to a ValueArg, except a vector of values will be returned\n * instead of just one.\n */\ntemplate<class T>\nclass MultiArg : public Arg\n{\npublic:\n\ttypedef std::vector<T> container_type;\t\n\ttypedef typename container_type::iterator iterator;\n\ttypedef typename container_type::const_iterator const_iterator;\n\nprotected:\n\n\t/**\n\t * The list of values parsed from the CmdLine.\n\t */\n\tstd::vector<T> _values;\n\n\t/**\n\t * The description of type T to be used in the usage.\n\t */\n\tstd::string _typeDesc;\n\n\t/**\n\t * A list of constraint on this Arg. \n\t */\n\tConstraint<T>* _constraint;\n\n\t/**\n\t * Extracts the value from the string.\n\t * Attempts to parse string as type T, if this fails an exception\n\t * is thrown.\n\t * \\param val - The string to be read.\n\t */\n\tvoid _extractValue( const std::string& val );\n\n\t/**\n\t * Used by XorHandler to decide whether to keep parsing for this arg.\n\t */\n\tbool _allowMore;\n\npublic:\n\n\t/**\n\t * Constructor.\n\t * \\param flag - The one character flag that identifies this\n\t * argument on the command line.\n\t * \\param name - A one word name for the argument.  Can be\n\t * used as a long flag on the command line.\n\t * \\param desc - A description of what the argument is for or\n\t * does.\n\t * \\param req - Whether the argument is required on the command\n\t * line.\n\t * \\param typeDesc - A short, human readable description of the\n\t * type that this object expects.  This is used in the generation\n\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t * of the program.\n\t * \\param v - An optional visitor.  You probably should not\n\t * use this unless you have a very good reason.\n\t */\n\tMultiArg( const std::string& flag,\n                  const std::string& name,\n                  const std::string& desc,\n                  bool req,\n                  const std::string& typeDesc,\n                  Visitor* v = NULL);\n\n\t/**\n\t * Constructor.\n\t * \\param flag - The one character flag that identifies this\n\t * argument on the command line.\n\t * \\param name - A one word name for the argument.  Can be\n\t * used as a long flag on the command line.\n\t * \\param desc - A description of what the argument is for or\n\t * does.\n\t * \\param req - Whether the argument is required on the command\n\t * line.\n\t * \\param typeDesc - A short, human readable description of the\n\t * type that this object expects.  This is used in the generation\n\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t * of the program.\n\t * \\param parser - A CmdLine parser object to add this Arg to\n\t * \\param v - An optional visitor.  You probably should not\n\t * use this unless you have a very good reason.\n\t */\n\tMultiArg( const std::string& flag, \n                  const std::string& name,\n                  const std::string& desc,\n                  bool req,\n                  const std::string& typeDesc,\n                  CmdLineInterface& parser,\n                  Visitor* v = NULL );\n\n\t/**\n\t * Constructor.\n\t * \\param flag - The one character flag that identifies this\n\t * argument on the command line.\n\t * \\param name - A one word name for the argument.  Can be\n\t * used as a long flag on the command line.\n\t * \\param desc - A description of what the argument is for or\n\t * does.\n\t * \\param req - Whether the argument is required on the command\n\t * line.\n\t * \\param constraint - A pointer to a Constraint object used\n\t * to constrain this Arg.\n\t * \\param v - An optional visitor.  You probably should not\n\t * use this unless you have a very good reason.\n\t */\n\tMultiArg( const std::string& flag,\n                  const std::string& name,\n                  const std::string& desc,\n                  bool req,\n                  Constraint<T>* constraint,\n                  Visitor* v = NULL );\n\t\t  \n\t/**\n\t * Constructor.\n\t * \\param flag - The one character flag that identifies this\n\t * argument on the command line.\n\t * \\param name - A one word name for the argument.  Can be\n\t * used as a long flag on the command line.\n\t * \\param desc - A description of what the argument is for or\n\t * does.\n\t * \\param req - Whether the argument is required on the command\n\t * line.\n\t * \\param constraint - A pointer to a Constraint object used\n\t * to constrain this Arg.\n\t * \\param parser - A CmdLine parser object to add this Arg to\n\t * \\param v - An optional visitor.  You probably should not\n\t * use this unless you have a very good reason.\n\t */\n\tMultiArg( const std::string& flag, \n                  const std::string& name,\n                  const std::string& desc,\n                  bool req,\n                  Constraint<T>* constraint,\n                  CmdLineInterface& parser,\n                  Visitor* v = NULL );\n\t\t  \n\t/**\n\t * Handles the processing of the argument.\n\t * This re-implements the Arg version of this method to set the\n\t * _value of the argument appropriately.  It knows the difference\n\t * between labeled and unlabeled.\n\t * \\param i - Pointer the the current argument in the list.\n\t * \\param args - Mutable list of strings. Passed from main().\n\t */\n\tvirtual bool processArg(int* i, std::vector<std::string>& args); \n\n\t/**\n\t * Returns a vector of type T containing the values parsed from\n\t * the command line.\n\t */\n\tconst std::vector<T>& getValue();\n\n\t/**\n\t * Returns an iterator over the values parsed from the command\n\t * line.\n\t */\n\tconst_iterator begin() const { return _values.begin(); }\n\n\t/**\n\t * Returns the end of the values parsed from the command\n\t * line.\n\t */\n\tconst_iterator end() const { return _values.end(); }\n\n\t/**\n\t * Returns the a short id string.  Used in the usage. \n\t * \\param val - value to be used.\n\t */\n\tvirtual std::string shortID(const std::string& val=\"val\") const;\n\n\t/**\n\t * Returns the a long id string.  Used in the usage. \n\t * \\param val - value to be used.\n\t */\n\tvirtual std::string longID(const std::string& val=\"val\") const;\n\n\t/**\n\t * Once we've matched the first value, then the arg is no longer\n\t * required.\n\t */\n\tvirtual bool isRequired() const;\n\n\tvirtual bool allowMore();\n\t\n\tvirtual void reset();\n\nprivate:\n\t/**\n\t * Prevent accidental copying\n\t */\n\tMultiArg<T>(const MultiArg<T>& rhs);\n\tMultiArg<T>& operator=(const MultiArg<T>& rhs);\n\n};\n\ntemplate<class T>\nMultiArg<T>::MultiArg(const std::string& flag, \n                      const std::string& name,\n                      const std::string& desc,\n                      bool req,\n                      const std::string& typeDesc,\n                      Visitor* v) :\n   Arg( flag, name, desc, req, true, v ),\n  _values(std::vector<T>()),\n  _typeDesc( typeDesc ),\n  _constraint( NULL ),\n  _allowMore(false)\n{ \n\t_acceptsMultipleValues = true;\n}\n\ntemplate<class T>\nMultiArg<T>::MultiArg(const std::string& flag, \n                      const std::string& name,\n                      const std::string& desc,\n                      bool req,\n                      const std::string& typeDesc,\n                      CmdLineInterface& parser,\n                      Visitor* v)\n: Arg( flag, name, desc, req, true, v ),\n  _values(std::vector<T>()),\n  _typeDesc( typeDesc ),\n  _constraint( NULL ),\n  _allowMore(false)\n{ \n\tparser.add( this );\n\t_acceptsMultipleValues = true;\n}\n\n/**\n *\n */\ntemplate<class T>\nMultiArg<T>::MultiArg(const std::string& flag, \n                      const std::string& name,\n                      const std::string& desc,\n                      bool req,\n                      Constraint<T>* constraint,\n                      Visitor* v)\n: Arg( flag, name, desc, req, true, v ),\n  _values(std::vector<T>()),\n  _typeDesc( constraint->shortID() ),\n  _constraint( constraint ),\n  _allowMore(false)\n{ \n\t_acceptsMultipleValues = true;\n}\n\ntemplate<class T>\nMultiArg<T>::MultiArg(const std::string& flag, \n                      const std::string& name,\n                      const std::string& desc,\n                      bool req,\n                      Constraint<T>* constraint,\n                      CmdLineInterface& parser,\n                      Visitor* v)\n: Arg( flag, name, desc, req, true, v ),\n  _values(std::vector<T>()),\n  _typeDesc( constraint->shortID() ),\n  _constraint( constraint ),\n  _allowMore(false)\n{ \n\tparser.add( this );\n\t_acceptsMultipleValues = true;\n}\n\ntemplate<class T>\nconst std::vector<T>& MultiArg<T>::getValue() { return _values; }\n\ntemplate<class T>\nbool MultiArg<T>::processArg(int *i, std::vector<std::string>& args) \n{\n \tif ( _ignoreable && Arg::ignoreRest() )\n\t\treturn false;\n\n\tif ( _hasBlanks( args[*i] ) )\n\t\treturn false;\n\n\tstd::string flag = args[*i];\n\tstd::string value = \"\";\n\n   \ttrimFlag( flag, value );\n\n   \tif ( argMatches( flag ) )\n   \t{\n   \t\tif ( Arg::delimiter() != ' ' && value == \"\" )\n\t\t\tthrow( ArgParseException( \n\t\t\t           \"Couldn't find delimiter for this argument!\",\n\t\t\t\t\t   toString() ) );\n\n\t\t// always take the first one, regardless of start string\n\t\tif ( value == \"\" )\n\t\t{\n\t\t\t(*i)++;\n\t\t\tif ( static_cast<unsigned int>(*i) < args.size() )\n\t\t\t\t_extractValue( args[*i] );\n\t\t\telse\n\t\t\t\tthrow( ArgParseException(\"Missing a value for this argument!\",\n                                         toString() ) );\n\t\t} \n\t\telse\n\t\t\t_extractValue( value );\n\n\t\t/*\n\t\t// continuing taking the args until we hit one with a start string \n\t\twhile ( (unsigned int)(*i)+1 < args.size() &&\n\t\t\t\targs[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&\n\t\t        args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) \n\t\t\t\t_extractValue( args[++(*i)] );\n\t\t*/\n\n\t\t_alreadySet = true;\n\t\t_checkWithVisitor();\n\n\t\treturn true;\n\t}\n\telse\n\t\treturn false;\n}\n\n/**\n *\n */\ntemplate<class T>\nstd::string MultiArg<T>::shortID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn Arg::shortID(_typeDesc) + \" ... \";\n}\n\n/**\n *\n */\ntemplate<class T>\nstd::string MultiArg<T>::longID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn Arg::longID(_typeDesc) + \"  (accepted multiple times)\";\n}\n\n/**\n * Once we've matched the first value, then the arg is no longer\n * required.\n */\ntemplate<class T>\nbool MultiArg<T>::isRequired() const\n{\n\tif ( _required )\n\t{\n\t\tif ( _values.size() > 1 )\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n   \t}\n   \telse\n\t\treturn false;\n\n}\n\ntemplate<class T>\nvoid MultiArg<T>::_extractValue( const std::string& val ) \n{\n    try {\n\tT tmp;\n\tExtractValue(tmp, val, typename ArgTraits<T>::ValueCategory());\n\t_values.push_back(tmp);\n    } catch( ArgParseException &e) {\n\tthrow ArgParseException(e.error(), toString());\n    }\n\n    if ( _constraint != NULL )\n\tif ( ! _constraint->check( _values.back() ) )\n\t    throw( CmdLineParseException( \"Value '\" + val +\n\t\t\t\t\t  \"' does not meet constraint: \" +\n\t\t\t\t\t  _constraint->description(), \n\t\t\t\t\t  toString() ) );\n}\n\t\t\ntemplate<class T>\nbool MultiArg<T>::allowMore()\n{\n\tbool am = _allowMore;\n\t_allowMore = true;\n\treturn am;\n}\n\ntemplate<class T>\nvoid MultiArg<T>::reset()\n{\n\tArg::reset();\n\t_values.clear();\n}\n\n} // namespace TCLAP\n\n#endif\n"
  },
  {
    "path": "environment/tclap/MultiSwitchArg.h",
    "content": "\n/****************************************************************************** \n*\n*  file:  MultiSwitchArg.h\n*\n*  Copyright (c) 2003, Michael E. Smoot .\n*  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n*  Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek.\n*  All rights reverved.\n*\n*  See the file COPYING in the top directory of this distribution for\n*  more information.\n*\n*  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n*  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n*  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n*  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n*  DEALINGS IN THE SOFTWARE.\n*\n*****************************************************************************/\n\n\n#ifndef TCLAP_MULTI_SWITCH_ARG_H\n#define TCLAP_MULTI_SWITCH_ARG_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/SwitchArg.h>\n\nnamespace TCLAP {\n\n/**\n* A multiple switch argument.  If the switch is set on the command line, then\n* the getValue method will return the number of times the switch appears.\n*/\nclass MultiSwitchArg : public SwitchArg\n{\n\tprotected:\n\n\t\t/**\n\t\t * The value of the switch.\n\t\t */\n\t\tint _value;\n\n\t\t/**\n\t\t * Used to support the reset() method so that ValueArg can be\n\t\t * reset to their constructed value.\n\t\t */\n\t\tint _default;\n\n\tpublic:\n\n\t\t/**\n\t\t * MultiSwitchArg constructor.\n\t\t * \\param flag - The one character flag that identifies this\n\t\t * argument on the command line.\n\t\t * \\param name - A one word name for the argument.  Can be\n\t\t * used as a long flag on the command line.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param init - Optional. The initial/default value of this Arg. \n\t\t * Defaults to 0.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tMultiSwitchArg(const std::string& flag, \n\t\t\t\tconst std::string& name,\n\t\t\t\tconst std::string& desc,\n\t\t\t\tint init = 0,\n\t\t\t\tVisitor* v = NULL);\n\n\n\t\t/**\n\t\t * MultiSwitchArg constructor.\n\t\t * \\param flag - The one character flag that identifies this\n\t\t * argument on the command line.\n\t\t * \\param name - A one word name for the argument.  Can be\n\t\t * used as a long flag on the command line.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param init - Optional. The initial/default value of this Arg. \n\t\t * Defaults to 0.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tMultiSwitchArg(const std::string& flag, \n\t\t\t\tconst std::string& name,\n\t\t\t\tconst std::string& desc,\n\t\t\t\tCmdLineInterface& parser,\n\t\t\t\tint init = 0,\n\t\t\t\tVisitor* v = NULL);\n\n\n\t\t/**\n\t\t * Handles the processing of the argument.\n\t\t * This re-implements the SwitchArg version of this method to set the\n\t\t * _value of the argument appropriately.\n\t\t * \\param i - Pointer the the current argument in the list.\n\t\t * \\param args - Mutable list of strings. Passed\n\t\t * in from main().\n\t\t */\n\t\tvirtual bool processArg(int* i, std::vector<std::string>& args); \n\n\t\t/**\n\t\t * Returns int, the number of times the switch has been set.\n\t\t */\n\t\tint getValue();\n\n\t\t/**\n\t\t * Returns the shortID for this Arg.\n\t\t */\n\t\tstd::string shortID(const std::string& val) const;\n\n\t\t/**\n\t\t * Returns the longID for this Arg.\n\t\t */\n\t\tstd::string longID(const std::string& val) const;\n\t\t\n\t\tvoid reset();\n\n};\n\n//////////////////////////////////////////////////////////////////////\n//BEGIN MultiSwitchArg.cpp\n//////////////////////////////////////////////////////////////////////\ninline MultiSwitchArg::MultiSwitchArg(const std::string& flag,\n\t\t\t\t\tconst std::string& name,\n\t\t\t\t\tconst std::string& desc,\n\t\t\t\t\tint init,\n\t\t\t\t\tVisitor* v )\n: SwitchArg(flag, name, desc, false, v),\n_value( init ),\n_default( init )\n{ }\n\ninline MultiSwitchArg::MultiSwitchArg(const std::string& flag,\n\t\t\t\t\tconst std::string& name, \n\t\t\t\t\tconst std::string& desc, \n\t\t\t\t\tCmdLineInterface& parser,\n\t\t\t\t\tint init,\n\t\t\t\t\tVisitor* v )\n: SwitchArg(flag, name, desc, false, v),\n_value( init ),\n_default( init )\n{ \n\tparser.add( this );\n}\n\ninline int MultiSwitchArg::getValue() { return _value; }\n\ninline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)\n{\n\tif ( _ignoreable && Arg::ignoreRest() )\n\t\treturn false;\n\n\tif ( argMatches( args[*i] ))\n\t{\n\t\t// so the isSet() method will work\n\t\t_alreadySet = true;\n\n\t\t// Matched argument: increment value.\n\t\t++_value;\n\n\t\t_checkWithVisitor();\n\n\t\treturn true;\n\t}\n\telse if ( combinedSwitchesMatch( args[*i] ) )\n\t{\n\t\t// so the isSet() method will work\n\t\t_alreadySet = true;\n\n\t\t// Matched argument: increment value.\n\t\t++_value;\n\n\t\t// Check for more in argument and increment value.\n\t\twhile ( combinedSwitchesMatch( args[*i] ) ) \n\t\t\t++_value;\n\n\t\t_checkWithVisitor();\n\n\t\treturn false;\n\t}\n\telse\n\t\treturn false;\n}\n\ninline std::string \nMultiSwitchArg::shortID(const std::string& val) const\n{\n\treturn Arg::shortID(val) + \" ... \";\n}\n\ninline std::string \nMultiSwitchArg::longID(const std::string& val) const\n{\n\treturn Arg::longID(val) + \"  (accepted multiple times)\";\n}\n\ninline void\nMultiSwitchArg::reset()\n{\n\tMultiSwitchArg::_value = MultiSwitchArg::_default;\n}\n\n//////////////////////////////////////////////////////////////////////\n//END MultiSwitchArg.cpp\n//////////////////////////////////////////////////////////////////////\n\n} //namespace TCLAP\n\n#endif\n"
  },
  {
    "path": "environment/tclap/OptionalUnlabeledTracker.h",
    "content": "\n\n/****************************************************************************** \n * \n *  file:  OptionalUnlabeledTracker.h\n * \n *  Copyright (c) 2005, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H\n#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H\n\n#include <string>\n\nnamespace TCLAP {\n\nclass OptionalUnlabeledTracker\n{\n\n\tpublic:\n\n\t\tstatic void check( bool req, const std::string& argName );\n\n\t\tstatic void gotOptional() { alreadyOptionalRef() = true; }\n\n\t\tstatic bool& alreadyOptional() { return alreadyOptionalRef(); } \n\n\tprivate:\n\n\t\tstatic bool& alreadyOptionalRef() { static bool ct = false; return ct; }\n};\n\n\ninline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )\n{\n    if ( OptionalUnlabeledTracker::alreadyOptional() )\n        throw( SpecificationException(\n\t\"You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg\",\n\t                argName ) );\n\n    if ( !req )\n        OptionalUnlabeledTracker::gotOptional();\n}\n\n\n} // namespace TCLAP\n\n#endif\n"
  },
  {
    "path": "environment/tclap/StandardTraits.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/******************************************************************************\n *\n *  file:  StandardTraits.h\n *\n *  Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .\n *  All rights reverved.\n *\n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *\n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n *  DEALINGS IN THE SOFTWARE.\n *\n *****************************************************************************/\n\n// This is an internal tclap file, you should probably not have to\n// include this directly\n\n#ifndef TCLAP_STANDARD_TRAITS_H\n#define TCLAP_STANDARD_TRAITS_H\n\n#ifdef HAVE_CONFIG_H\n#include <config.h> // To check for long long\n#endif\n\n// If Microsoft has already typedef'd wchar_t as an unsigned \n// short, then compiles will break because it's as if we're\n// creating ArgTraits twice for unsigned short. Thus...\n#ifdef _MSC_VER\n#ifndef _NATIVE_WCHAR_T_DEFINED\n#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS\n#endif\n#endif\n\nnamespace TCLAP {\n\n// ======================================================================\n// Integer types\n// ======================================================================\n\n/**\n * longs have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<long> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * ints have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<int> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * shorts have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<short> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * chars have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<char> {\n    typedef ValueLike ValueCategory;\n};\n\n#ifdef HAVE_LONG_LONG\n/**\n * long longs have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<long long> {\n    typedef ValueLike ValueCategory;\n};\n#endif\n\n// ======================================================================\n// Unsigned integer types\n// ======================================================================\n\n/**\n * unsigned longs have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<unsigned long> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * unsigned ints have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<unsigned int> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * unsigned shorts have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<unsigned short> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * unsigned chars have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<unsigned char> {\n    typedef ValueLike ValueCategory;\n};\n\n// Microsoft implements size_t awkwardly. \n#if defined(_MSC_VER) && defined(_M_X64)\n/**\n * size_ts have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<size_t> {\n    typedef ValueLike ValueCategory;\n};\n#endif\n\n\n#ifdef HAVE_LONG_LONG\n/**\n * unsigned long longs have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<unsigned long long> {\n    typedef ValueLike ValueCategory;\n};\n#endif\n\n// ======================================================================\n// Float types\n// ======================================================================\n\n/**\n * floats have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<float> {\n    typedef ValueLike ValueCategory;\n};\n\n/**\n * doubles have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<double> {\n    typedef ValueLike ValueCategory;\n};\n\n// ======================================================================\n// Other types\n// ======================================================================\n\n/**\n * bools have value-like semantics.\n */\ntemplate<>\nstruct ArgTraits<bool> {\n    typedef ValueLike ValueCategory;\n};\n\n\n/**\n * wchar_ts have value-like semantics.\n */\n#ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS\ntemplate<>\nstruct ArgTraits<wchar_t> {\n    typedef ValueLike ValueCategory;\n};\n#endif\n\n/**\n * Strings have string like argument traits.\n */\ntemplate<>\nstruct ArgTraits<std::string> {\n    typedef StringLike ValueCategory;\n};\n\ntemplate<typename T>\nvoid SetString(T &dst, const std::string &src)\n{\n    dst = src;\n}\n\n} // namespace\n\n#endif\n\n"
  },
  {
    "path": "environment/tclap/StdOutput.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/****************************************************************************** \n * \n *  file:  StdOutput.h\n * \n *  Copyright (c) 2004, Michael E. Smoot\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_STDCMDLINEOUTPUT_H\n#define TCLAP_STDCMDLINEOUTPUT_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <algorithm>\n\n#include <tclap/CmdLineInterface.h>\n#include <tclap/CmdLineOutput.h>\n#include <tclap/XorHandler.h>\n#include <tclap/Arg.h>\n\nnamespace TCLAP {\n\n/**\n * A class that isolates any output from the CmdLine object so that it\n * may be easily modified.\n */\nclass StdOutput : public CmdLineOutput\n{\n\n\tpublic:\n\n\t\t/**\n\t\t * Prints the usage to stdout.  Can be overridden to \n\t\t * produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void usage(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints the version to stdout. Can be overridden \n\t\t * to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void version(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints (to stderr) an error message, short usage \n\t\t * Can be overridden to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t * \\param e - The ArgException that caused the failure. \n\t\t */\n\t\tvirtual void failure(CmdLineInterface& c, \n\t\t\t\t     ArgException& e );\n\n\tprotected:\n\n        /**\n         * Writes a brief usage message with short args.\n\t\t * \\param c - The CmdLine object the output is generated for. \n         * \\param os - The stream to write the message to.\n         */\n        void _shortUsage( CmdLineInterface& c, std::ostream& os ) const;\n\n        /**\n\t\t * Writes a longer usage message with long and short args, \n\t\t * provides descriptions and prints message.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t * \\param os - The stream to write the message to.\n\t\t */\n\t\tvoid _longUsage( CmdLineInterface& c, std::ostream& os ) const;\n\n\t\t/**\n\t\t * This function inserts line breaks and indents long strings \n\t\t * according the  params input. It will only break lines at spaces, \n\t\t * commas and pipes.\n\t\t * \\param os - The stream to be printed to.\n\t\t * \\param s - The string to be printed.\n\t\t * \\param maxWidth - The maxWidth allowed for the output line. \n\t\t * \\param indentSpaces - The number of spaces to indent the first line. \n\t\t * \\param secondLineOffset - The number of spaces to indent the second\n\t\t * and all subsequent lines in addition to indentSpaces.\n\t\t */\n\t\tvoid spacePrint( std::ostream& os, \n\t\t\t\t\t\t const std::string& s, \n\t\t\t\t\t\t int maxWidth, \n\t\t\t\t\t\t int indentSpaces, \n\t\t\t\t\t\t int secondLineOffset ) const;\n\n};\n\n\ninline void StdOutput::version(CmdLineInterface& _cmd) \n{\n\tstd::string progName = _cmd.getProgramName();\n\tstd::string xversion = _cmd.getVersion();\n\n\tstd::cout << std::endl << progName << \"  version: \" \n\t\t\t  << xversion << std::endl << std::endl;\n}\n\ninline void StdOutput::usage(CmdLineInterface& _cmd ) \n{\n\tstd::cout << std::endl << \"USAGE: \" << std::endl << std::endl; \n\n\t_shortUsage( _cmd, std::cout );\n\n\tstd::cout << std::endl << std::endl << \"Where: \" << std::endl << std::endl;\n\n\t_longUsage( _cmd, std::cout );\n\n\tstd::cout << std::endl; \n\n}\n\ninline void StdOutput::failure( CmdLineInterface& _cmd,\n\t\t\t\t\t\t\t\tArgException& e ) \n{\n\tstd::string progName = _cmd.getProgramName();\n\n\tstd::cerr << \"PARSE ERROR: \" << e.argId() << std::endl\n\t\t      << \"             \" << e.error() << std::endl << std::endl;\n\n\tif ( _cmd.hasHelpAndVersion() )\n\t\t{\n\t\t\tstd::cerr << \"Brief USAGE: \" << std::endl;\n\n\t\t\t_shortUsage( _cmd, std::cerr );\t\n\n\t\t\tstd::cerr << std::endl << \"For complete USAGE and HELP type: \" \n\t\t\t\t\t  << std::endl << \"   \" << progName << \" --help\" \n\t\t\t\t\t  << std::endl << std::endl;\n\t\t}\n\telse\n\t\tusage(_cmd);\n\n\tthrow ExitException(1);\n}\n\ninline void \nStdOutput::_shortUsage( CmdLineInterface& _cmd, \n\t\t\t\t\t\tstd::ostream& os ) const\n{\n\tstd::list<Arg*> argList = _cmd.getArgList();\n\tstd::string progName = _cmd.getProgramName();\n\tXorHandler xorHandler = _cmd.getXorHandler();\n\tstd::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();\n\n\tstd::string s = progName + \" \";\n\n\t// first the xor\n\tfor ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )\n\t\t{\n\t\t\ts += \" {\";\n\t\t\tfor ( ArgVectorIterator it = xorList[i].begin(); \n\t\t\t\t  it != xorList[i].end(); it++ )\n\t\t\t\ts += (*it)->shortID() + \"|\";\n\n\t\t\ts[s.length()-1] = '}';\n\t\t}\n\n\t// then the rest\n\tfor (ArgListIterator it = argList.begin(); it != argList.end(); it++)\n\t\tif ( !xorHandler.contains( (*it) ) )\n\t\t\ts += \" \" + (*it)->shortID();\n\n\t// if the program name is too long, then adjust the second line offset \n\tint secondLineOffset = static_cast<int>(progName.length()) + 2;\n\tif ( secondLineOffset > 75/2 )\n\t\tsecondLineOffset = static_cast<int>(75/2);\n\n\tspacePrint( os, s, 75, 3, secondLineOffset );\n}\n\ninline void \nStdOutput::_longUsage( CmdLineInterface& _cmd, \n\t\t\t\t\t   std::ostream& os ) const\n{\n\tstd::list<Arg*> argList = _cmd.getArgList();\n\tstd::string message = _cmd.getMessage();\n\tXorHandler xorHandler = _cmd.getXorHandler();\n\tstd::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();\n\n\t// first the xor \n\tfor ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )\n\t\t{\n\t\t\tfor ( ArgVectorIterator it = xorList[i].begin(); \n\t\t\t\t  it != xorList[i].end(); \n\t\t\t\t  it++ )\n\t\t\t\t{\n\t\t\t\t\tspacePrint( os, (*it)->longID(), 75, 3, 3 );\n\t\t\t\t\tspacePrint( os, (*it)->getDescription(), 75, 5, 0 );\n\n\t\t\t\t\tif ( it+1 != xorList[i].end() )\n\t\t\t\t\t\tspacePrint(os, \"-- OR --\", 75, 9, 0);\n\t\t\t\t}\n\t\t\tos << std::endl << std::endl;\n\t\t}\n\n\t// then the rest\n\tfor (ArgListIterator it = argList.begin(); it != argList.end(); it++)\n\t\tif ( !xorHandler.contains( (*it) ) )\n\t\t\t{\n\t\t\t\tspacePrint( os, (*it)->longID(), 75, 3, 3 ); \n\t\t\t\tspacePrint( os, (*it)->getDescription(), 75, 5, 0 ); \n\t\t\t\tos << std::endl;\n\t\t\t}\n\n\tos << std::endl;\n\n\tspacePrint( os, message, 75, 3, 0 );\n}\n\ninline void StdOutput::spacePrint( std::ostream& os, \n\t\t\t\t\t\t           const std::string& s, \n\t\t\t\t\t\t           int maxWidth, \n\t\t\t\t\t\t           int indentSpaces, \n\t\t\t\t\t\t           int secondLineOffset ) const\n{\n\tint len = static_cast<int>(s.length());\n\n\tif ( (len + indentSpaces > maxWidth) && maxWidth > 0 )\n\t\t{\n\t\t\tint allowedLen = maxWidth - indentSpaces;\n\t\t\tint start = 0;\n\t\t\twhile ( start < len )\n\t\t\t\t{\n\t\t\t\t\t// find the substring length\n\t\t\t\t\t// int stringLen = std::min<int>( len - start, allowedLen );\n\t\t\t\t\t// doing it this way to support a VisualC++ 2005 bug \n\t\t\t\t\tusing namespace std; \n\t\t\t\t\tint stringLen = min<int>( len - start, allowedLen );\n\n\t\t\t\t\t// trim the length so it doesn't end in middle of a word\n\t\t\t\t\tif ( stringLen == allowedLen )\n\t\t\t\t\t\twhile ( stringLen >= 0 &&\n\t\t\t\t\t\t\t\ts[stringLen+start] != ' ' && \n\t\t\t\t\t\t\t\ts[stringLen+start] != ',' &&\n\t\t\t\t\t\t\t\ts[stringLen+start] != '|' ) \n\t\t\t\t\t\t\tstringLen--;\n\t\n\t\t\t\t\t// ok, the word is longer than the line, so just split \n\t\t\t\t\t// wherever the line ends\n\t\t\t\t\tif ( stringLen <= 0 )\n\t\t\t\t\t\tstringLen = allowedLen;\n\n\t\t\t\t\t// check for newlines\n\t\t\t\t\tfor ( int i = 0; i < stringLen; i++ )\n\t\t\t\t\t\tif ( s[start+i] == '\\n' )\n\t\t\t\t\t\t\tstringLen = i+1;\n\n\t\t\t\t\t// print the indent\t\n\t\t\t\t\tfor ( int i = 0; i < indentSpaces; i++ )\n\t\t\t\t\t\tos << \" \";\n\n\t\t\t\t\tif ( start == 0 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// handle second line offsets\n\t\t\t\t\t\t\tindentSpaces += secondLineOffset;\n\n\t\t\t\t\t\t\t// adjust allowed len\n\t\t\t\t\t\t\tallowedLen -= secondLineOffset;\n\t\t\t\t\t\t}\n\n\t\t\t\t\tos << s.substr(start,stringLen) << std::endl;\n\n\t\t\t\t\t// so we don't start a line with a space\n\t\t\t\t\twhile ( s[stringLen+start] == ' ' && start < len )\n\t\t\t\t\t\tstart++;\n\t\t\t\n\t\t\t\t\tstart += stringLen;\n\t\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\t\tfor ( int i = 0; i < indentSpaces; i++ )\n\t\t\t\tos << \" \";\n\t\t\tos << s << std::endl;\n\t\t}\n}\n\n} //namespace TCLAP\n#endif \n"
  },
  {
    "path": "environment/tclap/SwitchArg.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  SwitchArg.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_SWITCH_ARG_H\n#define TCLAP_SWITCH_ARG_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/Arg.h>\n\nnamespace TCLAP {\n\n/**\n * A simple switch argument.  If the switch is set on the command line, then\n * the getValue method will return the opposite of the default value for the\n * switch.\n */\nclass SwitchArg : public Arg\n{\n\tprotected:\n\n\t\t/**\n\t\t * The value of the switch.\n\t\t */\n\t\tbool _value;\n\n\t\t/**\n\t\t * Used to support the reset() method so that ValueArg can be\n\t\t * reset to their constructed value.\n\t\t */\n        bool _default;\n\n\tpublic:\n\n        /**\n\t\t * SwitchArg constructor.\n\t\t * \\param flag - The one character flag that identifies this\n\t\t * argument on the command line.\n\t\t * \\param name - A one word name for the argument.  Can be\n\t\t * used as a long flag on the command line.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param def - The default value for this Switch. \n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tSwitchArg(const std::string& flag, \n\t\t\t      const std::string& name, \n\t\t\t      const std::string& desc,\n\t\t\t      bool def = false,\n\t\t\t\t  Visitor* v = NULL);\n\n\t\t\t\t  \n\t\t/**\n\t\t * SwitchArg constructor.\n\t\t * \\param flag - The one character flag that identifies this\n\t\t * argument on the command line.\n\t\t * \\param name - A one word name for the argument.  Can be\n\t\t * used as a long flag on the command line.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param def - The default value for this Switch.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tSwitchArg(const std::string& flag, \n\t\t\t      const std::string& name, \n\t\t\t      const std::string& desc,\n\t\t\t\t  CmdLineInterface& parser,\n\t\t\t      bool def = false,\n\t\t\t\t  Visitor* v = NULL);\n\t\t\t\t  \n\t\t\t\t  \n        /**\n\t\t * Handles the processing of the argument.\n\t\t * This re-implements the Arg version of this method to set the\n\t\t * _value of the argument appropriately.\n\t\t * \\param i - Pointer the the current argument in the list.\n\t\t * \\param args - Mutable list of strings. Passed\n\t\t * in from main().\n\t\t */\n\t\tvirtual bool processArg(int* i, std::vector<std::string>& args); \n\n\t\t/**\n\t\t * Checks a string to see if any of the chars in the string\n\t\t * match the flag for this Switch.\n\t\t */\n\t\tbool combinedSwitchesMatch(std::string& combined);\n\n\t\t/**\n\t\t * Returns bool, whether or not the switch has been set.\n\t\t */\n\t\tbool getValue();\n\t\t\n\t\tvirtual void reset();\n\n\tprivate:\n\t\t/**\n\t\t * Checks to see if we've found the last match in\n\t\t * a combined string.\n\t\t */\n\t\tbool lastCombined(std::string& combined);\n\n\t\t/**\n\t\t * Does the common processing of processArg.\n\t\t */\n\t\tvoid commonProcessing();\n};\n\n//////////////////////////////////////////////////////////////////////\n//BEGIN SwitchArg.cpp\n//////////////////////////////////////////////////////////////////////\ninline SwitchArg::SwitchArg(const std::string& flag, \n                            const std::string& name, \n                            const std::string& desc, \n                            bool default_val,\n                            Visitor* v )\n: Arg(flag, name, desc, false, false, v),\n  _value( default_val ),\n  _default( default_val )\n{ }\n\ninline SwitchArg::SwitchArg(const std::string& flag, \n                            const std::string& name, \n                            const std::string& desc, \n                            CmdLineInterface& parser,\n                            bool default_val,\n                            Visitor* v )\n: Arg(flag, name, desc, false, false, v),\n  _value( default_val ),\n  _default(default_val)\n{ \n\tparser.add( this );\n}\n\ninline bool SwitchArg::getValue() { return _value; }\n\ninline bool SwitchArg::lastCombined(std::string& combinedSwitches ) \n{\n\tfor ( unsigned int i = 1; i < combinedSwitches.length(); i++ )\n\t\tif ( combinedSwitches[i] != Arg::blankChar() )\n\t\t\treturn false;\n\t\n\treturn true;\n}\n\ninline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )\n{\n\t// make sure this is actually a combined switch\n\tif ( combinedSwitches.length() > 0 &&\n\t     combinedSwitches[0] != Arg::flagStartString()[0] )\n\t\treturn false;\n\n\t// make sure it isn't a long name \n\tif ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) == \n\t     Arg::nameStartString() )\n\t\treturn false;\n\n\t// make sure the delimiter isn't in the string \n\tif ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos )\n\t\treturn false;\n\n\t// ok, we're not specifying a ValueArg, so we know that we have\n\t// a combined switch list.  \n\tfor ( unsigned int i = 1; i < combinedSwitches.length(); i++ )\n\t\tif ( _flag.length() > 0 && \n\t\t     combinedSwitches[i] == _flag[0] &&\n\t\t     _flag[0] != Arg::flagStartString()[0] ) \n\t\t{\n\t\t\t// update the combined switches so this one is no longer present\n\t\t\t// this is necessary so that no unlabeled args are matched\n\t\t\t// later in the processing.\n\t\t\t//combinedSwitches.erase(i,1);\n\t\t\tcombinedSwitches[i] = Arg::blankChar(); \n\t\t\treturn true;\n\t\t}\n\n\t// none of the switches passed in the list match. \n\treturn false;\t\n}\n\ninline void SwitchArg::commonProcessing()\n{\n\tif ( _xorSet )\n\t\tthrow(CmdLineParseException(\n\t\t      \"Mutually exclusive argument already set!\", toString()));\n\n\tif ( _alreadySet ) \n\t\tthrow(CmdLineParseException(\"Argument already set!\", toString()));\n\n\t_alreadySet = true;\n\n\tif ( _value == true )\n\t\t_value = false;\n\telse\n\t\t_value = true;\n\n\t_checkWithVisitor();\n}\n\ninline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)\n{\n\tif ( _ignoreable && Arg::ignoreRest() )\n\t\treturn false;\n\n\t// if the whole string matches the flag or name string\n\tif ( argMatches( args[*i] ) )\n\t{\n\t\tcommonProcessing();\n\n\t\treturn true;\n\t}\n\t// if a substring matches the flag as part of a combination\n\telse if ( combinedSwitchesMatch( args[*i] ) )\n\t{\n\t\t// check again to ensure we don't misinterpret \n\t\t// this as a MultiSwitchArg \n\t\tif ( combinedSwitchesMatch( args[*i] ) )\n\t\t\tthrow(CmdLineParseException(\"Argument already set!\", \n\t\t\t                            toString()));\n\n\t\tcommonProcessing();\n\n\t\t// We only want to return true if we've found the last combined\n\t\t// match in the string, otherwise we return true so that other \n\t\t// switches in the combination will have a chance to match.\n\t\treturn lastCombined( args[*i] );\n\t}\n\telse\n\t\treturn false;\n}\n\ninline void SwitchArg::reset()\n{\n\tArg::reset();\n\t_value = _default;  \n}\n//////////////////////////////////////////////////////////////////////\n//End SwitchArg.cpp\n//////////////////////////////////////////////////////////////////////\n\n} //namespace TCLAP\n\n#endif\n"
  },
  {
    "path": "environment/tclap/UnlabeledMultiArg.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  UnlabeledMultiArg.h\n * \n *  Copyright (c) 2003, Michael E. Smoot.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H\n#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/MultiArg.h>\n#include <tclap/OptionalUnlabeledTracker.h>\n\nnamespace TCLAP {\n\n/**\n * Just like a MultiArg, except that the arguments are unlabeled.  Basically,\n * this Arg will slurp up everything that hasn't been matched to another \n * Arg.\n */\ntemplate<class T>\nclass UnlabeledMultiArg : public MultiArg<T>\n{\n\n\t// If compiler has two stage name lookup (as gcc >= 3.4 does)\n\t// this is requried to prevent undef. symbols\n\tusing MultiArg<T>::_ignoreable;\n\tusing MultiArg<T>::_hasBlanks;\n\tusing MultiArg<T>::_extractValue;\n\tusing MultiArg<T>::_typeDesc;\n\tusing MultiArg<T>::_name;\n\tusing MultiArg<T>::_description;\n\tusing MultiArg<T>::_alreadySet;\n\tusing MultiArg<T>::toString;\n\n\tpublic:\n\t\t\n\t\t/**\n\t\t * Constructor.  \n\t\t * \\param name - The name of the Arg. Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t *  line.\n\t\t * \\param typeDesc - A short, human readable description of the\n\t\t * type that this object expects.  This is used in the generation\n\t\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t\t * of the program.\n\t\t * \\param ignoreable - Whether or not this argument can be ignored\n\t\t * using the \"--\" flag.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tUnlabeledMultiArg( const std::string& name,\n\t\t\t\t           const std::string& desc,\n\t\t\t\t\t\t   bool req,\n\t\t\t\t           const std::string& typeDesc,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL );\n\t\t/**\n\t\t * Constructor.  \n\t\t * \\param name - The name of the Arg. Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t *  line.\n\t\t * \\param typeDesc - A short, human readable description of the\n\t\t * type that this object expects.  This is used in the generation\n\t\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t\t * of the program.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param ignoreable - Whether or not this argument can be ignored\n\t\t * using the \"--\" flag.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tUnlabeledMultiArg( const std::string& name,\n\t\t\t\t           const std::string& desc,\n\t\t\t\t\t\t   bool req,\n\t\t\t\t           const std::string& typeDesc,\n\t\t\t\t\t\t   CmdLineInterface& parser,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL );\n\t\t\t\t\t\t \n\t\t/**\n\t\t * Constructor.  \n\t\t * \\param name - The name of the Arg. Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t *  line.\n\t\t * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n\t\t * \\param ignoreable - Whether or not this argument can be ignored\n\t\t * using the \"--\" flag.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tUnlabeledMultiArg( const std::string& name,\n\t\t\t\t\t\t   const std::string& desc,\n\t\t\t\t\t\t   bool req,\n\t\t\t\t\t\t   Constraint<T>* constraint,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t\t\t   Visitor* v = NULL );\n\n\t\t/**\n\t\t * Constructor.  \n\t\t * \\param name - The name of the Arg. Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t *  line.\n\t\t * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param ignoreable - Whether or not this argument can be ignored\n\t\t * using the \"--\" flag.\n\t\t * \\param v - An optional visitor.  You probably should not\n\t\t * use this unless you have a very good reason.\n\t\t */\n\t\tUnlabeledMultiArg( const std::string& name, \n\t\t\t\t\t\t   const std::string& desc, \n\t\t\t\t\t\t   bool req,\n\t\t\t\t\t\t   Constraint<T>* constraint,\n\t\t\t\t\t\t   CmdLineInterface& parser,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t\t\t   Visitor* v = NULL );\n\t\t\t\t\t\t \n\t\t/**\n\t\t * Handles the processing of the argument.\n\t\t * This re-implements the Arg version of this method to set the\n\t\t * _value of the argument appropriately.  It knows the difference\n\t\t * between labeled and unlabeled.\n\t\t * \\param i - Pointer the the current argument in the list.\n\t\t * \\param args - Mutable list of strings. Passed from main().\n\t\t */\n\t\tvirtual bool processArg(int* i, std::vector<std::string>& args); \n\n\t\t/**\n\t\t * Returns the a short id string.  Used in the usage.\n\t\t * \\param val - value to be used.\n\t\t */\n\t\tvirtual std::string shortID(const std::string& val=\"val\") const;\n\n\t\t/**\n\t\t * Returns the a long id string.  Used in the usage.\n\t\t * \\param val - value to be used.\n\t\t */\n\t\tvirtual std::string longID(const std::string& val=\"val\") const;\n\n\t\t/**\n\t\t * Opertor ==.\n\t\t * \\param a - The Arg to be compared to this.\n\t\t */\n\t\tvirtual bool operator==(const Arg& a) const;\n\n\t\t/**\n\t\t * Pushes this to back of list rather than front.\n\t\t * \\param argList - The list this should be added to.\n\t\t */\n\t\tvirtual void addToList( std::list<Arg*>& argList ) const;\n};\n\ntemplate<class T>\nUnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name, \n\t\t\t\t                        const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    const std::string& typeDesc,\n\t\t\t\t\t\t\t\t\t\tbool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: MultiArg<T>(\"\", name, desc,  req, typeDesc, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(true, toString());\n}\n\ntemplate<class T>\nUnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name, \n\t\t\t\t                        const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    const std::string& typeDesc,\n\t\t\t\t\t\t\t\t\t\tCmdLineInterface& parser,\n\t\t\t\t\t\t\t\t\t\tbool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: MultiArg<T>(\"\", name, desc,  req, typeDesc, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(true, toString());\n\tparser.add( this );\n}\n\n\ntemplate<class T>\nUnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name, \n\t\t\t\t                        const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    Constraint<T>* constraint,\n\t\t\t\t\t\t\t\t\t\tbool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: MultiArg<T>(\"\", name, desc,  req, constraint, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(true, toString());\n}\n\ntemplate<class T>\nUnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name, \n\t\t\t\t                        const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    Constraint<T>* constraint,\n\t\t\t\t\t\t\t\t\t\tCmdLineInterface& parser,\n\t\t\t\t\t\t\t\t\t\tbool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: MultiArg<T>(\"\", name, desc,  req, constraint, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(true, toString());\n\tparser.add( this );\n}\n\n\ntemplate<class T>\nbool UnlabeledMultiArg<T>::processArg(int *i, std::vector<std::string>& args) \n{\n\n\tif ( _hasBlanks( args[*i] ) )\n\t\treturn false;\n\n\t// never ignore an unlabeled multi arg\n\n\n\t// always take the first value, regardless of the start string \n\t_extractValue( args[(*i)] );\n\n\t/*\n\t// continue taking args until we hit the end or a start string \n\twhile ( (unsigned int)(*i)+1 < args.size() &&\n\t\t\targs[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&\n            args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) \n\t\t_extractValue( args[++(*i)] );\n\t*/\n\n\t_alreadySet = true;\n\n\treturn true;\n}\n\ntemplate<class T>\nstd::string UnlabeledMultiArg<T>::shortID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn std::string(\"<\") + _typeDesc + \"> ...\";\n}\n\ntemplate<class T>\nstd::string UnlabeledMultiArg<T>::longID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn std::string(\"<\") + _typeDesc + \">  (accepted multiple times)\";\n}\n\ntemplate<class T>\nbool UnlabeledMultiArg<T>::operator==(const Arg& a) const\n{\n\tif ( _name == a.getName() || _description == a.getDescription() )\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ntemplate<class T>\nvoid UnlabeledMultiArg<T>::addToList( std::list<Arg*>& argList ) const\n{\n\targList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );\n}\n\n}\n\n#endif\n"
  },
  {
    "path": "environment/tclap/UnlabeledValueArg.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  UnlabeledValueArg.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H\n#define TCLAP_UNLABELED_VALUE_ARGUMENT_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/ValueArg.h>\n#include <tclap/OptionalUnlabeledTracker.h>\n\n\nnamespace TCLAP {\n\n/**\n * The basic unlabeled argument that parses a value.\n * This is a template class, which means the type T defines the type\n * that a given object will attempt to parse when an UnlabeledValueArg\n * is reached in the list of args that the CmdLine iterates over.\n */\ntemplate<class T>\nclass UnlabeledValueArg : public ValueArg<T>\n{\n\n\t// If compiler has two stage name lookup (as gcc >= 3.4 does)\n\t// this is requried to prevent undef. symbols\n\tusing ValueArg<T>::_ignoreable;\n\tusing ValueArg<T>::_hasBlanks;\n\tusing ValueArg<T>::_extractValue;\n\tusing ValueArg<T>::_typeDesc;\n\tusing ValueArg<T>::_name;\n\tusing ValueArg<T>::_description;\n\tusing ValueArg<T>::_alreadySet;\n\tusing ValueArg<T>::toString;\n\n\tpublic:\n\n\t\t/**\n\t\t * UnlabeledValueArg constructor.\n\t\t * \\param name - A one word name for the argument.  Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t * line.\n\t\t * \\param value - The default value assigned to this argument if it\n\t\t * is not present on the command line.\n\t\t * \\param typeDesc - A short, human readable description of the\n\t\t * type that this object expects.  This is used in the generation\n\t\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t\t * of the program.\n\t\t * \\param ignoreable - Allows you to specify that this argument can be\n\t\t * ignored if the '--' flag is set.  This defaults to false (cannot\n\t\t * be ignored) and should  generally stay that way unless you have \n\t\t * some special need for certain arguments to be ignored.\n\t\t * \\param v - Optional Vistor.  You should leave this blank unless\n\t\t * you have a very good reason.\n\t\t */\n\t\tUnlabeledValueArg( const std::string& name, \n\t\t\t               const std::string& desc, \n\t\t\t\t\t\t   bool req,\n\t\t\t\t           T value,\n\t\t\t\t           const std::string& typeDesc,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL); \n\n\t\t/**\n\t\t * UnlabeledValueArg constructor.\n\t\t * \\param name - A one word name for the argument.  Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t * line.\n\t\t * \\param value - The default value assigned to this argument if it\n\t\t * is not present on the command line.\n\t\t * \\param typeDesc - A short, human readable description of the\n\t\t * type that this object expects.  This is used in the generation\n\t\t * of the USAGE statement.  The goal is to be helpful to the end user\n\t\t * of the program.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param ignoreable - Allows you to specify that this argument can be\n\t\t * ignored if the '--' flag is set.  This defaults to false (cannot\n\t\t * be ignored) and should  generally stay that way unless you have \n\t\t * some special need for certain arguments to be ignored.\n\t\t * \\param v - Optional Vistor.  You should leave this blank unless\n\t\t * you have a very good reason.\n\t\t */\n\t\tUnlabeledValueArg( const std::string& name, \n\t\t\t               const std::string& desc, \n\t\t\t\t\t\t   bool req,\n\t\t\t\t           T value,\n\t\t\t\t           const std::string& typeDesc,\n\t\t\t\t\t\t   CmdLineInterface& parser,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL ); \t\t\t\t\t\n\t\t\t\t\t\t\n\t\t/**\n\t\t * UnlabeledValueArg constructor.\n\t\t * \\param name - A one word name for the argument.  Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t * line.\n\t\t * \\param value - The default value assigned to this argument if it\n\t\t * is not present on the command line.\n\t\t * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n\t\t * \\param ignoreable - Allows you to specify that this argument can be\n\t\t * ignored if the '--' flag is set.  This defaults to false (cannot\n\t\t * be ignored) and should  generally stay that way unless you have \n\t\t * some special need for certain arguments to be ignored.\n\t\t * \\param v - Optional Vistor.  You should leave this blank unless\n\t\t * you have a very good reason.\n\t\t */\n\t\tUnlabeledValueArg( const std::string& name, \n\t\t\t               const std::string& desc, \n\t\t\t\t\t\t   bool req,\n\t\t\t\t           T value,\n\t\t\t\t           Constraint<T>* constraint,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL ); \n\n\t\t\n\t\t/**\n\t\t * UnlabeledValueArg constructor.\n\t\t * \\param name - A one word name for the argument.  Note that this is used for\n\t\t * identification, not as a long flag.\n\t\t * \\param desc - A description of what the argument is for or\n\t\t * does.\n\t\t * \\param req - Whether the argument is required on the command\n\t\t * line.\n\t\t * \\param value - The default value assigned to this argument if it\n\t\t * is not present on the command line.\n\t\t * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n\t\t * \\param parser - A CmdLine parser object to add this Arg to\n\t\t * \\param ignoreable - Allows you to specify that this argument can be\n\t\t * ignored if the '--' flag is set.  This defaults to false (cannot\n\t\t * be ignored) and should  generally stay that way unless you have \n\t\t * some special need for certain arguments to be ignored.\n\t\t * \\param v - Optional Vistor.  You should leave this blank unless\n\t\t * you have a very good reason.\n\t\t */\n\t\tUnlabeledValueArg( const std::string& name, \n\t\t\t               const std::string& desc, \n\t\t\t\t\t\t   bool req,\n\t\t\t\t           T value,\n\t\t\t\t           Constraint<T>* constraint,\n\t\t\t\t\t\t   CmdLineInterface& parser,\n\t\t\t\t\t\t   bool ignoreable = false,\n\t\t\t\t           Visitor* v = NULL);\n\t\t\t\t\t\t\n\t\t/**\n\t\t * Handles the processing of the argument.\n\t\t * This re-implements the Arg version of this method to set the\n\t\t * _value of the argument appropriately.  Handling specific to\n\t\t * unlabled arguments.\n\t\t * \\param i - Pointer the the current argument in the list.\n\t\t * \\param args - Mutable list of strings. \n\t\t */\n\t\tvirtual bool processArg(int* i, std::vector<std::string>& args); \n\n\t\t/**\n\t\t * Overrides shortID for specific behavior.\n\t\t */\n\t\tvirtual std::string shortID(const std::string& val=\"val\") const;\n\n\t\t/**\n\t\t * Overrides longID for specific behavior.\n\t\t */\n\t\tvirtual std::string longID(const std::string& val=\"val\") const;\n\n\t\t/**\n\t\t * Overrides operator== for specific behavior.\n\t\t */\n\t\tvirtual bool operator==(const Arg& a ) const;\n\n\t\t/**\n\t\t * Instead of pushing to the front of list, push to the back.\n\t\t * \\param argList - The list to add this to.\n\t\t */\n\t\tvirtual void addToList( std::list<Arg*>& argList ) const;\n\n};\n\n/**\n * Constructor implemenation.\n */\ntemplate<class T>\nUnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, \n\t\t\t\t\t                    const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    T val,\n\t\t\t\t\t                    const std::string& typeDesc,\n\t\t\t\t\t                    bool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: ValueArg<T>(\"\", name, desc, req, val, typeDesc, v)\n{ \n\t_ignoreable = ignoreable;\n\n\tOptionalUnlabeledTracker::check(req, toString());\n\n}\n\ntemplate<class T>\nUnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, \n\t\t\t\t\t                    const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    T val,\n\t\t\t\t\t                    const std::string& typeDesc,\n\t\t\t\t\t                    CmdLineInterface& parser,\n\t\t\t\t\t                    bool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: ValueArg<T>(\"\", name, desc, req, val, typeDesc, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(req, toString());\n\tparser.add( this );\n}\n\n/**\n * Constructor implemenation.\n */\ntemplate<class T>\nUnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, \n                                        const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n                                        T val,\n                                        Constraint<T>* constraint,\n                                        bool ignoreable,\n                                        Visitor* v)\n: ValueArg<T>(\"\", name, desc, req, val, constraint, v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(req, toString());\n}\n\ntemplate<class T>\nUnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, \n\t\t\t\t\t                    const std::string& desc, \n\t\t\t\t\t\t\t\t\t\tbool req,\n\t\t\t\t\t                    T val,\n\t\t\t\t\t                    Constraint<T>* constraint,\n\t\t\t\t\t                    CmdLineInterface& parser,\n\t\t\t\t\t                    bool ignoreable,\n\t\t\t\t\t                    Visitor* v)\n: ValueArg<T>(\"\", name, desc, req, val, constraint,  v)\n{ \n\t_ignoreable = ignoreable;\n\tOptionalUnlabeledTracker::check(req, toString());\n\tparser.add( this );\n}\n\n/**\n * Implementation of processArg().\n */\ntemplate<class T>\nbool UnlabeledValueArg<T>::processArg(int *i, std::vector<std::string>& args) \n{\n\t\n\tif ( _alreadySet )\n\t\treturn false;\n\t\n\tif ( _hasBlanks( args[*i] ) )\n\t\treturn false;\n\n\t// never ignore an unlabeled arg\n\t\n\t_extractValue( args[*i] );\n\t_alreadySet = true;\n\treturn true;\n}\n\n/**\n * Overriding shortID for specific output.\n */\ntemplate<class T>\nstd::string UnlabeledValueArg<T>::shortID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn std::string(\"<\") + _typeDesc + \">\";\n}\n\n/**\n * Overriding longID for specific output.\n */\ntemplate<class T>\nstd::string UnlabeledValueArg<T>::longID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\n\t// Ideally we would like to be able to use RTTI to return the name\n\t// of the type required for this argument.  However, g++ at least, \n\t// doesn't appear to return terribly useful \"names\" of the types.  \n\treturn std::string(\"<\") + _typeDesc + \">\";\n}\n\n/**\n * Overriding operator== for specific behavior.\n */\ntemplate<class T>\nbool UnlabeledValueArg<T>::operator==(const Arg& a ) const\n{\n\tif ( _name == a.getName() || _description == a.getDescription() )\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\ntemplate<class T>\nvoid UnlabeledValueArg<T>::addToList( std::list<Arg*>& argList ) const\n{\n\targList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );\n}\n\n}\n#endif\n"
  },
  {
    "path": "environment/tclap/ValueArg.h",
    "content": "/****************************************************************************** \n * \n *  file:  ValueArg.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_VALUE_ARGUMENT_H\n#define TCLAP_VALUE_ARGUMENT_H\n\n#include <string>\n#include <vector>\n\n#include <tclap/Arg.h>\n#include <tclap/Constraint.h>\n\nnamespace TCLAP {\n\n/**\n * The basic labeled argument that parses a value.\n * This is a template class, which means the type T defines the type\n * that a given object will attempt to parse when the flag/name is matched\n * on the command line.  While there is nothing stopping you from creating\n * an unflagged ValueArg, it is unwise and would cause significant problems.\n * Instead use an UnlabeledValueArg.\n */\ntemplate<class T>\nclass ValueArg : public Arg \n{\n    protected:\n\n        /**\n         * The value parsed from the command line.\n         * Can be of any type, as long as the >> operator for the type\n         * is defined.\n         */\n        T _value;\n\n\t\t/**\n\t\t * Used to support the reset() method so that ValueArg can be\n\t\t * reset to their constructed value.\n\t\t */\n        T _default;\n\n        /**\n         * A human readable description of the type to be parsed.\n         * This is a hack, plain and simple.  Ideally we would use RTTI to\n         * return the name of type T, but until there is some sort of\n         * consistent support for human readable names, we are left to our\n         * own devices.\n         */\n        std::string _typeDesc;\n\n        /**\n         * A Constraint this Arg must conform to. \n         */\n        Constraint<T>* _constraint;\n\n        /**\n         * Extracts the value from the string.\n         * Attempts to parse string as type T, if this fails an exception\n         * is thrown.\n         * \\param val - value to be parsed. \n         */\n        void _extractValue( const std::string& val );\n\n\tpublic:\n\n        /**\n         * Labeled ValueArg constructor.\n         * You could conceivably call this constructor with a blank flag, \n         * but that would make you a bad person.  It would also cause\n         * an exception to be thrown.   If you want an unlabeled argument, \n         * use the other constructor.\n         * \\param flag - The one character flag that identifies this\n         * argument on the command line.\n         * \\param name - A one word name for the argument.  Can be\n         * used as a long flag on the command line.\n         * \\param desc - A description of what the argument is for or\n         * does.\n         * \\param req - Whether the argument is required on the command\n         * line.\n         * \\param value - The default value assigned to this argument if it\n         * is not present on the command line.\n         * \\param typeDesc - A short, human readable description of the\n         * type that this object expects.  This is used in the generation\n         * of the USAGE statement.  The goal is to be helpful to the end user\n         * of the program.\n         * \\param v - An optional visitor.  You probably should not\n         * use this unless you have a very good reason.\n         */\n        ValueArg( const std::string& flag, \n                  const std::string& name, \n                  const std::string& desc, \n                  bool req, \n                  T value,\n                  const std::string& typeDesc,\n                  Visitor* v = NULL);\n\t\t\t\t \n\t\t\t\t \n        /**\n         * Labeled ValueArg constructor.\n         * You could conceivably call this constructor with a blank flag, \n         * but that would make you a bad person.  It would also cause\n         * an exception to be thrown.   If you want an unlabeled argument, \n         * use the other constructor.\n         * \\param flag - The one character flag that identifies this\n         * argument on the command line.\n         * \\param name - A one word name for the argument.  Can be\n         * used as a long flag on the command line.\n         * \\param desc - A description of what the argument is for or\n         * does.\n         * \\param req - Whether the argument is required on the command\n         * line.\n         * \\param value - The default value assigned to this argument if it\n         * is not present on the command line.\n         * \\param typeDesc - A short, human readable description of the\n         * type that this object expects.  This is used in the generation\n         * of the USAGE statement.  The goal is to be helpful to the end user\n         * of the program.\n         * \\param parser - A CmdLine parser object to add this Arg to\n         * \\param v - An optional visitor.  You probably should not\n         * use this unless you have a very good reason.\n         */\n        ValueArg( const std::string& flag, \n                  const std::string& name, \n                  const std::string& desc, \n                  bool req, \n                  T value,\n                  const std::string& typeDesc,\n                  CmdLineInterface& parser,\n                  Visitor* v = NULL );\n \n        /**\n         * Labeled ValueArg constructor.\n         * You could conceivably call this constructor with a blank flag, \n         * but that would make you a bad person.  It would also cause\n         * an exception to be thrown.   If you want an unlabeled argument, \n         * use the other constructor.\n         * \\param flag - The one character flag that identifies this\n         * argument on the command line.\n         * \\param name - A one word name for the argument.  Can be\n         * used as a long flag on the command line.\n         * \\param desc - A description of what the argument is for or\n         * does.\n         * \\param req - Whether the argument is required on the command\n         * line.\n         * \\param value - The default value assigned to this argument if it\n         * is not present on the command line.\n         * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n         * \\param parser - A CmdLine parser object to add this Arg to.\n         * \\param v - An optional visitor.  You probably should not\n         * use this unless you have a very good reason.\n         */\n        ValueArg( const std::string& flag, \n                  const std::string& name, \n                  const std::string& desc, \n                  bool req, \n                  T value,\n                  Constraint<T>* constraint,\n                  CmdLineInterface& parser,\n                  Visitor* v = NULL );\n\t  \n        /**\n         * Labeled ValueArg constructor.\n         * You could conceivably call this constructor with a blank flag, \n         * but that would make you a bad person.  It would also cause\n         * an exception to be thrown.   If you want an unlabeled argument, \n         * use the other constructor.\n         * \\param flag - The one character flag that identifies this\n         * argument on the command line.\n         * \\param name - A one word name for the argument.  Can be\n         * used as a long flag on the command line.\n         * \\param desc - A description of what the argument is for or\n         * does.\n         * \\param req - Whether the argument is required on the command\n         * line.\n         * \\param value - The default value assigned to this argument if it\n         * is not present on the command line.\n         * \\param constraint - A pointer to a Constraint object used\n\t\t * to constrain this Arg.\n         * \\param v - An optional visitor.  You probably should not\n         * use this unless you have a very good reason.\n         */\n        ValueArg( const std::string& flag, \n                  const std::string& name, \n                  const std::string& desc, \n                  bool req, \n                  T value,\n                  Constraint<T>* constraint,\n                  Visitor* v = NULL );\n\n        /**\n         * Handles the processing of the argument.\n         * This re-implements the Arg version of this method to set the\n         * _value of the argument appropriately.  It knows the difference\n         * between labeled and unlabeled.\n         * \\param i - Pointer the the current argument in the list.\n         * \\param args - Mutable list of strings. Passed \n         * in from main().\n         */\n        virtual bool processArg(int* i, std::vector<std::string>& args); \n\n        /**\n         * Returns the value of the argument.\n         */\n        T& getValue() ;\n\n        /**\n         * Specialization of shortID.\n         * \\param val - value to be used.\n         */\n        virtual std::string shortID(const std::string& val = \"val\") const;\n\n        /**\n         * Specialization of longID.\n         * \\param val - value to be used.\n         */\n        virtual std::string longID(const std::string& val = \"val\") const;\n        \n        virtual void reset() ;\n\nprivate:\n       /**\n        * Prevent accidental copying\n        */\n       ValueArg<T>(const ValueArg<T>& rhs);\n       ValueArg<T>& operator=(const ValueArg<T>& rhs);\n};\n\n\n/**\n * Constructor implementation.\n */\ntemplate<class T>\nValueArg<T>::ValueArg(const std::string& flag, \n                      const std::string& name, \n                      const std::string& desc, \n                      bool req, \n                      T val,\n                      const std::string& typeDesc,\n                      Visitor* v)\n: Arg(flag, name, desc, req, true, v),\n  _value( val ),\n  _default( val ),\n  _typeDesc( typeDesc ),\n  _constraint( NULL )\n{ }\n\ntemplate<class T>\nValueArg<T>::ValueArg(const std::string& flag, \n                      const std::string& name, \n                      const std::string& desc, \n                      bool req, \n                      T val,\n                      const std::string& typeDesc,\n                      CmdLineInterface& parser,\n                      Visitor* v)\n: Arg(flag, name, desc, req, true, v),\n  _value( val ),\n  _default( val ),\n  _typeDesc( typeDesc ),\n  _constraint( NULL )\n{ \n    parser.add( this );\n}\n\ntemplate<class T>\nValueArg<T>::ValueArg(const std::string& flag, \n                      const std::string& name, \n                      const std::string& desc, \n                      bool req, \n                      T val,\n                      Constraint<T>* constraint,\n                      Visitor* v)\n: Arg(flag, name, desc, req, true, v),\n  _value( val ),\n  _default( val ),\n  _typeDesc( constraint->shortID() ),\n  _constraint( constraint )\n{ }\n\ntemplate<class T>\nValueArg<T>::ValueArg(const std::string& flag, \n                      const std::string& name, \n                      const std::string& desc, \n                      bool req, \n                      T val,\n                      Constraint<T>* constraint,\n                      CmdLineInterface& parser,\n                      Visitor* v)\n: Arg(flag, name, desc, req, true, v),\n  _value( val ),\n  _default( val ),\n  _typeDesc( constraint->shortID() ),\n  _constraint( constraint )\n{ \n    parser.add( this );\n}\n\n\n/**\n * Implementation of getValue().\n */\ntemplate<class T>\nT& ValueArg<T>::getValue() { return _value; }\n\n/**\n * Implementation of processArg().\n */\ntemplate<class T>\nbool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)\n{\n    if ( _ignoreable && Arg::ignoreRest() )\n\t\treturn false;\n\n    if ( _hasBlanks( args[*i] ) )\n\t\treturn false;\n\n    std::string flag = args[*i];\n\n    std::string value = \"\";\n    trimFlag( flag, value );\n\n    if ( argMatches( flag ) )\n    {\n        if ( _alreadySet )\n\t\t{\n\t\t\tif ( _xorSet )\n\t\t\t\tthrow( CmdLineParseException(\n\t\t\t\t       \"Mutually exclusive argument already set!\", \n\t\t\t\t                             toString()) );\n\t\t\telse\n\t\t\t\tthrow( CmdLineParseException(\"Argument already set!\", \n\t\t\t\t                             toString()) );\n\t\t}\n\n        if ( Arg::delimiter() != ' ' && value == \"\" )\n\t\t\tthrow( ArgParseException( \n\t\t\t\t\t\t\t\"Couldn't find delimiter for this argument!\",\n                             toString() ) );\n\n        if ( value == \"\" )\n        {\n            (*i)++;\n            if ( static_cast<unsigned int>(*i) < args.size() ) \n\t\t\t\t_extractValue( args[*i] );\n            else\n\t\t\t\tthrow( ArgParseException(\"Missing a value for this argument!\",\n                                                    toString() ) );\n        }\n        else\n\t\t\t_extractValue( value );\n\t\t\t\t\n        _alreadySet = true;\n        _checkWithVisitor();\n        return true;\n    }\t\n    else\n\t\treturn false;\n}\n\n/**\n * Implementation of shortID.\n */\ntemplate<class T>\nstd::string ValueArg<T>::shortID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn Arg::shortID( _typeDesc ); \n}\n\n/**\n * Implementation of longID.\n */\ntemplate<class T>\nstd::string ValueArg<T>::longID(const std::string& val) const\n{\n\tstatic_cast<void>(val); // Ignore input, don't warn\n\treturn Arg::longID( _typeDesc ); \n}\n\ntemplate<class T>\nvoid ValueArg<T>::_extractValue( const std::string& val ) \n{\n    try {\n\tExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());\n    } catch( ArgParseException &e) {\n\tthrow ArgParseException(e.error(), toString());\n    }\n    \n    if ( _constraint != NULL )\n\tif ( ! _constraint->check( _value ) )\n\t    throw( CmdLineParseException( \"Value '\" + val + \n\t\t\t\t\t  + \"' does not meet constraint: \" \n\t\t\t\t\t  + _constraint->description(),\n\t\t\t\t\t  toString() ) );\n}\n\ntemplate<class T>\nvoid ValueArg<T>::reset()\n{\n\tArg::reset();\n\t_value = _default;\n}\n\n} // namespace TCLAP\n\n#endif\n"
  },
  {
    "path": "environment/tclap/ValuesConstraint.h",
    "content": "\n\n/****************************************************************************** \n * \n *  file:  ValuesConstraint.h\n * \n *  Copyright (c) 2005, Michael E. Smoot\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_VALUESCONSTRAINT_H\n#define TCLAP_VALUESCONSTRAINT_H\n\n#include <string>\n#include <vector>\n#include <tclap/Constraint.h>\n\n#ifdef HAVE_CONFIG_H\n#include <config.h>\n#else\n#define HAVE_SSTREAM\n#endif\n\n#if defined(HAVE_SSTREAM)\n#include <sstream>\n#elif defined(HAVE_STRSTREAM)\n#include <strstream>\n#else\n#error \"Need a stringstream (sstream or strstream) to compile!\"\n#endif\n\nnamespace TCLAP {\n\n/**\n * A Constraint that constrains the Arg to only those values specified\n * in the constraint.\n */\ntemplate<class T>\nclass ValuesConstraint : public Constraint<T>\n{\n\n\tpublic:\n\n\t\t/**\n\t\t * Constructor. \n\t\t * \\param allowed - vector of allowed values. \n\t\t */\n\t\tValuesConstraint(std::vector<T>& allowed);\t\n\n\t\t/**\n\t\t * Virtual destructor.\n\t\t */\n\t\tvirtual ~ValuesConstraint() {}\n\n\t\t/**\n\t\t * Returns a description of the Constraint. \n\t\t */\n\t\tvirtual std::string description() const;\n\n\t\t/**\n\t\t * Returns the short ID for the Constraint.\n\t\t */\n\t\tvirtual std::string shortID() const;\n\n\t\t/**\n\t\t * The method used to verify that the value parsed from the command\n\t\t * line meets the constraint.\n\t\t * \\param value - The value that will be checked. \n\t\t */\n\t\tvirtual bool check(const T& value) const;\n\t\n\tprotected:\n\n\t\t/**\n\t\t * The list of valid values. \n\t\t */\n\t\tstd::vector<T> _allowed;\n\n\t\t/**\n\t\t * The string used to describe the allowed values of this constraint.\n\t\t */\n\t\tstd::string _typeDesc;\n\n};\n\ntemplate<class T>\nValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)\n: _allowed(allowed),\n  _typeDesc(\"\")\n{ \n    for ( unsigned int i = 0; i < _allowed.size(); i++ )\n    {\n\n#if defined(HAVE_SSTREAM)\n        std::ostringstream os;\n#elif defined(HAVE_STRSTREAM)\n        std::ostrstream os;\n#else\n#error \"Need a stringstream (sstream or strstream) to compile!\"\n#endif\n\n        os << _allowed[i];\n\n        std::string temp( os.str() ); \n\n        if ( i > 0 )\n\t\t\t_typeDesc += \"|\";\n        _typeDesc += temp;\n    }\n}\n\ntemplate<class T>\nbool ValuesConstraint<T>::check( const T& val ) const\n{\n\tif ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )\n\t\treturn false;\n\telse \n\t\treturn true;\n}\n\ntemplate<class T>\nstd::string ValuesConstraint<T>::shortID() const\n{\n    return _typeDesc;\t\n}\n\ntemplate<class T>\nstd::string ValuesConstraint<T>::description() const\n{\n    return _typeDesc;\t\n}\n\n\n} //namespace TCLAP\n#endif \n\n"
  },
  {
    "path": "environment/tclap/VersionVisitor.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/****************************************************************************** \n * \n *  file:  VersionVisitor.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_VERSION_VISITOR_H\n#define TCLAP_VERSION_VISITOR_H\n\n#include <tclap/CmdLineInterface.h>\n#include <tclap/CmdLineOutput.h>\n#include <tclap/Visitor.h>\n\nnamespace TCLAP {\n\n/**\n * A Vistor that will call the version method of the given CmdLineOutput\n * for the specified CmdLine object and then exit.\n */\nclass VersionVisitor: public Visitor\n{\n\tprivate:\n\t\t/**\n\t\t * Prevent accidental copying\n\t\t */\n\t\tVersionVisitor(const VersionVisitor& rhs);\n\t\tVersionVisitor& operator=(const VersionVisitor& rhs);\n\n\tprotected:\n\n\t\t/**\n\t\t * The CmdLine of interest.\n\t\t */\n\t\tCmdLineInterface* _cmd;\n\n\t\t/**\n\t\t * The output object. \n\t\t */\n\t\tCmdLineOutput** _out;\n\n\tpublic:\n\n\t\t/**\n\t\t * Constructor.\n\t\t * \\param cmd - The CmdLine the output is generated for. \n\t\t * \\param out - The type of output. \n\t\t */\n\t\tVersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) \n\t\t\t\t: Visitor(), _cmd( cmd ), _out( out ) { }\n\n\t\t/**\n\t\t * Calls the version method of the output object using the\n\t\t * specified CmdLine.\n\t\t */\n\t\tvoid visit() { \n\t\t    (*_out)->version(*_cmd); \n\t\t    throw ExitException(0); \n\t\t}\n\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "environment/tclap/Visitor.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  Visitor.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n\n#ifndef TCLAP_VISITOR_H\n#define TCLAP_VISITOR_H\n\nnamespace TCLAP {\n\n/**\n * A base class that defines the interface for visitors.\n */\nclass Visitor\n{\n\tpublic:\n\n\t\t/**\n\t\t * Constructor. Does nothing.\n\t\t */\n\t\tVisitor() { }\n\n\t\t/**\n\t\t * Destructor. Does nothing.\n\t\t */\n\t\tvirtual ~Visitor() { }\n\n\t\t/**\n\t\t * Does nothing. Should be overridden by child.\n\t\t */\n\t\tvirtual void visit() { }\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "environment/tclap/XorHandler.h",
    "content": "\n/****************************************************************************** \n * \n *  file:  XorHandler.h\n * \n *  Copyright (c) 2003, Michael E. Smoot .\n *  Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.  \n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_XORHANDLER_H\n#define TCLAP_XORHANDLER_H\n\n#include <tclap/Arg.h>\n#include <string>\n#include <vector>\n#include <algorithm>\n#include <iostream>\n\nnamespace TCLAP {\n\n/**\n * This class handles lists of Arg's that are to be XOR'd on the command\n * line.  This is used by CmdLine and you shouldn't ever use it.\n */\nclass XorHandler\n{\n\tprotected:\n\n\t\t/**\n\t\t * The list of of lists of Arg's to be or'd together.\n\t\t */\n\t\tstd::vector< std::vector<Arg*> > _orList;\n\n\tpublic:\n\n\t\t/**\n\t\t * Constructor.  Does nothing.\n\t\t */\n\t\tXorHandler( ) : _orList(std::vector< std::vector<Arg*> >()) {}\n\n\t\t/**\n\t\t * Add a list of Arg*'s that will be orred together.\n\t\t * \\param ors - list of Arg* that will be xor'd.\n\t\t */\n\t\tvoid add( std::vector<Arg*>& ors );\n\t\t\t\n\t\t/**\n\t\t * Checks whether the specified Arg is in one of the xor lists and\n\t\t * if it does match one, returns the size of the xor list that the\n\t\t * Arg matched.  If the Arg matches, then it also sets the rest of\n\t\t * the Arg's in the list. You shouldn't use this.  \n\t\t * \\param a - The Arg to be checked.\n\t\t */\n\t\tint check( const Arg* a );\n\n\t\t/**\n\t\t * Returns the XOR specific short usage.\n\t\t */\n\t\tstd::string shortUsage();\n\n\t\t/**\n\t\t * Prints the XOR specific long usage.\n\t\t * \\param os - Stream to print to.\n\t\t */\n\t\tvoid printLongUsage(std::ostream& os);\n\n\t\t/**\n\t\t * Simply checks whether the Arg is contained in one of the arg\n\t\t * lists.\n\t\t * \\param a - The Arg to be checked.\n\t\t */\n\t\tbool contains( const Arg* a );\n\n\t\tstd::vector< std::vector<Arg*> >& getXorList(); \n\n};\n\n\n//////////////////////////////////////////////////////////////////////\n//BEGIN XOR.cpp\n//////////////////////////////////////////////////////////////////////\ninline void XorHandler::add( std::vector<Arg*>& ors )\n{ \n\t_orList.push_back( ors );\n}\n\ninline int XorHandler::check( const Arg* a ) \n{\n\t// iterate over each XOR list\n\tfor ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )\n\t{\n\t\t// if the XOR list contains the arg..\n\t\tArgVectorIterator ait = std::find( _orList[i].begin(), \n\t\t                                   _orList[i].end(), a );\n\t\tif ( ait != _orList[i].end() )\n\t\t{\n\t\t\t// first check to see if a mutually exclusive switch\n\t\t\t// has not already been set\n\t\t\tfor ( ArgVectorIterator it = _orList[i].begin(); \n\t\t\t\t  it != _orList[i].end(); \n\t\t\t\t  it++ )\n\t\t\t\tif ( a != (*it) && (*it)->isSet() )\n\t\t\t\t\tthrow(CmdLineParseException(\n\t\t\t\t\t      \"Mutually exclusive argument already set!\",\n\t\t\t\t\t      (*it)->toString()));\n\n\t\t\t// go through and set each arg that is not a\n\t\t\tfor ( ArgVectorIterator it = _orList[i].begin(); \n\t\t\t\t  it != _orList[i].end(); \n\t\t\t\t  it++ )\n\t\t\t\tif ( a != (*it) )\n\t\t\t\t\t(*it)->xorSet();\n\n\t\t\t// return the number of required args that have now been set\n\t\t\tif ( (*ait)->allowMore() )\n\t\t\t\treturn 0;\n\t\t\telse\n\t\t\t\treturn static_cast<int>(_orList[i].size());\n\t\t}\n\t}\n\n\tif ( a->isRequired() )\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\ninline bool XorHandler::contains( const Arg* a )\n{\n\tfor ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )\n\t\tfor ( ArgVectorIterator it = _orList[i].begin(); \n\t\t\t  it != _orList[i].end(); \n\t\t\t  it++ )\t\n\t\t\tif ( a == (*it) )\n\t\t\t\treturn true;\n\n\treturn false;\n}\n\ninline std::vector< std::vector<Arg*> >& XorHandler::getXorList() \n{\n\treturn _orList;\n}\n\n\n\n//////////////////////////////////////////////////////////////////////\n//END XOR.cpp\n//////////////////////////////////////////////////////////////////////\n\n} //namespace TCLAP\n\n#endif \n"
  },
  {
    "path": "environment/tclap/ZshCompletionOutput.h",
    "content": "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n/****************************************************************************** \n * \n *  file:  ZshCompletionOutput.h\n * \n *  Copyright (c) 2006, Oliver Kiddle\n *  All rights reverved.\n * \n *  See the file COPYING in the top directory of this distribution for\n *  more information.\n *  \n *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS \n *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL \n *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n *  DEALINGS IN THE SOFTWARE.\n *  \n *****************************************************************************/ \n\n#ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H\n#define TCLAP_ZSHCOMPLETIONOUTPUT_H\n\n#include <string>\n#include <vector>\n#include <list>\n#include <iostream>\n#include <map>\n\n#include <tclap/CmdLineInterface.h>\n#include <tclap/CmdLineOutput.h>\n#include <tclap/XorHandler.h>\n#include <tclap/Arg.h>\n\nnamespace TCLAP {\n\n/**\n * A class that generates a Zsh completion function as output from the usage()\n * method for the given CmdLine and its Args.\n */\nclass ZshCompletionOutput : public CmdLineOutput\n{\n\n\tpublic:\n\n\t\tZshCompletionOutput();\n\n\t\t/**\n\t\t * Prints the usage to stdout.  Can be overridden to \n\t\t * produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void usage(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints the version to stdout. Can be overridden \n\t\t * to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t */\n\t\tvirtual void version(CmdLineInterface& c);\n\n\t\t/**\n\t\t * Prints (to stderr) an error message, short usage \n\t\t * Can be overridden to produce alternative behavior.\n\t\t * \\param c - The CmdLine object the output is generated for. \n\t\t * \\param e - The ArgException that caused the failure. \n\t\t */\n\t\tvirtual void failure(CmdLineInterface& c,\n\t\t\t\t\t\t     ArgException& e );\n\n\tprotected:\n\n\t\tvoid basename( std::string& s );\n\t\tvoid quoteSpecialChars( std::string& s );\n\n\t\tstd::string getMutexList( CmdLineInterface& _cmd, Arg* a );\n\t\tvoid printOption( Arg* it, std::string mutex );\n\t\tvoid printArg( Arg* it );\n\n\t\tstd::map<std::string, std::string> common;\n\t\tchar theDelimiter;\n};\n\nZshCompletionOutput::ZshCompletionOutput()\n: common(std::map<std::string, std::string>()),\n  theDelimiter('=')\n{\n\tcommon[\"host\"] = \"_hosts\";\n\tcommon[\"hostname\"] = \"_hosts\";\n\tcommon[\"file\"] = \"_files\";\n\tcommon[\"filename\"] = \"_files\";\n\tcommon[\"user\"] = \"_users\";\n\tcommon[\"username\"] = \"_users\";\n\tcommon[\"directory\"] = \"_directories\";\n\tcommon[\"path\"] = \"_directories\";\n\tcommon[\"url\"] = \"_urls\";\n}\n\ninline void ZshCompletionOutput::version(CmdLineInterface& _cmd)\n{\n\tstd::cout << _cmd.getVersion() << std::endl;\n}\n\ninline void ZshCompletionOutput::usage(CmdLineInterface& _cmd )\n{\n\tstd::list<Arg*> argList = _cmd.getArgList();\n\tstd::string progName = _cmd.getProgramName();\n\tstd::string xversion = _cmd.getVersion();\n\ttheDelimiter = _cmd.getDelimiter();\n\tbasename(progName);\n\n\tstd::cout << \"#compdef \" << progName << std::endl << std::endl <<\n\t\t\"# \" << progName << \" version \" << _cmd.getVersion() << std::endl << std::endl <<\n\t\t\"_arguments -s -S\";\n\n\tfor (ArgListIterator it = argList.begin(); it != argList.end(); it++)\n\t{\n\t\tif ( (*it)->shortID().at(0) == '<' )\n\t\t\tprintArg((*it));\n\t\telse if ( (*it)->getFlag() != \"-\" )\n\t\t\tprintOption((*it), getMutexList(_cmd, *it));\n\t}\n\n\tstd::cout << std::endl;\n}\n\ninline void ZshCompletionOutput::failure( CmdLineInterface& _cmd,\n\t\t\t\t                ArgException& e )\n{\n\tstatic_cast<void>(_cmd); // unused\n\tstd::cout << e.what() << std::endl;\n}\n\ninline void ZshCompletionOutput::quoteSpecialChars( std::string& s )\n{\n\tsize_t idx = s.find_last_of(':');\n\twhile ( idx != std::string::npos )\n\t{\n\t\ts.insert(idx, 1, '\\\\');\n\t\tidx = s.find_last_of(':', idx);\n\t}\n\tidx = s.find_last_of('\\'');\n\twhile ( idx != std::string::npos )\n\t{\n\t\ts.insert(idx, \"'\\\\'\");\n\t\tif (idx == 0)\n\t\t\tidx = std::string::npos;\n\t\telse\n\t\t\tidx = s.find_last_of('\\'', --idx);\n\t}\n}\n\ninline void ZshCompletionOutput::basename( std::string& s )\n{\n\tsize_t p = s.find_last_of('/');\n\tif ( p != std::string::npos )\n\t{\n\t\ts.erase(0, p + 1);\n\t}\n}\n\ninline void ZshCompletionOutput::printArg(Arg* a)\n{\n\tstatic int count = 1;\n\n\tstd::cout << \" \\\\\" << std::endl << \"  '\";\n\tif ( a->acceptsMultipleValues() )\n\t\tstd::cout << '*';\n\telse\n\t\tstd::cout << count++;\n\tstd::cout << ':';\n\tif ( !a->isRequired() )\n\t\tstd::cout << ':';\n\n\tstd::cout << a->getName() << ':';\n\tstd::map<std::string, std::string>::iterator compArg = common.find(a->getName());\n\tif ( compArg != common.end() )\n\t{\n\t\tstd::cout << compArg->second;\n\t}\n\telse\n\t{\n\t\tstd::cout << \"_guard \\\"^-*\\\" \" << a->getName();\n\t}\n\tstd::cout << '\\'';\n}\n\ninline void ZshCompletionOutput::printOption(Arg* a, std::string mutex)\n{\n\tstd::string flag = a->flagStartChar() + a->getFlag();\n\tstd::string name = a->nameStartString() + a->getName();\n\tstd::string desc = a->getDescription();\n\n\t// remove full stop and capitalisation from description as\n\t// this is the convention for zsh function\n\tif (!desc.compare(0, 12, \"(required)  \"))\n\t{\n\t\tdesc.erase(0, 12);\n\t}\n\tif (!desc.compare(0, 15, \"(OR required)  \"))\n\t{\n\t\tdesc.erase(0, 15);\n\t}\n\tsize_t len = desc.length();\n\tif (len && desc.at(--len) == '.')\n\t{\n\t\tdesc.erase(len);\n\t}\n\tif (len)\n\t{\n\t\tdesc.replace(0, 1, 1, tolower(desc.at(0)));\n\t}\n\n\tstd::cout << \" \\\\\" << std::endl << \"  '\" << mutex;\n\n\tif ( a->getFlag().empty() )\n\t{\n\t\tstd::cout << name;\n\t}\n\telse\n\t{\n\t\tstd::cout << \"'{\" << flag << ',' << name << \"}'\";\n\t}\n\tif ( theDelimiter == '=' && a->isValueRequired() )\n\t\tstd::cout << \"=-\";\n\tquoteSpecialChars(desc);\n\tstd::cout << '[' << desc << ']';\n\n\tif ( a->isValueRequired() )\n\t{\n\t\tstd::string arg = a->shortID();\n\t\targ.erase(0, arg.find_last_of(theDelimiter) + 1);\n\t\tif ( arg.at(arg.length()-1) == ']' )\n\t\t\targ.erase(arg.length()-1);\n\t\tif ( arg.at(arg.length()-1) == ']' )\n\t\t{\n\t\t\targ.erase(arg.length()-1);\n\t\t}\n\t\tif ( arg.at(0) == '<' )\n\t\t{\n\t\t\targ.erase(arg.length()-1);\n\t\t\targ.erase(0, 1);\n\t\t}\n\t\tsize_t p = arg.find('|');\n\t\tif ( p != std::string::npos )\n\t\t{\n\t\t\tdo\n\t\t\t{\n\t\t\t\targ.replace(p, 1, 1, ' ');\n\t\t\t}\n\t\t\twhile ( (p = arg.find_first_of('|', p)) != std::string::npos );\n\t\t\tquoteSpecialChars(arg);\n\t\t\tstd::cout << \": :(\" << arg << ')';\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstd::cout << ':' << arg;\n\t\t\tstd::map<std::string, std::string>::iterator compArg = common.find(arg);\n\t\t\tif ( compArg != common.end() )\n\t\t\t{\n\t\t\t\tstd::cout << ':' << compArg->second;\n\t\t\t}\n\t\t}\n\t}\n\n\tstd::cout << '\\'';\n}\n\ninline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a)\n{\n\tXorHandler xorHandler = _cmd.getXorHandler();\n\tstd::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();\n\t\n\tif (a->getName() == \"help\" || a->getName() == \"version\")\n\t{\n\t\treturn \"(-)\";\n\t}\n\n\tstd::ostringstream list;\n\tif ( a->acceptsMultipleValues() )\n\t{\n\t\tlist << '*';\n\t}\n\n\tfor ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )\n\t{\n\t\tfor ( ArgVectorIterator it = xorList[i].begin();\n\t\t\tit != xorList[i].end();\n\t\t\tit++)\n\t\tif ( a == (*it) )\n\t\t{\n\t\t\tlist << '(';\n\t\t\tfor ( ArgVectorIterator iu = xorList[i].begin();\n\t\t\t\tiu != xorList[i].end();\n\t\t\t\tiu++ )\n\t\t\t{\n\t\t\t\tbool notCur = (*iu) != a;\n\t\t\t\tbool hasFlag = !(*iu)->getFlag().empty();\n\t\t\t\tif ( iu != xorList[i].begin() && (notCur || hasFlag) )\n\t\t\t\t\tlist << ' ';\n\t\t\t\tif (hasFlag)\n\t\t\t\t\tlist << (*iu)->flagStartChar() << (*iu)->getFlag() << ' ';\n\t\t\t\tif ( notCur || hasFlag )\n\t\t\t\t\tlist << (*iu)->nameStartString() << (*iu)->getName();\n\t\t\t}\n\t\t\tlist << ')';\n\t\t\treturn list.str();\n\t\t}\n\t}\n\t\n\t// wasn't found in xor list\n\tif (!a->getFlag().empty()) {\n\t\tlist << \"(\" << a->flagStartChar() << a->getFlag() << ' ' <<\n\t\t\ta->nameStartString() << a->getName() << ')';\n\t}\n\t\n\treturn list.str();\n}\n\n} //namespace TCLAP\n#endif\n"
  },
  {
    "path": "tests/environment/Fail10Bot.py",
    "content": "from hlt import *\nfrom networking import *\n\n# Fails on turn 10.\n\nmyID, gameMap = getInit()\nsendInit(\"Fail10Bot\")\n\nturn = 1\nhasMultipleSquares = False;\nwhile True:\n    moves = []\n    gameMap = getFrame()\n    if turn == 10:\n        break\n    sendFrame(moves)\n    turn += 1"
  },
  {
    "path": "tests/environment/FailInitBot.py",
    "content": "from hlt import *\nfrom networking import *\n\n# Exits during initialization.\n\nmyID, gameMap = getInit()"
  },
  {
    "path": "tests/environment/ModBot.py",
    "content": "from hlt import *\nfrom networking import *\n\nmyID, gameMap = getInit()\nsendInit(\"ModBot\")\n\nturn = 1\nwhile True:\n    moves = []\n    gameMap = getFrame()\n\n    for y in range(gameMap.height):\n        for x in range(gameMap.width):\n            site = gameMap.getSite(Location(x, y))\n            if site.owner == myID:\n                direction = -1;\n                if site.strength < 5*  site.production:\n                    direction = STILL\n                else:\n                    for d in CARDINALS:\n                        if gameMap.getSite(Location(x, y), d).owner != myID:\n                            direction = d\n                            break\n                if direction == -1:\n                    if turn % 4 < 2:\n                        direction = NORTH if x % 2 == 1 else SOUTH\n                    else:\n                        direction = EAST if y % 2 == 1 else WEST\n                moves.append(Move(Location(x, y), direction))\n\n    sendFrame(moves)\n    turn += 1"
  },
  {
    "path": "tests/environment/Timeout10Bot.py",
    "content": "from hlt import *\nfrom networking import *\n\n# Times out on turn 10.\n\nmyID, gameMap = getInit()\nsendInit(\"Timeout10Bot\")\n\nturn = 1\nhasMultipleSquares = False;\nwhile True:\n    moves = []\n    gameMap = getFrame()\n    if turn == 10:\n        while(True):\n            pass\n    sendFrame(moves)\n    turn += 1\n"
  },
  {
    "path": "tests/environment/TimeoutInitBot.py",
    "content": "from hlt import *\nfrom networking import *\n\n# Times out during initialization.\n\nmyID, gameMap = getInit()\n\nwhile True:\n    pass"
  },
  {
    "path": "tests/environment/hlt.py",
    "content": "import random\nimport math\nimport copy\n\nSTILL = 0\nNORTH = 1\nEAST = 2\nSOUTH = 3\nWEST = 4\n\nDIRECTIONS = [a for a in range(0, 5)]\nCARDINALS = [a for a in range(1, 5)]\n\nATTACK = 0\nSTOP_ATTACK = 1\n\nclass Location:\n    def __init__(self, x=0, y=0):\n        self.x = x\n        self.y = y\nclass Site:\n    def __init__(self, owner=0, strength=0, production=0):\n        self.owner = owner\n        self.strength = strength\n        self.production = production\nclass Move:\n    def __init__(self, loc=0, direction=0):\n        self.loc = loc\n        self.direction = direction\n\nclass GameMap:\n    def __init__(self, width = 0, height = 0, numberOfPlayers = 0):\n        self.width = width\n        self.height = height\n        self.contents = []\n\n        for y in range(0, self.height):\n            row = []\n            for x in range(0, self.width):\n                row.append(Site(0, 0, 0))\n            self.contents.append(row)\n\n    def inBounds(self, l):\n        return l.x >= 0 and l.x < self.width and l.y >= 0 and l.y < self.height\n\n    def getDistance(self, l1, l2):\n        dx = math.abs(l1.x - l2.x)\n        dy = math.abs(l1.y - l2.y)\n        if dx > self.width / 2:\n            dx = self.width - dx\n        if dy > self.height / 2:\n            dy = self.height - dy\n        return dx + dy\n\n    def getAngle(self, l1, l2):\n        dx = l2.x - l1.x\n        dy = l2.y - l1.y\n\n        if dx > self.width - dx:\n            dx -= self.width\n        elif -dx > self.width + dx:\n            dx += self.width\n\n        if dy > self.height - dy:\n            dy -= self.height\n        elif -dy > self.height + dy:\n            dy += self.height\n        return math.atan2(dy, dx)\n\n    def getLocation(self, loc, direction):\n        l = copy.deepcopy(loc)\n        if direction != STILL:\n            if direction == NORTH:\n                if l.y == 0:\n                    l.y = self.height - 1\n                else:\n                    l.y -= 1\n            elif direction == EAST:\n                if l.x == self.width - 1:\n                    l.x = 0\n                else:\n                    l.x += 1\n            elif direction == SOUTH:\n                if l.y == self.height - 1:\n                    l.y = 0\n                else:\n                    l.y += 1\n            elif direction == WEST:\n                if l.x == 0:\n                    l.x = self.width - 1\n                else:\n                    l.x -= 1\n        return l\n    def getSite(self, l, direction = STILL):\n        l = self.getLocation(l, direction)\n        return self.contents[l.y][l.x]\n"
  },
  {
    "path": "tests/environment/networking.py",
    "content": "from hlt import *\nimport socket\nimport traceback\nimport struct\nfrom ctypes import *\nimport sys\n\n_productions = []\n_width = -1\n_height = -1\n\ndef serializeMoveSet(moves):\n    returnString = \"\"\n    for move in moves:\n        returnString += str(move.loc.x) + \" \" + str(move.loc.y) + \" \" + str(move.direction) + \" \"\n    return returnString\n\ndef deserializeMapSize(inputString):\n    splitString = inputString.split(\" \")\n\n    global _width, _height\n    _width = int(splitString.pop(0))\n    _height = int(splitString.pop(0))\n\ndef deserializeProductions(inputString):\n    splitString = inputString.split(\" \")\n\n    for a in range(0, _height):\n        row = []\n        for b in range(0, _width):\n            row.append(int(splitString.pop(0)))\n        _productions.append(row)\n\ndef deserializeMap(inputString):\n    splitString = inputString.split(\" \")\n\n    m = GameMap(_width, _height)\n\n    y = 0\n    x = 0\n    counter = 0\n    owner = 0\n    while y != m.height:\n        counter = int(splitString.pop(0))\n        owner = int(splitString.pop(0))\n        for a in range(0, counter):\n            m.contents[y][x].owner = owner\n            x += 1\n            if x == m.width:\n                x = 0\n                y += 1\n\n    for a in range(0, _height):\n        for b in range(0, _width):\n            m.contents[a][b].strength = int(splitString.pop(0))\n            m.contents[a][b].production = _productions[a][b]\n\n    return m\n\ndef sendString(toBeSent):\n    toBeSent += '\\n'\n\n    sys.stdout.write(toBeSent)\n    sys.stdout.flush()\n\ndef getString():\n    return sys.stdin.readline().rstrip('\\n')\n\ndef getInit():\n    playerTag = int(getString())\n    deserializeMapSize(getString())\n    deserializeProductions(getString())\n    m = deserializeMap(getString())\n\n    return (playerTag, m)\n\ndef sendInit(name):\n    sendString(name)\n\ndef getFrame():\n    return deserializeMap(getString())\n\ndef sendFrame(moves):\n    sendString(serializeMoveSet(moves))\n"
  },
  {
    "path": "tests/environment/testenv.py",
    "content": "import os\nimport subprocess\nimport sys\n\nmakeenvout = subprocess.Popen('cd ../../environment; make clean; make all', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8')\nif \"Error 1\" in makeenvout:\n    print('Environment build failed. Make output:\\n#######################################################')\n    print(makeenvout + '\\n#######################################################')\n    sys.exit(1)\nelse:\n    print('Environment build succeeded.')\n\n# Assume all is well.\nisGood = True\n\n# Build starter packages (where necessary)\nmakecppout = subprocess.Popen('cd ../../airesources/C++; g++ MyBot.cpp -std=c++11 -o MyBot', stderr=subprocess.PIPE, shell = True).stderr.read().decode('utf-8')\nif \"error\" in makecppout:\n    print('C++ starter package build failed. Build output:\\n#######################################################')\n    print(makecppout + '\\n#######################################################')\n    isGood = False\nelse:\n    print('C++ starter package build succeeded.')\nmakejavaout = subprocess.Popen('cd ../../airesources/Java; javac MyBot.java', stderr=subprocess.PIPE, shell = True).stderr.read().decode('utf-8')\nif \"error\" in makejavaout:\n    print('Java starter package build failed. Build output:\\n#######################################################')\n    print(makejavaout + '\\n#######################################################')\n    isGood = False\nelse:\n    print('Java starter package build succeeded.')\nmakerustout = subprocess.Popen('cd ../../airesources/Rust; cargo build --release', stderr=subprocess.PIPE, shell = True).stderr.read().decode('utf-8')\nif \"error\" in makerustout:\n    print('Rust starter package build failed. Build output:\\n#######################################################')\n    print(makerustout + '\\n#######################################################')\n    isGood = False\nelse:\n    print('Rust starter package build succeeded.')\n# Do scala eventually.\n\n# Ensures that the environment can run a basic game where a bot wins. Confirm that the bot expected to win does indeed win.\ngenlines = subprocess.Popen('../../environment/halite -d \"10 10\" -q \"python3 ModBot.py\" \"python3 ModBot.py\" -s 1001', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8').split('\\n')\nif genlines[-4].split()[1] != \"1\" or genlines[-3].split()[1] != \"2\" or genlines[-2] != \" \" or genlines[-1] != \" \":\n    print('General environment test failed. Environment output:\\n#######################################################')\n    print('\\n'.join(genlines) + '\\n#######################################################')\n    isGood = False\nelse:\n    print('General environment test succeeded.')\n\n# Ensures that the environment can run a basic game where a bot wins. Confirm that the bot expected to win does indeed win.\nsplines = subprocess.Popen('../../environment/halite -d \"10 10\" -q \"../../airesources/C++/MyBot\" \"java -cp ../../airesources/Java MyBot\" \"python3 ../../airesources/Python/MyBot.py\" \"../../airesources/Rust/target/release/MyBot\" -s 1000', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8').split('\\n')\nif splines[-2] != \" \" or splines[-1] != \" \":\n    print('Starter package test failed. Environment output:\\n#######################################################')\n    print('\\n'.join(splines) + '\\n#######################################################')\n    isGood = False\nelse:\n    print('Starter package test succeeded.')\n\nsplines = subprocess.Popen('cat *.log', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8').split('\\n')\nprint('\\n'.join(splines))\n\n# Ensures that tie evaluation is correct. Confirm that the bot expected to win does indeed win.\ntielines = subprocess.Popen('../../environment/halite -d \"10 10\" -q \"python3 ModBot.py\" \"python3 ModBot.py\" -s 998', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8').split('\\n')\nif tielines[-4].split()[1] != \"2\" or tielines[-3].split()[1] != \"1\" or tielines[-2] != \" \" or tielines[-1] != \" \":\n    print('Tie evaluation test failed. Environment output:\\n#######################################################')\n    print('\\n'.join(tielines) + '\\n#######################################################')\n    isGood = False\nelse:\n    print('Tie evaluation test succeeded.')\n\n# Ensures that all timeouts work well.\ntimelines = subprocess.Popen('../../environment/halite -d \"20 20\" -q \"python3 FailInitBot.py\" \"python3 TimeoutInitBot.py\" \"python3 Fail10Bot.py\" \"python3 Timeout10Bot.py\" \"python3 ModBot.py\" -s 998', stdout=subprocess.PIPE, shell = True).stdout.read().decode('utf-8').split('\\n')\nif timelines[-7].split()[1] != \"5\" or timelines[-6].split()[1] != \"4\" or timelines[-5].split()[1] != \"3\" or timelines[-4].split()[1] != \"2\" or timelines[-3].split()[1] != \"1\" or timelines[-2] != \"1 2 3 4 \":\n    print('Timeout evaluation test failed. Environment output:\\n#######################################################')\n    print('\\n'.join(timelines) + '\\n#######################################################')\n    isGood = False\nelse:\n    print('Timeout evaluation test succeeded.')\n\n# Output (in human form) the result of the tests.\nif(isGood):\n    print('All environment tests succeeded.')\nelse:\n    print('Environment tests failed.')\n\nsys.exit(1 - int(isGood))\n"
  },
  {
    "path": "tests/install.sh",
    "content": "add-apt-repository -y ppa:ubuntu-toolchain-r/test\napt-get update\n\n# Python\napt-get install -y python3\n\n# Java\napt-get install -y openjdk-8-jdk libjansi-java\n\n# Rust\ncurl -sSf https://static.rust-lang.org/rustup.sh | sh\n\n# C++\napt-get install -y g++-4.9\n\n# Scala\nwget www.scala-lang.org/files/archive/scala-2.10.4.deb\ndpkg -i scala-2.10.4.deb\napt-get update -y\napt-get install -y scala\nwget https://bintray.com/artifact/download/sbt/debian/sbt-0.13.6.deb\ndpkg -i sbt-0.13.6.deb\napt-get update -y\napt-get install -y sbt\n\n# Php unit\nwget https://phar.phpunit.de/phpunit-5.7.phar\nchmod +x phpunit-5.7.phar\nmv phpunit-5.7.phar /usr/local/bin/phpunit\n\n\nphp -v\nmysql -V\nphpunit --version\n\nupdate-alternatives --set java $(update-alternatives --list java | grep java-8-openjdk)\nupdate-alternatives --set javac $(update-alternatives --list javac | grep java-8-openjdk)\nupdate-alternatives --display java\nupdate-alternatives --display javac\njava -version\njavac -version\n"
  },
  {
    "path": "tests/runTests.sh",
    "content": "#!/bin/bash\nset -e\n\nfunction finish {\n    echo \"Cleaning up\"\n    cd $WORKINGDIR\n    if [ -e ../temp.ini ]\n        then cp temp.ini ../halite.ini;\n    fi\n}\ntrap finish EXIT\n\necho \"Setting up\"\nWORKINGDIR=$PWD\nif [ -e ../halite.ini ]\n    then cp ../halite.ini temp.ini;\nfi\ncp tests.ini ../halite.ini\npython3 setupMysql.py || python setupMysql.py\n\necho \"Website tests\"\nphpunit --stderr website/\n\necho \"Worker tests\"\ncd worker\npython3 testWorker.py\n\necho \"Environment tests\"\ncd ../environment\npython3 testenv.py \n"
  },
  {
    "path": "tests/scalabilityTests/main.py",
    "content": "import configparser\nimport pymysql\n\nimport string\nimport random\n\nfrom boto.s3.connection import S3Connection\nfrom boto.s3.key import Key\n\ndef createNewUser(db, cursor, accessKey, secretAccessKey, numUsers):\n    username = \"test_\" + \"\".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(5))\n    print(username)\n    cursor.execute(\"insert into User (username, email, organization, oauthID, oauthProvider, rank) values ('\"+username+\"', 'mntruell@gmail.com', 'Other', 4297743, 1, \"+str(numUsers)+\")\")\n    db.commit()\n    cursor.execute(\"select LAST_INSERT_ID()\")\n    userID = cursor.fetchone()[0]\n\n    s3Conn = S3Connection(accessKey, secretAccessKey)\n    compileBucket = s3Conn.get_bucket(\"halitecompilebucket\")\n    key = Key(compileBucket)\n    key.key = str(userID)\n    key.set_contents_from_string(open(\"BasicJavaBot.zip\", \"rb\").read())\n\n    cursor.execute(\"update User set compileStatus=1 where userID=\"+str(userID))\n    db.commit()\n\nparser = configparser.ConfigParser()\nparser.read(\"../../halite.ini\")\n\nDB_CONFIG = parser[\"database\"]\nHALITE_EMAIL = parser[\"email\"][\"email\"]\nHALITE_EMAIL_PASSWORD = parser[\"email\"][\"password\"]\n\ndb = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'])\ncursor = db.cursor()\n\ncursor.execute(\"select COUNT(*) from User where isRunning=1\")\nnumUsers = cursor.fetchone()[0]+1\nprint(numUsers)\n\nNUM_NEW_USERS = 2\nfor a in range(NUM_NEW_USERS):\n    createNewUser(db, cursor, parser[\"aws\"][\"accesskey\"], parser[\"aws\"][\"secretaccesskey\"], numUsers+a)\n\n"
  },
  {
    "path": "tests/setupMysql.py",
    "content": "import configparser\nimport os\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\n\npasswordField = \"\" if parser[\"database\"][\"password\"] == \"\" else \"-p\"+parser[\"database\"][\"password\"]\nos.system(\"mysql -u \"+parser[\"database\"][\"username\"]+\" \"+passwordField+\" < ../website/sql/schema.sql\")\n"
  },
  {
    "path": "tests/travisTests.ini",
    "content": "[test]\nisTest = 1\n\n[hce]\nmanagerURl = http://localhost/manager/\napiKey = 1234 \nsecretFolder = wrongFolder\n\n[email]\nemail = halite@halite.io\npassword = wrongPassword \n\n[database]\nhostname = 127.0.0.1\nusername = root\npassword =  \nname = Halite\n\n[sso]\nsecret = wrongSecret\nurl = http://forums.halite.io/session/sso_login\n\n[forums]\napiUsername = wrongUser\napiKey = 123456789\n\n[encrypt]\nsalt = wrongSalt\n"
  },
  {
    "path": "tests/website/APITest.php",
    "content": "<?php\ninclude_once \"../website/api/web/WebsiteAPI.php\";\n\nclass APITest extends PHPUnit_Framework_TestCase {\n    protected $mysqli;\n    protected $config;\n\n    protected function setUp() {\n        $this->config = parse_ini_file(\"../halite.ini\", true);\n        $this->mysqli = new mysqli($this->config['database']['hostname'],\n            $this->config['database']['username'],\n            $this->config['database']['password'],\n            $this->config['database']['name']);\n\n        if (mysqli_connect_errno()) {\n            echo \"<br><br>There seems to be a problem with our database. Reload the page or try again later.\";\n            exit();\n        }\n    }\n\n    protected function tearDown() {\n        $tables = array();\n        $res = $this->mysqli->query(\"SELECT TABLE_NAME FROM information_schema.tables where TABLE_SCHEMA='Halite'\");\n        while($row = $res->fetch_assoc()) array_push($tables, $row['TABLE_NAME']);\n\n        foreach($tables as $table) {\n            $this->mysqli->query(\"DELETE FROM \".$table);\n        }\n    }\n\n    protected function insertObject($table, $obj) {\n        $sql = \"INSERT INTO $table (\".implode(\",\", array_keys($obj)).\") VALUES ('\".implode(\"','\", array_values($obj)).\"')\";\n        $this->mysqli->query($sql);\n    }\n}\n\n?>\n"
  },
  {
    "path": "tests/website/GameTest.php",
    "content": "<?php\n\ninclude_once \"../website/api/web/WebsiteAPI.php\";\ninclude_once \"APITest.php\";\ninclude_once \"UserTest.php\";\n\ndefine(\"GAME_TABLE\", \"Game\");\ndefine(\"GAME_USER_TABLE\", \"GameUser\");\n\nconst TEST_GAME = array(\"gameID\" => \"1234\", \"replayName\" => \"sdkfjlad.hlt\", \"mapWidth\" => \"50\", \"mapHeight\" => \"50\");\nconst TEST_GAME_USER = array(\"gameID\" => \"1234\", \"errorLogName\" => \"asdfkjl.log\", \"rank\" => \"1\", \"userID\" => TEST_USER['userID']);\nclass GameTest extends APITest {\n    public function testGET() {\n        echo \"MADE IT\";\n        $this->insertObject(GAME_TABLE, TEST_GAME);\n        $this->insertObject(GAME_USER_TABLE, TEST_GAME_USER);\n        $this->insertObject(USER_TABLE, TEST_USER);\n\n        $_GET['userID'] = TEST_USER['userID'];\n        $_GET['startingID'] = 100000;\n        $_SERVER['REQUEST_METHOD'] = \"GET\";\n\n        $returnedGame = json_decode((new WebsiteAPI(\"game\"))->processAPI(), true)[0];\n\n        $idealUser = TEST_GAME_USER;\n        $idealUser[\"username\"] = TEST_USER['username'];\n        unset($idealUser[\"gameID\"]);\n\n        $idealGame = TEST_GAME;\n        $idealGame[\"users\"] = array($idealUser);\n\n        $this->assertArrayHasKey(\"timestamp\", $returnedGame);\n        $this->assertArraySubset($idealGame, $returnedGame);\n    }\n}\n?>\n"
  },
  {
    "path": "tests/website/HistoryTest.php",
    "content": "<?php\ninclude_once \"../website/api/web/WebsiteAPI.php\";\ninclude_once \"APITest.php\";\ninclude_once \"UserTest.php\";\n\ndefine(\"HISTORY_TABLE\", \"UserHistory\");\nconst TEST_USER_HISTORY = array(\"userID\" => \"123\", \"lastNumGames\" => \"100\", \"lastNumPlayers\" => \"20\", \"versionNumber\" => \"1\", \"lastRank\" => \"2\");\nclass HistoryTest extends APITest {\n    public function testGET() {\n        $this->insertObject(HISTORY_TABLE, TEST_USER_HISTORY);\n\n        $_GET['userID'] = TEST_USER_HISTORY['userID'];\n        $_SERVER['REQUEST_METHOD'] = \"POST\";\n\n        $returnedHistory = json_decode((new WebsiteAPI(\"history\"))->processAPI(), true)[0];\n\n        $this->assertArraySubset(TEST_USER_HISTORY, $returnedHistory);\n    }\n}\n?>\n"
  },
  {
    "path": "tests/website/UserTest.php",
    "content": "<?php\n\ninclude_once \"../website/api/web/WebsiteAPI.php\";\ninclude_once \"APITest.php\";\n\ndefine(\"USER_TABLE\", \"User\");\nconst TEST_USER = array(\"userID\" => \"124\", \"username\" => \"testUsername\", \"email\" => \"halite@halite.io\");\n\nclass UserTest extends APITest {\n    public function testGetUser() {\n        $this->insertObject(USER_TABLE, TEST_USER);\n\n        // Get with ID\n        $_GET['userID'] = TEST_USER[\"userID\"];\n        $_SERVER['REQUEST_METHOD'] = \"GET\";\n\n        $returnedUser = json_decode((new WebsiteAPI(\"user\"))->processAPI());\n        $this->assertEquals($returnedUser->username, TEST_USER['username']);\n\n        // Get with username\n        unset($_GET['userID']);\n        $_GET['username'] = TEST_USER['username'];\n\n        $returnedUser = json_decode((new WebsiteAPI(\"user\"))->processAPI());\n        $this->assertEquals($returnedUser->username, TEST_USER['username']);\n    }\n\n    public function testActive() {\n        $inactiveUser = TEST_USER;\n        $this->insertObject(USER_TABLE, $inactiveUser);\n\n        $activeUser = TEST_USER;\n        $activeUser[\"username\"] = \"ACTIVE USERNAME\";\n        $activeUser[\"userID\"] = \"478371\";\n        $this->insertObject(USER_TABLE, $activeUser);\n        $activeID = $activeUser['userID'];\n        $this->mysqli->query(\"UPDATE User SET isRunning=1 where userID=$activeID\");\n\n        $_GET['active'] = 1;\n        $_SERVER['REQUEST_METHOD'] = \"GET\";\n        $returnedUsers = json_decode((new WebsiteAPI(\"user\"))->processAPI());\n\n        $this->assertEquals(count($returnedUsers), 1);\n\n        $returnedActiveUser = $returnedUsers[0];\n        $this->assertEquals($returnedActiveUser->username, $activeUser['username']);\n    }\n}\n\n?>\n"
  },
  {
    "path": "tests/website/testFile.txt",
    "content": ""
  },
  {
    "path": "tests/worker/languageBot/LANGUAGE",
    "content": "TestLanguage\n"
  },
  {
    "path": "tests/worker/languageBot/run.sh",
    "content": "#Python\npython3 MyBot.py\n"
  },
  {
    "path": "tests/worker/loseBot/MyBot.py",
    "content": "import hlt\nfrom hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square\nimport random\n\n\nmyID, game_map = hlt.get_init()\nhlt.send_init(\"MyPythonBot\")\n\nwhile True:\n    game_map.get_frame()\n    moves = [Move(square, random.choice((NORTH, EAST, SOUTH, WEST, STILL))) for square in game_map if square.owner == myID]\n    hlt.send_frame(moves)\n"
  },
  {
    "path": "tests/worker/loseBot/run.sh",
    "content": "python3 MyBot.py\n"
  },
  {
    "path": "tests/worker/testWorker.py",
    "content": "import unittest\nimport sys\nimport os\nimport glob\nimport zipfile\nimport shutil\n\nWORKER_PATH = os.path.join(os.getcwd(), '..', '..', 'worker')\nOUR_PATH = os.getcwd()\n\nsys.path.append(WORKER_PATH)\nos.chdir(WORKER_PATH)\nprint(os.listdir(os.getcwd()))\nimport compiler\nimport archive\nimport worker\nos.chdir(OUR_PATH)\n\nclass CompilerTests(unittest.TestCase):\n    def testStarterPackages(self):\n        '''Archive the starter packages like the website would'''\n        SP_DIR = \"starterpackages\"\n        if os.path.isdir(SP_DIR):\n            shutil.rmtree(SP_DIR)\n        os.system(\"cd ../../website/; ./archiveStarterPackages.sh\");\n        shutil.copytree(\"../../website/downloads/starterpackages/\", SP_DIR)\n        for f in glob.glob(os.path.join(SP_DIR, \"*.zip\")):\n            zip_ref = zipfile.ZipFile(f, 'r')\n            zip_ref.extractall(SP_DIR)\n            zip_ref.close()\n\n            folderName = os.path.splitext(os.path.basename(f))[0]\n            folder = os.path.join(SP_DIR, os.path.splitext(os.path.basename(f))[0])\n            for filename in os.listdir(folder):\n                if os.path.splitext(filename)[0] == \"RandomBot\":\n                   os.remove(os.path.join(folder, filename))\n            expectedLanguage = folderName.split(\"-\")[1]\n            print(\"Expected Language: \" + expectedLanguage)\n            language, errors = compiler.compile_anything(folder)\n            if errors is not None: print(\"Errors: \" + \"\\n\".join(errors))\n            print(\"Language: \" + language)\n\n            assert language == expectedLanguage\n            assert errors == None\n\n    def testLanguageOverride(self):\n        '''Use a LANGUAGE file to override the detected language'''\n        LANGUAGE_BOT_PATH = \"languageBot\"\n\n        bot_dir = os.path.join(OUR_PATH, LANGUAGE_BOT_PATH)\n        expectedLanguage = \"TestLanguage\"\n\n        language, errors = compiler.compile_anything(bot_dir)\n        if errors is not None: print(\"Errors: \" + \"\\n\".join(errors))\n        print(\"Language: \" + language)\n\n        assert language == expectedLanguage\n        assert errors == None\n\nclass GameTests(unittest.TestCase):\n    def testNormalGame(self):\n        '''Test the parsing of the output of runGame.sh'''\n        WIN_BOT_PATH = \"winBot\"\n        LOSE_BOT_PATH = \"loseBot\"\n\n        if os.path.isdir(os.path.join(WORKER_PATH, WIN_BOT_PATH)):\n            shutil.rmtree(os.path.join(WORKER_PATH, WIN_BOT_PATH))\n        if os.path.isdir(os.path.join(WORKER_PATH, LOSE_BOT_PATH)):\n            shutil.rmtree(os.path.join(WORKER_PATH, LOSE_BOT_PATH))\n\n        shutil.copytree(os.path.join(OUR_PATH, WIN_BOT_PATH), os.path.join(WORKER_PATH, WIN_BOT_PATH))\n        shutil.copytree(os.path.join(OUR_PATH, LOSE_BOT_PATH), os.path.join(WORKER_PATH, LOSE_BOT_PATH))\n        os.chdir(WORKER_PATH)\n        output = worker.runGame(20, 20, [{\"userID\": WIN_BOT_PATH, \"username\": WIN_BOT_PATH, \"numSubmissions\": \"1\"}, {\"userID\": LOSE_BOT_PATH, \"username\": LOSE_BOT_PATH, \"numSubmissions\": \"1\"}])\n        os.chdir(OUR_PATH)\n\n        assert int(output[len(output)-4].split(\" \")[1]) == 1\n        assert int(output[len(output)-3].split(\" \")[1]) == 2\n\n    def testParsing(self):\n        '''Test the parsing of the output of runGame.sh'''\n        MAP_SIZE = (35, 35)\n        REPLAY_FILE = \"123456.hlt\"\n        SEED = 123\n        USERS = [{\"playerTag\": 1, \"rank\": 2, \"territoryAverage\": 0.5, \"strengthAverage\": 0.6, \"productionAverage\": 0.7, \"stillPercentage\": 0.8, \"turnTimeAverage\": 0.9, \"didTimeout\": True, \"errorLogName\": \"errorLog.log\"}, {\"playerTag\": 2, \"rank\": 1, \"territoryAverage\": 1.5, \"strengthAverage\": 1.6, \"productionAverage\": 1.7, \"stillPercentage\": 1.8, \"turnTimeAverage\": 1.9, \"didTimeout\": False, \"errorLogName\": None}]\n        ERROR_LOGS = [str(user['errorLogName']) for user in USERS if user[\"didTimeout\"] == True]\n\n        lines = [\"%d %d\" % MAP_SIZE]\n        lines += [\"./%s %d\" % (REPLAY_FILE, SEED)]\n        for user in USERS:\n            lines += [\"%d %d %f %f %f %f %f\" % (user['playerTag'], user['rank'], user['territoryAverage'], user['strengthAverage'], user['productionAverage'], user['stillPercentage'], user['turnTimeAverage'])]\n        lines += [str(user['playerTag']) for user in USERS if user[\"didTimeout\"] == True]\n        lines += ERROR_LOGS\n\n        outputWidth, outputHeight, outputUsers, outputReplay, outputErrorLogs = worker.parseGameOutput(lines, USERS)\n        assert outputWidth == MAP_SIZE[0]\n        assert outputHeight == MAP_SIZE[1]\n        assert outputUsers == USERS\n        assert outputReplay == REPLAY_FILE\n        assert outputErrorLogs == ERROR_LOGS\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/worker/winBot/MyBot.py",
    "content": "import hlt\nfrom hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square\nimport random\n\n\nmyID, game_map = hlt.get_init()\nhlt.send_init(\"PythonBot\")\n\ndef assign_move(square):\n    for direction, neighbor in enumerate(game_map.neighbors(square)):\n        if neighbor.owner != myID and neighbor.strength < square.strength:\n            return Move(square, direction)\n\n    if square.strength < 5 * square.production:\n        return Move(square, STILL)\n    else:\n        return Move(square, random.choice((WEST, NORTH)))\n\n\nwhile True:\n    game_map.get_frame()\n    moves = [assign_move(square) for square in game_map if square.owner == myID]\n    hlt.send_frame(moves)\n"
  },
  {
    "path": "tests/worker/winBot/run.sh",
    "content": "python3 MyBot.py\n"
  },
  {
    "path": "visualizer/.editorconfig",
    "content": "root = true\n\n[*]\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[package.json]\nindent_style = space\nindent_size = 2\n"
  },
  {
    "path": "visualizer/.gitattributes",
    "content": "* text=auto\n"
  },
  {
    "path": "visualizer/index.html",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n    <title>Visualizer</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div id=\"container\" class=\"container\">\n        <div id=\"pageContent\" class=\"pageContent text-center\">\n            <div id=\"displayArea\" class=\"col-sm-12 text-center\">\n                <span class=\"glyphicon glyphicon-cloud-upload\" style=\"font-size: 10em;\"></span>\n                <h2 style=\"margin-top: 20px;\">Drop or upload a replay file here</h2>\n\n            </div>\n            <div id='fileSelect' class=\"col-sm-12 text-center\">\n                <label for=\"filePicker\" class=\"btn btn-primary\">Select File</label>\n                <input type=\"file\" id=\"filePicker\" accept=\".hlt\" style=\"display: none;\">\n            </div>\n        </div>\n    </div>\n    <script>window.$ = window.jQuery = require('./lib/jquery.min.js');</script>\n    <script>window._ = require('./lib/lodash.min.js');</script>\n    <script src=\"lib/bootstrap.min.js\"></script>\n    <script src=\"lib/seedrandom.min.js\"></script>\n    <script src=\"lib/pixi.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/parsereplay.js\"></script>\n    <script src=\"script/visualizer.js\"></script>\n    <script src=\"index.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "visualizer/index.js",
    "content": "$(function () {\n    const fs = require('fs');\n    var args = require('electron').remote.process.argv;\n    if (args.length > 2) {\n        fs.readFile(args[2], 'utf-8', function (err, data) {\n            if(err){\n              alert(\"An error ocurred reading the file :\" + err.message);\n              return;\n            }\n            console.log(data);\n            $(\"label[for=filePicker]\").text(\"Select another file\");\n            var fsHeight = $(\"#fileSelect\").outerHeight();\n            showGame(textToGame(data, args[2]), $(\"#displayArea\"), null, -fsHeight, true, false, true);\n        });\n    }\n\n    var $dropZone = $(\"html\");\n    var $filePicker = $(\"#filePicker\");\n    function handleFiles(files) {\n        // only use the first file.\n        file = files[0];\n        console.log(file)\n        var reader = new FileReader();\n\n        reader.onload = (function(filename) { // finished reading file data.\n            return function(e2) {\n                $(\"#displayArea\").empty();\n                $(\"label[for=filePicker]\").text(\"Select another file\");\n                var fsHeight = $(\"#fileSelect\").outerHeight();\n                showGame(textToGame(e2.target.result, filename), $(\"#displayArea\"), null, -fsHeight, true, false, true);\n            };\n        })(file.name);\n        reader.readAsText(file); // start reading the file data.\n    }\n\n    $dropZone.on('dragover', function(e) {\n        e.stopPropagation();\n        e.preventDefault();\n    });\n    $dropZone.on('drop', function(e) {\n        e.stopPropagation();\n        e.preventDefault();\n        var files = e.originalEvent.dataTransfer.files; // Array of all files\n        handleFiles(files)\n    });\n    $filePicker.on('change', function(e) {\n        var files = e.target.files\n        handleFiles(files)\n    });\n})\n"
  },
  {
    "path": "visualizer/main.js",
    "content": "'use strict';\nconst electron = require('electron');\nconst fs = require('fs');\n\nconst app = electron.app;\n\n// adds debug features like hotkeys for triggering dev tools and reload\n// require('electron-debug')();\n\n// prevent window being garbage collected\nlet mainWindow;\n\nfunction onClosed() {\n    // dereference the window\n    // for multiple windows store them in an array\n    mainWindow = null;\n}\n\nfunction createMainWindow() {\n    const win = new electron.BrowserWindow({\n        width: 1200,\n        height: 800\n    });\n\n    win.loadURL(`file://${__dirname}/index.html`);\n    win.on('closed', onClosed);\n\n    return win;\n}\n\napp.on('window-all-closed', () => {\n    if (process.platform !== 'darwin') {\n        app.quit();\n    }\n});\n\napp.on('activate', () => {\n    if (!mainWindow) {\n        mainWindow = createMainWindow();\n    }\n});\n\napp.on('ready', () => {\n    mainWindow = createMainWindow();\n});\n"
  },
  {
    "path": "visualizer/package.json",
    "content": "{\n  \"name\": \"hailte-visualizer\",\n  \"main\": \"main.js\",\n  \"productName\": \"Halite-Visualizer\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"license\": \"MIT\",\n  \"repository\": \"https://github.com/HaliteChallenge/Halite\",\n  \"author\": {\n    \"name\": \"Henry Wildermuth\",\n    \"email\": \"hmwildermuth@gmail.com\",\n    \"url\": \"https://github.com/FlyingGraysons\"\n  },\n  \"scripts\": {\n    \"test\": \"xo\",\n    \"start\": \"electron .\",\n    \"build\": \"mkdir -p downloads/ && cd downloads/ && electron-packager ../ --all --overwrite && for i in */; do zip -r \\\"${i%/}.zip\\\" \\\"$i\\\"; done\"\n  },\n  \"files\": [\n    \"main.js\",\n    \"index.html\",\n    \"./style/\",\n    \"./script/\",\n    \"./lib/\"\n  ],\n  \"keywords\": [\n    \"electron-app\",\n    \"electron\",\n    \"halite\"\n  ],\n  \"dependencies\": {\n    \"electron-debug\": \"^1.0.0\"\n  },\n  \"devDependencies\": {\n    \"devtron\": \"^1.1.0\",\n    \"electron\": \"^1.0.1\",\n    \"electron-packager\": \"^8.2.0\",\n    \"xo\": \"^0.16.0\"\n  },\n  \"xo\": {\n    \"esnext\": true,\n    \"envs\": [\n      \"node\",\n      \"browser\"\n    ]\n  }\n}\n"
  },
  {
    "path": "website/.htaccess",
    "content": "AddOutputFilterByType DEFLATE text/plain\nAddOutputFilterByType DEFLATE text/html\nAddOutputFilterByType DEFLATE text/xml\nAddOutputFilterByType DEFLATE text/css\nAddOutputFilterByType DEFLATE application/xml\nAddOutputFilterByType DEFLATE application/xhtml+xml\nAddOutputFilterByType DEFLATE application/rss+xml\nAddOutputFilterByType DEFLATE application/javascript\nAddOutputFilterByType DEFLATE application/x-javascript\n\nErrorDocument 404 /404.php\n\n<IfModule mod_expires.c>\n    <FilesMatch \"\\.(jpg|jpeg|png|gif|js|css)$\">\n        ExpiresActive on\n        ExpiresDefault \"access plus 2 days\"\n    </FilesMatch>\n</IfModule>\n"
  },
  {
    "path": "website/404.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include __DIR__.'/includes/header.php'; ?>\n\n    <title>404</title>\n\n    <link href=\"/lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/style/general.css\" rel=\"stylesheet\">\n</head>\n\n<body>\n    <div class=\"container\">\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-12\">\n                    <h1>404 Error</h1>\n                    <h4>You might want to head back to the <a href=\"/index.php\">homepage</a>.</h4>\n                    <h4>The page you were looking for doesn't exist. If you think that there's a problem with our site, please email us at halite@halite.io or post on the <a href=\"http://2016.forums.halite.io\">forums</a>.</h4>\n                </div>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/about.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>About</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <div class=\"col-sm-12\">\n                <h1>About Halite</h1>\n\n                <p><a href=\"https://2016.halite.io/\">Halite</a> is a programming game where players build smart bots that battle head-to-head with the goal of taking over the largest share of a virtual grid. Bots use their strength to gain territory, and their territory to gain strength—outmaneuvering opponents based on the relative sophistication of their code.</p>\n\n                <p><i>The general who wins the battle makes many calculations in his temple before the battle is fought –Sun Tzu</i></p>\n\n                <p>Halite is designed for all levels of coding enthusiasts—from high school students to senior engineers. The simplest Halite bot requires only 10 lines of code, but bots can get ever more advanced. Players may find themselves surprised: we’ve learned from thousands of hours of gameplay that it’s not always the most complicated algorithm that wins. Creativity and insight are highly rewarded! So code well — a bot’s fate depends on it.</p>\n\n                <p>Halite was conceived of and developed by <a href=\"https://github.com/Sydriax\">Benjamin Spector</a> and <a href=\"https://github.com/truell20\">Michael Truell</a>. Ben largely wrote the game implementation and starter packages, while Michael was primarily responsible for the website and the competition backend infrastructure. After receiving positive feedback on the Halite, the pair continually revised the game, extended it into the cloud and developed additional execution, leaderboard, and web interface capabilities.</p>\n\n                <p><a href=\"https://www.twosigma.com/\">Two Sigma</a>, having had a history of playful programming challenges for its mathematical and software-oriented teams (e.g., see the <a href=\"https://www.youtube.com/watch?v=oxAPXN5UKa8\">Robotic Air Hockey Competition</a>) retained Ben and Michael as 2016 summer interns to further develop Halite and then run an internal Halite Challenge. The team incorporated feedback from many, and about thirty-five players competed in a successful 3-week tournament in August.</p>\n\n                <p>At the end of the tournament, however, the Halite bots were not happy with being cashiered, and the winning bot used its AI capabilities to influence its human friends. Swayed by the power of this bot’s logic, Two Sigma then decided to offer Halite to human and non-human coding enthusiasts worldwide for a one-time, three-month competition… fearing unintended consequences from a longer release.</p>\n\n                <p>To help productize and orchestrate the public launch, Two Sigma reached out to <a href=\"http://tech.cornell.edu/\">Cornell Tech</a>, a leader in graduate tech education. With a shared interest in encouraging programming, entrepreneurship, and growth of the thriving New York tech scene, the two partners initiated the public Halite competition in November 2016. Cornell Tech is providing ongoing game support and community management, and by working closely with the online gaming community, it will empower players to collaborate, learn and have fun.</p>\n\n                <p>Many have contributed to Halite beyond Ben’s and Michael’s invention and engineering; they include Jaques Clapauch, Eric Abrego, Matt Adereth, Trammel Hudson, Emily Malloy, Arnaud Sahuguet, and Scott Spinner. And, no doubt, much credit should also be provided to users who are sending questions and comments to the <a href=\"http://2016.forums.halite.io\">forums</a>.</p>\n\n                <p>May the best bot win!</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_command_line.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Halite Environment CLI</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Halite Environment CLI</h1>\n\n                <p>The Halite environment is responsible for running games between bots and outputting appropriate data and files upon the end of a game. The downloadable version is the same version used on the servers.</p>\n\n                <p>\n                    It may be passed a number of flags, including:\n                    <ul>\n                        <li><code>-d</code>: allows the automatic input of the dimensions of the map. The following argument is expected to be a string containing the width and height (space-separated).</li>\n                        <li><code>-t</code>: disables timeouts for the duration of the game.</li>\n                        <li><code>-q</code>: turns on quiet output. Output will take the form of:\n                            <ul>\n                                <li>Unless the <code>-o</code> option is also specified, lines with the command used to run each bot (one bot per line).</li>\n                                <li>A line showing the actual map size used.</li>\n                                <li>A line containing the replay file name, a space, and the map seed.</li>\n                                <li>For <code>n</code> players in the game, <code>n</code> lines like so: <code>playerID rank lastFrameAlive</code></li>\n                                <li>A line of space separated playerIDs of the players that timed out.</li>\n                                <li>A line of space separated timeout log filenames.</li>\n                            </ul>\n                        </li>\n                        <li><code>-s</code>: provides the seed to the map generator. If this is not provided, it will use a time-based seed.</li>\n                    </ul>\n                </p>\n\n                <h3>Examples</h3>\n                <p>To run your bot against itself on a 40 by 40 map with no timeouts, run: \n                    <ul>\n                        <li>Linux/macOS: <code>./halite -d “40 40” -t “python3 MyBot.py” “python3 MyBot.py”</code></li>\n                        <li>Windows: <code>.\\halite.exe -d “40 40” -t “python3 MyBot.py” “python3 MyBot.py”</code></li>\n                    </ul>\n                </p>\n\n\n                <p>To run your python bot against a java bot (assuming it’s been compiled) on a 25 by 25 map with a predefined seed (2168), run:\n                    <ul>\n                        <li>Linux/macOS: <code>./halite -d “25 25” -s 2168 “python3 PythonBot.py” “java JavaBot”</code></li>\n                        <li>Windows: <code>.\\halite.exe -d “25 25” -s 2168 “python3 PythonBot.py” “java JavaBot”</code></li>\n                    </ul>\n                </p>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_development.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Best Practices</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Best Practices</h1>\n                <p>In this guide, we will list a couple of simple, useful practices to follow when building your Halite bot.</p>\n                <h3>Using a Log File</h3>\n                <p>Stdout and stdin in are used to communicate with the game environment. As such, you cannot use functions like <code>System.out.println</code>, <code>print()</code>, or <code>std::cout</code>. Instead, print debugging information to a log file.</p>\n                <h3>Local Bot Evaluation</h3>\n                <p>Before submitting a new bot to the online leaderboard, we recommend running some games against the version of your bot that is currently on the leaderboard. If your new bot consistently wins, then put it up!</p>\n                <h3>Disabling the Timeout Flag</h3>\n                <p>When debugging latency issues with your bot, it can be helpful to disable game environment timeouts. To do so, append the <code>-t</code> flag to your environment command (e.g. <code>./environment -d \"30 30\" \"python3 MyBot.py\" \"python3 RandomBot.py\" -t</code>).</p>\n                <h3>Debugging with an IDE</h3>\n                <p>There is a community contributed method for running a Halite bot from a custom debugger locally. More on this can be found <a href=\"http://2016.forums.halite.io/t/running-your-halite-bot-from-a-debugger/70\">here on the forums</a>. </p>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_game_server.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Game Servers</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n\n                <h1>Game Servers</h1>\n\n                <h3>Hardware</h3>\n                <p>All compilation and game execution is done on AWS EC2 m3.medium servers running Ubuntu 16.04. They have the following specs:\n                    <ul>\n                        <li>3.5 GB of RAM</li>\n                        <li>~10 GB of disk space</li>\n                        <li>1 CPU</li>\n                    </ul>\n                </p>\n\n                <h3>Sandbox</h3>\n                <p>During compilation and games, players are run as unprivileged users in a sandbox which limits memory, processing power, execution time, disk space, and internet access. The sandbox is a docker container defined by this <a href=\"https://github.com/HaliteChallenge/Halite/blob/master/worker/Dockerfile\">Dockerfile</a>, running on top of Docker 1.6.2. If you think that there is an issue with the sandbox, please email us at <a href=\"mailto:halite@halite.io\">halite@halite.io</a></b>.\n\n                    <h3>Compilation</h3>\n                    <p>Bot compilation is done using <a href=\"https://github.com/HaliteChallenge/Halite/blob/master/worker/compiler.py\">this autocompile script</a>.</p>\n                    <p>To facilitate the installation of custom software, we allow users to include an install script. If a file named <code>install.sh</code> exists in your submission, it is run as a bash script under the root user in a sandbox with internet access and 10 minutes of runtime. Bots may only read and write to their current directory, so all files that you want to be available at runtime must be installed locally. For more on using 3rd party libraries, click <a href=\"advanced_libraries.php\">here</a>.</p>\n                    <p>\n                        Your main file must be called <code>MyBot</code>. Your language is recognized using the file extension of your <code>MyBot</code> file. The appropriate file extensions for each language are:\n                        <ul>\n                            <li>Java - .java</li>\n                            <li>Python - .py</li>\n                            <li>C++ - .cpp and .h(pp)</li>\n                            <li>C# - .cs</li>\n                            <li>Rust - .toml (for your Cargo.toml) and .rs (for your Rust source)</li>\n                            <li>Scala - .scala</li>\n                            <li>Ruby - .rb</li>\n                            <li>Go - .go</li>\n                            <li>PHP - .php</li>\n                            <li>JavaScript - .js</li>\n                            <li>OCaml - .ml</li>\n                            <li>Clojure - .clj</li>\n                            <li>C - .c</li>\n                            <li>Julia - .jl</li>\n                        </ul>\n                    </p>\n\n                    <p>\n                        The following compilers are used:\n                        <ul>\n                            <li>Java - javac 1.8.0_111</li>\n                            <li>C++ - g++ 4.8</li>\n                            <li>C# - mcs 4.6.1.0</li>\n                            <li>Rust - rustc 1.10.0</li>\n                            <li>Scala - scalac 2.10.4</li>\n                            <li>C - gcc 4.8</li>\n                        </ul>\n                    </p>\n\n                    <p>\n                        The following build automators are used:\n                        <ul>\n                            <li>Rust - cargo 0.11.0</li>\n                            <li>Clojure - lein 2.7.0</li>\n                        </ul>\n                    </p>\n\n                    <p>\n                        The following versions of each language are supported:\n                        <ul>\n                            <li>Java 8</li>\n                            <li>Python 3.4.3</li>\n                            <li>C++ 11</li>\n                            <li>C# 6.0</li>\n                            <li>Rust 1.10</li>\n                            <li>Scala 2.10.4</li>\n                            <li>Ruby 2.3.1</li>\n                            <li>Go 1.6</li>\n                            <li>PHP 7.0</li>\n                            <li>Node.js (JavaScript) 7.1.0</li>\n                            <li>OCaml 4.01.0</li>\n                            <li>Clojure 1.8.0</li>\n                            <li>Julia 0.5.0</li>\n                        </ul>\n                    </p>\n\n                    <h3>Games</h3>\n                    <p>Bots are given <b>250 MB of RAM</b> and <b>equal amounts of CPU</b>.</p>\n                    <p>Currently, 20x20, 25x25, 30x30, 35x35, 40x40, 45x45, and 50x50 games are run. Games may be 2-6 player.</p>\n                    <p>Games are always run using <a href=\"downloads.php\">the most recent environment build</a>.</p>\n                </p>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_libraries.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Submitting A Bot</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Submitting A Bot</h1>\n\n                <p>You submit a zip file containing your <code>MyBot</code> file and any other files needed to compile and run your <code>MyBot</code> file.</p>\n\n                <h3>Installing Dependencies</h3>\n\n                <p>Instead of packaging up your dependencies inside your zip file, you may include a bash file named <code>install.sh</code> that will be run before your bot is compiled.</p>\n\n                <p>It will be run with internet access and write access to only its current directory. It may run for a maximum of 10 minutes and will not be able to make global installation changes (i.e. <code>apt-get</code> will not work).</p>\n\n                <h4>Package Managers</h4>\n\n                <p>The following package managers are already installed on the server and can be used to install dependencies locally:</p>\n\n                <ul>\n                <li><code>pip3</code></li>\n                <li><code>bundler</code></li>\n                <li><code>npm</code></li>\n                </ul>\n\n                <p><code>curl</code> is also available and can be used to download additional runtimes, tools, and environments.</p>\n\n                <p>If your library isn't on a package manager that supports local installation and you can’t download it with <code>curl</code>, you are going to have to compile it on our game servers. Include the source of you library in your bot's zip file and put compilation instructions in the <code>install.sh</code> file.</p>\n\n                <h4>Preinstalled Libraries</h4>\n                <p>For convenience's sake, we include <code>tensorflow</code>, <code>keras</code> (using a <code>tensorflow</code> backend), <code>numpy</code>, <code>scipy</code>, <code>scikit-learn</code>, <code>pillow</code>, and <code>h5py</code> on our game servers. Just import these libraries from your python files like normal!</p>\n\n                <h3>Compilation</h3>\n\n                <p>Bot compilation is done using <a href=\"https://github.com/HaliteChallenge/Halite/blob/master/worker/compiler.py\">this autocompile script</a>. Many languages will be properly autodetected and compiled if needed without the need for an <code>install.sh</code> script.</p>\n\n                <p>Your main file must be called <code>MyBot</code>. Your language is recognized using the file extension of your <code>MyBot</code> file. The appropriate file extensions for each language are:</p>\n\n                <ul>\n                <li>Java - <code>.java</code></li>\n                <li>Python - <code>.py</code></li>\n                <li>C++ - <code>.cpp</code> and <code>.h(pp)</code></li>\n                <li>C# - <code>.cs</code></li>\n                <li>Rust - <code>.toml</code> (for your <code>Cargo.toml</code>) and <code>.rs</code> (for your Rust source)</li>\n                <li>Scala - <code>.scala</code></li>\n                <li>Ruby - <code>.rb</code></li>\n                <li>Go - <code>.go</code></li>\n                <li>PHP - <code>.php</code></li>\n                <li>JavaScript - <code>.js</code></li>\n                <li>OCaml - <code>.ml</code></li>\n                <li>Clojure - <code>.clj</code></li>\n                <li>C - <code>.c</code></li>\n                </ul>\n\n                <p>See the <a href=\"advanced_game_server.php\">Game Server Reference</a> for details about compiler and runtime versions.</p>\n\n                <h4>Customizing your language name</h4>\n\n                <p>If you are using a language that is generic or that does not have first class support on the server, you can include a file named <code>LANGUAGE</code> containing the name of the language you are using. This will be used only for display on the rankings and in your profile.</p>\n\n                <h4>JVM Languages</h4>\n\n                <p>For JVM languages, you can submit a jar file inside of your zip file instead of source files. The jar will be executed <code>java -jar MyBot.jar</code> so you need to <a href=\"https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html\">define a Main-Class header in the manifest</a>.</p>\n\n                <h3>Running</h3>\n\n                <p>You may supply a <code>run.sh</code> script to control how your bot is run. Many languages will be properly autodetected and run without the need for an <code>install.sh</code> script. You should only include a custom <code>run.sh</code> script if you have a real need for one.</p>\n\n                <h4>Custom Runtime</h4>\n\n                <p>You could use a <code>run.sh</code> file to use a custom runtime such as PyPy instead of the default Python 3.</p>\n\n                <h3>Understanding Game Logs</h3>\n\n                <p>When your bot times out or errors on our game servers, we save and display a log file with debugging information including the time your bot took each turn, its output each turn, and its final output from stdout and stderr.</p>\n\n                <p>To find these log files, visit your <a href=\"user.php\">homepage</a>. Just click the download log button to grab your error log for a game.</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js\"></script>\n    <script src=\"https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_replay_file.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Replay Files</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Replay Files</h1>\n\n                <h2>Overview</h2>\n\n                <p>A Halite replay file is a JSON object which describes what occurred during the game. Halite replay files are easy to parse and reasonably compact (and extremely compact when compressed), making them ideal for both using machine learning on Halite as well as sharing interesting games. The extension .hlt is used to distinguish Halite replay files.</p>\n\n                <h2>Detailed Specification</h2>\n\n                <p>A Halite replay file contains only a single JSON object. This object has the following attributes:\n                <ul>\n                    <li><code>version</code> - Describes the version of the replay file. The present version is 11, which is expected to be stable for a while.</li>\n                    <li><code>width</code> - A positive integer representing the width of the map.</li>\n                    <li><code>height</code> - A positive integer representing the height of the map.</li>\n                    <li><code>num_players</code> - A positive integer of at least 2 representing the number of players taking part in the game.</li>\n                    <li><code>num_frames</code> - The number of frames encoded in this replay.</li>\n                    <li><code>player_names</code> - An array of strings which correspond to the names of the players, starting with the player with tag 1 and ending with the player with tag <code>num_players</code>.</li>\n                    <li><code>productions</code> - A 2D array of integers which represent the productions of the tiles on the map. These integers fill in the map from row 1 (i.e. the top) to row <code>height</code> and within a row from column 1 to column <code>width</code> and are all guaranteed to be positive and less than 255.\n                    <li><code>frames</code> - A 4D arrays of integers. This is the most complex piece of the file specification, so here it is step by step:\n                    <ul>\n                        <li>The outermost array has length <code>num_frames</code>, and it contains individual frames.</li>\n                        <li>The next array inwards has length <code>height</code>, and it contains individual rows of the frame. The first element is the first (top) row and the last is the bottom row.</li>\n                        <li>The following array has length <code>width</code>, and it contains individual sites of the frame. The first element is the first (leftmost) column and the last is the rightmost row.</li>\n                        <li>The innermost array has length 2 and contains integers. Its contents represent the attributes of a given site. The first element is always the owner of the site and the second element is the strength of the site.</li>\n                    </ul></li>\n                    <li><code>moves</code> - A 3D arrays of integers. The outermost array has length <code>num_frames - 1</code> and contains the moves for an individual frame. Each element is a 2D array of integers which represent the directions chosen to move for every site on the map. As always, the outer layer of the 2D array fills in the rows from top to bottom and the inside layer fills in individual rows from left to right. The integer values for each site are: <code>STILL</code> = 0, <code>NORTH</code> = 1, <code>EAST</code> = 2, <code>SOUTH</code> = 3, and <code>WEST</code> = 4. Sites not owned by any player are assigned the value of 0.</li>\n                </ul></p>\n\n                        </div>\n                    </div>\n                    <?php include 'includes/footer.php'; ?>\n                </div>\n\n                <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n                <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n                <script src=\"script/backend.js\"></script>\n                <script src=\"script/general.js\"></script>\n            </body>\n            </html>\n"
  },
  {
    "path": "website/advanced_strategy.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Strategy Considerations</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Strategy Considerations</h1>\n                <p>In this short tutorial, we describe how to evaluate the position of player during a game, how to think about combat and remind the reader of a few subtleties of the game.</p>\n\n                <h2>Evaluating a player's position in Halite</h2>\n                <p>Just like for other board games like Chess or Go, not all Halite positions (i.e. the game state) are equally valuable. For a given player, there are 3 components which are most important in defining the quality of their position. These are:\n                <ul>\n                    <li>Territory - the number of sites of the map which the player controls.</li>\n                    <li>Production - the sum of the productions of the sites of the map which the player controls.</li>\n                    <li>Strength - the sum of the strengths of the sites of the map which the player controls.</li>\n                </ul>\n                Let's go over each of these in a bit more detail.</p>\n\n                <h3>Territory</h3>\n                <p>Territory is the measure of how close a player is to winning the game, since the goal of the game is to capture the full grid.<br>The ultimate goal of a player should be focused on maximizing its own territory and minimizing the territory of other players.<br>Simply controlling a lot of territory is not enough to give a player a high degree of certainty of winning, as the other characteristics (production and strength) can be just as influential in determining the outcome of a game, but controlling territory can also provide subtle advantages to a player which will be outlined later.</p>\n\n                <h3>Production</h3>\n                <p>Production is the measure of a player's capacity to produce new strength.<br>It tends to determine the long-term outcome of a player's position, as a player with a high total production can often just wear down other players in a war of attrition and then take their territory once their strength is reduced to zero.</p>\n\n                <h3>Strength</h3>\n                <p>Strength is the measure of a player's capacity to immediately capture new territory.<br>It tends to determine the short-term outcome of a player's position, as a player with a high total strength can immediately attack and take new territory.<br>Players should note that the placement of this strength is relevant; strength in the center of a player's territory cannot be utilized nearly as quickly as strength near the border.</p>\n\n                <h3>Combat Guide</h3>\n                <p>In Halite, a single piece can deal damage to as many as 4 other pieces simultaneously, this means that it can output up to 4 times its own strength in damage. This single principle (we call it `overkill`) is at the core of Halite tactics.</p>\n\n                <h3>Minor Characteristics</h3>\n                <p>This is a short (and far from complete) list of some less-important but still valuable characteristics of the game to be aware of when playing Halite.\n                <ul>\n                    <li>Perimeter to area ratio: A player with a high perimeter to area ratio will be able to move newly produced strength to borders more quickly and with less waste than a player with a low ratio, but may also be more vulnerable to attack.</li>\n                    <li>Not all production is created equal: High-production zones located directly between spawn points may be a source of contention for players on many-player games. High-production zones nestled deep inside already-controlled territory may be more valuable because they are much more difficult to attack. However, production further from a border takes longer to move to combat regions and so may also be wasted on large maps.</li>\n                    <li>Strength found near a specific border may be useful in strengthening that border from assault, but will consequently take longer to move to another border if that border comes under heavy assault.<br>Also remember that pieces have their strength capped at 255; if a player moves their pieces too often, they'll waste possible production (since sites do not produce when moving), but if they don't move often enough, they'll be forced to combine pieces with too high a strength and lose strength to the 255 cap. This can be very difficult to optimize well, and many players lose a significant amount of their production to this effect.</li>\n                </ul>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_third_party.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Third Party Resources</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Third Party Resources</h1>\n\n                <p>Below is a list of useful and/or fun resources that were created by the Halite community. Especially popular resources will be <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>'ed.</p>\n\n                <h3>Tutorials</h3>\n                <ul>\n                   <li><a href=\"http://2016.forums.halite.io/t/ml-starter-bot-tutorial/616\">Machine Learning Starter Bot by brianvanleeuwen</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/running-your-halite-bot-from-an-ide/70\">Running Your Halite Bot from an IDE by the Halite team</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/so-youve-improved-the-random-bot-now-what/482\">So you've Improved the Random Bot. Now what? by nmalaguti</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li>\n                   <li><a href=\"http://2016.forums.halite.io/t/building-a-good-ml-bot/776\">Building a Good Machine Learning Bot by KalraA</a></li>\n                </ul>\n\n                <h3>Strategy Writeups</h3>\n                <ul>\n                   <li><a href=\"http://2016.forums.halite.io/t/early-mid-and-late-game/703\">Early, Mid, and Late Game Strategy by nmalaguti</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/how-your-starting-position-impacts-your-bots-performance/769\">How Your Starting Position Impacts Your Bot's Performance by nmalaguti</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/perimeter-optimization-during-expansion/723\">Perimeter Optimization by Sydriax</a></li> \n                </ul>\n\n                <h3>Tools</h3>\n                <ul>\n                   <li><a href=\"http://2016.forums.halite.io/t/cloudbots-compete-on-demand-against-some-of-my-bots/725\">Cloudbots: locally test your bot against nmalaguti's</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/halite-swig-wrapper-for-the-game-engine/550\">Environment: halite environment SWIG wrapper</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/unofficial-halite-engine-clone-reloader/582\">Environment: multi-featured game environment clone</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/unofficial-match-manager-for-local-testing/505\">Local tournament manager</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/visualizer-with-more-graphs-aka-experimental-visualizer/771\">Visualizer: web visualizer with aws s3 hosting, extra stats, and easy linking</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/a-stand-alone-game-viewer/615\">Visualizer: local 3D visualizer</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/auto-visualization-of-test-runs/422\">Visualizer: local auto-reloading visualizer</a></li> \n                   <li><a href=\"https://github.com/erdman/halint\">Halint: load in replays and analyse gameplay for obvious mistakes</a></li> \n                </ul>\n\n                <h3>Mini Competitions</h3>\n                <ul>\n                <li><a href=\"http://2016.forums.halite.io/t/introducing-unofficial-halite-single-player-mode/573\">Single player expansion competition</a> <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span></li> \n                </ul>\n\n                <h3>Alternate Starter Packages</h3>\n                <ul>\n                   <li><a href=\"http://2016.forums.halite.io/t/slightly-more-powerful-c-starter-package/767\">C#: more powerful starter package</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/python3-much-alternative-starter-kit-asyncio-based-timeout-management-etc/611\">Python: asyncio timeout-based starter package</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/distributed-evolutionary-algorithm-deap-starter/624\">Python: Distributed Evolutionary Algorithm (DEAP) starter package</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/python3-numpy-focused-all-i-want-is-matrices-starter-kit/766\">Python: numpy matrix oriented starter package</a></li> \n                </ul>\n\n                <h3>Replay File Dumps</h3>\n                <ul>\n                   <li><a href=\"http://2016.forums.halite.io/t/diamond-replay-dump/749\">December 22, 1583 replays of diamond tier bots</a></li> \n                   <li><a href=\"http://2016.forums.halite.io/t/2gb-hlt-files-to-train-on/569\">December 1, 5GB of @erdman, @djma, and @daniel-shields</a></li> \n                </ul>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/advanced_writing_sp.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Writing Your Own Starter Package</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Writing Your Own Starter Package</h1>\n\n                <h2>API Design</h2>\n\n                <p>Please try to generally adhere to the API used in the Java, Python, and C++. This is as follows:\n                <ul>\n                    <li>Global Functions\n                        <ul>\n                            <li>getInit</li>\n                            <li>sendInit</li>\n                            <li>getFrame</li>\n                            <li>sendFrame</li>\n                        </ul>\n                    </li>\n                    <li>Classes/Structs\n                        <ul>\n                            <li>Map</li>\n                            <li>Location</li>\n                            <li>Site</li>\n                            <li>Move</li>\n                        </ul>\n                    </li>\n                    <li>Constants\n                        <ul>\n                            <li>the directions - NORTH, EAST, SOUTH, WEST, STILL</li>\n                        </ul>\n                    </li>\n                </ul>\n                <p>Of course, if changes to this API will make the starter package fit more nicely into your language, feel free to make them. A Java API will not translate directly into Lisp nicely.</p>\n\n                <h2>Networking Overview</h2>\n\n                <p>Bots communicate with the environment via stdin and stdout using series of space separated integers. There are two stages of communication - initialization and turn formats, and these are detailed below.</p>\n\n                <h3>Initialization</h3>\n\n                <p>At the beginning of the game, bot is sent the following, with each item newline-terminated:\n                <ol>\n                    <li>A single integer representing their own tag within the game.</li>\n                    <li>Two integers representing the <code>WIDTH</code> and <code>HEIGHT</code> of the map.</li>\n                    <li>The production map.</li>\n                    <li>The initial game map.</li>\n                </ol>\n\n                <p>Every bot is expected to respond with a string representing their name (newline-terminated) within fifteen seconds.</p>\n\n                <h3>Turn</h3>\n\n                <p>Every turn, every bot is sent the the present game map (newline-terminated). Every bot is expected to respond with a set of moves (newline-terminated) within one second.</p>\n\n                <h2>Networking Specifics</h2>\n\n                <h3>Input Game Map Format</h3>\n\n                <p>The state of the map (including owner and strength values, but excluding production values) is sent in the following way:\n                <ul>\n                    <li>One integer, <code>COUNTER</code>, representing the number of tiles with the same owner consecutively.</li>\n                    <li>One integer, <code>OWNER</code>, representing the owner of the tiles <code>COUNTER</code> encodes.</li>\n                </ul>\n                <p>The above repeats until the <code>COUNTER</code> total is equal to the area of the map. It fills in the map from row 1 to row <code>HEIGHT</code> and within a row from column 1 to column <code>WIDTH</code>. Please be aware that the top row is the first row, as Halite uses screen-type coordinates.</p>\n                <p>This is then followed by <code>WIDTH</code> * <code>HEIGHT</code> integers, representing the strength values of the tiles in the map. It fills in the map in the same way owner values fill in the map.</p>\n                <p>Consider the following 3x3 map as an example (where <code>[O=x,S=y]</code> represents a tile owned by player x with strength y):<br><pre><code>[O=0,S=122] [O=1,S=25] [O=1,S=18]\n[O=0, S=13] [O=0,S=45] [O=1,S=22]\n[O=2,S=255] [O=2,S=85] [O=0, S=0]</code></pre>\n                <p>This map would be encoded using the following string:\n                <pre><code>1 0 2 1 2 0 1 1 2 2 1 0 122 25 18 13 45 22 255 85 0</code></pre>\n\n                <h3>Input Production Format</h3>\n\n                <p>The production values of the map are sent using <code>WIDTH</code> * <code>HEIGHT</code> integers which fill in the production values of the map from row 1 to row <code>HEIGHT</code> and within a row from column 1 to column <code>WIDTH</code>\nConsider the following 3x3 production map as an example (where <code>[x]</code> represents a tile with x production):<br><pre><code>[2][3][4]\n[1][2][3]\n[0][1][2]</code></pre>\n                <p>This map would be encoded using the following string:<br>\n                <pre><code>2 3 4 1 2 3 0 1 2</code></pre>\n\n                <h3>Output Move Set Format</h3>\n\n                <p>Bots should send their moves as a list of integers in sets of 3. In each set, every first integer is the x location (starting at 0) of the site the bot desires to move, every second integer is the y location (starting at 0) of the site the bot desires to move, and every third integer is the direction the bot wishes to move the site in. The order of the sets does not matter.</p>\n                \n                <p>Valid directions include:\n                <ul>\n                    <li>0 - STILL</li>\n                    <li>1 - NORTH</li>\n                    <li>2 - EAST</li>\n                    <li>3 - SOUTH</li>\n                    <li>4 - WEST</li>\n                </ul>\n                <p>Please note that these directions correspond most directly to screen coordinates; that is, NORTH decrements the y value of the site by 1 and SOUTH increments the value by 1. Attempts to move nonexistent or enemy pieces or to move pieces in nonexistent directions will be ignored. If multiple separate moves are issued for the same piece, the lower direction value will be preferred.</p>\n                <p>Consider the following case as an example:<br>I wish to order a piece located at (3, 4) to move <code>EAST</code>, a piece located at (4, 0) to remain <code>STILL</code>, and a piece located at (4, 5) to move <code>NORTH</code>.<br>This would be encoded with the following string:<br><pre><code>3 4 2 4 0 0 4 5 1</code></pre></p>\n\n                <p>Note: if you would like an alternate way of communicating with the environment, please see a future post on the forums for how to communicate with the environment over sockets instead of pipes if you need to use a debugger or similar to work on your bot.</p>\n\n                <h2>Submitting Your New Starter Package</h2>\n\n            <p><a href=\"https://github.com/HaliteChallenge/Halite\">Fork our repo</a>, place your starter package in the airesources/ folder, and send us a pull request! If we accept your PR, your starter package will be added to the site.<br>Note: please include the runGame.sh and runGame.bat scripts (each run a 30 by 30 game between MyBot and RandomBot) and the MyBot and RandomBot files (both just random bots).</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/api/API.class.php",
    "content": "<?php\n\nuse Aws\\Sdk;\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\ndefine(\"INI_PATH\", dirname(__FILE__).\"/../../halite.ini\");\ndefine(\"COMPILE_BUCKET\", \"halitecompilebucket\");\ndefine(\"BOT_BUCKET\", \"halitebotbucket\");\ndefine(\"REPLAY_BUCKET\", \"halitereplaybucket\");\ndefine(\"ERROR_LOG_BUCKET\", \"haliteerrorlogbucket\");\ndefine(\"WEB_DOMAIN\", \"https://halite.io/\");\n\nabstract class API{\n    /**\n     * Property: method\n     * The HTTP method this request was made in, either GET, POST, PUT or DELETE\n     */\n    protected $method = '';\n    /**\n     * Property: endpoint\n     * The Model requested in the URI. eg: /files\n     */\n    protected $endpoint = '';\n    /**\n     * Property: verb\n     * An optional additional descriptor about the endpoint, used for things that can\n     * not be handled by the basic methods. eg: /files/process\n     */\n    protected $verb = '';\n    /**\n     * Property: args\n     * Any additional URI components after the endpoint and verb have been removed, in our\n     * case, an integer ID for the resource. eg: /<endpoint>/<verb>/<arg0>/<arg1>\n     * or /<endpoint>/<arg0>\n     */\n    protected $args = Array();\n    /**\n     * Property: file\n     * Stores the input of the PUT request\n     */\n    protected $file = Null;\n\n    protected function numRows($sql) {\n        return mysqli_fetch_assoc(mysqli_query($this->mysqli, $sql))[\"COUNT(*)\"];\n    }\n\n    protected function select($sql) {\n        try {\n            $res = mysqli_query($this->mysqli, $sql);\n            $array = mysqli_fetch_array($res, MYSQLI_ASSOC);\n            return $array;\n        } catch(Exception $e) {\n            return array();\n        }\n    }\n\n    protected function selectMultiple($sql) {\n        $res = mysqli_query($this->mysqli, $sql);\n        $finalArray = array();\n\n        while($temp = mysqli_fetch_array($res, MYSQLI_ASSOC)) {\n            array_push($finalArray, $temp);\n        }\n\n        return $finalArray;\n    }\n\n    protected function insert($sql) {\n        mysqli_query($this->mysqli, $sql);\n    }\n\n    protected function loadConfig() {\n        if(!property_exists($this, \"config\")) $this->config = parse_ini_file(INI_PATH, true);\n    }\n\n    protected function loadAwsSdk() {\n        $this->loadConfig();\n        putenv(\"AWS_ACCESS_KEY_ID=\".$this->config[\"aws\"][\"accesskey\"]);\n        putenv(\"AWS_SECRET_ACCESS_KEY=\".$this->config[\"aws\"][\"secretaccesskey\"]);\n\n        $sdk = new Aws\\Sdk([\n            'region'   => 'us-east-1',\n            'version'  => 'latest'\n        ]);\n        return $sdk;\n    }\n\n    protected function sendNotification($recipientUser, $subject, $message, $mood, $doSendNotif=true, $alwaysSendEmail=false) {\n        $notificationMessage = $this->mysqli->real_escape_string($message);\n\n        if($doSendNotif) {\n            $this->insert(\"INSERT INTO UserNotification (userID, title, body, mood) VALUES ({$recipientUser['userID']}, '{$subject}', '{$notificationMessage}', {$mood})\");\n        }\n\n        if($recipientUser['onEmailList'] == 1 || $alwaysSendEmail) {\n            try {\n                $emailMessage = $message.\"<hr><p style='color: gray; font-size: 14px;'>To unsubscribe to these emails, click <a href='\".WEB_DOMAIN.\"api/web/emailList?unsubscribe=1'>here</a>. To resubscribe, click <a href='\".WEB_DOMAIN.\"api/web/emailList?subscribe=1'>here</a>.</p>\";\n\n                $transporter = Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 465, 'ssl')\n                    ->setUsername($this->config['email']['username'])\n                    ->setPassword($this->config['email']['password']);\n                $mailer = Swift_Mailer::newInstance($transporter);\n                $emailMessage = Swift_Message::newInstance($subject)\n                    ->setFrom(array($this->config['email']['email'] => 'Halite'))\n                    ->setTo(array($recipientUser['email']))\n                    ->setBody($emailMessage)\n                    ->setContentType(\"text/html\");\n\n                $mailer->send($emailMessage);\n            } catch (Exception $e) {\n            } finally {\n            }\n        }\n    }\n\n    protected function initDB() {\n        $this->loadConfig();\n\n        $this->mysqli = NULL;\n        $this->mysqli = new mysqli($this->config['database']['hostname'],\n            $this->config['database']['username'],\n            $this->config['database']['password'],\n            $this->config['database']['name']);\n\n        if (mysqli_connect_errno()) {\n            echo \"<br><br>There seems to be a problem with our database. Reload the page or try again later.\";\n            exit();\n        }\n    }\n\n    /**\n     * Constructor: __construct\n     * Allow for CORS, assemble and pre-process the data\n     */\n    public function __construct($request) {\n        header(\"Access-Control-Allow-Orgin: *\");\n        header(\"Access-Control-Allow-Methods: *\");\n        header(\"Content-Type: application/json\");\n\n        $this->loadConfig();\n\n        $this->args = explode('/', rtrim($request, '/'));\n        $this->endpoint = array_shift($this->args);\n        if (array_key_exists(0, $this->args) && !is_numeric($this->args[0])) {\n            $this->verb = array_shift($this->args);\n        }\n\n        $this->method = $_SERVER['REQUEST_METHOD'];\n        if ($this->method == 'POST' && array_key_exists('HTTP_X_HTTP_METHOD', $_SERVER)) {\n            if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'DELETE') {\n                $this->method = 'DELETE';\n            } else if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'PUT') {\n                $this->method = 'PUT';\n            } else {\n                throw new Exception(\"Unexpected Header\");\n            }\n        }\n\n        switch($this->method) {\n        case 'DELETE':\n        case 'POST':\n            $this->request = $this->_cleanInputs($_POST);\n            break;\n        case 'GET':\n            $this->request = $this->_cleanInputs($_GET);\n            break;\n        case 'PUT':\n            $this->request = $this->_cleanInputs($_GET);\n            $this->file = file_get_contents(\"php://input\");\n            break;\n        default:\n            $this->_response('Invalid Method', 405);\n            break;\n        }\n    }\n\n    public function processAPI() {\n        if (method_exists($this, $this->endpoint)) {\n            return $this->_response($this->{$this->endpoint}($this->args));\n        }\n        return $this->_response(\"No Endpoint: $this->endpoint\", 404);\n    }\n\n    private function _response($data, $status = 200) {\n        header(\"HTTP/1.1 \" . $status . \" \" . $this->_requestStatus($status));\n        return json_encode($data);\n    }\n\n    private function _cleanInputs($data) {\n        $clean_input = Array();\n        if (is_array($data)) {\n            foreach ($data as $k => $v) {\n                $clean_input[$k] = $this->_cleanInputs($v);\n            }\n        } else {\n            $clean_input = trim(strip_tags($data));\n        }\n        return $clean_input;\n    }\n\n    private function _requestStatus($code) {\n        $status = array(\n            200 => 'OK',\n            404 => 'Not Found',\n            405 => 'Method Not Allowed',\n            500 => 'Internal Server Error',\n        );\n        return ($status[$code])?$status[$code]:$status[500];\n    }\n}\n\n?>\n"
  },
  {
    "path": "website/api/manager/.htaccess",
    "content": "<IfModule mod_rewrite.c>\n    RewriteEngine On\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME} !-d\n    RewriteRule (.*)$ api.php?request=$1 [QSA,NC,L]\n</IfModule>\n"
  },
  {
    "path": "website/api/manager/ManagerAPI.php",
    "content": "<?php\n\nuse Aws\\Sdk;\nrequire __DIR__ . '/../../vendor/autoload.php';\nrequire_once '../API.class.php';\n\ndefine(\"INI_FILE\", \"../../../halite.ini\");\n\nini_set('upload_max_filesize', '50M');\nini_set('post_max_size', '50M');\nini_set('max_input_time', 90);\nini_set('max_execution_time', 90);\nini_set('display_errors', 1);\nerror_reporting(E_ALL ^ E_NOTICE);\n\nclass ManagerAPI extends API{\n    private $apiKey = NULL;\n\n    // Init database, sanitize parameters, and check if worker is valid\n    public function __construct($request) {\n        $this->loadConfig();\n        $this->initDB();\n\n        if($this->isValidWorker() == false) {\n            echo \"Not valid worker\";\n            exit(1);\n        } else {\n            $this->insert(\"UPDATE Worker SET lastRequestTime = now() WHERE apiKey = {$this->apiKey}\");\n        }\n        parent::__construct($request);\n    }\n\n    private function getAPIKey() {\n        $this->apiKey = NULL;\n        if(isset($_GET['apiKey'])) $this->apiKey = $_GET['apiKey'];\n        else if(isset($_POST['apiKey'])) $this->apiKey = $_POST['apiKey'];\n    }\n\n    // Checks HTTP parameters and request IP to make sure that the client provided a valid API key\n    private function isValidWorker() {\n        // Get apiKey\n        $this->getAPIKey();\n        if($this->apiKey == NULL) return false;\n\n        // Get ip\n        $ipAddress = $_SERVER['REMOTE_ADDR'];\n\n        if(count($this->select(\"SELECT ipAddress FROM Worker WHERE ipAddress = '\".$this->mysqli->real_escape_string($ipAddress).\"' and apiKey = \".$this->mysqli->real_escape_string($this->apiKey))) > 0) {\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    private function getTrueskillMatchQuality($rankingValues) {\n        usort($rankingValues, function($a, $b) {\n            return $a['rank'] < $b['rank'];\n        });\n        $rankings = array();\n        foreach($rankingValues as $user) {\n            array_push($rankings, $user['mu']);\n            array_push($rankings, $user['sigma']);\n        }\n        exec(\"python3 trueskillMatchQuality.py \".implode(' ', $rankings), $lines);\n        return floatval($lines[0]);\n    }\n\n    private function checkConfig($section, $key) {\n        if(!isset($this->config[$section]) || !isset($this->config[$section][$key])) {\n            return false;\n        }\n        return $this->config[$section][$key];\n    }\n\n\n    /////////////////////////API ENDPOINTS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n    // Delegate a task to a workers\n    protected function task() {\n        if($this->method == 'GET') {\n            // Check for compile tasks\n            $needToBeCompiled = $this->select(\"SELECT * FROM User WHERE compileStatus=1 ORDER BY userID ASC LIMIT 1\");\n            if(count($needToBeCompiled) > 0) {\n                $this->insert(\"UPDATE User SET compileStatus = 2 WHERE userID = \".$needToBeCompiled['userID']);\n                return array(\n                    \"type\" => \"compile\",\n                    \"user\" => $needToBeCompiled\n                );\n            }\n\n            // don't give out any task if games have been stopped.\n            if($this->checkConfig(\"compState\", \"noGameTasks\")) {\n                return array(\"type\" => \"notask\");\n            }\n\n            // Assign a run game tasks\n            $possibleNumPlayers = array(2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6);\n            $numPlayers = $possibleNumPlayers[array_rand($possibleNumPlayers)];\n\n            $seedPlayer = null;\n            if(!$this->checkConfig(\"compState\", \"finalsPairing\")) {\n                $randValue = mt_rand() / mt_getrandmax();\n                if($randValue > 0.5) {\n                    $seedPlayer = $this->select(\"SELECT * FROM User WHERE isRunning = 1 and numGames < 400 order by rand()*-pow(sigma, 2) LIMIT 1\");\n                }\n                if ($randValue > 0.25 && $randValue <= 0.5) {\n                    $seedPlayer = $this->select(\"SELECT * FROM (SELECT u.* FROM (SELECT MAX(g.timestamp) as maxTime, gu.userID as userID FROM GameUser gu INNER JOIN Game g ON g.gameID=gu.gameID GROUP BY gu.userID) temptable INNER JOIN User u on u.userID = temptable.userID where numGames < 400 and isRunning = 1 order by maxTime ASC limit 15) orderedTable order by rand() limit 1;\");\n                }\n                if($randValue <= 0.25 || count($seedPlayer) < 1) {\n                    $seedPlayer = $this->select(\"SELECT u.* FROM (SELECT MAX(g.timestamp) as maxTime, gu.userID as userID FROM GameUser gu INNER JOIN Game g ON g.gameID=gu.gameID GROUP BY gu.userID) temptable INNER JOIN User u on u.userID = temptable.userID where isRunning = 1 order by maxTime ASC limit 1\");\n                }\n            } else {\n                $seedPlayer = $this->select(\"SELECT * FROM (SELECT * FROM User WHERE rank < 398 and isRunning = 1 ORDER BY numGames ASC limit 15) orderedTable ORDER BY rand() LIMIT 1\");\n            }\n\n            $muRankLimit = intval(5.0 / pow((float)mt_rand(1, mt_getrandmax())/(float)mt_getrandmax(), 0.65));\n            $players = $this->selectMultiple(\"SELECT * FROM (SELECT * FROM User WHERE isRunning=1 and userID <> {$seedPlayer['userID']} ORDER BY ABS(mu-{$seedPlayer['mu']}) LIMIT $muRankLimit) muRankTable ORDER BY rand() LIMIT \".($numPlayers-1));\n            array_unshift($players, $seedPlayer);\n\n            // Pick map size\n            $sizes = array(20, 25, 25, 30, 30, 30, 35, 35, 35, 35, 40, 40, 40, 45, 45, 50);\n            $size = $sizes[array_rand($sizes)];\n\n            // Send game task\n            if(count($players) == $numPlayers) {\n                return array(\n                    \"type\" => \"game\",\n                    \"width\" => $size,\n                    \"height\" => $size,\n                    \"users\" => $players\n                );\n            }\n        }\n    }\n\n    // Allow worker to post the result of their compilation\n    protected function compile() {\n        var_dump($_POST);\n        if(isset($_POST['userID']) && isset($_POST['didCompile'])) {\n            $this->insert(\"UPDATE Worker SET numCompiles=numCompiles+1 WHERE apiKey=\".$this->mysqli->real_escape_string($this->apiKey));\n\n            $userID = $_POST['userID'];\n            $didCompile = $_POST['didCompile'];\n            $language = isset($_POST['language']) ? $_POST['language'] : \"Other\";\n            $user = $this->select(\"SELECT * FROM User WHERE userID={$userID}\");\n\n            if($didCompile == 1) { // Did succeed\n                $this->sendNotification($user, \"Compilation Success\", \"<p>Your bot was sucessfully compiled on our servers as a program written in {$language}. Within a few minutes, your bot will begin playing games against other contestant's programs. Replays of these games will show up on your <a href='\".WEB_DOMAIN.\"user.php'>homepage</a>.</p>\", 1);\n\n                $this->insert(\"UPDATE User SET numSubmissions=numSubmissions+1, numGames=0, mu = 25.000, sigma = 8.333, compileStatus = 0, isRunning = 1, language = '\".$this->mysqli->real_escape_string($language).\"' WHERE userID = \".$this->mysqli->real_escape_string($userID));\n\n                if(intval($user['numSubmissions']) != 0) {\n                    $numActiveUsers = mysqli_query($this->mysqli, \"SELECT userID FROM User WHERE isRunning=1\")->num_rows;\n                    $this->insert(\"INSERT INTO UserHistory (userID, versionNumber, lastRank, lastNumPlayers, lastNumGames) VALUES ({$user['userID']}, {$user['numSubmissions']}, {$user['rank']}, $numActiveUsers, {$user['numGames']})\");\n                }\n            } else { // Didnt succeed\n                $this->sendNotification($user, \"Compilation Failure\", \"<p>The bot that you recently submitted to the Halite competition would not compile on our servers.</p><p>Our autocompile script <b>thought that your bot was written in \\\"{$language}\\\"</b>.</p><b>Here is a description of the compilation error</b>:<br><pre><code><br>{$_POST['errors']}</code></pre>\", -1);\n                $this->insert(\"UPDATE User SET compileStatus = 0 WHERE userID = \".$this->mysqli->real_escape_string($userID));\n            }\n        }\n    }\n\n    // Allow workers to post the result of their game\n    protected function game() {\n        var_dump($_FILES);\n        var_dump($_POST);\n        // Each user in users must have a rank, playerIndex, mu, sigma, and userID\n        if(isset($_POST['users']) && count($_FILES) > 0) {\n            $this->insert(\"UPDATE Worker SET numGames=numGames+1 WHERE apiKey=\".$this->mysqli->real_escape_string($this->apiKey));\n            $workerID = $this->select(\"SELECT workerID FROM Worker WHERE apiKey=\".$this->mysqli->real_escape_string($this->apiKey))[\"workerID\"];\n\n            $mapWidth = $_POST['mapWidth'];\n            $mapHeight = $_POST['mapHeight'];\n            $users = json_decode($_POST['users'], true);\n\n            // Throw out the game if it is using an old version of a person's bot\n            foreach($users as $key => $user) {\n                // Will need email credentials for email sending, numSubmissions for version checking, and mu + sigma so we can update trueskill\n                $storedUser = $this->select(\"SELECT userID, onEmailList, email, numSubmissions, mu, sigma FROM User WHERE userID=\".$this->mysqli->real_escape_string($user['userID']));\n                if(intval($storedUser['numSubmissions']) != intval($user['numSubmissions'])) {\n                    return null;\n                }\n                $users[$key] = array_merge($user, $storedUser); // Second param overwrites first param\n            }\n\n            // Store replay file and error logs\n            $replayName = null;\n            $s3Client = $this->loadAwsSdk()->createS3();\n            foreach($_FILES as $fileKey => $file) {\n                $pathParts = pathinfo($file['name']);\n                $args = [\n                    'Key'    => $pathParts['basename'],\n                    'Body'   => file_get_contents($file['tmp_name']) \n                ];\n\n                if(strcmp('hlt', $pathParts['extension']) == 0) {\n                    $replayName = $pathParts['basename'];\n                    $args[\"Bucket\"] = REPLAY_BUCKET;\n                    $args[\"ContentEncoding\"] = \"gzip\";\n                } else {\n                    $args[\"Bucket\"] = ERROR_LOG_BUCKET;\n                }\n\n\n                $s3Client->putObject($args);\n            }\n\n            // Check that we arent stoing too many games in db\n            $numAllowed = 600000;\n            $numRows = $this->numRows(\"SELECT COUNT(*) FROM Game\");\n            $numToDelete = $numRows - $numAllowed;\n            if($numToDelete > 0) {\n                $gamesToDelete = $this->selectMultiple(\"SELECT gameID FROM Game ORDER BY gameID LIMIT $numToDelete\");\n                foreach($gamesToDelete as $game) {\n                    $this->insert(\"DELETE FROM GameUser WHERE gameID={$game['gameID']}\");\n                    $this->insert(\"DELETE FROM Game WHERE gameID={$game['gameID']}\");\n                }\n            }\n\n            // Store game information in db\n            $this->insert(\"INSERT INTO Game (replayName, mapWidth, mapHeight, timestamp, workerID) VALUES ('\".$this->mysqli->real_escape_string($replayName).\"', \".$this->mysqli->real_escape_string($mapWidth).\", \".$this->mysqli->real_escape_string($mapHeight).\", NOW(), $workerID)\");\n            $gameID = $this->mysqli->insert_id;\n\n            // Update each participant's stats\n            for($a = 0; $a < count($users); $a++) {\n                $timeoutInt = $users[$a]['didTimeout'] ? 1 : 0;\n                $errorLogName = $users[$a]['errorLogName'] == NULL ? \"NULL\" : \"'\".$this->mysqli->real_escape_string($users[$a]['errorLogName']).\"'\";\n                $this->insert(\"INSERT INTO GameUser (gameID, userID, errorLogName, rank, playerIndex, didTimeout, versionNumber) VALUES ($gameID, \".$this->mysqli->real_escape_string($users[$a]['userID']).\", $errorLogName, \".$this->mysqli->real_escape_string($users[$a]['rank']).\", \".$this->mysqli->real_escape_string($users[$a]['playerTag']).\", {$timeoutInt}, {$users[$a]['numSubmissions']})\");\n\n                // Increment number of games\n                $this->insert(\"UPDATE User SET numGames=numGames+1 WHERE userID=\".$users[$a]['userID']); \n            }\n            \n\n            // Send first game email and first timeout email\n            foreach($users as $user) {\n                if($user['didTimeout'] && mysqli_query($this->mysqli, \"SELECT * from GameUser WHERE didTimeout = 1 and versionNumber = {$user['numSubmissions']} and userID={$user['userID']}\")->num_rows == 1) {\n                    $errorLogContents = NULL;\n                    foreach($_FILES as $file) {\n                        if($file['name'] == $user['errorLogName']) {\n                            $errorLogContents = file_get_contents($file['tmp_name']);\n                            break;\n                        }\n                    }\n                    if($errorLogContents == NULL) continue;\n\n                    $message = \"<p>Your bot timed out in a game for the first time. This happens when your bot doesn't respond in 15 seconds of a game's start or 1 second of a turn's start. A timeout may be the result of a runtime error in your bot. When your bot times out, its pieces become part of the map and it is ejected from the game.</p> <p><a href='\".WEB_DOMAIN.\"game.php?replay={$replayName}'>Here</a> is a visualization of the game in which your bot timed out.</p> <p><a href='\".WEB_DOMAIN.\"api/web/errorLog?errorLogName={$user['errorLogName']}'>Here</a> is your bot's error log. An error log contains your bot's output (from stdout and stderr) and the time it took per turn.</p>\";\n                    $this->sendNotification($user, \"First Bot Timeout/Error\", $message, -1);\n                }\n            }\n\n            // Update mu and sigma for the players\n            usort($users, function($a, $b) {\n                return $a['rank'] > $b['rank'];\n            });\n            $rankings = array();\n            foreach($users as $user) {\n                array_push($rankings, $user['mu']);\n                array_push($rankings, $user['sigma']);\n            }\n            exec(\"python3 updateTrueskill.py \".implode(' ', $rankings), $lines);\n            var_dump($lines);\n            for($a = 0; $a < count($users); $a++) {\n                $components = explode(' ', $lines[$a]);\n                $this->insert(\"UPDATE User SET mu=\".$this->mysqli->real_escape_string($components[0]).\", sigma=\".$this->mysqli->real_escape_string($components[1]).\" WHERE userID=\".$this->mysqli->real_escape_string($users[$a]['userID']).\" AND numSubmissions=\".$this->mysqli->real_escape_string($users[$a]['numSubmissions']));\n            }\n\n            // Update overall rank of everyone\n            $allUsers = $this->selectMultiple(\"SELECT * FROM User where isRunning=1\");\n            usort($allUsers, function($a, $b) {\n                return $a['mu']-3*$a['sigma'] < $b['mu']-3*$b['sigma'];\n            });\n            $query = \"UPDATE User set rank = CASE\";\n            for($userIndex = 0; $userIndex < count($allUsers); $userIndex++) {\n                $rank = $userIndex+1;\n                $query .= \" WHEN userID = {$allUsers[$userIndex]['userID']} THEN {$rank}\";\n            }\n            $query .= \" ELSE rank END;\";\n            $this->insert($query);\n        }\n    }\n\n    // Allow workers to download and post bot files\n    protected function botFile() {\n        if(isset($_GET['userID'])) {\n            $userID = $_GET['userID'];\n\n            header(\"Content-disposition: attachment; filename={$userID}.zip\");\n            header(\"Content-type: application/zip\");\n\n            ob_clean();\n            flush();\n\n            $bucket = null;\n            if(isset($_GET['compile'])) $bucket = COMPILE_BUCKET; \n            else $bucket = BOT_BUCKET; \n\n            echo $this->loadAwsSdk()->createS3()->getObject([\n                'Bucket' => $bucket,\n                'Key'    => \"$userID\" \n            ])['Body'];\n\n            exit;\n        } else if(isset($_POST['userID']) && count($_FILES) > 0) {\n            $userID = $_POST['userID'];\n            $key = array_keys($_FILES)[0];\n            $name = basename($_FILES[$key]['name']);\n\n            $this->loadAwsSdk()->createS3()->putObject([\n                'Key'    => \"{$userID}\",\n                'Body'   => file_get_contents($_FILES[$key]['tmp_name']),\n                'Bucket' => BOT_BUCKET\n            ]);\n        } else {\n            return NULL;\n        }\n\n        return \"Success\";\n    }\n\n    // Allow workers to get the hash of a bot file so that they know that they downloaded the file correctly\n    protected function botHash() {\n        if(isset($_GET['userID'])) {\n            $userID = $_GET['userID'];\n            $s3Client = $this->loadAwsSdk()->createS3();            \n            if(isset($_GET['compile']) && $s3Client->doesObjectExist(COMPILE_BUCKET, \"$userID\")) {\n                return array(\"hash\" => md5($s3Client->getObject(['Bucket' => COMPILE_BUCKET, 'Key'    => \"$userID\"])['Body']));\n            } else if(!isset($_GET['compile']) && $s3Client->doesObjectExist(BOT_BUCKET, \"$userID\")) {\n                return array(\"hash\" => md5($s3Client->getObject(['Bucket' => BOT_BUCKET, 'Key'    => \"$userID\"])['Body']));\n            } else {\n                return \"Bot file does not exist\";\n            }\n        }\n    }\n}\n?>\n"
  },
  {
    "path": "website/api/manager/api.php",
    "content": "<?php\n\nrequire_once \"ManagerAPI.php\";\n\n// Requests from the same server don't have a HTTP_ORIGIN header\nif (!array_key_exists('HTTP_ORIGIN', $_SERVER)) {\n    $_SERVER['HTTP_ORIGIN'] = $_SERVER['SERVER_NAME'];\n}\n\ntry {\n    $API = new ManagerAPI($_REQUEST['request']);\n    echo $API->processAPI();\n} catch (Exception $e) {\n    echo json_encode(Array('error' => $e->getMessage()));\n}\n\n?>\n"
  },
  {
    "path": "website/api/manager/trueskillMatchQuality.py",
    "content": "import sys\nimport trueskill\n\nsys.argv.pop(0)\n\nteams = [[trueskill.Rating(mu=float(sys.argv[a]), sigma=float(sys.argv[a+1]))] for a in range(0, len(sys.argv), 2)]\nprint(trueskill.TrueSkill().quality(teams))\n"
  },
  {
    "path": "website/api/manager/updateTrueskill.py",
    "content": "import sys\nimport trueskill\n\nsys.argv.pop(0)\n\nteams = [[trueskill.Rating(mu=float(sys.argv[a]), sigma=float(sys.argv[a+1]))] for a in range(0, len(sys.argv), 2)]\n\nnewRatings = trueskill.rate(teams)\nfor rating in newRatings:\n    print(str(rating[0].mu) + \" \" + str(rating[0].sigma))\n"
  },
  {
    "path": "website/api/web/.htaccess",
    "content": "<IfModule mod_rewrite.c>\n    RewriteEngine On\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME} !-d\n    RewriteRule (.*)$ api.php?request=$1 [QSA,NC,L]\n</IfModule>\n"
  },
  {
    "path": "website/api/web/WebsiteAPI.php",
    "content": "<?php\n\nuse OAuth\\OAuth2\\Service\\GitHub;\nuse OAuth\\ServiceFactory;\nuse OAuth\\Common\\Storage\\Session;\nuse OAuth\\Common\\Consumer\\Credentials;\nuse OAuth\\Common\\Http\\Uri\\UriFactory;\n\nini_set('display_errors', 1);\nini_set('display_startup_errors', 1);\nini_set('session.gc_maxlifetime', 7*24*3600);\n\nheader('Access-Control-Allow-Origin: *');\nerror_reporting(E_ALL);\n\ndate_default_timezone_set('America/New_York');\n\ninclude dirname(__FILE__).'/../API.class.php';\n\ndefine(\"ORGANIZATION_WHITELIST_PATH\", dirname(__FILE__).\"/../../organizationWhitelist.txt\");\ndefine(\"USER_TO_SERVER_RATIO\", 100);\ndefine(\"WORKER_LIMIT\", 50);\n\nclass WebsiteAPI extends API{\n    public function __construct($request) {\n        if (session_status() == PHP_SESSION_NONE) {\n            session_start();\n        }\n\n        $this->loadConfig();\n        $this->initDB();\n        $this->sanitizeHTTPParameters();\n\n        parent::__construct($request);\n    }\n    \n    /* Apply MYSQL sanitization to all incoming parameters\n     * \n     * TODO: take this out, switch to just sanitizing when necessary\n     * Sanitizing everything breaks json parsing of params\n     * Also, bad practice\n     */\n    private function sanitizeHTTPParameters() {\n        foreach ($_POST as $key => $value) {\n            $_POST[$key] = $this->mysqli->real_escape_string($value);\n        }\n    }\n    \n    // Gets the id of one of our users in the discourse forums system\n    private function getForumsID($userID) {\n        $url = \"http://2016.forums.halite.io/users/by-external/{$userID}.json/?\".http_build_query(array('api_key' => $this->config['forums']['apiKey'], 'api_username' => $this->config['forums']['apiUsername']));\n        $contents = file_get_contents($url);\n        return intval(json_decode($contents, true)['user']['id']);\n    }\n    \n    // Log a users out of 2016.forums.halite.io\n    private function logOutForums($forumsID) {\n        $options = array('http' => array(\n            'header'  => \"Content-type: application/x-www-form-urlencoded\\r\\n\",\n            'method'  => 'POST',\n            'content' => http_build_query(array('api_key' => $this->config['forums']['apiKey'], 'api_username' => $this->config['forums']['apiUsername']))\n        ));\n        file_get_contents(\"http://2016.forums.halite.io/admin/users/{$forumsID}/log_out\", false, stream_context_create($options));\n    }\n\n    private function isLoggedIn() {\n        return isset($_SESSION['userID']) && mysqli_query($this->mysqli, \"SELECT * FROM User WHERE userID={$_SESSION['userID']}\")->num_rows == 1;\n    }\n\n    private function getUsers($query, $privateInfo=false) {\n        $users = $this->selectMultiple($query);\n        $numUsers = $this->numRows(\"SELECT COUNT(*) FROM User WHERE isRunning=1\");\n        foreach($users as &$user) {\n            if($privateInfo == false) {\n                unset($user['email']);\n                unset($user['githubEmail']);\n                unset($user['verificationCode']);\n            }\n            \n            if(intval($user['isRunning']) == 1) {\n                $percentile = intval($user['rank']) / $numUsers;\n                if($percentile < 1/64) $user['tier'] = \"Diamond\";\n                else if($percentile < 1/16) $user['tier'] = \"Gold\";\n                else if($percentile < 1/4) $user['tier'] = \"Silver\";\n                else $user['tier'] = \"Bronze\";\n                \n\n                $user['score'] = round(floatval($user['mu']) - 3*floatval($user['sigma']), 2);\n            }\n        }\n        return $users;\n    }\n\n    private function getLoggedInUser() {\n        if(isset($_SESSION['userID'])) return $this->getUsers(\"SELECT * FROM User WHERE userID={$_SESSION['userID']}\", true)[0];\n    }\n\n    /**\n     * Helper to interface with the database and get high schools based on the filters.\n     */\n    private function getHS($name=null, $state=null) {\n        $query_string = \"SELECT * FROM HighSchool \";\n        if(!empty($name) && isset($name)) {\n            $query_string = $query_string.\"WHERE name='\".$this->mysqli->real_escape_string($name).\"' \";\n        } \n        if(!empty($state) && isset($state)) {\n            $query_string = $query_string.(!empty($name) && isset($name)?\"AND\":\"WHERE\").\" state='\".$this->mysqli->real_escape_string($state).\"' \";\n        }\n        return $this->selectMultiple($query_string.\"ORDER BY name ASC\");\n    }\n\n    private function getOrganizationForEmail($email) {\n        $emailDomain = explode('@', $email)[1];\n        $rows = explode(\"\\n\", rtrim(file_get_contents(ORGANIZATION_WHITELIST_PATH)));\n        foreach($rows as $row) {\n            $components = explode(\" - \", $row);\n            if(strcmp($components[1], $emailDomain) == 0) {\n                return $components[0];\n            }\n        }\n        return \"Other\";\n    }\n\n\n    //------------------------------------- API ENDPOINTS ----------------------------------------\\\\\n    // Endpoint associated with a users credentials (everything in the User table; i.e. name, oauthID, etc.)\n    // -------------------------------------------------------------------------------------------\\\\\n\n    /* User Endpoint\n     *\n     * Encapsulates user information.\n     */ \n    protected function user() {\n        // Get a user's info with a username        \n        if(isset($_GET[\"username\"])) {\n            $results = $this->getUsers(\"SELECT * FROM User WHERE username = '\".$this->mysqli->real_escape_string($_GET['username']).\"'\");\n            if(count($results) > 0) return $results[0];\n            else return null;\n        } \n        \n        // Get a user's info with a userID\n        else if (isset($_GET[\"userID\"])) {\n            $results = $this->getUsers(\"SELECT * FROM User WHERE userID = \".intval($_GET['userID']), isset($_SESSION['userID']) && $_GET['userID'] == $_SESSION['userID']);\n            if(count($results) > 0) return $results[0];\n            else return null;\n        } \n        \n        // Get a set of filtered users\n        else if(isset($_GET['fields']) && isset($_GET['values'])) {\n            $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;\n            $whereClauses = array_map(function($a) {\n                return $this->mysqli->real_escape_string($_GET['fields'][$a]).\" = '\".$this->mysqli->real_escape_string($_GET['values'][$a]).\"'\";\n            }, range(0, count($_GET['fields'])-1));\n            $orderBy = isset($_GET['orderBy']) ? $this->mysqli->real_escape_string($_GET['orderBy']) : 'rank';\n            $page = isset($_GET['page']) ? intval($_GET['page']) : 0;\n\n            $results = $this->getUsers(\"SELECT * FROM User WHERE \".implode(\" and \", $whereClauses).\" ORDER BY \".$orderBy.\" LIMIT \".$limit.\" OFFSET \".($limit*$page));\n            $isNextPage = count($this->getUsers(\"SELECT * FROM User WHERE \".implode(\" and \", $whereClauses).\" ORDER BY \".$orderBy.\" LIMIT 1 OFFSET \".($limit*($page+1)))) > 0;\n\n            foreach(array_keys($results) as $key) unset($results[$key][\"email\"]);\n\n            return array(\"isNextPage\" => $isNextPage, \"users\" => $results);\n        } \n\n        // Get all of the user's with active submissions\n        else if(isset($_GET['active'])) {\n            return $this->getUsers(\"SELECT * FROM User WHERE isRunning=1\");\n        } \n        \n        // Github calls this once a user has granted us access to their profile info\n        if(isset($_GET[\"githubCallback\"]) && isset($_GET[\"code\"])) {\n            $code = $_GET[\"code\"];\n\n            $serviceFactory = new ServiceFactory();\n            $credentials = new Credentials($this->config['oauth']['githubClientID'], $this->config['oauth']['githubClientSecret'], NULL);\n            $gitHub = $serviceFactory->createService('GitHub', $credentials, new Session(), array('user', 'user:email'));\n            $gitHub->requestAccessToken($code);\n            $githubUser = json_decode($gitHub->request('user'), true);\n            $email = json_decode($gitHub->request('user/emails'), true)[0];\n\n            if($this->numRows(\"SELECT COUNT(*) FROM User WHERE oauthProvider=1 and oauthID={$githubUser['id']}\") > 0) { // Already signed up\n                \n                $_SESSION['userID'] = $this->select(\"SELECT userID FROM User WHERE oauthProvider=1 and oauthID={$githubUser['id']}\")['userID'];\n            } else { // New User\n                $numActiveUsers = $this->numRows(\"SELECT COUNT(*) FROM User WHERE isRunning=1\"); \n                $this->insert(\"INSERT INTO User (username, githubEmail, oauthID, oauthProvider, rank) VALUES ('{$githubUser['login']}', '{$email}', {$githubUser['id']}, 1, {$numActiveUsers})\");\n                $_SESSION['userID'] = $this->mysqli->insert_id;\n            }\n\n            if(isset($_GET['redirectURL'])) header(\"Location: {$_GET['redirectURL']}\");\n            else header(\"Location: \".WEB_DOMAIN);\n            die();\n        } \n    }\n\n    /* Email Endpoint\n     *\n     * Hitting this endpoint allows a user to handle the choosing of their email. \n     */\n    protected function email() {\n        $user = $this->getLoggedInUser();\n\n        if($user != null && isset($_GET['validate'])) {\n            $organization = $this->getOrganizationForEmail($user[\"githubEmail\"]);\n            $this->insert(\"UPDATE User SET email=githubEmail, organization='$organization', isEmailGood=1 WHERE userID = {$user['userID']}\");\n        } else if($user != null && isset($_GET['newEmail'])) {\n            $verificationCode = rand(0, 9999999999);\n            if(isset($_GET['newLevel']) && $_GET['newLevel'] == 'High School') {\n                if(empty($this->getHS($_GET['newInstitution'], null))) { \n                    # The only way this error should occur is if users manually try to game it (i.e.: REST calls)\n                    # As such we can just print their input is incorrect rather than getting a better landing page.\n                    echo \"INVALID INPUT: EITHER INSTITUTION OR SCRIMMAGE ARE NOT FROM AVAILABLE OPTIONS.\";\n                    die();\n                }\n                $this->insert(\"UPDATE User SET email='\".$this->mysqli->real_escape_string($_GET['newEmail']).\n                \"', level='\".$this->mysqli->real_escape_string($_GET['newLevel']).\n                \"', organization='\".$this->mysqli->real_escape_string($_GET['newInstitution']).\n                \"', verificationCode = '{$verificationCode}' WHERE userID = {$user['userID']}\");\n            } else if(isset($_GET['newLevel'])) {\n                $this->insert(\"UPDATE User SET email='\".$this->mysqli->real_escape_string($_GET['newEmail']).\n                \"', level='\".$this->mysqli->real_escape_string($_GET['newLevel']).\n                \"', organization='\".$this->getOrganizationForEmail($this->mysqli->real_escape_string($_GET['newEmail'])).\n                \"', verificationCode = '{$verificationCode}' WHERE userID = {$user['userID']}\");\n            } else {\n                $this->insert(\"UPDATE User SET email='\".$this->mysqli->real_escape_string($_GET['newEmail']).\"', verificationCode = '{$verificationCode}' WHERE userID = {$user['userID']}\");\n            }\n\n            $user[\"email\"] = $_GET[\"newEmail\"];\n            $this->sendNotification($user, \"Email Verification\", \"<p>Click <a href='\".WEB_DOMAIN.\"api/web/email?verificationCode=$verificationCode'>here</a> to verify your email address.</p>\", 0, false, true);\n        } else if(isset($_GET['verificationCode'])) {\n            if($user == null) {\n                $emailCallbackURL = urlencode(WEB_DOMAIN.\"api/web/email?\".$_SERVER['QUERY_STRING']);\n                $githubCallbackURL = urlencode(WEB_DOMAIN.\"api/web/user?githubCallback=1&redirectURL={$emailCallbackURL}\");\n                header(\"Location: https://github.com/login/oauth/authorize?scope=user:email&client_id=2b713362b2f331e1dde3&redirect_uri={$githubCallbackURL}\");\n                die();\n            }\n\n            if(strcmp($user['verificationCode'], $_GET['verificationCode']) != 0) {\n                return \"Invalid verification code\";\n            }\n\n            $organization = $this->getOrganizationForEmail($user[\"email\"]);\n            $this->insert(\"UPDATE User SET isEmailGood=1, organization='$organization' WHERE userID = {$user['userID']}\");\n\n            header(\"Location: \".WEB_DOMAIN.\"index.php?emailVerification=1\");\n            die();\n        } \n    }\n\n    /* Email List Endpoint\n     *\n     * Hitting this endpoint allows a user to subscribe and unsubscribe from all Halite emails. \n     */\n    protected function emailList() {\n        $user = $this->getLoggedInUser();\n        if($user == null) {\n            $emailCallbackURL = urlencode(WEB_DOMAIN.\"api/web/emailList?\".$_SERVER['QUERY_STRING']);\n            $githubCallbackURL = urlencode(WEB_DOMAIN.\"api/web/user?githubCallback=1&redirectURL={$emailCallbackURL}\");\n            header(\"Location: https://github.com/login/oauth/authorize?scope=user:email&client_id=2b713362b2f331e1dde3&redirect_uri={$githubCallbackURL}\");\n        }\n\n        if(isset($_GET['unsubscribe'])) {\n            $this->insert(\"UPDATE User SET onEmailList=0 WHERE userID = {$user['userID']}\");\n            header(\"Location: ../../index.php?unsubscribeEmails=1\");\n        } else if(isset($_GET['subscribe'])) {\n            $this->insert(\"UPDATE User SET onEmailList=1 WHERE userID = {$user['userID']}\");\n            header(\"Location: ../../index.php?subscribeEmails=1\");\n        } \n\n        die();\n    }\n\n    /* User History Endpoint\n     *\n     * We store the a history of user's bot submissions.\n     * This mitigates the 'stealth' submission problem, \n     * where users submit a bot, wait for their rank to stabilize, and take it down for the sake of secrecy.\n     */\n    protected function history() {\n        if(isset($_GET[\"userID\"])) {\n            return $this->selectMultiple(\"SELECT * FROM UserHistory WHERE userID=\".intval($_GET[\"userID\"]).\" ORDER BY versionNumber DESC\");\n        }\n    }\n\n    /* High School Endpoint\n     *\n     * Simple retrieval from the high school store. All participating high schools should be here.\n     */\n    protected function highSchool() {\n        return $this->getHS(isset($_GET[\"name\"])?$_GET[\"name\"]:null, isset($_GET[\"state\"])?$_GET[\"state\"]:null);\n    }\n\n    /* User Notification Endpoint\n     *\n     * Allows the downloading of all of the notifications a user has recieved over email.\n     * Notifications include \"Compilation Success\", \"Bot received\", etc\n     */\n    protected function notification() {\n        if($this->isLoggedIn()) {\n            $userID = $this->getLoggedInUser()['userID'];\n            $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;\n            return $this->selectMultiple(\"SELECT * FROM UserNotification WHERE userID={$userID} ORDER BY userNotificationID DESC LIMIT $limit\");\n        }\n    }\n\n    /* Game Endpoint\n     *\n     * Games are continuously run on our servers and exposed on our website\n     */\n    protected function game() {\n        if(isset($_GET['userID'])) {\n            $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 5;\n            $startingID = isset($_GET['startingID']) ? intval($_GET['startingID']) : PHP_INT_MAX;\n            $userID = intval($_GET['userID']);\n            $versionNumber = isset($_GET['versionNumber']) ? intval($_GET['versionNumber']) : $this->select(\"SELECT numSubmissions FROM User WHERE userID=$userID\")['numSubmissions']; \n\n            $gameArrays = $this->selectMultiple(\"SELECT g.* FROM GameUser gu INNER JOIN Game g ON g.gameID = gu.gameID WHERE gu.userID = $userID and gu.versionNumber = $versionNumber and gu.gameID < $startingID ORDER BY gu.gameID DESC LIMIT $limit\");\n        } else {\n            $previousID = isset($_GET['previousID']) ? intval($_GET['previousID']) : 0;\n            $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 20;\n            $gameArrays = $this->selectMultiple(\"SELECT * FROM Game WHERE gameID > $previousID ORDER BY gameID DESC LIMIT $limit\"); \n        }\n\n        // Get each game's info\n        foreach ($gameArrays as &$gameArray) {\n            $gameID = $gameArray['gameID'];\n\n            // Get information about users\n            $gameArray['users'] = $this->selectMultiple(\"SELECT gu.userID, gu.versionNumber, gu.errorLogName, gu.rank, u.username, u.oauthID, u.mu, u.sigma, u.rank AS userRank FROM GameUser gu INNER JOIN User u ON u.userID=gu.userID WHERE gu.gameID = $gameID\");\n        }\n        return $gameArrays;\n    }\n    \n    /* Bot File Endpoint\n     *\n     * Handles the user's submission of a new bot\n     */\n    protected function botFile() {\n        // Mark a new botfile for compilation if valid. Return error otherwise \n        if($this->isLoggedIn() && isset($_FILES['botFile']['name'])) {\n            $user = $this->getLoggedInUser();\n\n            if(isset($this->config[\"compState\"][\"closeSubmissions\"]) && $this->config[\"compState\"][\"closeSubmissions\"]) {\n                return \"Sorry, bot submissions are closed.\";\n            }\n            \n            if($user['compileStatus'] != 0) {\n                return \"Compiling\";\n            }\n            \n            if ($_FILES[\"botFile\"][\"size\"] > 20000000) {\n                $megabytes = $_FILES[\"botFile\"][\"size\"]/1000000;\n                $this->sendNotification($user, \"Bot TOO LARGE\", \"<p>Your bot archive was {$megabytes} Megabytes. Our limit on bot zip files is 20 Megabytes.</p>\", -1);\n                return \"Sorry, your file is too large.\";\n            }\n\n            $this->loadAwsSdk()->createS3()->putObject([\n                'Key'    => \"{$user['userID']}\",\n                'Body'   => file_get_contents($_FILES['botFile']['tmp_name']),\n                'Bucket' => COMPILE_BUCKET\n            ]);\n            $this->insert(\"UPDATE User SET compileStatus = 1 WHERE userID = {$user['userID']}\");\n\n            if(intval($this->config['test']['isTest']) == 0) $this->sendNotification($user, \"Bot Received\", \"<p>We have received and processed the zip file of your bot's source code. In a few minutes, our servers will compile your bot, and you will receive another email notification, even if your bot has compilation errors.</p>\", 0);\n\n            // AWS auto scaling\n            $numActiveUsers = $this->numRows(\"SELECT COUNT(*) FROM User WHERE isRunning=1\"); \n            $numWorkers = $this->numRows(\"SELECT COUNT(*) FROM Worker\");\n            if($numWorkers > 0 && $numWorkers < WORKER_LIMIT && $numActiveUsers / $numWorkers > USER_TO_SERVER_RATIO) {\n                echo shell_exec(\"python3 openNewWorker.py > /dev/null 2>/dev/null &\");\n            }\n\n            return \"Success\";\n        }\n    }\n    \n    /* Forums Endpoint\n     *\n     * Handle the Discourse forums (2016.forums.halite.io) single sign on authentication.\n     */\n    protected function forums() {\n        // Follows the Discource sso detailed here: https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045\n        if(isset($_GET['sso']) && isset($_GET['sig'])) {\n            if(!$this->isLoggedIn()) {\n                $forumsCallbackURL = urlencode(WEB_DOMAIN.\"api/web/forums?\".http_build_query(array(\"sig\" => $_GET['sig'], \"sso\" => $_GET['sso'])));\n                $githubCallbackURL = urlencode(WEB_DOMAIN.\"api/web/user?githubCallback=1&redirectURL={$forumsCallbackURL}\");\n                header(\"Location: https://github.com/login/oauth/authorize?scope=user:email&client_id=2b713362b2f331e1dde3&redirect_uri={$githubCallbackURL}\");\n                die();\n            }\n\n            $user = $this->getLoggedInUser();\n\n\n            $initialBase64Payload = stripcslashes($_GET['sso']);\n            $signature = $_GET['sig'];\n\n            $correctSignature = hash_hmac(\"sha256\", $initialBase64Payload, $this->config['sso']['secret']);\n\n            if($correctSignature != $signature) {\n                return null;\n            }\n\n            parse_str(base64_decode($initialBase64Payload), $initialPayload);\n            $nonce = $initialPayload[\"nonce\"];\n\n            $finalBase64Payload = base64_encode(http_build_query(array(\n                \"nonce\" => $nonce,\n                \"name\" => $user['username'],\n                \"email\" => $user['email'],\n                \"external_id\" => $user['userID']\n            )));\n            $finalSignature = hash_hmac(\"sha256\", $finalBase64Payload, $this->config['sso']['secret']);\n\n            $finalQueryString = http_build_query(array(\n                \"sso\" => $finalBase64Payload,\n                \"sig\" => $finalSignature\n            ));\n            $finalURL = $this->config['sso']['url'].\"?\".$finalQueryString;\n\n            header(\"Location: \".$this->config['sso']['url'].\"?\".$finalQueryString);\n            die();\n        }\n    }\n    \n    /* Worker Endpoint\n     *\n     * Bots are compiled and run in games by a decentralized network of 'worker' servers.\n     * A few stats about each worker are recorded by our 'manager' server.\n     * These stats are exposed on our status page.\n     */\n    protected function worker() {\n        $workers = $this->selectMultiple(\"SELECT * FROM Worker ORDER BY workerID\");\n        return $workers;\n    }\n    \n    /* Stats endpoint\n     *\n     * Provides a number of statistics about the competition,\n     * which would be expensive or impossible to determine using our generic endpoints.\n     */ \n    protected function stats() {\n        if(isset($_GET['throughput'])) {\n            return mysqli_query($this->mysqli, \"SELECT * FROM Game WHERE TIMESTAMPDIFF(DAY, timestamp, NOW()) < 1\")->num_rows;\n        }\n\n        // Get the number of active users\n        else if(isset($_GET['numSubmissions'])) {\n            return $this->select(\"SELECT SUM(numSubmissions) FROM User\")[\"SUM(numSubmissions)\"];\n        }\n\n        // Get the number of active users\n        else if(isset($_GET['numActive'])) {\n            return mysqli_query($this->mysqli, \"SELECT userID FROM User WHERE isRunning=1\")->num_rows;\n        } \n\n        // Get the median mu and sigma of active users\n        else if(isset($_GET['scoreMedians'])) {\n            $medians = array();\n            $medians[\"mu\"] = $this->select(\"SELECT AVG(tbl.mu) as medianMu FROM (\n                SELECT @rownum:=@rownum+1 as row, mu FROM User, (SELECT @rownum:=0) rn\n                    WHERE isRunning=1 ORDER BY mu\n                ) as tbl\n                WHERE tbl.row in (floor((@rownum+1)/2), floor((@rownum+2)/2))\")[\"medianMu\"];\n\n            $medians[\"sigma\"] = $this->select(\"SELECT AVG(tbl.sigma) as medianSigma FROM (\n                SELECT @rownum:=@rownum+1 as row, sigma FROM User, (SELECT @rownum:=0) rn\n                    WHERE isRunning=1 ORDER BY sigma\n                ) as tbl\n                WHERE tbl.row in (floor((@rownum+1)/2), floor((@rownum+2)/2))\")[\"medianSigma\"];\n            return $medians;\n        }\n    }\n\n    /* Announcement Endpoint\n     *\n     * Annoucements are used as 'news blasts' without requiring email.\n     * An alert with the annoucement's body and header is showed to users.\n     * Once it has been closed, it is never shown to that user again\n     */\n    protected function announcement() {\n        // Get the newest annoucement available to a user\n        if(isset($_GET['userID'])) {\n            return $this->select(\"SELECT a.* FROM Announcement a WHERE NOT EXISTS(SELECT NULL FROM DoneWithAnnouncement d WHERE d.userID = \".intval($_GET['userID']).\" and d.announcementID = a.announcementID) ORDER BY announcementID LIMIT 1;\");\n        } \n        \n        // Mark an annoucement as closed    \n        else if(isset($_POST['announcementID'])) {\n            $announcementID = intval($_POST['announcementID']);\n            $user = $this->getLoggedInUser();\n\n            if(count($this->select(\"SELECT * FROM User WHERE user={$user['userID']} LIMIT 1\")) > 0) {\n                $this->insert(\"INSERT INTO DoneWithAnnouncement (userID, announcementID) VALUES ({$user['userID']}, $announcementID)\");\n                return \"Success\";\n            }\n            return \"Fail\";\n        }\n    }\n    \n    /* Error Log Endpoint\n     *\n     * When a users times-out or errors during a game of Halite on our server,\n     * we store their stdout and stderr output and make it available to them.\n     * Users may only see **their** error logs.\n     */\n    protected function errorLog() {\n        // Return the requested error log only if it belongs to the signed in user.\n        if(isset($_GET['errorLogName']) && isset($_SESSION['userID']) && count($this->select(\"SELECT * FROM GameUser WHERE errorLogName='\".$this->mysqli->real_escape_string($_GET['errorLogName']).\"' and userID={$_SESSION['userID']}\"))) {\n            $result = $this->loadAwsSdk()->createS3()->getObject([\n                'Bucket' => ERROR_LOG_BUCKET,\n                'Key'    => $_GET['errorLogName']\n            ]);\n\n            header($_SERVER[\"SERVER_PROTOCOL\"] . \" 200 OK\");\n            header(\"Cache-Control: public\"); // needed for internet explorer\n            header(\"Content-Type: application/txt\");\n            header(\"Content-Transfer-Encoding: Binary\");\n            header(\"Content-Length:\".strlen($result['Body']));\n            header(\"Content-Disposition: attachment; filename=error.log\");\n            echo $result['Body'];\n            die();\n        }\n        return \"You aren't logged into your Halite account or are trying to access the error log of another contestant.\";\n    }\n    \n    /* Session Endpoint\n     *\n     * Encapsulates the logged in user's info\n     */\n    protected function session() {\n\n        // Get the logged in user's info\n        if($this->method == 'GET') {\n            if(count($_SESSION) > 0) return $_SESSION;\n            else return NULL;\n        } \n        \n        // Log out a user\n        else if($this->method == 'DELETE') {\n            if(isset($_SESSION['userID'])) {\n                $this->logOutForums($this->getForumsID($_SESSION['userID']));\n            }\n            session_destroy();\n            return \"Success\";\n        }\n    }\n }\n\n ?>\n"
  },
  {
    "path": "website/api/web/api.php",
    "content": "<?php\n\nrequire_once \"WebsiteAPI.php\";\n\n// Requests from the same server don't have a HTTP_ORIGIN header\nif (!array_key_exists('HTTP_ORIGIN', $_SERVER)) {\n    $_SERVER['HTTP_ORIGIN'] = $_SERVER['SERVER_NAME'];\n}\n\ntry {\n    $API = new WebsiteAPI($_REQUEST['request']);\n    echo $API->processAPI();\n} catch (Exception $e) {\n    echo json_encode(Array('error' => $e->getMessage()));\n}\n\n?>\n"
  },
  {
    "path": "website/api/web/openNewWorker.py",
    "content": "import boto.ec2\nimport boto.manage.cmdshell\nimport time\nimport random\nimport pymysql\nimport os.path\nimport configparser\n\nparser = configparser.ConfigParser()\nparser.read(\"../../../halite.ini\")\nAWS_CONFIG = parser[\"aws\"]\nDB_CONFIG = parser[\"database\"]\n\n# Create instance\nconn = boto.ec2.connect_to_region(\"us-east-1\", aws_access_key_id=AWS_CONFIG[\"accessKey\"], aws_secret_access_key=AWS_CONFIG[\"secretAccessKey\"])\nsecurityGroup = conn.get_all_security_groups(filters={'group-name': AWS_CONFIG[\"securityGroupName\"]})[0]\nreservation = conn.run_instances(AWS_CONFIG[\"amiID\"], key_name=AWS_CONFIG[\"keyName\"], instance_type=AWS_CONFIG[\"instanceType\"], security_groups=[securityGroup])\ninstance = reservation.instances[0]\n\n# Wait to start\nstatus = instance.update()\nwhile status == \"pending\":\n    time.sleep(1)\n    status = instance.update()\n    print(\"Waiting for instance to start...\")\n\n# Add worker to db\ndb = pymysql.connect(host=DB_CONFIG[\"hostname\"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'])\ncursor = db.cursor()\n\nipAddress = instance.ip_address\nprint(ipAddress)\n\nnumRows = 9999\nwhile numRows != 0:\n    apiKey = random.randrange(0, 10000000)\n    cursor.execute(\"SELECT * FROM Worker WHERE apiKey=\"+str(apiKey))\n    numRows = int(cursor.rowcount)\ncursor.execute(\"INSERT INTO Worker (apiKey, ipAddress) VALUES (\"+str(apiKey)+\", '\"+str(ipAddress)+\"')\")\ndb.commit()\n\ndef runCommandOnInstance(instance, command):\n    # Connect to ssh\n    ssh_client = None\n    for a in range(1000):\n        try:\n            ssh_client = boto.manage.cmdshell.sshclient_from_instance(instance, os.path.join(\"../../../\", AWS_CONFIG[\"keyFilePath\"]), user_name=\"ubuntu\")\n            print(\"Connected to server\")\n            break\n        except Exception as e:\n            print(\"except\")\n            print(str(e))\n\n    # Run install script\n    status, stdout, stderr = ssh_client.run(command)\n    print(stdout)\n    print(stderr)\n\nconfigFileContents = open(\"../../../halite.ini\").read()\nrunCommandOnInstance(instance, \"sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get install -f; sudo rm -rf /var/lib/apt/lists/*; sudo apt-get update\")\nrunCommandOnInstance(instance, \"sudo apt-get install -y --force-yes git; git clone https://github.com/HaliteChallenge/Halite.git; cd Halite; echo '\"+configFileContents+\"' > halite.ini; cd worker; sudo ./install.sh \"+str(apiKey)+\"; sudo reboot\")\n\ntime.sleep(10)\nrunCommandOnInstance(instance, 'cd ~/Halite/worker; ./startWorkerScreen.sh')\n"
  },
  {
    "path": "website/archiveEnvironment.sh",
    "content": "cd ../environment\nzip -r HaliteEnvironment-Source *\nmkdir ../website/downloads/environment\nmv HaliteEnvironment-Source.zip ../website/downloads/environment/\n"
  },
  {
    "path": "website/archiveStarterPackages.sh",
    "content": "rm *-Starter-Package.zip\n\ncd ../airesources/\n\nrm -r *-Starter-Package\n\nmkdir Halite-Python-Starter-Package \\\n      Halite-Java-Starter-Package \\\n      Halite-C++-Starter-Package \\\n      Halite-Rust-Starter-Package \\\n      Halite-C#-Starter-Package \\\n      Halite-Scala-Starter-Package \\\n      Halite-Ruby-Starter-Package \\\n      Halite-Go-Starter-Package \\\n      Halite-PHP-Starter-Package \\\n      Halite-JavaScript-Starter-Package \\\n      Halite-OCaml-Starter-Package \\\n      Halite-Clojure-Starter-Package \\\n      Halite-C-Starter-Package \\\n      Halite-Julia-Starter-Package\n\ncp -r Python/* Halite-Python-Starter-Package/\ncp -r Java/* Halite-Java-Starter-Package/\ncp -r C++/* Halite-C++-Starter-Package/\ncp -r Rust/* Halite-Rust-Starter-Package/\ncp -r Java/* Halite-Scala-Starter-Package/\ncp -r CSharp/* Halite-C#-Starter-Package/\ncp -r Ruby/* Halite-Ruby-Starter-Package/\ncp -r Go/* Halite-Go-Starter-Package/\ncp -r PHP/* Halite-PHP-Starter-Package/\ncp -r JavaScript/* Halite-JavaScript-Starter-Package/\ncp -r OCaml/* Halite-OCaml-Starter-Package/\ncp -r Clojure/* Halite-Clojure-Starter-Package/\ncp -r C/* Halite-C-Starter-Package/\ncp -r Julia/* Halite-Julia-Starter-Package/\n\ncp -r Scala/* Halite-Scala-Starter-Package/\nrm Halite-Scala-Starter-Package/MyBot.java\n\nzip -r Halite-Python-Starter-Package.zip Halite-Python-Starter-Package/\nzip -r Halite-C++-Starter-Package.zip Halite-C++-Starter-Package/\nzip -r Halite-Java-Starter-Package.zip Halite-Java-Starter-Package/ \nzip -r Halite-Rust-Starter-Package.zip Halite-Rust-Starter-Package/ \nzip -r Halite-C#-Starter-Package.zip Halite-C#-Starter-Package/ \nzip -r Halite-Scala-Starter-Package.zip Halite-Scala-Starter-Package/ \nzip -r Halite-Ruby-Starter-Package.zip Halite-Ruby-Starter-Package/ \nzip -r Halite-Go-Starter-Package.zip Halite-Go-Starter-Package/ \nzip -r Halite-PHP-Starter-Package.zip Halite-PHP-Starter-Package/ \nzip -r Halite-JavaScript-Starter-Package.zip Halite-JavaScript-Starter-Package/\nzip -r Halite-OCaml-Starter-Package.zip Halite-OCaml-Starter-Package/\nzip -r Halite-Clojure-Starter-Package.zip Halite-Clojure-Starter-Package/\nzip -r Halite-C-Starter-Package.zip Halite-C-Starter-Package/\nzip -r Halite-Julia-Starter-Package.zip Halite-Julia-Starter-Package/\n\nmkdir -p ../website/downloads/starterpackages\nmv *.zip ../website/downloads/starterpackages\n\nrm -r *-Starter-Package\n"
  },
  {
    "path": "website/assets/favicons/browserconfig.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<browserconfig>\n  <msapplication>\n    <tile>\n      <square150x150logo src=\"/mstile-150x150.png\"/>\n      <TileColor>#002226</TileColor>\n    </tile>\n  </msapplication>\n</browserconfig>\n"
  },
  {
    "path": "website/assets/favicons/manifest.json",
    "content": "{\n\t\"name\": \"Halite\",\n\t\"icons\": [\n\t\t{\n\t\t\t\"src\": \"\\/android-chrome-192x192.png\",\n\t\t\t\"sizes\": \"192x192\",\n\t\t\t\"type\": \"image\\/png\"\n\t\t},\n\t\t{\n\t\t\t\"src\": \"\\/android-chrome-512x512.png\",\n\t\t\t\"sizes\": \"512x512\",\n\t\t\t\"type\": \"image\\/png\"\n\t\t}\n\t],\n\t\"theme_color\": \"#002226\",\n\t\"display\": \"standalone\"\n}\n"
  },
  {
    "path": "website/associate.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Association</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <style>\n        h4 {\n            font-weight: 400;\n        }\n    </style>\n</head>\n\n<body>\n    <div class=\"container\">\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-12\">\n                    <div id=\"messageBox\"></div>\n                    <div id=\"associateMessage\">\n                        <h1>Share Your Affiliation</h1>\n                        <h4>Curious to see how your organization stacks up against the others? Want to see who else from your company or school is playing Halite?</h4>\n                        <h4>Enter your work/school information below and we'll match you with your organization. This way you can see your ranking on your team's leaderboard as well as your ranking overall. May the best bot win!</h4>\n                    </div>\n\n\n                    <div id=\"levelItems\">\n                        <label for=\"selectionLevel\">Select your level:</label>\n                        <select class=\"form-control\" type=\"level\" style=\"margin-top: 0px;max-width: 400px;margin-bottom: 20px;\" id=\"selectionLevel\">\n                            <option>High School</option>\n                            <option>Undergraduate</option>\n                            <option>Graduate</option>\n                            <option selected=\"selected\">Professional</option>\n                        </select>       \n                    </div>\n\n                    <div id=\"highSchoolItems\">\n                        <label for=\"selectionHighSchool\">Select your High School:</label>\n                        <select class=\"form-control\" type=\"level\" style=\"margin-top: 0px;max-width: 400px;margin-bottom: 20px;\" id=\"selectionHighSchool\">\n                        </select>\n                    </div>\n\n                    <div id=\"forms\">\n                        <label for=\"firstField\" style=\"margin-top: 0px\">Please enter your e-mail:</label>\n                        <input class=\"form-control\" type=\"email\" placeholder=\"Email\" style=\"max-width: 400px;\" id=\"firstField\">\n                        <input class=\"form-control\" type=\"email\" placeholder=\"Confirm Email\" style=\"margin-bottom: 10.5px; max-width: 400px;\" id=\"secondField\">\n                        <button id=\"customSubmitButton\" class=\"btn btn-primary\">Submit</button>\n                    </div>\n                    <div id=\"waitMessage\" style=\"display: none;\">\n                        <h2>We've sent you a verification email and are waiting for you to click the link in it. This email may land in your spam folder.</h2>\n                        <h4>If you've already verified your email, head to our <a href=\"index.php\">homepage</a>. If you're having problems with registration, please email us at halite@halite.io.</h4>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <br/><br/>\n        <div id=\"missingAssociation\">\n            <p><center><small>Is your organization missing from our selection? Click <a href=\"mailto:halite@halite.io?Subject=New%20Organization%20Request\" target=\"_top\">here</a> to e-mail us with the name and we will add it promptly.</small></center></p>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/associate.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/basics_faqs.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>FAQs</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n            <h1>Frequently Asked Questions</h1>\n        \n                <h2>About</h2>\n        \n                <h3>What is Halite?</h3>\n                <p>Halite (the game) is a multiplayer turn-based strategy game played on a rectangular grid; the objective of the game is to take over the entire grid and eliminate the other players in the game.<br>Halite (the tournament) is an online programming competition where human coders write bots that play the Halite game against each other.</p>\n\n                <h3>Where does the game come from? Who invented it?</h3>\n                <p>The Halite game was created by <a href=\"https://github.com/Sydriax\">Benjamin Spector</a> and <a href=\"https://github.com/truell20\">Michael Truell</a> during a summer internship at Two Sigma in 2016.<br>The game format is inspired by the 2011 Ants AI Challenge sponsored by Google.</p>\n\n                <h3>Why did you invent it?</h3>\n                <p>Halite’s creators heard about the Ants AI Challenge a few years too late :-(<br>They couldn’t find any other competitions quite like it, so they decided to create one.</p>\n\n                <h2>About the Tournament</h2>\n\n                <h3>What's the goal of the competition?</h3> \n                <p>The goal of Halite is to provide a fun and deep testbed to try new ideas and compete in problem-solving. Furthermore, Halite is being used for recruitment of talent by its sponsors.</p>\n\n                <h3>Who is running the tournament?</h3>\n                <p>The Halite game has been designed and implemented by <a href=\"https://www.twosigma.com/\">Two Sigma</a>, a highly-innovative, technological investment firm based in New York City.<br>The Halite tournament is jointly run with <a href=\"http://tech.cornell.edu/\">Cornell Tech</a>, a new graduate school that brings together faculty, business leaders, tech entrepreneurs, and students in a catalytic environment to produce visionary results grounded in significant needs that will reinvent the way we live in the digital age.</p>\n\n                <h3>How long is the tournament?</h3>\n                <p>The tournament will run from November 2, 2016 to February 2, 2017.</p>\n\n                <h3>How are rankings computed?</h3>\n                <p>Rankings are based on the outcome of organized games where bots play against each other. A good analogy is the <a href=\"https://en.wikipedia.org/wiki/Elo_rating_system\">Elo rating system</a> used for chess.<br>More precisely, rankings are computed using a Bayesian algorithm variant of the <a href=\"https://en.wikipedia.org/wiki/Glicko_rating_system\">Glicko system</a>, specifically using the TrueSkill Python library available <a href=\"https://github.com/sublee/trueskill\">here</a>.</p>\n\n                <h3>How are the winners decided?</h3>\n                <p>Winners are simply the highest ranked players on the <a href=\"https://2016.halite.io/leaderboard.php\">leaderboard</a> at the end of the competition. So, submit early and often!</p>\n\n                <h3>Is there a prize for the winners?</h3>\n                <p>Pride! Bragging rights! Internet royalty!<br>The results of the competition will be officially announced with a link to best players Github profiles.</p>\n\n                <h3>What information do you store about me?</h3> \n                <p>We store the email, username, and unique identifier that Github provides when you login to the halite.io website via Github OAuth.</p>\n\n                <h3>How do you determine my organization?</h3>\n                <p>We check to see if the domain of the email associated with your Github account is on our <a href=\"https://github.com/HaliteChallenge/Halite/blob/master/website/organizationWhitelist.txt\">whitelist</a>.</p>\n                <p>Is your organization not on there? <a href=\"https://github.com/HaliteChallenge/Halite/edit/master/website/organizationWhitelist.txt\">Edit the whitelist</a> and send us a pull request! We'll make sure to tag all members of your organization who have already signed up.</p>\n\n                <h2>Bot Programming</h2>\n\n                <h3>Do I need to be a programmer to play the game?</h3>\n                <p>Yes. Halite is a programming competition. You need to program a bot that will play the game in the Halite tournament.<br>However, you definitely don’t have to be a very good programmer to play Halite effectively. Success is more about coming up with a good strategy to play the game than coding this strategy expertly.</p>\n\n                <h3>What languages does the game support?</h3>\n                <p>Any and all! If the language can read from stdin and print to stdout, we can support it.<br>We provide out-of-the-box starter packages for the following languages: Python, Java and C++. See <a href=\"https://2016.halite.io/downloads.php\">here</a> for our growing list of starter packages.<br>We’re counting on the community to add support for as many languages as people want. Visit <a href=\"https://2016.halite.io/advanced_writing_sp.php\">this page</a> for more information on writing your own starter package and the protocol used by the game environment to talk to your bot.\n\n                <h3>How do I submit my bot?</h3>\n                <p>To submit your bot, you'll first need to zip your source code. Then, after signing in, click the \"Submit\" button on the top-right part of the page. Then, simply select your zipped source code to submit.</p>\n\n                <h2>The Code behind the Tournament</h2>\n\n                <h3>Is the code open source?</h3>\n                <p>Yes.<br>Check out our <a href=\"https://github.com/HaliteChallenge/Halite\">Github repo</a> and you are also welcome (even encouraged) to open issues and/or submit pull requests.</p>\n\n                <h3>How do I contribute to the game and/or report an issue?</h3>\n                <p>You can open an issue or submit a pull request on our <a href=\"https://github.com/HaliteChallenge/Halite\">Github Repo</a>. If you are looking for things to do, checkout our <a href=\"https://github.com/HaliteChallenge/Halite/issues\">open issues</a>.</p>\n\n                <h2>Other</h2>\n\n                <h3>I cannot find an answer to my question, what do I do?</h3>\n                <p>Please check/post on the <a href=\"http://2016.forums.halite.io\">Halite forums</a> or contact-us at <a href=\"mailto:halite@halite.io\">halite@halite.io</a>.\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/basics_improve_random.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php' ?>\n\n    <title>Improving the Random Bot</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php' ?>\n            <div class=\"col-sm-9\">\n                <h1>Improving the Random Bot</h1>\n                <p>In this tutorial, we'll go through the code that powers the random bot and add a couple heuristics to it. This will hopefully help you fully understand Halite and set you on your way to leaderboard domination.</p>\n\n                <p>The code in this tutorial can be found at the following links for <a href=\"https://gist.github.com/truell20/cd964cd3513066b7ff28b7aa5481333b\">Python</a>, <a href=\"https://gist.github.com/Sydriax/a2b8b88c940abe8f346df62a77e23441\">Java</a>, and <a href=\"https://gist.github.com/Sydriax/3aaabd3ecbc03ff997c720e7c5840a9a\">C++</a>.</p>\n                <h3>Prerequisites</h3>\n                <p>Make sure that you have read <a href=\"https://2016.halite.io/basics_intro_halite.php\">Introducing Halite</a> and followed the setup procedures described there.</p>\n                <p>Now open up the MyBot file in your favorite editor and let's get started!</p>\n\n                <h3>Import Considerations</h3>\n                <p>When writing a halite bot, be sure to stay away from functions like <code>System.out.print</code>, <code>cout</code>, <code>print</code>, etc. Bots use stdout and stdin to communicate with the game environment. You will be ejected from a game of Halite if you print debugging info to stdout. Instead, print to a log file.</p>\n\n                <h3>A Look At the Random Bot</h3>\n                <p>Now that you know how the game works, how do the two random starter bots work? How does one code a Halite bot? Here is the source from the main file of our python starter bot:</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-file=\"RandomBot.py\"></span>\n                <p>Let's walk through it line by line.</p>\n\n                <p>First we make some imports from the hlt.py helper file that is included in the starter package:</p>\n\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"1-3\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>Then we get our ID (each player has a unique identifier that is associated with their pieces) and the initial game map from the environment. We send back the name of our bot. This is used in game replays.</p>\n\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"6-7\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>Now we start our game loop:</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"9\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>Each turn, update the current map from the game environment:</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"10\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>Let's create our list of moves by cycling through all the pieces on the map. If a piece is owned by us, let's instruct it to move in a random direction.</p>\n\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"11\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>Finally, let's send all of our moves to the environment:</p>\n\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-hide-footer=\"true\" data-gist-line=\"12\" data-gist-file=\"RandomBot.py\"></span>\n\n                <p>And that's random bot!</p>\n\n                <h3>Utilizing Our Production</h3>\n\n                <p>From the rules outlined in <a href=\"https://2016.halite.io/basics_intro_halite.php\">Introducing Halite</a>, we know that when a piece moves, it gains no strength and leaves behind a piece with zero strength. It easily follows from this that moving zero strength pieces is a terrible idea, since:</p>\n                <ul>\n                    <li>A zero strength piece that moves will necessarily stay at zero strength, because pieces don't gain strength for any turn that they move.</li>\n                    <li>A zero strength piece won't ever conqueror any territory, because it has no strength with which to damage other pieces.</li>\n                </ul>\n                <p>Let's wrap the movement logic inside a function of its own. This function will take a piece as input and will return the piece's movement.</p>\n                <p>Now we can improve our bot by making sure that we tell all of our zero strength pieces to remain still.</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-file=\"Revision1.py\"></span>\n\n                <p>Our bot still moves its pieces around a lot (only a bit over one out of five turns will a piece stay still). This costs us a lot of strength (since a piece doesn't gain any strength on turns that it moves). To increase our utilization of our production, let's have pieces only move once their strength equals their production times some factor X. We're using 5 as the value of X in this example, but this is arbitrary.</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-file=\"Revision2.py\"></span>\n\n                <h3>Moving to Our Borders</h3>\n                <p>When building a Halite bot, one of our goals should be moving strength out of your territory quickly and with little production loss. Our current bot is terrible at this. Its pieces move randomly around our territory, going nowhere, costing us production, and often losing strength to the strength cap. </p>\n                <p>To improve this, let's just mandate that our pieces move only north and west. Since the map is wrap-around, we can still capture all of the board with this strategy! </p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-file=\"Revision3.py\"></span>\n\n                <h3>Improving our Attack</h3>\n                <p>Once our pieces get to our borders, we don't want them to randomly attack just any square (or worse, move back into our territory), as we do now. One problem with this random strategy is that we may attack a map square that has more strength than us. This is unproductive (pun implied) since moving onto the map square costs us a turn of production and we don't actually gain anything. We just diminish the squares strength.</p>\n                <p>To improve on our current combat, if there is an enemy or map square that is adjacent to one of our pieces with less strength than our piece, let's take it.</p>\n                <span data-gist-id=\"cd964cd3513066b7ff28b7aa5481333b\" data-gist-file=\"Revision4.py\"></span>\n\n                <h3>What's Next?</h3>\n                <p>That's really up to you! How you improve your bot from here is where you step into the competition.</p>\n                <p>That said, if you're looking for more ideas or a stronger starting base, <a href=\"https://2016.halite.io/user.php?userID=2697\">nmalaguti</a> wrote <a href=\"http://2016.forums.halite.io/t/so-youve-improved-the-random-bot-now-what/482\">a tutorial</a> that walks you through improving your combat, piece management, and expansion.</p>\n                <p>If you're interested in machine learning, Two Sigma's own <a href=\"https://2016.halite.io/user.php?userID=1669\">Brian van Leeuwen</a> authored <a href=\"http://2016.forums.halite.io/t/ml-starter-bot-tutorial/616\">an introductory deep learning tutorial</a>.</p>\n                <p>Good luck!</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/basics_intro_halite.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Introducing Halite</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Introducing Halite</h1>\n                <p>In <a href=\"basics_quickstart.php\">the last tutorial</a>, we showed how to submit a demo bot to the leaderboard. In this short tutorial, we will go over the files included in a starter package, running a game of halite, and the rules of halite.</p>\n                <h3>A look at the starter package</h3>\n                <p>Your starter package should contain these files.</p>\n\n                <table class=\"table\">\n                    <tr><th>Filename</th><th>Description</th></tr>\n                    <tr><td>MyBot</td><td>Your main file. Starts containing the code for a random bot.</td></tr>\n                    <tr><td>RandomBot</td><td>A random bot to test changes to your bot against.</td></tr>\n                    <tr><td>runGame.sh</td><td>Script to run a game on Linux/macOS</td></tr>\n                    <tr><td>runGame.bat</td><td>Script to run a game on Windows. Assumes halite.exe is in the same folder.</td></tr>\n                </table> \n\n                <p>The file you need to change is MyBot. Regardless of what you do with your code, MyBot will be considered your main file on our game servers.</p>\n\n                <h3>Testing your bot</h3>\n                <p>To play games of Halite locally, you will need the game environment. As of this writing we support Windows, Linux and OSX platforms. You can download the game environment <a href=\"downloads.php\">here</a>. Place the downloaded binary (halite or halite.exe) in your starter kit folder.</p>\n                <p>To simulate a game, simply issue the command ./runGame.sh (Linux and macOS) or runGame.bat (Windows). This command will run a game between my MyBot and RandomBot (both are just copies of each other at this point) on a grid of size 30x30.</p>\n                <p>The output should look like this and the details of the game will be stored in a file with the \"hlt\" extension (35538-124984302.hlt in the example below).</p>\n\n                <pre><code>$ ./runGame.sh \npython3 MyBot.py\npython3 RandomBot.py\nInit Message sent to player 2.\nInit Message sent to player 1.\nInit Message received from player 1, MyPythonBot.\nInit Message received from player 2, RandomPythonBot.\nTurn 1\nTurn 2\nTurn 3\nTurn 4\n…\nTurn 299\nTurn 300\nMap seed was 124984302\nOpening a file at 35538-124984302.hlt\nPlayer #1, MyPythonBot, came in rank #1!\nPlayer #2, RandomPythonBot, came in rank #2!</code></pre>\n\n\n                <h3>Visualizing a game</h3>\n                <p>The console output from the game environment gives just the outcome of the game. To replay the game, drag and drop the file to <a href=\"local_visualizer.php\">the visualizer</a>. Since the starter pack is very bad at playing Halite, your visualization will be quite dull.</p>\n                <p>Here's a taste of what some very good Halite bots look like:</p>\n                <div id=\"gameReplay\" class=\"text-center\"></div>\n                <div id=\"gameReplayTwo\" class=\"text-center\"></div>\n\n                <h3>Halite game rules</h3>\n                <p>What do all of these pretty squares mean?</p>\n                <p>Halite is played on a rectangular grid. Players own pieces on this grid. Some pieces are unowned and so belong to the map until claimed by players. Each piece has a strength value associated with it.</p>\n                <p>At each turn, bots decide how to move the pieces they own. Valid moves are: STILL, NORTH, EAST, SOUTH, WEST. When a piece remains STILL, its strength is increased by the production value of the site it is on. When a piece moves, it leaves behind a piece with the same owner and a strength of zero.</p>\n                <p>When two or more pieces from the same player try to occupy the same site, the resultant piece gets the sum of their strengths (this strength is capped at 255).</p>\n                <p>When pieces with different owners move onto the same site or cardinally adjacent sites, the pieces are forced to fight, and each piece loses strength equal to the strength of its opponent. When a player's piece moves onto an unowned site, that piece and the unowned piece fight, and each piece loses strength equal to the strength of its opponent. </p>\n                <p>When a piece loses all of its strength, it dies and is removed from the grid.</p>\n                <p>For the full rules, see <a href=\"rules_game.php\">here</a>.</p>\n                \n                <h3>How do we program a bot?</h3>\n                <p>Move on to <a href=\"basics_improve_random.php\">Improving the Random Bot</a>.</p>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.2/lodash.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"lib/pixi.min.js\"></script>\n    <script src=\"script/parsereplay.js\"></script>\n    <script src=\"script/visualizer.js\"></script>\n    <script src=\"script/basics_intro_halite.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/basics_quickstart.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Getting Started</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Getting Started</h1>\n                <p>In this short tutorial, we will explain how to submit your first bot and get your name on the Halite leaderboard.</p>\n                \n                <h3>Register using Github</h3>\n\n                <p>You will need a Github account in order to participate in the Halite tournament. If you don't have a Github account, please create a new account <a href=\"https://github.com/join\"> here</a>. Sign up for Halite by clicking \"Login with Github\" at the top right of this page.</p>\n\n                <h3>Download a Starter Package</h3>\n\n                <p>Download a starter package for your language of choice from the <a href=\"downloads.php\">downloads page</a>.</p>\n                \n                <p>Each starter package consists of a zip file that includes: (a) one code template for your your first bot (the MyBot file), (b) one code sample for a random bot (the RandomBot file), (c) some support libraries for the bot and (d) some tools to test your bot locally.</p> \n\n                <h3>Getting on the Leaderboard</h3>\n\n                <p>To get on the leaderboard, you need to submit a bot to the Halite tournament.</p>\n                <p>Click the \"Submit\" button in the navigation bar. In general, you need to package your submission as a zip file that contains everything needed to run your bot (your bot’s source code, starter package source files, supplemental libraries, etc.). For your first submission, you can simply upload the zipped starter package that you just downloaded. You will receive an email notification that your submission has been received.</p>\n                <p>The Halite servers will compile the source code of your submission and continuously play your bot against other contestants, which will generate your leaderboard ranking. If the compilation of your source code fails, we will email you.</p>\n                <p>To track your bot's progress, navigate to your <a href=\"user.php\">homepage</a>.</p>\n\n                <h3>Next Steps</h3>\n                <p>Congratulations. You are now an official contestant!</p>\n                <p>It may be up to <b>10 minutes</b> before your bot has played a few games. In the meantime, move onto <a href=\"basics_intro_halite.php\">Introducing Halite</a>.</p>\n\n                <h3>Join the Community</h3>\n                <p>If you need help or have feedback, please visit the <a href=\"http://2016.forums.halite.io/\">forums</a>! If you’d like to hang out and chat with other players, come join the <a href=\"https://discordapp.com/invite/rbVDB4n\">official discord</a>.</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/composer.json",
    "content": "{\n    \"require\": {\n        \"lusitanian/oauth\": \"~0.3\",\n        \"swiftmailer/swiftmailer\": \"^5.4.3\",\n        \"aws/aws-sdk-php\": \"^3.19\"\n    }\n}\n"
  },
  {
    "path": "website/cron/backupDatabase",
    "content": "#!/bin/bash\n \nTIMESTAMP=$(date +%s)\nmysqldump -u root Halite > \"/etc/cron.hourly/dump/\"$TIMESTAMP\"_dump.sql\"\nrsync -azvP /etc/cron.hourly/dump/* root@192.241.158.114:/backup/db\n"
  },
  {
    "path": "website/cron/backupWebsite",
    "content": "#!/bin/bash\n\nrsync -azvP /root/Halite/storage/bots/* root@192.241.158.114:/backup/web/storage/bots/\nrsync -azvP /root/Halite/halite.ini root@192.241.158.114:/backup/web/\n"
  },
  {
    "path": "website/downloads.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Downloads</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <div class=\"col-sm-12\">\n                <h1>Downloads</h1>\n\n                <h2>Starter Packages</h2>\n                <p>\n                    On December 31st, we patched the version of the Java starter package that we had released on December 30th.\n                </p>\n                <h3>Official Packages</h3>\n                <ul>\n                    <li><a href=\"downloads/starterpackages/Halite-Python-Starter-Package.zip\">Python 3</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Java-Starter-Package.zip\">Java 8</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-C++-Starter-Package.zip\">C++ 11</a></li>\n                </ul>\n                <h3>Community Packages</h3>\n                <ul>\n                    <li><a href=\"downloads/starterpackages/Halite-C%23-Starter-Package.zip\">C# 6.0</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Rust-Starter-Package.zip\">Rust 1.10</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Scala-Starter-Package.zip\">Scala 2.10.4</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Ruby-Starter-Package.zip\">Ruby 2.3.1</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Go-Starter-Package.zip\">Go 1.6</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-PHP-Starter-Package.zip\">PHP 7.0</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-JavaScript-Starter-Package.zip\">Node.js (JavaScript) 7.1.0</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-OCaml-Starter-Package.zip\">OCaml 4.01.0</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Clojure-Starter-Package.zip\">Clojure 1.8.0</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-C-Starter-Package.zip\">C</a></li>\n                    <li><a href=\"downloads/starterpackages/Halite-Julia-Starter-Package.zip\">Julia 0.5.0</a></li>\n                </ul>\n                </p>\n\n                <h2>Game Environment</h2>\n                <p>The environment is on version <b>1.1</b>. This version of the environment was posted on December 9th.</p>\n\n                <h3>Linux/macOS</h3>\n                <p>Execute:</p>\n                <pre><code>sh -c \"$(curl -fsSL https://raw.githubusercontent.com/HaliteChallenge/Halite/master/environment/install.sh)\"</code></pre>\n                <p>You should see a file titled \"halite\" in your current directory. This is the game environment. Put it in the root directory of your starter package.</p>\n\n                <h3>Windows</h3>\n                <p>Download the halite.exe executable from <a href=\"https://ci.appveyor.com/project/Sydriax/halite/build/artifacts\">here</a>. Put it in the root directory of your starter package.</p>\n\n                <h3>Building from Source</h3>\n                <p>Extract <a href=\"downloads/environment/HaliteEnvironment-Source.zip\">this archive</a>.</p>\n                <p>If you are on Unix, run <code>make</code> inside the extracted folder. The halite binary will now run the environment.</p>\n                <p>If you are on Windows, run the \"make.bat\" file. The file named \"halite.exe\" is your new environment binary.</p>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/email.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Email Selection</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <style>\n        h4 {\n            font-weight: 400;\n        }\n    </style>\n</head>\n\n<body>\n    <div class=\"container\">\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-12\">\n                    <div id=\"messageBox\"></div>\n                    <div id=\"firstMessage\">\n                        <h1>One Last Step...</h1>\n                        <h4>You need to enter your preferred email.</h4>\n                        <h4>We’ll use the domain of your email address to identify your university or company so you can easily see how you rank against others in your organization. We’ll also email you about bot submission events like compilation errors. You can opt out of these at any time.</h4>\n                    </div>\n                    <div id=\"returningMessage\">\n                        <h1>Email Change</h1>\n                        <h4>Please enter your preferred email.</h4>\n                        <h4>We’ll use the domain of your email address to identify your university or company so you can easily see how you rank against others in your organization. We’ll also email you about bot submission events like compilation errors. You can opt out of these at any time.</h4>\n                    </div>\n\n                    <div id=\"forms\">\n                        <input class=\"form-control\" type=\"email\" placeholder=\"Email\" style=\"margin-top: 20px; max-width: 400px;\" id=\"firstField\">\n                        <input class=\"form-control\" type=\"email\" placeholder=\"Confirm Email\" style=\"margin-bottom: 10.5px; max-width: 400px;\" id=\"secondField\">\n                        <button id=\"customSubmitButton\" class=\"btn btn-primary\">Submit</button>\n                    </div>\n                    <div id=\"waitMessage\" style=\"display: none;\">\n                        <h2>We've sent you a verification email and are waiting for you to click the link in it. This email may land in your spam folder.</h2>\n                        <h4>If you've already verified your email, head to our <a href=\"index.php\">homepage</a>. If you're having problems with registration, please email us at halite@halite.io.</h4>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/email.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/game.php",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Game</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <style type=\"text/css\">\n        .glyphicon-refresh-animate {\n            -animation: spin .7s infinite linear;\n            -webkit-animation: spin2 .7s infinite linear;\n        }\n        @-webkit-keyframes spin2 {\n            from {\n                -webkit-transform: rotate(0deg);\n            }\n            to {\n                -webkit-transform: rotate(360deg);\n            }\n        }\n        @keyframes spin {\n            from {\n                transform: scale(1) rotate(0deg);\n            }\n            to {\n                transform: scale(1) rotate(360deg);\n            }\n        }\n    </style>\n\n</head>\n<body>\n    <div id=\"container\" class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div id=\"pageContent\" class=\"pageContent text-center\">\n        </div>\n    </div>\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.2/lodash.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.6/pako_inflate.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"lib/pixi.min.js\"></script>\n    <script src=\"script/parsereplay.js\"></script>\n    <script src=\"script/visualizer.js\"></script>\n    <script src=\"script/game.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/includes/dropdowns.php",
    "content": "<li>\n  <a href=\"basics_quickstart.php\">Learn</a>\n</li>\n<li>\n  <a href=\"downloads.php\">Download</a>\n</li>\n<li>\n  <a href=\"leaderboard.php\">Rankings</a>\n</li>\n<li>\n    <a href=\"local_visualizer.php\">Visualize</a>\n</li>\n<li>\n  <a href=\"http://2016.forums.halite.io\">Forums</a>\n</li>\n<li>\n  <a href=\"about.php\">About</a>\n</li>"
  },
  {
    "path": "website/includes/footer.php",
    "content": "\n\n<div align=\"center\" style=\"bottom: 0; left: 0; right: 0; height: 50px;\">\n  <hr/>\n  <a href=\"/terms_of_service.php\">Terms of Service</a>\n|\n  <a href=\"/privacy_policy.php\">Privacy Policy</a>\n</div>"
  },
  {
    "path": "website/includes/header.php",
    "content": "<meta charset=\"utf-8\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"google-site-verification\" content=\"UzLAOvN92N2iaw_7HcFXSOc_M-WIe3KFXaozuaNsZo4\" />\n"
  },
  {
    "path": "website/includes/leaderTable.php",
    "content": "<table class=\"table\" id=\"leaderTable\">\n    <thead>\n        <tr>\n            <th></th>\n            <th>User</th>\n            <th>Tier</th>\n            <th>Language</th>\n            <th>Level</th>\n            <th>Organization</th>\n            <th>Points</th>\n        </tr>\n    </thead>\n    <tbody id=\"leaderTableBody\">\n    </tbody>\n</table>\n"
  },
  {
    "path": "website/includes/learn_sidebar.php",
    "content": "<style>\n    /* sidebar */\n    .bs-docs-sidebar {\n        padding-left: 20px;\n        margin-bottom: 20px;\n    }\n\n    .bs-docs-sidebar .nav>li>span {\n        color: #63ceca;\n    }\n\n    .bs-docs-sidebar .nav>li>span,\n    .bs-docs-sidebar .nav>li>a { border-left: 2px solid transparent;\n        padding: 4px 20px;\n        font-size: 18px;\n        font-weight: 400;\n    }\n\n    /* nested links */\n    .bs-docs-sidebar .nav .nav>li>a {\n        padding-top: 1px;\n        padding-bottom: 1px;\n        padding-left: 30px;\n        font-size: 12px;\n    }\n\n    /* active & hover links */\n    .bs-docs-sidebar .nav>.active>a, \n    .bs-docs-sidebar .nav>li>a:hover, \n    .bs-docs-sidebar .nav>li>a:focus {\n        text-decoration: none;          \n        background-color: transparent;  \n    }\n\n    /* nested active links */\n    .bs-docs-sidebar .nav .nav>.active>a, \n    .bs-docs-sidebar .nav .nav>.active:hover>a,\n    .bs-docs-sidebar .nav .nav>.active:focus>a {\n        font-weight: 700;\n        border-left-color: #63ceca; \n        font-weight: 500;\n    }\n\n</style>\n\n<nav class=\"col-sm-3 bs-docs-sidebar\">\n    <ul id=\"sidebar\" class=\"nav nav-stacked\">\n        <li class=\"\">\n            <span>Basics</span>\n            <ul class=\"nav nav-stacked\">\n                <li id=\"basics_quickstart\">\n                    <a href=\"basics_quickstart.php\">Getting Started</a>\n                </li>\n                <li id=\"basics_intro_halite\">\n                    <a href=\"basics_intro_halite.php\">Introducing Halite</a>\n                </li>\n                <li id=\"basics_improve_random\">\n                    <a href=\"basics_improve_random.php\">Improving the Random Bot</a>\n                </li>\n                <li id=\"basics_faqs\">\n                    <a href=\"basics_faqs.php\">FAQs</a>\n                </li>\n            </ul>\n        </li>\n        <li class=\"\">\n            <span>Rules</span>\n            <ul class=\"nav nav-stacked\">\n                <li id=\"rules_game\">\n                    <a href=\"rules_game.php\">Game Rules</a>\n                </li>\n                <li id=\"rules_contest\">\n                    <a href=\"rules_contest.php\">Contest Rules</a>\n                </li>\n            </ul>\n        </li>\n        <li class=\"\">\n            <span>Advanced</span>\n            <ul class=\"nav nav-stacked\">\n                <li id=\"advanced_development\">\n                    <a href=\"advanced_development.php\">Best Practices</a>\n                </li>\n                <li id=\"advanced_libraries\">\n                    <a href=\"advanced_libraries.php\">Submitting A Bot</a>\n                </li>\n                <li id=\"advanced_third_party\">\n                    <a href=\"advanced_third_party.php\">Third Party Resources</a>\n                </li>\n                <li id=\"advanced_writing_sp\">\n                    <a href=\"advanced_writing_sp.php\">Writing Your Own Starter Package</a>\n                </li>\n                <li id=\"advanced_command_line\">\n                    <a href=\"advanced_command_line.php\">Halite Environment CLI</a>\n                </li>\n                <li id=\"advanced_replay_file\">\n                    <a href=\"advanced_replay_file.php\">Replay Files</a>\n                </li>\n                <li id=\"advanced_game_server\">\n                    <a href=\"advanced_game_server.php\">Game Servers</a>\n                </li>\n            </ul>\n        </li>\n    </ul>\n    <hr>\n    <p style=\"line-height: 1.5em; font-size: 13px;\">You can <a id=\"githubLink\" href=\"\">edit this content on GitHub</a> and send us a pull request!</p>\n</nav>\n\n<script>\n    var fileName = location.pathname.substring(location.pathname.lastIndexOf(\"/\") + 1);\n    document.getElementById(\"githubLink\").href = \"https://github.com/HaliteChallenge/Halite/blob/master/website/\"+fileName;\n\n    var name = fileName.split(\".\")[0];\n    document.getElementById(name).className = \"active\";\n</script>\n"
  },
  {
    "path": "website/includes/login_form.php",
    "content": "<div id=\"login_form\">\n  <div class=\"form-group\">\n    <label for=\"login_user\" class=\"control-label\">Username</label>\n    <input type=\"username\" class=\"form-control\" id=\"login_user\">\n  </div>\n  <div class=\"form-group\">\n    <label for=\"login_pass\" class=\"control-label\">Password</label>\n    <input id=\"login_pass\" class=\"form-control\" type=\"password\" size=\"30\" >\n  </div>\n  <div>\n    <input id=\"login_button\" class=\"btn btn-primary\" style=\"width: 100%\" type=\"submit\" name=\"commit\" value=\"Login\" />\n  </div>\n</div>\n"
  },
  {
    "path": "website/includes/navbar.php",
    "content": "<?php\nsession_start();\n$config = parse_ini_file(\"../halite.ini\", true);\nif(isset($_SESSION['userID'])) {\n    $mysqli = new mysqli($config['database']['hostname'],\n        $config['database']['username'],\n        $config['database']['password'],\n        $config['database']['name']);\n\n    if (mysqli_connect_errno()) {\n        echo \"<br><br>There seems to be a problem with our database. Reload the page or try again later.\";\n        exit();\n    }\n    if(count(mysqli_fetch_array(mysqli_query($mysqli, \"SELECT * FROM User WHERE userID={$_SESSION['userID']} and isEmailGood=0\"))) > 0) {\n        header(\"Location: associate.php\");\n    }\n}\n?>\n<nav class=\"navbar navbar-default\" id=\"navvy\">\n    <div class=\"container-fluid\">\n        <div class=\"navbar-header\">\n            <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n                <span class=\"sr-only\">Toggle navigation</span>\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n            </button>\n            <a class=\"navbar-brand\" style=\"padding: 10px\" href=\"index.php\"><img src=\"assets/full_logo.png\" style=\"height: 100%;\"></a>\n        </div>\n        <div id=\"navbar\" class=\"navbar-collapse collapse\">\n            <ul class=\"nav navbar-nav navbar-right loggedOut\" id=\"loginNav\">\n                <ul class=\"nav navbar-nav\">\n                    <?php include 'includes/dropdowns.php'; ?>\n                    <li>\n                      <a href=\"https://github.com/login/oauth/authorize?scope=user:email&client_id=2b713362b2f331e1dde3\">Login with Github</a>\n                    </li>\n                </ul>\n            </ul>\n            <form id=\"submitForm\">\n                <ul class=\"nav navbar-nav navbar-right loggedIn\" id=\"logoutNav\">\n                    <?php include 'includes/dropdowns.php'; ?>\n                    <?php if(!isset($config[\"compState\"][\"closeSubmissions\"]) || !$config[\"compState\"][\"closeSubmissions\"]): ?>\n                    <li><a href=\"#\" id=\"submitButton\">Submit</a><input type=\"file\" id=\"myFile\" name=\"botFile\"></li>\n                    <?php endif; ?>\n                    <li><a href=\"#\" id=\"logoutButton\">Logout</a></li>\n                    <li><a href=\"associate.php\">Associate</a></li>\n                </ul>\n            </form>\n        </div>\n    </div>\n</nav>\n\n<div id=\"messageBox\"></div>\n\n<div class=\"modal fade\" id=\"submitModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h1 class=\"modal-title\" id=\"myModalLabel\">Halite Submission Instructions</h1>\n            </div>\n            <div class=\"modal-body\">\n                <h3>Name your main file <b>MyBot</b> with an appropriate file extension (e.g. MyBot.java).</h3>\n                <h3>Make sure that you aren't using stdout or stdin (print, cout, System.out.print, etc), which will cause your bot to fail. Instead, use <a href=\"advanced_development.php\">a log file</a>.</h3>\n                <h3>Upload a <b>zip file</b> of your source code.</h3>\n                <h3>Once we have compiled your code, you will get an email notification.</h3>\n                <button id=\"submitModalButton\" type=\"button\" class=\"btn btn-primary\">Submit!</button>\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "website/includes/register_form.php",
    "content": "<div id=\"register_form\">\n  <div class=\"form-group label-floating is-empty\">\n    <label for=\"register_email\" class=\"control-label\">Email</label>\n    <input id=\"register_email\" class=\"form-control\" type=\"email\" size=\"30\" >\n  </div>\n  <div class=\"form-group\">\n    <label for=\"register_user\" class=\"control-label\">Username</label>\n    <input type=\"username\" class=\"form-control\" id=\"register_user\">\n  </div>\n  <div class=\"form-group\">\n    <label for=\"register_pass\" class=\"control-label\">Password</label>\n    <input id=\"register_pass\" class=\"form-control\" type=\"password\" size=\"30\" >\n  </div>\n  <div class=\"form-group\">\n    <label for=\"register_confirm_pass\" class=\"control-label\">Confirm Password</label>\n    <input id=\"register_confirm_pass\" class=\"form-control\" type=\"password\" size=\"30\" >\n  </div>\n  <div>\n    <input id=\"register_button\" class=\"btn btn-primary\" style=\"width: 100%\" type=\"submit\" name=\"commit\" value=\"Register\" />\n  </div>\n</div>\n"
  },
  {
    "path": "website/index.php",
    "content": "<?php\nsession_start();\nif(isset($_SESSION['userID'])) {\n    $config = parse_ini_file(\"../halite.ini\", true);\n    $mysqli = new mysqli($config['database']['hostname'],\n        $config['database']['username'],\n        $config['database']['password'],\n        $config['database']['name']);\n\n    if (mysqli_connect_errno()) {\n        echo \"<br><br>There seems to be a problem with our database. Reload the page or try again later.\";\n        exit();\n    }\n    if(count(mysqli_fetch_array(mysqli_query($mysqli, \"SELECT * FROM User WHERE userID={$_SESSION['userID']} and isRunning=1\"))) > 0) {\n        header(\"Location: user.php?\".$_SERVER['QUERY_STRING']);\n    }\n}\n?>\n\n<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Halite AI Programming Challenge</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <style>\n        p:not(.featurette) {\n            font-size: 21px;\n            font-weight: 400;\n        }\n        .featurette {\n            font-size: 16px;\n        }\n    </style>\n</head>\n\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-12\">\n                    <img src=\"assets/hero.png\" style=\"margin-bottom: 21px; width: 100%\">\n                    <div id=\"intro_blurb\">\n                        <h1>The official Halite Competition is over!</h1>\n                        <p>Halite's final rankings closed on February 16, 2017. Thank you to our 1500+ competitors!</p>\n                        <p>Congratulations to mzotkiew, Halite's winner. Congrats also to the rest of the top 10: shummie, erdman, timfoden, curbin, PeppiKokki, DexGroves, nmalaguti, moonbirth, and ewirkerman. You can see some of their post-mortems and bot source code <a href=\"http://2016.forums.halite.io/t/published-bot-source-code/987\">here</a>.</p>\n                        <p>Two Sigma plans to release another programming competition in the future. Stay tuned!</p>\n                        <h1>Halite is an artificial intelligence programming challenge.</h1>\n                        <p>Players control a bot using the programming language of their choice. Bots fight for control of a 2D grid. The bot with the most territory at the end wins. Victory will require micromanaging of the movement of your pieces, optimizing your bot's combat ability, and braving a branching factor billions of times higher than that of Go.</p>\n                        <div id=\"gameReplay\" class=\"text-center\"></div>\n                    </div>\n\n                    <h1>Creators</h1>\n                    <p>The Halite game was designed and implemented by <a href=\"https://www.twosigma.com\">Two Sigma</a> for their annual summer programming competition. The current version of the competition is run with the help of <a href=\"http://tech.cornell.edu/\">Cornell Tech</a>.</p>\n                    \n                    <div class=\"row\">\n                        <div class=\"col-sm-6\">\n                            <div class=\"text-center\" style=\"margin-top: 10px; margin-bottom: 20.5px;\"><a href=\"https://www.twosigma.com\"><img src=\"assets/two_sigma.png\" style=\"max-width: 100%; max-height: 70px;\"></a></div>\n                            <p class=\"featurette\">Two Sigma is a technology company dedicated to finding value in the world’s data. Since its founding in 2001, Two Sigma has built an innovative platform that combines extraordinary computing power, vast amounts of information, and advanced data science to produce breakthroughs in investment management, insurance and related fields.</p>\n                        </div>\n\n                        <div class=\"col-sm-6\">\n                            <div class=\"text-center\" style=\"margin-top: 10px; margin-bottom: 20.5px;\"><a href=\"https://tech.cornell.edu\"><img src=\"assets/cornell_tech.png\" style=\"max-width: 100%; max-height: 70px\"></a></div>\n                            <p class=\"featurette\">Cornell Tech brings together faculty, business leaders, tech entrepreneurs, and students in a catalytic environment to produce visionary results grounded in significant needs that will reinvent the way we live in the digital age.</p>\n                        </div>\n                    </div>\n\n                    <h1>Sponsors</h1>\n                    <p>Halite is grateful for the support of many strong tech partners!</p>\n                    \n                    <div class=\"text-center\">\n                        <a href=\"https://www.vettery.com/\"><img src=\"assets/vettery.png\" style=\"max-width: 100%; max-height: 40px; margin-right: 40px; margin-top: 10px; margin-bottom: 20.5px;\"></a>\n                        <a href=\"https://www.aminoapps.com/\"><img src=\"assets/amino.png\" style=\"max-width: 100%; max-height: 40px; margin-top: 10px; margin-bottom: 20.5px;\"></a>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.2/lodash.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"lib/pixi.min.js\"></script>\n    <script src=\"script/parsereplay.js\"></script>\n    <script src=\"script/visualizer.js\"></script>\n    <script src=\"script/index.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/install.sh",
    "content": "LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php\napt-get update\n\napt-get install -y php5.6 php5.6-mysql apache2 \na2enmod rewrite expires\n\napt-get install -y python3 python3-pip \n\npip3 install trueskill boto paramiko pymysql\n\napt-get install -y zip \n\ncurl -sS https://getcomposer.org/installer | php\nmv composer.phar /usr/local/bin/composer\ncomposer install\n"
  },
  {
    "path": "website/leaderboard.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Rankings</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-12\">\n                    <div class=\"row\" style=\"margin-top: 21px; margin-bottom: 10px;\">\n                        <div class=\"col-sm-9\">\n                            <h1 id=\"leaderHeading\" style=\"margin-top: 0px;\">Leaderboard</h1>\n                            <p>There are <span id=\"numUsers\">1366</span> users on the Halite leaderboard. Want to join them? Visit our <a href=\"basics_quickstart.php\">getting started guide</a>.</p>\n                        </div>\n                        <div class=\"col-sm-3\">\n                            <div class=\"input-group\">\n                               <input type=\"text\" id=\"usernameField\" class=\"form-control\" placeholder=\"Username\">\n                               <span class=\"input-group-btn\">\n                                    <button class=\"btn btn-default\" style=\"border-width: 2px;\" id=\"usernameSubmitButton\" type=\"button\">Find</button>\n                               </span>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"panel panel-default\">\n                        <?php include 'includes/leaderTable.php'; ?>\n                    </div>\n\n                    <hr>\n\n                    <div id=\"footer\">\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/leaderTable.js\"></script>\n    <script src=\"script/leaderboard.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/alerts.less",
    "content": "//\n// Alerts\n// --------------------------------------------------\n\n\n// Base styles\n// -------------------------\n\n.alert {\n  padding: @alert-padding;\n  margin-bottom: @line-height-computed;\n  border: 1px solid transparent;\n  border-radius: @alert-border-radius;\n\n  // Headings for larger alerts\n  h4 {\n    margin-top: 0;\n    // Specified for the h4 to prevent conflicts of changing @headings-color\n    color: inherit;\n  }\n\n  // Provide class for links that match alerts\n  .alert-link {\n    font-weight: @alert-link-font-weight;\n  }\n\n  // Improve alignment and spacing of inner content\n  > p,\n  > ul {\n    margin-bottom: 0;\n  }\n\n  > p + p {\n    margin-top: 5px;\n  }\n}\n\n// Dismissible alerts\n//\n// Expand the right padding and account for the close button's positioning.\n\n.alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0.\n.alert-dismissible {\n  padding-right: (@alert-padding + 20);\n\n  // Adjust close link position\n  .close {\n    position: relative;\n    top: -2px;\n    right: -21px;\n    color: inherit;\n  }\n}\n\n// Alternate styles\n//\n// Generate contextual modifier classes for colorizing the alert.\n\n.alert-success {\n  .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text);\n}\n\n.alert-info {\n  .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text);\n}\n\n.alert-warning {\n  .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text);\n}\n\n.alert-danger {\n  .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/badges.less",
    "content": "//\n// Badges\n// --------------------------------------------------\n\n\n// Base class\n.badge {\n  display: inline-block;\n  min-width: 10px;\n  padding: 3px 7px;\n  font-size: @font-size-small;\n  font-weight: @badge-font-weight;\n  color: @badge-color;\n  line-height: @badge-line-height;\n  vertical-align: middle;\n  white-space: nowrap;\n  text-align: center;\n  background-color: @badge-bg;\n  border-radius: @badge-border-radius;\n\n  // Empty badges collapse automatically (not available in IE8)\n  &:empty {\n    display: none;\n  }\n\n  // Quick fix for badges in buttons\n  .btn & {\n    position: relative;\n    top: -1px;\n  }\n\n  .btn-xs &,\n  .btn-group-xs > .btn & {\n    top: 0;\n    padding: 1px 5px;\n  }\n\n  // Hover state, but only for links\n  a& {\n    &:hover,\n    &:focus {\n      color: @badge-link-hover-color;\n      text-decoration: none;\n      cursor: pointer;\n    }\n  }\n\n  // Account for badges in navs\n  .list-group-item.active > &,\n  .nav-pills > .active > a > & {\n    color: @badge-active-color;\n    background-color: @badge-active-bg;\n  }\n\n  .list-group-item > & {\n    float: right;\n  }\n\n  .list-group-item > & + & {\n    margin-right: 5px;\n  }\n\n  .nav-pills > li > a > & {\n    margin-left: 3px;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/bootstrap.less",
    "content": "/*!\n * Bootstrap v3.3.7 (http://getbootstrap.com)\n * Copyright 2011-2016 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n\n// Core variables and mixins\n@import \"variables.less\";\n@import \"mixins.less\";\n\n// Reset and dependencies\n@import \"normalize.less\";\n@import \"print.less\";\n@import \"glyphicons.less\";\n\n// Core CSS\n@import \"scaffolding.less\";\n@import \"type.less\";\n@import \"code.less\";\n@import \"grid.less\";\n@import \"tables.less\";\n@import \"forms.less\";\n@import \"buttons.less\";\n\n// Components\n@import \"component-animations.less\";\n@import \"dropdowns.less\";\n@import \"button-groups.less\";\n@import \"input-groups.less\";\n@import \"navs.less\";\n@import \"navbar.less\";\n@import \"breadcrumbs.less\";\n@import \"pagination.less\";\n@import \"pager.less\";\n@import \"labels.less\";\n@import \"badges.less\";\n@import \"jumbotron.less\";\n@import \"thumbnails.less\";\n@import \"alerts.less\";\n@import \"progress-bars.less\";\n@import \"media.less\";\n@import \"list-group.less\";\n@import \"panels.less\";\n@import \"responsive-embed.less\";\n@import \"wells.less\";\n@import \"close.less\";\n\n// Components w/ JavaScript\n@import \"modals.less\";\n@import \"tooltip.less\";\n@import \"popovers.less\";\n@import \"carousel.less\";\n\n// Utility classes\n@import \"utilities.less\";\n@import \"responsive-utilities.less\";\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/breadcrumbs.less",
    "content": "//\n// Breadcrumbs\n// --------------------------------------------------\n\n\n.breadcrumb {\n  padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal;\n  margin-bottom: @line-height-computed;\n  list-style: none;\n  background-color: @breadcrumb-bg;\n  border-radius: @border-radius-base;\n\n  > li {\n    display: inline-block;\n\n    + li:before {\n      content: \"@{breadcrumb-separator}\\00a0\"; // Unicode space added since inline-block means non-collapsing white-space\n      padding: 0 5px;\n      color: @breadcrumb-color;\n    }\n  }\n\n  > .active {\n    color: @breadcrumb-active-color;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/button-groups.less",
    "content": "//\n// Button groups\n// --------------------------------------------------\n\n// Make the div behave like a button\n.btn-group,\n.btn-group-vertical {\n  position: relative;\n  display: inline-block;\n  vertical-align: middle; // match .btn alignment given font-size hack above\n  > .btn {\n    position: relative;\n    float: left;\n    // Bring the \"active\" button to the front\n    &:hover,\n    &:focus,\n    &:active,\n    &.active {\n      z-index: 2;\n    }\n  }\n}\n\n// Prevent double borders when buttons are next to each other\n.btn-group {\n  .btn + .btn,\n  .btn + .btn-group,\n  .btn-group + .btn,\n  .btn-group + .btn-group {\n    margin-left: -1px;\n  }\n}\n\n// Optional: Group multiple button groups together for a toolbar\n.btn-toolbar {\n  margin-left: -5px; // Offset the first child's margin\n  &:extend(.clearfix all);\n\n  .btn,\n  .btn-group,\n  .input-group {\n    float: left;\n  }\n  > .btn,\n  > .btn-group,\n  > .input-group {\n    margin-left: 5px;\n  }\n}\n\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n  border-radius: 0;\n}\n\n// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match\n.btn-group > .btn:first-child {\n  margin-left: 0;\n  &:not(:last-child):not(.dropdown-toggle) {\n    .border-right-radius(0);\n  }\n}\n// Need .dropdown-toggle since :last-child doesn't apply, given that a .dropdown-menu is used immediately after it\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n  .border-left-radius(0);\n}\n\n// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)\n.btn-group > .btn-group {\n  float: left;\n}\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group > .btn-group:first-child:not(:last-child) {\n  > .btn:last-child,\n  > .dropdown-toggle {\n    .border-right-radius(0);\n  }\n}\n.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  .border-left-radius(0);\n}\n\n// On active and open, don't show outline\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n  outline: 0;\n}\n\n\n// Sizing\n//\n// Remix the default button sizing classes into new ones for easier manipulation.\n\n.btn-group-xs > .btn { &:extend(.btn-xs); }\n.btn-group-sm > .btn { &:extend(.btn-sm); }\n.btn-group-lg > .btn { &:extend(.btn-lg); }\n\n\n// Split button dropdowns\n// ----------------------\n\n// Give the line between buttons some depth\n.btn-group > .btn + .dropdown-toggle {\n  padding-left: 8px;\n  padding-right: 8px;\n}\n.btn-group > .btn-lg + .dropdown-toggle {\n  padding-left: 12px;\n  padding-right: 12px;\n}\n\n// The clickable button for toggling the menu\n// Remove the gradient and set the same inset shadow as the :active state\n.btn-group.open .dropdown-toggle {\n  .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n\n  // Show no shadow for `.btn-link` since it has no other button styles.\n  &.btn-link {\n    .box-shadow(none);\n  }\n}\n\n\n// Reposition the caret\n.btn .caret {\n  margin-left: 0;\n}\n// Carets in other button sizes\n.btn-lg .caret {\n  border-width: @caret-width-large @caret-width-large 0;\n  border-bottom-width: 0;\n}\n// Upside down carets for .dropup\n.dropup .btn-lg .caret {\n  border-width: 0 @caret-width-large @caret-width-large;\n}\n\n\n// Vertical button groups\n// ----------------------\n\n.btn-group-vertical {\n  > .btn,\n  > .btn-group,\n  > .btn-group > .btn {\n    display: block;\n    float: none;\n    width: 100%;\n    max-width: 100%;\n  }\n\n  // Clear floats so dropdown menus can be properly placed\n  > .btn-group {\n    &:extend(.clearfix all);\n    > .btn {\n      float: none;\n    }\n  }\n\n  > .btn + .btn,\n  > .btn + .btn-group,\n  > .btn-group + .btn,\n  > .btn-group + .btn-group {\n    margin-top: -1px;\n    margin-left: 0;\n  }\n}\n\n.btn-group-vertical > .btn {\n  &:not(:first-child):not(:last-child) {\n    border-radius: 0;\n  }\n  &:first-child:not(:last-child) {\n    .border-top-radius(@btn-border-radius-base);\n    .border-bottom-radius(0);\n  }\n  &:last-child:not(:first-child) {\n    .border-top-radius(0);\n    .border-bottom-radius(@btn-border-radius-base);\n  }\n}\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn-group:first-child:not(:last-child) {\n  > .btn:last-child,\n  > .dropdown-toggle {\n    .border-bottom-radius(0);\n  }\n}\n.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  .border-top-radius(0);\n}\n\n\n// Justified button groups\n// ----------------------\n\n.btn-group-justified {\n  display: table;\n  width: 100%;\n  table-layout: fixed;\n  border-collapse: separate;\n  > .btn,\n  > .btn-group {\n    float: none;\n    display: table-cell;\n    width: 1%;\n  }\n  > .btn-group .btn {\n    width: 100%;\n  }\n\n  > .btn-group .dropdown-menu {\n    left: auto;\n  }\n}\n\n\n// Checkbox and radio options\n//\n// In order to support the browser's form validation feedback, powered by the\n// `required` attribute, we have to \"hide\" the inputs via `clip`. We cannot use\n// `display: none;` or `visibility: hidden;` as that also hides the popover.\n// Simply visually hiding the inputs via `opacity` would leave them clickable in\n// certain cases which is prevented by using `clip` and `pointer-events`.\n// This way, we ensure a DOM element is visible to position the popover from.\n//\n// See https://github.com/twbs/bootstrap/pull/12794 and\n// https://github.com/twbs/bootstrap/pull/14559 for more information.\n\n[data-toggle=\"buttons\"] {\n  > .btn,\n  > .btn-group > .btn {\n    input[type=\"radio\"],\n    input[type=\"checkbox\"] {\n      position: absolute;\n      clip: rect(0,0,0,0);\n      pointer-events: none;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/buttons.less",
    "content": "//\n// Buttons\n// --------------------------------------------------\n\n\n// Base styles\n// --------------------------------------------------\n\n.btn {\n  display: inline-block;\n  margin-bottom: 0; // For input.btn\n  font-weight: @btn-font-weight;\n  text-align: center;\n  vertical-align: middle;\n  touch-action: manipulation;\n  cursor: pointer;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid transparent;\n  white-space: nowrap;\n  .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @btn-border-radius-base);\n  .user-select(none);\n\n  &,\n  &:active,\n  &.active {\n    &:focus,\n    &.focus {\n      .tab-focus();\n    }\n  }\n\n  &:hover,\n  &:focus,\n  &.focus {\n    color: @btn-default-color;\n    text-decoration: none;\n  }\n\n  &:active,\n  &.active {\n    outline: 0;\n    background-image: none;\n    .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n  }\n\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    cursor: @cursor-disabled;\n    .opacity(.65);\n    .box-shadow(none);\n  }\n\n  a& {\n    &.disabled,\n    fieldset[disabled] & {\n      pointer-events: none; // Future-proof disabling of clicks on `<a>` elements\n    }\n  }\n}\n\n\n// Alternate buttons\n// --------------------------------------------------\n\n.btn-default {\n  .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);\n}\n.btn-primary {\n  .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);\n}\n// Success appears as green\n.btn-success {\n  .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border);\n}\n// Info appears as blue-green\n.btn-info {\n  .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);\n}\n// Warning appears as orange\n.btn-warning {\n  .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);\n}\n// Danger and error appear as red\n.btn-danger {\n  .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);\n}\n\n\n// Link buttons\n// -------------------------\n\n// Make a button look and behave like a link\n.btn-link {\n  color: @link-color;\n  font-weight: normal;\n  border-radius: 0;\n\n  &,\n  &:active,\n  &.active,\n  &[disabled],\n  fieldset[disabled] & {\n    background-color: transparent;\n    .box-shadow(none);\n  }\n  &,\n  &:hover,\n  &:focus,\n  &:active {\n    border-color: transparent;\n  }\n  &:hover,\n  &:focus {\n    color: @link-hover-color;\n    text-decoration: @link-hover-decoration;\n    background-color: transparent;\n  }\n  &[disabled],\n  fieldset[disabled] & {\n    &:hover,\n    &:focus {\n      color: @btn-link-disabled-color;\n      text-decoration: none;\n    }\n  }\n}\n\n\n// Button Sizes\n// --------------------------------------------------\n\n.btn-lg {\n  // line-height: ensure even-numbered height of button next to large input\n  .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @btn-border-radius-large);\n}\n.btn-sm {\n  // line-height: ensure proper height of button next to small input\n  .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @btn-border-radius-small);\n}\n.btn-xs {\n  .button-size(@padding-xs-vertical; @padding-xs-horizontal; @font-size-small; @line-height-small; @btn-border-radius-small);\n}\n\n\n// Block button\n// --------------------------------------------------\n\n.btn-block {\n  display: block;\n  width: 100%;\n}\n\n// Vertically space out multiple block buttons\n.btn-block + .btn-block {\n  margin-top: 5px;\n}\n\n// Specificity overrides\ninput[type=\"submit\"],\ninput[type=\"reset\"],\ninput[type=\"button\"] {\n  &.btn-block {\n    width: 100%;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/carousel.less",
    "content": "//\n// Carousel\n// --------------------------------------------------\n\n\n// Wrapper for the slide container and indicators\n.carousel {\n  position: relative;\n}\n\n.carousel-inner {\n  position: relative;\n  overflow: hidden;\n  width: 100%;\n\n  > .item {\n    display: none;\n    position: relative;\n    .transition(.6s ease-in-out left);\n\n    // Account for jankitude on images\n    > img,\n    > a > img {\n      &:extend(.img-responsive);\n      line-height: 1;\n    }\n\n    // WebKit CSS3 transforms for supported devices\n    @media all and (transform-3d), (-webkit-transform-3d) {\n      .transition-transform(~'0.6s ease-in-out');\n      .backface-visibility(~'hidden');\n      .perspective(1000px);\n\n      &.next,\n      &.active.right {\n        .translate3d(100%, 0, 0);\n        left: 0;\n      }\n      &.prev,\n      &.active.left {\n        .translate3d(-100%, 0, 0);\n        left: 0;\n      }\n      &.next.left,\n      &.prev.right,\n      &.active {\n        .translate3d(0, 0, 0);\n        left: 0;\n      }\n    }\n  }\n\n  > .active,\n  > .next,\n  > .prev {\n    display: block;\n  }\n\n  > .active {\n    left: 0;\n  }\n\n  > .next,\n  > .prev {\n    position: absolute;\n    top: 0;\n    width: 100%;\n  }\n\n  > .next {\n    left: 100%;\n  }\n  > .prev {\n    left: -100%;\n  }\n  > .next.left,\n  > .prev.right {\n    left: 0;\n  }\n\n  > .active.left {\n    left: -100%;\n  }\n  > .active.right {\n    left: 100%;\n  }\n\n}\n\n// Left/right controls for nav\n// ---------------------------\n\n.carousel-control {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  width: @carousel-control-width;\n  .opacity(@carousel-control-opacity);\n  font-size: @carousel-control-font-size;\n  color: @carousel-control-color;\n  text-align: center;\n  text-shadow: @carousel-text-shadow;\n  background-color: rgba(0, 0, 0, 0); // Fix IE9 click-thru bug\n  // We can't have this transition here because WebKit cancels the carousel\n  // animation if you trip this while in the middle of another animation.\n\n  // Set gradients for backgrounds\n  &.left {\n    #gradient > .horizontal(@start-color: rgba(0,0,0,.5); @end-color: rgba(0,0,0,.0001));\n  }\n  &.right {\n    left: auto;\n    right: 0;\n    #gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));\n  }\n\n  // Hover/focus state\n  &:hover,\n  &:focus {\n    outline: 0;\n    color: @carousel-control-color;\n    text-decoration: none;\n    .opacity(.9);\n  }\n\n  // Toggles\n  .icon-prev,\n  .icon-next,\n  .glyphicon-chevron-left,\n  .glyphicon-chevron-right {\n    position: absolute;\n    top: 50%;\n    margin-top: -10px;\n    z-index: 5;\n    display: inline-block;\n  }\n  .icon-prev,\n  .glyphicon-chevron-left {\n    left: 50%;\n    margin-left: -10px;\n  }\n  .icon-next,\n  .glyphicon-chevron-right {\n    right: 50%;\n    margin-right: -10px;\n  }\n  .icon-prev,\n  .icon-next {\n    width:  20px;\n    height: 20px;\n    line-height: 1;\n    font-family: serif;\n  }\n\n\n  .icon-prev {\n    &:before {\n      content: '\\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)\n    }\n  }\n  .icon-next {\n    &:before {\n      content: '\\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)\n    }\n  }\n}\n\n// Optional indicator pips\n//\n// Add an unordered list with the following class and add a list item for each\n// slide your carousel holds.\n\n.carousel-indicators {\n  position: absolute;\n  bottom: 10px;\n  left: 50%;\n  z-index: 15;\n  width: 60%;\n  margin-left: -30%;\n  padding-left: 0;\n  list-style: none;\n  text-align: center;\n\n  li {\n    display: inline-block;\n    width:  10px;\n    height: 10px;\n    margin: 1px;\n    text-indent: -999px;\n    border: 1px solid @carousel-indicator-border-color;\n    border-radius: 10px;\n    cursor: pointer;\n\n    // IE8-9 hack for event handling\n    //\n    // Internet Explorer 8-9 does not support clicks on elements without a set\n    // `background-color`. We cannot use `filter` since that's not viewed as a\n    // background color by the browser. Thus, a hack is needed.\n    // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer\n    //\n    // For IE8, we set solid black as it doesn't support `rgba()`. For IE9, we\n    // set alpha transparency for the best results possible.\n    background-color: #000 \\9; // IE8\n    background-color: rgba(0,0,0,0); // IE9\n  }\n  .active {\n    margin: 0;\n    width:  12px;\n    height: 12px;\n    background-color: @carousel-indicator-active-bg;\n  }\n}\n\n// Optional captions\n// -----------------------------\n// Hidden by default for smaller viewports\n.carousel-caption {\n  position: absolute;\n  left: 15%;\n  right: 15%;\n  bottom: 20px;\n  z-index: 10;\n  padding-top: 20px;\n  padding-bottom: 20px;\n  color: @carousel-caption-color;\n  text-align: center;\n  text-shadow: @carousel-text-shadow;\n  & .btn {\n    text-shadow: none; // No shadow for button elements in carousel-caption\n  }\n}\n\n\n// Scale up controls for tablets and up\n@media screen and (min-width: @screen-sm-min) {\n\n  // Scale up the controls a smidge\n  .carousel-control {\n    .glyphicon-chevron-left,\n    .glyphicon-chevron-right,\n    .icon-prev,\n    .icon-next {\n      width: (@carousel-control-font-size * 1.5);\n      height: (@carousel-control-font-size * 1.5);\n      margin-top: (@carousel-control-font-size / -2);\n      font-size: (@carousel-control-font-size * 1.5);\n    }\n    .glyphicon-chevron-left,\n    .icon-prev {\n      margin-left: (@carousel-control-font-size / -2);\n    }\n    .glyphicon-chevron-right,\n    .icon-next {\n      margin-right: (@carousel-control-font-size / -2);\n    }\n  }\n\n  // Show and left align the captions\n  .carousel-caption {\n    left: 20%;\n    right: 20%;\n    padding-bottom: 30px;\n  }\n\n  // Move up the indicators\n  .carousel-indicators {\n    bottom: 20px;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/close.less",
    "content": "//\n// Close icons\n// --------------------------------------------------\n\n\n.close {\n  float: right;\n  font-size: (@font-size-base * 1.5);\n  font-weight: @close-font-weight;\n  line-height: 1;\n  color: @close-color;\n  text-shadow: @close-text-shadow;\n  .opacity(.2);\n\n  &:hover,\n  &:focus {\n    color: @close-color;\n    text-decoration: none;\n    cursor: pointer;\n    .opacity(.5);\n  }\n\n  // Additional properties for button version\n  // iOS requires the button element instead of an anchor tag.\n  // If you want the anchor version, it requires `href=\"#\"`.\n  // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile\n  button& {\n    padding: 0;\n    cursor: pointer;\n    background: transparent;\n    border: 0;\n    -webkit-appearance: none;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/code.less",
    "content": "//\n// Code (inline and block)\n// --------------------------------------------------\n\n\n// Inline and block code styles\ncode,\nkbd,\npre,\nsamp {\n  font-family: @font-family-monospace;\n}\n\n// Inline code\ncode {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: @code-color;\n  background-color: @code-bg;\n  border-radius: @border-radius-base;\n}\n\n// User input typically entered via keyboard\nkbd {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: @kbd-color;\n  background-color: @kbd-bg;\n  border-radius: @border-radius-small;\n  box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);\n\n  kbd {\n    padding: 0;\n    font-size: 100%;\n    font-weight: bold;\n    box-shadow: none;\n  }\n}\n\n// Blocks of code\npre {\n  display: block;\n  padding: ((@line-height-computed - 1) / 2);\n  margin: 0 0 (@line-height-computed / 2);\n  font-size: (@font-size-base - 1); // 14px to 13px\n  line-height: @line-height-base;\n  word-break: break-all;\n  word-wrap: break-word;\n  color: @pre-color;\n  background-color: @pre-bg;\n  border: 1px solid @pre-border-color;\n  border-radius: @border-radius-base;\n\n  // Account for some code outputs that place code tags in pre tags\n  code {\n    padding: 0;\n    font-size: inherit;\n    color: inherit;\n    white-space: pre-wrap;\n    background-color: transparent;\n    border-radius: 0;\n  }\n}\n\n// Enable scrollable blocks of code\n.pre-scrollable {\n  max-height: @pre-scrollable-max-height;\n  overflow-y: scroll;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/component-animations.less",
    "content": "//\n// Component animations\n// --------------------------------------------------\n\n// Heads up!\n//\n// We don't use the `.opacity()` mixin here since it causes a bug with text\n// fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552.\n\n.fade {\n  opacity: 0;\n  .transition(opacity .15s linear);\n  &.in {\n    opacity: 1;\n  }\n}\n\n.collapse {\n  display: none;\n\n  &.in      { display: block; }\n  tr&.in    { display: table-row; }\n  tbody&.in { display: table-row-group; }\n}\n\n.collapsing {\n  position: relative;\n  height: 0;\n  overflow: hidden;\n  .transition-property(~\"height, visibility\");\n  .transition-duration(.35s);\n  .transition-timing-function(ease);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/dropdowns.less",
    "content": "//\n// Dropdown menus\n// --------------------------------------------------\n\n\n// Dropdown arrow/caret\n.caret {\n  display: inline-block;\n  width: 0;\n  height: 0;\n  margin-left: 2px;\n  vertical-align: middle;\n  border-top:   @caret-width-base dashed;\n  border-top:   @caret-width-base solid ~\"\\9\"; // IE8\n  border-right: @caret-width-base solid transparent;\n  border-left:  @caret-width-base solid transparent;\n}\n\n// The dropdown wrapper (div)\n.dropup,\n.dropdown {\n  position: relative;\n}\n\n// Prevent the focus on the dropdown toggle when closing dropdowns\n.dropdown-toggle:focus {\n  outline: 0;\n}\n\n// The dropdown menu (ul)\n.dropdown-menu {\n  position: absolute;\n  top: 100%;\n  left: 0;\n  z-index: @zindex-dropdown;\n  display: none; // none by default, but block on \"open\" of the menu\n  float: left;\n  min-width: 160px;\n  padding: 5px 0;\n  margin: 2px 0 0; // override default ul\n  list-style: none;\n  font-size: @font-size-base;\n  text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)\n  background-color: @dropdown-bg;\n  border: 1px solid @dropdown-fallback-border; // IE8 fallback\n  border: 1px solid @dropdown-border;\n  border-radius: @border-radius-base;\n  .box-shadow(0 6px 12px rgba(0,0,0,.175));\n  background-clip: padding-box;\n\n  // Aligns the dropdown menu to right\n  //\n  // Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`\n  &.pull-right {\n    right: 0;\n    left: auto;\n  }\n\n  // Dividers (basically an hr) within the dropdown\n  .divider {\n    .nav-divider(@dropdown-divider-bg);\n  }\n\n  // Links within the dropdown menu\n  > li > a {\n    display: block;\n    padding: 3px 20px;\n    clear: both;\n    font-weight: normal;\n    line-height: @line-height-base;\n    color: @dropdown-link-color;\n    white-space: nowrap; // prevent links from randomly breaking onto new lines\n  }\n}\n\n// Hover/Focus state\n.dropdown-menu > li > a {\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    color: @dropdown-link-hover-color;\n    background-color: @dropdown-link-hover-bg;\n  }\n}\n\n// Active state\n.dropdown-menu > .active > a {\n  &,\n  &:hover,\n  &:focus {\n    color: @dropdown-link-active-color;\n    text-decoration: none;\n    outline: 0;\n    background-color: @dropdown-link-active-bg;\n  }\n}\n\n// Disabled state\n//\n// Gray out text and ensure the hover/focus state remains gray\n\n.dropdown-menu > .disabled > a {\n  &,\n  &:hover,\n  &:focus {\n    color: @dropdown-link-disabled-color;\n  }\n\n  // Nuke hover/focus effects\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    background-color: transparent;\n    background-image: none; // Remove CSS gradient\n    .reset-filter();\n    cursor: @cursor-disabled;\n  }\n}\n\n// Open state for the dropdown\n.open {\n  // Show the menu\n  > .dropdown-menu {\n    display: block;\n  }\n\n  // Remove the outline when :focus is triggered\n  > a {\n    outline: 0;\n  }\n}\n\n// Menu positioning\n//\n// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown\n// menu with the parent.\n.dropdown-menu-right {\n  left: auto; // Reset the default from `.dropdown-menu`\n  right: 0;\n}\n// With v3, we enabled auto-flipping if you have a dropdown within a right\n// aligned nav component. To enable the undoing of that, we provide an override\n// to restore the default dropdown menu alignment.\n//\n// This is only for left-aligning a dropdown menu within a `.navbar-right` or\n// `.pull-right` nav component.\n.dropdown-menu-left {\n  left: 0;\n  right: auto;\n}\n\n// Dropdown section headers\n.dropdown-header {\n  display: block;\n  padding: 3px 20px;\n  font-size: @font-size-small;\n  line-height: @line-height-base;\n  color: @dropdown-header-color;\n  white-space: nowrap; // as with > li > a\n}\n\n// Backdrop to catch body clicks on mobile, etc.\n.dropdown-backdrop {\n  position: fixed;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  top: 0;\n  z-index: (@zindex-dropdown - 10);\n}\n\n// Right aligned dropdowns\n.pull-right > .dropdown-menu {\n  right: 0;\n  left: auto;\n}\n\n// Allow for dropdowns to go bottom up (aka, dropup-menu)\n//\n// Just add .dropup after the standard .dropdown class and you're set, bro.\n// TODO: abstract this so that the navbar fixed styles are not placed here?\n\n.dropup,\n.navbar-fixed-bottom .dropdown {\n  // Reverse the caret\n  .caret {\n    border-top: 0;\n    border-bottom: @caret-width-base dashed;\n    border-bottom: @caret-width-base solid ~\"\\9\"; // IE8\n    content: \"\";\n  }\n  // Different positioning for bottom up menu\n  .dropdown-menu {\n    top: auto;\n    bottom: 100%;\n    margin-bottom: 2px;\n  }\n}\n\n\n// Component alignment\n//\n// Reiterate per navbar.less and the modified component alignment there.\n\n@media (min-width: @grid-float-breakpoint) {\n  .navbar-right {\n    .dropdown-menu {\n      .dropdown-menu-right();\n    }\n    // Necessary for overrides of the default right aligned menu.\n    // Will remove come v4 in all likelihood.\n    .dropdown-menu-left {\n      .dropdown-menu-left();\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/forms.less",
    "content": "//\n// Forms\n// --------------------------------------------------\n\n\n// Normalize non-controls\n//\n// Restyle and baseline non-control form elements.\n\nfieldset {\n  padding: 0;\n  margin: 0;\n  border: 0;\n  // Chrome and Firefox set a `min-width: min-content;` on fieldsets,\n  // so we reset that to ensure it behaves more like a standard block element.\n  // See https://github.com/twbs/bootstrap/issues/12359.\n  min-width: 0;\n}\n\nlegend {\n  display: block;\n  width: 100%;\n  padding: 0;\n  margin-bottom: @line-height-computed;\n  font-size: (@font-size-base * 1.5);\n  line-height: inherit;\n  color: @legend-color;\n  border: 0;\n  border-bottom: 1px solid @legend-border-color;\n}\n\nlabel {\n  display: inline-block;\n  max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)\n  margin-bottom: 5px;\n  font-weight: bold;\n}\n\n\n// Normalize form controls\n//\n// While most of our form styles require extra classes, some basic normalization\n// is required to ensure optimum display with or without those classes to better\n// address browser inconsistencies.\n\n// Override content-box in Normalize (* isn't specific enough)\ninput[type=\"search\"] {\n  .box-sizing(border-box);\n}\n\n// Position radios and checkboxes better\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 4px 0 0;\n  margin-top: 1px \\9; // IE8-9\n  line-height: normal;\n}\n\ninput[type=\"file\"] {\n  display: block;\n}\n\n// Make range inputs behave like textual form controls\ninput[type=\"range\"] {\n  display: block;\n  width: 100%;\n}\n\n// Make multiple select elements height not fixed\nselect[multiple],\nselect[size] {\n  height: auto;\n}\n\n// Focus for file, radio, and checkbox\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n  .tab-focus();\n}\n\n// Adjust output element\noutput {\n  display: block;\n  padding-top: (@padding-base-vertical + 1);\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @input-color;\n}\n\n\n// Common form controls\n//\n// Shared size and type resets for form controls. Apply `.form-control` to any\n// of the following form controls:\n//\n// select\n// textarea\n// input[type=\"text\"]\n// input[type=\"password\"]\n// input[type=\"datetime\"]\n// input[type=\"datetime-local\"]\n// input[type=\"date\"]\n// input[type=\"month\"]\n// input[type=\"time\"]\n// input[type=\"week\"]\n// input[type=\"number\"]\n// input[type=\"email\"]\n// input[type=\"url\"]\n// input[type=\"search\"]\n// input[type=\"tel\"]\n// input[type=\"color\"]\n\n.form-control {\n  display: block;\n  width: 100%;\n  height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)\n  padding: @padding-base-vertical @padding-base-horizontal;\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @input-color;\n  background-color: @input-bg;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid @input-border;\n  border-radius: @input-border-radius; // Note: This has no effect on <select>s in some browsers, due to the limited stylability of <select>s in CSS.\n  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));\n  .transition(~\"border-color ease-in-out .15s, box-shadow ease-in-out .15s\");\n\n  // Customize the `:focus` state to imitate native WebKit styles.\n  .form-control-focus();\n\n  // Placeholder\n  .placeholder();\n\n  // Unstyle the caret on `<select>`s in IE10+.\n  &::-ms-expand {\n    border: 0;\n    background-color: transparent;\n  }\n\n  // Disabled and read-only inputs\n  //\n  // HTML5 says that controls under a fieldset > legend:first-child won't be\n  // disabled if the fieldset is disabled. Due to implementation difficulty, we\n  // don't honor that edge case; we style them as disabled anyway.\n  &[disabled],\n  &[readonly],\n  fieldset[disabled] & {\n    background-color: @input-bg-disabled;\n    opacity: 1; // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655\n  }\n\n  &[disabled],\n  fieldset[disabled] & {\n    cursor: @cursor-disabled;\n  }\n\n  // Reset height for `textarea`s\n  textarea& {\n    height: auto;\n  }\n}\n\n\n// Search inputs in iOS\n//\n// This overrides the extra rounded corners on search inputs in iOS so that our\n// `.form-control` class can properly style them. Note that this cannot simply\n// be added to `.form-control` as it's not specific enough. For details, see\n// https://github.com/twbs/bootstrap/issues/11586.\n\ninput[type=\"search\"] {\n  -webkit-appearance: none;\n}\n\n\n// Special styles for iOS temporal inputs\n//\n// In Mobile Safari, setting `display: block` on temporal inputs causes the\n// text within the input to become vertically misaligned. As a workaround, we\n// set a pixel line-height that matches the given height of the input, but only\n// for Safari. See https://bugs.webkit.org/show_bug.cgi?id=139848\n//\n// Note that as of 9.3, iOS doesn't support `week`.\n\n@media screen and (-webkit-min-device-pixel-ratio: 0) {\n  input[type=\"date\"],\n  input[type=\"time\"],\n  input[type=\"datetime-local\"],\n  input[type=\"month\"] {\n    &.form-control {\n      line-height: @input-height-base;\n    }\n\n    &.input-sm,\n    .input-group-sm & {\n      line-height: @input-height-small;\n    }\n\n    &.input-lg,\n    .input-group-lg & {\n      line-height: @input-height-large;\n    }\n  }\n}\n\n\n// Form groups\n//\n// Designed to help with the organization and spacing of vertical forms. For\n// horizontal forms, use the predefined grid classes.\n\n.form-group {\n  margin-bottom: @form-group-margin-bottom;\n}\n\n\n// Checkboxes and radios\n//\n// Indent the labels to position radios/checkboxes as hanging controls.\n\n.radio,\n.checkbox {\n  position: relative;\n  display: block;\n  margin-top: 10px;\n  margin-bottom: 10px;\n\n  label {\n    min-height: @line-height-computed; // Ensure the input doesn't jump when there is no text\n    padding-left: 20px;\n    margin-bottom: 0;\n    font-weight: normal;\n    cursor: pointer;\n  }\n}\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n  position: absolute;\n  margin-left: -20px;\n  margin-top: 4px \\9;\n}\n\n.radio + .radio,\n.checkbox + .checkbox {\n  margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing\n}\n\n// Radios and checkboxes on same line\n.radio-inline,\n.checkbox-inline {\n  position: relative;\n  display: inline-block;\n  padding-left: 20px;\n  margin-bottom: 0;\n  vertical-align: middle;\n  font-weight: normal;\n  cursor: pointer;\n}\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n  margin-top: 0;\n  margin-left: 10px; // space out consecutive inline controls\n}\n\n// Apply same disabled cursor tweak as for inputs\n// Some special care is needed because <label>s don't inherit their parent's `cursor`.\n//\n// Note: Neither radios nor checkboxes can be readonly.\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  &[disabled],\n  &.disabled,\n  fieldset[disabled] & {\n    cursor: @cursor-disabled;\n  }\n}\n// These classes are used directly on <label>s\n.radio-inline,\n.checkbox-inline {\n  &.disabled,\n  fieldset[disabled] & {\n    cursor: @cursor-disabled;\n  }\n}\n// These classes are used on elements with <label> descendants\n.radio,\n.checkbox {\n  &.disabled,\n  fieldset[disabled] & {\n    label {\n      cursor: @cursor-disabled;\n    }\n  }\n}\n\n\n// Static form control text\n//\n// Apply class to a `p` element to make any string of text align with labels in\n// a horizontal form layout.\n\n.form-control-static {\n  // Size it appropriately next to real form controls\n  padding-top: (@padding-base-vertical + 1);\n  padding-bottom: (@padding-base-vertical + 1);\n  // Remove default margin from `p`\n  margin-bottom: 0;\n  min-height: (@line-height-computed + @font-size-base);\n\n  &.input-lg,\n  &.input-sm {\n    padding-left: 0;\n    padding-right: 0;\n  }\n}\n\n\n// Form control sizing\n//\n// Build on `.form-control` with modifier classes to decrease or increase the\n// height and font-size of form controls.\n//\n// The `.form-group-* form-control` variations are sadly duplicated to avoid the\n// issue documented in https://github.com/twbs/bootstrap/issues/15074.\n\n.input-sm {\n  .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @input-border-radius-small);\n}\n.form-group-sm {\n  .form-control {\n    height: @input-height-small;\n    padding: @padding-small-vertical @padding-small-horizontal;\n    font-size: @font-size-small;\n    line-height: @line-height-small;\n    border-radius: @input-border-radius-small;\n  }\n  select.form-control {\n    height: @input-height-small;\n    line-height: @input-height-small;\n  }\n  textarea.form-control,\n  select[multiple].form-control {\n    height: auto;\n  }\n  .form-control-static {\n    height: @input-height-small;\n    min-height: (@line-height-computed + @font-size-small);\n    padding: (@padding-small-vertical + 1) @padding-small-horizontal;\n    font-size: @font-size-small;\n    line-height: @line-height-small;\n  }\n}\n\n.input-lg {\n  .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @input-border-radius-large);\n}\n.form-group-lg {\n  .form-control {\n    height: @input-height-large;\n    padding: @padding-large-vertical @padding-large-horizontal;\n    font-size: @font-size-large;\n    line-height: @line-height-large;\n    border-radius: @input-border-radius-large;\n  }\n  select.form-control {\n    height: @input-height-large;\n    line-height: @input-height-large;\n  }\n  textarea.form-control,\n  select[multiple].form-control {\n    height: auto;\n  }\n  .form-control-static {\n    height: @input-height-large;\n    min-height: (@line-height-computed + @font-size-large);\n    padding: (@padding-large-vertical + 1) @padding-large-horizontal;\n    font-size: @font-size-large;\n    line-height: @line-height-large;\n  }\n}\n\n\n// Form control feedback states\n//\n// Apply contextual and semantic states to individual form controls.\n\n.has-feedback {\n  // Enable absolute positioning\n  position: relative;\n\n  // Ensure icons don't overlap text\n  .form-control {\n    padding-right: (@input-height-base * 1.25);\n  }\n}\n// Feedback icon (requires .glyphicon classes)\n.form-control-feedback {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 2; // Ensure icon is above input groups\n  display: block;\n  width: @input-height-base;\n  height: @input-height-base;\n  line-height: @input-height-base;\n  text-align: center;\n  pointer-events: none;\n}\n.input-lg + .form-control-feedback,\n.input-group-lg + .form-control-feedback,\n.form-group-lg .form-control + .form-control-feedback {\n  width: @input-height-large;\n  height: @input-height-large;\n  line-height: @input-height-large;\n}\n.input-sm + .form-control-feedback,\n.input-group-sm + .form-control-feedback,\n.form-group-sm .form-control + .form-control-feedback {\n  width: @input-height-small;\n  height: @input-height-small;\n  line-height: @input-height-small;\n}\n\n// Feedback states\n.has-success {\n  .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);\n}\n.has-warning {\n  .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);\n}\n.has-error {\n  .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);\n}\n\n// Reposition feedback icon if input has visible label above\n.has-feedback label {\n\n  & ~ .form-control-feedback {\n    top: (@line-height-computed + 5); // Height of the `label` and its margin\n  }\n  &.sr-only ~ .form-control-feedback {\n    top: 0;\n  }\n}\n\n\n// Help text\n//\n// Apply to any element you wish to create light text for placement immediately\n// below a form control. Use for general help, formatting, or instructional text.\n\n.help-block {\n  display: block; // account for any element using help-block\n  margin-top: 5px;\n  margin-bottom: 10px;\n  color: lighten(@text-color, 25%); // lighten the text some for contrast\n}\n\n\n// Inline forms\n//\n// Make forms appear inline(-block) by adding the `.form-inline` class. Inline\n// forms begin stacked on extra small (mobile) devices and then go inline when\n// viewports reach <768px.\n//\n// Requires wrapping inputs and labels with `.form-group` for proper display of\n// default HTML form controls and our custom form controls (e.g., input groups).\n//\n// Heads up! This is mixin-ed into `.navbar-form` in navbars.less.\n\n.form-inline {\n\n  // Kick in the inline\n  @media (min-width: @screen-sm-min) {\n    // Inline-block all the things for \"inline\"\n    .form-group {\n      display: inline-block;\n      margin-bottom: 0;\n      vertical-align: middle;\n    }\n\n    // In navbar-form, allow folks to *not* use `.form-group`\n    .form-control {\n      display: inline-block;\n      width: auto; // Prevent labels from stacking above inputs in `.form-group`\n      vertical-align: middle;\n    }\n\n    // Make static controls behave like regular ones\n    .form-control-static {\n      display: inline-block;\n    }\n\n    .input-group {\n      display: inline-table;\n      vertical-align: middle;\n\n      .input-group-addon,\n      .input-group-btn,\n      .form-control {\n        width: auto;\n      }\n    }\n\n    // Input groups need that 100% width though\n    .input-group > .form-control {\n      width: 100%;\n    }\n\n    .control-label {\n      margin-bottom: 0;\n      vertical-align: middle;\n    }\n\n    // Remove default margin on radios/checkboxes that were used for stacking, and\n    // then undo the floating of radios and checkboxes to match.\n    .radio,\n    .checkbox {\n      display: inline-block;\n      margin-top: 0;\n      margin-bottom: 0;\n      vertical-align: middle;\n\n      label {\n        padding-left: 0;\n      }\n    }\n    .radio input[type=\"radio\"],\n    .checkbox input[type=\"checkbox\"] {\n      position: relative;\n      margin-left: 0;\n    }\n\n    // Re-override the feedback icon.\n    .has-feedback .form-control-feedback {\n      top: 0;\n    }\n  }\n}\n\n\n// Horizontal forms\n//\n// Horizontal forms are built on grid classes and allow you to create forms with\n// labels on the left and inputs on the right.\n\n.form-horizontal {\n\n  // Consistent vertical alignment of radios and checkboxes\n  //\n  // Labels also get some reset styles, but that is scoped to a media query below.\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline {\n    margin-top: 0;\n    margin-bottom: 0;\n    padding-top: (@padding-base-vertical + 1); // Default padding plus a border\n  }\n  // Account for padding we're adding to ensure the alignment and of help text\n  // and other content below items\n  .radio,\n  .checkbox {\n    min-height: (@line-height-computed + (@padding-base-vertical + 1));\n  }\n\n  // Make form groups behave like rows\n  .form-group {\n    .make-row();\n  }\n\n  // Reset spacing and right align labels, but scope to media queries so that\n  // labels on narrow viewports stack the same as a default form example.\n  @media (min-width: @screen-sm-min) {\n    .control-label {\n      text-align: right;\n      margin-bottom: 0;\n      padding-top: (@padding-base-vertical + 1); // Default padding plus a border\n    }\n  }\n\n  // Validation states\n  //\n  // Reposition the icon because it's now within a grid column and columns have\n  // `position: relative;` on them. Also accounts for the grid gutter padding.\n  .has-feedback .form-control-feedback {\n    right: floor((@grid-gutter-width / 2));\n  }\n\n  // Form group sizes\n  //\n  // Quick utility class for applying `.input-lg` and `.input-sm` styles to the\n  // inputs and labels within a `.form-group`.\n  .form-group-lg {\n    @media (min-width: @screen-sm-min) {\n      .control-label {\n        padding-top: (@padding-large-vertical + 1);\n        font-size: @font-size-large;\n      }\n    }\n  }\n  .form-group-sm {\n    @media (min-width: @screen-sm-min) {\n      .control-label {\n        padding-top: (@padding-small-vertical + 1);\n        font-size: @font-size-small;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/glyphicons.less",
    "content": "//\n// Glyphicons for Bootstrap\n//\n// Since icons are fonts, they can be placed anywhere text is placed and are\n// thus automatically sized to match the surrounding child. To use, create an\n// inline element with the appropriate classes, like so:\n//\n// <a href=\"#\"><span class=\"glyphicon glyphicon-star\"></span> Star</a>\n\n// Import the fonts\n@font-face {\n  font-family: 'Glyphicons Halflings';\n  src: url('@{icon-font-path}@{icon-font-name}.eot');\n  src: url('@{icon-font-path}@{icon-font-name}.eot?#iefix') format('embedded-opentype'),\n       url('@{icon-font-path}@{icon-font-name}.woff2') format('woff2'),\n       url('@{icon-font-path}@{icon-font-name}.woff') format('woff'),\n       url('@{icon-font-path}@{icon-font-name}.ttf') format('truetype'),\n       url('@{icon-font-path}@{icon-font-name}.svg#@{icon-font-svg-id}') format('svg');\n}\n\n// Catchall baseclass\n.glyphicon {\n  position: relative;\n  top: 1px;\n  display: inline-block;\n  font-family: 'Glyphicons Halflings';\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n// Individual icons\n.glyphicon-asterisk               { &:before { content: \"\\002a\"; } }\n.glyphicon-plus                   { &:before { content: \"\\002b\"; } }\n.glyphicon-euro,\n.glyphicon-eur                    { &:before { content: \"\\20ac\"; } }\n.glyphicon-minus                  { &:before { content: \"\\2212\"; } }\n.glyphicon-cloud                  { &:before { content: \"\\2601\"; } }\n.glyphicon-envelope               { &:before { content: \"\\2709\"; } }\n.glyphicon-pencil                 { &:before { content: \"\\270f\"; } }\n.glyphicon-glass                  { &:before { content: \"\\e001\"; } }\n.glyphicon-music                  { &:before { content: \"\\e002\"; } }\n.glyphicon-search                 { &:before { content: \"\\e003\"; } }\n.glyphicon-heart                  { &:before { content: \"\\e005\"; } }\n.glyphicon-star                   { &:before { content: \"\\e006\"; } }\n.glyphicon-star-empty             { &:before { content: \"\\e007\"; } }\n.glyphicon-user                   { &:before { content: \"\\e008\"; } }\n.glyphicon-film                   { &:before { content: \"\\e009\"; } }\n.glyphicon-th-large               { &:before { content: \"\\e010\"; } }\n.glyphicon-th                     { &:before { content: \"\\e011\"; } }\n.glyphicon-th-list                { &:before { content: \"\\e012\"; } }\n.glyphicon-ok                     { &:before { content: \"\\e013\"; } }\n.glyphicon-remove                 { &:before { content: \"\\e014\"; } }\n.glyphicon-zoom-in                { &:before { content: \"\\e015\"; } }\n.glyphicon-zoom-out               { &:before { content: \"\\e016\"; } }\n.glyphicon-off                    { &:before { content: \"\\e017\"; } }\n.glyphicon-signal                 { &:before { content: \"\\e018\"; } }\n.glyphicon-cog                    { &:before { content: \"\\e019\"; } }\n.glyphicon-trash                  { &:before { content: \"\\e020\"; } }\n.glyphicon-home                   { &:before { content: \"\\e021\"; } }\n.glyphicon-file                   { &:before { content: \"\\e022\"; } }\n.glyphicon-time                   { &:before { content: \"\\e023\"; } }\n.glyphicon-road                   { &:before { content: \"\\e024\"; } }\n.glyphicon-download-alt           { &:before { content: \"\\e025\"; } }\n.glyphicon-download               { &:before { content: \"\\e026\"; } }\n.glyphicon-upload                 { &:before { content: \"\\e027\"; } }\n.glyphicon-inbox                  { &:before { content: \"\\e028\"; } }\n.glyphicon-play-circle            { &:before { content: \"\\e029\"; } }\n.glyphicon-repeat                 { &:before { content: \"\\e030\"; } }\n.glyphicon-refresh                { &:before { content: \"\\e031\"; } }\n.glyphicon-list-alt               { &:before { content: \"\\e032\"; } }\n.glyphicon-lock                   { &:before { content: \"\\e033\"; } }\n.glyphicon-flag                   { &:before { content: \"\\e034\"; } }\n.glyphicon-headphones             { &:before { content: \"\\e035\"; } }\n.glyphicon-volume-off             { &:before { content: \"\\e036\"; } }\n.glyphicon-volume-down            { &:before { content: \"\\e037\"; } }\n.glyphicon-volume-up              { &:before { content: \"\\e038\"; } }\n.glyphicon-qrcode                 { &:before { content: \"\\e039\"; } }\n.glyphicon-barcode                { &:before { content: \"\\e040\"; } }\n.glyphicon-tag                    { &:before { content: \"\\e041\"; } }\n.glyphicon-tags                   { &:before { content: \"\\e042\"; } }\n.glyphicon-book                   { &:before { content: \"\\e043\"; } }\n.glyphicon-bookmark               { &:before { content: \"\\e044\"; } }\n.glyphicon-print                  { &:before { content: \"\\e045\"; } }\n.glyphicon-camera                 { &:before { content: \"\\e046\"; } }\n.glyphicon-font                   { &:before { content: \"\\e047\"; } }\n.glyphicon-bold                   { &:before { content: \"\\e048\"; } }\n.glyphicon-italic                 { &:before { content: \"\\e049\"; } }\n.glyphicon-text-height            { &:before { content: \"\\e050\"; } }\n.glyphicon-text-width             { &:before { content: \"\\e051\"; } }\n.glyphicon-align-left             { &:before { content: \"\\e052\"; } }\n.glyphicon-align-center           { &:before { content: \"\\e053\"; } }\n.glyphicon-align-right            { &:before { content: \"\\e054\"; } }\n.glyphicon-align-justify          { &:before { content: \"\\e055\"; } }\n.glyphicon-list                   { &:before { content: \"\\e056\"; } }\n.glyphicon-indent-left            { &:before { content: \"\\e057\"; } }\n.glyphicon-indent-right           { &:before { content: \"\\e058\"; } }\n.glyphicon-facetime-video         { &:before { content: \"\\e059\"; } }\n.glyphicon-picture                { &:before { content: \"\\e060\"; } }\n.glyphicon-map-marker             { &:before { content: \"\\e062\"; } }\n.glyphicon-adjust                 { &:before { content: \"\\e063\"; } }\n.glyphicon-tint                   { &:before { content: \"\\e064\"; } }\n.glyphicon-edit                   { &:before { content: \"\\e065\"; } }\n.glyphicon-share                  { &:before { content: \"\\e066\"; } }\n.glyphicon-check                  { &:before { content: \"\\e067\"; } }\n.glyphicon-move                   { &:before { content: \"\\e068\"; } }\n.glyphicon-step-backward          { &:before { content: \"\\e069\"; } }\n.glyphicon-fast-backward          { &:before { content: \"\\e070\"; } }\n.glyphicon-backward               { &:before { content: \"\\e071\"; } }\n.glyphicon-play                   { &:before { content: \"\\e072\"; } }\n.glyphicon-pause                  { &:before { content: \"\\e073\"; } }\n.glyphicon-stop                   { &:before { content: \"\\e074\"; } }\n.glyphicon-forward                { &:before { content: \"\\e075\"; } }\n.glyphicon-fast-forward           { &:before { content: \"\\e076\"; } }\n.glyphicon-step-forward           { &:before { content: \"\\e077\"; } }\n.glyphicon-eject                  { &:before { content: \"\\e078\"; } }\n.glyphicon-chevron-left           { &:before { content: \"\\e079\"; } }\n.glyphicon-chevron-right          { &:before { content: \"\\e080\"; } }\n.glyphicon-plus-sign              { &:before { content: \"\\e081\"; } }\n.glyphicon-minus-sign             { &:before { content: \"\\e082\"; } }\n.glyphicon-remove-sign            { &:before { content: \"\\e083\"; } }\n.glyphicon-ok-sign                { &:before { content: \"\\e084\"; } }\n.glyphicon-question-sign          { &:before { content: \"\\e085\"; } }\n.glyphicon-info-sign              { &:before { content: \"\\e086\"; } }\n.glyphicon-screenshot             { &:before { content: \"\\e087\"; } }\n.glyphicon-remove-circle          { &:before { content: \"\\e088\"; } }\n.glyphicon-ok-circle              { &:before { content: \"\\e089\"; } }\n.glyphicon-ban-circle             { &:before { content: \"\\e090\"; } }\n.glyphicon-arrow-left             { &:before { content: \"\\e091\"; } }\n.glyphicon-arrow-right            { &:before { content: \"\\e092\"; } }\n.glyphicon-arrow-up               { &:before { content: \"\\e093\"; } }\n.glyphicon-arrow-down             { &:before { content: \"\\e094\"; } }\n.glyphicon-share-alt              { &:before { content: \"\\e095\"; } }\n.glyphicon-resize-full            { &:before { content: \"\\e096\"; } }\n.glyphicon-resize-small           { &:before { content: \"\\e097\"; } }\n.glyphicon-exclamation-sign       { &:before { content: \"\\e101\"; } }\n.glyphicon-gift                   { &:before { content: \"\\e102\"; } }\n.glyphicon-leaf                   { &:before { content: \"\\e103\"; } }\n.glyphicon-fire                   { &:before { content: \"\\e104\"; } }\n.glyphicon-eye-open               { &:before { content: \"\\e105\"; } }\n.glyphicon-eye-close              { &:before { content: \"\\e106\"; } }\n.glyphicon-warning-sign           { &:before { content: \"\\e107\"; } }\n.glyphicon-plane                  { &:before { content: \"\\e108\"; } }\n.glyphicon-calendar               { &:before { content: \"\\e109\"; } }\n.glyphicon-random                 { &:before { content: \"\\e110\"; } }\n.glyphicon-comment                { &:before { content: \"\\e111\"; } }\n.glyphicon-magnet                 { &:before { content: \"\\e112\"; } }\n.glyphicon-chevron-up             { &:before { content: \"\\e113\"; } }\n.glyphicon-chevron-down           { &:before { content: \"\\e114\"; } }\n.glyphicon-retweet                { &:before { content: \"\\e115\"; } }\n.glyphicon-shopping-cart          { &:before { content: \"\\e116\"; } }\n.glyphicon-folder-close           { &:before { content: \"\\e117\"; } }\n.glyphicon-folder-open            { &:before { content: \"\\e118\"; } }\n.glyphicon-resize-vertical        { &:before { content: \"\\e119\"; } }\n.glyphicon-resize-horizontal      { &:before { content: \"\\e120\"; } }\n.glyphicon-hdd                    { &:before { content: \"\\e121\"; } }\n.glyphicon-bullhorn               { &:before { content: \"\\e122\"; } }\n.glyphicon-bell                   { &:before { content: \"\\e123\"; } }\n.glyphicon-certificate            { &:before { content: \"\\e124\"; } }\n.glyphicon-thumbs-up              { &:before { content: \"\\e125\"; } }\n.glyphicon-thumbs-down            { &:before { content: \"\\e126\"; } }\n.glyphicon-hand-right             { &:before { content: \"\\e127\"; } }\n.glyphicon-hand-left              { &:before { content: \"\\e128\"; } }\n.glyphicon-hand-up                { &:before { content: \"\\e129\"; } }\n.glyphicon-hand-down              { &:before { content: \"\\e130\"; } }\n.glyphicon-circle-arrow-right     { &:before { content: \"\\e131\"; } }\n.glyphicon-circle-arrow-left      { &:before { content: \"\\e132\"; } }\n.glyphicon-circle-arrow-up        { &:before { content: \"\\e133\"; } }\n.glyphicon-circle-arrow-down      { &:before { content: \"\\e134\"; } }\n.glyphicon-globe                  { &:before { content: \"\\e135\"; } }\n.glyphicon-wrench                 { &:before { content: \"\\e136\"; } }\n.glyphicon-tasks                  { &:before { content: \"\\e137\"; } }\n.glyphicon-filter                 { &:before { content: \"\\e138\"; } }\n.glyphicon-briefcase              { &:before { content: \"\\e139\"; } }\n.glyphicon-fullscreen             { &:before { content: \"\\e140\"; } }\n.glyphicon-dashboard              { &:before { content: \"\\e141\"; } }\n.glyphicon-paperclip              { &:before { content: \"\\e142\"; } }\n.glyphicon-heart-empty            { &:before { content: \"\\e143\"; } }\n.glyphicon-link                   { &:before { content: \"\\e144\"; } }\n.glyphicon-phone                  { &:before { content: \"\\e145\"; } }\n.glyphicon-pushpin                { &:before { content: \"\\e146\"; } }\n.glyphicon-usd                    { &:before { content: \"\\e148\"; } }\n.glyphicon-gbp                    { &:before { content: \"\\e149\"; } }\n.glyphicon-sort                   { &:before { content: \"\\e150\"; } }\n.glyphicon-sort-by-alphabet       { &:before { content: \"\\e151\"; } }\n.glyphicon-sort-by-alphabet-alt   { &:before { content: \"\\e152\"; } }\n.glyphicon-sort-by-order          { &:before { content: \"\\e153\"; } }\n.glyphicon-sort-by-order-alt      { &:before { content: \"\\e154\"; } }\n.glyphicon-sort-by-attributes     { &:before { content: \"\\e155\"; } }\n.glyphicon-sort-by-attributes-alt { &:before { content: \"\\e156\"; } }\n.glyphicon-unchecked              { &:before { content: \"\\e157\"; } }\n.glyphicon-expand                 { &:before { content: \"\\e158\"; } }\n.glyphicon-collapse-down          { &:before { content: \"\\e159\"; } }\n.glyphicon-collapse-up            { &:before { content: \"\\e160\"; } }\n.glyphicon-log-in                 { &:before { content: \"\\e161\"; } }\n.glyphicon-flash                  { &:before { content: \"\\e162\"; } }\n.glyphicon-log-out                { &:before { content: \"\\e163\"; } }\n.glyphicon-new-window             { &:before { content: \"\\e164\"; } }\n.glyphicon-record                 { &:before { content: \"\\e165\"; } }\n.glyphicon-save                   { &:before { content: \"\\e166\"; } }\n.glyphicon-open                   { &:before { content: \"\\e167\"; } }\n.glyphicon-saved                  { &:before { content: \"\\e168\"; } }\n.glyphicon-import                 { &:before { content: \"\\e169\"; } }\n.glyphicon-export                 { &:before { content: \"\\e170\"; } }\n.glyphicon-send                   { &:before { content: \"\\e171\"; } }\n.glyphicon-floppy-disk            { &:before { content: \"\\e172\"; } }\n.glyphicon-floppy-saved           { &:before { content: \"\\e173\"; } }\n.glyphicon-floppy-remove          { &:before { content: \"\\e174\"; } }\n.glyphicon-floppy-save            { &:before { content: \"\\e175\"; } }\n.glyphicon-floppy-open            { &:before { content: \"\\e176\"; } }\n.glyphicon-credit-card            { &:before { content: \"\\e177\"; } }\n.glyphicon-transfer               { &:before { content: \"\\e178\"; } }\n.glyphicon-cutlery                { &:before { content: \"\\e179\"; } }\n.glyphicon-header                 { &:before { content: \"\\e180\"; } }\n.glyphicon-compressed             { &:before { content: \"\\e181\"; } }\n.glyphicon-earphone               { &:before { content: \"\\e182\"; } }\n.glyphicon-phone-alt              { &:before { content: \"\\e183\"; } }\n.glyphicon-tower                  { &:before { content: \"\\e184\"; } }\n.glyphicon-stats                  { &:before { content: \"\\e185\"; } }\n.glyphicon-sd-video               { &:before { content: \"\\e186\"; } }\n.glyphicon-hd-video               { &:before { content: \"\\e187\"; } }\n.glyphicon-subtitles              { &:before { content: \"\\e188\"; } }\n.glyphicon-sound-stereo           { &:before { content: \"\\e189\"; } }\n.glyphicon-sound-dolby            { &:before { content: \"\\e190\"; } }\n.glyphicon-sound-5-1              { &:before { content: \"\\e191\"; } }\n.glyphicon-sound-6-1              { &:before { content: \"\\e192\"; } }\n.glyphicon-sound-7-1              { &:before { content: \"\\e193\"; } }\n.glyphicon-copyright-mark         { &:before { content: \"\\e194\"; } }\n.glyphicon-registration-mark      { &:before { content: \"\\e195\"; } }\n.glyphicon-cloud-download         { &:before { content: \"\\e197\"; } }\n.glyphicon-cloud-upload           { &:before { content: \"\\e198\"; } }\n.glyphicon-tree-conifer           { &:before { content: \"\\e199\"; } }\n.glyphicon-tree-deciduous         { &:before { content: \"\\e200\"; } }\n.glyphicon-cd                     { &:before { content: \"\\e201\"; } }\n.glyphicon-save-file              { &:before { content: \"\\e202\"; } }\n.glyphicon-open-file              { &:before { content: \"\\e203\"; } }\n.glyphicon-level-up               { &:before { content: \"\\e204\"; } }\n.glyphicon-copy                   { &:before { content: \"\\e205\"; } }\n.glyphicon-paste                  { &:before { content: \"\\e206\"; } }\n// The following 2 Glyphicons are omitted for the time being because\n// they currently use Unicode codepoints that are outside the\n// Basic Multilingual Plane (BMP). Older buggy versions of WebKit can't handle\n// non-BMP codepoints in CSS string escapes, and thus can't display these two icons.\n// Notably, the bug affects some older versions of the Android Browser.\n// More info: https://github.com/twbs/bootstrap/issues/10106\n// .glyphicon-door                   { &:before { content: \"\\1f6aa\"; } }\n// .glyphicon-key                    { &:before { content: \"\\1f511\"; } }\n.glyphicon-alert                  { &:before { content: \"\\e209\"; } }\n.glyphicon-equalizer              { &:before { content: \"\\e210\"; } }\n.glyphicon-king                   { &:before { content: \"\\e211\"; } }\n.glyphicon-queen                  { &:before { content: \"\\e212\"; } }\n.glyphicon-pawn                   { &:before { content: \"\\e213\"; } }\n.glyphicon-bishop                 { &:before { content: \"\\e214\"; } }\n.glyphicon-knight                 { &:before { content: \"\\e215\"; } }\n.glyphicon-baby-formula           { &:before { content: \"\\e216\"; } }\n.glyphicon-tent                   { &:before { content: \"\\26fa\"; } }\n.glyphicon-blackboard             { &:before { content: \"\\e218\"; } }\n.glyphicon-bed                    { &:before { content: \"\\e219\"; } }\n.glyphicon-apple                  { &:before { content: \"\\f8ff\"; } }\n.glyphicon-erase                  { &:before { content: \"\\e221\"; } }\n.glyphicon-hourglass              { &:before { content: \"\\231b\"; } }\n.glyphicon-lamp                   { &:before { content: \"\\e223\"; } }\n.glyphicon-duplicate              { &:before { content: \"\\e224\"; } }\n.glyphicon-piggy-bank             { &:before { content: \"\\e225\"; } }\n.glyphicon-scissors               { &:before { content: \"\\e226\"; } }\n.glyphicon-bitcoin                { &:before { content: \"\\e227\"; } }\n.glyphicon-btc                    { &:before { content: \"\\e227\"; } }\n.glyphicon-xbt                    { &:before { content: \"\\e227\"; } }\n.glyphicon-yen                    { &:before { content: \"\\00a5\"; } }\n.glyphicon-jpy                    { &:before { content: \"\\00a5\"; } }\n.glyphicon-ruble                  { &:before { content: \"\\20bd\"; } }\n.glyphicon-rub                    { &:before { content: \"\\20bd\"; } }\n.glyphicon-scale                  { &:before { content: \"\\e230\"; } }\n.glyphicon-ice-lolly              { &:before { content: \"\\e231\"; } }\n.glyphicon-ice-lolly-tasted       { &:before { content: \"\\e232\"; } }\n.glyphicon-education              { &:before { content: \"\\e233\"; } }\n.glyphicon-option-horizontal      { &:before { content: \"\\e234\"; } }\n.glyphicon-option-vertical        { &:before { content: \"\\e235\"; } }\n.glyphicon-menu-hamburger         { &:before { content: \"\\e236\"; } }\n.glyphicon-modal-window           { &:before { content: \"\\e237\"; } }\n.glyphicon-oil                    { &:before { content: \"\\e238\"; } }\n.glyphicon-grain                  { &:before { content: \"\\e239\"; } }\n.glyphicon-sunglasses             { &:before { content: \"\\e240\"; } }\n.glyphicon-text-size              { &:before { content: \"\\e241\"; } }\n.glyphicon-text-color             { &:before { content: \"\\e242\"; } }\n.glyphicon-text-background        { &:before { content: \"\\e243\"; } }\n.glyphicon-object-align-top       { &:before { content: \"\\e244\"; } }\n.glyphicon-object-align-bottom    { &:before { content: \"\\e245\"; } }\n.glyphicon-object-align-horizontal{ &:before { content: \"\\e246\"; } }\n.glyphicon-object-align-left      { &:before { content: \"\\e247\"; } }\n.glyphicon-object-align-vertical  { &:before { content: \"\\e248\"; } }\n.glyphicon-object-align-right     { &:before { content: \"\\e249\"; } }\n.glyphicon-triangle-right         { &:before { content: \"\\e250\"; } }\n.glyphicon-triangle-left          { &:before { content: \"\\e251\"; } }\n.glyphicon-triangle-bottom        { &:before { content: \"\\e252\"; } }\n.glyphicon-triangle-top           { &:before { content: \"\\e253\"; } }\n.glyphicon-console                { &:before { content: \"\\e254\"; } }\n.glyphicon-superscript            { &:before { content: \"\\e255\"; } }\n.glyphicon-subscript              { &:before { content: \"\\e256\"; } }\n.glyphicon-menu-left              { &:before { content: \"\\e257\"; } }\n.glyphicon-menu-right             { &:before { content: \"\\e258\"; } }\n.glyphicon-menu-down              { &:before { content: \"\\e259\"; } }\n.glyphicon-menu-up                { &:before { content: \"\\e260\"; } }\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/grid.less",
    "content": "//\n// Grid system\n// --------------------------------------------------\n\n\n// Container widths\n//\n// Set the container width, and override it for fixed navbars in media queries.\n\n.container {\n  .container-fixed();\n\n  @media (min-width: @screen-sm-min) {\n    width: @container-sm;\n  }\n  @media (min-width: @screen-md-min) {\n    width: @container-md;\n  }\n  @media (min-width: @screen-lg-min) {\n    width: @container-lg;\n  }\n}\n\n\n// Fluid container\n//\n// Utilizes the mixin meant for fixed width containers, but without any defined\n// width for fluid, full width layouts.\n\n.container-fluid {\n  .container-fixed();\n}\n\n\n// Row\n//\n// Rows contain and clear the floats of your columns.\n\n.row {\n  .make-row();\n}\n\n\n// Columns\n//\n// Common styles for small and large grid columns\n\n.make-grid-columns();\n\n\n// Extra small grid\n//\n// Columns, offsets, pushes, and pulls for extra small devices like\n// smartphones.\n\n.make-grid(xs);\n\n\n// Small grid\n//\n// Columns, offsets, pushes, and pulls for the small device range, from phones\n// to tablets.\n\n@media (min-width: @screen-sm-min) {\n  .make-grid(sm);\n}\n\n\n// Medium grid\n//\n// Columns, offsets, pushes, and pulls for the desktop device range.\n\n@media (min-width: @screen-md-min) {\n  .make-grid(md);\n}\n\n\n// Large grid\n//\n// Columns, offsets, pushes, and pulls for the large desktop device range.\n\n@media (min-width: @screen-lg-min) {\n  .make-grid(lg);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/input-groups.less",
    "content": "//\n// Input groups\n// --------------------------------------------------\n\n// Base styles\n// -------------------------\n.input-group {\n  position: relative; // For dropdowns\n  display: table;\n  border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table\n\n  // Undo padding and float of grid classes\n  &[class*=\"col-\"] {\n    float: none;\n    padding-left: 0;\n    padding-right: 0;\n  }\n\n  .form-control {\n    // Ensure that the input is always above the *appended* addon button for\n    // proper border colors.\n    position: relative;\n    z-index: 2;\n\n    // IE9 fubars the placeholder attribute in text inputs and the arrows on\n    // select elements in input groups. To fix it, we float the input. Details:\n    // https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855\n    float: left;\n\n    width: 100%;\n    margin-bottom: 0;\n\n    &:focus {\n      z-index: 3;\n    }\n  }\n}\n\n// Sizing options\n//\n// Remix the default form control sizing classes into new ones for easier\n// manipulation.\n\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn {\n  .input-lg();\n}\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn {\n  .input-sm();\n}\n\n\n// Display as table-cell\n// -------------------------\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n  display: table-cell;\n\n  &:not(:first-child):not(:last-child) {\n    border-radius: 0;\n  }\n}\n// Addon and addon wrapper for buttons\n.input-group-addon,\n.input-group-btn {\n  width: 1%;\n  white-space: nowrap;\n  vertical-align: middle; // Match the inputs\n}\n\n// Text input groups\n// -------------------------\n.input-group-addon {\n  padding: @padding-base-vertical @padding-base-horizontal;\n  font-size: @font-size-base;\n  font-weight: normal;\n  line-height: 1;\n  color: @input-color;\n  text-align: center;\n  background-color: @input-group-addon-bg;\n  border: 1px solid @input-group-addon-border-color;\n  border-radius: @input-border-radius;\n\n  // Sizing\n  &.input-sm {\n    padding: @padding-small-vertical @padding-small-horizontal;\n    font-size: @font-size-small;\n    border-radius: @input-border-radius-small;\n  }\n  &.input-lg {\n    padding: @padding-large-vertical @padding-large-horizontal;\n    font-size: @font-size-large;\n    border-radius: @input-border-radius-large;\n  }\n\n  // Nuke default margins from checkboxes and radios to vertically center within.\n  input[type=\"radio\"],\n  input[type=\"checkbox\"] {\n    margin-top: 0;\n  }\n}\n\n// Reset rounded corners\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),\n.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {\n  .border-right-radius(0);\n}\n.input-group-addon:first-child {\n  border-right: 0;\n}\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child),\n.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {\n  .border-left-radius(0);\n}\n.input-group-addon:last-child {\n  border-left: 0;\n}\n\n// Button input groups\n// -------------------------\n.input-group-btn {\n  position: relative;\n  // Jankily prevent input button groups from wrapping with `white-space` and\n  // `font-size` in combination with `inline-block` on buttons.\n  font-size: 0;\n  white-space: nowrap;\n\n  // Negative margin for spacing, position for bringing hovered/focused/actived\n  // element above the siblings.\n  > .btn {\n    position: relative;\n    + .btn {\n      margin-left: -1px;\n    }\n    // Bring the \"active\" button to the front\n    &:hover,\n    &:focus,\n    &:active {\n      z-index: 2;\n    }\n  }\n\n  // Negative margin to only have a 1px border between the two\n  &:first-child {\n    > .btn,\n    > .btn-group {\n      margin-right: -1px;\n    }\n  }\n  &:last-child {\n    > .btn,\n    > .btn-group {\n      z-index: 2;\n      margin-left: -1px;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/jumbotron.less",
    "content": "//\n// Jumbotron\n// --------------------------------------------------\n\n\n.jumbotron {\n  padding-top:    @jumbotron-padding;\n  padding-bottom: @jumbotron-padding;\n  margin-bottom: @jumbotron-padding;\n  color: @jumbotron-color;\n  background-color: @jumbotron-bg;\n\n  h1,\n  .h1 {\n    color: @jumbotron-heading-color;\n  }\n\n  p {\n    margin-bottom: (@jumbotron-padding / 2);\n    font-size: @jumbotron-font-size;\n    font-weight: 200;\n  }\n\n  > hr {\n    border-top-color: darken(@jumbotron-bg, 10%);\n  }\n\n  .container &,\n  .container-fluid & {\n    border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container\n    padding-left:  (@grid-gutter-width / 2);\n    padding-right: (@grid-gutter-width / 2);\n  }\n\n  .container {\n    max-width: 100%;\n  }\n\n  @media screen and (min-width: @screen-sm-min) {\n    padding-top:    (@jumbotron-padding * 1.6);\n    padding-bottom: (@jumbotron-padding * 1.6);\n\n    .container &,\n    .container-fluid & {\n      padding-left:  (@jumbotron-padding * 2);\n      padding-right: (@jumbotron-padding * 2);\n    }\n\n    h1,\n    .h1 {\n      font-size: @jumbotron-heading-font-size;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/labels.less",
    "content": "//\n// Labels\n// --------------------------------------------------\n\n.label {\n  display: inline;\n  padding: .2em .6em .3em;\n  font-size: 75%;\n  font-weight: bold;\n  line-height: 1;\n  color: @label-color;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  border-radius: .25em;\n\n  // Add hover effects, but only for links\n  a& {\n    &:hover,\n    &:focus {\n      color: @label-link-hover-color;\n      text-decoration: none;\n      cursor: pointer;\n    }\n  }\n\n  // Empty labels collapse automatically (not available in IE8)\n  &:empty {\n    display: none;\n  }\n\n  // Quick fix for labels in buttons\n  .btn & {\n    position: relative;\n    top: -1px;\n  }\n}\n\n// Colors\n// Contextual variations (linked labels get darker on :hover)\n\n.label-default {\n  .label-variant(@label-default-bg);\n}\n\n.label-primary {\n  .label-variant(@label-primary-bg);\n}\n\n.label-success {\n  .label-variant(@label-success-bg);\n}\n\n.label-info {\n  .label-variant(@label-info-bg);\n}\n\n.label-warning {\n  .label-variant(@label-warning-bg);\n}\n\n.label-danger {\n  .label-variant(@label-danger-bg);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/list-group.less",
    "content": "//\n// List groups\n// --------------------------------------------------\n\n\n// Base class\n//\n// Easily usable on <ul>, <ol>, or <div>.\n\n.list-group {\n  // No need to set list-style: none; since .list-group-item is block level\n  margin-bottom: 20px;\n  padding-left: 0; // reset padding because ul and ol\n}\n\n\n// Individual list items\n//\n// Use on `li`s or `div`s within the `.list-group` parent.\n\n.list-group-item {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n  // Place the border on the list items and negative margin up for better styling\n  margin-bottom: -1px;\n  background-color: @list-group-bg;\n  border: 1px solid @list-group-border;\n\n  // Round the first and last items\n  &:first-child {\n    .border-top-radius(@list-group-border-radius);\n  }\n  &:last-child {\n    margin-bottom: 0;\n    .border-bottom-radius(@list-group-border-radius);\n  }\n}\n\n\n// Interactive list items\n//\n// Use anchor or button elements instead of `li`s or `div`s to create interactive items.\n// Includes an extra `.active` modifier class for showing selected items.\n\na.list-group-item,\nbutton.list-group-item {\n  color: @list-group-link-color;\n\n  .list-group-item-heading {\n    color: @list-group-link-heading-color;\n  }\n\n  // Hover state\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    color: @list-group-link-hover-color;\n    background-color: @list-group-hover-bg;\n  }\n}\n\nbutton.list-group-item {\n  width: 100%;\n  text-align: left;\n}\n\n.list-group-item {\n  // Disabled state\n  &.disabled,\n  &.disabled:hover,\n  &.disabled:focus {\n    background-color: @list-group-disabled-bg;\n    color: @list-group-disabled-color;\n    cursor: @cursor-disabled;\n\n    // Force color to inherit for custom content\n    .list-group-item-heading {\n      color: inherit;\n    }\n    .list-group-item-text {\n      color: @list-group-disabled-text-color;\n    }\n  }\n\n  // Active class on item itself, not parent\n  &.active,\n  &.active:hover,\n  &.active:focus {\n    z-index: 2; // Place active items above their siblings for proper border styling\n    color: @list-group-active-color;\n    background-color: @list-group-active-bg;\n    border-color: @list-group-active-border;\n\n    // Force color to inherit for custom content\n    .list-group-item-heading,\n    .list-group-item-heading > small,\n    .list-group-item-heading > .small {\n      color: inherit;\n    }\n    .list-group-item-text {\n      color: @list-group-active-text-color;\n    }\n  }\n}\n\n\n// Contextual variants\n//\n// Add modifier classes to change text and background color on individual items.\n// Organizationally, this must come after the `:hover` states.\n\n.list-group-item-variant(success; @state-success-bg; @state-success-text);\n.list-group-item-variant(info; @state-info-bg; @state-info-text);\n.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);\n.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);\n\n\n// Custom content options\n//\n// Extra classes for creating well-formatted content within `.list-group-item`s.\n\n.list-group-item-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.list-group-item-text {\n  margin-bottom: 0;\n  line-height: 1.3;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/media.less",
    "content": ".media {\n  // Proper spacing between instances of .media\n  margin-top: 15px;\n\n  &:first-child {\n    margin-top: 0;\n  }\n}\n\n.media,\n.media-body {\n  zoom: 1;\n  overflow: hidden;\n}\n\n.media-body {\n  width: 10000px;\n}\n\n.media-object {\n  display: block;\n\n  // Fix collapse in webkit from max-width: 100% and display: table-cell.\n  &.img-thumbnail {\n    max-width: none;\n  }\n}\n\n.media-right,\n.media > .pull-right {\n  padding-left: 10px;\n}\n\n.media-left,\n.media > .pull-left {\n  padding-right: 10px;\n}\n\n.media-left,\n.media-right,\n.media-body {\n  display: table-cell;\n  vertical-align: top;\n}\n\n.media-middle {\n  vertical-align: middle;\n}\n\n.media-bottom {\n  vertical-align: bottom;\n}\n\n// Reset margins on headings for tighter default spacing\n.media-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n\n// Media list variation\n//\n// Undo default ul/ol styles\n.media-list {\n  padding-left: 0;\n  list-style: none;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/alerts.less",
    "content": "// Alerts\n\n.alert-variant(@background; @border; @text-color) {\n  background-color: @background;\n  border-color: @border;\n  color: @text-color;\n\n  hr {\n    border-top-color: darken(@border, 5%);\n  }\n  .alert-link {\n    color: darken(@text-color, 10%);\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/background-variant.less",
    "content": "// Contextual backgrounds\n\n.bg-variant(@color) {\n  background-color: @color;\n  a&:hover,\n  a&:focus {\n    background-color: darken(@color, 10%);\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/border-radius.less",
    "content": "// Single side border-radius\n\n.border-top-radius(@radius) {\n  border-top-right-radius: @radius;\n   border-top-left-radius: @radius;\n}\n.border-right-radius(@radius) {\n  border-bottom-right-radius: @radius;\n     border-top-right-radius: @radius;\n}\n.border-bottom-radius(@radius) {\n  border-bottom-right-radius: @radius;\n   border-bottom-left-radius: @radius;\n}\n.border-left-radius(@radius) {\n  border-bottom-left-radius: @radius;\n     border-top-left-radius: @radius;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/buttons.less",
    "content": "// Button variants\n//\n// Easily pump out default styles, as well as :hover, :focus, :active,\n// and disabled options for all buttons\n\n.button-variant(@color; @background; @border) {\n  color: @color;\n  background-color: @background;\n  border-color: @border;\n\n  &:focus,\n  &.focus {\n    color: @color;\n    background-color: darken(@background, 10%);\n        border-color: darken(@border, 25%);\n  }\n  &:hover {\n    color: @color;\n    background-color: darken(@background, 10%);\n        border-color: darken(@border, 12%);\n  }\n  &:active,\n  &.active,\n  .open > .dropdown-toggle& {\n    color: @color;\n    background-color: darken(@background, 10%);\n        border-color: darken(@border, 12%);\n\n    &:hover,\n    &:focus,\n    &.focus {\n      color: @color;\n      background-color: darken(@background, 17%);\n          border-color: darken(@border, 25%);\n    }\n  }\n  &:active,\n  &.active,\n  .open > .dropdown-toggle& {\n    background-image: none;\n  }\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    &:hover,\n    &:focus,\n    &.focus {\n      background-color: @background;\n          border-color: @border;\n    }\n  }\n\n  .badge {\n    color: @background;\n    background-color: @color;\n  }\n}\n\n// Button sizes\n.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/center-block.less",
    "content": "// Center-align a block level element\n\n.center-block() {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/clearfix.less",
    "content": "// Clearfix\n//\n// For modern browsers\n// 1. The space content is one way to avoid an Opera bug when the\n//    contenteditable attribute is included anywhere else in the document.\n//    Otherwise it causes space to appear at the top and bottom of elements\n//    that are clearfixed.\n// 2. The use of `table` rather than `block` is only necessary if using\n//    `:before` to contain the top-margins of child elements.\n//\n// Source: http://nicolasgallagher.com/micro-clearfix-hack/\n\n.clearfix() {\n  &:before,\n  &:after {\n    content: \" \"; // 1\n    display: table; // 2\n  }\n  &:after {\n    clear: both;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/forms.less",
    "content": "// Form validation states\n//\n// Used in forms.less to generate the form validation CSS for warnings, errors,\n// and successes.\n\n.form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {\n  // Color the label and help text\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline,\n  &.radio label,\n  &.checkbox label,\n  &.radio-inline label,\n  &.checkbox-inline label  {\n    color: @text-color;\n  }\n  // Set the border and box shadow on specific inputs to match\n  .form-control {\n    border-color: @border-color;\n    .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work\n    &:focus {\n      border-color: darken(@border-color, 10%);\n      @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);\n      .box-shadow(@shadow);\n    }\n  }\n  // Set validation states also for addons\n  .input-group-addon {\n    color: @text-color;\n    border-color: @border-color;\n    background-color: @background-color;\n  }\n  // Optional feedback icon\n  .form-control-feedback {\n    color: @text-color;\n  }\n}\n\n\n// Form control focus state\n//\n// Generate a customized focus state and for any input with the specified color,\n// which defaults to the `@input-border-focus` variable.\n//\n// We highly encourage you to not customize the default value, but instead use\n// this to tweak colors on an as-needed basis. This aesthetic change is based on\n// WebKit's default styles, but applicable to a wider range of browsers. Its\n// usability and accessibility should be taken into account with any change.\n//\n// Example usage: change the default blue border and shadow to white for better\n// contrast against a dark gray background.\n.form-control-focus(@color: @input-border-focus) {\n  @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);\n  &:focus {\n    border-color: @color;\n    outline: 0;\n    .box-shadow(~\"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}\");\n  }\n}\n\n// Form control sizing\n//\n// Relative text size, padding, and border-radii changes for form controls. For\n// horizontal sizing, wrap controls in the predefined grid classes. `<select>`\n// element gets special love because it's special, and that's a fact!\n.input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  height: @input-height;\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n\n  select& {\n    height: @input-height;\n    line-height: @input-height;\n  }\n\n  textarea&,\n  select[multiple]& {\n    height: auto;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/gradients.less",
    "content": "// Gradients\n\n#gradient {\n\n  // Horizontal gradient, from left to right\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // Safari 5.1-6, Chrome 10+\n    background-image: -o-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // Opera 12\n    background-image: linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  // Vertical gradient, from top to bottom\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);  // Safari 5.1-6, Chrome 10+\n    background-image: -o-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);  // Opera 12\n    background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {\n    background-repeat: repeat-x;\n    background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+\n    background-image: -o-linear-gradient(@deg, @start-color, @end-color); // Opera 12\n    background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n  }\n  .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n    background-image: -o-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-image: -o-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .radial(@inner-color: #555; @outer-color: #333) {\n    background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);\n    background-image: radial-gradient(circle, @inner-color, @outer-color);\n    background-repeat: no-repeat;\n  }\n  .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {\n    background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n    background-image: -o-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n    background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/grid-framework.less",
    "content": "// Framework grid generation\n//\n// Used only by Bootstrap to generate the correct number of grid classes given\n// any value of `@grid-columns`.\n\n.make-grid-columns() {\n  // Common styles for all sizes of grid columns, widths 1-12\n  .col(@index) { // initial\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general; \"=<\" isn't a typo\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      position: relative;\n      // Prevent columns from collapsing when empty\n      min-height: 1px;\n      // Inner gutter via padding\n      padding-left:  ceil((@grid-gutter-width / 2));\n      padding-right: floor((@grid-gutter-width / 2));\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.float-grid-columns(@class) {\n  .col(@index) { // initial\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      float: left;\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {\n  .col-@{class}-@{index} {\n    width: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = push) and (@index > 0) {\n  .col-@{class}-push-@{index} {\n    left: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = push) and (@index = 0) {\n  .col-@{class}-push-0 {\n    left: auto;\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = pull) and (@index > 0) {\n  .col-@{class}-pull-@{index} {\n    right: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = pull) and (@index = 0) {\n  .col-@{class}-pull-0 {\n    right: auto;\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = offset) {\n  .col-@{class}-offset-@{index} {\n    margin-left: percentage((@index / @grid-columns));\n  }\n}\n\n// Basic looping in LESS\n.loop-grid-columns(@index, @class, @type) when (@index >= 0) {\n  .calc-grid-column(@index, @class, @type);\n  // next iteration\n  .loop-grid-columns((@index - 1), @class, @type);\n}\n\n// Create grid for specific class\n.make-grid(@class) {\n  .float-grid-columns(@class);\n  .loop-grid-columns(@grid-columns, @class, width);\n  .loop-grid-columns(@grid-columns, @class, pull);\n  .loop-grid-columns(@grid-columns, @class, push);\n  .loop-grid-columns(@grid-columns, @class, offset);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/grid.less",
    "content": "// Grid system\n//\n// Generate semantic grid columns with these mixins.\n\n// Centered container element\n.container-fixed(@gutter: @grid-gutter-width) {\n  margin-right: auto;\n  margin-left: auto;\n  padding-left:  floor((@gutter / 2));\n  padding-right: ceil((@gutter / 2));\n  &:extend(.clearfix all);\n}\n\n// Creates a wrapper for a series of columns\n.make-row(@gutter: @grid-gutter-width) {\n  margin-left:  ceil((@gutter / -2));\n  margin-right: floor((@gutter / -2));\n  &:extend(.clearfix all);\n}\n\n// Generate the extra small columns\n.make-xs-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  float: left;\n  width: percentage((@columns / @grid-columns));\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n}\n.make-xs-column-offset(@columns) {\n  margin-left: percentage((@columns / @grid-columns));\n}\n.make-xs-column-push(@columns) {\n  left: percentage((@columns / @grid-columns));\n}\n.make-xs-column-pull(@columns) {\n  right: percentage((@columns / @grid-columns));\n}\n\n// Generate the small columns\n.make-sm-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-sm-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-offset(@columns) {\n  @media (min-width: @screen-sm-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-push(@columns) {\n  @media (min-width: @screen-sm-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-pull(@columns) {\n  @media (min-width: @screen-sm-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n// Generate the medium columns\n.make-md-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-md-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-offset(@columns) {\n  @media (min-width: @screen-md-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-push(@columns) {\n  @media (min-width: @screen-md-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-pull(@columns) {\n  @media (min-width: @screen-md-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n// Generate the large columns\n.make-lg-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-lg-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-offset(@columns) {\n  @media (min-width: @screen-lg-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-push(@columns) {\n  @media (min-width: @screen-lg-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-pull(@columns) {\n  @media (min-width: @screen-lg-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/hide-text.less",
    "content": "// CSS image replacement\n//\n// Heads up! v3 launched with only `.hide-text()`, but per our pattern for\n// mixins being reused as classes with the same name, this doesn't hold up. As\n// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`.\n//\n// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757\n\n// Deprecated as of v3.0.1 (has been removed in v4)\n.hide-text() {\n  font: ~\"0/0\" a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n\n// New mixin to use as of v3.0.1\n.text-hide() {\n  .hide-text();\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/image.less",
    "content": "// Image Mixins\n// - Responsive image\n// - Retina image\n\n\n// Responsive image\n//\n// Keep images from scaling beyond the width of their parents.\n.img-responsive(@display: block) {\n  display: @display;\n  max-width: 100%; // Part 1: Set a maximum relative to the parent\n  height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching\n}\n\n\n// Retina image\n//\n// Short retina mixin for setting background-image and -size. Note that the\n// spelling of `min--moz-device-pixel-ratio` is intentional.\n.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {\n  background-image: url(\"@{file-1x}\");\n\n  @media\n  only screen and (-webkit-min-device-pixel-ratio: 2),\n  only screen and (   min--moz-device-pixel-ratio: 2),\n  only screen and (     -o-min-device-pixel-ratio: 2/1),\n  only screen and (        min-device-pixel-ratio: 2),\n  only screen and (                min-resolution: 192dpi),\n  only screen and (                min-resolution: 2dppx) {\n    background-image: url(\"@{file-2x}\");\n    background-size: @width-1x @height-1x;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/labels.less",
    "content": "// Labels\n\n.label-variant(@color) {\n  background-color: @color;\n\n  &[href] {\n    &:hover,\n    &:focus {\n      background-color: darken(@color, 10%);\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/list-group.less",
    "content": "// List Groups\n\n.list-group-item-variant(@state; @background; @color) {\n  .list-group-item-@{state} {\n    color: @color;\n    background-color: @background;\n\n    a&,\n    button& {\n      color: @color;\n\n      .list-group-item-heading {\n        color: inherit;\n      }\n\n      &:hover,\n      &:focus {\n        color: @color;\n        background-color: darken(@background, 5%);\n      }\n      &.active,\n      &.active:hover,\n      &.active:focus {\n        color: #fff;\n        background-color: @color;\n        border-color: @color;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/nav-divider.less",
    "content": "// Horizontal dividers\n//\n// Dividers (basically an hr) within dropdowns and nav lists\n\n.nav-divider(@color: #e5e5e5) {\n  height: 1px;\n  margin: ((@line-height-computed / 2) - 1) 0;\n  overflow: hidden;\n  background-color: @color;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/nav-vertical-align.less",
    "content": "// Navbar vertical align\n//\n// Vertically center elements in the navbar.\n// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.\n\n.navbar-vertical-align(@element-height) {\n  margin-top: ((@navbar-height - @element-height) / 2);\n  margin-bottom: ((@navbar-height - @element-height) / 2);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/opacity.less",
    "content": "// Opacity\n\n.opacity(@opacity) {\n  opacity: @opacity;\n  // IE8 filter\n  @opacity-ie: (@opacity * 100);\n  filter: ~\"alpha(opacity=@{opacity-ie})\";\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/pagination.less",
    "content": "// Pagination\n\n.pagination-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  > li {\n    > a,\n    > span {\n      padding: @padding-vertical @padding-horizontal;\n      font-size: @font-size;\n      line-height: @line-height;\n    }\n    &:first-child {\n      > a,\n      > span {\n        .border-left-radius(@border-radius);\n      }\n    }\n    &:last-child {\n      > a,\n      > span {\n        .border-right-radius(@border-radius);\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/panels.less",
    "content": "// Panels\n\n.panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {\n  border-color: @border;\n\n  & > .panel-heading {\n    color: @heading-text-color;\n    background-color: @heading-bg-color;\n    border-color: @heading-border;\n\n    + .panel-collapse > .panel-body {\n      border-top-color: @border;\n    }\n    .badge {\n      color: @heading-bg-color;\n      background-color: @heading-text-color;\n    }\n  }\n  & > .panel-footer {\n    + .panel-collapse > .panel-body {\n      border-bottom-color: @border;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/progress-bar.less",
    "content": "// Progress bars\n\n.progress-bar-variant(@color) {\n  background-color: @color;\n\n  // Deprecated parent class requirement as of v3.2.0\n  .progress-striped & {\n    #gradient > .striped();\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/reset-filter.less",
    "content": "// Reset filters for IE\n//\n// When you need to remove a gradient background, do not forget to use this to reset\n// the IE filter for IE9 and below.\n\n.reset-filter() {\n  filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(enabled = false)\"));\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/reset-text.less",
    "content": ".reset-text() {\n  font-family: @font-family-base;\n  // We deliberately do NOT reset font-size.\n  font-style: normal;\n  font-weight: normal;\n  letter-spacing: normal;\n  line-break: auto;\n  line-height: @line-height-base;\n  text-align: left; // Fallback for where `start` is not supported\n  text-align: start;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  white-space: normal;\n  word-break: normal;\n  word-spacing: normal;\n  word-wrap: normal;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/resize.less",
    "content": "// Resize anything\n\n.resizable(@direction) {\n  resize: @direction; // Options: horizontal, vertical, both\n  overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible`\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/responsive-visibility.less",
    "content": "// Responsive utilities\n\n//\n// More easily include all the states for responsive-utilities.less.\n.responsive-visibility() {\n  display: block !important;\n  table&  { display: table !important; }\n  tr&     { display: table-row !important; }\n  th&,\n  td&     { display: table-cell !important; }\n}\n\n.responsive-invisibility() {\n  display: none !important;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/size.less",
    "content": "// Sizing shortcuts\n\n.size(@width; @height) {\n  width: @width;\n  height: @height;\n}\n\n.square(@size) {\n  .size(@size; @size);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/tab-focus.less",
    "content": "// WebKit-style focus\n\n.tab-focus() {\n  // WebKit-specific. Other browsers will keep their default outline style.\n  // (Initially tried to also force default via `outline: initial`,\n  // but that seems to erroneously remove the outline in Firefox altogether.)\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/table-row.less",
    "content": "// Tables\n\n.table-row-variant(@state; @background) {\n  // Exact selectors below required to override `.table-striped` and prevent\n  // inheritance to nested tables.\n  .table > thead > tr,\n  .table > tbody > tr,\n  .table > tfoot > tr {\n    > td.@{state},\n    > th.@{state},\n    &.@{state} > td,\n    &.@{state} > th {\n      background-color: @background;\n    }\n  }\n\n  // Hover states for `.table-hover`\n  // Note: this is not available for cells or rows within `thead` or `tfoot`.\n  .table-hover > tbody > tr {\n    > td.@{state}:hover,\n    > th.@{state}:hover,\n    &.@{state}:hover > td,\n    &:hover > .@{state},\n    &.@{state}:hover > th {\n      background-color: darken(@background, 5%);\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/text-emphasis.less",
    "content": "// Typography\n\n.text-emphasis-variant(@color) {\n  color: @color;\n  a&:hover,\n  a&:focus {\n    color: darken(@color, 10%);\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/text-overflow.less",
    "content": "// Text overflow\n// Requires inline-block or block for proper styling\n\n.text-overflow() {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins/vendor-prefixes.less",
    "content": "// Vendor Prefixes\n//\n// All vendor mixins are deprecated as of v3.2.0 due to the introduction of\n// Autoprefixer in our Gruntfile. They have been removed in v4.\n\n// - Animations\n// - Backface visibility\n// - Box shadow\n// - Box sizing\n// - Content columns\n// - Hyphens\n// - Placeholder text\n// - Transformations\n// - Transitions\n// - User Select\n\n\n// Animations\n.animation(@animation) {\n  -webkit-animation: @animation;\n       -o-animation: @animation;\n          animation: @animation;\n}\n.animation-name(@name) {\n  -webkit-animation-name: @name;\n          animation-name: @name;\n}\n.animation-duration(@duration) {\n  -webkit-animation-duration: @duration;\n          animation-duration: @duration;\n}\n.animation-timing-function(@timing-function) {\n  -webkit-animation-timing-function: @timing-function;\n          animation-timing-function: @timing-function;\n}\n.animation-delay(@delay) {\n  -webkit-animation-delay: @delay;\n          animation-delay: @delay;\n}\n.animation-iteration-count(@iteration-count) {\n  -webkit-animation-iteration-count: @iteration-count;\n          animation-iteration-count: @iteration-count;\n}\n.animation-direction(@direction) {\n  -webkit-animation-direction: @direction;\n          animation-direction: @direction;\n}\n.animation-fill-mode(@fill-mode) {\n  -webkit-animation-fill-mode: @fill-mode;\n          animation-fill-mode: @fill-mode;\n}\n\n// Backface visibility\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden`\n\n.backface-visibility(@visibility) {\n  -webkit-backface-visibility: @visibility;\n     -moz-backface-visibility: @visibility;\n          backface-visibility: @visibility;\n}\n\n// Drop shadows\n//\n// Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's\n// supported browsers that have box shadow capabilities now support it.\n\n.box-shadow(@shadow) {\n  -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1\n          box-shadow: @shadow;\n}\n\n// Box sizing\n.box-sizing(@boxmodel) {\n  -webkit-box-sizing: @boxmodel;\n     -moz-box-sizing: @boxmodel;\n          box-sizing: @boxmodel;\n}\n\n// CSS3 Content Columns\n.content-columns(@column-count; @column-gap: @grid-gutter-width) {\n  -webkit-column-count: @column-count;\n     -moz-column-count: @column-count;\n          column-count: @column-count;\n  -webkit-column-gap: @column-gap;\n     -moz-column-gap: @column-gap;\n          column-gap: @column-gap;\n}\n\n// Optional hyphenation\n.hyphens(@mode: auto) {\n  word-wrap: break-word;\n  -webkit-hyphens: @mode;\n     -moz-hyphens: @mode;\n      -ms-hyphens: @mode; // IE10+\n       -o-hyphens: @mode;\n          hyphens: @mode;\n}\n\n// Placeholder text\n.placeholder(@color: @input-color-placeholder) {\n  // Firefox\n  &::-moz-placeholder {\n    color: @color;\n    opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526\n  }\n  &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+\n  &::-webkit-input-placeholder  { color: @color; } // Safari and Chrome\n}\n\n// Transformations\n.scale(@ratio) {\n  -webkit-transform: scale(@ratio);\n      -ms-transform: scale(@ratio); // IE9 only\n       -o-transform: scale(@ratio);\n          transform: scale(@ratio);\n}\n.scale(@ratioX; @ratioY) {\n  -webkit-transform: scale(@ratioX, @ratioY);\n      -ms-transform: scale(@ratioX, @ratioY); // IE9 only\n       -o-transform: scale(@ratioX, @ratioY);\n          transform: scale(@ratioX, @ratioY);\n}\n.scaleX(@ratio) {\n  -webkit-transform: scaleX(@ratio);\n      -ms-transform: scaleX(@ratio); // IE9 only\n       -o-transform: scaleX(@ratio);\n          transform: scaleX(@ratio);\n}\n.scaleY(@ratio) {\n  -webkit-transform: scaleY(@ratio);\n      -ms-transform: scaleY(@ratio); // IE9 only\n       -o-transform: scaleY(@ratio);\n          transform: scaleY(@ratio);\n}\n.skew(@x; @y) {\n  -webkit-transform: skewX(@x) skewY(@y);\n      -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+\n       -o-transform: skewX(@x) skewY(@y);\n          transform: skewX(@x) skewY(@y);\n}\n.translate(@x; @y) {\n  -webkit-transform: translate(@x, @y);\n      -ms-transform: translate(@x, @y); // IE9 only\n       -o-transform: translate(@x, @y);\n          transform: translate(@x, @y);\n}\n.translate3d(@x; @y; @z) {\n  -webkit-transform: translate3d(@x, @y, @z);\n          transform: translate3d(@x, @y, @z);\n}\n.rotate(@degrees) {\n  -webkit-transform: rotate(@degrees);\n      -ms-transform: rotate(@degrees); // IE9 only\n       -o-transform: rotate(@degrees);\n          transform: rotate(@degrees);\n}\n.rotateX(@degrees) {\n  -webkit-transform: rotateX(@degrees);\n      -ms-transform: rotateX(@degrees); // IE9 only\n       -o-transform: rotateX(@degrees);\n          transform: rotateX(@degrees);\n}\n.rotateY(@degrees) {\n  -webkit-transform: rotateY(@degrees);\n      -ms-transform: rotateY(@degrees); // IE9 only\n       -o-transform: rotateY(@degrees);\n          transform: rotateY(@degrees);\n}\n.perspective(@perspective) {\n  -webkit-perspective: @perspective;\n     -moz-perspective: @perspective;\n          perspective: @perspective;\n}\n.perspective-origin(@perspective) {\n  -webkit-perspective-origin: @perspective;\n     -moz-perspective-origin: @perspective;\n          perspective-origin: @perspective;\n}\n.transform-origin(@origin) {\n  -webkit-transform-origin: @origin;\n     -moz-transform-origin: @origin;\n      -ms-transform-origin: @origin; // IE9 only\n          transform-origin: @origin;\n}\n\n\n// Transitions\n\n.transition(@transition) {\n  -webkit-transition: @transition;\n       -o-transition: @transition;\n          transition: @transition;\n}\n.transition-property(@transition-property) {\n  -webkit-transition-property: @transition-property;\n          transition-property: @transition-property;\n}\n.transition-delay(@transition-delay) {\n  -webkit-transition-delay: @transition-delay;\n          transition-delay: @transition-delay;\n}\n.transition-duration(@transition-duration) {\n  -webkit-transition-duration: @transition-duration;\n          transition-duration: @transition-duration;\n}\n.transition-timing-function(@timing-function) {\n  -webkit-transition-timing-function: @timing-function;\n          transition-timing-function: @timing-function;\n}\n.transition-transform(@transition) {\n  -webkit-transition: -webkit-transform @transition;\n     -moz-transition: -moz-transform @transition;\n       -o-transition: -o-transform @transition;\n          transition: transform @transition;\n}\n\n\n// User select\n// For selecting text on the page\n\n.user-select(@select) {\n  -webkit-user-select: @select;\n     -moz-user-select: @select;\n      -ms-user-select: @select; // IE10+\n          user-select: @select;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/mixins.less",
    "content": "// Mixins\n// --------------------------------------------------\n\n// Utilities\n@import \"mixins/hide-text.less\";\n@import \"mixins/opacity.less\";\n@import \"mixins/image.less\";\n@import \"mixins/labels.less\";\n@import \"mixins/reset-filter.less\";\n@import \"mixins/resize.less\";\n@import \"mixins/responsive-visibility.less\";\n@import \"mixins/size.less\";\n@import \"mixins/tab-focus.less\";\n@import \"mixins/reset-text.less\";\n@import \"mixins/text-emphasis.less\";\n@import \"mixins/text-overflow.less\";\n@import \"mixins/vendor-prefixes.less\";\n\n// Components\n@import \"mixins/alerts.less\";\n@import \"mixins/buttons.less\";\n@import \"mixins/panels.less\";\n@import \"mixins/pagination.less\";\n@import \"mixins/list-group.less\";\n@import \"mixins/nav-divider.less\";\n@import \"mixins/forms.less\";\n@import \"mixins/progress-bar.less\";\n@import \"mixins/table-row.less\";\n\n// Skins\n@import \"mixins/background-variant.less\";\n@import \"mixins/border-radius.less\";\n@import \"mixins/gradients.less\";\n\n// Layout\n@import \"mixins/clearfix.less\";\n@import \"mixins/center-block.less\";\n@import \"mixins/nav-vertical-align.less\";\n@import \"mixins/grid-framework.less\";\n@import \"mixins/grid.less\";\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/modals.less",
    "content": "//\n// Modals\n// --------------------------------------------------\n\n// .modal-open      - body class for killing the scroll\n// .modal           - container to scroll within\n// .modal-dialog    - positioning shell for the actual modal\n// .modal-content   - actual modal w/ bg and corners and shit\n\n// Kill the scroll on the body\n.modal-open {\n  overflow: hidden;\n}\n\n// Container that the modal scrolls within\n.modal {\n  display: none;\n  overflow: hidden;\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: @zindex-modal;\n  -webkit-overflow-scrolling: touch;\n\n  // Prevent Chrome on Windows from adding a focus outline. For details, see\n  // https://github.com/twbs/bootstrap/pull/10951.\n  outline: 0;\n\n  // When fading in the modal, animate it to slide down\n  &.fade .modal-dialog {\n    .translate(0, -25%);\n    .transition-transform(~\"0.3s ease-out\");\n  }\n  &.in .modal-dialog { .translate(0, 0) }\n}\n.modal-open .modal {\n  overflow-x: hidden;\n  overflow-y: auto;\n}\n\n// Shell div to position the modal with bottom padding\n.modal-dialog {\n  position: relative;\n  width: auto;\n  margin: 10px;\n}\n\n// Actual modal\n.modal-content {\n  position: relative;\n  background-color: @modal-content-bg;\n  border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc)\n  border: 1px solid @modal-content-border-color;\n  border-radius: @border-radius-large;\n  .box-shadow(0 3px 9px rgba(0,0,0,.5));\n  background-clip: padding-box;\n  // Remove focus outline from opened modal\n  outline: 0;\n}\n\n// Modal background\n.modal-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: @zindex-modal-background;\n  background-color: @modal-backdrop-bg;\n  // Fade for backdrop\n  &.fade { .opacity(0); }\n  &.in { .opacity(@modal-backdrop-opacity); }\n}\n\n// Modal header\n// Top section of the modal w/ title and dismiss\n.modal-header {\n  padding: @modal-title-padding;\n  border-bottom: 1px solid @modal-header-border-color;\n  &:extend(.clearfix all);\n}\n// Close icon\n.modal-header .close {\n  margin-top: -2px;\n}\n\n// Title text within header\n.modal-title {\n  margin: 0;\n  line-height: @modal-title-line-height;\n}\n\n// Modal body\n// Where all modal content resides (sibling of .modal-header and .modal-footer)\n.modal-body {\n  position: relative;\n  padding: @modal-inner-padding;\n}\n\n// Footer (for actions)\n.modal-footer {\n  padding: @modal-inner-padding;\n  text-align: right; // right align buttons\n  border-top: 1px solid @modal-footer-border-color;\n  &:extend(.clearfix all); // clear it in case folks use .pull-* classes on buttons\n\n  // Properly space out buttons\n  .btn + .btn {\n    margin-left: 5px;\n    margin-bottom: 0; // account for input[type=\"submit\"] which gets the bottom margin like all other inputs\n  }\n  // but override that for button groups\n  .btn-group .btn + .btn {\n    margin-left: -1px;\n  }\n  // and override it for block buttons as well\n  .btn-block + .btn-block {\n    margin-left: 0;\n  }\n}\n\n// Measure scrollbar width for padding body during modal show/hide\n.modal-scrollbar-measure {\n  position: absolute;\n  top: -9999px;\n  width: 50px;\n  height: 50px;\n  overflow: scroll;\n}\n\n// Scale up the modal\n@media (min-width: @screen-sm-min) {\n  // Automatically set modal's width for larger viewports\n  .modal-dialog {\n    width: @modal-md;\n    margin: 30px auto;\n  }\n  .modal-content {\n    .box-shadow(0 5px 15px rgba(0,0,0,.5));\n  }\n\n  // Modal sizes\n  .modal-sm { width: @modal-sm; }\n}\n\n@media (min-width: @screen-md-min) {\n  .modal-lg { width: @modal-lg; }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/navbar.less",
    "content": "//\n// Navbars\n// --------------------------------------------------\n\n\n// Wrapper and base class\n//\n// Provide a static navbar from which we expand to create full-width, fixed, and\n// other navbar variations.\n\n.navbar {\n  position: relative;\n  min-height: @navbar-height; // Ensure a navbar always shows (e.g., without a .navbar-brand in collapsed mode)\n  margin-bottom: @navbar-margin-bottom;\n  border: 1px solid transparent;\n\n  // Prevent floats from breaking the navbar\n  &:extend(.clearfix all);\n\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: @navbar-border-radius;\n  }\n}\n\n\n// Navbar heading\n//\n// Groups `.navbar-brand` and `.navbar-toggle` into a single component for easy\n// styling of responsive aspects.\n\n.navbar-header {\n  &:extend(.clearfix all);\n\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n  }\n}\n\n\n// Navbar collapse (body)\n//\n// Group your navbar content into this for easy collapsing and expanding across\n// various device sizes. By default, this content is collapsed when <768px, but\n// will expand past that for a horizontal display.\n//\n// To start (on mobile devices) the navbar links, forms, and buttons are stacked\n// vertically and include a `max-height` to overflow in case you have too much\n// content for the user's viewport.\n\n.navbar-collapse {\n  overflow-x: visible;\n  padding-right: @navbar-padding-horizontal;\n  padding-left:  @navbar-padding-horizontal;\n  border-top: 1px solid transparent;\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);\n  &:extend(.clearfix all);\n  -webkit-overflow-scrolling: touch;\n\n  &.in {\n    overflow-y: auto;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    width: auto;\n    border-top: 0;\n    box-shadow: none;\n\n    &.collapse {\n      display: block !important;\n      height: auto !important;\n      padding-bottom: 0; // Override default setting\n      overflow: visible !important;\n    }\n\n    &.in {\n      overflow-y: visible;\n    }\n\n    // Undo the collapse side padding for navbars with containers to ensure\n    // alignment of right-aligned contents.\n    .navbar-fixed-top &,\n    .navbar-static-top &,\n    .navbar-fixed-bottom & {\n      padding-left: 0;\n      padding-right: 0;\n    }\n  }\n}\n\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  .navbar-collapse {\n    max-height: @navbar-collapse-max-height;\n\n    @media (max-device-width: @screen-xs-min) and (orientation: landscape) {\n      max-height: 200px;\n    }\n  }\n}\n\n\n// Both navbar header and collapse\n//\n// When a container is present, change the behavior of the header and collapse.\n\n.container,\n.container-fluid {\n  > .navbar-header,\n  > .navbar-collapse {\n    margin-right: -@navbar-padding-horizontal;\n    margin-left:  -@navbar-padding-horizontal;\n\n    @media (min-width: @grid-float-breakpoint) {\n      margin-right: 0;\n      margin-left:  0;\n    }\n  }\n}\n\n\n//\n// Navbar alignment options\n//\n// Display the navbar across the entirety of the page or fixed it to the top or\n// bottom of the page.\n\n// Static top (unfixed, but 100% wide) navbar\n.navbar-static-top {\n  z-index: @zindex-navbar;\n  border-width: 0 0 1px;\n\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: 0;\n  }\n}\n\n// Fix the top/bottom navbars when screen real estate supports it\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  position: fixed;\n  right: 0;\n  left: 0;\n  z-index: @zindex-navbar-fixed;\n\n  // Undo the rounded corners\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top {\n  top: 0;\n  border-width: 0 0 1px;\n}\n.navbar-fixed-bottom {\n  bottom: 0;\n  margin-bottom: 0; // override .navbar defaults\n  border-width: 1px 0 0;\n}\n\n\n// Brand/project name\n\n.navbar-brand {\n  float: left;\n  padding: @navbar-padding-vertical @navbar-padding-horizontal;\n  font-size: @font-size-large;\n  line-height: @line-height-computed;\n  height: @navbar-height;\n\n  &:hover,\n  &:focus {\n    text-decoration: none;\n  }\n\n  > img {\n    display: block;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    .navbar > .container &,\n    .navbar > .container-fluid & {\n      margin-left: -@navbar-padding-horizontal;\n    }\n  }\n}\n\n\n// Navbar toggle\n//\n// Custom button for toggling the `.navbar-collapse`, powered by the collapse\n// JavaScript plugin.\n\n.navbar-toggle {\n  position: relative;\n  float: right;\n  margin-right: @navbar-padding-horizontal;\n  padding: 9px 10px;\n  .navbar-vertical-align(34px);\n  background-color: transparent;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid transparent;\n  border-radius: @border-radius-base;\n\n  // We remove the `outline` here, but later compensate by attaching `:hover`\n  // styles to `:focus`.\n  &:focus {\n    outline: 0;\n  }\n\n  // Bars\n  .icon-bar {\n    display: block;\n    width: 22px;\n    height: 2px;\n    border-radius: 1px;\n  }\n  .icon-bar + .icon-bar {\n    margin-top: 4px;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    display: none;\n  }\n}\n\n\n// Navbar nav links\n//\n// Builds on top of the `.nav` components with its own modifier class to make\n// the nav the full height of the horizontal nav (above 768px).\n\n.navbar-nav {\n  margin: (@navbar-padding-vertical / 2) -@navbar-padding-horizontal;\n\n  > li > a {\n    padding-top:    10px;\n    padding-bottom: 10px;\n    line-height: @line-height-computed;\n  }\n\n  @media (max-width: @grid-float-breakpoint-max) {\n    // Dropdowns get custom display when collapsed\n    .open .dropdown-menu {\n      position: static;\n      float: none;\n      width: auto;\n      margin-top: 0;\n      background-color: transparent;\n      border: 0;\n      box-shadow: none;\n      > li > a,\n      .dropdown-header {\n        padding: 5px 15px 5px 25px;\n      }\n      > li > a {\n        line-height: @line-height-computed;\n        &:hover,\n        &:focus {\n          background-image: none;\n        }\n      }\n    }\n  }\n\n  // Uncollapse the nav\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n    margin: 0;\n\n    > li {\n      float: left;\n      > a {\n        padding-top:    @navbar-padding-vertical;\n        padding-bottom: @navbar-padding-vertical;\n      }\n    }\n  }\n}\n\n\n// Navbar form\n//\n// Extension of the `.form-inline` with some extra flavor for optimum display in\n// our navbars.\n\n.navbar-form {\n  margin-left: -@navbar-padding-horizontal;\n  margin-right: -@navbar-padding-horizontal;\n  padding: 10px @navbar-padding-horizontal;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid transparent;\n  @shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);\n  .box-shadow(@shadow);\n\n  // Mixin behavior for optimum display\n  .form-inline();\n\n  .form-group {\n    @media (max-width: @grid-float-breakpoint-max) {\n      margin-bottom: 5px;\n\n      &:last-child {\n        margin-bottom: 0;\n      }\n    }\n  }\n\n  // Vertically center in expanded, horizontal navbar\n  .navbar-vertical-align(@input-height-base);\n\n  // Undo 100% width for pull classes\n  @media (min-width: @grid-float-breakpoint) {\n    width: auto;\n    border: 0;\n    margin-left: 0;\n    margin-right: 0;\n    padding-top: 0;\n    padding-bottom: 0;\n    .box-shadow(none);\n  }\n}\n\n\n// Dropdown menus\n\n// Menu position and menu carets\n.navbar-nav > li > .dropdown-menu {\n  margin-top: 0;\n  .border-top-radius(0);\n}\n// Menu position and menu caret support for dropups via extra dropup class\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n  margin-bottom: 0;\n  .border-top-radius(@navbar-border-radius);\n  .border-bottom-radius(0);\n}\n\n\n// Buttons in navbars\n//\n// Vertically center a button within a navbar (when *not* in a form).\n\n.navbar-btn {\n  .navbar-vertical-align(@input-height-base);\n\n  &.btn-sm {\n    .navbar-vertical-align(@input-height-small);\n  }\n  &.btn-xs {\n    .navbar-vertical-align(22);\n  }\n}\n\n\n// Text in navbars\n//\n// Add a class to make any element properly align itself vertically within the navbars.\n\n.navbar-text {\n  .navbar-vertical-align(@line-height-computed);\n\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n    margin-left: @navbar-padding-horizontal;\n    margin-right: @navbar-padding-horizontal;\n  }\n}\n\n\n// Component alignment\n//\n// Repurpose the pull utilities as their own navbar utilities to avoid specificity\n// issues with parents and chaining. Only do this when the navbar is uncollapsed\n// though so that navbar contents properly stack and align in mobile.\n//\n// Declared after the navbar components to ensure more specificity on the margins.\n\n@media (min-width: @grid-float-breakpoint) {\n  .navbar-left  { .pull-left(); }\n  .navbar-right {\n    .pull-right();\n    margin-right: -@navbar-padding-horizontal;\n\n    ~ .navbar-right {\n      margin-right: 0;\n    }\n  }\n}\n\n\n// Alternate navbars\n// --------------------------------------------------\n\n// Default navbar\n.navbar-default {\n  background-color: @navbar-default-bg;\n  border-color: @navbar-default-border;\n\n  .navbar-brand {\n    color: @navbar-default-brand-color;\n    &:hover,\n    &:focus {\n      color: @navbar-default-brand-hover-color;\n      background-color: @navbar-default-brand-hover-bg;\n    }\n  }\n\n  .navbar-text {\n    color: @navbar-default-color;\n  }\n\n  .navbar-nav {\n    > li > a {\n      color: @navbar-default-link-color;\n\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-hover-color;\n        background-color: @navbar-default-link-hover-bg;\n      }\n    }\n    > .active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-active-color;\n        background-color: @navbar-default-link-active-bg;\n      }\n    }\n    > .disabled > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-disabled-color;\n        background-color: @navbar-default-link-disabled-bg;\n      }\n    }\n  }\n\n  .navbar-toggle {\n    border-color: @navbar-default-toggle-border-color;\n    &:hover,\n    &:focus {\n      background-color: @navbar-default-toggle-hover-bg;\n    }\n    .icon-bar {\n      background-color: @navbar-default-toggle-icon-bar-bg;\n    }\n  }\n\n  .navbar-collapse,\n  .navbar-form {\n    border-color: @navbar-default-border;\n  }\n\n  // Dropdown menu items\n  .navbar-nav {\n    // Remove background color from open dropdown\n    > .open > a {\n      &,\n      &:hover,\n      &:focus {\n        background-color: @navbar-default-link-active-bg;\n        color: @navbar-default-link-active-color;\n      }\n    }\n\n    @media (max-width: @grid-float-breakpoint-max) {\n      // Dropdowns get custom display when collapsed\n      .open .dropdown-menu {\n        > li > a {\n          color: @navbar-default-link-color;\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-hover-color;\n            background-color: @navbar-default-link-hover-bg;\n          }\n        }\n        > .active > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-active-color;\n            background-color: @navbar-default-link-active-bg;\n          }\n        }\n        > .disabled > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-disabled-color;\n            background-color: @navbar-default-link-disabled-bg;\n          }\n        }\n      }\n    }\n  }\n\n\n  // Links in navbars\n  //\n  // Add a class to ensure links outside the navbar nav are colored correctly.\n\n  .navbar-link {\n    color: @navbar-default-link-color;\n    &:hover {\n      color: @navbar-default-link-hover-color;\n    }\n  }\n\n  .btn-link {\n    color: @navbar-default-link-color;\n    &:hover,\n    &:focus {\n      color: @navbar-default-link-hover-color;\n    }\n    &[disabled],\n    fieldset[disabled] & {\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-disabled-color;\n      }\n    }\n  }\n}\n\n// Inverse navbar\n\n.navbar-inverse {\n  background-color: @navbar-inverse-bg;\n  border-color: @navbar-inverse-border;\n\n  .navbar-brand {\n    color: @navbar-inverse-brand-color;\n    &:hover,\n    &:focus {\n      color: @navbar-inverse-brand-hover-color;\n      background-color: @navbar-inverse-brand-hover-bg;\n    }\n  }\n\n  .navbar-text {\n    color: @navbar-inverse-color;\n  }\n\n  .navbar-nav {\n    > li > a {\n      color: @navbar-inverse-link-color;\n\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-hover-color;\n        background-color: @navbar-inverse-link-hover-bg;\n      }\n    }\n    > .active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-active-color;\n        background-color: @navbar-inverse-link-active-bg;\n      }\n    }\n    > .disabled > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-disabled-color;\n        background-color: @navbar-inverse-link-disabled-bg;\n      }\n    }\n  }\n\n  // Darken the responsive nav toggle\n  .navbar-toggle {\n    border-color: @navbar-inverse-toggle-border-color;\n    &:hover,\n    &:focus {\n      background-color: @navbar-inverse-toggle-hover-bg;\n    }\n    .icon-bar {\n      background-color: @navbar-inverse-toggle-icon-bar-bg;\n    }\n  }\n\n  .navbar-collapse,\n  .navbar-form {\n    border-color: darken(@navbar-inverse-bg, 7%);\n  }\n\n  // Dropdowns\n  .navbar-nav {\n    > .open > a {\n      &,\n      &:hover,\n      &:focus {\n        background-color: @navbar-inverse-link-active-bg;\n        color: @navbar-inverse-link-active-color;\n      }\n    }\n\n    @media (max-width: @grid-float-breakpoint-max) {\n      // Dropdowns get custom display\n      .open .dropdown-menu {\n        > .dropdown-header {\n          border-color: @navbar-inverse-border;\n        }\n        .divider {\n          background-color: @navbar-inverse-border;\n        }\n        > li > a {\n          color: @navbar-inverse-link-color;\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-hover-color;\n            background-color: @navbar-inverse-link-hover-bg;\n          }\n        }\n        > .active > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-active-color;\n            background-color: @navbar-inverse-link-active-bg;\n          }\n        }\n        > .disabled > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-disabled-color;\n            background-color: @navbar-inverse-link-disabled-bg;\n          }\n        }\n      }\n    }\n  }\n\n  .navbar-link {\n    color: @navbar-inverse-link-color;\n    &:hover {\n      color: @navbar-inverse-link-hover-color;\n    }\n  }\n\n  .btn-link {\n    color: @navbar-inverse-link-color;\n    &:hover,\n    &:focus {\n      color: @navbar-inverse-link-hover-color;\n    }\n    &[disabled],\n    fieldset[disabled] & {\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-disabled-color;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/navs.less",
    "content": "//\n// Navs\n// --------------------------------------------------\n\n\n// Base class\n// --------------------------------------------------\n\n.nav {\n  margin-bottom: 0;\n  padding-left: 0; // Override default ul/ol\n  list-style: none;\n  &:extend(.clearfix all);\n\n  > li {\n    position: relative;\n    display: block;\n\n    > a {\n      position: relative;\n      display: block;\n      padding: @nav-link-padding;\n      &:hover,\n      &:focus {\n        text-decoration: none;\n        background-color: @nav-link-hover-bg;\n      }\n    }\n\n    // Disabled state sets text to gray and nukes hover/tab effects\n    &.disabled > a {\n      color: @nav-disabled-link-color;\n\n      &:hover,\n      &:focus {\n        color: @nav-disabled-link-hover-color;\n        text-decoration: none;\n        background-color: transparent;\n        cursor: @cursor-disabled;\n      }\n    }\n  }\n\n  // Open dropdowns\n  .open > a {\n    &,\n    &:hover,\n    &:focus {\n      background-color: @nav-link-hover-bg;\n      border-color: @link-color;\n    }\n  }\n\n  // Nav dividers (deprecated with v3.0.1)\n  //\n  // This should have been removed in v3 with the dropping of `.nav-list`, but\n  // we missed it. We don't currently support this anywhere, but in the interest\n  // of maintaining backward compatibility in case you use it, it's deprecated.\n  .nav-divider {\n    .nav-divider();\n  }\n\n  // Prevent IE8 from misplacing imgs\n  //\n  // See https://github.com/h5bp/html5-boilerplate/issues/984#issuecomment-3985989\n  > li > a > img {\n    max-width: none;\n  }\n}\n\n\n// Tabs\n// -------------------------\n\n// Give the tabs something to sit on\n.nav-tabs {\n  border-bottom: 1px solid @nav-tabs-border-color;\n  > li {\n    float: left;\n    // Make the list-items overlay the bottom border\n    margin-bottom: -1px;\n\n    // Actual tabs (as links)\n    > a {\n      margin-right: 2px;\n      line-height: @line-height-base;\n      border: 1px solid transparent;\n      border-radius: @border-radius-base @border-radius-base 0 0;\n      &:hover {\n        border-color: @nav-tabs-link-hover-border-color @nav-tabs-link-hover-border-color @nav-tabs-border-color;\n      }\n    }\n\n    // Active state, and its :hover to override normal :hover\n    &.active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @nav-tabs-active-link-hover-color;\n        background-color: @nav-tabs-active-link-hover-bg;\n        border: 1px solid @nav-tabs-active-link-hover-border-color;\n        border-bottom-color: transparent;\n        cursor: default;\n      }\n    }\n  }\n  // pulling this in mainly for less shorthand\n  &.nav-justified {\n    .nav-justified();\n    .nav-tabs-justified();\n  }\n}\n\n\n// Pills\n// -------------------------\n.nav-pills {\n  > li {\n    float: left;\n\n    // Links rendered as pills\n    > a {\n      border-radius: @nav-pills-border-radius;\n    }\n    + li {\n      margin-left: 2px;\n    }\n\n    // Active state\n    &.active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @nav-pills-active-link-hover-color;\n        background-color: @nav-pills-active-link-hover-bg;\n      }\n    }\n  }\n}\n\n\n// Stacked pills\n.nav-stacked {\n  > li {\n    float: none;\n    + li {\n      margin-top: 2px;\n      margin-left: 0; // no need for this gap between nav items\n    }\n  }\n}\n\n\n// Nav variations\n// --------------------------------------------------\n\n// Justified nav links\n// -------------------------\n\n.nav-justified {\n  width: 100%;\n\n  > li {\n    float: none;\n    > a {\n      text-align: center;\n      margin-bottom: 5px;\n    }\n  }\n\n  > .dropdown .dropdown-menu {\n    top: auto;\n    left: auto;\n  }\n\n  @media (min-width: @screen-sm-min) {\n    > li {\n      display: table-cell;\n      width: 1%;\n      > a {\n        margin-bottom: 0;\n      }\n    }\n  }\n}\n\n// Move borders to anchors instead of bottom of list\n//\n// Mixin for adding on top the shared `.nav-justified` styles for our tabs\n.nav-tabs-justified {\n  border-bottom: 0;\n\n  > li > a {\n    // Override margin from .nav-tabs\n    margin-right: 0;\n    border-radius: @border-radius-base;\n  }\n\n  > .active > a,\n  > .active > a:hover,\n  > .active > a:focus {\n    border: 1px solid @nav-tabs-justified-link-border-color;\n  }\n\n  @media (min-width: @screen-sm-min) {\n    > li > a {\n      border-bottom: 1px solid @nav-tabs-justified-link-border-color;\n      border-radius: @border-radius-base @border-radius-base 0 0;\n    }\n    > .active > a,\n    > .active > a:hover,\n    > .active > a:focus {\n      border-bottom-color: @nav-tabs-justified-active-link-border-color;\n    }\n  }\n}\n\n\n// Tabbable tabs\n// -------------------------\n\n// Hide tabbable panes to start, show them when `.active`\n.tab-content {\n  > .tab-pane {\n    display: none;\n  }\n  > .active {\n    display: block;\n  }\n}\n\n\n// Dropdowns\n// -------------------------\n\n// Specific dropdowns\n.nav-tabs .dropdown-menu {\n  // make dropdown border overlap tab border\n  margin-top: -1px;\n  // Remove the top rounded corners here since there is a hard edge above the menu\n  .border-top-radius(0);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/normalize.less",
    "content": "/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\n\n//\n// 1. Set default font family to sans-serif.\n// 2. Prevent iOS and IE text size adjust after device orientation change,\n//    without disabling user zoom.\n//\n\nhtml {\n  font-family: sans-serif; // 1\n  -ms-text-size-adjust: 100%; // 2\n  -webkit-text-size-adjust: 100%; // 2\n}\n\n//\n// Remove default margin.\n//\n\nbody {\n  margin: 0;\n}\n\n// HTML5 display definitions\n// ==========================================================================\n\n//\n// Correct `block` display not defined for any HTML5 element in IE 8/9.\n// Correct `block` display not defined for `details` or `summary` in IE 10/11\n// and Firefox.\n// Correct `block` display not defined for `main` in IE 11.\n//\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n  display: block;\n}\n\n//\n// 1. Correct `inline-block` display not defined in IE 8/9.\n// 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n//\n\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block; // 1\n  vertical-align: baseline; // 2\n}\n\n//\n// Prevent modern browsers from displaying `audio` without controls.\n// Remove excess height in iOS 5 devices.\n//\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n//\n// Address `[hidden]` styling not present in IE 8/9/10.\n// Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.\n//\n\n[hidden],\ntemplate {\n  display: none;\n}\n\n// Links\n// ==========================================================================\n\n//\n// Remove the gray background color from active links in IE 10.\n//\n\na {\n  background-color: transparent;\n}\n\n//\n// Improve readability of focused elements when they are also in an\n// active/hover state.\n//\n\na:active,\na:hover {\n  outline: 0;\n}\n\n// Text-level semantics\n// ==========================================================================\n\n//\n// Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n//\n\nabbr[title] {\n  border-bottom: 1px dotted;\n}\n\n//\n// Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n//\n\nb,\nstrong {\n  font-weight: bold;\n}\n\n//\n// Address styling not present in Safari and Chrome.\n//\n\ndfn {\n  font-style: italic;\n}\n\n//\n// Address variable `h1` font-size and margin within `section` and `article`\n// contexts in Firefox 4+, Safari, and Chrome.\n//\n\nh1 {\n  font-size: 2em;\n  margin: 0.67em 0;\n}\n\n//\n// Address styling not present in IE 8/9.\n//\n\nmark {\n  background: #ff0;\n  color: #000;\n}\n\n//\n// Address inconsistent and variable font size in all browsers.\n//\n\nsmall {\n  font-size: 80%;\n}\n\n//\n// Prevent `sub` and `sup` affecting `line-height` in all browsers.\n//\n\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\n// Embedded content\n// ==========================================================================\n\n//\n// Remove border when inside `a` element in IE 8/9/10.\n//\n\nimg {\n  border: 0;\n}\n\n//\n// Correct overflow not hidden in IE 9/10/11.\n//\n\nsvg:not(:root) {\n  overflow: hidden;\n}\n\n// Grouping content\n// ==========================================================================\n\n//\n// Address margin not present in IE 8/9 and Safari.\n//\n\nfigure {\n  margin: 1em 40px;\n}\n\n//\n// Address differences between Firefox and other browsers.\n//\n\nhr {\n  box-sizing: content-box;\n  height: 0;\n}\n\n//\n// Contain overflow in all browsers.\n//\n\npre {\n  overflow: auto;\n}\n\n//\n// Address odd `em`-unit font size rendering in all browsers.\n//\n\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\n\n// Forms\n// ==========================================================================\n\n//\n// Known limitation: by default, Chrome and Safari on OS X allow very limited\n// styling of `select`, unless a `border` property is set.\n//\n\n//\n// 1. Correct color not being inherited.\n//    Known issue: affects color of disabled elements.\n// 2. Correct font properties not being inherited.\n// 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n//\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  color: inherit; // 1\n  font: inherit; // 2\n  margin: 0; // 3\n}\n\n//\n// Address `overflow` set to `hidden` in IE 8/9/10/11.\n//\n\nbutton {\n  overflow: visible;\n}\n\n//\n// Address inconsistent `text-transform` inheritance for `button` and `select`.\n// All other form control elements do not inherit `text-transform` values.\n// Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n// Correct `select` style inheritance in Firefox.\n//\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n//\n// 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n//    and `video` controls.\n// 2. Correct inability to style clickable `input` types in iOS.\n// 3. Improve usability and consistency of cursor style between image-type\n//    `input` and others.\n//\n\nbutton,\nhtml input[type=\"button\"], // 1\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  -webkit-appearance: button; // 2\n  cursor: pointer; // 3\n}\n\n//\n// Re-set default cursor for disabled elements.\n//\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\n//\n// Remove inner padding and border in Firefox 4+.\n//\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\n\n//\n// Address Firefox 4+ setting `line-height` on `input` using `!important` in\n// the UA stylesheet.\n//\n\ninput {\n  line-height: normal;\n}\n\n//\n// It's recommended that you don't attempt to style these elements.\n// Firefox's implementation doesn't respect box-sizing, padding, or width.\n//\n// 1. Address box sizing set to `content-box` in IE 8/9/10.\n// 2. Remove excess padding in IE 8/9/10.\n//\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  box-sizing: border-box; // 1\n  padding: 0; // 2\n}\n\n//\n// Fix the cursor style for Chrome's increment/decrement buttons. For certain\n// `font-size` values of the `input`, it causes the cursor style of the\n// decrement button to change from `default` to `text`.\n//\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n  height: auto;\n}\n\n//\n// 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n// 2. Address `box-sizing` set to `border-box` in Safari and Chrome.\n//\n\ninput[type=\"search\"] {\n  -webkit-appearance: textfield; // 1\n  box-sizing: content-box; //2\n}\n\n//\n// Remove inner padding and search cancel button in Safari and Chrome on OS X.\n// Safari (but not Chrome) clips the cancel button when the search input has\n// padding (and `textfield` appearance).\n//\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n//\n// Define consistent border, margin, and padding.\n//\n\nfieldset {\n  border: 1px solid #c0c0c0;\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n}\n\n//\n// 1. Correct `color` not being inherited in IE 8/9/10/11.\n// 2. Remove padding so people aren't caught out if they zero out fieldsets.\n//\n\nlegend {\n  border: 0; // 1\n  padding: 0; // 2\n}\n\n//\n// Remove default vertical scrollbar in IE 8/9/10/11.\n//\n\ntextarea {\n  overflow: auto;\n}\n\n//\n// Don't inherit the `font-weight` (applied by a rule above).\n// NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n//\n\noptgroup {\n  font-weight: bold;\n}\n\n// Tables\n// ==========================================================================\n\n//\n// Remove most spacing between table cells.\n//\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\n\ntd,\nth {\n  padding: 0;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/pager.less",
    "content": "//\n// Pager pagination\n// --------------------------------------------------\n\n\n.pager {\n  padding-left: 0;\n  margin: @line-height-computed 0;\n  list-style: none;\n  text-align: center;\n  &:extend(.clearfix all);\n  li {\n    display: inline;\n    > a,\n    > span {\n      display: inline-block;\n      padding: 5px 14px;\n      background-color: @pager-bg;\n      border: 1px solid @pager-border;\n      border-radius: @pager-border-radius;\n    }\n\n    > a:hover,\n    > a:focus {\n      text-decoration: none;\n      background-color: @pager-hover-bg;\n    }\n  }\n\n  .next {\n    > a,\n    > span {\n      float: right;\n    }\n  }\n\n  .previous {\n    > a,\n    > span {\n      float: left;\n    }\n  }\n\n  .disabled {\n    > a,\n    > a:hover,\n    > a:focus,\n    > span {\n      color: @pager-disabled-color;\n      background-color: @pager-bg;\n      cursor: @cursor-disabled;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/pagination.less",
    "content": "//\n// Pagination (multiple pages)\n// --------------------------------------------------\n.pagination {\n  display: inline-block;\n  padding-left: 0;\n  margin: @line-height-computed 0;\n  border-radius: @border-radius-base;\n\n  > li {\n    display: inline; // Remove list-style and block-level defaults\n    > a,\n    > span {\n      position: relative;\n      float: left; // Collapse white-space\n      padding: @padding-base-vertical @padding-base-horizontal;\n      line-height: @line-height-base;\n      text-decoration: none;\n      color: @pagination-color;\n      background-color: @pagination-bg;\n      border: 1px solid @pagination-border;\n      margin-left: -1px;\n    }\n    &:first-child {\n      > a,\n      > span {\n        margin-left: 0;\n        .border-left-radius(@border-radius-base);\n      }\n    }\n    &:last-child {\n      > a,\n      > span {\n        .border-right-radius(@border-radius-base);\n      }\n    }\n  }\n\n  > li > a,\n  > li > span {\n    &:hover,\n    &:focus {\n      z-index: 2;\n      color: @pagination-hover-color;\n      background-color: @pagination-hover-bg;\n      border-color: @pagination-hover-border;\n    }\n  }\n\n  > .active > a,\n  > .active > span {\n    &,\n    &:hover,\n    &:focus {\n      z-index: 3;\n      color: @pagination-active-color;\n      background-color: @pagination-active-bg;\n      border-color: @pagination-active-border;\n      cursor: default;\n    }\n  }\n\n  > .disabled {\n    > span,\n    > span:hover,\n    > span:focus,\n    > a,\n    > a:hover,\n    > a:focus {\n      color: @pagination-disabled-color;\n      background-color: @pagination-disabled-bg;\n      border-color: @pagination-disabled-border;\n      cursor: @cursor-disabled;\n    }\n  }\n}\n\n// Sizing\n// --------------------------------------------------\n\n// Large\n.pagination-lg {\n  .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);\n}\n\n// Small\n.pagination-sm {\n  .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/panels.less",
    "content": "//\n// Panels\n// --------------------------------------------------\n\n\n// Base class\n.panel {\n  margin-bottom: @line-height-computed;\n  background-color: @panel-bg;\n  border: 1px solid transparent;\n  border-radius: @panel-border-radius;\n  .box-shadow(0 1px 1px rgba(0,0,0,.05));\n}\n\n// Panel contents\n.panel-body {\n  padding: @panel-body-padding;\n  &:extend(.clearfix all);\n}\n\n// Optional heading\n.panel-heading {\n  padding: @panel-heading-padding;\n  border-bottom: 1px solid transparent;\n  .border-top-radius((@panel-border-radius - 1));\n\n  > .dropdown .dropdown-toggle {\n    color: inherit;\n  }\n}\n\n// Within heading, strip any `h*` tag of its default margins for spacing.\n.panel-title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-size: ceil((@font-size-base * 1.125));\n  color: inherit;\n\n  > a,\n  > small,\n  > .small,\n  > small > a,\n  > .small > a {\n    color: inherit;\n  }\n}\n\n// Optional footer (stays gray in every modifier class)\n.panel-footer {\n  padding: @panel-footer-padding;\n  background-color: @panel-footer-bg;\n  border-top: 1px solid @panel-inner-border;\n  .border-bottom-radius((@panel-border-radius - 1));\n}\n\n\n// List groups in panels\n//\n// By default, space out list group content from panel headings to account for\n// any kind of custom content between the two.\n\n.panel {\n  > .list-group,\n  > .panel-collapse > .list-group {\n    margin-bottom: 0;\n\n    .list-group-item {\n      border-width: 1px 0;\n      border-radius: 0;\n    }\n\n    // Add border top radius for first one\n    &:first-child {\n      .list-group-item:first-child {\n        border-top: 0;\n        .border-top-radius((@panel-border-radius - 1));\n      }\n    }\n\n    // Add border bottom radius for last one\n    &:last-child {\n      .list-group-item:last-child {\n        border-bottom: 0;\n        .border-bottom-radius((@panel-border-radius - 1));\n      }\n    }\n  }\n  > .panel-heading + .panel-collapse > .list-group {\n    .list-group-item:first-child {\n      .border-top-radius(0);\n    }\n  }\n}\n// Collapse space between when there's no additional content.\n.panel-heading + .list-group {\n  .list-group-item:first-child {\n    border-top-width: 0;\n  }\n}\n.list-group + .panel-footer {\n  border-top-width: 0;\n}\n\n// Tables in panels\n//\n// Place a non-bordered `.table` within a panel (not within a `.panel-body`) and\n// watch it go full width.\n\n.panel {\n  > .table,\n  > .table-responsive > .table,\n  > .panel-collapse > .table {\n    margin-bottom: 0;\n\n    caption {\n      padding-left: @panel-body-padding;\n      padding-right: @panel-body-padding;\n    }\n  }\n  // Add border top radius for first one\n  > .table:first-child,\n  > .table-responsive:first-child > .table:first-child {\n    .border-top-radius((@panel-border-radius - 1));\n\n    > thead:first-child,\n    > tbody:first-child {\n      > tr:first-child {\n        border-top-left-radius: (@panel-border-radius - 1);\n        border-top-right-radius: (@panel-border-radius - 1);\n\n        td:first-child,\n        th:first-child {\n          border-top-left-radius: (@panel-border-radius - 1);\n        }\n        td:last-child,\n        th:last-child {\n          border-top-right-radius: (@panel-border-radius - 1);\n        }\n      }\n    }\n  }\n  // Add border bottom radius for last one\n  > .table:last-child,\n  > .table-responsive:last-child > .table:last-child {\n    .border-bottom-radius((@panel-border-radius - 1));\n\n    > tbody:last-child,\n    > tfoot:last-child {\n      > tr:last-child {\n        border-bottom-left-radius: (@panel-border-radius - 1);\n        border-bottom-right-radius: (@panel-border-radius - 1);\n\n        td:first-child,\n        th:first-child {\n          border-bottom-left-radius: (@panel-border-radius - 1);\n        }\n        td:last-child,\n        th:last-child {\n          border-bottom-right-radius: (@panel-border-radius - 1);\n        }\n      }\n    }\n  }\n  > .panel-body + .table,\n  > .panel-body + .table-responsive,\n  > .table + .panel-body,\n  > .table-responsive + .panel-body {\n    border-top: 1px solid @table-border-color;\n  }\n  > .table > tbody:first-child > tr:first-child th,\n  > .table > tbody:first-child > tr:first-child td {\n    border-top: 0;\n  }\n  > .table-bordered,\n  > .table-responsive > .table-bordered {\n    border: 0;\n    > thead,\n    > tbody,\n    > tfoot {\n      > tr {\n        > th:first-child,\n        > td:first-child {\n          border-left: 0;\n        }\n        > th:last-child,\n        > td:last-child {\n          border-right: 0;\n        }\n      }\n    }\n    > thead,\n    > tbody {\n      > tr:first-child {\n        > td,\n        > th {\n          border-bottom: 0;\n        }\n      }\n    }\n    > tbody,\n    > tfoot {\n      > tr:last-child {\n        > td,\n        > th {\n          border-bottom: 0;\n        }\n      }\n    }\n  }\n  > .table-responsive {\n    border: 0;\n    margin-bottom: 0;\n  }\n}\n\n\n// Collapsible panels (aka, accordion)\n//\n// Wrap a series of panels in `.panel-group` to turn them into an accordion with\n// the help of our collapse JavaScript plugin.\n\n.panel-group {\n  margin-bottom: @line-height-computed;\n\n  // Tighten up margin so it's only between panels\n  .panel {\n    margin-bottom: 0;\n    border-radius: @panel-border-radius;\n\n    + .panel {\n      margin-top: 5px;\n    }\n  }\n\n  .panel-heading {\n    border-bottom: 0;\n\n    + .panel-collapse > .panel-body,\n    + .panel-collapse > .list-group {\n      border-top: 1px solid @panel-inner-border;\n    }\n  }\n\n  .panel-footer {\n    border-top: 0;\n    + .panel-collapse .panel-body {\n      border-bottom: 1px solid @panel-inner-border;\n    }\n  }\n}\n\n\n// Contextual variations\n.panel-default {\n  .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);\n}\n.panel-primary {\n  .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);\n}\n.panel-success {\n  .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);\n}\n.panel-info {\n  .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);\n}\n.panel-warning {\n  .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);\n}\n.panel-danger {\n  .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/popovers.less",
    "content": "//\n// Popovers\n// --------------------------------------------------\n\n\n.popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: @zindex-popover;\n  display: none;\n  max-width: @popover-max-width;\n  padding: 1px;\n  // Our parent element can be arbitrary since popovers are by default inserted as a sibling of their target element.\n  // So reset our font and text properties to avoid inheriting weird values.\n  .reset-text();\n  font-size: @font-size-base;\n\n  background-color: @popover-bg;\n  background-clip: padding-box;\n  border: 1px solid @popover-fallback-border-color;\n  border: 1px solid @popover-border-color;\n  border-radius: @border-radius-large;\n  .box-shadow(0 5px 10px rgba(0,0,0,.2));\n\n  // Offset the popover to account for the popover arrow\n  &.top     { margin-top: -@popover-arrow-width; }\n  &.right   { margin-left: @popover-arrow-width; }\n  &.bottom  { margin-top: @popover-arrow-width; }\n  &.left    { margin-left: -@popover-arrow-width; }\n}\n\n.popover-title {\n  margin: 0; // reset heading margin\n  padding: 8px 14px;\n  font-size: @font-size-base;\n  background-color: @popover-title-bg;\n  border-bottom: 1px solid darken(@popover-title-bg, 5%);\n  border-radius: (@border-radius-large - 1) (@border-radius-large - 1) 0 0;\n}\n\n.popover-content {\n  padding: 9px 14px;\n}\n\n// Arrows\n//\n// .arrow is outer, .arrow:after is inner\n\n.popover > .arrow {\n  &,\n  &:after {\n    position: absolute;\n    display: block;\n    width: 0;\n    height: 0;\n    border-color: transparent;\n    border-style: solid;\n  }\n}\n.popover > .arrow {\n  border-width: @popover-arrow-outer-width;\n}\n.popover > .arrow:after {\n  border-width: @popover-arrow-width;\n  content: \"\";\n}\n\n.popover {\n  &.top > .arrow {\n    left: 50%;\n    margin-left: -@popover-arrow-outer-width;\n    border-bottom-width: 0;\n    border-top-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-top-color: @popover-arrow-outer-color;\n    bottom: -@popover-arrow-outer-width;\n    &:after {\n      content: \" \";\n      bottom: 1px;\n      margin-left: -@popover-arrow-width;\n      border-bottom-width: 0;\n      border-top-color: @popover-arrow-color;\n    }\n  }\n  &.right > .arrow {\n    top: 50%;\n    left: -@popover-arrow-outer-width;\n    margin-top: -@popover-arrow-outer-width;\n    border-left-width: 0;\n    border-right-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-right-color: @popover-arrow-outer-color;\n    &:after {\n      content: \" \";\n      left: 1px;\n      bottom: -@popover-arrow-width;\n      border-left-width: 0;\n      border-right-color: @popover-arrow-color;\n    }\n  }\n  &.bottom > .arrow {\n    left: 50%;\n    margin-left: -@popover-arrow-outer-width;\n    border-top-width: 0;\n    border-bottom-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-bottom-color: @popover-arrow-outer-color;\n    top: -@popover-arrow-outer-width;\n    &:after {\n      content: \" \";\n      top: 1px;\n      margin-left: -@popover-arrow-width;\n      border-top-width: 0;\n      border-bottom-color: @popover-arrow-color;\n    }\n  }\n\n  &.left > .arrow {\n    top: 50%;\n    right: -@popover-arrow-outer-width;\n    margin-top: -@popover-arrow-outer-width;\n    border-right-width: 0;\n    border-left-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-left-color: @popover-arrow-outer-color;\n    &:after {\n      content: \" \";\n      right: 1px;\n      border-right-width: 0;\n      border-left-color: @popover-arrow-color;\n      bottom: -@popover-arrow-width;\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/print.less",
    "content": "/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */\n\n// ==========================================================================\n// Print styles.\n// Inlined to avoid the additional HTTP request: h5bp.com/r\n// ==========================================================================\n\n@media print {\n    *,\n    *:before,\n    *:after {\n        background: transparent !important;\n        color: #000 !important; // Black prints faster: h5bp.com/s\n        box-shadow: none !important;\n        text-shadow: none !important;\n    }\n\n    a,\n    a:visited {\n        text-decoration: underline;\n    }\n\n    a[href]:after {\n        content: \" (\" attr(href) \")\";\n    }\n\n    abbr[title]:after {\n        content: \" (\" attr(title) \")\";\n    }\n\n    // Don't show links that are fragment identifiers,\n    // or use the `javascript:` pseudo protocol\n    a[href^=\"#\"]:after,\n    a[href^=\"javascript:\"]:after {\n        content: \"\";\n    }\n\n    pre,\n    blockquote {\n        border: 1px solid #999;\n        page-break-inside: avoid;\n    }\n\n    thead {\n        display: table-header-group; // h5bp.com/t\n    }\n\n    tr,\n    img {\n        page-break-inside: avoid;\n    }\n\n    img {\n        max-width: 100% !important;\n    }\n\n    p,\n    h2,\n    h3 {\n        orphans: 3;\n        widows: 3;\n    }\n\n    h2,\n    h3 {\n        page-break-after: avoid;\n    }\n\n    // Bootstrap specific changes start\n\n    // Bootstrap components\n    .navbar {\n        display: none;\n    }\n    .btn,\n    .dropup > .btn {\n        > .caret {\n            border-top-color: #000 !important;\n        }\n    }\n    .label {\n        border: 1px solid #000;\n    }\n\n    .table {\n        border-collapse: collapse !important;\n\n        td,\n        th {\n            background-color: #fff !important;\n        }\n    }\n    .table-bordered {\n        th,\n        td {\n            border: 1px solid #ddd !important;\n        }\n    }\n\n    // Bootstrap specific changes end\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/progress-bars.less",
    "content": "//\n// Progress bars\n// --------------------------------------------------\n\n\n// Bar animations\n// -------------------------\n\n// WebKit\n@-webkit-keyframes progress-bar-stripes {\n  from  { background-position: 40px 0; }\n  to    { background-position: 0 0; }\n}\n\n// Spec and IE10+\n@keyframes progress-bar-stripes {\n  from  { background-position: 40px 0; }\n  to    { background-position: 0 0; }\n}\n\n\n// Bar itself\n// -------------------------\n\n// Outer container\n.progress {\n  overflow: hidden;\n  height: @line-height-computed;\n  margin-bottom: @line-height-computed;\n  background-color: @progress-bg;\n  border-radius: @progress-border-radius;\n  .box-shadow(inset 0 1px 2px rgba(0,0,0,.1));\n}\n\n// Bar of progress\n.progress-bar {\n  float: left;\n  width: 0%;\n  height: 100%;\n  font-size: @font-size-small;\n  line-height: @line-height-computed;\n  color: @progress-bar-color;\n  text-align: center;\n  background-color: @progress-bar-bg;\n  .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15));\n  .transition(width .6s ease);\n}\n\n// Striped bars\n//\n// `.progress-striped .progress-bar` is deprecated as of v3.2.0 in favor of the\n// `.progress-bar-striped` class, which you just add to an existing\n// `.progress-bar`.\n.progress-striped .progress-bar,\n.progress-bar-striped {\n  #gradient > .striped();\n  background-size: 40px 40px;\n}\n\n// Call animation for the active one\n//\n// `.progress.active .progress-bar` is deprecated as of v3.2.0 in favor of the\n// `.progress-bar.active` approach.\n.progress.active .progress-bar,\n.progress-bar.active {\n  .animation(progress-bar-stripes 2s linear infinite);\n}\n\n\n// Variations\n// -------------------------\n\n.progress-bar-success {\n  .progress-bar-variant(@progress-bar-success-bg);\n}\n\n.progress-bar-info {\n  .progress-bar-variant(@progress-bar-info-bg);\n}\n\n.progress-bar-warning {\n  .progress-bar-variant(@progress-bar-warning-bg);\n}\n\n.progress-bar-danger {\n  .progress-bar-variant(@progress-bar-danger-bg);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/responsive-embed.less",
    "content": "// Embeds responsive\n//\n// Credit: Nicolas Gallagher and SUIT CSS.\n\n.embed-responsive {\n  position: relative;\n  display: block;\n  height: 0;\n  padding: 0;\n  overflow: hidden;\n\n  .embed-responsive-item,\n  iframe,\n  embed,\n  object,\n  video {\n    position: absolute;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    height: 100%;\n    width: 100%;\n    border: 0;\n  }\n}\n\n// Modifier class for 16:9 aspect ratio\n.embed-responsive-16by9 {\n  padding-bottom: 56.25%;\n}\n\n// Modifier class for 4:3 aspect ratio\n.embed-responsive-4by3 {\n  padding-bottom: 75%;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/responsive-utilities.less",
    "content": "//\n// Responsive: Utility classes\n// --------------------------------------------------\n\n\n// IE10 in Windows (Phone) 8\n//\n// Support for responsive views via media queries is kind of borked in IE10, for\n// Surface/desktop in split view and for Windows Phone 8. This particular fix\n// must be accompanied by a snippet of JavaScript to sniff the user agent and\n// apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at\n// our Getting Started page for more information on this bug.\n//\n// For more information, see the following:\n//\n// Issue: https://github.com/twbs/bootstrap/issues/10497\n// Docs: http://getbootstrap.com/getting-started/#support-ie10-width\n// Source: http://timkadlec.com/2013/01/windows-phone-8-and-device-width/\n// Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/\n\n@-ms-viewport {\n  width: device-width;\n}\n\n\n// Visibility utilities\n// Note: Deprecated .visible-xs, .visible-sm, .visible-md, and .visible-lg as of v3.2.0\n.visible-xs,\n.visible-sm,\n.visible-md,\n.visible-lg {\n  .responsive-invisibility();\n}\n\n.visible-xs-block,\n.visible-xs-inline,\n.visible-xs-inline-block,\n.visible-sm-block,\n.visible-sm-inline,\n.visible-sm-inline-block,\n.visible-md-block,\n.visible-md-inline,\n.visible-md-inline-block,\n.visible-lg-block,\n.visible-lg-inline,\n.visible-lg-inline-block {\n  display: none !important;\n}\n\n.visible-xs {\n  @media (max-width: @screen-xs-max) {\n    .responsive-visibility();\n  }\n}\n.visible-xs-block {\n  @media (max-width: @screen-xs-max) {\n    display: block !important;\n  }\n}\n.visible-xs-inline {\n  @media (max-width: @screen-xs-max) {\n    display: inline !important;\n  }\n}\n.visible-xs-inline-block {\n  @media (max-width: @screen-xs-max) {\n    display: inline-block !important;\n  }\n}\n\n.visible-sm {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    .responsive-visibility();\n  }\n}\n.visible-sm-block {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    display: block !important;\n  }\n}\n.visible-sm-inline {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    display: inline !important;\n  }\n}\n.visible-sm-inline-block {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    display: inline-block !important;\n  }\n}\n\n.visible-md {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    .responsive-visibility();\n  }\n}\n.visible-md-block {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    display: block !important;\n  }\n}\n.visible-md-inline {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    display: inline !important;\n  }\n}\n.visible-md-inline-block {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    display: inline-block !important;\n  }\n}\n\n.visible-lg {\n  @media (min-width: @screen-lg-min) {\n    .responsive-visibility();\n  }\n}\n.visible-lg-block {\n  @media (min-width: @screen-lg-min) {\n    display: block !important;\n  }\n}\n.visible-lg-inline {\n  @media (min-width: @screen-lg-min) {\n    display: inline !important;\n  }\n}\n.visible-lg-inline-block {\n  @media (min-width: @screen-lg-min) {\n    display: inline-block !important;\n  }\n}\n\n.hidden-xs {\n  @media (max-width: @screen-xs-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-sm {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-md {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-lg {\n  @media (min-width: @screen-lg-min) {\n    .responsive-invisibility();\n  }\n}\n\n\n// Print utilities\n//\n// Media queries are placed on the inside to be mixin-friendly.\n\n// Note: Deprecated .visible-print as of v3.2.0\n.visible-print {\n  .responsive-invisibility();\n\n  @media print {\n    .responsive-visibility();\n  }\n}\n.visible-print-block {\n  display: none !important;\n\n  @media print {\n    display: block !important;\n  }\n}\n.visible-print-inline {\n  display: none !important;\n\n  @media print {\n    display: inline !important;\n  }\n}\n.visible-print-inline-block {\n  display: none !important;\n\n  @media print {\n    display: inline-block !important;\n  }\n}\n\n.hidden-print {\n  @media print {\n    .responsive-invisibility();\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/scaffolding.less",
    "content": "//\n// Scaffolding\n// --------------------------------------------------\n\n\n// Reset the box-sizing\n//\n// Heads up! This reset may cause conflicts with some third-party widgets.\n// For recommendations on resolving such conflicts, see\n// http://getbootstrap.com/getting-started/#third-box-sizing\n* {\n  .box-sizing(border-box);\n}\n*:before,\n*:after {\n  .box-sizing(border-box);\n}\n\n\n// Body reset\n\nhtml {\n  font-size: 10px;\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n}\n\nbody {\n  font-family: @font-family-base;\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @text-color;\n  background-color: @body-bg;\n}\n\n// Reset fonts for relevant elements\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: inherit;\n  font-size: inherit;\n  line-height: inherit;\n}\n\n\n// Links\n\na {\n  color: @link-color;\n  text-decoration: none;\n\n  &:hover,\n  &:focus {\n    color: @link-hover-color;\n    text-decoration: @link-hover-decoration;\n  }\n\n  &:focus {\n    .tab-focus();\n  }\n}\n\n\n// Figures\n//\n// We reset this here because previously Normalize had no `figure` margins. This\n// ensures we don't break anyone's use of the element.\n\nfigure {\n  margin: 0;\n}\n\n\n// Images\n\nimg {\n  vertical-align: middle;\n}\n\n// Responsive images (ensure images don't scale beyond their parents)\n.img-responsive {\n  .img-responsive();\n}\n\n// Rounded corners\n.img-rounded {\n  border-radius: @border-radius-large;\n}\n\n// Image thumbnails\n//\n// Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`.\n.img-thumbnail {\n  padding: @thumbnail-padding;\n  line-height: @line-height-base;\n  background-color: @thumbnail-bg;\n  border: 1px solid @thumbnail-border;\n  border-radius: @thumbnail-border-radius;\n  .transition(all .2s ease-in-out);\n\n  // Keep them at most 100% wide\n  .img-responsive(inline-block);\n}\n\n// Perfect circle\n.img-circle {\n  border-radius: 50%; // set radius in percents\n}\n\n\n// Horizontal rules\n\nhr {\n  margin-top:    @line-height-computed;\n  margin-bottom: @line-height-computed;\n  border: 0;\n  border-top: 1px solid @hr-border;\n}\n\n\n// Only display content to screen readers\n//\n// See: http://a11yproject.com/posts/how-to-hide-content\n\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  clip: rect(0,0,0,0);\n  border: 0;\n}\n\n// Use in conjunction with .sr-only to only display content when it's focused.\n// Useful for \"Skip to main content\" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1\n// Credit: HTML5 Boilerplate\n\n.sr-only-focusable {\n  &:active,\n  &:focus {\n    position: static;\n    width: auto;\n    height: auto;\n    margin: 0;\n    overflow: visible;\n    clip: auto;\n  }\n}\n\n\n// iOS \"clickable elements\" fix for role=\"button\"\n//\n// Fixes \"clickability\" issue (and more generally, the firing of events such as focus as well)\n// for traditionally non-focusable elements with role=\"button\"\n// see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile\n\n[role=\"button\"] {\n  cursor: pointer;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/tables.less",
    "content": "//\n// Tables\n// --------------------------------------------------\n\n\ntable {\n  background-color: @table-bg;\n}\ncaption {\n  padding-top: @table-cell-padding;\n  padding-bottom: @table-cell-padding;\n  color: @text-muted;\n  text-align: left;\n}\nth {\n  text-align: left;\n}\n\n\n// Baseline styles\n\n.table {\n  width: 100%;\n  max-width: 100%;\n  margin-bottom: @line-height-computed;\n  // Cells\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        padding: @table-cell-padding;\n        line-height: @line-height-base;\n        vertical-align: top;\n        border-top: 1px solid @table-border-color;\n      }\n    }\n  }\n  // Bottom align for column headings\n  > thead > tr > th {\n    vertical-align: bottom;\n    border-bottom: 2px solid @table-border-color;\n  }\n  // Remove top border from thead by default\n  > caption + thead,\n  > colgroup + thead,\n  > thead:first-child {\n    > tr:first-child {\n      > th,\n      > td {\n        border-top: 0;\n      }\n    }\n  }\n  // Account for multiple tbody instances\n  > tbody + tbody {\n    border-top: 2px solid @table-border-color;\n  }\n\n  // Nesting\n  .table {\n    background-color: @body-bg;\n  }\n}\n\n\n// Condensed table w/ half padding\n\n.table-condensed {\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        padding: @table-condensed-cell-padding;\n      }\n    }\n  }\n}\n\n\n// Bordered version\n//\n// Add borders all around the table and between all the columns.\n\n.table-bordered {\n  border: 1px solid @table-border-color;\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        border: 1px solid @table-border-color;\n      }\n    }\n  }\n  > thead > tr {\n    > th,\n    > td {\n      border-bottom-width: 2px;\n    }\n  }\n}\n\n\n// Zebra-striping\n//\n// Default zebra-stripe styles (alternating gray and transparent backgrounds)\n\n.table-striped {\n  > tbody > tr:nth-of-type(odd) {\n    background-color: @table-bg-accent;\n  }\n}\n\n\n// Hover effect\n//\n// Placed here since it has to come after the potential zebra striping\n\n.table-hover {\n  > tbody > tr:hover {\n    background-color: @table-bg-hover;\n  }\n}\n\n\n// Table cell sizing\n//\n// Reset default table behavior\n\ntable col[class*=\"col-\"] {\n  position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)\n  float: none;\n  display: table-column;\n}\ntable {\n  td,\n  th {\n    &[class*=\"col-\"] {\n      position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)\n      float: none;\n      display: table-cell;\n    }\n  }\n}\n\n\n// Table backgrounds\n//\n// Exact selectors below required to override `.table-striped` and prevent\n// inheritance to nested tables.\n\n// Generate the contextual variants\n.table-row-variant(active; @table-bg-active);\n.table-row-variant(success; @state-success-bg);\n.table-row-variant(info; @state-info-bg);\n.table-row-variant(warning; @state-warning-bg);\n.table-row-variant(danger; @state-danger-bg);\n\n\n// Responsive tables\n//\n// Wrap your tables in `.table-responsive` and we'll make them mobile friendly\n// by enabling horizontal scrolling. Only applies <768px. Everything above that\n// will display normally.\n\n.table-responsive {\n  overflow-x: auto;\n  min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)\n\n  @media screen and (max-width: @screen-xs-max) {\n    width: 100%;\n    margin-bottom: (@line-height-computed * 0.75);\n    overflow-y: hidden;\n    -ms-overflow-style: -ms-autohiding-scrollbar;\n    border: 1px solid @table-border-color;\n\n    // Tighten up spacing\n    > .table {\n      margin-bottom: 0;\n\n      // Ensure the content doesn't wrap\n      > thead,\n      > tbody,\n      > tfoot {\n        > tr {\n          > th,\n          > td {\n            white-space: nowrap;\n          }\n        }\n      }\n    }\n\n    // Special overrides for the bordered tables\n    > .table-bordered {\n      border: 0;\n\n      // Nuke the appropriate borders so that the parent can handle them\n      > thead,\n      > tbody,\n      > tfoot {\n        > tr {\n          > th:first-child,\n          > td:first-child {\n            border-left: 0;\n          }\n          > th:last-child,\n          > td:last-child {\n            border-right: 0;\n          }\n        }\n      }\n\n      // Only nuke the last row's bottom-border in `tbody` and `tfoot` since\n      // chances are there will be only one `tr` in a `thead` and that would\n      // remove the border altogether.\n      > tbody,\n      > tfoot {\n        > tr:last-child {\n          > th,\n          > td {\n            border-bottom: 0;\n          }\n        }\n      }\n\n    }\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/theme.less",
    "content": "/*!\n * Bootstrap v3.3.7 (http://getbootstrap.com)\n * Copyright 2011-2016 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n\n//\n// Load core variables and mixins\n// --------------------------------------------------\n\n@import \"variables.less\";\n@import \"mixins.less\";\n\n\n//\n// Buttons\n// --------------------------------------------------\n\n// Common styles\n.btn-default,\n.btn-primary,\n.btn-success,\n.btn-info,\n.btn-warning,\n.btn-danger {\n  text-shadow: 0 -1px 0 rgba(0,0,0,.2);\n  @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.075);\n  .box-shadow(@shadow);\n\n  // Reset the shadow\n  &:active,\n  &.active {\n    .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n  }\n\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    .box-shadow(none);\n  }\n\n  .badge {\n    text-shadow: none;\n  }\n}\n\n// Mixin for generating new styles\n.btn-styles(@btn-color: #555) {\n  #gradient > .vertical(@start-color: @btn-color; @end-color: darken(@btn-color, 12%));\n  .reset-filter(); // Disable gradients for IE9 because filter bleeds through rounded corners; see https://github.com/twbs/bootstrap/issues/10620\n  background-repeat: repeat-x;\n  border-color: darken(@btn-color, 14%);\n\n  &:hover,\n  &:focus  {\n    background-color: darken(@btn-color, 12%);\n    background-position: 0 -15px;\n  }\n\n  &:active,\n  &.active {\n    background-color: darken(@btn-color, 12%);\n    border-color: darken(@btn-color, 14%);\n  }\n\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    &,\n    &:hover,\n    &:focus,\n    &.focus,\n    &:active,\n    &.active {\n      background-color: darken(@btn-color, 12%);\n      background-image: none;\n    }\n  }\n}\n\n// Common styles\n.btn {\n  // Remove the gradient for the pressed/active state\n  &:active,\n  &.active {\n    background-image: none;\n  }\n}\n\n// Apply the mixin to the buttons\n.btn-default { .btn-styles(@btn-default-bg); text-shadow: 0 1px 0 #fff; border-color: #ccc; }\n.btn-primary { .btn-styles(@btn-primary-bg); }\n.btn-success { .btn-styles(@btn-success-bg); }\n.btn-info    { .btn-styles(@btn-info-bg); }\n.btn-warning { .btn-styles(@btn-warning-bg); }\n.btn-danger  { .btn-styles(@btn-danger-bg); }\n\n\n//\n// Images\n// --------------------------------------------------\n\n.thumbnail,\n.img-thumbnail {\n  .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n\n\n//\n// Dropdowns\n// --------------------------------------------------\n\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  #gradient > .vertical(@start-color: @dropdown-link-hover-bg; @end-color: darken(@dropdown-link-hover-bg, 5%));\n  background-color: darken(@dropdown-link-hover-bg, 5%);\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  #gradient > .vertical(@start-color: @dropdown-link-active-bg; @end-color: darken(@dropdown-link-active-bg, 5%));\n  background-color: darken(@dropdown-link-active-bg, 5%);\n}\n\n\n//\n// Navbar\n// --------------------------------------------------\n\n// Default navbar\n.navbar-default {\n  #gradient > .vertical(@start-color: lighten(@navbar-default-bg, 10%); @end-color: @navbar-default-bg);\n  .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered\n  border-radius: @navbar-border-radius;\n  @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 5px rgba(0,0,0,.075);\n  .box-shadow(@shadow);\n\n  .navbar-nav > .open > a,\n  .navbar-nav > .active > a {\n    #gradient > .vertical(@start-color: darken(@navbar-default-link-active-bg, 5%); @end-color: darken(@navbar-default-link-active-bg, 2%));\n    .box-shadow(inset 0 3px 9px rgba(0,0,0,.075));\n  }\n}\n.navbar-brand,\n.navbar-nav > li > a {\n  text-shadow: 0 1px 0 rgba(255,255,255,.25);\n}\n\n// Inverted navbar\n.navbar-inverse {\n  #gradient > .vertical(@start-color: lighten(@navbar-inverse-bg, 10%); @end-color: @navbar-inverse-bg);\n  .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered; see https://github.com/twbs/bootstrap/issues/10257\n  border-radius: @navbar-border-radius;\n  .navbar-nav > .open > a,\n  .navbar-nav > .active > a {\n    #gradient > .vertical(@start-color: @navbar-inverse-link-active-bg; @end-color: lighten(@navbar-inverse-link-active-bg, 2.5%));\n    .box-shadow(inset 0 3px 9px rgba(0,0,0,.25));\n  }\n\n  .navbar-brand,\n  .navbar-nav > li > a {\n    text-shadow: 0 -1px 0 rgba(0,0,0,.25);\n  }\n}\n\n// Undo rounded corners in static and fixed navbars\n.navbar-static-top,\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  border-radius: 0;\n}\n\n// Fix active state of dropdown items in collapsed mode\n@media (max-width: @grid-float-breakpoint-max) {\n  .navbar .navbar-nav .open .dropdown-menu > .active > a {\n    &,\n    &:hover,\n    &:focus {\n      color: #fff;\n      #gradient > .vertical(@start-color: @dropdown-link-active-bg; @end-color: darken(@dropdown-link-active-bg, 5%));\n    }\n  }\n}\n\n\n//\n// Alerts\n// --------------------------------------------------\n\n// Common styles\n.alert {\n  text-shadow: 0 1px 0 rgba(255,255,255,.2);\n  @shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.05);\n  .box-shadow(@shadow);\n}\n\n// Mixin for generating new styles\n.alert-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 7.5%));\n  border-color: darken(@color, 15%);\n}\n\n// Apply the mixin to the alerts\n.alert-success    { .alert-styles(@alert-success-bg); }\n.alert-info       { .alert-styles(@alert-info-bg); }\n.alert-warning    { .alert-styles(@alert-warning-bg); }\n.alert-danger     { .alert-styles(@alert-danger-bg); }\n\n\n//\n// Progress bars\n// --------------------------------------------------\n\n// Give the progress background some depth\n.progress {\n  #gradient > .vertical(@start-color: darken(@progress-bg, 4%); @end-color: @progress-bg)\n}\n\n// Mixin for generating new styles\n.progress-bar-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 10%));\n}\n\n// Apply the mixin to the progress bars\n.progress-bar            { .progress-bar-styles(@progress-bar-bg); }\n.progress-bar-success    { .progress-bar-styles(@progress-bar-success-bg); }\n.progress-bar-info       { .progress-bar-styles(@progress-bar-info-bg); }\n.progress-bar-warning    { .progress-bar-styles(@progress-bar-warning-bg); }\n.progress-bar-danger     { .progress-bar-styles(@progress-bar-danger-bg); }\n\n// Reset the striped class because our mixins don't do multiple gradients and\n// the above custom styles override the new `.progress-bar-striped` in v3.2.0.\n.progress-bar-striped {\n  #gradient > .striped();\n}\n\n\n//\n// List groups\n// --------------------------------------------------\n\n.list-group {\n  border-radius: @border-radius-base;\n  .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n  text-shadow: 0 -1px 0 darken(@list-group-active-bg, 10%);\n  #gradient > .vertical(@start-color: @list-group-active-bg; @end-color: darken(@list-group-active-bg, 7.5%));\n  border-color: darken(@list-group-active-border, 7.5%);\n\n  .badge {\n    text-shadow: none;\n  }\n}\n\n\n//\n// Panels\n// --------------------------------------------------\n\n// Common styles\n.panel {\n  .box-shadow(0 1px 2px rgba(0,0,0,.05));\n}\n\n// Mixin for generating new styles\n.panel-heading-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 5%));\n}\n\n// Apply the mixin to the panel headings only\n.panel-default > .panel-heading   { .panel-heading-styles(@panel-default-heading-bg); }\n.panel-primary > .panel-heading   { .panel-heading-styles(@panel-primary-heading-bg); }\n.panel-success > .panel-heading   { .panel-heading-styles(@panel-success-heading-bg); }\n.panel-info > .panel-heading      { .panel-heading-styles(@panel-info-heading-bg); }\n.panel-warning > .panel-heading   { .panel-heading-styles(@panel-warning-heading-bg); }\n.panel-danger > .panel-heading    { .panel-heading-styles(@panel-danger-heading-bg); }\n\n\n//\n// Wells\n// --------------------------------------------------\n\n.well {\n  #gradient > .vertical(@start-color: darken(@well-bg, 5%); @end-color: @well-bg);\n  border-color: darken(@well-bg, 10%);\n  @shadow: inset 0 1px 3px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);\n  .box-shadow(@shadow);\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/thumbnails.less",
    "content": "//\n// Thumbnails\n// --------------------------------------------------\n\n\n// Mixin and adjust the regular image class\n.thumbnail {\n  display: block;\n  padding: @thumbnail-padding;\n  margin-bottom: @line-height-computed;\n  line-height: @line-height-base;\n  background-color: @thumbnail-bg;\n  border: 1px solid @thumbnail-border;\n  border-radius: @thumbnail-border-radius;\n  .transition(border .2s ease-in-out);\n\n  > img,\n  a > img {\n    &:extend(.img-responsive);\n    margin-left: auto;\n    margin-right: auto;\n  }\n\n  // Add a hover state for linked versions only\n  a&:hover,\n  a&:focus,\n  a&.active {\n    border-color: @link-color;\n  }\n\n  // Image captions\n  .caption {\n    padding: @thumbnail-caption-padding;\n    color: @thumbnail-caption-color;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/tooltip.less",
    "content": "//\n// Tooltips\n// --------------------------------------------------\n\n\n// Base class\n.tooltip {\n  position: absolute;\n  z-index: @zindex-tooltip;\n  display: block;\n  // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.\n  // So reset our font and text properties to avoid inheriting weird values.\n  .reset-text();\n  font-size: @font-size-small;\n\n  .opacity(0);\n\n  &.in     { .opacity(@tooltip-opacity); }\n  &.top    { margin-top:  -3px; padding: @tooltip-arrow-width 0; }\n  &.right  { margin-left:  3px; padding: 0 @tooltip-arrow-width; }\n  &.bottom { margin-top:   3px; padding: @tooltip-arrow-width 0; }\n  &.left   { margin-left: -3px; padding: 0 @tooltip-arrow-width; }\n}\n\n// Wrapper for the tooltip content\n.tooltip-inner {\n  max-width: @tooltip-max-width;\n  padding: 3px 8px;\n  color: @tooltip-color;\n  text-align: center;\n  background-color: @tooltip-bg;\n  border-radius: @border-radius-base;\n}\n\n// Arrows\n.tooltip-arrow {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n// Note: Deprecated .top-left, .top-right, .bottom-left, and .bottom-right as of v3.3.1\n.tooltip {\n  &.top .tooltip-arrow {\n    bottom: 0;\n    left: 50%;\n    margin-left: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.top-left .tooltip-arrow {\n    bottom: 0;\n    right: @tooltip-arrow-width;\n    margin-bottom: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.top-right .tooltip-arrow {\n    bottom: 0;\n    left: @tooltip-arrow-width;\n    margin-bottom: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.right .tooltip-arrow {\n    top: 50%;\n    left: 0;\n    margin-top: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-right-color: @tooltip-arrow-color;\n  }\n  &.left .tooltip-arrow {\n    top: 50%;\n    right: 0;\n    margin-top: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-left-color: @tooltip-arrow-color;\n  }\n  &.bottom .tooltip-arrow {\n    top: 0;\n    left: 50%;\n    margin-left: -@tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n  &.bottom-left .tooltip-arrow {\n    top: 0;\n    right: @tooltip-arrow-width;\n    margin-top: -@tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n  &.bottom-right .tooltip-arrow {\n    top: 0;\n    left: @tooltip-arrow-width;\n    margin-top: -@tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/type.less",
    "content": "//\n// Typography\n// --------------------------------------------------\n\n\n// Headings\n// -------------------------\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  font-family: @headings-font-family;\n  font-weight: @headings-font-weight;\n  line-height: @headings-line-height;\n  color: @headings-color;\n\n  small,\n  .small {\n    font-weight: normal;\n    line-height: 1;\n    color: @headings-small-color;\n  }\n}\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: @line-height-computed;\n  margin-bottom: (@line-height-computed / 2);\n\n  small,\n  .small {\n    font-size: 65%;\n  }\n}\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: (@line-height-computed / 2);\n  margin-bottom: (@line-height-computed / 2);\n\n  small,\n  .small {\n    font-size: 75%;\n  }\n}\n\nh1, .h1 { font-size: @font-size-h1; }\nh2, .h2 { font-size: @font-size-h2; }\nh3, .h3 { font-size: @font-size-h3; }\nh4, .h4 { font-size: @font-size-h4; }\nh5, .h5 { font-size: @font-size-h5; }\nh6, .h6 { font-size: @font-size-h6; }\n\n\n// Body text\n// -------------------------\n\np {\n  margin: 0 0 (@line-height-computed / 2);\n}\n\n.lead {\n  margin-bottom: @line-height-computed;\n  font-size: floor((@font-size-base * 1.15));\n  font-weight: 300;\n  line-height: 1.4;\n\n  @media (min-width: @screen-sm-min) {\n    font-size: (@font-size-base * 1.5);\n  }\n}\n\n\n// Emphasis & misc\n// -------------------------\n\n// Ex: (12px small font / 14px base font) * 100% = about 85%\nsmall,\n.small {\n  font-size: floor((100% * @font-size-small / @font-size-base));\n}\n\nmark,\n.mark {\n  background-color: @state-warning-bg;\n  padding: .2em;\n}\n\n// Alignment\n.text-left           { text-align: left; }\n.text-right          { text-align: right; }\n.text-center         { text-align: center; }\n.text-justify        { text-align: justify; }\n.text-nowrap         { white-space: nowrap; }\n\n// Transformation\n.text-lowercase      { text-transform: lowercase; }\n.text-uppercase      { text-transform: uppercase; }\n.text-capitalize     { text-transform: capitalize; }\n\n// Contextual colors\n.text-muted {\n  color: @text-muted;\n}\n.text-primary {\n  .text-emphasis-variant(@brand-primary);\n}\n.text-success {\n  .text-emphasis-variant(@state-success-text);\n}\n.text-info {\n  .text-emphasis-variant(@state-info-text);\n}\n.text-warning {\n  .text-emphasis-variant(@state-warning-text);\n}\n.text-danger {\n  .text-emphasis-variant(@state-danger-text);\n}\n\n// Contextual backgrounds\n// For now we'll leave these alongside the text classes until v4 when we can\n// safely shift things around (per SemVer rules).\n.bg-primary {\n  // Given the contrast here, this is the only class to have its color inverted\n  // automatically.\n  color: #fff;\n  .bg-variant(@brand-primary);\n}\n.bg-success {\n  .bg-variant(@state-success-bg);\n}\n.bg-info {\n  .bg-variant(@state-info-bg);\n}\n.bg-warning {\n  .bg-variant(@state-warning-bg);\n}\n.bg-danger {\n  .bg-variant(@state-danger-bg);\n}\n\n\n// Page header\n// -------------------------\n\n.page-header {\n  padding-bottom: ((@line-height-computed / 2) - 1);\n  margin: (@line-height-computed * 2) 0 @line-height-computed;\n  border-bottom: 1px solid @page-header-border-color;\n}\n\n\n// Lists\n// -------------------------\n\n// Unordered and Ordered lists\nul,\nol {\n  margin-top: 0;\n  margin-bottom: (@line-height-computed / 2);\n  ul,\n  ol {\n    margin-bottom: 0;\n  }\n}\n\n// List options\n\n// Unstyled keeps list items block level, just removes default browser padding and list-style\n.list-unstyled {\n  padding-left: 0;\n  list-style: none;\n}\n\n// Inline turns list items into inline-block\n.list-inline {\n  .list-unstyled();\n  margin-left: -5px;\n\n  > li {\n    display: inline-block;\n    padding-left: 5px;\n    padding-right: 5px;\n  }\n}\n\n// Description Lists\ndl {\n  margin-top: 0; // Remove browser default\n  margin-bottom: @line-height-computed;\n}\ndt,\ndd {\n  line-height: @line-height-base;\n}\ndt {\n  font-weight: bold;\n}\ndd {\n  margin-left: 0; // Undo browser default\n}\n\n// Horizontal description lists\n//\n// Defaults to being stacked without any of the below styles applied, until the\n// grid breakpoint is reached (default of ~768px).\n\n.dl-horizontal {\n  dd {\n    &:extend(.clearfix all); // Clear the floated `dt` if an empty `dd` is present\n  }\n\n  @media (min-width: @dl-horizontal-breakpoint) {\n    dt {\n      float: left;\n      width: (@dl-horizontal-offset - 20);\n      clear: left;\n      text-align: right;\n      .text-overflow();\n    }\n    dd {\n      margin-left: @dl-horizontal-offset;\n    }\n  }\n}\n\n\n// Misc\n// -------------------------\n\n// Abbreviations and acronyms\nabbr[title],\n// Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257\nabbr[data-original-title] {\n  cursor: help;\n  border-bottom: 1px dotted @abbr-border-color;\n}\n.initialism {\n  font-size: 90%;\n  .text-uppercase();\n}\n\n// Blockquotes\nblockquote {\n  padding: (@line-height-computed / 2) @line-height-computed;\n  margin: 0 0 @line-height-computed;\n  font-size: @blockquote-font-size;\n  border-left: 5px solid @blockquote-border-color;\n\n  p,\n  ul,\n  ol {\n    &:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  // Note: Deprecated small and .small as of v3.1.0\n  // Context: https://github.com/twbs/bootstrap/issues/11660\n  footer,\n  small,\n  .small {\n    display: block;\n    font-size: 80%; // back to default font-size\n    line-height: @line-height-base;\n    color: @blockquote-small-color;\n\n    &:before {\n      content: '\\2014 \\00A0'; // em dash, nbsp\n    }\n  }\n}\n\n// Opposite alignment of blockquote\n//\n// Heads up: `blockquote.pull-right` has been deprecated as of v3.1.0.\n.blockquote-reverse,\nblockquote.pull-right {\n  padding-right: 15px;\n  padding-left: 0;\n  border-right: 5px solid @blockquote-border-color;\n  border-left: 0;\n  text-align: right;\n\n  // Account for citation\n  footer,\n  small,\n  .small {\n    &:before { content: ''; }\n    &:after {\n      content: '\\00A0 \\2014'; // nbsp, em dash\n    }\n  }\n}\n\n// Addresses\naddress {\n  margin-bottom: @line-height-computed;\n  font-style: normal;\n  line-height: @line-height-base;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/utilities.less",
    "content": "//\n// Utility classes\n// --------------------------------------------------\n\n\n// Floats\n// -------------------------\n\n.clearfix {\n  .clearfix();\n}\n.center-block {\n  .center-block();\n}\n.pull-right {\n  float: right !important;\n}\n.pull-left {\n  float: left !important;\n}\n\n\n// Toggling content\n// -------------------------\n\n// Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1\n.hide {\n  display: none !important;\n}\n.show {\n  display: block !important;\n}\n.invisible {\n  visibility: hidden;\n}\n.text-hide {\n  .text-hide();\n}\n\n\n// Hide from screenreaders and browsers\n//\n// Credit: HTML5 Boilerplate\n\n.hidden {\n  display: none !important;\n}\n\n\n// For Affix plugin\n// -------------------------\n\n.affix {\n  position: fixed;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/variables.less",
    "content": "//\n// Variables\n// --------------------------------------------------\n\n\n//== Colors\n//\n//## Gray and brand colors for use across Bootstrap.\n\n@gray-base:              #000;\n@gray-darker:            lighten(@gray-base, 13.5%); // #222\n@gray-dark:              lighten(@gray-base, 20%);   // #333\n@gray:                   lighten(@gray-base, 33.5%); // #555\n@gray-light:             lighten(@gray-base, 46.7%); // #777\n@gray-lighter:           lighten(@gray-base, 93.5%); // #eee\n\n@brand-primary:         darken(#428bca, 6.5%); // #337ab7\n@brand-success:         #5cb85c;\n@brand-info:            #5bc0de;\n@brand-warning:         #f0ad4e;\n@brand-danger:          #d9534f;\n\n\n//== Scaffolding\n//\n//## Settings for some of the most global styles.\n\n//** Background color for `<body>`.\n@body-bg:               #fff;\n//** Global text color on `<body>`.\n@text-color:            @gray-dark;\n\n//** Global textual link color.\n@link-color:            @brand-primary;\n//** Link hover color set via `darken()` function.\n@link-hover-color:      darken(@link-color, 15%);\n//** Link hover decoration.\n@link-hover-decoration: underline;\n\n\n//== Typography\n//\n//## Font, line-height, and color for body text, headings, and more.\n\n@font-family-sans-serif:  \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n@font-family-serif:       Georgia, \"Times New Roman\", Times, serif;\n//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.\n@font-family-monospace:   Menlo, Monaco, Consolas, \"Courier New\", monospace;\n@font-family-base:        @font-family-sans-serif;\n\n@font-size-base:          14px;\n@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px\n@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px\n\n@font-size-h1:            floor((@font-size-base * 2.6)); // ~36px\n@font-size-h2:            floor((@font-size-base * 2.15)); // ~30px\n@font-size-h3:            ceil((@font-size-base * 1.7)); // ~24px\n@font-size-h4:            ceil((@font-size-base * 1.25)); // ~18px\n@font-size-h5:            @font-size-base;\n@font-size-h6:            ceil((@font-size-base * 0.85)); // ~12px\n\n//** Unit-less `line-height` for use in components like buttons.\n@line-height-base:        1.428571429; // 20/14\n//** Computed \"line-height\" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.\n@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px\n\n//** By default, this inherits from the `<body>`.\n@headings-font-family:    inherit;\n@headings-font-weight:    500;\n@headings-line-height:    1.1;\n@headings-color:          inherit;\n\n\n//== Iconography\n//\n//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.\n\n//** Load fonts from this directory.\n@icon-font-path:          \"../fonts/\";\n//** File name for all font files.\n@icon-font-name:          \"glyphicons-halflings-regular\";\n//** Element ID within SVG icon file.\n@icon-font-svg-id:        \"glyphicons_halflingsregular\";\n\n\n//== Components\n//\n//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).\n\n@padding-base-vertical:     6px;\n@padding-base-horizontal:   12px;\n\n@padding-large-vertical:    10px;\n@padding-large-horizontal:  16px;\n\n@padding-small-vertical:    5px;\n@padding-small-horizontal:  10px;\n\n@padding-xs-vertical:       1px;\n@padding-xs-horizontal:     5px;\n\n@line-height-large:         1.3333333; // extra decimals for Win 8.1 Chrome\n@line-height-small:         1.5;\n\n@border-radius-base:        4px;\n@border-radius-large:       6px;\n@border-radius-small:       3px;\n\n//** Global color for active items (e.g., navs or dropdowns).\n@component-active-color:    #fff;\n//** Global background color for active items (e.g., navs or dropdowns).\n@component-active-bg:       @brand-primary;\n\n//** Width of the `border` for generating carets that indicate dropdowns.\n@caret-width-base:          4px;\n//** Carets increase slightly in size for larger components.\n@caret-width-large:         5px;\n\n\n//== Tables\n//\n//## Customizes the `.table` component with basic values, each used across all table variations.\n\n//** Padding for `<th>`s and `<td>`s.\n@table-cell-padding:            8px;\n//** Padding for cells in `.table-condensed`.\n@table-condensed-cell-padding:  5px;\n\n//** Default background color used for all tables.\n@table-bg:                      transparent;\n//** Background color used for `.table-striped`.\n@table-bg-accent:               #f9f9f9;\n//** Background color used for `.table-hover`.\n@table-bg-hover:                #f5f5f5;\n@table-bg-active:               @table-bg-hover;\n\n//** Border color for table and cell borders.\n@table-border-color:            #ddd;\n\n\n//== Buttons\n//\n//## For each of Bootstrap's buttons, define text, background and border color.\n\n@btn-font-weight:                normal;\n\n@btn-default-color:              #333;\n@btn-default-bg:                 #fff;\n@btn-default-border:             #ccc;\n\n@btn-primary-color:              #fff;\n@btn-primary-bg:                 @brand-primary;\n@btn-primary-border:             darken(@btn-primary-bg, 5%);\n\n@btn-success-color:              #fff;\n@btn-success-bg:                 @brand-success;\n@btn-success-border:             darken(@btn-success-bg, 5%);\n\n@btn-info-color:                 #fff;\n@btn-info-bg:                    @brand-info;\n@btn-info-border:                darken(@btn-info-bg, 5%);\n\n@btn-warning-color:              #fff;\n@btn-warning-bg:                 @brand-warning;\n@btn-warning-border:             darken(@btn-warning-bg, 5%);\n\n@btn-danger-color:               #fff;\n@btn-danger-bg:                  @brand-danger;\n@btn-danger-border:              darken(@btn-danger-bg, 5%);\n\n@btn-link-disabled-color:        @gray-light;\n\n// Allows for customizing button radius independently from global border radius\n@btn-border-radius-base:         @border-radius-base;\n@btn-border-radius-large:        @border-radius-large;\n@btn-border-radius-small:        @border-radius-small;\n\n\n//== Forms\n//\n//##\n\n//** `<input>` background color\n@input-bg:                       #fff;\n//** `<input disabled>` background color\n@input-bg-disabled:              @gray-lighter;\n\n//** Text color for `<input>`s\n@input-color:                    @gray;\n//** `<input>` border color\n@input-border:                   #ccc;\n\n// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4\n//** Default `.form-control` border radius\n// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.\n@input-border-radius:            @border-radius-base;\n//** Large `.form-control` border radius\n@input-border-radius-large:      @border-radius-large;\n//** Small `.form-control` border radius\n@input-border-radius-small:      @border-radius-small;\n\n//** Border color for inputs on focus\n@input-border-focus:             #66afe9;\n\n//** Placeholder text color\n@input-color-placeholder:        #999;\n\n//** Default `.form-control` height\n@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);\n//** Large `.form-control` height\n@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);\n//** Small `.form-control` height\n@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);\n\n//** `.form-group` margin\n@form-group-margin-bottom:       15px;\n\n@legend-color:                   @gray-dark;\n@legend-border-color:            #e5e5e5;\n\n//** Background color for textual input addons\n@input-group-addon-bg:           @gray-lighter;\n//** Border color for textual input addons\n@input-group-addon-border-color: @input-border;\n\n//** Disabled cursor for form controls and buttons.\n@cursor-disabled:                not-allowed;\n\n\n//== Dropdowns\n//\n//## Dropdown menu container and contents.\n\n//** Background for the dropdown menu.\n@dropdown-bg:                    #fff;\n//** Dropdown menu `border-color`.\n@dropdown-border:                rgba(0,0,0,.15);\n//** Dropdown menu `border-color` **for IE8**.\n@dropdown-fallback-border:       #ccc;\n//** Divider color for between dropdown items.\n@dropdown-divider-bg:            #e5e5e5;\n\n//** Dropdown link text color.\n@dropdown-link-color:            @gray-dark;\n//** Hover color for dropdown links.\n@dropdown-link-hover-color:      darken(@gray-dark, 5%);\n//** Hover background for dropdown links.\n@dropdown-link-hover-bg:         #f5f5f5;\n\n//** Active dropdown menu item text color.\n@dropdown-link-active-color:     @component-active-color;\n//** Active dropdown menu item background color.\n@dropdown-link-active-bg:        @component-active-bg;\n\n//** Disabled dropdown menu item background color.\n@dropdown-link-disabled-color:   @gray-light;\n\n//** Text color for headers within dropdown menus.\n@dropdown-header-color:          @gray-light;\n\n//** Deprecated `@dropdown-caret-color` as of v3.1.0\n@dropdown-caret-color:           #000;\n\n\n//-- Z-index master list\n//\n// Warning: Avoid customizing these values. They're used for a bird's eye view\n// of components dependent on the z-axis and are designed to all work together.\n//\n// Note: These variables are not generated into the Customizer.\n\n@zindex-navbar:            1000;\n@zindex-dropdown:          1000;\n@zindex-popover:           1060;\n@zindex-tooltip:           1070;\n@zindex-navbar-fixed:      1030;\n@zindex-modal-background:  1040;\n@zindex-modal:             1050;\n\n\n//== Media queries breakpoints\n//\n//## Define the breakpoints at which your layout will change, adapting to different screen sizes.\n\n// Extra small screen / phone\n//** Deprecated `@screen-xs` as of v3.0.1\n@screen-xs:                  480px;\n//** Deprecated `@screen-xs-min` as of v3.2.0\n@screen-xs-min:              @screen-xs;\n//** Deprecated `@screen-phone` as of v3.0.1\n@screen-phone:               @screen-xs-min;\n\n// Small screen / tablet\n//** Deprecated `@screen-sm` as of v3.0.1\n@screen-sm:                  768px;\n@screen-sm-min:              @screen-sm;\n//** Deprecated `@screen-tablet` as of v3.0.1\n@screen-tablet:              @screen-sm-min;\n\n// Medium screen / desktop\n//** Deprecated `@screen-md` as of v3.0.1\n@screen-md:                  992px;\n@screen-md-min:              @screen-md;\n//** Deprecated `@screen-desktop` as of v3.0.1\n@screen-desktop:             @screen-md-min;\n\n// Large screen / wide desktop\n//** Deprecated `@screen-lg` as of v3.0.1\n@screen-lg:                  1200px;\n@screen-lg-min:              @screen-lg;\n//** Deprecated `@screen-lg-desktop` as of v3.0.1\n@screen-lg-desktop:          @screen-lg-min;\n\n// So media queries don't overlap when required, provide a maximum\n@screen-xs-max:              (@screen-sm-min - 1);\n@screen-sm-max:              (@screen-md-min - 1);\n@screen-md-max:              (@screen-lg-min - 1);\n\n\n//== Grid system\n//\n//## Define your custom responsive grid.\n\n//** Number of columns in the grid.\n@grid-columns:              12;\n//** Padding between columns. Gets divided in half for the left and right.\n@grid-gutter-width:         30px;\n// Navbar collapse\n//** Point at which the navbar becomes uncollapsed.\n@grid-float-breakpoint:     @screen-sm-min;\n//** Point at which the navbar begins collapsing.\n@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);\n\n\n//== Container sizes\n//\n//## Define the maximum width of `.container` for different screen sizes.\n\n// Small screen / tablet\n@container-tablet:             (720px + @grid-gutter-width);\n//** For `@screen-sm-min` and up.\n@container-sm:                 @container-tablet;\n\n// Medium screen / desktop\n@container-desktop:            (940px + @grid-gutter-width);\n//** For `@screen-md-min` and up.\n@container-md:                 @container-desktop;\n\n// Large screen / wide desktop\n@container-large-desktop:      (1140px + @grid-gutter-width);\n//** For `@screen-lg-min` and up.\n@container-lg:                 @container-large-desktop;\n\n\n//== Navbar\n//\n//##\n\n// Basics of a navbar\n@navbar-height:                    50px;\n@navbar-margin-bottom:             @line-height-computed;\n@navbar-border-radius:             @border-radius-base;\n@navbar-padding-horizontal:        floor((@grid-gutter-width / 2));\n@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);\n@navbar-collapse-max-height:       340px;\n\n@navbar-default-color:             #777;\n@navbar-default-bg:                #f8f8f8;\n@navbar-default-border:            darken(@navbar-default-bg, 6.5%);\n\n// Navbar links\n@navbar-default-link-color:                #777;\n@navbar-default-link-hover-color:          #333;\n@navbar-default-link-hover-bg:             transparent;\n@navbar-default-link-active-color:         #555;\n@navbar-default-link-active-bg:            darken(@navbar-default-bg, 6.5%);\n@navbar-default-link-disabled-color:       #ccc;\n@navbar-default-link-disabled-bg:          transparent;\n\n// Navbar brand label\n@navbar-default-brand-color:               @navbar-default-link-color;\n@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);\n@navbar-default-brand-hover-bg:            transparent;\n\n// Navbar toggle\n@navbar-default-toggle-hover-bg:           #ddd;\n@navbar-default-toggle-icon-bar-bg:        #888;\n@navbar-default-toggle-border-color:       #ddd;\n\n\n//=== Inverted navbar\n// Reset inverted navbar basics\n@navbar-inverse-color:                      lighten(@gray-light, 15%);\n@navbar-inverse-bg:                         #222;\n@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);\n\n// Inverted navbar links\n@navbar-inverse-link-color:                 lighten(@gray-light, 15%);\n@navbar-inverse-link-hover-color:           #fff;\n@navbar-inverse-link-hover-bg:              transparent;\n@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;\n@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);\n@navbar-inverse-link-disabled-color:        #444;\n@navbar-inverse-link-disabled-bg:           transparent;\n\n// Inverted navbar brand label\n@navbar-inverse-brand-color:                @navbar-inverse-link-color;\n@navbar-inverse-brand-hover-color:          #fff;\n@navbar-inverse-brand-hover-bg:             transparent;\n\n// Inverted navbar toggle\n@navbar-inverse-toggle-hover-bg:            #333;\n@navbar-inverse-toggle-icon-bar-bg:         #fff;\n@navbar-inverse-toggle-border-color:        #333;\n\n\n//== Navs\n//\n//##\n\n//=== Shared nav styles\n@nav-link-padding:                          10px 15px;\n@nav-link-hover-bg:                         @gray-lighter;\n\n@nav-disabled-link-color:                   @gray-light;\n@nav-disabled-link-hover-color:             @gray-light;\n\n//== Tabs\n@nav-tabs-border-color:                     #ddd;\n\n@nav-tabs-link-hover-border-color:          @gray-lighter;\n\n@nav-tabs-active-link-hover-bg:             @body-bg;\n@nav-tabs-active-link-hover-color:          @gray;\n@nav-tabs-active-link-hover-border-color:   #ddd;\n\n@nav-tabs-justified-link-border-color:            #ddd;\n@nav-tabs-justified-active-link-border-color:     @body-bg;\n\n//== Pills\n@nav-pills-border-radius:                   @border-radius-base;\n@nav-pills-active-link-hover-bg:            @component-active-bg;\n@nav-pills-active-link-hover-color:         @component-active-color;\n\n\n//== Pagination\n//\n//##\n\n@pagination-color:                     @link-color;\n@pagination-bg:                        #fff;\n@pagination-border:                    #ddd;\n\n@pagination-hover-color:               @link-hover-color;\n@pagination-hover-bg:                  @gray-lighter;\n@pagination-hover-border:              #ddd;\n\n@pagination-active-color:              #fff;\n@pagination-active-bg:                 @brand-primary;\n@pagination-active-border:             @brand-primary;\n\n@pagination-disabled-color:            @gray-light;\n@pagination-disabled-bg:               #fff;\n@pagination-disabled-border:           #ddd;\n\n\n//== Pager\n//\n//##\n\n@pager-bg:                             @pagination-bg;\n@pager-border:                         @pagination-border;\n@pager-border-radius:                  15px;\n\n@pager-hover-bg:                       @pagination-hover-bg;\n\n@pager-active-bg:                      @pagination-active-bg;\n@pager-active-color:                   @pagination-active-color;\n\n@pager-disabled-color:                 @pagination-disabled-color;\n\n\n//== Jumbotron\n//\n//##\n\n@jumbotron-padding:              30px;\n@jumbotron-color:                inherit;\n@jumbotron-bg:                   @gray-lighter;\n@jumbotron-heading-color:        inherit;\n@jumbotron-font-size:            ceil((@font-size-base * 1.5));\n@jumbotron-heading-font-size:    ceil((@font-size-base * 4.5));\n\n\n//== Form states and alerts\n//\n//## Define colors for form feedback states and, by default, alerts.\n\n@state-success-text:             #3c763d;\n@state-success-bg:               #dff0d8;\n@state-success-border:           darken(spin(@state-success-bg, -10), 5%);\n\n@state-info-text:                #31708f;\n@state-info-bg:                  #d9edf7;\n@state-info-border:              darken(spin(@state-info-bg, -10), 7%);\n\n@state-warning-text:             #8a6d3b;\n@state-warning-bg:               #fcf8e3;\n@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);\n\n@state-danger-text:              #a94442;\n@state-danger-bg:                #f2dede;\n@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);\n\n\n//== Tooltips\n//\n//##\n\n//** Tooltip max width\n@tooltip-max-width:           200px;\n//** Tooltip text color\n@tooltip-color:               #fff;\n//** Tooltip background color\n@tooltip-bg:                  #000;\n@tooltip-opacity:             .9;\n\n//** Tooltip arrow width\n@tooltip-arrow-width:         5px;\n//** Tooltip arrow color\n@tooltip-arrow-color:         @tooltip-bg;\n\n\n//== Popovers\n//\n//##\n\n//** Popover body background color\n@popover-bg:                          #fff;\n//** Popover maximum width\n@popover-max-width:                   276px;\n//** Popover border color\n@popover-border-color:                rgba(0,0,0,.2);\n//** Popover fallback border color\n@popover-fallback-border-color:       #ccc;\n\n//** Popover title background color\n@popover-title-bg:                    darken(@popover-bg, 3%);\n\n//** Popover arrow width\n@popover-arrow-width:                 10px;\n//** Popover arrow color\n@popover-arrow-color:                 @popover-bg;\n\n//** Popover outer arrow width\n@popover-arrow-outer-width:           (@popover-arrow-width + 1);\n//** Popover outer arrow color\n@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);\n//** Popover outer arrow fallback color\n@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);\n\n\n//== Labels\n//\n//##\n\n//** Default label background color\n@label-default-bg:            @gray-light;\n//** Primary label background color\n@label-primary-bg:            @brand-primary;\n//** Success label background color\n@label-success-bg:            @brand-success;\n//** Info label background color\n@label-info-bg:               @brand-info;\n//** Warning label background color\n@label-warning-bg:            @brand-warning;\n//** Danger label background color\n@label-danger-bg:             @brand-danger;\n\n//** Default label text color\n@label-color:                 #fff;\n//** Default text color of a linked label\n@label-link-hover-color:      #fff;\n\n\n//== Modals\n//\n//##\n\n//** Padding applied to the modal body\n@modal-inner-padding:         15px;\n\n//** Padding applied to the modal title\n@modal-title-padding:         15px;\n//** Modal title line-height\n@modal-title-line-height:     @line-height-base;\n\n//** Background color of modal content area\n@modal-content-bg:                             #fff;\n//** Modal content border color\n@modal-content-border-color:                   rgba(0,0,0,.2);\n//** Modal content border color **for IE8**\n@modal-content-fallback-border-color:          #999;\n\n//** Modal backdrop background color\n@modal-backdrop-bg:           #000;\n//** Modal backdrop opacity\n@modal-backdrop-opacity:      .5;\n//** Modal header border color\n@modal-header-border-color:   #e5e5e5;\n//** Modal footer border color\n@modal-footer-border-color:   @modal-header-border-color;\n\n@modal-lg:                    900px;\n@modal-md:                    600px;\n@modal-sm:                    300px;\n\n\n//== Alerts\n//\n//## Define alert colors, border radius, and padding.\n\n@alert-padding:               15px;\n@alert-border-radius:         @border-radius-base;\n@alert-link-font-weight:      bold;\n\n@alert-success-bg:            @state-success-bg;\n@alert-success-text:          @state-success-text;\n@alert-success-border:        @state-success-border;\n\n@alert-info-bg:               @state-info-bg;\n@alert-info-text:             @state-info-text;\n@alert-info-border:           @state-info-border;\n\n@alert-warning-bg:            @state-warning-bg;\n@alert-warning-text:          @state-warning-text;\n@alert-warning-border:        @state-warning-border;\n\n@alert-danger-bg:             @state-danger-bg;\n@alert-danger-text:           @state-danger-text;\n@alert-danger-border:         @state-danger-border;\n\n\n//== Progress bars\n//\n//##\n\n//** Background color of the whole progress component\n@progress-bg:                 #f5f5f5;\n//** Progress bar text color\n@progress-bar-color:          #fff;\n//** Variable for setting rounded corners on progress bar.\n@progress-border-radius:      @border-radius-base;\n\n//** Default progress bar color\n@progress-bar-bg:             @brand-primary;\n//** Success progress bar color\n@progress-bar-success-bg:     @brand-success;\n//** Warning progress bar color\n@progress-bar-warning-bg:     @brand-warning;\n//** Danger progress bar color\n@progress-bar-danger-bg:      @brand-danger;\n//** Info progress bar color\n@progress-bar-info-bg:        @brand-info;\n\n\n//== List group\n//\n//##\n\n//** Background color on `.list-group-item`\n@list-group-bg:                 #fff;\n//** `.list-group-item` border color\n@list-group-border:             #ddd;\n//** List group border radius\n@list-group-border-radius:      @border-radius-base;\n\n//** Background color of single list items on hover\n@list-group-hover-bg:           #f5f5f5;\n//** Text color of active list items\n@list-group-active-color:       @component-active-color;\n//** Background color of active list items\n@list-group-active-bg:          @component-active-bg;\n//** Border color of active list elements\n@list-group-active-border:      @list-group-active-bg;\n//** Text color for content within active list items\n@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);\n\n//** Text color of disabled list items\n@list-group-disabled-color:      @gray-light;\n//** Background color of disabled list items\n@list-group-disabled-bg:         @gray-lighter;\n//** Text color for content within disabled list items\n@list-group-disabled-text-color: @list-group-disabled-color;\n\n@list-group-link-color:         #555;\n@list-group-link-hover-color:   @list-group-link-color;\n@list-group-link-heading-color: #333;\n\n\n//== Panels\n//\n//##\n\n@panel-bg:                    #fff;\n@panel-body-padding:          15px;\n@panel-heading-padding:       10px 15px;\n@panel-footer-padding:        @panel-heading-padding;\n@panel-border-radius:         @border-radius-base;\n\n//** Border color for elements within panels\n@panel-inner-border:          #ddd;\n@panel-footer-bg:             #f5f5f5;\n\n@panel-default-text:          @gray-dark;\n@panel-default-border:        #ddd;\n@panel-default-heading-bg:    #f5f5f5;\n\n@panel-primary-text:          #fff;\n@panel-primary-border:        @brand-primary;\n@panel-primary-heading-bg:    @brand-primary;\n\n@panel-success-text:          @state-success-text;\n@panel-success-border:        @state-success-border;\n@panel-success-heading-bg:    @state-success-bg;\n\n@panel-info-text:             @state-info-text;\n@panel-info-border:           @state-info-border;\n@panel-info-heading-bg:       @state-info-bg;\n\n@panel-warning-text:          @state-warning-text;\n@panel-warning-border:        @state-warning-border;\n@panel-warning-heading-bg:    @state-warning-bg;\n\n@panel-danger-text:           @state-danger-text;\n@panel-danger-border:         @state-danger-border;\n@panel-danger-heading-bg:     @state-danger-bg;\n\n\n//== Thumbnails\n//\n//##\n\n//** Padding around the thumbnail image\n@thumbnail-padding:           4px;\n//** Thumbnail background color\n@thumbnail-bg:                @body-bg;\n//** Thumbnail border color\n@thumbnail-border:            #ddd;\n//** Thumbnail border radius\n@thumbnail-border-radius:     @border-radius-base;\n\n//** Custom text color for thumbnail captions\n@thumbnail-caption-color:     @text-color;\n//** Padding around the thumbnail caption\n@thumbnail-caption-padding:   9px;\n\n\n//== Wells\n//\n//##\n\n@well-bg:                     #f5f5f5;\n@well-border:                 darken(@well-bg, 7%);\n\n\n//== Badges\n//\n//##\n\n@badge-color:                 #fff;\n//** Linked badge text color on hover\n@badge-link-hover-color:      #fff;\n@badge-bg:                    @gray-light;\n\n//** Badge text color in active nav link\n@badge-active-color:          @link-color;\n//** Badge background color in active nav link\n@badge-active-bg:             #fff;\n\n@badge-font-weight:           bold;\n@badge-line-height:           1;\n@badge-border-radius:         10px;\n\n\n//== Breadcrumbs\n//\n//##\n\n@breadcrumb-padding-vertical:   8px;\n@breadcrumb-padding-horizontal: 15px;\n//** Breadcrumb background color\n@breadcrumb-bg:                 #f5f5f5;\n//** Breadcrumb text color\n@breadcrumb-color:              #ccc;\n//** Text color of current page in the breadcrumb\n@breadcrumb-active-color:       @gray-light;\n//** Textual separator for between breadcrumb elements\n@breadcrumb-separator:          \"/\";\n\n\n//== Carousel\n//\n//##\n\n@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);\n\n@carousel-control-color:                      #fff;\n@carousel-control-width:                      15%;\n@carousel-control-opacity:                    .5;\n@carousel-control-font-size:                  20px;\n\n@carousel-indicator-active-bg:                #fff;\n@carousel-indicator-border-color:             #fff;\n\n@carousel-caption-color:                      #fff;\n\n\n//== Close\n//\n//##\n\n@close-font-weight:           bold;\n@close-color:                 #000;\n@close-text-shadow:           0 1px 0 #fff;\n\n\n//== Code\n//\n//##\n\n@code-color:                  #c7254e;\n@code-bg:                     #f9f2f4;\n\n@kbd-color:                   #fff;\n@kbd-bg:                      #333;\n\n@pre-bg:                      #f5f5f5;\n@pre-color:                   @gray-dark;\n@pre-border-color:            #ccc;\n@pre-scrollable-max-height:   340px;\n\n\n//== Type\n//\n//##\n\n//** Horizontal offset for forms and lists.\n@component-offset-horizontal: 180px;\n//** Text muted color\n@text-muted:                  @gray-light;\n//** Abbreviations and acronyms border color\n@abbr-border-color:           @gray-light;\n//** Headings small color\n@headings-small-color:        @gray-light;\n//** Blockquote small color\n@blockquote-small-color:      @gray-light;\n//** Blockquote font size\n@blockquote-font-size:        (@font-size-base * 1.25);\n//** Blockquote border color\n@blockquote-border-color:     @gray-lighter;\n//** Page header border color\n@page-header-border-color:    @gray-lighter;\n//** Width of horizontal description list titles\n@dl-horizontal-offset:        @component-offset-horizontal;\n//** Point at which .dl-horizontal becomes horizontal\n@dl-horizontal-breakpoint:    @grid-float-breakpoint;\n//** Horizontal line color.\n@hr-border:                   @gray-lighter;\n"
  },
  {
    "path": "website/lib/bootstrap/bootstrap/wells.less",
    "content": "//\n// Wells\n// --------------------------------------------------\n\n\n// Base class\n.well {\n  min-height: 20px;\n  padding: 19px;\n  margin-bottom: 20px;\n  background-color: @well-bg;\n  border: 1px solid @well-border;\n  border-radius: @border-radius-base;\n  .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));\n  blockquote {\n    border-color: #ddd;\n    border-color: rgba(0,0,0,.15);\n  }\n}\n\n// Sizes\n.well-lg {\n  padding: 24px;\n  border-radius: @border-radius-large;\n}\n.well-sm {\n  padding: 9px;\n  border-radius: @border-radius-small;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/bootswatch.less",
    "content": "// Flatly 3.3.7\n// Bootswatch\n// -----------------------------------------------------\n\n@web-font-path: \"https://fonts.googleapis.com/css?family=Lato:400,700,400,light,italic\";\n\n.web-font(@path) {\n  @import url(\"@{path}\");\n}\n.web-font(@web-font-path);\n\n// Navbar =====================================================================\n\n.navbar {\n  border-width: 0;\n\n  &-default {\n\n    .badge {\n      background-color: #fff;\n      color: @navbar-default-bg;\n    }\n  }\n\n  &-inverse {\n\n    .badge {\n      background-color: #fff;\n      color: @navbar-inverse-bg;\n    }\n  }\n\n  &-brand {\n    line-height: 1;\n  }\n}\n\n// Buttons ====================================================================\n\n.btn {\n  border-width: 0px;\n}\n\n.btn:active {\n  .box-shadow(none);\n}\n\n.btn-group.open .dropdown-toggle {\n  .box-shadow(none);\n}\n\n// Typography =================================================================\n\n.text-primary,\n.text-primary:hover {\n  color: @brand-primary;\n}\n\n.text-success,\n.text-success:hover {\n  color: @brand-success;\n}\n\n.text-danger,\n.text-danger:hover {\n  color: @brand-danger;\n}\n\n.text-warning,\n.text-warning:hover {\n  color: @brand-warning;\n}\n\n.text-info,\n.text-info:hover {\n  color: @brand-info;\n}\n\n// Tables =====================================================================\n\ntable,\n.table {\n\n  a:not(.btn) {\n    text-decoration: underline;\n  }\n\n  .dropdown-menu a {\n    text-decoration: none;\n  }\n\n  .success,\n  .warning,\n  .danger,\n  .info {\n    color: #fff;\n\n    > th > a,\n    > td > a,\n    > a {\n      color: #fff;\n    }\n  }\n\n  > thead > tr > th,\n  > tbody > tr > th,\n  > tfoot > tr > th,\n  > thead > tr > td,\n  > tbody > tr > td,\n  > tfoot > tr > td {\n    border: none;\n  }\n\n  &-bordered > thead > tr > th,\n  &-bordered > tbody > tr > th,\n  &-bordered > tfoot > tr > th,\n  &-bordered > thead > tr > td,\n  &-bordered > tbody > tr > td,\n  &-bordered > tfoot > tr > td {\n    border: 1px solid @table-border-color;\n  }\n}\n\n// Forms ======================================================================\n\n.form-control,\ninput {\n  border-width: 2px;\n  .box-shadow(none);\n\n  &:focus {\n    .box-shadow(none);\n  }\n}\n\n.has-warning {\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline,\n  &.radio label,\n  &.checkbox label,\n  &.radio-inline label,\n  &.checkbox-inline label,\n  .form-control-feedback {\n    color: @brand-warning;\n  }\n\n  .form-control,\n  .form-control:focus {\n    border: 2px solid @brand-warning;\n  }\n\n  .input-group-addon {\n    border-color: @brand-warning;\n  }\n}\n\n.has-error {\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline,\n  &.radio label,\n  &.checkbox label,\n  &.radio-inline label,\n  &.checkbox-inline label,\n  .form-control-feedback {\n    color: @brand-danger;\n  }\n\n  .form-control,\n  .form-control:focus {\n    border: 2px solid @brand-danger;\n  }\n\n  .input-group-addon {\n    border-color: @brand-danger;\n  }\n}\n\n.has-success {\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline,\n  &.radio label,\n  &.checkbox label,\n  &.radio-inline label,\n  &.checkbox-inline label,\n  .form-control-feedback {\n    color: @brand-success;\n  }\n\n  .form-control,\n  .form-control:focus {\n    border: 2px solid @brand-success;\n  }\n\n  .input-group-addon {\n    border-color: @brand-success;\n  }\n}\n\n// Navs =======================================================================\n\n.nav {\n  .open > a,\n  .open > a:hover,\n  .open > a:focus {\n    border-color: transparent;\n  }\n}\n\n.pager {\n  a,\n  a:hover {\n    color: #fff;\n  }\n\n  .disabled {\n    &>a,\n    &>a:hover,\n    &>a:focus,\n    &>span {\n      background-color: @pagination-disabled-bg;\n    }\n  }\n}\n\n// Indicators =================================================================\n\n.close {\n  color: #fff;\n  text-decoration: none;\n  opacity: 0.4;\n\n  &:hover,\n  &:focus {\n    color: #fff;\n    opacity: 1;\n  }\n}\n\n.alert {\n\n  .alert-link {\n    color: #fff;\n    text-decoration: underline;\n  }\n}\n\n// Progress bars ==============================================================\n\n.progress {\n  height: 10px;\n  .box-shadow(none);\n  .progress-bar {\n    font-size: 10px;\n    line-height: 10px;\n  }\n}\n\n// Containers =================================================================\n\n.well {\n  .box-shadow(none);\n}\n\na.list-group-item {\n\n  &.active,\n  &.active:hover,\n  &.active:focus {\n    border-color: @list-group-border;\n  }\n\n  &-success {\n    &.active {\n      background-color: @state-success-bg;\n    }\n\n    &.active:hover,\n    &.active:focus {\n      background-color: darken(@state-success-bg, 5%);\n    }\n  }\n\n  &-warning {\n    &.active {\n      background-color: @state-warning-bg;\n    }\n    \n    &.active:hover,\n    &.active:focus {\n      background-color: darken(@state-warning-bg, 5%);\n    }\n  }\n\n  &-danger {\n    &.active {\n      background-color: @state-danger-bg;\n    }\n    \n    &.active:hover,\n    &.active:focus {\n      background-color: darken(@state-danger-bg, 5%);\n    }\n  }\n}\n\n.panel {\n  border-width: 0px;\n  &-default {\n    .close {\n      color: @text-color;\n    }\n  }\n}\n\n.modal {\n  .close {\n    color: @text-color;\n  }\n}\n\n.popover {\n  color: @text-color;\n}\n\nbody {\n    margin-bottom: 10px; \n    padding-top: 20px;\n}\n\n.navbar {\n    margin-bottom: 20px;\n}\n\n.jumbotron {\n    padding: 0.9em 0.9em;\n}\n\ncode {\n    font-family: monospace;\n}\n\ntable a:not(.btn), .table a:not(.btn) {\n    text-decoration: none;\n}\n\n.navbar-nav>li>a {\n    font-weight: 500;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/build.less",
    "content": "@import \"bootstrap/bootstrap.less\";\n@import \"variables.less\";\n@import \"bootswatch.less\";\n"
  },
  {
    "path": "website/lib/bootstrap/build.sh",
    "content": "lessc -clean-css build.less > ../bootstrap.min.css\n"
  },
  {
    "path": "website/lib/bootstrap/output.css",
    "content": "/*!\n * Bootstrap v3.3.7 (http://getbootstrap.com)\n * Copyright 2011-2016 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\n@import url(\"https://fonts.googleapis.com/css?family=Lato:400,700,400italic\");\nhtml {\n  font-family: sans-serif;\n  -ms-text-size-adjust: 100%;\n  -webkit-text-size-adjust: 100%;\n}\nbody {\n  margin: 0;\n}\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n  display: block;\n}\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block;\n  vertical-align: baseline;\n}\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n[hidden],\ntemplate {\n  display: none;\n}\na {\n  background-color: transparent;\n}\na:active,\na:hover {\n  outline: 0;\n}\nabbr[title] {\n  border-bottom: 1px dotted;\n}\nb,\nstrong {\n  font-weight: bold;\n}\ndfn {\n  font-style: italic;\n}\nh1 {\n  font-size: 2em;\n  margin: 0.67em 0;\n}\nmark {\n  background: #ff0;\n  color: #000;\n}\nsmall {\n  font-size: 80%;\n}\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\nsup {\n  top: -0.5em;\n}\nsub {\n  bottom: -0.25em;\n}\nimg {\n  border: 0;\n}\nsvg:not(:root) {\n  overflow: hidden;\n}\nfigure {\n  margin: 1em 40px;\n}\nhr {\n  box-sizing: content-box;\n  height: 0;\n}\npre {\n  overflow: auto;\n}\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  color: inherit;\n  font: inherit;\n  margin: 0;\n}\nbutton {\n  overflow: visible;\n}\nbutton,\nselect {\n  text-transform: none;\n}\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  -webkit-appearance: button;\n  cursor: pointer;\n}\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\ninput {\n  line-height: normal;\n}\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  box-sizing: border-box;\n  padding: 0;\n}\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n  height: auto;\n}\ninput[type=\"search\"] {\n  -webkit-appearance: textfield;\n  box-sizing: content-box;\n}\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\nfieldset {\n  border: 1px solid #c0c0c0;\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n}\nlegend {\n  border: 0;\n  padding: 0;\n}\ntextarea {\n  overflow: auto;\n}\noptgroup {\n  font-weight: bold;\n}\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\ntd,\nth {\n  padding: 0;\n}\n/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */\n@media print {\n  *,\n  *:before,\n  *:after {\n    background: transparent !important;\n    color: #000 !important;\n    box-shadow: none !important;\n    text-shadow: none !important;\n  }\n  a,\n  a:visited {\n    text-decoration: underline;\n  }\n  a[href]:after {\n    content: \" (\" attr(href) \")\";\n  }\n  abbr[title]:after {\n    content: \" (\" attr(title) \")\";\n  }\n  a[href^=\"#\"]:after,\n  a[href^=\"javascript:\"]:after {\n    content: \"\";\n  }\n  pre,\n  blockquote {\n    border: 1px solid #999;\n    page-break-inside: avoid;\n  }\n  thead {\n    display: table-header-group;\n  }\n  tr,\n  img {\n    page-break-inside: avoid;\n  }\n  img {\n    max-width: 100% !important;\n  }\n  p,\n  h2,\n  h3 {\n    orphans: 3;\n    widows: 3;\n  }\n  h2,\n  h3 {\n    page-break-after: avoid;\n  }\n  .navbar {\n    display: none;\n  }\n  .btn > .caret,\n  .dropup > .btn > .caret {\n    border-top-color: #000 !important;\n  }\n  .label {\n    border: 1px solid #000;\n  }\n  .table {\n    border-collapse: collapse !important;\n  }\n  .table td,\n  .table th {\n    background-color: #fff !important;\n  }\n  .table-bordered th,\n  .table-bordered td {\n    border: 1px solid #ddd !important;\n  }\n}\n@font-face {\n  font-family: 'Glyphicons Halflings';\n  src: url('../fonts/glyphicons-halflings-regular.eot');\n  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');\n}\n.glyphicon {\n  position: relative;\n  top: 1px;\n  display: inline-block;\n  font-family: 'Glyphicons Halflings';\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n.glyphicon-asterisk:before {\n  content: \"\\002a\";\n}\n.glyphicon-plus:before {\n  content: \"\\002b\";\n}\n.glyphicon-euro:before,\n.glyphicon-eur:before {\n  content: \"\\20ac\";\n}\n.glyphicon-minus:before {\n  content: \"\\2212\";\n}\n.glyphicon-cloud:before {\n  content: \"\\2601\";\n}\n.glyphicon-envelope:before {\n  content: \"\\2709\";\n}\n.glyphicon-pencil:before {\n  content: \"\\270f\";\n}\n.glyphicon-glass:before {\n  content: \"\\e001\";\n}\n.glyphicon-music:before {\n  content: \"\\e002\";\n}\n.glyphicon-search:before {\n  content: \"\\e003\";\n}\n.glyphicon-heart:before {\n  content: \"\\e005\";\n}\n.glyphicon-star:before {\n  content: \"\\e006\";\n}\n.glyphicon-star-empty:before {\n  content: \"\\e007\";\n}\n.glyphicon-user:before {\n  content: \"\\e008\";\n}\n.glyphicon-film:before {\n  content: \"\\e009\";\n}\n.glyphicon-th-large:before {\n  content: \"\\e010\";\n}\n.glyphicon-th:before {\n  content: \"\\e011\";\n}\n.glyphicon-th-list:before {\n  content: \"\\e012\";\n}\n.glyphicon-ok:before {\n  content: \"\\e013\";\n}\n.glyphicon-remove:before {\n  content: \"\\e014\";\n}\n.glyphicon-zoom-in:before {\n  content: \"\\e015\";\n}\n.glyphicon-zoom-out:before {\n  content: \"\\e016\";\n}\n.glyphicon-off:before {\n  content: \"\\e017\";\n}\n.glyphicon-signal:before {\n  content: \"\\e018\";\n}\n.glyphicon-cog:before {\n  content: \"\\e019\";\n}\n.glyphicon-trash:before {\n  content: \"\\e020\";\n}\n.glyphicon-home:before {\n  content: \"\\e021\";\n}\n.glyphicon-file:before {\n  content: \"\\e022\";\n}\n.glyphicon-time:before {\n  content: \"\\e023\";\n}\n.glyphicon-road:before {\n  content: \"\\e024\";\n}\n.glyphicon-download-alt:before {\n  content: \"\\e025\";\n}\n.glyphicon-download:before {\n  content: \"\\e026\";\n}\n.glyphicon-upload:before {\n  content: \"\\e027\";\n}\n.glyphicon-inbox:before {\n  content: \"\\e028\";\n}\n.glyphicon-play-circle:before {\n  content: \"\\e029\";\n}\n.glyphicon-repeat:before {\n  content: \"\\e030\";\n}\n.glyphicon-refresh:before {\n  content: \"\\e031\";\n}\n.glyphicon-list-alt:before {\n  content: \"\\e032\";\n}\n.glyphicon-lock:before {\n  content: \"\\e033\";\n}\n.glyphicon-flag:before {\n  content: \"\\e034\";\n}\n.glyphicon-headphones:before {\n  content: \"\\e035\";\n}\n.glyphicon-volume-off:before {\n  content: \"\\e036\";\n}\n.glyphicon-volume-down:before {\n  content: \"\\e037\";\n}\n.glyphicon-volume-up:before {\n  content: \"\\e038\";\n}\n.glyphicon-qrcode:before {\n  content: \"\\e039\";\n}\n.glyphicon-barcode:before {\n  content: \"\\e040\";\n}\n.glyphicon-tag:before {\n  content: \"\\e041\";\n}\n.glyphicon-tags:before {\n  content: \"\\e042\";\n}\n.glyphicon-book:before {\n  content: \"\\e043\";\n}\n.glyphicon-bookmark:before {\n  content: \"\\e044\";\n}\n.glyphicon-print:before {\n  content: \"\\e045\";\n}\n.glyphicon-camera:before {\n  content: \"\\e046\";\n}\n.glyphicon-font:before {\n  content: \"\\e047\";\n}\n.glyphicon-bold:before {\n  content: \"\\e048\";\n}\n.glyphicon-italic:before {\n  content: \"\\e049\";\n}\n.glyphicon-text-height:before {\n  content: \"\\e050\";\n}\n.glyphicon-text-width:before {\n  content: \"\\e051\";\n}\n.glyphicon-align-left:before {\n  content: \"\\e052\";\n}\n.glyphicon-align-center:before {\n  content: \"\\e053\";\n}\n.glyphicon-align-right:before {\n  content: \"\\e054\";\n}\n.glyphicon-align-justify:before {\n  content: \"\\e055\";\n}\n.glyphicon-list:before {\n  content: \"\\e056\";\n}\n.glyphicon-indent-left:before {\n  content: \"\\e057\";\n}\n.glyphicon-indent-right:before {\n  content: \"\\e058\";\n}\n.glyphicon-facetime-video:before {\n  content: \"\\e059\";\n}\n.glyphicon-picture:before {\n  content: \"\\e060\";\n}\n.glyphicon-map-marker:before {\n  content: \"\\e062\";\n}\n.glyphicon-adjust:before {\n  content: \"\\e063\";\n}\n.glyphicon-tint:before {\n  content: \"\\e064\";\n}\n.glyphicon-edit:before {\n  content: \"\\e065\";\n}\n.glyphicon-share:before {\n  content: \"\\e066\";\n}\n.glyphicon-check:before {\n  content: \"\\e067\";\n}\n.glyphicon-move:before {\n  content: \"\\e068\";\n}\n.glyphicon-step-backward:before {\n  content: \"\\e069\";\n}\n.glyphicon-fast-backward:before {\n  content: \"\\e070\";\n}\n.glyphicon-backward:before {\n  content: \"\\e071\";\n}\n.glyphicon-play:before {\n  content: \"\\e072\";\n}\n.glyphicon-pause:before {\n  content: \"\\e073\";\n}\n.glyphicon-stop:before {\n  content: \"\\e074\";\n}\n.glyphicon-forward:before {\n  content: \"\\e075\";\n}\n.glyphicon-fast-forward:before {\n  content: \"\\e076\";\n}\n.glyphicon-step-forward:before {\n  content: \"\\e077\";\n}\n.glyphicon-eject:before {\n  content: \"\\e078\";\n}\n.glyphicon-chevron-left:before {\n  content: \"\\e079\";\n}\n.glyphicon-chevron-right:before {\n  content: \"\\e080\";\n}\n.glyphicon-plus-sign:before {\n  content: \"\\e081\";\n}\n.glyphicon-minus-sign:before {\n  content: \"\\e082\";\n}\n.glyphicon-remove-sign:before {\n  content: \"\\e083\";\n}\n.glyphicon-ok-sign:before {\n  content: \"\\e084\";\n}\n.glyphicon-question-sign:before {\n  content: \"\\e085\";\n}\n.glyphicon-info-sign:before {\n  content: \"\\e086\";\n}\n.glyphicon-screenshot:before {\n  content: \"\\e087\";\n}\n.glyphicon-remove-circle:before {\n  content: \"\\e088\";\n}\n.glyphicon-ok-circle:before {\n  content: \"\\e089\";\n}\n.glyphicon-ban-circle:before {\n  content: \"\\e090\";\n}\n.glyphicon-arrow-left:before {\n  content: \"\\e091\";\n}\n.glyphicon-arrow-right:before {\n  content: \"\\e092\";\n}\n.glyphicon-arrow-up:before {\n  content: \"\\e093\";\n}\n.glyphicon-arrow-down:before {\n  content: \"\\e094\";\n}\n.glyphicon-share-alt:before {\n  content: \"\\e095\";\n}\n.glyphicon-resize-full:before {\n  content: \"\\e096\";\n}\n.glyphicon-resize-small:before {\n  content: \"\\e097\";\n}\n.glyphicon-exclamation-sign:before {\n  content: \"\\e101\";\n}\n.glyphicon-gift:before {\n  content: \"\\e102\";\n}\n.glyphicon-leaf:before {\n  content: \"\\e103\";\n}\n.glyphicon-fire:before {\n  content: \"\\e104\";\n}\n.glyphicon-eye-open:before {\n  content: \"\\e105\";\n}\n.glyphicon-eye-close:before {\n  content: \"\\e106\";\n}\n.glyphicon-warning-sign:before {\n  content: \"\\e107\";\n}\n.glyphicon-plane:before {\n  content: \"\\e108\";\n}\n.glyphicon-calendar:before {\n  content: \"\\e109\";\n}\n.glyphicon-random:before {\n  content: \"\\e110\";\n}\n.glyphicon-comment:before {\n  content: \"\\e111\";\n}\n.glyphicon-magnet:before {\n  content: \"\\e112\";\n}\n.glyphicon-chevron-up:before {\n  content: \"\\e113\";\n}\n.glyphicon-chevron-down:before {\n  content: \"\\e114\";\n}\n.glyphicon-retweet:before {\n  content: \"\\e115\";\n}\n.glyphicon-shopping-cart:before {\n  content: \"\\e116\";\n}\n.glyphicon-folder-close:before {\n  content: \"\\e117\";\n}\n.glyphicon-folder-open:before {\n  content: \"\\e118\";\n}\n.glyphicon-resize-vertical:before {\n  content: \"\\e119\";\n}\n.glyphicon-resize-horizontal:before {\n  content: \"\\e120\";\n}\n.glyphicon-hdd:before {\n  content: \"\\e121\";\n}\n.glyphicon-bullhorn:before {\n  content: \"\\e122\";\n}\n.glyphicon-bell:before {\n  content: \"\\e123\";\n}\n.glyphicon-certificate:before {\n  content: \"\\e124\";\n}\n.glyphicon-thumbs-up:before {\n  content: \"\\e125\";\n}\n.glyphicon-thumbs-down:before {\n  content: \"\\e126\";\n}\n.glyphicon-hand-right:before {\n  content: \"\\e127\";\n}\n.glyphicon-hand-left:before {\n  content: \"\\e128\";\n}\n.glyphicon-hand-up:before {\n  content: \"\\e129\";\n}\n.glyphicon-hand-down:before {\n  content: \"\\e130\";\n}\n.glyphicon-circle-arrow-right:before {\n  content: \"\\e131\";\n}\n.glyphicon-circle-arrow-left:before {\n  content: \"\\e132\";\n}\n.glyphicon-circle-arrow-up:before {\n  content: \"\\e133\";\n}\n.glyphicon-circle-arrow-down:before {\n  content: \"\\e134\";\n}\n.glyphicon-globe:before {\n  content: \"\\e135\";\n}\n.glyphicon-wrench:before {\n  content: \"\\e136\";\n}\n.glyphicon-tasks:before {\n  content: \"\\e137\";\n}\n.glyphicon-filter:before {\n  content: \"\\e138\";\n}\n.glyphicon-briefcase:before {\n  content: \"\\e139\";\n}\n.glyphicon-fullscreen:before {\n  content: \"\\e140\";\n}\n.glyphicon-dashboard:before {\n  content: \"\\e141\";\n}\n.glyphicon-paperclip:before {\n  content: \"\\e142\";\n}\n.glyphicon-heart-empty:before {\n  content: \"\\e143\";\n}\n.glyphicon-link:before {\n  content: \"\\e144\";\n}\n.glyphicon-phone:before {\n  content: \"\\e145\";\n}\n.glyphicon-pushpin:before {\n  content: \"\\e146\";\n}\n.glyphicon-usd:before {\n  content: \"\\e148\";\n}\n.glyphicon-gbp:before {\n  content: \"\\e149\";\n}\n.glyphicon-sort:before {\n  content: \"\\e150\";\n}\n.glyphicon-sort-by-alphabet:before {\n  content: \"\\e151\";\n}\n.glyphicon-sort-by-alphabet-alt:before {\n  content: \"\\e152\";\n}\n.glyphicon-sort-by-order:before {\n  content: \"\\e153\";\n}\n.glyphicon-sort-by-order-alt:before {\n  content: \"\\e154\";\n}\n.glyphicon-sort-by-attributes:before {\n  content: \"\\e155\";\n}\n.glyphicon-sort-by-attributes-alt:before {\n  content: \"\\e156\";\n}\n.glyphicon-unchecked:before {\n  content: \"\\e157\";\n}\n.glyphicon-expand:before {\n  content: \"\\e158\";\n}\n.glyphicon-collapse-down:before {\n  content: \"\\e159\";\n}\n.glyphicon-collapse-up:before {\n  content: \"\\e160\";\n}\n.glyphicon-log-in:before {\n  content: \"\\e161\";\n}\n.glyphicon-flash:before {\n  content: \"\\e162\";\n}\n.glyphicon-log-out:before {\n  content: \"\\e163\";\n}\n.glyphicon-new-window:before {\n  content: \"\\e164\";\n}\n.glyphicon-record:before {\n  content: \"\\e165\";\n}\n.glyphicon-save:before {\n  content: \"\\e166\";\n}\n.glyphicon-open:before {\n  content: \"\\e167\";\n}\n.glyphicon-saved:before {\n  content: \"\\e168\";\n}\n.glyphicon-import:before {\n  content: \"\\e169\";\n}\n.glyphicon-export:before {\n  content: \"\\e170\";\n}\n.glyphicon-send:before {\n  content: \"\\e171\";\n}\n.glyphicon-floppy-disk:before {\n  content: \"\\e172\";\n}\n.glyphicon-floppy-saved:before {\n  content: \"\\e173\";\n}\n.glyphicon-floppy-remove:before {\n  content: \"\\e174\";\n}\n.glyphicon-floppy-save:before {\n  content: \"\\e175\";\n}\n.glyphicon-floppy-open:before {\n  content: \"\\e176\";\n}\n.glyphicon-credit-card:before {\n  content: \"\\e177\";\n}\n.glyphicon-transfer:before {\n  content: \"\\e178\";\n}\n.glyphicon-cutlery:before {\n  content: \"\\e179\";\n}\n.glyphicon-header:before {\n  content: \"\\e180\";\n}\n.glyphicon-compressed:before {\n  content: \"\\e181\";\n}\n.glyphicon-earphone:before {\n  content: \"\\e182\";\n}\n.glyphicon-phone-alt:before {\n  content: \"\\e183\";\n}\n.glyphicon-tower:before {\n  content: \"\\e184\";\n}\n.glyphicon-stats:before {\n  content: \"\\e185\";\n}\n.glyphicon-sd-video:before {\n  content: \"\\e186\";\n}\n.glyphicon-hd-video:before {\n  content: \"\\e187\";\n}\n.glyphicon-subtitles:before {\n  content: \"\\e188\";\n}\n.glyphicon-sound-stereo:before {\n  content: \"\\e189\";\n}\n.glyphicon-sound-dolby:before {\n  content: \"\\e190\";\n}\n.glyphicon-sound-5-1:before {\n  content: \"\\e191\";\n}\n.glyphicon-sound-6-1:before {\n  content: \"\\e192\";\n}\n.glyphicon-sound-7-1:before {\n  content: \"\\e193\";\n}\n.glyphicon-copyright-mark:before {\n  content: \"\\e194\";\n}\n.glyphicon-registration-mark:before {\n  content: \"\\e195\";\n}\n.glyphicon-cloud-download:before {\n  content: \"\\e197\";\n}\n.glyphicon-cloud-upload:before {\n  content: \"\\e198\";\n}\n.glyphicon-tree-conifer:before {\n  content: \"\\e199\";\n}\n.glyphicon-tree-deciduous:before {\n  content: \"\\e200\";\n}\n.glyphicon-cd:before {\n  content: \"\\e201\";\n}\n.glyphicon-save-file:before {\n  content: \"\\e202\";\n}\n.glyphicon-open-file:before {\n  content: \"\\e203\";\n}\n.glyphicon-level-up:before {\n  content: \"\\e204\";\n}\n.glyphicon-copy:before {\n  content: \"\\e205\";\n}\n.glyphicon-paste:before {\n  content: \"\\e206\";\n}\n.glyphicon-alert:before {\n  content: \"\\e209\";\n}\n.glyphicon-equalizer:before {\n  content: \"\\e210\";\n}\n.glyphicon-king:before {\n  content: \"\\e211\";\n}\n.glyphicon-queen:before {\n  content: \"\\e212\";\n}\n.glyphicon-pawn:before {\n  content: \"\\e213\";\n}\n.glyphicon-bishop:before {\n  content: \"\\e214\";\n}\n.glyphicon-knight:before {\n  content: \"\\e215\";\n}\n.glyphicon-baby-formula:before {\n  content: \"\\e216\";\n}\n.glyphicon-tent:before {\n  content: \"\\26fa\";\n}\n.glyphicon-blackboard:before {\n  content: \"\\e218\";\n}\n.glyphicon-bed:before {\n  content: \"\\e219\";\n}\n.glyphicon-apple:before {\n  content: \"\\f8ff\";\n}\n.glyphicon-erase:before {\n  content: \"\\e221\";\n}\n.glyphicon-hourglass:before {\n  content: \"\\231b\";\n}\n.glyphicon-lamp:before {\n  content: \"\\e223\";\n}\n.glyphicon-duplicate:before {\n  content: \"\\e224\";\n}\n.glyphicon-piggy-bank:before {\n  content: \"\\e225\";\n}\n.glyphicon-scissors:before {\n  content: \"\\e226\";\n}\n.glyphicon-bitcoin:before {\n  content: \"\\e227\";\n}\n.glyphicon-btc:before {\n  content: \"\\e227\";\n}\n.glyphicon-xbt:before {\n  content: \"\\e227\";\n}\n.glyphicon-yen:before {\n  content: \"\\00a5\";\n}\n.glyphicon-jpy:before {\n  content: \"\\00a5\";\n}\n.glyphicon-ruble:before {\n  content: \"\\20bd\";\n}\n.glyphicon-rub:before {\n  content: \"\\20bd\";\n}\n.glyphicon-scale:before {\n  content: \"\\e230\";\n}\n.glyphicon-ice-lolly:before {\n  content: \"\\e231\";\n}\n.glyphicon-ice-lolly-tasted:before {\n  content: \"\\e232\";\n}\n.glyphicon-education:before {\n  content: \"\\e233\";\n}\n.glyphicon-option-horizontal:before {\n  content: \"\\e234\";\n}\n.glyphicon-option-vertical:before {\n  content: \"\\e235\";\n}\n.glyphicon-menu-hamburger:before {\n  content: \"\\e236\";\n}\n.glyphicon-modal-window:before {\n  content: \"\\e237\";\n}\n.glyphicon-oil:before {\n  content: \"\\e238\";\n}\n.glyphicon-grain:before {\n  content: \"\\e239\";\n}\n.glyphicon-sunglasses:before {\n  content: \"\\e240\";\n}\n.glyphicon-text-size:before {\n  content: \"\\e241\";\n}\n.glyphicon-text-color:before {\n  content: \"\\e242\";\n}\n.glyphicon-text-background:before {\n  content: \"\\e243\";\n}\n.glyphicon-object-align-top:before {\n  content: \"\\e244\";\n}\n.glyphicon-object-align-bottom:before {\n  content: \"\\e245\";\n}\n.glyphicon-object-align-horizontal:before {\n  content: \"\\e246\";\n}\n.glyphicon-object-align-left:before {\n  content: \"\\e247\";\n}\n.glyphicon-object-align-vertical:before {\n  content: \"\\e248\";\n}\n.glyphicon-object-align-right:before {\n  content: \"\\e249\";\n}\n.glyphicon-triangle-right:before {\n  content: \"\\e250\";\n}\n.glyphicon-triangle-left:before {\n  content: \"\\e251\";\n}\n.glyphicon-triangle-bottom:before {\n  content: \"\\e252\";\n}\n.glyphicon-triangle-top:before {\n  content: \"\\e253\";\n}\n.glyphicon-console:before {\n  content: \"\\e254\";\n}\n.glyphicon-superscript:before {\n  content: \"\\e255\";\n}\n.glyphicon-subscript:before {\n  content: \"\\e256\";\n}\n.glyphicon-menu-left:before {\n  content: \"\\e257\";\n}\n.glyphicon-menu-right:before {\n  content: \"\\e258\";\n}\n.glyphicon-menu-down:before {\n  content: \"\\e259\";\n}\n.glyphicon-menu-up:before {\n  content: \"\\e260\";\n}\n* {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n}\n*:before,\n*:after {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n}\nhtml {\n  font-size: 10px;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\nbody {\n  font-family: \"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-size: 15px;\n  line-height: 1.42857143;\n  color: #FFFFFF;\n  background-color: #002221;\n}\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: inherit;\n  font-size: inherit;\n  line-height: inherit;\n}\na {\n  color: #ffbe00;\n  text-decoration: none;\n}\na:hover,\na:focus {\n  color: #ffbe00;\n  text-decoration: underline;\n}\na:focus {\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\nfigure {\n  margin: 0;\n}\nimg {\n  vertical-align: middle;\n}\n.img-responsive,\n.thumbnail > img,\n.thumbnail a > img,\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n  display: block;\n  max-width: 100%;\n  height: auto;\n}\n.img-rounded {\n  border-radius: 6px;\n}\n.img-thumbnail {\n  padding: 4px;\n  line-height: 1.42857143;\n  background-color: #002221;\n  border: 1px solid #ecf0f1;\n  border-radius: 4px;\n  -webkit-transition: all 0.2s ease-in-out;\n  -o-transition: all 0.2s ease-in-out;\n  transition: all 0.2s ease-in-out;\n  display: inline-block;\n  max-width: 100%;\n  height: auto;\n}\n.img-circle {\n  border-radius: 50%;\n}\nhr {\n  margin-top: 21px;\n  margin-bottom: 21px;\n  border: 0;\n  border-top: 1px solid #ecf0f1;\n}\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  border: 0;\n}\n.sr-only-focusable:active,\n.sr-only-focusable:focus {\n  position: static;\n  width: auto;\n  height: auto;\n  margin: 0;\n  overflow: visible;\n  clip: auto;\n}\n[role=\"button\"] {\n  cursor: pointer;\n}\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n  font-family: \"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-weight: 400;\n  line-height: 1.1;\n  color: inherit;\n}\nh1 small,\nh2 small,\nh3 small,\nh4 small,\nh5 small,\nh6 small,\n.h1 small,\n.h2 small,\n.h3 small,\n.h4 small,\n.h5 small,\n.h6 small,\nh1 .small,\nh2 .small,\nh3 .small,\nh4 .small,\nh5 .small,\nh6 .small,\n.h1 .small,\n.h2 .small,\n.h3 .small,\n.h4 .small,\n.h5 .small,\n.h6 .small {\n  font-weight: normal;\n  line-height: 1;\n  color: #b4bcc2;\n}\nh1,\n.h1,\nh2,\n.h2,\nh3,\n.h3 {\n  margin-top: 21px;\n  margin-bottom: 10.5px;\n}\nh1 small,\n.h1 small,\nh2 small,\n.h2 small,\nh3 small,\n.h3 small,\nh1 .small,\n.h1 .small,\nh2 .small,\n.h2 .small,\nh3 .small,\n.h3 .small {\n  font-size: 65%;\n}\nh4,\n.h4,\nh5,\n.h5,\nh6,\n.h6 {\n  margin-top: 10.5px;\n  margin-bottom: 10.5px;\n}\nh4 small,\n.h4 small,\nh5 small,\n.h5 small,\nh6 small,\n.h6 small,\nh4 .small,\n.h4 .small,\nh5 .small,\n.h5 .small,\nh6 .small,\n.h6 .small {\n  font-size: 75%;\n}\nh1,\n.h1 {\n  font-size: 39px;\n}\nh2,\n.h2 {\n  font-size: 32px;\n}\nh3,\n.h3 {\n  font-size: 26px;\n}\nh4,\n.h4 {\n  font-size: 19px;\n}\nh5,\n.h5 {\n  font-size: 15px;\n}\nh6,\n.h6 {\n  font-size: 13px;\n}\np {\n  margin: 0 0 10.5px;\n}\n.lead {\n  margin-bottom: 21px;\n  font-size: 17px;\n  font-weight: 300;\n  line-height: 1.4;\n}\n@media (min-width: 768px) {\n  .lead {\n    font-size: 22.5px;\n  }\n}\nsmall,\n.small {\n  font-size: 86%;\n}\nmark,\n.mark {\n  background-color: #F39C12;\n  padding: .2em;\n}\n.text-left {\n  text-align: left;\n}\n.text-right {\n  text-align: right;\n}\n.text-center {\n  text-align: center;\n}\n.text-justify {\n  text-align: justify;\n}\n.text-nowrap {\n  white-space: nowrap;\n}\n.text-lowercase {\n  text-transform: lowercase;\n}\n.text-uppercase {\n  text-transform: uppercase;\n}\n.text-capitalize {\n  text-transform: capitalize;\n}\n.text-muted {\n  color: #b4bcc2;\n}\n.text-primary {\n  color: #63ceca;\n}\na.text-primary:hover,\na.text-primary:focus {\n  color: #3dc1bc;\n}\n.text-success {\n  color: #fff;\n}\na.text-success:hover,\na.text-success:focus {\n  color: #e6e6e6;\n}\n.text-info {\n  color: #fff;\n}\na.text-info:hover,\na.text-info:focus {\n  color: #e6e6e6;\n}\n.text-warning {\n  color: #fff;\n}\na.text-warning:hover,\na.text-warning:focus {\n  color: #e6e6e6;\n}\n.text-danger {\n  color: #fff;\n}\na.text-danger:hover,\na.text-danger:focus {\n  color: #e6e6e6;\n}\n.bg-primary {\n  color: #fff;\n  background-color: #63ceca;\n}\na.bg-primary:hover,\na.bg-primary:focus {\n  background-color: #3dc1bc;\n}\n.bg-success {\n  background-color: #ffbe00;\n}\na.bg-success:hover,\na.bg-success:focus {\n  background-color: #cc9800;\n}\n.bg-info {\n  background-color: #3498DB;\n}\na.bg-info:hover,\na.bg-info:focus {\n  background-color: #217dbb;\n}\n.bg-warning {\n  background-color: #F39C12;\n}\na.bg-warning:hover,\na.bg-warning:focus {\n  background-color: #c87f0a;\n}\n.bg-danger {\n  background-color: #E74C3C;\n}\na.bg-danger:hover,\na.bg-danger:focus {\n  background-color: #d62c1a;\n}\n.page-header {\n  padding-bottom: 9.5px;\n  margin: 42px 0 21px;\n  border-bottom: 1px solid transparent;\n}\nul,\nol {\n  margin-top: 0;\n  margin-bottom: 10.5px;\n}\nul ul,\nol ul,\nul ol,\nol ol {\n  margin-bottom: 0;\n}\n.list-unstyled {\n  padding-left: 0;\n  list-style: none;\n}\n.list-inline {\n  padding-left: 0;\n  list-style: none;\n  margin-left: -5px;\n}\n.list-inline > li {\n  display: inline-block;\n  padding-left: 5px;\n  padding-right: 5px;\n}\ndl {\n  margin-top: 0;\n  margin-bottom: 21px;\n}\ndt,\ndd {\n  line-height: 1.42857143;\n}\ndt {\n  font-weight: bold;\n}\ndd {\n  margin-left: 0;\n}\n@media (min-width: 768px) {\n  .dl-horizontal dt {\n    float: left;\n    width: 160px;\n    clear: left;\n    text-align: right;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .dl-horizontal dd {\n    margin-left: 180px;\n  }\n}\nabbr[title],\nabbr[data-original-title] {\n  cursor: help;\n  border-bottom: 1px dotted #b4bcc2;\n}\n.initialism {\n  font-size: 90%;\n  text-transform: uppercase;\n}\nblockquote {\n  padding: 10.5px 21px;\n  margin: 0 0 21px;\n  font-size: 18.75px;\n  border-left: 5px solid #ecf0f1;\n}\nblockquote p:last-child,\nblockquote ul:last-child,\nblockquote ol:last-child {\n  margin-bottom: 0;\n}\nblockquote footer,\nblockquote small,\nblockquote .small {\n  display: block;\n  font-size: 80%;\n  line-height: 1.42857143;\n  color: #b4bcc2;\n}\nblockquote footer:before,\nblockquote small:before,\nblockquote .small:before {\n  content: '\\2014 \\00A0';\n}\n.blockquote-reverse,\nblockquote.pull-right {\n  padding-right: 15px;\n  padding-left: 0;\n  border-right: 5px solid #ecf0f1;\n  border-left: 0;\n  text-align: right;\n}\n.blockquote-reverse footer:before,\nblockquote.pull-right footer:before,\n.blockquote-reverse small:before,\nblockquote.pull-right small:before,\n.blockquote-reverse .small:before,\nblockquote.pull-right .small:before {\n  content: '';\n}\n.blockquote-reverse footer:after,\nblockquote.pull-right footer:after,\n.blockquote-reverse small:after,\nblockquote.pull-right small:after,\n.blockquote-reverse .small:after,\nblockquote.pull-right .small:after {\n  content: '\\00A0 \\2014';\n}\naddress {\n  margin-bottom: 21px;\n  font-style: normal;\n  line-height: 1.42857143;\n}\ncode,\nkbd,\npre,\nsamp {\n  font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\ncode {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: #c7254e;\n  background-color: #f9f2f4;\n  border-radius: 4px;\n}\nkbd {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: #fff;\n  background-color: #333;\n  border-radius: 3px;\n  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);\n}\nkbd kbd {\n  padding: 0;\n  font-size: 100%;\n  font-weight: bold;\n  box-shadow: none;\n}\npre {\n  display: block;\n  padding: 10px;\n  margin: 0 0 10.5px;\n  font-size: 14px;\n  line-height: 1.42857143;\n  word-break: break-all;\n  word-wrap: break-word;\n  color: #7b8a8b;\n  background-color: #ecf0f1;\n  border: 1px solid #ccc;\n  border-radius: 4px;\n}\npre code {\n  padding: 0;\n  font-size: inherit;\n  color: inherit;\n  white-space: pre-wrap;\n  background-color: transparent;\n  border-radius: 0;\n}\n.pre-scrollable {\n  max-height: 340px;\n  overflow-y: scroll;\n}\n.container {\n  margin-right: auto;\n  margin-left: auto;\n  padding-left: 15px;\n  padding-right: 15px;\n}\n@media (min-width: 768px) {\n  .container {\n    width: 750px;\n  }\n}\n@media (min-width: 992px) {\n  .container {\n    width: 970px;\n  }\n}\n@media (min-width: 1200px) {\n  .container {\n    width: 1170px;\n  }\n}\n.container-fluid {\n  margin-right: auto;\n  margin-left: auto;\n  padding-left: 15px;\n  padding-right: 15px;\n}\n.row {\n  margin-left: -15px;\n  margin-right: -15px;\n}\n.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {\n  position: relative;\n  min-height: 1px;\n  padding-left: 15px;\n  padding-right: 15px;\n}\n.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {\n  float: left;\n}\n.col-xs-12 {\n  width: 100%;\n}\n.col-xs-11 {\n  width: 91.66666667%;\n}\n.col-xs-10 {\n  width: 83.33333333%;\n}\n.col-xs-9 {\n  width: 75%;\n}\n.col-xs-8 {\n  width: 66.66666667%;\n}\n.col-xs-7 {\n  width: 58.33333333%;\n}\n.col-xs-6 {\n  width: 50%;\n}\n.col-xs-5 {\n  width: 41.66666667%;\n}\n.col-xs-4 {\n  width: 33.33333333%;\n}\n.col-xs-3 {\n  width: 25%;\n}\n.col-xs-2 {\n  width: 16.66666667%;\n}\n.col-xs-1 {\n  width: 8.33333333%;\n}\n.col-xs-pull-12 {\n  right: 100%;\n}\n.col-xs-pull-11 {\n  right: 91.66666667%;\n}\n.col-xs-pull-10 {\n  right: 83.33333333%;\n}\n.col-xs-pull-9 {\n  right: 75%;\n}\n.col-xs-pull-8 {\n  right: 66.66666667%;\n}\n.col-xs-pull-7 {\n  right: 58.33333333%;\n}\n.col-xs-pull-6 {\n  right: 50%;\n}\n.col-xs-pull-5 {\n  right: 41.66666667%;\n}\n.col-xs-pull-4 {\n  right: 33.33333333%;\n}\n.col-xs-pull-3 {\n  right: 25%;\n}\n.col-xs-pull-2 {\n  right: 16.66666667%;\n}\n.col-xs-pull-1 {\n  right: 8.33333333%;\n}\n.col-xs-pull-0 {\n  right: auto;\n}\n.col-xs-push-12 {\n  left: 100%;\n}\n.col-xs-push-11 {\n  left: 91.66666667%;\n}\n.col-xs-push-10 {\n  left: 83.33333333%;\n}\n.col-xs-push-9 {\n  left: 75%;\n}\n.col-xs-push-8 {\n  left: 66.66666667%;\n}\n.col-xs-push-7 {\n  left: 58.33333333%;\n}\n.col-xs-push-6 {\n  left: 50%;\n}\n.col-xs-push-5 {\n  left: 41.66666667%;\n}\n.col-xs-push-4 {\n  left: 33.33333333%;\n}\n.col-xs-push-3 {\n  left: 25%;\n}\n.col-xs-push-2 {\n  left: 16.66666667%;\n}\n.col-xs-push-1 {\n  left: 8.33333333%;\n}\n.col-xs-push-0 {\n  left: auto;\n}\n.col-xs-offset-12 {\n  margin-left: 100%;\n}\n.col-xs-offset-11 {\n  margin-left: 91.66666667%;\n}\n.col-xs-offset-10 {\n  margin-left: 83.33333333%;\n}\n.col-xs-offset-9 {\n  margin-left: 75%;\n}\n.col-xs-offset-8 {\n  margin-left: 66.66666667%;\n}\n.col-xs-offset-7 {\n  margin-left: 58.33333333%;\n}\n.col-xs-offset-6 {\n  margin-left: 50%;\n}\n.col-xs-offset-5 {\n  margin-left: 41.66666667%;\n}\n.col-xs-offset-4 {\n  margin-left: 33.33333333%;\n}\n.col-xs-offset-3 {\n  margin-left: 25%;\n}\n.col-xs-offset-2 {\n  margin-left: 16.66666667%;\n}\n.col-xs-offset-1 {\n  margin-left: 8.33333333%;\n}\n.col-xs-offset-0 {\n  margin-left: 0%;\n}\n@media (min-width: 768px) {\n  .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {\n    float: left;\n  }\n  .col-sm-12 {\n    width: 100%;\n  }\n  .col-sm-11 {\n    width: 91.66666667%;\n  }\n  .col-sm-10 {\n    width: 83.33333333%;\n  }\n  .col-sm-9 {\n    width: 75%;\n  }\n  .col-sm-8 {\n    width: 66.66666667%;\n  }\n  .col-sm-7 {\n    width: 58.33333333%;\n  }\n  .col-sm-6 {\n    width: 50%;\n  }\n  .col-sm-5 {\n    width: 41.66666667%;\n  }\n  .col-sm-4 {\n    width: 33.33333333%;\n  }\n  .col-sm-3 {\n    width: 25%;\n  }\n  .col-sm-2 {\n    width: 16.66666667%;\n  }\n  .col-sm-1 {\n    width: 8.33333333%;\n  }\n  .col-sm-pull-12 {\n    right: 100%;\n  }\n  .col-sm-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-sm-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-sm-pull-9 {\n    right: 75%;\n  }\n  .col-sm-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-sm-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-sm-pull-6 {\n    right: 50%;\n  }\n  .col-sm-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-sm-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-sm-pull-3 {\n    right: 25%;\n  }\n  .col-sm-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-sm-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-sm-pull-0 {\n    right: auto;\n  }\n  .col-sm-push-12 {\n    left: 100%;\n  }\n  .col-sm-push-11 {\n    left: 91.66666667%;\n  }\n  .col-sm-push-10 {\n    left: 83.33333333%;\n  }\n  .col-sm-push-9 {\n    left: 75%;\n  }\n  .col-sm-push-8 {\n    left: 66.66666667%;\n  }\n  .col-sm-push-7 {\n    left: 58.33333333%;\n  }\n  .col-sm-push-6 {\n    left: 50%;\n  }\n  .col-sm-push-5 {\n    left: 41.66666667%;\n  }\n  .col-sm-push-4 {\n    left: 33.33333333%;\n  }\n  .col-sm-push-3 {\n    left: 25%;\n  }\n  .col-sm-push-2 {\n    left: 16.66666667%;\n  }\n  .col-sm-push-1 {\n    left: 8.33333333%;\n  }\n  .col-sm-push-0 {\n    left: auto;\n  }\n  .col-sm-offset-12 {\n    margin-left: 100%;\n  }\n  .col-sm-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-sm-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-sm-offset-9 {\n    margin-left: 75%;\n  }\n  .col-sm-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-sm-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-sm-offset-6 {\n    margin-left: 50%;\n  }\n  .col-sm-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-sm-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-sm-offset-3 {\n    margin-left: 25%;\n  }\n  .col-sm-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-sm-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-sm-offset-0 {\n    margin-left: 0%;\n  }\n}\n@media (min-width: 992px) {\n  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {\n    float: left;\n  }\n  .col-md-12 {\n    width: 100%;\n  }\n  .col-md-11 {\n    width: 91.66666667%;\n  }\n  .col-md-10 {\n    width: 83.33333333%;\n  }\n  .col-md-9 {\n    width: 75%;\n  }\n  .col-md-8 {\n    width: 66.66666667%;\n  }\n  .col-md-7 {\n    width: 58.33333333%;\n  }\n  .col-md-6 {\n    width: 50%;\n  }\n  .col-md-5 {\n    width: 41.66666667%;\n  }\n  .col-md-4 {\n    width: 33.33333333%;\n  }\n  .col-md-3 {\n    width: 25%;\n  }\n  .col-md-2 {\n    width: 16.66666667%;\n  }\n  .col-md-1 {\n    width: 8.33333333%;\n  }\n  .col-md-pull-12 {\n    right: 100%;\n  }\n  .col-md-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-md-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-md-pull-9 {\n    right: 75%;\n  }\n  .col-md-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-md-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-md-pull-6 {\n    right: 50%;\n  }\n  .col-md-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-md-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-md-pull-3 {\n    right: 25%;\n  }\n  .col-md-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-md-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-md-pull-0 {\n    right: auto;\n  }\n  .col-md-push-12 {\n    left: 100%;\n  }\n  .col-md-push-11 {\n    left: 91.66666667%;\n  }\n  .col-md-push-10 {\n    left: 83.33333333%;\n  }\n  .col-md-push-9 {\n    left: 75%;\n  }\n  .col-md-push-8 {\n    left: 66.66666667%;\n  }\n  .col-md-push-7 {\n    left: 58.33333333%;\n  }\n  .col-md-push-6 {\n    left: 50%;\n  }\n  .col-md-push-5 {\n    left: 41.66666667%;\n  }\n  .col-md-push-4 {\n    left: 33.33333333%;\n  }\n  .col-md-push-3 {\n    left: 25%;\n  }\n  .col-md-push-2 {\n    left: 16.66666667%;\n  }\n  .col-md-push-1 {\n    left: 8.33333333%;\n  }\n  .col-md-push-0 {\n    left: auto;\n  }\n  .col-md-offset-12 {\n    margin-left: 100%;\n  }\n  .col-md-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-md-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-md-offset-9 {\n    margin-left: 75%;\n  }\n  .col-md-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-md-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-md-offset-6 {\n    margin-left: 50%;\n  }\n  .col-md-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-md-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-md-offset-3 {\n    margin-left: 25%;\n  }\n  .col-md-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-md-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-md-offset-0 {\n    margin-left: 0%;\n  }\n}\n@media (min-width: 1200px) {\n  .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {\n    float: left;\n  }\n  .col-lg-12 {\n    width: 100%;\n  }\n  .col-lg-11 {\n    width: 91.66666667%;\n  }\n  .col-lg-10 {\n    width: 83.33333333%;\n  }\n  .col-lg-9 {\n    width: 75%;\n  }\n  .col-lg-8 {\n    width: 66.66666667%;\n  }\n  .col-lg-7 {\n    width: 58.33333333%;\n  }\n  .col-lg-6 {\n    width: 50%;\n  }\n  .col-lg-5 {\n    width: 41.66666667%;\n  }\n  .col-lg-4 {\n    width: 33.33333333%;\n  }\n  .col-lg-3 {\n    width: 25%;\n  }\n  .col-lg-2 {\n    width: 16.66666667%;\n  }\n  .col-lg-1 {\n    width: 8.33333333%;\n  }\n  .col-lg-pull-12 {\n    right: 100%;\n  }\n  .col-lg-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-lg-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-lg-pull-9 {\n    right: 75%;\n  }\n  .col-lg-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-lg-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-lg-pull-6 {\n    right: 50%;\n  }\n  .col-lg-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-lg-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-lg-pull-3 {\n    right: 25%;\n  }\n  .col-lg-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-lg-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-lg-pull-0 {\n    right: auto;\n  }\n  .col-lg-push-12 {\n    left: 100%;\n  }\n  .col-lg-push-11 {\n    left: 91.66666667%;\n  }\n  .col-lg-push-10 {\n    left: 83.33333333%;\n  }\n  .col-lg-push-9 {\n    left: 75%;\n  }\n  .col-lg-push-8 {\n    left: 66.66666667%;\n  }\n  .col-lg-push-7 {\n    left: 58.33333333%;\n  }\n  .col-lg-push-6 {\n    left: 50%;\n  }\n  .col-lg-push-5 {\n    left: 41.66666667%;\n  }\n  .col-lg-push-4 {\n    left: 33.33333333%;\n  }\n  .col-lg-push-3 {\n    left: 25%;\n  }\n  .col-lg-push-2 {\n    left: 16.66666667%;\n  }\n  .col-lg-push-1 {\n    left: 8.33333333%;\n  }\n  .col-lg-push-0 {\n    left: auto;\n  }\n  .col-lg-offset-12 {\n    margin-left: 100%;\n  }\n  .col-lg-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-lg-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-lg-offset-9 {\n    margin-left: 75%;\n  }\n  .col-lg-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-lg-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-lg-offset-6 {\n    margin-left: 50%;\n  }\n  .col-lg-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-lg-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-lg-offset-3 {\n    margin-left: 25%;\n  }\n  .col-lg-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-lg-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-lg-offset-0 {\n    margin-left: 0%;\n  }\n}\ntable {\n  background-color: transparent;\n}\ncaption {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  color: #b4bcc2;\n  text-align: left;\n}\nth {\n  text-align: left;\n}\n.table {\n  width: 100%;\n  max-width: 100%;\n  margin-bottom: 21px;\n}\n.table > thead > tr > th,\n.table > tbody > tr > th,\n.table > tfoot > tr > th,\n.table > thead > tr > td,\n.table > tbody > tr > td,\n.table > tfoot > tr > td {\n  padding: 8px;\n  line-height: 1.42857143;\n  vertical-align: top;\n  border-top: 1px solid #ecf0f1;\n}\n.table > thead > tr > th {\n  vertical-align: bottom;\n  border-bottom: 2px solid #ecf0f1;\n}\n.table > caption + thead > tr:first-child > th,\n.table > colgroup + thead > tr:first-child > th,\n.table > thead:first-child > tr:first-child > th,\n.table > caption + thead > tr:first-child > td,\n.table > colgroup + thead > tr:first-child > td,\n.table > thead:first-child > tr:first-child > td {\n  border-top: 0;\n}\n.table > tbody + tbody {\n  border-top: 2px solid #ecf0f1;\n}\n.table .table {\n  background-color: #002221;\n}\n.table-condensed > thead > tr > th,\n.table-condensed > tbody > tr > th,\n.table-condensed > tfoot > tr > th,\n.table-condensed > thead > tr > td,\n.table-condensed > tbody > tr > td,\n.table-condensed > tfoot > tr > td {\n  padding: 5px;\n}\n.table-bordered {\n  border: 1px solid #ecf0f1;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > tbody > tr > th,\n.table-bordered > tfoot > tr > th,\n.table-bordered > thead > tr > td,\n.table-bordered > tbody > tr > td,\n.table-bordered > tfoot > tr > td {\n  border: 1px solid #ecf0f1;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > thead > tr > td {\n  border-bottom-width: 2px;\n}\n.table-striped > tbody > tr:nth-of-type(odd) {\n  background-color: #f9f9f9;\n}\n.table-hover > tbody > tr:hover {\n  background-color: #ecf0f1;\n}\ntable col[class*=\"col-\"] {\n  position: static;\n  float: none;\n  display: table-column;\n}\ntable td[class*=\"col-\"],\ntable th[class*=\"col-\"] {\n  position: static;\n  float: none;\n  display: table-cell;\n}\n.table > thead > tr > td.active,\n.table > tbody > tr > td.active,\n.table > tfoot > tr > td.active,\n.table > thead > tr > th.active,\n.table > tbody > tr > th.active,\n.table > tfoot > tr > th.active,\n.table > thead > tr.active > td,\n.table > tbody > tr.active > td,\n.table > tfoot > tr.active > td,\n.table > thead > tr.active > th,\n.table > tbody > tr.active > th,\n.table > tfoot > tr.active > th {\n  background-color: #ecf0f1;\n}\n.table-hover > tbody > tr > td.active:hover,\n.table-hover > tbody > tr > th.active:hover,\n.table-hover > tbody > tr.active:hover > td,\n.table-hover > tbody > tr:hover > .active,\n.table-hover > tbody > tr.active:hover > th {\n  background-color: #dde4e6;\n}\n.table > thead > tr > td.success,\n.table > tbody > tr > td.success,\n.table > tfoot > tr > td.success,\n.table > thead > tr > th.success,\n.table > tbody > tr > th.success,\n.table > tfoot > tr > th.success,\n.table > thead > tr.success > td,\n.table > tbody > tr.success > td,\n.table > tfoot > tr.success > td,\n.table > thead > tr.success > th,\n.table > tbody > tr.success > th,\n.table > tfoot > tr.success > th {\n  background-color: #ffbe00;\n}\n.table-hover > tbody > tr > td.success:hover,\n.table-hover > tbody > tr > th.success:hover,\n.table-hover > tbody > tr.success:hover > td,\n.table-hover > tbody > tr:hover > .success,\n.table-hover > tbody > tr.success:hover > th {\n  background-color: #e6ab00;\n}\n.table > thead > tr > td.info,\n.table > tbody > tr > td.info,\n.table > tfoot > tr > td.info,\n.table > thead > tr > th.info,\n.table > tbody > tr > th.info,\n.table > tfoot > tr > th.info,\n.table > thead > tr.info > td,\n.table > tbody > tr.info > td,\n.table > tfoot > tr.info > td,\n.table > thead > tr.info > th,\n.table > tbody > tr.info > th,\n.table > tfoot > tr.info > th {\n  background-color: #3498DB;\n}\n.table-hover > tbody > tr > td.info:hover,\n.table-hover > tbody > tr > th.info:hover,\n.table-hover > tbody > tr.info:hover > td,\n.table-hover > tbody > tr:hover > .info,\n.table-hover > tbody > tr.info:hover > th {\n  background-color: #258cd1;\n}\n.table > thead > tr > td.warning,\n.table > tbody > tr > td.warning,\n.table > tfoot > tr > td.warning,\n.table > thead > tr > th.warning,\n.table > tbody > tr > th.warning,\n.table > tfoot > tr > th.warning,\n.table > thead > tr.warning > td,\n.table > tbody > tr.warning > td,\n.table > tfoot > tr.warning > td,\n.table > thead > tr.warning > th,\n.table > tbody > tr.warning > th,\n.table > tfoot > tr.warning > th {\n  background-color: #F39C12;\n}\n.table-hover > tbody > tr > td.warning:hover,\n.table-hover > tbody > tr > th.warning:hover,\n.table-hover > tbody > tr.warning:hover > td,\n.table-hover > tbody > tr:hover > .warning,\n.table-hover > tbody > tr.warning:hover > th {\n  background-color: #e08e0b;\n}\n.table > thead > tr > td.danger,\n.table > tbody > tr > td.danger,\n.table > tfoot > tr > td.danger,\n.table > thead > tr > th.danger,\n.table > tbody > tr > th.danger,\n.table > tfoot > tr > th.danger,\n.table > thead > tr.danger > td,\n.table > tbody > tr.danger > td,\n.table > tfoot > tr.danger > td,\n.table > thead > tr.danger > th,\n.table > tbody > tr.danger > th,\n.table > tfoot > tr.danger > th {\n  background-color: #E74C3C;\n}\n.table-hover > tbody > tr > td.danger:hover,\n.table-hover > tbody > tr > th.danger:hover,\n.table-hover > tbody > tr.danger:hover > td,\n.table-hover > tbody > tr:hover > .danger,\n.table-hover > tbody > tr.danger:hover > th {\n  background-color: #e43725;\n}\n.table-responsive {\n  overflow-x: auto;\n  min-height: 0.01%;\n}\n@media screen and (max-width: 767px) {\n  .table-responsive {\n    width: 100%;\n    margin-bottom: 15.75px;\n    overflow-y: hidden;\n    -ms-overflow-style: -ms-autohiding-scrollbar;\n    border: 1px solid #ecf0f1;\n  }\n  .table-responsive > .table {\n    margin-bottom: 0;\n  }\n  .table-responsive > .table > thead > tr > th,\n  .table-responsive > .table > tbody > tr > th,\n  .table-responsive > .table > tfoot > tr > th,\n  .table-responsive > .table > thead > tr > td,\n  .table-responsive > .table > tbody > tr > td,\n  .table-responsive > .table > tfoot > tr > td {\n    white-space: nowrap;\n  }\n  .table-responsive > .table-bordered {\n    border: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:first-child,\n  .table-responsive > .table-bordered > tbody > tr > th:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n  .table-responsive > .table-bordered > thead > tr > td:first-child,\n  .table-responsive > .table-bordered > tbody > tr > td:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n    border-left: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:last-child,\n  .table-responsive > .table-bordered > tbody > tr > th:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n  .table-responsive > .table-bordered > thead > tr > td:last-child,\n  .table-responsive > .table-bordered > tbody > tr > td:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n    border-right: 0;\n  }\n  .table-responsive > .table-bordered > tbody > tr:last-child > th,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > th,\n  .table-responsive > .table-bordered > tbody > tr:last-child > td,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > td {\n    border-bottom: 0;\n  }\n}\nfieldset {\n  padding: 0;\n  margin: 0;\n  border: 0;\n  min-width: 0;\n}\nlegend {\n  display: block;\n  width: 100%;\n  padding: 0;\n  margin-bottom: 21px;\n  font-size: 22.5px;\n  line-height: inherit;\n  color: #FFFFFF;\n  border: 0;\n  border-bottom: 1px solid transparent;\n}\nlabel {\n  display: inline-block;\n  max-width: 100%;\n  margin-bottom: 5px;\n  font-weight: bold;\n}\ninput[type=\"search\"] {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n}\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 4px 0 0;\n  margin-top: 1px \\9;\n  line-height: normal;\n}\ninput[type=\"file\"] {\n  display: block;\n}\ninput[type=\"range\"] {\n  display: block;\n  width: 100%;\n}\nselect[multiple],\nselect[size] {\n  height: auto;\n}\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\noutput {\n  display: block;\n  padding-top: 11px;\n  font-size: 15px;\n  line-height: 1.42857143;\n  color: #FFFFFF;\n}\n.form-control {\n  display: block;\n  width: 100%;\n  height: 45px;\n  padding: 10px 15px;\n  font-size: 15px;\n  line-height: 1.42857143;\n  color: #FFFFFF;\n  background-color: #fff;\n  background-image: none;\n  border: 1px solid #dce4ec;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n  -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n}\n.form-control:focus {\n  border-color: #63ceca;\n  outline: 0;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(99, 206, 202, 0.6);\n  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(99, 206, 202, 0.6);\n}\n.form-control::-moz-placeholder {\n  color: #acb6c0;\n  opacity: 1;\n}\n.form-control:-ms-input-placeholder {\n  color: #acb6c0;\n}\n.form-control::-webkit-input-placeholder {\n  color: #acb6c0;\n}\n.form-control::-ms-expand {\n  border: 0;\n  background-color: transparent;\n}\n.form-control[disabled],\n.form-control[readonly],\nfieldset[disabled] .form-control {\n  background-color: #ecf0f1;\n  opacity: 1;\n}\n.form-control[disabled],\nfieldset[disabled] .form-control {\n  cursor: not-allowed;\n}\ntextarea.form-control {\n  height: auto;\n}\ninput[type=\"search\"] {\n  -webkit-appearance: none;\n}\n@media screen and (-webkit-min-device-pixel-ratio: 0) {\n  input[type=\"date\"].form-control,\n  input[type=\"time\"].form-control,\n  input[type=\"datetime-local\"].form-control,\n  input[type=\"month\"].form-control {\n    line-height: 45px;\n  }\n  input[type=\"date\"].input-sm,\n  input[type=\"time\"].input-sm,\n  input[type=\"datetime-local\"].input-sm,\n  input[type=\"month\"].input-sm,\n  .input-group-sm input[type=\"date\"],\n  .input-group-sm input[type=\"time\"],\n  .input-group-sm input[type=\"datetime-local\"],\n  .input-group-sm input[type=\"month\"] {\n    line-height: 35px;\n  }\n  input[type=\"date\"].input-lg,\n  input[type=\"time\"].input-lg,\n  input[type=\"datetime-local\"].input-lg,\n  input[type=\"month\"].input-lg,\n  .input-group-lg input[type=\"date\"],\n  .input-group-lg input[type=\"time\"],\n  .input-group-lg input[type=\"datetime-local\"],\n  .input-group-lg input[type=\"month\"] {\n    line-height: 66px;\n  }\n}\n.form-group {\n  margin-bottom: 15px;\n}\n.radio,\n.checkbox {\n  position: relative;\n  display: block;\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n.radio label,\n.checkbox label {\n  min-height: 21px;\n  padding-left: 20px;\n  margin-bottom: 0;\n  font-weight: normal;\n  cursor: pointer;\n}\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n  position: absolute;\n  margin-left: -20px;\n  margin-top: 4px \\9;\n}\n.radio + .radio,\n.checkbox + .checkbox {\n  margin-top: -5px;\n}\n.radio-inline,\n.checkbox-inline {\n  position: relative;\n  display: inline-block;\n  padding-left: 20px;\n  margin-bottom: 0;\n  vertical-align: middle;\n  font-weight: normal;\n  cursor: pointer;\n}\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n  margin-top: 0;\n  margin-left: 10px;\n}\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"].disabled,\ninput[type=\"checkbox\"].disabled,\nfieldset[disabled] input[type=\"radio\"],\nfieldset[disabled] input[type=\"checkbox\"] {\n  cursor: not-allowed;\n}\n.radio-inline.disabled,\n.checkbox-inline.disabled,\nfieldset[disabled] .radio-inline,\nfieldset[disabled] .checkbox-inline {\n  cursor: not-allowed;\n}\n.radio.disabled label,\n.checkbox.disabled label,\nfieldset[disabled] .radio label,\nfieldset[disabled] .checkbox label {\n  cursor: not-allowed;\n}\n.form-control-static {\n  padding-top: 11px;\n  padding-bottom: 11px;\n  margin-bottom: 0;\n  min-height: 36px;\n}\n.form-control-static.input-lg,\n.form-control-static.input-sm {\n  padding-left: 0;\n  padding-right: 0;\n}\n.input-sm {\n  height: 35px;\n  padding: 6px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\nselect.input-sm {\n  height: 35px;\n  line-height: 35px;\n}\ntextarea.input-sm,\nselect[multiple].input-sm {\n  height: auto;\n}\n.form-group-sm .form-control {\n  height: 35px;\n  padding: 6px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.form-group-sm select.form-control {\n  height: 35px;\n  line-height: 35px;\n}\n.form-group-sm textarea.form-control,\n.form-group-sm select[multiple].form-control {\n  height: auto;\n}\n.form-group-sm .form-control-static {\n  height: 35px;\n  min-height: 34px;\n  padding: 7px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n}\n.input-lg {\n  height: 66px;\n  padding: 18px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\nselect.input-lg {\n  height: 66px;\n  line-height: 66px;\n}\ntextarea.input-lg,\nselect[multiple].input-lg {\n  height: auto;\n}\n.form-group-lg .form-control {\n  height: 66px;\n  padding: 18px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\n.form-group-lg select.form-control {\n  height: 66px;\n  line-height: 66px;\n}\n.form-group-lg textarea.form-control,\n.form-group-lg select[multiple].form-control {\n  height: auto;\n}\n.form-group-lg .form-control-static {\n  height: 66px;\n  min-height: 40px;\n  padding: 19px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n}\n.has-feedback {\n  position: relative;\n}\n.has-feedback .form-control {\n  padding-right: 56.25px;\n}\n.form-control-feedback {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 2;\n  display: block;\n  width: 45px;\n  height: 45px;\n  line-height: 45px;\n  text-align: center;\n  pointer-events: none;\n}\n.input-lg + .form-control-feedback,\n.input-group-lg + .form-control-feedback,\n.form-group-lg .form-control + .form-control-feedback {\n  width: 66px;\n  height: 66px;\n  line-height: 66px;\n}\n.input-sm + .form-control-feedback,\n.input-group-sm + .form-control-feedback,\n.form-group-sm .form-control + .form-control-feedback {\n  width: 35px;\n  height: 35px;\n  line-height: 35px;\n}\n.has-success .help-block,\n.has-success .control-label,\n.has-success .radio,\n.has-success .checkbox,\n.has-success .radio-inline,\n.has-success .checkbox-inline,\n.has-success.radio label,\n.has-success.checkbox label,\n.has-success.radio-inline label,\n.has-success.checkbox-inline label {\n  color: #fff;\n}\n.has-success .form-control {\n  border-color: #fff;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n.has-success .form-control:focus {\n  border-color: #e6e6e6;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n}\n.has-success .input-group-addon {\n  color: #fff;\n  border-color: #fff;\n  background-color: #ffbe00;\n}\n.has-success .form-control-feedback {\n  color: #fff;\n}\n.has-warning .help-block,\n.has-warning .control-label,\n.has-warning .radio,\n.has-warning .checkbox,\n.has-warning .radio-inline,\n.has-warning .checkbox-inline,\n.has-warning.radio label,\n.has-warning.checkbox label,\n.has-warning.radio-inline label,\n.has-warning.checkbox-inline label {\n  color: #fff;\n}\n.has-warning .form-control {\n  border-color: #fff;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n.has-warning .form-control:focus {\n  border-color: #e6e6e6;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n}\n.has-warning .input-group-addon {\n  color: #fff;\n  border-color: #fff;\n  background-color: #F39C12;\n}\n.has-warning .form-control-feedback {\n  color: #fff;\n}\n.has-error .help-block,\n.has-error .control-label,\n.has-error .radio,\n.has-error .checkbox,\n.has-error .radio-inline,\n.has-error .checkbox-inline,\n.has-error.radio label,\n.has-error.checkbox label,\n.has-error.radio-inline label,\n.has-error.checkbox-inline label {\n  color: #fff;\n}\n.has-error .form-control {\n  border-color: #fff;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n.has-error .form-control:focus {\n  border-color: #e6e6e6;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffffff;\n}\n.has-error .input-group-addon {\n  color: #fff;\n  border-color: #fff;\n  background-color: #E74C3C;\n}\n.has-error .form-control-feedback {\n  color: #fff;\n}\n.has-feedback label ~ .form-control-feedback {\n  top: 26px;\n}\n.has-feedback label.sr-only ~ .form-control-feedback {\n  top: 0;\n}\n.help-block {\n  display: block;\n  margin-top: 5px;\n  margin-bottom: 10px;\n  color: #ffffff;\n}\n@media (min-width: 768px) {\n  .form-inline .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .form-control {\n    display: inline-block;\n    width: auto;\n    vertical-align: middle;\n  }\n  .form-inline .form-control-static {\n    display: inline-block;\n  }\n  .form-inline .input-group {\n    display: inline-table;\n    vertical-align: middle;\n  }\n  .form-inline .input-group .input-group-addon,\n  .form-inline .input-group .input-group-btn,\n  .form-inline .input-group .form-control {\n    width: auto;\n  }\n  .form-inline .input-group > .form-control {\n    width: 100%;\n  }\n  .form-inline .control-label {\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .radio,\n  .form-inline .checkbox {\n    display: inline-block;\n    margin-top: 0;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .radio label,\n  .form-inline .checkbox label {\n    padding-left: 0;\n  }\n  .form-inline .radio input[type=\"radio\"],\n  .form-inline .checkbox input[type=\"checkbox\"] {\n    position: relative;\n    margin-left: 0;\n  }\n  .form-inline .has-feedback .form-control-feedback {\n    top: 0;\n  }\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox,\n.form-horizontal .radio-inline,\n.form-horizontal .checkbox-inline {\n  margin-top: 0;\n  margin-bottom: 0;\n  padding-top: 11px;\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox {\n  min-height: 32px;\n}\n.form-horizontal .form-group {\n  margin-left: -15px;\n  margin-right: -15px;\n}\n@media (min-width: 768px) {\n  .form-horizontal .control-label {\n    text-align: right;\n    margin-bottom: 0;\n    padding-top: 11px;\n  }\n}\n.form-horizontal .has-feedback .form-control-feedback {\n  right: 15px;\n}\n@media (min-width: 768px) {\n  .form-horizontal .form-group-lg .control-label {\n    padding-top: 19px;\n    font-size: 19px;\n  }\n}\n@media (min-width: 768px) {\n  .form-horizontal .form-group-sm .control-label {\n    padding-top: 7px;\n    font-size: 13px;\n  }\n}\n.btn {\n  display: inline-block;\n  margin-bottom: 0;\n  font-weight: normal;\n  text-align: center;\n  vertical-align: middle;\n  touch-action: manipulation;\n  cursor: pointer;\n  background-image: none;\n  border: 1px solid transparent;\n  white-space: nowrap;\n  padding: 10px 15px;\n  font-size: 15px;\n  line-height: 1.42857143;\n  border-radius: 4px;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n.btn:focus,\n.btn:active:focus,\n.btn.active:focus,\n.btn.focus,\n.btn:active.focus,\n.btn.active.focus {\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n.btn:hover,\n.btn:focus,\n.btn.focus {\n  color: #fff;\n  text-decoration: none;\n}\n.btn:active,\n.btn.active {\n  outline: 0;\n  background-image: none;\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n}\n.btn.disabled,\n.btn[disabled],\nfieldset[disabled] .btn {\n  cursor: not-allowed;\n  opacity: 0.65;\n  filter: alpha(opacity=65);\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\na.btn.disabled,\nfieldset[disabled] a.btn {\n  pointer-events: none;\n}\n.btn-default {\n  color: #fff;\n  background-color: #95a5a6;\n  border-color: #95a5a6;\n}\n.btn-default:focus,\n.btn-default.focus {\n  color: #fff;\n  background-color: #798d8f;\n  border-color: #566566;\n}\n.btn-default:hover {\n  color: #fff;\n  background-color: #798d8f;\n  border-color: #74898a;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n  color: #fff;\n  background-color: #798d8f;\n  border-color: #74898a;\n}\n.btn-default:active:hover,\n.btn-default.active:hover,\n.open > .dropdown-toggle.btn-default:hover,\n.btn-default:active:focus,\n.btn-default.active:focus,\n.open > .dropdown-toggle.btn-default:focus,\n.btn-default:active.focus,\n.btn-default.active.focus,\n.open > .dropdown-toggle.btn-default.focus {\n  color: #fff;\n  background-color: #687b7c;\n  border-color: #566566;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n  background-image: none;\n}\n.btn-default.disabled:hover,\n.btn-default[disabled]:hover,\nfieldset[disabled] .btn-default:hover,\n.btn-default.disabled:focus,\n.btn-default[disabled]:focus,\nfieldset[disabled] .btn-default:focus,\n.btn-default.disabled.focus,\n.btn-default[disabled].focus,\nfieldset[disabled] .btn-default.focus {\n  background-color: #95a5a6;\n  border-color: #95a5a6;\n}\n.btn-default .badge {\n  color: #95a5a6;\n  background-color: #fff;\n}\n.btn-primary {\n  color: #fff;\n  background-color: #63ceca;\n  border-color: #63ceca;\n}\n.btn-primary:focus,\n.btn-primary.focus {\n  color: #fff;\n  background-color: #3dc1bc;\n  border-color: #2a8784;\n}\n.btn-primary:hover {\n  color: #fff;\n  background-color: #3dc1bc;\n  border-color: #3abab5;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n  color: #fff;\n  background-color: #3dc1bc;\n  border-color: #3abab5;\n}\n.btn-primary:active:hover,\n.btn-primary.active:hover,\n.open > .dropdown-toggle.btn-primary:hover,\n.btn-primary:active:focus,\n.btn-primary.active:focus,\n.open > .dropdown-toggle.btn-primary:focus,\n.btn-primary:active.focus,\n.btn-primary.active.focus,\n.open > .dropdown-toggle.btn-primary.focus {\n  color: #fff;\n  background-color: #34a6a2;\n  border-color: #2a8784;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n  background-image: none;\n}\n.btn-primary.disabled:hover,\n.btn-primary[disabled]:hover,\nfieldset[disabled] .btn-primary:hover,\n.btn-primary.disabled:focus,\n.btn-primary[disabled]:focus,\nfieldset[disabled] .btn-primary:focus,\n.btn-primary.disabled.focus,\n.btn-primary[disabled].focus,\nfieldset[disabled] .btn-primary.focus {\n  background-color: #63ceca;\n  border-color: #63ceca;\n}\n.btn-primary .badge {\n  color: #63ceca;\n  background-color: #fff;\n}\n.btn-success {\n  color: #fff;\n  background-color: #ffbe00;\n  border-color: #ffbe00;\n}\n.btn-success:focus,\n.btn-success.focus {\n  color: #fff;\n  background-color: #cc9800;\n  border-color: #805f00;\n}\n.btn-success:hover {\n  color: #fff;\n  background-color: #cc9800;\n  border-color: #c29000;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n  color: #fff;\n  background-color: #cc9800;\n  border-color: #c29000;\n}\n.btn-success:active:hover,\n.btn-success.active:hover,\n.open > .dropdown-toggle.btn-success:hover,\n.btn-success:active:focus,\n.btn-success.active:focus,\n.open > .dropdown-toggle.btn-success:focus,\n.btn-success:active.focus,\n.btn-success.active.focus,\n.open > .dropdown-toggle.btn-success.focus {\n  color: #fff;\n  background-color: #a87d00;\n  border-color: #805f00;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n  background-image: none;\n}\n.btn-success.disabled:hover,\n.btn-success[disabled]:hover,\nfieldset[disabled] .btn-success:hover,\n.btn-success.disabled:focus,\n.btn-success[disabled]:focus,\nfieldset[disabled] .btn-success:focus,\n.btn-success.disabled.focus,\n.btn-success[disabled].focus,\nfieldset[disabled] .btn-success.focus {\n  background-color: #ffbe00;\n  border-color: #ffbe00;\n}\n.btn-success .badge {\n  color: #ffbe00;\n  background-color: #fff;\n}\n.btn-info {\n  color: #fff;\n  background-color: #3498DB;\n  border-color: #3498DB;\n}\n.btn-info:focus,\n.btn-info.focus {\n  color: #fff;\n  background-color: #217dbb;\n  border-color: #16527a;\n}\n.btn-info:hover {\n  color: #fff;\n  background-color: #217dbb;\n  border-color: #2077b2;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n  color: #fff;\n  background-color: #217dbb;\n  border-color: #2077b2;\n}\n.btn-info:active:hover,\n.btn-info.active:hover,\n.open > .dropdown-toggle.btn-info:hover,\n.btn-info:active:focus,\n.btn-info.active:focus,\n.open > .dropdown-toggle.btn-info:focus,\n.btn-info:active.focus,\n.btn-info.active.focus,\n.open > .dropdown-toggle.btn-info.focus {\n  color: #fff;\n  background-color: #1c699d;\n  border-color: #16527a;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n  background-image: none;\n}\n.btn-info.disabled:hover,\n.btn-info[disabled]:hover,\nfieldset[disabled] .btn-info:hover,\n.btn-info.disabled:focus,\n.btn-info[disabled]:focus,\nfieldset[disabled] .btn-info:focus,\n.btn-info.disabled.focus,\n.btn-info[disabled].focus,\nfieldset[disabled] .btn-info.focus {\n  background-color: #3498DB;\n  border-color: #3498DB;\n}\n.btn-info .badge {\n  color: #3498DB;\n  background-color: #fff;\n}\n.btn-warning {\n  color: #fff;\n  background-color: #F39C12;\n  border-color: #F39C12;\n}\n.btn-warning:focus,\n.btn-warning.focus {\n  color: #fff;\n  background-color: #c87f0a;\n  border-color: #7f5006;\n}\n.btn-warning:hover {\n  color: #fff;\n  background-color: #c87f0a;\n  border-color: #be780a;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n  color: #fff;\n  background-color: #c87f0a;\n  border-color: #be780a;\n}\n.btn-warning:active:hover,\n.btn-warning.active:hover,\n.open > .dropdown-toggle.btn-warning:hover,\n.btn-warning:active:focus,\n.btn-warning.active:focus,\n.open > .dropdown-toggle.btn-warning:focus,\n.btn-warning:active.focus,\n.btn-warning.active.focus,\n.open > .dropdown-toggle.btn-warning.focus {\n  color: #fff;\n  background-color: #a66908;\n  border-color: #7f5006;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n  background-image: none;\n}\n.btn-warning.disabled:hover,\n.btn-warning[disabled]:hover,\nfieldset[disabled] .btn-warning:hover,\n.btn-warning.disabled:focus,\n.btn-warning[disabled]:focus,\nfieldset[disabled] .btn-warning:focus,\n.btn-warning.disabled.focus,\n.btn-warning[disabled].focus,\nfieldset[disabled] .btn-warning.focus {\n  background-color: #F39C12;\n  border-color: #F39C12;\n}\n.btn-warning .badge {\n  color: #F39C12;\n  background-color: #fff;\n}\n.btn-danger {\n  color: #fff;\n  background-color: #E74C3C;\n  border-color: #E74C3C;\n}\n.btn-danger:focus,\n.btn-danger.focus {\n  color: #fff;\n  background-color: #d62c1a;\n  border-color: #921e12;\n}\n.btn-danger:hover {\n  color: #fff;\n  background-color: #d62c1a;\n  border-color: #cd2a19;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n  color: #fff;\n  background-color: #d62c1a;\n  border-color: #cd2a19;\n}\n.btn-danger:active:hover,\n.btn-danger.active:hover,\n.open > .dropdown-toggle.btn-danger:hover,\n.btn-danger:active:focus,\n.btn-danger.active:focus,\n.open > .dropdown-toggle.btn-danger:focus,\n.btn-danger:active.focus,\n.btn-danger.active.focus,\n.open > .dropdown-toggle.btn-danger.focus {\n  color: #fff;\n  background-color: #b62516;\n  border-color: #921e12;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n  background-image: none;\n}\n.btn-danger.disabled:hover,\n.btn-danger[disabled]:hover,\nfieldset[disabled] .btn-danger:hover,\n.btn-danger.disabled:focus,\n.btn-danger[disabled]:focus,\nfieldset[disabled] .btn-danger:focus,\n.btn-danger.disabled.focus,\n.btn-danger[disabled].focus,\nfieldset[disabled] .btn-danger.focus {\n  background-color: #E74C3C;\n  border-color: #E74C3C;\n}\n.btn-danger .badge {\n  color: #E74C3C;\n  background-color: #fff;\n}\n.btn-link {\n  color: #ffbe00;\n  font-weight: normal;\n  border-radius: 0;\n}\n.btn-link,\n.btn-link:active,\n.btn-link.active,\n.btn-link[disabled],\nfieldset[disabled] .btn-link {\n  background-color: transparent;\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.btn-link,\n.btn-link:hover,\n.btn-link:focus,\n.btn-link:active {\n  border-color: transparent;\n}\n.btn-link:hover,\n.btn-link:focus {\n  color: #ffbe00;\n  text-decoration: underline;\n  background-color: transparent;\n}\n.btn-link[disabled]:hover,\nfieldset[disabled] .btn-link:hover,\n.btn-link[disabled]:focus,\nfieldset[disabled] .btn-link:focus {\n  color: #b4bcc2;\n  text-decoration: none;\n}\n.btn-lg,\n.btn-group-lg > .btn {\n  padding: 18px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\n.btn-sm,\n.btn-group-sm > .btn {\n  padding: 6px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.btn-xs,\n.btn-group-xs > .btn {\n  padding: 1px 5px;\n  font-size: 13px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.btn-block {\n  display: block;\n  width: 100%;\n}\n.btn-block + .btn-block {\n  margin-top: 5px;\n}\ninput[type=\"submit\"].btn-block,\ninput[type=\"reset\"].btn-block,\ninput[type=\"button\"].btn-block {\n  width: 100%;\n}\n.fade {\n  opacity: 0;\n  -webkit-transition: opacity 0.15s linear;\n  -o-transition: opacity 0.15s linear;\n  transition: opacity 0.15s linear;\n}\n.fade.in {\n  opacity: 1;\n}\n.collapse {\n  display: none;\n}\n.collapse.in {\n  display: block;\n}\ntr.collapse.in {\n  display: table-row;\n}\ntbody.collapse.in {\n  display: table-row-group;\n}\n.collapsing {\n  position: relative;\n  height: 0;\n  overflow: hidden;\n  -webkit-transition-property: height, visibility;\n  transition-property: height, visibility;\n  -webkit-transition-duration: 0.35s;\n  transition-duration: 0.35s;\n  -webkit-transition-timing-function: ease;\n  transition-timing-function: ease;\n}\n.caret {\n  display: inline-block;\n  width: 0;\n  height: 0;\n  margin-left: 2px;\n  vertical-align: middle;\n  border-top: 4px dashed;\n  border-top: 4px solid \\9;\n  border-right: 4px solid transparent;\n  border-left: 4px solid transparent;\n}\n.dropup,\n.dropdown {\n  position: relative;\n}\n.dropdown-toggle:focus {\n  outline: 0;\n}\n.dropdown-menu {\n  position: absolute;\n  top: 100%;\n  left: 0;\n  z-index: 1000;\n  display: none;\n  float: left;\n  min-width: 160px;\n  padding: 5px 0;\n  margin: 2px 0 0;\n  list-style: none;\n  font-size: 15px;\n  text-align: left;\n  background-color: #fff;\n  border: 1px solid #ccc;\n  border: 1px solid rgba(0, 0, 0, 0.15);\n  border-radius: 4px;\n  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n  background-clip: padding-box;\n}\n.dropdown-menu.pull-right {\n  right: 0;\n  left: auto;\n}\n.dropdown-menu .divider {\n  height: 1px;\n  margin: 9.5px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n.dropdown-menu > li > a {\n  display: block;\n  padding: 3px 20px;\n  clear: both;\n  font-weight: normal;\n  line-height: 1.42857143;\n  color: #7b8a8b;\n  white-space: nowrap;\n}\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  text-decoration: none;\n  color: #fff;\n  background-color: #63ceca;\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  color: #fff;\n  text-decoration: none;\n  outline: 0;\n  background-color: #63ceca;\n}\n.dropdown-menu > .disabled > a,\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  color: #b4bcc2;\n}\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  text-decoration: none;\n  background-color: transparent;\n  background-image: none;\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);\n  cursor: not-allowed;\n}\n.open > .dropdown-menu {\n  display: block;\n}\n.open > a {\n  outline: 0;\n}\n.dropdown-menu-right {\n  left: auto;\n  right: 0;\n}\n.dropdown-menu-left {\n  left: 0;\n  right: auto;\n}\n.dropdown-header {\n  display: block;\n  padding: 3px 20px;\n  font-size: 13px;\n  line-height: 1.42857143;\n  color: #b4bcc2;\n  white-space: nowrap;\n}\n.dropdown-backdrop {\n  position: fixed;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  top: 0;\n  z-index: 990;\n}\n.pull-right > .dropdown-menu {\n  right: 0;\n  left: auto;\n}\n.dropup .caret,\n.navbar-fixed-bottom .dropdown .caret {\n  border-top: 0;\n  border-bottom: 4px dashed;\n  border-bottom: 4px solid \\9;\n  content: \"\";\n}\n.dropup .dropdown-menu,\n.navbar-fixed-bottom .dropdown .dropdown-menu {\n  top: auto;\n  bottom: 100%;\n  margin-bottom: 2px;\n}\n@media (min-width: 768px) {\n  .navbar-right .dropdown-menu {\n    left: auto;\n    right: 0;\n  }\n  .navbar-right .dropdown-menu-left {\n    left: 0;\n    right: auto;\n  }\n}\n.btn-group,\n.btn-group-vertical {\n  position: relative;\n  display: inline-block;\n  vertical-align: middle;\n}\n.btn-group > .btn,\n.btn-group-vertical > .btn {\n  position: relative;\n  float: left;\n}\n.btn-group > .btn:hover,\n.btn-group-vertical > .btn:hover,\n.btn-group > .btn:focus,\n.btn-group-vertical > .btn:focus,\n.btn-group > .btn:active,\n.btn-group-vertical > .btn:active,\n.btn-group > .btn.active,\n.btn-group-vertical > .btn.active {\n  z-index: 2;\n}\n.btn-group .btn + .btn,\n.btn-group .btn + .btn-group,\n.btn-group .btn-group + .btn,\n.btn-group .btn-group + .btn-group {\n  margin-left: -1px;\n}\n.btn-toolbar {\n  margin-left: -5px;\n}\n.btn-toolbar .btn,\n.btn-toolbar .btn-group,\n.btn-toolbar .input-group {\n  float: left;\n}\n.btn-toolbar > .btn,\n.btn-toolbar > .btn-group,\n.btn-toolbar > .input-group {\n  margin-left: 5px;\n}\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n  border-radius: 0;\n}\n.btn-group > .btn:first-child {\n  margin-left: 0;\n}\n.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {\n  border-bottom-right-radius: 0;\n  border-top-right-radius: 0;\n}\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n.btn-group > .btn-group {\n  float: left;\n}\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n  border-bottom-right-radius: 0;\n  border-top-right-radius: 0;\n}\n.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n  outline: 0;\n}\n.btn-group > .btn + .dropdown-toggle {\n  padding-left: 8px;\n  padding-right: 8px;\n}\n.btn-group > .btn-lg + .dropdown-toggle {\n  padding-left: 12px;\n  padding-right: 12px;\n}\n.btn-group.open .dropdown-toggle {\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n}\n.btn-group.open .dropdown-toggle.btn-link {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.btn .caret {\n  margin-left: 0;\n}\n.btn-lg .caret {\n  border-width: 5px 5px 0;\n  border-bottom-width: 0;\n}\n.dropup .btn-lg .caret {\n  border-width: 0 5px 5px;\n}\n.btn-group-vertical > .btn,\n.btn-group-vertical > .btn-group,\n.btn-group-vertical > .btn-group > .btn {\n  display: block;\n  float: none;\n  width: 100%;\n  max-width: 100%;\n}\n.btn-group-vertical > .btn-group > .btn {\n  float: none;\n}\n.btn-group-vertical > .btn + .btn,\n.btn-group-vertical > .btn + .btn-group,\n.btn-group-vertical > .btn-group + .btn,\n.btn-group-vertical > .btn-group + .btn-group {\n  margin-top: -1px;\n  margin-left: 0;\n}\n.btn-group-vertical > .btn:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn:first-child:not(:last-child) {\n  border-top-right-radius: 4px;\n  border-top-left-radius: 4px;\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn:last-child:not(:first-child) {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.btn-group-justified {\n  display: table;\n  width: 100%;\n  table-layout: fixed;\n  border-collapse: separate;\n}\n.btn-group-justified > .btn,\n.btn-group-justified > .btn-group {\n  float: none;\n  display: table-cell;\n  width: 1%;\n}\n.btn-group-justified > .btn-group .btn {\n  width: 100%;\n}\n.btn-group-justified > .btn-group .dropdown-menu {\n  left: auto;\n}\n[data-toggle=\"buttons\"] > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn input[type=\"checkbox\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"checkbox\"] {\n  position: absolute;\n  clip: rect(0, 0, 0, 0);\n  pointer-events: none;\n}\n.input-group {\n  position: relative;\n  display: table;\n  border-collapse: separate;\n}\n.input-group[class*=\"col-\"] {\n  float: none;\n  padding-left: 0;\n  padding-right: 0;\n}\n.input-group .form-control {\n  position: relative;\n  z-index: 2;\n  float: left;\n  width: 100%;\n  margin-bottom: 0;\n}\n.input-group .form-control:focus {\n  z-index: 3;\n}\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn {\n  height: 66px;\n  padding: 18px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\nselect.input-group-lg > .form-control,\nselect.input-group-lg > .input-group-addon,\nselect.input-group-lg > .input-group-btn > .btn {\n  height: 66px;\n  line-height: 66px;\n}\ntextarea.input-group-lg > .form-control,\ntextarea.input-group-lg > .input-group-addon,\ntextarea.input-group-lg > .input-group-btn > .btn,\nselect[multiple].input-group-lg > .form-control,\nselect[multiple].input-group-lg > .input-group-addon,\nselect[multiple].input-group-lg > .input-group-btn > .btn {\n  height: auto;\n}\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn {\n  height: 35px;\n  padding: 6px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\nselect.input-group-sm > .form-control,\nselect.input-group-sm > .input-group-addon,\nselect.input-group-sm > .input-group-btn > .btn {\n  height: 35px;\n  line-height: 35px;\n}\ntextarea.input-group-sm > .form-control,\ntextarea.input-group-sm > .input-group-addon,\ntextarea.input-group-sm > .input-group-btn > .btn,\nselect[multiple].input-group-sm > .form-control,\nselect[multiple].input-group-sm > .input-group-addon,\nselect[multiple].input-group-sm > .input-group-btn > .btn {\n  height: auto;\n}\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n  display: table-cell;\n}\n.input-group-addon:not(:first-child):not(:last-child),\n.input-group-btn:not(:first-child):not(:last-child),\n.input-group .form-control:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n.input-group-addon,\n.input-group-btn {\n  width: 1%;\n  white-space: nowrap;\n  vertical-align: middle;\n}\n.input-group-addon {\n  padding: 10px 15px;\n  font-size: 15px;\n  font-weight: normal;\n  line-height: 1;\n  color: #FFFFFF;\n  text-align: center;\n  background-color: #ecf0f1;\n  border: 1px solid #dce4ec;\n  border-radius: 4px;\n}\n.input-group-addon.input-sm {\n  padding: 6px 9px;\n  font-size: 13px;\n  border-radius: 3px;\n}\n.input-group-addon.input-lg {\n  padding: 18px 27px;\n  font-size: 19px;\n  border-radius: 6px;\n}\n.input-group-addon input[type=\"radio\"],\n.input-group-addon input[type=\"checkbox\"] {\n  margin-top: 0;\n}\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),\n.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {\n  border-bottom-right-radius: 0;\n  border-top-right-radius: 0;\n}\n.input-group-addon:first-child {\n  border-right: 0;\n}\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child),\n.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n.input-group-addon:last-child {\n  border-left: 0;\n}\n.input-group-btn {\n  position: relative;\n  font-size: 0;\n  white-space: nowrap;\n}\n.input-group-btn > .btn {\n  position: relative;\n}\n.input-group-btn > .btn + .btn {\n  margin-left: -1px;\n}\n.input-group-btn > .btn:hover,\n.input-group-btn > .btn:focus,\n.input-group-btn > .btn:active {\n  z-index: 2;\n}\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group {\n  margin-right: -1px;\n}\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group {\n  z-index: 2;\n  margin-left: -1px;\n}\n.nav {\n  margin-bottom: 0;\n  padding-left: 0;\n  list-style: none;\n}\n.nav > li {\n  position: relative;\n  display: block;\n}\n.nav > li > a {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n}\n.nav > li > a:hover,\n.nav > li > a:focus {\n  text-decoration: none;\n  background-color: #ecf0f1;\n}\n.nav > li.disabled > a {\n  color: #b4bcc2;\n}\n.nav > li.disabled > a:hover,\n.nav > li.disabled > a:focus {\n  color: #b4bcc2;\n  text-decoration: none;\n  background-color: transparent;\n  cursor: not-allowed;\n}\n.nav .open > a,\n.nav .open > a:hover,\n.nav .open > a:focus {\n  background-color: #ecf0f1;\n  border-color: #ffbe00;\n}\n.nav .nav-divider {\n  height: 1px;\n  margin: 9.5px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n.nav > li > a > img {\n  max-width: none;\n}\n.nav-tabs {\n  border-bottom: 1px solid #ecf0f1;\n}\n.nav-tabs > li {\n  float: left;\n  margin-bottom: -1px;\n}\n.nav-tabs > li > a {\n  margin-right: 2px;\n  line-height: 1.42857143;\n  border: 1px solid transparent;\n  border-radius: 4px 4px 0 0;\n}\n.nav-tabs > li > a:hover {\n  border-color: #ecf0f1 #ecf0f1 #ecf0f1;\n}\n.nav-tabs > li.active > a,\n.nav-tabs > li.active > a:hover,\n.nav-tabs > li.active > a:focus {\n  color: #63ceca;\n  background-color: #002221;\n  border: 1px solid #ecf0f1;\n  border-bottom-color: transparent;\n  cursor: default;\n}\n.nav-tabs.nav-justified {\n  width: 100%;\n  border-bottom: 0;\n}\n.nav-tabs.nav-justified > li {\n  float: none;\n}\n.nav-tabs.nav-justified > li > a {\n  text-align: center;\n  margin-bottom: 5px;\n}\n.nav-tabs.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-tabs.nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n.nav-tabs.nav-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n.nav-tabs.nav-justified > .active > a,\n.nav-tabs.nav-justified > .active > a:hover,\n.nav-tabs.nav-justified > .active > a:focus {\n  border: 1px solid #ecf0f1;\n}\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li > a {\n    border-bottom: 1px solid #ecf0f1;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs.nav-justified > .active > a,\n  .nav-tabs.nav-justified > .active > a:hover,\n  .nav-tabs.nav-justified > .active > a:focus {\n    border-bottom-color: #002221;\n  }\n}\n.nav-pills > li {\n  float: left;\n}\n.nav-pills > li > a {\n  border-radius: 4px;\n}\n.nav-pills > li + li {\n  margin-left: 2px;\n}\n.nav-pills > li.active > a,\n.nav-pills > li.active > a:hover,\n.nav-pills > li.active > a:focus {\n  color: #fff;\n  background-color: #63ceca;\n}\n.nav-stacked > li {\n  float: none;\n}\n.nav-stacked > li + li {\n  margin-top: 2px;\n  margin-left: 0;\n}\n.nav-justified {\n  width: 100%;\n}\n.nav-justified > li {\n  float: none;\n}\n.nav-justified > li > a {\n  text-align: center;\n  margin-bottom: 5px;\n}\n.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n@media (min-width: 768px) {\n  .nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n.nav-tabs-justified {\n  border-bottom: 0;\n}\n.nav-tabs-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n.nav-tabs-justified > .active > a,\n.nav-tabs-justified > .active > a:hover,\n.nav-tabs-justified > .active > a:focus {\n  border: 1px solid #ecf0f1;\n}\n@media (min-width: 768px) {\n  .nav-tabs-justified > li > a {\n    border-bottom: 1px solid #ecf0f1;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs-justified > .active > a,\n  .nav-tabs-justified > .active > a:hover,\n  .nav-tabs-justified > .active > a:focus {\n    border-bottom-color: #002221;\n  }\n}\n.tab-content > .tab-pane {\n  display: none;\n}\n.tab-content > .active {\n  display: block;\n}\n.nav-tabs .dropdown-menu {\n  margin-top: -1px;\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.navbar {\n  position: relative;\n  min-height: 60px;\n  margin-bottom: 21px;\n  border: 1px solid transparent;\n}\n@media (min-width: 768px) {\n  .navbar {\n    border-radius: 4px;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-header {\n    float: left;\n  }\n}\n.navbar-collapse {\n  overflow-x: visible;\n  padding-right: 15px;\n  padding-left: 15px;\n  border-top: 1px solid transparent;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);\n  -webkit-overflow-scrolling: touch;\n}\n.navbar-collapse.in {\n  overflow-y: auto;\n}\n@media (min-width: 768px) {\n  .navbar-collapse {\n    width: auto;\n    border-top: 0;\n    box-shadow: none;\n  }\n  .navbar-collapse.collapse {\n    display: block !important;\n    height: auto !important;\n    padding-bottom: 0;\n    overflow: visible !important;\n  }\n  .navbar-collapse.in {\n    overflow-y: visible;\n  }\n  .navbar-fixed-top .navbar-collapse,\n  .navbar-static-top .navbar-collapse,\n  .navbar-fixed-bottom .navbar-collapse {\n    padding-left: 0;\n    padding-right: 0;\n  }\n}\n.navbar-fixed-top .navbar-collapse,\n.navbar-fixed-bottom .navbar-collapse {\n  max-height: 340px;\n}\n@media (max-device-width: 480px) and (orientation: landscape) {\n  .navbar-fixed-top .navbar-collapse,\n  .navbar-fixed-bottom .navbar-collapse {\n    max-height: 200px;\n  }\n}\n.container > .navbar-header,\n.container-fluid > .navbar-header,\n.container > .navbar-collapse,\n.container-fluid > .navbar-collapse {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n@media (min-width: 768px) {\n  .container > .navbar-header,\n  .container-fluid > .navbar-header,\n  .container > .navbar-collapse,\n  .container-fluid > .navbar-collapse {\n    margin-right: 0;\n    margin-left: 0;\n  }\n}\n.navbar-static-top {\n  z-index: 1000;\n  border-width: 0 0 1px;\n}\n@media (min-width: 768px) {\n  .navbar-static-top {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  position: fixed;\n  right: 0;\n  left: 0;\n  z-index: 1030;\n}\n@media (min-width: 768px) {\n  .navbar-fixed-top,\n  .navbar-fixed-bottom {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top {\n  top: 0;\n  border-width: 0 0 1px;\n}\n.navbar-fixed-bottom {\n  bottom: 0;\n  margin-bottom: 0;\n  border-width: 1px 0 0;\n}\n.navbar-brand {\n  float: left;\n  padding: 19.5px 15px;\n  font-size: 19px;\n  line-height: 21px;\n  height: 60px;\n}\n.navbar-brand:hover,\n.navbar-brand:focus {\n  text-decoration: none;\n}\n.navbar-brand > img {\n  display: block;\n}\n@media (min-width: 768px) {\n  .navbar > .container .navbar-brand,\n  .navbar > .container-fluid .navbar-brand {\n    margin-left: -15px;\n  }\n}\n.navbar-toggle {\n  position: relative;\n  float: right;\n  margin-right: 15px;\n  padding: 9px 10px;\n  margin-top: 13px;\n  margin-bottom: 13px;\n  background-color: transparent;\n  background-image: none;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n.navbar-toggle:focus {\n  outline: 0;\n}\n.navbar-toggle .icon-bar {\n  display: block;\n  width: 22px;\n  height: 2px;\n  border-radius: 1px;\n}\n.navbar-toggle .icon-bar + .icon-bar {\n  margin-top: 4px;\n}\n@media (min-width: 768px) {\n  .navbar-toggle {\n    display: none;\n  }\n}\n.navbar-nav {\n  margin: 9.75px -15px;\n}\n.navbar-nav > li > a {\n  padding-top: 10px;\n  padding-bottom: 10px;\n  line-height: 21px;\n}\n@media (max-width: 767px) {\n  .navbar-nav .open .dropdown-menu {\n    position: static;\n    float: none;\n    width: auto;\n    margin-top: 0;\n    background-color: transparent;\n    border: 0;\n    box-shadow: none;\n  }\n  .navbar-nav .open .dropdown-menu > li > a,\n  .navbar-nav .open .dropdown-menu .dropdown-header {\n    padding: 5px 15px 5px 25px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a {\n    line-height: 21px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-nav .open .dropdown-menu > li > a:focus {\n    background-image: none;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-nav {\n    float: left;\n    margin: 0;\n  }\n  .navbar-nav > li {\n    float: left;\n  }\n  .navbar-nav > li > a {\n    padding-top: 19.5px;\n    padding-bottom: 19.5px;\n  }\n}\n.navbar-form {\n  margin-left: -15px;\n  margin-right: -15px;\n  padding: 10px 15px;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid transparent;\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);\n  margin-top: 7.5px;\n  margin-bottom: 7.5px;\n}\n@media (min-width: 768px) {\n  .navbar-form .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .form-control {\n    display: inline-block;\n    width: auto;\n    vertical-align: middle;\n  }\n  .navbar-form .form-control-static {\n    display: inline-block;\n  }\n  .navbar-form .input-group {\n    display: inline-table;\n    vertical-align: middle;\n  }\n  .navbar-form .input-group .input-group-addon,\n  .navbar-form .input-group .input-group-btn,\n  .navbar-form .input-group .form-control {\n    width: auto;\n  }\n  .navbar-form .input-group > .form-control {\n    width: 100%;\n  }\n  .navbar-form .control-label {\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .radio,\n  .navbar-form .checkbox {\n    display: inline-block;\n    margin-top: 0;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .radio label,\n  .navbar-form .checkbox label {\n    padding-left: 0;\n  }\n  .navbar-form .radio input[type=\"radio\"],\n  .navbar-form .checkbox input[type=\"checkbox\"] {\n    position: relative;\n    margin-left: 0;\n  }\n  .navbar-form .has-feedback .form-control-feedback {\n    top: 0;\n  }\n}\n@media (max-width: 767px) {\n  .navbar-form .form-group {\n    margin-bottom: 5px;\n  }\n  .navbar-form .form-group:last-child {\n    margin-bottom: 0;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-form {\n    width: auto;\n    border: 0;\n    margin-left: 0;\n    margin-right: 0;\n    padding-top: 0;\n    padding-bottom: 0;\n    -webkit-box-shadow: none;\n    box-shadow: none;\n  }\n}\n.navbar-nav > li > .dropdown-menu {\n  margin-top: 0;\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n  margin-bottom: 0;\n  border-top-right-radius: 4px;\n  border-top-left-radius: 4px;\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.navbar-btn {\n  margin-top: 7.5px;\n  margin-bottom: 7.5px;\n}\n.navbar-btn.btn-sm {\n  margin-top: 12.5px;\n  margin-bottom: 12.5px;\n}\n.navbar-btn.btn-xs {\n  margin-top: 19px;\n  margin-bottom: 19px;\n}\n.navbar-text {\n  margin-top: 19.5px;\n  margin-bottom: 19.5px;\n}\n@media (min-width: 768px) {\n  .navbar-text {\n    float: left;\n    margin-left: 15px;\n    margin-right: 15px;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-left {\n    float: left !important;\n  }\n  .navbar-right {\n    float: right !important;\n    margin-right: -15px;\n  }\n  .navbar-right ~ .navbar-right {\n    margin-right: 0;\n  }\n}\n.navbar-default {\n  background-color: #63ceca;\n  border-color: transparent;\n}\n.navbar-default .navbar-brand {\n  color: #fff;\n}\n.navbar-default .navbar-brand:hover,\n.navbar-default .navbar-brand:focus {\n  color: #ffbe00;\n  background-color: transparent;\n}\n.navbar-default .navbar-text {\n  color: #fff;\n}\n.navbar-default .navbar-nav > li > a {\n  color: #fff;\n}\n.navbar-default .navbar-nav > li > a:hover,\n.navbar-default .navbar-nav > li > a:focus {\n  color: #ffbe00;\n  background-color: transparent;\n}\n.navbar-default .navbar-nav > .active > a,\n.navbar-default .navbar-nav > .active > a:hover,\n.navbar-default .navbar-nav > .active > a:focus {\n  color: #fff;\n  background-color: #3dc1bc;\n}\n.navbar-default .navbar-nav > .disabled > a,\n.navbar-default .navbar-nav > .disabled > a:hover,\n.navbar-default .navbar-nav > .disabled > a:focus {\n  color: #ccc;\n  background-color: transparent;\n}\n.navbar-default .navbar-toggle {\n  border-color: #3dc1bc;\n}\n.navbar-default .navbar-toggle:hover,\n.navbar-default .navbar-toggle:focus {\n  background-color: #3dc1bc;\n}\n.navbar-default .navbar-toggle .icon-bar {\n  background-color: #fff;\n}\n.navbar-default .navbar-collapse,\n.navbar-default .navbar-form {\n  border-color: transparent;\n}\n.navbar-default .navbar-nav > .open > a,\n.navbar-default .navbar-nav > .open > a:hover,\n.navbar-default .navbar-nav > .open > a:focus {\n  background-color: #3dc1bc;\n  color: #fff;\n}\n@media (max-width: 767px) {\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a {\n    color: #fff;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #ffbe00;\n    background-color: transparent;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #fff;\n    background-color: #3dc1bc;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #ccc;\n    background-color: transparent;\n  }\n}\n.navbar-default .navbar-link {\n  color: #fff;\n}\n.navbar-default .navbar-link:hover {\n  color: #ffbe00;\n}\n.navbar-default .btn-link {\n  color: #fff;\n}\n.navbar-default .btn-link:hover,\n.navbar-default .btn-link:focus {\n  color: #ffbe00;\n}\n.navbar-default .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-default .btn-link:hover,\n.navbar-default .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-default .btn-link:focus {\n  color: #ccc;\n}\n.navbar-inverse {\n  background-color: #ffbe00;\n  border-color: transparent;\n}\n.navbar-inverse .navbar-brand {\n  color: #fff;\n}\n.navbar-inverse .navbar-brand:hover,\n.navbar-inverse .navbar-brand:focus {\n  color: #63ceca;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-text {\n  color: #fff;\n}\n.navbar-inverse .navbar-nav > li > a {\n  color: #fff;\n}\n.navbar-inverse .navbar-nav > li > a:hover,\n.navbar-inverse .navbar-nav > li > a:focus {\n  color: #63ceca;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-nav > .active > a,\n.navbar-inverse .navbar-nav > .active > a:hover,\n.navbar-inverse .navbar-nav > .active > a:focus {\n  color: #fff;\n  background-color: #e6ab00;\n}\n.navbar-inverse .navbar-nav > .disabled > a,\n.navbar-inverse .navbar-nav > .disabled > a:hover,\n.navbar-inverse .navbar-nav > .disabled > a:focus {\n  color: #ccc;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-toggle {\n  border-color: #cc9800;\n}\n.navbar-inverse .navbar-toggle:hover,\n.navbar-inverse .navbar-toggle:focus {\n  background-color: #cc9800;\n}\n.navbar-inverse .navbar-toggle .icon-bar {\n  background-color: #fff;\n}\n.navbar-inverse .navbar-collapse,\n.navbar-inverse .navbar-form {\n  border-color: #dba300;\n}\n.navbar-inverse .navbar-nav > .open > a,\n.navbar-inverse .navbar-nav > .open > a:hover,\n.navbar-inverse .navbar-nav > .open > a:focus {\n  background-color: #e6ab00;\n  color: #fff;\n}\n@media (max-width: 767px) {\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {\n    border-color: transparent;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu .divider {\n    background-color: transparent;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a {\n    color: #fff;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #63ceca;\n    background-color: transparent;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #fff;\n    background-color: #e6ab00;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #ccc;\n    background-color: transparent;\n  }\n}\n.navbar-inverse .navbar-link {\n  color: #fff;\n}\n.navbar-inverse .navbar-link:hover {\n  color: #63ceca;\n}\n.navbar-inverse .btn-link {\n  color: #fff;\n}\n.navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link:focus {\n  color: #63ceca;\n}\n.navbar-inverse .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-inverse .btn-link:focus {\n  color: #ccc;\n}\n.breadcrumb {\n  padding: 8px 15px;\n  margin-bottom: 21px;\n  list-style: none;\n  background-color: #ecf0f1;\n  border-radius: 4px;\n}\n.breadcrumb > li {\n  display: inline-block;\n}\n.breadcrumb > li + li:before {\n  content: \"/\\00a0\";\n  padding: 0 5px;\n  color: #ccc;\n}\n.breadcrumb > .active {\n  color: #95a5a6;\n}\n.pagination {\n  display: inline-block;\n  padding-left: 0;\n  margin: 21px 0;\n  border-radius: 4px;\n}\n.pagination > li {\n  display: inline;\n}\n.pagination > li > a,\n.pagination > li > span {\n  position: relative;\n  float: left;\n  padding: 10px 15px;\n  line-height: 1.42857143;\n  text-decoration: none;\n  color: #fff;\n  background-color: #ffbe00;\n  border: 1px solid transparent;\n  margin-left: -1px;\n}\n.pagination > li:first-child > a,\n.pagination > li:first-child > span {\n  margin-left: 0;\n  border-bottom-left-radius: 4px;\n  border-top-left-radius: 4px;\n}\n.pagination > li:last-child > a,\n.pagination > li:last-child > span {\n  border-bottom-right-radius: 4px;\n  border-top-right-radius: 4px;\n}\n.pagination > li > a:hover,\n.pagination > li > span:hover,\n.pagination > li > a:focus,\n.pagination > li > span:focus {\n  z-index: 2;\n  color: #fff;\n  background-color: #b38500;\n  border-color: transparent;\n}\n.pagination > .active > a,\n.pagination > .active > span,\n.pagination > .active > a:hover,\n.pagination > .active > span:hover,\n.pagination > .active > a:focus,\n.pagination > .active > span:focus {\n  z-index: 3;\n  color: #fff;\n  background-color: #b38500;\n  border-color: transparent;\n  cursor: default;\n}\n.pagination > .disabled > span,\n.pagination > .disabled > span:hover,\n.pagination > .disabled > span:focus,\n.pagination > .disabled > a,\n.pagination > .disabled > a:hover,\n.pagination > .disabled > a:focus {\n  color: #ecf0f1;\n  background-color: #ffd14d;\n  border-color: transparent;\n  cursor: not-allowed;\n}\n.pagination-lg > li > a,\n.pagination-lg > li > span {\n  padding: 18px 27px;\n  font-size: 19px;\n  line-height: 1.3333333;\n}\n.pagination-lg > li:first-child > a,\n.pagination-lg > li:first-child > span {\n  border-bottom-left-radius: 6px;\n  border-top-left-radius: 6px;\n}\n.pagination-lg > li:last-child > a,\n.pagination-lg > li:last-child > span {\n  border-bottom-right-radius: 6px;\n  border-top-right-radius: 6px;\n}\n.pagination-sm > li > a,\n.pagination-sm > li > span {\n  padding: 6px 9px;\n  font-size: 13px;\n  line-height: 1.5;\n}\n.pagination-sm > li:first-child > a,\n.pagination-sm > li:first-child > span {\n  border-bottom-left-radius: 3px;\n  border-top-left-radius: 3px;\n}\n.pagination-sm > li:last-child > a,\n.pagination-sm > li:last-child > span {\n  border-bottom-right-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.pager {\n  padding-left: 0;\n  margin: 21px 0;\n  list-style: none;\n  text-align: center;\n}\n.pager li {\n  display: inline;\n}\n.pager li > a,\n.pager li > span {\n  display: inline-block;\n  padding: 5px 14px;\n  background-color: #ffbe00;\n  border: 1px solid transparent;\n  border-radius: 15px;\n}\n.pager li > a:hover,\n.pager li > a:focus {\n  text-decoration: none;\n  background-color: #b38500;\n}\n.pager .next > a,\n.pager .next > span {\n  float: right;\n}\n.pager .previous > a,\n.pager .previous > span {\n  float: left;\n}\n.pager .disabled > a,\n.pager .disabled > a:hover,\n.pager .disabled > a:focus,\n.pager .disabled > span {\n  color: #fff;\n  background-color: #ffbe00;\n  cursor: not-allowed;\n}\n.label {\n  display: inline;\n  padding: .2em .6em .3em;\n  font-size: 75%;\n  font-weight: bold;\n  line-height: 1;\n  color: #fff;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  border-radius: .25em;\n}\na.label:hover,\na.label:focus {\n  color: #fff;\n  text-decoration: none;\n  cursor: pointer;\n}\n.label:empty {\n  display: none;\n}\n.btn .label {\n  position: relative;\n  top: -1px;\n}\n.label-default {\n  background-color: #95a5a6;\n}\n.label-default[href]:hover,\n.label-default[href]:focus {\n  background-color: #798d8f;\n}\n.label-primary {\n  background-color: #63ceca;\n}\n.label-primary[href]:hover,\n.label-primary[href]:focus {\n  background-color: #3dc1bc;\n}\n.label-success {\n  background-color: #ffbe00;\n}\n.label-success[href]:hover,\n.label-success[href]:focus {\n  background-color: #cc9800;\n}\n.label-info {\n  background-color: #3498DB;\n}\n.label-info[href]:hover,\n.label-info[href]:focus {\n  background-color: #217dbb;\n}\n.label-warning {\n  background-color: #F39C12;\n}\n.label-warning[href]:hover,\n.label-warning[href]:focus {\n  background-color: #c87f0a;\n}\n.label-danger {\n  background-color: #E74C3C;\n}\n.label-danger[href]:hover,\n.label-danger[href]:focus {\n  background-color: #d62c1a;\n}\n.badge {\n  display: inline-block;\n  min-width: 10px;\n  padding: 3px 7px;\n  font-size: 13px;\n  font-weight: bold;\n  color: #fff;\n  line-height: 1;\n  vertical-align: middle;\n  white-space: nowrap;\n  text-align: center;\n  background-color: #63ceca;\n  border-radius: 10px;\n}\n.badge:empty {\n  display: none;\n}\n.btn .badge {\n  position: relative;\n  top: -1px;\n}\n.btn-xs .badge,\n.btn-group-xs > .btn .badge {\n  top: 0;\n  padding: 1px 5px;\n}\na.badge:hover,\na.badge:focus {\n  color: #fff;\n  text-decoration: none;\n  cursor: pointer;\n}\n.list-group-item.active > .badge,\n.nav-pills > .active > a > .badge {\n  color: #63ceca;\n  background-color: #fff;\n}\n.list-group-item > .badge {\n  float: right;\n}\n.list-group-item > .badge + .badge {\n  margin-right: 5px;\n}\n.nav-pills > li > a > .badge {\n  margin-left: 3px;\n}\n.jumbotron {\n  padding-top: 30px;\n  padding-bottom: 30px;\n  margin-bottom: 30px;\n  color: inherit;\n  background-color: #ecf0f1;\n}\n.jumbotron h1,\n.jumbotron .h1 {\n  color: inherit;\n}\n.jumbotron p {\n  margin-bottom: 15px;\n  font-size: 23px;\n  font-weight: 200;\n}\n.jumbotron > hr {\n  border-top-color: #cfd9db;\n}\n.container .jumbotron,\n.container-fluid .jumbotron {\n  border-radius: 6px;\n  padding-left: 15px;\n  padding-right: 15px;\n}\n.jumbotron .container {\n  max-width: 100%;\n}\n@media screen and (min-width: 768px) {\n  .jumbotron {\n    padding-top: 48px;\n    padding-bottom: 48px;\n  }\n  .container .jumbotron,\n  .container-fluid .jumbotron {\n    padding-left: 60px;\n    padding-right: 60px;\n  }\n  .jumbotron h1,\n  .jumbotron .h1 {\n    font-size: 68px;\n  }\n}\n.thumbnail {\n  display: block;\n  padding: 4px;\n  margin-bottom: 21px;\n  line-height: 1.42857143;\n  background-color: #002221;\n  border: 1px solid #ecf0f1;\n  border-radius: 4px;\n  -webkit-transition: border 0.2s ease-in-out;\n  -o-transition: border 0.2s ease-in-out;\n  transition: border 0.2s ease-in-out;\n}\n.thumbnail > img,\n.thumbnail a > img {\n  margin-left: auto;\n  margin-right: auto;\n}\na.thumbnail:hover,\na.thumbnail:focus,\na.thumbnail.active {\n  border-color: #ffbe00;\n}\n.thumbnail .caption {\n  padding: 9px;\n  color: #FFFFFF;\n}\n.alert {\n  padding: 15px;\n  margin-bottom: 21px;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n.alert h4 {\n  margin-top: 0;\n  color: inherit;\n}\n.alert .alert-link {\n  font-weight: bold;\n}\n.alert > p,\n.alert > ul {\n  margin-bottom: 0;\n}\n.alert > p + p {\n  margin-top: 5px;\n}\n.alert-dismissable,\n.alert-dismissible {\n  padding-right: 35px;\n}\n.alert-dismissable .close,\n.alert-dismissible .close {\n  position: relative;\n  top: -2px;\n  right: -21px;\n  color: inherit;\n}\n.alert-success {\n  background-color: #ffbe00;\n  border-color: #ffbe00;\n  color: #fff;\n}\n.alert-success hr {\n  border-top-color: #e6ab00;\n}\n.alert-success .alert-link {\n  color: #e6e6e6;\n}\n.alert-info {\n  background-color: #3498DB;\n  border-color: #3498DB;\n  color: #fff;\n}\n.alert-info hr {\n  border-top-color: #258cd1;\n}\n.alert-info .alert-link {\n  color: #e6e6e6;\n}\n.alert-warning {\n  background-color: #F39C12;\n  border-color: #F39C12;\n  color: #fff;\n}\n.alert-warning hr {\n  border-top-color: #e08e0b;\n}\n.alert-warning .alert-link {\n  color: #e6e6e6;\n}\n.alert-danger {\n  background-color: #E74C3C;\n  border-color: #E74C3C;\n  color: #fff;\n}\n.alert-danger hr {\n  border-top-color: #e43725;\n}\n.alert-danger .alert-link {\n  color: #e6e6e6;\n}\n@-webkit-keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n@keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n.progress {\n  overflow: hidden;\n  height: 21px;\n  margin-bottom: 21px;\n  background-color: #ecf0f1;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n}\n.progress-bar {\n  float: left;\n  width: 0%;\n  height: 100%;\n  font-size: 13px;\n  line-height: 21px;\n  color: #fff;\n  text-align: center;\n  background-color: #63ceca;\n  -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n  -webkit-transition: width 0.6s ease;\n  -o-transition: width 0.6s ease;\n  transition: width 0.6s ease;\n}\n.progress-striped .progress-bar,\n.progress-bar-striped {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-size: 40px 40px;\n}\n.progress.active .progress-bar,\n.progress-bar.active {\n  -webkit-animation: progress-bar-stripes 2s linear infinite;\n  -o-animation: progress-bar-stripes 2s linear infinite;\n  animation: progress-bar-stripes 2s linear infinite;\n}\n.progress-bar-success {\n  background-color: #ffbe00;\n}\n.progress-striped .progress-bar-success {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n.progress-bar-info {\n  background-color: #3498DB;\n}\n.progress-striped .progress-bar-info {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n.progress-bar-warning {\n  background-color: #F39C12;\n}\n.progress-striped .progress-bar-warning {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n.progress-bar-danger {\n  background-color: #E74C3C;\n}\n.progress-striped .progress-bar-danger {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n.media {\n  margin-top: 15px;\n}\n.media:first-child {\n  margin-top: 0;\n}\n.media,\n.media-body {\n  zoom: 1;\n  overflow: hidden;\n}\n.media-body {\n  width: 10000px;\n}\n.media-object {\n  display: block;\n}\n.media-object.img-thumbnail {\n  max-width: none;\n}\n.media-right,\n.media > .pull-right {\n  padding-left: 10px;\n}\n.media-left,\n.media > .pull-left {\n  padding-right: 10px;\n}\n.media-left,\n.media-right,\n.media-body {\n  display: table-cell;\n  vertical-align: top;\n}\n.media-middle {\n  vertical-align: middle;\n}\n.media-bottom {\n  vertical-align: bottom;\n}\n.media-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.media-list {\n  padding-left: 0;\n  list-style: none;\n}\n.list-group {\n  margin-bottom: 20px;\n  padding-left: 0;\n}\n.list-group-item {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n  margin-bottom: -1px;\n  background-color: #fff;\n  border: 1px solid #ecf0f1;\n}\n.list-group-item:first-child {\n  border-top-right-radius: 4px;\n  border-top-left-radius: 4px;\n}\n.list-group-item:last-child {\n  margin-bottom: 0;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\na.list-group-item,\nbutton.list-group-item {\n  color: #555;\n}\na.list-group-item .list-group-item-heading,\nbutton.list-group-item .list-group-item-heading {\n  color: #333;\n}\na.list-group-item:hover,\nbutton.list-group-item:hover,\na.list-group-item:focus,\nbutton.list-group-item:focus {\n  text-decoration: none;\n  color: #555;\n  background-color: #ecf0f1;\n}\nbutton.list-group-item {\n  width: 100%;\n  text-align: left;\n}\n.list-group-item.disabled,\n.list-group-item.disabled:hover,\n.list-group-item.disabled:focus {\n  background-color: #ecf0f1;\n  color: #b4bcc2;\n  cursor: not-allowed;\n}\n.list-group-item.disabled .list-group-item-heading,\n.list-group-item.disabled:hover .list-group-item-heading,\n.list-group-item.disabled:focus .list-group-item-heading {\n  color: inherit;\n}\n.list-group-item.disabled .list-group-item-text,\n.list-group-item.disabled:hover .list-group-item-text,\n.list-group-item.disabled:focus .list-group-item-text {\n  color: #b4bcc2;\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n  z-index: 2;\n  color: #fff;\n  background-color: #63ceca;\n  border-color: #63ceca;\n}\n.list-group-item.active .list-group-item-heading,\n.list-group-item.active:hover .list-group-item-heading,\n.list-group-item.active:focus .list-group-item-heading,\n.list-group-item.active .list-group-item-heading > small,\n.list-group-item.active:hover .list-group-item-heading > small,\n.list-group-item.active:focus .list-group-item-heading > small,\n.list-group-item.active .list-group-item-heading > .small,\n.list-group-item.active:hover .list-group-item-heading > .small,\n.list-group-item.active:focus .list-group-item-heading > .small {\n  color: inherit;\n}\n.list-group-item.active .list-group-item-text,\n.list-group-item.active:hover .list-group-item-text,\n.list-group-item.active:focus .list-group-item-text {\n  color: #feffff;\n}\n.list-group-item-success {\n  color: #fff;\n  background-color: #ffbe00;\n}\na.list-group-item-success,\nbutton.list-group-item-success {\n  color: #fff;\n}\na.list-group-item-success .list-group-item-heading,\nbutton.list-group-item-success .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-success:hover,\nbutton.list-group-item-success:hover,\na.list-group-item-success:focus,\nbutton.list-group-item-success:focus {\n  color: #fff;\n  background-color: #e6ab00;\n}\na.list-group-item-success.active,\nbutton.list-group-item-success.active,\na.list-group-item-success.active:hover,\nbutton.list-group-item-success.active:hover,\na.list-group-item-success.active:focus,\nbutton.list-group-item-success.active:focus {\n  color: #fff;\n  background-color: #fff;\n  border-color: #fff;\n}\n.list-group-item-info {\n  color: #fff;\n  background-color: #3498DB;\n}\na.list-group-item-info,\nbutton.list-group-item-info {\n  color: #fff;\n}\na.list-group-item-info .list-group-item-heading,\nbutton.list-group-item-info .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-info:hover,\nbutton.list-group-item-info:hover,\na.list-group-item-info:focus,\nbutton.list-group-item-info:focus {\n  color: #fff;\n  background-color: #258cd1;\n}\na.list-group-item-info.active,\nbutton.list-group-item-info.active,\na.list-group-item-info.active:hover,\nbutton.list-group-item-info.active:hover,\na.list-group-item-info.active:focus,\nbutton.list-group-item-info.active:focus {\n  color: #fff;\n  background-color: #fff;\n  border-color: #fff;\n}\n.list-group-item-warning {\n  color: #fff;\n  background-color: #F39C12;\n}\na.list-group-item-warning,\nbutton.list-group-item-warning {\n  color: #fff;\n}\na.list-group-item-warning .list-group-item-heading,\nbutton.list-group-item-warning .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-warning:hover,\nbutton.list-group-item-warning:hover,\na.list-group-item-warning:focus,\nbutton.list-group-item-warning:focus {\n  color: #fff;\n  background-color: #e08e0b;\n}\na.list-group-item-warning.active,\nbutton.list-group-item-warning.active,\na.list-group-item-warning.active:hover,\nbutton.list-group-item-warning.active:hover,\na.list-group-item-warning.active:focus,\nbutton.list-group-item-warning.active:focus {\n  color: #fff;\n  background-color: #fff;\n  border-color: #fff;\n}\n.list-group-item-danger {\n  color: #fff;\n  background-color: #E74C3C;\n}\na.list-group-item-danger,\nbutton.list-group-item-danger {\n  color: #fff;\n}\na.list-group-item-danger .list-group-item-heading,\nbutton.list-group-item-danger .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-danger:hover,\nbutton.list-group-item-danger:hover,\na.list-group-item-danger:focus,\nbutton.list-group-item-danger:focus {\n  color: #fff;\n  background-color: #e43725;\n}\na.list-group-item-danger.active,\nbutton.list-group-item-danger.active,\na.list-group-item-danger.active:hover,\nbutton.list-group-item-danger.active:hover,\na.list-group-item-danger.active:focus,\nbutton.list-group-item-danger.active:focus {\n  color: #fff;\n  background-color: #fff;\n  border-color: #fff;\n}\n.list-group-item-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.list-group-item-text {\n  margin-bottom: 0;\n  line-height: 1.3;\n}\n.panel {\n  margin-bottom: 21px;\n  background-color: #fff;\n  border: 1px solid transparent;\n  border-radius: 4px;\n  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);\n  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);\n}\n.panel-body {\n  padding: 15px;\n}\n.panel-heading {\n  padding: 10px 15px;\n  border-bottom: 1px solid transparent;\n  border-top-right-radius: 3px;\n  border-top-left-radius: 3px;\n}\n.panel-heading > .dropdown .dropdown-toggle {\n  color: inherit;\n}\n.panel-title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-size: 17px;\n  color: inherit;\n}\n.panel-title > a,\n.panel-title > small,\n.panel-title > .small,\n.panel-title > small > a,\n.panel-title > .small > a {\n  color: inherit;\n}\n.panel-footer {\n  padding: 10px 15px;\n  background-color: #ecf0f1;\n  border-top: 1px solid #ecf0f1;\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .list-group,\n.panel > .panel-collapse > .list-group {\n  margin-bottom: 0;\n}\n.panel > .list-group .list-group-item,\n.panel > .panel-collapse > .list-group .list-group-item {\n  border-width: 1px 0;\n  border-radius: 0;\n}\n.panel > .list-group:first-child .list-group-item:first-child,\n.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child {\n  border-top: 0;\n  border-top-right-radius: 3px;\n  border-top-left-radius: 3px;\n}\n.panel > .list-group:last-child .list-group-item:last-child,\n.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child {\n  border-bottom: 0;\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.panel-heading + .list-group .list-group-item:first-child {\n  border-top-width: 0;\n}\n.list-group + .panel-footer {\n  border-top-width: 0;\n}\n.panel > .table,\n.panel > .table-responsive > .table,\n.panel > .panel-collapse > .table {\n  margin-bottom: 0;\n}\n.panel > .table caption,\n.panel > .table-responsive > .table caption,\n.panel > .panel-collapse > .table caption {\n  padding-left: 15px;\n  padding-right: 15px;\n}\n.panel > .table:first-child,\n.panel > .table-responsive:first-child > .table:first-child {\n  border-top-right-radius: 3px;\n  border-top-left-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child {\n  border-top-left-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {\n  border-top-left-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {\n  border-top-right-radius: 3px;\n}\n.panel > .table:last-child,\n.panel > .table-responsive:last-child > .table:last-child {\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child {\n  border-bottom-left-radius: 3px;\n  border-bottom-right-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {\n  border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {\n  border-bottom-right-radius: 3px;\n}\n.panel > .panel-body + .table,\n.panel > .panel-body + .table-responsive,\n.panel > .table + .panel-body,\n.panel > .table-responsive + .panel-body {\n  border-top: 1px solid #ecf0f1;\n}\n.panel > .table > tbody:first-child > tr:first-child th,\n.panel > .table > tbody:first-child > tr:first-child td {\n  border-top: 0;\n}\n.panel > .table-bordered,\n.panel > .table-responsive > .table-bordered {\n  border: 0;\n}\n.panel > .table-bordered > thead > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,\n.panel > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-bordered > thead > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,\n.panel > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-bordered > tfoot > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n  border-left: 0;\n}\n.panel > .table-bordered > thead > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,\n.panel > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-bordered > thead > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,\n.panel > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-bordered > tfoot > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n  border-right: 0;\n}\n.panel > .table-bordered > thead > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,\n.panel > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-bordered > thead > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,\n.panel > .table-bordered > tbody > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {\n  border-bottom: 0;\n}\n.panel > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-bordered > tfoot > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {\n  border-bottom: 0;\n}\n.panel > .table-responsive {\n  border: 0;\n  margin-bottom: 0;\n}\n.panel-group {\n  margin-bottom: 21px;\n}\n.panel-group .panel {\n  margin-bottom: 0;\n  border-radius: 4px;\n}\n.panel-group .panel + .panel {\n  margin-top: 5px;\n}\n.panel-group .panel-heading {\n  border-bottom: 0;\n}\n.panel-group .panel-heading + .panel-collapse > .panel-body,\n.panel-group .panel-heading + .panel-collapse > .list-group {\n  border-top: 1px solid #ecf0f1;\n}\n.panel-group .panel-footer {\n  border-top: 0;\n}\n.panel-group .panel-footer + .panel-collapse .panel-body {\n  border-bottom: 1px solid #ecf0f1;\n}\n.panel-default {\n  border-color: #ecf0f1;\n}\n.panel-default > .panel-heading {\n  color: #FFFFFF;\n  background-color: #ecf0f1;\n  border-color: #ecf0f1;\n}\n.panel-default > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #ecf0f1;\n}\n.panel-default > .panel-heading .badge {\n  color: #ecf0f1;\n  background-color: #FFFFFF;\n}\n.panel-default > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #ecf0f1;\n}\n.panel-primary {\n  border-color: #63ceca;\n}\n.panel-primary > .panel-heading {\n  color: #fff;\n  background-color: #63ceca;\n  border-color: #63ceca;\n}\n.panel-primary > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #63ceca;\n}\n.panel-primary > .panel-heading .badge {\n  color: #63ceca;\n  background-color: #fff;\n}\n.panel-primary > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #63ceca;\n}\n.panel-success {\n  border-color: #ffbe00;\n}\n.panel-success > .panel-heading {\n  color: #fff;\n  background-color: #ffbe00;\n  border-color: #ffbe00;\n}\n.panel-success > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #ffbe00;\n}\n.panel-success > .panel-heading .badge {\n  color: #ffbe00;\n  background-color: #fff;\n}\n.panel-success > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #ffbe00;\n}\n.panel-info {\n  border-color: #3498DB;\n}\n.panel-info > .panel-heading {\n  color: #fff;\n  background-color: #3498DB;\n  border-color: #3498DB;\n}\n.panel-info > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #3498DB;\n}\n.panel-info > .panel-heading .badge {\n  color: #3498DB;\n  background-color: #fff;\n}\n.panel-info > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #3498DB;\n}\n.panel-warning {\n  border-color: #F39C12;\n}\n.panel-warning > .panel-heading {\n  color: #fff;\n  background-color: #F39C12;\n  border-color: #F39C12;\n}\n.panel-warning > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #F39C12;\n}\n.panel-warning > .panel-heading .badge {\n  color: #F39C12;\n  background-color: #fff;\n}\n.panel-warning > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #F39C12;\n}\n.panel-danger {\n  border-color: #E74C3C;\n}\n.panel-danger > .panel-heading {\n  color: #fff;\n  background-color: #E74C3C;\n  border-color: #E74C3C;\n}\n.panel-danger > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #E74C3C;\n}\n.panel-danger > .panel-heading .badge {\n  color: #E74C3C;\n  background-color: #fff;\n}\n.panel-danger > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #E74C3C;\n}\n.embed-responsive {\n  position: relative;\n  display: block;\n  height: 0;\n  padding: 0;\n  overflow: hidden;\n}\n.embed-responsive .embed-responsive-item,\n.embed-responsive iframe,\n.embed-responsive embed,\n.embed-responsive object,\n.embed-responsive video {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  height: 100%;\n  width: 100%;\n  border: 0;\n}\n.embed-responsive-16by9 {\n  padding-bottom: 56.25%;\n}\n.embed-responsive-4by3 {\n  padding-bottom: 75%;\n}\n.well {\n  min-height: 20px;\n  padding: 19px;\n  margin-bottom: 20px;\n  background-color: #ecf0f1;\n  border: 1px solid transparent;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n}\n.well blockquote {\n  border-color: #ddd;\n  border-color: rgba(0, 0, 0, 0.15);\n}\n.well-lg {\n  padding: 24px;\n  border-radius: 6px;\n}\n.well-sm {\n  padding: 9px;\n  border-radius: 3px;\n}\n.close {\n  float: right;\n  font-size: 22.5px;\n  font-weight: bold;\n  line-height: 1;\n  color: #000;\n  text-shadow: none;\n  opacity: 0.2;\n  filter: alpha(opacity=20);\n}\n.close:hover,\n.close:focus {\n  color: #000;\n  text-decoration: none;\n  cursor: pointer;\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n}\nbutton.close {\n  padding: 0;\n  cursor: pointer;\n  background: transparent;\n  border: 0;\n  -webkit-appearance: none;\n}\n.modal-open {\n  overflow: hidden;\n}\n.modal {\n  display: none;\n  overflow: hidden;\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1050;\n  -webkit-overflow-scrolling: touch;\n  outline: 0;\n}\n.modal.fade .modal-dialog {\n  -webkit-transform: translate(0, -25%);\n  -ms-transform: translate(0, -25%);\n  -o-transform: translate(0, -25%);\n  transform: translate(0, -25%);\n  -webkit-transition: -webkit-transform 0.3s ease-out;\n  -moz-transition: -moz-transform 0.3s ease-out;\n  -o-transition: -o-transform 0.3s ease-out;\n  transition: transform 0.3s ease-out;\n}\n.modal.in .modal-dialog {\n  -webkit-transform: translate(0, 0);\n  -ms-transform: translate(0, 0);\n  -o-transform: translate(0, 0);\n  transform: translate(0, 0);\n}\n.modal-open .modal {\n  overflow-x: hidden;\n  overflow-y: auto;\n}\n.modal-dialog {\n  position: relative;\n  width: auto;\n  margin: 10px;\n}\n.modal-content {\n  position: relative;\n  background-color: #fff;\n  border: 1px solid #999;\n  border: 1px solid rgba(0, 0, 0, 0.2);\n  border-radius: 6px;\n  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);\n  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);\n  background-clip: padding-box;\n  outline: 0;\n}\n.modal-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1040;\n  background-color: #000;\n}\n.modal-backdrop.fade {\n  opacity: 0;\n  filter: alpha(opacity=0);\n}\n.modal-backdrop.in {\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n}\n.modal-header {\n  padding: 15px;\n  border-bottom: 1px solid #e5e5e5;\n}\n.modal-header .close {\n  margin-top: -2px;\n}\n.modal-title {\n  margin: 0;\n  line-height: 1.42857143;\n}\n.modal-body {\n  position: relative;\n  padding: 20px;\n}\n.modal-footer {\n  padding: 20px;\n  text-align: right;\n  border-top: 1px solid #e5e5e5;\n}\n.modal-footer .btn + .btn {\n  margin-left: 5px;\n  margin-bottom: 0;\n}\n.modal-footer .btn-group .btn + .btn {\n  margin-left: -1px;\n}\n.modal-footer .btn-block + .btn-block {\n  margin-left: 0;\n}\n.modal-scrollbar-measure {\n  position: absolute;\n  top: -9999px;\n  width: 50px;\n  height: 50px;\n  overflow: scroll;\n}\n@media (min-width: 768px) {\n  .modal-dialog {\n    width: 600px;\n    margin: 30px auto;\n  }\n  .modal-content {\n    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);\n    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);\n  }\n  .modal-sm {\n    width: 300px;\n  }\n}\n@media (min-width: 992px) {\n  .modal-lg {\n    width: 900px;\n  }\n}\n.tooltip {\n  position: absolute;\n  z-index: 1070;\n  display: block;\n  font-family: \"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-style: normal;\n  font-weight: normal;\n  letter-spacing: normal;\n  line-break: auto;\n  line-height: 1.42857143;\n  text-align: left;\n  text-align: start;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  white-space: normal;\n  word-break: normal;\n  word-spacing: normal;\n  word-wrap: normal;\n  font-size: 13px;\n  opacity: 0;\n  filter: alpha(opacity=0);\n}\n.tooltip.in {\n  opacity: 0.9;\n  filter: alpha(opacity=90);\n}\n.tooltip.top {\n  margin-top: -3px;\n  padding: 5px 0;\n}\n.tooltip.right {\n  margin-left: 3px;\n  padding: 0 5px;\n}\n.tooltip.bottom {\n  margin-top: 3px;\n  padding: 5px 0;\n}\n.tooltip.left {\n  margin-left: -3px;\n  padding: 0 5px;\n}\n.tooltip-inner {\n  max-width: 200px;\n  padding: 3px 8px;\n  color: #fff;\n  text-align: center;\n  background-color: #000;\n  border-radius: 4px;\n}\n.tooltip-arrow {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.tooltip.top .tooltip-arrow {\n  bottom: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.top-left .tooltip-arrow {\n  bottom: 0;\n  right: 5px;\n  margin-bottom: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.top-right .tooltip-arrow {\n  bottom: 0;\n  left: 5px;\n  margin-bottom: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.right .tooltip-arrow {\n  top: 50%;\n  left: 0;\n  margin-top: -5px;\n  border-width: 5px 5px 5px 0;\n  border-right-color: #000;\n}\n.tooltip.left .tooltip-arrow {\n  top: 50%;\n  right: 0;\n  margin-top: -5px;\n  border-width: 5px 0 5px 5px;\n  border-left-color: #000;\n}\n.tooltip.bottom .tooltip-arrow {\n  top: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.tooltip.bottom-left .tooltip-arrow {\n  top: 0;\n  right: 5px;\n  margin-top: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.tooltip.bottom-right .tooltip-arrow {\n  top: 0;\n  left: 5px;\n  margin-top: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 1060;\n  display: none;\n  max-width: 276px;\n  padding: 1px;\n  font-family: \"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-style: normal;\n  font-weight: normal;\n  letter-spacing: normal;\n  line-break: auto;\n  line-height: 1.42857143;\n  text-align: left;\n  text-align: start;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  white-space: normal;\n  word-break: normal;\n  word-spacing: normal;\n  word-wrap: normal;\n  font-size: 15px;\n  background-color: #fff;\n  background-clip: padding-box;\n  border: 1px solid #ccc;\n  border: 1px solid rgba(0, 0, 0, 0.2);\n  border-radius: 6px;\n  -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n}\n.popover.top {\n  margin-top: -10px;\n}\n.popover.right {\n  margin-left: 10px;\n}\n.popover.bottom {\n  margin-top: 10px;\n}\n.popover.left {\n  margin-left: -10px;\n}\n.popover-title {\n  margin: 0;\n  padding: 8px 14px;\n  font-size: 15px;\n  background-color: #f7f7f7;\n  border-bottom: 1px solid #ebebeb;\n  border-radius: 5px 5px 0 0;\n}\n.popover-content {\n  padding: 9px 14px;\n}\n.popover > .arrow,\n.popover > .arrow:after {\n  position: absolute;\n  display: block;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.popover > .arrow {\n  border-width: 11px;\n}\n.popover > .arrow:after {\n  border-width: 10px;\n  content: \"\";\n}\n.popover.top > .arrow {\n  left: 50%;\n  margin-left: -11px;\n  border-bottom-width: 0;\n  border-top-color: #999999;\n  border-top-color: rgba(0, 0, 0, 0.25);\n  bottom: -11px;\n}\n.popover.top > .arrow:after {\n  content: \" \";\n  bottom: 1px;\n  margin-left: -10px;\n  border-bottom-width: 0;\n  border-top-color: #fff;\n}\n.popover.right > .arrow {\n  top: 50%;\n  left: -11px;\n  margin-top: -11px;\n  border-left-width: 0;\n  border-right-color: #999999;\n  border-right-color: rgba(0, 0, 0, 0.25);\n}\n.popover.right > .arrow:after {\n  content: \" \";\n  left: 1px;\n  bottom: -10px;\n  border-left-width: 0;\n  border-right-color: #fff;\n}\n.popover.bottom > .arrow {\n  left: 50%;\n  margin-left: -11px;\n  border-top-width: 0;\n  border-bottom-color: #999999;\n  border-bottom-color: rgba(0, 0, 0, 0.25);\n  top: -11px;\n}\n.popover.bottom > .arrow:after {\n  content: \" \";\n  top: 1px;\n  margin-left: -10px;\n  border-top-width: 0;\n  border-bottom-color: #fff;\n}\n.popover.left > .arrow {\n  top: 50%;\n  right: -11px;\n  margin-top: -11px;\n  border-right-width: 0;\n  border-left-color: #999999;\n  border-left-color: rgba(0, 0, 0, 0.25);\n}\n.popover.left > .arrow:after {\n  content: \" \";\n  right: 1px;\n  border-right-width: 0;\n  border-left-color: #fff;\n  bottom: -10px;\n}\n.carousel {\n  position: relative;\n}\n.carousel-inner {\n  position: relative;\n  overflow: hidden;\n  width: 100%;\n}\n.carousel-inner > .item {\n  display: none;\n  position: relative;\n  -webkit-transition: 0.6s ease-in-out left;\n  -o-transition: 0.6s ease-in-out left;\n  transition: 0.6s ease-in-out left;\n}\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n  line-height: 1;\n}\n@media all and (transform-3d), (-webkit-transform-3d) {\n  .carousel-inner > .item {\n    -webkit-transition: -webkit-transform 0.6s ease-in-out;\n    -moz-transition: -moz-transform 0.6s ease-in-out;\n    -o-transition: -o-transform 0.6s ease-in-out;\n    transition: transform 0.6s ease-in-out;\n    -webkit-backface-visibility: hidden;\n    -moz-backface-visibility: hidden;\n    backface-visibility: hidden;\n    -webkit-perspective: 1000px;\n    -moz-perspective: 1000px;\n    perspective: 1000px;\n  }\n  .carousel-inner > .item.next,\n  .carousel-inner > .item.active.right {\n    -webkit-transform: translate3d(100%, 0, 0);\n    transform: translate3d(100%, 0, 0);\n    left: 0;\n  }\n  .carousel-inner > .item.prev,\n  .carousel-inner > .item.active.left {\n    -webkit-transform: translate3d(-100%, 0, 0);\n    transform: translate3d(-100%, 0, 0);\n    left: 0;\n  }\n  .carousel-inner > .item.next.left,\n  .carousel-inner > .item.prev.right,\n  .carousel-inner > .item.active {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n    left: 0;\n  }\n}\n.carousel-inner > .active,\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  display: block;\n}\n.carousel-inner > .active {\n  left: 0;\n}\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  position: absolute;\n  top: 0;\n  width: 100%;\n}\n.carousel-inner > .next {\n  left: 100%;\n}\n.carousel-inner > .prev {\n  left: -100%;\n}\n.carousel-inner > .next.left,\n.carousel-inner > .prev.right {\n  left: 0;\n}\n.carousel-inner > .active.left {\n  left: -100%;\n}\n.carousel-inner > .active.right {\n  left: 100%;\n}\n.carousel-control {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  width: 15%;\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n  font-size: 20px;\n  color: #fff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);\n  background-color: rgba(0, 0, 0, 0);\n}\n.carousel-control.left {\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);\n  background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);\n}\n.carousel-control.right {\n  left: auto;\n  right: 0;\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);\n  background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);\n}\n.carousel-control:hover,\n.carousel-control:focus {\n  outline: 0;\n  color: #fff;\n  text-decoration: none;\n  opacity: 0.9;\n  filter: alpha(opacity=90);\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-left,\n.carousel-control .glyphicon-chevron-right {\n  position: absolute;\n  top: 50%;\n  margin-top: -10px;\n  z-index: 5;\n  display: inline-block;\n}\n.carousel-control .icon-prev,\n.carousel-control .glyphicon-chevron-left {\n  left: 50%;\n  margin-left: -10px;\n}\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-right {\n  right: 50%;\n  margin-right: -10px;\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next {\n  width: 20px;\n  height: 20px;\n  line-height: 1;\n  font-family: serif;\n}\n.carousel-control .icon-prev:before {\n  content: '\\2039';\n}\n.carousel-control .icon-next:before {\n  content: '\\203a';\n}\n.carousel-indicators {\n  position: absolute;\n  bottom: 10px;\n  left: 50%;\n  z-index: 15;\n  width: 60%;\n  margin-left: -30%;\n  padding-left: 0;\n  list-style: none;\n  text-align: center;\n}\n.carousel-indicators li {\n  display: inline-block;\n  width: 10px;\n  height: 10px;\n  margin: 1px;\n  text-indent: -999px;\n  border: 1px solid #fff;\n  border-radius: 10px;\n  cursor: pointer;\n  background-color: #000 \\9;\n  background-color: rgba(0, 0, 0, 0);\n}\n.carousel-indicators .active {\n  margin: 0;\n  width: 12px;\n  height: 12px;\n  background-color: #fff;\n}\n.carousel-caption {\n  position: absolute;\n  left: 15%;\n  right: 15%;\n  bottom: 20px;\n  z-index: 10;\n  padding-top: 20px;\n  padding-bottom: 20px;\n  color: #fff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);\n}\n.carousel-caption .btn {\n  text-shadow: none;\n}\n@media screen and (min-width: 768px) {\n  .carousel-control .glyphicon-chevron-left,\n  .carousel-control .glyphicon-chevron-right,\n  .carousel-control .icon-prev,\n  .carousel-control .icon-next {\n    width: 30px;\n    height: 30px;\n    margin-top: -10px;\n    font-size: 30px;\n  }\n  .carousel-control .glyphicon-chevron-left,\n  .carousel-control .icon-prev {\n    margin-left: -10px;\n  }\n  .carousel-control .glyphicon-chevron-right,\n  .carousel-control .icon-next {\n    margin-right: -10px;\n  }\n  .carousel-caption {\n    left: 20%;\n    right: 20%;\n    padding-bottom: 30px;\n  }\n  .carousel-indicators {\n    bottom: 20px;\n  }\n}\n.clearfix:before,\n.clearfix:after,\n.dl-horizontal dd:before,\n.dl-horizontal dd:after,\n.container:before,\n.container:after,\n.container-fluid:before,\n.container-fluid:after,\n.row:before,\n.row:after,\n.form-horizontal .form-group:before,\n.form-horizontal .form-group:after,\n.btn-toolbar:before,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:before,\n.btn-group-vertical > .btn-group:after,\n.nav:before,\n.nav:after,\n.navbar:before,\n.navbar:after,\n.navbar-header:before,\n.navbar-header:after,\n.navbar-collapse:before,\n.navbar-collapse:after,\n.pager:before,\n.pager:after,\n.panel-body:before,\n.panel-body:after,\n.modal-header:before,\n.modal-header:after,\n.modal-footer:before,\n.modal-footer:after {\n  content: \" \";\n  display: table;\n}\n.clearfix:after,\n.dl-horizontal dd:after,\n.container:after,\n.container-fluid:after,\n.row:after,\n.form-horizontal .form-group:after,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:after,\n.nav:after,\n.navbar:after,\n.navbar-header:after,\n.navbar-collapse:after,\n.pager:after,\n.panel-body:after,\n.modal-header:after,\n.modal-footer:after {\n  clear: both;\n}\n.center-block {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n.pull-right {\n  float: right !important;\n}\n.pull-left {\n  float: left !important;\n}\n.hide {\n  display: none !important;\n}\n.show {\n  display: block !important;\n}\n.invisible {\n  visibility: hidden;\n}\n.text-hide {\n  font: 0/0 a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n.hidden {\n  display: none !important;\n}\n.affix {\n  position: fixed;\n}\n@-ms-viewport {\n  width: device-width;\n}\n.visible-xs,\n.visible-sm,\n.visible-md,\n.visible-lg {\n  display: none !important;\n}\n.visible-xs-block,\n.visible-xs-inline,\n.visible-xs-inline-block,\n.visible-sm-block,\n.visible-sm-inline,\n.visible-sm-inline-block,\n.visible-md-block,\n.visible-md-inline,\n.visible-md-inline-block,\n.visible-lg-block,\n.visible-lg-inline,\n.visible-lg-inline-block {\n  display: none !important;\n}\n@media (max-width: 767px) {\n  .visible-xs {\n    display: block !important;\n  }\n  table.visible-xs {\n    display: table !important;\n  }\n  tr.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-xs,\n  td.visible-xs {\n    display: table-cell !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-block {\n    display: block !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-inline {\n    display: inline !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm {\n    display: block !important;\n  }\n  table.visible-sm {\n    display: table !important;\n  }\n  tr.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-sm,\n  td.visible-sm {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-block {\n    display: block !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md {\n    display: block !important;\n  }\n  table.visible-md {\n    display: table !important;\n  }\n  tr.visible-md {\n    display: table-row !important;\n  }\n  th.visible-md,\n  td.visible-md {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-block {\n    display: block !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg {\n    display: block !important;\n  }\n  table.visible-lg {\n    display: table !important;\n  }\n  tr.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-lg,\n  td.visible-lg {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-block {\n    display: block !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (max-width: 767px) {\n  .hidden-xs {\n    display: none !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-sm {\n    display: none !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-md {\n    display: none !important;\n  }\n}\n@media (min-width: 1200px) {\n  .hidden-lg {\n    display: none !important;\n  }\n}\n.visible-print {\n  display: none !important;\n}\n@media print {\n  .visible-print {\n    display: block !important;\n  }\n  table.visible-print {\n    display: table !important;\n  }\n  tr.visible-print {\n    display: table-row !important;\n  }\n  th.visible-print,\n  td.visible-print {\n    display: table-cell !important;\n  }\n}\n.visible-print-block {\n  display: none !important;\n}\n@media print {\n  .visible-print-block {\n    display: block !important;\n  }\n}\n.visible-print-inline {\n  display: none !important;\n}\n@media print {\n  .visible-print-inline {\n    display: inline !important;\n  }\n}\n.visible-print-inline-block {\n  display: none !important;\n}\n@media print {\n  .visible-print-inline-block {\n    display: inline-block !important;\n  }\n}\n@media print {\n  .hidden-print {\n    display: none !important;\n  }\n}\n.navbar {\n  border-width: 0;\n}\n.navbar-default .badge {\n  background-color: #fff;\n  color: #63ceca;\n}\n.navbar-inverse .badge {\n  background-color: #fff;\n  color: #ffbe00;\n}\n.navbar-brand {\n  line-height: 1;\n}\n.btn {\n  border-width: 2px;\n}\n.btn:active {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.btn-group.open .dropdown-toggle {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.text-primary,\n.text-primary:hover {\n  color: #63ceca;\n}\n.text-success,\n.text-success:hover {\n  color: #ffbe00;\n}\n.text-danger,\n.text-danger:hover {\n  color: #E74C3C;\n}\n.text-warning,\n.text-warning:hover {\n  color: #F39C12;\n}\n.text-info,\n.text-info:hover {\n  color: #3498DB;\n}\ntable a:not(.btn),\n.table a:not(.btn) {\n  text-decoration: underline;\n}\ntable .dropdown-menu a,\n.table .dropdown-menu a {\n  text-decoration: none;\n}\ntable .success,\n.table .success,\ntable .warning,\n.table .warning,\ntable .danger,\n.table .danger,\ntable .info,\n.table .info {\n  color: #fff;\n}\ntable .success > th > a,\n.table .success > th > a,\ntable .warning > th > a,\n.table .warning > th > a,\ntable .danger > th > a,\n.table .danger > th > a,\ntable .info > th > a,\n.table .info > th > a,\ntable .success > td > a,\n.table .success > td > a,\ntable .warning > td > a,\n.table .warning > td > a,\ntable .danger > td > a,\n.table .danger > td > a,\ntable .info > td > a,\n.table .info > td > a,\ntable .success > a,\n.table .success > a,\ntable .warning > a,\n.table .warning > a,\ntable .danger > a,\n.table .danger > a,\ntable .info > a,\n.table .info > a {\n  color: #fff;\n}\ntable > thead > tr > th,\n.table > thead > tr > th,\ntable > tbody > tr > th,\n.table > tbody > tr > th,\ntable > tfoot > tr > th,\n.table > tfoot > tr > th,\ntable > thead > tr > td,\n.table > thead > tr > td,\ntable > tbody > tr > td,\n.table > tbody > tr > td,\ntable > tfoot > tr > td,\n.table > tfoot > tr > td {\n  border: none;\n}\ntable-bordered > thead > tr > th,\n.table-bordered > thead > tr > th,\ntable-bordered > tbody > tr > th,\n.table-bordered > tbody > tr > th,\ntable-bordered > tfoot > tr > th,\n.table-bordered > tfoot > tr > th,\ntable-bordered > thead > tr > td,\n.table-bordered > thead > tr > td,\ntable-bordered > tbody > tr > td,\n.table-bordered > tbody > tr > td,\ntable-bordered > tfoot > tr > td,\n.table-bordered > tfoot > tr > td {\n  border: 1px solid #ecf0f1;\n}\n.form-control,\ninput {\n  border-width: 2px;\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.form-control:focus,\ninput:focus {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.has-warning .help-block,\n.has-warning .control-label,\n.has-warning .radio,\n.has-warning .checkbox,\n.has-warning .radio-inline,\n.has-warning .checkbox-inline,\n.has-warning.radio label,\n.has-warning.checkbox label,\n.has-warning.radio-inline label,\n.has-warning.checkbox-inline label,\n.has-warning .form-control-feedback {\n  color: #F39C12;\n}\n.has-warning .form-control,\n.has-warning .form-control:focus {\n  border: 2px solid #F39C12;\n}\n.has-warning .input-group-addon {\n  border-color: #F39C12;\n}\n.has-error .help-block,\n.has-error .control-label,\n.has-error .radio,\n.has-error .checkbox,\n.has-error .radio-inline,\n.has-error .checkbox-inline,\n.has-error.radio label,\n.has-error.checkbox label,\n.has-error.radio-inline label,\n.has-error.checkbox-inline label,\n.has-error .form-control-feedback {\n  color: #E74C3C;\n}\n.has-error .form-control,\n.has-error .form-control:focus {\n  border: 2px solid #E74C3C;\n}\n.has-error .input-group-addon {\n  border-color: #E74C3C;\n}\n.has-success .help-block,\n.has-success .control-label,\n.has-success .radio,\n.has-success .checkbox,\n.has-success .radio-inline,\n.has-success .checkbox-inline,\n.has-success.radio label,\n.has-success.checkbox label,\n.has-success.radio-inline label,\n.has-success.checkbox-inline label,\n.has-success .form-control-feedback {\n  color: #ffbe00;\n}\n.has-success .form-control,\n.has-success .form-control:focus {\n  border: 2px solid #ffbe00;\n}\n.has-success .input-group-addon {\n  border-color: #ffbe00;\n}\n.nav .open > a,\n.nav .open > a:hover,\n.nav .open > a:focus {\n  border-color: transparent;\n}\n.pager a,\n.pager a:hover {\n  color: #fff;\n}\n.pager .disabled > a,\n.pager .disabled > a:hover,\n.pager .disabled > a:focus,\n.pager .disabled > span {\n  background-color: #ffd14d;\n}\n.close {\n  color: #fff;\n  text-decoration: none;\n  opacity: 0.4;\n}\n.close:hover,\n.close:focus {\n  color: #fff;\n  opacity: 1;\n}\n.alert .alert-link {\n  color: #fff;\n  text-decoration: underline;\n}\n.progress {\n  height: 10px;\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\n.progress .progress-bar {\n  font-size: 10px;\n  line-height: 10px;\n}\n.well {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}\na.list-group-item.active,\na.list-group-item.active:hover,\na.list-group-item.active:focus {\n  border-color: #ecf0f1;\n}\na.list-group-item-success.active {\n  background-color: #ffbe00;\n}\na.list-group-item-success.active:hover,\na.list-group-item-success.active:focus {\n  background-color: #e6ab00;\n}\na.list-group-item-warning.active {\n  background-color: #F39C12;\n}\na.list-group-item-warning.active:hover,\na.list-group-item-warning.active:focus {\n  background-color: #e08e0b;\n}\na.list-group-item-danger.active {\n  background-color: #E74C3C;\n}\na.list-group-item-danger.active:hover,\na.list-group-item-danger.active:focus {\n  background-color: #e43725;\n}\n.panel-default .close {\n  color: #FFFFFF;\n}\n.modal .close {\n  color: #FFFFFF;\n}\n.popover {\n  color: #FFFFFF;\n}\n"
  },
  {
    "path": "website/lib/bootstrap/variables.less",
    "content": "// Flatly 3.3.7\n// Variables\n// --------------------------------------------------\n\n\n//== Colors\n//\n//## Gray and brand colors for use across Bootstrap.\n\n@ts-dark-teal: rgb(0, 34, 38);\n@ts-teal: rgb(99, 206, 202); //rgb(0,146,161); \n@ts-orange: rgb(227, 114, 34);\n@ts-yellow: rgb(255, 190, 0);\n\n@gray-base:              @ts-dark-teal;\n@gray-darker:            lighten(@ts-dark-teal, 13.5%); // #222\n@gray-dark:              rgb(0, 40, 39);   // #333\n@gray:                   rgb(0, 45, 44); // #555\n@gray-light:             rgb(0, 50, 49);   // #999\n@gray-lighter:           rgb(0, 55, 54); // #eee\n\n@brand-primary:         @ts-teal;\n@brand-success:         @ts-teal;\n@brand-info:            #3498DB;\n@brand-warning:         #F39C12;\n@brand-danger:          #E74C3C;\n\n\n//== Scaffolding\n//\n//## Settings for some of the most global styles.\n\n//** Background color for `<body>`.\n@body-bg:               @ts-dark-teal;\n//** Global text color on `<body>`.\n@text-color:            #FFF;\n\n//** Global textual link color.\n@link-color:            @ts-teal;\n//** Link hover color set via `darken()` function.\n@link-hover-color:      @ts-yellow;\n//** Link hover decoration.\n@link-hover-decoration: underline;\n\n\n//== Typography\n//\n//## Font, line-height, and color for body text, headings, and more.\n\n@font-family-sans-serif:  \"Lato\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n@font-family-serif:       Georgia, \"Times New Roman\", Times, serif;\n//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.\n@font-family-monospace:   Menlo, Monaco, Consolas, \"Courier New\", monospace;\n@font-family-base:        @font-family-sans-serif;\n\n@font-size-base:          15px;\n@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px\n@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px\n\n@font-size-h1:            floor((@font-size-base * 2.6)); // ~36px\n@font-size-h2:            floor((@font-size-base * 2.15)); // ~30px\n@font-size-h3:            ceil((@font-size-base * 1.7)); // ~24px\n@font-size-h4:            ceil((@font-size-base * 1.25)); // ~18px\n@font-size-h5:            @font-size-base;\n@font-size-h6:            ceil((@font-size-base * 0.85)); // ~12px\n\n\n//** Unit-less `line-height` for use in components like buttons.\n@line-height-base:        1.428571429; // 20/14\n//** Computed \"line-height\" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.\n@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px\n\n@common-margin:        18;\n\n//** By default, this inherits from the `<body>`.\n@headings-font-family:    @font-family-base;\n@headings-font-weight:    600;\n@headings-line-height:    1.1;\n@headings-color:          inherit;\n\n\n//== Iconography\n//\n//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.\n\n//** Load fonts from this directory.\n@icon-font-path:          \"../fonts/\";\n//** File name for all font files.\n@icon-font-name:          \"glyphicons-halflings-regular\";\n//** Element ID within SVG icon file.\n@icon-font-svg-id:        \"glyphicons_halflingsregular\";\n\n\n//== Components\n//\n//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).\n\n@padding-base-vertical:     10px;\n@padding-base-horizontal:   15px;\n\n@padding-large-vertical:    18px;\n@padding-large-horizontal:  27px;\n\n@padding-small-vertical:    6px;\n@padding-small-horizontal:  9px;\n\n@padding-xs-vertical:       1px;\n@padding-xs-horizontal:     5px;\n\n@line-height-large:         1.3333333; // extra decimals for Win 8.1 Chrome\n@line-height-small:         1.5;\n\n@border-radius-base:        0px;\n@border-radius-large:       0px;\n@border-radius-small:       0px;\n\n//** Global color for active items (e.g., navs or dropdowns).\n@component-active-color:    #fff;\n//** Global background color for active items (e.g., navs or dropdowns).\n@component-active-bg:       @brand-primary;\n\n//** Width of the `border` for generating carets that indicate dropdowns.\n@caret-width-base:          4px;\n//** Carets increase slightly in size for larger components.\n@caret-width-large:         5px;\n\n\n//== Tables\n//\n//## Customizes the `.table` component with basic values, each used across all table variations.\n\n//** Padding for `<th>`s and `<td>`s.\n@table-cell-padding:            8px;\n//** Padding for cells in `.table-condensed`.\n@table-condensed-cell-padding:  5px;\n\n//** Default background color used for all tables.\n@table-bg:                      @gray-lighter;\n//** Background color used for `.table-striped`.\n@table-bg-accent:               @gray-lighter;\n//** Background color used for `.table-hover`.\n@table-bg-hover:                @gray-lighter;\n@table-bg-active:               @table-bg-hover;\n\n//** Border color for table and cell borders.\n@table-border-color:            @gray-lighter;\n\n\n//== Buttons\n//\n//## For each of Bootstrap's buttons, define text, background and border color.\n\n@btn-font-weight:                normal;\n\n@btn-default-color:              #fff;\n@btn-default-bg:                 @gray;\n@btn-default-border:             @btn-default-bg;\n\n@btn-primary-color:              @btn-default-color;\n@btn-primary-bg:                 @brand-primary;\n@btn-primary-border:             @btn-primary-bg;\n\n@btn-success-color:              @btn-default-color;\n@btn-success-bg:                 @brand-success;\n@btn-success-border:             @btn-success-bg;\n\n@btn-info-color:                 @btn-default-color;\n@btn-info-bg:                    @brand-info;\n@btn-info-border:                @btn-info-bg;\n\n@btn-warning-color:              @btn-default-color;\n@btn-warning-bg:                 @brand-warning;\n@btn-warning-border:             @btn-warning-bg;\n\n@btn-danger-color:               @btn-default-color;\n@btn-danger-bg:                  @brand-danger;\n@btn-danger-border:              @btn-danger-bg;\n\n@btn-link-disabled-color:        @gray-light;\n\n// Allows for customizing button radius independently from global border radius\n@btn-border-radius-base:         @border-radius-base;\n@btn-border-radius-large:        @border-radius-large;\n@btn-border-radius-small:        @border-radius-small;\n\n\n//== Forms\n//\n//##\n\n//** `<input>` background color\n@input-bg:                       #fff;\n//** `<input disabled>` background color\n@input-bg-disabled:              @gray-lighter;\n\n//** Text color for `<input>`s\n@input-color:                    @ts-dark-teal;\n//** `<input>` border color\n@input-border:                   #dce4ec;\n\n// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4\n//** Default `.form-control` border radius\n// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.\n@input-border-radius:            @border-radius-base;\n//** Large `.form-control` border radius\n@input-border-radius-large:      @border-radius-large;\n//** Small `.form-control` border radius\n@input-border-radius-small:      @border-radius-small;\n\n//** Border color for inputs on focus\n@input-border-focus:             @brand-primary;\n\n//** Placeholder text color\n@input-color-placeholder:        #acb6c0;\n\n//** Default `.form-control` height\n@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 4);\n//** Large `.form-control` height\n@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 4);\n//** Small `.form-control` height\n@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 4);\n\n//** `.form-group` margin\n@form-group-margin-bottom:       15px;\n\n@legend-color:                   @text-color;\n@legend-border-color:            transparent;\n\n//** Background color for textual input addons\n@input-group-addon-bg:           @gray-lighter;\n//** Border color for textual input addons\n@input-group-addon-border-color: @input-border;\n\n//** Disabled cursor for form controls and buttons.\n@cursor-disabled:                not-allowed;\n\n\n//== Dropdowns\n//\n//## Dropdown menu container and contents.\n\n//** Background for the dropdown menu.\n@dropdown-bg:                    #fff;\n//** Dropdown menu `border-color`.\n@dropdown-border:                rgba(0,0,0,.15);\n//** Dropdown menu `border-color` **for IE8**.\n@dropdown-fallback-border:       #ccc;\n//** Divider color for between dropdown items.\n@dropdown-divider-bg:            #e5e5e5;\n\n//** Dropdown link text color.\n@dropdown-link-color:            @gray-dark;\n//** Hover color for dropdown links.\n@dropdown-link-hover-color:      #fff;\n//** Hover background for dropdown links.\n@dropdown-link-hover-bg:         @component-active-bg;\n\n//** Active dropdown menu item text color.\n@dropdown-link-active-color:     #fff;\n//** Active dropdown menu item background color.\n@dropdown-link-active-bg:        @component-active-bg;\n\n//** Disabled dropdown menu item background color.\n@dropdown-link-disabled-color:   @gray-light;\n\n//** Text color for headers within dropdown menus.\n@dropdown-header-color:          @gray-light;\n\n//** Deprecated `@dropdown-caret-color` as of v3.1.0\n@dropdown-caret-color:           #000;\n\n\n//-- Z-index master list\n//\n// Warning: Avoid customizing these values. They're used for a bird's eye view\n// of components dependent on the z-axis and are designed to all work together.\n//\n// Note: These variables are not generated into the Customizer.\n\n@zindex-navbar:            1000;\n@zindex-dropdown:          1000;\n@zindex-popover:           1060;\n@zindex-tooltip:           1070;\n@zindex-navbar-fixed:      1030;\n@zindex-modal-background:  1040;\n@zindex-modal:             1050;\n\n\n//== Media queries breakpoints\n//\n//## Define the breakpoints at which your layout will change, adapting to different screen sizes.\n\n// Extra small screen / phone\n//** Deprecated `@screen-xs` as of v3.0.1\n@screen-xs:                  480px;\n//** Deprecated `@screen-xs-min` as of v3.2.0\n@screen-xs-min:              @screen-xs;\n//** Deprecated `@screen-phone` as of v3.0.1\n@screen-phone:               @screen-xs-min;\n\n// Small screen / tablet\n//** Deprecated `@screen-sm` as of v3.0.1\n@screen-sm:                  768px;\n@screen-sm-min:              @screen-sm;\n//** Deprecated `@screen-tablet` as of v3.0.1\n@screen-tablet:              @screen-sm-min;\n\n// Medium screen / desktop\n//** Deprecated `@screen-md` as of v3.0.1\n@screen-md:                  992px;\n@screen-md-min:              @screen-md;\n//** Deprecated `@screen-desktop` as of v3.0.1\n@screen-desktop:             @screen-md-min;\n\n// Large screen / wide desktop\n//** Deprecated `@screen-lg` as of v3.0.1\n@screen-lg:                  1200px;\n@screen-lg-min:              @screen-lg;\n//** Deprecated `@screen-lg-desktop` as of v3.0.1\n@screen-lg-desktop:          @screen-lg-min;\n\n// So media queries don't overlap when required, provide a maximum\n@screen-xs-max:              (@screen-sm-min - 1);\n@screen-sm-max:              (@screen-md-min - 1);\n@screen-md-max:              (@screen-lg-min - 1);\n\n\n//== Grid system\n//\n//## Define your custom responsive grid.\n\n//** Number of columns in the grid.\n@grid-columns:              12;\n//** Padding between columns. Gets divided in half for the left and right.\n@grid-gutter-width:         30px;\n// Navbar collapse\n//** Point at which the navbar becomes uncollapsed.\n@grid-float-breakpoint:     @screen-sm-min;\n//** Point at which the navbar begins collapsing.\n@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);\n\n\n//== Container sizes\n//\n//## Define the maximum width of `.container` for different screen sizes.\n\n// Small screen / tablet\n@container-tablet:             (720px + @grid-gutter-width);\n//** For `@screen-sm-min` and up.\n@container-sm:                 @container-tablet;\n\n// Medium screen / desktop\n@container-desktop:            (940px + @grid-gutter-width);\n//** For `@screen-md-min` and up.\n@container-md:                 @container-desktop;\n\n// Large screen / wide desktop\n@container-large-desktop:      (1140px + @grid-gutter-width);\n//** For `@screen-lg-min` and up.\n@container-lg:                 @container-large-desktop;\n\n\n//== Navbar\n//\n//##\n\n// Basics of a navbar\n@navbar-height:                    60px;\n@navbar-margin-bottom:             @line-height-computed;\n@navbar-border-radius:             @border-radius-base;\n@navbar-padding-horizontal:        floor((@grid-gutter-width / 2));\n@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);\n@navbar-collapse-max-height:       340px;\n\n@navbar-default-color:             #fff;\n@navbar-default-bg:                @gray-lighter;\n@navbar-default-border:            transparent;\n\n// Navbar links\n@navbar-default-link-color:                @ts-orange;\n@navbar-default-link-hover-color:          @navbar-default-link-color;\n@navbar-default-link-hover-bg:             transparent;\n@navbar-default-link-active-color:         #fff;\n@navbar-default-link-active-bg:            darken(@navbar-default-bg, 10%);\n@navbar-default-link-disabled-color:       #ccc;\n@navbar-default-link-disabled-bg:          transparent;\n\n// Navbar brand label\n@navbar-default-brand-color:               @navbar-default-link-color;\n@navbar-default-brand-hover-color:         @navbar-default-link-hover-color;\n@navbar-default-brand-hover-bg:            transparent;\n\n// Navbar toggle\n@navbar-default-toggle-hover-bg:           darken(@navbar-default-bg, 10%);\n@navbar-default-toggle-icon-bar-bg:        #fff;\n@navbar-default-toggle-border-color:       transparent;\n\n\n//=== Inverted navbar\n// Reset inverted navbar basics\n@navbar-inverse-color:                      #fff;\n@navbar-inverse-bg:                         @brand-success;\n@navbar-inverse-border:                     transparent;\n\n// Inverted navbar links\n@navbar-inverse-link-color:                 #fff;\n@navbar-inverse-link-hover-color:           @brand-primary;\n@navbar-inverse-link-hover-bg:              transparent;\n@navbar-inverse-link-active-color:          #fff;\n@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 5%);\n@navbar-inverse-link-disabled-color:        #ccc;\n@navbar-inverse-link-disabled-bg:           transparent;\n\n// Inverted navbar brand label\n@navbar-inverse-brand-color:                @navbar-inverse-link-color;\n@navbar-inverse-brand-hover-color:          @navbar-inverse-link-hover-color;\n@navbar-inverse-brand-hover-bg:             transparent;\n\n// Inverted navbar toggle\n@navbar-inverse-toggle-hover-bg:            darken(@navbar-inverse-bg, 10%);\n@navbar-inverse-toggle-icon-bar-bg:         #fff;\n@navbar-inverse-toggle-border-color:        darken(@navbar-inverse-bg, 10%);\n\n\n//== Navs\n//\n//##\n\n//=== Shared nav styles\n@nav-link-padding:                          10px 15px;\n@nav-link-hover-bg:                         @gray-lighter;\n\n@nav-disabled-link-color:                   @gray-light;\n@nav-disabled-link-hover-color:             @gray-light;\n\n//== Tabs\n@nav-tabs-border-color:                     @gray-lighter;\n\n@nav-tabs-link-hover-border-color:          @gray-lighter;\n\n@nav-tabs-active-link-hover-bg:             @body-bg;\n@nav-tabs-active-link-hover-color:          @brand-primary;\n@nav-tabs-active-link-hover-border-color:   @gray-lighter;\n\n@nav-tabs-justified-link-border-color:            @gray-lighter;\n@nav-tabs-justified-active-link-border-color:     @body-bg;\n\n//== Pills\n@nav-pills-border-radius:                   @border-radius-base;\n@nav-pills-active-link-hover-bg:            @component-active-bg;\n@nav-pills-active-link-hover-color:         @component-active-color;\n\n\n//== Pagination\n//\n//##\n\n@pagination-color:                     #fff;\n@pagination-bg:                        @brand-success;\n@pagination-border:                    transparent;\n\n@pagination-hover-color:               #fff;\n@pagination-hover-bg:                  darken(@brand-success, 15%);\n@pagination-hover-border:              transparent;\n\n@pagination-active-color:              #fff;\n@pagination-active-bg:                 darken(@brand-success, 15%);\n@pagination-active-border:             transparent;\n\n@pagination-disabled-color:            @gray-lighter;\n@pagination-disabled-bg:               lighten(@brand-success, 15%);\n@pagination-disabled-border:           transparent;\n\n\n//== Pager\n//\n//##\n\n@pager-bg:                             @pagination-bg;\n@pager-border:                         @pagination-border;\n@pager-border-radius:                  15px;\n\n@pager-hover-bg:                       @pagination-hover-bg;\n\n@pager-active-bg:                      @pagination-active-bg;\n@pager-active-color:                   @pagination-active-color;\n\n@pager-disabled-color:                 #fff;\n\n\n//== Jumbotron\n//\n//##\n\n@jumbotron-padding:              30px;\n@jumbotron-color:                inherit;\n@jumbotron-bg:                   @gray-lighter;\n@jumbotron-heading-color:        inherit;\n@jumbotron-font-size:            ceil((@font-size-base * 1.5));\n@jumbotron-heading-font-size:    ceil((@font-size-base * 4.5));\n\n\n//== Form states and alerts\n//\n//## Define colors for form feedback states and, by default, alerts.\n\n@state-success-text:             #fff;\n@state-success-bg:               @brand-success;\n@state-success-border:           @brand-success;\n\n@state-info-text:                #fff;\n@state-info-bg:                  @brand-info;\n@state-info-border:              @brand-info;\n\n@state-warning-text:             #fff;\n@state-warning-bg:               @brand-warning;\n@state-warning-border:           @brand-warning;\n\n@state-danger-text:              #fff;\n@state-danger-bg:                @brand-danger;\n@state-danger-border:            @brand-danger;\n\n\n//== Tooltips\n//\n//##\n\n//** Tooltip max width\n@tooltip-max-width:           200px;\n//** Tooltip text color\n@tooltip-color:               #fff;\n//** Tooltip background color\n@tooltip-bg:                  #000;\n@tooltip-opacity:             .9;\n\n//** Tooltip arrow width\n@tooltip-arrow-width:         5px;\n//** Tooltip arrow color\n@tooltip-arrow-color:         @tooltip-bg;\n\n\n//== Popovers\n//\n//##\n\n//** Popover body background color\n@popover-bg:                          #fff;\n//** Popover maximum width\n@popover-max-width:                   276px;\n//** Popover border color\n@popover-border-color:                rgba(0,0,0,.2);\n//** Popover fallback border color\n@popover-fallback-border-color:       #ccc;\n\n//** Popover title background color\n@popover-title-bg:                    darken(@popover-bg, 3%);\n\n//** Popover arrow width\n@popover-arrow-width:                 10px;\n//** Popover arrow color\n@popover-arrow-color:                 @popover-bg;\n\n//** Popover outer arrow width\n@popover-arrow-outer-width:           (@popover-arrow-width + 1);\n//** Popover outer arrow color\n@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);\n//** Popover outer arrow fallback color\n@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);\n\n\n//== Labels\n//\n//##\n\n//** Default label background color\n@label-default-bg:            @btn-default-bg;\n//** Primary label background color\n@label-primary-bg:            @brand-primary;\n//** Success label background color\n@label-success-bg:            @brand-success;\n//** Info label background color\n@label-info-bg:               @brand-info;\n//** Warning label background color\n@label-warning-bg:            @brand-warning;\n//** Danger label background color\n@label-danger-bg:             @brand-danger;\n\n//** Default label text color\n@label-color:                 #fff;\n//** Default text color of a linked label\n@label-link-hover-color:      #fff;\n\n\n//== Modals\n//\n//##\n\n//** Padding applied to the modal body\n@modal-inner-padding:         20px;\n\n//** Padding applied to the modal title\n@modal-title-padding:         15px;\n//** Modal title line-height\n@modal-title-line-height:     @line-height-base;\n\n//** Background color of modal content area\n@modal-content-bg:                             @gray-lighter;\n//** Modal content border color\n@modal-content-border-color:                   rgba(0,0,0,.2);\n//** Modal content border color **for IE8**\n@modal-content-fallback-border-color:          #999;\n\n//** Modal backdrop background color\n@modal-backdrop-bg:           #000;\n//** Modal backdrop opacity\n@modal-backdrop-opacity:      .5;\n//** Modal header border color\n@modal-header-border-color:   #fff;\n//** Modal footer border color\n@modal-footer-border-color:   @modal-header-border-color;\n\n@modal-lg:                    900px;\n@modal-md:                    600px;\n@modal-sm:                    300px;\n\n\n//== Alerts\n//\n//## Define alert colors, border radius, and padding.\n\n@alert-padding:               15px;\n@alert-border-radius:         @border-radius-base;\n@alert-link-font-weight:      bold;\n\n@alert-success-bg:            @state-success-bg;\n@alert-success-text:          @state-success-text;\n@alert-success-border:        @state-success-border;\n\n@alert-info-bg:               @state-info-bg;\n@alert-info-text:             @state-info-text;\n@alert-info-border:           @state-info-border;\n\n@alert-warning-bg:            @state-warning-bg;\n@alert-warning-text:          @state-warning-text;\n@alert-warning-border:        @state-warning-border;\n\n@alert-danger-bg:             @state-danger-bg;\n@alert-danger-text:           @state-danger-text;\n@alert-danger-border:         @state-danger-border;\n\n\n//== Progress bars\n//\n//##\n\n//** Background color of the whole progress component\n@progress-bg:                 @gray-lighter;\n//** Progress bar text color\n@progress-bar-color:          #fff;\n//** Variable for setting rounded corners on progress bar.\n@progress-border-radius:      @border-radius-base;\n\n//** Default progress bar color\n@progress-bar-bg:             @brand-primary;\n//** Success progress bar color\n@progress-bar-success-bg:     @brand-success;\n//** Warning progress bar color\n@progress-bar-warning-bg:     @brand-warning;\n//** Danger progress bar color\n@progress-bar-danger-bg:      @brand-danger;\n//** Info progress bar color\n@progress-bar-info-bg:        @brand-info;\n\n\n//== List group\n//\n//##\n\n//** Background color on `.list-group-item`\n@list-group-bg:                 #fff;\n//** `.list-group-item` border color\n@list-group-border:             @gray-lighter;\n//** List group border radius\n@list-group-border-radius:      @border-radius-base;\n\n//** Background color of single list items on hover\n@list-group-hover-bg:           @gray-lighter;\n//** Text color of active list items\n@list-group-active-color:       @component-active-color;\n//** Background color of active list items\n@list-group-active-bg:          @component-active-bg;\n//** Border color of active list elements\n@list-group-active-border:      @list-group-active-bg;\n//** Text color for content within active list items\n@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);\n\n//** Text color of disabled list items\n@list-group-disabled-color:      @gray-light;\n//** Background color of disabled list items\n@list-group-disabled-bg:         @gray-lighter;\n//** Text color for content within disabled list items\n@list-group-disabled-text-color: @list-group-disabled-color;\n\n@list-group-link-color:         #555;\n@list-group-link-hover-color:   @list-group-link-color;\n@list-group-link-heading-color: #333;\n\n\n//== Panels\n//\n//##\n\n@panel-bg:                    @gray-lighter;\n@panel-body-padding:          15px;\n@panel-heading-padding:       10px 15px;\n@panel-footer-padding:        @panel-heading-padding;\n@panel-border-radius:         @border-radius-base;\n\n//** Border color for elements within panels\n@panel-inner-border:          @gray-lighter;\n@panel-footer-bg:             @gray-lighter;\n\n@panel-default-text:          @text-color;\n@panel-default-border:        @gray-lighter;\n@panel-default-heading-bg:    @gray-light;\n\n@panel-primary-text:          #fff;\n@panel-primary-border:        @brand-primary;\n@panel-primary-heading-bg:    @brand-primary;\n\n@panel-success-text:          @state-success-text;\n@panel-success-border:        @state-success-border;\n@panel-success-heading-bg:    @state-success-bg;\n\n@panel-info-text:             @state-info-text;\n@panel-info-border:           @state-info-border;\n@panel-info-heading-bg:       @state-info-bg;\n\n@panel-warning-text:          @state-warning-text;\n@panel-warning-border:        @state-warning-border;\n@panel-warning-heading-bg:    @state-warning-bg;\n\n@panel-danger-text:           @state-danger-text;\n@panel-danger-border:         @state-danger-border;\n@panel-danger-heading-bg:     @state-danger-bg;\n\n\n//== Thumbnails\n//\n//##\n\n//** Padding around the thumbnail image\n@thumbnail-padding:           4px;\n//** Thumbnail background color\n@thumbnail-bg:                @body-bg;\n//** Thumbnail border color\n@thumbnail-border:            @gray-lighter;\n//** Thumbnail border radius\n@thumbnail-border-radius:     @border-radius-base;\n\n//** Custom text color for thumbnail captions\n@thumbnail-caption-color:     @text-color;\n//** Padding around the thumbnail caption\n@thumbnail-caption-padding:   9px;\n\n\n//== Wells\n//\n//##\n\n@well-bg:                     @gray-lighter;\n@well-border:                 transparent;\n\n\n//== Badges\n//\n//##\n\n@badge-color:                 #fff;\n//** Linked badge text color on hover\n@badge-link-hover-color:      #fff;\n@badge-bg:                    @brand-primary;\n\n//** Badge text color in active nav link\n@badge-active-color:          @brand-primary;\n//** Badge background color in active nav link\n@badge-active-bg:             #fff;\n\n@badge-font-weight:           bold;\n@badge-line-height:           1;\n@badge-border-radius:         10px;\n\n\n//== Breadcrumbs\n//\n//##\n\n@breadcrumb-padding-vertical:   8px;\n@breadcrumb-padding-horizontal: 15px;\n//** Breadcrumb background color\n@breadcrumb-bg:                 @gray-lighter;\n//** Breadcrumb text color\n@breadcrumb-color:              #ccc;\n//** Text color of current page in the breadcrumb\n@breadcrumb-active-color:       @gray;\n//** Textual separator for between breadcrumb elements\n@breadcrumb-separator:          \"/\";\n\n\n//== Carousel\n//\n//##\n\n@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);\n\n@carousel-control-color:                      #fff;\n@carousel-control-width:                      15%;\n@carousel-control-opacity:                    .5;\n@carousel-control-font-size:                  20px;\n\n@carousel-indicator-active-bg:                #fff;\n@carousel-indicator-border-color:             #fff;\n\n@carousel-caption-color:                      #fff;\n\n\n//== Close\n//\n//##\n\n@close-font-weight:           bold;\n@close-color:                 #000;\n@close-text-shadow:           none;\n\n\n//== Code\n//\n//##\n\n@code-color:                  lighten(#c7254e, 5%);\n@code-bg:                     @body-bg;\n\n@kbd-color:                   #fff;\n@kbd-bg:                      #333;\n\n@pre-bg:                      @gray-lighter;\n@pre-color:                   @text-color;\n@pre-border-color:            transparent;\n@pre-scrollable-max-height:   340px;\n\n\n//== Type\n//\n//##\n\n//** Horizontal offset for forms and lists.\n@component-offset-horizontal: 180px;\n//** Text muted color\n@text-muted:                  rgb(100, 100, 100); // #222\n//** Abbreviations and acronyms border color\n@abbr-border-color:           @gray-light;\n//** Headings small color\n@headings-small-color:        @gray-light;\n//** Blockquote small color\n@blockquote-small-color:      @gray-light;\n//** Blockquote font size\n@blockquote-font-size:        (@font-size-base * 1.25);\n//** Blockquote border color\n@blockquote-border-color:     @gray-lighter;\n//** Page header border color\n@page-header-border-color:    transparent;\n//** Width of horizontal description list titles\n@dl-horizontal-offset:        @component-offset-horizontal;\n//** Point at which .dl-horizontal becomes horizontal\n@dl-horizontal-breakpoint:    @grid-float-breakpoint;\n//** Horizontal line color.\n@hr-border:                   @gray-lighter;\n"
  },
  {
    "path": "website/lib/swiftmailer/.gitattributes",
    "content": "*.crt -crlf\n*.key -crlf\n*.srl -crlf\n*.pub -crlf\n*.priv -crlf\n*.txt -crlf\n\n# ignore /notes in the git-generated distributed .zip archive\n/notes export-ignore\n"
  },
  {
    "path": "website/lib/swiftmailer/.gitignore",
    "content": "/tests/acceptance.conf.php\n/tests/smoke.conf.php\n/build/*\n/vendor/\n"
  },
  {
    "path": "website/lib/swiftmailer/.travis.yml",
    "content": "language: php\n\nsudo: false\n\nbefore_script:\n    - cp tests/acceptance.conf.php.default tests/acceptance.conf.php\n    - cp tests/smoke.conf.php.default tests/smoke.conf.php\n    - composer self-update\n    - composer update --no-interaction --prefer-source\n    - gem install mime-types -v 2.99.1\n    - gem install mailcatcher\n    - mailcatcher --smtp-port 4456\n\nscript:\n    - phpunit --verbose\n\nmatrix:\n    include:\n        - php: 5.3\n        - php: 5.4\n        - php: 5.5\n        - php: 5.6\n        - php: 7.0\n        - php: hhvm\n    allow_failures:\n        - php: 7.0\n        - php: hhvm\n    fast_finish: true\n"
  },
  {
    "path": "website/lib/swiftmailer/CHANGES",
    "content": "Changelog\n=========\n\n5.4.2 (2016-05-01)\n------------------\n\n * fixed support for IPv6 sockets\n * added auto-retry when sending messages from the memory spool\n * fixed consecutive read calls in Swift_ByteStream_FileByteStream\n * added support for iso-8859-15 encoding\n * fixed PHP mail extra params on missing reversePath\n * added methods to set custom stream context options\n * fixed charset changes in QpContentEncoderProxy\n * added return-path header to the ignoredHeaders list of DKIMSigner\n * fixed crlf for subject using mail\n * fixed add soft line break only when necessary\n * fixed escaping command-line args to Sendmail\n\n5.4.1 (2015-06-06)\n------------------\n\n * made Swiftmailer exceptions confirm to PHP base exception constructor signature\n * fixed MAIL FROM & RCPT TO headers to be RFC compliant\n\n5.4.0 (2015-03-14)\n------------------\n\n * added the possibility to add extra certs to PKCS#7 signature\n * fix base64 encoding with streams\n * added a new RESULT_SPOOLED status for SpoolTransport\n * fixed getBody() on attachments when called more than once\n * removed dots from generated filenames in filespool\n\n5.3.1 (2014-12-05)\n------------------\n\n * fixed cloning of messages with attachments\n\n5.3.0 (2014-10-04)\n------------------\n\n * fixed cloning when using signers\n * reverted removal of Swift_Encoding\n * drop support for PHP 5.2.x\n\n5.2.2 (2014-09-20)\n------------------\n\n * fixed Japanese support\n * fixed the memory spool when the message changes when in the pool\n * added support for cloning messages\n * fixed PHP warning in the redirect plugin\n * changed the way to and cc-ed email are sent to only use one transaction\n\n5.2.1 (2014-06-13)\n------------------\n\n * SECURITY FIX: fixed CLI escaping when using sendmail as a transport\n\n   Prior to 5.2.1, the sendmail transport (Swift_Transport_SendmailTransport)\n   was vulnerable to an arbitrary shell execution if the \"From\" header came\n   from a non-trusted source and no \"Return-Path\" is configured.\n\n * fixed parameter in DKIMSigner\n * fixed compatibility with PHP < 5.4\n\n5.2.0 (2014-05-08)\n------------------\n\n * fixed Swift_ByteStream_FileByteStream::read() to match to the specification\n * fixed from-charset and to-charset arguments in mbstring_convert_encoding() usages\n * fixed infinite loop in StreamBuffer\n * fixed NullTransport to return the number of ignored emails instead of 0\n * Use phpunit and mockery for unit testing (realityking)\n\n5.1.0 (2014-03-18)\n------------------\n\n * fixed data writing to stream when sending large messages\n * added support for libopendkim (https://github.com/xdecock/php-opendkim)\n * merged SignedMessage and Message\n * added Gmail XOAuth2 authentication\n * updated the list of known mime types\n * added NTLM authentication\n\n5.0.3 (2013-12-03)\n------------------\n\n * fixed double-dot bug\n * fixed DKIM signer\n\n5.0.2 (2013-08-30)\n------------------\n\n * handled correct exception type while reading IoBuffer output\n\n5.0.1 (2013-06-17)\n------------------\n\n * changed the spool to only start the transport when a mail has to be sent\n * fixed compatibility with PHP 5.2\n * fixed LICENSE file\n\n5.0.0 (2013-04-30)\n------------------\n\n * changed the license from LGPL to MIT\n\n4.3.1 (2013-04-11)\n------------------\n\n * removed usage of the native QP encoder when the charset is not UTF-8\n * fixed usage of uniqid to avoid collisions\n * made a performance improvement when tokenizing large headers\n * fixed usage of the PHP native QP encoder on PHP 5.4.7+\n\n4.3.0 (2013-01-08)\n------------------\n\n * made the temporary directory configurable via the TMPDIR env variable\n * added S/MIME signer and encryption support\n\n4.2.2 (2012-10-25)\n------------------\n\n * added the possibility to throttle messages per second in ThrottlerPlugin (mostly for Amazon SES)\n * switched mime.qpcontentencoder to automatically use the PHP native encoder on PHP 5.4.7+\n * allowed specifying a whitelist with regular expressions in RedirectingPlugin\n\n4.2.1 (2012-07-13)\n------------------\n\n * changed the coding standards to PSR-1/2\n * fixed issue with autoloading\n * added NativeQpContentEncoder to enhance performance (for PHP 5.3+)\n\n4.2.0 (2012-06-29)\n------------------\n\n * added documentation about how to use the Japanese support introduced in 4.1.8\n * added a way to override the default configuration in a lazy way\n * changed the PEAR init script to lazy-load the initialization\n * fixed a bug when calling Swift_Preferences before anything else (regression introduced in 4.1.8)\n\n4.1.8 (2012-06-17)\n------------------\n\n * added Japanese iso-2022-jp support\n * changed the init script to lazy-load the initialization\n * fixed docblocks (@id) which caused some problems with libraries parsing the dobclocks\n * fixed Swift_Mime_Headers_IdentificationHeader::setId() when passed an array of ids\n * fixed encoding of email addresses in headers\n * added replacements setter to the Decorator plugin\n\n4.1.7 (2012-04-26)\n------------------\n\n * fixed QpEncoder safeMapShareId property\n\n4.1.6 (2012-03-23)\n------------------\n\n * reduced the size of serialized Messages\n\n4.1.5 (2012-01-04)\n------------------\n\n * enforced Swift_Spool::queueMessage() to return a Boolean\n * made an optimization to the memory spool: start the transport only when required\n * prevented stream_socket_client() from generating an error and throw a Swift_TransportException instead\n * fixed a PHP warning when calling to mail() when safe_mode is off\n * many doc tweaks\n\n4.1.4 (2011-12-16)\n------------------\n\n * added a memory spool (Swift_MemorySpool)\n * fixed too many opened files when sending emails with attachments\n\n4.1.3 (2011-10-27)\n------------------\n\n * added STARTTLS support\n * added missing @return tags on fluent methods\n * added a MessageLogger plugin that logs all sent messages\n * added composer.json\n\n4.1.2 (2011-09-13)\n------------------\n\n * fixed wrong detection of magic_quotes_runtime\n * fixed fatal errors when no To or Subject header has been set\n * fixed charset on parameter header continuations\n * added documentation about how to install Swiftmailer from the PEAR channel\n * fixed various typos and markup problem in the documentation\n * fixed warning when cache directory does not exist\n * fixed \"slashes are escaped\" bug\n * changed require_once() to require() in autoload\n\n4.1.1 (2011-07-04)\n------------------\n\n * added missing file in PEAR package\n\n4.1.0 (2011-06-30)\n------------------\n\n * documentation has been converted to ReST\n\n4.1.0 RC1 (2011-06-17)\n----------------------\n\nNew features:\n\n * changed the Decorator Plugin to allow replacements in all headers\n * added Swift_Mime_Grammar and Swift_Validate to validate an email address\n * modified the autoloader to lazy-initialize Swiftmailer\n * removed Swift_Mailer::batchSend()\n * added NullTransport\n * added new plugins: RedirectingPlugin and ImpersonatePlugin\n * added a way to send messages asynchronously (Spool)\n"
  },
  {
    "path": "website/lib/swiftmailer/LICENSE",
    "content": "Copyright (c) 2013-2016 Fabien Potencier\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "website/lib/swiftmailer/README",
    "content": "Swift Mailer\n------------\n\nSwift Mailer is a component based mailing solution for PHP 5.\nIt is released under the MIT license.\n\nHomepage:      http://swiftmailer.org\nDocumentation: http://swiftmailer.org/docs\nBugs:          https://github.com/swiftmailer/swiftmailer/issues\nRepository:    https://github.com/swiftmailer/swiftmailer\n\nSwift Mailer is highly object-oriented by design and lends itself\nto use in complex web application with a great deal of flexibility.\n\nFor full details on usage, see the documentation.\n"
  },
  {
    "path": "website/lib/swiftmailer/VERSION",
    "content": "Swift-5.4.2\n"
  },
  {
    "path": "website/lib/swiftmailer/composer.json",
    "content": "{\n    \"name\": \"swiftmailer/swiftmailer\",\n    \"type\": \"library\",\n    \"description\": \"Swiftmailer, free feature-rich PHP mailer\",\n    \"keywords\": [\"mail\",\"mailer\",\"email\"],\n    \"homepage\": \"http://swiftmailer.org\",\n    \"license\": \"MIT\",\n    \"authors\": [{\n            \"name\": \"Chris Corbyn\"\n        },{\n            \"name\": \"Fabien Potencier\",\n            \"email\": \"fabien@symfony.com\"\n        }\n    ],\n    \"require\": {\n        \"php\": \">=5.3.3\"\n    },\n    \"require-dev\": {\n        \"mockery/mockery\": \"~0.9.1,<0.9.4\"\n    },\n    \"autoload\": {\n        \"files\": [\"lib/swift_required.php\"]\n    },\n    \"autoload-dev\": {\n        \"psr-0\": {\n            \"Swift_\": \"tests/unit\"\n        }\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"5.4-dev\"\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Attachment.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Attachment class for attaching files to a {@link Swift_Mime_Message}.\n *\n * @author Chris Corbyn\n */\nclass Swift_Attachment extends Swift_Mime_Attachment{\n    /**\n     * Create a new Attachment.\n     *\n     * Details may be optionally provided to the constructor.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     */\n    public function __construct($data = null, $filename = null, $contentType = null) {\n        call_user_func_array(\n            array($this, 'Swift_Mime_Attachment::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('mime.attachment')\n            );\n\n        $this->setBody($data);\n        $this->setFilename($filename);\n        if ($contentType) {\n            $this->setContentType($contentType);\n        }\n    }\n\n    /**\n     * Create a new Attachment.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public static function newInstance($data = null, $filename = null, $contentType = null) {\n        return new self($data, $filename, $contentType);\n    }\n\n    /**\n     * Create a new Attachment from a filesystem path.\n     *\n     * @param string $path\n     * @param string $contentType optional\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public static function fromPath($path, $contentType = null) {\n        return self::newInstance()->setFile(\n            new Swift_ByteStream_FileByteStream($path),\n            $contentType\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides the base functionality for an InputStream supporting filters.\n *\n * @author Chris Corbyn\n */\nabstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_InputByteStream, Swift_Filterable{\n    /**\n     * Write sequence.\n     */\n    protected $_sequence = 0;\n\n    /**\n     * StreamFilters.\n     *\n     * @var Swift_StreamFilter[]\n     */\n    private $_filters = array();\n\n    /**\n     * A buffer for writing.\n     */\n    private $_writeBuffer = '';\n\n    /**\n     * Bound streams.\n     *\n     * @var Swift_InputByteStream[]\n     */\n    private $_mirrors = array();\n\n    /**\n     * Commit the given bytes to the storage medium immediately.\n     *\n     * @param string $bytes\n     */\n    abstract protected function _commit($bytes);\n\n    /**\n     * Flush any buffers/content with immediate effect.\n     */\n    abstract protected function _flush();\n\n    /**\n     * Add a StreamFilter to this InputByteStream.\n     *\n     * @param Swift_StreamFilter $filter\n     * @param string             $key\n     */\n    public function addFilter(Swift_StreamFilter $filter, $key) {\n        $this->_filters[$key] = $filter;\n    }\n\n    /**\n     * Remove an already present StreamFilter based on its $key.\n     *\n     * @param string $key\n     */\n    public function removeFilter($key) {\n        unset($this->_filters[$key]);\n    }\n\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * @param string $bytes\n     *\n     * @throws Swift_IoException\n     *\n     * @return int\n     */\n    public function write($bytes) {\n        $this->_writeBuffer .= $bytes;\n        foreach ($this->_filters as $filter) {\n            if ($filter->shouldBuffer($this->_writeBuffer)) {\n                return;\n            }\n        }\n        $this->_doWrite($this->_writeBuffer);\n\n        return ++$this->_sequence;\n    }\n\n    /**\n     * For any bytes that are currently buffered inside the stream, force them\n     * off the buffer.\n     *\n     * @throws Swift_IoException\n     */\n    public function commit() {\n        $this->_doWrite($this->_writeBuffer);\n    }\n\n    /**\n     * Attach $is to this stream.\n     *\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function bind(Swift_InputByteStream $is) {\n        $this->_mirrors[] = $is;\n    }\n\n    /**\n     * Remove an already bound stream.\n     *\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function unbind(Swift_InputByteStream $is) {\n        foreach ($this->_mirrors as $k => $stream) {\n            if ($is === $stream) {\n                if ($this->_writeBuffer !== '') {\n                    $stream->write($this->_writeBuffer);\n                }\n                unset($this->_mirrors[$k]);\n            }\n        }\n    }\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     *\n     * @throws Swift_IoException\n     */\n    public function flushBuffers() {\n        if ($this->_writeBuffer !== '') {\n            $this->_doWrite($this->_writeBuffer);\n        }\n        $this->_flush();\n\n        foreach ($this->_mirrors as $stream) {\n            $stream->flushBuffers();\n        }\n    }\n\n    /** Run $bytes through all filters */\n    private function _filter($bytes) {\n        foreach ($this->_filters as $filter) {\n            $bytes = $filter->filter($bytes);\n        }\n\n        return $bytes;\n    }\n\n    /** Just write the bytes to the stream */\n    private function _doWrite($bytes) {\n        $this->_commit($this->_filter($bytes));\n\n        foreach ($this->_mirrors as $stream) {\n            $stream->write($bytes);\n        }\n\n        $this->_writeBuffer = '';\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Allows reading and writing of bytes to and from an array.\n *\n * @author Chris Corbyn\n */\nclass Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_OutputByteStream{\n    /**\n     * The internal stack of bytes.\n     *\n     * @var string[]\n     */\n    private $_array = array();\n\n    /**\n     * The size of the stack.\n     *\n     * @var int\n     */\n    private $_arraySize = 0;\n\n    /**\n     * The internal pointer offset.\n     *\n     * @var int\n     */\n    private $_offset = 0;\n\n    /**\n     * Bound streams.\n     *\n     * @var Swift_InputByteStream[]\n     */\n    private $_mirrors = array();\n\n    /**\n     * Create a new ArrayByteStream.\n     *\n     * If $stack is given the stream will be populated with the bytes it contains.\n     *\n     * @param mixed $stack of bytes in string or array form, optional\n     */\n    public function __construct($stack = null) {\n        if (is_array($stack)) {\n            $this->_array = $stack;\n            $this->_arraySize = count($stack);\n        } elseif (is_string($stack)) {\n            $this->write($stack);\n        } else {\n            $this->_array = array();\n        }\n    }\n\n    /**\n     * Reads $length bytes from the stream into a string and moves the pointer\n     * through the stream by $length.\n     *\n     * If less bytes exist than are requested the\n     * remaining bytes are given instead. If no bytes are remaining at all, boolean\n     * false is returned.\n     *\n     * @param int $length\n     *\n     * @return string\n     */\n    public function read($length) {\n        if ($this->_offset == $this->_arraySize) {\n            return false;\n        }\n\n        // Don't use array slice\n        $end = $length + $this->_offset;\n        $end = $this->_arraySize < $end ? $this->_arraySize : $end;\n        $ret = '';\n        for (; $this->_offset < $end; ++$this->_offset) {\n            $ret .= $this->_array[$this->_offset];\n        }\n\n        return $ret;\n    }\n\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * @param string $bytes\n     */\n    public function write($bytes) {\n        $to_add = str_split($bytes);\n        foreach ($to_add as $value) {\n            $this->_array[] = $value;\n        }\n        $this->_arraySize = count($this->_array);\n\n        foreach ($this->_mirrors as $stream) {\n            $stream->write($bytes);\n        }\n    }\n\n    /**\n     * Not used.\n     */\n    public function commit() {\n    }\n\n    /**\n     * Attach $is to this stream.\n     *\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function bind(Swift_InputByteStream $is) {\n        $this->_mirrors[] = $is;\n    }\n\n    /**\n     * Remove an already bound stream.\n     *\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function unbind(Swift_InputByteStream $is) {\n        foreach ($this->_mirrors as $k => $stream) {\n            if ($is === $stream) {\n                unset($this->_mirrors[$k]);\n            }\n        }\n    }\n\n    /**\n     * Move the internal read pointer to $byteOffset in the stream.\n     *\n     * @param int $byteOffset\n     *\n     * @return bool\n     */\n    public function setReadPointer($byteOffset) {\n        if ($byteOffset > $this->_arraySize) {\n            $byteOffset = $this->_arraySize;\n        } elseif ($byteOffset < 0) {\n            $byteOffset = 0;\n        }\n\n        $this->_offset = $byteOffset;\n    }\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     */\n    public function flushBuffers() {\n        $this->_offset = 0;\n        $this->_array = array();\n        $this->_arraySize = 0;\n\n        foreach ($this->_mirrors as $stream) {\n            $stream->flushBuffers();\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Allows reading and writing of bytes to and from a file.\n *\n * @author Chris Corbyn\n */\nclass Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_FileStream{\n    /** The internal pointer offset */\n    private $_offset = 0;\n\n    /** The path to the file */\n    private $_path;\n\n    /** The mode this file is opened in for writing */\n    private $_mode;\n\n    /** A lazy-loaded resource handle for reading the file */\n    private $_reader;\n\n    /** A lazy-loaded resource handle for writing the file */\n    private $_writer;\n\n    /** If magic_quotes_runtime is on, this will be true */\n    private $_quotes = false;\n\n    /** If stream is seekable true/false, or null if not known */\n    private $_seekable = null;\n\n    /**\n     * Create a new FileByteStream for $path.\n     *\n     * @param string $path\n     * @param bool   $writable if true\n     */\n    public function __construct($path, $writable = false) {\n        if (empty($path)) {\n            throw new Swift_IoException('The path cannot be empty');\n        }\n        $this->_path = $path;\n        $this->_mode = $writable ? 'w+b' : 'rb';\n\n        if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {\n            $this->_quotes = true;\n        }\n    }\n\n    /**\n     * Get the complete path to the file.\n     *\n     * @return string\n     */\n    public function getPath() {\n        return $this->_path;\n    }\n\n    /**\n     * Reads $length bytes from the stream into a string and moves the pointer\n     * through the stream by $length.\n     *\n     * If less bytes exist than are requested the\n     * remaining bytes are given instead. If no bytes are remaining at all, boolean\n     * false is returned.\n     *\n     * @param int $length\n     *\n     * @throws Swift_IoException\n     *\n     * @return string|bool\n     */\n    public function read($length) {\n        $fp = $this->_getReadHandle();\n        if (!feof($fp)) {\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 0);\n            }\n            $bytes = fread($fp, $length);\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 1);\n            }\n            $this->_offset = ftell($fp);\n\n            // If we read one byte after reaching the end of the file\n            // feof() will return false and an empty string is returned\n            if ($bytes === '' && feof($fp)) {\n                $this->_resetReadHandle();\n\n                return false;\n            }\n\n            return $bytes;\n        }\n\n        $this->_resetReadHandle();\n\n        return false;\n    }\n\n    /**\n     * Move the internal read pointer to $byteOffset in the stream.\n     *\n     * @param int $byteOffset\n     *\n     * @return bool\n     */\n    public function setReadPointer($byteOffset) {\n        if (isset($this->_reader)) {\n            $this->_seekReadStreamToPosition($byteOffset);\n        }\n        $this->_offset = $byteOffset;\n    }\n\n    /** Just write the bytes to the file */\n    protected function _commit($bytes) {\n        fwrite($this->_getWriteHandle(), $bytes);\n        $this->_resetReadHandle();\n    }\n\n    /** Not used */\n    protected function _flush() {\n    }\n\n    /** Get the resource for reading */\n    private function _getReadHandle() {\n        if (!isset($this->_reader)) {\n            $pointer = @fopen($this->_path, 'rb');\n            if (!$pointer) {\n                throw new Swift_IoException(\n                    'Unable to open file for reading ['.$this->_path.']'\n                );\n            }\n            $this->_reader = $pointer;\n            if ($this->_offset != 0) {\n                $this->_getReadStreamSeekableStatus();\n                $this->_seekReadStreamToPosition($this->_offset);\n            }\n        }\n\n        return $this->_reader;\n    }\n\n    /** Get the resource for writing */\n    private function _getWriteHandle() {\n        if (!isset($this->_writer)) {\n            if (!$this->_writer = fopen($this->_path, $this->_mode)) {\n                throw new Swift_IoException(\n                    'Unable to open file for writing ['.$this->_path.']'\n                );\n            }\n        }\n\n        return $this->_writer;\n    }\n\n    /** Force a reload of the resource for reading */\n    private function _resetReadHandle() {\n        if (isset($this->_reader)) {\n            fclose($this->_reader);\n            $this->_reader = null;\n        }\n    }\n\n    /** Check if ReadOnly Stream is seekable */\n    private function _getReadStreamSeekableStatus() {\n        $metas = stream_get_meta_data($this->_reader);\n        $this->_seekable = $metas['seekable'];\n    }\n\n    /** Streams in a readOnly stream ensuring copy if needed */\n    private function _seekReadStreamToPosition($offset) {\n        if ($this->_seekable === null) {\n            $this->_getReadStreamSeekableStatus();\n        }\n        if ($this->_seekable === false) {\n            $currentPos = ftell($this->_reader);\n            if ($currentPos < $offset) {\n                $toDiscard = $offset - $currentPos;\n                fread($this->_reader, $toDiscard);\n\n                return;\n            }\n            $this->_copyReadStream();\n        }\n        fseek($this->_reader, $offset, SEEK_SET);\n    }\n\n    /** Copy a readOnly Stream to ensure seekability */\n    private function _copyReadStream() {\n        if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {\n            /* We have opened a php:// Stream Should work without problem */\n        } elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {\n            /* We have opened a tmpfile */\n        } else {\n            throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');\n        }\n        $currentPos = ftell($this->_reader);\n        fclose($this->_reader);\n        $source = fopen($this->_path, 'rb');\n        if (!$source) {\n            throw new Swift_IoException('Unable to open file for copying ['.$this->_path.']');\n        }\n        fseek($tmpFile, 0, SEEK_SET);\n        while (!feof($source)) {\n            fwrite($tmpFile, fread($source, 4096));\n        }\n        fseek($tmpFile, $currentPos, SEEK_SET);\n        fclose($source);\n        $this->_reader = $tmpFile;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php",
    "content": "<?php\n\n/*\n* This file is part of SwiftMailer.\n* (c) 2004-2009 Chris Corbyn\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n/**\n * @author Romain-Geissler\n */\nclass Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByteStream{\n    public function __construct() {\n        $filePath = tempnam(sys_get_temp_dir(), 'FileByteStream');\n\n        if ($filePath === false) {\n            throw new Swift_IoException('Failed to retrieve temporary file name.');\n        }\n\n        parent::__construct($filePath, true);\n    }\n\n    public function getContent() {\n        if (($content = file_get_contents($this->getPath())) === false) {\n            throw new Swift_IoException('Failed to get temporary file content.');\n        }\n\n        return $content;\n    }\n\n    public function __destruct() {\n        if (file_exists($this->getPath())) {\n            @unlink($this->getPath());\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides fixed-width byte sizes for reading fixed-width character sets.\n *\n * @author Chris Corbyn\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader{\n    /**\n     * The number of bytes in a single character.\n     *\n     * @var int\n     */\n    private $_width;\n\n    /**\n     * Creates a new GenericFixedWidthReader using $width bytes per character.\n     *\n     * @param int $width\n     */\n    public function __construct($width) {\n        $this->_width = $width;\n    }\n\n    /**\n     * Returns the complete character map.\n     *\n     * @param string $string\n     * @param int    $startOffset\n     * @param array  $currentMap\n     * @param mixed  $ignoredChars\n     *\n     * @return int\n     */\n    public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) {\n        $strlen = strlen($string);\n        // % and / are CPU intensive, so, maybe find a better way\n        $ignored = $strlen % $this->_width;\n        $ignoredChars = substr($string, -$ignored);\n        $currentMap = $this->_width;\n\n        return ($strlen - $ignored) / $this->_width;\n    }\n\n    /**\n     * Returns the mapType.\n     *\n     * @return int\n     */\n    public function getMapType() {\n        return self::MAP_TYPE_FIXED_LEN;\n    }\n\n    /**\n     * Returns an integer which specifies how many more bytes to read.\n     *\n     * A positive integer indicates the number of more bytes to fetch before invoking\n     * this method again.\n     *\n     * A value of zero means this is already a valid character.\n     * A value of -1 means this cannot possibly be a valid character.\n     *\n     * @param string $bytes\n     * @param int    $size\n     *\n     * @return int\n     */\n    public function validateByteSequence($bytes, $size) {\n        $needed = $this->_width - $size;\n\n        return $needed > -1 ? $needed : -1;\n    }\n\n    /**\n     * Returns the number of bytes which should be read to start each character.\n     *\n     * @return int\n     */\n    public function getInitialByteSize() {\n        return $this->_width;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Analyzes US-ASCII characters.\n *\n * @author Chris Corbyn\n */\nclass Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader{\n    /**\n     * Returns the complete character map.\n     *\n     * @param string $string\n     * @param int    $startOffset\n     * @param array  $currentMap\n     * @param string $ignoredChars\n     *\n     * @return int\n     */\n    public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) {\n        $strlen = strlen($string);\n        $ignoredChars = '';\n        for ($i = 0; $i < $strlen; ++$i) {\n            if ($string[$i] > \"\\x07F\") {\n                // Invalid char\n                $currentMap[$i + $startOffset] = $string[$i];\n            }\n        }\n\n        return $strlen;\n    }\n\n    /**\n     * Returns mapType.\n     *\n     * @return int mapType\n     */\n    public function getMapType() {\n        return self::MAP_TYPE_INVALID;\n    }\n\n    /**\n     * Returns an integer which specifies how many more bytes to read.\n     *\n     * A positive integer indicates the number of more bytes to fetch before invoking\n     * this method again.\n     * A value of zero means this is already a valid character.\n     * A value of -1 means this cannot possibly be a valid character.\n     *\n     * @param string $bytes\n     * @param int    $size\n     *\n     * @return int\n     */\n    public function validateByteSequence($bytes, $size) {\n        $byte = reset($bytes);\n        if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {\n            return 0;\n        }\n\n        return -1;\n    }\n\n    /**\n     * Returns the number of bytes which should be read to start each character.\n     *\n     * @return int\n     */\n    public function getInitialByteSize() {\n        return 1;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Analyzes UTF-8 characters.\n *\n * @author Chris Corbyn\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader{\n    /** Pre-computed for optimization */\n    private static $length_map = array(\n        // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N\n        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N\n        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N\n        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N\n        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN\n        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN\n        2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN\n        2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN\n        3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN\n        4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0,  // 0xFN\n    );\n\n    private static $s_length_map = array(\n        \"\\x00\" => 1, \"\\x01\" => 1, \"\\x02\" => 1, \"\\x03\" => 1, \"\\x04\" => 1, \"\\x05\" => 1, \"\\x06\" => 1, \"\\x07\" => 1,\n        \"\\x08\" => 1, \"\\x09\" => 1, \"\\x0a\" => 1, \"\\x0b\" => 1, \"\\x0c\" => 1, \"\\x0d\" => 1, \"\\x0e\" => 1, \"\\x0f\" => 1,\n        \"\\x10\" => 1, \"\\x11\" => 1, \"\\x12\" => 1, \"\\x13\" => 1, \"\\x14\" => 1, \"\\x15\" => 1, \"\\x16\" => 1, \"\\x17\" => 1,\n        \"\\x18\" => 1, \"\\x19\" => 1, \"\\x1a\" => 1, \"\\x1b\" => 1, \"\\x1c\" => 1, \"\\x1d\" => 1, \"\\x1e\" => 1, \"\\x1f\" => 1,\n        \"\\x20\" => 1, \"\\x21\" => 1, \"\\x22\" => 1, \"\\x23\" => 1, \"\\x24\" => 1, \"\\x25\" => 1, \"\\x26\" => 1, \"\\x27\" => 1,\n        \"\\x28\" => 1, \"\\x29\" => 1, \"\\x2a\" => 1, \"\\x2b\" => 1, \"\\x2c\" => 1, \"\\x2d\" => 1, \"\\x2e\" => 1, \"\\x2f\" => 1,\n        \"\\x30\" => 1, \"\\x31\" => 1, \"\\x32\" => 1, \"\\x33\" => 1, \"\\x34\" => 1, \"\\x35\" => 1, \"\\x36\" => 1, \"\\x37\" => 1,\n        \"\\x38\" => 1, \"\\x39\" => 1, \"\\x3a\" => 1, \"\\x3b\" => 1, \"\\x3c\" => 1, \"\\x3d\" => 1, \"\\x3e\" => 1, \"\\x3f\" => 1,\n        \"\\x40\" => 1, \"\\x41\" => 1, \"\\x42\" => 1, \"\\x43\" => 1, \"\\x44\" => 1, \"\\x45\" => 1, \"\\x46\" => 1, \"\\x47\" => 1,\n        \"\\x48\" => 1, \"\\x49\" => 1, \"\\x4a\" => 1, \"\\x4b\" => 1, \"\\x4c\" => 1, \"\\x4d\" => 1, \"\\x4e\" => 1, \"\\x4f\" => 1,\n        \"\\x50\" => 1, \"\\x51\" => 1, \"\\x52\" => 1, \"\\x53\" => 1, \"\\x54\" => 1, \"\\x55\" => 1, \"\\x56\" => 1, \"\\x57\" => 1,\n        \"\\x58\" => 1, \"\\x59\" => 1, \"\\x5a\" => 1, \"\\x5b\" => 1, \"\\x5c\" => 1, \"\\x5d\" => 1, \"\\x5e\" => 1, \"\\x5f\" => 1,\n        \"\\x60\" => 1, \"\\x61\" => 1, \"\\x62\" => 1, \"\\x63\" => 1, \"\\x64\" => 1, \"\\x65\" => 1, \"\\x66\" => 1, \"\\x67\" => 1,\n        \"\\x68\" => 1, \"\\x69\" => 1, \"\\x6a\" => 1, \"\\x6b\" => 1, \"\\x6c\" => 1, \"\\x6d\" => 1, \"\\x6e\" => 1, \"\\x6f\" => 1,\n        \"\\x70\" => 1, \"\\x71\" => 1, \"\\x72\" => 1, \"\\x73\" => 1, \"\\x74\" => 1, \"\\x75\" => 1, \"\\x76\" => 1, \"\\x77\" => 1,\n        \"\\x78\" => 1, \"\\x79\" => 1, \"\\x7a\" => 1, \"\\x7b\" => 1, \"\\x7c\" => 1, \"\\x7d\" => 1, \"\\x7e\" => 1, \"\\x7f\" => 1,\n        \"\\x80\" => 0, \"\\x81\" => 0, \"\\x82\" => 0, \"\\x83\" => 0, \"\\x84\" => 0, \"\\x85\" => 0, \"\\x86\" => 0, \"\\x87\" => 0,\n        \"\\x88\" => 0, \"\\x89\" => 0, \"\\x8a\" => 0, \"\\x8b\" => 0, \"\\x8c\" => 0, \"\\x8d\" => 0, \"\\x8e\" => 0, \"\\x8f\" => 0,\n        \"\\x90\" => 0, \"\\x91\" => 0, \"\\x92\" => 0, \"\\x93\" => 0, \"\\x94\" => 0, \"\\x95\" => 0, \"\\x96\" => 0, \"\\x97\" => 0,\n        \"\\x98\" => 0, \"\\x99\" => 0, \"\\x9a\" => 0, \"\\x9b\" => 0, \"\\x9c\" => 0, \"\\x9d\" => 0, \"\\x9e\" => 0, \"\\x9f\" => 0,\n        \"\\xa0\" => 0, \"\\xa1\" => 0, \"\\xa2\" => 0, \"\\xa3\" => 0, \"\\xa4\" => 0, \"\\xa5\" => 0, \"\\xa6\" => 0, \"\\xa7\" => 0,\n        \"\\xa8\" => 0, \"\\xa9\" => 0, \"\\xaa\" => 0, \"\\xab\" => 0, \"\\xac\" => 0, \"\\xad\" => 0, \"\\xae\" => 0, \"\\xaf\" => 0,\n        \"\\xb0\" => 0, \"\\xb1\" => 0, \"\\xb2\" => 0, \"\\xb3\" => 0, \"\\xb4\" => 0, \"\\xb5\" => 0, \"\\xb6\" => 0, \"\\xb7\" => 0,\n        \"\\xb8\" => 0, \"\\xb9\" => 0, \"\\xba\" => 0, \"\\xbb\" => 0, \"\\xbc\" => 0, \"\\xbd\" => 0, \"\\xbe\" => 0, \"\\xbf\" => 0,\n        \"\\xc0\" => 2, \"\\xc1\" => 2, \"\\xc2\" => 2, \"\\xc3\" => 2, \"\\xc4\" => 2, \"\\xc5\" => 2, \"\\xc6\" => 2, \"\\xc7\" => 2,\n        \"\\xc8\" => 2, \"\\xc9\" => 2, \"\\xca\" => 2, \"\\xcb\" => 2, \"\\xcc\" => 2, \"\\xcd\" => 2, \"\\xce\" => 2, \"\\xcf\" => 2,\n        \"\\xd0\" => 2, \"\\xd1\" => 2, \"\\xd2\" => 2, \"\\xd3\" => 2, \"\\xd4\" => 2, \"\\xd5\" => 2, \"\\xd6\" => 2, \"\\xd7\" => 2,\n        \"\\xd8\" => 2, \"\\xd9\" => 2, \"\\xda\" => 2, \"\\xdb\" => 2, \"\\xdc\" => 2, \"\\xdd\" => 2, \"\\xde\" => 2, \"\\xdf\" => 2,\n        \"\\xe0\" => 3, \"\\xe1\" => 3, \"\\xe2\" => 3, \"\\xe3\" => 3, \"\\xe4\" => 3, \"\\xe5\" => 3, \"\\xe6\" => 3, \"\\xe7\" => 3,\n        \"\\xe8\" => 3, \"\\xe9\" => 3, \"\\xea\" => 3, \"\\xeb\" => 3, \"\\xec\" => 3, \"\\xed\" => 3, \"\\xee\" => 3, \"\\xef\" => 3,\n        \"\\xf0\" => 4, \"\\xf1\" => 4, \"\\xf2\" => 4, \"\\xf3\" => 4, \"\\xf4\" => 4, \"\\xf5\" => 4, \"\\xf6\" => 4, \"\\xf7\" => 4,\n        \"\\xf8\" => 5, \"\\xf9\" => 5, \"\\xfa\" => 5, \"\\xfb\" => 5, \"\\xfc\" => 6, \"\\xfd\" => 6, \"\\xfe\" => 0, \"\\xff\" => 0,\n     );\n\n    /**\n     * Returns the complete character map.\n     *\n     * @param string $string\n     * @param int    $startOffset\n     * @param array  $currentMap\n     * @param mixed  $ignoredChars\n     *\n     * @return int\n     */\n    public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) {\n        if (!isset($currentMap['i']) || !isset($currentMap['p'])) {\n            $currentMap['p'] = $currentMap['i'] = array();\n        }\n\n        $strlen = strlen($string);\n        $charPos = count($currentMap['p']);\n        $foundChars = 0;\n        $invalid = false;\n        for ($i = 0; $i < $strlen; ++$i) {\n            $char = $string[$i];\n            $size = self::$s_length_map[$char];\n            if ($size == 0) {\n                /* char is invalid, we must wait for a resync */\n                $invalid = true;\n                continue;\n            } else {\n                if ($invalid == true) {\n                    /* We mark the chars as invalid and start a new char */\n                    $currentMap['p'][$charPos + $foundChars] = $startOffset + $i;\n                    $currentMap['i'][$charPos + $foundChars] = true;\n                    ++$foundChars;\n                    $invalid = false;\n                }\n                if (($i + $size) > $strlen) {\n                    $ignoredChars = substr($string, $i);\n                    break;\n                }\n                for ($j = 1; $j < $size; ++$j) {\n                    $char = $string[$i + $j];\n                    if ($char > \"\\x7F\" && $char < \"\\xC0\") {\n                        // Valid - continue parsing\n                    } else {\n                        /* char is invalid, we must wait for a resync */\n                        $invalid = true;\n                        continue 2;\n                    }\n                }\n                /* Ok we got a complete char here */\n                $currentMap['p'][$charPos + $foundChars] = $startOffset + $i + $size;\n                $i += $j - 1;\n                ++$foundChars;\n            }\n        }\n\n        return $foundChars;\n    }\n\n    /**\n     * Returns mapType.\n     *\n     * @return int mapType\n     */\n    public function getMapType() {\n        return self::MAP_TYPE_POSITIONS;\n    }\n\n    /**\n     * Returns an integer which specifies how many more bytes to read.\n     *\n     * A positive integer indicates the number of more bytes to fetch before invoking\n     * this method again.\n     * A value of zero means this is already a valid character.\n     * A value of -1 means this cannot possibly be a valid character.\n     *\n     * @param string $bytes\n     * @param int    $size\n     *\n     * @return int\n     */\n    public function validateByteSequence($bytes, $size) {\n        if ($size < 1) {\n            return -1;\n        }\n        $needed = self::$length_map[$bytes[0]] - $size;\n\n        return $needed > -1 ? $needed : -1;\n    }\n\n    /**\n     * Returns the number of bytes which should be read to start each character.\n     *\n     * @return int\n     */\n    public function getInitialByteSize() {\n        return 1;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Analyzes characters for a specific character set.\n *\n * @author Chris Corbyn\n * @author Xavier De Cock <xdecock@gmail.com>\n */\ninterface Swift_CharacterReader{\n    const MAP_TYPE_INVALID = 0x01;\n    const MAP_TYPE_FIXED_LEN = 0x02;\n    const MAP_TYPE_POSITIONS = 0x03;\n\n    /**\n     * Returns the complete character map.\n     *\n     * @param string $string\n     * @param int    $startOffset\n     * @param array  $currentMap\n     * @param mixed  $ignoredChars\n     *\n     * @return int\n     */\n    public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);\n\n    /**\n     * Returns the mapType, see constants.\n     *\n     * @return int\n     */\n    public function getMapType();\n\n    /**\n     * Returns an integer which specifies how many more bytes to read.\n     *\n     * A positive integer indicates the number of more bytes to fetch before invoking\n     * this method again.\n     *\n     * A value of zero means this is already a valid character.\n     * A value of -1 means this cannot possibly be a valid character.\n     *\n     * @param integer[] $bytes\n     * @param int       $size\n     *\n     * @return int\n     */\n    public function validateByteSequence($bytes, $size);\n\n    /**\n     * Returns the number of bytes which should be read to start each character.\n     *\n     * For fixed width character sets this should be the number of octets-per-character.\n     * For multibyte character sets this will probably be 1.\n     *\n     * @return int\n     */\n    public function getInitialByteSize();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Standard factory for creating CharacterReaders.\n *\n * @author Chris Corbyn\n */\nclass Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift_CharacterReaderFactory{\n    /**\n     * A map of charset patterns to their implementation classes.\n     *\n     * @var array\n     */\n    private static $_map = array();\n\n    /**\n     * Factories which have already been loaded.\n     *\n     * @var Swift_CharacterReaderFactory[]\n     */\n    private static $_loaded = array();\n\n    /**\n     * Creates a new CharacterReaderFactory.\n     */\n    public function __construct() {\n        $this->init();\n    }\n\n    public function __wakeup() {\n        $this->init();\n    }\n\n    public function init() {\n        if (count(self::$_map) > 0) {\n            return;\n        }\n\n        $prefix = 'Swift_CharacterReader_';\n\n        $singleByte = array(\n            'class' => $prefix.'GenericFixedWidthReader',\n            'constructor' => array(1),\n            );\n\n        $doubleByte = array(\n            'class' => $prefix.'GenericFixedWidthReader',\n            'constructor' => array(2),\n            );\n\n        $fourBytes = array(\n            'class' => $prefix.'GenericFixedWidthReader',\n            'constructor' => array(4),\n            );\n\n        // Utf-8\n        self::$_map['utf-?8'] = array(\n            'class' => $prefix.'Utf8Reader',\n            'constructor' => array(),\n            );\n\n        //7-8 bit charsets\n        self::$_map['(us-)?ascii'] = $singleByte;\n        self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;\n        self::$_map['windows-?125[0-9]'] = $singleByte;\n        self::$_map['cp-?[0-9]+'] = $singleByte;\n        self::$_map['ansi'] = $singleByte;\n        self::$_map['macintosh'] = $singleByte;\n        self::$_map['koi-?7'] = $singleByte;\n        self::$_map['koi-?8-?.+'] = $singleByte;\n        self::$_map['mik'] = $singleByte;\n        self::$_map['(cork|t1)'] = $singleByte;\n        self::$_map['v?iscii'] = $singleByte;\n\n        //16 bits\n        self::$_map['(ucs-?2|utf-?16)'] = $doubleByte;\n\n        //32 bits\n        self::$_map['(ucs-?4|utf-?32)'] = $fourBytes;\n\n        // Fallback\n        self::$_map['.*'] = $singleByte;\n    }\n\n    /**\n     * Returns a CharacterReader suitable for the charset applied.\n     *\n     * @param string $charset\n     *\n     * @return Swift_CharacterReader\n     */\n    public function getReaderFor($charset) {\n        $charset = trim(strtolower($charset));\n        foreach (self::$_map as $pattern => $spec) {\n            $re = '/^'.$pattern.'$/D';\n            if (preg_match($re, $charset)) {\n                if (!array_key_exists($pattern, self::$_loaded)) {\n                    $reflector = new ReflectionClass($spec['class']);\n                    if ($reflector->getConstructor()) {\n                        $reader = $reflector->newInstanceArgs($spec['constructor']);\n                    } else {\n                        $reader = $reflector->newInstance();\n                    }\n                    self::$_loaded[$pattern] = $reader;\n                }\n\n                return self::$_loaded[$pattern];\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A factory for creating CharacterReaders.\n *\n * @author Chris Corbyn\n */\ninterface Swift_CharacterReaderFactory{\n    /**\n     * Returns a CharacterReader suitable for the charset applied.\n     *\n     * @param string $charset\n     *\n     * @return Swift_CharacterReader\n     */\n    public function getReaderFor($charset);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A CharacterStream implementation which stores characters in an internal array.\n *\n * @author Chris Corbyn\n */\nclass Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStream{\n    /** A map of byte values and their respective characters */\n    private static $_charMap;\n\n    /** A map of characters and their derivative byte values */\n    private static $_byteMap;\n\n    /** The char reader (lazy-loaded) for the current charset */\n    private $_charReader;\n\n    /** A factory for creating CharacterReader instances */\n    private $_charReaderFactory;\n\n    /** The character set this stream is using */\n    private $_charset;\n\n    /** Array of characters */\n    private $_array = array();\n\n    /** Size of the array of character */\n    private $_array_size = array();\n\n    /** The current character offset in the stream */\n    private $_offset = 0;\n\n    /**\n     * Create a new CharacterStream with the given $chars, if set.\n     *\n     * @param Swift_CharacterReaderFactory $factory for loading validators\n     * @param string                       $charset used in the stream\n     */\n    public function __construct(Swift_CharacterReaderFactory $factory, $charset) {\n        self::_initializeMaps();\n        $this->setCharacterReaderFactory($factory);\n        $this->setCharacterSet($charset);\n    }\n\n    /**\n     * Set the character set used in this CharacterStream.\n     *\n     * @param string $charset\n     */\n    public function setCharacterSet($charset) {\n        $this->_charset = $charset;\n        $this->_charReader = null;\n    }\n\n    /**\n     * Set the CharacterReaderFactory for multi charset support.\n     *\n     * @param Swift_CharacterReaderFactory $factory\n     */\n    public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory) {\n        $this->_charReaderFactory = $factory;\n    }\n\n    /**\n     * Overwrite this character stream using the byte sequence in the byte stream.\n     *\n     * @param Swift_OutputByteStream $os output stream to read from\n     */\n    public function importByteStream(Swift_OutputByteStream $os) {\n        if (!isset($this->_charReader)) {\n            $this->_charReader = $this->_charReaderFactory\n                ->getReaderFor($this->_charset);\n        }\n\n        $startLength = $this->_charReader->getInitialByteSize();\n        while (false !== $bytes = $os->read($startLength)) {\n            $c = array();\n            for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {\n                $c[] = self::$_byteMap[$bytes[$i]];\n            }\n            $size = count($c);\n            $need = $this->_charReader\n                ->validateByteSequence($c, $size);\n            if ($need > 0 &&\n                false !== $bytes = $os->read($need)) {\n                for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {\n                    $c[] = self::$_byteMap[$bytes[$i]];\n                }\n            }\n            $this->_array[] = $c;\n            ++$this->_array_size;\n        }\n    }\n\n    /**\n     * Import a string a bytes into this CharacterStream, overwriting any existing\n     * data in the stream.\n     *\n     * @param string $string\n     */\n    public function importString($string) {\n        $this->flushContents();\n        $this->write($string);\n    }\n\n    /**\n     * Read $length characters from the stream and move the internal pointer\n     * $length further into the stream.\n     *\n     * @param int $length\n     *\n     * @return string\n     */\n    public function read($length) {\n        if ($this->_offset == $this->_array_size) {\n            return false;\n        }\n\n        // Don't use array slice\n        $arrays = array();\n        $end = $length + $this->_offset;\n        for ($i = $this->_offset; $i < $end; ++$i) {\n            if (!isset($this->_array[$i])) {\n                break;\n            }\n            $arrays[] = $this->_array[$i];\n        }\n        $this->_offset += $i - $this->_offset; // Limit function calls\n        $chars = false;\n        foreach ($arrays as $array) {\n            $chars .= implode('', array_map('chr', $array));\n        }\n\n        return $chars;\n    }\n\n    /**\n     * Read $length characters from the stream and return a 1-dimensional array\n     * containing there octet values.\n     *\n     * @param int $length\n     *\n     * @return integer[]\n     */\n    public function readBytes($length) {\n        if ($this->_offset == $this->_array_size) {\n            return false;\n        }\n        $arrays = array();\n        $end = $length + $this->_offset;\n        for ($i = $this->_offset; $i < $end; ++$i) {\n            if (!isset($this->_array[$i])) {\n                break;\n            }\n            $arrays[] = $this->_array[$i];\n        }\n        $this->_offset += ($i - $this->_offset); // Limit function calls\n\n        return call_user_func_array('array_merge', $arrays);\n    }\n\n    /**\n     * Write $chars to the end of the stream.\n     *\n     * @param string $chars\n     */\n    public function write($chars) {\n        if (!isset($this->_charReader)) {\n            $this->_charReader = $this->_charReaderFactory->getReaderFor(\n                $this->_charset);\n        }\n\n        $startLength = $this->_charReader->getInitialByteSize();\n\n        $fp = fopen('php://memory', 'w+b');\n        fwrite($fp, $chars);\n        unset($chars);\n        fseek($fp, 0, SEEK_SET);\n\n        $buffer = array(0);\n        $buf_pos = 1;\n        $buf_len = 1;\n        $has_datas = true;\n        do {\n            $bytes = array();\n            // Buffer Filing\n            if ($buf_len - $buf_pos < $startLength) {\n                $buf = array_splice($buffer, $buf_pos);\n                $new = $this->_reloadBuffer($fp, 100);\n                if ($new) {\n                    $buffer = array_merge($buf, $new);\n                    $buf_len = count($buffer);\n                    $buf_pos = 0;\n                } else {\n                    $has_datas = false;\n                }\n            }\n            if ($buf_len - $buf_pos > 0) {\n                $size = 0;\n                for ($i = 0; $i < $startLength && isset($buffer[$buf_pos]); ++$i) {\n                    ++$size;\n                    $bytes[] = $buffer[$buf_pos++];\n                }\n                $need = $this->_charReader->validateByteSequence(\n                    $bytes, $size);\n                if ($need > 0) {\n                    if ($buf_len - $buf_pos < $need) {\n                        $new = $this->_reloadBuffer($fp, $need);\n\n                        if ($new) {\n                            $buffer = array_merge($buffer, $new);\n                            $buf_len = count($buffer);\n                        }\n                    }\n                    for ($i = 0; $i < $need && isset($buffer[$buf_pos]); ++$i) {\n                        $bytes[] = $buffer[$buf_pos++];\n                    }\n                }\n                $this->_array[] = $bytes;\n                ++$this->_array_size;\n            }\n        } while ($has_datas);\n\n        fclose($fp);\n    }\n\n    /**\n     * Move the internal pointer to $charOffset in the stream.\n     *\n     * @param int $charOffset\n     */\n    public function setPointer($charOffset) {\n        if ($charOffset > $this->_array_size) {\n            $charOffset = $this->_array_size;\n        } elseif ($charOffset < 0) {\n            $charOffset = 0;\n        }\n        $this->_offset = $charOffset;\n    }\n\n    /**\n     * Empty the stream and reset the internal pointer.\n     */\n    public function flushContents() {\n        $this->_offset = 0;\n        $this->_array = array();\n        $this->_array_size = 0;\n    }\n\n    private function _reloadBuffer($fp, $len) {\n        if (!feof($fp) && ($bytes = fread($fp, $len)) !== false) {\n            $buf = array();\n            for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {\n                $buf[] = self::$_byteMap[$bytes[$i]];\n            }\n\n            return $buf;\n        }\n\n        return false;\n    }\n\n    private static function _initializeMaps() {\n        if (!isset(self::$_charMap)) {\n            self::$_charMap = array();\n            for ($byte = 0; $byte < 256; ++$byte) {\n                self::$_charMap[$byte] = chr($byte);\n            }\n            self::$_byteMap = array_flip(self::$_charMap);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A CharacterStream implementation which stores characters in an internal array.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream{\n    /**\n     * The char reader (lazy-loaded) for the current charset.\n     *\n     * @var Swift_CharacterReader\n     */\n    private $_charReader;\n\n    /**\n     * A factory for creating CharacterReader instances.\n     *\n     * @var Swift_CharacterReaderFactory\n     */\n    private $_charReaderFactory;\n\n    /**\n     * The character set this stream is using.\n     *\n     * @var string\n     */\n    private $_charset;\n\n    /**\n     * The data's stored as-is.\n     *\n     * @var string\n     */\n    private $_datas = '';\n\n    /**\n     * Number of bytes in the stream.\n     *\n     * @var int\n     */\n    private $_datasSize = 0;\n\n    /**\n     * Map.\n     *\n     * @var mixed\n     */\n    private $_map;\n\n    /**\n     * Map Type.\n     *\n     * @var int\n     */\n    private $_mapType = 0;\n\n    /**\n     * Number of characters in the stream.\n     *\n     * @var int\n     */\n    private $_charCount = 0;\n\n    /**\n     * Position in the stream.\n     *\n     * @var int\n     */\n    private $_currentPos = 0;\n\n    /**\n     * Constructor.\n     *\n     * @param Swift_CharacterReaderFactory $factory\n     * @param string                       $charset\n     */\n    public function __construct(Swift_CharacterReaderFactory $factory, $charset) {\n        $this->setCharacterReaderFactory($factory);\n        $this->setCharacterSet($charset);\n    }\n\n    /* -- Changing parameters of the stream -- */\n\n    /**\n     * Set the character set used in this CharacterStream.\n     *\n     * @param string $charset\n     */\n    public function setCharacterSet($charset) {\n        $this->_charset = $charset;\n        $this->_charReader = null;\n        $this->_mapType = 0;\n    }\n\n    /**\n     * Set the CharacterReaderFactory for multi charset support.\n     *\n     * @param Swift_CharacterReaderFactory $factory\n     */\n    public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory) {\n        $this->_charReaderFactory = $factory;\n    }\n\n    /**\n     * @see Swift_CharacterStream::flushContents()\n     */\n    public function flushContents() {\n        $this->_datas = null;\n        $this->_map = null;\n        $this->_charCount = 0;\n        $this->_currentPos = 0;\n        $this->_datasSize = 0;\n    }\n\n    /**\n     * @see Swift_CharacterStream::importByteStream()\n     *\n     * @param Swift_OutputByteStream $os\n     */\n    public function importByteStream(Swift_OutputByteStream $os) {\n        $this->flushContents();\n        $blocks = 512;\n        $os->setReadPointer(0);\n        while (false !== ($read = $os->read($blocks))) {\n            $this->write($read);\n        }\n    }\n\n    /**\n     * @see Swift_CharacterStream::importString()\n     *\n     * @param string $string\n     */\n    public function importString($string) {\n        $this->flushContents();\n        $this->write($string);\n    }\n\n    /**\n     * @see Swift_CharacterStream::read()\n     *\n     * @param int $length\n     *\n     * @return string\n     */\n    public function read($length) {\n        if ($this->_currentPos >= $this->_charCount) {\n            return false;\n        }\n        $ret = false;\n        $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length;\n        switch ($this->_mapType) {\n            case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:\n                $len = $length * $this->_map;\n                $ret = substr($this->_datas,\n                        $this->_currentPos * $this->_map,\n                        $len);\n                $this->_currentPos += $length;\n                break;\n\n            case Swift_CharacterReader::MAP_TYPE_INVALID:\n                $ret = '';\n                for (; $this->_currentPos < $length; ++$this->_currentPos) {\n                    if (isset($this->_map[$this->_currentPos])) {\n                        $ret .= '?';\n                    } else {\n                        $ret .= $this->_datas[$this->_currentPos];\n                    }\n                }\n                break;\n\n            case Swift_CharacterReader::MAP_TYPE_POSITIONS:\n                $end = $this->_currentPos + $length;\n                $end = $end > $this->_charCount ? $this->_charCount : $end;\n                $ret = '';\n                $start = 0;\n                if ($this->_currentPos > 0) {\n                    $start = $this->_map['p'][$this->_currentPos - 1];\n                }\n                $to = $start;\n                for (; $this->_currentPos < $end; ++$this->_currentPos) {\n                    if (isset($this->_map['i'][$this->_currentPos])) {\n                        $ret .= substr($this->_datas, $start, $to - $start).'?';\n                        $start = $this->_map['p'][$this->_currentPos];\n                    } else {\n                        $to = $this->_map['p'][$this->_currentPos];\n                    }\n                }\n                $ret .= substr($this->_datas, $start, $to - $start);\n                break;\n        }\n\n        return $ret;\n    }\n\n    /**\n     * @see Swift_CharacterStream::readBytes()\n     *\n     * @param int $length\n     *\n     * @return integer[]\n     */\n    public function readBytes($length) {\n        $read = $this->read($length);\n        if ($read !== false) {\n            $ret = array_map('ord', str_split($read, 1));\n\n            return $ret;\n        }\n\n        return false;\n    }\n\n    /**\n     * @see Swift_CharacterStream::setPointer()\n     *\n     * @param int $charOffset\n     */\n    public function setPointer($charOffset) {\n        if ($this->_charCount < $charOffset) {\n            $charOffset = $this->_charCount;\n        }\n        $this->_currentPos = $charOffset;\n    }\n\n    /**\n     * @see Swift_CharacterStream::write()\n     *\n     * @param string $chars\n     */\n    public function write($chars) {\n        if (!isset($this->_charReader)) {\n            $this->_charReader = $this->_charReaderFactory->getReaderFor(\n                $this->_charset);\n            $this->_map = array();\n            $this->_mapType = $this->_charReader->getMapType();\n        }\n        $ignored = '';\n        $this->_datas .= $chars;\n        $this->_charCount += $this->_charReader->getCharPositions(substr($this->_datas, $this->_datasSize), $this->_datasSize, $this->_map, $ignored);\n        if ($ignored !== false) {\n            $this->_datasSize = strlen($this->_datas) - strlen($ignored);\n        } else {\n            $this->_datasSize = strlen($this->_datas);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/CharacterStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An abstract means of reading and writing data in terms of characters as opposed\n * to bytes.\n *\n * Classes implementing this interface may use a subsystem which requires less\n * memory than working with large strings of data.\n *\n * @author Chris Corbyn\n */\ninterface Swift_CharacterStream{\n    /**\n     * Set the character set used in this CharacterStream.\n     *\n     * @param string $charset\n     */\n    public function setCharacterSet($charset);\n\n    /**\n     * Set the CharacterReaderFactory for multi charset support.\n     *\n     * @param Swift_CharacterReaderFactory $factory\n     */\n    public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory);\n\n    /**\n     * Overwrite this character stream using the byte sequence in the byte stream.\n     *\n     * @param Swift_OutputByteStream $os output stream to read from\n     */\n    public function importByteStream(Swift_OutputByteStream $os);\n\n    /**\n     * Import a string a bytes into this CharacterStream, overwriting any existing\n     * data in the stream.\n     *\n     * @param string $string\n     */\n    public function importString($string);\n\n    /**\n     * Read $length characters from the stream and move the internal pointer\n     * $length further into the stream.\n     *\n     * @param int $length\n     *\n     * @return string\n     */\n    public function read($length);\n\n    /**\n     * Read $length characters from the stream and return a 1-dimensional array\n     * containing there octet values.\n     *\n     * @param int $length\n     *\n     * @return int[]\n     */\n    public function readBytes($length);\n\n    /**\n     * Write $chars to the end of the stream.\n     *\n     * @param string $chars\n     */\n    public function write($chars);\n\n    /**\n     * Move the internal pointer to $charOffset in the stream.\n     *\n     * @param int $charOffset\n     */\n    public function setPointer($charOffset);\n\n    /**\n     * Empty the stream and reset the internal pointer.\n     */\n    public function flushContents();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ConfigurableSpool.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Base class for Spools (implements time and message limits).\n *\n * @author Fabien Potencier\n */\nabstract class Swift_ConfigurableSpool implements Swift_Spool{\n    /** The maximum number of messages to send per flush */\n    private $_message_limit;\n\n    /** The time limit per flush */\n    private $_time_limit;\n\n    /**\n     * Sets the maximum number of messages to send per flush.\n     *\n     * @param int $limit\n     */\n    public function setMessageLimit($limit) {\n        $this->_message_limit = (int) $limit;\n    }\n\n    /**\n     * Gets the maximum number of messages to send per flush.\n     *\n     * @return int The limit\n     */\n    public function getMessageLimit() {\n        return $this->_message_limit;\n    }\n\n    /**\n     * Sets the time limit (in seconds) per flush.\n     *\n     * @param int $limit The limit\n     */\n    public function setTimeLimit($limit) {\n        $this->_time_limit = (int) $limit;\n    }\n\n    /**\n     * Gets the time limit (in seconds) per flush.\n     *\n     * @return int The limit\n     */\n    public function getTimeLimit() {\n        return $this->_time_limit;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/DependencyContainer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Dependency Injection container.\n *\n * @author Chris Corbyn\n */\nclass Swift_DependencyContainer{\n    /** Constant for literal value types */\n    const TYPE_VALUE = 0x0001;\n\n    /** Constant for new instance types */\n    const TYPE_INSTANCE = 0x0010;\n\n    /** Constant for shared instance types */\n    const TYPE_SHARED = 0x0100;\n\n    /** Constant for aliases */\n    const TYPE_ALIAS = 0x1000;\n\n    /** Singleton instance */\n    private static $_instance = null;\n\n    /** The data container */\n    private $_store = array();\n\n    /** The current endpoint in the data container */\n    private $_endPoint;\n\n    /**\n     * Constructor should not be used.\n     *\n     * Use {@link getInstance()} instead.\n     */\n    public function __construct() {\n    }\n\n    /**\n     * Returns a singleton of the DependencyContainer.\n     *\n     * @return Swift_DependencyContainer\n     */\n    public static function getInstance() {\n        if (!isset(self::$_instance)) {\n            self::$_instance = new self();\n        }\n\n        return self::$_instance;\n    }\n\n    /**\n     * List the names of all items stored in the Container.\n     *\n     * @return array\n     */\n    public function listItems() {\n        return array_keys($this->_store);\n    }\n\n    /**\n     * Test if an item is registered in this container with the given name.\n     *\n     * @see register()\n     *\n     * @param string $itemName\n     *\n     * @return bool\n     */\n    public function has($itemName) {\n        return array_key_exists($itemName, $this->_store)\n            && isset($this->_store[$itemName]['lookupType']);\n    }\n\n    /**\n     * Lookup the item with the given $itemName.\n     *\n     * @see register()\n     *\n     * @param string $itemName\n     *\n     * @throws Swift_DependencyException If the dependency is not found\n     *\n     * @return mixed\n     */\n    public function lookup($itemName) {\n        if (!$this->has($itemName)) {\n            throw new Swift_DependencyException(\n                'Cannot lookup dependency \"'.$itemName.'\" since it is not registered.'\n                );\n        }\n\n        switch ($this->_store[$itemName]['lookupType']) {\n            case self::TYPE_ALIAS:\n                return $this->_createAlias($itemName);\n            case self::TYPE_VALUE:\n                return $this->_getValue($itemName);\n            case self::TYPE_INSTANCE:\n                return $this->_createNewInstance($itemName);\n            case self::TYPE_SHARED:\n                return $this->_createSharedInstance($itemName);\n        }\n    }\n\n    /**\n     * Create an array of arguments passed to the constructor of $itemName.\n     *\n     * @param string $itemName\n     *\n     * @return array\n     */\n    public function createDependenciesFor($itemName) {\n        $args = array();\n        if (isset($this->_store[$itemName]['args'])) {\n            $args = $this->_resolveArgs($this->_store[$itemName]['args']);\n        }\n\n        return $args;\n    }\n\n    /**\n     * Register a new dependency with $itemName.\n     *\n     * This method returns the current DependencyContainer instance because it\n     * requires the use of the fluid interface to set the specific details for the\n     * dependency.\n     *\n     * @see asNewInstanceOf(), asSharedInstanceOf(), asValue()\n     *\n     * @param string $itemName\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function register($itemName) {\n        $this->_store[$itemName] = array();\n        $this->_endPoint = &$this->_store[$itemName];\n\n        return $this;\n    }\n\n    /**\n     * Specify the previously registered item as a literal value.\n     *\n     * {@link register()} must be called before this will work.\n     *\n     * @param mixed $value\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function asValue($value) {\n        $endPoint = &$this->_getEndPoint();\n        $endPoint['lookupType'] = self::TYPE_VALUE;\n        $endPoint['value'] = $value;\n\n        return $this;\n    }\n\n    /**\n     * Specify the previously registered item as an alias of another item.\n     *\n     * @param string $lookup\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function asAliasOf($lookup) {\n        $endPoint = &$this->_getEndPoint();\n        $endPoint['lookupType'] = self::TYPE_ALIAS;\n        $endPoint['ref'] = $lookup;\n\n        return $this;\n    }\n\n    /**\n     * Specify the previously registered item as a new instance of $className.\n     *\n     * {@link register()} must be called before this will work.\n     * Any arguments can be set with {@link withDependencies()},\n     * {@link addConstructorValue()} or {@link addConstructorLookup()}.\n     *\n     * @see withDependencies(), addConstructorValue(), addConstructorLookup()\n     *\n     * @param string $className\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function asNewInstanceOf($className) {\n        $endPoint = &$this->_getEndPoint();\n        $endPoint['lookupType'] = self::TYPE_INSTANCE;\n        $endPoint['className'] = $className;\n\n        return $this;\n    }\n\n    /**\n     * Specify the previously registered item as a shared instance of $className.\n     *\n     * {@link register()} must be called before this will work.\n     *\n     * @param string $className\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function asSharedInstanceOf($className) {\n        $endPoint = &$this->_getEndPoint();\n        $endPoint['lookupType'] = self::TYPE_SHARED;\n        $endPoint['className'] = $className;\n\n        return $this;\n    }\n\n    /**\n     * Specify a list of injected dependencies for the previously registered item.\n     *\n     * This method takes an array of lookup names.\n     *\n     * @see addConstructorValue(), addConstructorLookup()\n     *\n     * @param array $lookups\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function withDependencies(array $lookups) {\n        $endPoint = &$this->_getEndPoint();\n        $endPoint['args'] = array();\n        foreach ($lookups as $lookup) {\n            $this->addConstructorLookup($lookup);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Specify a literal (non looked up) value for the constructor of the\n     * previously registered item.\n     *\n     * @see withDependencies(), addConstructorLookup()\n     *\n     * @param mixed $value\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function addConstructorValue($value) {\n        $endPoint = &$this->_getEndPoint();\n        if (!isset($endPoint['args'])) {\n            $endPoint['args'] = array();\n        }\n        $endPoint['args'][] = array('type' => 'value', 'item' => $value);\n\n        return $this;\n    }\n\n    /**\n     * Specify a dependency lookup for the constructor of the previously\n     * registered item.\n     *\n     * @see withDependencies(), addConstructorValue()\n     *\n     * @param string $lookup\n     *\n     * @return Swift_DependencyContainer\n     */\n    public function addConstructorLookup($lookup) {\n        $endPoint = &$this->_getEndPoint();\n        if (!isset($this->_endPoint['args'])) {\n            $endPoint['args'] = array();\n        }\n        $endPoint['args'][] = array('type' => 'lookup', 'item' => $lookup);\n\n        return $this;\n    }\n\n    /** Get the literal value with $itemName */\n    private function _getValue($itemName) {\n        return $this->_store[$itemName]['value'];\n    }\n\n    /** Resolve an alias to another item */\n    private function _createAlias($itemName) {\n        return $this->lookup($this->_store[$itemName]['ref']);\n    }\n\n    /** Create a fresh instance of $itemName */\n    private function _createNewInstance($itemName) {\n        $reflector = new ReflectionClass($this->_store[$itemName]['className']);\n        if ($reflector->getConstructor()) {\n            return $reflector->newInstanceArgs(\n                $this->createDependenciesFor($itemName)\n                );\n        }\n\n        return $reflector->newInstance();\n    }\n\n    /** Create and register a shared instance of $itemName */\n    private function _createSharedInstance($itemName) {\n        if (!isset($this->_store[$itemName]['instance'])) {\n            $this->_store[$itemName]['instance'] = $this->_createNewInstance($itemName);\n        }\n\n        return $this->_store[$itemName]['instance'];\n    }\n\n    /** Get the current endpoint in the store */\n    private function &_getEndPoint() {\n        if (!isset($this->_endPoint)) {\n            throw new BadMethodCallException(\n                'Component must first be registered by calling register()'\n                );\n        }\n\n        return $this->_endPoint;\n    }\n\n    /** Get an argument list with dependencies resolved */\n    private function _resolveArgs(array $args) {\n        $resolved = array();\n        foreach ($args as $argDefinition) {\n            switch ($argDefinition['type']) {\n                case 'lookup':\n                    $resolved[] = $this->_lookupRecursive($argDefinition['item']);\n                    break;\n                case 'value':\n                    $resolved[] = $argDefinition['item'];\n                    break;\n            }\n        }\n\n        return $resolved;\n    }\n\n    /** Resolve a single dependency with an collections */\n    private function _lookupRecursive($item) {\n        if (is_array($item)) {\n            $collection = array();\n            foreach ($item as $k => $v) {\n                $collection[$k] = $this->_lookupRecursive($v);\n            }\n\n            return $collection;\n        }\n\n        return $this->lookup($item);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/DependencyException.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * DependencyException gets thrown when a requested dependency is missing.\n *\n * @author Chris Corbyn\n */\nclass Swift_DependencyException extends Swift_SwiftException{\n    /**\n     * Create a new DependencyException with $message.\n     *\n     * @param string $message\n     */\n    public function __construct($message) {\n        parent::__construct($message);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/EmbeddedFile.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An embedded file, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile{\n    /**\n     * Create a new EmbeddedFile.\n     *\n     * Details may be optionally provided to the constructor.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     */\n    public function __construct($data = null, $filename = null, $contentType = null) {\n        call_user_func_array(\n            array($this, 'Swift_Mime_EmbeddedFile::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('mime.embeddedfile')\n            );\n\n        $this->setBody($data);\n        $this->setFilename($filename);\n        if ($contentType) {\n            $this->setContentType($contentType);\n        }\n    }\n\n    /**\n     * Create a new EmbeddedFile.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     *\n     * @return Swift_Mime_EmbeddedFile\n     */\n    public static function newInstance($data = null, $filename = null, $contentType = null) {\n        return new self($data, $filename, $contentType);\n    }\n\n    /**\n     * Create a new EmbeddedFile from a filesystem path.\n     *\n     * @param string $path\n     *\n     * @return Swift_Mime_EmbeddedFile\n     */\n    public static function fromPath($path) {\n        return self::newInstance()->setFile(\n            new Swift_ByteStream_FileByteStream($path)\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Base 64 Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Encoder_Base64Encoder implements Swift_Encoder{\n    /**\n     * Takes an unencoded string and produces a Base64 encoded string from it.\n     *\n     * Base64 encoded strings have a maximum line length of 76 characters.\n     * If the first line needs to be shorter, indicate the difference with\n     * $firstLineOffset.\n     *\n     * @param string $string          to encode\n     * @param int    $firstLineOffset\n     * @param int    $maxLineLength   optional, 0 indicates the default of 76 bytes\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        if (0 >= $maxLineLength || 76 < $maxLineLength) {\n            $maxLineLength = 76;\n        }\n\n        $encodedString = base64_encode($string);\n        $firstLine = '';\n\n        if (0 != $firstLineOffset) {\n            $firstLine = substr(\n                $encodedString, 0, $maxLineLength - $firstLineOffset\n                ).\"\\r\\n\";\n            $encodedString = substr(\n                $encodedString, $maxLineLength - $firstLineOffset\n                );\n        }\n\n        return $firstLine.trim(chunk_split($encodedString, $maxLineLength, \"\\r\\n\"));\n    }\n\n    /**\n     * Does nothing.\n     */\n    public function charsetChanged($charset) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Quoted Printable (QP) Encoding in Swift Mailer.\n *\n * Possibly the most accurate RFC 2045 QP implementation found in PHP.\n *\n * @author Chris Corbyn\n */\nclass Swift_Encoder_QpEncoder implements Swift_Encoder{\n    /**\n     * The CharacterStream used for reading characters (as opposed to bytes).\n     *\n     * @var Swift_CharacterStream\n     */\n    protected $_charStream;\n\n    /**\n     * A filter used if input should be canonicalized.\n     *\n     * @var Swift_StreamFilter\n     */\n    protected $_filter;\n\n    /**\n     * Pre-computed QP for HUGE optimization.\n     *\n     * @var string[]\n     */\n    protected static $_qpMap = array(\n        0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',\n        5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',\n        10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',\n        15 => '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13',\n        20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18',\n        25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D',\n        30 => '=1E', 31 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22',\n        35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27',\n        40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C',\n        45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', 49 => '=31',\n        50 => '=32', 51 => '=33', 52 => '=34', 53 => '=35', 54 => '=36',\n        55 => '=37', 56 => '=38', 57 => '=39', 58 => '=3A', 59 => '=3B',\n        60 => '=3C', 61 => '=3D', 62 => '=3E', 63 => '=3F', 64 => '=40',\n        65 => '=41', 66 => '=42', 67 => '=43', 68 => '=44', 69 => '=45',\n        70 => '=46', 71 => '=47', 72 => '=48', 73 => '=49', 74 => '=4A',\n        75 => '=4B', 76 => '=4C', 77 => '=4D', 78 => '=4E', 79 => '=4F',\n        80 => '=50', 81 => '=51', 82 => '=52', 83 => '=53', 84 => '=54',\n        85 => '=55', 86 => '=56', 87 => '=57', 88 => '=58', 89 => '=59',\n        90 => '=5A', 91 => '=5B', 92 => '=5C', 93 => '=5D', 94 => '=5E',\n        95 => '=5F', 96 => '=60', 97 => '=61', 98 => '=62', 99 => '=63',\n        100 => '=64', 101 => '=65', 102 => '=66', 103 => '=67', 104 => '=68',\n        105 => '=69', 106 => '=6A', 107 => '=6B', 108 => '=6C', 109 => '=6D',\n        110 => '=6E', 111 => '=6F', 112 => '=70', 113 => '=71', 114 => '=72',\n        115 => '=73', 116 => '=74', 117 => '=75', 118 => '=76', 119 => '=77',\n        120 => '=78', 121 => '=79', 122 => '=7A', 123 => '=7B', 124 => '=7C',\n        125 => '=7D', 126 => '=7E', 127 => '=7F', 128 => '=80', 129 => '=81',\n        130 => '=82', 131 => '=83', 132 => '=84', 133 => '=85', 134 => '=86',\n        135 => '=87', 136 => '=88', 137 => '=89', 138 => '=8A', 139 => '=8B',\n        140 => '=8C', 141 => '=8D', 142 => '=8E', 143 => '=8F', 144 => '=90',\n        145 => '=91', 146 => '=92', 147 => '=93', 148 => '=94', 149 => '=95',\n        150 => '=96', 151 => '=97', 152 => '=98', 153 => '=99', 154 => '=9A',\n        155 => '=9B', 156 => '=9C', 157 => '=9D', 158 => '=9E', 159 => '=9F',\n        160 => '=A0', 161 => '=A1', 162 => '=A2', 163 => '=A3', 164 => '=A4',\n        165 => '=A5', 166 => '=A6', 167 => '=A7', 168 => '=A8', 169 => '=A9',\n        170 => '=AA', 171 => '=AB', 172 => '=AC', 173 => '=AD', 174 => '=AE',\n        175 => '=AF', 176 => '=B0', 177 => '=B1', 178 => '=B2', 179 => '=B3',\n        180 => '=B4', 181 => '=B5', 182 => '=B6', 183 => '=B7', 184 => '=B8',\n        185 => '=B9', 186 => '=BA', 187 => '=BB', 188 => '=BC', 189 => '=BD',\n        190 => '=BE', 191 => '=BF', 192 => '=C0', 193 => '=C1', 194 => '=C2',\n        195 => '=C3', 196 => '=C4', 197 => '=C5', 198 => '=C6', 199 => '=C7',\n        200 => '=C8', 201 => '=C9', 202 => '=CA', 203 => '=CB', 204 => '=CC',\n        205 => '=CD', 206 => '=CE', 207 => '=CF', 208 => '=D0', 209 => '=D1',\n        210 => '=D2', 211 => '=D3', 212 => '=D4', 213 => '=D5', 214 => '=D6',\n        215 => '=D7', 216 => '=D8', 217 => '=D9', 218 => '=DA', 219 => '=DB',\n        220 => '=DC', 221 => '=DD', 222 => '=DE', 223 => '=DF', 224 => '=E0',\n        225 => '=E1', 226 => '=E2', 227 => '=E3', 228 => '=E4', 229 => '=E5',\n        230 => '=E6', 231 => '=E7', 232 => '=E8', 233 => '=E9', 234 => '=EA',\n        235 => '=EB', 236 => '=EC', 237 => '=ED', 238 => '=EE', 239 => '=EF',\n        240 => '=F0', 241 => '=F1', 242 => '=F2', 243 => '=F3', 244 => '=F4',\n        245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9',\n        250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE',\n        255 => '=FF',\n        );\n\n    protected static $_safeMapShare = array();\n\n    /**\n     * A map of non-encoded ascii characters.\n     *\n     * @var string[]\n     */\n    protected $_safeMap = array();\n\n    /**\n     * Creates a new QpEncoder for the given CharacterStream.\n     *\n     * @param Swift_CharacterStream $charStream to use for reading characters\n     * @param Swift_StreamFilter    $filter     if input should be canonicalized\n     */\n    public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null) {\n        $this->_charStream = $charStream;\n        if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) {\n            $this->initSafeMap();\n            self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;\n        } else {\n            $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];\n        }\n        $this->_filter = $filter;\n    }\n\n    public function __sleep() {\n        return array('_charStream', '_filter');\n    }\n\n    public function __wakeup() {\n        if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) {\n            $this->initSafeMap();\n            self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;\n        } else {\n            $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];\n        }\n    }\n\n    protected function getSafeMapShareId() {\n        return get_class($this);\n    }\n\n    protected function initSafeMap() {\n        foreach (array_merge(\n            array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {\n            $this->_safeMap[$byte] = chr($byte);\n        }\n    }\n\n    /**\n     * Takes an unencoded string and produces a QP encoded string from it.\n     *\n     * QP encoded strings have a maximum line length of 76 characters.\n     * If the first line needs to be shorter, indicate the difference with\n     * $firstLineOffset.\n     *\n     * @param string $string           to encode\n     * @param int    $firstLineOffset, optional\n     * @param int    $maxLineLength,   optional 0 indicates the default of 76 chars\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        if ($maxLineLength > 76 || $maxLineLength <= 0) {\n            $maxLineLength = 76;\n        }\n\n        $thisLineLength = $maxLineLength - $firstLineOffset;\n\n        $lines = array();\n        $lNo = 0;\n        $lines[$lNo] = '';\n        $currentLine = &$lines[$lNo++];\n        $size = $lineLen = 0;\n\n        $this->_charStream->flushContents();\n        $this->_charStream->importString($string);\n\n        // Fetching more than 4 chars at one is slower, as is fetching fewer bytes\n        // Conveniently 4 chars is the UTF-8 safe number since UTF-8 has up to 6\n        // bytes per char and (6 * 4 * 3 = 72 chars per line) * =NN is 3 bytes\n        while (false !== $bytes = $this->_nextSequence()) {\n            // If we're filtering the input\n            if (isset($this->_filter)) {\n                // If we can't filter because we need more bytes\n                while ($this->_filter->shouldBuffer($bytes)) {\n                    // Then collect bytes into the buffer\n                    if (false === $moreBytes = $this->_nextSequence(1)) {\n                        break;\n                    }\n\n                    foreach ($moreBytes as $b) {\n                        $bytes[] = $b;\n                    }\n                }\n                // And filter them\n                $bytes = $this->_filter->filter($bytes);\n            }\n\n            $enc = $this->_encodeByteSequence($bytes, $size);\n\n            $i = strpos($enc, '=0D=0A');\n            $newLineLength = $lineLen + ($i === false ? $size : $i);\n\n            if ($currentLine && $newLineLength >= $thisLineLength) {\n                $lines[$lNo] = '';\n                $currentLine = &$lines[$lNo++];\n                $thisLineLength = $maxLineLength;\n                $lineLen = 0;\n            }\n\n            $currentLine .= $enc;\n\n            if ($i === false) {\n                $lineLen += $size;\n            } else {\n                // 6 is the length of '=0D=0A'.\n                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;\n            }\n        }\n\n        return $this->_standardize(implode(\"=\\r\\n\", $lines));\n    }\n\n    /**\n     * Updates the charset used.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->_charStream->setCharacterSet($charset);\n    }\n\n    /**\n     * Encode the given byte array into a verbatim QP form.\n     *\n     * @param integer[] $bytes\n     * @param int       $size\n     *\n     * @return string\n     */\n    protected function _encodeByteSequence(array $bytes, &$size) {\n        $ret = '';\n        $size = 0;\n        foreach ($bytes as $b) {\n            if (isset($this->_safeMap[$b])) {\n                $ret .= $this->_safeMap[$b];\n                ++$size;\n            } else {\n                $ret .= self::$_qpMap[$b];\n                $size += 3;\n            }\n        }\n\n        return $ret;\n    }\n\n    /**\n     * Get the next sequence of bytes to read from the char stream.\n     *\n     * @param int $size number of bytes to read\n     *\n     * @return integer[]\n     */\n    protected function _nextSequence($size = 4) {\n        return $this->_charStream->readBytes($size);\n    }\n\n    /**\n     * Make sure CRLF is correct and HT/SPACE are in valid places.\n     *\n     * @param string $string\n     *\n     * @return string\n     */\n    protected function _standardize($string) {\n        $string = str_replace(array(\"\\t=0D=0A\", ' =0D=0A', '=0D=0A'),\n            array(\"=09\\r\\n\", \"=20\\r\\n\", \"\\r\\n\"), $string\n            );\n        switch ($end = ord(substr($string, -1))) {\n            case 0x09:\n            case 0x20:\n                $string = substr_replace($string, self::$_qpMap[$end], -1);\n        }\n\n        return $string;\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->_charStream = clone $this->_charStream;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles RFC 2231 specified Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Encoder_Rfc2231Encoder implements Swift_Encoder{\n    /**\n     * A character stream to use when reading a string as characters instead of bytes.\n     *\n     * @var Swift_CharacterStream\n     */\n    private $_charStream;\n\n    /**\n     * Creates a new Rfc2231Encoder using the given character stream instance.\n     *\n     * @param Swift_CharacterStream\n     */\n    public function __construct(Swift_CharacterStream $charStream) {\n        $this->_charStream = $charStream;\n    }\n\n    /**\n     * Takes an unencoded string and produces a string encoded according to\n     * RFC 2231 from it.\n     *\n     * @param string $string\n     * @param int    $firstLineOffset\n     * @param int    $maxLineLength   optional, 0 indicates the default of 75 bytes\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        $lines = array();\n        $lineCount = 0;\n        $lines[] = '';\n        $currentLine = &$lines[$lineCount++];\n\n        if (0 >= $maxLineLength) {\n            $maxLineLength = 75;\n        }\n\n        $this->_charStream->flushContents();\n        $this->_charStream->importString($string);\n\n        $thisLineLength = $maxLineLength - $firstLineOffset;\n\n        while (false !== $char = $this->_charStream->read(4)) {\n            $encodedChar = rawurlencode($char);\n            if (0 != strlen($currentLine)\n                && strlen($currentLine.$encodedChar) > $thisLineLength) {\n                $lines[] = '';\n                $currentLine = &$lines[$lineCount++];\n                $thisLineLength = $maxLineLength;\n            }\n            $currentLine .= $encodedChar;\n        }\n\n        return implode(\"\\r\\n\", $lines);\n    }\n\n    /**\n     * Updates the charset used.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->_charStream->setCharacterSet($charset);\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->_charStream = clone $this->_charStream;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Encoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Interface for all Encoder schemes.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Encoder extends Swift_Mime_CharsetObserver{\n    /**\n     * Encode a given string to produce an encoded string.\n     *\n     * @param string $string\n     * @param int    $firstLineOffset if first line needs to be shorter\n     * @param int    $maxLineLength   - 0 indicates the default length for this encoding\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Encoding.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides quick access to each encoding type.\n *\n * @author Chris Corbyn\n */\nclass Swift_Encoding{\n    /**\n     * Get the Encoder that provides 7-bit encoding.\n     *\n     * @return Swift_Mime_ContentEncoder\n     */\n    public static function get7BitEncoding() {\n        return self::_lookup('mime.7bitcontentencoder');\n    }\n\n    /**\n     * Get the Encoder that provides 8-bit encoding.\n     *\n     * @return Swift_Mime_ContentEncoder\n     */\n    public static function get8BitEncoding() {\n        return self::_lookup('mime.8bitcontentencoder');\n    }\n\n    /**\n     * Get the Encoder that provides Quoted-Printable (QP) encoding.\n     *\n     * @return Swift_Mime_ContentEncoder\n     */\n    public static function getQpEncoding() {\n        return self::_lookup('mime.qpcontentencoder');\n    }\n\n    /**\n     * Get the Encoder that provides Base64 encoding.\n     *\n     * @return Swift_Mime_ContentEncoder\n     */\n    public static function getBase64Encoding() {\n        return self::_lookup('mime.base64contentencoder');\n    }\n\n    // -- Private Static Methods\n\n    private static function _lookup($key) {\n        return Swift_DependencyContainer::getInstance()->lookup($key);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/CommandEvent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Generated when a command is sent over an SMTP connection.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_CommandEvent extends Swift_Events_EventObject{\n    /**\n     * The command sent to the server.\n     *\n     * @var string\n     */\n    private $_command;\n\n    /**\n     * An array of codes which a successful response will contain.\n     *\n     * @var integer[]\n     */\n    private $_successCodes = array();\n\n    /**\n     * Create a new CommandEvent for $source with $command.\n     *\n     * @param Swift_Transport $source\n     * @param string          $command\n     * @param array           $successCodes\n     */\n    public function __construct(Swift_Transport $source, $command, $successCodes = array()) {\n        parent::__construct($source);\n        $this->_command = $command;\n        $this->_successCodes = $successCodes;\n    }\n\n    /**\n     * Get the command which was sent to the server.\n     *\n     * @return string\n     */\n    public function getCommand() {\n        return $this->_command;\n    }\n\n    /**\n     * Get the numeric response codes which indicate success for this command.\n     *\n     * @return integer[]\n     */\n    public function getSuccessCodes() {\n        return $this->_successCodes;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/CommandListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Listens for Transports to send commands to the server.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_CommandListener extends Swift_Events_EventListener{\n    /**\n     * Invoked immediately following a command being sent.\n     *\n     * @param Swift_Events_CommandEvent $evt\n     */\n    public function commandSent(Swift_Events_CommandEvent $evt);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/Event.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * The minimum interface for an Event.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_Event{\n    /**\n     * Get the source object of this event.\n     *\n     * @return object\n     */\n    public function getSource();\n\n    /**\n     * Prevent this Event from bubbling any further up the stack.\n     *\n     * @param bool $cancel, optional\n     */\n    public function cancelBubble($cancel = true);\n\n    /**\n     * Returns true if this Event will not bubble any further up the stack.\n     *\n     * @return bool\n     */\n    public function bubbleCancelled();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Interface for the EventDispatcher which handles the event dispatching layer.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_EventDispatcher{\n    /**\n     * Create a new SendEvent for $source and $message.\n     *\n     * @param Swift_Transport $source\n     * @param Swift_Mime_Message\n     *\n     * @return Swift_Events_SendEvent\n     */\n    public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message);\n\n    /**\n     * Create a new CommandEvent for $source and $command.\n     *\n     * @param Swift_Transport $source\n     * @param string          $command      That will be executed\n     * @param array           $successCodes That are needed\n     *\n     * @return Swift_Events_CommandEvent\n     */\n    public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array());\n\n    /**\n     * Create a new ResponseEvent for $source and $response.\n     *\n     * @param Swift_Transport $source\n     * @param string          $response\n     * @param bool            $valid    If the response is valid\n     *\n     * @return Swift_Events_ResponseEvent\n     */\n    public function createResponseEvent(Swift_Transport $source, $response, $valid);\n\n    /**\n     * Create a new TransportChangeEvent for $source.\n     *\n     * @param Swift_Transport $source\n     *\n     * @return Swift_Events_TransportChangeEvent\n     */\n    public function createTransportChangeEvent(Swift_Transport $source);\n\n    /**\n     * Create a new TransportExceptionEvent for $source.\n     *\n     * @param Swift_Transport          $source\n     * @param Swift_TransportException $ex\n     *\n     * @return Swift_Events_TransportExceptionEvent\n     */\n    public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex);\n\n    /**\n     * Bind an event listener to this dispatcher.\n     *\n     * @param Swift_Events_EventListener $listener\n     */\n    public function bindEventListener(Swift_Events_EventListener $listener);\n\n    /**\n     * Dispatch the given Event to all suitable listeners.\n     *\n     * @param Swift_Events_EventObject $evt\n     * @param string                   $target method\n     */\n    public function dispatchEvent(Swift_Events_EventObject $evt, $target);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/EventListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An identity interface which all EventListeners must extend.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_EventListener{\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/EventObject.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A base Event which all Event classes inherit from.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_EventObject implements Swift_Events_Event{\n    /** The source of this Event */\n    private $_source;\n\n    /** The state of this Event (should it bubble up the stack?) */\n    private $_bubbleCancelled = false;\n\n    /**\n     * Create a new EventObject originating at $source.\n     *\n     * @param object $source\n     */\n    public function __construct($source) {\n        $this->_source = $source;\n    }\n\n    /**\n     * Get the source object of this event.\n     *\n     * @return object\n     */\n    public function getSource() {\n        return $this->_source;\n    }\n\n    /**\n     * Prevent this Event from bubbling any further up the stack.\n     *\n     * @param bool $cancel, optional\n     */\n    public function cancelBubble($cancel = true) {\n        $this->_bubbleCancelled = $cancel;\n    }\n\n    /**\n     * Returns true if this Event will not bubble any further up the stack.\n     *\n     * @return bool\n     */\n    public function bubbleCancelled() {\n        return $this->_bubbleCancelled;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Generated when a response is received on a SMTP connection.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_ResponseEvent extends Swift_Events_EventObject{\n    /**\n     * The overall result.\n     *\n     * @var bool\n     */\n    private $_valid;\n\n    /**\n     * The response received from the server.\n     *\n     * @var string\n     */\n    private $_response;\n\n    /**\n     * Create a new ResponseEvent for $source and $response.\n     *\n     * @param Swift_Transport $source\n     * @param string          $response\n     * @param bool            $valid\n     */\n    public function __construct(Swift_Transport $source, $response, $valid = false) {\n        parent::__construct($source);\n        $this->_response = $response;\n        $this->_valid = $valid;\n    }\n\n    /**\n     * Get the response which was received from the server.\n     *\n     * @return string\n     */\n    public function getResponse() {\n        return $this->_response;\n    }\n\n    /**\n     * Get the success status of this Event.\n     *\n     * @return bool\n     */\n    public function isValid() {\n        return $this->_valid;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/ResponseListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Listens for responses from a remote SMTP server.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_ResponseListener extends Swift_Events_EventListener{\n    /**\n     * Invoked immediately following a response coming back.\n     *\n     * @param Swift_Events_ResponseEvent $evt\n     */\n    public function responseReceived(Swift_Events_ResponseEvent $evt);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/SendEvent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Generated when a message is being sent.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_SendEvent extends Swift_Events_EventObject{\n    /** Sending has yet to occur */\n    const RESULT_PENDING = 0x0001;\n\n    /** Email is spooled, ready to be sent */\n    const RESULT_SPOOLED = 0x0011;\n\n    /** Sending was successful */\n    const RESULT_SUCCESS = 0x0010;\n\n    /** Sending worked, but there were some failures */\n    const RESULT_TENTATIVE = 0x0100;\n\n    /** Sending failed */\n    const RESULT_FAILED = 0x1000;\n\n    /**\n     * The Message being sent.\n     *\n     * @var Swift_Mime_Message\n     */\n    private $_message;\n\n    /**\n     * Any recipients which failed after sending.\n     *\n     * @var string[]\n     */\n    private $_failedRecipients = array();\n\n    /**\n     * The overall result as a bitmask from the class constants.\n     *\n     * @var int\n     */\n    private $_result;\n\n    /**\n     * Create a new SendEvent for $source and $message.\n     *\n     * @param Swift_Transport    $source\n     * @param Swift_Mime_Message $message\n     */\n    public function __construct(Swift_Transport $source, Swift_Mime_Message $message) {\n        parent::__construct($source);\n        $this->_message = $message;\n        $this->_result = self::RESULT_PENDING;\n    }\n\n    /**\n     * Get the Transport used to send the Message.\n     *\n     * @return Swift_Transport\n     */\n    public function getTransport() {\n        return $this->getSource();\n    }\n\n    /**\n     * Get the Message being sent.\n     *\n     * @return Swift_Mime_Message\n     */\n    public function getMessage() {\n        return $this->_message;\n    }\n\n    /**\n     * Set the array of addresses that failed in sending.\n     *\n     * @param array $recipients\n     */\n    public function setFailedRecipients($recipients) {\n        $this->_failedRecipients = $recipients;\n    }\n\n    /**\n     * Get an recipient addresses which were not accepted for delivery.\n     *\n     * @return string[]\n     */\n    public function getFailedRecipients() {\n        return $this->_failedRecipients;\n    }\n\n    /**\n     * Set the result of sending.\n     *\n     * @param int $result\n     */\n    public function setResult($result) {\n        $this->_result = $result;\n    }\n\n    /**\n     * Get the result of this Event.\n     *\n     * The return value is a bitmask from\n     * {@see RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}\n     *\n     * @return int\n     */\n    public function getResult() {\n        return $this->_result;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/SendListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Listens for Messages being sent from within the Transport system.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_SendListener extends Swift_Events_EventListener{\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt);\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * The EventDispatcher which handles the event dispatching layer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher{\n    /** A map of event types to their associated listener types */\n    private $_eventMap = array();\n\n    /** Event listeners bound to this dispatcher */\n    private $_listeners = array();\n\n    /** Listeners queued to have an Event bubbled up the stack to them */\n    private $_bubbleQueue = array();\n\n    /**\n     * Create a new EventDispatcher.\n     */\n    public function __construct() {\n        $this->_eventMap = array(\n            'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener',\n            'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener',\n            'Swift_Events_SendEvent' => 'Swift_Events_SendListener',\n            'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener',\n            'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener',\n            );\n    }\n\n    /**\n     * Create a new SendEvent for $source and $message.\n     *\n     * @param Swift_Transport $source\n     * @param Swift_Mime_Message\n     *\n     * @return Swift_Events_SendEvent\n     */\n    public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message) {\n        return new Swift_Events_SendEvent($source, $message);\n    }\n\n    /**\n     * Create a new CommandEvent for $source and $command.\n     *\n     * @param Swift_Transport $source\n     * @param string          $command      That will be executed\n     * @param array           $successCodes That are needed\n     *\n     * @return Swift_Events_CommandEvent\n     */\n    public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array()) {\n        return new Swift_Events_CommandEvent($source, $command, $successCodes);\n    }\n\n    /**\n     * Create a new ResponseEvent for $source and $response.\n     *\n     * @param Swift_Transport $source\n     * @param string          $response\n     * @param bool            $valid    If the response is valid\n     *\n     * @return Swift_Events_ResponseEvent\n     */\n    public function createResponseEvent(Swift_Transport $source, $response, $valid) {\n        return new Swift_Events_ResponseEvent($source, $response, $valid);\n    }\n\n    /**\n     * Create a new TransportChangeEvent for $source.\n     *\n     * @param Swift_Transport $source\n     *\n     * @return Swift_Events_TransportChangeEvent\n     */\n    public function createTransportChangeEvent(Swift_Transport $source) {\n        return new Swift_Events_TransportChangeEvent($source);\n    }\n\n    /**\n     * Create a new TransportExceptionEvent for $source.\n     *\n     * @param Swift_Transport          $source\n     * @param Swift_TransportException $ex\n     *\n     * @return Swift_Events_TransportExceptionEvent\n     */\n    public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex) {\n        return new Swift_Events_TransportExceptionEvent($source, $ex);\n    }\n\n    /**\n     * Bind an event listener to this dispatcher.\n     *\n     * @param Swift_Events_EventListener $listener\n     */\n    public function bindEventListener(Swift_Events_EventListener $listener) {\n        foreach ($this->_listeners as $l) {\n            // Already loaded\n            if ($l === $listener) {\n                return;\n            }\n        }\n        $this->_listeners[] = $listener;\n    }\n\n    /**\n     * Dispatch the given Event to all suitable listeners.\n     *\n     * @param Swift_Events_EventObject $evt\n     * @param string                   $target method\n     */\n    public function dispatchEvent(Swift_Events_EventObject $evt, $target) {\n        $this->_prepareBubbleQueue($evt);\n        $this->_bubble($evt, $target);\n    }\n\n    /** Queue listeners on a stack ready for $evt to be bubbled up it */\n    private function _prepareBubbleQueue(Swift_Events_EventObject $evt) {\n        $this->_bubbleQueue = array();\n        $evtClass = get_class($evt);\n        foreach ($this->_listeners as $listener) {\n            if (array_key_exists($evtClass, $this->_eventMap)\n                && ($listener instanceof $this->_eventMap[$evtClass])) {\n                $this->_bubbleQueue[] = $listener;\n            }\n        }\n    }\n\n    /** Bubble $evt up the stack calling $target() on each listener */\n    private function _bubble(Swift_Events_EventObject $evt, $target) {\n        if (!$evt->bubbleCancelled() && $listener = array_shift($this->_bubbleQueue)) {\n            $listener->$target($evt);\n            $this->_bubble($evt, $target);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Generated when the state of a Transport is changed (i.e. stopped/started).\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_TransportChangeEvent extends Swift_Events_EventObject{\n    /**\n     * Get the Transport.\n     *\n     * @return Swift_Transport\n     */\n    public function getTransport() {\n        return $this->getSource();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Listens for changes within the Transport system.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_TransportChangeListener extends Swift_Events_EventListener{\n    /**\n     * Invoked just before a Transport is started.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt);\n\n    /**\n     * Invoked immediately after the Transport is started.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function transportStarted(Swift_Events_TransportChangeEvent $evt);\n\n    /**\n     * Invoked just before a Transport is stopped.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt);\n\n    /**\n     * Invoked immediately after the Transport is stopped.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function transportStopped(Swift_Events_TransportChangeEvent $evt);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Generated when a TransportException is thrown from the Transport system.\n *\n * @author Chris Corbyn\n */\nclass Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject{\n    /**\n     * The Exception thrown.\n     *\n     * @var Swift_TransportException\n     */\n    private $_exception;\n\n    /**\n     * Create a new TransportExceptionEvent for $transport.\n     *\n     * @param Swift_Transport          $transport\n     * @param Swift_TransportException $ex\n     */\n    public function __construct(Swift_Transport $transport, Swift_TransportException $ex) {\n        parent::__construct($transport);\n        $this->_exception = $ex;\n    }\n\n    /**\n     * Get the TransportException thrown.\n     *\n     * @return Swift_TransportException\n     */\n    public function getException() {\n        return $this->_exception;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Listens for Exceptions thrown from within the Transport system.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Events_TransportExceptionListener extends Swift_Events_EventListener{\n    /**\n     * Invoked as a TransportException is thrown in the Transport system.\n     *\n     * @param Swift_Events_TransportExceptionEvent $evt\n     */\n    public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/FailoverTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Contains a list of redundant Transports so when one fails, the next is used.\n *\n * @author Chris Corbyn\n */\nclass Swift_FailoverTransport extends Swift_Transport_FailoverTransport{\n    /**\n     * Creates a new FailoverTransport with $transports.\n     *\n     * @param Swift_Transport[] $transports\n     */\n    public function __construct($transports = array()) {\n        call_user_func_array(\n            array($this, 'Swift_Transport_FailoverTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.failover')\n            );\n\n        $this->setTransports($transports);\n    }\n\n    /**\n     * Create a new FailoverTransport instance.\n     *\n     * @param Swift_Transport[] $transports\n     *\n     * @return Swift_FailoverTransport\n     */\n    public static function newInstance($transports = array()) {\n        return new self($transports);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/FileSpool.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Stores Messages on the filesystem.\n *\n * @author Fabien Potencier\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_FileSpool extends Swift_ConfigurableSpool{\n    /** The spool directory */\n    private $_path;\n\n    /**\n     * File WriteRetry Limit.\n     *\n     * @var int\n     */\n    private $_retryLimit = 10;\n\n    /**\n     * Create a new FileSpool.\n     *\n     * @param string $path\n     *\n     * @throws Swift_IoException\n     */\n    public function __construct($path) {\n        $this->_path = $path;\n\n        if (!file_exists($this->_path)) {\n            if (!mkdir($this->_path, 0777, true)) {\n                throw new Swift_IoException(sprintf('Unable to create path \"%s\".', $this->_path));\n            }\n        }\n    }\n\n    /**\n     * Tests if this Spool mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return true;\n    }\n\n    /**\n     * Starts this Spool mechanism.\n     */\n    public function start() {\n    }\n\n    /**\n     * Stops this Spool mechanism.\n     */\n    public function stop() {\n    }\n\n    /**\n     * Allow to manage the enqueuing retry limit.\n     *\n     * Default, is ten and allows over 64^20 different fileNames\n     *\n     * @param int $limit\n     */\n    public function setRetryLimit($limit) {\n        $this->_retryLimit = $limit;\n    }\n\n    /**\n     * Queues a message.\n     *\n     * @param Swift_Mime_Message $message The message to store\n     *\n     * @throws Swift_IoException\n     *\n     * @return bool\n     */\n    public function queueMessage(Swift_Mime_Message $message) {\n        $ser = serialize($message);\n        $fileName = $this->_path.'/'.$this->getRandomString(10);\n        for ($i = 0; $i < $this->_retryLimit; ++$i) {\n            /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */\n            $fp = @fopen($fileName.'.message', 'x');\n            if (false !== $fp) {\n                if (false === fwrite($fp, $ser)) {\n                    return false;\n                }\n\n                return fclose($fp);\n            } else {\n                /* The file already exists, we try a longer fileName */\n                $fileName .= $this->getRandomString(1);\n            }\n        }\n\n        throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in \"%s\".', $this->_path));\n    }\n\n    /**\n     * Execute a recovery if for any reason a process is sending for too long.\n     *\n     * @param int $timeout in second Defaults is for very slow smtp responses\n     */\n    public function recover($timeout = 900) {\n        foreach (new DirectoryIterator($this->_path) as $file) {\n            $file = $file->getRealPath();\n\n            if (substr($file, -16) == '.message.sending') {\n                $lockedtime = filectime($file);\n                if ((time() - $lockedtime) > $timeout) {\n                    rename($file, substr($file, 0, -8));\n                }\n            }\n        }\n    }\n\n    /**\n     * Sends messages using the given transport instance.\n     *\n     * @param Swift_Transport $transport        A transport instance\n     * @param string[]        $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of sent e-mail's\n     */\n    public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) {\n        $directoryIterator = new DirectoryIterator($this->_path);\n\n        /* Start the transport only if there are queued files to send */\n        if (!$transport->isStarted()) {\n            foreach ($directoryIterator as $file) {\n                if (substr($file->getRealPath(), -8) == '.message') {\n                    $transport->start();\n                    break;\n                }\n            }\n        }\n\n        $failedRecipients = (array) $failedRecipients;\n        $count = 0;\n        $time = time();\n        foreach ($directoryIterator as $file) {\n            $file = $file->getRealPath();\n\n            if (substr($file, -8) != '.message') {\n                continue;\n            }\n\n            /* We try a rename, it's an atomic operation, and avoid locking the file */\n            if (rename($file, $file.'.sending')) {\n                $message = unserialize(file_get_contents($file.'.sending'));\n\n                $count += $transport->send($message, $failedRecipients);\n\n                unlink($file.'.sending');\n            } else {\n                /* This message has just been catched by another process */\n                continue;\n            }\n\n            if ($this->getMessageLimit() && $count >= $this->getMessageLimit()) {\n                break;\n            }\n\n            if ($this->getTimeLimit() && (time() - $time) >= $this->getTimeLimit()) {\n                break;\n            }\n        }\n\n        return $count;\n    }\n\n    /**\n     * Returns a random string needed to generate a fileName for the queue.\n     *\n     * @param int $count\n     *\n     * @return string\n     */\n    protected function getRandomString($count) {\n        // This string MUST stay FS safe, avoid special chars\n        $base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';\n        $ret = '';\n        $strlen = strlen($base);\n        for ($i = 0; $i < $count; ++$i) {\n            $ret .= $base[((int) rand(0, $strlen - 1))];\n        }\n\n        return $ret;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/FileStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An OutputByteStream which specifically reads from a file.\n *\n * @author Chris Corbyn\n */\ninterface Swift_FileStream extends Swift_OutputByteStream{\n    /**\n     * Get the complete path to the file.\n     *\n     * @return string\n     */\n    public function getPath();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Filterable.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Allows StreamFilters to operate on a stream.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Filterable{\n    /**\n     * Add a new StreamFilter, referenced by $key.\n     *\n     * @param Swift_StreamFilter $filter\n     * @param string             $key\n     */\n    public function addFilter(Swift_StreamFilter $filter, $key);\n\n    /**\n     * Remove an existing filter using $key.\n     *\n     * @param string $key\n     */\n    public function removeFilter($key);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Image.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An image, embedded in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_Image extends Swift_EmbeddedFile{\n    /**\n     * Create a new EmbeddedFile.\n     *\n     * Details may be optionally provided to the constructor.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     */\n    public function __construct($data = null, $filename = null, $contentType = null) {\n        parent::__construct($data, $filename, $contentType);\n    }\n\n    /**\n     * Create a new Image.\n     *\n     * @param string|Swift_OutputByteStream $data\n     * @param string                        $filename\n     * @param string                        $contentType\n     *\n     * @return Swift_Image\n     */\n    public static function newInstance($data = null, $filename = null, $contentType = null) {\n        return new self($data, $filename, $contentType);\n    }\n\n    /**\n     * Create a new Image from a filesystem path.\n     *\n     * @param string $path\n     *\n     * @return Swift_Image\n     */\n    public static function fromPath($path) {\n        $image = self::newInstance()->setFile(\n            new Swift_ByteStream_FileByteStream($path)\n            );\n\n        return $image;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/InputByteStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An abstract means of writing data.\n *\n * Classes implementing this interface may use a subsystem which requires less\n * memory than working with large strings of data.\n *\n * @author Chris Corbyn\n */\ninterface Swift_InputByteStream{\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * Writing may not happen immediately if the stream chooses to buffer.  If\n     * you want to write these bytes with immediate effect, call {@link commit()}\n     * after calling write().\n     *\n     * This method returns the sequence ID of the write (i.e. 1 for first, 2 for\n     * second, etc etc).\n     *\n     * @param string $bytes\n     *\n     * @throws Swift_IoException\n     *\n     * @return int\n     */\n    public function write($bytes);\n\n    /**\n     * For any bytes that are currently buffered inside the stream, force them\n     * off the buffer.\n     *\n     * @throws Swift_IoException\n     */\n    public function commit();\n\n    /**\n     * Attach $is to this stream.\n     *\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function bind(Swift_InputByteStream $is);\n\n    /**\n     * Remove an already bound stream.\n     *\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function unbind(Swift_InputByteStream $is);\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     *\n     * @throws Swift_IoException\n     */\n    public function flushBuffers();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/IoException.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * I/O Exception class.\n *\n * @author Chris Corbyn\n */\nclass Swift_IoException extends Swift_SwiftException{\n    /**\n     * Create a new IoException with $message.\n     *\n     * @param string    $message\n     * @param int       $code\n     * @param Exception $previous\n     */\n    public function __construct($message, $code = 0, Exception $previous = null) {\n        parent::__construct($message, $code, $previous);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A basic KeyCache backed by an array.\n *\n * @author Chris Corbyn\n */\nclass Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache{\n    /**\n     * Cache contents.\n     *\n     * @var array\n     */\n    private $_contents = array();\n\n    /**\n     * An InputStream for cloning.\n     *\n     * @var Swift_KeyCache_KeyCacheInputStream\n     */\n    private $_stream;\n\n    /**\n     * Create a new ArrayKeyCache with the given $stream for cloning to make\n     * InputByteStreams.\n     *\n     * @param Swift_KeyCache_KeyCacheInputStream $stream\n     */\n    public function __construct(Swift_KeyCache_KeyCacheInputStream $stream) {\n        $this->_stream = $stream;\n    }\n\n    /**\n     * Set a string into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     * @param string $string\n     * @param int    $mode\n     */\n    public function setString($nsKey, $itemKey, $string, $mode) {\n        $this->_prepareCache($nsKey);\n        switch ($mode) {\n            case self::MODE_WRITE:\n                $this->_contents[$nsKey][$itemKey] = $string;\n                break;\n            case self::MODE_APPEND:\n                if (!$this->hasKey($nsKey, $itemKey)) {\n                    $this->_contents[$nsKey][$itemKey] = '';\n                }\n                $this->_contents[$nsKey][$itemKey] .= $string;\n                break;\n            default:\n                throw new Swift_SwiftException(\n                    'Invalid mode ['.$mode.'] used to set nsKey='.\n                    $nsKey.', itemKey='.$itemKey\n                    );\n        }\n    }\n\n    /**\n     * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string                 $nsKey\n     * @param string                 $itemKey\n     * @param Swift_OutputByteStream $os\n     * @param int                    $mode\n     */\n    public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) {\n        $this->_prepareCache($nsKey);\n        switch ($mode) {\n            case self::MODE_WRITE:\n                $this->clearKey($nsKey, $itemKey);\n            case self::MODE_APPEND:\n                if (!$this->hasKey($nsKey, $itemKey)) {\n                    $this->_contents[$nsKey][$itemKey] = '';\n                }\n                while (false !== $bytes = $os->read(8192)) {\n                    $this->_contents[$nsKey][$itemKey] .= $bytes;\n                }\n                break;\n            default:\n                throw new Swift_SwiftException(\n                    'Invalid mode ['.$mode.'] used to set nsKey='.\n                    $nsKey.', itemKey='.$itemKey\n                    );\n        }\n    }\n\n    /**\n     * Provides a ByteStream which when written to, writes data to $itemKey.\n     *\n     * NOTE: The stream will always write in append mode.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $writeThrough\n     *\n     * @return Swift_InputByteStream\n     */\n    public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) {\n        $is = clone $this->_stream;\n        $is->setKeyCache($this);\n        $is->setNsKey($nsKey);\n        $is->setItemKey($itemKey);\n        if (isset($writeThrough)) {\n            $is->setWriteThroughStream($writeThrough);\n        }\n\n        return $is;\n    }\n\n    /**\n     * Get data back out of the cache as a string.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return string\n     */\n    public function getString($nsKey, $itemKey) {\n        $this->_prepareCache($nsKey);\n        if ($this->hasKey($nsKey, $itemKey)) {\n            return $this->_contents[$nsKey][$itemKey];\n        }\n    }\n\n    /**\n     * Get data back out of the cache as a ByteStream.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $is      to write the data to\n     */\n    public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) {\n        $this->_prepareCache($nsKey);\n        $is->write($this->getString($nsKey, $itemKey));\n    }\n\n    /**\n     * Check if the given $itemKey exists in the namespace $nsKey.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return bool\n     */\n    public function hasKey($nsKey, $itemKey) {\n        $this->_prepareCache($nsKey);\n\n        return array_key_exists($itemKey, $this->_contents[$nsKey]);\n    }\n\n    /**\n     * Clear data for $itemKey in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     */\n    public function clearKey($nsKey, $itemKey) {\n        unset($this->_contents[$nsKey][$itemKey]);\n    }\n\n    /**\n     * Clear all data in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     */\n    public function clearAll($nsKey) {\n        unset($this->_contents[$nsKey]);\n    }\n\n    /**\n     * Initialize the namespace of $nsKey if needed.\n     *\n     * @param string $nsKey\n     */\n    private function _prepareCache($nsKey) {\n        if (!array_key_exists($nsKey, $this->_contents)) {\n            $this->_contents[$nsKey] = array();\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A KeyCache which streams to and from disk.\n *\n * @author Chris Corbyn\n */\nclass Swift_KeyCache_DiskKeyCache implements Swift_KeyCache{\n    /** Signal to place pointer at start of file */\n    const POSITION_START = 0;\n\n    /** Signal to place pointer at end of file */\n    const POSITION_END = 1;\n\n    /** Signal to leave pointer in whatever position it currently is */\n    const POSITION_CURRENT = 2;\n\n    /**\n     * An InputStream for cloning.\n     *\n     * @var Swift_KeyCache_KeyCacheInputStream\n     */\n    private $_stream;\n\n    /**\n     * A path to write to.\n     *\n     * @var string\n     */\n    private $_path;\n\n    /**\n     * Stored keys.\n     *\n     * @var array\n     */\n    private $_keys = array();\n\n    /**\n     * Will be true if magic_quotes_runtime is turned on.\n     *\n     * @var bool\n     */\n    private $_quotes = false;\n\n    /**\n     * Create a new DiskKeyCache with the given $stream for cloning to make\n     * InputByteStreams, and the given $path to save to.\n     *\n     * @param Swift_KeyCache_KeyCacheInputStream $stream\n     * @param string                             $path   to save to\n     */\n    public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path) {\n        $this->_stream = $stream;\n        $this->_path = $path;\n\n        if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {\n            $this->_quotes = true;\n        }\n    }\n\n    /**\n     * Set a string into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     * @param string $string\n     * @param int    $mode\n     *\n     * @throws Swift_IoException\n     */\n    public function setString($nsKey, $itemKey, $string, $mode) {\n        $this->_prepareCache($nsKey);\n        switch ($mode) {\n            case self::MODE_WRITE:\n                $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);\n                break;\n            case self::MODE_APPEND:\n                $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END);\n                break;\n            default:\n                throw new Swift_SwiftException(\n                    'Invalid mode ['.$mode.'] used to set nsKey='.\n                    $nsKey.', itemKey='.$itemKey\n                    );\n                break;\n        }\n        fwrite($fp, $string);\n        $this->_freeHandle($nsKey, $itemKey);\n    }\n\n    /**\n     * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string                 $nsKey\n     * @param string                 $itemKey\n     * @param Swift_OutputByteStream $os\n     * @param int                    $mode\n     *\n     * @throws Swift_IoException\n     */\n    public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) {\n        $this->_prepareCache($nsKey);\n        switch ($mode) {\n            case self::MODE_WRITE:\n                $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);\n                break;\n            case self::MODE_APPEND:\n                $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END);\n                break;\n            default:\n                throw new Swift_SwiftException(\n                    'Invalid mode ['.$mode.'] used to set nsKey='.\n                    $nsKey.', itemKey='.$itemKey\n                    );\n                break;\n        }\n        while (false !== $bytes = $os->read(8192)) {\n            fwrite($fp, $bytes);\n        }\n        $this->_freeHandle($nsKey, $itemKey);\n    }\n\n    /**\n     * Provides a ByteStream which when written to, writes data to $itemKey.\n     *\n     * NOTE: The stream will always write in append mode.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $writeThrough\n     *\n     * @return Swift_InputByteStream\n     */\n    public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) {\n        $is = clone $this->_stream;\n        $is->setKeyCache($this);\n        $is->setNsKey($nsKey);\n        $is->setItemKey($itemKey);\n        if (isset($writeThrough)) {\n            $is->setWriteThroughStream($writeThrough);\n        }\n\n        return $is;\n    }\n\n    /**\n     * Get data back out of the cache as a string.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @throws Swift_IoException\n     *\n     * @return string\n     */\n    public function getString($nsKey, $itemKey) {\n        $this->_prepareCache($nsKey);\n        if ($this->hasKey($nsKey, $itemKey)) {\n            $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 0);\n            }\n            $str = '';\n            while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {\n                $str .= $bytes;\n            }\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 1);\n            }\n            $this->_freeHandle($nsKey, $itemKey);\n\n            return $str;\n        }\n    }\n\n    /**\n     * Get data back out of the cache as a ByteStream.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $is      to write the data to\n     */\n    public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) {\n        if ($this->hasKey($nsKey, $itemKey)) {\n            $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 0);\n            }\n            while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {\n                $is->write($bytes);\n            }\n            if ($this->_quotes) {\n                ini_set('magic_quotes_runtime', 1);\n            }\n            $this->_freeHandle($nsKey, $itemKey);\n        }\n    }\n\n    /**\n     * Check if the given $itemKey exists in the namespace $nsKey.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return bool\n     */\n    public function hasKey($nsKey, $itemKey) {\n        return is_file($this->_path.'/'.$nsKey.'/'.$itemKey);\n    }\n\n    /**\n     * Clear data for $itemKey in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     */\n    public function clearKey($nsKey, $itemKey) {\n        if ($this->hasKey($nsKey, $itemKey)) {\n            $this->_freeHandle($nsKey, $itemKey);\n            unlink($this->_path.'/'.$nsKey.'/'.$itemKey);\n        }\n    }\n\n    /**\n     * Clear all data in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     */\n    public function clearAll($nsKey) {\n        if (array_key_exists($nsKey, $this->_keys)) {\n            foreach ($this->_keys[$nsKey] as $itemKey => $null) {\n                $this->clearKey($nsKey, $itemKey);\n            }\n            if (is_dir($this->_path.'/'.$nsKey)) {\n                rmdir($this->_path.'/'.$nsKey);\n            }\n            unset($this->_keys[$nsKey]);\n        }\n    }\n\n    /**\n     * Initialize the namespace of $nsKey if needed.\n     *\n     * @param string $nsKey\n     */\n    private function _prepareCache($nsKey) {\n        $cacheDir = $this->_path.'/'.$nsKey;\n        if (!is_dir($cacheDir)) {\n            if (!mkdir($cacheDir)) {\n                throw new Swift_IoException('Failed to create cache directory '.$cacheDir);\n            }\n            $this->_keys[$nsKey] = array();\n        }\n    }\n\n    /**\n     * Get a file handle on the cache item.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     * @param int    $position\n     *\n     * @return resource\n     */\n    private function _getHandle($nsKey, $itemKey, $position) {\n        if (!isset($this->_keys[$nsKey][$itemKey])) {\n            $openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';\n            $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode);\n            $this->_keys[$nsKey][$itemKey] = $fp;\n        }\n        if (self::POSITION_START == $position) {\n            fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_SET);\n        } elseif (self::POSITION_END == $position) {\n            fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_END);\n        }\n\n        return $this->_keys[$nsKey][$itemKey];\n    }\n\n    private function _freeHandle($nsKey, $itemKey) {\n        $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_CURRENT);\n        fclose($fp);\n        $this->_keys[$nsKey][$itemKey] = null;\n    }\n\n    /**\n     * Destructor.\n     */\n    public function __destruct() {\n        foreach ($this->_keys as $nsKey => $null) {\n            $this->clearAll($nsKey);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Writes data to a KeyCache using a stream.\n *\n * @author Chris Corbyn\n */\ninterface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream{\n    /**\n     * Set the KeyCache to wrap.\n     *\n     * @param Swift_KeyCache $keyCache\n     */\n    public function setKeyCache(Swift_KeyCache $keyCache);\n\n    /**\n     * Set the nsKey which will be written to.\n     *\n     * @param string $nsKey\n     */\n    public function setNsKey($nsKey);\n\n    /**\n     * Set the itemKey which will be written to.\n     *\n     * @param string $itemKey\n     */\n    public function setItemKey($itemKey);\n\n    /**\n     * Specify a stream to write through for each write().\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function setWriteThroughStream(Swift_InputByteStream $is);\n\n    /**\n     * Any implementation should be cloneable, allowing the clone to access a\n     * separate $nsKey and $itemKey.\n     */\n    public function __clone();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A null KeyCache that does not cache at all.\n *\n * @author Chris Corbyn\n */\nclass Swift_KeyCache_NullKeyCache implements Swift_KeyCache{\n    /**\n     * Set a string into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     * @param string $string\n     * @param int    $mode\n     */\n    public function setString($nsKey, $itemKey, $string, $mode) {\n    }\n\n    /**\n     * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string                 $nsKey\n     * @param string                 $itemKey\n     * @param Swift_OutputByteStream $os\n     * @param int                    $mode\n     */\n    public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) {\n    }\n\n    /**\n     * Provides a ByteStream which when written to, writes data to $itemKey.\n     *\n     * NOTE: The stream will always write in append mode.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $writeThrough\n     *\n     * @return Swift_InputByteStream\n     */\n    public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) {\n    }\n\n    /**\n     * Get data back out of the cache as a string.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return string\n     */\n    public function getString($nsKey, $itemKey) {\n    }\n\n    /**\n     * Get data back out of the cache as a ByteStream.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $is      to write the data to\n     */\n    public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) {\n    }\n\n    /**\n     * Check if the given $itemKey exists in the namespace $nsKey.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return bool\n     */\n    public function hasKey($nsKey, $itemKey) {\n        return false;\n    }\n\n    /**\n     * Clear data for $itemKey in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     */\n    public function clearKey($nsKey, $itemKey) {\n    }\n\n    /**\n     * Clear all data in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     */\n    public function clearAll($nsKey) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Writes data to a KeyCache using a stream.\n *\n * @author Chris Corbyn\n */\nclass Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream{\n    /** The KeyCache being written to */\n    private $_keyCache;\n\n    /** The nsKey of the KeyCache being written to */\n    private $_nsKey;\n\n    /** The itemKey of the KeyCache being written to */\n    private $_itemKey;\n\n    /** A stream to write through on each write() */\n    private $_writeThrough = null;\n\n    /**\n     * Set the KeyCache to wrap.\n     *\n     * @param Swift_KeyCache $keyCache\n     */\n    public function setKeyCache(Swift_KeyCache $keyCache) {\n        $this->_keyCache = $keyCache;\n    }\n\n    /**\n     * Specify a stream to write through for each write().\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function setWriteThroughStream(Swift_InputByteStream $is) {\n        $this->_writeThrough = $is;\n    }\n\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * @param string                $bytes\n     * @param Swift_InputByteStream $is    optional\n     */\n    public function write($bytes, Swift_InputByteStream $is = null) {\n        $this->_keyCache->setString(\n            $this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND\n            );\n        if (isset($is)) {\n            $is->write($bytes);\n        }\n        if (isset($this->_writeThrough)) {\n            $this->_writeThrough->write($bytes);\n        }\n    }\n\n    /**\n     * Not used.\n     */\n    public function commit() {\n    }\n\n    /**\n     * Not used.\n     */\n    public function bind(Swift_InputByteStream $is) {\n    }\n\n    /**\n     * Not used.\n     */\n    public function unbind(Swift_InputByteStream $is) {\n    }\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     */\n    public function flushBuffers() {\n        $this->_keyCache->clearKey($this->_nsKey, $this->_itemKey);\n    }\n\n    /**\n     * Set the nsKey which will be written to.\n     *\n     * @param string $nsKey\n     */\n    public function setNsKey($nsKey) {\n        $this->_nsKey = $nsKey;\n    }\n\n    /**\n     * Set the itemKey which will be written to.\n     *\n     * @param string $itemKey\n     */\n    public function setItemKey($itemKey) {\n        $this->_itemKey = $itemKey;\n    }\n\n    /**\n     * Any implementation should be cloneable, allowing the clone to access a\n     * separate $nsKey and $itemKey.\n     */\n    public function __clone() {\n        $this->_writeThrough = null;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/KeyCache.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides a mechanism for storing data using two keys.\n *\n * @author Chris Corbyn\n */\ninterface Swift_KeyCache{\n    /** Mode for replacing existing cached data */\n    const MODE_WRITE = 1;\n\n    /** Mode for appending data to the end of existing cached data */\n    const MODE_APPEND = 2;\n\n    /**\n     * Set a string into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     * @param string $string\n     * @param int    $mode\n     */\n    public function setString($nsKey, $itemKey, $string, $mode);\n\n    /**\n     * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.\n     *\n     * @see MODE_WRITE, MODE_APPEND\n     *\n     * @param string                 $nsKey\n     * @param string                 $itemKey\n     * @param Swift_OutputByteStream $os\n     * @param int                    $mode\n     */\n    public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode);\n\n    /**\n     * Provides a ByteStream which when written to, writes data to $itemKey.\n     *\n     * NOTE: The stream will always write in append mode.\n     * If the optional third parameter is passed all writes will go through $is.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $is      optional input stream\n     *\n     * @return Swift_InputByteStream\n     */\n    public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null);\n\n    /**\n     * Get data back out of the cache as a string.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return string\n     */\n    public function getString($nsKey, $itemKey);\n\n    /**\n     * Get data back out of the cache as a ByteStream.\n     *\n     * @param string                $nsKey\n     * @param string                $itemKey\n     * @param Swift_InputByteStream $is      stream to write the data to\n     */\n    public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);\n\n    /**\n     * Check if the given $itemKey exists in the namespace $nsKey.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     *\n     * @return bool\n     */\n    public function hasKey($nsKey, $itemKey);\n\n    /**\n     * Clear data for $itemKey in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     * @param string $itemKey\n     */\n    public function clearKey($nsKey, $itemKey);\n\n    /**\n     * Clear all data in the namespace $nsKey if it exists.\n     *\n     * @param string $nsKey\n     */\n    public function clearAll($nsKey);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Redundantly and rotationally uses several Transport implementations when sending.\n *\n * @author Chris Corbyn\n */\nclass Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport{\n    /**\n     * Creates a new LoadBalancedTransport with $transports.\n     *\n     * @param array $transports\n     */\n    public function __construct($transports = array()) {\n        call_user_func_array(\n            array($this, 'Swift_Transport_LoadBalancedTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.loadbalanced')\n            );\n\n        $this->setTransports($transports);\n    }\n\n    /**\n     * Create a new LoadBalancedTransport instance.\n     *\n     * @param array $transports\n     *\n     * @return Swift_LoadBalancedTransport\n     */\n    public static function newInstance($transports = array()) {\n        return new self($transports);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/MailTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages using the mail() function.\n *\n * @author Chris Corbyn\n */\nclass Swift_MailTransport extends Swift_Transport_MailTransport{\n    /**\n     * Create a new MailTransport, optionally specifying $extraParams.\n     *\n     * @param string $extraParams\n     */\n    public function __construct($extraParams = '-f%s') {\n        call_user_func_array(\n            array($this, 'Swift_Transport_MailTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.mail')\n            );\n\n        $this->setExtraParams($extraParams);\n    }\n\n    /**\n     * Create a new MailTransport instance.\n     *\n     * @param string $extraParams To be passed to mail()\n     *\n     * @return Swift_MailTransport\n     */\n    public static function newInstance($extraParams = '-f%s') {\n        return new self($extraParams);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Wraps a standard PHP array in an iterator.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientIterator{\n    /**\n     * The list of recipients.\n     *\n     * @var array\n     */\n    private $_recipients = array();\n\n    /**\n     * Create a new ArrayRecipientIterator from $recipients.\n     *\n     * @param array $recipients\n     */\n    public function __construct(array $recipients) {\n        $this->_recipients = $recipients;\n    }\n\n    /**\n     * Returns true only if there are more recipients to send to.\n     *\n     * @return bool\n     */\n    public function hasNext() {\n        return !empty($this->_recipients);\n    }\n\n    /**\n     * Returns an array where the keys are the addresses of recipients and the\n     * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).\n     *\n     * @return array\n     */\n    public function nextRecipient() {\n        return array_splice($this->_recipients, 0, 1);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mailer/RecipientIterator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides an abstract way of specifying recipients for batch sending.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mailer_RecipientIterator{\n    /**\n     * Returns true only if there are more recipients to send to.\n     *\n     * @return bool\n     */\n    public function hasNext();\n\n    /**\n     * Returns an array where the keys are the addresses of recipients and the\n     * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).\n     *\n     * @return array\n     */\n    public function nextRecipient();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mailer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Swift Mailer class.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mailer{\n    /** The Transport used to send messages */\n    private $_transport;\n\n    /**\n     * Create a new Mailer using $transport for delivery.\n     *\n     * @param Swift_Transport $transport\n     */\n    public function __construct(Swift_Transport $transport) {\n        $this->_transport = $transport;\n    }\n\n    /**\n     * Create a new Mailer instance.\n     *\n     * @param Swift_Transport $transport\n     *\n     * @return Swift_Mailer\n     */\n    public static function newInstance(Swift_Transport $transport) {\n        return new self($transport);\n    }\n\n    /**\n     * Create a new class instance of one of the message services.\n     *\n     * For example 'mimepart' would create a 'message.mimepart' instance\n     *\n     * @param string $service\n     *\n     * @return object\n     */\n    public function createMessage($service = 'message') {\n        return Swift_DependencyContainer::getInstance()\n            ->lookup('message.'.$service);\n    }\n\n    /**\n     * Send the given Message like it would be sent in a mail client.\n     *\n     * All recipients (with the exception of Bcc) will be able to see the other\n     * recipients this message was sent to.\n     *\n     * Recipient/sender data will be retrieved from the Message object.\n     *\n     * The return value is the number of recipients who were accepted for\n     * delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param array              $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of successful recipients. Can be 0 which indicates failure\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $failedRecipients = (array) $failedRecipients;\n\n        if (!$this->_transport->isStarted()) {\n            $this->_transport->start();\n        }\n\n        $sent = 0;\n\n        try {\n            $sent = $this->_transport->send($message, $failedRecipients);\n        } catch (Swift_RfcComplianceException $e) {\n            foreach ($message->getTo() as $address => $name) {\n                $failedRecipients[] = $address;\n            }\n        }\n\n        return $sent;\n    }\n\n    /**\n     * Register a plugin using a known unique key (e.g. myPlugin).\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        $this->_transport->registerPlugin($plugin);\n    }\n\n    /**\n     * The Transport used to send messages.\n     *\n     * @return Swift_Transport\n     */\n    public function getTransport() {\n        return $this->_transport;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/MemorySpool.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2011 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Stores Messages in memory.\n *\n * @author Fabien Potencier\n */\nclass Swift_MemorySpool implements Swift_Spool{\n    protected $messages = array();\n    private $flushRetries = 3;\n\n    /**\n     * Tests if this Transport mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return true;\n    }\n\n    /**\n     * Starts this Transport mechanism.\n     */\n    public function start() {\n    }\n\n    /**\n     * Stops this Transport mechanism.\n     */\n    public function stop() {\n    }\n\n    /**\n     * @param int $retries\n     */\n    public function setFlushRetries($retries) {\n        $this->flushRetries = $retries;\n    }\n\n    /**\n     * Stores a message in the queue.\n     *\n     * @param Swift_Mime_Message $message The message to store\n     *\n     * @return bool Whether the operation has succeeded\n     */\n    public function queueMessage(Swift_Mime_Message $message) {\n        //clone the message to make sure it is not changed while in the queue\n        $this->messages[] = clone $message;\n\n        return true;\n    }\n\n    /**\n     * Sends messages using the given transport instance.\n     *\n     * @param Swift_Transport $transport        A transport instance\n     * @param string[]        $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of sent emails\n     */\n    public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) {\n        if (!$this->messages) {\n            return 0;\n        }\n\n        if (!$transport->isStarted()) {\n            $transport->start();\n        }\n\n        $count = 0;\n        $retries = $this->flushRetries;\n        while ($retries--) {\n            try {\n                while ($message = array_pop($this->messages)) {\n                    $count += $transport->send($message, $failedRecipients);\n                }\n            } catch (Swift_TransportException $exception) {\n                if ($retries) {\n                    // re-queue the message at the end of the queue to give a chance\n                    // to the other messages to be sent, in case the failure was due to\n                    // this message and not just the transport failing\n                    array_unshift($this->messages, $message);\n\n                    // wait half a second before we try again\n                    usleep(500000);\n                } else {\n                    throw $exception;\n                }\n            }\n        }\n\n        return $count;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Message.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * The Message class for building emails.\n *\n * @author Chris Corbyn\n */\nclass Swift_Message extends Swift_Mime_SimpleMessage{\n    /**\n     * @var Swift_Signers_HeaderSigner[]\n     */\n    private $headerSigners = array();\n\n    /**\n     * @var Swift_Signers_BodySigner[]\n     */\n    private $bodySigners = array();\n\n    /**\n     * @var array\n     */\n    private $savedMessage = array();\n\n    /**\n     * Create a new Message.\n     *\n     * Details may be optionally passed into the constructor.\n     *\n     * @param string $subject\n     * @param string $body\n     * @param string $contentType\n     * @param string $charset\n     */\n    public function __construct($subject = null, $body = null, $contentType = null, $charset = null) {\n        call_user_func_array(\n            array($this, 'Swift_Mime_SimpleMessage::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('mime.message')\n            );\n\n        if (!isset($charset)) {\n            $charset = Swift_DependencyContainer::getInstance()\n                ->lookup('properties.charset');\n        }\n        $this->setSubject($subject);\n        $this->setBody($body);\n        $this->setCharset($charset);\n        if ($contentType) {\n            $this->setContentType($contentType);\n        }\n    }\n\n    /**\n     * Create a new Message.\n     *\n     * @param string $subject\n     * @param string $body\n     * @param string $contentType\n     * @param string $charset\n     *\n     * @return Swift_Message\n     */\n    public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null) {\n        return new self($subject, $body, $contentType, $charset);\n    }\n\n    /**\n     * Add a MimePart to this Message.\n     *\n     * @param string|Swift_OutputByteStream $body\n     * @param string                        $contentType\n     * @param string                        $charset\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addPart($body, $contentType = null, $charset = null) {\n        return $this->attach(Swift_MimePart::newInstance(\n            $body, $contentType, $charset\n            ));\n    }\n\n    /**\n     * Attach a new signature handler to the message.\n     *\n     * @param Swift_Signer $signer\n     *\n     * @return Swift_Message\n     */\n    public function attachSigner(Swift_Signer $signer) {\n        if ($signer instanceof Swift_Signers_HeaderSigner) {\n            $this->headerSigners[] = $signer;\n        } elseif ($signer instanceof Swift_Signers_BodySigner) {\n            $this->bodySigners[] = $signer;\n        }\n\n        return $this;\n    }\n\n    /**\n     * Attach a new signature handler to the message.\n     *\n     * @param Swift_Signer $signer\n     *\n     * @return Swift_Message\n     */\n    public function detachSigner(Swift_Signer $signer) {\n        if ($signer instanceof Swift_Signers_HeaderSigner) {\n            foreach ($this->headerSigners as $k => $headerSigner) {\n                if ($headerSigner === $signer) {\n                    unset($this->headerSigners[$k]);\n\n                    return $this;\n                }\n            }\n        } elseif ($signer instanceof Swift_Signers_BodySigner) {\n            foreach ($this->bodySigners as $k => $bodySigner) {\n                if ($bodySigner === $signer) {\n                    unset($this->bodySigners[$k]);\n\n                    return $this;\n                }\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get this message as a complete string.\n     *\n     * @return string\n     */\n    public function toString() {\n        if (empty($this->headerSigners) && empty($this->bodySigners)) {\n            return parent::toString();\n        }\n\n        $this->saveMessage();\n\n        $this->doSign();\n\n        $string = parent::toString();\n\n        $this->restoreMessage();\n\n        return $string;\n    }\n\n    /**\n     * Write this message to a {@link Swift_InputByteStream}.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function toByteStream(Swift_InputByteStream $is) {\n        if (empty($this->headerSigners) && empty($this->bodySigners)) {\n            parent::toByteStream($is);\n\n            return;\n        }\n\n        $this->saveMessage();\n\n        $this->doSign();\n\n        parent::toByteStream($is);\n\n        $this->restoreMessage();\n    }\n\n    public function __wakeup() {\n        Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.message');\n    }\n\n    /**\n     * loops through signers and apply the signatures.\n     */\n    protected function doSign() {\n        foreach ($this->bodySigners as $signer) {\n            $altered = $signer->getAlteredHeaders();\n            $this->saveHeaders($altered);\n            $signer->signMessage($this);\n        }\n\n        foreach ($this->headerSigners as $signer) {\n            $altered = $signer->getAlteredHeaders();\n            $this->saveHeaders($altered);\n            $signer->reset();\n\n            $signer->setHeaders($this->getHeaders());\n\n            $signer->startBody();\n            $this->_bodyToByteStream($signer);\n            $signer->endBody();\n\n            $signer->addSignature($this->getHeaders());\n        }\n    }\n\n    /**\n     * save the message before any signature is applied.\n     */\n    protected function saveMessage() {\n        $this->savedMessage = array('headers' => array());\n        $this->savedMessage['body'] = $this->getBody();\n        $this->savedMessage['children'] = $this->getChildren();\n        if (count($this->savedMessage['children']) > 0 && $this->getBody() != '') {\n            $this->setChildren(array_merge(array($this->_becomeMimePart()), $this->savedMessage['children']));\n            $this->setBody('');\n        }\n    }\n\n    /**\n     * save the original headers.\n     *\n     * @param array $altered\n     */\n    protected function saveHeaders(array $altered) {\n        foreach ($altered as $head) {\n            $lc = strtolower($head);\n\n            if (!isset($this->savedMessage['headers'][$lc])) {\n                $this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head);\n            }\n        }\n    }\n\n    /**\n     * Remove or restore altered headers.\n     */\n    protected function restoreHeaders() {\n        foreach ($this->savedMessage['headers'] as $name => $savedValue) {\n            $headers = $this->getHeaders()->getAll($name);\n\n            foreach ($headers as $key => $value) {\n                if (!isset($savedValue[$key])) {\n                    $this->getHeaders()->remove($name, $key);\n                }\n            }\n        }\n    }\n\n    /**\n     * Restore message body.\n     */\n    protected function restoreMessage() {\n        $this->setBody($this->savedMessage['body']);\n        $this->setChildren($this->savedMessage['children']);\n\n        $this->restoreHeaders();\n        $this->savedMessage = array();\n    }\n\n    /**\n     * Clone Message Signers.\n     *\n     * @see Swift_Mime_SimpleMimeEntity::__clone()\n     */\n    public function __clone() {\n        parent::__clone();\n        foreach ($this->bodySigners as $key => $bodySigner) {\n            $this->bodySigners[$key] = clone($bodySigner);\n        }\n\n        foreach ($this->headerSigners as $key => $headerSigner) {\n            $this->headerSigners[$key] = clone($headerSigner);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Attachment.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An attachment, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity{\n    /** Recognized MIME types */\n    private $_mimeTypes = array();\n\n    /**\n     * Create a new Attachment with $headers, $encoder and $cache.\n     *\n     * @param Swift_Mime_HeaderSet      $headers\n     * @param Swift_Mime_ContentEncoder $encoder\n     * @param Swift_KeyCache            $cache\n     * @param Swift_Mime_Grammar        $grammar\n     * @param array                     $mimeTypes optional\n     */\n    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $mimeTypes = array()) {\n        parent::__construct($headers, $encoder, $cache, $grammar);\n        $this->setDisposition('attachment');\n        $this->setContentType('application/octet-stream');\n        $this->_mimeTypes = $mimeTypes;\n    }\n\n    /**\n     * Get the nesting level used for this attachment.\n     *\n     * Always returns {@link LEVEL_MIXED}.\n     *\n     * @return int\n     */\n    public function getNestingLevel() {\n        return self::LEVEL_MIXED;\n    }\n\n    /**\n     * Get the Content-Disposition of this attachment.\n     *\n     * By default attachments have a disposition of \"attachment\".\n     *\n     * @return string\n     */\n    public function getDisposition() {\n        return $this->_getHeaderFieldModel('Content-Disposition');\n    }\n\n    /**\n     * Set the Content-Disposition of this attachment.\n     *\n     * @param string $disposition\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public function setDisposition($disposition) {\n        if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) {\n            $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the filename of this attachment when downloaded.\n     *\n     * @return string\n     */\n    public function getFilename() {\n        return $this->_getHeaderParameter('Content-Disposition', 'filename');\n    }\n\n    /**\n     * Set the filename of this attachment.\n     *\n     * @param string $filename\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public function setFilename($filename) {\n        $this->_setHeaderParameter('Content-Disposition', 'filename', $filename);\n        $this->_setHeaderParameter('Content-Type', 'name', $filename);\n\n        return $this;\n    }\n\n    /**\n     * Get the file size of this attachment.\n     *\n     * @return int\n     */\n    public function getSize() {\n        return $this->_getHeaderParameter('Content-Disposition', 'size');\n    }\n\n    /**\n     * Set the file size of this attachment.\n     *\n     * @param int $size\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public function setSize($size) {\n        $this->_setHeaderParameter('Content-Disposition', 'size', $size);\n\n        return $this;\n    }\n\n    /**\n     * Set the file that this attachment is for.\n     *\n     * @param Swift_FileStream $file\n     * @param string           $contentType optional\n     *\n     * @return Swift_Mime_Attachment\n     */\n    public function setFile(Swift_FileStream $file, $contentType = null) {\n        $this->setFilename(basename($file->getPath()));\n        $this->setBody($file, $contentType);\n        if (!isset($contentType)) {\n            $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));\n\n            if (array_key_exists($extension, $this->_mimeTypes)) {\n                $this->setContentType($this->_mimeTypes[$extension]);\n            }\n        }\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/CharsetObserver.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Observes changes in an Mime entity's character set.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_CharsetObserver{\n    /**\n     * Notify this observer that the entity's charset has changed.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Base 64 Transfer Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_ContentEncoder{\n    /**\n     * Encode stream $in to stream $out.\n     *\n     * @param Swift_OutputByteStream $os\n     * @param Swift_InputByteStream  $is\n     * @param int                    $firstLineOffset\n     * @param int                    $maxLineLength,  optional, 0 indicates the default of 76 bytes\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        if (0 >= $maxLineLength || 76 < $maxLineLength) {\n            $maxLineLength = 76;\n        }\n\n        $remainder = 0;\n        $base64ReadBufferRemainderBytes = null;\n\n        // To reduce memory usage, the output buffer is streamed to the input buffer like so:\n        //   Output Stream => base64encode => wrap line length => Input Stream\n        // HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data)\n        // otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream.\n        // We use $base64ReadBufferRemainderBytes to carry over 1-2 \"remainder\" bytes from the each chunk from OutputStream and pre-pend those onto the\n        // chunk of bytes read in the next iteration.\n        // When the OutputStream is empty, we must flush any remainder bytes.\n        while (true) {\n            $readBytes = $os->read(8192);\n            $atEOF = ($readBytes === false);\n\n            if ($atEOF) {\n                $streamTheseBytes = $base64ReadBufferRemainderBytes;\n            } else {\n                $streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;\n            }\n            $base64ReadBufferRemainderBytes = null;\n            $bytesLength = strlen($streamTheseBytes);\n\n            if ($bytesLength === 0) { // no data left to encode\n                break;\n            }\n\n            // if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data\n            // and carry over remainder 1-2 bytes to the next loop iteration\n            if (!$atEOF) {\n                $excessBytes = $bytesLength % 3;\n                if ($excessBytes !== 0) {\n                    $base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);\n                    $streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);\n                }\n            }\n\n            $encoded = base64_encode($streamTheseBytes);\n            $encodedTransformed = '';\n            $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;\n\n            while ($thisMaxLineLength < strlen($encoded)) {\n                $encodedTransformed .= substr($encoded, 0, $thisMaxLineLength).\"\\r\\n\";\n                $firstLineOffset = 0;\n                $encoded = substr($encoded, $thisMaxLineLength);\n                $thisMaxLineLength = $maxLineLength;\n                $remainder = 0;\n            }\n\n            if (0 < $remainingLength = strlen($encoded)) {\n                $remainder += $remainingLength;\n                $encodedTransformed .= $encoded;\n                $encoded = null;\n            }\n\n            $is->write($encodedTransformed);\n\n            if ($atEOF) {\n                break;\n            }\n        }\n    }\n\n    /**\n     * Get the name of this encoding scheme.\n     * Returns the string 'base64'.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'base64';\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer using the PHP core function.\n *\n * @author Lars Strojny\n */\nclass Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder{\n    /**\n     * @var null|string\n     */\n    private $charset;\n\n    /**\n     * @param null|string $charset\n     */\n    public function __construct($charset = null) {\n        $this->charset = $charset ? $charset : 'utf-8';\n    }\n\n    /**\n     * Notify this observer that the entity's charset has changed.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->charset = $charset;\n    }\n\n    /**\n     * Encode $in to $out.\n     *\n     * @param Swift_OutputByteStream $os              to read from\n     * @param Swift_InputByteStream  $is              to write to\n     * @param int                    $firstLineOffset\n     * @param int                    $maxLineLength   0 indicates the default length for this encoding\n     *\n     * @throws RuntimeException\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        if ($this->charset !== 'utf-8') {\n            throw new RuntimeException(\n                sprintf('Charset \"%s\" not supported. NativeQpContentEncoder only supports \"utf-8\"', $this->charset));\n        }\n\n        $string = '';\n\n        while (false !== $bytes = $os->read(8192)) {\n            $string .= $bytes;\n        }\n\n        $is->write($this->encodeString($string));\n    }\n\n    /**\n     * Get the MIME name of this content encoding scheme.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'quoted-printable';\n    }\n\n    /**\n     * Encode a given string to produce an encoded string.\n     *\n     * @param string $string\n     * @param int    $firstLineOffset if first line needs to be shorter\n     * @param int    $maxLineLength   0 indicates the default length for this encoding\n     *\n     * @throws RuntimeException\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        if ($this->charset !== 'utf-8') {\n            throw new RuntimeException(\n                sprintf('Charset \"%s\" not supported. NativeQpContentEncoder only supports \"utf-8\"', $this->charset));\n        }\n\n        return $this->_standardize(quoted_printable_encode($string));\n    }\n\n    /**\n     * Make sure CRLF is correct and HT/SPACE are in valid places.\n     *\n     * @param string $string\n     *\n     * @return string\n     */\n    protected function _standardize($string) {\n        // transform CR or LF to CRLF\n        $string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);\n        // transform =0D=0A to CRLF\n        $string = str_replace(array(\"\\t=0D=0A\", ' =0D=0A', '=0D=0A'), array(\"=09\\r\\n\", \"=20\\r\\n\", \"\\r\\n\"), $string);\n\n        switch ($end = ord(substr($string, -1))) {\n            case 0x09:\n                $string = substr_replace($string, '=09', -1);\n                break;\n            case 0x20:\n                $string = substr_replace($string, '=20', -1);\n                break;\n        }\n\n        return $string;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles binary/7/8-bit Transfer Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder{\n    /**\n     * The name of this encoding scheme (probably 7bit or 8bit).\n     *\n     * @var string\n     */\n    private $_name;\n\n    /**\n     * True if canonical transformations should be done.\n     *\n     * @var bool\n     */\n    private $_canonical;\n\n    /**\n     * Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).\n     *\n     * @param string $name\n     * @param bool   $canonical If canonicalization transformation should be done.\n     */\n    public function __construct($name, $canonical = false) {\n        $this->_name = $name;\n        $this->_canonical = $canonical;\n    }\n\n    /**\n     * Encode a given string to produce an encoded string.\n     *\n     * @param string $string\n     * @param int    $firstLineOffset ignored\n     * @param int    $maxLineLength   - 0 means no wrapping will occur\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        if ($this->_canonical) {\n            $string = $this->_canonicalize($string);\n        }\n\n        return $this->_safeWordWrap($string, $maxLineLength, \"\\r\\n\");\n    }\n\n    /**\n     * Encode stream $in to stream $out.\n     *\n     * @param Swift_OutputByteStream $os\n     * @param Swift_InputByteStream  $is\n     * @param int                    $firstLineOffset ignored\n     * @param int                    $maxLineLength   optional, 0 means no wrapping will occur\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        $leftOver = '';\n        while (false !== $bytes = $os->read(8192)) {\n            $toencode = $leftOver.$bytes;\n            if ($this->_canonical) {\n                $toencode = $this->_canonicalize($toencode);\n            }\n            $wrapped = $this->_safeWordWrap($toencode, $maxLineLength, \"\\r\\n\");\n            $lastLinePos = strrpos($wrapped, \"\\r\\n\");\n            $leftOver = substr($wrapped, $lastLinePos);\n            $wrapped = substr($wrapped, 0, $lastLinePos);\n\n            $is->write($wrapped);\n        }\n        if (strlen($leftOver)) {\n            $is->write($leftOver);\n        }\n    }\n\n    /**\n     * Get the name of this encoding scheme.\n     *\n     * @return string\n     */\n    public function getName() {\n        return $this->_name;\n    }\n\n    /**\n     * Not used.\n     */\n    public function charsetChanged($charset) {\n    }\n\n    /**\n     * A safer (but weaker) wordwrap for unicode.\n     *\n     * @param string $string\n     * @param int    $length\n     * @param string $le\n     *\n     * @return string\n     */\n    private function _safeWordwrap($string, $length = 75, $le = \"\\r\\n\") {\n        if (0 >= $length) {\n            return $string;\n        }\n\n        $originalLines = explode($le, $string);\n\n        $lines = array();\n        $lineCount = 0;\n\n        foreach ($originalLines as $originalLine) {\n            $lines[] = '';\n            $currentLine = &$lines[$lineCount++];\n\n            //$chunks = preg_split('/(?<=[\\ \\t,\\.!\\?\\-&\\+\\/])/', $originalLine);\n            $chunks = preg_split('/(?<=\\s)/', $originalLine);\n\n            foreach ($chunks as $chunk) {\n                if (0 != strlen($currentLine)\n                    && strlen($currentLine.$chunk) > $length) {\n                    $lines[] = '';\n                    $currentLine = &$lines[$lineCount++];\n                }\n                $currentLine .= $chunk;\n            }\n        }\n\n        return implode(\"\\r\\n\", $lines);\n    }\n\n    /**\n     * Canonicalize string input (fix CRLF).\n     *\n     * @param string $string\n     *\n     * @return string\n     */\n    private function _canonicalize($string) {\n        return str_replace(\n            array(\"\\r\\n\", \"\\r\", \"\\n\"),\n            array(\"\\n\", \"\\n\", \"\\r\\n\"),\n            $string\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder{\n    protected $_dotEscape;\n\n    /**\n     * Creates a new QpContentEncoder for the given CharacterStream.\n     *\n     * @param Swift_CharacterStream $charStream to use for reading characters\n     * @param Swift_StreamFilter    $filter     if canonicalization should occur\n     * @param bool                  $dotEscape  if dot stuffing workaround must be enabled\n     */\n    public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false) {\n        $this->_dotEscape = $dotEscape;\n        parent::__construct($charStream, $filter);\n    }\n\n    public function __sleep() {\n        return array('_charStream', '_filter', '_dotEscape');\n    }\n\n    protected function getSafeMapShareId() {\n        return get_class($this).($this->_dotEscape ? '.dotEscape' : '');\n    }\n\n    protected function initSafeMap() {\n        parent::initSafeMap();\n        if ($this->_dotEscape) {\n            /* Encode . as =2e for buggy remote servers */\n            unset($this->_safeMap[0x2e]);\n        }\n    }\n\n    /**\n     * Encode stream $in to stream $out.\n     *\n     * QP encoded strings have a maximum line length of 76 characters.\n     * If the first line needs to be shorter, indicate the difference with\n     * $firstLineOffset.\n     *\n     * @param Swift_OutputByteStream $os              output stream\n     * @param Swift_InputByteStream  $is              input stream\n     * @param int                    $firstLineOffset\n     * @param int                    $maxLineLength\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        if ($maxLineLength > 76 || $maxLineLength <= 0) {\n            $maxLineLength = 76;\n        }\n\n        $thisLineLength = $maxLineLength - $firstLineOffset;\n\n        $this->_charStream->flushContents();\n        $this->_charStream->importByteStream($os);\n\n        $currentLine = '';\n        $prepend = '';\n        $size = $lineLen = 0;\n\n        while (false !== $bytes = $this->_nextSequence()) {\n            // If we're filtering the input\n            if (isset($this->_filter)) {\n                // If we can't filter because we need more bytes\n                while ($this->_filter->shouldBuffer($bytes)) {\n                    // Then collect bytes into the buffer\n                    if (false === $moreBytes = $this->_nextSequence(1)) {\n                        break;\n                    }\n\n                    foreach ($moreBytes as $b) {\n                        $bytes[] = $b;\n                    }\n                }\n                // And filter them\n                $bytes = $this->_filter->filter($bytes);\n            }\n\n            $enc = $this->_encodeByteSequence($bytes, $size);\n\n            $i = strpos($enc, '=0D=0A');\n            $newLineLength = $lineLen + ($i === false ? $size : $i);\n\n            if ($currentLine && $newLineLength >= $thisLineLength) {\n                $is->write($prepend.$this->_standardize($currentLine));\n                $currentLine = '';\n                $prepend = \"=\\r\\n\";\n                $thisLineLength = $maxLineLength;\n                $lineLen = 0;\n            }\n\n            $currentLine .= $enc;\n\n            if ($i === false) {\n                $lineLen += $size;\n            } else {\n                // 6 is the length of '=0D=0A'.\n                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;\n            }\n        }\n        if (strlen($currentLine)) {\n            $is->write($prepend.$this->_standardize($currentLine));\n        }\n    }\n\n    /**\n     * Get the name of this encoding scheme.\n     * Returns the string 'quoted-printable'.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'quoted-printable';\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Proxy for quoted-printable content encoders.\n *\n * Switches on the best QP encoder implementation for current charset.\n *\n * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>\n */\nclass Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_ContentEncoder{\n    /**\n     * @var Swift_Mime_ContentEncoder_QpContentEncoder\n     */\n    private $safeEncoder;\n\n    /**\n     * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder\n     */\n    private $nativeEncoder;\n\n    /**\n     * @var null|string\n     */\n    private $charset;\n\n    /**\n     * Constructor.\n     *\n     * @param Swift_Mime_ContentEncoder_QpContentEncoder       $safeEncoder\n     * @param Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder\n     * @param string|null                                      $charset\n     */\n    public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset) {\n        $this->safeEncoder = $safeEncoder;\n        $this->nativeEncoder = $nativeEncoder;\n        $this->charset = $charset;\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->safeEncoder = clone $this->safeEncoder;\n        $this->nativeEncoder = clone $this->nativeEncoder;\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function charsetChanged($charset) {\n        $this->charset = $charset;\n        $this->safeEncoder->charsetChanged($charset);\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        $this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength);\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function getName() {\n        return 'quoted-printable';\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        return $this->getEncoder()->encodeString($string, $firstLineOffset, $maxLineLength);\n    }\n\n    /**\n     * @return Swift_Mime_ContentEncoder\n     */\n    private function getEncoder() {\n        return 'utf-8' === $this->charset ? $this->nativeEncoder : $this->safeEncoder;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles raw Transfer Encoding in Swift Mailer.\n *\n *\n * @author Sebastiaan Stok <s.stok@rollerscapes.net>\n */\nclass Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder{\n    /**\n     * Encode a given string to produce an encoded string.\n     *\n     * @param string $string\n     * @param int    $firstLineOffset ignored\n     * @param int    $maxLineLength   ignored\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        return $string;\n    }\n\n    /**\n     * Encode stream $in to stream $out.\n     *\n     * @param Swift_OutputByteStream $in\n     * @param Swift_InputByteStream  $out\n     * @param int                    $firstLineOffset ignored\n     * @param int                    $maxLineLength   ignored\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) {\n        while (false !== ($bytes = $os->read(8192))) {\n            $is->write($bytes);\n        }\n    }\n\n    /**\n     * Get the name of this encoding scheme.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'raw';\n    }\n\n    /**\n     * Not used.\n     */\n    public function charsetChanged($charset) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ContentEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Interface for all Transfer Encoding schemes.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_ContentEncoder extends Swift_Encoder{\n    /**\n     * Encode $in to $out.\n     *\n     * @param Swift_OutputByteStream $os              to read from\n     * @param Swift_InputByteStream  $is              to write to\n     * @param int                    $firstLineOffset\n     * @param int                    $maxLineLength   - 0 indicates the default length for this encoding\n     */\n    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0);\n\n    /**\n     * Get the MIME name of this content encoding scheme.\n     *\n     * @return string\n     */\n    public function getName();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An embedded file, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment{\n    /**\n     * Creates a new Attachment with $headers and $encoder.\n     *\n     * @param Swift_Mime_HeaderSet      $headers\n     * @param Swift_Mime_ContentEncoder $encoder\n     * @param Swift_KeyCache            $cache\n     * @param Swift_Mime_Grammar        $grammar\n     * @param array                     $mimeTypes optional\n     */\n    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $mimeTypes = array()) {\n        parent::__construct($headers, $encoder, $cache, $grammar, $mimeTypes);\n        $this->setDisposition('inline');\n        $this->setId($this->getId());\n    }\n\n    /**\n     * Get the nesting level of this EmbeddedFile.\n     *\n     * Returns {@see LEVEL_RELATED}.\n     *\n     * @return int\n     */\n    public function getNestingLevel() {\n        return self::LEVEL_RELATED;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Observes changes for a Mime entity's ContentEncoder.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_EncodingObserver{\n    /**\n     * Notify this observer that the observed entity's ContentEncoder has changed.\n     *\n     * @param Swift_Mime_ContentEncoder $encoder\n     */\n    public function encoderChanged(Swift_Mime_ContentEncoder $encoder);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Grammar.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Defines the grammar to use for validation, implements the RFC 2822 (and friends) ABNF grammar definitions.\n *\n * @author     Fabien Potencier\n * @author     Chris Corbyn\n */\nclass Swift_Mime_Grammar{\n    /**\n     * Special characters used in the syntax which need to be escaped.\n     *\n     * @var string[]\n     */\n    private static $_specials = array();\n\n    /**\n     * Tokens defined in RFC 2822 (and some related RFCs).\n     *\n     * @var string[]\n     */\n    private static $_grammar = array();\n\n    /**\n     * Initialize some RFC 2822 (and friends) ABNF grammar definitions.\n     */\n    public function __construct() {\n        $this->init();\n    }\n\n    public function __wakeup() {\n        $this->init();\n    }\n\n    protected function init() {\n        if (count(self::$_specials) > 0) {\n            return;\n        }\n\n        self::$_specials = array(\n            '(', ')', '<', '>', '[', ']',\n            ':', ';', '@', ',', '.', '\"',\n            );\n\n        /*** Refer to RFC 2822 for ABNF grammar ***/\n\n        // All basic building blocks\n        self::$_grammar['NO-WS-CTL'] = '[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]';\n        self::$_grammar['WSP'] = '[ \\t]';\n        self::$_grammar['CRLF'] = '(?:\\r\\n)';\n        self::$_grammar['FWS'] = '(?:(?:'.self::$_grammar['WSP'].'*'.\n                self::$_grammar['CRLF'].')?'.self::$_grammar['WSP'].')';\n        self::$_grammar['text'] = '[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F]';\n        self::$_grammar['quoted-pair'] = '(?:\\\\\\\\'.self::$_grammar['text'].')';\n        self::$_grammar['ctext'] = '(?:'.self::$_grammar['NO-WS-CTL'].\n                '|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])';\n        // Uses recursive PCRE (?1) -- could be a weak point??\n        self::$_grammar['ccontent'] = '(?:'.self::$_grammar['ctext'].'|'.\n                self::$_grammar['quoted-pair'].'|(?1))';\n        self::$_grammar['comment'] = '(\\((?:'.self::$_grammar['FWS'].'|'.\n                self::$_grammar['ccontent'].')*'.self::$_grammar['FWS'].'?\\))';\n        self::$_grammar['CFWS'] = '(?:(?:'.self::$_grammar['FWS'].'?'.\n                self::$_grammar['comment'].')*(?:(?:'.self::$_grammar['FWS'].'?'.\n                self::$_grammar['comment'].')|'.self::$_grammar['FWS'].'))';\n        self::$_grammar['qtext'] = '(?:'.self::$_grammar['NO-WS-CTL'].\n                '|[\\x21\\x23-\\x5B\\x5D-\\x7E])';\n        self::$_grammar['qcontent'] = '(?:'.self::$_grammar['qtext'].'|'.\n                self::$_grammar['quoted-pair'].')';\n        self::$_grammar['quoted-string'] = '(?:'.self::$_grammar['CFWS'].'?\"'.\n                '('.self::$_grammar['FWS'].'?'.self::$_grammar['qcontent'].')*'.\n                self::$_grammar['FWS'].'?\"'.self::$_grammar['CFWS'].'?)';\n        self::$_grammar['atext'] = '[a-zA-Z0-9!#\\$%&\\'\\*\\+\\-\\/=\\?\\^_`\\{\\}\\|~]';\n        self::$_grammar['atom'] = '(?:'.self::$_grammar['CFWS'].'?'.\n                self::$_grammar['atext'].'+'.self::$_grammar['CFWS'].'?)';\n        self::$_grammar['dot-atom-text'] = '(?:'.self::$_grammar['atext'].'+'.\n                '(\\.'.self::$_grammar['atext'].'+)*)';\n        self::$_grammar['dot-atom'] = '(?:'.self::$_grammar['CFWS'].'?'.\n                self::$_grammar['dot-atom-text'].'+'.self::$_grammar['CFWS'].'?)';\n        self::$_grammar['word'] = '(?:'.self::$_grammar['atom'].'|'.\n                self::$_grammar['quoted-string'].')';\n        self::$_grammar['phrase'] = '(?:'.self::$_grammar['word'].'+?)';\n        self::$_grammar['no-fold-quote'] = '(?:\"(?:'.self::$_grammar['qtext'].\n                '|'.self::$_grammar['quoted-pair'].')*\")';\n        self::$_grammar['dtext'] = '(?:'.self::$_grammar['NO-WS-CTL'].\n                '|[\\x21-\\x5A\\x5E-\\x7E])';\n        self::$_grammar['no-fold-literal'] = '(?:\\[(?:'.self::$_grammar['dtext'].\n                '|'.self::$_grammar['quoted-pair'].')*\\])';\n\n        // Message IDs\n        self::$_grammar['id-left'] = '(?:'.self::$_grammar['dot-atom-text'].'|'.\n                self::$_grammar['no-fold-quote'].')';\n        self::$_grammar['id-right'] = '(?:'.self::$_grammar['dot-atom-text'].'|'.\n                self::$_grammar['no-fold-literal'].')';\n\n        // Addresses, mailboxes and paths\n        self::$_grammar['local-part'] = '(?:'.self::$_grammar['dot-atom'].'|'.\n                self::$_grammar['quoted-string'].')';\n        self::$_grammar['dcontent'] = '(?:'.self::$_grammar['dtext'].'|'.\n                self::$_grammar['quoted-pair'].')';\n        self::$_grammar['domain-literal'] = '(?:'.self::$_grammar['CFWS'].'?\\[('.\n                self::$_grammar['FWS'].'?'.self::$_grammar['dcontent'].')*?'.\n                self::$_grammar['FWS'].'?\\]'.self::$_grammar['CFWS'].'?)';\n        self::$_grammar['domain'] = '(?:'.self::$_grammar['dot-atom'].'|'.\n                self::$_grammar['domain-literal'].')';\n        self::$_grammar['addr-spec'] = '(?:'.self::$_grammar['local-part'].'@'.\n                self::$_grammar['domain'].')';\n    }\n\n    /**\n     * Get the grammar defined for $name token.\n     *\n     * @param string $name exactly as written in the RFC\n     *\n     * @return string\n     */\n    public function getDefinition($name) {\n        if (array_key_exists($name, self::$_grammar)) {\n            return self::$_grammar[$name];\n        }\n\n        throw new Swift_RfcComplianceException(\n            \"No such grammar '\".$name.\"' defined.\"\n        );\n    }\n\n    /**\n     * Returns the tokens defined in RFC 2822 (and some related RFCs).\n     *\n     * @return array\n     */\n    public function getGrammarDefinitions() {\n        return self::$_grammar;\n    }\n\n    /**\n     * Returns the current special characters used in the syntax which need to be escaped.\n     *\n     * @return array\n     */\n    public function getSpecials() {\n        return self::$_specials;\n    }\n\n    /**\n     * Escape special characters in a string (convert to quoted-pairs).\n     *\n     * @param string   $token\n     * @param string[] $include additional chars to escape\n     * @param string[] $exclude chars from escaping\n     *\n     * @return string\n     */\n    public function escapeSpecials($token, $include = array(), $exclude = array()) {\n        foreach (array_merge(array('\\\\'), array_diff(self::$_specials, $exclude), $include) as $char) {\n            $token = str_replace($char, '\\\\'.$char, $token);\n        }\n\n        return $token;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Header.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME Header.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_Header{\n    /** Text headers */\n    const TYPE_TEXT = 2;\n\n    /**  headers (text + params) */\n    const TYPE_PARAMETERIZED = 6;\n\n    /** Mailbox and address headers */\n    const TYPE_MAILBOX = 8;\n\n    /** Date and time headers */\n    const TYPE_DATE = 16;\n\n    /** Identification headers */\n    const TYPE_ID = 32;\n\n    /** Address path headers */\n    const TYPE_PATH = 64;\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType();\n\n    /**\n     * Set the model for the field body.\n     *\n     * The actual types needed will vary depending upon the type of Header.\n     *\n     * @param mixed $model\n     */\n    public function setFieldBodyModel($model);\n\n    /**\n     * Set the charset used when rendering the Header.\n     *\n     * @param string $charset\n     */\n    public function setCharset($charset);\n\n    /**\n     * Get the model for the field body.\n     *\n     * The return type depends on the specifics of the Header.\n     *\n     * @return mixed\n     */\n    public function getFieldBodyModel();\n\n    /**\n     * Get the name of this header (e.g. Subject).\n     *\n     * The name is an identifier and as such will be immutable.\n     *\n     * @return string\n     */\n    public function getFieldName();\n\n    /**\n     * Get the field body, prepared for folding into a final header value.\n     *\n     * @return string\n     */\n    public function getFieldBody();\n\n    /**\n     * Get this Header rendered as a compliant string.\n     *\n     * @return string\n     */\n    public function toString();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Base64 (B) Header Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_HeaderEncoder_Base64HeaderEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_HeaderEncoder{\n    /**\n     * Get the name of this encoding scheme.\n     * Returns the string 'B'.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'B';\n    }\n\n    /**\n     * Takes an unencoded string and produces a Base64 encoded string from it.\n     *\n     * If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of\n     * default encodeString, otherwise pass to the parent method.\n     *\n     * @param string $string          string to encode\n     * @param int    $firstLineOffset\n     * @param int    $maxLineLength   optional, 0 indicates the default of 76 bytes\n     * @param string $charset\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0, $charset = 'utf-8') {\n        if (strtolower($charset) === 'iso-2022-jp') {\n            $old = mb_internal_encoding();\n            mb_internal_encoding('utf-8');\n            $newstring = mb_encode_mimeheader($string, $charset, $this->getName(), \"\\r\\n\");\n            mb_internal_encoding($old);\n\n            return $newstring;\n        }\n\n        return parent::encodeString($string, $firstLineOffset, $maxLineLength);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles Quoted Printable (Q) Header Encoding in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_HeaderEncoder{\n    /**\n     * Creates a new QpHeaderEncoder for the given CharacterStream.\n     *\n     * @param Swift_CharacterStream $charStream to use for reading characters\n     */\n    public function __construct(Swift_CharacterStream $charStream) {\n        parent::__construct($charStream);\n    }\n\n    protected function initSafeMap() {\n        foreach (array_merge(\n            range(0x61, 0x7A), range(0x41, 0x5A),\n            range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F)\n        ) as $byte) {\n            $this->_safeMap[$byte] = chr($byte);\n        }\n    }\n\n    /**\n     * Get the name of this encoding scheme.\n     *\n     * Returns the string 'Q'.\n     *\n     * @return string\n     */\n    public function getName() {\n        return 'Q';\n    }\n\n    /**\n     * Takes an unencoded string and produces a QP encoded string from it.\n     *\n     * @param string $string          string to encode\n     * @param int    $firstLineOffset optional\n     * @param int    $maxLineLength   optional, 0 indicates the default of 76 chars\n     *\n     * @return string\n     */\n    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) {\n        return str_replace(array(' ', '=20', \"=\\r\\n\"), array('_', '_', \"\\r\\n\"),\n            parent::encodeString($string, $firstLineOffset, $maxLineLength)\n        );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Interface for all Header Encoding schemes.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_HeaderEncoder extends Swift_Encoder{\n    /**\n     * Get the MIME name of this content encoding scheme.\n     *\n     * @return string\n     */\n    public function getName();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Creates MIME headers.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_HeaderFactory extends Swift_Mime_CharsetObserver{\n    /**\n     * Create a new Mailbox Header with a list of $addresses.\n     *\n     * @param string       $name\n     * @param array|string $addresses\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createMailboxHeader($name, $addresses = null);\n\n    /**\n     * Create a new Date header using $timestamp (UNIX time).\n     *\n     * @param string $name\n     * @param int    $timestamp\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createDateHeader($name, $timestamp = null);\n\n    /**\n     * Create a new basic text header with $name and $value.\n     *\n     * @param string $name\n     * @param string $value\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createTextHeader($name, $value = null);\n\n    /**\n     * Create a new ParameterizedHeader with $name, $value and $params.\n     *\n     * @param string $name\n     * @param string $value\n     * @param array  $params\n     *\n     * @return Swift_Mime_ParameterizedHeader\n     */\n    public function createParameterizedHeader($name, $value = null, $params = array());\n\n    /**\n     * Create a new ID header for Message-ID or Content-ID.\n     *\n     * @param string       $name\n     * @param string|array $ids\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createIdHeader($name, $ids = null);\n\n    /**\n     * Create a new Path header with an address (path) in it.\n     *\n     * @param string $name\n     * @param string $path\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createPathHeader($name, $path = null);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A collection of MIME headers.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver{\n    /**\n     * Add a new Mailbox Header with a list of $addresses.\n     *\n     * @param string       $name\n     * @param array|string $addresses\n     */\n    public function addMailboxHeader($name, $addresses = null);\n\n    /**\n     * Add a new Date header using $timestamp (UNIX time).\n     *\n     * @param string $name\n     * @param int    $timestamp\n     */\n    public function addDateHeader($name, $timestamp = null);\n\n    /**\n     * Add a new basic text header with $name and $value.\n     *\n     * @param string $name\n     * @param string $value\n     */\n    public function addTextHeader($name, $value = null);\n\n    /**\n     * Add a new ParameterizedHeader with $name, $value and $params.\n     *\n     * @param string $name\n     * @param string $value\n     * @param array  $params\n     */\n    public function addParameterizedHeader($name, $value = null, $params = array());\n\n    /**\n     * Add a new ID header for Message-ID or Content-ID.\n     *\n     * @param string       $name\n     * @param string|array $ids\n     */\n    public function addIdHeader($name, $ids = null);\n\n    /**\n     * Add a new Path header with an address (path) in it.\n     *\n     * @param string $name\n     * @param string $path\n     */\n    public function addPathHeader($name, $path = null);\n\n    /**\n     * Returns true if at least one header with the given $name exists.\n     *\n     * If multiple headers match, the actual one may be specified by $index.\n     *\n     * @param string $name\n     * @param int    $index\n     *\n     * @return bool\n     */\n    public function has($name, $index = 0);\n\n    /**\n     * Set a header in the HeaderSet.\n     *\n     * The header may be a previously fetched header via {@link get()} or it may\n     * be one that has been created separately.\n     *\n     * If $index is specified, the header will be inserted into the set at this\n     * offset.\n     *\n     * @param Swift_Mime_Header $header\n     * @param int               $index\n     */\n    public function set(Swift_Mime_Header $header, $index = 0);\n\n    /**\n     * Get the header with the given $name.\n     * If multiple headers match, the actual one may be specified by $index.\n     * Returns NULL if none present.\n     *\n     * @param string $name\n     * @param int    $index\n     *\n     * @return Swift_Mime_Header\n     */\n    public function get($name, $index = 0);\n\n    /**\n     * Get all headers with the given $name.\n     *\n     * @param string $name\n     *\n     * @return array\n     */\n    public function getAll($name = null);\n\n    /**\n     * Return the name of all Headers.\n     *\n     * @return array\n     */\n    public function listAll();\n\n    /**\n     * Remove the header with the given $name if it's set.\n     *\n     * If multiple headers match, the actual one may be specified by $index.\n     *\n     * @param string $name\n     * @param int    $index\n     */\n    public function remove($name, $index = 0);\n\n    /**\n     * Remove all headers with the given $name.\n     *\n     * @param string $name\n     */\n    public function removeAll($name);\n\n    /**\n     * Create a new instance of this HeaderSet.\n     *\n     * @return Swift_Mime_HeaderSet\n     */\n    public function newInstance();\n\n    /**\n     * Define a list of Header names as an array in the correct order.\n     *\n     * These Headers will be output in the given order where present.\n     *\n     * @param array $sequence\n     */\n    public function defineOrdering(array $sequence);\n\n    /**\n     * Set a list of header names which must always be displayed when set.\n     *\n     * Usually headers without a field value won't be output unless set here.\n     *\n     * @param array $names\n     */\n    public function setAlwaysDisplayed(array $names);\n\n    /**\n     * Returns a string with a representation of all headers.\n     *\n     * @return string\n     */\n    public function toString();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An abstract base MIME Header.\n *\n * @author Chris Corbyn\n */\nabstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header{\n    /**\n     * The name of this Header.\n     *\n     * @var string\n     */\n    private $_name;\n\n    /**\n     * The Grammar used for this Header.\n     *\n     * @var Swift_Mime_Grammar\n     */\n    private $_grammar;\n\n    /**\n     * The Encoder used to encode this Header.\n     *\n     * @var Swift_Encoder\n     */\n    private $_encoder;\n\n    /**\n     * The maximum length of a line in the header.\n     *\n     * @var int\n     */\n    private $_lineLength = 78;\n\n    /**\n     * The language used in this Header.\n     *\n     * @var string\n     */\n    private $_lang;\n\n    /**\n     * The character set of the text in this Header.\n     *\n     * @var string\n     */\n    private $_charset = 'utf-8';\n\n    /**\n     * The value of this Header, cached.\n     *\n     * @var string\n     */\n    private $_cachedValue = null;\n\n    /**\n     * Creates a new Header.\n     *\n     * @param Swift_Mime_Grammar $grammar\n     */\n    public function __construct(Swift_Mime_Grammar $grammar) {\n        $this->setGrammar($grammar);\n    }\n\n    /**\n     * Set the character set used in this Header.\n     *\n     * @param string $charset\n     */\n    public function setCharset($charset) {\n        $this->clearCachedValueIf($charset != $this->_charset);\n        $this->_charset = $charset;\n        if (isset($this->_encoder)) {\n            $this->_encoder->charsetChanged($charset);\n        }\n    }\n\n    /**\n     * Get the character set used in this Header.\n     *\n     * @return string\n     */\n    public function getCharset() {\n        return $this->_charset;\n    }\n\n    /**\n     * Set the language used in this Header.\n     *\n     * For example, for US English, 'en-us'.\n     * This can be unspecified.\n     *\n     * @param string $lang\n     */\n    public function setLanguage($lang) {\n        $this->clearCachedValueIf($this->_lang != $lang);\n        $this->_lang = $lang;\n    }\n\n    /**\n     * Get the language used in this Header.\n     *\n     * @return string\n     */\n    public function getLanguage() {\n        return $this->_lang;\n    }\n\n    /**\n     * Set the encoder used for encoding the header.\n     *\n     * @param Swift_Mime_HeaderEncoder $encoder\n     */\n    public function setEncoder(Swift_Mime_HeaderEncoder $encoder) {\n        $this->_encoder = $encoder;\n        $this->setCachedValue(null);\n    }\n\n    /**\n     * Get the encoder used for encoding this Header.\n     *\n     * @return Swift_Mime_HeaderEncoder\n     */\n    public function getEncoder() {\n        return $this->_encoder;\n    }\n\n    /**\n     * Set the grammar used for the header.\n     *\n     * @param Swift_Mime_Grammar $grammar\n     */\n    public function setGrammar(Swift_Mime_Grammar $grammar) {\n        $this->_grammar = $grammar;\n        $this->setCachedValue(null);\n    }\n\n    /**\n     * Get the grammar used for this Header.\n     *\n     * @return Swift_Mime_Grammar\n     */\n    public function getGrammar() {\n        return $this->_grammar;\n    }\n\n    /**\n     * Get the name of this header (e.g. charset).\n     *\n     * @return string\n     */\n    public function getFieldName() {\n        return $this->_name;\n    }\n\n    /**\n     * Set the maximum length of lines in the header (excluding EOL).\n     *\n     * @param int $lineLength\n     */\n    public function setMaxLineLength($lineLength) {\n        $this->clearCachedValueIf($this->_lineLength != $lineLength);\n        $this->_lineLength = $lineLength;\n    }\n\n    /**\n     * Get the maximum permitted length of lines in this Header.\n     *\n     * @return int\n     */\n    public function getMaxLineLength() {\n        return $this->_lineLength;\n    }\n\n    /**\n     * Get this Header rendered as a RFC 2822 compliant string.\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return string\n     */\n    public function toString() {\n        return $this->_tokensToString($this->toTokens());\n    }\n\n    /**\n     * Returns a string representation of this object.\n     *\n     * @return string\n     *\n     * @see toString()\n     */\n    public function __toString() {\n        return $this->toString();\n    }\n\n    // -- Points of extension\n\n    /**\n     * Set the name of this Header field.\n     *\n     * @param string $name\n     */\n    protected function setFieldName($name) {\n        $this->_name = $name;\n    }\n\n    /**\n     * Produces a compliant, formatted RFC 2822 'phrase' based on the string given.\n     *\n     * @param Swift_Mime_Header        $header\n     * @param string                   $string  as displayed\n     * @param string                   $charset of the text\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param bool                     $shorten the first line to make remove for header name\n     *\n     * @return string\n     */\n    protected function createPhrase(Swift_Mime_Header $header, $string, $charset, Swift_Mime_HeaderEncoder $encoder = null, $shorten = false) {\n        // Treat token as exactly what was given\n        $phraseStr = $string;\n        // If it's not valid\n        if (!preg_match('/^'.$this->getGrammar()->getDefinition('phrase').'$/D', $phraseStr)) {\n            // .. but it is just ascii text, try escaping some characters\n            // and make it a quoted-string\n            if (preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $phraseStr)) {\n                $phraseStr = $this->getGrammar()->escapeSpecials(\n                    $phraseStr, array('\"'), $this->getGrammar()->getSpecials()\n                    );\n                $phraseStr = '\"'.$phraseStr.'\"';\n            } else {\n                // ... otherwise it needs encoding\n                // Determine space remaining on line if first line\n                if ($shorten) {\n                    $usedLength = strlen($header->getFieldName().': ');\n                } else {\n                    $usedLength = 0;\n                }\n                $phraseStr = $this->encodeWords($header, $string, $usedLength);\n            }\n        }\n\n        return $phraseStr;\n    }\n\n    /**\n     * Encode needed word tokens within a string of input.\n     *\n     * @param Swift_Mime_Header $header\n     * @param string            $input\n     * @param string            $usedLength optional\n     *\n     * @return string\n     */\n    protected function encodeWords(Swift_Mime_Header $header, $input, $usedLength = -1) {\n        $value = '';\n\n        $tokens = $this->getEncodableWordTokens($input);\n\n        foreach ($tokens as $token) {\n            // See RFC 2822, Sect 2.2 (really 2.2 ??)\n            if ($this->tokenNeedsEncoding($token)) {\n                // Don't encode starting WSP\n                $firstChar = substr($token, 0, 1);\n                switch ($firstChar) {\n                    case ' ':\n                    case \"\\t\":\n                        $value .= $firstChar;\n                        $token = substr($token, 1);\n                }\n\n                if (-1 == $usedLength) {\n                    $usedLength = strlen($header->getFieldName().': ') + strlen($value);\n                }\n                $value .= $this->getTokenAsEncodedWord($token, $usedLength);\n\n                $header->setMaxLineLength(76); // Forcefully override\n            } else {\n                $value .= $token;\n            }\n        }\n\n        return $value;\n    }\n\n    /**\n     * Test if a token needs to be encoded or not.\n     *\n     * @param string $token\n     *\n     * @return bool\n     */\n    protected function tokenNeedsEncoding($token) {\n        return preg_match('~[\\x00-\\x08\\x10-\\x19\\x7F-\\xFF\\r\\n]~', $token);\n    }\n\n    /**\n     * Splits a string into tokens in blocks of words which can be encoded quickly.\n     *\n     * @param string $string\n     *\n     * @return string[]\n     */\n    protected function getEncodableWordTokens($string) {\n        $tokens = array();\n\n        $encodedToken = '';\n        // Split at all whitespace boundaries\n        foreach (preg_split('~(?=[\\t ])~', $string) as $token) {\n            if ($this->tokenNeedsEncoding($token)) {\n                $encodedToken .= $token;\n            } else {\n                if (strlen($encodedToken) > 0) {\n                    $tokens[] = $encodedToken;\n                    $encodedToken = '';\n                }\n                $tokens[] = $token;\n            }\n        }\n        if (strlen($encodedToken)) {\n            $tokens[] = $encodedToken;\n        }\n\n        return $tokens;\n    }\n\n    /**\n     * Get a token as an encoded word for safe insertion into headers.\n     *\n     * @param string $token           token to encode\n     * @param int    $firstLineOffset optional\n     *\n     * @return string\n     */\n    protected function getTokenAsEncodedWord($token, $firstLineOffset = 0) {\n        // Adjust $firstLineOffset to account for space needed for syntax\n        $charsetDecl = $this->_charset;\n        if (isset($this->_lang)) {\n            $charsetDecl .= '*'.$this->_lang;\n        }\n        $encodingWrapperLength = strlen(\n            '=?'.$charsetDecl.'?'.$this->_encoder->getName().'??='\n            );\n\n        if ($firstLineOffset >= 75) {\n            //Does this logic need to be here?\n            $firstLineOffset = 0;\n        }\n\n        $encodedTextLines = explode(\"\\r\\n\",\n            $this->_encoder->encodeString(\n                $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->_charset\n                )\n        );\n\n        if (strtolower($this->_charset) !== 'iso-2022-jp') {\n            // special encoding for iso-2022-jp using mb_encode_mimeheader\n            foreach ($encodedTextLines as $lineNum => $line) {\n                $encodedTextLines[$lineNum] = '=?'.$charsetDecl.\n                    '?'.$this->_encoder->getName().\n                    '?'.$line.'?=';\n            }\n        }\n\n        return implode(\"\\r\\n \", $encodedTextLines);\n    }\n\n    /**\n     * Generates tokens from the given string which include CRLF as individual tokens.\n     *\n     * @param string $token\n     *\n     * @return string[]\n     */\n    protected function generateTokenLines($token) {\n        return preg_split('~(\\r\\n)~', $token, -1, PREG_SPLIT_DELIM_CAPTURE);\n    }\n\n    /**\n     * Set a value into the cache.\n     *\n     * @param string $value\n     */\n    protected function setCachedValue($value) {\n        $this->_cachedValue = $value;\n    }\n\n    /**\n     * Get the value in the cache.\n     *\n     * @return string\n     */\n    protected function getCachedValue() {\n        return $this->_cachedValue;\n    }\n\n    /**\n     * Clear the cached value if $condition is met.\n     *\n     * @param bool $condition\n     */\n    protected function clearCachedValueIf($condition) {\n        if ($condition) {\n            $this->setCachedValue(null);\n        }\n    }\n\n    /**\n     * Generate a list of all tokens in the final header.\n     *\n     * @param string $string The string to tokenize\n     *\n     * @return array An array of tokens as strings\n     */\n    protected function toTokens($string = null) {\n        if (is_null($string)) {\n            $string = $this->getFieldBody();\n        }\n\n        $tokens = array();\n\n        // Generate atoms; split at all invisible boundaries followed by WSP\n        foreach (preg_split('~(?=[ \\t])~', $string) as $token) {\n            $newTokens = $this->generateTokenLines($token);\n            foreach ($newTokens as $newToken) {\n                $tokens[] = $newToken;\n            }\n        }\n\n        return $tokens;\n    }\n\n    /**\n     * Takes an array of tokens which appear in the header and turns them into\n     * an RFC 2822 compliant string, adding FWSP where needed.\n     *\n     * @param string[] $tokens\n     *\n     * @return string\n     */\n    private function _tokensToString(array $tokens) {\n        $lineCount = 0;\n        $headerLines = array();\n        $headerLines[] = $this->_name.': ';\n        $currentLine = &$headerLines[$lineCount++];\n\n        // Build all tokens back into compliant header\n        foreach ($tokens as $i => $token) {\n            // Line longer than specified maximum or token was just a new line\n            if ((\"\\r\\n\" == $token) ||\n                ($i > 0 && strlen($currentLine.$token) > $this->_lineLength)\n                && 0 < strlen($currentLine)) {\n                $headerLines[] = '';\n                $currentLine = &$headerLines[$lineCount++];\n            }\n\n            // Append token to the line\n            if (\"\\r\\n\" != $token) {\n                $currentLine .= $token;\n            }\n        }\n\n        // Implode with FWS (RFC 2822, 2.2.3)\n        return implode(\"\\r\\n\", $headerLines).\"\\r\\n\";\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A Date MIME Header for Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader{\n    /**\n     * The UNIX timestamp value of this Header.\n     *\n     * @var int\n     */\n    private $_timestamp;\n\n    /**\n     * Creates a new DateHeader with $name and $timestamp.\n     *\n     * Example:\n     * <code>\n     * <?php\n     * $header = new Swift_Mime_Headers_DateHeader('Date', time());\n     * ?>\n     * </code>\n     *\n     * @param string             $name    of Header\n     * @param Swift_Mime_Grammar $grammar\n     */\n    public function __construct($name, Swift_Mime_Grammar $grammar) {\n        $this->setFieldName($name);\n        parent::__construct($grammar);\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_DATE;\n    }\n\n    /**\n     * Set the model for the field body.\n     *\n     * This method takes a UNIX timestamp.\n     *\n     * @param int $model\n     */\n    public function setFieldBodyModel($model) {\n        $this->setTimestamp($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     *\n     * This method returns a UNIX timestamp.\n     *\n     * @return mixed\n     */\n    public function getFieldBodyModel() {\n        return $this->getTimestamp();\n    }\n\n    /**\n     * Get the UNIX timestamp of the Date in this Header.\n     *\n     * @return int\n     */\n    public function getTimestamp() {\n        return $this->_timestamp;\n    }\n\n    /**\n     * Set the UNIX timestamp of the Date in this Header.\n     *\n     * @param int $timestamp\n     */\n    public function setTimestamp($timestamp) {\n        if (!is_null($timestamp)) {\n            $timestamp = (int) $timestamp;\n        }\n        $this->clearCachedValueIf($this->_timestamp != $timestamp);\n        $this->_timestamp = $timestamp;\n    }\n\n    /**\n     * Get the string value of the body in this Header.\n     *\n     * This is not necessarily RFC 2822 compliant since folding white space will\n     * not be added at this stage (see {@link toString()} for that).\n     *\n     * @see toString()\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        if (!$this->getCachedValue()) {\n            if (isset($this->_timestamp)) {\n                $this->setCachedValue(date('r', $this->_timestamp));\n            }\n        }\n\n        return $this->getCachedValue();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An ID MIME Header for something like Message-ID or Content-ID.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_AbstractHeader{\n    /**\n     * The IDs used in the value of this Header.\n     *\n     * This may hold multiple IDs or just a single ID.\n     *\n     * @var string[]\n     */\n    private $_ids = array();\n\n    /**\n     * Creates a new IdentificationHeader with the given $name and $id.\n     *\n     * @param string             $name\n     * @param Swift_Mime_Grammar $grammar\n     */\n    public function __construct($name, Swift_Mime_Grammar $grammar) {\n        $this->setFieldName($name);\n        parent::__construct($grammar);\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_ID;\n    }\n\n    /**\n     * Set the model for the field body.\n     *\n     * This method takes a string ID, or an array of IDs.\n     *\n     * @param mixed $model\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setFieldBodyModel($model) {\n        $this->setId($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     *\n     * This method returns an array of IDs\n     *\n     * @return array\n     */\n    public function getFieldBodyModel() {\n        return $this->getIds();\n    }\n\n    /**\n     * Set the ID used in the value of this header.\n     *\n     * @param string|array $id\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setId($id) {\n        $this->setIds(is_array($id) ? $id : array($id));\n    }\n\n    /**\n     * Get the ID used in the value of this Header.\n     *\n     * If multiple IDs are set only the first is returned.\n     *\n     * @return string\n     */\n    public function getId() {\n        if (count($this->_ids) > 0) {\n            return $this->_ids[0];\n        }\n    }\n\n    /**\n     * Set a collection of IDs to use in the value of this Header.\n     *\n     * @param string[] $ids\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setIds(array $ids) {\n        $actualIds = array();\n\n        foreach ($ids as $id) {\n            $this->_assertValidId($id);\n            $actualIds[] = $id;\n        }\n\n        $this->clearCachedValueIf($this->_ids != $actualIds);\n        $this->_ids = $actualIds;\n    }\n\n    /**\n     * Get the list of IDs used in this Header.\n     *\n     * @return string[]\n     */\n    public function getIds() {\n        return $this->_ids;\n    }\n\n    /**\n     * Get the string value of the body in this Header.\n     *\n     * This is not necessarily RFC 2822 compliant since folding white space will\n     * not be added at this stage (see {@see toString()} for that).\n     *\n     * @see toString()\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        if (!$this->getCachedValue()) {\n            $angleAddrs = array();\n\n            foreach ($this->_ids as $id) {\n                $angleAddrs[] = '<'.$id.'>';\n            }\n\n            $this->setCachedValue(implode(' ', $angleAddrs));\n        }\n\n        return $this->getCachedValue();\n    }\n\n    /**\n     * Throws an Exception if the id passed does not comply with RFC 2822.\n     *\n     * @param string $id\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    private function _assertValidId($id) {\n        if (!preg_match(\n            '/^'.$this->getGrammar()->getDefinition('id-left').'@'.\n            $this->getGrammar()->getDefinition('id-right').'$/D',\n            $id\n            )) {\n            throw new Swift_RfcComplianceException(\n                'Invalid ID given <'.$id.'>'\n                );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A Mailbox Address MIME Header for something like From or Sender.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader{\n    /**\n     * The mailboxes used in this Header.\n     *\n     * @var string[]\n     */\n    private $_mailboxes = array();\n\n    /**\n     * Creates a new MailboxHeader with $name.\n     *\n     * @param string                   $name    of Header\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param Swift_Mime_Grammar       $grammar\n     */\n    public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) {\n        $this->setFieldName($name);\n        $this->setEncoder($encoder);\n        parent::__construct($grammar);\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_MAILBOX;\n    }\n\n    /**\n     * Set the model for the field body.\n     *\n     * This method takes a string, or an array of addresses.\n     *\n     * @param mixed $model\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setFieldBodyModel($model) {\n        $this->setNameAddresses($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     *\n     * This method returns an associative array like {@link getNameAddresses()}\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return array\n     */\n    public function getFieldBodyModel() {\n        return $this->getNameAddresses();\n    }\n\n    /**\n     * Set a list of mailboxes to be shown in this Header.\n     *\n     * The mailboxes can be a simple array of addresses, or an array of\n     * key=>value pairs where (email => personalName).\n     * Example:\n     * <code>\n     * <?php\n     * //Sets two mailboxes in the Header, one with a personal name\n     * $header->setNameAddresses(array(\n     *  'chris@swiftmailer.org' => 'Chris Corbyn',\n     *  'mark@swiftmailer.org' //No associated personal name\n     *  ));\n     * ?>\n     * </code>\n     *\n     * @see __construct()\n     * @see setAddresses()\n     * @see setValue()\n     *\n     * @param string|string[] $mailboxes\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setNameAddresses($mailboxes) {\n        $this->_mailboxes = $this->normalizeMailboxes((array) $mailboxes);\n        $this->setCachedValue(null); //Clear any cached value\n    }\n\n    /**\n     * Get the full mailbox list of this Header as an array of valid RFC 2822 strings.\n     *\n     * Example:\n     * <code>\n     * <?php\n     * $header = new Swift_Mime_Headers_MailboxHeader('From',\n     *  array('chris@swiftmailer.org' => 'Chris Corbyn',\n     *  'mark@swiftmailer.org' => 'Mark Corbyn')\n     *  );\n     * print_r($header->getNameAddressStrings());\n     * // array (\n     * // 0 => Chris Corbyn <chris@swiftmailer.org>,\n     * // 1 => Mark Corbyn <mark@swiftmailer.org>\n     * // )\n     * ?>\n     * </code>\n     *\n     * @see getNameAddresses()\n     * @see toString()\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return string[]\n     */\n    public function getNameAddressStrings() {\n        return $this->_createNameAddressStrings($this->getNameAddresses());\n    }\n\n    /**\n     * Get all mailboxes in this Header as key=>value pairs.\n     *\n     * The key is the address and the value is the name (or null if none set).\n     * Example:\n     * <code>\n     * <?php\n     * $header = new Swift_Mime_Headers_MailboxHeader('From',\n     *  array('chris@swiftmailer.org' => 'Chris Corbyn',\n     *  'mark@swiftmailer.org' => 'Mark Corbyn')\n     *  );\n     * print_r($header->getNameAddresses());\n     * // array (\n     * // chris@swiftmailer.org => Chris Corbyn,\n     * // mark@swiftmailer.org => Mark Corbyn\n     * // )\n     * ?>\n     * </code>\n     *\n     * @see getAddresses()\n     * @see getNameAddressStrings()\n     *\n     * @return string[]\n     */\n    public function getNameAddresses() {\n        return $this->_mailboxes;\n    }\n\n    /**\n     * Makes this Header represent a list of plain email addresses with no names.\n     *\n     * Example:\n     * <code>\n     * <?php\n     * //Sets three email addresses as the Header data\n     * $header->setAddresses(\n     *  array('one@domain.tld', 'two@domain.tld', 'three@domain.tld')\n     *  );\n     * ?>\n     * </code>\n     *\n     * @see setNameAddresses()\n     * @see setValue()\n     *\n     * @param string[] $addresses\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setAddresses($addresses) {\n        $this->setNameAddresses(array_values((array) $addresses));\n    }\n\n    /**\n     * Get all email addresses in this Header.\n     *\n     * @see getNameAddresses()\n     *\n     * @return string[]\n     */\n    public function getAddresses() {\n        return array_keys($this->_mailboxes);\n    }\n\n    /**\n     * Remove one or more addresses from this Header.\n     *\n     * @param string|string[] $addresses\n     */\n    public function removeAddresses($addresses) {\n        $this->setCachedValue(null);\n        foreach ((array) $addresses as $address) {\n            unset($this->_mailboxes[$address]);\n        }\n    }\n\n    /**\n     * Get the string value of the body in this Header.\n     *\n     * This is not necessarily RFC 2822 compliant since folding white space will\n     * not be added at this stage (see {@link toString()} for that).\n     *\n     * @see toString()\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        // Compute the string value of the header only if needed\n        if (is_null($this->getCachedValue())) {\n            $this->setCachedValue($this->createMailboxListString($this->_mailboxes));\n        }\n\n        return $this->getCachedValue();\n    }\n\n    // -- Points of extension\n\n    /**\n     * Normalizes a user-input list of mailboxes into consistent key=>value pairs.\n     *\n     * @param string[] $mailboxes\n     *\n     * @return string[]\n     */\n    protected function normalizeMailboxes(array $mailboxes) {\n        $actualMailboxes = array();\n\n        foreach ($mailboxes as $key => $value) {\n            if (is_string($key)) {\n                //key is email addr\n                $address = $key;\n                $name = $value;\n            } else {\n                $address = $value;\n                $name = null;\n            }\n            $this->_assertValidAddress($address);\n            $actualMailboxes[$address] = $name;\n        }\n\n        return $actualMailboxes;\n    }\n\n    /**\n     * Produces a compliant, formatted display-name based on the string given.\n     *\n     * @param string $displayName as displayed\n     * @param bool   $shorten     the first line to make remove for header name\n     *\n     * @return string\n     */\n    protected function createDisplayNameString($displayName, $shorten = false) {\n        return $this->createPhrase($this, $displayName,\n            $this->getCharset(), $this->getEncoder(), $shorten\n            );\n    }\n\n    /**\n     * Creates a string form of all the mailboxes in the passed array.\n     *\n     * @param string[] $mailboxes\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return string\n     */\n    protected function createMailboxListString(array $mailboxes) {\n        return implode(', ', $this->_createNameAddressStrings($mailboxes));\n    }\n\n    /**\n     * Redefine the encoding requirements for mailboxes.\n     *\n     * Commas and semicolons are used to separate\n     * multiple addresses, and should therefore be encoded\n     *\n     * @param string $token\n     *\n     * @return bool\n     */\n    protected function tokenNeedsEncoding($token) {\n        return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token);\n    }\n\n    /**\n     * Return an array of strings conforming the the name-addr spec of RFC 2822.\n     *\n     * @param string[] $mailboxes\n     *\n     * @return string[]\n     */\n    private function _createNameAddressStrings(array $mailboxes) {\n        $strings = array();\n\n        foreach ($mailboxes as $email => $name) {\n            $mailboxStr = $email;\n            if (!is_null($name)) {\n                $nameStr = $this->createDisplayNameString($name, empty($strings));\n                $mailboxStr = $nameStr.' <'.$mailboxStr.'>';\n            }\n            $strings[] = $mailboxStr;\n        }\n\n        return $strings;\n    }\n\n    /**\n     * Throws an Exception if the address passed does not comply with RFC 2822.\n     *\n     * @param string $address\n     *\n     * @throws Swift_RfcComplianceException If invalid.\n     */\n    private function _assertValidAddress($address) {\n        if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',\n            $address)) {\n            throw new Swift_RfcComplianceException(\n                'Address in mailbox given ['.$address.\n                '] does not comply with RFC 2822, 3.6.2.'\n                );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An OpenDKIM Specific Header using only raw header datas without encoding.\n *\n * @author De Cock Xavier <xdecock@gmail.com>\n */\nclass Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header{\n    /**\n     * The value of this Header.\n     *\n     * @var string\n     */\n    private $_value;\n\n    /**\n     * The name of this Header.\n     *\n     * @var string\n     */\n    private $_fieldName;\n\n    /**\n     * Creates a new SimpleHeader with $name.\n     *\n     * @param string                   $name\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param Swift_Mime_Grammar       $grammar\n     */\n    public function __construct($name) {\n        $this->_fieldName = $name;\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_TEXT;\n    }\n\n    /**\n     * Set the model for the field body.\n     *\n     * This method takes a string for the field value.\n     *\n     * @param string $model\n     */\n    public function setFieldBodyModel($model) {\n        $this->setValue($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     *\n     * This method returns a string.\n     *\n     * @return string\n     */\n    public function getFieldBodyModel() {\n        return $this->getValue();\n    }\n\n    /**\n     * Get the (unencoded) value of this header.\n     *\n     * @return string\n     */\n    public function getValue() {\n        return $this->_value;\n    }\n\n    /**\n     * Set the (unencoded) value of this header.\n     *\n     * @param string $value\n     */\n    public function setValue($value) {\n        $this->_value = $value;\n    }\n\n    /**\n     * Get the value of this header prepared for rendering.\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        return $this->_value;\n    }\n\n    /**\n     * Get this Header rendered as a RFC 2822 compliant string.\n     *\n     * @return string\n     */\n    public function toString() {\n        return $this->_fieldName.': '.$this->_value;\n    }\n\n    /**\n     * Set the Header FieldName.\n     *\n     * @see Swift_Mime_Header::getFieldName()\n     */\n    public function getFieldName() {\n        return $this->_fieldName;\n    }\n\n    /**\n     * Ignored.\n     */\n    public function setCharset($charset) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An abstract base MIME Header.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_UnstructuredHeader implements Swift_Mime_ParameterizedHeader{\n    /**\n     * RFC 2231's definition of a token.\n     *\n     * @var string\n     */\n    const TOKEN_REGEX = '(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2E\\x30-\\x39\\x41-\\x5A\\x5E-\\x7E]+)';\n\n    /**\n     * The Encoder used to encode the parameters.\n     *\n     * @var Swift_Encoder\n     */\n    private $_paramEncoder;\n\n    /**\n     * The parameters as an associative array.\n     *\n     * @var string[]\n     */\n    private $_params = array();\n\n    /**\n     * Creates a new ParameterizedHeader with $name.\n     *\n     * @param string                   $name\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param Swift_Encoder            $paramEncoder, optional\n     * @param Swift_Mime_Grammar       $grammar\n     */\n    public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder = null, Swift_Mime_Grammar $grammar) {\n        parent::__construct($name, $encoder, $grammar);\n        $this->_paramEncoder = $paramEncoder;\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_PARAMETERIZED;\n    }\n\n    /**\n     * Set the character set used in this Header.\n     *\n     * @param string $charset\n     */\n    public function setCharset($charset) {\n        parent::setCharset($charset);\n        if (isset($this->_paramEncoder)) {\n            $this->_paramEncoder->charsetChanged($charset);\n        }\n    }\n\n    /**\n     * Set the value of $parameter.\n     *\n     * @param string $parameter\n     * @param string $value\n     */\n    public function setParameter($parameter, $value) {\n        $this->setParameters(array_merge($this->getParameters(), array($parameter => $value)));\n    }\n\n    /**\n     * Get the value of $parameter.\n     *\n     * @param string $parameter\n     *\n     * @return string\n     */\n    public function getParameter($parameter) {\n        $params = $this->getParameters();\n\n        return array_key_exists($parameter, $params) ? $params[$parameter] : null;\n    }\n\n    /**\n     * Set an associative array of parameter names mapped to values.\n     *\n     * @param string[] $parameters\n     */\n    public function setParameters(array $parameters) {\n        $this->clearCachedValueIf($this->_params != $parameters);\n        $this->_params = $parameters;\n    }\n\n    /**\n     * Returns an associative array of parameter names mapped to values.\n     *\n     * @return string[]\n     */\n    public function getParameters() {\n        return $this->_params;\n    }\n\n    /**\n     * Get the value of this header prepared for rendering.\n     *\n     * @return string\n     */\n    public function getFieldBody() { //TODO: Check caching here\n        $body = parent::getFieldBody();\n        foreach ($this->_params as $name => $value) {\n            if (!is_null($value)) {\n                // Add the parameter\n                $body .= '; '.$this->_createParameter($name, $value);\n            }\n        }\n\n        return $body;\n    }\n\n    /**\n     * Generate a list of all tokens in the final header.\n     *\n     * This doesn't need to be overridden in theory, but it is for implementation\n     * reasons to prevent potential breakage of attributes.\n     *\n     * @param string $string The string to tokenize\n     *\n     * @return array An array of tokens as strings\n     */\n    protected function toTokens($string = null) {\n        $tokens = parent::toTokens(parent::getFieldBody());\n\n        // Try creating any parameters\n        foreach ($this->_params as $name => $value) {\n            if (!is_null($value)) {\n                // Add the semi-colon separator\n                $tokens[count($tokens) - 1] .= ';';\n                $tokens = array_merge($tokens, $this->generateTokenLines(\n                    ' '.$this->_createParameter($name, $value)\n                    ));\n            }\n        }\n\n        return $tokens;\n    }\n\n    /**\n     * Render a RFC 2047 compliant header parameter from the $name and $value.\n     *\n     * @param string $name\n     * @param string $value\n     *\n     * @return string\n     */\n    private function _createParameter($name, $value) {\n        $origValue = $value;\n\n        $encoded = false;\n        // Allow room for parameter name, indices, \"=\" and DQUOTEs\n        $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N\"\";') - 1;\n        $firstLineOffset = 0;\n\n        // If it's not already a valid parameter value...\n        if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {\n            // TODO: text, or something else??\n            // ... and it's not ascii\n            if (!preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $value)) {\n                $encoded = true;\n                // Allow space for the indices, charset and language\n                $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*=\"\";') - 1;\n                $firstLineOffset = strlen(\n                    $this->getCharset().\"'\".$this->getLanguage().\"'\"\n                    );\n            }\n        }\n\n        // Encode if we need to\n        if ($encoded || strlen($value) > $maxValueLength) {\n            if (isset($this->_paramEncoder)) {\n                $value = $this->_paramEncoder->encodeString(\n                    $origValue, $firstLineOffset, $maxValueLength, $this->getCharset()\n                    );\n            } else {\n                // We have to go against RFC 2183/2231 in some areas for interoperability\n                $value = $this->getTokenAsEncodedWord($origValue);\n                $encoded = false;\n            }\n        }\n\n        $valueLines = isset($this->_paramEncoder) ? explode(\"\\r\\n\", $value) : array($value);\n\n        // Need to add indices\n        if (count($valueLines) > 1) {\n            $paramLines = array();\n            foreach ($valueLines as $i => $line) {\n                $paramLines[] = $name.'*'.$i.\n                    $this->_getEndOfParameterValue($line, true, $i == 0);\n            }\n\n            return implode(\";\\r\\n \", $paramLines);\n        } else {\n            return $name.$this->_getEndOfParameterValue(\n                $valueLines[0], $encoded, true\n                );\n        }\n    }\n\n    /**\n     * Returns the parameter value from the \"=\" and beyond.\n     *\n     * @param string $value     to append\n     * @param bool   $encoded\n     * @param bool   $firstLine\n     *\n     * @return string\n     */\n    private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) {\n        if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {\n            $value = '\"'.$value.'\"';\n        }\n        $prepend = '=';\n        if ($encoded) {\n            $prepend = '*=';\n            if ($firstLine) {\n                $prepend = '*='.$this->getCharset().\"'\".$this->getLanguage().\n                    \"'\";\n            }\n        }\n\n        return $prepend.$value;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A Path Header in Swift Mailer, such a Return-Path.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader{\n    /**\n     * The address in this Header (if specified).\n     *\n     * @var string\n     */\n    private $_address;\n\n    /**\n     * Creates a new PathHeader with the given $name.\n     *\n     * @param string             $name\n     * @param Swift_Mime_Grammar $grammar\n     */\n    public function __construct($name, Swift_Mime_Grammar $grammar) {\n        $this->setFieldName($name);\n        parent::__construct($grammar);\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_PATH;\n    }\n\n    /**\n     * Set the model for the field body.\n     * This method takes a string for an address.\n     *\n     * @param string $model\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setFieldBodyModel($model) {\n        $this->setAddress($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     * This method returns a string email address.\n     *\n     * @return mixed\n     */\n    public function getFieldBodyModel() {\n        return $this->getAddress();\n    }\n\n    /**\n     * Set the Address which should appear in this Header.\n     *\n     * @param string $address\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    public function setAddress($address) {\n        if (is_null($address)) {\n            $this->_address = null;\n        } elseif ('' == $address) {\n            $this->_address = '';\n        } else {\n            $this->_assertValidAddress($address);\n            $this->_address = $address;\n        }\n        $this->setCachedValue(null);\n    }\n\n    /**\n     * Get the address which is used in this Header (if any).\n     *\n     * Null is returned if no address is set.\n     *\n     * @return string\n     */\n    public function getAddress() {\n        return $this->_address;\n    }\n\n    /**\n     * Get the string value of the body in this Header.\n     *\n     * This is not necessarily RFC 2822 compliant since folding white space will\n     * not be added at this stage (see {@link toString()} for that).\n     *\n     * @see toString()\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        if (!$this->getCachedValue()) {\n            if (isset($this->_address)) {\n                $this->setCachedValue('<'.$this->_address.'>');\n            }\n        }\n\n        return $this->getCachedValue();\n    }\n\n    /**\n     * Throws an Exception if the address passed does not comply with RFC 2822.\n     *\n     * @param string $address\n     *\n     * @throws Swift_RfcComplianceException If address is invalid\n     */\n    private function _assertValidAddress($address) {\n        if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',\n            $address)) {\n            throw new Swift_RfcComplianceException(\n                'Address set in PathHeader does not comply with addr-spec of RFC 2822.'\n                );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A Simple MIME Header.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractHeader{\n    /**\n     * The value of this Header.\n     *\n     * @var string\n     */\n    private $_value;\n\n    /**\n     * Creates a new SimpleHeader with $name.\n     *\n     * @param string                   $name\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param Swift_Mime_Grammar       $grammar\n     */\n    public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) {\n        $this->setFieldName($name);\n        $this->setEncoder($encoder);\n        parent::__construct($grammar);\n    }\n\n    /**\n     * Get the type of Header that this instance represents.\n     *\n     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX\n     * @see TYPE_DATE, TYPE_ID, TYPE_PATH\n     *\n     * @return int\n     */\n    public function getFieldType() {\n        return self::TYPE_TEXT;\n    }\n\n    /**\n     * Set the model for the field body.\n     *\n     * This method takes a string for the field value.\n     *\n     * @param string $model\n     */\n    public function setFieldBodyModel($model) {\n        $this->setValue($model);\n    }\n\n    /**\n     * Get the model for the field body.\n     *\n     * This method returns a string.\n     *\n     * @return string\n     */\n    public function getFieldBodyModel() {\n        return $this->getValue();\n    }\n\n    /**\n     * Get the (unencoded) value of this header.\n     *\n     * @return string\n     */\n    public function getValue() {\n        return $this->_value;\n    }\n\n    /**\n     * Set the (unencoded) value of this header.\n     *\n     * @param string $value\n     */\n    public function setValue($value) {\n        $this->clearCachedValueIf($this->_value != $value);\n        $this->_value = $value;\n    }\n\n    /**\n     * Get the value of this header prepared for rendering.\n     *\n     * @return string\n     */\n    public function getFieldBody() {\n        if (!$this->getCachedValue()) {\n            $this->setCachedValue(\n                $this->encodeWords($this, $this->_value)\n                );\n        }\n\n        return $this->getCachedValue();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/Message.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A Message (RFC 2822) object.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_Message extends Swift_Mime_MimeEntity{\n    /**\n     * Generates a valid Message-ID and switches to it.\n     *\n     * @return string\n     */\n    public function generateId();\n\n    /**\n     * Set the subject of the message.\n     *\n     * @param string $subject\n     */\n    public function setSubject($subject);\n\n    /**\n     * Get the subject of the message.\n     *\n     * @return string\n     */\n    public function getSubject();\n\n    /**\n     * Set the origination date of the message as a UNIX timestamp.\n     *\n     * @param int $date\n     */\n    public function setDate($date);\n\n    /**\n     * Get the origination date of the message as a UNIX timestamp.\n     *\n     * @return int\n     */\n    public function getDate();\n\n    /**\n     * Set the return-path (bounce-detect) address.\n     *\n     * @param string $address\n     */\n    public function setReturnPath($address);\n\n    /**\n     * Get the return-path (bounce-detect) address.\n     *\n     * @return string\n     */\n    public function getReturnPath();\n\n    /**\n     * Set the sender of this message.\n     *\n     * If multiple addresses are present in the From field, this SHOULD be set.\n     *\n     * According to RFC 2822 it is a requirement when there are multiple From\n     * addresses, but Swift itself does not require it directly.\n     *\n     * An associative array (with one element!) can be used to provide a display-\n     * name: i.e. array('email@address' => 'Real Name').\n     *\n     * If the second parameter is provided and the first is a string, then $name\n     * is associated with the address.\n     *\n     * @param mixed  $address\n     * @param string $name    optional\n     */\n    public function setSender($address, $name = null);\n\n    /**\n     * Get the sender address for this message.\n     *\n     * This has a higher significance than the From address.\n     *\n     * @return string\n     */\n    public function getSender();\n\n    /**\n     * Set the From address of this message.\n     *\n     * It is permissible for multiple From addresses to be set using an array.\n     *\n     * If multiple From addresses are used, you SHOULD set the Sender address and\n     * according to RFC 2822, MUST set the sender address.\n     *\n     * An array can be used if display names are to be provided: i.e.\n     * array('email@address.com' => 'Real Name').\n     *\n     * If the second parameter is provided and the first is a string, then $name\n     * is associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     */\n    public function setFrom($addresses, $name = null);\n\n    /**\n     * Get the From address(es) of this message.\n     *\n     * This method always returns an associative array where the keys are the\n     * addresses.\n     *\n     * @return string[]\n     */\n    public function getFrom();\n\n    /**\n     * Set the Reply-To address(es).\n     *\n     * Any replies from the receiver will be sent to this address.\n     *\n     * It is permissible for multiple reply-to addresses to be set using an array.\n     *\n     * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.\n     *\n     * If the second parameter is provided and the first is a string, then $name\n     * is associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     */\n    public function setReplyTo($addresses, $name = null);\n\n    /**\n     * Get the Reply-To addresses for this message.\n     *\n     * This method always returns an associative array where the keys provide the\n     * email addresses.\n     *\n     * @return string[]\n     */\n    public function getReplyTo();\n\n    /**\n     * Set the To address(es).\n     *\n     * Recipients set in this field will receive a copy of this message.\n     *\n     * This method has the same synopsis as {@link setFrom()} and {@link setCc()}.\n     *\n     * If the second parameter is provided and the first is a string, then $name\n     * is associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     */\n    public function setTo($addresses, $name = null);\n\n    /**\n     * Get the To addresses for this message.\n     *\n     * This method always returns an associative array, whereby the keys provide\n     * the actual email addresses.\n     *\n     * @return string[]\n     */\n    public function getTo();\n\n    /**\n     * Set the Cc address(es).\n     *\n     * Recipients set in this field will receive a 'carbon-copy' of this message.\n     *\n     * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     */\n    public function setCc($addresses, $name = null);\n\n    /**\n     * Get the Cc addresses for this message.\n     *\n     * This method always returns an associative array, whereby the keys provide\n     * the actual email addresses.\n     *\n     * @return string[]\n     */\n    public function getCc();\n\n    /**\n     * Set the Bcc address(es).\n     *\n     * Recipients set in this field will receive a 'blind-carbon-copy' of this\n     * message.\n     *\n     * In other words, they will get the message, but any other recipients of the\n     * message will have no such knowledge of their receipt of it.\n     *\n     * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     */\n    public function setBcc($addresses, $name = null);\n\n    /**\n     * Get the Bcc addresses for this message.\n     *\n     * This method always returns an associative array, whereby the keys provide\n     * the actual email addresses.\n     *\n     * @return string[]\n     */\n    public function getBcc();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME entity, such as an attachment.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_MimeEntity extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver{\n    /** Main message document; there can only be one of these */\n    const LEVEL_TOP = 16;\n\n    /** An entity which nests with the same precedence as an attachment */\n    const LEVEL_MIXED = 256;\n\n    /** An entity which nests with the same precedence as a mime part */\n    const LEVEL_ALTERNATIVE = 4096;\n\n    /** An entity which nests with the same precedence as embedded content */\n    const LEVEL_RELATED = 65536;\n\n    /**\n     * Get the level at which this entity shall be nested in final document.\n     *\n     * The lower the value, the more outermost the entity will be nested.\n     *\n     * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE\n     *\n     * @return int\n     */\n    public function getNestingLevel();\n\n    /**\n     * Get the qualified content-type of this mime entity.\n     *\n     * @return string\n     */\n    public function getContentType();\n\n    /**\n     * Returns a unique ID for this entity.\n     *\n     * For most entities this will likely be the Content-ID, though it has\n     * no explicit semantic meaning and can be considered an identifier for\n     * programming logic purposes.\n     *\n     * If a Content-ID header is present, this value SHOULD match the value of\n     * the header.\n     *\n     * @return string\n     */\n    public function getId();\n\n    /**\n     * Get all children nested inside this entity.\n     *\n     * These are not just the immediate children, but all children.\n     *\n     * @return Swift_Mime_MimeEntity[]\n     */\n    public function getChildren();\n\n    /**\n     * Set all children nested inside this entity.\n     *\n     * This includes grandchildren.\n     *\n     * @param Swift_Mime_MimeEntity[] $children\n     */\n    public function setChildren(array $children);\n\n    /**\n     * Get the collection of Headers in this Mime entity.\n     *\n     * @return Swift_Mime_HeaderSet\n     */\n    public function getHeaders();\n\n    /**\n     * Get the body content of this entity as a string.\n     *\n     * Returns NULL if no body has been set.\n     *\n     * @return string|null\n     */\n    public function getBody();\n\n    /**\n     * Set the body content of this entity as a string.\n     *\n     * @param string $body\n     * @param string $contentType optional\n     */\n    public function setBody($body, $contentType = null);\n\n    /**\n     * Get this entire entity in its string form.\n     *\n     * @return string\n     */\n    public function toString();\n\n    /**\n     * Get this entire entity as a ByteStream.\n     *\n     * @param Swift_InputByteStream $is to write to\n     */\n    public function toByteStream(Swift_InputByteStream $is);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/MimePart.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME part, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity{\n    /** The format parameter last specified by the user */\n    protected $_userFormat;\n\n    /** The charset last specified by the user */\n    protected $_userCharset;\n\n    /** The delsp parameter last specified by the user */\n    protected $_userDelSp;\n\n    /** The nesting level of this MimePart */\n    private $_nestingLevel = self::LEVEL_ALTERNATIVE;\n\n    /**\n     * Create a new MimePart with $headers, $encoder and $cache.\n     *\n     * @param Swift_Mime_HeaderSet      $headers\n     * @param Swift_Mime_ContentEncoder $encoder\n     * @param Swift_KeyCache            $cache\n     * @param Swift_Mime_Grammar        $grammar\n     * @param string                    $charset\n     */\n    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) {\n        parent::__construct($headers, $encoder, $cache, $grammar);\n        $this->setContentType('text/plain');\n        if (!is_null($charset)) {\n            $this->setCharset($charset);\n        }\n    }\n\n    /**\n     * Set the body of this entity, either as a string, or as an instance of\n     * {@link Swift_OutputByteStream}.\n     *\n     * @param mixed  $body\n     * @param string $contentType optional\n     * @param string $charset     optional\n     *\n     * @return Swift_Mime_MimePart\n     */\n    public function setBody($body, $contentType = null, $charset = null) {\n        if (isset($charset)) {\n            $this->setCharset($charset);\n        }\n        $body = $this->_convertString($body);\n\n        parent::setBody($body, $contentType);\n\n        return $this;\n    }\n\n    /**\n     * Get the character set of this entity.\n     *\n     * @return string\n     */\n    public function getCharset() {\n        return $this->_getHeaderParameter('Content-Type', 'charset');\n    }\n\n    /**\n     * Set the character set of this entity.\n     *\n     * @param string $charset\n     *\n     * @return Swift_Mime_MimePart\n     */\n    public function setCharset($charset) {\n        $this->_setHeaderParameter('Content-Type', 'charset', $charset);\n        if ($charset !== $this->_userCharset) {\n            $this->_clearCache();\n        }\n        $this->_userCharset = $charset;\n        parent::charsetChanged($charset);\n\n        return $this;\n    }\n\n    /**\n     * Get the format of this entity (i.e. flowed or fixed).\n     *\n     * @return string\n     */\n    public function getFormat() {\n        return $this->_getHeaderParameter('Content-Type', 'format');\n    }\n\n    /**\n     * Set the format of this entity (flowed or fixed).\n     *\n     * @param string $format\n     *\n     * @return Swift_Mime_MimePart\n     */\n    public function setFormat($format) {\n        $this->_setHeaderParameter('Content-Type', 'format', $format);\n        $this->_userFormat = $format;\n\n        return $this;\n    }\n\n    /**\n     * Test if delsp is being used for this entity.\n     *\n     * @return bool\n     */\n    public function getDelSp() {\n        return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false;\n    }\n\n    /**\n     * Turn delsp on or off for this entity.\n     *\n     * @param bool $delsp\n     *\n     * @return Swift_Mime_MimePart\n     */\n    public function setDelSp($delsp = true) {\n        $this->_setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);\n        $this->_userDelSp = $delsp;\n\n        return $this;\n    }\n\n    /**\n     * Get the nesting level of this entity.\n     *\n     * @see LEVEL_TOP, LEVEL_ALTERNATIVE, LEVEL_MIXED, LEVEL_RELATED\n     *\n     * @return int\n     */\n    public function getNestingLevel() {\n        return $this->_nestingLevel;\n    }\n\n    /**\n     * Receive notification that the charset has changed on this document, or a\n     * parent document.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->setCharset($charset);\n    }\n\n    /** Fix the content-type and encoding of this entity */\n    protected function _fixHeaders() {\n        parent::_fixHeaders();\n        if (count($this->getChildren())) {\n            $this->_setHeaderParameter('Content-Type', 'charset', null);\n            $this->_setHeaderParameter('Content-Type', 'format', null);\n            $this->_setHeaderParameter('Content-Type', 'delsp', null);\n        } else {\n            $this->setCharset($this->_userCharset);\n            $this->setFormat($this->_userFormat);\n            $this->setDelSp($this->_userDelSp);\n        }\n    }\n\n    /** Set the nesting level of this entity */\n    protected function _setNestingLevel($level) {\n        $this->_nestingLevel = $level;\n    }\n\n    /** Encode charset when charset is not utf-8 */\n    protected function _convertString($string) {\n        $charset = strtolower($this->getCharset());\n        if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) {\n            // mb_convert_encoding must be the first one to check, since iconv cannot convert some words.\n            if (function_exists('mb_convert_encoding')) {\n                $string = mb_convert_encoding($string, $charset, 'utf-8');\n            } elseif (function_exists('iconv')) {\n                $string = iconv('utf-8//TRANSLIT//IGNORE', $charset, $string);\n            } else {\n                throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your charset or install the mbstring or iconv extension).');\n            }\n\n            return $string;\n        }\n\n        return $string;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME Header with parameters.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Mime_ParameterizedHeader extends Swift_Mime_Header{\n    /**\n     * Set the value of $parameter.\n     *\n     * @param string $parameter\n     * @param string $value\n     */\n    public function setParameter($parameter, $value);\n\n    /**\n     * Get the value of $parameter.\n     *\n     * @param string $parameter\n     *\n     * @return string\n     */\n    public function getParameter($parameter);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Creates MIME headers.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory{\n    /** The HeaderEncoder used by these headers */\n    private $_encoder;\n\n    /** The Encoder used by parameters */\n    private $_paramEncoder;\n\n    /** The Grammar */\n    private $_grammar;\n\n    /** The charset of created Headers */\n    private $_charset;\n\n    /**\n     * Creates a new SimpleHeaderFactory using $encoder and $paramEncoder.\n     *\n     * @param Swift_Mime_HeaderEncoder $encoder\n     * @param Swift_Encoder            $paramEncoder\n     * @param Swift_Mime_Grammar       $grammar\n     * @param string|null              $charset\n     */\n    public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, Swift_Mime_Grammar $grammar, $charset = null) {\n        $this->_encoder = $encoder;\n        $this->_paramEncoder = $paramEncoder;\n        $this->_grammar = $grammar;\n        $this->_charset = $charset;\n    }\n\n    /**\n     * Create a new Mailbox Header with a list of $addresses.\n     *\n     * @param string            $name\n     * @param array|string|null $addresses\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createMailboxHeader($name, $addresses = null) {\n        $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar);\n        if (isset($addresses)) {\n            $header->setFieldBodyModel($addresses);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Create a new Date header using $timestamp (UNIX time).\n     *\n     * @param string   $name\n     * @param int|null $timestamp\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createDateHeader($name, $timestamp = null) {\n        $header = new Swift_Mime_Headers_DateHeader($name, $this->_grammar);\n        if (isset($timestamp)) {\n            $header->setFieldBodyModel($timestamp);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Create a new basic text header with $name and $value.\n     *\n     * @param string $name\n     * @param string $value\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createTextHeader($name, $value = null) {\n        $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder, $this->_grammar);\n        if (isset($value)) {\n            $header->setFieldBodyModel($value);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Create a new ParameterizedHeader with $name, $value and $params.\n     *\n     * @param string $name\n     * @param string $value\n     * @param array  $params\n     *\n     * @return Swift_Mime_ParameterizedHeader\n     */\n    public function createParameterizedHeader($name, $value = null,\n        $params = array()) {\n        $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar);\n        if (isset($value)) {\n            $header->setFieldBodyModel($value);\n        }\n        foreach ($params as $k => $v) {\n            $header->setParameter($k, $v);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Create a new ID header for Message-ID or Content-ID.\n     *\n     * @param string       $name\n     * @param string|array $ids\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createIdHeader($name, $ids = null) {\n        $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->_grammar);\n        if (isset($ids)) {\n            $header->setFieldBodyModel($ids);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Create a new Path header with an address (path) in it.\n     *\n     * @param string $name\n     * @param string $path\n     *\n     * @return Swift_Mime_Header\n     */\n    public function createPathHeader($name, $path = null) {\n        $header = new Swift_Mime_Headers_PathHeader($name, $this->_grammar);\n        if (isset($path)) {\n            $header->setFieldBodyModel($path);\n        }\n        $this->_setHeaderCharset($header);\n\n        return $header;\n    }\n\n    /**\n     * Notify this observer that the entity's charset has changed.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->_charset = $charset;\n        $this->_encoder->charsetChanged($charset);\n        $this->_paramEncoder->charsetChanged($charset);\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->_encoder = clone $this->_encoder;\n        $this->_paramEncoder = clone $this->_paramEncoder;\n    }\n\n    /** Apply the charset to the Header */\n    private function _setHeaderCharset(Swift_Mime_Header $header) {\n        if (isset($this->_charset)) {\n            $header->setCharset($this->_charset);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A collection of MIME headers.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet{\n    /** HeaderFactory */\n    private $_factory;\n\n    /** Collection of set Headers */\n    private $_headers = array();\n\n    /** Field ordering details */\n    private $_order = array();\n\n    /** List of fields which are required to be displayed */\n    private $_required = array();\n\n    /** The charset used by Headers */\n    private $_charset;\n\n    /**\n     * Create a new SimpleHeaderSet with the given $factory.\n     *\n     * @param Swift_Mime_HeaderFactory $factory\n     * @param string                   $charset\n     */\n    public function __construct(Swift_Mime_HeaderFactory $factory, $charset = null) {\n        $this->_factory = $factory;\n        if (isset($charset)) {\n            $this->setCharset($charset);\n        }\n    }\n\n    /**\n     * Set the charset used by these headers.\n     *\n     * @param string $charset\n     */\n    public function setCharset($charset) {\n        $this->_charset = $charset;\n        $this->_factory->charsetChanged($charset);\n        $this->_notifyHeadersOfCharset($charset);\n    }\n\n    /**\n     * Add a new Mailbox Header with a list of $addresses.\n     *\n     * @param string       $name\n     * @param array|string $addresses\n     */\n    public function addMailboxHeader($name, $addresses = null) {\n        $this->_storeHeader($name,\n        $this->_factory->createMailboxHeader($name, $addresses));\n    }\n\n    /**\n     * Add a new Date header using $timestamp (UNIX time).\n     *\n     * @param string $name\n     * @param int    $timestamp\n     */\n    public function addDateHeader($name, $timestamp = null) {\n        $this->_storeHeader($name,\n        $this->_factory->createDateHeader($name, $timestamp));\n    }\n\n    /**\n     * Add a new basic text header with $name and $value.\n     *\n     * @param string $name\n     * @param string $value\n     */\n    public function addTextHeader($name, $value = null) {\n        $this->_storeHeader($name,\n        $this->_factory->createTextHeader($name, $value));\n    }\n\n    /**\n     * Add a new ParameterizedHeader with $name, $value and $params.\n     *\n     * @param string $name\n     * @param string $value\n     * @param array  $params\n     */\n    public function addParameterizedHeader($name, $value = null, $params = array()) {\n        $this->_storeHeader($name, $this->_factory->createParameterizedHeader($name, $value, $params));\n    }\n\n    /**\n     * Add a new ID header for Message-ID or Content-ID.\n     *\n     * @param string       $name\n     * @param string|array $ids\n     */\n    public function addIdHeader($name, $ids = null) {\n        $this->_storeHeader($name, $this->_factory->createIdHeader($name, $ids));\n    }\n\n    /**\n     * Add a new Path header with an address (path) in it.\n     *\n     * @param string $name\n     * @param string $path\n     */\n    public function addPathHeader($name, $path = null) {\n        $this->_storeHeader($name, $this->_factory->createPathHeader($name, $path));\n    }\n\n    /**\n     * Returns true if at least one header with the given $name exists.\n     *\n     * If multiple headers match, the actual one may be specified by $index.\n     *\n     * @param string $name\n     * @param int    $index\n     *\n     * @return bool\n     */\n    public function has($name, $index = 0) {\n        $lowerName = strtolower($name);\n\n        return array_key_exists($lowerName, $this->_headers) && array_key_exists($index, $this->_headers[$lowerName]);\n    }\n\n    /**\n     * Set a header in the HeaderSet.\n     *\n     * The header may be a previously fetched header via {@link get()} or it may\n     * be one that has been created separately.\n     *\n     * If $index is specified, the header will be inserted into the set at this\n     * offset.\n     *\n     * @param Swift_Mime_Header $header\n     * @param int               $index\n     */\n    public function set(Swift_Mime_Header $header, $index = 0) {\n        $this->_storeHeader($header->getFieldName(), $header, $index);\n    }\n\n    /**\n     * Get the header with the given $name.\n     *\n     * If multiple headers match, the actual one may be specified by $index.\n     * Returns NULL if none present.\n     *\n     * @param string $name\n     * @param int    $index\n     *\n     * @return Swift_Mime_Header\n     */\n    public function get($name, $index = 0) {\n        if ($this->has($name, $index)) {\n            $lowerName = strtolower($name);\n\n            return $this->_headers[$lowerName][$index];\n        }\n    }\n\n    /**\n     * Get all headers with the given $name.\n     *\n     * @param string $name\n     *\n     * @return array\n     */\n    public function getAll($name = null) {\n        if (!isset($name)) {\n            $headers = array();\n            foreach ($this->_headers as $collection) {\n                $headers = array_merge($headers, $collection);\n            }\n\n            return $headers;\n        }\n\n        $lowerName = strtolower($name);\n        if (!array_key_exists($lowerName, $this->_headers)) {\n            return array();\n        }\n\n        return $this->_headers[$lowerName];\n    }\n\n    /**\n     * Return the name of all Headers.\n     *\n     * @return array\n     */\n    public function listAll() {\n        $headers = $this->_headers;\n        if ($this->_canSort()) {\n            uksort($headers, array($this, '_sortHeaders'));\n        }\n\n        return array_keys($headers);\n    }\n\n    /**\n     * Remove the header with the given $name if it's set.\n     *\n     * If multiple headers match, the actual one may be specified by $index.\n     *\n     * @param string $name\n     * @param int    $index\n     */\n    public function remove($name, $index = 0) {\n        $lowerName = strtolower($name);\n        unset($this->_headers[$lowerName][$index]);\n    }\n\n    /**\n     * Remove all headers with the given $name.\n     *\n     * @param string $name\n     */\n    public function removeAll($name) {\n        $lowerName = strtolower($name);\n        unset($this->_headers[$lowerName]);\n    }\n\n    /**\n     * Create a new instance of this HeaderSet.\n     *\n     * @return Swift_Mime_HeaderSet\n     */\n    public function newInstance() {\n        return new self($this->_factory);\n    }\n\n    /**\n     * Define a list of Header names as an array in the correct order.\n     *\n     * These Headers will be output in the given order where present.\n     *\n     * @param array $sequence\n     */\n    public function defineOrdering(array $sequence) {\n        $this->_order = array_flip(array_map('strtolower', $sequence));\n    }\n\n    /**\n     * Set a list of header names which must always be displayed when set.\n     *\n     * Usually headers without a field value won't be output unless set here.\n     *\n     * @param array $names\n     */\n    public function setAlwaysDisplayed(array $names) {\n        $this->_required = array_flip(array_map('strtolower', $names));\n    }\n\n    /**\n     * Notify this observer that the entity's charset has changed.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->setCharset($charset);\n    }\n\n    /**\n     * Returns a string with a representation of all headers.\n     *\n     * @return string\n     */\n    public function toString() {\n        $string = '';\n        $headers = $this->_headers;\n        if ($this->_canSort()) {\n            uksort($headers, array($this, '_sortHeaders'));\n        }\n        foreach ($headers as $collection) {\n            foreach ($collection as $header) {\n                if ($this->_isDisplayed($header) || $header->getFieldBody() != '') {\n                    $string .= $header->toString();\n                }\n            }\n        }\n\n        return $string;\n    }\n\n    /**\n     * Returns a string representation of this object.\n     *\n     * @return string\n     *\n     * @see toString()\n     */\n    public function __toString() {\n        return $this->toString();\n    }\n\n    /** Save a Header to the internal collection */\n    private function _storeHeader($name, Swift_Mime_Header $header, $offset = null) {\n        if (!isset($this->_headers[strtolower($name)])) {\n            $this->_headers[strtolower($name)] = array();\n        }\n        if (!isset($offset)) {\n            $this->_headers[strtolower($name)][] = $header;\n        } else {\n            $this->_headers[strtolower($name)][$offset] = $header;\n        }\n    }\n\n    /** Test if the headers can be sorted */\n    private function _canSort() {\n        return count($this->_order) > 0;\n    }\n\n    /** uksort() algorithm for Header ordering */\n    private function _sortHeaders($a, $b) {\n        $lowerA = strtolower($a);\n        $lowerB = strtolower($b);\n        $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1;\n        $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1;\n\n        if (-1 === $aPos && -1 === $bPos) {\n            // just be sure to be determinist here\n            return $a > $b ? -1 : 1;\n        }\n\n        if ($aPos == -1) {\n            return 1;\n        } elseif ($bPos == -1) {\n            return -1;\n        }\n\n        return $aPos < $bPos ? -1 : 1;\n    }\n\n    /** Test if the given Header is always displayed */\n    private function _isDisplayed(Swift_Mime_Header $header) {\n        return array_key_exists(strtolower($header->getFieldName()), $this->_required);\n    }\n\n    /** Notify all Headers of the new charset */\n    private function _notifyHeadersOfCharset($charset) {\n        foreach ($this->_headers as $headerGroup) {\n            foreach ($headerGroup as $header) {\n                $header->setCharset($charset);\n            }\n        }\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->_factory = clone $this->_factory;\n        foreach ($this->_headers as $groupKey => $headerGroup) {\n            foreach ($headerGroup as $key => $header) {\n                $this->_headers[$groupKey][$key] = clone $header;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * The default email message class.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message{\n    /**\n     * Create a new SimpleMessage with $headers, $encoder and $cache.\n     *\n     * @param Swift_Mime_HeaderSet      $headers\n     * @param Swift_Mime_ContentEncoder $encoder\n     * @param Swift_KeyCache            $cache\n     * @param Swift_Mime_Grammar        $grammar\n     * @param string                    $charset\n     */\n    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) {\n        parent::__construct($headers, $encoder, $cache, $grammar, $charset);\n        $this->getHeaders()->defineOrdering(array(\n            'Return-Path',\n            'Received',\n            'DKIM-Signature',\n            'DomainKey-Signature',\n            'Sender',\n            'Message-ID',\n            'Date',\n            'Subject',\n            'From',\n            'Reply-To',\n            'To',\n            'Cc',\n            'Bcc',\n            'MIME-Version',\n            'Content-Type',\n            'Content-Transfer-Encoding',\n            ));\n        $this->getHeaders()->setAlwaysDisplayed(array('Date', 'Message-ID', 'From'));\n        $this->getHeaders()->addTextHeader('MIME-Version', '1.0');\n        $this->setDate(time());\n        $this->setId($this->getId());\n        $this->getHeaders()->addMailboxHeader('From');\n    }\n\n    /**\n     * Always returns {@link LEVEL_TOP} for a message instance.\n     *\n     * @return int\n     */\n    public function getNestingLevel() {\n        return self::LEVEL_TOP;\n    }\n\n    /**\n     * Set the subject of this message.\n     *\n     * @param string $subject\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setSubject($subject) {\n        if (!$this->_setHeaderFieldModel('Subject', $subject)) {\n            $this->getHeaders()->addTextHeader('Subject', $subject);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the subject of this message.\n     *\n     * @return string\n     */\n    public function getSubject() {\n        return $this->_getHeaderFieldModel('Subject');\n    }\n\n    /**\n     * Set the date at which this message was created.\n     *\n     * @param int $date\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setDate($date) {\n        if (!$this->_setHeaderFieldModel('Date', $date)) {\n            $this->getHeaders()->addDateHeader('Date', $date);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the date at which this message was created.\n     *\n     * @return int\n     */\n    public function getDate() {\n        return $this->_getHeaderFieldModel('Date');\n    }\n\n    /**\n     * Set the return-path (the bounce address) of this message.\n     *\n     * @param string $address\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setReturnPath($address) {\n        if (!$this->_setHeaderFieldModel('Return-Path', $address)) {\n            $this->getHeaders()->addPathHeader('Return-Path', $address);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the return-path (bounce address) of this message.\n     *\n     * @return string\n     */\n    public function getReturnPath() {\n        return $this->_getHeaderFieldModel('Return-Path');\n    }\n\n    /**\n     * Set the sender of this message.\n     *\n     * This does not override the From field, but it has a higher significance.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setSender($address, $name = null) {\n        if (!is_array($address) && isset($name)) {\n            $address = array($address => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('Sender', (array) $address)) {\n            $this->getHeaders()->addMailboxHeader('Sender', (array) $address);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the sender of this message.\n     *\n     * @return string\n     */\n    public function getSender() {\n        return $this->_getHeaderFieldModel('Sender');\n    }\n\n    /**\n     * Add a From: address to this message.\n     *\n     * If $name is passed this name will be associated with the address.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addFrom($address, $name = null) {\n        $current = $this->getFrom();\n        $current[$address] = $name;\n\n        return $this->setFrom($current);\n    }\n\n    /**\n     * Set the from address of this message.\n     *\n     * You may pass an array of addresses if this message is from multiple people.\n     *\n     * If $name is passed and the first parameter is a string, this name will be\n     * associated with the address.\n     *\n     * @param string|array $addresses\n     * @param string       $name      optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setFrom($addresses, $name = null) {\n        if (!is_array($addresses) && isset($name)) {\n            $addresses = array($addresses => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('From', (array) $addresses)) {\n            $this->getHeaders()->addMailboxHeader('From', (array) $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the from address of this message.\n     *\n     * @return mixed\n     */\n    public function getFrom() {\n        return $this->_getHeaderFieldModel('From');\n    }\n\n    /**\n     * Add a Reply-To: address to this message.\n     *\n     * If $name is passed this name will be associated with the address.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addReplyTo($address, $name = null) {\n        $current = $this->getReplyTo();\n        $current[$address] = $name;\n\n        return $this->setReplyTo($current);\n    }\n\n    /**\n     * Set the reply-to address of this message.\n     *\n     * You may pass an array of addresses if replies will go to multiple people.\n     *\n     * If $name is passed and the first parameter is a string, this name will be\n     * associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setReplyTo($addresses, $name = null) {\n        if (!is_array($addresses) && isset($name)) {\n            $addresses = array($addresses => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('Reply-To', (array) $addresses)) {\n            $this->getHeaders()->addMailboxHeader('Reply-To', (array) $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the reply-to address of this message.\n     *\n     * @return string\n     */\n    public function getReplyTo() {\n        return $this->_getHeaderFieldModel('Reply-To');\n    }\n\n    /**\n     * Add a To: address to this message.\n     *\n     * If $name is passed this name will be associated with the address.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addTo($address, $name = null) {\n        $current = $this->getTo();\n        $current[$address] = $name;\n\n        return $this->setTo($current);\n    }\n\n    /**\n     * Set the to addresses of this message.\n     *\n     * If multiple recipients will receive the message an array should be used.\n     * Example: array('receiver@domain.org', 'other@domain.org' => 'A name')\n     *\n     * If $name is passed and the first parameter is a string, this name will be\n     * associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setTo($addresses, $name = null) {\n        if (!is_array($addresses) && isset($name)) {\n            $addresses = array($addresses => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('To', (array) $addresses)) {\n            $this->getHeaders()->addMailboxHeader('To', (array) $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the To addresses of this message.\n     *\n     * @return array\n     */\n    public function getTo() {\n        return $this->_getHeaderFieldModel('To');\n    }\n\n    /**\n     * Add a Cc: address to this message.\n     *\n     * If $name is passed this name will be associated with the address.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addCc($address, $name = null) {\n        $current = $this->getCc();\n        $current[$address] = $name;\n\n        return $this->setCc($current);\n    }\n\n    /**\n     * Set the Cc addresses of this message.\n     *\n     * If $name is passed and the first parameter is a string, this name will be\n     * associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setCc($addresses, $name = null) {\n        if (!is_array($addresses) && isset($name)) {\n            $addresses = array($addresses => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('Cc', (array) $addresses)) {\n            $this->getHeaders()->addMailboxHeader('Cc', (array) $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the Cc address of this message.\n     *\n     * @return array\n     */\n    public function getCc() {\n        return $this->_getHeaderFieldModel('Cc');\n    }\n\n    /**\n     * Add a Bcc: address to this message.\n     *\n     * If $name is passed this name will be associated with the address.\n     *\n     * @param string $address\n     * @param string $name    optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function addBcc($address, $name = null) {\n        $current = $this->getBcc();\n        $current[$address] = $name;\n\n        return $this->setBcc($current);\n    }\n\n    /**\n     * Set the Bcc addresses of this message.\n     *\n     * If $name is passed and the first parameter is a string, this name will be\n     * associated with the address.\n     *\n     * @param mixed  $addresses\n     * @param string $name      optional\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setBcc($addresses, $name = null) {\n        if (!is_array($addresses) && isset($name)) {\n            $addresses = array($addresses => $name);\n        }\n\n        if (!$this->_setHeaderFieldModel('Bcc', (array) $addresses)) {\n            $this->getHeaders()->addMailboxHeader('Bcc', (array) $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the Bcc addresses of this message.\n     *\n     * @return array\n     */\n    public function getBcc() {\n        return $this->_getHeaderFieldModel('Bcc');\n    }\n\n    /**\n     * Set the priority of this message.\n     *\n     * The value is an integer where 1 is the highest priority and 5 is the lowest.\n     *\n     * @param int $priority\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setPriority($priority) {\n        $priorityMap = array(\n            1 => 'Highest',\n            2 => 'High',\n            3 => 'Normal',\n            4 => 'Low',\n            5 => 'Lowest',\n            );\n        $pMapKeys = array_keys($priorityMap);\n        if ($priority > max($pMapKeys)) {\n            $priority = max($pMapKeys);\n        } elseif ($priority < min($pMapKeys)) {\n            $priority = min($pMapKeys);\n        }\n        if (!$this->_setHeaderFieldModel('X-Priority',\n            sprintf('%d (%s)', $priority, $priorityMap[$priority]))) {\n            $this->getHeaders()->addTextHeader('X-Priority',\n                sprintf('%d (%s)', $priority, $priorityMap[$priority]));\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the priority of this message.\n     *\n     * The returned value is an integer where 1 is the highest priority and 5\n     * is the lowest.\n     *\n     * @return int\n     */\n    public function getPriority() {\n        list($priority) = sscanf($this->_getHeaderFieldModel('X-Priority'),\n            '%[1-5]'\n            );\n\n        return isset($priority) ? $priority : 3;\n    }\n\n    /**\n     * Ask for a delivery receipt from the recipient to be sent to $addresses.\n     *\n     * @param array $addresses\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function setReadReceiptTo($addresses) {\n        if (!$this->_setHeaderFieldModel('Disposition-Notification-To', $addresses)) {\n            $this->getHeaders()\n                ->addMailboxHeader('Disposition-Notification-To', $addresses);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the addresses to which a read-receipt will be sent.\n     *\n     * @return string\n     */\n    public function getReadReceiptTo() {\n        return $this->_getHeaderFieldModel('Disposition-Notification-To');\n    }\n\n    /**\n     * Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart.\n     *\n     * @param Swift_Mime_MimeEntity $entity\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function attach(Swift_Mime_MimeEntity $entity) {\n        $this->setChildren(array_merge($this->getChildren(), array($entity)));\n\n        return $this;\n    }\n\n    /**\n     * Remove an already attached entity.\n     *\n     * @param Swift_Mime_MimeEntity $entity\n     *\n     * @return Swift_Mime_SimpleMessage\n     */\n    public function detach(Swift_Mime_MimeEntity $entity) {\n        $newChildren = array();\n        foreach ($this->getChildren() as $child) {\n            if ($entity !== $child) {\n                $newChildren[] = $child;\n            }\n        }\n        $this->setChildren($newChildren);\n\n        return $this;\n    }\n\n    /**\n     * Attach a {@link Swift_Mime_MimeEntity} and return it's CID source.\n     * This method should be used when embedding images or other data in a message.\n     *\n     * @param Swift_Mime_MimeEntity $entity\n     *\n     * @return string\n     */\n    public function embed(Swift_Mime_MimeEntity $entity) {\n        $this->attach($entity);\n\n        return 'cid:'.$entity->getId();\n    }\n\n    /**\n     * Get this message as a complete string.\n     *\n     * @return string\n     */\n    public function toString() {\n        if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {\n            $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));\n            $string = parent::toString();\n            $this->setChildren($children);\n        } else {\n            $string = parent::toString();\n        }\n\n        return $string;\n    }\n\n    /**\n     * Returns a string representation of this object.\n     *\n     * @see toString()\n     *\n     * @return string\n     */\n    public function __toString() {\n        return $this->toString();\n    }\n\n    /**\n     * Write this message to a {@link Swift_InputByteStream}.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function toByteStream(Swift_InputByteStream $is) {\n        if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {\n            $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));\n            parent::toByteStream($is);\n            $this->setChildren($children);\n        } else {\n            parent::toByteStream($is);\n        }\n    }\n\n    /** @see Swift_Mime_SimpleMimeEntity::_getIdField() */\n    protected function _getIdField() {\n        return 'Message-ID';\n    }\n\n    /** Turn the body of this message into a child of itself if needed */\n    protected function _becomeMimePart() {\n        $part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(),\n            $this->_getCache(), $this->_getGrammar(), $this->_userCharset\n            );\n        $part->setContentType($this->_userContentType);\n        $part->setBody($this->getBody());\n        $part->setFormat($this->_userFormat);\n        $part->setDelSp($this->_userDelSp);\n        $part->_setNestingLevel($this->_getTopNestingLevel());\n\n        return $part;\n    }\n\n    /** Get the highest nesting level nested inside this message */\n    private function _getTopNestingLevel() {\n        $highestLevel = $this->getNestingLevel();\n        foreach ($this->getChildren() as $child) {\n            $childLevel = $child->getNestingLevel();\n            if ($highestLevel < $childLevel) {\n                $highestLevel = $childLevel;\n            }\n        }\n\n        return $highestLevel;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME entity, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity{\n    /** A collection of Headers for this mime entity */\n    private $_headers;\n\n    /** The body as a string, or a stream */\n    private $_body;\n\n    /** The encoder that encodes the body into a streamable format */\n    private $_encoder;\n\n    /** The grammar to use for id validation */\n    private $_grammar;\n\n    /** A mime boundary, if any is used */\n    private $_boundary;\n\n    /** Mime types to be used based on the nesting level */\n    private $_compositeRanges = array(\n        'multipart/mixed' => array(self::LEVEL_TOP, self::LEVEL_MIXED),\n        'multipart/alternative' => array(self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE),\n        'multipart/related' => array(self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED),\n    );\n\n    /** A set of filter rules to define what level an entity should be nested at */\n    private $_compoundLevelFilters = array();\n\n    /** The nesting level of this entity */\n    private $_nestingLevel = self::LEVEL_ALTERNATIVE;\n\n    /** A KeyCache instance used during encoding and streaming */\n    private $_cache;\n\n    /** Direct descendants of this entity */\n    private $_immediateChildren = array();\n\n    /** All descendants of this entity */\n    private $_children = array();\n\n    /** The maximum line length of the body of this entity */\n    private $_maxLineLength = 78;\n\n    /** The order in which alternative mime types should appear */\n    private $_alternativePartOrder = array(\n        'text/plain' => 1,\n        'text/html' => 2,\n        'multipart/related' => 3,\n    );\n\n    /** The CID of this entity */\n    private $_id;\n\n    /** The key used for accessing the cache */\n    private $_cacheKey;\n\n    protected $_userContentType;\n\n    /**\n     * Create a new SimpleMimeEntity with $headers, $encoder and $cache.\n     *\n     * @param Swift_Mime_HeaderSet      $headers\n     * @param Swift_Mime_ContentEncoder $encoder\n     * @param Swift_KeyCache            $cache\n     * @param Swift_Mime_Grammar        $grammar\n     */\n    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar) {\n        $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true));\n        $this->_cache = $cache;\n        $this->_headers = $headers;\n        $this->_grammar = $grammar;\n        $this->setEncoder($encoder);\n        $this->_headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));\n\n        // This array specifies that, when the entire MIME document contains\n        // $compoundLevel, then for each child within $level, if its Content-Type\n        // is $contentType then it should be treated as if it's level is\n        // $neededLevel instead.  I tried to write that unambiguously! :-\\\n        // Data Structure:\n        // array (\n        //   $compoundLevel => array(\n        //     $level => array(\n        //       $contentType => $neededLevel\n        //     )\n        //   )\n        // )\n\n        $this->_compoundLevelFilters = array(\n            (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => array(\n                self::LEVEL_ALTERNATIVE => array(\n                    'text/plain' => self::LEVEL_ALTERNATIVE,\n                    'text/html' => self::LEVEL_RELATED,\n                    ),\n                ),\n            );\n\n        $this->_id = $this->getRandomId();\n    }\n\n    /**\n     * Generate a new Content-ID or Message-ID for this MIME entity.\n     *\n     * @return string\n     */\n    public function generateId() {\n        $this->setId($this->getRandomId());\n\n        return $this->_id;\n    }\n\n    /**\n     * Get the {@link Swift_Mime_HeaderSet} for this entity.\n     *\n     * @return Swift_Mime_HeaderSet\n     */\n    public function getHeaders() {\n        return $this->_headers;\n    }\n\n    /**\n     * Get the nesting level of this entity.\n     *\n     * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE\n     *\n     * @return int\n     */\n    public function getNestingLevel() {\n        return $this->_nestingLevel;\n    }\n\n    /**\n     * Get the Content-type of this entity.\n     *\n     * @return string\n     */\n    public function getContentType() {\n        return $this->_getHeaderFieldModel('Content-Type');\n    }\n\n    /**\n     * Set the Content-type of this entity.\n     *\n     * @param string $type\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setContentType($type) {\n        $this->_setContentTypeInHeaders($type);\n        // Keep track of the value so that if the content-type changes automatically\n        // due to added child entities, it can be restored if they are later removed\n        $this->_userContentType = $type;\n\n        return $this;\n    }\n\n    /**\n     * Get the CID of this entity.\n     *\n     * The CID will only be present in headers if a Content-ID header is present.\n     *\n     * @return string\n     */\n    public function getId() {\n        $tmp = (array) $this->_getHeaderFieldModel($this->_getIdField());\n\n        return $this->_headers->has($this->_getIdField()) ? current($tmp) : $this->_id;\n    }\n\n    /**\n     * Set the CID of this entity.\n     *\n     * @param string $id\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setId($id) {\n        if (!$this->_setHeaderFieldModel($this->_getIdField(), $id)) {\n            $this->_headers->addIdHeader($this->_getIdField(), $id);\n        }\n        $this->_id = $id;\n\n        return $this;\n    }\n\n    /**\n     * Get the description of this entity.\n     *\n     * This value comes from the Content-Description header if set.\n     *\n     * @return string\n     */\n    public function getDescription() {\n        return $this->_getHeaderFieldModel('Content-Description');\n    }\n\n    /**\n     * Set the description of this entity.\n     *\n     * This method sets a value in the Content-ID header.\n     *\n     * @param string $description\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setDescription($description) {\n        if (!$this->_setHeaderFieldModel('Content-Description', $description)) {\n            $this->_headers->addTextHeader('Content-Description', $description);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the maximum line length of the body of this entity.\n     *\n     * @return int\n     */\n    public function getMaxLineLength() {\n        return $this->_maxLineLength;\n    }\n\n    /**\n     * Set the maximum line length of lines in this body.\n     *\n     * Though not enforced by the library, lines should not exceed 1000 chars.\n     *\n     * @param int $length\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setMaxLineLength($length) {\n        $this->_maxLineLength = $length;\n\n        return $this;\n    }\n\n    /**\n     * Get all children added to this entity.\n     *\n     * @return Swift_Mime_MimeEntity[]\n     */\n    public function getChildren() {\n        return $this->_children;\n    }\n\n    /**\n     * Set all children of this entity.\n     *\n     * @param Swift_Mime_MimeEntity[] $children\n     * @param int                     $compoundLevel For internal use only\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setChildren(array $children, $compoundLevel = null) {\n        // TODO: Try to refactor this logic\n\n        $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children);\n        $immediateChildren = array();\n        $grandchildren = array();\n        $newContentType = $this->_userContentType;\n\n        foreach ($children as $child) {\n            $level = $this->_getNeededChildLevel($child, $compoundLevel);\n            if (empty($immediateChildren)) {\n                //first iteration\n                $immediateChildren = array($child);\n            } else {\n                $nextLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel);\n                if ($nextLevel == $level) {\n                    $immediateChildren[] = $child;\n                } elseif ($level < $nextLevel) {\n                    // Re-assign immediateChildren to grandchildren\n                    $grandchildren = array_merge($grandchildren, $immediateChildren);\n                    // Set new children\n                    $immediateChildren = array($child);\n                } else {\n                    $grandchildren[] = $child;\n                }\n            }\n        }\n\n        if ($immediateChildren) {\n            $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel);\n\n            // Determine which composite media type is needed to accommodate the\n            // immediate children\n            foreach ($this->_compositeRanges as $mediaType => $range) {\n                if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) {\n                    $newContentType = $mediaType;\n\n                    break;\n                }\n            }\n\n            // Put any grandchildren in a subpart\n            if (!empty($grandchildren)) {\n                $subentity = $this->_createChild();\n                $subentity->_setNestingLevel($lowestLevel);\n                $subentity->setChildren($grandchildren, $compoundLevel);\n                array_unshift($immediateChildren, $subentity);\n            }\n        }\n\n        $this->_immediateChildren = $immediateChildren;\n        $this->_children = $children;\n        $this->_setContentTypeInHeaders($newContentType);\n        $this->_fixHeaders();\n        $this->_sortChildren();\n\n        return $this;\n    }\n\n    /**\n     * Get the body of this entity as a string.\n     *\n     * @return string\n     */\n    public function getBody() {\n        return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body;\n    }\n\n    /**\n     * Set the body of this entity, either as a string, or as an instance of\n     * {@link Swift_OutputByteStream}.\n     *\n     * @param mixed  $body\n     * @param string $contentType optional\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setBody($body, $contentType = null) {\n        if ($body !== $this->_body) {\n            $this->_clearCache();\n        }\n\n        $this->_body = $body;\n        if (isset($contentType)) {\n            $this->setContentType($contentType);\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the encoder used for the body of this entity.\n     *\n     * @return Swift_Mime_ContentEncoder\n     */\n    public function getEncoder() {\n        return $this->_encoder;\n    }\n\n    /**\n     * Set the encoder used for the body of this entity.\n     *\n     * @param Swift_Mime_ContentEncoder $encoder\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setEncoder(Swift_Mime_ContentEncoder $encoder) {\n        if ($encoder !== $this->_encoder) {\n            $this->_clearCache();\n        }\n\n        $this->_encoder = $encoder;\n        $this->_setEncoding($encoder->getName());\n        $this->_notifyEncoderChanged($encoder);\n\n        return $this;\n    }\n\n    /**\n     * Get the boundary used to separate children in this entity.\n     *\n     * @return string\n     */\n    public function getBoundary() {\n        if (!isset($this->_boundary)) {\n            $this->_boundary = '_=_swift_v4_'.time().'_'.md5(getmypid().mt_rand().uniqid('', true)).'_=_';\n        }\n\n        return $this->_boundary;\n    }\n\n    /**\n     * Set the boundary used to separate children in this entity.\n     *\n     * @param string $boundary\n     *\n     * @throws Swift_RfcComplianceException\n     *\n     * @return Swift_Mime_SimpleMimeEntity\n     */\n    public function setBoundary($boundary) {\n        $this->_assertValidBoundary($boundary);\n        $this->_boundary = $boundary;\n\n        return $this;\n    }\n\n    /**\n     * Receive notification that the charset of this entity, or a parent entity\n     * has changed.\n     *\n     * @param string $charset\n     */\n    public function charsetChanged($charset) {\n        $this->_notifyCharsetChanged($charset);\n    }\n\n    /**\n     * Receive notification that the encoder of this entity or a parent entity\n     * has changed.\n     *\n     * @param Swift_Mime_ContentEncoder $encoder\n     */\n    public function encoderChanged(Swift_Mime_ContentEncoder $encoder) {\n        $this->_notifyEncoderChanged($encoder);\n    }\n\n    /**\n     * Get this entire entity as a string.\n     *\n     * @return string\n     */\n    public function toString() {\n        $string = $this->_headers->toString();\n        $string .= $this->_bodyToString();\n\n        return $string;\n    }\n\n    /**\n     * Get this entire entity as a string.\n     *\n     * @return string\n     */\n    protected function _bodyToString() {\n        $string = '';\n\n        if (isset($this->_body) && empty($this->_immediateChildren)) {\n            if ($this->_cache->hasKey($this->_cacheKey, 'body')) {\n                $body = $this->_cache->getString($this->_cacheKey, 'body');\n            } else {\n                $body = \"\\r\\n\".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength());\n                $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE);\n            }\n            $string .= $body;\n        }\n\n        if (!empty($this->_immediateChildren)) {\n            foreach ($this->_immediateChildren as $child) {\n                $string .= \"\\r\\n\\r\\n--\".$this->getBoundary().\"\\r\\n\";\n                $string .= $child->toString();\n            }\n            $string .= \"\\r\\n\\r\\n--\".$this->getBoundary().\"--\\r\\n\";\n        }\n\n        return $string;\n    }\n\n    /**\n     * Returns a string representation of this object.\n     *\n     * @see toString()\n     *\n     * @return string\n     */\n    public function __toString() {\n        return $this->toString();\n    }\n\n    /**\n     * Write this entire entity to a {@see Swift_InputByteStream}.\n     *\n     * @param Swift_InputByteStream\n     */\n    public function toByteStream(Swift_InputByteStream $is) {\n        $is->write($this->_headers->toString());\n        $is->commit();\n\n        $this->_bodyToByteStream($is);\n    }\n\n    /**\n     * Write this entire entity to a {@link Swift_InputByteStream}.\n     *\n     * @param Swift_InputByteStream\n     */\n    protected function _bodyToByteStream(Swift_InputByteStream $is) {\n        if (empty($this->_immediateChildren)) {\n            if (isset($this->_body)) {\n                if ($this->_cache->hasKey($this->_cacheKey, 'body')) {\n                    $this->_cache->exportToByteStream($this->_cacheKey, 'body', $is);\n                } else {\n                    $cacheIs = $this->_cache->getInputByteStream($this->_cacheKey, 'body');\n                    if ($cacheIs) {\n                        $is->bind($cacheIs);\n                    }\n\n                    $is->write(\"\\r\\n\");\n\n                    if ($this->_body instanceof Swift_OutputByteStream) {\n                        $this->_body->setReadPointer(0);\n\n                        $this->_encoder->encodeByteStream($this->_body, $is, 0, $this->getMaxLineLength());\n                    } else {\n                        $is->write($this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()));\n                    }\n\n                    if ($cacheIs) {\n                        $is->unbind($cacheIs);\n                    }\n                }\n            }\n        }\n\n        if (!empty($this->_immediateChildren)) {\n            foreach ($this->_immediateChildren as $child) {\n                $is->write(\"\\r\\n\\r\\n--\".$this->getBoundary().\"\\r\\n\");\n                $child->toByteStream($is);\n            }\n            $is->write(\"\\r\\n\\r\\n--\".$this->getBoundary().\"--\\r\\n\");\n        }\n    }\n\n    /**\n     * Get the name of the header that provides the ID of this entity.\n     */\n    protected function _getIdField() {\n        return 'Content-ID';\n    }\n\n    /**\n     * Get the model data (usually an array or a string) for $field.\n     */\n    protected function _getHeaderFieldModel($field) {\n        if ($this->_headers->has($field)) {\n            return $this->_headers->get($field)->getFieldBodyModel();\n        }\n    }\n\n    /**\n     * Set the model data for $field.\n     */\n    protected function _setHeaderFieldModel($field, $model) {\n        if ($this->_headers->has($field)) {\n            $this->_headers->get($field)->setFieldBodyModel($model);\n\n            return true;\n        }\n\n        return false;\n    }\n\n    /**\n     * Get the parameter value of $parameter on $field header.\n     */\n    protected function _getHeaderParameter($field, $parameter) {\n        if ($this->_headers->has($field)) {\n            return $this->_headers->get($field)->getParameter($parameter);\n        }\n    }\n\n    /**\n     * Set the parameter value of $parameter on $field header.\n     */\n    protected function _setHeaderParameter($field, $parameter, $value) {\n        if ($this->_headers->has($field)) {\n            $this->_headers->get($field)->setParameter($parameter, $value);\n\n            return true;\n        }\n\n        return false;\n    }\n\n    /**\n     * Re-evaluate what content type and encoding should be used on this entity.\n     */\n    protected function _fixHeaders() {\n        if (count($this->_immediateChildren)) {\n            $this->_setHeaderParameter('Content-Type', 'boundary',\n                $this->getBoundary()\n                );\n            $this->_headers->remove('Content-Transfer-Encoding');\n        } else {\n            $this->_setHeaderParameter('Content-Type', 'boundary', null);\n            $this->_setEncoding($this->_encoder->getName());\n        }\n    }\n\n    /**\n     * Get the KeyCache used in this entity.\n     *\n     * @return Swift_KeyCache\n     */\n    protected function _getCache() {\n        return $this->_cache;\n    }\n\n    /**\n     * Get the grammar used for validation.\n     *\n     * @return Swift_Mime_Grammar\n     */\n    protected function _getGrammar() {\n        return $this->_grammar;\n    }\n\n    /**\n     * Empty the KeyCache for this entity.\n     */\n    protected function _clearCache() {\n        $this->_cache->clearKey($this->_cacheKey, 'body');\n    }\n\n    /**\n     * Returns a random Content-ID or Message-ID.\n     *\n     * @return string\n     */\n    protected function getRandomId() {\n        $idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));\n        $idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated';\n        $id = $idLeft.'@'.$idRight;\n\n        try {\n            $this->_assertValidId($id);\n        } catch (Swift_RfcComplianceException $e) {\n            $id = $idLeft.'@swift.generated';\n        }\n\n        return $id;\n    }\n\n    private function _readStream(Swift_OutputByteStream $os) {\n        $string = '';\n        while (false !== $bytes = $os->read(8192)) {\n            $string .= $bytes;\n        }\n\n        $os->setReadPointer(0);\n\n        return $string;\n    }\n\n    private function _setEncoding($encoding) {\n        if (!$this->_setHeaderFieldModel('Content-Transfer-Encoding', $encoding)) {\n            $this->_headers->addTextHeader('Content-Transfer-Encoding', $encoding);\n        }\n    }\n\n    private function _assertValidBoundary($boundary) {\n        if (!preg_match('/^[a-z0-9\\'\\(\\)\\+_\\-,\\.\\/:=\\?\\ ]{0,69}[a-z0-9\\'\\(\\)\\+_\\-,\\.\\/:=\\?]$/Di', $boundary)) {\n            throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.');\n        }\n    }\n\n    private function _setContentTypeInHeaders($type) {\n        if (!$this->_setHeaderFieldModel('Content-Type', $type)) {\n            $this->_headers->addParameterizedHeader('Content-Type', $type);\n        }\n    }\n\n    private function _setNestingLevel($level) {\n        $this->_nestingLevel = $level;\n    }\n\n    private function _getCompoundLevel($children) {\n        $level = 0;\n        foreach ($children as $child) {\n            $level |= $child->getNestingLevel();\n        }\n\n        return $level;\n    }\n\n    private function _getNeededChildLevel($child, $compoundLevel) {\n        $filter = array();\n        foreach ($this->_compoundLevelFilters as $bitmask => $rules) {\n            if (($compoundLevel & $bitmask) === $bitmask) {\n                $filter = $rules + $filter;\n            }\n        }\n\n        $realLevel = $child->getNestingLevel();\n        $lowercaseType = strtolower($child->getContentType());\n\n        if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) {\n            return $filter[$realLevel][$lowercaseType];\n        }\n\n        return $realLevel;\n    }\n\n    private function _createChild() {\n        return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar);\n    }\n\n    private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) {\n        foreach ($this->_immediateChildren as $child) {\n            $child->encoderChanged($encoder);\n        }\n    }\n\n    private function _notifyCharsetChanged($charset) {\n        $this->_encoder->charsetChanged($charset);\n        $this->_headers->charsetChanged($charset);\n        foreach ($this->_immediateChildren as $child) {\n            $child->charsetChanged($charset);\n        }\n    }\n\n    private function _sortChildren() {\n        $shouldSort = false;\n        foreach ($this->_immediateChildren as $child) {\n            // NOTE: This include alternative parts moved into a related part\n            if ($child->getNestingLevel() == self::LEVEL_ALTERNATIVE) {\n                $shouldSort = true;\n                break;\n            }\n        }\n\n        // Sort in order of preference, if there is one\n        if ($shouldSort) {\n            usort($this->_immediateChildren, array($this, '_childSortAlgorithm'));\n        }\n    }\n\n    private function _childSortAlgorithm($a, $b) {\n        $typePrefs = array();\n        $types = array(strtolower($a->getContentType()), strtolower($b->getContentType()));\n\n        foreach ($types as $type) {\n            $typePrefs[] = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1;\n        }\n\n        return $typePrefs[0] >= $typePrefs[1] ? 1 : -1;\n    }\n\n    // -- Destructor\n\n    /**\n     * Empties it's own contents from the cache.\n     */\n    public function __destruct() {\n        $this->_cache->clearAll($this->_cacheKey);\n    }\n\n    /**\n     * Throws an Exception if the id passed does not comply with RFC 2822.\n     *\n     * @param string $id\n     *\n     * @throws Swift_RfcComplianceException\n     */\n    private function _assertValidId($id) {\n        if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) {\n            throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');\n        }\n    }\n\n    /**\n     * Make a deep copy of object.\n     */\n    public function __clone() {\n        $this->_headers = clone $this->_headers;\n        $this->_encoder = clone $this->_encoder;\n        $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true));\n        $children = array();\n        foreach ($this->_children as $pos => $child) {\n            $children[$pos] = clone $child;\n        }\n        $this->setChildren($children);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/MimePart.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A MIME part, in a multipart message.\n *\n * @author Chris Corbyn\n */\nclass Swift_MimePart extends Swift_Mime_MimePart{\n    /**\n     * Create a new MimePart.\n     *\n     * Details may be optionally passed into the constructor.\n     *\n     * @param string $body\n     * @param string $contentType\n     * @param string $charset\n     */\n    public function __construct($body = null, $contentType = null, $charset = null) {\n        call_user_func_array(\n            array($this, 'Swift_Mime_MimePart::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('mime.part')\n            );\n\n        if (!isset($charset)) {\n            $charset = Swift_DependencyContainer::getInstance()\n                ->lookup('properties.charset');\n        }\n        $this->setBody($body);\n        $this->setCharset($charset);\n        if ($contentType) {\n            $this->setContentType($contentType);\n        }\n    }\n\n    /**\n     * Create a new MimePart.\n     *\n     * @param string $body\n     * @param string $contentType\n     * @param string $charset\n     *\n     * @return Swift_Mime_MimePart\n     */\n    public static function newInstance($body = null, $contentType = null, $charset = null) {\n        return new self($body, $contentType, $charset);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/NullTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Pretends messages have been sent, but just ignores them.\n *\n * @author Fabien Potencier\n */\nclass Swift_NullTransport extends Swift_Transport_NullTransport{\n    /**\n     * Create a new NullTransport.\n     */\n    public function __construct() {\n        call_user_func_array(\n            array($this, 'Swift_Transport_NullTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.null')\n        );\n    }\n\n    /**\n     * Create a new NullTransport instance.\n     *\n     * @return Swift_NullTransport\n     */\n    public static function newInstance() {\n        return new self();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/OutputByteStream.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An abstract means of reading data.\n *\n * Classes implementing this interface may use a subsystem which requires less\n * memory than working with large strings of data.\n *\n * @author Chris Corbyn\n */\ninterface Swift_OutputByteStream{\n    /**\n     * Reads $length bytes from the stream into a string and moves the pointer\n     * through the stream by $length.\n     *\n     * If less bytes exist than are requested the remaining bytes are given instead.\n     * If no bytes are remaining at all, boolean false is returned.\n     *\n     * @param int $length\n     *\n     * @throws Swift_IoException\n     *\n     * @return string|bool\n     */\n    public function read($length);\n\n    /**\n     * Move the internal read pointer to $byteOffset in the stream.\n     *\n     * @param int $byteOffset\n     *\n     * @throws Swift_IoException\n     *\n     * @return bool\n     */\n    public function setReadPointer($byteOffset);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Reduces network flooding when sending large amounts of mail.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_Plugins_Sleeper{\n    /**\n     * The number of emails to send before restarting Transport.\n     *\n     * @var int\n     */\n    private $_threshold;\n\n    /**\n     * The number of seconds to sleep for during a restart.\n     *\n     * @var int\n     */\n    private $_sleep;\n\n    /**\n     * The internal counter.\n     *\n     * @var int\n     */\n    private $_counter = 0;\n\n    /**\n     * The Sleeper instance for sleeping.\n     *\n     * @var Swift_Plugins_Sleeper\n     */\n    private $_sleeper;\n\n    /**\n     * Create a new AntiFloodPlugin with $threshold and $sleep time.\n     *\n     * @param int                   $threshold\n     * @param int                   $sleep     time\n     * @param Swift_Plugins_Sleeper $sleeper   (not needed really)\n     */\n    public function __construct($threshold = 99, $sleep = 0, Swift_Plugins_Sleeper $sleeper = null) {\n        $this->setThreshold($threshold);\n        $this->setSleepTime($sleep);\n        $this->_sleeper = $sleeper;\n    }\n\n    /**\n     * Set the number of emails to send before restarting.\n     *\n     * @param int $threshold\n     */\n    public function setThreshold($threshold) {\n        $this->_threshold = $threshold;\n    }\n\n    /**\n     * Get the number of emails to send before restarting.\n     *\n     * @return int\n     */\n    public function getThreshold() {\n        return $this->_threshold;\n    }\n\n    /**\n     * Set the number of seconds to sleep for during a restart.\n     *\n     * @param int $sleep time\n     */\n    public function setSleepTime($sleep) {\n        $this->_sleep = $sleep;\n    }\n\n    /**\n     * Get the number of seconds to sleep for during a restart.\n     *\n     * @return int\n     */\n    public function getSleepTime() {\n        return $this->_sleep;\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        ++$this->_counter;\n        if ($this->_counter >= $this->_threshold) {\n            $transport = $evt->getTransport();\n            $transport->stop();\n            if ($this->_sleep) {\n                $this->sleep($this->_sleep);\n            }\n            $transport->start();\n            $this->_counter = 0;\n        }\n    }\n\n    /**\n     * Sleep for $seconds.\n     *\n     * @param int $seconds\n     */\n    public function sleep($seconds) {\n        if (isset($this->_sleeper)) {\n            $this->_sleeper->sleep($seconds);\n        } else {\n            sleep($seconds);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Reduces network flooding when sending large amounts of mail.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener, Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_InputByteStream{\n    /**\n     * The outgoing traffic counter.\n     *\n     * @var int\n     */\n    private $_out = 0;\n\n    /**\n     * The incoming traffic counter.\n     *\n     * @var int\n     */\n    private $_in = 0;\n\n    /** Bound byte streams */\n    private $_mirrors = array();\n\n    /**\n     * Not used.\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n        $message->toByteStream($this);\n    }\n\n    /**\n     * Invoked immediately following a command being sent.\n     *\n     * @param Swift_Events_CommandEvent $evt\n     */\n    public function commandSent(Swift_Events_CommandEvent $evt) {\n        $command = $evt->getCommand();\n        $this->_out += strlen($command);\n    }\n\n    /**\n     * Invoked immediately following a response coming back.\n     *\n     * @param Swift_Events_ResponseEvent $evt\n     */\n    public function responseReceived(Swift_Events_ResponseEvent $evt) {\n        $response = $evt->getResponse();\n        $this->_in += strlen($response);\n    }\n\n    /**\n     * Called when a message is sent so that the outgoing counter can be increased.\n     *\n     * @param string $bytes\n     */\n    public function write($bytes) {\n        $this->_out += strlen($bytes);\n        foreach ($this->_mirrors as $stream) {\n            $stream->write($bytes);\n        }\n    }\n\n    /**\n     * Not used.\n     */\n    public function commit() {\n    }\n\n    /**\n     * Attach $is to this stream.\n     *\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function bind(Swift_InputByteStream $is) {\n        $this->_mirrors[] = $is;\n    }\n\n    /**\n     * Remove an already bound stream.\n     *\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function unbind(Swift_InputByteStream $is) {\n        foreach ($this->_mirrors as $k => $stream) {\n            if ($is === $stream) {\n                unset($this->_mirrors[$k]);\n            }\n        }\n    }\n\n    /**\n     * Not used.\n     */\n    public function flushBuffers() {\n        foreach ($this->_mirrors as $stream) {\n            $stream->flushBuffers();\n        }\n    }\n\n    /**\n     * Get the total number of bytes sent to the server.\n     *\n     * @return int\n     */\n    public function getBytesOut() {\n        return $this->_out;\n    }\n\n    /**\n     * Get the total number of bytes received from the server.\n     *\n     * @return int\n     */\n    public function getBytesIn() {\n        return $this->_in;\n    }\n\n    /**\n     * Reset the internal counters to zero.\n     */\n    public function reset() {\n        $this->_out = 0;\n        $this->_in = 0;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Allows customization of Messages on-the-fly.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Decorator_Replacements{\n    /**\n     * Return the array of replacements for $address.\n     *\n     * This method is invoked once for every single recipient of a message.\n     *\n     * If no replacements can be found, an empty value (NULL) should be returned\n     * and no replacements will then be made on the message.\n     *\n     * @param string $address\n     *\n     * @return array\n     */\n    public function getReplacementsFor($address);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Allows customization of Messages on-the-fly.\n *\n * @author Chris Corbyn\n * @author Fabien Potencier\n */\nclass Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_Plugins_Decorator_Replacements{\n    /** The replacement map */\n    private $_replacements;\n\n    /** The body as it was before replacements */\n    private $_originalBody;\n\n    /** The original headers of the message, before replacements */\n    private $_originalHeaders = array();\n\n    /** Bodies of children before they are replaced */\n    private $_originalChildBodies = array();\n\n    /** The Message that was last replaced */\n    private $_lastMessage;\n\n    /**\n     * Create a new DecoratorPlugin with $replacements.\n     *\n     * The $replacements can either be an associative array, or an implementation\n     * of {@link Swift_Plugins_Decorator_Replacements}.\n     *\n     * When using an array, it should be of the form:\n     * <code>\n     * $replacements = array(\n     *  \"address1@domain.tld\" => array(\"{a}\" => \"b\", \"{c}\" => \"d\"),\n     *  \"address2@domain.tld\" => array(\"{a}\" => \"x\", \"{c}\" => \"y\")\n     * )\n     * </code>\n     *\n     * When using an instance of {@link Swift_Plugins_Decorator_Replacements},\n     * the object should return just the array of replacements for the address\n     * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}.\n     *\n     * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements\n     */\n    public function __construct($replacements) {\n        $this->setReplacements($replacements);\n    }\n\n    /**\n     * Sets replacements.\n     *\n     * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements\n     *\n     * @see __construct()\n     */\n    public function setReplacements($replacements) {\n        if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {\n            $this->_replacements = (array) $replacements;\n        } else {\n            $this->_replacements = $replacements;\n        }\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n        $this->_restoreMessage($message);\n        $to = array_keys($message->getTo());\n        $address = array_shift($to);\n        if ($replacements = $this->getReplacementsFor($address)) {\n            $body = $message->getBody();\n            $search = array_keys($replacements);\n            $replace = array_values($replacements);\n            $bodyReplaced = str_replace(\n                $search, $replace, $body\n                );\n            if ($body != $bodyReplaced) {\n                $this->_originalBody = $body;\n                $message->setBody($bodyReplaced);\n            }\n\n            foreach ($message->getHeaders()->getAll() as $header) {\n                $body = $header->getFieldBodyModel();\n                $count = 0;\n                if (is_array($body)) {\n                    $bodyReplaced = array();\n                    foreach ($body as $key => $value) {\n                        $count1 = 0;\n                        $count2 = 0;\n                        $key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;\n                        $value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;\n                        $bodyReplaced[$key] = $value;\n\n                        if (!$count && ($count1 || $count2)) {\n                            $count = 1;\n                        }\n                    }\n                } else {\n                    $bodyReplaced = str_replace($search, $replace, $body, $count);\n                }\n\n                if ($count) {\n                    $this->_originalHeaders[$header->getFieldName()] = $body;\n                    $header->setFieldBodyModel($bodyReplaced);\n                }\n            }\n\n            $children = (array) $message->getChildren();\n            foreach ($children as $child) {\n                list($type) = sscanf($child->getContentType(), '%[^/]/%s');\n                if ('text' == $type) {\n                    $body = $child->getBody();\n                    $bodyReplaced = str_replace(\n                        $search, $replace, $body\n                        );\n                    if ($body != $bodyReplaced) {\n                        $child->setBody($bodyReplaced);\n                        $this->_originalChildBodies[$child->getId()] = $body;\n                    }\n                }\n            }\n            $this->_lastMessage = $message;\n        }\n    }\n\n    /**\n     * Find a map of replacements for the address.\n     *\n     * If this plugin was provided with a delegate instance of\n     * {@link Swift_Plugins_Decorator_Replacements} then the call will be\n     * delegated to it.  Otherwise, it will attempt to find the replacements\n     * from the array provided in the constructor.\n     *\n     * If no replacements can be found, an empty value (NULL) is returned.\n     *\n     * @param string $address\n     *\n     * @return array\n     */\n    public function getReplacementsFor($address) {\n        if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) {\n            return $this->_replacements->getReplacementsFor($address);\n        }\n\n        return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null;\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        $this->_restoreMessage($evt->getMessage());\n    }\n\n    /** Restore a changed message back to its original state */\n    private function _restoreMessage(Swift_Mime_Message $message) {\n        if ($this->_lastMessage === $message) {\n            if (isset($this->_originalBody)) {\n                $message->setBody($this->_originalBody);\n                $this->_originalBody = null;\n            }\n            if (!empty($this->_originalHeaders)) {\n                foreach ($message->getHeaders()->getAll() as $header) {\n                    if (array_key_exists($header->getFieldName(), $this->_originalHeaders)) {\n                        $header->setFieldBodyModel($this->_originalHeaders[$header->getFieldName()]);\n                    }\n                }\n                $this->_originalHeaders = array();\n            }\n            if (!empty($this->_originalChildBodies)) {\n                $children = (array) $message->getChildren();\n                foreach ($children as $child) {\n                    $id = $child->getId();\n                    if (array_key_exists($id, $this->_originalChildBodies)) {\n                        $child->setBody($this->_originalChildBodies[$id]);\n                    }\n                }\n                $this->_originalChildBodies = array();\n            }\n            $this->_lastMessage = null;\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Replaces the sender of a message.\n *\n * @author Arjen Brouwer\n */\nclass Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener{\n    /**\n     * The sender to impersonate.\n     *\n     * @var String\n     */\n    private $_sender;\n\n    /**\n     * Create a new ImpersonatePlugin to impersonate $sender.\n     *\n     * @param string $sender address\n     */\n    public function __construct($sender) {\n        $this->_sender = $sender;\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n        $headers = $message->getHeaders();\n\n        // save current recipients\n        $headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath());\n\n        // replace them with the one to send to\n        $message->setReturnPath($this->_sender);\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n\n        // restore original headers\n        $headers = $message->getHeaders();\n\n        if ($headers->has('X-Swift-Return-Path')) {\n            $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress());\n            $headers->removeAll('X-Swift-Return-Path');\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Logger.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Logs events in the Transport system.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Logger{\n    /**\n     * Add a log entry.\n     *\n     * @param string $entry\n     */\n    public function add($entry);\n\n    /**\n     * Clear the log contents.\n     */\n    public function clear();\n\n    /**\n     * Get this log as a string.\n     *\n     * @return string\n     */\n    public function dump();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Does real time logging of Transport level information.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_Events_TransportChangeListener, Swift_Events_TransportExceptionListener, Swift_Plugins_Logger{\n    /** The logger which is delegated to */\n    private $_logger;\n\n    /**\n     * Create a new LoggerPlugin using $logger.\n     *\n     * @param Swift_Plugins_Logger $logger\n     */\n    public function __construct(Swift_Plugins_Logger $logger) {\n        $this->_logger = $logger;\n    }\n\n    /**\n     * Add a log entry.\n     *\n     * @param string $entry\n     */\n    public function add($entry) {\n        $this->_logger->add($entry);\n    }\n\n    /**\n     * Clear the log contents.\n     */\n    public function clear() {\n        $this->_logger->clear();\n    }\n\n    /**\n     * Get this log as a string.\n     *\n     * @return string\n     */\n    public function dump() {\n        return $this->_logger->dump();\n    }\n\n    /**\n     * Invoked immediately following a command being sent.\n     *\n     * @param Swift_Events_CommandEvent $evt\n     */\n    public function commandSent(Swift_Events_CommandEvent $evt) {\n        $command = $evt->getCommand();\n        $this->_logger->add(sprintf('>> %s', $command));\n    }\n\n    /**\n     * Invoked immediately following a response coming back.\n     *\n     * @param Swift_Events_ResponseEvent $evt\n     */\n    public function responseReceived(Swift_Events_ResponseEvent $evt) {\n        $response = $evt->getResponse();\n        $this->_logger->add(sprintf('<< %s', $response));\n    }\n\n    /**\n     * Invoked just before a Transport is started.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) {\n        $transportName = get_class($evt->getSource());\n        $this->_logger->add(sprintf('++ Starting %s', $transportName));\n    }\n\n    /**\n     * Invoked immediately after the Transport is started.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function transportStarted(Swift_Events_TransportChangeEvent $evt) {\n        $transportName = get_class($evt->getSource());\n        $this->_logger->add(sprintf('++ %s started', $transportName));\n    }\n\n    /**\n     * Invoked just before a Transport is stopped.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) {\n        $transportName = get_class($evt->getSource());\n        $this->_logger->add(sprintf('++ Stopping %s', $transportName));\n    }\n\n    /**\n     * Invoked immediately after the Transport is stopped.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function transportStopped(Swift_Events_TransportChangeEvent $evt) {\n        $transportName = get_class($evt->getSource());\n        $this->_logger->add(sprintf('++ %s stopped', $transportName));\n    }\n\n    /**\n     * Invoked as a TransportException is thrown in the Transport system.\n     *\n     * @param Swift_Events_TransportExceptionEvent $evt\n     */\n    public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt) {\n        $e = $evt->getException();\n        $message = $e->getMessage();\n        $code = $e->getCode();\n        $this->_logger->add(sprintf('!! %s (code: %s)', $message, $code));\n        $message .= PHP_EOL;\n        $message .= 'Log data:'.PHP_EOL;\n        $message .= $this->_logger->dump();\n        $evt->cancelBubble();\n        throw new Swift_TransportException($message, $code, $e->getPrevious());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Logs to an Array backend.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger{\n    /**\n     * The log contents.\n     *\n     * @var array\n     */\n    private $_log = array();\n\n    /**\n     * Max size of the log.\n     *\n     * @var int\n     */\n    private $_size = 0;\n\n    /**\n     * Create a new ArrayLogger with a maximum of $size entries.\n     *\n     * @var int\n     */\n    public function __construct($size = 50) {\n        $this->_size = $size;\n    }\n\n    /**\n     * Add a log entry.\n     *\n     * @param string $entry\n     */\n    public function add($entry) {\n        $this->_log[] = $entry;\n        while (count($this->_log) > $this->_size) {\n            array_shift($this->_log);\n        }\n    }\n\n    /**\n     * Clear the log contents.\n     */\n    public function clear() {\n        $this->_log = array();\n    }\n\n    /**\n     * Get this log as a string.\n     *\n     * @return string\n     */\n    public function dump() {\n        return implode(PHP_EOL, $this->_log);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Prints all log messages in real time.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger{\n    /** Whether or not HTML should be output */\n    private $_isHtml;\n\n    /**\n     * Create a new EchoLogger.\n     *\n     * @param bool $isHtml\n     */\n    public function __construct($isHtml = true) {\n        $this->_isHtml = $isHtml;\n    }\n\n    /**\n     * Add a log entry.\n     *\n     * @param string $entry\n     */\n    public function add($entry) {\n        if ($this->_isHtml) {\n            printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL);\n        } else {\n            printf('%s%s', $entry, PHP_EOL);\n        }\n    }\n\n    /**\n     * Not implemented.\n     */\n    public function clear() {\n    }\n\n    /**\n     * Not implemented.\n     */\n    public function dump() {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2011 Fabien Potencier\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Stores all sent emails for further usage.\n *\n * @author Fabien Potencier\n */\nclass Swift_Plugins_MessageLogger implements Swift_Events_SendListener{\n    /**\n     * @var array\n     */\n    private $messages;\n\n    public function __construct() {\n        $this->messages = array();\n    }\n\n    /**\n     * Get the message list.\n     *\n     * @return array\n     */\n    public function getMessages() {\n        return $this->messages;\n    }\n\n    /**\n     * Get the message count.\n     *\n     * @return int count\n     */\n    public function countMessages() {\n        return count($this->messages);\n    }\n\n    /**\n     * Empty the message list.\n     */\n    public function clear() {\n        $this->messages = array();\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n        $this->messages[] = clone $evt->getMessage();\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Pop3Connection interface for connecting and disconnecting to a POP3 host.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Pop_Pop3Connection{\n    /**\n     * Connect to the POP3 host and throw an Exception if it fails.\n     *\n     * @throws Swift_Plugins_Pop_Pop3Exception\n     */\n    public function connect();\n\n    /**\n     * Disconnect from the POP3 host and throw an Exception if it fails.\n     *\n     * @throws Swift_Plugins_Pop_Pop3Exception\n     */\n    public function disconnect();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Exception.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Pop3Exception thrown when an error occurs connecting to a POP3 host.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_Pop_Pop3Exception extends Swift_IoException{\n    /**\n     * Create a new Pop3Exception with $message.\n     *\n     * @param string $message\n     */\n    public function __construct($message) {\n        parent::__construct($message);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Makes sure a connection to a POP3 host has been established prior to connecting to SMTP.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeListener, Swift_Plugins_Pop_Pop3Connection{\n    /** A delegate connection to use (mostly a test hook) */\n    private $_connection;\n\n    /** Hostname of the POP3 server */\n    private $_host;\n\n    /** Port number to connect on */\n    private $_port;\n\n    /** Encryption type to use (if any) */\n    private $_crypto;\n\n    /** Username to use (if any) */\n    private $_username;\n\n    /** Password to use (if any) */\n    private $_password;\n\n    /** Established connection via TCP socket */\n    private $_socket;\n\n    /** Connect timeout in seconds */\n    private $_timeout = 10;\n\n    /** SMTP Transport to bind to */\n    private $_transport;\n\n    /**\n     * Create a new PopBeforeSmtpPlugin for $host and $port.\n     *\n     * @param string $host\n     * @param int    $port\n     * @param string $crypto as \"tls\" or \"ssl\"\n     */\n    public function __construct($host, $port = 110, $crypto = null) {\n        $this->_host = $host;\n        $this->_port = $port;\n        $this->_crypto = $crypto;\n    }\n\n    /**\n     * Create a new PopBeforeSmtpPlugin for $host and $port.\n     *\n     * @param string $host\n     * @param int    $port\n     * @param string $crypto as \"tls\" or \"ssl\"\n     *\n     * @return Swift_Plugins_PopBeforeSmtpPlugin\n     */\n    public static function newInstance($host, $port = 110, $crypto = null) {\n        return new self($host, $port, $crypto);\n    }\n\n    /**\n     * Set a Pop3Connection to delegate to instead of connecting directly.\n     *\n     * @param Swift_Plugins_Pop_Pop3Connection $connection\n     *\n     * @return Swift_Plugins_PopBeforeSmtpPlugin\n     */\n    public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) {\n        $this->_connection = $connection;\n\n        return $this;\n    }\n\n    /**\n     * Bind this plugin to a specific SMTP transport instance.\n     *\n     * @param Swift_Transport\n     */\n    public function bindSmtp(Swift_Transport $smtp) {\n        $this->_transport = $smtp;\n    }\n\n    /**\n     * Set the connection timeout in seconds (default 10).\n     *\n     * @param int $timeout\n     *\n     * @return Swift_Plugins_PopBeforeSmtpPlugin\n     */\n    public function setTimeout($timeout) {\n        $this->_timeout = (int) $timeout;\n\n        return $this;\n    }\n\n    /**\n     * Set the username to use when connecting (if needed).\n     *\n     * @param string $username\n     *\n     * @return Swift_Plugins_PopBeforeSmtpPlugin\n     */\n    public function setUsername($username) {\n        $this->_username = $username;\n\n        return $this;\n    }\n\n    /**\n     * Set the password to use when connecting (if needed).\n     *\n     * @param string $password\n     *\n     * @return Swift_Plugins_PopBeforeSmtpPlugin\n     */\n    public function setPassword($password) {\n        $this->_password = $password;\n\n        return $this;\n    }\n\n    /**\n     * Connect to the POP3 host and authenticate.\n     *\n     * @throws Swift_Plugins_Pop_Pop3Exception if connection fails\n     */\n    public function connect() {\n        if (isset($this->_connection)) {\n            $this->_connection->connect();\n        } else {\n            if (!isset($this->_socket)) {\n                if (!$socket = fsockopen(\n                    $this->_getHostString(), $this->_port, $errno, $errstr, $this->_timeout)) {\n                    throw new Swift_Plugins_Pop_Pop3Exception(\n                        sprintf('Failed to connect to POP3 host [%s]: %s', $this->_host, $errstr)\n                    );\n                }\n                $this->_socket = $socket;\n\n                if (false === $greeting = fgets($this->_socket)) {\n                    throw new Swift_Plugins_Pop_Pop3Exception(\n                        sprintf('Failed to connect to POP3 host [%s]', trim($greeting))\n                    );\n                }\n\n                $this->_assertOk($greeting);\n\n                if ($this->_username) {\n                    $this->_command(sprintf(\"USER %s\\r\\n\", $this->_username));\n                    $this->_command(sprintf(\"PASS %s\\r\\n\", $this->_password));\n                }\n            }\n        }\n    }\n\n    /**\n     * Disconnect from the POP3 host.\n     */\n    public function disconnect() {\n        if (isset($this->_connection)) {\n            $this->_connection->disconnect();\n        } else {\n            $this->_command(\"QUIT\\r\\n\");\n            if (!fclose($this->_socket)) {\n                throw new Swift_Plugins_Pop_Pop3Exception(\n                    sprintf('POP3 host [%s] connection could not be stopped', $this->_host)\n                );\n            }\n            $this->_socket = null;\n        }\n    }\n\n    /**\n     * Invoked just before a Transport is started.\n     *\n     * @param Swift_Events_TransportChangeEvent $evt\n     */\n    public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) {\n        if (isset($this->_transport)) {\n            if ($this->_transport !== $evt->getTransport()) {\n                return;\n            }\n        }\n\n        $this->connect();\n        $this->disconnect();\n    }\n\n    /**\n     * Not used.\n     */\n    public function transportStarted(Swift_Events_TransportChangeEvent $evt) {\n    }\n\n    /**\n     * Not used.\n     */\n    public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) {\n    }\n\n    /**\n     * Not used.\n     */\n    public function transportStopped(Swift_Events_TransportChangeEvent $evt) {\n    }\n\n    private function _command($command) {\n        if (!fwrite($this->_socket, $command)) {\n            throw new Swift_Plugins_Pop_Pop3Exception(\n                sprintf('Failed to write command [%s] to POP3 host', trim($command))\n            );\n        }\n\n        if (false === $response = fgets($this->_socket)) {\n            throw new Swift_Plugins_Pop_Pop3Exception(\n                sprintf('Failed to read from POP3 host after command [%s]', trim($command))\n            );\n        }\n\n        $this->_assertOk($response);\n\n        return $response;\n    }\n\n    private function _assertOk($response) {\n        if (substr($response, 0, 3) != '+OK') {\n            throw new Swift_Plugins_Pop_Pop3Exception(\n                sprintf('POP3 command failed [%s]', trim($response))\n            );\n        }\n    }\n\n    private function _getHostString() {\n        $host = $this->_host;\n        switch (strtolower($this->_crypto)) {\n            case 'ssl':\n                $host = 'ssl://'.$host;\n                break;\n\n            case 'tls':\n                $host = 'tls://'.$host;\n                break;\n        }\n\n        return $host;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Redirects all email to a single recipient.\n *\n * @author Fabien Potencier\n */\nclass Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener{\n    /**\n     * The recipient who will receive all messages.\n     *\n     * @var mixed\n     */\n    private $_recipient;\n\n    /**\n     * List of regular expression for recipient whitelisting.\n     *\n     * @var array\n     */\n    private $_whitelist = array();\n\n    /**\n     * Create a new RedirectingPlugin.\n     *\n     * @param mixed $recipient\n     * @param array $whitelist\n     */\n    public function __construct($recipient, array $whitelist = array()) {\n        $this->_recipient = $recipient;\n        $this->_whitelist = $whitelist;\n    }\n\n    /**\n     * Set the recipient of all messages.\n     *\n     * @param mixed $recipient\n     */\n    public function setRecipient($recipient) {\n        $this->_recipient = $recipient;\n    }\n\n    /**\n     * Get the recipient of all messages.\n     *\n     * @return mixed\n     */\n    public function getRecipient() {\n        return $this->_recipient;\n    }\n\n    /**\n     * Set a list of regular expressions to whitelist certain recipients.\n     *\n     * @param array $whitelist\n     */\n    public function setWhitelist(array $whitelist) {\n        $this->_whitelist = $whitelist;\n    }\n\n    /**\n     * Get the whitelist.\n     *\n     * @return array\n     */\n    public function getWhitelist() {\n        return $this->_whitelist;\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n        $headers = $message->getHeaders();\n\n        // conditionally save current recipients\n\n        if ($headers->has('to')) {\n            $headers->addMailboxHeader('X-Swift-To', $message->getTo());\n        }\n\n        if ($headers->has('cc')) {\n            $headers->addMailboxHeader('X-Swift-Cc', $message->getCc());\n        }\n\n        if ($headers->has('bcc')) {\n            $headers->addMailboxHeader('X-Swift-Bcc', $message->getBcc());\n        }\n\n        // Filter remaining headers against whitelist\n        $this->_filterHeaderSet($headers, 'To');\n        $this->_filterHeaderSet($headers, 'Cc');\n        $this->_filterHeaderSet($headers, 'Bcc');\n\n        // Add each hard coded recipient\n        $to = $message->getTo();\n        if (null === $to) {\n            $to = array();\n        }\n\n        foreach ((array) $this->_recipient as $recipient) {\n            if (!array_key_exists($recipient, $to)) {\n                $message->addTo($recipient);\n            }\n        }\n    }\n\n    /**\n     * Filter header set against a whitelist of regular expressions.\n     *\n     * @param Swift_Mime_HeaderSet $headerSet\n     * @param string               $type\n     */\n    private function _filterHeaderSet(Swift_Mime_HeaderSet $headerSet, $type) {\n        foreach ($headerSet->getAll($type) as $headers) {\n            $headers->setNameAddresses($this->_filterNameAddresses($headers->getNameAddresses()));\n        }\n    }\n\n    /**\n     * Filtered list of addresses => name pairs.\n     *\n     * @param array $recipients\n     *\n     * @return array\n     */\n    private function _filterNameAddresses(array $recipients) {\n        $filtered = array();\n\n        foreach ($recipients as $address => $name) {\n            if ($this->_isWhitelisted($address)) {\n                $filtered[$address] = $name;\n            }\n        }\n\n        return $filtered;\n    }\n\n    /**\n     * Matches address against whitelist of regular expressions.\n     *\n     * @param $recipient\n     *\n     * @return bool\n     */\n    protected function _isWhitelisted($recipient) {\n        if (in_array($recipient, (array) $this->_recipient)) {\n            return true;\n        }\n\n        foreach ($this->_whitelist as $pattern) {\n            if (preg_match($pattern, $recipient)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        $this->_restoreMessage($evt->getMessage());\n    }\n\n    private function _restoreMessage(Swift_Mime_Message $message) {\n        // restore original headers\n        $headers = $message->getHeaders();\n\n        if ($headers->has('X-Swift-To')) {\n            $message->setTo($headers->get('X-Swift-To')->getNameAddresses());\n            $headers->removeAll('X-Swift-To');\n        } else {\n            $message->setTo(null);\n        }\n\n        if ($headers->has('X-Swift-Cc')) {\n            $message->setCc($headers->get('X-Swift-Cc')->getNameAddresses());\n            $headers->removeAll('X-Swift-Cc');\n        }\n\n        if ($headers->has('X-Swift-Bcc')) {\n            $message->setBcc($headers->get('X-Swift-Bcc')->getNameAddresses());\n            $headers->removeAll('X-Swift-Bcc');\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Reporter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * The Reporter plugin sends pass/fail notification to a Reporter.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Reporter{\n    /** The recipient was accepted for delivery */\n    const RESULT_PASS = 0x01;\n\n    /** The recipient could not be accepted */\n    const RESULT_FAIL = 0x10;\n\n    /**\n     * Notifies this ReportNotifier that $address failed or succeeded.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string             $address\n     * @param int                $result  from {@link RESULT_PASS, RESULT_FAIL}\n     */\n    public function notify(Swift_Mime_Message $message, $address, $result);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Does real time reporting of pass/fail for each recipient.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener{\n    /**\n     * The reporter backend which takes notifications.\n     *\n     * @var Swift_Plugins_Reporter\n     */\n    private $_reporter;\n\n    /**\n     * Create a new ReporterPlugin using $reporter.\n     *\n     * @param Swift_Plugins_Reporter $reporter\n     */\n    public function __construct(Swift_Plugins_Reporter $reporter) {\n        $this->_reporter = $reporter;\n    }\n\n    /**\n     * Not used.\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n    }\n\n    /**\n     * Invoked immediately after the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        $message = $evt->getMessage();\n        $failures = array_flip($evt->getFailedRecipients());\n        foreach ((array) $message->getTo() as $address => $null) {\n            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);\n        }\n        foreach ((array) $message->getCc() as $address => $null) {\n            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);\n        }\n        foreach ((array) $message->getBcc() as $address => $null) {\n            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A reporter which \"collects\" failures for the Reporter plugin.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter{\n    /**\n     * The list of failures.\n     *\n     * @var array\n     */\n    private $_failures = array();\n\n    private $_failures_cache = array();\n\n    /**\n     * Notifies this ReportNotifier that $address failed or succeeded.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string             $address\n     * @param int                $result  from {@link RESULT_PASS, RESULT_FAIL}\n     */\n    public function notify(Swift_Mime_Message $message, $address, $result) {\n        if (self::RESULT_FAIL == $result && !isset($this->_failures_cache[$address])) {\n            $this->_failures[] = $address;\n            $this->_failures_cache[$address] = true;\n        }\n    }\n\n    /**\n     * Get an array of addresses for which delivery failed.\n     *\n     * @return array\n     */\n    public function getFailedRecipients() {\n        return $this->_failures;\n    }\n\n    /**\n     * Clear the buffer (empty the list).\n     */\n    public function clear() {\n        $this->_failures = $this->_failures_cache = array();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A HTML output reporter for the Reporter plugin.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter{\n    /**\n     * Notifies this ReportNotifier that $address failed or succeeded.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string             $address\n     * @param int                $result  from {@see RESULT_PASS, RESULT_FAIL}\n     */\n    public function notify(Swift_Mime_Message $message, $address, $result) {\n        if (self::RESULT_PASS == $result) {\n            echo '<div style=\"color: #fff; background: #006600; padding: 2px; margin: 2px;\">'.PHP_EOL;\n            echo 'PASS '.$address.PHP_EOL;\n            echo '</div>'.PHP_EOL;\n            flush();\n        } else {\n            echo '<div style=\"color: #fff; background: #880000; padding: 2px; margin: 2px;\">'.PHP_EOL;\n            echo 'FAIL '.$address.PHP_EOL;\n            echo '</div>'.PHP_EOL;\n            flush();\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sleeps for a duration of time.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Sleeper{\n    /**\n     * Sleep for $seconds.\n     *\n     * @param int $seconds\n     */\n    public function sleep($seconds);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Throttles the rate at which emails are sent.\n *\n * @author Chris Corbyn\n */\nclass Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin implements Swift_Plugins_Sleeper, Swift_Plugins_Timer{\n    /** Flag for throttling in bytes per minute */\n    const BYTES_PER_MINUTE = 0x01;\n\n    /** Flag for throttling in emails per second (Amazon SES) */\n    const MESSAGES_PER_SECOND = 0x11;\n\n    /** Flag for throttling in emails per minute */\n    const MESSAGES_PER_MINUTE = 0x10;\n\n    /**\n     * The Sleeper instance for sleeping.\n     *\n     * @var Swift_Plugins_Sleeper\n     */\n    private $_sleeper;\n\n    /**\n     * The Timer instance which provides the timestamp.\n     *\n     * @var Swift_Plugins_Timer\n     */\n    private $_timer;\n\n    /**\n     * The time at which the first email was sent.\n     *\n     * @var int\n     */\n    private $_start;\n\n    /**\n     * The rate at which messages should be sent.\n     *\n     * @var int\n     */\n    private $_rate;\n\n    /**\n     * The mode for throttling.\n     *\n     * This is {@link BYTES_PER_MINUTE} or {@link MESSAGES_PER_MINUTE}\n     *\n     * @var int\n     */\n    private $_mode;\n\n    /**\n     * An internal counter of the number of messages sent.\n     *\n     * @var int\n     */\n    private $_messages = 0;\n\n    /**\n     * Create a new ThrottlerPlugin.\n     *\n     * @param int                   $rate\n     * @param int                   $mode,   defaults to {@link BYTES_PER_MINUTE}\n     * @param Swift_Plugins_Sleeper $sleeper (only needed in testing)\n     * @param Swift_Plugins_Timer   $timer   (only needed in testing)\n     */\n    public function __construct($rate, $mode = self::BYTES_PER_MINUTE, Swift_Plugins_Sleeper $sleeper = null, Swift_Plugins_Timer $timer = null) {\n        $this->_rate = $rate;\n        $this->_mode = $mode;\n        $this->_sleeper = $sleeper;\n        $this->_timer = $timer;\n    }\n\n    /**\n     * Invoked immediately before the Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function beforeSendPerformed(Swift_Events_SendEvent $evt) {\n        $time = $this->getTimestamp();\n        if (!isset($this->_start)) {\n            $this->_start = $time;\n        }\n        $duration = $time - $this->_start;\n\n        switch ($this->_mode) {\n            case self::BYTES_PER_MINUTE :\n                $sleep = $this->_throttleBytesPerMinute($duration);\n                break;\n            case self::MESSAGES_PER_SECOND :\n                $sleep = $this->_throttleMessagesPerSecond($duration);\n                break;\n            case self::MESSAGES_PER_MINUTE :\n                $sleep = $this->_throttleMessagesPerMinute($duration);\n                break;\n            default :\n                $sleep = 0;\n                break;\n        }\n\n        if ($sleep > 0) {\n            $this->sleep($sleep);\n        }\n    }\n\n    /**\n     * Invoked when a Message is sent.\n     *\n     * @param Swift_Events_SendEvent $evt\n     */\n    public function sendPerformed(Swift_Events_SendEvent $evt) {\n        parent::sendPerformed($evt);\n        ++$this->_messages;\n    }\n\n    /**\n     * Sleep for $seconds.\n     *\n     * @param int $seconds\n     */\n    public function sleep($seconds) {\n        if (isset($this->_sleeper)) {\n            $this->_sleeper->sleep($seconds);\n        } else {\n            sleep($seconds);\n        }\n    }\n\n    /**\n     * Get the current UNIX timestamp.\n     *\n     * @return int\n     */\n    public function getTimestamp() {\n        if (isset($this->_timer)) {\n            return $this->_timer->getTimestamp();\n        }\n\n        return time();\n    }\n\n    /**\n     * Get a number of seconds to sleep for.\n     *\n     * @param int $timePassed\n     *\n     * @return int\n     */\n    private function _throttleBytesPerMinute($timePassed) {\n        $expectedDuration = $this->getBytesOut() / ($this->_rate / 60);\n\n        return (int) ceil($expectedDuration - $timePassed);\n    }\n\n    /**\n     * Get a number of seconds to sleep for.\n     *\n     * @param int $timePassed\n     *\n     * @return int\n     */\n    private function _throttleMessagesPerSecond($timePassed) {\n        $expectedDuration = $this->_messages / ($this->_rate);\n\n        return (int) ceil($expectedDuration - $timePassed);\n    }\n\n    /**\n     * Get a number of seconds to sleep for.\n     *\n     * @param int $timePassed\n     *\n     * @return int\n     */\n    private function _throttleMessagesPerMinute($timePassed) {\n        $expectedDuration = $this->_messages / ($this->_rate / 60);\n\n        return (int) ceil($expectedDuration - $timePassed);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Plugins/Timer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Provides timestamp data.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Plugins_Timer{\n    /**\n     * Get the current UNIX timestamp.\n     *\n     * @return int\n     */\n    public function getTimestamp();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Preferences.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Changes some global preference settings in Swift Mailer.\n *\n * @author Chris Corbyn\n */\nclass Swift_Preferences{\n    /** Singleton instance */\n    private static $_instance = null;\n\n    /** Constructor not to be used */\n    private function __construct() {\n    }\n\n    /**\n     * Gets the instance of Preferences.\n     *\n     * @return Swift_Preferences\n     */\n    public static function getInstance() {\n        if (!isset(self::$_instance)) {\n            self::$_instance = new self();\n        }\n\n        return self::$_instance;\n    }\n\n    /**\n     * Set the default charset used.\n     *\n     * @param string $charset\n     *\n     * @return Swift_Preferences\n     */\n    public function setCharset($charset) {\n        Swift_DependencyContainer::getInstance()\n            ->register('properties.charset')->asValue($charset);\n\n        return $this;\n    }\n\n    /**\n     * Set the directory where temporary files can be saved.\n     *\n     * @param string $dir\n     *\n     * @return Swift_Preferences\n     */\n    public function setTempDir($dir) {\n        Swift_DependencyContainer::getInstance()\n            ->register('tempdir')->asValue($dir);\n\n        return $this;\n    }\n\n    /**\n     * Set the type of cache to use (i.e. \"disk\" or \"array\").\n     *\n     * @param string $type\n     *\n     * @return Swift_Preferences\n     */\n    public function setCacheType($type) {\n        Swift_DependencyContainer::getInstance()\n            ->register('cache')->asAliasOf(sprintf('cache.%s', $type));\n\n        return $this;\n    }\n\n    /**\n     * Set the QuotedPrintable dot escaper preference.\n     *\n     * @param bool $dotEscape\n     *\n     * @return Swift_Preferences\n     */\n    public function setQPDotEscape($dotEscape) {\n        $dotEscape = !empty($dotEscape);\n        Swift_DependencyContainer::getInstance()\n            ->register('mime.qpcontentencoder')\n            ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')\n            ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))\n            ->addConstructorValue($dotEscape);\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/ReplacementFilterFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Creates StreamFilters.\n *\n * @author Chris Corbyn\n */\ninterface Swift_ReplacementFilterFactory{\n    /**\n     * Create a filter to replace $search with $replace.\n     *\n     * @param mixed $search\n     * @param mixed $replace\n     *\n     * @return Swift_StreamFilter\n     */\n    public function createFilter($search, $replace);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/RfcComplianceException.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * RFC Compliance Exception class.\n *\n * @author Chris Corbyn\n */\nclass Swift_RfcComplianceException extends Swift_SwiftException{\n    /**\n     * Create a new RfcComplianceException with $message.\n     *\n     * @param string $message\n     */\n    public function __construct($message) {\n        parent::__construct($message);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/SendmailTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary.\n *\n * @author Chris Corbyn\n */\nclass Swift_SendmailTransport extends Swift_Transport_SendmailTransport{\n    /**\n     * Create a new SendmailTransport, optionally using $command for sending.\n     *\n     * @param string $command\n     */\n    public function __construct($command = '/usr/sbin/sendmail -bs') {\n        call_user_func_array(\n            array($this, 'Swift_Transport_SendmailTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.sendmail')\n            );\n\n        $this->setCommand($command);\n    }\n\n    /**\n     * Create a new SendmailTransport instance.\n     *\n     * @param string $command\n     *\n     * @return Swift_SendmailTransport\n     */\n    public static function newInstance($command = '/usr/sbin/sendmail -bs') {\n        return new self($command);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/SignedMessage.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Signed Message, message that can be signed using a signer.\n *\n * This class is only kept for compatibility\n *\n *\n * @author     Xavier De Cock <xdecock@gmail.com>\n *\n * @deprecated\n */\nclass Swift_SignedMessage extends Swift_Message{\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Base Class of Signer Infrastructure.\n *\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\ninterface Swift_Signer{\n    public function reset();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/BodySigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Body Signer Interface used to apply Body-Based Signature to a message.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\ninterface Swift_Signers_BodySigner extends Swift_Signer{\n    /**\n     * Change the Swift_Signed_Message to apply the singing.\n     *\n     * @param Swift_Message $message\n     *\n     * @return Swift_Signers_BodySigner\n     */\n    public function signMessage(Swift_Message $message);\n\n    /**\n     * Return the list of header a signer might tamper.\n     *\n     * @return array\n     */\n    public function getAlteredHeaders();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * DKIM Signer used to apply DKIM Signature to a message.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner{\n    /**\n     * PrivateKey.\n     *\n     * @var string\n     */\n    protected $_privateKey;\n\n    /**\n     * DomainName.\n     *\n     * @var string\n     */\n    protected $_domainName;\n\n    /**\n     * Selector.\n     *\n     * @var string\n     */\n    protected $_selector;\n\n    /**\n     * Hash algorithm used.\n     *\n     * @var string\n     */\n    protected $_hashAlgorithm = 'rsa-sha1';\n\n    /**\n     * Body canon method.\n     *\n     * @var string\n     */\n    protected $_bodyCanon = 'simple';\n\n    /**\n     * Header canon method.\n     *\n     * @var string\n     */\n    protected $_headerCanon = 'simple';\n\n    /**\n     * Headers not being signed.\n     *\n     * @var array\n     */\n    protected $_ignoredHeaders = array('return-path' => true);\n\n    /**\n     * Signer identity.\n     *\n     * @var string\n     */\n    protected $_signerIdentity;\n\n    /**\n     * BodyLength.\n     *\n     * @var int\n     */\n    protected $_bodyLen = 0;\n\n    /**\n     * Maximum signedLen.\n     *\n     * @var int\n     */\n    protected $_maxLen = PHP_INT_MAX;\n\n    /**\n     * Embbed bodyLen in signature.\n     *\n     * @var bool\n     */\n    protected $_showLen = false;\n\n    /**\n     * When the signature has been applied (true means time()), false means not embedded.\n     *\n     * @var mixed\n     */\n    protected $_signatureTimestamp = true;\n\n    /**\n     * When will the signature expires false means not embedded, if sigTimestamp is auto\n     * Expiration is relative, otherwhise it's absolute.\n     *\n     * @var int\n     */\n    protected $_signatureExpiration = false;\n\n    /**\n     * Must we embed signed headers?\n     *\n     * @var bool\n     */\n    protected $_debugHeaders = false;\n\n    // work variables\n    /**\n     * Headers used to generate hash.\n     *\n     * @var array\n     */\n    protected $_signedHeaders = array();\n\n    /**\n     * If debugHeaders is set store debugDatas here.\n     *\n     * @var string\n     */\n    private $_debugHeadersData = '';\n\n    /**\n     * Stores the bodyHash.\n     *\n     * @var string\n     */\n    private $_bodyHash = '';\n\n    /**\n     * Stores the signature header.\n     *\n     * @var Swift_Mime_Headers_ParameterizedHeader\n     */\n    protected $_dkimHeader;\n\n    private $_bodyHashHandler;\n\n    private $_headerHash;\n\n    private $_headerCanonData = '';\n\n    private $_bodyCanonEmptyCounter = 0;\n\n    private $_bodyCanonIgnoreStart = 2;\n\n    private $_bodyCanonSpace = false;\n\n    private $_bodyCanonLastChar = null;\n\n    private $_bodyCanonLine = '';\n\n    private $_bound = array();\n\n    /**\n     * Constructor.\n     *\n     * @param string $privateKey\n     * @param string $domainName\n     * @param string $selector\n     */\n    public function __construct($privateKey, $domainName, $selector) {\n        $this->_privateKey = $privateKey;\n        $this->_domainName = $domainName;\n        $this->_signerIdentity = '@'.$domainName;\n        $this->_selector = $selector;\n    }\n\n    /**\n     * Instanciate DKIMSigner.\n     *\n     * @param string $privateKey\n     * @param string $domainName\n     * @param string $selector\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public static function newInstance($privateKey, $domainName, $selector) {\n        return new static($privateKey, $domainName, $selector);\n    }\n\n    /**\n     * Reset the Signer.\n     *\n     * @see Swift_Signer::reset()\n     */\n    public function reset() {\n        $this->_headerHash = null;\n        $this->_signedHeaders = array();\n        $this->_bodyHash = null;\n        $this->_bodyHashHandler = null;\n        $this->_bodyCanonIgnoreStart = 2;\n        $this->_bodyCanonEmptyCounter = 0;\n        $this->_bodyCanonLastChar = null;\n        $this->_bodyCanonSpace = false;\n    }\n\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * Writing may not happen immediately if the stream chooses to buffer.  If\n     * you want to write these bytes with immediate effect, call {@link commit()}\n     * after calling write().\n     *\n     * This method returns the sequence ID of the write (i.e. 1 for first, 2 for\n     * second, etc etc).\n     *\n     * @param string $bytes\n     *\n     * @throws Swift_IoException\n     *\n     * @return int\n     */\n    public function write($bytes) {\n        $this->_canonicalizeBody($bytes);\n        foreach ($this->_bound as $is) {\n            $is->write($bytes);\n        }\n    }\n\n    /**\n     * For any bytes that are currently buffered inside the stream, force them\n     * off the buffer.\n     *\n     * @throws Swift_IoException\n     */\n    public function commit() {\n        // Nothing to do\n        return;\n    }\n\n    /**\n     * Attach $is to this stream.\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function bind(Swift_InputByteStream $is) {\n        // Don't have to mirror anything\n        $this->_bound[] = $is;\n\n        return;\n    }\n\n    /**\n     * Remove an already bound stream.\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     */\n    public function unbind(Swift_InputByteStream $is) {\n        // Don't have to mirror anything\n        foreach ($this->_bound as $k => $stream) {\n            if ($stream === $is) {\n                unset($this->_bound[$k]);\n\n                return;\n            }\n        }\n\n        return;\n    }\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     *\n     * @throws Swift_IoException\n     */\n    public function flushBuffers() {\n        $this->reset();\n    }\n\n    /**\n     * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.\n     *\n     * @param string $hash\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setHashAlgorithm($hash) {\n        // Unable to sign with rsa-sha256\n        if ($hash == 'rsa-sha1') {\n            $this->_hashAlgorithm = 'rsa-sha1';\n        } else {\n            $this->_hashAlgorithm = 'rsa-sha256';\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the body canonicalization algorithm.\n     *\n     * @param string $canon\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setBodyCanon($canon) {\n        if ($canon == 'relaxed') {\n            $this->_bodyCanon = 'relaxed';\n        } else {\n            $this->_bodyCanon = 'simple';\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the header canonicalization algorithm.\n     *\n     * @param string $canon\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setHeaderCanon($canon) {\n        if ($canon == 'relaxed') {\n            $this->_headerCanon = 'relaxed';\n        } else {\n            $this->_headerCanon = 'simple';\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the signer identity.\n     *\n     * @param string $identity\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setSignerIdentity($identity) {\n        $this->_signerIdentity = $identity;\n\n        return $this;\n    }\n\n    /**\n     * Set the length of the body to sign.\n     *\n     * @param mixed $len (bool or int)\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setBodySignedLen($len) {\n        if ($len === true) {\n            $this->_showLen = true;\n            $this->_maxLen = PHP_INT_MAX;\n        } elseif ($len === false) {\n            $this->_showLen = false;\n            $this->_maxLen = PHP_INT_MAX;\n        } else {\n            $this->_showLen = true;\n            $this->_maxLen = (int) $len;\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the signature timestamp.\n     *\n     * @param int $time A timestamp\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setSignatureTimestamp($time) {\n        $this->_signatureTimestamp = $time;\n\n        return $this;\n    }\n\n    /**\n     * Set the signature expiration timestamp.\n     *\n     * @param int $time A timestamp\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setSignatureExpiration($time) {\n        $this->_signatureExpiration = $time;\n\n        return $this;\n    }\n\n    /**\n     * Enable / disable the DebugHeaders.\n     *\n     * @param bool $debug\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setDebugHeaders($debug) {\n        $this->_debugHeaders = (bool) $debug;\n\n        return $this;\n    }\n\n    /**\n     * Start Body.\n     */\n    public function startBody() {\n        // Init\n        switch ($this->_hashAlgorithm) {\n            case 'rsa-sha256' :\n                $this->_bodyHashHandler = hash_init('sha256');\n                break;\n            case 'rsa-sha1' :\n                $this->_bodyHashHandler = hash_init('sha1');\n                break;\n        }\n        $this->_bodyCanonLine = '';\n    }\n\n    /**\n     * End Body.\n     */\n    public function endBody() {\n        $this->_endOfBody();\n    }\n\n    /**\n     * Returns the list of Headers Tampered by this plugin.\n     *\n     * @return array\n     */\n    public function getAlteredHeaders() {\n        if ($this->_debugHeaders) {\n            return array('DKIM-Signature', 'X-DebugHash');\n        } else {\n            return array('DKIM-Signature');\n        }\n    }\n\n    /**\n     * Adds an ignored Header.\n     *\n     * @param string $header_name\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function ignoreHeader($header_name) {\n        $this->_ignoredHeaders[strtolower($header_name)] = true;\n\n        return $this;\n    }\n\n    /**\n     * Set the headers to sign.\n     *\n     * @param Swift_Mime_HeaderSet $headers\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setHeaders(Swift_Mime_HeaderSet $headers) {\n        $this->_headerCanonData = '';\n        // Loop through Headers\n        $listHeaders = $headers->listAll();\n        foreach ($listHeaders as $hName) {\n            // Check if we need to ignore Header\n            if (!isset($this->_ignoredHeaders[strtolower($hName)])) {\n                if ($headers->has($hName)) {\n                    $tmp = $headers->getAll($hName);\n                    foreach ($tmp as $header) {\n                        if ($header->getFieldBody() != '') {\n                            $this->_addHeader($header->toString());\n                            $this->_signedHeaders[] = $header->getFieldName();\n                        }\n                    }\n                }\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * Add the signature to the given Headers.\n     *\n     * @param Swift_Mime_HeaderSet $headers\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function addSignature(Swift_Mime_HeaderSet $headers) {\n        // Prepare the DKIM-Signature\n        $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector);\n        if ($this->_bodyCanon != 'simple') {\n            $params['c'] = $this->_headerCanon.'/'.$this->_bodyCanon;\n        } elseif ($this->_headerCanon != 'simple') {\n            $params['c'] = $this->_headerCanon;\n        }\n        if ($this->_showLen) {\n            $params['l'] = $this->_bodyLen;\n        }\n        if ($this->_signatureTimestamp === true) {\n            $params['t'] = time();\n            if ($this->_signatureExpiration !== false) {\n                $params['x'] = $params['t'] + $this->_signatureExpiration;\n            }\n        } else {\n            if ($this->_signatureTimestamp !== false) {\n                $params['t'] = $this->_signatureTimestamp;\n            }\n            if ($this->_signatureExpiration !== false) {\n                $params['x'] = $this->_signatureExpiration;\n            }\n        }\n        if ($this->_debugHeaders) {\n            $params['z'] = implode('|', $this->_debugHeadersData);\n        }\n        $string = '';\n        foreach ($params as $k => $v) {\n            $string .= $k.'='.$v.'; ';\n        }\n        $string = trim($string);\n        $headers->addTextHeader('DKIM-Signature', $string);\n        // Add the last DKIM-Signature\n        $tmp = $headers->getAll('DKIM-Signature');\n        $this->_dkimHeader = end($tmp);\n        $this->_addHeader(trim($this->_dkimHeader->toString()).\"\\r\\n b=\", true);\n        $this->_endOfHeaders();\n        if ($this->_debugHeaders) {\n            $headers->addTextHeader('X-DebugHash', base64_encode($this->_headerHash));\n        }\n        $this->_dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' ')));\n\n        return $this;\n    }\n\n    /* Private helpers */\n\n    protected function _addHeader($header, $is_sig = false) {\n        switch ($this->_headerCanon) {\n            case 'relaxed' :\n                // Prepare Header and cascade\n                $exploded = explode(':', $header, 2);\n                $name = strtolower(trim($exploded[0]));\n                $value = str_replace(\"\\r\\n\", '', $exploded[1]);\n                $value = preg_replace(\"/[ \\t][ \\t]+/\", ' ', $value);\n                $header = $name.':'.trim($value).($is_sig ? '' : \"\\r\\n\");\n            case 'simple' :\n                // Nothing to do\n        }\n        $this->_addToHeaderHash($header);\n    }\n\n    /**\n     * @deprecated This method is currently useless in this class but it must be\n     *             kept for BC reasons due to its \"protected\" scope. This method\n     *             might be overriden by custom client code.\n     */\n    protected function _endOfHeaders() {\n    }\n\n    protected function _canonicalizeBody($string) {\n        $len = strlen($string);\n        $canon = '';\n        $method = ($this->_bodyCanon == 'relaxed');\n        for ($i = 0; $i < $len; ++$i) {\n            if ($this->_bodyCanonIgnoreStart > 0) {\n                --$this->_bodyCanonIgnoreStart;\n                continue;\n            }\n            switch ($string[$i]) {\n                case \"\\r\" :\n                    $this->_bodyCanonLastChar = \"\\r\";\n                    break;\n                case \"\\n\" :\n                    if ($this->_bodyCanonLastChar == \"\\r\") {\n                        if ($method) {\n                            $this->_bodyCanonSpace = false;\n                        }\n                        if ($this->_bodyCanonLine == '') {\n                            ++$this->_bodyCanonEmptyCounter;\n                        } else {\n                            $this->_bodyCanonLine = '';\n                            $canon .= \"\\r\\n\";\n                        }\n                    } else {\n                        // Wooops Error\n                        // todo handle it but should never happen\n                    }\n                    break;\n                case ' ' :\n                case \"\\t\" :\n                    if ($method) {\n                        $this->_bodyCanonSpace = true;\n                        break;\n                    }\n                default :\n                    if ($this->_bodyCanonEmptyCounter > 0) {\n                        $canon .= str_repeat(\"\\r\\n\", $this->_bodyCanonEmptyCounter);\n                        $this->_bodyCanonEmptyCounter = 0;\n                    }\n                    if ($this->_bodyCanonSpace) {\n                        $this->_bodyCanonLine .= ' ';\n                        $canon .= ' ';\n                        $this->_bodyCanonSpace = false;\n                    }\n                    $this->_bodyCanonLine .= $string[$i];\n                    $canon .= $string[$i];\n            }\n        }\n        $this->_addToBodyHash($canon);\n    }\n\n    protected function _endOfBody() {\n        // Add trailing Line return if last line is non empty\n        if (strlen($this->_bodyCanonLine) > 0) {\n            $this->_addToBodyHash(\"\\r\\n\");\n        }\n        $this->_bodyHash = hash_final($this->_bodyHashHandler, true);\n    }\n\n    private function _addToBodyHash($string) {\n        $len = strlen($string);\n        if ($len > ($new_len = ($this->_maxLen - $this->_bodyLen))) {\n            $string = substr($string, 0, $new_len);\n            $len = $new_len;\n        }\n        hash_update($this->_bodyHashHandler, $string);\n        $this->_bodyLen += $len;\n    }\n\n    private function _addToHeaderHash($header) {\n        if ($this->_debugHeaders) {\n            $this->_debugHeadersData[] = trim($header);\n        }\n        $this->_headerCanonData .= $header;\n    }\n\n    /**\n     * @throws Swift_SwiftException\n     *\n     * @return string\n     */\n    private function _getEncryptedHash() {\n        $signature = '';\n        switch ($this->_hashAlgorithm) {\n            case 'rsa-sha1':\n                $algorithm = OPENSSL_ALGO_SHA1;\n                break;\n            case 'rsa-sha256':\n                $algorithm = OPENSSL_ALGO_SHA256;\n                break;\n        }\n        $pkeyId = openssl_get_privatekey($this->_privateKey);\n        if (!$pkeyId) {\n            throw new Swift_SwiftException('Unable to load DKIM Private Key ['.openssl_error_string().']');\n        }\n        if (openssl_sign($this->_headerCanonData, $signature, $pkeyId, $algorithm)) {\n            return $signature;\n        }\n        throw new Swift_SwiftException('Unable to sign DKIM Hash ['.openssl_error_string().']');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * DomainKey Signer used to apply DomainKeys Signature to a message.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner{\n    /**\n     * PrivateKey.\n     *\n     * @var string\n     */\n    protected $_privateKey;\n\n    /**\n     * DomainName.\n     *\n     * @var string\n     */\n    protected $_domainName;\n\n    /**\n     * Selector.\n     *\n     * @var string\n     */\n    protected $_selector;\n\n    /**\n     * Hash algorithm used.\n     *\n     * @var string\n     */\n    protected $_hashAlgorithm = 'rsa-sha1';\n\n    /**\n     * Canonisation method.\n     *\n     * @var string\n     */\n    protected $_canon = 'simple';\n\n    /**\n     * Headers not being signed.\n     *\n     * @var array\n     */\n    protected $_ignoredHeaders = array();\n\n    /**\n     * Signer identity.\n     *\n     * @var string\n     */\n    protected $_signerIdentity;\n\n    /**\n     * Must we embed signed headers?\n     *\n     * @var bool\n     */\n    protected $_debugHeaders = false;\n\n    // work variables\n    /**\n     * Headers used to generate hash.\n     *\n     * @var array\n     */\n    private $_signedHeaders = array();\n\n    /**\n     * Stores the signature header.\n     *\n     * @var Swift_Mime_Headers_ParameterizedHeader\n     */\n    protected $_domainKeyHeader;\n\n    /**\n     * Hash Handler.\n     *\n     * @var resource|null\n     */\n    private $_hashHandler;\n\n    private $_hash;\n\n    private $_canonData = '';\n\n    private $_bodyCanonEmptyCounter = 0;\n\n    private $_bodyCanonIgnoreStart = 2;\n\n    private $_bodyCanonSpace = false;\n\n    private $_bodyCanonLastChar = null;\n\n    private $_bodyCanonLine = '';\n\n    private $_bound = array();\n\n    /**\n     * Constructor.\n     *\n     * @param string $privateKey\n     * @param string $domainName\n     * @param string $selector\n     */\n    public function __construct($privateKey, $domainName, $selector) {\n        $this->_privateKey = $privateKey;\n        $this->_domainName = $domainName;\n        $this->_signerIdentity = '@'.$domainName;\n        $this->_selector = $selector;\n    }\n\n    /**\n     * Instanciate DomainKeySigner.\n     *\n     * @param string $privateKey\n     * @param string $domainName\n     * @param string $selector\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public static function newInstance($privateKey, $domainName, $selector) {\n        return new static($privateKey, $domainName, $selector);\n    }\n\n    /**\n     * Resets internal states.\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function reset() {\n        $this->_hash = null;\n        $this->_hashHandler = null;\n        $this->_bodyCanonIgnoreStart = 2;\n        $this->_bodyCanonEmptyCounter = 0;\n        $this->_bodyCanonLastChar = null;\n        $this->_bodyCanonSpace = false;\n\n        return $this;\n    }\n\n    /**\n     * Writes $bytes to the end of the stream.\n     *\n     * Writing may not happen immediately if the stream chooses to buffer.  If\n     * you want to write these bytes with immediate effect, call {@link commit()}\n     * after calling write().\n     *\n     * This method returns the sequence ID of the write (i.e. 1 for first, 2 for\n     * second, etc etc).\n     *\n     * @param string $bytes\n     *\n     * @throws Swift_IoException\n     *\n     * @return int\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function write($bytes) {\n        $this->_canonicalizeBody($bytes);\n        foreach ($this->_bound as $is) {\n            $is->write($bytes);\n        }\n\n        return $this;\n    }\n\n    /**\n     * For any bytes that are currently buffered inside the stream, force them\n     * off the buffer.\n     *\n     * @throws Swift_IoException\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function commit() {\n        // Nothing to do\n        return $this;\n    }\n\n    /**\n     * Attach $is to this stream.\n     * The stream acts as an observer, receiving all data that is written.\n     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.\n     *\n     * @param Swift_InputByteStream $is\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function bind(Swift_InputByteStream $is) {\n        // Don't have to mirror anything\n        $this->_bound[] = $is;\n\n        return $this;\n    }\n\n    /**\n     * Remove an already bound stream.\n     * If $is is not bound, no errors will be raised.\n     * If the stream currently has any buffered data it will be written to $is\n     * before unbinding occurs.\n     *\n     * @param Swift_InputByteStream $is\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function unbind(Swift_InputByteStream $is) {\n        // Don't have to mirror anything\n        foreach ($this->_bound as $k => $stream) {\n            if ($stream === $is) {\n                unset($this->_bound[$k]);\n\n                return;\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * Flush the contents of the stream (empty it) and set the internal pointer\n     * to the beginning.\n     *\n     * @throws Swift_IoException\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function flushBuffers() {\n        $this->reset();\n\n        return $this;\n    }\n\n    /**\n     * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.\n     *\n     * @param string $hash\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function setHashAlgorithm($hash) {\n        $this->_hashAlgorithm = 'rsa-sha1';\n\n        return $this;\n    }\n\n    /**\n     * Set the canonicalization algorithm.\n     *\n     * @param string $canon simple | nofws defaults to simple\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function setCanon($canon) {\n        if ($canon == 'nofws') {\n            $this->_canon = 'nofws';\n        } else {\n            $this->_canon = 'simple';\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the signer identity.\n     *\n     * @param string $identity\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function setSignerIdentity($identity) {\n        $this->_signerIdentity = $identity;\n\n        return $this;\n    }\n\n    /**\n     * Enable / disable the DebugHeaders.\n     *\n     * @param bool $debug\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function setDebugHeaders($debug) {\n        $this->_debugHeaders = (bool) $debug;\n\n        return $this;\n    }\n\n    /**\n     * Start Body.\n     */\n    public function startBody() {\n    }\n\n    /**\n     * End Body.\n     */\n    public function endBody() {\n        $this->_endOfBody();\n    }\n\n    /**\n     * Returns the list of Headers Tampered by this plugin.\n     *\n     * @return array\n     */\n    public function getAlteredHeaders() {\n        if ($this->_debugHeaders) {\n            return array('DomainKey-Signature', 'X-DebugHash');\n        }\n\n        return array('DomainKey-Signature');\n    }\n\n    /**\n     * Adds an ignored Header.\n     *\n     * @param string $header_name\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function ignoreHeader($header_name) {\n        $this->_ignoredHeaders[strtolower($header_name)] = true;\n\n        return $this;\n    }\n\n    /**\n     * Set the headers to sign.\n     *\n     * @param Swift_Mime_HeaderSet $headers\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function setHeaders(Swift_Mime_HeaderSet $headers) {\n        $this->_startHash();\n        $this->_canonData = '';\n        // Loop through Headers\n        $listHeaders = $headers->listAll();\n        foreach ($listHeaders as $hName) {\n            // Check if we need to ignore Header\n            if (!isset($this->_ignoredHeaders[strtolower($hName)])) {\n                if ($headers->has($hName)) {\n                    $tmp = $headers->getAll($hName);\n                    foreach ($tmp as $header) {\n                        if ($header->getFieldBody() != '') {\n                            $this->_addHeader($header->toString());\n                            $this->_signedHeaders[] = $header->getFieldName();\n                        }\n                    }\n                }\n            }\n        }\n        $this->_endOfHeaders();\n\n        return $this;\n    }\n\n    /**\n     * Add the signature to the given Headers.\n     *\n     * @param Swift_Mime_HeaderSet $headers\n     *\n     * @return Swift_Signers_DomainKeySigner\n     */\n    public function addSignature(Swift_Mime_HeaderSet $headers) {\n        // Prepare the DomainKey-Signature Header\n        $params = array('a' => $this->_hashAlgorithm, 'b' => chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '), 'c' => $this->_canon, 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'q' => 'dns', 's' => $this->_selector);\n        $string = '';\n        foreach ($params as $k => $v) {\n            $string .= $k.'='.$v.'; ';\n        }\n        $string = trim($string);\n        $headers->addTextHeader('DomainKey-Signature', $string);\n\n        return $this;\n    }\n\n    /* Private helpers */\n\n    protected function _addHeader($header) {\n        switch ($this->_canon) {\n            case 'nofws' :\n                // Prepare Header and cascade\n                $exploded = explode(':', $header, 2);\n                $name = strtolower(trim($exploded[0]));\n                $value = str_replace(\"\\r\\n\", '', $exploded[1]);\n                $value = preg_replace(\"/[ \\t][ \\t]+/\", ' ', $value);\n                $header = $name.':'.trim($value).\"\\r\\n\";\n            case 'simple' :\n                // Nothing to do\n        }\n        $this->_addToHash($header);\n    }\n\n    protected function _endOfHeaders() {\n        $this->_bodyCanonEmptyCounter = 1;\n    }\n\n    protected function _canonicalizeBody($string) {\n        $len = strlen($string);\n        $canon = '';\n        $nofws = ($this->_canon == 'nofws');\n        for ($i = 0; $i < $len; ++$i) {\n            if ($this->_bodyCanonIgnoreStart > 0) {\n                --$this->_bodyCanonIgnoreStart;\n                continue;\n            }\n            switch ($string[$i]) {\n                case \"\\r\" :\n                    $this->_bodyCanonLastChar = \"\\r\";\n                    break;\n                case \"\\n\" :\n                    if ($this->_bodyCanonLastChar == \"\\r\") {\n                        if ($nofws) {\n                            $this->_bodyCanonSpace = false;\n                        }\n                        if ($this->_bodyCanonLine == '') {\n                            ++$this->_bodyCanonEmptyCounter;\n                        } else {\n                            $this->_bodyCanonLine = '';\n                            $canon .= \"\\r\\n\";\n                        }\n                    } else {\n                        // Wooops Error\n                        throw new Swift_SwiftException('Invalid new line sequence in mail found \\n without preceding \\r');\n                    }\n                    break;\n                case ' ' :\n                case \"\\t\" :\n                case \"\\x09\": //HTAB\n                    if ($nofws) {\n                        $this->_bodyCanonSpace = true;\n                        break;\n                    }\n                default :\n                    if ($this->_bodyCanonEmptyCounter > 0) {\n                        $canon .= str_repeat(\"\\r\\n\", $this->_bodyCanonEmptyCounter);\n                        $this->_bodyCanonEmptyCounter = 0;\n                    }\n                    $this->_bodyCanonLine .= $string[$i];\n                    $canon .= $string[$i];\n            }\n        }\n        $this->_addToHash($canon);\n    }\n\n    protected function _endOfBody() {\n        if (strlen($this->_bodyCanonLine) > 0) {\n            $this->_addToHash(\"\\r\\n\");\n        }\n        $this->_hash = hash_final($this->_hashHandler, true);\n    }\n\n    private function _addToHash($string) {\n        $this->_canonData .= $string;\n        hash_update($this->_hashHandler, $string);\n    }\n\n    private function _startHash() {\n        // Init\n        switch ($this->_hashAlgorithm) {\n            case 'rsa-sha1' :\n                $this->_hashHandler = hash_init('sha1');\n                break;\n        }\n        $this->_bodyCanonLine = '';\n    }\n\n    /**\n     * @throws Swift_SwiftException\n     *\n     * @return string\n     */\n    private function _getEncryptedHash() {\n        $signature = '';\n        $pkeyId = openssl_get_privatekey($this->_privateKey);\n        if (!$pkeyId) {\n            throw new Swift_SwiftException('Unable to load DomainKey Private Key ['.openssl_error_string().']');\n        }\n        if (openssl_sign($this->_canonData, $signature, $pkeyId, OPENSSL_ALGO_SHA1)) {\n            return $signature;\n        }\n        throw new Swift_SwiftException('Unable to sign DomainKey Hash  ['.openssl_error_string().']');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Header Signer Interface used to apply Header-Based Signature to a message.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\ninterface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream{\n    /**\n     * Exclude an header from the signed headers.\n     *\n     * @param string $header_name\n     *\n     * @return Swift_Signers_HeaderSigner\n     */\n    public function ignoreHeader($header_name);\n\n    /**\n     * Prepare the Signer to get a new Body.\n     *\n     * @return Swift_Signers_HeaderSigner\n     */\n    public function startBody();\n\n    /**\n     * Give the signal that the body has finished streaming.\n     *\n     * @return Swift_Signers_HeaderSigner\n     */\n    public function endBody();\n\n    /**\n     * Give the headers already given.\n     *\n     * @param Swift_Mime_SimpleHeaderSet $headers\n     *\n     * @return Swift_Signers_HeaderSigner\n     */\n    public function setHeaders(Swift_Mime_HeaderSet $headers);\n\n    /**\n     * Add the header(s) to the headerSet.\n     *\n     * @param Swift_Mime_HeaderSet $headers\n     *\n     * @return Swift_Signers_HeaderSigner\n     */\n    public function addSignature(Swift_Mime_HeaderSet $headers);\n\n    /**\n     * Return the list of header a signer might tamper.\n     *\n     * @return array\n     */\n    public function getAlteredHeaders();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * DKIM Signer used to apply DKIM Signature to a message\n * Takes advantage of pecl extension.\n *\n * @author Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner{\n    private $_peclLoaded = false;\n\n    private $_dkimHandler = null;\n\n    private $dropFirstLF = true;\n\n    const CANON_RELAXED = 1;\n    const CANON_SIMPLE = 2;\n    const SIG_RSA_SHA1 = 3;\n    const SIG_RSA_SHA256 = 4;\n\n    public function __construct($privateKey, $domainName, $selector) {\n        if (!extension_loaded('opendkim')) {\n            throw new Swift_SwiftException('php-opendkim extension not found');\n        }\n\n        $this->_peclLoaded = true;\n\n        parent::__construct($privateKey, $domainName, $selector);\n    }\n\n    public static function newInstance($privateKey, $domainName, $selector) {\n        return new static($privateKey, $domainName, $selector);\n    }\n\n    public function addSignature(Swift_Mime_HeaderSet $headers) {\n        $header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature');\n        $headerVal = $this->_dkimHandler->getSignatureHeader();\n        if (!$headerVal) {\n            throw new Swift_SwiftException('OpenDKIM Error: '.$this->_dkimHandler->getError());\n        }\n        $header->setValue($headerVal);\n        $headers->set($header);\n\n        return $this;\n    }\n\n    public function setHeaders(Swift_Mime_HeaderSet $headers) {\n        $bodyLen = $this->_bodyLen;\n        if (is_bool($bodyLen)) {\n            $bodyLen = -1;\n        }\n        $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;\n        $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;\n        $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;\n        $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);\n        // Hardcode signature Margin for now\n        $this->_dkimHandler->setMargin(78);\n\n        if (!is_numeric($this->_signatureTimestamp)) {\n            OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time());\n        } else {\n            if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->_signatureTimestamp)) {\n                throw new Swift_SwiftException('Unable to force signature timestamp ['.openssl_error_string().']');\n            }\n        }\n        if (isset($this->_signerIdentity)) {\n            $this->_dkimHandler->setSigner($this->_signerIdentity);\n        }\n        $listHeaders = $headers->listAll();\n        foreach ($listHeaders as $hName) {\n            // Check if we need to ignore Header\n            if (!isset($this->_ignoredHeaders[strtolower($hName)])) {\n                $tmp = $headers->getAll($hName);\n                if ($headers->has($hName)) {\n                    foreach ($tmp as $header) {\n                        if ($header->getFieldBody() != '') {\n                            $htosign = $header->toString();\n                            $this->_dkimHandler->header($htosign);\n                            $this->_signedHeaders[] = $header->getFieldName();\n                        }\n                    }\n                }\n            }\n        }\n\n        return $this;\n    }\n\n    public function startBody() {\n        if (!$this->_peclLoaded) {\n            return parent::startBody();\n        }\n        $this->dropFirstLF = true;\n        $this->_dkimHandler->eoh();\n\n        return $this;\n    }\n\n    public function endBody() {\n        if (!$this->_peclLoaded) {\n            return parent::endBody();\n        }\n        $this->_dkimHandler->eom();\n\n        return $this;\n    }\n\n    public function reset() {\n        $this->_dkimHandler = null;\n        parent::reset();\n\n        return $this;\n    }\n\n    /**\n     * Set the signature timestamp.\n     *\n     * @param int $time\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setSignatureTimestamp($time) {\n        $this->_signatureTimestamp = $time;\n\n        return $this;\n    }\n\n    /**\n     * Set the signature expiration timestamp.\n     *\n     * @param int $time\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setSignatureExpiration($time) {\n        $this->_signatureExpiration = $time;\n\n        return $this;\n    }\n\n    /**\n     * Enable / disable the DebugHeaders.\n     *\n     * @param bool $debug\n     *\n     * @return Swift_Signers_DKIMSigner\n     */\n    public function setDebugHeaders($debug) {\n        $this->_debugHeaders = (bool) $debug;\n\n        return $this;\n    }\n\n    // Protected\n\n    protected function _canonicalizeBody($string) {\n        if (!$this->_peclLoaded) {\n            return parent::_canonicalizeBody($string);\n        }\n        if (false && $this->dropFirstLF === true) {\n            if ($string[0] == \"\\r\" && $string[1] == \"\\n\") {\n                $string = substr($string, 2);\n            }\n        }\n        $this->dropFirstLF = false;\n        if (strlen($string)) {\n            $this->_dkimHandler->body($string);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * MIME Message Signer used to apply S/MIME Signature/Encryption to a message.\n *\n *\n * @author Romain-Geissler\n * @author Sebastiaan Stok <s.stok@rollerscapes.net>\n */\nclass Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner{\n    protected $signCertificate;\n    protected $signPrivateKey;\n    protected $encryptCert;\n    protected $signThenEncrypt = true;\n    protected $signLevel;\n    protected $encryptLevel;\n    protected $signOptions;\n    protected $encryptOptions;\n    protected $encryptCipher;\n    protected $extraCerts = null;\n\n    /**\n     * @var Swift_StreamFilters_StringReplacementFilterFactory\n     */\n    protected $replacementFactory;\n\n    /**\n     * @var Swift_Mime_HeaderFactory\n     */\n    protected $headerFactory;\n\n    /**\n     * Constructor.\n     *\n     * @param string|null $signCertificate\n     * @param string|null $signPrivateKey\n     * @param string|null $encryptCertificate\n     */\n    public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null) {\n        if (null !== $signPrivateKey) {\n            $this->setSignCertificate($signCertificate, $signPrivateKey);\n        }\n\n        if (null !== $encryptCertificate) {\n            $this->setEncryptCertificate($encryptCertificate);\n        }\n\n        $this->replacementFactory = Swift_DependencyContainer::getInstance()\n            ->lookup('transport.replacementfactory');\n\n        $this->signOptions = PKCS7_DETACHED;\n\n        // Supported since php5.4\n        if (defined('OPENSSL_CIPHER_AES_128_CBC')) {\n            $this->encryptCipher = OPENSSL_CIPHER_AES_128_CBC;\n        } else {\n            $this->encryptCipher = OPENSSL_CIPHER_RC2_128;\n        }\n    }\n\n    /**\n     * Returns an new Swift_Signers_SMimeSigner instance.\n     *\n     * @param string $certificate\n     * @param string $privateKey\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public static function newInstance($certificate = null, $privateKey = null) {\n        return new self($certificate, $privateKey);\n    }\n\n    /**\n     * Set the certificate location to use for signing.\n     *\n     * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php\n     *\n     * @param string       $certificate\n     * @param string|array $privateKey  If the key needs an passphrase use array('file-location', 'passphrase') instead\n     * @param int          $signOptions Bitwise operator options for openssl_pkcs7_sign()\n     * @param string       $extraCerts  A file containing intermediate certificates needed by the signing certificate\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) {\n        $this->signCertificate = 'file://'.str_replace('\\\\', '/', realpath($certificate));\n\n        if (null !== $privateKey) {\n            if (is_array($privateKey)) {\n                $this->signPrivateKey = $privateKey;\n                $this->signPrivateKey[0] = 'file://'.str_replace('\\\\', '/', realpath($privateKey[0]));\n            } else {\n                $this->signPrivateKey = 'file://'.str_replace('\\\\', '/', realpath($privateKey));\n            }\n        }\n\n        $this->signOptions = $signOptions;\n        if (null !== $extraCerts) {\n            $this->extraCerts = str_replace('\\\\', '/', realpath($extraCerts));\n        }\n\n        return $this;\n    }\n\n    /**\n     * Set the certificate location to use for encryption.\n     *\n     * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php\n     * @link http://nl3.php.net/manual/en/openssl.ciphers.php\n     *\n     * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates.\n     * @param int          $cipher\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public function setEncryptCertificate($recipientCerts, $cipher = null) {\n        if (is_array($recipientCerts)) {\n            $this->encryptCert = array();\n\n            foreach ($recipientCerts as $cert) {\n                $this->encryptCert[] = 'file://'.str_replace('\\\\', '/', realpath($cert));\n            }\n        } else {\n            $this->encryptCert = 'file://'.str_replace('\\\\', '/', realpath($recipientCerts));\n        }\n\n        if (null !== $cipher) {\n            $this->encryptCipher = $cipher;\n        }\n\n        return $this;\n    }\n\n    /**\n     * @return string\n     */\n    public function getSignCertificate() {\n        return $this->signCertificate;\n    }\n\n    /**\n     * @return string\n     */\n    public function getSignPrivateKey() {\n        return $this->signPrivateKey;\n    }\n\n    /**\n     * Set perform signing before encryption.\n     *\n     * The default is to first sign the message and then encrypt.\n     * But some older mail clients, namely Microsoft Outlook 2000 will work when the message first encrypted.\n     * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients.\n     *\n     * @param bool $signThenEncrypt\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public function setSignThenEncrypt($signThenEncrypt = true) {\n        $this->signThenEncrypt = $signThenEncrypt;\n\n        return $this;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isSignThenEncrypt() {\n        return $this->signThenEncrypt;\n    }\n\n    /**\n     * Resets internal states.\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public function reset() {\n        return $this;\n    }\n\n    /**\n     * Change the Swift_Message to apply the signing.\n     *\n     * @param Swift_Message $message\n     *\n     * @return Swift_Signers_SMimeSigner\n     */\n    public function signMessage(Swift_Message $message) {\n        if (null === $this->signCertificate && null === $this->encryptCert) {\n            return $this;\n        }\n\n        // Store the message using ByteStream to a file{1}\n        // Remove all Children\n        // Sign file{1}, parse the new MIME headers and set them on the primary MimeEntity\n        // Set the singed-body as the new body (without boundary)\n\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $this->toSMimeByteStream($messageStream, $message);\n        $message->setEncoder(Swift_DependencyContainer::getInstance()->lookup('mime.rawcontentencoder'));\n\n        $message->setChildren(array());\n        $this->streamToMime($messageStream, $message);\n    }\n\n    /**\n     * Return the list of header a signer might tamper.\n     *\n     * @return array\n     */\n    public function getAlteredHeaders() {\n        return array('Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition');\n    }\n\n    /**\n     * @param Swift_InputByteStream $inputStream\n     * @param Swift_Message         $mimeEntity\n     */\n    protected function toSMimeByteStream(Swift_InputByteStream $inputStream, Swift_Message $message) {\n        $mimeEntity = $this->createMessage($message);\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        $mimeEntity->toByteStream($messageStream);\n        $messageStream->commit();\n\n        if (null !== $this->signCertificate && null !== $this->encryptCert) {\n            $temporaryStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n            if ($this->signThenEncrypt) {\n                $this->messageStreamToSignedByteStream($messageStream, $temporaryStream);\n                $this->messageStreamToEncryptedByteStream($temporaryStream, $inputStream);\n            } else {\n                $this->messageStreamToEncryptedByteStream($messageStream, $temporaryStream);\n                $this->messageStreamToSignedByteStream($temporaryStream, $inputStream);\n            }\n        } elseif ($this->signCertificate !== null) {\n            $this->messageStreamToSignedByteStream($messageStream, $inputStream);\n        } else {\n            $this->messageStreamToEncryptedByteStream($messageStream, $inputStream);\n        }\n    }\n\n    /**\n     * @param Swift_Message $message\n     *\n     * @return Swift_Message\n     */\n    protected function createMessage(Swift_Message $message) {\n        $mimeEntity = new Swift_Message('', $message->getBody(), $message->getContentType(), $message->getCharset());\n        $mimeEntity->setChildren($message->getChildren());\n\n        $messageHeaders = $mimeEntity->getHeaders();\n        $messageHeaders->remove('Message-ID');\n        $messageHeaders->remove('Date');\n        $messageHeaders->remove('Subject');\n        $messageHeaders->remove('MIME-Version');\n        $messageHeaders->remove('To');\n        $messageHeaders->remove('From');\n\n        return $mimeEntity;\n    }\n\n    /**\n     * @param Swift_FileStream      $outputStream\n     * @param Swift_InputByteStream $inputStream\n     *\n     * @throws Swift_IoException\n     */\n    protected function messageStreamToSignedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $inputStream) {\n        $signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        $args = array($outputStream->getPath(), $signedMessageStream->getPath(), $this->signCertificate, $this->signPrivateKey, array(), $this->signOptions);\n        if (null !== $this->extraCerts) {\n            $args[] = $this->extraCerts;\n        }\n\n        if (!call_user_func_array('openssl_pkcs7_sign', $args)) {\n            throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: \"%s\".', openssl_error_string()));\n        }\n\n        $this->copyFromOpenSSLOutput($signedMessageStream, $inputStream);\n    }\n\n    /**\n     * @param Swift_FileStream      $outputStream\n     * @param Swift_InputByteStream $is\n     *\n     * @throws Swift_IoException\n     */\n    protected function messageStreamToEncryptedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $is) {\n        $encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_encrypt($outputStream->getPath(), $encryptedMessageStream->getPath(), $this->encryptCert, array(), 0, $this->encryptCipher)) {\n            throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: \"%s\".', openssl_error_string()));\n        }\n\n        $this->copyFromOpenSSLOutput($encryptedMessageStream, $is);\n    }\n\n    /**\n     * @param Swift_OutputByteStream $fromStream\n     * @param Swift_InputByteStream  $toStream\n     */\n    protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream) {\n        $bufferLength = 4096;\n        $filteredStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $filteredStream->addFilter($this->replacementFactory->createFilter(\"\\r\\n\", \"\\n\"), 'CRLF to LF');\n        $filteredStream->addFilter($this->replacementFactory->createFilter(\"\\n\", \"\\r\\n\"), 'LF to CRLF');\n\n        while (false !== ($buffer = $fromStream->read($bufferLength))) {\n            $filteredStream->write($buffer);\n        }\n\n        $filteredStream->flushBuffers();\n\n        while (false !== ($buffer = $filteredStream->read($bufferLength))) {\n            $toStream->write($buffer);\n        }\n\n        $toStream->commit();\n    }\n\n    /**\n     * Merges an OutputByteStream to Swift_Message.\n     *\n     * @param Swift_OutputByteStream $fromStream\n     * @param Swift_Message          $message\n     */\n    protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message) {\n        $bufferLength = 78;\n        $headerData = '';\n\n        $fromStream->setReadPointer(0);\n\n        while (($buffer = $fromStream->read($bufferLength)) !== false) {\n            $headerData .= $buffer;\n\n            if (false !== strpos($buffer, \"\\r\\n\\r\\n\")) {\n                break;\n            }\n        }\n\n        $headersPosEnd = strpos($headerData, \"\\r\\n\\r\\n\");\n        $headerData = trim($headerData);\n        $headerData = substr($headerData, 0, $headersPosEnd);\n        $headerLines = explode(\"\\r\\n\", $headerData);\n        unset($headerData);\n\n        $headers = array();\n        $currentHeaderName = '';\n\n        foreach ($headerLines as $headerLine) {\n            // Line separated\n            if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) {\n                $headers[$currentHeaderName] .= ' '.trim($headerLine);\n                continue;\n            }\n\n            $header = explode(':', $headerLine, 2);\n            $currentHeaderName = strtolower($header[0]);\n            $headers[$currentHeaderName] = trim($header[1]);\n        }\n\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $messageStream->addFilter($this->replacementFactory->createFilter(\"\\r\\n\", \"\\n\"), 'CRLF to LF');\n        $messageStream->addFilter($this->replacementFactory->createFilter(\"\\n\", \"\\r\\n\"), 'LF to CRLF');\n\n        $messageHeaders = $message->getHeaders();\n\n        // No need to check for 'application/pkcs7-mime', as this is always base64\n        if ('multipart/signed;' === substr($headers['content-type'], 0, 17)) {\n            if (!preg_match('/boundary=(\"[^\"]+\"|(?:[^\\s]+|$))/is', $headers['content-type'], $contentTypeData)) {\n                throw new Swift_SwiftException('Failed to find Boundary parameter');\n            }\n\n            $boundary = trim($contentTypeData['1'], '\"');\n\n            // Skip the header and CRLF CRLF\n            $fromStream->setReadPointer($headersPosEnd + 4);\n\n            while (false !== ($buffer = $fromStream->read($bufferLength))) {\n                $messageStream->write($buffer);\n            }\n\n            $messageStream->commit();\n\n            $messageHeaders->remove('Content-Transfer-Encoding');\n            $message->setContentType($headers['content-type']);\n            $message->setBoundary($boundary);\n            $message->setBody($messageStream);\n        } else {\n            $fromStream->setReadPointer($headersPosEnd + 4);\n\n            if (null === $this->headerFactory) {\n                $this->headerFactory = Swift_DependencyContainer::getInstance()->lookup('mime.headerfactory');\n            }\n\n            $message->setContentType($headers['content-type']);\n            $messageHeaders->set($this->headerFactory->createTextHeader('Content-Transfer-Encoding', $headers['content-transfer-encoding']));\n            $messageHeaders->set($this->headerFactory->createTextHeader('Content-Disposition', $headers['content-disposition']));\n\n            while (false !== ($buffer = $fromStream->read($bufferLength))) {\n                $messageStream->write($buffer);\n            }\n\n            $messageStream->commit();\n            $message->setBody($messageStream);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/SmtpTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages over SMTP with ESMTP support.\n *\n * @author Chris Corbyn\n *\n * @method Swift_SmtpTransport setUsername(string $username) Set the username to authenticate with.\n * @method string              getUsername()                 Get the username to authenticate with.\n * @method Swift_SmtpTransport setPassword(string $password) Set the password to authenticate with.\n * @method string              getPassword()                 Get the password to authenticate with.\n * @method Swift_SmtpTransport setAuthMode(string $mode)     Set the auth mode to use to authenticate.\n * @method string              getAuthMode()                 Get the auth mode to use to authenticate.\n */\nclass Swift_SmtpTransport extends Swift_Transport_EsmtpTransport{\n    /**\n     * Create a new SmtpTransport, optionally with $host, $port and $security.\n     *\n     * @param string $host\n     * @param int    $port\n     * @param string $security\n     */\n    public function __construct($host = 'localhost', $port = 25, $security = null) {\n        call_user_func_array(\n            array($this, 'Swift_Transport_EsmtpTransport::__construct'),\n            Swift_DependencyContainer::getInstance()\n                ->createDependenciesFor('transport.smtp')\n            );\n\n        $this->setHost($host);\n        $this->setPort($port);\n        $this->setEncryption($security);\n    }\n\n    /**\n     * Create a new SmtpTransport instance.\n     *\n     * @param string $host\n     * @param int    $port\n     * @param string $security\n     *\n     * @return Swift_SmtpTransport\n     */\n    public static function newInstance($host = 'localhost', $port = 25, $security = null) {\n        return new self($host, $port, $security);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Spool.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Interface for spools.\n *\n * @author Fabien Potencier\n */\ninterface Swift_Spool{\n    /**\n     * Starts this Spool mechanism.\n     */\n    public function start();\n\n    /**\n     * Stops this Spool mechanism.\n     */\n    public function stop();\n\n    /**\n     * Tests if this Spool mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted();\n\n    /**\n     * Queues a message.\n     *\n     * @param Swift_Mime_Message $message The message to store\n     *\n     * @return bool Whether the operation has succeeded\n     */\n    public function queueMessage(Swift_Mime_Message $message);\n\n    /**\n     * Sends messages using the given transport instance.\n     *\n     * @param Swift_Transport $transport        A transport instance\n     * @param string[]        $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of sent emails\n     */\n    public function flushQueue(Swift_Transport $transport, &$failedRecipients = null);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/SpoolTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Stores Messages in a queue.\n *\n * @author Fabien Potencier\n */\nclass Swift_SpoolTransport extends Swift_Transport_SpoolTransport{\n    /**\n     * Create a new SpoolTransport.\n     *\n     * @param Swift_Spool $spool\n     */\n    public function __construct(Swift_Spool $spool) {\n        $arguments = Swift_DependencyContainer::getInstance()\n            ->createDependenciesFor('transport.spool');\n\n        $arguments[] = $spool;\n\n        call_user_func_array(\n            array($this, 'Swift_Transport_SpoolTransport::__construct'),\n            $arguments\n        );\n    }\n\n    /**\n     * Create a new SpoolTransport instance.\n     *\n     * @param Swift_Spool $spool\n     *\n     * @return Swift_SpoolTransport\n     */\n    public static function newInstance(Swift_Spool $spool) {\n        return new self($spool);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/StreamFilter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Processes bytes as they pass through a stream and performs filtering.\n *\n * @author Chris Corbyn\n */\ninterface Swift_StreamFilter{\n    /**\n     * Based on the buffer given, this returns true if more buffering is needed.\n     *\n     * @param mixed $buffer\n     *\n     * @return bool\n     */\n    public function shouldBuffer($buffer);\n\n    /**\n     * Filters $buffer and returns the changes.\n     *\n     * @param mixed $buffer\n     *\n     * @return mixed\n     */\n    public function filter($buffer);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Processes bytes as they pass through a buffer and replaces sequences in it.\n *\n * This stream filter deals with Byte arrays rather than simple strings.\n *\n * @author Chris Corbyn\n */\nclass Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilter{\n    /** The needle(s) to search for */\n    private $_search;\n\n    /** The replacement(s) to make */\n    private $_replace;\n\n    /** The Index for searching */\n    private $_index;\n\n    /** The Search Tree */\n    private $_tree = array();\n\n    /**  Gives the size of the largest search */\n    private $_treeMaxLen = 0;\n\n    private $_repSize;\n\n    /**\n     * Create a new ByteArrayReplacementFilter with $search and $replace.\n     *\n     * @param array $search\n     * @param array $replace\n     */\n    public function __construct($search, $replace) {\n        $this->_search = $search;\n        $this->_index = array();\n        $this->_tree = array();\n        $this->_replace = array();\n        $this->_repSize = array();\n\n        $tree = null;\n        $i = null;\n        $last_size = $size = 0;\n        foreach ($search as $i => $search_element) {\n            if ($tree !== null) {\n                $tree[-1] = min(count($replace) - 1, $i - 1);\n                $tree[-2] = $last_size;\n            }\n            $tree = &$this->_tree;\n            if (is_array($search_element)) {\n                foreach ($search_element as $k => $char) {\n                    $this->_index[$char] = true;\n                    if (!isset($tree[$char])) {\n                        $tree[$char] = array();\n                    }\n                    $tree = &$tree[$char];\n                }\n                $last_size = $k + 1;\n                $size = max($size, $last_size);\n            } else {\n                $last_size = 1;\n                if (!isset($tree[$search_element])) {\n                    $tree[$search_element] = array();\n                }\n                $tree = &$tree[$search_element];\n                $size = max($last_size, $size);\n                $this->_index[$search_element] = true;\n            }\n        }\n        if ($i !== null) {\n            $tree[-1] = min(count($replace) - 1, $i);\n            $tree[-2] = $last_size;\n            $this->_treeMaxLen = $size;\n        }\n        foreach ($replace as $rep) {\n            if (!is_array($rep)) {\n                $rep = array($rep);\n            }\n            $this->_replace[] = $rep;\n        }\n        for ($i = count($this->_replace) - 1; $i >= 0; --$i) {\n            $this->_replace[$i] = $rep = $this->filter($this->_replace[$i], $i);\n            $this->_repSize[$i] = count($rep);\n        }\n    }\n\n    /**\n     * Returns true if based on the buffer passed more bytes should be buffered.\n     *\n     * @param array $buffer\n     *\n     * @return bool\n     */\n    public function shouldBuffer($buffer) {\n        $endOfBuffer = end($buffer);\n\n        return isset($this->_index[$endOfBuffer]);\n    }\n\n    /**\n     * Perform the actual replacements on $buffer and return the result.\n     *\n     * @param array $buffer\n     * @param int   $_minReplaces\n     *\n     * @return array\n     */\n    public function filter($buffer, $_minReplaces = -1) {\n        if ($this->_treeMaxLen == 0) {\n            return $buffer;\n        }\n\n        $newBuffer = array();\n        $buf_size = count($buffer);\n        for ($i = 0; $i < $buf_size; ++$i) {\n            $search_pos = $this->_tree;\n            $last_found = PHP_INT_MAX;\n            // We try to find if the next byte is part of a search pattern\n            for ($j = 0; $j <= $this->_treeMaxLen; ++$j) {\n                // We have a new byte for a search pattern\n                if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) {\n                    $search_pos = $search_pos[$buffer[$p]];\n                    // We have a complete pattern, save, in case we don't find a better match later\n                    if (isset($search_pos[-1]) && $search_pos[-1] < $last_found\n                        && $search_pos[-1] > $_minReplaces) {\n                        $last_found = $search_pos[-1];\n                        $last_size = $search_pos[-2];\n                    }\n                }\n                // We got a complete pattern\n                elseif ($last_found !== PHP_INT_MAX) {\n                    // Adding replacement datas to output buffer\n                    $rep_size = $this->_repSize[$last_found];\n                    for ($j = 0; $j < $rep_size; ++$j) {\n                        $newBuffer[] = $this->_replace[$last_found][$j];\n                    }\n                    // We Move cursor forward\n                    $i += $last_size - 1;\n                    // Edge Case, last position in buffer\n                    if ($i >= $buf_size) {\n                        $newBuffer[] = $buffer[$i];\n                    }\n\n                    // We start the next loop\n                    continue 2;\n                } else {\n                    // this byte is not in a pattern and we haven't found another pattern\n                    break;\n                }\n            }\n            // Normal byte, move it to output buffer\n            $newBuffer[] = $buffer[$i];\n        }\n\n        return $newBuffer;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Processes bytes as they pass through a buffer and replaces sequences in it.\n *\n * @author Chris Corbyn\n */\nclass Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter{\n    /** The needle(s) to search for */\n    private $_search;\n\n    /** The replacement(s) to make */\n    private $_replace;\n\n    /**\n     * Create a new StringReplacementFilter with $search and $replace.\n     *\n     * @param string|array $search\n     * @param string|array $replace\n     */\n    public function __construct($search, $replace) {\n        $this->_search = $search;\n        $this->_replace = $replace;\n    }\n\n    /**\n     * Returns true if based on the buffer passed more bytes should be buffered.\n     *\n     * @param string $buffer\n     *\n     * @return bool\n     */\n    public function shouldBuffer($buffer) {\n        $endOfBuffer = substr($buffer, -1);\n        foreach ((array) $this->_search as $needle) {\n            if (false !== strpos($needle, $endOfBuffer)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /**\n     * Perform the actual replacements on $buffer and return the result.\n     *\n     * @param string $buffer\n     *\n     * @return string\n     */\n    public function filter($buffer) {\n        return str_replace($this->_search, $this->_replace, $buffer);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Creates filters for replacing needles in a string buffer.\n *\n * @author Chris Corbyn\n */\nclass Swift_StreamFilters_StringReplacementFilterFactory implements Swift_ReplacementFilterFactory{\n    /** Lazy-loaded filters */\n    private $_filters = array();\n\n    /**\n     * Create a new StreamFilter to replace $search with $replace in a string.\n     *\n     * @param string $search\n     * @param string $replace\n     *\n     * @return Swift_StreamFilter\n     */\n    public function createFilter($search, $replace) {\n        if (!isset($this->_filters[$search][$replace])) {\n            if (!isset($this->_filters[$search])) {\n                $this->_filters[$search] = array();\n            }\n\n            if (!isset($this->_filters[$search][$replace])) {\n                $this->_filters[$search][$replace] = array();\n            }\n\n            $this->_filters[$search][$replace] = new Swift_StreamFilters_StringReplacementFilter($search, $replace);\n        }\n\n        return $this->_filters[$search][$replace];\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/SwiftException.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Base Exception class.\n *\n * @author Chris Corbyn\n */\nclass Swift_SwiftException extends Exception{\n    /**\n     * Create a new SwiftException with $message.\n     *\n     * @param string    $message\n     * @param int       $code\n     * @param Exception $previous\n     */\n    public function __construct($message, $code = 0, Exception $previous = null) {\n        parent::__construct($message, $code, $previous);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages over SMTP.\n *\n * @author Chris Corbyn\n */\nabstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport{\n    /** Input-Output buffer for sending/receiving SMTP commands and responses */\n    protected $_buffer;\n\n    /** Connection status */\n    protected $_started = false;\n\n    /** The domain name to use in HELO command */\n    protected $_domain = '[127.0.0.1]';\n\n    /** The event dispatching layer */\n    protected $_eventDispatcher;\n\n    /** Source Ip */\n    protected $_sourceIp;\n\n    /** Return an array of params for the Buffer */\n    abstract protected function _getBufferParams();\n\n    /**\n     * Creates a new EsmtpTransport using the given I/O buffer.\n     *\n     * @param Swift_Transport_IoBuffer     $buf\n     * @param Swift_Events_EventDispatcher $dispatcher\n     */\n    public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher) {\n        $this->_eventDispatcher = $dispatcher;\n        $this->_buffer = $buf;\n        $this->_lookupHostname();\n    }\n\n    /**\n     * Set the name of the local domain which Swift will identify itself as.\n     *\n     * This should be a fully-qualified domain name and should be truly the domain\n     * you're using.\n     *\n     * If your server doesn't have a domain name, use the IP in square\n     * brackets (i.e. [127.0.0.1]).\n     *\n     * @param string $domain\n     *\n     * @return Swift_Transport_AbstractSmtpTransport\n     */\n    public function setLocalDomain($domain) {\n        $this->_domain = $domain;\n\n        return $this;\n    }\n\n    /**\n     * Get the name of the domain Swift will identify as.\n     *\n     * @return string\n     */\n    public function getLocalDomain() {\n        return $this->_domain;\n    }\n\n    /**\n     * Sets the source IP.\n     *\n     * @param string $source\n     */\n    public function setSourceIp($source) {\n        $this->_sourceIp = $source;\n    }\n\n    /**\n     * Returns the IP used to connect to the destination.\n     *\n     * @return string\n     */\n    public function getSourceIp() {\n        return $this->_sourceIp;\n    }\n\n    /**\n     * Start the SMTP connection.\n     */\n    public function start() {\n        if (!$this->_started) {\n            if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {\n                $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');\n                if ($evt->bubbleCancelled()) {\n                    return;\n                }\n            }\n\n            try {\n                $this->_buffer->initialize($this->_getBufferParams());\n            } catch (Swift_TransportException $e) {\n                $this->_throwException($e);\n            }\n            $this->_readGreeting();\n            $this->_doHeloCommand();\n\n            if ($evt) {\n                $this->_eventDispatcher->dispatchEvent($evt, 'transportStarted');\n            }\n\n            $this->_started = true;\n        }\n    }\n\n    /**\n     * Test if an SMTP connection has been established.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return $this->_started;\n    }\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     * The return value is the number of recipients who were accepted for delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $sent = 0;\n        $failedRecipients = (array) $failedRecipients;\n\n        if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');\n            if ($evt->bubbleCancelled()) {\n                return 0;\n            }\n        }\n\n        if (!$reversePath = $this->_getReversePath($message)) {\n            $this->_throwException(new Swift_TransportException(\n                'Cannot send message without a sender address'\n                )\n            );\n        }\n\n        $to = (array) $message->getTo();\n        $cc = (array) $message->getCc();\n        $tos = array_merge($to, $cc);\n        $bcc = (array) $message->getBcc();\n\n        $message->setBcc(array());\n\n        try {\n            $sent += $this->_sendTo($message, $reversePath, $tos, $failedRecipients);\n            $sent += $this->_sendBcc($message, $reversePath, $bcc, $failedRecipients);\n        } catch (Exception $e) {\n            $message->setBcc($bcc);\n            throw $e;\n        }\n\n        $message->setBcc($bcc);\n\n        if ($evt) {\n            if ($sent == count($to) + count($cc) + count($bcc)) {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);\n            } elseif ($sent > 0) {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_TENTATIVE);\n            } else {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_FAILED);\n            }\n            $evt->setFailedRecipients($failedRecipients);\n            $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n        }\n\n        $message->generateId(); //Make sure a new Message ID is used\n\n        return $sent;\n    }\n\n    /**\n     * Stop the SMTP connection.\n     */\n    public function stop() {\n        if ($this->_started) {\n            if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {\n                $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');\n                if ($evt->bubbleCancelled()) {\n                    return;\n                }\n            }\n\n            try {\n                $this->executeCommand(\"QUIT\\r\\n\", array(221));\n            } catch (Swift_TransportException $e) {\n            }\n\n            try {\n                $this->_buffer->terminate();\n\n                if ($evt) {\n                    $this->_eventDispatcher->dispatchEvent($evt, 'transportStopped');\n                }\n            } catch (Swift_TransportException $e) {\n                $this->_throwException($e);\n            }\n        }\n        $this->_started = false;\n    }\n\n    /**\n     * Register a plugin.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        $this->_eventDispatcher->bindEventListener($plugin);\n    }\n\n    /**\n     * Reset the current mail transaction.\n     */\n    public function reset() {\n        $this->executeCommand(\"RSET\\r\\n\", array(250));\n    }\n\n    /**\n     * Get the IoBuffer where read/writes are occurring.\n     *\n     * @return Swift_Transport_IoBuffer\n     */\n    public function getBuffer() {\n        return $this->_buffer;\n    }\n\n    /**\n     * Run a command against the buffer, expecting the given response codes.\n     *\n     * If no response codes are given, the response will not be validated.\n     * If codes are given, an exception will be thrown on an invalid response.\n     *\n     * @param string   $command\n     * @param int[]    $codes\n     * @param string[] $failures An array of failures by-reference\n     *\n     * @return string\n     */\n    public function executeCommand($command, $codes = array(), &$failures = null) {\n        $failures = (array) $failures;\n        $seq = $this->_buffer->write($command);\n        $response = $this->_getFullResponse($seq);\n        if ($evt = $this->_eventDispatcher->createCommandEvent($this, $command, $codes)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'commandSent');\n        }\n        $this->_assertResponseCode($response, $codes);\n\n        return $response;\n    }\n\n    /** Read the opening SMTP greeting */\n    protected function _readGreeting() {\n        $this->_assertResponseCode($this->_getFullResponse(0), array(220));\n    }\n\n    /** Send the HELO welcome */\n    protected function _doHeloCommand() {\n        $this->executeCommand(\n            sprintf(\"HELO %s\\r\\n\", $this->_domain), array(250)\n            );\n    }\n\n    /** Send the MAIL FROM command */\n    protected function _doMailFromCommand($address) {\n        $this->executeCommand(\n            sprintf(\"MAIL FROM:<%s>\\r\\n\", $address), array(250)\n            );\n    }\n\n    /** Send the RCPT TO command */\n    protected function _doRcptToCommand($address) {\n        $this->executeCommand(\n            sprintf(\"RCPT TO:<%s>\\r\\n\", $address), array(250, 251, 252)\n            );\n    }\n\n    /** Send the DATA command */\n    protected function _doDataCommand() {\n        $this->executeCommand(\"DATA\\r\\n\", array(354));\n    }\n\n    /** Stream the contents of the message over the buffer */\n    protected function _streamMessage(Swift_Mime_Message $message) {\n        $this->_buffer->setWriteTranslations(array(\"\\r\\n.\" => \"\\r\\n..\"));\n        try {\n            $message->toByteStream($this->_buffer);\n            $this->_buffer->flushBuffers();\n        } catch (Swift_TransportException $e) {\n            $this->_throwException($e);\n        }\n        $this->_buffer->setWriteTranslations(array());\n        $this->executeCommand(\"\\r\\n.\\r\\n\", array(250));\n    }\n\n    /** Determine the best-use reverse path for this message */\n    protected function _getReversePath(Swift_Mime_Message $message) {\n        $return = $message->getReturnPath();\n        $sender = $message->getSender();\n        $from = $message->getFrom();\n        $path = null;\n        if (!empty($return)) {\n            $path = $return;\n        } elseif (!empty($sender)) {\n            // Don't use array_keys\n            reset($sender); // Reset Pointer to first pos\n            $path = key($sender); // Get key\n        } elseif (!empty($from)) {\n            reset($from); // Reset Pointer to first pos\n            $path = key($from); // Get key\n        }\n\n        return $path;\n    }\n\n    /** Throw a TransportException, first sending it to any listeners */\n    protected function _throwException(Swift_TransportException $e) {\n        if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown');\n            if (!$evt->bubbleCancelled()) {\n                throw $e;\n            }\n        } else {\n            throw $e;\n        }\n    }\n\n    /** Throws an Exception if a response code is incorrect */\n    protected function _assertResponseCode($response, $wanted) {\n        list($code) = sscanf($response, '%3d');\n        $valid = (empty($wanted) || in_array($code, $wanted));\n\n        if ($evt = $this->_eventDispatcher->createResponseEvent($this, $response,\n            $valid)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'responseReceived');\n        }\n\n        if (!$valid) {\n            $this->_throwException(\n                new Swift_TransportException(\n                    'Expected response code '.implode('/', $wanted).' but got code '.\n                    '\"'.$code.'\", with message \"'.$response.'\"',\n                    $code)\n                );\n        }\n    }\n\n    /** Get an entire multi-line response using its sequence number */\n    protected function _getFullResponse($seq) {\n        $response = '';\n        try {\n            do {\n                $line = $this->_buffer->readLine($seq);\n                $response .= $line;\n            } while (null !== $line && false !== $line && ' ' != $line{3});\n        } catch (Swift_TransportException $e) {\n            $this->_throwException($e);\n        } catch (Swift_IoException $e) {\n            $this->_throwException(\n                new Swift_TransportException(\n                    $e->getMessage())\n                );\n        }\n\n        return $response;\n    }\n\n    /** Send an email to the given recipients from the given reverse path */\n    private function _doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients) {\n        $sent = 0;\n        $this->_doMailFromCommand($reversePath);\n        foreach ($recipients as $forwardPath) {\n            try {\n                $this->_doRcptToCommand($forwardPath);\n                ++$sent;\n            } catch (Swift_TransportException $e) {\n                $failedRecipients[] = $forwardPath;\n            }\n        }\n\n        if ($sent != 0) {\n            $this->_doDataCommand();\n            $this->_streamMessage($message);\n        } else {\n            $this->reset();\n        }\n\n        return $sent;\n    }\n\n    /** Send a message to the given To: recipients */\n    private function _sendTo(Swift_Mime_Message $message, $reversePath, array $to, array &$failedRecipients) {\n        if (empty($to)) {\n            return 0;\n        }\n\n        return $this->_doMailTransaction($message, $reversePath, array_keys($to),\n            $failedRecipients);\n    }\n\n    /** Send a message to all Bcc: recipients */\n    private function _sendBcc(Swift_Mime_Message $message, $reversePath, array $bcc, array &$failedRecipients) {\n        $sent = 0;\n        foreach ($bcc as $forwardPath => $name) {\n            $message->setBcc(array($forwardPath => $name));\n            $sent += $this->_doMailTransaction(\n                $message, $reversePath, array($forwardPath), $failedRecipients\n                );\n        }\n\n        return $sent;\n    }\n\n    /** Try to determine the hostname of the server this is run on */\n    private function _lookupHostname() {\n        if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) {\n            $this->_domain = $_SERVER['SERVER_NAME'];\n        } elseif (!empty($_SERVER['SERVER_ADDR'])) {\n            // Set the address literal tag (See RFC 5321, section: 4.1.3)\n            if (false === strpos($_SERVER['SERVER_ADDR'], ':')) {\n                $prefix = ''; // IPv4 addresses are not tagged.\n            } else {\n                $prefix = 'IPv6:'; // Adding prefix in case of IPv6.\n            }\n\n            $this->_domain = sprintf('[%s%s]', $prefix, $_SERVER['SERVER_ADDR']);\n        }\n    }\n\n    /** Determine is the $hostname is a fully-qualified name */\n    private function _isFqdn($hostname) {\n        // We could do a really thorough check, but there's really no point\n        if (false !== $dotPos = strpos($hostname, '.')) {\n            return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1);\n        }\n\n        return false;\n    }\n\n    /**\n     * Destructor.\n     */\n    public function __destruct() {\n        $this->stop();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles CRAM-MD5 authentication.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_Esmtp_Auth_CramMd5Authenticator implements Swift_Transport_Esmtp_Authenticator{\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword() {\n        return 'CRAM-MD5';\n    }\n\n    /**\n     * Try to authenticate the user with $username and $password.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $username\n     * @param string                    $password\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) {\n        try {\n            $challenge = $agent->executeCommand(\"AUTH CRAM-MD5\\r\\n\", array(334));\n            $challenge = base64_decode(substr($challenge, 4));\n            $message = base64_encode(\n                $username.' '.$this->_getResponse($password, $challenge)\n                );\n            $agent->executeCommand(sprintf(\"%s\\r\\n\", $message), array(235));\n\n            return true;\n        } catch (Swift_TransportException $e) {\n            $agent->executeCommand(\"RSET\\r\\n\", array(250));\n\n            return false;\n        }\n    }\n\n    /**\n     * Generate a CRAM-MD5 response from a server challenge.\n     *\n     * @param string $secret\n     * @param string $challenge\n     *\n     * @return string\n     */\n    private function _getResponse($secret, $challenge) {\n        if (strlen($secret) > 64) {\n            $secret = pack('H32', md5($secret));\n        }\n\n        if (strlen($secret) < 64) {\n            $secret = str_pad($secret, 64, chr(0));\n        }\n\n        $k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);\n        $k_opad = substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64);\n\n        $inner = pack('H32', md5($k_ipad.$challenge));\n        $digest = md5($k_opad.$inner);\n\n        return $digest;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles LOGIN authentication.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_Esmtp_Auth_LoginAuthenticator implements Swift_Transport_Esmtp_Authenticator{\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword() {\n        return 'LOGIN';\n    }\n\n    /**\n     * Try to authenticate the user with $username and $password.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $username\n     * @param string                    $password\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) {\n        try {\n            $agent->executeCommand(\"AUTH LOGIN\\r\\n\", array(334));\n            $agent->executeCommand(sprintf(\"%s\\r\\n\", base64_encode($username)), array(334));\n            $agent->executeCommand(sprintf(\"%s\\r\\n\", base64_encode($password)), array(235));\n\n            return true;\n        } catch (Swift_TransportException $e) {\n            $agent->executeCommand(\"RSET\\r\\n\", array(250));\n\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * This authentication is for Exchange servers. We support version 1 & 2.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles NTLM authentication.\n *\n * @author Ward Peeters <ward@coding-tech.com>\n */\nclass Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Esmtp_Authenticator{\n    const NTLMSIG = \"NTLMSSP\\x00\";\n    const DESCONST = 'KGS!@#$%';\n\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword() {\n        return 'NTLM';\n    }\n\n    /**\n     * Try to authenticate the user with $username and $password.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $username\n     * @param string                    $password\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) {\n        if (!function_exists('mcrypt_module_open')) {\n            throw new LogicException('The mcrypt functions need to be enabled to use the NTLM authenticator.');\n        }\n\n        if (!function_exists('openssl_random_pseudo_bytes')) {\n            throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.');\n        }\n\n        if (!function_exists('bcmul')) {\n            throw new LogicException('The BCMatch functions must be enabled to use the NTLM authenticator.');\n        }\n\n        try {\n            // execute AUTH command and filter out the code at the beginning\n            // AUTH NTLM xxxx\n            $response = base64_decode(substr(trim($this->sendMessage1($agent)), 4));\n\n            // extra parameters for our unit cases\n            $timestamp = func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000'));\n            $client = func_num_args() > 4 ? func_get_arg(4) : $this->getRandomBytes(8);\n\n            // Message 3 response\n            $this->sendMessage3($response, $username, $password, $timestamp, $client, $agent);\n\n            return true;\n        } catch (Swift_TransportException $e) {\n            $agent->executeCommand(\"RSET\\r\\n\", array(250));\n\n            return false;\n        }\n    }\n\n    protected function si2bin($si, $bits = 32) {\n        $bin = null;\n        if ($si >= -pow(2, $bits - 1) && ($si <= pow(2, $bits - 1))) {\n            // positive or zero\n            if ($si >= 0) {\n                $bin = base_convert($si, 10, 2);\n                // pad to $bits bit\n                $bin_length = strlen($bin);\n                if ($bin_length < $bits) {\n                    $bin = str_repeat('0', $bits - $bin_length).$bin;\n                }\n            } else {\n                // negative\n                $si = -$si - pow(2, $bits);\n                $bin = base_convert($si, 10, 2);\n                $bin_length = strlen($bin);\n                if ($bin_length > $bits) {\n                    $bin = str_repeat('1', $bits - $bin_length).$bin;\n                }\n            }\n        }\n\n        return $bin;\n    }\n\n    /**\n     * Send our auth message and returns the response.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     *\n     * @return string SMTP Response\n     */\n    protected function sendMessage1(Swift_Transport_SmtpAgent $agent) {\n        $message = $this->createMessage1();\n\n        return $agent->executeCommand(sprintf(\"AUTH %s %s\\r\\n\", $this->getAuthKeyword(), base64_encode($message)), array(334));\n    }\n\n    /**\n     * Fetch all details of our response (message 2).\n     *\n     * @param string $response\n     *\n     * @return array our response parsed\n     */\n    protected function parseMessage2($response) {\n        $responseHex = bin2hex($response);\n        $length = floor(hexdec(substr($responseHex, 28, 4)) / 256) * 2;\n        $offset = floor(hexdec(substr($responseHex, 32, 4)) / 256) * 2;\n        $challenge = $this->hex2bin(substr($responseHex, 48, 16));\n        $context = $this->hex2bin(substr($responseHex, 64, 16));\n        $targetInfoH = $this->hex2bin(substr($responseHex, 80, 16));\n        $targetName = $this->hex2bin(substr($responseHex, $offset, $length));\n        $offset = floor(hexdec(substr($responseHex, 88, 4)) / 256) * 2;\n        $targetInfoBlock = substr($responseHex, $offset);\n        list($domainName, $serverName, $DNSDomainName, $DNSServerName, $terminatorByte) = $this->readSubBlock($targetInfoBlock);\n\n        return array(\n            $challenge,\n            $context,\n            $targetInfoH,\n            $targetName,\n            $domainName,\n            $serverName,\n            $DNSDomainName,\n            $DNSServerName,\n            $this->hex2bin($targetInfoBlock),\n            $terminatorByte,\n        );\n    }\n\n    /**\n     * Read the blob information in from message2.\n     *\n     * @param $block\n     *\n     * @return array\n     */\n    protected function readSubBlock($block) {\n        // remove terminatorByte cause it's always the same\n        $block = substr($block, 0, -8);\n\n        $length = strlen($block);\n        $offset = 0;\n        $data = array();\n        while ($offset < $length) {\n            $blockLength = hexdec(substr(substr($block, $offset, 8), -4)) / 256;\n            $offset += 8;\n            $data[] = $this->hex2bin(substr($block, $offset, $blockLength * 2));\n            $offset += $blockLength * 2;\n        }\n\n        if (count($data) == 3) {\n            $data[] = $data[2];\n            $data[2] = '';\n        }\n\n        $data[] = $this->createByte('00');\n\n        return $data;\n    }\n\n    /**\n     * Send our final message with all our data.\n     *\n     * @param string                    $response  Message 1 response (message 2)\n     * @param string                    $username\n     * @param string                    $password\n     * @param string                    $timestamp\n     * @param string                    $client\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param bool                      $v2        Use version2 of the protocol\n     *\n     * @return string\n     */\n    protected function sendMessage3($response, $username, $password, $timestamp, $client, Swift_Transport_SmtpAgent $agent, $v2 = true) {\n        list($domain, $username) = $this->getDomainAndUsername($username);\n        //$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSServerName, $blob, $ter\n        list($challenge, , , , , $workstation, , , $blob) = $this->parseMessage2($response);\n\n        if (!$v2) {\n            // LMv1\n            $lmResponse = $this->createLMPassword($password, $challenge);\n            // NTLMv1\n            $ntlmResponse = $this->createNTLMPassword($password, $challenge);\n        } else {\n            // LMv2\n            $lmResponse = $this->createLMv2Password($password, $username, $domain, $challenge, $client);\n            // NTLMv2\n            $ntlmResponse = $this->createNTLMv2Hash($password, $username, $domain, $challenge, $blob, $timestamp, $client);\n        }\n\n        $message = $this->createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse);\n\n        return $agent->executeCommand(sprintf(\"%s\\r\\n\", base64_encode($message)), array(235));\n    }\n\n    /**\n     * Create our message 1.\n     *\n     * @return string\n     */\n    protected function createMessage1() {\n        return self::NTLMSIG\n        .$this->createByte('01') // Message 1\n.$this->createByte('0702'); // Flags\n    }\n\n    /**\n     * Create our message 3.\n     *\n     * @param string $domain\n     * @param string $username\n     * @param string $workstation\n     * @param string $lmResponse\n     * @param string $ntlmResponse\n     *\n     * @return string\n     */\n    protected function createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse) {\n        // Create security buffers\n        $domainSec = $this->createSecurityBuffer($domain, 64);\n        $domainInfo = $this->readSecurityBuffer(bin2hex($domainSec));\n        $userSec = $this->createSecurityBuffer($username, ($domainInfo[0] + $domainInfo[1]) / 2);\n        $userInfo = $this->readSecurityBuffer(bin2hex($userSec));\n        $workSec = $this->createSecurityBuffer($workstation, ($userInfo[0] + $userInfo[1]) / 2);\n        $workInfo = $this->readSecurityBuffer(bin2hex($workSec));\n        $lmSec = $this->createSecurityBuffer($lmResponse, ($workInfo[0] + $workInfo[1]) / 2, true);\n        $lmInfo = $this->readSecurityBuffer(bin2hex($lmSec));\n        $ntlmSec = $this->createSecurityBuffer($ntlmResponse, ($lmInfo[0] + $lmInfo[1]) / 2, true);\n\n        return self::NTLMSIG\n        .$this->createByte('03') // TYPE 3 message\n.$lmSec // LM response header\n.$ntlmSec // NTLM response header\n.$domainSec // Domain header\n.$userSec // User header\n.$workSec // Workstation header\n.$this->createByte('000000009a', 8) // session key header (empty)\n.$this->createByte('01020000') // FLAGS\n.$this->convertTo16bit($domain) // domain name\n.$this->convertTo16bit($username) // username\n.$this->convertTo16bit($workstation) // workstation\n.$lmResponse\n        .$ntlmResponse;\n    }\n\n    /**\n     * @param string $timestamp  Epoch timestamp in microseconds\n     * @param string $client     Random bytes\n     * @param string $targetInfo\n     *\n     * @return string\n     */\n    protected function createBlob($timestamp, $client, $targetInfo) {\n        return $this->createByte('0101')\n        .$this->createByte('00')\n        .$timestamp\n        .$client\n        .$this->createByte('00')\n        .$targetInfo\n        .$this->createByte('00');\n    }\n\n    /**\n     * Get domain and username from our username.\n     *\n     * @example DOMAIN\\username\n     *\n     * @param string $name\n     *\n     * @return array\n     */\n    protected function getDomainAndUsername($name) {\n        if (strpos($name, '\\\\') !== false) {\n            return explode('\\\\', $name);\n        }\n\n        list($user, $domain) = explode('@', $name);\n\n        return array($domain, $user);\n    }\n\n    /**\n     * Create LMv1 response.\n     *\n     * @param string $password\n     * @param string $challenge\n     *\n     * @return string\n     */\n    protected function createLMPassword($password, $challenge) {\n        // FIRST PART\n        $password = $this->createByte(strtoupper($password), 14, false);\n        list($key1, $key2) = str_split($password, 7);\n\n        $desKey1 = $this->createDesKey($key1);\n        $desKey2 = $this->createDesKey($key2);\n\n        $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1).$this->desEncrypt(self::DESCONST, $desKey2), 21, false);\n\n        // SECOND PART\n        list($key1, $key2, $key3) = str_split($constantDecrypt, 7);\n\n        $desKey1 = $this->createDesKey($key1);\n        $desKey2 = $this->createDesKey($key2);\n        $desKey3 = $this->createDesKey($key3);\n\n        return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3);\n    }\n\n    /**\n     * Create NTLMv1 response.\n     *\n     * @param string $password\n     * @param string $challenge\n     *\n     * @return string\n     */\n    protected function createNTLMPassword($password, $challenge) {\n        // FIRST PART\n        $ntlmHash = $this->createByte($this->md4Encrypt($password), 21, false);\n        list($key1, $key2, $key3) = str_split($ntlmHash, 7);\n\n        $desKey1 = $this->createDesKey($key1);\n        $desKey2 = $this->createDesKey($key2);\n        $desKey3 = $this->createDesKey($key3);\n\n        return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3);\n    }\n\n    /**\n     * Convert a normal timestamp to a tenth of a microtime epoch time.\n     *\n     * @param string $time\n     *\n     * @return string\n     */\n    protected function getCorrectTimestamp($time) {\n        // Get our timestamp (tricky!)\n        bcscale(0);\n\n        $time = number_format($time, 0, '.', ''); // save microtime to string\n        $time = bcadd($time, '11644473600000'); // add epoch time\n        $time = bcmul($time, 10000); // tenths of a microsecond.\n\n        $binary = $this->si2bin($time, 64); // create 64 bit binary string\n        $timestamp = '';\n        for ($i = 0; $i < 8; ++$i) {\n            $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8)));\n        }\n\n        return $timestamp;\n    }\n\n    /**\n     * Create LMv2 response.\n     *\n     * @param string $password\n     * @param string $username\n     * @param string $domain\n     * @param string $challenge NTLM Challenge\n     * @param string $client    Random string\n     *\n     * @return string\n     */\n    protected function createLMv2Password($password, $username, $domain, $challenge, $client) {\n        $lmPass = '00'; // by default 00\n        // if $password > 15 than we can't use this method\n        if (strlen($password) <= 15) {\n            $ntlmHash = $this->md4Encrypt($password);\n            $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain));\n\n            $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge.$client).$client);\n        }\n\n        return $this->createByte($lmPass, 24);\n    }\n\n    /**\n     * Create NTLMv2 response.\n     *\n     * @param string $password\n     * @param string $username\n     * @param string $domain\n     * @param string $challenge  Hex values\n     * @param string $targetInfo Hex values\n     * @param string $timestamp\n     * @param string $client     Random bytes\n     *\n     * @return string\n     *\n     * @see http://davenport.sourceforge.net/ntlm.html#theNtlmResponse\n     */\n    protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client) {\n        $ntlmHash = $this->md4Encrypt($password);\n        $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain));\n\n        // create blob\n        $blob = $this->createBlob($timestamp, $client, $targetInfo);\n\n        $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge.$blob);\n\n        return $ntlmv2Response.$blob;\n    }\n\n    protected function createDesKey($key) {\n        $material = array(bin2hex($key[0]));\n        $len = strlen($key);\n        for ($i = 1; $i < $len; ++$i) {\n            list($high, $low) = str_split(bin2hex($key[$i]));\n            $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i));\n            $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte\n        }\n        $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0');\n\n        // odd parity\n        foreach ($material as $k => $v) {\n            $b = $this->castToByte(hexdec($v));\n            $needsParity = (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5)\n                        ^ $this->uRShift($b, 4) ^ $this->uRShift($b, 3) ^ $this->uRShift($b, 2)\n                        ^ $this->uRShift($b, 1)) & 0x01) == 0;\n\n            list($high, $low) = str_split($v);\n            if ($needsParity) {\n                $material[$k] = dechex(hexdec($high) | 0x0).dechex(hexdec($low) | 0x1);\n            } else {\n                $material[$k] = dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xe);\n            }\n        }\n\n        return $this->hex2bin(implode('', $material));\n    }\n\n    /** HELPER FUNCTIONS */\n    /**\n     * Create our security buffer depending on length and offset.\n     *\n     * @param string $value  Value we want to put in\n     * @param int    $offset start of value\n     * @param bool   $is16   Do we 16bit string or not?\n     *\n     * @return string\n     */\n    protected function createSecurityBuffer($value, $offset, $is16 = false) {\n        $length = strlen(bin2hex($value));\n        $length = $is16 ? $length / 2 : $length;\n        $length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2);\n\n        return $length.$length.$this->createByte(dechex($offset), 4);\n    }\n\n    /**\n     * Read our security buffer to fetch length and offset of our value.\n     *\n     * @param string $value Securitybuffer in hex\n     *\n     * @return array array with length and offset\n     */\n    protected function readSecurityBuffer($value) {\n        $length = floor(hexdec(substr($value, 0, 4)) / 256) * 2;\n        $offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2;\n\n        return array($length, $offset);\n    }\n\n    /**\n     * Cast to byte java equivalent to (byte).\n     *\n     * @param int $v\n     *\n     * @return int\n     */\n    protected function castToByte($v) {\n        return (($v + 128) % 256) - 128;\n    }\n\n    /**\n     * Java unsigned right bitwise\n     * $a >>> $b.\n     *\n     * @param int $a\n     * @param int $b\n     *\n     * @return int\n     */\n    protected function uRShift($a, $b) {\n        if ($b == 0) {\n            return $a;\n        }\n\n        return ($a >> $b) & ~(1 << (8 * PHP_INT_SIZE - 1) >> ($b - 1));\n    }\n\n    /**\n     * Right padding with 0 to certain length.\n     *\n     * @param string $input\n     * @param int    $bytes Length of bytes\n     * @param bool   $isHex Did we provided hex value\n     *\n     * @return string\n     */\n    protected function createByte($input, $bytes = 4, $isHex = true) {\n        if ($isHex) {\n            $byte = $this->hex2bin(str_pad($input, $bytes * 2, '00'));\n        } else {\n            $byte = str_pad($input, $bytes, \"\\x00\");\n        }\n\n        return $byte;\n    }\n\n    /**\n     * Create random bytes.\n     *\n     * @param $length\n     *\n     * @return string\n     */\n    protected function getRandomBytes($length) {\n        $bytes = openssl_random_pseudo_bytes($length, $strong);\n\n        if (false !== $bytes && true === $strong) {\n            return $bytes;\n        }\n\n        throw new RuntimeException('OpenSSL did not produce a secure random number.');\n    }\n\n    /** ENCRYPTION ALGORITHMS */\n    /**\n     * DES Encryption.\n     *\n     * @param string $value\n     * @param string $key\n     *\n     * @return string\n     */\n    protected function desEncrypt($value, $key) {\n        $cipher = mcrypt_module_open(MCRYPT_DES, '', 'ecb', '');\n        mcrypt_generic_init($cipher, $key, mcrypt_create_iv(mcrypt_enc_get_iv_size($cipher), MCRYPT_DEV_RANDOM));\n\n        return mcrypt_generic($cipher, $value);\n    }\n\n    /**\n     * MD5 Encryption.\n     *\n     * @param string $key Encryption key\n     * @param string $msg Message to encrypt\n     *\n     * @return string\n     */\n    protected function md5Encrypt($key, $msg) {\n        $blocksize = 64;\n        if (strlen($key) > $blocksize) {\n            $key = pack('H*', md5($key));\n        }\n\n        $key = str_pad($key, $blocksize, \"\\0\");\n        $ipadk = $key ^ str_repeat(\"\\x36\", $blocksize);\n        $opadk = $key ^ str_repeat(\"\\x5c\", $blocksize);\n\n        return pack('H*', md5($opadk.pack('H*', md5($ipadk.$msg))));\n    }\n\n    /**\n     * MD4 Encryption.\n     *\n     * @param string $input\n     *\n     * @return string\n     *\n     * @see http://php.net/manual/en/ref.hash.php\n     */\n    protected function md4Encrypt($input) {\n        $input = $this->convertTo16bit($input);\n\n        return function_exists('hash') ? $this->hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);\n    }\n\n    /**\n     * Convert UTF-8 to UTF-16.\n     *\n     * @param string $input\n     *\n     * @return string\n     */\n    protected function convertTo16bit($input) {\n        return iconv('UTF-8', 'UTF-16LE', $input);\n    }\n\n    /**\n     * Hex2bin replacement for < PHP 5.4.\n     *\n     * @param string $hex\n     *\n     * @return string Binary\n     */\n    protected function hex2bin($hex) {\n        if (function_exists('hex2bin')) {\n            return hex2bin($hex);\n        } else {\n            return pack('H*', $hex);\n        }\n    }\n\n    /**\n     * @param string $message\n     */\n    protected function debug($message) {\n        $message = bin2hex($message);\n        $messageId = substr($message, 16, 8);\n        echo substr($message, 0, 16).\" NTLMSSP Signature<br />\\n\";\n        echo $messageId.\" Type Indicator<br />\\n\";\n\n        if ($messageId == '02000000') {\n            $map = array(\n                'Challenge',\n                'Context',\n                'Target Information Security Buffer',\n                'Target Name Data',\n                'NetBIOS Domain Name',\n                'NetBIOS Server Name',\n                'DNS Domain Name',\n                'DNS Server Name',\n                'BLOB',\n                'Target Information Terminator',\n            );\n\n            $data = $this->parseMessage2($this->hex2bin($message));\n\n            foreach ($map as $key => $value) {\n                echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value.\"<br />\\n\";\n            }\n        } elseif ($messageId == '03000000') {\n            $i = 0;\n            $data[$i++] = substr($message, 24, 16);\n            list($lmLength, $lmOffset) = $this->readSecurityBuffer($data[$i - 1]);\n\n            $data[$i++] = substr($message, 40, 16);\n            list($ntmlLength, $ntmlOffset) = $this->readSecurityBuffer($data[$i - 1]);\n\n            $data[$i++] = substr($message, 56, 16);\n            list($targetLength, $targetOffset) = $this->readSecurityBuffer($data[$i - 1]);\n\n            $data[$i++] = substr($message, 72, 16);\n            list($userLength, $userOffset) = $this->readSecurityBuffer($data[$i - 1]);\n\n            $data[$i++] = substr($message, 88, 16);\n            list($workLength, $workOffset) = $this->readSecurityBuffer($data[$i - 1]);\n\n            $data[$i++] = substr($message, 104, 16);\n            $data[$i++] = substr($message, 120, 8);\n            $data[$i++] = substr($message, $targetOffset, $targetLength);\n            $data[$i++] = substr($message, $userOffset, $userLength);\n            $data[$i++] = substr($message, $workOffset, $workLength);\n            $data[$i++] = substr($message, $lmOffset, $lmLength);\n            $data[$i] = substr($message, $ntmlOffset, $ntmlLength);\n\n            $map = array(\n                'LM Response Security Buffer',\n                'NTLM Response Security Buffer',\n                'Target Name Security Buffer',\n                'User Name Security Buffer',\n                'Workstation Name Security Buffer',\n                'Session Key Security Buffer',\n                'Flags',\n                'Target Name Data',\n                'User Name Data',\n                'Workstation Name Data',\n                'LM Response Data',\n                'NTLM Response Data',\n            );\n\n            foreach ($map as $key => $value) {\n                echo $data[$key].' - '.$this->hex2bin($data[$key]).' ||| '.$value.\"<br />\\n\";\n            }\n        }\n\n        echo '<br /><br />';\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles PLAIN authentication.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_Esmtp_Auth_PlainAuthenticator implements Swift_Transport_Esmtp_Authenticator{\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword() {\n        return 'PLAIN';\n    }\n\n    /**\n     * Try to authenticate the user with $username and $password.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $username\n     * @param string                    $password\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) {\n        try {\n            $message = base64_encode($username.chr(0).$username.chr(0).$password);\n            $agent->executeCommand(sprintf(\"AUTH PLAIN %s\\r\\n\", $message), array(235));\n\n            return true;\n        } catch (Swift_TransportException $e) {\n            $agent->executeCommand(\"RSET\\r\\n\", array(250));\n\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Handles XOAUTH2 authentication.\n *\n * Example:\n * <code>\n * $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls')\n *   ->setAuthMode('XOAUTH2')\n *   ->setUsername('YOUR_EMAIL_ADDRESS')\n *   ->setPassword('YOUR_ACCESS_TOKEN');\n * </code>\n *\n * @author xu.li<AthenaLightenedMyPath@gmail.com>\n *\n * @see        https://developers.google.com/google-apps/gmail/xoauth2_protocol\n */\nclass Swift_Transport_Esmtp_Auth_XOAuth2Authenticator implements Swift_Transport_Esmtp_Authenticator{\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword() {\n        return 'XOAUTH2';\n    }\n\n    /**\n     * Try to authenticate the user with $email and $token.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $email\n     * @param string                    $token\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $email, $token) {\n        try {\n            $param = $this->constructXOAuth2Params($email, $token);\n            $agent->executeCommand('AUTH XOAUTH2 '.$param.\"\\r\\n\", array(235));\n\n            return true;\n        } catch (Swift_TransportException $e) {\n            $agent->executeCommand(\"RSET\\r\\n\", array(250));\n\n            return false;\n        }\n    }\n\n    /**\n     * Construct the auth parameter.\n     *\n     * @see https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism\n     */\n    protected function constructXOAuth2Params($email, $token) {\n        return base64_encode(\"user=$email\\1auth=Bearer $token\\1\\1\");\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An ESMTP handler for AUTH support.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler{\n    /**\n     * Authenticators available to process the request.\n     *\n     * @var Swift_Transport_Esmtp_Authenticator[]\n     */\n    private $_authenticators = array();\n\n    /**\n     * The username for authentication.\n     *\n     * @var string\n     */\n    private $_username;\n\n    /**\n     * The password for authentication.\n     *\n     * @var string\n     */\n    private $_password;\n\n    /**\n     * The auth mode for authentication.\n     *\n     * @var string\n     */\n    private $_auth_mode;\n\n    /**\n     * The ESMTP AUTH parameters available.\n     *\n     * @var string[]\n     */\n    private $_esmtpParams = array();\n\n    /**\n     * Create a new AuthHandler with $authenticators for support.\n     *\n     * @param Swift_Transport_Esmtp_Authenticator[] $authenticators\n     */\n    public function __construct(array $authenticators) {\n        $this->setAuthenticators($authenticators);\n    }\n\n    /**\n     * Set the Authenticators which can process a login request.\n     *\n     * @param Swift_Transport_Esmtp_Authenticator[] $authenticators\n     */\n    public function setAuthenticators(array $authenticators) {\n        $this->_authenticators = $authenticators;\n    }\n\n    /**\n     * Get the Authenticators which can process a login request.\n     *\n     * @return Swift_Transport_Esmtp_Authenticator[]\n     */\n    public function getAuthenticators() {\n        return $this->_authenticators;\n    }\n\n    /**\n     * Set the username to authenticate with.\n     *\n     * @param string $username\n     */\n    public function setUsername($username) {\n        $this->_username = $username;\n    }\n\n    /**\n     * Get the username to authenticate with.\n     *\n     * @return string\n     */\n    public function getUsername() {\n        return $this->_username;\n    }\n\n    /**\n     * Set the password to authenticate with.\n     *\n     * @param string $password\n     */\n    public function setPassword($password) {\n        $this->_password = $password;\n    }\n\n    /**\n     * Get the password to authenticate with.\n     *\n     * @return string\n     */\n    public function getPassword() {\n        return $this->_password;\n    }\n\n    /**\n     * Set the auth mode to use to authenticate.\n     *\n     * @param string $mode\n     */\n    public function setAuthMode($mode) {\n        $this->_auth_mode = $mode;\n    }\n\n    /**\n     * Get the auth mode to use to authenticate.\n     *\n     * @return string\n     */\n    public function getAuthMode() {\n        return $this->_auth_mode;\n    }\n\n    /**\n     * Get the name of the ESMTP extension this handles.\n     *\n     * @return bool\n     */\n    public function getHandledKeyword() {\n        return 'AUTH';\n    }\n\n    /**\n     * Set the parameters which the EHLO greeting indicated.\n     *\n     * @param string[] $parameters\n     */\n    public function setKeywordParams(array $parameters) {\n        $this->_esmtpParams = $parameters;\n    }\n\n    /**\n     * Runs immediately after a EHLO has been issued.\n     *\n     * @param Swift_Transport_SmtpAgent $agent to read/write\n     */\n    public function afterEhlo(Swift_Transport_SmtpAgent $agent) {\n        if ($this->_username) {\n            $count = 0;\n            foreach ($this->_getAuthenticatorsForAgent() as $authenticator) {\n                if (in_array(strtolower($authenticator->getAuthKeyword()),\n                    array_map('strtolower', $this->_esmtpParams))) {\n                    ++$count;\n                    if ($authenticator->authenticate($agent, $this->_username, $this->_password)) {\n                        return;\n                    }\n                }\n            }\n            throw new Swift_TransportException(\n                'Failed to authenticate on SMTP server with username \"'.\n                $this->_username.'\" using '.$count.' possible authenticators'\n                );\n        }\n    }\n\n    /**\n     * Not used.\n     */\n    public function getMailParams() {\n        return array();\n    }\n\n    /**\n     * Not used.\n     */\n    public function getRcptParams() {\n        return array();\n    }\n\n    /**\n     * Not used.\n     */\n    public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false) {\n    }\n\n    /**\n     * Returns +1, -1 or 0 according to the rules for usort().\n     *\n     * This method is called to ensure extensions can be execute in an appropriate order.\n     *\n     * @param string $esmtpKeyword to compare with\n     *\n     * @return int\n     */\n    public function getPriorityOver($esmtpKeyword) {\n        return 0;\n    }\n\n    /**\n     * Returns an array of method names which are exposed to the Esmtp class.\n     *\n     * @return string[]\n     */\n    public function exposeMixinMethods() {\n        return array('setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode');\n    }\n\n    /**\n     * Not used.\n     */\n    public function resetState() {\n    }\n\n    /**\n     * Returns the authenticator list for the given agent.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     *\n     * @return array\n     */\n    protected function _getAuthenticatorsForAgent() {\n        if (!$mode = strtolower($this->_auth_mode)) {\n            return $this->_authenticators;\n        }\n\n        foreach ($this->_authenticators as $authenticator) {\n            if (strtolower($authenticator->getAuthKeyword()) == $mode) {\n                return array($authenticator);\n            }\n        }\n\n        throw new Swift_TransportException('Auth mode '.$mode.' is invalid');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An Authentication mechanism.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Transport_Esmtp_Authenticator{\n    /**\n     * Get the name of the AUTH mechanism this Authenticator handles.\n     *\n     * @return string\n     */\n    public function getAuthKeyword();\n\n    /**\n     * Try to authenticate the user with $username and $password.\n     *\n     * @param Swift_Transport_SmtpAgent $agent\n     * @param string                    $username\n     * @param string                    $password\n     *\n     * @return bool\n     */\n    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * An ESMTP handler.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Transport_EsmtpHandler{\n    /**\n     * Get the name of the ESMTP extension this handles.\n     *\n     * @return bool\n     */\n    public function getHandledKeyword();\n\n    /**\n     * Set the parameters which the EHLO greeting indicated.\n     *\n     * @param string[] $parameters\n     */\n    public function setKeywordParams(array $parameters);\n\n    /**\n     * Runs immediately after a EHLO has been issued.\n     *\n     * @param Swift_Transport_SmtpAgent $agent to read/write\n     */\n    public function afterEhlo(Swift_Transport_SmtpAgent $agent);\n\n    /**\n     * Get params which are appended to MAIL FROM:<>.\n     *\n     * @return string[]\n     */\n    public function getMailParams();\n\n    /**\n     * Get params which are appended to RCPT TO:<>.\n     *\n     * @return string[]\n     */\n    public function getRcptParams();\n\n    /**\n     * Runs when a command is due to be sent.\n     *\n     * @param Swift_Transport_SmtpAgent $agent            to read/write\n     * @param string                    $command          to send\n     * @param int[]                     $codes            expected in response\n     * @param string[]                  $failedRecipients to collect failures\n     * @param bool                      $stop             to be set true  by-reference if the command is now sent\n     */\n    public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false);\n\n    /**\n     * Returns +1, -1 or 0 according to the rules for usort().\n     *\n     * This method is called to ensure extensions can be execute in an appropriate order.\n     *\n     * @param string $esmtpKeyword to compare with\n     *\n     * @return int\n     */\n    public function getPriorityOver($esmtpKeyword);\n\n    /**\n     * Returns an array of method names which are exposed to the Esmtp class.\n     *\n     * @return string[]\n     */\n    public function exposeMixinMethods();\n\n    /**\n     * Tells this handler to clear any buffers and reset its state.\n     */\n    public function resetState();\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages over SMTP with ESMTP support.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTransport implements Swift_Transport_SmtpAgent{\n    /**\n     * ESMTP extension handlers.\n     *\n     * @var Swift_Transport_EsmtpHandler[]\n     */\n    private $_handlers = array();\n\n    /**\n     * ESMTP capabilities.\n     *\n     * @var string[]\n     */\n    private $_capabilities = array();\n\n    /**\n     * Connection buffer parameters.\n     *\n     * @var array\n     */\n    private $_params = array(\n        'protocol' => 'tcp',\n        'host' => 'localhost',\n        'port' => 25,\n        'timeout' => 30,\n        'blocking' => 1,\n        'tls' => false,\n        'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,\n        'stream_context_options' => array(),\n        );\n\n    /**\n     * Creates a new EsmtpTransport using the given I/O buffer.\n     *\n     * @param Swift_Transport_IoBuffer       $buf\n     * @param Swift_Transport_EsmtpHandler[] $extensionHandlers\n     * @param Swift_Events_EventDispatcher   $dispatcher\n     */\n    public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher) {\n        parent::__construct($buf, $dispatcher);\n        $this->setExtensionHandlers($extensionHandlers);\n    }\n\n    /**\n     * Set the host to connect to.\n     *\n     * @param string $host\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setHost($host) {\n        $this->_params['host'] = $host;\n\n        return $this;\n    }\n\n    /**\n     * Get the host to connect to.\n     *\n     * @return string\n     */\n    public function getHost() {\n        return $this->_params['host'];\n    }\n\n    /**\n     * Set the port to connect to.\n     *\n     * @param int $port\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setPort($port) {\n        $this->_params['port'] = (int) $port;\n\n        return $this;\n    }\n\n    /**\n     * Get the port to connect to.\n     *\n     * @return int\n     */\n    public function getPort() {\n        return $this->_params['port'];\n    }\n\n    /**\n     * Set the connection timeout.\n     *\n     * @param int $timeout seconds\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setTimeout($timeout) {\n        $this->_params['timeout'] = (int) $timeout;\n        $this->_buffer->setParam('timeout', (int) $timeout);\n\n        return $this;\n    }\n\n    /**\n     * Get the connection timeout.\n     *\n     * @return int\n     */\n    public function getTimeout() {\n        return $this->_params['timeout'];\n    }\n\n    /**\n     * Set the encryption type (tls or ssl).\n     *\n     * @param string $encryption\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setEncryption($encryption) {\n        $encryption = strtolower($encryption);    \n        if ('tls' == $encryption) {\n            $this->_params['protocol'] = 'tcp';\n            $this->_params['tls'] = true;\n        } else {\n            $this->_params['protocol'] = $encryption;\n            $this->_params['tls'] = false;\n        }\n\n        return $this;\n    }\n\n    /**\n     * Get the encryption type.\n     *\n     * @return string\n     */\n    public function getEncryption() {\n        return $this->_params['tls'] ? 'tls' : $this->_params['protocol'];\n    }\n\n    /**\n     * Sets the stream context options.\n     *\n     * @param array $options\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setStreamOptions($options) {\n        $this->_params['stream_context_options'] = $options;\n\n        return $this;\n    }\n\n    /**\n     * Returns the stream context options.\n     *\n     * @return array\n     */\n    public function getStreamOptions() {\n        return $this->_params['stream_context_options'];\n    }\n\n    /**\n     * Sets the source IP.\n     *\n     * @param string $source\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setSourceIp($source) {\n        $this->_params['sourceIp'] = $source;\n\n        return $this;\n    }\n\n    /**\n     * Returns the IP used to connect to the destination.\n     *\n     * @return string\n     */\n    public function getSourceIp() {\n        return isset($this->_params['sourceIp']) ? $this->_params['sourceIp'] : null;\n    }\n\n    /**\n     * Set ESMTP extension handlers.\n     *\n     * @param Swift_Transport_EsmtpHandler[] $handlers\n     *\n     * @return Swift_Transport_EsmtpTransport\n     */\n    public function setExtensionHandlers(array $handlers) {\n        $assoc = array();\n        foreach ($handlers as $handler) {\n            $assoc[$handler->getHandledKeyword()] = $handler;\n        }\n\n        @uasort($assoc, array($this, '_sortHandlers'));\n        $this->_handlers = $assoc;\n        $this->_setHandlerParams();\n\n        return $this;\n    }\n\n    /**\n     * Get ESMTP extension handlers.\n     *\n     * @return Swift_Transport_EsmtpHandler[]\n     */\n    public function getExtensionHandlers() {\n        return array_values($this->_handlers);\n    }\n\n    /**\n     * Run a command against the buffer, expecting the given response codes.\n     *\n     * If no response codes are given, the response will not be validated.\n     * If codes are given, an exception will be thrown on an invalid response.\n     *\n     * @param string   $command\n     * @param int[]    $codes\n     * @param string[] $failures An array of failures by-reference\n     *\n     * @return string\n     */\n    public function executeCommand($command, $codes = array(), &$failures = null) {\n        $failures = (array) $failures;\n        $stopSignal = false;\n        $response = null;\n        foreach ($this->_getActiveHandlers() as $handler) {\n            $response = $handler->onCommand(\n                $this, $command, $codes, $failures, $stopSignal\n                );\n            if ($stopSignal) {\n                return $response;\n            }\n        }\n\n        return parent::executeCommand($command, $codes, $failures);\n    }\n\n    // -- Mixin invocation code\n\n    /** Mixin handling method for ESMTP handlers */\n    public function __call($method, $args) {\n        foreach ($this->_handlers as $handler) {\n            if (in_array(strtolower($method),\n                array_map('strtolower', (array) $handler->exposeMixinMethods())\n                )) {\n                $return = call_user_func_array(array($handler, $method), $args);\n                // Allow fluid method calls\n                if (is_null($return) && substr($method, 0, 3) == 'set') {\n                    return $this;\n                } else {\n                    return $return;\n                }\n            }\n        }\n        trigger_error('Call to undefined method '.$method, E_USER_ERROR);\n    }\n\n    /** Get the params to initialize the buffer */\n    protected function _getBufferParams() {\n        return $this->_params;\n    }\n\n    /** Overridden to perform EHLO instead */\n    protected function _doHeloCommand() {\n        try {\n            $response = $this->executeCommand(\n                sprintf(\"EHLO %s\\r\\n\", $this->_domain), array(250)\n                );\n        } catch (Swift_TransportException $e) {\n            return parent::_doHeloCommand();\n        }\n\n        if ($this->_params['tls']) {\n            try {\n                $this->executeCommand(\"STARTTLS\\r\\n\", array(220));\n\n                if (!$this->_buffer->startTLS()) {\n                    throw new Swift_TransportException('Unable to connect with TLS encryption');\n                }\n\n                try {\n                    $response = $this->executeCommand(\n                        sprintf(\"EHLO %s\\r\\n\", $this->_domain), array(250)\n                        );\n                } catch (Swift_TransportException $e) {\n                    return parent::_doHeloCommand();\n                }\n            } catch (Swift_TransportException $e) {\n                $this->_throwException($e);\n            }\n        }\n\n        $this->_capabilities = $this->_getCapabilities($response);\n        $this->_setHandlerParams();\n        foreach ($this->_getActiveHandlers() as $handler) {\n            $handler->afterEhlo($this);\n        }\n    }\n\n    /** Overridden to add Extension support */\n    protected function _doMailFromCommand($address) {\n        $handlers = $this->_getActiveHandlers();\n        $params = array();\n        foreach ($handlers as $handler) {\n            $params = array_merge($params, (array) $handler->getMailParams());\n        }\n        $paramStr = !empty($params) ? ' '.implode(' ', $params) : '';\n        $this->executeCommand(\n            sprintf(\"MAIL FROM:<%s>%s\\r\\n\", $address, $paramStr), array(250)\n            );\n    }\n\n    /** Overridden to add Extension support */\n    protected function _doRcptToCommand($address) {\n        $handlers = $this->_getActiveHandlers();\n        $params = array();\n        foreach ($handlers as $handler) {\n            $params = array_merge($params, (array) $handler->getRcptParams());\n        }\n        $paramStr = !empty($params) ? ' '.implode(' ', $params) : '';\n        $this->executeCommand(\n            sprintf(\"RCPT TO:<%s>%s\\r\\n\", $address, $paramStr), array(250, 251, 252)\n            );\n    }\n\n    /** Determine ESMTP capabilities by function group */\n    private function _getCapabilities($ehloResponse) {\n        $capabilities = array();\n        $ehloResponse = trim($ehloResponse);\n        $lines = explode(\"\\r\\n\", $ehloResponse);\n        array_shift($lines);\n        foreach ($lines as $line) {\n            if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches)) {\n                $keyword = strtoupper($matches[1]);\n                $paramStr = strtoupper(ltrim($matches[2], ' ='));\n                $params = !empty($paramStr) ? explode(' ', $paramStr) : array();\n                $capabilities[$keyword] = $params;\n            }\n        }\n\n        return $capabilities;\n    }\n\n    /** Set parameters which are used by each extension handler */\n    private function _setHandlerParams() {\n        foreach ($this->_handlers as $keyword => $handler) {\n            if (array_key_exists($keyword, $this->_capabilities)) {\n                $handler->setKeywordParams($this->_capabilities[$keyword]);\n            }\n        }\n    }\n\n    /** Get ESMTP handlers which are currently ok to use */\n    private function _getActiveHandlers() {\n        $handlers = array();\n        foreach ($this->_handlers as $keyword => $handler) {\n            if (array_key_exists($keyword, $this->_capabilities)) {\n                $handlers[] = $handler;\n            }\n        }\n\n        return $handlers;\n    }\n\n    /** Custom sort for extension handler ordering */\n    private function _sortHandlers($a, $b) {\n        return $a->getPriorityOver($b->getHandledKeyword());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Contains a list of redundant Transports so when one fails, the next is used.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTransport{\n    /**\n     * Registered transport currently used.\n     *\n     * @var Swift_Transport\n     */\n    private $_currentTransport;\n\n    // needed as __construct is called from elsewhere explicitly\n    public function __construct() {\n        parent::__construct();\n    }\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     * The return value is the number of recipients who were accepted for delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $maxTransports = count($this->_transports);\n        $sent = 0;\n        $this->_lastUsedTransport = null;\n\n        for ($i = 0; $i < $maxTransports\n            && $transport = $this->_getNextTransport(); ++$i) {\n            try {\n                if (!$transport->isStarted()) {\n                    $transport->start();\n                }\n\n                if ($sent = $transport->send($message, $failedRecipients)) {\n                    $this->_lastUsedTransport = $transport;\n\n                    return $sent;\n                }\n            } catch (Swift_TransportException $e) {\n                $this->_killCurrentTransport();\n            }\n        }\n\n        if (count($this->_transports) == 0) {\n            throw new Swift_TransportException(\n                'All Transports in FailoverTransport failed, or no Transports available'\n                );\n        }\n\n        return $sent;\n    }\n\n    protected function _getNextTransport() {\n        if (!isset($this->_currentTransport)) {\n            $this->_currentTransport = parent::_getNextTransport();\n        }\n\n        return $this->_currentTransport;\n    }\n\n    protected function _killCurrentTransport() {\n        $this->_currentTransport = null;\n        parent::_killCurrentTransport();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Buffers input and output to a resource.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Transport_IoBuffer extends Swift_InputByteStream, Swift_OutputByteStream{\n    /** A socket buffer over TCP */\n    const TYPE_SOCKET = 0x0001;\n\n    /** A process buffer with I/O support */\n    const TYPE_PROCESS = 0x0010;\n\n    /**\n     * Perform any initialization needed, using the given $params.\n     *\n     * Parameters will vary depending upon the type of IoBuffer used.\n     *\n     * @param array $params\n     */\n    public function initialize(array $params);\n\n    /**\n     * Set an individual param on the buffer (e.g. switching to SSL).\n     *\n     * @param string $param\n     * @param mixed  $value\n     */\n    public function setParam($param, $value);\n\n    /**\n     * Perform any shutdown logic needed.\n     */\n    public function terminate();\n\n    /**\n     * Set an array of string replacements which should be made on data written\n     * to the buffer.\n     *\n     * This could replace LF with CRLF for example.\n     *\n     * @param string[] $replacements\n     */\n    public function setWriteTranslations(array $replacements);\n\n    /**\n     * Get a line of output (including any CRLF).\n     *\n     * The $sequence number comes from any writes and may or may not be used\n     * depending upon the implementation.\n     *\n     * @param int $sequence of last write to scan from\n     *\n     * @return string\n     */\n    public function readLine($sequence);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Redundantly and rotationally uses several Transports when sending.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_LoadBalancedTransport implements Swift_Transport{\n    /**\n     * Transports which are deemed useless.\n     *\n     * @var Swift_Transport[]\n     */\n    private $_deadTransports = array();\n\n    /**\n     * The Transports which are used in rotation.\n     *\n     * @var Swift_Transport[]\n     */\n    protected $_transports = array();\n\n    /**\n     * The Transport used in the last successful send operation.\n     *\n     * @var Swift_Transport\n     */\n    protected $_lastUsedTransport = null;\n\n    // needed as __construct is called from elsewhere explicitly\n    public function __construct() {\n    }\n\n    /**\n     * Set $transports to delegate to.\n     *\n     * @param Swift_Transport[] $transports\n     */\n    public function setTransports(array $transports) {\n        $this->_transports = $transports;\n        $this->_deadTransports = array();\n    }\n\n    /**\n     * Get $transports to delegate to.\n     *\n     * @return Swift_Transport[]\n     */\n    public function getTransports() {\n        return array_merge($this->_transports, $this->_deadTransports);\n    }\n\n    /**\n     * Get the Transport used in the last successful send operation.\n     *\n     * @return Swift_Transport\n     */\n    public function getLastUsedTransport() {\n        return $this->_lastUsedTransport;\n    }\n\n    /**\n     * Test if this Transport mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return count($this->_transports) > 0;\n    }\n\n    /**\n     * Start this Transport mechanism.\n     */\n    public function start() {\n        $this->_transports = array_merge($this->_transports, $this->_deadTransports);\n    }\n\n    /**\n     * Stop this Transport mechanism.\n     */\n    public function stop() {\n        foreach ($this->_transports as $transport) {\n            $transport->stop();\n        }\n    }\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     * The return value is the number of recipients who were accepted for delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $maxTransports = count($this->_transports);\n        $sent = 0;\n        $this->_lastUsedTransport = null;\n\n        for ($i = 0; $i < $maxTransports\n            && $transport = $this->_getNextTransport(); ++$i) {\n            try {\n                if (!$transport->isStarted()) {\n                    $transport->start();\n                }\n                if ($sent = $transport->send($message, $failedRecipients)) {\n                    $this->_lastUsedTransport = $transport;\n                    break;\n                }\n            } catch (Swift_TransportException $e) {\n                $this->_killCurrentTransport();\n            }\n        }\n\n        if (count($this->_transports) == 0) {\n            throw new Swift_TransportException(\n                'All Transports in LoadBalancedTransport failed, or no Transports available'\n                );\n        }\n\n        return $sent;\n    }\n\n    /**\n     * Register a plugin.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        foreach ($this->_transports as $transport) {\n            $transport->registerPlugin($plugin);\n        }\n    }\n\n    /**\n     * Rotates the transport list around and returns the first instance.\n     *\n     * @return Swift_Transport\n     */\n    protected function _getNextTransport() {\n        if ($next = array_shift($this->_transports)) {\n            $this->_transports[] = $next;\n        }\n\n        return $next;\n    }\n\n    /**\n     * Tag the currently used (top of stack) transport as dead/useless.\n     */\n    protected function _killCurrentTransport() {\n        if ($transport = array_pop($this->_transports)) {\n            try {\n                $transport->stop();\n            } catch (Exception $e) {\n            }\n            $this->_deadTransports[] = $transport;\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * This interface intercepts calls to the mail() function.\n *\n * @author     Chris Corbyn\n */\ninterface Swift_Transport_MailInvoker{\n    /**\n     * Send mail via the mail() function.\n     *\n     * This method takes the same arguments as PHP mail().\n     *\n     * @param string $to\n     * @param string $subject\n     * @param string $body\n     * @param string $headers\n     * @param string $extraParams\n     *\n     * @return bool\n     */\n    public function mail($to, $subject, $body, $headers = null, $extraParams = null);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/MailTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages using the mail() function.\n *\n * It is advised that users do not use this transport if at all possible\n * since a number of plugin features cannot be used in conjunction with this\n * transport due to the internal interface in PHP itself.\n *\n * The level of error reporting with this transport is incredibly weak, again\n * due to limitations of PHP's internal mail() function.  You'll get an\n * all-or-nothing result from sending.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_MailTransport implements Swift_Transport{\n    /** Additional parameters to pass to mail() */\n    private $_extraParams = '-f%s';\n\n    /** The event dispatcher from the plugin API */\n    private $_eventDispatcher;\n\n    /** An invoker that calls the mail() function */\n    private $_invoker;\n\n    /**\n     * Create a new MailTransport with the $log.\n     *\n     * @param Swift_Transport_MailInvoker  $invoker\n     * @param Swift_Events_EventDispatcher $eventDispatcher\n     */\n    public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher) {\n        $this->_invoker = $invoker;\n        $this->_eventDispatcher = $eventDispatcher;\n    }\n\n    /**\n     * Not used.\n     */\n    public function isStarted() {\n        return false;\n    }\n\n    /**\n     * Not used.\n     */\n    public function start() {\n    }\n\n    /**\n     * Not used.\n     */\n    public function stop() {\n    }\n\n    /**\n     * Set the additional parameters used on the mail() function.\n     *\n     * This string is formatted for sprintf() where %s is the sender address.\n     *\n     * @param string $params\n     *\n     * @return Swift_Transport_MailTransport\n     */\n    public function setExtraParams($params) {\n        $this->_extraParams = $params;\n\n        return $this;\n    }\n\n    /**\n     * Get the additional parameters used on the mail() function.\n     *\n     * This string is formatted for sprintf() where %s is the sender address.\n     *\n     * @return string\n     */\n    public function getExtraParams() {\n        return $this->_extraParams;\n    }\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     * The return value is the number of recipients who were accepted for delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $failedRecipients = (array) $failedRecipients;\n\n        if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');\n            if ($evt->bubbleCancelled()) {\n                return 0;\n            }\n        }\n\n        $count = (\n            count((array) $message->getTo())\n            + count((array) $message->getCc())\n            + count((array) $message->getBcc())\n            );\n\n        $toHeader = $message->getHeaders()->get('To');\n        $subjectHeader = $message->getHeaders()->get('Subject');\n\n        if (!$toHeader) {\n            $this->_throwException(new Swift_TransportException('Cannot send message without a recipient'));\n        }\n        $to = $toHeader->getFieldBody();\n        $subject = $subjectHeader ? $subjectHeader->getFieldBody() : '';\n\n        $reversePath = $this->_getReversePath($message);\n\n        // Remove headers that would otherwise be duplicated\n        $message->getHeaders()->remove('To');\n        $message->getHeaders()->remove('Subject');\n\n        $messageStr = $message->toString();\n\n        $message->getHeaders()->set($toHeader);\n        $message->getHeaders()->set($subjectHeader);\n\n        // Separate headers from body\n        if (false !== $endHeaders = strpos($messageStr, \"\\r\\n\\r\\n\")) {\n            $headers = substr($messageStr, 0, $endHeaders).\"\\r\\n\"; //Keep last EOL\n            $body = substr($messageStr, $endHeaders + 4);\n        } else {\n            $headers = $messageStr.\"\\r\\n\";\n            $body = '';\n        }\n\n        unset($messageStr);\n\n        if (\"\\r\\n\" != PHP_EOL) {\n            // Non-windows (not using SMTP)\n            $headers = str_replace(\"\\r\\n\", PHP_EOL, $headers);\n            $subject = str_replace(\"\\r\\n\", PHP_EOL, $subject);\n            $body = str_replace(\"\\r\\n\", PHP_EOL, $body);\n        } else {\n            // Windows, using SMTP\n            $headers = str_replace(\"\\r\\n.\", \"\\r\\n..\", $headers);\n            $subject = str_replace(\"\\r\\n.\", \"\\r\\n..\", $subject);\n            $body = str_replace(\"\\r\\n.\", \"\\r\\n..\", $body);\n        }\n\n        if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) {\n            if ($evt) {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);\n                $evt->setFailedRecipients($failedRecipients);\n                $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n            }\n        } else {\n            $failedRecipients = array_merge(\n                $failedRecipients,\n                array_keys((array) $message->getTo()),\n                array_keys((array) $message->getCc()),\n                array_keys((array) $message->getBcc())\n                );\n\n            if ($evt) {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_FAILED);\n                $evt->setFailedRecipients($failedRecipients);\n                $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n            }\n\n            $message->generateId();\n\n            $count = 0;\n        }\n\n        return $count;\n    }\n\n    /**\n     * Register a plugin.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        $this->_eventDispatcher->bindEventListener($plugin);\n    }\n\n    /** Throw a TransportException, first sending it to any listeners */\n    protected function _throwException(Swift_TransportException $e) {\n        if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown');\n            if (!$evt->bubbleCancelled()) {\n                throw $e;\n            }\n        } else {\n            throw $e;\n        }\n    }\n\n    /** Determine the best-use reverse path for this message */\n    private function _getReversePath(Swift_Mime_Message $message) {\n        $return = $message->getReturnPath();\n        $sender = $message->getSender();\n        $from = $message->getFrom();\n        $path = null;\n        if (!empty($return)) {\n            $path = $return;\n        } elseif (!empty($sender)) {\n            $keys = array_keys($sender);\n            $path = array_shift($keys);\n        } elseif (!empty($from)) {\n            $keys = array_keys($from);\n            $path = array_shift($keys);\n        }\n\n        return $path;\n    }\n\n    /**\n     * Return php mail extra params to use for invoker->mail.\n     *\n     * @param $extraParams\n     * @param $reversePath\n     *\n     * @return string|null\n     */\n    private function _formatExtraParams($extraParams, $reversePath) {\n        if (false !== strpos($extraParams, '-f%s')) {\n            $extraParams = empty($reversePath) ? str_replace('-f%s', '', $extraParams) : sprintf($extraParams, escapeshellarg($reversePath));\n        }\n\n        return !empty($extraParams) ? $extraParams : null;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/NullTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Pretends messages have been sent, but just ignores them.\n *\n * @author Fabien Potencier\n */\nclass Swift_Transport_NullTransport implements Swift_Transport{\n    /** The event dispatcher from the plugin API */\n    private $_eventDispatcher;\n\n    /**\n     * Constructor.\n     */\n    public function __construct(Swift_Events_EventDispatcher $eventDispatcher) {\n        $this->_eventDispatcher = $eventDispatcher;\n    }\n\n    /**\n     * Tests if this Transport mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return true;\n    }\n\n    /**\n     * Starts this Transport mechanism.\n     */\n    public function start() {\n    }\n\n    /**\n     * Stops this Transport mechanism.\n     */\n    public function stop() {\n    }\n\n    /**\n     * Sends the given message.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of sent emails\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');\n            if ($evt->bubbleCancelled()) {\n                return 0;\n            }\n        }\n\n        if ($evt) {\n            $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);\n            $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n        }\n\n        $count = (\n            count((array) $message->getTo())\n            + count((array) $message->getCc())\n            + count((array) $message->getBcc())\n            );\n\n        return $count;\n    }\n\n    /**\n     * Register a plugin.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        $this->_eventDispatcher->bindEventListener($plugin);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary.\n *\n * Supported modes are -bs and -t, with any additional flags desired.\n * It is advised to use -bs mode since error reporting with -t mode is not\n * possible.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTransport{\n    /**\n     * Connection buffer parameters.\n     *\n     * @var array\n     */\n    private $_params = array(\n        'timeout' => 30,\n        'blocking' => 1,\n        'command' => '/usr/sbin/sendmail -bs',\n        'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,\n        );\n\n    /**\n     * Create a new SendmailTransport with $buf for I/O.\n     *\n     * @param Swift_Transport_IoBuffer     $buf\n     * @param Swift_Events_EventDispatcher $dispatcher\n     */\n    public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher) {\n        parent::__construct($buf, $dispatcher);\n    }\n\n    /**\n     * Start the standalone SMTP session if running in -bs mode.\n     */\n    public function start() {\n        if (false !== strpos($this->getCommand(), ' -bs')) {\n            parent::start();\n        }\n    }\n\n    /**\n     * Set the command to invoke.\n     *\n     * If using -t mode you are strongly advised to include -oi or -i in the flags.\n     * For example: /usr/sbin/sendmail -oi -t\n     * Swift will append a -f<sender> flag if one is not present.\n     *\n     * The recommended mode is \"-bs\" since it is interactive and failure notifications\n     * are hence possible.\n     *\n     * @param string $command\n     *\n     * @return Swift_Transport_SendmailTransport\n     */\n    public function setCommand($command) {\n        $this->_params['command'] = $command;\n\n        return $this;\n    }\n\n    /**\n     * Get the sendmail command which will be invoked.\n     *\n     * @return string\n     */\n    public function getCommand() {\n        return $this->_params['command'];\n    }\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     *\n     * The return value is the number of recipients who were accepted for delivery.\n     * NOTE: If using 'sendmail -t' you will not be aware of any failures until\n     * they bounce (i.e. send() will always return 100% success).\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        $failedRecipients = (array) $failedRecipients;\n        $command = $this->getCommand();\n        $buffer = $this->getBuffer();\n        $count = 0;\n\n        if (false !== strpos($command, ' -t')) {\n            if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {\n                $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');\n                if ($evt->bubbleCancelled()) {\n                    return 0;\n                }\n            }\n\n            if (false === strpos($command, ' -f')) {\n                $command .= ' -f'.escapeshellarg($this->_getReversePath($message));\n            }\n\n            $buffer->initialize(array_merge($this->_params, array('command' => $command)));\n\n            if (false === strpos($command, ' -i') && false === strpos($command, ' -oi')) {\n                $buffer->setWriteTranslations(array(\"\\r\\n\" => \"\\n\", \"\\n.\" => \"\\n..\"));\n            } else {\n                $buffer->setWriteTranslations(array(\"\\r\\n\" => \"\\n\"));\n            }\n\n            $count = count((array) $message->getTo())\n                + count((array) $message->getCc())\n                + count((array) $message->getBcc())\n                ;\n            $message->toByteStream($buffer);\n            $buffer->flushBuffers();\n            $buffer->setWriteTranslations(array());\n            $buffer->terminate();\n\n            if ($evt) {\n                $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);\n                $evt->setFailedRecipients($failedRecipients);\n                $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n            }\n\n            $message->generateId();\n        } elseif (false !== strpos($command, ' -bs')) {\n            $count = parent::send($message, $failedRecipients);\n        } else {\n            $this->_throwException(new Swift_TransportException(\n                'Unsupported sendmail command flags ['.$command.']. '.\n                'Must be one of \"-bs\" or \"-t\" but can include additional flags.'\n                ));\n        }\n\n        return $count;\n    }\n\n    /** Get the params to initialize the buffer */\n    protected function _getBufferParams() {\n        return $this->_params;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * This is the implementation class for {@link Swift_Transport_MailInvoker}.\n *\n * @author     Chris Corbyn\n */\nclass Swift_Transport_SimpleMailInvoker implements Swift_Transport_MailInvoker{\n    /**\n     * Send mail via the mail() function.\n     *\n     * This method takes the same arguments as PHP mail().\n     *\n     * @param string $to\n     * @param string $subject\n     * @param string $body\n     * @param string $headers\n     * @param string $extraParams\n     *\n     * @return bool\n     */\n    public function mail($to, $subject, $body, $headers = null, $extraParams = null) {\n        if (!ini_get('safe_mode')) {\n            return @mail($to, $subject, $body, $headers, $extraParams);\n        }\n\n        return @mail($to, $subject, $body, $headers);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Wraps an IoBuffer to send/receive SMTP commands/responses.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Transport_SmtpAgent{\n    /**\n     * Get the IoBuffer where read/writes are occurring.\n     *\n     * @return Swift_Transport_IoBuffer\n     */\n    public function getBuffer();\n\n    /**\n     * Run a command against the buffer, expecting the given response codes.\n     *\n     * If no response codes are given, the response will not be validated.\n     * If codes are given, an exception will be thrown on an invalid response.\n     *\n     * @param string   $command\n     * @param int[]    $codes\n     * @param string[] $failures An array of failures by-reference\n     */\n    public function executeCommand($command, $codes = array(), &$failures = null);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Stores Messages in a queue.\n *\n * @author Fabien Potencier\n */\nclass Swift_Transport_SpoolTransport implements Swift_Transport{\n    /** The spool instance */\n    private $_spool;\n\n    /** The event dispatcher from the plugin API */\n    private $_eventDispatcher;\n\n    /**\n     * Constructor.\n     */\n    public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift_Spool $spool = null) {\n        $this->_eventDispatcher = $eventDispatcher;\n        $this->_spool = $spool;\n    }\n\n    /**\n     * Sets the spool object.\n     *\n     * @param Swift_Spool $spool\n     *\n     * @return Swift_Transport_SpoolTransport\n     */\n    public function setSpool(Swift_Spool $spool) {\n        $this->_spool = $spool;\n\n        return $this;\n    }\n\n    /**\n     * Get the spool object.\n     *\n     * @return Swift_Spool\n     */\n    public function getSpool() {\n        return $this->_spool;\n    }\n\n    /**\n     * Tests if this Transport mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted() {\n        return true;\n    }\n\n    /**\n     * Starts this Transport mechanism.\n     */\n    public function start() {\n    }\n\n    /**\n     * Stops this Transport mechanism.\n     */\n    public function stop() {\n    }\n\n    /**\n     * Sends the given message.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int The number of sent e-mail's\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {\n        if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {\n            $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');\n            if ($evt->bubbleCancelled()) {\n                return 0;\n            }\n        }\n\n        $success = $this->_spool->queueMessage($message);\n\n        if ($evt) {\n            $evt->setResult($success ? Swift_Events_SendEvent::RESULT_SPOOLED : Swift_Events_SendEvent::RESULT_FAILED);\n            $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');\n        }\n\n        return 1;\n    }\n\n    /**\n     * Register a plugin.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin) {\n        $this->_eventDispatcher->bindEventListener($plugin);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * A generic IoBuffer implementation supporting remote sockets and local processes.\n *\n * @author Chris Corbyn\n */\nclass Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_Transport_IoBuffer{\n    /** A primary socket */\n    private $_stream;\n\n    /** The input stream */\n    private $_in;\n\n    /** The output stream */\n    private $_out;\n\n    /** Buffer initialization parameters */\n    private $_params = array();\n\n    /** The ReplacementFilterFactory */\n    private $_replacementFactory;\n\n    /** Translations performed on data being streamed into the buffer */\n    private $_translations = array();\n\n    /**\n     * Create a new StreamBuffer using $replacementFactory for transformations.\n     *\n     * @param Swift_ReplacementFilterFactory $replacementFactory\n     */\n    public function __construct(Swift_ReplacementFilterFactory $replacementFactory) {\n        $this->_replacementFactory = $replacementFactory;\n    }\n\n    /**\n     * Perform any initialization needed, using the given $params.\n     *\n     * Parameters will vary depending upon the type of IoBuffer used.\n     *\n     * @param array $params\n     */\n    public function initialize(array $params) {\n        $this->_params = $params;\n        switch ($params['type']) {\n            case self::TYPE_PROCESS:\n                $this->_establishProcessConnection();\n                break;\n            case self::TYPE_SOCKET:\n            default:\n                $this->_establishSocketConnection();\n                break;\n        }\n    }\n\n    /**\n     * Set an individual param on the buffer (e.g. switching to SSL).\n     *\n     * @param string $param\n     * @param mixed  $value\n     */\n    public function setParam($param, $value) {\n        if (isset($this->_stream)) {\n            switch ($param) {\n                case 'timeout':\n                    if ($this->_stream) {\n                        stream_set_timeout($this->_stream, $value);\n                    }\n                    break;\n\n                case 'blocking':\n                    if ($this->_stream) {\n                        stream_set_blocking($this->_stream, 1);\n                    }\n\n            }\n        }\n        $this->_params[$param] = $value;\n    }\n\n    public function startTLS() {\n        return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);\n    }\n\n    /**\n     * Perform any shutdown logic needed.\n     */\n    public function terminate() {\n        if (isset($this->_stream)) {\n            switch ($this->_params['type']) {\n                case self::TYPE_PROCESS:\n                    fclose($this->_in);\n                    fclose($this->_out);\n                    proc_close($this->_stream);\n                    break;\n                case self::TYPE_SOCKET:\n                default:\n                    fclose($this->_stream);\n                    break;\n            }\n        }\n        $this->_stream = null;\n        $this->_out = null;\n        $this->_in = null;\n    }\n\n    /**\n     * Set an array of string replacements which should be made on data written\n     * to the buffer.\n     *\n     * This could replace LF with CRLF for example.\n     *\n     * @param string[] $replacements\n     */\n    public function setWriteTranslations(array $replacements) {\n        foreach ($this->_translations as $search => $replace) {\n            if (!isset($replacements[$search])) {\n                $this->removeFilter($search);\n                unset($this->_translations[$search]);\n            }\n        }\n\n        foreach ($replacements as $search => $replace) {\n            if (!isset($this->_translations[$search])) {\n                $this->addFilter(\n                    $this->_replacementFactory->createFilter($search, $replace), $search\n                    );\n                $this->_translations[$search] = true;\n            }\n        }\n    }\n\n    /**\n     * Get a line of output (including any CRLF).\n     *\n     * The $sequence number comes from any writes and may or may not be used\n     * depending upon the implementation.\n     *\n     * @param int $sequence of last write to scan from\n     *\n     * @throws Swift_IoException\n     *\n     * @return string\n     */\n    public function readLine($sequence) {\n        if (isset($this->_out) && !feof($this->_out)) {\n            $line = fgets($this->_out);\n            if (strlen($line) == 0) {\n                $metas = stream_get_meta_data($this->_out);\n                if ($metas['timed_out']) {\n                    throw new Swift_IoException(\n                        'Connection to '.\n                            $this->_getReadConnectionDescription().\n                        ' Timed Out'\n                    );\n                }\n            }\n\n            return $line;\n        }\n    }\n\n    /**\n     * Reads $length bytes from the stream into a string and moves the pointer\n     * through the stream by $length.\n     *\n     * If less bytes exist than are requested the remaining bytes are given instead.\n     * If no bytes are remaining at all, boolean false is returned.\n     *\n     * @param int $length\n     *\n     * @throws Swift_IoException\n     *\n     * @return string|bool\n     */\n    public function read($length) {\n        if (isset($this->_out) && !feof($this->_out)) {\n            $ret = fread($this->_out, $length);\n            if (strlen($ret) == 0) {\n                $metas = stream_get_meta_data($this->_out);\n                if ($metas['timed_out']) {\n                    throw new Swift_IoException(\n                        'Connection to '.\n                            $this->_getReadConnectionDescription().\n                        ' Timed Out'\n                    );\n                }\n            }\n\n            return $ret;\n        }\n    }\n\n    /** Not implemented */\n    public function setReadPointer($byteOffset) {\n    }\n\n    /** Flush the stream contents */\n    protected function _flush() {\n        if (isset($this->_in)) {\n            fflush($this->_in);\n        }\n    }\n\n    /** Write this bytes to the stream */\n    protected function _commit($bytes) {\n        if (isset($this->_in)) {\n            $bytesToWrite = strlen($bytes);\n            $totalBytesWritten = 0;\n\n            while ($totalBytesWritten < $bytesToWrite) {\n                $bytesWritten = fwrite($this->_in, substr($bytes, $totalBytesWritten));\n                if (false === $bytesWritten || 0 === $bytesWritten) {\n                    break;\n                }\n\n                $totalBytesWritten += $bytesWritten;\n            }\n\n            if ($totalBytesWritten > 0) {\n                return ++$this->_sequence;\n            }\n        }\n    }\n\n    /**\n     * Establishes a connection to a remote server.\n     */\n    private function _establishSocketConnection() {\n        $host = $this->_params['host'];\n        if (!empty($this->_params['protocol'])) {\n            $host = $this->_params['protocol'].'://'.$host;\n        }\n        $timeout = 15;\n        if (!empty($this->_params['timeout'])) {\n            $timeout = $this->_params['timeout'];\n        }\n        $options = array();\n        if (!empty($this->_params['sourceIp'])) {\n            $options['socket']['bindto'] = $this->_params['sourceIp'].':0';\n        }\n        if (isset($this->_params['stream_context_options'])) {\n            $options = array_merge($options, $this->_params['stream_context_options']);\n        }\n        $streamContext = stream_context_create($options);\n        $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);\n        if (false === $this->_stream) {\n            throw new Swift_TransportException(\n                'Connection could not be established with host '.$this->_params['host'].\n                ' ['.$errstr.' #'.$errno.']'\n                );\n        }\n        if (!empty($this->_params['blocking'])) {\n            stream_set_blocking($this->_stream, 1);\n        } else {\n            stream_set_blocking($this->_stream, 0);\n        }\n        stream_set_timeout($this->_stream, $timeout);\n        $this->_in = &$this->_stream;\n        $this->_out = &$this->_stream;\n    }\n\n    /**\n     * Opens a process for input/output.\n     */\n    private function _establishProcessConnection() {\n        $command = $this->_params['command'];\n        $descriptorSpec = array(\n            0 => array('pipe', 'r'),\n            1 => array('pipe', 'w'),\n            2 => array('pipe', 'w'),\n            );\n        $this->_stream = proc_open($command, $descriptorSpec, $pipes);\n        stream_set_blocking($pipes[2], 0);\n        if ($err = stream_get_contents($pipes[2])) {\n            throw new Swift_TransportException(\n                'Process could not be started ['.$err.']'\n                );\n        }\n        $this->_in = &$pipes[0];\n        $this->_out = &$pipes[1];\n    }\n\n    private function _getReadConnectionDescription() {\n        switch ($this->_params['type']) {\n            case self::TYPE_PROCESS:\n                return 'Process '.$this->_params['command'];\n                break;\n\n            case self::TYPE_SOCKET:\n            default:\n                $host = $this->_params['host'];\n                if (!empty($this->_params['protocol'])) {\n                    $host = $this->_params['protocol'].'://'.$host;\n                }\n                $host .= ':'.$this->_params['port'];\n\n                return $host;\n                break;\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Transport.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Sends Messages via an abstract Transport subsystem.\n *\n * @author Chris Corbyn\n */\ninterface Swift_Transport{\n    /**\n     * Test if this Transport mechanism has started.\n     *\n     * @return bool\n     */\n    public function isStarted();\n\n    /**\n     * Start this Transport mechanism.\n     */\n    public function start();\n\n    /**\n     * Stop this Transport mechanism.\n     */\n    public function stop();\n\n    /**\n     * Send the given Message.\n     *\n     * Recipient/sender data will be retrieved from the Message API.\n     * The return value is the number of recipients who were accepted for delivery.\n     *\n     * @param Swift_Mime_Message $message\n     * @param string[]           $failedRecipients An array of failures by-reference\n     *\n     * @return int\n     */\n    public function send(Swift_Mime_Message $message, &$failedRecipients = null);\n\n    /**\n     * Register a plugin in the Transport.\n     *\n     * @param Swift_Events_EventListener $plugin\n     */\n    public function registerPlugin(Swift_Events_EventListener $plugin);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/TransportException.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * TransportException thrown when an error occurs in the Transport subsystem.\n *\n * @author Chris Corbyn\n */\nclass Swift_TransportException extends Swift_IoException{\n    /**\n     * Create a new TransportException with $message.\n     *\n     * @param string    $message\n     * @param int       $code\n     * @param Exception $previous\n     */\n    public function __construct($message, $code = 0, Exception $previous = null) {\n        parent::__construct($message, $code, $previous);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift/Validate.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * Utility Class allowing users to simply check expressions again Swift Grammar.\n *\n * @author  Xavier De Cock <xdecock@gmail.com>\n */\nclass Swift_Validate{\n    /**\n     * Grammar Object.\n     *\n     * @var Swift_Mime_Grammar\n     */\n    private static $grammar = null;\n\n    /**\n     * Checks if an e-mail address matches the current grammars.\n     *\n     * @param string $email\n     *\n     * @return bool\n     */\n    public static function email($email) {\n        if (self::$grammar === null) {\n            self::$grammar = Swift_DependencyContainer::getInstance()\n                ->lookup('mime.grammar');\n        }\n\n        return (bool) preg_match(\n                '/^'.self::$grammar->getDefinition('addr-spec').'$/D',\n                $email\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/classes/Swift.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/**\n * General utility class in Swift Mailer, not to be instantiated.\n *\n *\n * @author Chris Corbyn\n */\nabstract class Swift{\n    /** Swift Mailer Version number generated during dist release process */\n    const VERSION = '@SWIFT_VERSION_NUMBER@';\n\n    public static $initialized = false;\n    public static $inits = array();\n\n    /**\n     * Registers an initializer callable that will be called the first time\n     * a SwiftMailer class is autoloaded.\n     *\n     * This enables you to tweak the default configuration in a lazy way.\n     *\n     * @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class\n     */\n    public static function init($callable) {\n        self::$inits[] = $callable;\n    }\n\n    /**\n     * Internal autoloader for spl_autoload_register().\n     *\n     * @param string $class\n     */\n    public static function autoload($class) {\n        // Don't interfere with other autoloaders\n        if (0 !== strpos($class, 'Swift_')) {\n            return;\n        }\n\n        $path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';\n\n        if (!file_exists($path)) {\n            return;\n        }\n\n        require $path;\n\n        if (self::$inits && !self::$initialized) {\n            self::$initialized = true;\n            foreach (self::$inits as $init) {\n                call_user_func($init);\n            }\n        }\n    }\n\n    /**\n     * Configure autoloading using Swift Mailer.\n     *\n     * This is designed to play nicely with other autoloaders.\n     *\n     * @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class\n     */\n    public static function registerAutoload($callable = null) {\n        if (null !== $callable) {\n            self::$inits[] = $callable;\n        }\n        spl_autoload_register(array('Swift', 'autoload'));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/dependency_maps/cache_deps.php",
    "content": "<?php\n\nSwift_DependencyContainer::getInstance()\n    ->register('cache')\n    ->asAliasOf('cache.array')\n\n    ->register('tempdir')\n    ->asValue('/tmp')\n\n    ->register('cache.null')\n    ->asSharedInstanceOf('Swift_KeyCache_NullKeyCache')\n\n    ->register('cache.array')\n    ->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache')\n    ->withDependencies(array('cache.inputstream'))\n\n    ->register('cache.disk')\n    ->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache')\n    ->withDependencies(array('cache.inputstream', 'tempdir'))\n\n    ->register('cache.inputstream')\n    ->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream')\n;\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/dependency_maps/message_deps.php",
    "content": "<?php\n\nSwift_DependencyContainer::getInstance()\n    ->register('message.message')\n    ->asNewInstanceOf('Swift_Message')\n\n    ->register('message.mimepart')\n    ->asNewInstanceOf('Swift_MimePart')\n;\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/dependency_maps/mime_deps.php",
    "content": "<?php\n\nrequire dirname(__FILE__).'/../mime_types.php';\n\nSwift_DependencyContainer::getInstance()\n    ->register('properties.charset')\n    ->asValue('utf-8')\n\n    ->register('mime.grammar')\n    ->asSharedInstanceOf('Swift_Mime_Grammar')\n\n    ->register('mime.message')\n    ->asNewInstanceOf('Swift_Mime_SimpleMessage')\n    ->withDependencies(array(\n        'mime.headerset',\n        'mime.qpcontentencoder',\n        'cache',\n        'mime.grammar',\n        'properties.charset',\n    ))\n\n    ->register('mime.part')\n    ->asNewInstanceOf('Swift_Mime_MimePart')\n    ->withDependencies(array(\n        'mime.headerset',\n        'mime.qpcontentencoder',\n        'cache',\n        'mime.grammar',\n        'properties.charset',\n    ))\n\n    ->register('mime.attachment')\n    ->asNewInstanceOf('Swift_Mime_Attachment')\n    ->withDependencies(array(\n        'mime.headerset',\n        'mime.base64contentencoder',\n        'cache',\n        'mime.grammar',\n    ))\n    ->addConstructorValue($swift_mime_types)\n\n    ->register('mime.embeddedfile')\n    ->asNewInstanceOf('Swift_Mime_EmbeddedFile')\n    ->withDependencies(array(\n        'mime.headerset',\n        'mime.base64contentencoder',\n        'cache',\n        'mime.grammar',\n    ))\n    ->addConstructorValue($swift_mime_types)\n\n    ->register('mime.headerfactory')\n    ->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory')\n    ->withDependencies(array(\n            'mime.qpheaderencoder',\n            'mime.rfc2231encoder',\n            'mime.grammar',\n            'properties.charset',\n        ))\n\n    ->register('mime.headerset')\n    ->asNewInstanceOf('Swift_Mime_SimpleHeaderSet')\n    ->withDependencies(array('mime.headerfactory', 'properties.charset'))\n\n    ->register('mime.qpheaderencoder')\n    ->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder')\n    ->withDependencies(array('mime.charstream'))\n\n    ->register('mime.base64headerencoder')\n    ->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder')\n    ->withDependencies(array('mime.charstream'))\n\n    ->register('mime.charstream')\n    ->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')\n    ->withDependencies(array('mime.characterreaderfactory', 'properties.charset'))\n\n    ->register('mime.bytecanonicalizer')\n    ->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter')\n    ->addConstructorValue(array(array(0x0D, 0x0A), array(0x0D), array(0x0A)))\n    ->addConstructorValue(array(array(0x0A), array(0x0A), array(0x0D, 0x0A)))\n\n    ->register('mime.characterreaderfactory')\n    ->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory')\n\n    ->register('mime.safeqpcontentencoder')\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')\n    ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))\n\n    ->register('mime.rawcontentencoder')\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder')\n\n    ->register('mime.nativeqpcontentencoder')\n    ->withDependencies(array('properties.charset'))\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder')\n\n    ->register('mime.qpcontentencoderproxy')\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy')\n    ->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'))\n\n    ->register('mime.7bitcontentencoder')\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')\n    ->addConstructorValue('7bit')\n    ->addConstructorValue(true)\n\n    ->register('mime.8bitcontentencoder')\n    ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')\n    ->addConstructorValue('8bit')\n    ->addConstructorValue(true)\n\n    ->register('mime.base64contentencoder')\n    ->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder')\n\n    ->register('mime.rfc2231encoder')\n    ->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder')\n    ->withDependencies(array('mime.charstream'))\n\n    // As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly.\n    // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629\n    ->register('mime.qpcontentencoder')\n    ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')\n;\n\nunset($swift_mime_types);\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/dependency_maps/transport_deps.php",
    "content": "<?php\n\nSwift_DependencyContainer::getInstance()\n    ->register('transport.smtp')\n    ->asNewInstanceOf('Swift_Transport_EsmtpTransport')\n    ->withDependencies(array(\n        'transport.buffer',\n        array('transport.authhandler'),\n        'transport.eventdispatcher',\n    ))\n\n    ->register('transport.sendmail')\n    ->asNewInstanceOf('Swift_Transport_SendmailTransport')\n    ->withDependencies(array(\n        'transport.buffer',\n        'transport.eventdispatcher',\n    ))\n\n    ->register('transport.mail')\n    ->asNewInstanceOf('Swift_Transport_MailTransport')\n    ->withDependencies(array('transport.mailinvoker', 'transport.eventdispatcher'))\n\n    ->register('transport.loadbalanced')\n    ->asNewInstanceOf('Swift_Transport_LoadBalancedTransport')\n\n    ->register('transport.failover')\n    ->asNewInstanceOf('Swift_Transport_FailoverTransport')\n\n    ->register('transport.spool')\n    ->asNewInstanceOf('Swift_Transport_SpoolTransport')\n    ->withDependencies(array('transport.eventdispatcher'))\n\n    ->register('transport.null')\n    ->asNewInstanceOf('Swift_Transport_NullTransport')\n    ->withDependencies(array('transport.eventdispatcher'))\n\n    ->register('transport.mailinvoker')\n    ->asSharedInstanceOf('Swift_Transport_SimpleMailInvoker')\n\n    ->register('transport.buffer')\n    ->asNewInstanceOf('Swift_Transport_StreamBuffer')\n    ->withDependencies(array('transport.replacementfactory'))\n\n    ->register('transport.authhandler')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler')\n    ->withDependencies(array(\n        array(\n            'transport.crammd5auth',\n            'transport.loginauth',\n            'transport.plainauth',\n            'transport.ntlmauth',\n            'transport.xoauth2auth',\n        ),\n    ))\n\n    ->register('transport.crammd5auth')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator')\n\n    ->register('transport.loginauth')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_LoginAuthenticator')\n\n    ->register('transport.plainauth')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_PlainAuthenticator')\n\n    ->register('transport.xoauth2auth')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_XOAuth2Authenticator')\n\n    ->register('transport.ntlmauth')\n    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_NTLMAuthenticator')\n\n    ->register('transport.eventdispatcher')\n    ->asNewInstanceOf('Swift_Events_SimpleEventDispatcher')\n\n    ->register('transport.replacementfactory')\n    ->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory')\n;\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/mime_types.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n *\n * autogenerated using http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\n * and https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml\n */\n\n/*\n * List of MIME type automatically detected in Swift Mailer.\n */\n\n// You may add or take away what you like (lowercase required)\n\n$swift_mime_types = array(\n    '3dml' => 'text/vnd.in3d.3dml',\n    '3ds' => 'image/x-3ds',\n    '3g2' => 'video/3gpp2',\n    '3gp' => 'video/3gpp',\n    '7z' => 'application/x-7z-compressed',\n    'aab' => 'application/x-authorware-bin',\n    'aac' => 'audio/x-aac',\n    'aam' => 'application/x-authorware-map',\n    'aas' => 'application/x-authorware-seg',\n    'abw' => 'application/x-abiword',\n    'ac' => 'application/pkix-attr-cert',\n    'acc' => 'application/vnd.americandynamics.acc',\n    'ace' => 'application/x-ace-compressed',\n    'acu' => 'application/vnd.acucobol',\n    'acutc' => 'application/vnd.acucorp',\n    'adp' => 'audio/adpcm',\n    'aep' => 'application/vnd.audiograph',\n    'afm' => 'application/x-font-type1',\n    'afp' => 'application/vnd.ibm.modcap',\n    'ahead' => 'application/vnd.ahead.space',\n    'ai' => 'application/postscript',\n    'aif' => 'audio/x-aiff',\n    'aifc' => 'audio/x-aiff',\n    'aiff' => 'audio/x-aiff',\n    'air' => 'application/vnd.adobe.air-application-installer-package+zip',\n    'ait' => 'application/vnd.dvb.ait',\n    'ami' => 'application/vnd.amiga.ami',\n    'apk' => 'application/vnd.android.package-archive',\n    'appcache' => 'text/cache-manifest',\n    'apr' => 'application/vnd.lotus-approach',\n    'aps' => 'application/postscript',\n    'arc' => 'application/x-freearc',\n    'asc' => 'application/pgp-signature',\n    'asf' => 'video/x-ms-asf',\n    'asm' => 'text/x-asm',\n    'aso' => 'application/vnd.accpac.simply.aso',\n    'asx' => 'video/x-ms-asf',\n    'atc' => 'application/vnd.acucorp',\n    'atom' => 'application/atom+xml',\n    'atomcat' => 'application/atomcat+xml',\n    'atomsvc' => 'application/atomsvc+xml',\n    'atx' => 'application/vnd.antix.game-component',\n    'au' => 'audio/basic',\n    'avi' => 'video/x-msvideo',\n    'aw' => 'application/applixware',\n    'azf' => 'application/vnd.airzip.filesecure.azf',\n    'azs' => 'application/vnd.airzip.filesecure.azs',\n    'azw' => 'application/vnd.amazon.ebook',\n    'bat' => 'application/x-msdownload',\n    'bcpio' => 'application/x-bcpio',\n    'bdf' => 'application/x-font-bdf',\n    'bdm' => 'application/vnd.syncml.dm+wbxml',\n    'bed' => 'application/vnd.realvnc.bed',\n    'bh2' => 'application/vnd.fujitsu.oasysprs',\n    'bin' => 'application/octet-stream',\n    'blb' => 'application/x-blorb',\n    'blorb' => 'application/x-blorb',\n    'bmi' => 'application/vnd.bmi',\n    'bmp' => 'image/bmp',\n    'book' => 'application/vnd.framemaker',\n    'box' => 'application/vnd.previewsystems.box',\n    'boz' => 'application/x-bzip2',\n    'bpk' => 'application/octet-stream',\n    'btif' => 'image/prs.btif',\n    'bz' => 'application/x-bzip',\n    'bz2' => 'application/x-bzip2',\n    'c' => 'text/x-c',\n    'c11amc' => 'application/vnd.cluetrust.cartomobile-config',\n    'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',\n    'c4d' => 'application/vnd.clonk.c4group',\n    'c4f' => 'application/vnd.clonk.c4group',\n    'c4g' => 'application/vnd.clonk.c4group',\n    'c4p' => 'application/vnd.clonk.c4group',\n    'c4u' => 'application/vnd.clonk.c4group',\n    'cab' => 'application/vnd.ms-cab-compressed',\n    'caf' => 'audio/x-caf',\n    'cap' => 'application/vnd.tcpdump.pcap',\n    'car' => 'application/vnd.curl.car',\n    'cat' => 'application/vnd.ms-pki.seccat',\n    'cb7' => 'application/x-cbr',\n    'cba' => 'application/x-cbr',\n    'cbr' => 'application/x-cbr',\n    'cbt' => 'application/x-cbr',\n    'cbz' => 'application/x-cbr',\n    'cc' => 'text/x-c',\n    'cct' => 'application/x-director',\n    'ccxml' => 'application/ccxml+xml',\n    'cdbcmsg' => 'application/vnd.contact.cmsg',\n    'cdf' => 'application/x-netcdf',\n    'cdkey' => 'application/vnd.mediastation.cdkey',\n    'cdmia' => 'application/cdmi-capability',\n    'cdmic' => 'application/cdmi-container',\n    'cdmid' => 'application/cdmi-domain',\n    'cdmio' => 'application/cdmi-object',\n    'cdmiq' => 'application/cdmi-queue',\n    'cdx' => 'chemical/x-cdx',\n    'cdxml' => 'application/vnd.chemdraw+xml',\n    'cdy' => 'application/vnd.cinderella',\n    'cer' => 'application/pkix-cert',\n    'cfs' => 'application/x-cfs-compressed',\n    'cgm' => 'image/cgm',\n    'chat' => 'application/x-chat',\n    'chm' => 'application/vnd.ms-htmlhelp',\n    'chrt' => 'application/vnd.kde.kchart',\n    'cif' => 'chemical/x-cif',\n    'cii' => 'application/vnd.anser-web-certificate-issue-initiation',\n    'cil' => 'application/vnd.ms-artgalry',\n    'cla' => 'application/vnd.claymore',\n    'class' => 'application/java-vm',\n    'clkk' => 'application/vnd.crick.clicker.keyboard',\n    'clkp' => 'application/vnd.crick.clicker.palette',\n    'clkt' => 'application/vnd.crick.clicker.template',\n    'clkw' => 'application/vnd.crick.clicker.wordbank',\n    'clkx' => 'application/vnd.crick.clicker',\n    'clp' => 'application/x-msclip',\n    'cmc' => 'application/vnd.cosmocaller',\n    'cmdf' => 'chemical/x-cmdf',\n    'cml' => 'chemical/x-cml',\n    'cmp' => 'application/vnd.yellowriver-custom-menu',\n    'cmx' => 'image/x-cmx',\n    'cod' => 'application/vnd.rim.cod',\n    'com' => 'application/x-msdownload',\n    'conf' => 'text/plain',\n    'cpio' => 'application/x-cpio',\n    'cpp' => 'text/x-c',\n    'cpt' => 'application/mac-compactpro',\n    'crd' => 'application/x-mscardfile',\n    'crl' => 'application/pkix-crl',\n    'crt' => 'application/x-x509-ca-cert',\n    'csh' => 'application/x-csh',\n    'csml' => 'chemical/x-csml',\n    'csp' => 'application/vnd.commonspace',\n    'css' => 'text/css',\n    'cst' => 'application/x-director',\n    'csv' => 'text/csv',\n    'cu' => 'application/cu-seeme',\n    'curl' => 'text/vnd.curl',\n    'cww' => 'application/prs.cww',\n    'cxt' => 'application/x-director',\n    'cxx' => 'text/x-c',\n    'dae' => 'model/vnd.collada+xml',\n    'daf' => 'application/vnd.mobius.daf',\n    'dart' => 'application/vnd.dart',\n    'dataless' => 'application/vnd.fdsn.seed',\n    'davmount' => 'application/davmount+xml',\n    'dbk' => 'application/docbook+xml',\n    'dcr' => 'application/x-director',\n    'dcurl' => 'text/vnd.curl.dcurl',\n    'dd2' => 'application/vnd.oma.dd2+xml',\n    'ddd' => 'application/vnd.fujixerox.ddd',\n    'deb' => 'application/x-debian-package',\n    'def' => 'text/plain',\n    'deploy' => 'application/octet-stream',\n    'der' => 'application/x-x509-ca-cert',\n    'dfac' => 'application/vnd.dreamfactory',\n    'dgc' => 'application/x-dgc-compressed',\n    'dic' => 'text/x-c',\n    'dir' => 'application/x-director',\n    'dis' => 'application/vnd.mobius.dis',\n    'dist' => 'application/octet-stream',\n    'distz' => 'application/octet-stream',\n    'djv' => 'image/vnd.djvu',\n    'djvu' => 'image/vnd.djvu',\n    'dll' => 'application/x-msdownload',\n    'dmg' => 'application/x-apple-diskimage',\n    'dmp' => 'application/vnd.tcpdump.pcap',\n    'dms' => 'application/octet-stream',\n    'dna' => 'application/vnd.dna',\n    'doc' => 'application/msword',\n    'docm' => 'application/vnd.ms-word.document.macroenabled.12',\n    'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n    'dot' => 'application/msword',\n    'dotm' => 'application/vnd.ms-word.template.macroenabled.12',\n    'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',\n    'dp' => 'application/vnd.osgi.dp',\n    'dpg' => 'application/vnd.dpgraph',\n    'dra' => 'audio/vnd.dra',\n    'dsc' => 'text/prs.lines.tag',\n    'dssc' => 'application/dssc+der',\n    'dtb' => 'application/x-dtbook+xml',\n    'dtd' => 'application/xml-dtd',\n    'dts' => 'audio/vnd.dts',\n    'dtshd' => 'audio/vnd.dts.hd',\n    'dump' => 'application/octet-stream',\n    'dvb' => 'video/vnd.dvb.file',\n    'dvi' => 'application/x-dvi',\n    'dwf' => 'model/vnd.dwf',\n    'dwg' => 'image/vnd.dwg',\n    'dxf' => 'image/vnd.dxf',\n    'dxp' => 'application/vnd.spotfire.dxp',\n    'dxr' => 'application/x-director',\n    'ecelp4800' => 'audio/vnd.nuera.ecelp4800',\n    'ecelp7470' => 'audio/vnd.nuera.ecelp7470',\n    'ecelp9600' => 'audio/vnd.nuera.ecelp9600',\n    'ecma' => 'application/ecmascript',\n    'edm' => 'application/vnd.novadigm.edm',\n    'edx' => 'application/vnd.novadigm.edx',\n    'efif' => 'application/vnd.picsel',\n    'ei6' => 'application/vnd.pg.osasli',\n    'elc' => 'application/octet-stream',\n    'emf' => 'application/x-msmetafile',\n    'eml' => 'message/rfc822',\n    'emma' => 'application/emma+xml',\n    'emz' => 'application/x-msmetafile',\n    'eol' => 'audio/vnd.digital-winds',\n    'eot' => 'application/vnd.ms-fontobject',\n    'eps' => 'application/postscript',\n    'epub' => 'application/epub+zip',\n    'es3' => 'application/vnd.eszigno3+xml',\n    'esa' => 'application/vnd.osgi.subsystem',\n    'esf' => 'application/vnd.epson.esf',\n    'et3' => 'application/vnd.eszigno3+xml',\n    'etx' => 'text/x-setext',\n    'eva' => 'application/x-eva',\n    'evy' => 'application/x-envoy',\n    'exe' => 'application/x-msdownload',\n    'exi' => 'application/exi',\n    'ext' => 'application/vnd.novadigm.ext',\n    'ez' => 'application/andrew-inset',\n    'ez2' => 'application/vnd.ezpix-album',\n    'ez3' => 'application/vnd.ezpix-package',\n    'f' => 'text/x-fortran',\n    'f4v' => 'video/x-f4v',\n    'f77' => 'text/x-fortran',\n    'f90' => 'text/x-fortran',\n    'fbs' => 'image/vnd.fastbidsheet',\n    'fcdt' => 'application/vnd.adobe.formscentral.fcdt',\n    'fcs' => 'application/vnd.isac.fcs',\n    'fdf' => 'application/vnd.fdf',\n    'fe_launch' => 'application/vnd.denovo.fcselayout-link',\n    'fg5' => 'application/vnd.fujitsu.oasysgp',\n    'fgd' => 'application/x-director',\n    'fh' => 'image/x-freehand',\n    'fh4' => 'image/x-freehand',\n    'fh5' => 'image/x-freehand',\n    'fh7' => 'image/x-freehand',\n    'fhc' => 'image/x-freehand',\n    'fig' => 'application/x-xfig',\n    'flac' => 'audio/x-flac',\n    'fli' => 'video/x-fli',\n    'flo' => 'application/vnd.micrografx.flo',\n    'flv' => 'video/x-flv',\n    'flw' => 'application/vnd.kde.kivio',\n    'flx' => 'text/vnd.fmi.flexstor',\n    'fly' => 'text/vnd.fly',\n    'fm' => 'application/vnd.framemaker',\n    'fnc' => 'application/vnd.frogans.fnc',\n    'for' => 'text/x-fortran',\n    'fpx' => 'image/vnd.fpx',\n    'frame' => 'application/vnd.framemaker',\n    'fsc' => 'application/vnd.fsc.weblaunch',\n    'fst' => 'image/vnd.fst',\n    'ftc' => 'application/vnd.fluxtime.clip',\n    'fti' => 'application/vnd.anser-web-funds-transfer-initiation',\n    'fvt' => 'video/vnd.fvt',\n    'fxp' => 'application/vnd.adobe.fxp',\n    'fxpl' => 'application/vnd.adobe.fxp',\n    'fzs' => 'application/vnd.fuzzysheet',\n    'g2w' => 'application/vnd.geoplan',\n    'g3' => 'image/g3fax',\n    'g3w' => 'application/vnd.geospace',\n    'gac' => 'application/vnd.groove-account',\n    'gam' => 'application/x-tads',\n    'gbr' => 'application/rpki-ghostbusters',\n    'gca' => 'application/x-gca-compressed',\n    'gdl' => 'model/vnd.gdl',\n    'geo' => 'application/vnd.dynageo',\n    'gex' => 'application/vnd.geometry-explorer',\n    'ggb' => 'application/vnd.geogebra.file',\n    'ggt' => 'application/vnd.geogebra.tool',\n    'ghf' => 'application/vnd.groove-help',\n    'gif' => 'image/gif',\n    'gim' => 'application/vnd.groove-identity-message',\n    'gml' => 'application/gml+xml',\n    'gmx' => 'application/vnd.gmx',\n    'gnumeric' => 'application/x-gnumeric',\n    'gph' => 'application/vnd.flographit',\n    'gpx' => 'application/gpx+xml',\n    'gqf' => 'application/vnd.grafeq',\n    'gqs' => 'application/vnd.grafeq',\n    'gram' => 'application/srgs',\n    'gramps' => 'application/x-gramps-xml',\n    'gre' => 'application/vnd.geometry-explorer',\n    'grv' => 'application/vnd.groove-injector',\n    'grxml' => 'application/srgs+xml',\n    'gsf' => 'application/x-font-ghostscript',\n    'gtar' => 'application/x-gtar',\n    'gtm' => 'application/vnd.groove-tool-message',\n    'gtw' => 'model/vnd.gtw',\n    'gv' => 'text/vnd.graphviz',\n    'gxf' => 'application/gxf',\n    'gxt' => 'application/vnd.geonext',\n    'gz' => 'application/x-gzip',\n    'h' => 'text/x-c',\n    'h261' => 'video/h261',\n    'h263' => 'video/h263',\n    'h264' => 'video/h264',\n    'hal' => 'application/vnd.hal+xml',\n    'hbci' => 'application/vnd.hbci',\n    'hdf' => 'application/x-hdf',\n    'hh' => 'text/x-c',\n    'hlp' => 'application/winhlp',\n    'hpgl' => 'application/vnd.hp-hpgl',\n    'hpid' => 'application/vnd.hp-hpid',\n    'hps' => 'application/vnd.hp-hps',\n    'hqx' => 'application/mac-binhex40',\n    'htke' => 'application/vnd.kenameaapp',\n    'htm' => 'text/html',\n    'html' => 'text/html',\n    'hvd' => 'application/vnd.yamaha.hv-dic',\n    'hvp' => 'application/vnd.yamaha.hv-voice',\n    'hvs' => 'application/vnd.yamaha.hv-script',\n    'i2g' => 'application/vnd.intergeo',\n    'icc' => 'application/vnd.iccprofile',\n    'ice' => 'x-conference/x-cooltalk',\n    'icm' => 'application/vnd.iccprofile',\n    'ico' => 'image/x-icon',\n    'ics' => 'text/calendar',\n    'ief' => 'image/ief',\n    'ifb' => 'text/calendar',\n    'ifm' => 'application/vnd.shana.informed.formdata',\n    'iges' => 'model/iges',\n    'igl' => 'application/vnd.igloader',\n    'igm' => 'application/vnd.insors.igm',\n    'igs' => 'model/iges',\n    'igx' => 'application/vnd.micrografx.igx',\n    'iif' => 'application/vnd.shana.informed.interchange',\n    'imp' => 'application/vnd.accpac.simply.imp',\n    'ims' => 'application/vnd.ms-ims',\n    'in' => 'text/plain',\n    'ink' => 'application/inkml+xml',\n    'inkml' => 'application/inkml+xml',\n    'install' => 'application/x-install-instructions',\n    'iota' => 'application/vnd.astraea-software.iota',\n    'ipfix' => 'application/ipfix',\n    'ipk' => 'application/vnd.shana.informed.package',\n    'irm' => 'application/vnd.ibm.rights-management',\n    'irp' => 'application/vnd.irepository.package+xml',\n    'iso' => 'application/x-iso9660-image',\n    'itp' => 'application/vnd.shana.informed.formtemplate',\n    'ivp' => 'application/vnd.immervision-ivp',\n    'ivu' => 'application/vnd.immervision-ivu',\n    'jad' => 'text/vnd.sun.j2me.app-descriptor',\n    'jam' => 'application/vnd.jam',\n    'jar' => 'application/java-archive',\n    'java' => 'text/x-java-source',\n    'jisp' => 'application/vnd.jisp',\n    'jlt' => 'application/vnd.hp-jlyt',\n    'jnlp' => 'application/x-java-jnlp-file',\n    'joda' => 'application/vnd.joost.joda-archive',\n    'jpe' => 'image/jpeg',\n    'jpeg' => 'image/jpeg',\n    'jpg' => 'image/jpeg',\n    'jpgm' => 'video/jpm',\n    'jpgv' => 'video/jpeg',\n    'jpm' => 'video/jpm',\n    'js' => 'application/javascript',\n    'json' => 'application/json',\n    'jsonml' => 'application/jsonml+json',\n    'kar' => 'audio/midi',\n    'karbon' => 'application/vnd.kde.karbon',\n    'kfo' => 'application/vnd.kde.kformula',\n    'kia' => 'application/vnd.kidspiration',\n    'kml' => 'application/vnd.google-earth.kml+xml',\n    'kmz' => 'application/vnd.google-earth.kmz',\n    'kne' => 'application/vnd.kinar',\n    'knp' => 'application/vnd.kinar',\n    'kon' => 'application/vnd.kde.kontour',\n    'kpr' => 'application/vnd.kde.kpresenter',\n    'kpt' => 'application/vnd.kde.kpresenter',\n    'kpxx' => 'application/vnd.ds-keypoint',\n    'ksp' => 'application/vnd.kde.kspread',\n    'ktr' => 'application/vnd.kahootz',\n    'ktx' => 'image/ktx',\n    'ktz' => 'application/vnd.kahootz',\n    'kwd' => 'application/vnd.kde.kword',\n    'kwt' => 'application/vnd.kde.kword',\n    'lasxml' => 'application/vnd.las.las+xml',\n    'latex' => 'application/x-latex',\n    'lbd' => 'application/vnd.llamagraphics.life-balance.desktop',\n    'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',\n    'les' => 'application/vnd.hhe.lesson-player',\n    'lha' => 'application/x-lzh-compressed',\n    'link66' => 'application/vnd.route66.link66+xml',\n    'list' => 'text/plain',\n    'list3820' => 'application/vnd.ibm.modcap',\n    'listafp' => 'application/vnd.ibm.modcap',\n    'lnk' => 'application/x-ms-shortcut',\n    'log' => 'text/plain',\n    'lostxml' => 'application/lost+xml',\n    'lrf' => 'application/octet-stream',\n    'lrm' => 'application/vnd.ms-lrm',\n    'ltf' => 'application/vnd.frogans.ltf',\n    'lvp' => 'audio/vnd.lucent.voice',\n    'lwp' => 'application/vnd.lotus-wordpro',\n    'lzh' => 'application/x-lzh-compressed',\n    'm13' => 'application/x-msmediaview',\n    'm14' => 'application/x-msmediaview',\n    'm1v' => 'video/mpeg',\n    'm21' => 'application/mp21',\n    'm2a' => 'audio/mpeg',\n    'm2v' => 'video/mpeg',\n    'm3a' => 'audio/mpeg',\n    'm3u' => 'audio/x-mpegurl',\n    'm3u8' => 'application/vnd.apple.mpegurl',\n    'm4a' => 'audio/mp4',\n    'm4u' => 'video/vnd.mpegurl',\n    'm4v' => 'video/x-m4v',\n    'ma' => 'application/mathematica',\n    'mads' => 'application/mads+xml',\n    'mag' => 'application/vnd.ecowin.chart',\n    'maker' => 'application/vnd.framemaker',\n    'man' => 'text/troff',\n    'mar' => 'application/octet-stream',\n    'mathml' => 'application/mathml+xml',\n    'mb' => 'application/mathematica',\n    'mbk' => 'application/vnd.mobius.mbk',\n    'mbox' => 'application/mbox',\n    'mc1' => 'application/vnd.medcalcdata',\n    'mcd' => 'application/vnd.mcd',\n    'mcurl' => 'text/vnd.curl.mcurl',\n    'mdb' => 'application/x-msaccess',\n    'mdi' => 'image/vnd.ms-modi',\n    'me' => 'text/troff',\n    'mesh' => 'model/mesh',\n    'meta4' => 'application/metalink4+xml',\n    'metalink' => 'application/metalink+xml',\n    'mets' => 'application/mets+xml',\n    'mfm' => 'application/vnd.mfmp',\n    'mft' => 'application/rpki-manifest',\n    'mgp' => 'application/vnd.osgeo.mapguide.package',\n    'mgz' => 'application/vnd.proteus.magazine',\n    'mid' => 'audio/midi',\n    'midi' => 'audio/midi',\n    'mie' => 'application/x-mie',\n    'mif' => 'application/vnd.mif',\n    'mime' => 'message/rfc822',\n    'mj2' => 'video/mj2',\n    'mjp2' => 'video/mj2',\n    'mk3d' => 'video/x-matroska',\n    'mka' => 'audio/x-matroska',\n    'mks' => 'video/x-matroska',\n    'mkv' => 'video/x-matroska',\n    'mlp' => 'application/vnd.dolby.mlp',\n    'mmd' => 'application/vnd.chipnuts.karaoke-mmd',\n    'mmf' => 'application/vnd.smaf',\n    'mmr' => 'image/vnd.fujixerox.edmics-mmr',\n    'mng' => 'video/x-mng',\n    'mny' => 'application/x-msmoney',\n    'mobi' => 'application/x-mobipocket-ebook',\n    'mods' => 'application/mods+xml',\n    'mov' => 'video/quicktime',\n    'movie' => 'video/x-sgi-movie',\n    'mp2' => 'audio/mpeg',\n    'mp21' => 'application/mp21',\n    'mp2a' => 'audio/mpeg',\n    'mp3' => 'audio/mpeg',\n    'mp4' => 'video/mp4',\n    'mp4a' => 'audio/mp4',\n    'mp4s' => 'application/mp4',\n    'mp4v' => 'video/mp4',\n    'mpc' => 'application/vnd.mophun.certificate',\n    'mpe' => 'video/mpeg',\n    'mpeg' => 'video/mpeg',\n    'mpg' => 'video/mpeg',\n    'mpg4' => 'video/mp4',\n    'mpga' => 'audio/mpeg',\n    'mpkg' => 'application/vnd.apple.installer+xml',\n    'mpm' => 'application/vnd.blueice.multipass',\n    'mpn' => 'application/vnd.mophun.application',\n    'mpp' => 'application/vnd.ms-project',\n    'mpt' => 'application/vnd.ms-project',\n    'mpy' => 'application/vnd.ibm.minipay',\n    'mqy' => 'application/vnd.mobius.mqy',\n    'mrc' => 'application/marc',\n    'mrcx' => 'application/marcxml+xml',\n    'ms' => 'text/troff',\n    'mscml' => 'application/mediaservercontrol+xml',\n    'mseed' => 'application/vnd.fdsn.mseed',\n    'mseq' => 'application/vnd.mseq',\n    'msf' => 'application/vnd.epson.msf',\n    'msh' => 'model/mesh',\n    'msi' => 'application/x-msdownload',\n    'msl' => 'application/vnd.mobius.msl',\n    'msty' => 'application/vnd.muvee.style',\n    'mts' => 'model/vnd.mts',\n    'mus' => 'application/vnd.musician',\n    'musicxml' => 'application/vnd.recordare.musicxml+xml',\n    'mvb' => 'application/x-msmediaview',\n    'mwf' => 'application/vnd.mfer',\n    'mxf' => 'application/mxf',\n    'mxl' => 'application/vnd.recordare.musicxml',\n    'mxml' => 'application/xv+xml',\n    'mxs' => 'application/vnd.triscape.mxs',\n    'mxu' => 'video/vnd.mpegurl',\n    'n-gage' => 'application/vnd.nokia.n-gage.symbian.install',\n    'n3' => 'text/n3',\n    'nb' => 'application/mathematica',\n    'nbp' => 'application/vnd.wolfram.player',\n    'nc' => 'application/x-netcdf',\n    'ncx' => 'application/x-dtbncx+xml',\n    'nfo' => 'text/x-nfo',\n    'ngdat' => 'application/vnd.nokia.n-gage.data',\n    'nitf' => 'application/vnd.nitf',\n    'nlu' => 'application/vnd.neurolanguage.nlu',\n    'nml' => 'application/vnd.enliven',\n    'nnd' => 'application/vnd.noblenet-directory',\n    'nns' => 'application/vnd.noblenet-sealer',\n    'nnw' => 'application/vnd.noblenet-web',\n    'npx' => 'image/vnd.net-fpx',\n    'nsc' => 'application/x-conference',\n    'nsf' => 'application/vnd.lotus-notes',\n    'ntf' => 'application/vnd.nitf',\n    'nzb' => 'application/x-nzb',\n    'oa2' => 'application/vnd.fujitsu.oasys2',\n    'oa3' => 'application/vnd.fujitsu.oasys3',\n    'oas' => 'application/vnd.fujitsu.oasys',\n    'obd' => 'application/x-msbinder',\n    'obj' => 'application/x-tgif',\n    'oda' => 'application/oda',\n    'odb' => 'application/vnd.oasis.opendocument.database',\n    'odc' => 'application/vnd.oasis.opendocument.chart',\n    'odf' => 'application/vnd.oasis.opendocument.formula',\n    'odft' => 'application/vnd.oasis.opendocument.formula-template',\n    'odg' => 'application/vnd.oasis.opendocument.graphics',\n    'odi' => 'application/vnd.oasis.opendocument.image',\n    'odm' => 'application/vnd.oasis.opendocument.text-master',\n    'odp' => 'application/vnd.oasis.opendocument.presentation',\n    'ods' => 'application/vnd.oasis.opendocument.spreadsheet',\n    'odt' => 'application/vnd.oasis.opendocument.text',\n    'oga' => 'audio/ogg',\n    'ogg' => 'audio/ogg',\n    'ogv' => 'video/ogg',\n    'ogx' => 'application/ogg',\n    'omdoc' => 'application/omdoc+xml',\n    'onepkg' => 'application/onenote',\n    'onetmp' => 'application/onenote',\n    'onetoc' => 'application/onenote',\n    'onetoc2' => 'application/onenote',\n    'opf' => 'application/oebps-package+xml',\n    'opml' => 'text/x-opml',\n    'oprc' => 'application/vnd.palm',\n    'org' => 'application/vnd.lotus-organizer',\n    'osf' => 'application/vnd.yamaha.openscoreformat',\n    'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',\n    'otc' => 'application/vnd.oasis.opendocument.chart-template',\n    'otf' => 'application/x-font-otf',\n    'otg' => 'application/vnd.oasis.opendocument.graphics-template',\n    'oth' => 'application/vnd.oasis.opendocument.text-web',\n    'oti' => 'application/vnd.oasis.opendocument.image-template',\n    'otp' => 'application/vnd.oasis.opendocument.presentation-template',\n    'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',\n    'ott' => 'application/vnd.oasis.opendocument.text-template',\n    'oxps' => 'application/oxps',\n    'oxt' => 'application/vnd.openofficeorg.extension',\n    'p' => 'text/x-pascal',\n    'p10' => 'application/pkcs10',\n    'p12' => 'application/x-pkcs12',\n    'p7b' => 'application/x-pkcs7-certificates',\n    'p7c' => 'application/pkcs7-mime',\n    'p7m' => 'application/pkcs7-mime',\n    'p7r' => 'application/x-pkcs7-certreqresp',\n    'p7s' => 'application/pkcs7-signature',\n    'p8' => 'application/pkcs8',\n    'pas' => 'text/x-pascal',\n    'paw' => 'application/vnd.pawaafile',\n    'pbd' => 'application/vnd.powerbuilder6',\n    'pbm' => 'image/x-portable-bitmap',\n    'pcap' => 'application/vnd.tcpdump.pcap',\n    'pcf' => 'application/x-font-pcf',\n    'pcl' => 'application/vnd.hp-pcl',\n    'pclxl' => 'application/vnd.hp-pclxl',\n    'pct' => 'image/x-pict',\n    'pcurl' => 'application/vnd.curl.pcurl',\n    'pcx' => 'image/x-pcx',\n    'pdb' => 'application/vnd.palm',\n    'pdf' => 'application/pdf',\n    'pfa' => 'application/x-font-type1',\n    'pfb' => 'application/x-font-type1',\n    'pfm' => 'application/x-font-type1',\n    'pfr' => 'application/font-tdpfr',\n    'pfx' => 'application/x-pkcs12',\n    'pgm' => 'image/x-portable-graymap',\n    'pgn' => 'application/x-chess-pgn',\n    'pgp' => 'application/pgp-encrypted',\n    'php' => 'application/x-php',\n    'php3' => 'application/x-php',\n    'php4' => 'application/x-php',\n    'php5' => 'application/x-php',\n    'pic' => 'image/x-pict',\n    'pkg' => 'application/octet-stream',\n    'pki' => 'application/pkixcmp',\n    'pkipath' => 'application/pkix-pkipath',\n    'plb' => 'application/vnd.3gpp.pic-bw-large',\n    'plc' => 'application/vnd.mobius.plc',\n    'plf' => 'application/vnd.pocketlearn',\n    'pls' => 'application/pls+xml',\n    'pml' => 'application/vnd.ctc-posml',\n    'png' => 'image/png',\n    'pnm' => 'image/x-portable-anymap',\n    'portpkg' => 'application/vnd.macports.portpkg',\n    'pot' => 'application/vnd.ms-powerpoint',\n    'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',\n    'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',\n    'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',\n    'ppd' => 'application/vnd.cups-ppd',\n    'ppm' => 'image/x-portable-pixmap',\n    'pps' => 'application/vnd.ms-powerpoint',\n    'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',\n    'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',\n    'ppt' => 'application/vnd.ms-powerpoint',\n    'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',\n    'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n    'pqa' => 'application/vnd.palm',\n    'prc' => 'application/x-mobipocket-ebook',\n    'pre' => 'application/vnd.lotus-freelance',\n    'prf' => 'application/pics-rules',\n    'ps' => 'application/postscript',\n    'psb' => 'application/vnd.3gpp.pic-bw-small',\n    'psd' => 'image/vnd.adobe.photoshop',\n    'psf' => 'application/x-font-linux-psf',\n    'pskcxml' => 'application/pskc+xml',\n    'ptid' => 'application/vnd.pvi.ptid1',\n    'pub' => 'application/x-mspublisher',\n    'pvb' => 'application/vnd.3gpp.pic-bw-var',\n    'pwn' => 'application/vnd.3m.post-it-notes',\n    'pya' => 'audio/vnd.ms-playready.media.pya',\n    'pyv' => 'video/vnd.ms-playready.media.pyv',\n    'qam' => 'application/vnd.epson.quickanime',\n    'qbo' => 'application/vnd.intu.qbo',\n    'qfx' => 'application/vnd.intu.qfx',\n    'qps' => 'application/vnd.publishare-delta-tree',\n    'qt' => 'video/quicktime',\n    'qwd' => 'application/vnd.quark.quarkxpress',\n    'qwt' => 'application/vnd.quark.quarkxpress',\n    'qxb' => 'application/vnd.quark.quarkxpress',\n    'qxd' => 'application/vnd.quark.quarkxpress',\n    'qxl' => 'application/vnd.quark.quarkxpress',\n    'qxt' => 'application/vnd.quark.quarkxpress',\n    'ra' => 'audio/x-pn-realaudio',\n    'ram' => 'audio/x-pn-realaudio',\n    'rar' => 'application/x-rar-compressed',\n    'ras' => 'image/x-cmu-raster',\n    'rcprofile' => 'application/vnd.ipunplugged.rcprofile',\n    'rdf' => 'application/rdf+xml',\n    'rdz' => 'application/vnd.data-vision.rdz',\n    'rep' => 'application/vnd.businessobjects',\n    'res' => 'application/x-dtbresource+xml',\n    'rgb' => 'image/x-rgb',\n    'rif' => 'application/reginfo+xml',\n    'rip' => 'audio/vnd.rip',\n    'ris' => 'application/x-research-info-systems',\n    'rl' => 'application/resource-lists+xml',\n    'rlc' => 'image/vnd.fujixerox.edmics-rlc',\n    'rld' => 'application/resource-lists-diff+xml',\n    'rm' => 'application/vnd.rn-realmedia',\n    'rmi' => 'audio/midi',\n    'rmp' => 'audio/x-pn-realaudio-plugin',\n    'rms' => 'application/vnd.jcp.javame.midlet-rms',\n    'rmvb' => 'application/vnd.rn-realmedia-vbr',\n    'rnc' => 'application/relax-ng-compact-syntax',\n    'roa' => 'application/rpki-roa',\n    'roff' => 'text/troff',\n    'rp9' => 'application/vnd.cloanto.rp9',\n    'rpss' => 'application/vnd.nokia.radio-presets',\n    'rpst' => 'application/vnd.nokia.radio-preset',\n    'rq' => 'application/sparql-query',\n    'rs' => 'application/rls-services+xml',\n    'rsd' => 'application/rsd+xml',\n    'rss' => 'application/rss+xml',\n    'rtf' => 'application/rtf',\n    'rtx' => 'text/richtext',\n    's' => 'text/x-asm',\n    's3m' => 'audio/s3m',\n    'saf' => 'application/vnd.yamaha.smaf-audio',\n    'sbml' => 'application/sbml+xml',\n    'sc' => 'application/vnd.ibm.secure-container',\n    'scd' => 'application/x-msschedule',\n    'scm' => 'application/vnd.lotus-screencam',\n    'scq' => 'application/scvp-cv-request',\n    'scs' => 'application/scvp-cv-response',\n    'scurl' => 'text/vnd.curl.scurl',\n    'sda' => 'application/vnd.stardivision.draw',\n    'sdc' => 'application/vnd.stardivision.calc',\n    'sdd' => 'application/vnd.stardivision.impress',\n    'sdkd' => 'application/vnd.solent.sdkm+xml',\n    'sdkm' => 'application/vnd.solent.sdkm+xml',\n    'sdp' => 'application/sdp',\n    'sdw' => 'application/vnd.stardivision.writer',\n    'see' => 'application/vnd.seemail',\n    'seed' => 'application/vnd.fdsn.seed',\n    'sema' => 'application/vnd.sema',\n    'semd' => 'application/vnd.semd',\n    'semf' => 'application/vnd.semf',\n    'ser' => 'application/java-serialized-object',\n    'setpay' => 'application/set-payment-initiation',\n    'setreg' => 'application/set-registration-initiation',\n    'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',\n    'sfs' => 'application/vnd.spotfire.sfs',\n    'sfv' => 'text/x-sfv',\n    'sgi' => 'image/sgi',\n    'sgl' => 'application/vnd.stardivision.writer-global',\n    'sgm' => 'text/sgml',\n    'sgml' => 'text/sgml',\n    'sh' => 'application/x-sh',\n    'shar' => 'application/x-shar',\n    'shf' => 'application/shf+xml',\n    'sid' => 'image/x-mrsid-image',\n    'sig' => 'application/pgp-signature',\n    'sil' => 'audio/silk',\n    'silo' => 'model/mesh',\n    'sis' => 'application/vnd.symbian.install',\n    'sisx' => 'application/vnd.symbian.install',\n    'sit' => 'application/x-stuffit',\n    'sitx' => 'application/x-stuffitx',\n    'skd' => 'application/vnd.koan',\n    'skm' => 'application/vnd.koan',\n    'skp' => 'application/vnd.koan',\n    'skt' => 'application/vnd.koan',\n    'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',\n    'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',\n    'slt' => 'application/vnd.epson.salt',\n    'sm' => 'application/vnd.stepmania.stepchart',\n    'smf' => 'application/vnd.stardivision.math',\n    'smi' => 'application/smil+xml',\n    'smil' => 'application/smil+xml',\n    'smv' => 'video/x-smv',\n    'smzip' => 'application/vnd.stepmania.package',\n    'snd' => 'audio/basic',\n    'snf' => 'application/x-font-snf',\n    'so' => 'application/octet-stream',\n    'spc' => 'application/x-pkcs7-certificates',\n    'spf' => 'application/vnd.yamaha.smaf-phrase',\n    'spl' => 'application/x-futuresplash',\n    'spot' => 'text/vnd.in3d.spot',\n    'spp' => 'application/scvp-vp-response',\n    'spq' => 'application/scvp-vp-request',\n    'spx' => 'audio/ogg',\n    'sql' => 'application/x-sql',\n    'src' => 'application/x-wais-source',\n    'srt' => 'application/x-subrip',\n    'sru' => 'application/sru+xml',\n    'srx' => 'application/sparql-results+xml',\n    'ssdl' => 'application/ssdl+xml',\n    'sse' => 'application/vnd.kodak-descriptor',\n    'ssf' => 'application/vnd.epson.ssf',\n    'ssml' => 'application/ssml+xml',\n    'st' => 'application/vnd.sailingtracker.track',\n    'stc' => 'application/vnd.sun.xml.calc.template',\n    'std' => 'application/vnd.sun.xml.draw.template',\n    'stf' => 'application/vnd.wt.stf',\n    'sti' => 'application/vnd.sun.xml.impress.template',\n    'stk' => 'application/hyperstudio',\n    'stl' => 'application/vnd.ms-pki.stl',\n    'str' => 'application/vnd.pg.format',\n    'stw' => 'application/vnd.sun.xml.writer.template',\n    'sub' => 'text/vnd.dvb.subtitle',\n    'sus' => 'application/vnd.sus-calendar',\n    'susp' => 'application/vnd.sus-calendar',\n    'sv4cpio' => 'application/x-sv4cpio',\n    'sv4crc' => 'application/x-sv4crc',\n    'svc' => 'application/vnd.dvb.service',\n    'svd' => 'application/vnd.svd',\n    'svg' => 'image/svg+xml',\n    'svgz' => 'image/svg+xml',\n    'swa' => 'application/x-director',\n    'swf' => 'application/x-shockwave-flash',\n    'swi' => 'application/vnd.aristanetworks.swi',\n    'sxc' => 'application/vnd.sun.xml.calc',\n    'sxd' => 'application/vnd.sun.xml.draw',\n    'sxg' => 'application/vnd.sun.xml.writer.global',\n    'sxi' => 'application/vnd.sun.xml.impress',\n    'sxm' => 'application/vnd.sun.xml.math',\n    'sxw' => 'application/vnd.sun.xml.writer',\n    't' => 'text/troff',\n    't3' => 'application/x-t3vm-image',\n    'taglet' => 'application/vnd.mynfc',\n    'tao' => 'application/vnd.tao.intent-module-archive',\n    'tar' => 'application/x-tar',\n    'tcap' => 'application/vnd.3gpp2.tcap',\n    'tcl' => 'application/x-tcl',\n    'teacher' => 'application/vnd.smart.teacher',\n    'tei' => 'application/tei+xml',\n    'teicorpus' => 'application/tei+xml',\n    'tex' => 'application/x-tex',\n    'texi' => 'application/x-texinfo',\n    'texinfo' => 'application/x-texinfo',\n    'text' => 'text/plain',\n    'tfi' => 'application/thraud+xml',\n    'tfm' => 'application/x-tex-tfm',\n    'tga' => 'image/x-tga',\n    'thmx' => 'application/vnd.ms-officetheme',\n    'tif' => 'image/tiff',\n    'tiff' => 'image/tiff',\n    'tmo' => 'application/vnd.tmobile-livetv',\n    'torrent' => 'application/x-bittorrent',\n    'tpl' => 'application/vnd.groove-tool-template',\n    'tpt' => 'application/vnd.trid.tpt',\n    'tr' => 'text/troff',\n    'tra' => 'application/vnd.trueapp',\n    'trm' => 'application/x-msterminal',\n    'tsd' => 'application/timestamped-data',\n    'tsv' => 'text/tab-separated-values',\n    'ttc' => 'application/x-font-ttf',\n    'ttf' => 'application/x-font-ttf',\n    'ttl' => 'text/turtle',\n    'twd' => 'application/vnd.simtech-mindmapper',\n    'twds' => 'application/vnd.simtech-mindmapper',\n    'txd' => 'application/vnd.genomatix.tuxedo',\n    'txf' => 'application/vnd.mobius.txf',\n    'txt' => 'text/plain',\n    'u32' => 'application/x-authorware-bin',\n    'udeb' => 'application/x-debian-package',\n    'ufd' => 'application/vnd.ufdl',\n    'ufdl' => 'application/vnd.ufdl',\n    'ulx' => 'application/x-glulx',\n    'umj' => 'application/vnd.umajin',\n    'unityweb' => 'application/vnd.unity',\n    'uoml' => 'application/vnd.uoml+xml',\n    'uri' => 'text/uri-list',\n    'uris' => 'text/uri-list',\n    'urls' => 'text/uri-list',\n    'ustar' => 'application/x-ustar',\n    'utz' => 'application/vnd.uiq.theme',\n    'uu' => 'text/x-uuencode',\n    'uva' => 'audio/vnd.dece.audio',\n    'uvd' => 'application/vnd.dece.data',\n    'uvf' => 'application/vnd.dece.data',\n    'uvg' => 'image/vnd.dece.graphic',\n    'uvh' => 'video/vnd.dece.hd',\n    'uvi' => 'image/vnd.dece.graphic',\n    'uvm' => 'video/vnd.dece.mobile',\n    'uvp' => 'video/vnd.dece.pd',\n    'uvs' => 'video/vnd.dece.sd',\n    'uvt' => 'application/vnd.dece.ttml+xml',\n    'uvu' => 'video/vnd.uvvu.mp4',\n    'uvv' => 'video/vnd.dece.video',\n    'uvva' => 'audio/vnd.dece.audio',\n    'uvvd' => 'application/vnd.dece.data',\n    'uvvf' => 'application/vnd.dece.data',\n    'uvvg' => 'image/vnd.dece.graphic',\n    'uvvh' => 'video/vnd.dece.hd',\n    'uvvi' => 'image/vnd.dece.graphic',\n    'uvvm' => 'video/vnd.dece.mobile',\n    'uvvp' => 'video/vnd.dece.pd',\n    'uvvs' => 'video/vnd.dece.sd',\n    'uvvt' => 'application/vnd.dece.ttml+xml',\n    'uvvu' => 'video/vnd.uvvu.mp4',\n    'uvvv' => 'video/vnd.dece.video',\n    'uvvx' => 'application/vnd.dece.unspecified',\n    'uvvz' => 'application/vnd.dece.zip',\n    'uvx' => 'application/vnd.dece.unspecified',\n    'uvz' => 'application/vnd.dece.zip',\n    'vcard' => 'text/vcard',\n    'vcd' => 'application/x-cdlink',\n    'vcf' => 'text/x-vcard',\n    'vcg' => 'application/vnd.groove-vcard',\n    'vcs' => 'text/x-vcalendar',\n    'vcx' => 'application/vnd.vcx',\n    'vis' => 'application/vnd.visionary',\n    'viv' => 'video/vnd.vivo',\n    'vob' => 'video/x-ms-vob',\n    'vor' => 'application/vnd.stardivision.writer',\n    'vox' => 'application/x-authorware-bin',\n    'vrml' => 'model/vrml',\n    'vsd' => 'application/vnd.visio',\n    'vsf' => 'application/vnd.vsf',\n    'vss' => 'application/vnd.visio',\n    'vst' => 'application/vnd.visio',\n    'vsw' => 'application/vnd.visio',\n    'vtu' => 'model/vnd.vtu',\n    'vxml' => 'application/voicexml+xml',\n    'w3d' => 'application/x-director',\n    'wad' => 'application/x-doom',\n    'wav' => 'audio/x-wav',\n    'wax' => 'audio/x-ms-wax',\n    'wbmp' => 'image/vnd.wap.wbmp',\n    'wbs' => 'application/vnd.criticaltools.wbs+xml',\n    'wbxml' => 'application/vnd.wap.wbxml',\n    'wcm' => 'application/vnd.ms-works',\n    'wdb' => 'application/vnd.ms-works',\n    'wdp' => 'image/vnd.ms-photo',\n    'weba' => 'audio/webm',\n    'webm' => 'video/webm',\n    'webp' => 'image/webp',\n    'wg' => 'application/vnd.pmi.widget',\n    'wgt' => 'application/widget',\n    'wks' => 'application/vnd.ms-works',\n    'wm' => 'video/x-ms-wm',\n    'wma' => 'audio/x-ms-wma',\n    'wmd' => 'application/x-ms-wmd',\n    'wmf' => 'application/x-msmetafile',\n    'wml' => 'text/vnd.wap.wml',\n    'wmlc' => 'application/vnd.wap.wmlc',\n    'wmls' => 'text/vnd.wap.wmlscript',\n    'wmlsc' => 'application/vnd.wap.wmlscriptc',\n    'wmv' => 'video/x-ms-wmv',\n    'wmx' => 'video/x-ms-wmx',\n    'wmz' => 'application/x-msmetafile',\n    'woff' => 'application/font-woff',\n    'wpd' => 'application/vnd.wordperfect',\n    'wpl' => 'application/vnd.ms-wpl',\n    'wps' => 'application/vnd.ms-works',\n    'wqd' => 'application/vnd.wqd',\n    'wri' => 'application/x-mswrite',\n    'wrl' => 'model/vrml',\n    'wsdl' => 'application/wsdl+xml',\n    'wspolicy' => 'application/wspolicy+xml',\n    'wtb' => 'application/vnd.webturbo',\n    'wvx' => 'video/x-ms-wvx',\n    'x32' => 'application/x-authorware-bin',\n    'x3d' => 'model/x3d+xml',\n    'x3db' => 'model/x3d+binary',\n    'x3dbz' => 'model/x3d+binary',\n    'x3dv' => 'model/x3d+vrml',\n    'x3dvz' => 'model/x3d+vrml',\n    'x3dz' => 'model/x3d+xml',\n    'xaml' => 'application/xaml+xml',\n    'xap' => 'application/x-silverlight-app',\n    'xar' => 'application/vnd.xara',\n    'xbap' => 'application/x-ms-xbap',\n    'xbd' => 'application/vnd.fujixerox.docuworks.binder',\n    'xbm' => 'image/x-xbitmap',\n    'xdf' => 'application/xcap-diff+xml',\n    'xdm' => 'application/vnd.syncml.dm+xml',\n    'xdp' => 'application/vnd.adobe.xdp+xml',\n    'xdssc' => 'application/dssc+xml',\n    'xdw' => 'application/vnd.fujixerox.docuworks',\n    'xenc' => 'application/xenc+xml',\n    'xer' => 'application/patch-ops-error+xml',\n    'xfdf' => 'application/vnd.adobe.xfdf',\n    'xfdl' => 'application/vnd.xfdl',\n    'xht' => 'application/xhtml+xml',\n    'xhtml' => 'application/xhtml+xml',\n    'xhvml' => 'application/xv+xml',\n    'xif' => 'image/vnd.xiff',\n    'xla' => 'application/vnd.ms-excel',\n    'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',\n    'xlc' => 'application/vnd.ms-excel',\n    'xlf' => 'application/x-xliff+xml',\n    'xlm' => 'application/vnd.ms-excel',\n    'xls' => 'application/vnd.ms-excel',\n    'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',\n    'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',\n    'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n    'xlt' => 'application/vnd.ms-excel',\n    'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',\n    'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',\n    'xlw' => 'application/vnd.ms-excel',\n    'xm' => 'audio/xm',\n    'xml' => 'application/xml',\n    'xo' => 'application/vnd.olpc-sugar',\n    'xop' => 'application/xop+xml',\n    'xpi' => 'application/x-xpinstall',\n    'xpl' => 'application/xproc+xml',\n    'xpm' => 'image/x-xpixmap',\n    'xpr' => 'application/vnd.is-xpr',\n    'xps' => 'application/vnd.ms-xpsdocument',\n    'xpw' => 'application/vnd.intercon.formnet',\n    'xpx' => 'application/vnd.intercon.formnet',\n    'xsl' => 'application/xml',\n    'xslt' => 'application/xslt+xml',\n    'xsm' => 'application/vnd.syncml+xml',\n    'xspf' => 'application/xspf+xml',\n    'xul' => 'application/vnd.mozilla.xul+xml',\n    'xvm' => 'application/xv+xml',\n    'xvml' => 'application/xv+xml',\n    'xwd' => 'image/x-xwindowdump',\n    'xyz' => 'chemical/x-xyz',\n    'xz' => 'application/x-xz',\n    'yang' => 'application/yang',\n    'yin' => 'application/yin+xml',\n    'z1' => 'application/x-zmachine',\n    'z2' => 'application/x-zmachine',\n    'z3' => 'application/x-zmachine',\n    'z4' => 'application/x-zmachine',\n    'z5' => 'application/x-zmachine',\n    'z6' => 'application/x-zmachine',\n    'z7' => 'application/x-zmachine',\n    'z8' => 'application/x-zmachine',\n    'zaz' => 'application/vnd.zzazz.deck+xml',\n    'zip' => 'application/zip',\n    'zir' => 'application/vnd.zul',\n    'zirz' => 'application/vnd.zul',\n    'zmm' => 'application/vnd.handheld-entertainment+xml',\n    '123' => 'application/vnd.lotus-1-2-3',\n);\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/preferences.php",
    "content": "<?php\n\n/****************************************************************************/\n/*                                                                          */\n/* YOU MAY WISH TO MODIFY OR REMOVE THE FOLLOWING LINES WHICH SET DEFAULTS  */\n/*                                                                          */\n/****************************************************************************/\n\n$preferences = Swift_Preferences::getInstance();\n\n// Sets the default charset so that setCharset() is not needed elsewhere\n$preferences->setCharset('utf-8');\n\n// Without these lines the default caching mechanism is \"array\" but this uses a lot of memory.\n// If possible, use a disk cache to enable attaching large attachments etc.\n// You can override the default temporary directory by setting the TMPDIR environment variable.\nif (@is_writable($tmpDir = sys_get_temp_dir())) {\n    $preferences->setTempDir($tmpDir)->setCacheType('disk');\n}\n\n// this should only be done when Swiftmailer won't use the native QP content encoder\n// see mime_deps.php\nif (version_compare(phpversion(), '5.4.7', '<')) {\n    $preferences->setQPDotEscape(false);\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/swift_init.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/*\n * Dependency injection initialization for Swift Mailer.\n */\n\nif (defined('SWIFT_INIT_LOADED')) {\n    return;\n}\n\ndefine('SWIFT_INIT_LOADED', true);\n\n// Load in dependency maps\nrequire dirname(__FILE__).'/dependency_maps/cache_deps.php';\nrequire dirname(__FILE__).'/dependency_maps/mime_deps.php';\nrequire dirname(__FILE__).'/dependency_maps/message_deps.php';\nrequire dirname(__FILE__).'/dependency_maps/transport_deps.php';\n\n// Load in global library preferences\nrequire dirname(__FILE__).'/preferences.php';\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/swift_required.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/*\n * Autoloader and dependency injection initialization for Swift Mailer.\n */\n\nif (class_exists('Swift', false)) {\n    return;\n}\n\n// Load Swift utility class\nrequire dirname(__FILE__).'/classes/Swift.php';\n\nif (!function_exists('_swiftmailer_init')) {\n    function _swiftmailer_init() {\n        require dirname(__FILE__).'/swift_init.php';\n    }\n}\n\n// Start the autoloader and lazy-load the init script to set up dependency injection\nSwift::registerAutoload('_swiftmailer_init');\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/swift_required_pear.php",
    "content": "<?php\n\n/*\n * This file is part of SwiftMailer.\n * (c) 2004-2009 Chris Corbyn\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n/*\n * Autoloader and dependency injection initialization for Swift Mailer.\n */\n\nif (class_exists('Swift', false)) {\n    return;\n}\n\n// Load Swift utility class\nrequire dirname(__FILE__).'/Swift.php';\n\nif (!function_exists('_swiftmailer_init')) {\n    function _swiftmailer_init() {\n        require dirname(__FILE__).'/swift_init.php';\n    }\n}\n\n// Start the autoloader and lazy-load the init script to set up dependency injection\nSwift::registerAutoload('_swiftmailer_init');\n"
  },
  {
    "path": "website/lib/swiftmailer/lib/swiftmailer_generate_mimes_config.php",
    "content": "#!/usr/bin/php\n\n<?php\ndefine('APACHE_MIME_TYPES_URL', 'http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');\ndefine('FREEDESKTOP_XML_URL', 'https://raw2.github.com/minad/mimemagic/master/script/freedesktop.org.xml');\n\nfunction generateUpToDateMimeArray() {\n    $preamble = \"<?php\\n\\n\";\n    $preamble .= \"/*\\n\";\n    $preamble .= \" * This file is part of SwiftMailer.\\n\";\n    $preamble .= \" * (c) 2004-2009 Chris Corbyn\\n *\\n\";\n    $preamble .= \" * For the full copyright and license information, please view the LICENSE\\n\";\n    $preamble .= \" * file that was distributed with this source code.\\n *\\n\";\n    $preamble .= \" * autogenerated using http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\\n\";\n    $preamble .= \" * and https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml\\n\";\n    $preamble .= \" */\\n\\n\";\n    $preamble .= \"/*\\n\";\n    $preamble .= \" * List of MIME type automatically detected in Swift Mailer.\\n\";\n    $preamble .= \" */\\n\\n\";\n    $preamble .= \"// You may add or take away what you like (lowercase required)\\n\\n\";\n\n    // get current mime types files\n    $mime_types = @file_get_contents(APACHE_MIME_TYPES_URL);\n    $mime_xml = @file_get_contents(FREEDESKTOP_XML_URL);\n\n    // prepare valid mime types\n    $valid_mime_types = array();\n\n    // split mime type and extensions eg. \"video/x-matroska        mkv mk3d mks\"\n    if (preg_match_all('/^#?([a-z0-9\\-\\+\\/\\.]+)[\\t]+(.*)$/miu', $mime_types, $matches) !== false) {\n        // collection of predefined mimetypes (bugfix for wrong resolved or missing mime types)\n        $valid_mime_types_preset = array(\n            'php' => 'application/x-php',\n            'php3' => 'application/x-php',\n            'php4' => 'application/x-php',\n            'php5' => 'application/x-php',\n            'zip' => 'application/zip',\n            'gif' => 'image/gif',\n            'png' => 'image/png',\n            'css' => 'text/css',\n            'js' => 'text/javascript',\n            'txt' => 'text/plain',\n            'aif' => 'audio/x-aiff',\n            'aiff' => 'audio/x-aiff',\n            'avi' => 'video/avi',\n            'bmp' => 'image/bmp',\n            'bz2' => 'application/x-bz2',\n            'csv' => 'text/csv',\n            'dmg' => 'application/x-apple-diskimage',\n            'doc' => 'application/msword',\n            'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n            'eml' => 'message/rfc822',\n            'aps' => 'application/postscript',\n            'exe' => 'application/x-ms-dos-executable',\n            'flv' => 'video/x-flv',\n            'gz' => 'application/x-gzip',\n            'hqx' => 'application/stuffit',\n            'htm' => 'text/html',\n            'html' => 'text/html',\n            'jar' => 'application/x-java-archive',\n            'jpeg' => 'image/jpeg',\n            'jpg' => 'image/jpeg',\n            'm3u' => 'audio/x-mpegurl',\n            'm4a' => 'audio/mp4',\n            'mdb' => 'application/x-msaccess',\n            'mid' => 'audio/midi',\n            'midi' => 'audio/midi',\n            'mov' => 'video/quicktime',\n            'mp3' => 'audio/mpeg',\n            'mp4' => 'video/mp4',\n            'mpeg' => 'video/mpeg',\n            'mpg' => 'video/mpeg',\n            'odg' => 'vnd.oasis.opendocument.graphics',\n            'odp' => 'vnd.oasis.opendocument.presentation',\n            'odt' => 'vnd.oasis.opendocument.text',\n            'ods' => 'vnd.oasis.opendocument.spreadsheet',\n            'ogg' => 'audio/ogg',\n            'pdf' => 'application/pdf',\n            'ppt' => 'application/vnd.ms-powerpoint',\n            'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n            'ps' => 'application/postscript',\n            'rar' => 'application/x-rar-compressed',\n            'rtf' => 'application/rtf',\n            'tar' => 'application/x-tar',\n            'sit' => 'application/x-stuffit',\n            'svg' => 'image/svg+xml',\n            'tif' => 'image/tiff',\n            'tiff' => 'image/tiff',\n            'ttf' => 'application/x-font-truetype',\n            'vcf' => 'text/x-vcard',\n            'wav' => 'audio/wav',\n            'wma' => 'audio/x-ms-wma',\n            'wmv' => 'audio/x-ms-wmv',\n            'xls' => 'application/excel',\n            'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n            'xml' => 'application/xml',\n        );\n\n        // wrap array for generating file\n        foreach ($valid_mime_types_preset as $extension => $mime_type) {\n            // generate array for mimetype to extension resolver (only first match)\n            $valid_mime_types[$extension] = \"'{$extension}' => '{$mime_type}'\";\n        }\n\n        // collect extensions\n        $valid_extensions = array();\n\n        // all extensions from second match\n        foreach ($matches[2] as $i => $extensions) {\n            // explode multiple extensions from string\n            $extensions = explode(' ', strtolower($extensions));\n\n            // force array for foreach\n            if (!is_array($extensions)) {\n                $extensions = array($extensions);\n            }\n\n            foreach ($extensions as $extension) {\n                // get mime type\n                $mime_type = $matches[1][$i];\n\n                // check if string length lower than 10\n                if (strlen($extension) < 10) {\n                    // add extension\n                    $valid_extensions[] = $extension;\n\n                    if (!isset($valid_mime_types[$mime_type])) {\n                        // generate array for mimetype to extension resolver (only first match)\n                        $valid_mime_types[$extension] = \"'{$extension}' => '{$mime_type}'\";\n                    }\n                }\n            }\n        }\n    }\n\n    $xml = simplexml_load_string($mime_xml);\n\n    foreach ($xml as $node) {\n        // check if there is no pattern\n        if (!isset($node->glob['pattern'])) {\n            continue;\n        }\n\n        // get all matching extensions from match\n        foreach ((array) $node->glob['pattern'] as $extension) {\n            // skip none glob extensions\n            if (strpos($extension, '.') === false) {\n                continue;\n            }\n\n            // remove get only last part\n            $extension = explode('.', strtolower($extension));\n            $extension = end($extension);\n\n            // maximum length in database column\n            if (strlen($extension) <= 9) {\n                $valid_extensions[] = $extension;\n            }\n        }\n\n        if (isset($node->glob['pattern'][0])) {\n            // mime type\n            $mime_type = strtolower((string) $node['type']);\n\n            // get first extension\n            $extension = strtolower(trim($node->glob['ddpattern'][0], '*.'));\n\n            // skip none glob extensions and check if string length between 1 and 10\n            if (strpos($extension, '.') !== false || strlen($extension) < 1 || strlen($extension) > 9) {\n                continue;\n            }\n\n            // check if string length lower than 10\n            if (!isset($valid_mime_types[$mime_type])) {\n                // generate array for mimetype to extension resolver (only first match)\n                $valid_mime_types[$extension] = \"'{$extension}' => '{$mime_type}'\";\n            }\n        }\n    }\n\n    // full list of valid extensions only\n    $valid_mime_types = array_unique($valid_mime_types);\n    ksort($valid_mime_types);\n\n    // combine mime types and extensions array\n    $output = \"$preamble\\$swift_mime_types = array(\\n    \".implode($valid_mime_types, \",\\n    \").\"\\n);\";\n\n    // write mime_types.php config file\n    @file_put_contents('./mime_types.php', $output);\n}\n\ngenerateUpToDateMimeArray();\n"
  },
  {
    "path": "website/lib/swiftmailer/phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         colors=\"true\"\n         convertErrorsToExceptions=\"true\"\n         convertNoticesToExceptions=\"true\"\n         convertWarningsToExceptions=\"true\"\n         processIsolation=\"false\"\n         stopOnFailure=\"false\"\n         syntaxCheck=\"false\"\n         bootstrap=\"tests/bootstrap.php\"\n>\n    <php>\n        <ini name=\"intl.default_locale\" value=\"en\"/>\n        <ini name=\"intl.error_level\" value=\"0\"/>\n        <ini name=\"memory_limit\" value=\"-1\"/>\n    </php>\n\n    <testsuites>\n        <testsuite name=\"SwiftMailer unit tests\">\n            <directory>tests/unit</directory>\n        </testsuite>\n        <testsuite name=\"SwiftMailer acceptance tests\">\n            <directory>tests/acceptance</directory>\n        </testsuite>\n        <testsuite name=\"SwiftMailer bug\">\n            <directory>tests/bug</directory>\n        </testsuite>\n        <testsuite name=\"SwiftMailer smoke tests\">\n            <directory>tests/smoke</directory>\n        </testsuite>\n    </testsuites>\n\n    <listeners>\n        <listener class=\"Mockery\\Adapter\\Phpunit\\TestListener\"/>\n    </listeners>\n</phpunit>\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/IdenticalBinaryConstraint.php",
    "content": "<?php\n\n/**\n * A binary safe string comparison.\n *\n * @author Chris Corbyn\n */\nclass IdenticalBinaryConstraint extends \\PHPUnit_Framework_Constraint{\n    protected $value;\n\n    public function __construct($value) {\n        $this->value = $value;\n    }\n\n    /**\n     * Evaluates the constraint for parameter $other. Returns TRUE if the\n     * constraint is met, FALSE otherwise.\n     *\n     * @param mixed $other Value or object to evaluate.\n     *\n     * @return bool\n     */\n    public function matches($other) {\n        $aHex = $this->asHexString($this->value);\n        $bHex = $this->asHexString($other);\n\n        return $aHex === $bHex;\n    }\n\n    /**\n     * Returns a string representation of the constraint.\n     *\n     * @return string\n     */\n    public function toString() {\n        return 'indentical binary';\n    }\n\n    /**\n     * Get the given string of bytes as a stirng of Hexadecimal sequences.\n     *\n     * @param string $binary\n     *\n     * @return string\n     */\n    private function asHexString($binary) {\n        $hex = '';\n\n        $bytes = unpack('H*', $binary);\n\n        foreach ($bytes as &$byte) {\n            $byte = strtoupper($byte);\n        }\n\n        return implode('', $bytes);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/StreamCollector.php",
    "content": "<?php\n\nclass Swift_StreamCollector{\n    public $content = '';\n\n    public function __invoke($arg) {\n        $this->content .= $arg;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/SwiftMailerSmokeTestCase.php",
    "content": "<?php\n\n/**\n * Base test for smoke tests.\n *\n * @author Rouven Weßling\n */\nclass SwiftMailerSmokeTestCase extends SwiftMailerTestCase{\n    public function setUp() {\n        if (!defined('SWIFT_SMOKE_TRANSPORT_TYPE')) {\n            $this->markTestSkipped(\n                'Smoke tests are skipped if tests/smoke.conf.php is not edited'\n             );\n        }\n    }\n\n    protected function _getMailer() {\n        switch (SWIFT_SMOKE_TRANSPORT_TYPE) {\n            case 'smtp':\n                $transport = Swift_DependencyContainer::getInstance()->lookup('transport.smtp')\n                    ->setHost(SWIFT_SMOKE_SMTP_HOST)\n                    ->setPort(SWIFT_SMOKE_SMTP_PORT)\n                    ->setUsername(SWIFT_SMOKE_SMTP_USER)\n                    ->setPassword(SWIFT_SMOKE_SMTP_PASS)\n                    ->setEncryption(SWIFT_SMOKE_SMTP_ENCRYPTION)\n                    ;\n                break;\n            case 'sendmail':\n                $transport = Swift_DependencyContainer::getInstance()->lookup('transport.sendmail')\n                    ->setCommand(SWIFT_SMOKE_SENDMAIL_COMMAND)\n                    ;\n                break;\n            case 'mail':\n            case 'nativemail':\n                $transport = Swift_DependencyContainer::getInstance()->lookup('transport.mail');\n                break;\n            default:\n                throw new Exception('Undefined transport ['.SWIFT_SMOKE_TRANSPORT_TYPE.']');\n        }\n\n        return new Swift_Mailer($transport);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/SwiftMailerTestCase.php",
    "content": "<?php\n\n/**\n * A base test case with some custom expectations.\n *\n * @author Rouven Weßling\n */\nclass SwiftMailerTestCase extends \\PHPUnit_Framework_TestCase{\n    public static function regExp($pattern) {\n        if (!is_string($pattern)) {\n            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');\n        }\n\n        return new PHPUnit_Framework_Constraint_PCREMatch($pattern);\n    }\n\n    public function assertIdenticalBinary($expected, $actual, $message = '') {\n        $constraint = new IdenticalBinaryConstraint($expected);\n        self::assertThat($actual, $constraint, $message);\n    }\n\n    protected function tearDown() {\n        \\Mockery::close();\n    }\n\n    protected function getMockery($class) {\n        return \\Mockery::mock($class);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt",
    "content": "ISO-2022-JPは、インターネット上(特に電子メール)などで使われる日本の文字用の文字符号化方式。ISO/IEC 2022のエスケープシーケンスを利用して文字集合を切り替える7ビットのコードであることを特徴とする (アナウンス機能のエスケープシーケンスは省略される)。俗に「JISコード」と呼ばれることもある。\n\n概要\n日本語表記への利用が想定されている文字コードであり、日本語の利用されるネットワークにおいて、日本の規格を応用したものである。また文字集合としては、日本語で用いられる漢字、ひらがな、カタカナはもちろん、ラテン文字、ギリシア文字、キリル文字なども含んでおり、学術や産業の分野での利用も考慮たものとなっている。規格名に、ISOの日本語の言語コードであるjaではなく、国・地域名コードのJPが示されているゆえんである。\n文字集合としてJIS X 0201のC0集合（制御文字）、JIS X 0201のラテン文字集合、ISO 646の国際基準版図形文字、JIS X 0208の1978年版（JIS C 6226-1978）と1983年および1990年版が利用できる。JIS X 0201の片仮名文字集合は利用できない。1986年以降、日本の電子メールで用いられてきたJUNETコードを、村井純・Mark Crispin・Erik van der Poelが1993年にRFC化したもの(RFC 1468)。後にJIS X 0208:1997の附属書2としてJISに規定された。MIMEにおける文字符号化方式の識別用の名前として IANA に登録されている。\nなお、符号化の仕様についてはISO/IEC 2022#ISO-2022-JPも参照。\n\nISO-2022-JPと非標準的拡張使用\n「JISコード」（または「ISO-2022-JP」）というコード名の規定下では、その仕様通りの使用が求められる。しかし、Windows OS上では、実際にはCP932コード (MicrosoftによるShift JISを拡張した亜種。ISO-2022-JP規定外文字が追加されている。）による独自拡張（の文字）を断りなく使うアプリケーションが多い。この例としてInternet ExplorerやOutlook Expressがある。また、EmEditor、秀丸エディタやThunderbirdのようなMicrosoft社以外のWindowsアプリケーションでも同様の場合がある。この場合、ISO-2022-JPの範囲外の文字を使ってしまうと、異なる製品間では未定義不明文字として認識されるか、もしくは文字化けを起こす原因となる。そのため、Windows用の電子メールクライアントであっても独自拡張の文字を使用すると警告を出したり、あえて使えないように制限しているものも存在する。さらにはISO-2022-JPの範囲内であってもCP932は非標準文字（FULLWIDTH TILDE等）を持つので文字化けの原因になり得る。\nまた、符号化方式名をISO-2022-JPとしているのに、文字集合としてはJIS X 0212 (いわゆる補助漢字) やJIS X 0201の片仮名文字集合 (いわゆる半角カナ) をも符号化している例があるが、ISO-2022-JPではこれらの文字を許容していない。これらの符号化は独自拡張の実装であり、中にはISO/IEC 2022の仕様に準拠すらしていないものもある[2]。従って受信側の電子メールクライアントがこれらの独自拡張に対応していない場合、その文字あるいはその文字を含む行、時にはテキスト全体が文字化けすることがある。\n\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt",
    "content": "Op mat eraus hinnen beschte, rou zënne schaddreg ké. Ké sin Eisen Kaffi prächteg, den haut esou Fielse wa, Well zielen d'Welt am dir. Aus grousse rëschten d'Stroos do, as dat Kléder gewëss d'Kàchen. Schied gehéiert d'Vioule net hu, rou ke zënter Säiten d'Hierz. Ze eise Fletschen mat, gei as gréng d'Lëtzebuerger. Wäit räich no mat.\n\nSäiten d'Liewen aus en. Un gëtt bléit lossen wee, da wéi alle weisen Kolrettchen. Et deser d'Pan d'Kirmes vun, en wuel Benn rëschten méi. En get drem ménger beschte, da wär Stad welle. Nun Dach d'Pied do, mä gét ruffen gehéiert. Ze onser ugedon fir, d'Liewen Plett'len ech no, si Räis wielen bereet wat. Iwer spilt fir jo.\n\nAn hin däischter Margréitchen, eng ke Frot brommt, vu den Räis néierens. Da hir Hunn Frot nozegon, rout Fläiß Himmel zum si, net gutt Kaffi Gesträich fu. Vill lait Gaart sou wa, Land Mamm Schuebersonndeg rei do. Gei geet Minutt en, gei d'Leit beschte Kolrettchen et, Mamm fergiess un hun.\n\nEt gutt Heck kommen oft, Lann rëscht rei um, Hunn rëscht schéinste ke der. En lait zielen schnéiwäiss hir, fu rou botze éiweg Minutt, rem fest gudden schaddreg en. Noper bereet Margréitchen mat op, dem denkt d'Leit d'Vioule no, oft ké Himmel Hämmel. En denkt blénken Fréijor net, Gart Schiet d'Natur no wou. No hin Ierd Frot d'Kirmes. Hire aremt un rou, ké den éiweg wielen Milliounen.\n\nMir si Hunn Blénkeg. Ké get ston derfir d'Kàchen. Haut d'Pan fu ons, dé frou löschteg d'Meereische rei. Sou op wuel Léift. Stret schlon grousse gin hu. Mä denkt d'Leit hinnen net, ké gét haut fort rëscht.\n\nKoum d'Pan hannendrun ass ké, ké den brét Kaffi geplot. Schéi Hären d'Pied fu gét, do d'Mier néierens bei. Rëm päift Hämmel am, wee Engel beschéngt mä. Brommt klinzecht der ke, wa rout jeitzt dén. Get Zalot d'Vioule däischter da, jo fir Bänk päift duerch, bei d'Beem schéinen Plett'len jo. Den haut Faarwen ze, eng en Biereg Kirmesdag, um sin alles Faarwen d'Vioule.\n\nEng Hunn Schied et, wat wa Frot fest gebotzt. Bei jo bleiwe ruffen Klarinett. Un Feld klinzecht gét, rifft Margréitchen rem ke. Mir dé Noper duurch gewëss, ston sech kille sin en. Gei Stret d'Wise um, Haus Gart wee as. Monn ménger an blo, wat da Gart gefällt Hämmelsbrot.\n\nBrommt geplot och ze, dat wa Räis Well Kaffi. Do get spilt prächteg, as wär kille bleiwe gewalteg. Onser frësch Margréitchen rem ke, blo en huet ugedon. Onser Hemecht wär de, hu eraus d'Sonn dat, eise deser hannendrun da och.\n\nAs durch Himmel hun, no fest iw'rem schéinste mir, Hunn séngt Hierz ke zum. Séngt iw'rem d'Natur zum an. Ke wär gutt Grénge. Kënnt gudden prächteg mä rei. Dé dir Blénkeg Klarinett Kolrettchen, da fort muerges d'Kanner wou, main Feld ruffen vu wéi. Da gin esou Zalot gewalteg, gét vill Hemecht blénken dé.\n\nHaut gréng nun et, nei vu Bass gréng d'Gaassen. Fest d'Beem uechter si gin. Oft vu sinn wellen kréien. Et ass lait Zalot schéinen."
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/charsets/utf-8/one.txt",
    "content": "Код одно гринспана руководишь на. Его вы знания движение. Ты две начать\nодиночку, сказать основатель удовольствием но миф. Бы какие система тем.\nПолностью использует три мы, человек клоунов те нас, бы давать творческую\nэзотерическая шеф.\n\nМог не помнить никакого сэкономленного, две либо какие пишите бы. Должен\nкомпанию кто те, этот заключалась проектировщик не ты. Глупые периоды ты\nдля. Вам который хороший он. Те любых кремния концентрируются мог,\nсобирать принадлежите без вы.\n\nДжоэла меньше хорошего вы миф, за тем году разработки. Даже управляющим\nруководители был не. Три коде выпускать заботиться ну. То его система\nудовольствием безостановочно, или ты главной процессорах. Мы без джоэл\nзнания получат, статьи остальные мы ещё.\n\nНих русском касается поскольку по, образование должником\nсистематизированный ну мои. Прийти кандидата университет но нас, для бы\nдолжны никакого, биг многие причин интервьюирования за.\n\nТем до плиту почему. Вот учёт такие одного бы, об биг разным внешних\nпромежуток. Вас до какому возможностей безответственный, были погодите бы\nего, по них глупые долгий количества.\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/charsets/utf-8/three.txt",
    "content": "Αν ήδη διάβασε γλιτώσει μεταγλωτίσει, αυτήν θυμάμαι μου μα. Την κατάσταση χρησιμοποίησέ να! Τα διαφορά φαινόμενο διολισθήσεις πες, υψηλότερη προκαλείς περισσότερες όχι κι. Με ελέγχου γίνεται σας, μικρής δημιουργούν τη του. Τις τα γράψει εικόνες απαράδεκτη?\n\nΝα ότι πρώτοι απαραίτητο. Άμεση πετάνε κακόκεφος τον ώς, να χώρου πιθανότητες του. Το μέχρι ορίστε λιγότερους σας. Πω ναί φυσικά εικόνες.\n\nΜου οι κώδικα αποκλειστικούς, λες το μάλλον συνεχώς. Νέου σημεία απίστευτα σας μα. Χρόνου μεταγλωτιστής σε νέα, τη τις πιάνει μπορούσες προγραμματιστές. Των κάνε βγαίνει εντυπωσιακό τα? Κρατάει τεσσαρών δυστυχώς της κι, ήδη υψηλότερη εξακολουθεί τα?\n\nΏρα πετάνε μπορούσε λιγότερους αν, τα απαράδεκτη συγχωνευτεί ροή. Τη έγραψες συνηθίζουν σαν. Όλα με υλικό στήλες χειρότερα. Ανώδυνη δουλέψει επί ως, αν διαδίκτυο εσωτερικών παράγοντες από. Κεντρικό επιτυχία πες το.\n\nΠω ναι λέει τελειώσει, έξι ως έργων τελειώσει. Με αρχεία βουτήξουν ανταγωνιστής ώρα, πολύ γραφικά σελίδων τα στη. Όρο οέλεγχος δημιουργούν δε, ας θέλεις ελέγχου συντακτικό όρο! Της θυμάμαι επιδιόρθωση τα. Για μπορούσε περισσότερο αν, μέγιστη σημαίνει αποφάσισε τα του, άτομο αποτελέσει τι στα.\n\nΤι στην αφήσεις διοίκηση στη. Τα εσφαλμένη δημιουργια επιχείριση έξι! Βήμα μαγικά εκτελέσει ανά τη. Όλη αφήσεις συνεχώς εμπορικά αν, το λες κόλπα επιτυχία. Ότι οι ζώνη κειμένων. Όρο κι ρωτάει γραμμής πελάτες, τελειώσει διολισθήσεις καθυστερούσε αν εγώ? Τι πετούν διοίκηση προβλήματα ήδη.\n\nΤη γλιτώσει αποθηκευτικού μια. Πω έξι δημιουργια πιθανότητες, ως πέντε ελέγχους εκτελείται λες. Πως ερωτήσεις διοικητικό συγκεντρωμένοι οι, ας συνεχώς διοικητικό αποστηθίσει σαν. Δε πρώτες συνεχώς διολισθήσεις έχω, από τι κανένας βουτήξουν, γειτονιάς προσεκτικά ανταγωνιστής κι σαν.\n\nΔημιουργια συνηθίζουν κλπ τι? Όχι ποσοστό διακοπής κι. Κλπ φακέλους δεδομένη εξοργιστικά θα? Υποψήφιο καθορίζουν με όλη, στα πήρε προσοχή εταιρείες πω, ώς τον συνάδελφος διοικητικό δημιουργήσεις! Δούλευε επιτίθενται σας θα, με ένας παραγωγικής ένα, να ναι σημεία μέγιστη απαράδεκτη?\n\nΣας τεσσαρών συνεντεύξης τη, αρπάζεις σίγουρος μη για', επί τοπικές εντολές ακούσει θα? Ως δυστυχής μεταγλωτιστής όλη, να την είχαν σφάλμα απαραίτητο! Μην ώς άτομο διορθώσει χρησιμοποιούνταν. Δεν τα κόλπα πετάξαμε, μη που άγχος υόρκη άμεση, αφού δυστυχώς διακόψουμε όρο αν! Όλη μαγικά πετάνε επιδιορθώσεις δε, ροή φυσικά αποτελέσει πω.\n\nΆπειρα παραπάνω φαινόμενο πω ώρα, σαν πόρτες κρατήσουν συνηθίζουν ως. Κι ώρα τρέξει είχαμε εφαρμογή. Απλό σχεδιαστής μεταγλωτιστής ας επί, τις τα όταν έγραψες γραμμής? Όλα κάνεις συνάδελφος εργαζόμενοι θα, χαρτιού χαμηλός τα ροή. Ως ναι όροφο έρθει, μην πελάτες αποφάσισε μεταφραστής με, να βιαστικά εκδόσεις αναζήτησης λες. Των φταίει εκθέσεις προσπαθήσεις οι, σπίτι αποστηθίσει ας λες?\n\nΏς που υπηρεσία απαραίτητο δημιουργείς. Μη άρα χαρά καθώς νύχτας, πω ματ μπουν είχαν. Άμεση δημιουργείς ώς ροή, γράψει γραμμής σίγουρος στα τι! Αν αφού πρώτοι εργαζόμενων ναί.\n\nΆμεση διορθώσεις με δύο? Έχουν παράδειγμα των θα, μου έρθει θυμάμαι περισσότερο το. Ότι θα αφού χρειάζονται περισσότερες. Σαν συνεχώς περίπου οι.\n\nΏς πρώτης πετάξαμε λες, όρο κι πρώτες ζητήσεις δυστυχής. Ανά χρόνου διακοπή επιχειρηματίες ας, ώς μόλις άτομο χειρότερα όρο, κρατάει σχεδιαστής προσπαθήσεις νέο το. Πουλάς προσθέσει όλη πω, τύπου χαρακτηριστικό εγώ σε, πω πιο δούλευε αναζήτησης? Αναφορά δίνοντας σαν μη, μάθε δεδομένη εσωτερικών με ναι, αναφέρονται περιβάλλοντος ώρα αν. Και λέει απόλαυσε τα, που το όροφο προσπαθούν?\n\nΠάντα χρόνου χρήματα ναι το, σαν σωστά θυμάμαι σκεφτείς τα. Μα αποτελέσει ανεπιθύμητη την, πιο το τέτοιο ατόμου, τη των τρόπο εργαλείων επιδιόρθωσης. Περιβάλλον παραγωγικής σου κι, κλπ οι τύπου κακόκεφους αποστηθίσει, δε των πλέον τρόποι. Πιθανότητες χαρακτηριστικών σας κι, γραφικά δημιουργήσεις μια οι, πω πολλοί εξαρτάται προσεκτικά εδώ. Σταματάς παράγοντες για' ώς, στις ρωτάει το ναι! Καρέκλα ζητήσεις συνδυασμούς τη ήδη!\n\nΓια μαγικά συνεχώς ακούσει το. Σταματάς προϊόντα βουτήξουν ώς ροή. Είχαν πρώτες οι ναι, μα λες αποστηθίσει ανακαλύπτεις. Όροφο άλγεβρα παραπάνω εδώ τη, πρόσληψη λαμβάνουν καταλάθος ήδη ας? Ως και εισαγωγή κρατήσουν, ένας κακόκεφους κι μας, όχι κώδικάς παίξουν πω. Πω νέα κρατάει εκφράσουν, τότε τελικών τη όχι, ας της τρέξει αλλάζοντας αποκλειστικούς.\n\nΈνας βιβλίο σε άρα, ναι ως γράψει ταξινομεί διορθώσεις! Εδώ να γεγονός συγγραφείς, ώς ήδη διακόψουμε επιχειρηματίες? Ότι πακέτων εσφαλμένη κι, θα όρο κόλπα παραγωγικής? Αν έχω κεντρικό υψηλότερη, κι δεν ίδιο πετάνε παρατηρούμενη! Που λοιπόν σημαντικό μα, προκαλείς χειροκροτήματα ως όλα, μα επί κόλπα άγχος γραμμές! Δε σου κάνεις βουτήξουν, μη έργων επενδυτής χρησιμοποίησέ στα, ως του πρώτες διάσημα σημαντικό.\n\nΒιβλίο τεράστιο προκύπτουν σαν το, σαν τρόπο επιδιόρθωση ας. Είχαν προσοχή προσπάθεια κι ματ, εδώ ως έτσι σελίδων συζήτηση. Και στην βγαίνει εσφαλμένη με, δυστυχής παράδειγμα δε μας, από σε υόρκη επιδιόρθωσης. Νέα πω νέου πιθανό, στήλες συγγραφείς μπαίνοντας μα για', το ρωτήσει κακόκεφους της? Μου σε αρέσει συγγραφής συγχωνευτεί, μη μου υόρκη ξέχασε διακοπής! Ώς επί αποφάσισε αποκλειστικούς χρησιμοποιώντας, χρήματα σελίδων ταξινομεί ναι με.\n\nΜη ανά γραμμή απόλαυσε, πω ναι μάτσο διασφαλίζεται. Τη έξι μόλις εργάστηκε δημιουργούν, έκδοση αναφορά δυσκολότερο οι νέο. Σας ως μπορούσε παράδειγμα, αν ότι δούλευε μπορούσε αποκλειστικούς, πιο λέει βουτήξουν διορθώσει ως. Έχω τελευταία κακόκεφους ας, όσο εργαζόμενων δημιουργήσεις τα.\n\nΤου αν δουλέψει μπορούσε, πετούν χαμηλός εδώ ας? Κύκλο τύπους με που, δεν σε έχουν συνεχώς χειρότερα, τις τι απαράδεκτη συνηθίζουν? Θα μην τους αυτήν, τη ένα πήρε πακέτων, κι προκύπτουν περιβάλλον πως. Μα για δουλέψει απόλαυσε εφαμοργής, ώς εδώ σημαίνει μπορούσες, άμεση ακούσει προσοχή τη εδώ?\n\nΣτα δώσε αθόρυβες λιγότερους οι, δε αναγκάζονται αποκλειστικούς όλα! Ας μπουν διοικητικό μια, πάντα ελέγχου διορθώσεις ώς τον. Ότι πήρε κανόνα μα. Που άτομα κάνεις δημιουργίες τα, οι μας αφού κόλπα προγραμματιστής, αφού ωραίο προκύπτουν στα ως. Θέμα χρησιμοποιήσει αν όλα, του τα άλγεβρα σελίδων. Τα ότι ανώδυνη δυστυχώς συνδυασμούς, μας οι πάντα γνωρίζουμε ανταγωνιστής, όχι τα δοκιμάσεις σχεδιαστής! Στην συνεντεύξης επιδιόρθωση πιο τα, μα από πουλάς περιβάλλον παραγωγικής.\n\nΈχουν μεταγλωτίσει σε σας, σε πάντα πρώτης μειώσει των, γράψει ρουτίνα δυσκολότερο ήδη μα? Ταξινομεί διορθώσεις να μας. Θα της προσπαθούν περιεχόμενα, δε έχω τοπικές στέλνοντάς. Ανά δε αλφα άμεση, κάποιο ρωτάει γνωρίζουμε πω στη, φράση μαγικά συνέχεια δε δύο! Αν είχαμε μειώσει ροή, μας μετράει καθυστερούσε επιδιορθώσεις μη. Χάος υόρκη κεντρικό έχω σε, ανά περίπου αναγκάζονται πω.\n\nΌσο επιστρέφουν χρονοδιαγράμματα μη. Πως ωραίο κακόκεφος διαχειριστής ως, τις να διακοπής αναζήτησης. Κάποιο ποσοστό ταξινομεί επί τη? Μάθε άμεση αλλάζοντας δύο με, μου νέου πάντα να.\n\nΠω του δυστυχώς πιθανότητες. Κι ρωτάει υψηλότερη δημιουργια ότι, πω εισαγωγή τελευταία απομόνωση ναι. Των ζητήσεις γνωρίζουμε ώς? Για' μη παραδοτέου αναφέρονται! Ύψος παραγωγικά ροή ως, φυσικά διάβασε εικόνες όσο σε? Δεν υόρκη διορθώσεις επεξεργασία θα, ως μέση σύστημα χρησιμοποιήσει τις."
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/charsets/utf-8/two.txt",
    "content": "रखति आवश्यकत प्रेरना मुख्यतह हिंदी किएलोग असक्षम कार्यलय करते विवरण किके मानसिक दिनांक पुर्व संसाध एवम् कुशलता अमितकुमार प्रोत्साहित जनित देखने उदेशीत विकसित बलवान ब्रौशर किएलोग विश्लेषण लोगो कैसे जागरुक प्रव्रुति प्रोत्साहित सदस्य आवश्यकत प्रसारन उपलब्धता अथवा हिंदी जनित दर्शाता यन्त्रालय बलवान अतित सहयोग शुरुआत सभीकुछ माहितीवानीज्य लिये खरिदे है।अभी एकत्रित सम्पर्क रिती मुश्किल प्राथमिक भेदनक्षमता विश्व उन्हे गटको द्वारा तकरीबन\n\nविश्व द्वारा व्याख्या सके। आजपर वातावरण व्याख्यान पहोच। हमारी कीसे प्राथमिक विचारशिलता पुर्व करती कम्प्युटर भेदनक्षमता लिये बलवान और्४५० यायेका वार्तालाप सुचना भारत शुरुआत लाभान्वित पढाए संस्था वर्णित मार्गदर्शन चुनने"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/dkim/dkim.test.priv",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDZeUdi1RKnm9cRYNn6E24xxrRTouh3Va8JOEHQ5SB018lvbjwH\n2lW5mZ/I0kh/dHsTN0zcN0VE62WIbnLreMk/af/4Pg1i93+c9TmfXmoropsmdLos\nw0tjq50jGbBqtHZNJYAokP/u3uUuRw8g0V/O4zlQ3GlO/PDH7xDQzekl9wIDAQAB\nAoGAaoCBXD5a72hbb/BNb7HaUlgscZUjYWW93bcGTGYZef8/b+m9Tl83gjhgzvlk\ndb62k1eOtX3/11uskp78eqLhctv7yWc0mQQhgOogY2qCwHTCH8wja8kJkUAnKQhs\nP9sa5iJvgckiuX3SdxgTMwib9d1VyGq6YywiORiZF9rxyhECQQD/xhiZSi7y0ciB\ng4bassy0GVMS7EDRumMHc8wC23E1H2mj5yPE/QLqkW4ddmCv2BbJnYmyNvOaK9tk\nT2W+mn3/AkEA2aqDGja9CaTlY4BCXfiT166n+xVl5+d+1DENQ4FK9O2jpSi1265J\ntjEkXVxUOpV1ZEcUVOdK6RpvsKpc7vVICQJBALEFO5UsQJ4SD0GD9Ft8kCy9sj9Q\nf/Qnmc5YmIQJuKpZmVW07Y6yxcfu61U8zuIlHnBftiM/4Q18+RTN1s86QaUCQHoL\n9MTfCnH85q46/XuJZQRbp07O+bvlfqTl+CTwuyHImaiCwi2ydRxWQ6ihm4zZvuAC\nRvEwWz2HGDc73y4RlFkCQDDdnN9e46l1nMDLDI4cyyGBVg4Z2IZ3IAu5GaoUCGjM\na8w6kxE8f1d8DD5vvqVbmfK89TA/DjT+7/arBNBCiCM=\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/dkim/dkim.test.pub",
    "content": "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZeUdi1RKnm9cRYNn6E24xxrRT\nouh3Va8JOEHQ5SB018lvbjwH2lW5mZ/I0kh/dHsTN0zcN0VE62WIbnLreMk/af/4\nPg1i93+c9TmfXmoropsmdLosw0tjq50jGbBqtHZNJYAokP/u3uUuRw8g0V/O4zlQ\n3GlO/PDH7xDQzekl9wIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/files/data.txt",
    "content": "<data>"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/CA.srl",
    "content": "D42DA34CF90FA0DE\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/ca.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDazCCAlOgAwIBAgIJAKJCGQYLxWT1MA0GCSqGSIb3DQEBBQUAMEwxFzAVBgNV\nBAMMDlN3aWZ0bWFpbGVyIENBMRQwEgYDVQQKDAtTd2lmdG1haWxlcjEOMAwGA1UE\nBwwFUGFyaXMxCzAJBgNVBAYTAkZSMB4XDTEzMTEyNzA4MzkxMFoXDTE3MTEyNjA4\nMzkxMFowTDEXMBUGA1UEAwwOU3dpZnRtYWlsZXIgQ0ExFDASBgNVBAoMC1N3aWZ0\nbWFpbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkGA1UEBhMCRlIwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQC7RLdHE3OWo9aZwv1xA/cYyPui/gegxpTqClRp\ngGcVQ+jxIfnJQDQndyoAvFDiqOiZ+gAjZGJeUHDp9C/2IZp05MLh+omt9N8pBykm\n3nj/3ZwPXOAO0uyDPAOHhISITAxEuZCqDnq7iYujywtwfQ7bpW1hCK9PfNZYMStM\nkw7LsGr5BqcKkPuOWTvxE3+NqK8HxydYolsoApEGhgonyImVh1Pg1Kjkt5ojvwAX\nzOdjfw5poY5NArwuLORUH+XocetRo8DC6S42HkU/MoqcYxa9EuRuwuQh7GtE6baR\nPgrDsEYaY4Asy43sK81V51F/8Q1bHZKN/goQdxQwzv+/nOLTAgMBAAGjUDBOMB0G\nA1UdDgQWBBRHgqkl543tKhsVAvcx1I0JFU7JuDAfBgNVHSMEGDAWgBRHgqkl543t\nKhsVAvcx1I0JFU7JuDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAz\nOJiEQcygKGkkXXDiXGBvP/cSznj3nG9FolON0yHUBgdvLfNnctRMStGzPke0siLt\nRJvjqiL0Uw+blmLJU8lgMyLJ9ctXkiLJ/WflabN7VzmwYRWe5HzafGQJAg5uFjae\nVtAAHQgvbmdXB6brWvcMQmB8di7wjVedeigZvkt1z2V0FtBy8ybJaT5H6bX9Bf5C\ndS9r4mLhk/0ThthpRhRxsmupSL6e49nJaIk9q0UTEQVnorJXPcs4SPTIY51bCp6u\ncOebhNgndSxCiy0zSD7vRjNiyB/YNGZ9Uv/3DNTLleMZ9kZgfoKVpwYKrRL0IFT/\ncfS2OV1wxRxq668qaOfK\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/ca.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAu0S3RxNzlqPWmcL9cQP3GMj7ov4HoMaU6gpUaYBnFUPo8SH5\nyUA0J3cqALxQ4qjomfoAI2RiXlBw6fQv9iGadOTC4fqJrfTfKQcpJt54/92cD1zg\nDtLsgzwDh4SEiEwMRLmQqg56u4mLo8sLcH0O26VtYQivT3zWWDErTJMOy7Bq+Qan\nCpD7jlk78RN/jaivB8cnWKJbKAKRBoYKJ8iJlYdT4NSo5LeaI78AF8znY38OaaGO\nTQK8LizkVB/l6HHrUaPAwukuNh5FPzKKnGMWvRLkbsLkIexrROm2kT4Kw7BGGmOA\nLMuN7CvNVedRf/ENWx2Sjf4KEHcUMM7/v5zi0wIDAQABAoIBAGyaWkvu/O7Uz2TW\nz1JWgVuvWzfYaKYV5FCicvfITn/npVUKZikPge+NTR+mFqaMXHDHqoLb+axGrGUR\nhysPq9q0vEx/lo763tyVWYlAJh4E8Dd8njganK0zBbz23kGJEOheUYY95XGTQBda\nbqTq8c3x7zAB8GGBvXDh+wFqm38GLyMF6T+YEzWJZqXfg31f1ldRvf6+VFwlLfz6\ncvTR7oUpYIsUeGE47kBs13SN7Oju6a355o/7wy9tOCRiu+r/ikXFh8rFGLfeTiwv\nR1dhYjcEYGxZUD8u64U+Cj4qR1P0gHJL0kbh22VMMqgALOc8FpndkjNdg1Nun2X8\nBWpsPwECgYEA7C9PfTOIZfxGBlCl05rmWex++/h5E5PbH1Cw/NGjIH1HjmAkO3+5\nWyMXhySOJ8yWyCBQ/nxqc0w7+TO4C7wQcEdZdUak25KJ74v0sfmWWrVw6kcnLU6k\noawW/L2F2w7ET3zDoxKh4fOF34pfHpSbZk7XJ68YOfHpYVnP4efkQVMCgYEAyvrM\nKA7xjnsKumWh206ag3QEI0M/9uPHWmrh2164p7w1MtawccZTxYYJ5o5SsjTwbxkf\n0cAamp4qLInmRUxU1gk76tPYC3Ndp6Yf1C+dt0q/vtzyJetCDrdz8HHT1SpKbW0l\ng6z1I5FMwa6oWvWsfS++W51vsxUheNsOJ4uxKIECgYBwM7GRiw+7U3N4wItm0Wmp\nQp642Tu7vzwTzmOmV3klkB6UVrwfv/ewgiVFQGqAIcNn42JW44g2qfq70oQWnws4\nK80l15+t6Bm7QUPH4Qg6o4O26IKGFZxEadqpyudyP7um/2B5cfqRuvzYS4YQowyI\nN+AirB3YOUJjyyTk7yMSnQKBgGNLpSvDg6+ryWe96Bwcq8G6s3t8noHsk81LlAl4\noOSNUYj5NX+zAbATDizXWuUKuMPgioxVaa5RyVfYbelgme/KvKD32Sxg12P4BIIM\neR79VifMdjjOiZYhcHojdPlGovo89qkfpxwrLF1jT8CPhj4HaRvwPIBiyekRYC9A\nSv4BAoGAXCIC1xxAJP15osUuQjcM8KdsL1qw+LiPB2+cJJ2VMAZGV7CR2K0aCsis\nOwRaYM0jZKUpxzp1uwtfrfqbhdYsv+jIBkfwoShYZuo6MhbUrj0sffkhJC3WrT2z\nxafCFLFv1idzGvvNxatlp1DNKrndG2NS3syVAox9MnL5OMsvGM8=\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/create-cert.sh",
    "content": "#!/bin/sh\n\nopenssl genrsa -out CA.key 2048\nopenssl req -x509 -new -nodes -key CA.key -days 1460 -subj '/CN=Swiftmailer CA/O=Swiftmailer/L=Paris/C=FR' -out CA.crt\nopenssl x509 -in CA.crt -clrtrust -out CA.crt\n\nopenssl genrsa -out sign.key 2048\nopenssl req -new -key sign.key -subj '/CN=Swiftmailer-User/O=Swiftmailer/L=Paris/C=FR' -out sign.csr\nopenssl x509 -req -in sign.csr -CA CA.crt -CAkey CA.key -out sign.crt -days 1460 -addtrust emailProtection\nopenssl x509 -in sign.crt -clrtrust -out sign.crt\n\nrm sign.csr\n\nopenssl genrsa -out intermediate.key 2048\nopenssl req -new -key intermediate.key -subj '/CN=Swiftmailer Intermediate/O=Swiftmailer/L=Paris/C=FR' -out intermediate.csr\nopenssl x509 -req -in intermediate.csr -CA CA.crt -CAkey CA.key -set_serial 01 -out intermediate.crt -days 1460\nopenssl x509 -in intermediate.crt -clrtrust -out intermediate.crt\n\nrm intermediate.csr\n\nopenssl genrsa -out sign2.key 2048\nopenssl req -new -key sign2.key -subj '/CN=Swiftmailer-User2/O=Swiftmailer/L=Paris/C=FR' -out sign2.csr\nopenssl x509 -req -in sign2.csr -CA intermediate.crt -CAkey intermediate.key -set_serial 01 -out sign2.crt -days 1460 -addtrust emailProtection\nopenssl x509 -in sign2.crt -clrtrust -out sign2.crt\n\nrm sign2.csr\n\nopenssl genrsa -out encrypt.key 2048\nopenssl req -new -key encrypt.key -subj '/CN=Swiftmailer-User/O=Swiftmailer/L=Paris/C=FR' -out encrypt.csr\nopenssl x509 -req -in encrypt.csr -CA CA.crt -CAkey CA.key -CAcreateserial -out encrypt.crt -days 1460 -addtrust emailProtection\nopenssl x509 -in encrypt.crt -clrtrust -out encrypt.crt\n\nrm encrypt.csr\n\nopenssl genrsa -out encrypt2.key 2048\nopenssl req -new -key encrypt2.key -subj '/CN=Swiftmailer-User2/O=Swiftmailer/L=Paris/C=FR' -out encrypt2.csr\nopenssl x509 -req -in encrypt2.csr -CA CA.crt -CAkey CA.key -CAcreateserial -out encrypt2.crt -days 1460 -addtrust emailProtection\nopenssl x509 -in encrypt2.crt -clrtrust -out encrypt2.crt\n\nrm encrypt2.csr\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/encrypt.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDFjCCAf4CCQDULaNM+Q+g3TANBgkqhkiG9w0BAQUFADBMMRcwFQYDVQQDDA5T\nd2lmdG1haWxlciBDQTEUMBIGA1UECgwLU3dpZnRtYWlsZXIxDjAMBgNVBAcMBVBh\ncmlzMQswCQYDVQQGEwJGUjAeFw0xMzExMjcwODM5MTFaFw0xNzExMjYwODM5MTFa\nME4xGTAXBgNVBAMMEFN3aWZ0bWFpbGVyLVVzZXIxFDASBgNVBAoMC1N3aWZ0bWFp\nbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkGA1UEBhMCRlIwggEiMA0GCSqGSIb3DQEB\nAQUAA4IBDwAwggEKAoIBAQCcNO+fVZBT2znmVwXXZ08n3G5WA1kyvqh9z4RBBZOD\nV46Gc1X9MMXr9+wzZBFkAckKaa6KsTkeUr4pC8XUBpQnakxH/kW9CaDPdOE+7wNo\nFkPfc6pjWWgpAVxdkrtk7pb4/aGQ++HUkqVu0cMpIcj/7ht7H+3QLZHybn+oMr2+\nFDnn8vPmHxVioinSrxKTlUITuLWS9ZZUTrDa0dG8UAv55A/Tba4T4McCPDpJSA4m\n9jrW321NGQUntQoItOJxagaueSvh6PveGV826gTXoU5X+YJ3I2OZUEQ2l6yByAzf\nnT+QlxPj5ikotFwL72HsenYtetynOO/k43FblAF/V/l7AgMBAAEwDQYJKoZIhvcN\nAQEFBQADggEBAJ048Sdb9Sw5OJM5L00OtGHgcT1B/phqdzSjkM/s64cg3Q20VN+F\nfZIIkOnxgyYWcpOWXcdNw2tm5OWhWPGsBcYgMac7uK/ukgoOJSjICg+TTS5kRo96\niHtmImqkWc6WjNODh7uMnQ6DsZsscdl7Bkx5pKhgGnEdHr5GW8sztgXgyPQO5LUs\nYzCmR1RK1WoNMxwbPrGLgYdcpJw69ns5hJbZbMWwrdufiMjYWvTfBPABkk1JRCcY\nK6rRTAx4fApsw1kEIY8grGxyAzfRXLArpro7thJr0SIquZ8GpXkQT/mgRR8JD9Hp\nz9yhr98EnKzITE/yclGN4pUsuk9S3jiyzUU=\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/encrypt.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAnDTvn1WQU9s55lcF12dPJ9xuVgNZMr6ofc+EQQWTg1eOhnNV\n/TDF6/fsM2QRZAHJCmmuirE5HlK+KQvF1AaUJ2pMR/5FvQmgz3ThPu8DaBZD33Oq\nY1loKQFcXZK7ZO6W+P2hkPvh1JKlbtHDKSHI/+4bex/t0C2R8m5/qDK9vhQ55/Lz\n5h8VYqIp0q8Sk5VCE7i1kvWWVE6w2tHRvFAL+eQP022uE+DHAjw6SUgOJvY61t9t\nTRkFJ7UKCLTicWoGrnkr4ej73hlfNuoE16FOV/mCdyNjmVBENpesgcgM350/kJcT\n4+YpKLRcC+9h7Hp2LXrcpzjv5ONxW5QBf1f5ewIDAQABAoIBADmuMm2botfUM+Ui\nbT3FIC2P8A5C3kUmsgEDB8sazAXL5w0uuanswKkJu2aepO1Q23PE4nbESlswIpf1\niO9qHnsPfWt4MThEveTdO++JQrDEx/tTMq/M6/F4VysWa6wxjf4Taf2nhRSBsiTh\nwDcICri2q98jQyWELkhfFTR+yCHPsn6iNtzE2OpNv9ojKiSqck/sVjC39Z+uU/HD\nN4v0CPf9pDGkO+modaVGKf2TpvZT7Hpq/jsPzkk1h7BY7aWdZiIY4YkBkWYqZk8f\n0dsxKkOR2glfuEYNtcywG+4UGx3i1AY0mMu96hH5M1ACFmFrTCoodmWDnWy9wUpm\nleLmG8ECgYEAywWdryqcvLyhcmqHbnmUhCL9Vl4/5w5fr/5/FNvqArxSGwd2CxcN\nJtkvu22cxWAUoe155eMc6GlPIdNRG8KdWg4sg0TN3Jb2jiHQ3QkHXUJlWU6onjP1\ng2n5h052JxVNGBEb7hr3U7ZMW6wnuYnGdYwCB9P3r5oGxxtfVRB8ygUCgYEAxPfy\ntAd3SNT8Sv/cciw76GYKbztUjJRXkLo6GOBGq/AQxP1NDWMuL2AES11YIahidMsF\nTMmM+zhkNHsd5P69p87FTMWx0cLoH0M9iQNK7Q6C1luTjLf5DTFuk+nHGErM4Drs\n+6Ly1Z4KLXfXgBDD8Ce6U9+W3RrCc36poGZvjX8CgYEAna0P6WJr9r19mhIYevmc\nGf/ex7xNXxMvx80dP8MIfPVrwyhJSpWtljVpt+SKtFRJ0fVRDfUUl4Bqf/fR74B3\nmuCVO6ItTBxHAt5Ki9CeUpTlh7XqiWwLSvP8Y1TRuMr3ZDCtg4CYBAD6Ttxmwde6\nNcL2NMQwgsZaazrcEIHMmU0CgYEAl/Mn2tZ/oUIdt8YWzEVvmeNOXW0J1sGBo/bm\nZtZt7qpuZWl7jb5bnNSXu4QxPxXljnAokIpUJmHke9AWydfze4c6EfXZLhcMd0Gq\nMQ7HOIWfTbqr4zzx9smRoq4Ql57s2nba521XpJAdDeKL7xH/9j7PsXCls8C3Dd5D\nAajEmgUCgYAGEdn6tYxIdX7jF39E3x7zHQf8jHIoQ7+cLTLtd944mSGgeqMfbiww\nCoUa+AAUqjdAD5ViAyJrA+gmDtWpkFnJZtToXYwfUF2o3zRo4k1DeBrVbFqwSQkE\nomrfiBGtviYIPdqQLE34LYpWEooNPraqO9qTyc+9w5038u2OFS+WmQ==\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/encrypt2.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDFzCCAf8CCQDULaNM+Q+g3jANBgkqhkiG9w0BAQUFADBMMRcwFQYDVQQDDA5T\nd2lmdG1haWxlciBDQTEUMBIGA1UECgwLU3dpZnRtYWlsZXIxDjAMBgNVBAcMBVBh\ncmlzMQswCQYDVQQGEwJGUjAeFw0xMzExMjcwODM5MTJaFw0xNzExMjYwODM5MTJa\nME8xGjAYBgNVBAMMEVN3aWZ0bWFpbGVyLVVzZXIyMRQwEgYDVQQKDAtTd2lmdG1h\naWxlcjEOMAwGA1UEBwwFUGFyaXMxCzAJBgNVBAYTAkZSMIIBIjANBgkqhkiG9w0B\nAQEFAAOCAQ8AMIIBCgKCAQEAw4AoYVYss2sa1BWJAJpK6gVemjXrp1mVXVpb1/z6\nSH15AGsp3kiNXsMpgvsdofbqC/5HXrw2G8gWqo+uh6GuK67+Tvp7tO2aD4+8CZzU\nK1cffj7Pbx95DUPwXckv79PT5ZcuyeFaVo92aug11+gS/P8n0WXSlzZxNuZ1f3G2\nr/IgwfNKZlarEf1Ih781L2SwmyveW/dtsV2pdrd4IZwsV5SOF2zBFIXSuhPN0c+m\nmtwSJe+Ow1udLX4KJkAX8sGVFJ5P5q4s2nS9vLkkj7X6YRQscbyJO9L7e1TksRqL\nDLxZwiko6gUhp4/bIs1wDj5tzkQBi4qXviRq3i7A9b2d0QIDAQABMA0GCSqGSIb3\nDQEBBQUAA4IBAQAj8iARhPB2DA3YfT5mJJrgU156Sm0Z3mekAECsr+VqFZtU/9Dz\npPFYEf0hg61cjvwhLtOmaTB+50hu1KNNlu8QlxAfPJqNxtH85W0CYiZHJwW9eSTr\nz1swaHpRHLDUgo3oAXdh5syMbdl0MWos0Z14WP5yYu4IwJXs+j2JRW70BICyrNjm\nd+AjCzoYjKMdJkSj4uxQEOuW2/5veAoDyU+kHDdfT7SmbyoKu+Pw4Xg/XDuKoWYg\nw5/sRiw5vxsmOr9+anspDHdP9rUe1JEfwAJqZB3fwdqEyxu54Xw/GedG4wZBEJf0\nZcS1eh31emcjYUHQa1IA93jcFSmXzJ+ftJrY\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/encrypt2.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAw4AoYVYss2sa1BWJAJpK6gVemjXrp1mVXVpb1/z6SH15AGsp\n3kiNXsMpgvsdofbqC/5HXrw2G8gWqo+uh6GuK67+Tvp7tO2aD4+8CZzUK1cffj7P\nbx95DUPwXckv79PT5ZcuyeFaVo92aug11+gS/P8n0WXSlzZxNuZ1f3G2r/IgwfNK\nZlarEf1Ih781L2SwmyveW/dtsV2pdrd4IZwsV5SOF2zBFIXSuhPN0c+mmtwSJe+O\nw1udLX4KJkAX8sGVFJ5P5q4s2nS9vLkkj7X6YRQscbyJO9L7e1TksRqLDLxZwiko\n6gUhp4/bIs1wDj5tzkQBi4qXviRq3i7A9b2d0QIDAQABAoIBAH8RvK1PmqxfkEeL\nW8oVf13OcafgJjRW6NuNkKa5mmAlldFs1gDRvXl7dm7ZE3CjkYqMEw2DXdP+4KSp\n0TH9J7zi+A6ThnaZ/QniTcEdu1YUQbcH0kIS/dZec0wyKUNDtrXC5zl2jQY4Jyrj\nlaOpBzaEDfhvq0p3q2yYrIRSgACpSEVEsfPoHrxtlLhfMkVNe8P0nkQkzdwou5MQ\nMZKV4JUopLHLgPH6IXQCqA1wzlU32yZ86w88GFcBVLkwlLJCKbuAo7yxMCD+nzvA\nxm5NuF1kzpP0gk+kZRXF+rFEV4av/2kSS+n8IeUBQZrxovLBuQHVDvJXoqcEjmlh\nZUltznUCgYEA4inwieePfb7kh7L/ma5OLLn+uCNwzVw9LayzXT1dyPravOnkHl6h\nMgaoTspqDyU8k8pStedRrr5dVYbseni/A4WSMGvi4innqSXBQGp64TyeJy/e+LrS\nypSWQ6RSJkCxI5t8s4mOpR7FMcdE34I5qeA4G5RS1HIacn7Hxc7uXtcCgYEA3Uqn\nE7EDfNfYdZm6AikvE6x64oihWI0x47rlkLu6lf6ihiF1dbfaEN+IAaIxQ/unGYwU\n130F0TUwarXnVkeBIRlij4fXhExyd7USSQH1VpqmIqDwsS2ojrzQVMo5UcH+A22G\nbbHPtwJNmw8a7yzTPWo2/vnjgV2OaXEQ9vCVG5cCgYEAu1kEoihJDGBijSqxY4wp\nxBE7OSxamDNtlnV2i6l3FDMBmfaieqnnHDq5l7NDklJFUSQLyhXZ60hUprHDGV0G\n1pMCW8wzQSh3d/4HjSXnrsd5N3sHWMHiNeBKbbQkPP3f/2AhN9SebpgDwE2S9xe4\nTsmnkOkYiFYRJIFzWaAmhDcCgYEAwxRCgZt0xaPKULG6RpljxOYyVm24PsYKCwYB\nxjuYWw5k2/W3BJWVCXblAPuojpPUVTMmVGkErc9D5W6Ch471iOZF+t334cs6xci8\nW9v8GeKvPqu+Q5NKmrpctcKoESkA8qik7yLnSCAhpeYFCn/roKJ35QMJyktddhqU\np/yilfUCgYBxZ6YmFjYH6l5SxQdcfa5JQ2To8lZCfRJwB65EyWj4pKH4TaWFS7vb\n50WOGTBwJgyhTKLCO3lOmXIUyIwC+OO9xzaeRCBjqEhpup/Ih3MsfMEd6BZRVK5E\nIxtmIWba5HQ52k8FKHeRrRB7PSVSADUN2pUFkLudH+j/01kSZyJoLA==\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/intermediate.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDFjCCAf4CAQEwDQYJKoZIhvcNAQEFBQAwTDEXMBUGA1UEAwwOU3dpZnRtYWls\nZXIgQ0ExFDASBgNVBAoMC1N3aWZ0bWFpbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkG\nA1UEBhMCRlIwHhcNMTQxMTIwMTMyNTQxWhcNMTgxMTE5MTMyNTQxWjBWMSEwHwYD\nVQQDDBhTd2lmdG1haWxlciBJbnRlcm1lZGlhdGUxFDASBgNVBAoMC1N3aWZ0bWFp\nbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkGA1UEBhMCRlIwggEiMA0GCSqGSIb3DQEB\nAQUAA4IBDwAwggEKAoIBAQDSgEhftX6f1wV+uqWl4J+zwCn8fHaLZT6GZ0Gs9ThE\n4e+4mkLG1rvSEIJon8U0ic8Zph1UGa1Grveh5bgbldHlFxYSsCCyDGgixRvRWNhI\nKuO+SxaIZChqqKwVn3aNQ4BZOSo/MjJ/jQyr9BMgMmdxlHR3e1wkkeAkW//sOsfu\nxQGF1h9yeQvuu/GbG6K7vHSGOGd5O3G7bftfQ7l78TMqeJ7jV32AdJeuO5MD4dRn\nW4CQLTaeribLN0MKn35UdSiFoZxKHqqWcgtl5xcJWPOmq6CsAJ2Eo90kW/BHOrLv\n10h6Oan9R1PdXSvSCvVnXY3Kz30zofw305oA/KJk/hVzAgMBAAEwDQYJKoZIhvcN\nAQEFBQADggEBABijZ2NNd05Js5VFNr4uyaydam9Yqu/nnrxbPRbAXPlCduydu2Gd\nd1ekn3nblMJ87Bc7zVyHdAQD8/AfS1LOKuoWHpTzmlpIL+8T5sbCYG5J1jKdeLkh\n7L/UD5v1ACgA33oKtN8GzcrIq8Zp73r0n+c3hFCfDYRSZRCxGyIf3qgU2LBOD0A3\nwTff/N8E/p3WaJX9VnuQ7xyRMOubDuqJnlo5YsFv7wjyGOIAz9afZzcEbH6czt/t\ng0Xc/kGr/fkAjUu+z3ZfE4247Gut5m3hEVwWkpEEzQo4osX/BEX20Q2nPz9WBq4a\npK3qNNGwAqS4gdE3ihOExMWxAKgr9d2CcU4=\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/intermediate.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA0oBIX7V+n9cFfrqlpeCfs8Ap/Hx2i2U+hmdBrPU4ROHvuJpC\nxta70hCCaJ/FNInPGaYdVBmtRq73oeW4G5XR5RcWErAgsgxoIsUb0VjYSCrjvksW\niGQoaqisFZ92jUOAWTkqPzIyf40Mq/QTIDJncZR0d3tcJJHgJFv/7DrH7sUBhdYf\ncnkL7rvxmxuiu7x0hjhneTtxu237X0O5e/EzKnie41d9gHSXrjuTA+HUZ1uAkC02\nnq4myzdDCp9+VHUohaGcSh6qlnILZecXCVjzpqugrACdhKPdJFvwRzqy79dIejmp\n/UdT3V0r0gr1Z12Nys99M6H8N9OaAPyiZP4VcwIDAQABAoIBAQDLJiKyu2XIvKsA\n8wCKZY262+mpUjTVso/1BhHL6Zy0XZgMgFORsgrxYB16+zZGzfiguD/1uhIP9Svn\ngtt7Q8udW/phbrkfG/okFDYUg7m3bCz+qVjFqGOZC8+Hzq2LB2oGsbSj6L3zexyP\nlq4elIZghvUfml4CrQW0EVWbld79/kF7XHABcIOk2+3f63XAQWkjdFNxj5+z6TR0\n52Rv7SmRioAsukW9wr77G3Luv/0cEzDFXgGW5s0wO+rJg28smlsIaj+Y0KsptTig\nreQvReAT/S5ZxEp4H6WtXQ1WmaliMB0Gcu4TKB0yE8DoTeCePuslo9DqGokXYT66\noqtcVMqBAoGBAPoOL9byNNU/bBNDWSCiq8PqhSjl0M4vYBGqtgMXM4GFOJU+W2nX\nYRJbbxoSd/DKjnxEsR6V0vDTDHj4ZSkgmpEmVhEdAiwUwaZ0T8YUaCPhdiAENo5+\nzRBWVJcvAC2XKTK1hy5D7Z5vlC32HHygYqitU+JsK4ylvhrdeOcGx5cfAoGBANeB\nX0JbeuqBEwwEHZqYSpzmtB+IEiuYc9ARTttHEvIWgCThK4ldAzbXhDUIQy3Hm0sL\nPzDA33furNl2WwB+vmOuioYMNjArKrfg689Aim1byg4AHM5XVQcqoDSOABtI55iP\nE0hYDe/d4ema2gk1uR/mT4pnLnk2VzRKsHUbP9stAoGBAKjyIuJwPMADnMqbC0Hg\nhnrVHejW9TAJlDf7hgQqjdMppmQ3gF3PdjeH7VXJOp5GzOQrKRxIEABEJ74n3Xlf\nHO+K3kWrusb7syb6mNd0/DOZ5kyVbCL0iypJmdeXmuAyrFQlj9LzdD1Cl/RBv1d4\nqY/bo7xsZzQc24edMU2uJ/XzAoGBAMHChA95iK5HlwR6vtM8kfk4REMFaLDhxV8R\n8MCeyp33NQfzm91JT5aDd07nOt9yVGHInuwKveFrKuXq0C9FxZCCYfHcEOyGI0Zo\naBxTfyKMIMMtvriXNM/Yt2oJMndVuUUlfsTQxtcfu/r5S4h0URopTOK3msVI4mcV\nsEnaUjORAoGAGDnslKYtROQMXTe4sh6CoJ32J8UZVV9M+8NLus9rO0v/eZ/pIFxo\nMXGrrrl51ScqahCQ+DXHzpLvInsdlAJvDP3ymhb7H2xGsyvb3x2YgsLmr1YVOnli\nISbCssno3vZyFU1TDjeEIKqZHc92byHNMjMuhmlaA25g8kb0cCO76EA=\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/sign.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDFjCCAf4CCQDULaNM+Q+g3DANBgkqhkiG9w0BAQUFADBMMRcwFQYDVQQDDA5T\nd2lmdG1haWxlciBDQTEUMBIGA1UECgwLU3dpZnRtYWlsZXIxDjAMBgNVBAcMBVBh\ncmlzMQswCQYDVQQGEwJGUjAeFw0xMzExMjcwODM5MTBaFw0xNzExMjYwODM5MTBa\nME4xGTAXBgNVBAMMEFN3aWZ0bWFpbGVyLVVzZXIxFDASBgNVBAoMC1N3aWZ0bWFp\nbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkGA1UEBhMCRlIwggEiMA0GCSqGSIb3DQEB\nAQUAA4IBDwAwggEKAoIBAQCTe8ZouyjVGgqlljhaswYqLj7icMoHq+Qg13CE+zJg\ntl2/UzyPhAd3WWOIvlQ0lu+E/n0bXrS6+q28DrQ3UgJ9BskzzLz15qUO12b92AvG\nvLJ+9kKuiM5KXDljOAsXc7/A9UUGwEFA1D0mkeMmkHuiQavAMkzBLha22hGpg/hz\nVbE6W9MGna0szd8yh38IY1M5uR+OZ0dG3KbVZb7H3N0OLOP8j8n+4YtAGAW+Onz/\n2CGPfZ1kaDMvY/WTZwyGeA4FwCPy1D8tfeswqKnWDB9Sfl8hns5VxnoJ3dqKQHeX\niC4OMfQ0U4CcuM5sVYJZRNNwP7/TeUh3HegnOnuZ1hy9AgMBAAEwDQYJKoZIhvcN\nAQEFBQADggEBAAEPjGt98GIK6ecAEat52aG+8UP7TuZaxoH3cbZdhFTafrP8187F\nRk5G3LCPTeA/QIzbHppA4fPAiS07OVSwVCknpTJbtKKn0gmtTZxThacFHF2NlzTH\nXxM5bIbkK3jzIF+WattyTSj34UHHfaNAmvmS7Jyq6MhjSDbcQ+/dZ9eo2tF/AmrC\n+MBhyH8aUYwKhTOQQh8yC11niziHhGO99FQ4tpuD9AKlun5snHq4uK9AOFe8VhoR\nq2CqX5g5v8OAtdlvzhp50IqD4BNOP+JrUxjGLHDG76BZZIK2Ai1eBz+GhRlIQru/\n8EhQzd94mdFEPblGbmuD2QXWLFFKLiYOwOc=\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/sign.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAk3vGaLso1RoKpZY4WrMGKi4+4nDKB6vkINdwhPsyYLZdv1M8\nj4QHd1ljiL5UNJbvhP59G160uvqtvA60N1ICfQbJM8y89ealDtdm/dgLxryyfvZC\nrojOSlw5YzgLF3O/wPVFBsBBQNQ9JpHjJpB7okGrwDJMwS4WttoRqYP4c1WxOlvT\nBp2tLM3fMod/CGNTObkfjmdHRtym1WW+x9zdDizj/I/J/uGLQBgFvjp8/9ghj32d\nZGgzL2P1k2cMhngOBcAj8tQ/LX3rMKip1gwfUn5fIZ7OVcZ6Cd3aikB3l4guDjH0\nNFOAnLjObFWCWUTTcD+/03lIdx3oJzp7mdYcvQIDAQABAoIBAH2vrw/T6GFrlwU0\ntwP8q1VJIghCDLpq77hZQafilzU6VTxWyDaaUu6QPDXt1b8Xnjnd02p+1FDAj0zD\nzyuR9VLtdIxzf9mj3KiAQ2IzOx3787YlUgCB0CQo4jM/MJyk5RahL1kogLOp7A8x\npr5XxTUq+B6L/0Nmbq8XupOXRyWp53amZ5N8sgWDv4oKh9fqgAhxbSG6KUkTmhYs\nDLinWg86Q28pSn+eivf4dehR56YwtTBVguXW3WKO70+GW1RotSrS6e6SSxfKYksZ\na7/J1hCmJkEE3+4C8BpcI0MelgaK66ocN0pOqDF9ByxphARqyD7tYCfoS2P8gi81\nXoiZJaECgYEAwqx4AnDX63AANsfKuKVsEQfMSAG47SnKOVwHB7prTAgchTRcDph1\nEVOPtJ+4ssanosXzLcN/dCRlvqLEqnKYAOizy3C56CyRguCpO1AGbRpJjRmHTRgA\nw8iArhM07HgJ3XLFn99V/0bsPCMxW8dje1ZMjKjoQtDrXRQMtWaVY+UCgYEAwfGi\nf0If6z7wJj9gQUkGimWDAg/bxDkvEeh3nSD/PQyNiW0XDclcb3roNPQsal2ZoMwt\nf1bwkclw7yUCIZBvXWEkZapjKCdseTp6nglScxr8GAzfN9p5KQl+OS3GzC6xZf6C\nBsZQ5ucsHTHsCAi3WbwGK829z9c7x0qRwgwu9/kCgYEAsqwEwYi8Q/RZ3e1lXC9H\njiHwFi6ugc2XMyoJscghbnkLZB54V1UKLUraXFcz97FobnbsCJajxf8Z+uv9QMtI\nQ51QV2ow1q0BKHP2HuAF5eD4nK5Phix/lzHRGPO74UUTGNKcG22pylBXxaIvTSMl\nZTABth/YfGqvepBKUbvDZRkCgYB5ykbUCW9H6D8glZ3ZgYU09ag+bD0CzTIs2cH7\nj1QZPz/GdBYNF00PyKv3TPpzVRH7cxyDIdJyioB7/M6Iy03T4wPbQBOCjLdGrZ2A\njrQTCngSlkq6pVx+k7KLL57ua8gFF70JihIV3kfKkaX6KZcSJ8vsSAgRc8TbUo2T\nwNjh6QKBgDyxw4bG2ULs+LVaHcnp7nizLgRGXJsCkDICjla6y0eCgAnG8fSt8CcG\ns5DIfJeVs/NXe/NVNuVrfwsUx0gBOirtFwQStvi5wJnY/maGAyjmgafisNFgAroT\naM5f+wyGPQeGCs7bj7JWY7Nx9lkyuUV7DdKBTZNMOe51K3+PTEL3\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/sign2.crt",
    "content": "-----BEGIN CERTIFICATE-----\nMIIDGTCCAgECAQEwDQYJKoZIhvcNAQEFBQAwVjEhMB8GA1UEAwwYU3dpZnRtYWls\nZXIgSW50ZXJtZWRpYXRlMRQwEgYDVQQKDAtTd2lmdG1haWxlcjEOMAwGA1UEBwwF\nUGFyaXMxCzAJBgNVBAYTAkZSMB4XDTE0MTEyMDEzMjYyNloXDTE4MTExOTEzMjYy\nNlowTzEaMBgGA1UEAwwRU3dpZnRtYWlsZXItVXNlcjIxFDASBgNVBAoMC1N3aWZ0\nbWFpbGVyMQ4wDAYDVQQHDAVQYXJpczELMAkGA1UEBhMCRlIwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQDbr1m4z/rzFS/DxUUQIhKNx19oAeGYLt3niaEP\ntwfvBMNB80gMgM9d+XtqrPAMPeY/2C8t5NlChNPKMcR70JBKdmlSH4/aTjaIfWmD\nPoZJjvRRXINZgSHNKIt4ZGAN/EPFr19CBisV4iPxzu+lyIbbkaZJ/qtyatlP7m/q\n8TnykFRlyxNEveCakpcXeRd3YTFGKWoED+/URhVc0cCPZVjoeSTtPHAYBnC29lG5\nVFbq6NBQiyF4tpjOHRarq6G8PtQFH9CpAZg5bPk3bqka9C8mEr5jWfrM4EHtUkTl\nCwVLOQRBsz/nMBT27pXZh18GU0hc3geNDN4kqaeqgNBo0mblAgMBAAEwDQYJKoZI\nhvcNAQEFBQADggEBAAHDMuv6oxWPsTQWWGWWFIk7QZu3iogMqFuxhhQxg8BE37CT\nVt1mBVEjYGMkWhMSwWBMWuP6yuOZecWtpp6eOie/UKGg1XoW7Y7zq2aQaP7YPug0\n8Lgq1jIo7iO2b6gZeMtLiTZrxyte0z1XzS3wy7ZC9mZjYd7QE7mZ+/rzQ0x5zjOp\nG8b3msS/yYYJCMN+HtHln++HOGmm6uhvbsHTfvvZvtl7F5vJ5WhGGlUfjhanSEtZ\n1RKx+cbgIv1eFOGO1OTuZfEuKdLb0T38d/rjLeI99nVVKEIGtLmX4dj327GHe/D3\naPr2blF2gOvlzkfN9Vz6ZUE2s3rVBeCg2AVseYQ=\n-----END CERTIFICATE-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/_samples/smime/sign2.key",
    "content": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA269ZuM/68xUvw8VFECISjcdfaAHhmC7d54mhD7cH7wTDQfNI\nDIDPXfl7aqzwDD3mP9gvLeTZQoTTyjHEe9CQSnZpUh+P2k42iH1pgz6GSY70UVyD\nWYEhzSiLeGRgDfxDxa9fQgYrFeIj8c7vpciG25GmSf6rcmrZT+5v6vE58pBUZcsT\nRL3gmpKXF3kXd2ExRilqBA/v1EYVXNHAj2VY6Hkk7TxwGAZwtvZRuVRW6ujQUIsh\neLaYzh0Wq6uhvD7UBR/QqQGYOWz5N26pGvQvJhK+Y1n6zOBB7VJE5QsFSzkEQbM/\n5zAU9u6V2YdfBlNIXN4HjQzeJKmnqoDQaNJm5QIDAQABAoIBAAM2FvuqnqJ7Bs23\nzoCj3t2PsodUr7WHydqemmoeZNFLoocORVlZcK6Q/QrcKE4lgX4hbN8g30QnqOjl\nvVeJ/vH3tSZsK7AnQIjSPH6cpV3h5xRhY9IlHxdepltGLFlH/L2hCKVwbaTOP3RD\ncCFeQwpmoKWoQV1UzoRqmdw3Vn+DMaUULomLVR9aSW9PnKeFL+tPWShf7GmVISfM\n2H6xKw/qT0XAX59ZHA1laxSFVvbV5ZcKrBOFMV407Vzw2d3ojmfEzNsHjUVBXX8j\nB5nK1VeJiTVmcoVhnRX7tXESDaZy+Kv38pqOmc8Svn70lDJ35SM2EpWnX39w5LsQ\n29NsIUECgYEA/vNKiMfVmmZNQrpcuHQe5adlmz9+I4xJ4wbRzrS7czpbKF0/iaPf\ndKoVz67yYHOJCBHTVaXWkElQsq1mkyuFt/cc0ReJXO8709+t+6ULsE50cLQm/HN5\nnpg3gw0Ls/9dy/cHM5SdVIHMBm9oQ65rXup/dqWC8Dz2cAAOQhIPwx0CgYEA3Jbk\nDPdUlrj4sXcE3V/CtmBuK9Xq1xolJt026fYCrle0YhdMKmchRBDCc6BzM+F/vDyC\nllPfQu8TDXK40Oan7GbxMdoLqKK9gSIq1dvfG1YMMz8OrBcX8xKe61KFRWd7QSBJ\nBcY575NzYHapOHVGnUJ68j8zCow0gfb7q6iK4GkCgYEAz2mUuKSCxYL21hORfUqT\nHFjMU7oa38axEa6pn9XvLjZKlRMPruWP1HTPG9ADRa6Yy+TcnrA1V9sdeM+TRKXC\nusCiRAU27lF+xccS30gNs1iQaGRX10gGqJzDhK1nWP+nClmlFTSRrn+OQan/FBjh\nJy31lsveM54VC1cwQlY5Vo0CgYEArtjfnLNzFiE55xjq/znHUd4vlYlzItrzddHE\nlEBOsbiNH29ODRI/2P7b0uDsT8Q/BoqEC/ohLqHn3TIA8nzRv91880HdGecdBL17\nbJZiSv2yn/AshhWsAxzQYMDBKFk05lNb7jrIc3DR9DU6PqketsoaP+f+Yi7t89I8\nfD0VD3kCgYAaJCoQshng/ijiHF/RJXLrXXHJSUmaOfbweX/mzFup0YR1LxUjcv85\ncxvwc41Y2iI5MwUXyX97/GYKeoobzWZy3XflNWtg04rcInVaPsb/OOFDDqI+MkzT\nB4PcCurOmjzcxHMVE34CYvl3YVwWrPb5JO1rYG9T2gKUJnLU6qG4Bw==\n-----END RSA PRIVATE KEY-----\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\nrequire_once __DIR__.'/Mime/AttachmentAcceptanceTest.php';\n\nclass Swift_AttachmentAcceptanceTest extends Swift_Mime_AttachmentAcceptanceTest{\n    protected function _createAttachment() {\n        return Swift_Attachment::newInstance();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_ByteStream_FileByteStreamAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_tmpDir;\n    private $_testFile;\n\n    public function setUp() {\n        if (!defined('SWIFT_TMP_DIR')) {\n            $this->markTestSkipped(\n                'Cannot run test without a writable directory to use ('.\n                'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'\n             );\n        }\n\n        $this->_tmpDir = SWIFT_TMP_DIR;\n        $this->_testFile = $this->_tmpDir.'/swift-test-file'.__CLASS__;\n        file_put_contents($this->_testFile, 'abcdefghijklm');\n    }\n\n    public function tearDown() {\n        unlink($this->_testFile);\n    }\n\n    public function testFileDataCanBeRead() {\n        $file = $this->_createFileStream($this->_testFile);\n        $str = '';\n        while (false !== $bytes = $file->read(8192)) {\n            $str .= $bytes;\n        }\n        $this->assertEquals('abcdefghijklm', $str);\n    }\n\n    public function testFileDataCanBeReadSequentially() {\n        $file = $this->_createFileStream($this->_testFile);\n        $this->assertEquals('abcde', $file->read(5));\n        $this->assertEquals('fghijklm', $file->read(8));\n        $this->assertFalse($file->read(1));\n    }\n\n    public function testFilenameIsReturned() {\n        $file = $this->_createFileStream($this->_testFile);\n        $this->assertEquals($this->_testFile, $file->getPath());\n    }\n\n    public function testFileCanBeWrittenTo() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $file->write('foobar');\n        $this->assertEquals('foobar', $file->read(8192));\n    }\n\n    public function testReadingFromThenWritingToFile() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $file->write('foobar');\n        $this->assertEquals('foobar', $file->read(8192));\n        $file->write('zipbutton');\n        $this->assertEquals('zipbutton', $file->read(8192));\n    }\n\n    public function testWritingToFileWithCanonicalization() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $file->addFilter($this->_createFilter(array(\"\\r\\n\", \"\\r\"), \"\\n\"), 'allToLF');\n        $file->write(\"foo\\r\\nbar\\r\");\n        $file->write(\"\\nzip\\r\\ntest\\r\");\n        $file->flushBuffers();\n        $this->assertEquals(\"foo\\nbar\\nzip\\ntest\\n\", file_get_contents($this->_testFile));\n    }\n\n    public function testBindingOtherStreamsMirrorsWriteOperations() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is2->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n\n        $file->bind($is1);\n        $file->bind($is2);\n\n        $file->write('x');\n        $file->write('y');\n    }\n\n    public function testBindingOtherStreamsMirrorsFlushOperations() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->once())\n            ->method('flushBuffers');\n        $is2->expects($this->once())\n            ->method('flushBuffers');\n\n        $file->bind($is1);\n        $file->bind($is2);\n\n        $file->flushBuffers();\n    }\n\n    public function testUnbindingStreamPreventsFurtherWrites() {\n        $file = $this->_createFileStream(\n            $this->_testFile, true\n            );\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->once())\n            ->method('write')\n            ->with('x');\n\n        $file->bind($is1);\n        $file->bind($is2);\n\n        $file->write('x');\n\n        $file->unbind($is2);\n\n        $file->write('y');\n    }\n\n    // -- Creation methods\n\n    private function _createFilter($search, $replace) {\n        return new Swift_StreamFilters_StringReplacementFilter($search, $replace);\n    }\n\n    private function _createMockInputStream() {\n        return $this->getMock('Swift_InputByteStream');\n    }\n\n    private function _createFileStream($file, $writable = false) {\n        return new Swift_ByteStream_FileByteStream($file, $writable);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_factory;\n    private $_prefix = 'Swift_CharacterReader_';\n\n    public function setUp() {\n        $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n    }\n\n    public function testCreatingUtf8Reader() {\n        foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) {\n            $reader = $this->_factory->getReaderFor($utf8);\n            $this->assertInstanceof($this->_prefix.'Utf8Reader', $reader);\n        }\n    }\n\n    public function testCreatingIso8859XReaders() {\n        $charsets = array();\n        foreach (range(1, 16) as $number) {\n            foreach (array('iso', 'iec') as $body) {\n                $charsets[] = $body.'-8859-'.$number;\n                $charsets[] = $body.'8859-'.$number;\n                $charsets[] = strtoupper($body).'-8859-'.$number;\n                $charsets[] = strtoupper($body).'8859-'.$number;\n            }\n        }\n\n        foreach ($charsets as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingWindows125XReaders() {\n        $charsets = array();\n        foreach (range(0, 8) as $number) {\n            $charsets[] = 'windows-125'.$number;\n            $charsets[] = 'windows125'.$number;\n            $charsets[] = 'WINDOWS-125'.$number;\n            $charsets[] = 'WINDOWS125'.$number;\n        }\n\n        foreach ($charsets as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingCodePageReaders() {\n        $charsets = array();\n        foreach (range(0, 8) as $number) {\n            $charsets[] = 'cp-125'.$number;\n            $charsets[] = 'cp125'.$number;\n            $charsets[] = 'CP-125'.$number;\n            $charsets[] = 'CP125'.$number;\n        }\n\n        foreach (array(437, 737, 850, 855, 857, 858, 860,\n            861, 863, 865, 866, 869, ) as $number) {\n            $charsets[] = 'cp-'.$number;\n            $charsets[] = 'cp'.$number;\n            $charsets[] = 'CP-'.$number;\n            $charsets[] = 'CP'.$number;\n        }\n\n        foreach ($charsets as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingAnsiReader() {\n        foreach (array('ansi', 'ANSI') as $ansi) {\n            $reader = $this->_factory->getReaderFor($ansi);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingMacintoshReader() {\n        foreach (array('macintosh', 'MACINTOSH') as $mac) {\n            $reader = $this->_factory->getReaderFor($mac);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingKOIReaders() {\n        $charsets = array();\n        foreach (array('7', '8-r', '8-u', '8u', '8r') as $end) {\n            $charsets[] = 'koi-'.$end;\n            $charsets[] = 'koi'.$end;\n            $charsets[] = 'KOI-'.$end;\n            $charsets[] = 'KOI'.$end;\n        }\n\n        foreach ($charsets as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingIsciiReaders() {\n        foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingMIKReader() {\n        foreach (array('mik', 'MIK') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingCorkReader() {\n        foreach (array('cork', 'CORK', 't1', 'T1') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(1, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingUcs2Reader() {\n        foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(2, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingUtf16Reader() {\n        foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(2, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingUcs4Reader() {\n        foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(4, $reader->getInitialByteSize());\n        }\n    }\n\n    public function testCreatingUtf32Reader() {\n        foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) {\n            $reader = $this->_factory->getReaderFor($charset);\n            $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);\n            $this->assertEquals(4, $reader->getInitialByteSize());\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\n\n//This is more of a \"cross your fingers and hope it works\" test!\n\nclass Swift_DependencyContainerAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    public function testNoLookupsFail() {\n        $di = Swift_DependencyContainer::getInstance();\n        foreach ($di->listItems() as $itemName) {\n            try {\n                $di->lookup($itemName);\n            } catch (Swift_DependencyException $e) {\n                $this->fail($e->getMessage());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\nrequire_once __DIR__.'/Mime/EmbeddedFileAcceptanceTest.php';\n\nclass Swift_EmbeddedFileAcceptanceTest extends Swift_Mime_EmbeddedFileAcceptanceTest{\n    protected function _createEmbeddedFile() {\n        return Swift_EmbeddedFile::newInstance();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Encoder_Base64EncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_encoder;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');\n        $this->_encoder = new Swift_Encoder_Base64Encoder();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n                    $encodedText = $this->_encoder->encodeString($text);\n\n                    $this->assertEquals(\n                        base64_decode($encodedText), $text,\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Encoder_QpEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_factory;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');\n        $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $encoding = $encodingDir;\n            $charStream = new Swift_CharacterStream_ArrayCharacterStream(\n                $this->_factory, $encoding);\n            $encoder = new Swift_Encoder_QpEncoder($charStream);\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n                    $encodedText = $encoder->encodeString($text);\n\n                    foreach (explode(\"\\r\\n\", $encodedText) as $line) {\n                        $this->assertLessThanOrEqual(76, strlen($line));\n                    }\n\n                    $this->assertEquals(\n                        quoted_printable_decode($encodedText), $text,\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_factory;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');\n        $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $encoding = $encodingDir;\n            $charStream = new Swift_CharacterStream_ArrayCharacterStream(\n                $this->_factory, $encoding);\n            $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n                    $encodedText = $encoder->encodeString($text);\n\n                    $this->assertEquals(\n                        urldecode(implode('', explode(\"\\r\\n\", $encodedText))), $text,\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\n\nclass Swift_EncodingAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    public function testGet7BitEncodingReturns7BitEncoder() {\n        $encoder = Swift_Encoding::get7BitEncoding();\n        $this->assertEquals('7bit', $encoder->getName());\n    }\n\n    public function testGet8BitEncodingReturns8BitEncoder() {\n        $encoder = Swift_Encoding::get8BitEncoding();\n        $this->assertEquals('8bit', $encoder->getName());\n    }\n\n    public function testGetQpEncodingReturnsQpEncoder() {\n        $encoder = Swift_Encoding::getQpEncoding();\n        $this->assertEquals('quoted-printable', $encoder->getName());\n    }\n\n    public function testGetBase64EncodingReturnsBase64Encoder() {\n        $encoder = Swift_Encoding::getBase64Encoding();\n        $this->assertEquals('base64', $encoder->getName());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_cache;\n    private $_key1 = 'key1';\n    private $_key2 = 'key2';\n\n    public function setUp() {\n        $this->_cache = new Swift_KeyCache_ArrayKeyCache(\n            new Swift_KeyCache_SimpleKeyCacheInputStream()\n            );\n    }\n\n    public function testStringDataCanBeSetAndFetched() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeOverwritten() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeAppended() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND\n            );\n        $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testHasKeyReturnValue() {\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyIsWellPartitioned() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));\n    }\n\n    public function testItemKeyIsWellPartitioned() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));\n    }\n\n    public function testByteStreamCanBeImported() {\n        $os = new Swift_ByteStream_ArrayByteStream();\n        $os->write('abcdef');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamCanBeAppended() {\n        $os1 = new Swift_ByteStream_ArrayByteStream();\n        $os1->write('abcdef');\n\n        $os2 = new Swift_ByteStream_ArrayByteStream();\n        $os2->write('xyzuvw');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND\n            );\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND\n            );\n\n        $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamAndStringCanBeAppended() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND\n            );\n\n        $os = new Swift_ByteStream_ArrayByteStream();\n        $os->write('abcdef');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND\n            );\n        $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testDataCanBeExportedToByteStream() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n\n        $is = new Swift_ByteStream_ArrayByteStream();\n\n        $this->_cache->exportToByteStream($this->_key1, 'foo', $is);\n\n        $string = '';\n        while (false !== $bytes = $is->read(8192)) {\n            $string .= $bytes;\n        }\n\n        $this->assertEquals('test', $string);\n    }\n\n    public function testKeyCanBeCleared() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->_cache->clearKey($this->_key1, 'foo');\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyCanBeCleared() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));\n        $this->_cache->clearAll($this->_key1);\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));\n    }\n\n    public function testKeyCacheInputStream() {\n        $is = $this->_cache->getInputByteStream($this->_key1, 'foo');\n        $is->write('abc');\n        $is->write('xyz');\n        $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_cache;\n    private $_key1;\n    private $_key2;\n\n    public function setUp() {\n        if (!defined('SWIFT_TMP_DIR')) {\n            $this->markTestSkipped(\n                'Cannot run test without a writable directory to use ('.\n                'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'\n             );\n        }\n\n        $this->_key1 = uniqid(microtime(true), true);\n        $this->_key2 = uniqid(microtime(true), true);\n        $this->_cache = new Swift_KeyCache_DiskKeyCache(\n            new Swift_KeyCache_SimpleKeyCacheInputStream(),\n            SWIFT_TMP_DIR\n            );\n    }\n\n    public function testStringDataCanBeSetAndFetched() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeOverwritten() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeAppended() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND\n            );\n        $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testHasKeyReturnValue() {\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyIsWellPartitioned() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));\n    }\n\n    public function testItemKeyIsWellPartitioned() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));\n    }\n\n    public function testByteStreamCanBeImported() {\n        $os = new Swift_ByteStream_ArrayByteStream();\n        $os->write('abcdef');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamCanBeAppended() {\n        $os1 = new Swift_ByteStream_ArrayByteStream();\n        $os1->write('abcdef');\n\n        $os2 = new Swift_ByteStream_ArrayByteStream();\n        $os2->write('xyzuvw');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND\n            );\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND\n            );\n\n        $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamAndStringCanBeAppended() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND\n            );\n\n        $os = new Swift_ByteStream_ArrayByteStream();\n        $os->write('abcdef');\n\n        $this->_cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND\n            );\n        $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testDataCanBeExportedToByteStream() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n\n        $is = new Swift_ByteStream_ArrayByteStream();\n\n        $this->_cache->exportToByteStream($this->_key1, 'foo', $is);\n\n        $string = '';\n        while (false !== $bytes = $is->read(8192)) {\n            $string .= $bytes;\n        }\n\n        $this->assertEquals('test', $string);\n    }\n\n    public function testKeyCanBeCleared() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->_cache->clearKey($this->_key1, 'foo');\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyCanBeCleared() {\n        $this->_cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->_cache->setString(\n            $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));\n        $this->_cache->clearAll($this->_key1);\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));\n        $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));\n    }\n\n    public function testKeyCacheInputStream() {\n        $is = $this->_cache->getInputByteStream($this->_key1, 'foo');\n        $is->write('abc');\n        $is->write('xyz');\n        $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\nrequire_once __DIR__.'/Mime/SimpleMessageAcceptanceTest.php';\n\nclass Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest{\n    public function testAddPartWrapper() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = $message->getDate();\n        $boundary = $message->getBoundary();\n\n        $message->addPart('foo', 'text/plain', 'iso-8859-1');\n        $message->addPart('test <b>foo</b>', 'text/html', 'iso-8859-1');\n\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'test <b>foo</b>'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createMessage() {\n        Swift_DependencyContainer::getInstance()\n            ->register('properties.charset')->asValue(null);\n\n        return Swift_Message::newInstance();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_AttachmentAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_contentEncoder;\n    private $_cache;\n    private $_grammar;\n    private $_headers;\n\n    public function setUp() {\n        $this->_cache = new Swift_KeyCache_ArrayKeyCache(\n            new Swift_KeyCache_SimpleKeyCacheInputStream()\n            );\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $this->_grammar = new Swift_Mime_Grammar();\n        $this->_headers = new Swift_Mime_SimpleHeaderSet(\n            new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)\n            );\n    }\n\n    public function testDispositionIsSetInHeader() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setDisposition('inline');\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: inline'.\"\\r\\n\",\n            $attachment->toString()\n            );\n    }\n\n    public function testDispositionIsAttachmentByDefault() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment'.\"\\r\\n\",\n            $attachment->toString()\n            );\n    }\n\n    public function testFilenameIsSetInHeader() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf'.\"\\r\\n\",\n            $attachment->toString()\n            );\n    }\n\n    public function testSizeIsSetInHeader() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setSize(12340);\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; size=12340'.\"\\r\\n\",\n            $attachment->toString()\n            );\n    }\n\n    public function testMultipleParametersInHeader() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setSize(12340);\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf; size=12340'.\"\\r\\n\",\n            $attachment->toString()\n            );\n    }\n\n    public function testEndToEnd() {\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setSize(12340);\n        $attachment->setBody('abcd');\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf; size=12340'.\"\\r\\n\".\n            \"\\r\\n\".\n            base64_encode('abcd'),\n            $attachment->toString()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createAttachment() {\n        $entity = new Swift_Mime_Attachment(\n            $this->_headers,\n            $this->_contentEncoder,\n            $this->_cache,\n            $this->_grammar\n            );\n\n        return $entity;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_encoder;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');\n        $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n\n                    $os = new Swift_ByteStream_ArrayByteStream();\n                    $os->write($text);\n\n                    $is = new Swift_ByteStream_ArrayByteStream();\n\n                    $this->_encoder->encodeByteStream($os, $is);\n\n                    $encoded = '';\n                    while (false !== $bytes = $is->read(8192)) {\n                        $encoded .= $bytes;\n                    }\n\n                    $this->assertEquals(\n                        base64_decode($encoded), $text,\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    protected $_samplesDir;\n\n    /**\n     * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder\n     */\n    protected $_encoder;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');\n        $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n\n                    $os = new Swift_ByteStream_ArrayByteStream();\n                    $os->write($text);\n\n                    $is = new Swift_ByteStream_ArrayByteStream();\n                    $this->_encoder->encodeByteStream($os, $is);\n\n                    $encoded = '';\n                    while (false !== $bytes = $is->read(8192)) {\n                        $encoded .= $bytes;\n                    }\n\n                    $this->assertEquals(\n                        quoted_printable_decode($encoded),\n                        // CR and LF are converted to CRLF\n                        preg_replace('~\\r(?!\\n)|(?<!\\r)\\n~', \"\\r\\n\", $text),\n                        '%s: Encoded string should decode back to original string for sample '.$sampleDir.'/'.$sampleFile\n                    );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n\n    public function testEncodingAndDecodingSamplesFromDiConfiguredInstance() {\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertSame('=C3=A4=C3=B6=C3=BC=C3=9F', $encoder->encodeString('äöüß'));\n    }\n\n    /**\n     * @expectedException RuntimeException\n     */\n    public function testCharsetChangeNotImplemented() {\n        $this->_encoder->charsetChanged('utf-8');\n        $this->_encoder->charsetChanged('charset');\n        $this->_encoder->encodeString('foo');\n    }\n\n    public function testGetName() {\n        $this->assertSame('quoted-printable', $this->_encoder->getName());\n    }\n\n    private function _createEncoderFromContainer() {\n        return Swift_DependencyContainer::getInstance()\n            ->lookup('mime.nativeqpcontentencoder')\n            ;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_encoder;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');\n        $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');\n    }\n\n    public function testEncodingAndDecodingSamplesString() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n                    $encodedText = $this->_encoder->encodeString($text);\n\n                    $this->assertEquals(\n                        $encodedText, $text,\n                        '%s: Encoded string should be identical to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n\n    public function testEncodingAndDecodingSamplesByteStream() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n\n                    $os = new Swift_ByteStream_ArrayByteStream();\n                    $os->write($text);\n\n                    $is = new Swift_ByteStream_ArrayByteStream();\n\n                    $this->_encoder->encodeByteStream($os, $is);\n\n                    $encoded = '';\n                    while (false !== $bytes = $is->read(8192)) {\n                        $encoded .= $bytes;\n                    }\n\n                    $this->assertEquals(\n                        $encoded, $text,\n                        '%s: Encoded string should be identical to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_samplesDir;\n    private $_factory;\n\n    public function setUp() {\n        $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');\n        $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n    }\n\n    public function testEncodingAndDecodingSamples() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $encoding = $encodingDir;\n            $charStream = new Swift_CharacterStream_NgCharacterStream(\n                $this->_factory, $encoding);\n            $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n\n                    $os = new Swift_ByteStream_ArrayByteStream();\n                    $os->write($text);\n\n                    $is = new Swift_ByteStream_ArrayByteStream();\n                    $encoder->encodeByteStream($os, $is);\n\n                    $encoded = '';\n                    while (false !== $bytes = $is->read(8192)) {\n                        $encoded .= $bytes;\n                    }\n\n                    $this->assertEquals(\n                        quoted_printable_decode($encoded), $text,\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n\n    public function testEncodingAndDecodingSamplesFromDiConfiguredInstance() {\n        $sampleFp = opendir($this->_samplesDir);\n        while (false !== $encodingDir = readdir($sampleFp)) {\n            if (substr($encodingDir, 0, 1) == '.') {\n                continue;\n            }\n\n            $encoding = $encodingDir;\n            $encoder = $this->_createEncoderFromContainer();\n\n            $sampleDir = $this->_samplesDir.'/'.$encodingDir;\n\n            if (is_dir($sampleDir)) {\n                $fileFp = opendir($sampleDir);\n                while (false !== $sampleFile = readdir($fileFp)) {\n                    if (substr($sampleFile, 0, 1) == '.') {\n                        continue;\n                    }\n\n                    $text = file_get_contents($sampleDir.'/'.$sampleFile);\n\n                    $os = new Swift_ByteStream_ArrayByteStream();\n                    $os->write($text);\n\n                    $is = new Swift_ByteStream_ArrayByteStream();\n                    $encoder->encodeByteStream($os, $is);\n\n                    $encoded = '';\n                    while (false !== $bytes = $is->read(8192)) {\n                        $encoded .= $bytes;\n                    }\n\n                    $this->assertEquals(\n                        str_replace(\"\\r\\n\", \"\\n\", quoted_printable_decode($encoded)), str_replace(\"\\r\\n\", \"\\n\", $text),\n                        '%s: Encoded string should decode back to original string for sample '.\n                        $sampleDir.'/'.$sampleFile\n                        );\n                }\n                closedir($fileFp);\n            }\n        }\n        closedir($sampleFp);\n    }\n\n    public function testEncodingLFTextWithDiConfiguredInstance() {\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a\\r\\nb\\r\\nc\", $encoder->encodeString(\"a\\nb\\nc\"));\n    }\n\n    public function testEncodingCRTextWithDiConfiguredInstance() {\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a\\r\\nb\\r\\nc\", $encoder->encodeString(\"a\\rb\\rc\"));\n    }\n\n    public function testEncodingLFCRTextWithDiConfiguredInstance() {\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a\\r\\n\\r\\nb\\r\\n\\r\\nc\", $encoder->encodeString(\"a\\n\\rb\\n\\rc\"));\n    }\n\n    public function testEncodingCRLFTextWithDiConfiguredInstance() {\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a\\r\\nb\\r\\nc\", $encoder->encodeString(\"a\\r\\nb\\r\\nc\"));\n    }\n\n    public function testEncodingDotStuffingWithDiConfiguredInstance() {\n        // Enable DotEscaping\n        Swift_Preferences::getInstance()->setQPDotEscape(true);\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a=2E\\r\\n=2E\\r\\n=2Eb\\r\\nc\", $encoder->encodeString(\"a.\\r\\n.\\r\\n.b\\r\\nc\"));\n        // Return to default\n        Swift_Preferences::getInstance()->setQPDotEscape(false);\n        $encoder = $this->_createEncoderFromContainer();\n        $this->assertEquals(\"a.\\r\\n.\\r\\n.b\\r\\nc\", $encoder->encodeString(\"a.\\r\\n.\\r\\n.b\\r\\nc\"));\n    }\n\n    public function testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstance() {\n        // Enable DotEscaping\n        Swift_Preferences::getInstance()->setQPDotEscape(true);\n        $this->testEncodingAndDecodingSamplesFromDiConfiguredInstance();\n        // Disable DotStuffing to continue\n        Swift_Preferences::getInstance()->setQPDotEscape(false);\n    }\n\n    private function _createEncoderFromContainer() {\n        return Swift_DependencyContainer::getInstance()\n            ->lookup('mime.qpcontentencoder')\n            ;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_EmbeddedFileAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_contentEncoder;\n    private $_cache;\n    private $_grammar;\n    private $_headers;\n\n    public function setUp() {\n        $this->_cache = new Swift_KeyCache_ArrayKeyCache(\n            new Swift_KeyCache_SimpleKeyCacheInputStream()\n            );\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $this->_grammar = new Swift_Mime_Grammar();\n        $this->_headers = new Swift_Mime_SimpleHeaderSet(\n            new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)\n            );\n    }\n\n    public function testContentIdIsSetInHeader() {\n        $file = $this->_createEmbeddedFile();\n        $file->setContentType('application/pdf');\n        $file->setId('foo@bar');\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <foo@bar>'.\"\\r\\n\".\n            'Content-Disposition: inline'.\"\\r\\n\",\n            $file->toString()\n            );\n    }\n\n    public function testDispositionIsSetInHeader() {\n        $file = $this->_createEmbeddedFile();\n        $id = $file->getId();\n        $file->setContentType('application/pdf');\n        $file->setDisposition('attachment');\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$id.'>'.\"\\r\\n\".\n            'Content-Disposition: attachment'.\"\\r\\n\",\n            $file->toString()\n            );\n    }\n\n    public function testFilenameIsSetInHeader() {\n        $file = $this->_createEmbeddedFile();\n        $id = $file->getId();\n        $file->setContentType('application/pdf');\n        $file->setFilename('foo.pdf');\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$id.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=foo.pdf'.\"\\r\\n\",\n            $file->toString()\n            );\n    }\n\n    public function testSizeIsSetInHeader() {\n        $file = $this->_createEmbeddedFile();\n        $id = $file->getId();\n        $file->setContentType('application/pdf');\n        $file->setSize(12340);\n        $this->assertEquals(\n            'Content-Type: application/pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$id.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; size=12340'.\"\\r\\n\",\n            $file->toString()\n            );\n    }\n\n    public function testMultipleParametersInHeader() {\n        $file = $this->_createEmbeddedFile();\n        $id = $file->getId();\n        $file->setContentType('application/pdf');\n        $file->setFilename('foo.pdf');\n        $file->setSize(12340);\n\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$id.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=foo.pdf; size=12340'.\"\\r\\n\",\n            $file->toString()\n            );\n    }\n\n    public function testEndToEnd() {\n        $file = $this->_createEmbeddedFile();\n        $id = $file->getId();\n        $file->setContentType('application/pdf');\n        $file->setFilename('foo.pdf');\n        $file->setSize(12340);\n        $file->setBody('abcd');\n        $this->assertEquals(\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$id.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=foo.pdf; size=12340'.\"\\r\\n\".\n            \"\\r\\n\".\n            base64_encode('abcd'),\n            $file->toString()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createEmbeddedFile() {\n        $entity = new Swift_Mime_EmbeddedFile(\n            $this->_headers,\n            $this->_contentEncoder,\n            $this->_cache,\n            $this->_grammar\n            );\n\n        return $entity;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_encoder;\n\n    public function setUp() {\n        $this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();\n    }\n\n    public function testEncodingJIS() {\n        if (function_exists('mb_convert_encoding')) {\n            // base64_encode and split cannot handle long JIS text to fold\n            $subject = '長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い件名';\n\n            $encodedWrapperLength = strlen('=?iso-2022-jp?'.$this->_encoder->getName().'??=');\n\n            $old = mb_internal_encoding();\n            mb_internal_encoding('utf-8');\n            $newstring = mb_encode_mimeheader($subject, 'iso-2022-jp', 'B', \"\\r\\n\");\n            mb_internal_encoding($old);\n\n            $encoded = $this->_encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp');\n            $this->assertEquals(\n                $encoded, $newstring,\n                'Encoded string should decode back to original string for sample '\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_MimePartAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    private $_contentEncoder;\n    private $_cache;\n    private $_grammar;\n    private $_headers;\n\n    public function setUp() {\n        $this->_cache = new Swift_KeyCache_ArrayKeyCache(\n            new Swift_KeyCache_SimpleKeyCacheInputStream()\n            );\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $this->_contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'),\n            new Swift_StreamFilters_ByteArrayReplacementFilter(\n                array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n                array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n                )\n            );\n\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n            );\n        $this->_grammar = new Swift_Mime_Grammar();\n        $this->_headers = new Swift_Mime_SimpleHeaderSet(\n            new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)\n            );\n    }\n\n    public function testCharsetIsSetInHeader() {\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('utf-8');\n        $part->setBody('foobar');\n        $this->assertEquals(\n            'Content-Type: text/plain; charset=utf-8'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foobar',\n            $part->toString()\n            );\n    }\n\n    public function testFormatIsSetInHeaders() {\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setFormat('flowed');\n        $part->setBody('> foobar');\n        $this->assertEquals(\n            'Content-Type: text/plain; format=flowed'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            '> foobar',\n            $part->toString()\n            );\n    }\n\n    public function testDelSpIsSetInHeaders() {\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setDelSp(true);\n        $part->setBody('foobar');\n        $this->assertEquals(\n            'Content-Type: text/plain; delsp=yes'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foobar',\n            $part->toString()\n            );\n    }\n\n    public function testAll3ParamsInHeaders() {\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('utf-8');\n        $part->setFormat('fixed');\n        $part->setDelSp(true);\n        $part->setBody('foobar');\n        $this->assertEquals(\n            'Content-Type: text/plain; charset=utf-8; format=fixed; delsp=yes'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foobar',\n            $part->toString()\n            );\n    }\n\n    public function testBodyIsCanonicalized() {\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('utf-8');\n        $part->setBody(\"foobar\\r\\rtest\\ning\\r\");\n        $this->assertEquals(\n            'Content-Type: text/plain; charset=utf-8'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            \"foobar\\r\\n\".\n            \"\\r\\n\".\n            \"test\\r\\n\".\n            \"ing\\r\\n\",\n            $part->toString()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createMimePart() {\n        $entity = new Swift_Mime_MimePart(\n            $this->_headers,\n            $this->_contentEncoder,\n            $this->_cache,\n            $this->_grammar\n            );\n\n        return $entity;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php",
    "content": "<?php\n\nclass Swift_Mime_SimpleMessageAcceptanceTest extends \\PHPUnit_Framework_TestCase{\n    public function setUp() {\n        Swift_Preferences::getInstance()->setCharset(null); //TODO: Test with the charset defined\n    }\n\n    public function testBasicHeaders() {\n        /* -- RFC 2822, 3.6.\n     */\n\n        $message = $this->_createMessage();\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString(),\n            '%s: Only required headers, and non-empty headers should be displayed'\n            );\n    }\n\n    public function testSubjectIsDisplayedIfSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testDateCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $id = $message->getId();\n        $message->setDate(1234);\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', 1234).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMessageIdCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setId('foo@bar');\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <foo@bar>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testContentTypeCanBeChanged() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setContentType('text/html');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/html'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testCharsetCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setContentType('text/html');\n        $message->setCharset('iso-8859-1');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testFormatCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFormat('flowed');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain; format=flowed'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testEncoderCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setContentType('text/html');\n        $message->setEncoder(\n            new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit')\n            );\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/html'.\"\\r\\n\".\n            'Content-Transfer-Encoding: 7bit'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testFromAddressCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom('chris.corbyn@swiftmailer.org');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: chris.corbyn@swiftmailer.org'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testFromAddressCanBeSetWithName() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris Corbyn'));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMultipleFromAddressesCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org',\n            ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>, mark@swiftmailer.org'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testReturnPathAddressCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testEmptyReturnPathHeaderCanBeUsed() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Return-Path: <>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testSenderCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setSender('chris.corbyn@swiftmailer.org');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Sender: chris.corbyn@swiftmailer.org'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testSenderCanBeSetWithName() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setSender(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Sender: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: '.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testReplyToCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array('chris@w3style.co.uk' => 'Myself'));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMultipleReplyAddressCanBeUsed() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testToAddressCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo('mark@swiftmailer.org');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMultipleToAddressesCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo(array(\n            'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testCcAddressCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo(array(\n            'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $message->setCc('john@some-site.com');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'.\"\\r\\n\".\n            'Cc: john@some-site.com'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMultipleCcAddressesCanBeSet() {\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo(array(\n            'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $message->setCc(array(\n            'john@some-site.com' => 'John West',\n            'fred@another-site.co.uk' => 'Big Fred',\n            ));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'.\"\\r\\n\".\n            'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testBccAddressCanBeSet() {\n        //Obviously Transports need to setBcc(array()) and send to each Bcc recipient\n        // separately in accordance with RFC 2822/2821\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo(array(\n            'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $message->setCc(array(\n            'john@some-site.com' => 'John West',\n            'fred@another-site.co.uk' => 'Big Fred',\n            ));\n        $message->setBcc('x@alphabet.tld');\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'.\"\\r\\n\".\n            'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'.\"\\r\\n\".\n            'Bcc: x@alphabet.tld'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testMultipleBccAddressesCanBeSet() {\n        //Obviously Transports need to setBcc(array()) and send to each Bcc recipient\n        // separately in accordance with RFC 2822/2821\n        $message = $this->_createMessage();\n        $message->setSubject('just a test subject');\n        $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));\n        $message->setReplyTo(array(\n            'chris@w3style.co.uk' => 'Myself',\n            'my.other@address.com' => 'Me',\n            ));\n        $message->setTo(array(\n            'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $message->setCc(array(\n            'john@some-site.com' => 'John West',\n            'fred@another-site.co.uk' => 'Big Fred',\n            ));\n        $message->setBcc(array('x@alphabet.tld', 'a@alphabet.tld' => 'A'));\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'.\"\\r\\n\".\n            'To: mark@swiftmailer.org, Chris Corbyn <chris@swiftmailer.org>'.\"\\r\\n\".\n            'Cc: John West <john@some-site.com>, Big Fred <fred@another-site.co.uk>'.\"\\r\\n\".\n            'Bcc: x@alphabet.tld, A <a@alphabet.tld>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testStringBodyIsAppended() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setBody(\n            'just a test body'.\"\\r\\n\".\n            'with a new line'\n            );\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'just a test body'.\"\\r\\n\".\n            'with a new line',\n            $message->toString()\n            );\n    }\n\n    public function testStringBodyIsEncoded() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setBody(\n            'Just s'.pack('C*', 0xC2, 0x01, 0x01).'me multi-'.\"\\r\\n\".\n            'line message!'\n            );\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'Just s=C2=01=01me multi-'.\"\\r\\n\".\n            'line message!',\n            $message->toString()\n            );\n    }\n\n    public function testChildrenCanBeAttached() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = $message->getDate();\n        $boundary = $message->getBoundary();\n\n        $part1 = $this->_createMimePart();\n        $part1->setContentType('text/plain');\n        $part1->setCharset('iso-8859-1');\n        $part1->setBody('foo');\n\n        $message->attach($part1);\n\n        $part2 = $this->_createMimePart();\n        $part2->setContentType('text/html');\n        $part2->setCharset('iso-8859-1');\n        $part2->setBody('test <b>foo</b>');\n\n        $message->attach($part2);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'test <b>foo</b>'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testAttachmentsBeingAttached() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('iso-8859-1');\n        $part->setBody('foo');\n\n        $message->attach($part);\n\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setBody('<pdf data>');\n\n        $message->attach($attachment);\n\n        $this->assertRegExp(\n            '~^'.\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/mixed;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"(.*?)\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--\\\\1--'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<pdf data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D',\n            $message->toString()\n            );\n    }\n\n    public function testAttachmentsAndEmbeddedFilesBeingAttached() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('iso-8859-1');\n        $part->setBody('foo');\n\n        $message->attach($part);\n\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setBody('<pdf data>');\n\n        $message->attach($attachment);\n\n        $file = $this->_createEmbeddedFile();\n        $file->setContentType('image/jpeg');\n        $file->setFilename('myimage.jpg');\n        $file->setBody('<image data>');\n\n        $message->attach($file);\n\n        $cid = $file->getId();\n\n        $this->assertRegExp(\n            '~^'.\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/mixed;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"(.*?)\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: multipart/related;'.\"\\r\\n\".\n            ' boundary=\"(.*?)\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\2'.\"\\r\\n\".\n            'Content-Type: image/jpeg; name=myimage.jpg'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$cid.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=myimage.jpg'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<image data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--\\\\2--'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\1--'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<pdf data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D',\n            $message->toString()\n            );\n    }\n\n    public function testComplexEmbeddingOfContent() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setBody('<pdf data>');\n\n        $message->attach($attachment);\n\n        $file = $this->_createEmbeddedFile();\n        $file->setContentType('image/jpeg');\n        $file->setFilename('myimage.jpg');\n        $file->setBody('<image data>');\n\n        $part = $this->_createMimePart();\n        $part->setContentType('text/html');\n        $part->setCharset('iso-8859-1');\n        $part->setBody('foo <img src=\"'.$message->embed($file).'\" />');\n\n        $message->attach($part);\n\n        $cid = $file->getId();\n\n        $this->assertRegExp(\n            '~^'.\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/mixed;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: multipart/related;'.\"\\r\\n\".\n            ' boundary=\"(.*?)\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo <img src=3D\"cid:'.$cid.'\" />'.//=3D is just = in QP\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: image/jpeg; name=myimage.jpg'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$cid.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=myimage.jpg'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<image data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--\\\\1--'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<pdf data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D',\n            $message->toString()\n            );\n    }\n\n    public function testAttachingAndDetachingContent() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $part = $this->_createMimePart();\n        $part->setContentType('text/plain');\n        $part->setCharset('iso-8859-1');\n        $part->setBody('foo');\n\n        $message->attach($part);\n\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setBody('<pdf data>');\n\n        $message->attach($attachment);\n\n        $file = $this->_createEmbeddedFile();\n        $file->setContentType('image/jpeg');\n        $file->setFilename('myimage.jpg');\n        $file->setBody('<image data>');\n\n        $message->attach($file);\n\n        $cid = $file->getId();\n\n        $message->detach($attachment);\n\n        $this->assertRegExp(\n            '~^'.\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: multipart/related;'.\"\\r\\n\".\n            ' boundary=\"(.*?)\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--\\\\1'.\"\\r\\n\".\n            'Content-Type: image/jpeg; name=myimage.jpg'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.$cid.'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=myimage.jpg'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<image data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--\\\\1--'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D',\n            $message->toString(),\n            '%s: Attachment should have been detached'\n            );\n    }\n\n    public function testBoundaryDoesNotAppearAfterAllPartsAreDetached() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = $message->getDate();\n        $boundary = $message->getBoundary();\n\n        $part1 = $this->_createMimePart();\n        $part1->setContentType('text/plain');\n        $part1->setCharset('iso-8859-1');\n        $part1->setBody('foo');\n\n        $message->attach($part1);\n\n        $part2 = $this->_createMimePart();\n        $part2->setContentType('text/html');\n        $part2->setCharset('iso-8859-1');\n        $part2->setBody('test <b>foo</b>');\n\n        $message->attach($part2);\n\n        $message->detach($part1);\n        $message->detach($part2);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\",\n            $message->toString(),\n            '%s: Message should be restored to orignal state after parts are detached'\n            );\n    }\n\n    public function testCharsetFormatOrDelSpAreNotShownWhenBoundaryIsSet() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setCharset('utf-8');\n        $message->setFormat('flowed');\n        $message->setDelSp(true);\n\n        $id = $message->getId();\n        $date = $message->getDate();\n        $boundary = $message->getBoundary();\n\n        $part1 = $this->_createMimePart();\n        $part1->setContentType('text/plain');\n        $part1->setCharset('iso-8859-1');\n        $part1->setBody('foo');\n\n        $message->attach($part1);\n\n        $part2 = $this->_createMimePart();\n        $part2->setContentType('text/html');\n        $part2->setCharset('iso-8859-1');\n        $part2->setBody('test <b>foo</b>');\n\n        $message->attach($part2);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'test <b>foo</b>'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testBodyCanBeSetWithAttachments() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setContentType('text/html');\n        $message->setCharset('iso-8859-1');\n        $message->setBody('foo');\n\n        $id = $message->getId();\n        $date = date('r', $message->getDate());\n        $boundary = $message->getBoundary();\n\n        $attachment = $this->_createAttachment();\n        $attachment->setContentType('application/pdf');\n        $attachment->setFilename('foo.pdf');\n        $attachment->setBody('<pdf data>');\n\n        $message->attach($attachment);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/mixed;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=iso-8859-1'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: application/pdf; name=foo.pdf'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename=foo.pdf'.\"\\r\\n\".\n            \"\\r\\n\".\n            base64_encode('<pdf data>').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testHtmlPartAlwaysAppearsLast() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n\n        $id = $message->getId();\n        $date = date('r', $message->getDate());\n        $boundary = $message->getBoundary();\n\n        $part1 = $this->_createMimePart();\n        $part1->setContentType('text/html');\n        $part1->setBody('foo');\n\n        $part2 = $this->_createMimePart();\n        $part2->setContentType('text/plain');\n        $part2->setBody('bar');\n\n        $message->attach($part1);\n        $message->attach($part2);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'bar'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testBodyBecomesPartIfOtherPartsAttached() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setContentType('text/html');\n        $message->setBody('foo');\n\n        $id = $message->getId();\n        $date = date('r', $message->getDate());\n        $boundary = $message->getBoundary();\n\n        $part2 = $this->_createMimePart();\n        $part2->setContentType('text/plain');\n        $part2->setBody('bar');\n\n        $message->attach($part2);\n\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/alternative;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'bar'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'foo'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\",\n            $message->toString()\n            );\n    }\n\n    public function testBodyIsCanonicalized() {\n        $message = $this->_createMessage();\n        $message->setReturnPath('chris@w3style.co.uk');\n        $message->setSubject('just a test subject');\n        $message->setFrom(array(\n            'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));\n        $message->setBody(\n            'just a test body'.\"\\n\".\n            'with a new line'\n            );\n        $id = $message->getId();\n        $date = $message->getDate();\n        $this->assertEquals(\n            'Return-Path: <chris@w3style.co.uk>'.\"\\r\\n\".\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.date('r', $date).\"\\r\\n\".\n            'Subject: just a test subject'.\"\\r\\n\".\n            'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: text/plain'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'just a test body'.\"\\r\\n\".\n            'with a new line',\n            $message->toString()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createMessage() {\n        return new Swift_Message();\n    }\n\n    protected function _createMimePart() {\n        return new Swift_MimePart();\n    }\n\n    protected function _createAttachment() {\n        return new Swift_Attachment();\n    }\n\n    protected function _createEmbeddedFile() {\n        return new Swift_EmbeddedFile();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php",
    "content": "<?php\n\nrequire_once 'swift_required.php';\nrequire_once __DIR__.'/Mime/MimePartAcceptanceTest.php';\n\nclass Swift_MimePartAcceptanceTest extends Swift_Mime_MimePartAcceptanceTest{\n    protected function _createMimePart() {\n        Swift_DependencyContainer::getInstance()\n            ->register('properties.charset')->asValue(null);\n\n        return Swift_MimePart::newInstance();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php",
    "content": "<?php\n\nabstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest\n    extends \\PHPUnit_Framework_TestCase{\n    protected $_buffer;\n\n    abstract protected function _initializeBuffer();\n\n    public function setUp() {\n        if (true == getenv('TRAVIS')) {\n            $this->markTestSkipped(\n                'Will fail on travis-ci if not skipped due to travis blocking '.\n                'socket mailing tcp connections.'\n             );\n        }\n\n        $this->_buffer = new Swift_Transport_StreamBuffer(\n            $this->getMock('Swift_ReplacementFilterFactory')\n        );\n    }\n\n    public function testReadLine() {\n        $this->_initializeBuffer();\n\n        $line = $this->_buffer->readLine(0);\n        $this->assertRegExp('/^[0-9]{3}.*?\\r\\n$/D', $line);\n        $seq = $this->_buffer->write(\"QUIT\\r\\n\");\n        $this->assertTrue((bool) $seq);\n        $line = $this->_buffer->readLine($seq);\n        $this->assertRegExp('/^[0-9]{3}.*?\\r\\n$/D', $line);\n        $this->_buffer->terminate();\n    }\n\n    public function testWrite() {\n        $this->_initializeBuffer();\n\n        $line = $this->_buffer->readLine(0);\n        $this->assertRegExp('/^[0-9]{3}.*?\\r\\n$/D', $line);\n\n        $seq = $this->_buffer->write(\"HELO foo\\r\\n\");\n        $this->assertTrue((bool) $seq);\n        $line = $this->_buffer->readLine($seq);\n        $this->assertRegExp('/^[0-9]{3}.*?\\r\\n$/D', $line);\n\n        $seq = $this->_buffer->write(\"QUIT\\r\\n\");\n        $this->assertTrue((bool) $seq);\n        $line = $this->_buffer->readLine($seq);\n        $this->assertRegExp('/^[0-9]{3}.*?\\r\\n$/D', $line);\n        $this->_buffer->terminate();\n    }\n\n    public function testBindingOtherStreamsMirrorsWriteOperations() {\n        $this->_initializeBuffer();\n\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is2->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n\n        $this->_buffer->bind($is1);\n        $this->_buffer->bind($is2);\n\n        $this->_buffer->write('x');\n        $this->_buffer->write('y');\n    }\n\n    public function testBindingOtherStreamsMirrorsFlushOperations() {\n        $this->_initializeBuffer();\n\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->once())\n            ->method('flushBuffers');\n        $is2->expects($this->once())\n            ->method('flushBuffers');\n\n        $this->_buffer->bind($is1);\n        $this->_buffer->bind($is2);\n\n        $this->_buffer->flushBuffers();\n    }\n\n    public function testUnbindingStreamPreventsFurtherWrites() {\n        $this->_initializeBuffer();\n\n        $is1 = $this->_createMockInputStream();\n        $is2 = $this->_createMockInputStream();\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->once())\n            ->method('write')\n            ->with('x');\n\n        $this->_buffer->bind($is1);\n        $this->_buffer->bind($is2);\n\n        $this->_buffer->write('x');\n\n        $this->_buffer->unbind($is2);\n\n        $this->_buffer->write('y');\n    }\n\n    // -- Creation Methods\n\n    private function _createMockInputStream() {\n        return $this->getMock('Swift_InputByteStream');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php",
    "content": "<?php\n\nrequire_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';\n\nclass Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest\n    extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest{\n    public function setUp() {\n        if (!defined('SWIFT_SMTP_HOST')) {\n            $this->markTestSkipped(\n                'Cannot run test without an SMTP host to connect to (define '.\n                'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)'\n             );\n        }\n        parent::setUp();\n    }\n\n    protected function _initializeBuffer() {\n        $parts = explode(':', SWIFT_SMTP_HOST);\n        $host = $parts[0];\n        $port = isset($parts[1]) ? $parts[1] : 25;\n\n        $this->_buffer->initialize(array(\n            'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,\n            'host' => $host,\n            'port' => $port,\n            'protocol' => 'tcp',\n            'blocking' => 1,\n            'timeout' => 15,\n        ));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php",
    "content": "<?php\n\nrequire_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';\n\nclass Swift_Transport_StreamBuffer_ProcessAcceptanceTest\n    extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest{\n    public function setUp() {\n        if (!defined('SWIFT_SENDMAIL_PATH')) {\n            $this->markTestSkipped(\n                'Cannot run test without a path to sendmail (define '.\n                'SWIFT_SENDMAIL_PATH in tests/acceptance.conf.php if you wish to run this test)'\n             );\n        }\n\n        parent::setUp();\n    }\n\n    protected function _initializeBuffer() {\n        $this->_buffer->initialize(array(\n            'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,\n            'command' => SWIFT_SENDMAIL_PATH.' -bs',\n        ));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php",
    "content": "<?php\n\nclass Swift_Transport_StreamBuffer_SocketTimeoutTest extends \\PHPUnit_Framework_TestCase{\n    protected $_buffer;\n\n    protected $_randomHighPort;\n\n    protected $_server;\n\n    public function setUp() {\n        if (!defined('SWIFT_SMTP_HOST')) {\n            $this->markTestSkipped(\n                'Cannot run test without an SMTP host to connect to (define '.\n                'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)'\n             );\n        }\n\n        $serverStarted = false;\n        for ($i = 0; $i < 5; ++$i) {\n            $this->_randomHighPort = rand(50000, 65000);\n            $this->_server = stream_socket_server('tcp://127.0.0.1:'.$this->_randomHighPort);\n            if ($this->_server) {\n                $serverStarted = true;\n            }\n        }\n\n        $this->_buffer = new Swift_Transport_StreamBuffer(\n            $this->getMock('Swift_ReplacementFilterFactory')\n        );\n    }\n\n    protected function _initializeBuffer() {\n        $host = '127.0.0.1';\n        $port = $this->_randomHighPort;\n\n        $this->_buffer->initialize(array(\n            'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,\n            'host' => $host,\n            'port' => $port,\n            'protocol' => 'tcp',\n            'blocking' => 1,\n            'timeout' => 1,\n        ));\n    }\n\n    public function testTimeoutException() {\n        $this->_initializeBuffer();\n        $e = null;\n        try {\n            $line = $this->_buffer->readLine(0);\n        } catch (Exception $e) {\n        }\n        $this->assertInstanceof('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout');\n        $this->assertRegExp('/Connection to .* Timed Out/', $e->getMessage());\n    }\n\n    public function tearDown() {\n        if ($this->_server) {\n            stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php",
    "content": "<?php\n\nrequire_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';\n\nclass Swift_Transport_StreamBuffer_SslSocketAcceptanceTest\n    extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest{\n    public function setUp() {\n        $streams = stream_get_transports();\n        if (!in_array('ssl', $streams)) {\n            $this->markTestSkipped(\n                'SSL is not configured for your system.  It is not possible to run this test'\n             );\n        }\n        if (!defined('SWIFT_SSL_HOST')) {\n            $this->markTestSkipped(\n                'Cannot run test without an SSL enabled SMTP host to connect to (define '.\n                'SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)'\n             );\n        }\n\n        parent::setUp();\n    }\n\n    protected function _initializeBuffer() {\n        $parts = explode(':', SWIFT_SSL_HOST);\n        $host = $parts[0];\n        $port = isset($parts[1]) ? $parts[1] : 25;\n\n        $this->_buffer->initialize(array(\n            'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,\n            'host' => $host,\n            'port' => $port,\n            'protocol' => 'ssl',\n            'blocking' => 1,\n            'timeout' => 15,\n        ));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php",
    "content": "<?php\n\nrequire_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';\n\nclass Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest\n    extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest{\n    public function setUp() {\n        $streams = stream_get_transports();\n        if (!in_array('tls', $streams)) {\n            $this->markTestSkipped(\n                'TLS is not configured for your system.  It is not possible to run this test'\n             );\n        }\n        if (!defined('SWIFT_TLS_HOST')) {\n            $this->markTestSkipped(\n                'Cannot run test without a TLS enabled SMTP host to connect to (define '.\n                'SWIFT_TLS_HOST in tests/acceptance.conf.php if you wish to run this test)'\n             );\n        }\n        parent::setUp();\n    }\n\n    protected function _initializeBuffer() {\n        $parts = explode(':', SWIFT_TLS_HOST);\n        $host = $parts[0];\n        $port = isset($parts[1]) ? $parts[1] : 25;\n\n        $this->_buffer->initialize(array(\n            'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,\n            'host' => $host,\n            'port' => $port,\n            'protocol' => 'tls',\n            'blocking' => 1,\n            'timeout' => 15,\n            ));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/acceptance.conf.php.default",
    "content": "<?php\n\n/*\n Swift Mailer V4 accpetance test configuration.\n\n YOU ONLY NEED TO EDIT THIS FILE IF YOU WISH TO RUN THE ACCEPTANCE TESTS.\n\n The acceptance tests are run by default when \"All Tests\" are run with the\n testing suite, however, without configuration options here only the unit tests\n will be run and the acceptance tests will be skipped.\n \n You can fill out only the parts you know and leave the other bits.\n */\n\n\n/*\n Defines: The path to a writable directory (a temporary dir).\n Recommended: /tmp\n */\ndefine('SWIFT_TMP_DIR', '/tmp');\n\n/*\n Defines: The name and port of a SMTP server you can connect to.\n Recommended: smtp.gmail.com:25\n */\ndefine('SWIFT_SMTP_HOST', 'localhost:4456');\n\n/*\n Defines: An SMTP server and port which uses TLS encryption.\n Recommended: smtp.gmail.com:465\n */\ndefine('SWIFT_TLS_HOST', 'smtp.gmail.com:465');\n\n/*\n Defines: An SMTP server and port which uses SSL encryption.\n Recommended: smtp.gmail.com:465\n */\ndefine('SWIFT_SSL_HOST', 'smtp.gmail.com:465');\n\n/*\n Defines: The path to a sendmail binary (one which can run in -bs mode).\n Recommended: /usr/sbin/sendmail\n */\ndefine('SWIFT_SENDMAIL_PATH', '/usr/sbin/sendmail -bs');\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bootstrap.php",
    "content": "<?php\n\nrequire_once dirname(__DIR__).'/vendor/autoload.php';\n\n// Disable garbage collector to prevent segfaults\ngc_disable();\n\nset_include_path(get_include_path().PATH_SEPARATOR.dirname(__DIR__).'/lib');\n\nMockery::getConfiguration()->allowMockingNonExistentMethods(false);\n\nif (is_file(__DIR__.'/acceptance.conf.php')) {\n    require_once __DIR__.'/acceptance.conf.php';\n}\nif (is_file(__DIR__.'/smoke.conf.php')) {\n    require_once __DIR__.'/smoke.conf.php';\n}\nrequire_once __DIR__.'/StreamCollector.php';\nrequire_once __DIR__.'/IdenticalBinaryConstraint.php';\nrequire_once __DIR__.'/SwiftMailerTestCase.php';\nrequire_once __DIR__.'/SwiftMailerSmokeTestCase.php';\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug111Test.php",
    "content": "<?php\n\nclass Swift_Bug111Test extends \\PHPUnit_Framework_TestCase{\n    public function testUnstructuredHeaderSlashesShouldNotBeEscaped() {\n        $complicated_header = array(\n            'to' => array(\n                'email1@example.com',\n                'email2@example.com',\n                'email3@example.com',\n                'email4@example.com',\n                'email5@example.com',\n            ),\n            'sub' => array(\n                '-name-' => array(\n                    'email1',\n                    '\"email2\"',\n                    'email3\\\\',\n                    'email4',\n                    'email5',\n                ),\n                '-url-' => array(\n                    'http://google.com',\n                    'http://yahoo.com',\n                    'http://hotmail.com',\n                    'http://aol.com',\n                    'http://facebook.com',\n                ),\n            ),\n        );\n        $json = json_encode($complicated_header);\n\n        $message = new Swift_Message();\n        $headers = $message->getHeaders();\n        $headers->addTextHeader('X-SMTPAPI', $json);\n        $header = $headers->get('X-SMTPAPI');\n\n        $this->assertEquals('Swift_Mime_Headers_UnstructuredHeader', get_class($header));\n        $this->assertEquals($json, $header->getFieldBody());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug118Test.php",
    "content": "<?php\n\nclass Swift_Bug118Test extends \\PHPUnit_Framework_TestCase{\n    private $_message;\n\n    public function setUp() {\n        $this->_message = new Swift_Message();\n    }\n\n    public function testCallingGenerateIdChangesTheMessageId() {\n        $currentId = $this->_message->getId();\n        $this->_message->generateId();\n        $newId = $this->_message->getId();\n\n        $this->assertNotEquals($currentId, $newId);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug206Test.php",
    "content": "<?php\n\nclass Swift_Bug206Test extends \\PHPUnit_Framework_TestCase{\n    private $_factory;\n\n    public function setUp() {\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n        );\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(\n            new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')\n        );\n        $grammar = new Swift_Mime_Grammar();\n        $this->_factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar);\n    }\n\n    public function testMailboxHeaderEncoding() {\n        $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Name, Name', ' \"Family Name, Name\" <email@example.org>');\n        $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé, Name', ' Family =?utf-8?Q?Nam=C3=A9=2C?= Name');\n        $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé , Name', ' Family =?utf-8?Q?Nam=C3=A9_=2C?= Name');\n        $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé ;Name', ' Family =?utf-8?Q?Nam=C3=A9_=3BName?= ');\n    }\n\n    private function _testHeaderIsFullyEncoded($email, $name, $expected) {\n        $mailboxHeader = $this->_factory->createMailboxHeader('To', array(\n            $email => $name,\n        ));\n\n        $headerBody = substr($mailboxHeader->toString(), 3, strlen($expected));\n\n        $this->assertEquals($expected, $headerBody);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug274Test.php",
    "content": "<?php\n\nclass Swift_Bug274Test extends \\PHPUnit_Framework_TestCase{\n    public function testEmptyFileNameAsAttachment() {\n        $message = new Swift_Message();\n        $this->setExpectedException('Swift_IoException', 'The path cannot be empty');\n        $message->attach(Swift_Attachment::fromPath(''));\n    }\n\n    public function testNonEmptyFileNameAsAttachment() {\n        $message = new Swift_Message();\n        try {\n            $message->attach(Swift_Attachment::fromPath(__FILE__));\n        } catch (Exception $e) {\n            $this->fail('Path should not be empty');\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug34Test.php",
    "content": "<?php\n\nclass Swift_Bug34Test extends \\PHPUnit_Framework_TestCase{\n    public function setUp() {\n        Swift_Preferences::getInstance()->setCharset('utf-8');\n    }\n\n    public function testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentAsAnAlternative() {\n        $message = Swift_Message::newInstance();\n        $message->setCharset('utf-8');\n        $message->setSubject('test subject');\n        $message->addPart('plain part', 'text/plain');\n\n        $image = Swift_Image::newInstance('<image data>', 'image.gif', 'image/gif');\n        $cid = $message->embed($image);\n\n        $message->setBody('<img src=\"'.$cid.'\" />', 'text/html');\n\n        $message->setTo(array('user@domain.tld' => 'User'));\n\n        $message->setFrom(array('other@domain.tld' => 'Other'));\n        $message->setSender(array('other@domain.tld' => 'Other'));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n        $cidVal = $image->getId();\n\n        $this->assertRegExp(\n        '~^'.\n        'Sender: Other <other@domain.tld>'.\"\\r\\n\".\n        'Message-ID: <'.$id.'>'.\"\\r\\n\".\n        'Date: '.$date.\"\\r\\n\".\n        'Subject: test subject'.\"\\r\\n\".\n        'From: Other <other@domain.tld>'.\"\\r\\n\".\n        'To: User <user@domain.tld>'.\"\\r\\n\".\n        'MIME-Version: 1.0'.\"\\r\\n\".\n        'Content-Type: multipart/alternative;'.\"\\r\\n\".\n        ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: text/plain; charset=utf-8'.\"\\r\\n\".\n        'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n        \"\\r\\n\".\n        'plain part'.\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: multipart/related;'.\"\\r\\n\".\n        ' boundary=\"(.*?)\"'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--\\\\1'.\"\\r\\n\".\n        'Content-Type: text/html; charset=utf-8'.\"\\r\\n\".\n        'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n        \"\\r\\n\".\n        '<img.*?/>'.\n        \"\\r\\n\\r\\n\".\n        '--\\\\1'.\"\\r\\n\".\n        'Content-Type: image/gif; name=image.gif'.\"\\r\\n\".\n        'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n        'Content-ID: <'.$cidVal.'>'.\"\\r\\n\".\n        'Content-Disposition: inline; filename=image.gif'.\"\\r\\n\".\n        \"\\r\\n\".\n        preg_quote(base64_encode('<image data>'), '~').\n        \"\\r\\n\\r\\n\".\n        '--\\\\1--'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.'--'.\"\\r\\n\".\n        '$~D',\n        $message->toString()\n        );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug35Test.php",
    "content": "<?php\n\nclass Swift_Bug35Test extends \\PHPUnit_Framework_TestCase{\n    public function setUp() {\n        Swift_Preferences::getInstance()->setCharset('utf-8');\n    }\n\n    public function testHTMLPartAppearsLastEvenWhenAttachmentsAdded() {\n        $message = Swift_Message::newInstance();\n        $message->setCharset('utf-8');\n        $message->setSubject('test subject');\n        $message->addPart('plain part', 'text/plain');\n\n        $attachment = Swift_Attachment::newInstance('<data>', 'image.gif', 'image/gif');\n        $message->attach($attachment);\n\n        $message->setBody('HTML part', 'text/html');\n\n        $message->setTo(array('user@domain.tld' => 'User'));\n\n        $message->setFrom(array('other@domain.tld' => 'Other'));\n        $message->setSender(array('other@domain.tld' => 'Other'));\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $this->assertRegExp(\n        '~^'.\n        'Sender: Other <other@domain.tld>'.\"\\r\\n\".\n        'Message-ID: <'.$id.'>'.\"\\r\\n\".\n        'Date: '.$date.\"\\r\\n\".\n        'Subject: test subject'.\"\\r\\n\".\n        'From: Other <other@domain.tld>'.\"\\r\\n\".\n        'To: User <user@domain.tld>'.\"\\r\\n\".\n        'MIME-Version: 1.0'.\"\\r\\n\".\n        'Content-Type: multipart/mixed;'.\"\\r\\n\".\n        ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: multipart/alternative;'.\"\\r\\n\".\n        ' boundary=\"(.*?)\"'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--\\\\1'.\"\\r\\n\".\n        'Content-Type: text/plain; charset=utf-8'.\"\\r\\n\".\n        'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n        \"\\r\\n\".\n        'plain part'.\n        \"\\r\\n\\r\\n\".\n        '--\\\\1'.\"\\r\\n\".\n        'Content-Type: text/html; charset=utf-8'.\"\\r\\n\".\n        'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n        \"\\r\\n\".\n        'HTML part'.\n        \"\\r\\n\\r\\n\".\n        '--\\\\1--'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: image/gif; name=image.gif'.\"\\r\\n\".\n        'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n        'Content-Disposition: attachment; filename=image.gif'.\"\\r\\n\".\n        \"\\r\\n\".\n        preg_quote(base64_encode('<data>'), '~').\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.'--'.\"\\r\\n\".\n        '$~D',\n        $message->toString()\n        );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug38Test.php",
    "content": "<?php\n\nclass Swift_Bug38Test extends \\PHPUnit_Framework_TestCase{\n    private $_attFile;\n    private $_attFileName;\n    private $_attFileType;\n\n    public function setUp() {\n        $this->_attFileName = 'data.txt';\n        $this->_attFileType = 'text/plain';\n        $this->_attFile = __DIR__.'/../../_samples/files/data.txt';\n        Swift_Preferences::getInstance()->setCharset('utf-8');\n    }\n\n    public function testWritingMessageToByteStreamProducesCorrectStructure() {\n        $message = new Swift_Message();\n        $message->setSubject('test subject');\n        $message->setTo('user@domain.tld');\n        $message->setCc('other@domain.tld');\n        $message->setFrom('user@domain.tld');\n\n        $image = new Swift_Image('<data>', 'image.gif', 'image/gif');\n\n        $cid = $message->embed($image);\n        $message->setBody('HTML part', 'text/html');\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n        $imgId = $image->getId();\n\n        $stream = new Swift_ByteStream_ArrayByteStream();\n\n        $message->toByteStream($stream);\n\n        $this->assertPatternInStream(\n            '~^'.\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: test subject'.\"\\r\\n\".\n            'From: user@domain.tld'.\"\\r\\n\".\n            'To: user@domain.tld'.\"\\r\\n\".\n            'Cc: other@domain.tld'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/related;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=utf-8'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'HTML part'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: image/gif; name=image.gif'.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-ID: <'.preg_quote($imgId, '~').'>'.\"\\r\\n\".\n            'Content-Disposition: inline; filename=image.gif'.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode('<data>'), '~').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D',\n            $stream\n        );\n    }\n\n    public function testWritingMessageToByteStreamTwiceProducesCorrectStructure() {\n        $message = new Swift_Message();\n        $message->setSubject('test subject');\n        $message->setTo('user@domain.tld');\n        $message->setCc('other@domain.tld');\n        $message->setFrom('user@domain.tld');\n\n        $image = new Swift_Image('<data>', 'image.gif', 'image/gif');\n\n        $cid = $message->embed($image);\n        $message->setBody('HTML part', 'text/html');\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n        $imgId = $image->getId();\n\n        $pattern = '~^'.\n        'Message-ID: <'.$id.'>'.\"\\r\\n\".\n        'Date: '.$date.\"\\r\\n\".\n        'Subject: test subject'.\"\\r\\n\".\n        'From: user@domain.tld'.\"\\r\\n\".\n        'To: user@domain.tld'.\"\\r\\n\".\n        'Cc: other@domain.tld'.\"\\r\\n\".\n        'MIME-Version: 1.0'.\"\\r\\n\".\n        'Content-Type: multipart/related;'.\"\\r\\n\".\n        ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: text/html; charset=utf-8'.\"\\r\\n\".\n        'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n        \"\\r\\n\".\n        'HTML part'.\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.\"\\r\\n\".\n        'Content-Type: image/gif; name=image.gif'.\"\\r\\n\".\n        'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n        'Content-ID: <'.preg_quote($imgId, '~').'>'.\"\\r\\n\".\n        'Content-Disposition: inline; filename=image.gif'.\"\\r\\n\".\n        \"\\r\\n\".\n        preg_quote(base64_encode('<data>'), '~').\n        \"\\r\\n\\r\\n\".\n        '--'.$boundary.'--'.\"\\r\\n\".\n        '$~D'\n        ;\n\n        $streamA = new Swift_ByteStream_ArrayByteStream();\n        $streamB = new Swift_ByteStream_ArrayByteStream();\n\n        $message->toByteStream($streamA);\n        $message->toByteStream($streamB);\n\n        $this->assertPatternInStream($pattern, $streamA);\n        $this->assertPatternInStream($pattern, $streamB);\n    }\n\n    public function testWritingMessageToByteStreamTwiceUsingAFileAttachment() {\n        $message = new Swift_Message();\n        $message->setSubject('test subject');\n        $message->setTo('user@domain.tld');\n        $message->setCc('other@domain.tld');\n        $message->setFrom('user@domain.tld');\n\n        $attachment = Swift_Attachment::fromPath($this->_attFile);\n\n        $message->attach($attachment);\n\n        $message->setBody('HTML part', 'text/html');\n\n        $id = $message->getId();\n        $date = preg_quote(date('r', $message->getDate()), '~');\n        $boundary = $message->getBoundary();\n\n        $streamA = new Swift_ByteStream_ArrayByteStream();\n        $streamB = new Swift_ByteStream_ArrayByteStream();\n\n        $pattern = '~^'.\n            'Message-ID: <'.$id.'>'.\"\\r\\n\".\n            'Date: '.$date.\"\\r\\n\".\n            'Subject: test subject'.\"\\r\\n\".\n            'From: user@domain.tld'.\"\\r\\n\".\n            'To: user@domain.tld'.\"\\r\\n\".\n            'Cc: other@domain.tld'.\"\\r\\n\".\n            'MIME-Version: 1.0'.\"\\r\\n\".\n            'Content-Type: multipart/mixed;'.\"\\r\\n\".\n            ' boundary=\"'.$boundary.'\"'.\"\\r\\n\".\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: text/html; charset=utf-8'.\"\\r\\n\".\n            'Content-Transfer-Encoding: quoted-printable'.\"\\r\\n\".\n            \"\\r\\n\".\n            'HTML part'.\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.\"\\r\\n\".\n            'Content-Type: '.$this->_attFileType.'; name='.$this->_attFileName.\"\\r\\n\".\n            'Content-Transfer-Encoding: base64'.\"\\r\\n\".\n            'Content-Disposition: attachment; filename='.$this->_attFileName.\"\\r\\n\".\n            \"\\r\\n\".\n            preg_quote(base64_encode(file_get_contents($this->_attFile)), '~').\n            \"\\r\\n\\r\\n\".\n            '--'.$boundary.'--'.\"\\r\\n\".\n            '$~D'\n            ;\n\n        $message->toByteStream($streamA);\n        $message->toByteStream($streamB);\n\n        $this->assertPatternInStream($pattern, $streamA);\n        $this->assertPatternInStream($pattern, $streamB);\n    }\n\n    // -- Helpers\n\n    public function assertPatternInStream($pattern, $stream, $message = '%s') {\n        $string = '';\n        while (false !== $bytes = $stream->read(8192)) {\n            $string .= $bytes;\n        }\n        $this->assertRegExp($pattern, $string, $message);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug518Test.php",
    "content": "<?php\n\nuse Mockery as m;\n\nclass Swift_Bug518Test extends \\PHPUnit_Framework_TestCase{\n    public function testIfEmailChangesAfterQueued() {\n        $failedRecipients = 'value';\n        $message = new Swift_Message();\n        $message->setTo('foo@bar.com');\n\n        $that = $this;\n        $messageValidation = function ($m) use ($that) {\n            //the getTo should return the same value as we put in\n            $that->assertEquals('foo@bar.com', key($m->getTo()), 'The message has changed after it was put to the memory queue');\n\n            return true;\n        };\n\n        $transport = m::mock('Swift_Transport');\n        $transport->shouldReceive('isStarted')->andReturn(true);\n        $transport->shouldReceive('send')\n            ->with(m::on($messageValidation), $failedRecipients)\n            ->andReturn(1);\n\n        $memorySpool = new Swift_MemorySpool();\n        $memorySpool->queueMessage($message);\n\n        /*\n         * The message is queued in memory.\n         * Lets change the message\n         */\n        $message->setTo('other@value.com');\n\n        $memorySpool->flushQueue($transport, $failedRecipients);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug51Test.php",
    "content": "<?php\n\nclass Swift_Bug51Test extends \\SwiftMailerTestCase{\n    private $_attachmentFile;\n    private $_outputFile;\n\n    public function setUp() {\n        if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) {\n            $this->markTestSkipped(\n                'Cannot run test without a writable directory to use ('.\n                'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'\n             );\n        }\n\n        $this->_attachmentFile = SWIFT_TMP_DIR.'/attach.rand.bin';\n        file_put_contents($this->_attachmentFile, '');\n\n        $this->_outputFile = SWIFT_TMP_DIR.'/attach.out.bin';\n        file_put_contents($this->_outputFile, '');\n    }\n\n    public function tearDown() {\n        unlink($this->_attachmentFile);\n        unlink($this->_outputFile);\n    }\n\n    public function testAttachmentsDoNotGetTruncatedUsingToByteStream() {\n        //Run 100 times with 10KB attachments\n        for ($i = 0; $i < 10; ++$i) {\n            $message = $this->_createMessageWithRandomAttachment(\n                10000, $this->_attachmentFile\n            );\n\n            file_put_contents($this->_outputFile, '');\n            $message->toByteStream(\n                new Swift_ByteStream_FileByteStream($this->_outputFile, true)\n            );\n\n            $emailSource = file_get_contents($this->_outputFile);\n\n            $this->assertAttachmentFromSourceMatches(\n                file_get_contents($this->_attachmentFile),\n                $emailSource\n            );\n        }\n    }\n\n    public function testAttachmentsDoNotGetTruncatedUsingToString() {\n        //Run 100 times with 10KB attachments\n        for ($i = 0; $i < 10; ++$i) {\n            $message = $this->_createMessageWithRandomAttachment(\n                10000, $this->_attachmentFile\n            );\n\n            $emailSource = $message->toString();\n\n            $this->assertAttachmentFromSourceMatches(\n                file_get_contents($this->_attachmentFile),\n                $emailSource\n            );\n        }\n    }\n\n    // -- Custom Assertions\n\n    public function assertAttachmentFromSourceMatches($attachmentData, $source) {\n        $encHeader = 'Content-Transfer-Encoding: base64';\n        $base64declaration = strpos($source, $encHeader);\n\n        $attachmentDataStart = strpos($source, \"\\r\\n\\r\\n\", $base64declaration);\n        $attachmentDataEnd = strpos($source, \"\\r\\n--\", $attachmentDataStart);\n\n        if (false === $attachmentDataEnd) {\n            $attachmentBase64 = trim(substr($source, $attachmentDataStart));\n        } else {\n            $attachmentBase64 = trim(substr(\n                $source, $attachmentDataStart,\n                $attachmentDataEnd - $attachmentDataStart\n            ));\n        }\n\n        $this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64));\n    }\n\n    // -- Creation Methods\n\n    private function _fillFileWithRandomBytes($byteCount, $file) {\n        // I was going to use dd with if=/dev/random but this way seems more\n        // cross platform even if a hella expensive!!\n\n        file_put_contents($file, '');\n        $fp = fopen($file, 'wb');\n        for ($i = 0; $i < $byteCount; ++$i) {\n            $byteVal = rand(0, 255);\n            fwrite($fp, pack('i', $byteVal));\n        }\n        fclose($fp);\n    }\n\n    private function _createMessageWithRandomAttachment($size, $attachmentPath) {\n        $this->_fillFileWithRandomBytes($size, $attachmentPath);\n\n        $message = Swift_Message::newInstance()\n            ->setSubject('test')\n            ->setBody('test')\n            ->setFrom('a@b.c')\n            ->setTo('d@e.f')\n            ->attach(Swift_Attachment::fromPath($attachmentPath))\n            ;\n\n        return $message;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug534Test.php",
    "content": "<?php\n\nuse Mockery as m;\n\nclass Swift_Bug534Test extends \\PHPUnit_Framework_TestCase{\n    public function testEmbeddedImagesAreEmbedded() {\n        $message = Swift_Message::newInstance()\n            ->setFrom('from@example.com')\n            ->setTo('to@example.com')\n            ->setSubject('test')\n        ;\n        $cid = $message->embed(Swift_Image::fromPath(__DIR__.'/../../_samples/files/swiftmailer.png'));\n        $message->setBody('<img src=\"'.$cid.'\" />', 'text/html');\n\n        $that = $this;\n        $messageValidation = function (Swift_Mime_Message $message) use ($that) {\n            preg_match('/cid:(.*)\"/', $message->toString(), $matches);\n            $cid = $matches[1];\n            preg_match('/Content-ID: <(.*)>/', $message->toString(), $matches);\n            $contentId = $matches[1];\n            $that->assertEquals($cid, $contentId, 'cid in body and mime part Content-ID differ');\n\n            return true;\n        };\n\n        $failedRecipients = array();\n\n        $transport = m::mock('Swift_Transport');\n        $transport->shouldReceive('isStarted')->andReturn(true);\n        $transport->shouldReceive('send')->with(m::on($messageValidation), $failedRecipients)->andReturn(1);\n\n        $memorySpool = new Swift_MemorySpool();\n        $memorySpool->queueMessage($message);\n        $memorySpool->flushQueue($transport, $failedRecipients);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug71Test.php",
    "content": "<?php\n\nclass Swift_Bug71Test extends \\PHPUnit_Framework_TestCase{\n    private $_message;\n\n    public function setUp() {\n        $this->_message = new Swift_Message('test');\n    }\n\n    public function testCallingToStringAfterSettingNewBodyReflectsChanges() {\n        $this->_message->setBody('BODY1');\n        $this->assertRegExp('/BODY1/', $this->_message->toString());\n\n        $this->_message->setBody('BODY2');\n        $this->assertRegExp('/BODY2/', $this->_message->toString());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/Bug76Test.php",
    "content": "<?php\n\nclass Swift_Bug76Test extends \\PHPUnit_Framework_TestCase{\n    private $_inputFile;\n    private $_outputFile;\n    private $_encoder;\n\n    public function setUp() {\n        if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) {\n            $this->markTestSkipped(\n                'Cannot run test without a writable directory to use ('.\n                'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'\n             );\n        }\n\n        $this->_inputFile = SWIFT_TMP_DIR.'/in.bin';\n        file_put_contents($this->_inputFile, '');\n\n        $this->_outputFile = SWIFT_TMP_DIR.'/out.bin';\n        file_put_contents($this->_outputFile, '');\n\n        $this->_encoder = $this->_createEncoder();\n    }\n\n    public function tearDown() {\n        unlink($this->_inputFile);\n        unlink($this->_outputFile);\n    }\n\n    public function testBase64EncodedLineLengthNeverExceeds76CharactersEvenIfArgsDo() {\n        $this->_fillFileWithRandomBytes(1000, $this->_inputFile);\n\n        $os = $this->_createStream($this->_inputFile);\n        $is = $this->_createStream($this->_outputFile);\n\n        $this->_encoder->encodeByteStream($os, $is, 0, 80); //Exceeds 76\n\n        $this->assertMaxLineLength(76, $this->_outputFile,\n            '%s: Line length should not exceed 76 characters'\n        );\n    }\n\n    // -- Custom Assertions\n\n    public function assertMaxLineLength($length, $filePath, $message = '%s') {\n        $lines = file($filePath);\n        foreach ($lines as $line) {\n            $this->assertTrue((strlen(trim($line)) <= 76), $message);\n        }\n    }\n\n    // -- Creation Methods\n\n    private function _fillFileWithRandomBytes($byteCount, $file) {\n        // I was going to use dd with if=/dev/random but this way seems more\n        // cross platform even if a hella expensive!!\n\n        file_put_contents($file, '');\n        $fp = fopen($file, 'wb');\n        for ($i = 0; $i < $byteCount; ++$i) {\n            $byteVal = rand(0, 255);\n            fwrite($fp, pack('i', $byteVal));\n        }\n        fclose($fp);\n    }\n\n    private function _createEncoder() {\n        return new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n    }\n\n    private function _createStream($file) {\n        return new Swift_ByteStream_FileByteStream($file, true);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php",
    "content": "<?php\n\n\nclass Swift_FileByteStreamConsecutiveReadCalls extends  \\PHPUnit_Framework_TestCase{\n    /**\n     * @test\n     * @expectedException \\Swift_IoException\n     */\n    public function shouldThrowExceptionOnConsecutiveRead() {\n        $fbs = new \\Swift_ByteStream_FileByteStream('does not exist');\n        try {\n            $fbs->read(100);\n        } catch (\\Swift_IoException $exc) {\n            $fbs->read(100);\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/fixtures/MimeEntityFixture.php",
    "content": "<?php\n\nclass MimeEntityFixture implements Swift_Mime_MimeEntity{\n    private $level;\n    private $string;\n    private $contentType;\n\n    public function __construct($level = null, $string = '', $contentType = null) {\n        $this->level = $level;\n        $this->string = $string;\n        $this->contentType = $contentType;\n    }\n\n    public function getNestingLevel() {\n        return $this->level;\n    }\n\n    public function toString() {\n        return $this->string;\n    }\n\n    public function getContentType() {\n        return $this->contentType;\n    }\n\n    // These methods are here to account for the implemented interfaces\n    public function getId() {\n    }\n    public function getHeaders() {\n    }\n    public function getBody() {\n    }\n    public function setBody($body, $contentType = null) {\n    }\n    public function toByteStream(Swift_InputByteStream $is) {\n    }\n    public function charsetChanged($charset) {\n    }\n    public function encoderChanged(Swift_Mime_ContentEncoder $encoder) {\n    }\n    public function getChildren() {\n    }\n    public function setChildren(array $children) {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php",
    "content": "<?php\n\n/**\n * @group smoke\n */\nclass Swift_Smoke_AttachmentSmokeTest extends SwiftMailerSmokeTestCase{\n    private $_attFile;\n\n    public function setUp() {\n        $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';\n    }\n\n    public function testAttachmentSending() {\n        $mailer = $this->_getMailer();\n        $message = Swift_Message::newInstance()\n            ->setSubject('[Swift Mailer] AttachmentSmokeTest')\n            ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))\n            ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)\n            ->setBody('This message should contain an attached ZIP file (named \"textfile.zip\").'.PHP_EOL.\n                'When unzipped, the archive should produce a text file which reads:'.PHP_EOL.\n                '\"This is part of a Swift Mailer v4 smoke test.\"'\n                )\n            ->attach(Swift_Attachment::fromPath($this->_attFile))\n            ;\n        $this->assertEquals(1, $mailer->send($message),\n            '%s: The smoke test should send a single message'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php",
    "content": "<?php\n\n/**\n * @group smoke\n */\nclass Swift_Smoke_BasicSmokeTest extends SwiftMailerSmokeTestCase{\n    public function testBasicSending() {\n        $mailer = $this->_getMailer();\n        $message = Swift_Message::newInstance()\n            ->setSubject('[Swift Mailer] BasicSmokeTest')\n            ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))\n            ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)\n            ->setBody('One, two, three, four, five...'.PHP_EOL.\n                'six, seven, eight...'\n                )\n            ;\n        $this->assertEquals(1, $mailer->send($message),\n            '%s: The smoke test should send a single message'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php",
    "content": "<?php\n\n/**\n * @group smoke\n */\nclass Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase{\n    private $_attFile;\n\n    public function setUp() {\n        $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';\n    }\n\n    public function testAttachmentSending() {\n        $mailer = $this->_getMailer();\n        $message = Swift_Message::newInstance('[Swift Mailer] HtmlWithAttachmentSmokeTest')\n            ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))\n            ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)\n            ->attach(Swift_Attachment::fromPath($this->_attFile))\n            ->setBody('<p>This HTML-formatted message should contain an attached ZIP file (named \"textfile.zip\").'.PHP_EOL.\n                'When unzipped, the archive should produce a text file which reads:</p>'.PHP_EOL.\n                '<p><q>This is part of a Swift Mailer v4 smoke test.</q></p>', 'text/html'\n            )\n            ;\n        $this->assertEquals(1, $mailer->send($message),\n            '%s: The smoke test should send a single message'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php",
    "content": "<?php\n\n/**\n * @group smoke\n */\nclass Swift_Smoke_InternationalSmokeTest extends SwiftMailerSmokeTestCase{\n    private $_attFile;\n\n    public function setUp() {\n        $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';\n    }\n\n    public function testAttachmentSending() {\n        $mailer = $this->_getMailer();\n        $message = Swift_Message::newInstance()\n            ->setCharset('utf-8')\n            ->setSubject('[Swift Mailer] InternationalSmokeTest (διεθνής)')\n            ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Χριστοφορου (Swift Mailer)'))\n            ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)\n            ->setBody('This message should contain an attached ZIP file (named \"κείμενο, εδάφιο, θέμα.zip\").'.PHP_EOL.\n                'When unzipped, the archive should produce a text file which reads:'.PHP_EOL.\n                '\"This is part of a Swift Mailer v4 smoke test.\"'.PHP_EOL.\n                PHP_EOL.\n                'Following is some arbitrary Greek text:'.PHP_EOL.\n                'Δεν βρέθηκαν λέξεις.'\n                )\n            ->attach(Swift_Attachment::fromPath($this->_attFile)\n                ->setContentType('application/zip')\n                ->setFilename('κείμενο, εδάφιο, θέμα.zip')\n                )\n            ;\n        $this->assertEquals(1, $mailer->send($message),\n            '%s: The smoke test should send a single message'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/smoke.conf.php.default",
    "content": "<?php\n\n/*\n Swift Mailer V4 smoke test configuration.\n\n YOU ONLY NEED TO EDIT THIS FILE IF YOU WISH TO RUN THE SMOKE TESTS.\n\n The smoke tests are run by default when \"All Tests\" are run with the\n testing suite, however, without configuration options here only the unit tests\n will be run and the smoke tests will be skipped.\n */\n\n/*\n Defines: The an address which Swift can send to (it will also send \"from\" this address).\n Recommended: (your own email address?)\n */\ndefine('SWIFT_SMOKE_EMAIL_ADDRESS', 'test@swiftmailer.org');\n\n/*\n Defines: The specific transport you want to mail with.\n Recommended: Any of 'smtp', 'sendmail' or 'mail'\n */\ndefine('SWIFT_SMOKE_TRANSPORT_TYPE', 'smtp');\n\n// SMTP-specific settings\n\n/*\n Defines: An SMTP server to connect to\n Recommended: smtp.your-isp.com (varies wildly!)\n */\ndefine('SWIFT_SMOKE_SMTP_HOST', 'localhost');\n\n/*\n Defines: The SMTP port to connect to\n Recommended: 25\n */\ndefine('SWIFT_SMOKE_SMTP_PORT', '4456');\n\n/*\n Defines: A username to authenticate with SMTP (if needed).\n Recommended: (none)\n */\ndefine('SWIFT_SMOKE_SMTP_USER', '');\n\n/*\n Defines: A password to authenticate with SMTP (if needed).\n Recommended: (none)\n */\ndefine('SWIFT_SMOKE_SMTP_PASS', '');\n\n/*\n Defines: The encryption needed on your SMTP server.\n Recommended: (none), or 'tls' or 'ssl'\n */\ndefine('SWIFT_SMOKE_SMTP_ENCRYPTION', '');\n\n// Sendmail specific settings\n\n/*\n Defines: The command to use when sending via sendmail\n Recommended: /usr/sbin/sendmail -bs (or \"-oi -t\")\n */\ndefine('SWIFT_SMOKE_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs');\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php",
    "content": "<?php\n\nclass Swift_ByteStream_ArrayByteStreamTest extends \\PHPUnit_Framework_TestCase{\n    public function testReadingSingleBytesFromBaseInput() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n        $output = array();\n        while (false !== $bytes = $bs->read(1)) {\n            $output[] = $bytes;\n        }\n        $this->assertEquals($input, $output,\n            '%s: Bytes read from stream should be the same as bytes in constructor'\n            );\n    }\n\n    public function testReadingMultipleBytesFromBaseInput() {\n        $input = array('a', 'b', 'c', 'd');\n        $bs = $this->_createArrayStream($input);\n        $output = array();\n        while (false !== $bytes = $bs->read(2)) {\n            $output[] = $bytes;\n        }\n        $this->assertEquals(array('ab', 'cd'), $output,\n            '%s: Bytes read from stream should be in pairs'\n            );\n    }\n\n    public function testReadingOddOffsetOnLastByte() {\n        $input = array('a', 'b', 'c', 'd', 'e');\n        $bs = $this->_createArrayStream($input);\n        $output = array();\n        while (false !== $bytes = $bs->read(2)) {\n            $output[] = $bytes;\n        }\n        $this->assertEquals(array('ab', 'cd', 'e'), $output,\n            '%s: Bytes read from stream should be in pairs except final read'\n            );\n    }\n\n    public function testSettingPointerPartway() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n        $bs->setReadPointer(1);\n        $this->assertEquals('b', $bs->read(1),\n            '%s: Byte should be second byte since pointer as at offset 1'\n            );\n    }\n\n    public function testResettingPointerAfterExhaustion() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input); while (false !== $bs->read(1));\n\n        $bs->setReadPointer(0);\n        $this->assertEquals('a', $bs->read(1),\n            '%s: Byte should be first byte since pointer as at offset 0'\n            );\n    }\n\n    public function testPointerNeverSetsBelowZero() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n\n        $bs->setReadPointer(-1);\n        $this->assertEquals('a', $bs->read(1),\n            '%s: Byte should be first byte since pointer should be at offset 0'\n            );\n    }\n\n    public function testPointerNeverSetsAboveStackSize() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n\n        $bs->setReadPointer(3);\n        $this->assertSame(false, $bs->read(1),\n            '%s: Stream should be at end and thus return false'\n            );\n    }\n\n    public function testBytesCanBeWrittenToStream() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n\n        $bs->write('de');\n\n        $output = array();\n        while (false !== $bytes = $bs->read(1)) {\n            $output[] = $bytes;\n        }\n        $this->assertEquals(array('a', 'b', 'c', 'd', 'e'), $output,\n            '%s: Bytes read from stream should be from initial stack + written'\n            );\n    }\n\n    public function testContentsCanBeFlushed() {\n        $input = array('a', 'b', 'c');\n        $bs = $this->_createArrayStream($input);\n\n        $bs->flushBuffers();\n\n        $this->assertSame(false, $bs->read(1),\n            '%s: Contents have been flushed so read() should return false'\n            );\n    }\n\n    public function testConstructorCanTakeStringArgument() {\n        $bs = $this->_createArrayStream('abc');\n        $output = array();\n        while (false !== $bytes = $bs->read(1)) {\n            $output[] = $bytes;\n        }\n        $this->assertEquals(array('a', 'b', 'c'), $output,\n            '%s: Bytes read from stream should be the same as bytes in constructor'\n            );\n    }\n\n    public function testBindingOtherStreamsMirrorsWriteOperations() {\n        $bs = $this->_createArrayStream('');\n        $is1 = $this->getMock('Swift_InputByteStream');\n        $is2 = $this->getMock('Swift_InputByteStream');\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is2->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n\n        $bs->bind($is1);\n        $bs->bind($is2);\n\n        $bs->write('x');\n        $bs->write('y');\n    }\n\n    public function testBindingOtherStreamsMirrorsFlushOperations() {\n        $bs = $this->_createArrayStream('');\n        $is1 = $this->getMock('Swift_InputByteStream');\n        $is2 = $this->getMock('Swift_InputByteStream');\n\n        $is1->expects($this->once())\n            ->method('flushBuffers');\n        $is2->expects($this->once())\n            ->method('flushBuffers');\n\n        $bs->bind($is1);\n        $bs->bind($is2);\n\n        $bs->flushBuffers();\n    }\n\n    public function testUnbindingStreamPreventsFurtherWrites() {\n        $bs = $this->_createArrayStream('');\n        $is1 = $this->getMock('Swift_InputByteStream');\n        $is2 = $this->getMock('Swift_InputByteStream');\n\n        $is1->expects($this->at(0))\n            ->method('write')\n            ->with('x');\n        $is1->expects($this->at(1))\n            ->method('write')\n            ->with('y');\n        $is2->expects($this->once())\n            ->method('write')\n            ->with('x');\n\n        $bs->bind($is1);\n        $bs->bind($is2);\n\n        $bs->write('x');\n\n        $bs->unbind($is2);\n\n        $bs->write('y');\n    }\n\n    // -- Creation Methods\n\n    private function _createArrayStream($input) {\n        return new Swift_ByteStream_ArrayByteStream($input);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php",
    "content": "<?php\n\nclass Swift_CharacterReader_GenericFixedWidthReaderTest extends \\PHPUnit_Framework_TestCase{\n    public function testInitialByteSizeMatchesWidth() {\n        $reader = new Swift_CharacterReader_GenericFixedWidthReader(1);\n        $this->assertSame(1, $reader->getInitialByteSize());\n\n        $reader = new Swift_CharacterReader_GenericFixedWidthReader(4);\n        $this->assertSame(4, $reader->getInitialByteSize());\n    }\n\n    public function testValidationValueIsBasedOnOctetCount() {\n        $reader = new Swift_CharacterReader_GenericFixedWidthReader(4);\n\n        $this->assertSame(\n            1, $reader->validateByteSequence(array(0x01, 0x02, 0x03), 3)\n            ); //3 octets\n\n        $this->assertSame(\n            2, $reader->validateByteSequence(array(0x01, 0x0A), 2)\n            ); //2 octets\n\n        $this->assertSame(\n            3, $reader->validateByteSequence(array(0xFE), 1)\n            ); //1 octet\n\n        $this->assertSame(\n            0, $reader->validateByteSequence(array(0xFE, 0x03, 0x67, 0x9A), 4)\n            ); //All 4 octets\n    }\n\n    public function testValidationFailsIfTooManyOctets() {\n        $reader = new Swift_CharacterReader_GenericFixedWidthReader(6);\n\n        $this->assertSame(-1, $reader->validateByteSequence(\n            array(0xFE, 0x03, 0x67, 0x9A, 0x10, 0x09, 0x85), 7\n            )); //7 octets\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php",
    "content": "<?php\n\nclass Swift_CharacterReader_UsAsciiReaderTest extends \\PHPUnit_Framework_TestCase{\n    /*\n\n    for ($c = '', $size = 1; false !== $bytes = $os->read($size); ) {\n        $c .= $bytes;\n        $size = $v->validateCharacter($c);\n        if (-1 == $size) {\n            throw new Exception( ... invalid char .. );\n        } elseif (0 == $size) {\n            return $c; //next character in $os\n        }\n    }\n\n    */\n\n    private $_reader;\n\n    public function setUp() {\n        $this->_reader = new Swift_CharacterReader_UsAsciiReader();\n    }\n\n    public function testAllValidAsciiCharactersReturnZero() {\n        for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) {\n            $this->assertSame(\n                0, $this->_reader->validateByteSequence(array($ordinal), 1)\n                );\n        }\n    }\n\n    public function testMultipleBytesAreInvalid() {\n        for ($ordinal = 0x00; $ordinal <= 0x7F; $ordinal += 2) {\n            $this->assertSame(\n                -1, $this->_reader->validateByteSequence(array($ordinal, $ordinal + 1), 2)\n                );\n        }\n    }\n\n    public function testBytesAboveAsciiRangeAreInvalid() {\n        for ($ordinal = 0x80; $ordinal <= 0xFF; ++$ordinal) {\n            $this->assertSame(\n                -1, $this->_reader->validateByteSequence(array($ordinal), 1)\n                );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php",
    "content": "<?php\n\nclass Swift_CharacterReader_Utf8ReaderTest extends \\PHPUnit_Framework_TestCase{\n    private $_reader;\n\n    public function setUp() {\n        $this->_reader = new Swift_CharacterReader_Utf8Reader();\n    }\n\n    public function testLeading7BitOctetCausesReturnZero() {\n        for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) {\n            $this->assertSame(\n                0, $this->_reader->validateByteSequence(array($ordinal), 1)\n                );\n        }\n    }\n\n    public function testLeadingByteOf2OctetCharCausesReturn1() {\n        for ($octet = 0xC0; $octet <= 0xDF; ++$octet) {\n            $this->assertSame(\n                1, $this->_reader->validateByteSequence(array($octet), 1)\n                );\n        }\n    }\n\n    public function testLeadingByteOf3OctetCharCausesReturn2() {\n        for ($octet = 0xE0; $octet <= 0xEF; ++$octet) {\n            $this->assertSame(\n                2, $this->_reader->validateByteSequence(array($octet), 1)\n                );\n        }\n    }\n\n    public function testLeadingByteOf4OctetCharCausesReturn3() {\n        for ($octet = 0xF0; $octet <= 0xF7; ++$octet) {\n            $this->assertSame(\n                3, $this->_reader->validateByteSequence(array($octet), 1)\n                );\n        }\n    }\n\n    public function testLeadingByteOf5OctetCharCausesReturn4() {\n        for ($octet = 0xF8; $octet <= 0xFB; ++$octet) {\n            $this->assertSame(\n                4, $this->_reader->validateByteSequence(array($octet), 1)\n                );\n        }\n    }\n\n    public function testLeadingByteOf6OctetCharCausesReturn5() {\n        for ($octet = 0xFC; $octet <= 0xFD; ++$octet) {\n            $this->assertSame(\n                5, $this->_reader->validateByteSequence(array($octet), 1)\n                );\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php",
    "content": "<?php\n\nclass Swift_CharacterStream_ArrayCharacterStreamTest extends \\SwiftMailerTestCase{\n    public function testValidatorAlgorithmOnImportString() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importString(pack('C*',\n            0xD0, 0x94,\n            0xD0, 0xB6,\n            0xD0, 0xBE,\n            0xD1, 0x8D,\n            0xD0, 0xBB,\n            0xD0, 0xB0\n            )\n        );\n    }\n\n    public function testCharactersWrittenUseValidator() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $stream->write(pack('C*',\n            0xD0, 0xBB,\n            0xD1, 0x8E,\n            0xD0, 0xB1,\n            0xD1, 0x8B,\n            0xD1, 0x85\n            )\n        );\n    }\n\n    public function testReadCharactersAreInTact() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        //String\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        //Stream\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $stream->write(pack('C*',\n            0xD0, 0xBB,\n            0xD1, 0x8E,\n            0xD0, 0xB1,\n            0xD1, 0x8B,\n            0xD1, 0x85\n            )\n        );\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1));\n        $this->assertIdenticalBinary(\n            pack('C*', 0xD0, 0xB6, 0xD0, 0xBE), $stream->read(2)\n            );\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBB), $stream->read(1));\n        $this->assertIdenticalBinary(\n            pack('C*', 0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B), $stream->read(3)\n            );\n        $this->assertIdenticalBinary(pack('C*', 0xD1, 0x85), $stream->read(1));\n\n        $this->assertSame(false, $stream->read(1));\n    }\n\n    public function testCharactersCanBeReadAsByteArrays() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        //String\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        //Stream\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $stream->write(pack('C*',\n            0xD0, 0xBB,\n            0xD1, 0x8E,\n            0xD0, 0xB1,\n            0xD1, 0x8B,\n            0xD1, 0x85\n            )\n        );\n\n        $this->assertEquals(array(0xD0, 0x94), $stream->readBytes(1));\n        $this->assertEquals(array(0xD0, 0xB6, 0xD0, 0xBE), $stream->readBytes(2));\n        $this->assertEquals(array(0xD0, 0xBB), $stream->readBytes(1));\n        $this->assertEquals(\n            array(0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B), $stream->readBytes(3)\n            );\n        $this->assertEquals(array(0xD1, 0x85), $stream->readBytes(1));\n\n        $this->assertSame(false, $stream->readBytes(1));\n    }\n\n    public function testRequestingLargeCharCountPastEndOfStream() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE),\n            $stream->read(100)\n            );\n\n        $this->assertSame(false, $stream->read(1));\n    }\n\n    public function testRequestingByteArrayCountPastEndOfStream() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $this->assertEquals(array(0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE),\n            $stream->readBytes(100)\n            );\n\n        $this->assertSame(false, $stream->readBytes(1));\n    }\n\n    public function testPointerOffsetCanBeSet() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1));\n\n        $stream->setPointer(0);\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1));\n\n        $stream->setPointer(2);\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBE), $stream->read(1));\n    }\n\n    public function testContentsCanBeFlushed() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));\n\n        $stream->flushContents();\n\n        $this->assertSame(false, $stream->read(1));\n    }\n\n    public function testByteStreamCanBeImportingUsesValidator() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n        $os = $this->_getByteStream();\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $os->shouldReceive('setReadPointer')\n           ->between(0, 1)\n           ->with(0);\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0x94));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xB6));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xBE));\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importByteStream($os);\n    }\n\n    public function testImportingStreamProducesCorrectCharArray() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n        $os = $this->_getByteStream();\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');\n\n        $os->shouldReceive('setReadPointer')\n           ->between(0, 1)\n           ->with(0);\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0x94));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xB6));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xD0));\n        $os->shouldReceive('read')->once()->andReturn(pack('C*', 0xBE));\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);\n\n        $stream->importByteStream($os);\n\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1));\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB6), $stream->read(1));\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBE), $stream->read(1));\n\n        $this->assertSame(false, $stream->read(1));\n    }\n\n    public function testAlgorithmWithFixedWidthCharsets() {\n        $reader = $this->_getReader();\n        $factory = $this->_getFactory($reader);\n\n        $reader->shouldReceive('getInitialByteSize')\n               ->zeroOrMoreTimes()\n               ->andReturn(2);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1, 0x8D), 2);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0, 0xBB), 2);\n        $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0, 0xB0), 2);\n\n        $stream = new Swift_CharacterStream_ArrayCharacterStream(\n            $factory, 'utf-8'\n        );\n        $stream->importString(pack('C*', 0xD1, 0x8D, 0xD0, 0xBB, 0xD0, 0xB0));\n\n        $this->assertIdenticalBinary(pack('C*', 0xD1, 0x8D), $stream->read(1));\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBB), $stream->read(1));\n        $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB0), $stream->read(1));\n\n        $this->assertSame(false, $stream->read(1));\n    }\n\n    // -- Creation methods\n\n    private function _getReader() {\n        return $this->getMockery('Swift_CharacterReader');\n    }\n\n    private function _getFactory($reader) {\n        $factory = $this->getMockery('Swift_CharacterReaderFactory');\n        $factory->shouldReceive('getReaderFor')\n                ->zeroOrMoreTimes()\n                ->with('utf-8')\n                ->andReturn($reader);\n\n        return $factory;\n    }\n\n    private function _getByteStream() {\n        return $this->getMockery('Swift_OutputByteStream');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/DependencyContainerTest.php",
    "content": "<?php\n\nclass One{\n    public $arg1, $arg2;\n    public function __construct($arg1 = null, $arg2 = null) {\n        $this->arg1 = $arg1;\n        $this->arg2 = $arg2;\n    }\n}\n\nclass Swift_DependencyContainerTest extends \\PHPUnit_Framework_TestCase{\n    private $_container;\n\n    public function setUp() {\n        $this->_container = new Swift_DependencyContainer();\n    }\n\n    public function testRegisterAndLookupValue() {\n        $this->_container->register('foo')->asValue('bar');\n        $this->assertEquals('bar', $this->_container->lookup('foo'));\n    }\n\n    public function testHasReturnsTrueForRegisteredValue() {\n        $this->_container->register('foo')->asValue('bar');\n        $this->assertTrue($this->_container->has('foo'));\n    }\n\n    public function testHasReturnsFalseForUnregisteredValue() {\n        $this->assertFalse($this->_container->has('foo'));\n    }\n\n    public function testRegisterAndLookupNewInstance() {\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $this->assertInstanceof('One', $this->_container->lookup('one'));\n    }\n\n    public function testHasReturnsTrueForRegisteredInstance() {\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $this->assertTrue($this->_container->has('one'));\n    }\n\n    public function testNewInstanceIsAlwaysNew() {\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $a = $this->_container->lookup('one');\n        $b = $this->_container->lookup('one');\n        $this->assertEquals($a, $b);\n    }\n\n    public function testRegisterAndLookupSharedInstance() {\n        $this->_container->register('one')->asSharedInstanceOf('One');\n        $this->assertInstanceof('One', $this->_container->lookup('one'));\n    }\n\n    public function testHasReturnsTrueForSharedInstance() {\n        $this->_container->register('one')->asSharedInstanceOf('One');\n        $this->assertTrue($this->_container->has('one'));\n    }\n\n    public function testMultipleSharedInstancesAreSameInstance() {\n        $this->_container->register('one')->asSharedInstanceOf('One');\n        $a = $this->_container->lookup('one');\n        $b = $this->_container->lookup('one');\n        $this->assertEquals($a, $b);\n    }\n\n    public function testNewInstanceWithDependencies() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('one')->asNewInstanceOf('One')\n            ->withDependencies(array('foo'));\n        $obj = $this->_container->lookup('one');\n        $this->assertSame('FOO', $obj->arg1);\n    }\n\n    public function testNewInstanceWithMultipleDependencies() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('bar')->asValue(42);\n        $this->_container->register('one')->asNewInstanceOf('One')\n            ->withDependencies(array('foo', 'bar'));\n        $obj = $this->_container->lookup('one');\n        $this->assertSame('FOO', $obj->arg1);\n        $this->assertSame(42, $obj->arg2);\n    }\n\n    public function testNewInstanceWithInjectedObjects() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $this->_container->register('two')->asNewInstanceOf('One')\n            ->withDependencies(array('one', 'foo'));\n        $obj = $this->_container->lookup('two');\n        $this->assertEquals($this->_container->lookup('one'), $obj->arg1);\n        $this->assertSame('FOO', $obj->arg2);\n    }\n\n    public function testNewInstanceWithAddConstructorValue() {\n        $this->_container->register('one')->asNewInstanceOf('One')\n            ->addConstructorValue('x')\n            ->addConstructorValue(99);\n        $obj = $this->_container->lookup('one');\n        $this->assertSame('x', $obj->arg1);\n        $this->assertSame(99, $obj->arg2);\n    }\n\n    public function testNewInstanceWithAddConstructorLookup() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('bar')->asValue(42);\n        $this->_container->register('one')->asNewInstanceOf('One')\n            ->addConstructorLookup('foo')\n            ->addConstructorLookup('bar');\n\n        $obj = $this->_container->lookup('one');\n        $this->assertSame('FOO', $obj->arg1);\n        $this->assertSame(42, $obj->arg2);\n    }\n\n    public function testResolvedDependenciesCanBeLookedUp() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $this->_container->register('two')->asNewInstanceOf('One')\n            ->withDependencies(array('one', 'foo'));\n        $deps = $this->_container->createDependenciesFor('two');\n        $this->assertEquals(\n            array($this->_container->lookup('one'), 'FOO'), $deps\n            );\n    }\n\n    public function testArrayOfDependenciesCanBeSpecified() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('one')->asNewInstanceOf('One');\n        $this->_container->register('two')->asNewInstanceOf('One')\n            ->withDependencies(array(array('one', 'foo'), 'foo'));\n\n        $obj = $this->_container->lookup('two');\n        $this->assertEquals(array($this->_container->lookup('one'), 'FOO'), $obj->arg1);\n        $this->assertSame('FOO', $obj->arg2);\n    }\n\n    public function testAliasCanBeSet() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('bar')->asAliasOf('foo');\n\n        $this->assertSame('FOO', $this->_container->lookup('bar'));\n    }\n\n    public function testAliasOfAliasCanBeSet() {\n        $this->_container->register('foo')->asValue('FOO');\n        $this->_container->register('bar')->asAliasOf('foo');\n        $this->_container->register('zip')->asAliasOf('bar');\n        $this->_container->register('button')->asAliasOf('zip');\n\n        $this->assertSame('FOO', $this->_container->lookup('button'));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php",
    "content": "<?php\n\nclass Swift_Encoder_Base64EncoderTest extends \\PHPUnit_Framework_TestCase{\n    private $_encoder;\n\n    public function setUp() {\n        $this->_encoder = new Swift_Encoder_Base64Encoder();\n    }\n\n    /*\n    There's really no point in testing the entire base64 encoding to the\n    level QP encoding has been tested.  base64_encode() has been in PHP for\n    years.\n    */\n\n    public function testInputOutputRatioIs3to4Bytes() {\n        /*\n        RFC 2045, 6.8\n\n         The encoding process represents 24-bit groups of input bits as output\n         strings of 4 encoded characters.  Proceeding from left to right, a\n         24-bit input group is formed by concatenating 3 8bit input groups.\n         These 24 bits are then treated as 4 concatenated 6-bit groups, each\n         of which is translated into a single digit in the base64 alphabet.\n         */\n\n        $this->assertEquals(\n            'MTIz', $this->_encoder->encodeString('123'),\n            '%s: 3 bytes of input should yield 4 bytes of output'\n            );\n        $this->assertEquals(\n            'MTIzNDU2', $this->_encoder->encodeString('123456'),\n            '%s: 6 bytes in input should yield 8 bytes of output'\n            );\n        $this->assertEquals(\n            'MTIzNDU2Nzg5', $this->_encoder->encodeString('123456789'),\n            '%s: 9 bytes in input should yield 12 bytes of output'\n            );\n    }\n\n    public function testPadLength() {\n        /*\n        RFC 2045, 6.8\n\n       Special processing is performed if fewer than 24 bits are available\n       at the end of the data being encoded.  A full encoding quantum is\n       always completed at the end of a body.  When fewer than 24 input bits\n       are available in an input group, zero bits are added (on the right)\n       to form an integral number of 6-bit groups.  Padding at the end of\n       the data is performed using the \"=\" character.  Since all base64\n       input is an integral number of octets, only the following cases can\n       arise: (1) the final quantum of encoding input is an integral\n       multiple of 24 bits; here, the final unit of encoded output will be\n       an integral multiple of 4 characters with no \"=\" padding, (2) the\n       final quantum of encoding input is exactly 8 bits; here, the final\n       unit of encoded output will be two characters followed by two \"=\"\n       padding characters, or (3) the final quantum of encoding input is\n       exactly 16 bits; here, the final unit of encoded output will be three\n       characters followed by one \"=\" padding character.\n       */\n\n        for ($i = 0; $i < 30; ++$i) {\n            $input = pack('C', rand(0, 255));\n            $this->assertRegExp(\n                '~^[a-zA-Z0-9/\\+]{2}==$~', $this->_encoder->encodeString($input),\n                '%s: A single byte should have 2 bytes of padding'\n                );\n        }\n\n        for ($i = 0; $i < 30; ++$i) {\n            $input = pack('C*', rand(0, 255), rand(0, 255));\n            $this->assertRegExp(\n                '~^[a-zA-Z0-9/\\+]{3}=$~', $this->_encoder->encodeString($input),\n                '%s: Two bytes should have 1 byte of padding'\n                );\n        }\n\n        for ($i = 0; $i < 30; ++$i) {\n            $input = pack('C*', rand(0, 255), rand(0, 255), rand(0, 255));\n            $this->assertRegExp(\n                '~^[a-zA-Z0-9/\\+]{4}$~', $this->_encoder->encodeString($input),\n                '%s: Three bytes should have no padding'\n                );\n        }\n    }\n\n    public function testMaximumLineLengthIs76Characters() {\n        /*\n         The encoded output stream must be represented in lines of no more\n         than 76 characters each.  All line breaks or other characters not\n         found in Table 1 must be ignored by decoding software.\n         */\n\n        $input =\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n        $output =\n        'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk'.//38\n        'NERUZHSElKS0xNTk9QUVJTVFVWV1hZWjEyMzQ1'.\"\\r\\n\".//76 *\n        'Njc4OTBhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3'.//38\n        'h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFla'.\"\\r\\n\".//76 *\n        'MTIzNDU2Nzg5MEFCQ0RFRkdISUpLTE1OT1BRUl'.//38\n        'NUVVZXWFla';                                       //48\n\n        $this->assertEquals(\n            $output, $this->_encoder->encodeString($input),\n            '%s: Lines should be no more than 76 characters'\n            );\n    }\n\n    public function testMaximumLineLengthCanBeSpecified() {\n        $input =\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n        $output =\n        'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk'.//38\n        'NERUZHSElKS0'.\"\\r\\n\".//50 *\n        'xNTk9QUVJTVFVWV1hZWjEyMzQ1Njc4OTBhYmNk'.//38\n        'ZWZnaGlqa2xt'.\"\\r\\n\".//50 *\n        'bm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLTE1OT1'.//38\n        'BRUlNUVVZXWF'.\"\\r\\n\".//50 *\n        'laMTIzNDU2Nzg5MEFCQ0RFRkdISUpLTE1OT1BR'.//38\n        'UlNUVVZXWFla';                                     //50 *\n\n        $this->assertEquals(\n            $output, $this->_encoder->encodeString($input, 0, 50),\n            '%s: Lines should be no more than 100 characters'\n            );\n    }\n\n    public function testFirstLineLengthCanBeDifferent() {\n        $input =\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'abcdefghijklmnopqrstuvwxyz'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.\n        '1234567890'.\n        'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n        $output =\n        'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk'.//38\n        'NERUZHSElKS0xNTk9QU'.\"\\r\\n\".//57 *\n        'VJTVFVWV1hZWjEyMzQ1Njc4OTBhYmNkZWZnaGl'.//38\n        'qa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLT'.\"\\r\\n\".//76 *\n        'E1OT1BRUlNUVVZXWFlaMTIzNDU2Nzg5MEFCQ0R'.//38\n        'FRkdISUpLTE1OT1BRUlNUVVZXWFla';                    //67\n\n        $this->assertEquals(\n            $output, $this->_encoder->encodeString($input, 19),\n            '%s: First line offset is 19 so first line should be 57 chars long'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php",
    "content": "<?php\n\nclass Swift_Encoder_QpEncoderTest extends \\SwiftMailerTestCase{\n    /* -- RFC 2045, 6.7 --\n    (1)   (General 8bit representation) Any octet, except a CR or\n                    LF that is part of a CRLF line break of the canonical\n                    (standard) form of the data being encoded, may be\n                    represented by an \"=\" followed by a two digit\n                    hexadecimal representation of the octet's value.  The\n                    digits of the hexadecimal alphabet, for this purpose,\n                    are \"0123456789ABCDEF\".  Uppercase letters must be\n                    used; lowercase letters are not allowed.  Thus, for\n                    example, the decimal value 12 (US-ASCII form feed) can\n                    be represented by \"=0C\", and the decimal value 61 (US-\n                    ASCII EQUAL SIGN) can be represented by \"=3D\".  This\n                    rule must be followed except when the following rules\n                    allow an alternative encoding.\n                    */\n\n    public function testPermittedCharactersAreNotEncoded() {\n        /* -- RFC 2045, 6.7 --\n        (2)   (Literal representation) Octets with decimal values of\n                    33 through 60 inclusive, and 62 through 126, inclusive,\n                    MAY be represented as the US-ASCII characters which\n                    correspond to those octets (EXCLAMATION POINT through\n                    LESS THAN, and GREATER THAN through TILDE,\n                    respectively).\n                    */\n\n        foreach (array_merge(range(33, 60), range(62, 126)) as $ordinal) {\n            $char = chr($ordinal);\n\n            $charStream = $this->_createCharStream();\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importString')\n                       ->once()\n                       ->with($char);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->atLeast()->times(1)\n                       ->andReturn(false);\n\n            $encoder = new Swift_Encoder_QpEncoder($charStream);\n\n            $this->assertIdenticalBinary($char, $encoder->encodeString($char));\n        }\n    }\n\n    public function testWhiteSpaceAtLineEndingIsEncoded() {\n        /* -- RFC 2045, 6.7 --\n        (3)   (White Space) Octets with values of 9 and 32 MAY be\n                    represented as US-ASCII TAB (HT) and SPACE characters,\n                    respectively, but MUST NOT be so represented at the end\n                    of an encoded line.  Any TAB (HT) or SPACE characters\n                    on an encoded line MUST thus be followed on that line\n                    by a printable character.  In particular, an \"=\" at the\n                    end of an encoded line, indicating a soft line break\n                    (see rule #5) may follow one or more TAB (HT) or SPACE\n                    characters.  It follows that an octet with decimal\n                    value 9 or 32 appearing at the end of an encoded line\n                    must be represented according to Rule #1.  This rule is\n                    necessary because some MTAs (Message Transport Agents,\n                    programs which transport messages from one user to\n                    another, or perform a portion of such transfers) are\n                    known to pad lines of text with SPACEs, and others are\n                    known to remove \"white space\" characters from the end\n                    of a line.  Therefore, when decoding a Quoted-Printable\n                    body, any trailing white space on a line must be\n                    deleted, as it will necessarily have been added by\n                    intermediate transport agents.\n                    */\n\n        $HT = chr(0x09); //9\n        $SPACE = chr(0x20); //32\n\n        //HT\n        $string = 'a'.$HT.$HT.\"\\r\\n\".'b';\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x09));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x09));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals(\n            'a'.$HT.'=09'.\"\\r\\n\".'b',\n            $encoder->encodeString($string)\n            );\n\n        //SPACE\n        $string = 'a'.$SPACE.$SPACE.\"\\r\\n\".'b';\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x20));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x20));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals(\n            'a'.$SPACE.'=20'.\"\\r\\n\".'b',\n            $encoder->encodeString($string)\n            );\n    }\n\n    public function testCRLFIsLeftAlone() {\n        /*\n        (4)   (Line Breaks) A line break in a text body, represented\n                    as a CRLF sequence in the text canonical form, must be\n                    represented by a (RFC 822) line break, which is also a\n                    CRLF sequence, in the Quoted-Printable encoding.  Since\n                    the canonical representation of media types other than\n                    text do not generally include the representation of\n                    line breaks as CRLF sequences, no hard line breaks\n                    (i.e. line breaks that are intended to be meaningful\n                    and to be displayed to the user) can occur in the\n                    quoted-printable encoding of such types.  Sequences\n                    like \"=0D\", \"=0A\", \"=0A=0D\" and \"=0D=0A\" will routinely\n                    appear in non-text data represented in quoted-\n                    printable, of course.\n\n                    Note that many implementations may elect to encode the\n                    local representation of various content types directly\n                    rather than converting to canonical form first,\n                    encoding, and then converting back to local\n                    representation.  In particular, this may apply to plain\n                    text material on systems that use newline conventions\n                    other than a CRLF terminator sequence.  Such an\n                    implementation optimization is permissible, but only\n                    when the combined canonicalization-encoding step is\n                    equivalent to performing the three steps separately.\n                    */\n\n        $string = 'a'.\"\\r\\n\".'b'.\"\\r\\n\".'c'.\"\\r\\n\";\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('c')));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')->once()->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals($string, $encoder->encodeString($string));\n    }\n\n    public function testLinesLongerThan76CharactersAreSoftBroken() {\n        /*\n        (5)   (Soft Line Breaks) The Quoted-Printable encoding\n                    REQUIRES that encoded lines be no more than 76\n                    characters long.  If longer lines are to be encoded\n                    with the Quoted-Printable encoding, \"soft\" line breaks\n                    must be used.  An equal sign as the last character on a\n                    encoded line indicates such a non-significant (\"soft\")\n                    line break in the encoded text.\n                    */\n\n        $input = str_repeat('a', 140);\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($input);\n\n        $output = '';\n        for ($i = 0; $i < 140; ++$i) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n\n            if (75 == $i) {\n                $output .= \"=\\r\\n\";\n            }\n            $output .= 'a';\n        }\n\n        $charStream->shouldReceive('readBytes')\n                    ->once()\n                    ->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals($output, $encoder->encodeString($input));\n    }\n\n    public function testMaxLineLengthCanBeSpecified() {\n        $input = str_repeat('a', 100);\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($input);\n\n        $output = '';\n        for ($i = 0; $i < 100; ++$i) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n\n            if (53 == $i) {\n                $output .= \"=\\r\\n\";\n            }\n            $output .= 'a';\n        }\n        $charStream->shouldReceive('readBytes')\n                    ->once()\n                    ->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals($output, $encoder->encodeString($input, 0, 54));\n    }\n\n    public function testBytesBelowPermittedRangeAreEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        foreach (range(0, 32) as $ordinal) {\n            $char = chr($ordinal);\n\n            $charStream = $this->_createCharStream();\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importString')\n                       ->once()\n                       ->with($char);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->atLeast()->times(1)\n                       ->andReturn(false);\n\n            $encoder = new Swift_Encoder_QpEncoder($charStream);\n\n            $this->assertEquals(\n                sprintf('=%02X', $ordinal), $encoder->encodeString($char)\n                );\n        }\n    }\n\n    public function testDecimalByte61IsEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        $char = '=';\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($char);\n        $charStream->shouldReceive('readBytes')\n                    ->once()\n                    ->andReturn(array(61));\n        $charStream->shouldReceive('readBytes')\n                    ->atLeast()->times(1)\n                    ->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n\n        $this->assertEquals('=3D', $encoder->encodeString('='));\n    }\n\n    public function testBytesAbovePermittedRangeAreEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        foreach (range(127, 255) as $ordinal) {\n            $char = chr($ordinal);\n\n            $charStream = $this->_createCharStream();\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importString')\n                       ->once()\n                       ->with($char);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->atLeast()->times(1)\n                       ->andReturn(false);\n\n            $encoder = new Swift_Encoder_QpEncoder($charStream);\n\n            $this->assertEquals(\n                sprintf('=%02X', $ordinal), $encoder->encodeString($char)\n                );\n        }\n    }\n\n    public function testFirstLineLengthCanBeDifferent() {\n        $input = str_repeat('a', 140);\n\n        $charStream = $this->_createCharStream();\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($input);\n\n        $output = '';\n        for ($i = 0; $i < 140; ++$i) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n\n            if (53 == $i || 53 + 75 == $i) {\n                $output .= \"=\\r\\n\";\n            }\n            $output .= 'a';\n        }\n\n        $charStream->shouldReceive('readBytes')\n                    ->once()\n                    ->andReturn(false);\n\n        $encoder = new Swift_Encoder_QpEncoder($charStream);\n        $this->assertEquals(\n            $output, $encoder->encodeString($input, 22),\n            '%s: First line should start at offset 22 so can only have max length 54'\n            );\n    }\n\n    public function testTextIsPreWrapped() {\n        $encoder = $this->createEncoder();\n\n        $input = str_repeat('a', 70).\"\\r\\n\".\n                 str_repeat('a', 70).\"\\r\\n\".\n                 str_repeat('a', 70);\n\n        $this->assertEquals(\n            $input, $encoder->encodeString($input)\n            );\n    }\n\n    // -- Creation methods\n\n    private function _createCharStream() {\n        return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();\n    }\n\n    private function createEncoder() {\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');\n\n        return new Swift_Encoder_QpEncoder($charStream);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php",
    "content": "<?php\n\nclass Swift_Encoder_Rfc2231EncoderTest extends \\SwiftMailerTestCase{\n    private $_rfc2045Token = '/^[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2E\\x30-\\x39\\x41-\\x5A\\x5E-\\x7E]+$/D';\n\n    /* --\n    This algorithm is described in RFC 2231, but is barely touched upon except\n    for mentioning bytes can be represented as their octet values (e.g. %20 for\n    the SPACE character).\n\n    The tests here focus on how to use that representation to always generate text\n    which matches RFC 2045's definition of \"token\".\n    */\n\n    public function testEncodingAsciiCharactersProducesValidToken() {\n        $charStream = $this->getMockery('Swift_CharacterStream');\n\n        $string = '';\n        foreach (range(0x00, 0x7F) as $octet) {\n            $char = pack('C', $octet);\n            $string .= $char;\n            $charStream->shouldReceive('read')\n                       ->once()\n                       ->andReturn($char);\n        }\n\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n        $charStream->shouldReceive('read')\n                    ->atLeast()->times(1)\n                    ->andReturn(false);\n\n        $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);\n        $encoded = $encoder->encodeString($string);\n\n        foreach (explode(\"\\r\\n\", $encoded) as $line) {\n            $this->assertRegExp($this->_rfc2045Token, $line,\n                '%s: Encoder should always return a valid RFC 2045 token.');\n        }\n    }\n\n    public function testEncodingNonAsciiCharactersProducesValidToken() {\n        $charStream = $this->getMockery('Swift_CharacterStream');\n\n        $string = '';\n        foreach (range(0x80, 0xFF) as $octet) {\n            $char = pack('C', $octet);\n            $string .= $char;\n            $charStream->shouldReceive('read')\n                       ->once()\n                       ->andReturn($char);\n        }\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n        $charStream->shouldReceive('read')\n                    ->atLeast()->times(1)\n                    ->andReturn(false);\n        $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);\n\n        $encoded = $encoder->encodeString($string);\n\n        foreach (explode(\"\\r\\n\", $encoded) as $line) {\n            $this->assertRegExp($this->_rfc2045Token, $line,\n                '%s: Encoder should always return a valid RFC 2045 token.');\n        }\n    }\n\n    public function testMaximumLineLengthCanBeSet() {\n        $charStream = $this->getMockery('Swift_CharacterStream');\n\n        $string = '';\n        for ($x = 0; $x < 200; ++$x) {\n            $char = 'a';\n            $string .= $char;\n            $charStream->shouldReceive('read')\n                       ->once()\n                       ->andReturn($char);\n        }\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n        $charStream->shouldReceive('read')\n                    ->atLeast()->times(1)\n                    ->andReturn(false);\n        $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);\n\n        $encoded = $encoder->encodeString($string, 0, 75);\n\n        $this->assertEquals(\n            str_repeat('a', 75).\"\\r\\n\".\n            str_repeat('a', 75).\"\\r\\n\".\n            str_repeat('a', 50),\n            $encoded,\n            '%s: Lines should be wrapped at each 75 characters'\n            );\n    }\n\n    public function testFirstLineCanHaveShorterLength() {\n        $charStream = $this->getMockery('Swift_CharacterStream');\n\n        $string = '';\n        for ($x = 0; $x < 200; ++$x) {\n            $char = 'a';\n            $string .= $char;\n            $charStream->shouldReceive('read')\n                       ->once()\n                       ->andReturn($char);\n        }\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importString')\n                    ->once()\n                    ->with($string);\n        $charStream->shouldReceive('read')\n                    ->atLeast()->times(1)\n                    ->andReturn(false);\n        $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);\n        $encoded = $encoder->encodeString($string, 25, 75);\n\n        $this->assertEquals(\n            str_repeat('a', 50).\"\\r\\n\".\n            str_repeat('a', 75).\"\\r\\n\".\n            str_repeat('a', 75),\n            $encoded,\n            '%s: First line should be 25 bytes shorter than the others.'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php",
    "content": "<?php\n\nclass Swift_Events_CommandEventTest extends \\PHPUnit_Framework_TestCase{\n    public function testCommandCanBeFetchedByGetter() {\n        $evt = $this->_createEvent($this->_createTransport(), \"FOO\\r\\n\");\n        $this->assertEquals(\"FOO\\r\\n\", $evt->getCommand());\n    }\n\n    public function testSuccessCodesCanBeFetchedViaGetter() {\n        $evt = $this->_createEvent($this->_createTransport(), \"FOO\\r\\n\", array(250));\n        $this->assertEquals(array(250), $evt->getSuccessCodes());\n    }\n\n    public function testSourceIsBuffer() {\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport, \"FOO\\r\\n\");\n        $ref = $evt->getSource();\n        $this->assertEquals($transport, $ref);\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent(Swift_Transport $source, $command, $successCodes = array()) {\n        return new Swift_Events_CommandEvent($source, $command, $successCodes);\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php",
    "content": "<?php\n\nclass Swift_Events_EventObjectTest extends \\PHPUnit_Framework_TestCase{\n    public function testEventSourceCanBeReturnedViaGetter() {\n        $source = new stdClass();\n        $evt = $this->_createEvent($source);\n        $ref = $evt->getSource();\n        $this->assertEquals($source, $ref);\n    }\n\n    public function testEventDoesNotHaveCancelledBubbleWhenNew() {\n        $source = new stdClass();\n        $evt = $this->_createEvent($source);\n        $this->assertFalse($evt->bubbleCancelled());\n    }\n\n    public function testBubbleCanBeCancelledInEvent() {\n        $source = new stdClass();\n        $evt = $this->_createEvent($source);\n        $evt->cancelBubble();\n        $this->assertTrue($evt->bubbleCancelled());\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent($source) {\n        return new Swift_Events_EventObject($source);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php",
    "content": "<?php\n\nclass Swift_Events_ResponseEventTest extends \\PHPUnit_Framework_TestCase{\n    public function testResponseCanBeFetchViaGetter() {\n        $evt = $this->_createEvent($this->_createTransport(), \"250 Ok\\r\\n\", true);\n        $this->assertEquals(\"250 Ok\\r\\n\", $evt->getResponse(),\n            '%s: Response should be available via getResponse()'\n            );\n    }\n\n    public function testResultCanBeFetchedViaGetter() {\n        $evt = $this->_createEvent($this->_createTransport(), \"250 Ok\\r\\n\", false);\n        $this->assertFalse($evt->isValid(),\n            '%s: Result should be checkable via isValid()'\n            );\n    }\n\n    public function testSourceIsBuffer() {\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport, \"250 Ok\\r\\n\", true);\n        $ref = $evt->getSource();\n        $this->assertEquals($transport, $ref);\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent(Swift_Transport $source, $response, $result) {\n        return new Swift_Events_ResponseEvent($source, $response, $result);\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/SendEventTest.php",
    "content": "<?php\n\nclass Swift_Events_SendEventTest extends \\PHPUnit_Framework_TestCase{\n    public function testMessageCanBeFetchedViaGetter() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n\n        $ref = $evt->getMessage();\n        $this->assertEquals($message, $ref,\n            '%s: Message should be returned from getMessage()'\n            );\n    }\n\n    public function testTransportCanBeFetchViaGetter() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n\n        $ref = $evt->getTransport();\n        $this->assertEquals($transport, $ref,\n            '%s: Transport should be returned from getTransport()'\n            );\n    }\n\n    public function testTransportCanBeFetchViaGetSource() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n\n        $ref = $evt->getSource();\n        $this->assertEquals($transport, $ref,\n            '%s: Transport should be returned from getSource()'\n            );\n    }\n\n    public function testResultCanBeSetAndGet() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n\n        $evt->setResult(\n            Swift_Events_SendEvent::RESULT_SUCCESS | Swift_Events_SendEvent::RESULT_TENTATIVE\n            );\n\n        $this->assertTrue((bool) ($evt->getResult() & Swift_Events_SendEvent::RESULT_SUCCESS));\n        $this->assertTrue((bool) ($evt->getResult() & Swift_Events_SendEvent::RESULT_TENTATIVE));\n    }\n\n    public function testFailedRecipientsCanBeSetAndGet() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n\n        $evt->setFailedRecipients(array('foo@bar', 'zip@button'));\n\n        $this->assertEquals(array('foo@bar', 'zip@button'), $evt->getFailedRecipients(),\n            '%s: FailedRecipients should be returned from getter'\n            );\n    }\n\n    public function testFailedRecipientsGetsPickedUpCorrectly() {\n        $message = $this->_createMessage();\n        $transport = $this->_createTransport();\n\n        $evt = $this->_createEvent($transport, $message);\n        $this->assertEquals(array(), $evt->getFailedRecipients());\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent(Swift_Transport $source,\n        Swift_Mime_Message $message) {\n        return new Swift_Events_SendEvent($source, $message);\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n\n    private function _createMessage() {\n        return $this->getMock('Swift_Mime_Message');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php",
    "content": "<?php\n\nclass Swift_Events_SimpleEventDispatcherTest extends \\PHPUnit_Framework_TestCase{\n    private $_dispatcher;\n\n    public function setUp() {\n        $this->_dispatcher = new Swift_Events_SimpleEventDispatcher();\n    }\n\n    public function testSendEventCanBeCreated() {\n        $transport = $this->getMock('Swift_Transport');\n        $message = $this->getMock('Swift_Mime_Message');\n        $evt = $this->_dispatcher->createSendEvent($transport, $message);\n        $this->assertInstanceof('Swift_Events_SendEvent', $evt);\n        $this->assertSame($message, $evt->getMessage());\n        $this->assertSame($transport, $evt->getTransport());\n    }\n\n    public function testCommandEventCanBeCreated() {\n        $buf = $this->getMock('Swift_Transport');\n        $evt = $this->_dispatcher->createCommandEvent($buf, \"FOO\\r\\n\", array(250));\n        $this->assertInstanceof('Swift_Events_CommandEvent', $evt);\n        $this->assertSame($buf, $evt->getSource());\n        $this->assertEquals(\"FOO\\r\\n\", $evt->getCommand());\n        $this->assertEquals(array(250), $evt->getSuccessCodes());\n    }\n\n    public function testResponseEventCanBeCreated() {\n        $buf = $this->getMock('Swift_Transport');\n        $evt = $this->_dispatcher->createResponseEvent($buf, \"250 Ok\\r\\n\", true);\n        $this->assertInstanceof('Swift_Events_ResponseEvent', $evt);\n        $this->assertSame($buf, $evt->getSource());\n        $this->assertEquals(\"250 Ok\\r\\n\", $evt->getResponse());\n        $this->assertTrue($evt->isValid());\n    }\n\n    public function testTransportChangeEventCanBeCreated() {\n        $transport = $this->getMock('Swift_Transport');\n        $evt = $this->_dispatcher->createTransportChangeEvent($transport);\n        $this->assertInstanceof('Swift_Events_TransportChangeEvent', $evt);\n        $this->assertSame($transport, $evt->getSource());\n    }\n\n    public function testTransportExceptionEventCanBeCreated() {\n        $transport = $this->getMock('Swift_Transport');\n        $ex = new Swift_TransportException('');\n        $evt = $this->_dispatcher->createTransportExceptionEvent($transport, $ex);\n        $this->assertInstanceof('Swift_Events_TransportExceptionEvent', $evt);\n        $this->assertSame($transport, $evt->getSource());\n        $this->assertSame($ex, $evt->getException());\n    }\n\n    public function testListenersAreNotifiedOfDispatchedEvent() {\n        $transport = $this->getMock('Swift_Transport');\n\n        $evt = $this->_dispatcher->createTransportChangeEvent($transport);\n\n        $listenerA = $this->getMock('Swift_Events_TransportChangeListener');\n        $listenerB = $this->getMock('Swift_Events_TransportChangeListener');\n\n        $this->_dispatcher->bindEventListener($listenerA);\n        $this->_dispatcher->bindEventListener($listenerB);\n\n        $listenerA->expects($this->once())\n                  ->method('transportStarted')\n                  ->with($evt);\n        $listenerB->expects($this->once())\n                  ->method('transportStarted')\n                  ->with($evt);\n\n        $this->_dispatcher->dispatchEvent($evt, 'transportStarted');\n    }\n\n    public function testListenersAreOnlyCalledIfImplementingCorrectInterface() {\n        $transport = $this->getMock('Swift_Transport');\n        $message = $this->getMock('Swift_Mime_Message');\n\n        $evt = $this->_dispatcher->createSendEvent($transport, $message);\n\n        $targetListener = $this->getMock('Swift_Events_SendListener');\n        $otherListener = $this->getMock('Swift_Events_TransportChangeListener');\n\n        $this->_dispatcher->bindEventListener($targetListener);\n        $this->_dispatcher->bindEventListener($otherListener);\n\n        $targetListener->expects($this->once())\n                       ->method('sendPerformed')\n                       ->with($evt);\n        $otherListener->expects($this->never())\n                    ->method('sendPerformed');\n\n        $this->_dispatcher->dispatchEvent($evt, 'sendPerformed');\n    }\n\n    public function testListenersCanCancelBubblingOfEvent() {\n        $transport = $this->getMock('Swift_Transport');\n        $message = $this->getMock('Swift_Mime_Message');\n\n        $evt = $this->_dispatcher->createSendEvent($transport, $message);\n\n        $listenerA = $this->getMock('Swift_Events_SendListener');\n        $listenerB = $this->getMock('Swift_Events_SendListener');\n\n        $this->_dispatcher->bindEventListener($listenerA);\n        $this->_dispatcher->bindEventListener($listenerB);\n\n        $listenerA->expects($this->once())\n                  ->method('sendPerformed')\n                  ->with($evt)\n                  ->will($this->returnCallback(function ($object) {\n                      $object->cancelBubble(true);\n                  }));\n        $listenerB->expects($this->never())\n                  ->method('sendPerformed');\n\n        $this->_dispatcher->dispatchEvent($evt, 'sendPerformed');\n\n        $this->assertTrue($evt->bubbleCancelled());\n    }\n\n    private function _createDispatcher(array $map) {\n        return new Swift_Events_SimpleEventDispatcher($map);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php",
    "content": "<?php\n\nclass Swift_Events_TransportChangeEventTest extends \\PHPUnit_Framework_TestCase{\n    public function testGetTransportReturnsTransport() {\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport);\n        $ref = $evt->getTransport();\n        $this->assertEquals($transport, $ref);\n    }\n\n    public function testSourceIsTransport() {\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport);\n        $ref = $evt->getSource();\n        $this->assertEquals($transport, $ref);\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent(Swift_Transport $source) {\n        return new Swift_Events_TransportChangeEvent($source);\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php",
    "content": "<?php\n\nclass Swift_Events_TransportExceptionEventTest extends \\PHPUnit_Framework_TestCase{\n    public function testExceptionCanBeFetchViaGetter() {\n        $ex = $this->_createException();\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport, $ex);\n        $ref = $evt->getException();\n        $this->assertEquals($ex, $ref,\n            '%s: Exception should be available via getException()'\n            );\n    }\n\n    public function testSourceIsTransport() {\n        $ex = $this->_createException();\n        $transport = $this->_createTransport();\n        $evt = $this->_createEvent($transport, $ex);\n        $ref = $evt->getSource();\n        $this->assertEquals($transport, $ref,\n            '%s: Transport should be available via getSource()'\n            );\n    }\n\n    // -- Creation Methods\n\n    private function _createEvent(Swift_Transport $transport, Swift_TransportException $ex) {\n        return new Swift_Events_TransportExceptionEvent($transport, $ex);\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n\n    private function _createException() {\n        return new Swift_TransportException('');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php",
    "content": "<?php\n\nclass Swift_KeyCache_ArrayKeyCacheTest extends \\PHPUnit_Framework_TestCase{\n    private $_key1 = 'key1';\n    private $_key2 = 'key2';\n\n    public function testStringDataCanBeSetAndFetched() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeOverwritten() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $cache->setString(\n            $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE\n            );\n\n        $this->assertEquals('whatever', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testStringDataCanBeAppended() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $cache->setString(\n            $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND\n            );\n\n        $this->assertEquals('testing', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testHasKeyReturnValue() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n\n        $this->assertTrue($cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyIsWellPartitioned() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $cache->setString(\n            $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n\n        $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $cache->getString($this->_key2, 'foo'));\n    }\n\n    public function testItemKeyIsWellPartitioned() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $cache->setString(\n            $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE\n            );\n\n        $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));\n        $this->assertEquals('ing', $cache->getString($this->_key1, 'bar'));\n    }\n\n    public function testByteStreamCanBeImported() {\n        $os = $this->_createOutputStream();\n        $os->expects($this->at(0))\n           ->method('read')\n           ->will($this->returnValue('abc'));\n        $os->expects($this->at(1))\n           ->method('read')\n           ->will($this->returnValue('def'));\n        $os->expects($this->at(2))\n           ->method('read')\n           ->will($this->returnValue(false));\n\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n        $cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertEquals('abcdef', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamCanBeAppended() {\n        $os1 = $this->_createOutputStream();\n        $os1->expects($this->at(0))\n            ->method('read')\n            ->will($this->returnValue('abc'));\n        $os1->expects($this->at(1))\n            ->method('read')\n            ->will($this->returnValue('def'));\n        $os1->expects($this->at(2))\n            ->method('read')\n            ->will($this->returnValue(false));\n\n        $os2 = $this->_createOutputStream();\n        $os2->expects($this->at(0))\n            ->method('read')\n            ->will($this->returnValue('xyz'));\n        $os2->expects($this->at(1))\n            ->method('read')\n            ->will($this->returnValue('uvw'));\n        $os2->expects($this->at(2))\n            ->method('read')\n            ->will($this->returnValue(false));\n\n        $is = $this->_createKeyCacheInputStream(true);\n\n        $cache = $this->_createCache($is);\n\n        $cache->importFromByteStream(\n            $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND\n            );\n        $cache->importFromByteStream(\n            $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND\n            );\n\n        $this->assertEquals('abcdefxyzuvw', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testByteStreamAndStringCanBeAppended() {\n        $os = $this->_createOutputStream();\n        $os->expects($this->at(0))\n           ->method('read')\n           ->will($this->returnValue('abc'));\n        $os->expects($this->at(1))\n           ->method('read')\n           ->will($this->returnValue('def'));\n        $os->expects($this->at(2))\n           ->method('read')\n           ->will($this->returnValue(false));\n\n        $is = $this->_createKeyCacheInputStream(true);\n\n        $cache = $this->_createCache($is);\n\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND\n            );\n        $cache->importFromByteStream(\n            $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND\n            );\n        $this->assertEquals('testabcdef', $cache->getString($this->_key1, 'foo'));\n    }\n\n    public function testDataCanBeExportedToByteStream() {\n        //See acceptance test for more detail\n        $is = $this->_createInputStream();\n        $is->expects($this->atLeastOnce())\n           ->method('write');\n\n        $kcis = $this->_createKeyCacheInputStream(true);\n\n        $cache = $this->_createCache($kcis);\n\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n\n        $cache->exportToByteStream($this->_key1, 'foo', $is);\n    }\n\n    public function testKeyCanBeCleared() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($cache->hasKey($this->_key1, 'foo'));\n        $cache->clearKey($this->_key1, 'foo');\n        $this->assertFalse($cache->hasKey($this->_key1, 'foo'));\n    }\n\n    public function testNsKeyCanBeCleared() {\n        $is = $this->_createKeyCacheInputStream();\n        $cache = $this->_createCache($is);\n\n        $cache->setString(\n            $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE\n            );\n        $cache->setString(\n            $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE\n            );\n        $this->assertTrue($cache->hasKey($this->_key1, 'foo'));\n        $this->assertTrue($cache->hasKey($this->_key1, 'bar'));\n        $cache->clearAll($this->_key1);\n        $this->assertFalse($cache->hasKey($this->_key1, 'foo'));\n        $this->assertFalse($cache->hasKey($this->_key1, 'bar'));\n    }\n\n    // -- Creation methods\n\n    private function _createCache($is) {\n        return new Swift_KeyCache_ArrayKeyCache($is);\n    }\n\n    private function _createKeyCacheInputStream() {\n        return $this->getMock('Swift_KeyCache_KeyCacheInputStream');\n    }\n\n    private function _createOutputStream() {\n        return $this->getMock('Swift_OutputByteStream');\n    }\n\n    private function _createInputStream() {\n        return $this->getMock('Swift_InputByteStream');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php",
    "content": "<?php\n\nclass Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \\PHPUnit_Framework_TestCase{\n    private $_nsKey = 'ns1';\n\n    public function testStreamWritesToCacheInAppendMode() {\n        $cache = $this->getMock('Swift_KeyCache');\n        $cache->expects($this->at(0))\n              ->method('setString')\n              ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);\n        $cache->expects($this->at(1))\n              ->method('setString')\n              ->with($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);\n        $cache->expects($this->at(2))\n              ->method('setString')\n              ->with($this->_nsKey, 'foo', 'c', Swift_KeyCache::MODE_APPEND);\n\n        $stream = new Swift_KeyCache_SimpleKeyCacheInputStream();\n        $stream->setKeyCache($cache);\n        $stream->setNsKey($this->_nsKey);\n        $stream->setItemKey('foo');\n\n        $stream->write('a');\n        $stream->write('b');\n        $stream->write('c');\n    }\n\n    public function testFlushContentClearsKey() {\n        $cache = $this->getMock('Swift_KeyCache');\n        $cache->expects($this->once())\n              ->method('clearKey')\n              ->with($this->_nsKey, 'foo');\n\n        $stream = new Swift_KeyCache_SimpleKeyCacheInputStream();\n        $stream->setKeyCache($cache);\n        $stream->setNsKey($this->_nsKey);\n        $stream->setItemKey('foo');\n\n        $stream->flushBuffers();\n    }\n\n    public function testClonedStreamStillReferencesSameCache() {\n        $cache = $this->getMock('Swift_KeyCache');\n        $cache->expects($this->at(0))\n              ->method('setString')\n              ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);\n        $cache->expects($this->at(1))\n              ->method('setString')\n              ->with($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);\n        $cache->expects($this->at(2))\n              ->method('setString')\n              ->with('test', 'bar', 'x', Swift_KeyCache::MODE_APPEND);\n\n        $stream = new Swift_KeyCache_SimpleKeyCacheInputStream();\n        $stream->setKeyCache($cache);\n        $stream->setNsKey($this->_nsKey);\n        $stream->setItemKey('foo');\n\n        $stream->write('a');\n        $stream->write('b');\n\n        $newStream = clone $stream;\n        $newStream->setKeyCache($cache);\n        $newStream->setNsKey('test');\n        $newStream->setItemKey('bar');\n\n        $newStream->write('x');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php",
    "content": "<?php\n\nclass Swift_Mailer_ArrayRecipientIteratorTest extends \\PHPUnit_Framework_TestCase{\n    public function testHasNextReturnsFalseForEmptyArray() {\n        $it = new Swift_Mailer_ArrayRecipientIterator(array());\n        $this->assertFalse($it->hasNext());\n    }\n\n    public function testHasNextReturnsTrueIfItemsLeft() {\n        $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));\n        $this->assertTrue($it->hasNext());\n    }\n\n    public function testReadingToEndOfListCausesHasNextToReturnFalse() {\n        $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));\n        $this->assertTrue($it->hasNext());\n        $it->nextRecipient();\n        $this->assertFalse($it->hasNext());\n    }\n\n    public function testReturnedValueHasPreservedKeyValuePair() {\n        $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));\n        $this->assertEquals(array('foo@bar' => 'Foo'), $it->nextRecipient());\n    }\n\n    public function testIteratorMovesNextAfterEachIteration() {\n        $it = new Swift_Mailer_ArrayRecipientIterator(array(\n            'foo@bar' => 'Foo',\n            'zip@button' => 'Zip thing',\n            'test@test' => null,\n            ));\n        $this->assertEquals(array('foo@bar' => 'Foo'), $it->nextRecipient());\n        $this->assertEquals(array('zip@button' => 'Zip thing'), $it->nextRecipient());\n        $this->assertEquals(array('test@test' => null), $it->nextRecipient());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/MailerTest.php",
    "content": "<?php\n\nclass Swift_MailerTest extends \\SwiftMailerTestCase{\n    public function testTransportIsStartedWhenSending() {\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n\n        $started = false;\n        $transport->shouldReceive('isStarted')\n                  ->zeroOrMoreTimes()\n                  ->andReturnUsing(function () use (&$started) {\n                      return $started;\n                  });\n        $transport->shouldReceive('start')\n                  ->once()\n                  ->andReturnUsing(function () use (&$started) {\n                      $started = true;\n\n                      return;\n                  });\n\n        $mailer = $this->_createMailer($transport);\n        $mailer->send($message);\n    }\n\n    public function testTransportIsOnlyStartedOnce() {\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n\n        $started = false;\n        $transport->shouldReceive('isStarted')\n                  ->zeroOrMoreTimes()\n                  ->andReturnUsing(function () use (&$started) {\n                      return $started;\n                  });\n        $transport->shouldReceive('start')\n                  ->once()\n                  ->andReturnUsing(function () use (&$started) {\n                      $started = true;\n\n                      return;\n                  });\n\n        $mailer = $this->_createMailer($transport);\n        for ($i = 0; $i < 10; ++$i) {\n            $mailer->send($message);\n        }\n    }\n\n    public function testMessageIsPassedToTransport() {\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n        $transport->shouldReceive('send')\n                  ->once()\n                  ->with($message, \\Mockery::any());\n\n        $mailer = $this->_createMailer($transport);\n        $mailer->send($message);\n    }\n\n    public function testSendReturnsCountFromTransport() {\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n        $transport->shouldReceive('send')\n                  ->once()\n                  ->with($message, \\Mockery::any())\n                  ->andReturn(57);\n\n        $mailer = $this->_createMailer($transport);\n        $this->assertEquals(57, $mailer->send($message));\n    }\n\n    public function testFailedRecipientReferenceIsPassedToTransport() {\n        $failures = array();\n\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n        $transport->shouldReceive('send')\n                  ->once()\n                  ->with($message, $failures)\n                  ->andReturn(57);\n\n        $mailer = $this->_createMailer($transport);\n        $mailer->send($message, $failures);\n    }\n\n    public function testSendRecordsRfcComplianceExceptionAsEntireSendFailure() {\n        $failures = array();\n\n        $rfcException = new Swift_RfcComplianceException('test');\n        $transport = $this->_createTransport();\n        $message = $this->_createMessage();\n        $message->shouldReceive('getTo')\n                  ->once()\n                  ->andReturn(array('foo&invalid' => 'Foo', 'bar@valid.tld' => 'Bar'));\n        $transport->shouldReceive('send')\n                  ->once()\n                  ->with($message, $failures)\n                  ->andThrow($rfcException);\n\n        $mailer = $this->_createMailer($transport);\n        $this->assertEquals(0, $mailer->send($message, $failures), '%s: Should return 0');\n        $this->assertEquals(array('foo&invalid', 'bar@valid.tld'), $failures, '%s: Failures should contain all addresses since the entire message failed to compile');\n    }\n\n    public function testRegisterPluginDelegatesToTransport() {\n        $plugin = $this->_createPlugin();\n        $transport = $this->_createTransport();\n        $mailer = $this->_createMailer($transport);\n\n        $transport->shouldReceive('registerPlugin')\n                  ->once()\n                  ->with($plugin);\n\n        $mailer->registerPlugin($plugin);\n    }\n\n    // -- Creation methods\n\n    private function _createPlugin() {\n        return $this->getMockery('Swift_Events_EventListener')->shouldIgnoreMissing();\n    }\n\n    private function _createTransport() {\n        return $this->getMockery('Swift_Transport')->shouldIgnoreMissing();\n    }\n\n    private function _createMessage() {\n        return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n    }\n\n    private function _createMailer(Swift_Transport $transport) {\n        return new Swift_Mailer($transport);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/MessageTest.php",
    "content": "<?php\n\nclass Swift_MessageTest extends \\PHPUnit_Framework_TestCase{\n    public function testCloning() {\n        $message1 = new Swift_Message('subj', 'body', 'ctype');\n        $message2 = new Swift_Message('subj', 'body', 'ctype');\n        $message1_clone = clone $message1;\n\n        $this->_recursiveObjectCloningCheck($message1, $message2, $message1_clone);\n    }\n\n    public function testCloningWithSigners() {\n        $message1 = new Swift_Message('subj', 'body', 'ctype');\n        $signer = new Swift_Signers_DKIMSigner(dirname(dirname(__DIR__)).'/_samples/dkim/dkim.test.priv', 'test.example', 'example');\n        $message1->attachSigner($signer);\n        $message2 = new Swift_Message('subj', 'body', 'ctype');\n        $signer = new Swift_Signers_DKIMSigner(dirname(dirname(__DIR__)).'/_samples/dkim/dkim.test.priv', 'test.example', 'example');\n        $message2->attachSigner($signer);\n        $message1_clone = clone $message1;\n\n        $this->_recursiveObjectCloningCheck($message1, $message2, $message1_clone);\n    }\n\n    public function testBodySwap() {\n        $message1 = new Swift_Message('Test');\n        $html = Swift_MimePart::newInstance('<html></html>', 'text/html');\n        $html->getHeaders()->addTextHeader('X-Test-Remove', 'Test-Value');\n        $html->getHeaders()->addTextHeader('X-Test-Alter', 'Test-Value');\n        $message1->attach($html);\n        $source = $message1->toString();\n        $message2 = clone $message1;\n        $message2->setSubject('Message2');\n        foreach ($message2->getChildren() as $child) {\n            $child->setBody('Test');\n            $child->getHeaders()->removeAll('X-Test-Remove');\n            $child->getHeaders()->get('X-Test-Alter')->setValue('Altered');\n        }\n        $final = $message1->toString();\n        if ($source != $final) {\n            $this->fail(\"Difference although object cloned \\n [\".$source.\"]\\n[\".$final.\"]\\n\");\n        }\n        $final = $message2->toString();\n        if ($final == $source) {\n            $this->fail('Two body matches although they should differ'.\"\\n [\".$source.\"]\\n[\".$final.\"]\\n\");\n        }\n        $id_1 = $message1->getId();\n        $id_2 = $message2->getId();\n        $this->assertEquals($id_1, $id_2, 'Message Ids differ');\n        $id_2 = $message2->generateId();\n        $this->assertNotEquals($id_1, $id_2, 'Message Ids are the same');\n    }\n\n    // -- Private helpers\n    protected function _recursiveObjectCloningCheck($obj1, $obj2, $obj1_clone) {\n        $obj1_properties = (array) $obj1;\n        $obj2_properties = (array) $obj2;\n        $obj1_clone_properties = (array) $obj1_clone;\n\n        foreach ($obj1_properties as $property => $value) {\n            if (is_object($value)) {\n                $obj1_value = $obj1_properties[$property];\n                $obj2_value = $obj2_properties[$property];\n                $obj1_clone_value = $obj1_clone_properties[$property];\n\n                if ($obj1_value !== $obj2_value) {\n                    // two separetely instanciated objects property not referencing same object\n                    $this->assertFalse(\n                        // but object's clone does - not everything copied\n                        $obj1_value === $obj1_clone_value,\n                        \"Property `$property` cloning error: source and cloned objects property is referencing same object\"\n                    );\n                } else {\n                    // two separetely instanciated objects have same reference\n                    $this->assertFalse(\n                        // but object's clone doesn't - overdone making copies\n                        $obj1_value !== $obj1_clone_value,\n                        \"Property `$property` not properly cloned: it should reference same object as cloning source (overdone copping)\"\n                    );\n                }\n                // recurse\n                $this->_recursiveObjectCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);\n            } elseif (is_array($value)) {\n                $obj1_value = $obj1_properties[$property];\n                $obj2_value = $obj2_properties[$property];\n                $obj1_clone_value = $obj1_clone_properties[$property];\n\n                return $this->_recursiveArrayCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);\n            }\n        }\n    }\n\n    protected function _recursiveArrayCloningCheck($array1, $array2, $array1_clone) {\n        foreach ($array1 as $key => $value) {\n            if (is_object($value)) {\n                $arr1_value = $array1[$key];\n                $arr2_value = $array2[$key];\n                $arr1_clone_value = $array1_clone[$key];\n                if ($arr1_value !== $arr2_value) {\n                    // two separetely instanciated objects property not referencing same object\n                    $this->assertFalse(\n                        // but object's clone does - not everything copied\n                        $arr1_value === $arr1_clone_value,\n                        \"Key `$key` cloning error: source and cloned objects property is referencing same object\"\n                    );\n                } else {\n                    // two separetely instanciated objects have same reference\n                    $this->assertFalse(\n                        // but object's clone doesn't - overdone making copies\n                        $arr1_value !== $arr1_clone_value,\n                        \"Key `$key` not properly cloned: it should reference same object as cloning source (overdone copping)\"\n                    );\n                }\n                // recurse\n                $this->_recursiveObjectCloningCheck($arr1_value, $arr2_value, $arr1_clone_value);\n            } elseif (is_array($value)) {\n                $arr1_value = $array1[$key];\n                $arr2_value = $array2[$key];\n                $arr1_clone_value = $array1_clone[$key];\n\n                return $this->_recursiveArrayCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php",
    "content": "<?php\n\nrequire_once dirname(dirname(dirname(__DIR__))).'/fixtures/MimeEntityFixture.php';\n\nabstract class Swift_Mime_AbstractMimeEntityTest extends \\SwiftMailerTestCase{\n    public function testGetHeadersReturnsHeaderSet() {\n        $headers = $this->_createHeaderSet();\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $this->assertSame($headers, $entity->getHeaders());\n    }\n\n    public function testContentTypeIsReturnedFromHeader() {\n        $ctype = $this->_createHeader('Content-Type', 'image/jpeg-test');\n        $headers = $this->_createHeaderSet(array('Content-Type' => $ctype));\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $this->assertEquals('image/jpeg-test', $entity->getContentType());\n    }\n\n    public function testContentTypeIsSetInHeader() {\n        $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $headers = $this->_createHeaderSet(array('Content-Type' => $ctype));\n\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with('image/jpeg');\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->zeroOrMoreTimes()\n              ->with(\\Mockery::not('image/jpeg'));\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setContentType('image/jpeg');\n    }\n\n    public function testContentTypeHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addParameterizedHeader')\n                ->once()\n                ->with('Content-Type', 'image/jpeg');\n        $headers->shouldReceive('addParameterizedHeader')\n                ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setContentType('image/jpeg');\n    }\n\n    public function testContentTypeCanBeSetViaSetBody() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addParameterizedHeader')\n                ->once()\n                ->with('Content-Type', 'text/html');\n        $headers->shouldReceive('addParameterizedHeader')\n                ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBody('<b>foo</b>', 'text/html');\n    }\n\n    public function testGetEncoderFromConstructor() {\n        $encoder = $this->_createEncoder('base64');\n        $entity = $this->_createEntity($this->_createHeaderSet(), $encoder,\n            $this->_createCache()\n            );\n        $this->assertSame($encoder, $entity->getEncoder());\n    }\n\n    public function testSetAndGetEncoder() {\n        $encoder = $this->_createEncoder('base64');\n        $headers = $this->_createHeaderSet();\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setEncoder($encoder);\n        $this->assertSame($encoder, $entity->getEncoder());\n    }\n\n    public function testSettingEncoderUpdatesTransferEncoding() {\n        $encoder = $this->_createEncoder('base64');\n        $encoding = $this->_createHeader(\n            'Content-Transfer-Encoding', '8bit', array(), false\n            );\n        $headers = $this->_createHeaderSet(array(\n            'Content-Transfer-Encoding' => $encoding,\n            ));\n        $encoding->shouldReceive('setFieldBodyModel')\n                 ->once()\n                 ->with('base64');\n        $encoding->shouldReceive('setFieldBodyModel')\n                 ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setEncoder($encoder);\n    }\n\n    public function testSettingEncoderAddsEncodingHeaderIfNonePresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addTextHeader')\n                ->once()\n                ->with('Content-Transfer-Encoding', 'something');\n        $headers->shouldReceive('addTextHeader')\n                ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setEncoder($this->_createEncoder('something'));\n    }\n\n    public function testIdIsReturnedFromHeader() {\n        /* -- RFC 2045, 7.\n        In constructing a high-level user agent, it may be desirable to allow\n        one body to make reference to another.  Accordingly, bodies may be\n        labelled using the \"Content-ID\" header field, which is syntactically\n        identical to the \"Message-ID\" header field\n        */\n\n        $cid = $this->_createHeader('Content-ID', 'zip@button');\n        $headers = $this->_createHeaderSet(array('Content-ID' => $cid));\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $this->assertEquals('zip@button', $entity->getId());\n    }\n\n    public function testIdIsSetInHeader() {\n        $cid = $this->_createHeader('Content-ID', 'zip@button', array(), false);\n        $headers = $this->_createHeaderSet(array('Content-ID' => $cid));\n\n        $cid->shouldReceive('setFieldBodyModel')\n            ->once()\n            ->with('foo@bar');\n        $cid->shouldReceive('setFieldBodyModel')\n            ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setId('foo@bar');\n    }\n\n    public function testIdIsAutoGenerated() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertRegExp('/^.*?@.*?$/D', $entity->getId());\n    }\n\n    public function testGenerateIdCreatesNewId() {\n        $headers = $this->_createHeaderSet();\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $id1 = $entity->generateId();\n        $id2 = $entity->generateId();\n        $this->assertNotEquals($id1, $id2);\n    }\n\n    public function testGenerateIdSetsNewId() {\n        $headers = $this->_createHeaderSet();\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $id = $entity->generateId();\n        $this->assertEquals($id, $entity->getId());\n    }\n\n    public function testDescriptionIsReadFromHeader() {\n        /* -- RFC 2045, 8.\n        The ability to associate some descriptive information with a given\n        body is often desirable.  For example, it may be useful to mark an\n        \"image\" body as \"a picture of the Space Shuttle Endeavor.\"  Such text\n        may be placed in the Content-Description header field.  This header\n        field is always optional.\n        */\n\n        $desc = $this->_createHeader('Content-Description', 'something');\n        $headers = $this->_createHeaderSet(array('Content-Description' => $desc));\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $this->assertEquals('something', $entity->getDescription());\n    }\n\n    public function testDescriptionIsSetInHeader() {\n        $desc = $this->_createHeader('Content-Description', '', array(), false);\n        $desc->shouldReceive('setFieldBodyModel')->once()->with('whatever');\n\n        $headers = $this->_createHeaderSet(array('Content-Description' => $desc));\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setDescription('whatever');\n    }\n\n    public function testDescriptionHeaderIsAddedIfNotPresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addTextHeader')\n                ->once()\n                ->with('Content-Description', 'whatever');\n        $headers->shouldReceive('addTextHeader')\n                ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setDescription('whatever');\n    }\n\n    public function testSetAndGetMaxLineLength() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setMaxLineLength(60);\n        $this->assertEquals(60, $entity->getMaxLineLength());\n    }\n\n    public function testEncoderIsUsedForStringGeneration() {\n        $encoder = $this->_createEncoder('base64', false);\n        $encoder->expects($this->once())\n                ->method('encodeString')\n                ->with('blah');\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $encoder, $this->_createCache()\n            );\n        $entity->setBody('blah');\n        $entity->toString();\n    }\n\n    public function testMaxLineLengthIsProvidedWhenEncoding() {\n        $encoder = $this->_createEncoder('base64', false);\n        $encoder->expects($this->once())\n                ->method('encodeString')\n                ->with('blah', 0, 65);\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $encoder, $this->_createCache()\n            );\n        $entity->setBody('blah');\n        $entity->setMaxLineLength(65);\n        $entity->toString();\n    }\n\n    public function testHeadersAppearInString() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->once()\n                ->andReturn(\n                    \"Content-Type: text/plain; charset=utf-8\\r\\n\".\n                    \"X-MyHeader: foobar\\r\\n\"\n                );\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $this->assertEquals(\n            \"Content-Type: text/plain; charset=utf-8\\r\\n\".\n            \"X-MyHeader: foobar\\r\\n\",\n            $entity->toString()\n            );\n    }\n\n    public function testSetAndGetBody() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $this->assertEquals(\"blah\\r\\nblah!\", $entity->getBody());\n    }\n\n    public function testBodyIsAppended() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->once()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $this->assertEquals(\n            \"Content-Type: text/plain; charset=utf-8\\r\\n\".\n            \"\\r\\n\".\n            \"blah\\r\\nblah!\",\n            $entity->toString()\n            );\n    }\n\n    public function testGetBodyReturnsStringFromByteStream() {\n        $os = $this->_createOutputStream('byte stream string');\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setBody($os);\n        $this->assertEquals('byte stream string', $entity->getBody());\n    }\n\n    public function testByteStreamBodyIsAppended() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $os = $this->_createOutputStream('streamed');\n        $headers->shouldReceive('toString')\n                ->once()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBody($os);\n        $this->assertEquals(\n            \"Content-Type: text/plain; charset=utf-8\\r\\n\".\n            \"\\r\\n\".\n            'streamed',\n            $entity->toString()\n            );\n    }\n\n    public function testBoundaryCanBeRetrieved() {\n        /* -- RFC 2046, 5.1.1.\n     boundary := 0*69<bchars> bcharsnospace\n\n     bchars := bcharsnospace / \" \"\n\n     bcharsnospace := DIGIT / ALPHA / \"'\" / \"(\" / \")\" /\n                                            \"+\" / \"_\" / \",\" / \"-\" / \".\" /\n                                            \"/\" / \":\" / \"=\" / \"?\"\n        */\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertRegExp(\n            '/^[a-zA-Z0-9\\'\\(\\)\\+_\\-,\\.\\/:=\\?\\ ]{0,69}[a-zA-Z0-9\\'\\(\\)\\+_\\-,\\.\\/:=\\?]$/D',\n            $entity->getBoundary()\n            );\n    }\n\n    public function testBoundaryNeverChanges() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $firstBoundary = $entity->getBoundary();\n        for ($i = 0; $i < 10; ++$i) {\n            $this->assertEquals($firstBoundary, $entity->getBoundary());\n        }\n    }\n\n    public function testBoundaryCanBeSet() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setBoundary('foobar');\n        $this->assertEquals('foobar', $entity->getBoundary());\n    }\n\n    public function testAddingChildrenGeneratesBoundaryInHeaders() {\n        $child = $this->_createChild();\n        $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $cType->shouldReceive('setParameter')\n              ->once()\n              ->with('boundary', \\Mockery::any());\n        $cType->shouldReceive('setParameter')\n              ->zeroOrMoreTimes();\n\n        $entity = $this->_createEntity($this->_createHeaderSet(array(\n            'Content-Type' => $cType,\n            )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setChildren(array($child));\n    }\n\n    public function testChildrenOfLevelAttachmentAndLessCauseMultipartMixed() {\n        for ($level = Swift_Mime_MimeEntity::LEVEL_MIXED;\n            $level > Swift_Mime_MimeEntity::LEVEL_TOP; $level /= 2) {\n            $child = $this->_createChild($level);\n            $cType = $this->_createHeader(\n                'Content-Type', 'text/plain', array(), false\n                );\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->once()\n                  ->with('multipart/mixed');\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->zeroOrMoreTimes();\n\n            $entity = $this->_createEntity($this->_createHeaderSet(array(\n                'Content-Type' => $cType, )),\n                $this->_createEncoder(), $this->_createCache()\n                );\n            $entity->setChildren(array($child));\n        }\n    }\n\n    public function testChildrenOfLevelAlternativeAndLessCauseMultipartAlternative() {\n        for ($level = Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE;\n            $level > Swift_Mime_MimeEntity::LEVEL_MIXED; $level /= 2) {\n            $child = $this->_createChild($level);\n            $cType = $this->_createHeader(\n                'Content-Type', 'text/plain', array(), false\n                );\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->once()\n                  ->with('multipart/alternative');\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->zeroOrMoreTimes();\n\n            $entity = $this->_createEntity($this->_createHeaderSet(array(\n                'Content-Type' => $cType, )),\n                $this->_createEncoder(), $this->_createCache()\n                );\n            $entity->setChildren(array($child));\n        }\n    }\n\n    public function testChildrenOfLevelRelatedAndLessCauseMultipartRelated() {\n        for ($level = Swift_Mime_MimeEntity::LEVEL_RELATED;\n            $level > Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE; $level /= 2) {\n            $child = $this->_createChild($level);\n            $cType = $this->_createHeader(\n                'Content-Type', 'text/plain', array(), false\n                );\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->once()\n                  ->with('multipart/related');\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->zeroOrMoreTimes();\n\n            $entity = $this->_createEntity($this->_createHeaderSet(array(\n                'Content-Type' => $cType, )),\n                $this->_createEncoder(), $this->_createCache()\n                );\n            $entity->setChildren(array($child));\n        }\n    }\n\n    public function testHighestLevelChildDeterminesContentType() {\n        $combinations = array(\n            array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,\n                Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n                Swift_Mime_MimeEntity::LEVEL_RELATED,\n                ),\n                'type' => 'multipart/mixed',\n                ),\n            array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,\n                Swift_Mime_MimeEntity::LEVEL_RELATED,\n                ),\n                'type' => 'multipart/mixed',\n                ),\n            array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,\n                Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n                ),\n                'type' => 'multipart/mixed',\n                ),\n            array('levels' => array(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n                Swift_Mime_MimeEntity::LEVEL_RELATED,\n                ),\n                'type' => 'multipart/alternative',\n                ),\n            );\n\n        foreach ($combinations as $combination) {\n            $children = array();\n            foreach ($combination['levels'] as $level) {\n                $children[] = $this->_createChild($level);\n            }\n\n            $cType = $this->_createHeader(\n                'Content-Type', 'text/plain', array(), false\n                );\n            $cType->shouldReceive('setFieldBodyModel')\n                  ->once()\n                  ->with($combination['type']);\n\n            $headerSet = $this->_createHeaderSet(array('Content-Type' => $cType));\n            $headerSet->shouldReceive('newInstance')\n                      ->zeroOrMoreTimes()\n                      ->andReturnUsing(function () use ($headerSet) {\n                          return $headerSet;\n                      });\n            $entity = $this->_createEntity($headerSet,\n                $this->_createEncoder(), $this->_createCache()\n                );\n            $entity->setChildren($children);\n        }\n    }\n\n    public function testChildrenAppearNestedInString() {\n        /* -- RFC 2046, 5.1.1.\n     (excerpt too verbose to paste here)\n     */\n\n        $headers = $this->_createHeaderSet(array(), false);\n\n        $child1 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            'foobar', 'text/plain'\n            );\n\n        $child2 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n            \"Content-Type: text/html\\r\\n\".\n            \"\\r\\n\".\n            '<b>foobar</b>', 'text/html'\n            );\n\n        $headers->shouldReceive('toString')\n              ->zeroOrMoreTimes()\n              ->andReturn(\"Content-Type: multipart/alternative; boundary=\\\"xxx\\\"\\r\\n\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBoundary('xxx');\n        $entity->setChildren(array($child1, $child2));\n\n        $this->assertEquals(\n            \"Content-Type: multipart/alternative; boundary=\\\"xxx\\\"\\r\\n\".\n            \"\\r\\n\".\n            \"\\r\\n--xxx\\r\\n\".\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            \"foobar\\r\\n\".\n            \"\\r\\n--xxx\\r\\n\".\n            \"Content-Type: text/html\\r\\n\".\n            \"\\r\\n\".\n            \"<b>foobar</b>\\r\\n\".\n            \"\\r\\n--xxx--\\r\\n\",\n            $entity->toString()\n            );\n    }\n\n    public function testMixingLevelsIsHierarchical() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $newHeaders = $this->_createHeaderSet(array(), false);\n\n        $part = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            'foobar'\n            );\n\n        $attachment = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_MIXED,\n            \"Content-Type: application/octet-stream\\r\\n\".\n            \"\\r\\n\".\n            'data'\n            );\n\n        $headers->shouldReceive('toString')\n              ->zeroOrMoreTimes()\n              ->andReturn(\"Content-Type: multipart/mixed; boundary=\\\"xxx\\\"\\r\\n\");\n        $headers->shouldReceive('newInstance')\n              ->zeroOrMoreTimes()\n              ->andReturn($newHeaders);\n        $newHeaders->shouldReceive('toString')\n              ->zeroOrMoreTimes()\n              ->andReturn(\"Content-Type: multipart/alternative; boundary=\\\"yyy\\\"\\r\\n\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBoundary('xxx');\n        $entity->setChildren(array($part, $attachment));\n\n        $this->assertRegExp(\n            '~^'.\n            \"Content-Type: multipart/mixed; boundary=\\\"xxx\\\"\\r\\n\".\n            \"\\r\\n\\r\\n--xxx\\r\\n\".\n            \"Content-Type: multipart/alternative; boundary=\\\"yyy\\\"\\r\\n\".\n            \"\\r\\n\\r\\n--(.*?)\\r\\n\".\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            'foobar'.\n            \"\\r\\n\\r\\n--\\\\1--\\r\\n\".\n            \"\\r\\n\\r\\n--xxx\\r\\n\".\n            \"Content-Type: application/octet-stream\\r\\n\".\n            \"\\r\\n\".\n            'data'.\n            \"\\r\\n\\r\\n--xxx--\\r\\n\".\n            '$~',\n            $entity->toString()\n            );\n    }\n\n    public function testSettingEncoderNotifiesChildren() {\n        $child = $this->_createChild(0, '', false);\n        $encoder = $this->_createEncoder('base64');\n\n        $child->shouldReceive('encoderChanged')\n              ->once()\n              ->with($encoder);\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setChildren(array($child));\n        $entity->setEncoder($encoder);\n    }\n\n    public function testReceiptOfEncoderChangeNotifiesChildren() {\n        $child = $this->_createChild(0, '', false);\n        $encoder = $this->_createEncoder('base64');\n\n        $child->shouldReceive('encoderChanged')\n              ->once()\n              ->with($encoder);\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setChildren(array($child));\n        $entity->encoderChanged($encoder);\n    }\n\n    public function testReceiptOfCharsetChangeNotifiesChildren() {\n        $child = $this->_createChild(0, '', false);\n        $child->shouldReceive('charsetChanged')\n              ->once()\n              ->with('windows-874');\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $entity->setChildren(array($child));\n        $entity->charsetChanged('windows-874');\n    }\n\n    public function testEntityIsWrittenToByteStream() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $is = $this->_createInputStream(false);\n        $is->expects($this->atLeastOnce())\n           ->method('write');\n\n        $entity->toByteStream($is);\n    }\n\n    public function testEntityHeadersAreComittedToByteStream() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $is = $this->_createInputStream(false);\n        $is->expects($this->atLeastOnce())\n           ->method('write');\n        $is->expects($this->atLeastOnce())\n           ->method('commit');\n\n        $entity->toByteStream($is);\n    }\n\n    public function testOrderingTextBeforeHtml() {\n        $htmlChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n            \"Content-Type: text/html\\r\\n\".\n            \"\\r\\n\".\n            'HTML PART',\n            'text/html'\n            );\n        $textChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            'TEXT PART',\n            'text/plain'\n            );\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: multipart/alternative; boundary=\\\"xxx\\\"\\r\\n\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $entity->setBoundary('xxx');\n        $entity->setChildren(array($htmlChild, $textChild));\n\n        $this->assertEquals(\n            \"Content-Type: multipart/alternative; boundary=\\\"xxx\\\"\\r\\n\".\n            \"\\r\\n\\r\\n--xxx\\r\\n\".\n            \"Content-Type: text/plain\\r\\n\".\n            \"\\r\\n\".\n            'TEXT PART'.\n            \"\\r\\n\\r\\n--xxx\\r\\n\".\n            \"Content-Type: text/html\\r\\n\".\n            \"\\r\\n\".\n            'HTML PART'.\n            \"\\r\\n\\r\\n--xxx--\\r\\n\",\n            $entity->toString()\n            );\n    }\n\n    public function testUnsettingChildrenRestoresContentType() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE);\n\n        $cType->shouldReceive('setFieldBodyModel')\n              ->twice()\n              ->with('image/jpeg');\n        $cType->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with('multipart/alternative');\n        $cType->shouldReceive('setFieldBodyModel')\n              ->zeroOrMoreTimes()\n              ->with(\\Mockery::not('multipart/alternative', 'image/jpeg'));\n\n        $entity = $this->_createEntity($this->_createHeaderSet(array(\n            'Content-Type' => $cType,\n            )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $entity->setContentType('image/jpeg');\n        $entity->setChildren(array($child));\n        $entity->setChildren(array());\n    }\n\n    public function testBodyIsReadFromCacheWhenUsingToStringIfPresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n        $cache->shouldReceive('hasKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body')\n              ->andReturn(true);\n        $cache->shouldReceive('getString')\n              ->once()\n              ->with(\\Mockery::any(), 'body')\n              ->andReturn(\"\\r\\ncache\\r\\ncache!\");\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $this->assertEquals(\n            \"Content-Type: text/plain; charset=utf-8\\r\\n\".\n            \"\\r\\n\".\n            \"cache\\r\\ncache!\",\n            $entity->toString()\n            );\n    }\n\n    public function testBodyIsAddedToCacheWhenUsingToString() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n        $cache->shouldReceive('hasKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body')\n              ->andReturn(false);\n        $cache->shouldReceive('setString')\n              ->once()\n              ->with(\\Mockery::any(), 'body', \"\\r\\nblah\\r\\nblah!\", Swift_KeyCache::MODE_WRITE);\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $entity->toString();\n    }\n\n    public function testBodyIsClearedFromCacheIfNewBodySet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $entity->toString();\n\n        // We set the expectation at this point because we only care what happens when calling setBody()\n        $cache->shouldReceive('clearKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body');\n\n        $entity->setBody(\"new\\r\\nnew!\");\n    }\n\n    public function testBodyIsNotClearedFromCacheIfSameBodySet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $entity->toString();\n\n        // We set the expectation at this point because we only care what happens when calling setBody()\n        $cache->shouldReceive('clearKey')\n              ->never();\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n    }\n\n    public function testBodyIsClearedFromCacheIfNewEncoderSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n        $otherEncoder = $this->_createEncoder();\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $entity->toString();\n\n        // We set the expectation at this point because we only care what happens when calling setEncoder()\n        $cache->shouldReceive('clearKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body');\n\n        $entity->setEncoder($otherEncoder);\n    }\n\n    public function testBodyIsReadFromCacheWhenUsingToByteStreamIfPresent() {\n        $is = $this->_createInputStream();\n        $cache = $this->_createCache(false);\n        $cache->shouldReceive('hasKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body')\n              ->andReturn(true);\n        $cache->shouldReceive('exportToByteStream')\n              ->once()\n              ->with(\\Mockery::any(), 'body', $is);\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $cache\n            );\n        $entity->setBody('foo');\n\n        $entity->toByteStream($is);\n    }\n\n    public function testBodyIsAddedToCacheWhenUsingToByteStream() {\n        $is = $this->_createInputStream();\n        $cache = $this->_createCache(false);\n        $cache->shouldReceive('hasKey')\n              ->once()\n              ->with(\\Mockery::any(), 'body')\n              ->andReturn(false);\n        $cache->shouldReceive('getInputByteStream')\n              ->once()\n              ->with(\\Mockery::any(), 'body');\n\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $cache\n            );\n        $entity->setBody('foo');\n\n        $entity->toByteStream($is);\n    }\n\n    public function testFluidInterface() {\n        $entity = $this->_createEntity($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $this->assertSame($entity,\n            $entity\n            ->setContentType('text/plain')\n            ->setEncoder($this->_createEncoder())\n            ->setId('foo@bar')\n            ->setDescription('my description')\n            ->setMaxLineLength(998)\n            ->setBody('xx')\n            ->setBoundary('xyz')\n            ->setChildren(array())\n            );\n    }\n\n    // -- Private helpers\n\n    abstract protected function _createEntity($headers, $encoder, $cache);\n\n    protected function _createChild($level = null, $string = '', $stub = true) {\n        $child = $this->getMockery('Swift_Mime_MimeEntity')->shouldIgnoreMissing();\n        if (isset($level)) {\n            $child->shouldReceive('getNestingLevel')\n                  ->zeroOrMoreTimes()\n                  ->andReturn($level);\n        }\n        $child->shouldReceive('toString')\n              ->zeroOrMoreTimes()\n              ->andReturn($string);\n\n        return $child;\n    }\n\n    protected function _createEncoder($name = 'quoted-printable', $stub = true) {\n        $encoder = $this->getMock('Swift_Mime_ContentEncoder');\n        $encoder->expects($this->any())\n                ->method('getName')\n                ->will($this->returnValue($name));\n        $encoder->expects($this->any())\n                ->method('encodeString')\n                ->will($this->returnCallback(function () {\n                    $args = func_get_args();\n\n                    return array_shift($args);\n                }));\n\n        return $encoder;\n    }\n\n    protected function _createCache($stub = true) {\n        return $this->getMockery('Swift_KeyCache')->shouldIgnoreMissing();\n    }\n\n    protected function _createHeaderSet($headers = array(), $stub = true) {\n        $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();\n        $set->shouldReceive('get')\n            ->zeroOrMoreTimes()\n            ->andReturnUsing(function ($key) use ($headers) {\n                return $headers[$key];\n            });\n        $set->shouldReceive('has')\n            ->zeroOrMoreTimes()\n            ->andReturnUsing(function ($key) use ($headers) {\n                return array_key_exists($key, $headers);\n            });\n\n        return $set;\n    }\n\n    protected function _createHeader($name, $model = null, $params = array(), $stub = true) {\n        $header = $this->getMockery('Swift_Mime_ParameterizedHeader')->shouldIgnoreMissing();\n        $header->shouldReceive('getFieldName')\n               ->zeroOrMoreTimes()\n               ->andReturn($name);\n        $header->shouldReceive('getFieldBodyModel')\n               ->zeroOrMoreTimes()\n               ->andReturn($model);\n        $header->shouldReceive('getParameter')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing(function ($key) use ($params) {\n                   return $params[$key];\n               });\n\n        return $header;\n    }\n\n    protected function _createOutputStream($data = null, $stub = true) {\n        $os = $this->getMockery('Swift_OutputByteStream');\n        if (isset($data)) {\n            $os->shouldReceive('read')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing(function () use ($data) {\n                   static $first = true;\n                   if (!$first) {\n                       return false;\n                   }\n\n                   $first = false;\n\n                   return $data;\n               });\n            $os->shouldReceive('setReadPointer')\n              ->zeroOrMoreTimes();\n        }\n\n        return $os;\n    }\n\n    protected function _createInputStream($stub = true) {\n        return $this->getMock('Swift_InputByteStream');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php",
    "content": "<?php\n\nclass Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest{\n    public function testNestingLevelIsAttachment() {\n        $attachment = $this->_createAttachment($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(\n            Swift_Mime_MimeEntity::LEVEL_MIXED, $attachment->getNestingLevel()\n            );\n    }\n\n    public function testDispositionIsReturnedFromHeader() {\n        /* -- RFC 2183, 2.1, 2.2.\n     */\n\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment');\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('attachment', $attachment->getDisposition());\n    }\n\n    public function testDispositionIsSetInHeader() {\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array(), false\n            );\n        $disposition->shouldReceive('setFieldBodyModel')\n                    ->once()\n                    ->with('inline');\n        $disposition->shouldReceive('setFieldBodyModel')\n                    ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setDisposition('inline');\n    }\n\n    public function testDispositionIsAddedIfNonePresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addParameterizedHeader')\n                ->once()\n                ->with('Content-Disposition', 'inline');\n        $headers->shouldReceive('addParameterizedHeader')\n                ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $attachment->setDisposition('inline');\n    }\n\n    public function testDispositionIsAutoDefaultedToAttachment() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addParameterizedHeader')\n                ->once()\n                ->with('Content-Disposition', 'attachment');\n        $headers->shouldReceive('addParameterizedHeader')\n                ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n    }\n\n    public function testDefaultContentTypeInitializedToOctetStream() {\n        $cType = $this->_createHeader('Content-Type', '',\n            array(), false\n            );\n        $cType->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with('application/octet-stream');\n        $cType->shouldReceive('setFieldBodyModel')\n              ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n    }\n\n    public function testFilenameIsReturnedFromHeader() {\n        /* -- RFC 2183, 2.3.\n     */\n\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('filename' => 'foo.txt')\n            );\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('foo.txt', $attachment->getFilename());\n    }\n\n    public function testFilenameIsSetInHeader() {\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('filename' => 'foo.txt'), false\n            );\n        $disposition->shouldReceive('setParameter')\n                    ->once()\n                    ->with('filename', 'bar.txt');\n        $disposition->shouldReceive('setParameter')\n                    ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setFilename('bar.txt');\n    }\n\n    public function testSettingFilenameSetsNameInContentType() {\n        /*\n     This is a legacy requirement which isn't covered by up-to-date RFCs.\n     */\n\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array(), false\n            );\n        $cType->shouldReceive('setParameter')\n              ->once()\n              ->with('name', 'bar.txt');\n        $cType->shouldReceive('setParameter')\n              ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setFilename('bar.txt');\n    }\n\n    public function testSizeIsReturnedFromHeader() {\n        /* -- RFC 2183, 2.7.\n     */\n\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('size' => 1234)\n            );\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(1234, $attachment->getSize());\n    }\n\n    public function testSizeIsSetInHeader() {\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array(), false\n            );\n        $disposition->shouldReceive('setParameter')\n                    ->once()\n                    ->with('size', 12345);\n        $disposition->shouldReceive('setParameter')\n                    ->zeroOrMoreTimes();\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setSize(12345);\n    }\n\n    public function testFilnameCanBeReadFromFileStream() {\n        $file = $this->_createFileStream('/bar/file.ext', '');\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('filename' => 'foo.txt'), false\n            );\n        $disposition->shouldReceive('setParameter')\n                    ->once()\n                    ->with('filename', 'file.ext');\n\n        $attachment = $this->_createAttachment($this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setFile($file);\n    }\n\n    public function testContentTypeCanBeSetViaSetFile() {\n        $file = $this->_createFileStream('/bar/file.ext', '');\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('filename' => 'foo.txt'), false\n            );\n        $disposition->shouldReceive('setParameter')\n                    ->once()\n                    ->with('filename', 'file.ext');\n\n        $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with('text/html');\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->zeroOrMoreTimes();\n\n        $headers = $this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition,\n            'Content-Type' => $ctype,\n            ));\n\n        $attachment = $this->_createAttachment($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $attachment->setFile($file, 'text/html');\n    }\n\n    public function XtestContentTypeCanBeLookedUpFromCommonListIfNotProvided() {\n        $file = $this->_createFileStream('/bar/file.zip', '');\n        $disposition = $this->_createHeader('Content-Disposition', 'attachment',\n            array('filename' => 'foo.zip'), false\n            );\n        $disposition->shouldReceive('setParameter')\n                    ->once()\n                    ->with('filename', 'file.zip');\n\n        $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with('application/zip');\n        $ctype->shouldReceive('setFieldBodyModel')\n              ->zeroOrMoreTimes();\n\n        $headers = $this->_createHeaderSet(array(\n            'Content-Disposition' => $disposition,\n            'Content-Type' => $ctype,\n            ));\n\n        $attachment = $this->_createAttachment($headers, $this->_createEncoder(),\n            $this->_createCache(), array('zip' => 'application/zip', 'txt' => 'text/plain')\n            );\n        $attachment->setFile($file);\n    }\n\n    public function testDataCanBeReadFromFile() {\n        $file = $this->_createFileStream('/foo/file.ext', '<some data>');\n        $attachment = $this->_createAttachment($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $attachment->setFile($file);\n        $this->assertEquals('<some data>', $attachment->getBody());\n    }\n\n    public function testFluidInterface() {\n        $attachment = $this->_createAttachment($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertSame($attachment,\n            $attachment\n            ->setContentType('application/pdf')\n            ->setEncoder($this->_createEncoder())\n            ->setId('foo@bar')\n            ->setDescription('my pdf')\n            ->setMaxLineLength(998)\n            ->setBody('xx')\n            ->setBoundary('xyz')\n            ->setChildren(array())\n            ->setDisposition('inline')\n            ->setFilename('afile.txt')\n            ->setSize(123)\n            ->setFile($this->_createFileStream('foo.txt', ''))\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createEntity($headers, $encoder, $cache) {\n        return $this->_createAttachment($headers, $encoder, $cache);\n    }\n\n    protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array()) {\n        return new Swift_Mime_Attachment($headers, $encoder, $cache, new Swift_Mime_Grammar(), $mimeTypes);\n    }\n\n    protected function _createFileStream($path, $data, $stub = true) {\n        $file = $this->getMockery('Swift_FileStream');\n        $file->shouldReceive('getPath')\n             ->zeroOrMoreTimes()\n             ->andReturn($path);\n        $file->shouldReceive('read')\n             ->zeroOrMoreTimes()\n             ->andReturnUsing(function () use ($data) {\n                 static $first = true;\n                 if (!$first) {\n                     return false;\n                 }\n\n                 $first = false;\n\n                 return $data;\n             });\n        $file->shouldReceive('setReadPointer')\n             ->zeroOrMoreTimes();\n\n        return $file;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \\SwiftMailerTestCase{\n    private $_encoder;\n\n    public function setUp() {\n        $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n    }\n\n    public function testNameIsBase64() {\n        $this->assertEquals('base64', $this->_encoder->getName());\n    }\n\n    /*\n    There's really no point in testing the entire base64 encoding to the\n    level QP encoding has been tested.  base64_encode() has been in PHP for\n    years.\n    */\n\n    public function testInputOutputRatioIs3to4Bytes() {\n        /*\n        RFC 2045, 6.8\n\n         The encoding process represents 24-bit groups of input bits as output\n         strings of 4 encoded characters.  Proceeding from left to right, a\n         24-bit input group is formed by concatenating 3 8bit input groups.\n         These 24 bits are then treated as 4 concatenated 6-bit groups, each\n         of which is translated into a single digit in the base64 alphabet.\n         */\n\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('123');\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $this->_encoder->encodeByteStream($os, $is);\n        $this->assertEquals('MTIz', $collection->content);\n    }\n\n    public function testPadLength() {\n        /*\n        RFC 2045, 6.8\n\n       Special processing is performed if fewer than 24 bits are available\n       at the end of the data being encoded.  A full encoding quantum is\n       always completed at the end of a body.  When fewer than 24 input bits\n       are available in an input group, zero bits are added (on the right)\n       to form an integral number of 6-bit groups.  Padding at the end of\n       the data is performed using the \"=\" character.  Since all base64\n       input is an integral number of octets, only the following cases can\n       arise: (1) the final quantum of encoding input is an integral\n       multiple of 24 bits; here, the final unit of encoded output will be\n       an integral multiple of 4 characters with no \"=\" padding, (2) the\n       final quantum of encoding input is exactly 8 bits; here, the final\n       unit of encoded output will be two characters followed by two \"=\"\n       padding characters, or (3) the final quantum of encoding input is\n       exactly 16 bits; here, the final unit of encoded output will be three\n       characters followed by one \"=\" padding character.\n       */\n\n        for ($i = 0; $i < 30; ++$i) {\n            $os = $this->_createOutputByteStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $os->shouldReceive('read')\n               ->once()\n               ->andReturn(pack('C', rand(0, 255)));\n            $os->shouldReceive('read')\n               ->zeroOrMoreTimes()\n               ->andReturn(false);\n\n            $this->_encoder->encodeByteStream($os, $is);\n            $this->assertRegExp('~^[a-zA-Z0-9/\\+]{2}==$~', $collection->content,\n                '%s: A single byte should have 2 bytes of padding'\n                );\n        }\n\n        for ($i = 0; $i < 30; ++$i) {\n            $os = $this->_createOutputByteStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $os->shouldReceive('read')\n               ->once()\n               ->andReturn(pack('C*', rand(0, 255), rand(0, 255)));\n            $os->shouldReceive('read')\n               ->zeroOrMoreTimes()\n               ->andReturn(false);\n\n            $this->_encoder->encodeByteStream($os, $is);\n            $this->assertRegExp('~^[a-zA-Z0-9/\\+]{3}=$~', $collection->content,\n                '%s: Two bytes should have 1 byte of padding'\n                );\n        }\n\n        for ($i = 0; $i < 30; ++$i) {\n            $os = $this->_createOutputByteStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $os->shouldReceive('read')\n               ->once()\n               ->andReturn(pack('C*', rand(0, 255), rand(0, 255), rand(0, 255)));\n            $os->shouldReceive('read')\n               ->zeroOrMoreTimes()\n               ->andReturn(false);\n\n            $this->_encoder->encodeByteStream($os, $is);\n            $this->assertRegExp('~^[a-zA-Z0-9/\\+]{4}$~', $collection->content,\n                '%s: Three bytes should have no padding'\n                );\n        }\n    }\n\n    public function testMaximumLineLengthIs76Characters() {\n        /*\n         The encoded output stream must be represented in lines of no more\n         than 76 characters each.  All line breaks or other characters not\n         found in Table 1 must be ignored by decoding software.\n         */\n\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //12\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('mnopqrstuvwx'); //24\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('yzabc1234567'); //36\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('890ABCDEFGHI'); //48\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('JKLMNOPQRSTU'); //60\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('VWXYZ1234567'); //72\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //84\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $this->_encoder->encodeByteStream($os, $is);\n        $this->assertEquals(\n            \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\\r\\n\".\n            'U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',\n            $collection->content\n            );\n    }\n\n    public function testMaximumLineLengthCanBeDifferent() {\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //12\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('mnopqrstuvwx'); //24\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('yzabc1234567'); //36\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('890ABCDEFGHI'); //48\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('JKLMNOPQRSTU'); //60\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('VWXYZ1234567'); //72\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //84\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $this->_encoder->encodeByteStream($os, $is, 0, 50);\n        $this->assertEquals(\n            \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3OD\\r\\n\".\n            \"kwQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJj\\r\\n\".\n            'ZGVmZ2hpamts',\n            $collection->content\n            );\n    }\n\n    public function testMaximumLineLengthIsNeverMoreThan76Chars() {\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //12\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('mnopqrstuvwx'); //24\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('yzabc1234567'); //36\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('890ABCDEFGHI'); //48\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('JKLMNOPQRSTU'); //60\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('VWXYZ1234567'); //72\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //84\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $this->_encoder->encodeByteStream($os, $is, 0, 100);\n        $this->assertEquals(\n            \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\\r\\n\".\n            'U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',\n            $collection->content\n            );\n    }\n\n    public function testFirstLineLengthCanBeDifferent() {\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //12\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('mnopqrstuvwx'); //24\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('yzabc1234567'); //36\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('890ABCDEFGHI'); //48\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('JKLMNOPQRSTU'); //60\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('VWXYZ1234567'); //72\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('abcdefghijkl'); //84\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $this->_encoder->encodeByteStream($os, $is, 19);\n        $this->assertEquals(\n            \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDR\\r\\n\".\n            'EVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',\n            $collection->content\n            );\n    }\n\n    private function _createOutputByteStream($stub = false) {\n        return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();\n    }\n\n    private function _createInputByteStream($stub = false) {\n        return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \\SwiftMailerTestCase{\n    public function testNameCanBeSpecifiedInConstructor() {\n        $encoder = $this->_getEncoder('7bit');\n        $this->assertEquals('7bit', $encoder->getName());\n\n        $encoder = $this->_getEncoder('8bit');\n        $this->assertEquals('8bit', $encoder->getName());\n    }\n\n    public function testNoOctetsAreModifiedInString() {\n        $encoder = $this->_getEncoder('7bit');\n        foreach (range(0x00, 0xFF) as $octet) {\n            $byte = pack('C', $octet);\n            $this->assertIdenticalBinary($byte, $encoder->encodeString($byte));\n        }\n    }\n\n    public function testNoOctetsAreModifiedInByteStream() {\n        $encoder = $this->_getEncoder('7bit');\n        foreach (range(0x00, 0xFF) as $octet) {\n            $byte = pack('C', $octet);\n\n            $os = $this->_createOutputByteStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $os->shouldReceive('read')\n               ->once()\n               ->andReturn($byte);\n            $os->shouldReceive('read')\n               ->zeroOrMoreTimes()\n               ->andReturn(false);\n\n            $encoder->encodeByteStream($os, $is);\n            $this->assertIdenticalBinary($byte, $collection->content);\n        }\n    }\n\n    public function testLineLengthCanBeSpecified() {\n        $encoder = $this->_getEncoder('7bit');\n\n        $chars = array();\n        for ($i = 0; $i < 50; ++$i) {\n            $chars[] = 'a';\n        }\n        $input = implode(' ', $chars); //99 chars long\n\n        $this->assertEquals(\n            'a a a a a a a a a a a a a a a a a a a a a a a a a '.\"\\r\\n\".//50 *\n            'a a a a a a a a a a a a a a a a a a a a a a a a a',            //99\n            $encoder->encodeString($input, 0, 50),\n            '%s: Lines should be wrapped at 50 chars'\n            );\n    }\n\n    public function testLineLengthCanBeSpecifiedInByteStream() {\n        $encoder = $this->_getEncoder('7bit');\n\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n\n        for ($i = 0; $i < 50; ++$i) {\n            $os->shouldReceive('read')\n               ->once()\n               ->andReturn('a ');\n        }\n\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $encoder->encodeByteStream($os, $is, 0, 50);\n        $this->assertEquals(\n            str_repeat('a ', 25).\"\\r\\n\".str_repeat('a ', 25),\n            $collection->content\n            );\n    }\n\n    public function testencodeStringGeneratesCorrectCrlf() {\n        $encoder = $this->_getEncoder('7bit', true);\n        $this->assertEquals(\"a\\r\\nb\", $encoder->encodeString(\"a\\rb\"),\n            '%s: Line endings should be standardized'\n            );\n        $this->assertEquals(\"a\\r\\nb\", $encoder->encodeString(\"a\\nb\"),\n            '%s: Line endings should be standardized'\n            );\n        $this->assertEquals(\"a\\r\\n\\r\\nb\", $encoder->encodeString(\"a\\n\\rb\"),\n            '%s: Line endings should be standardized'\n            );\n        $this->assertEquals(\"a\\r\\n\\r\\nb\", $encoder->encodeString(\"a\\r\\rb\"),\n            '%s: Line endings should be standardized'\n            );\n        $this->assertEquals(\"a\\r\\n\\r\\nb\", $encoder->encodeString(\"a\\n\\nb\"),\n            '%s: Line endings should be standardized'\n            );\n    }\n\n    public function crlfProvider() {\n        return array(\n            array(\"\\r\", \"a\\r\\nb\"),\n            array(\"\\n\", \"a\\r\\nb\"),\n            array(\"\\n\\r\", \"a\\r\\n\\r\\nb\"),\n            array(\"\\n\\n\", \"a\\r\\n\\r\\nb\"),\n            array(\"\\r\\r\", \"a\\r\\n\\r\\nb\"),\n        );\n    }\n\n    /**\n     * @dataProvider crlfProvider\n     */\n    public function testCanonicEncodeByteStreamGeneratesCorrectCrlf($test, $expected) {\n        $encoder = $this->_getEncoder('7bit', true);\n\n        $os = $this->_createOutputByteStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('a');\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn($test);\n        $os->shouldReceive('read')\n           ->once()\n           ->andReturn('b');\n        $os->shouldReceive('read')\n           ->zeroOrMoreTimes()\n           ->andReturn(false);\n\n        $encoder->encodeByteStream($os, $is);\n        $this->assertEquals($expected, $collection->content);\n    }\n\n    // -- Private helpers\n\n    private function _getEncoder($name, $canonical = false) {\n        return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical);\n    }\n\n    private function _createOutputByteStream($stub = false) {\n        return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();\n    }\n\n    private function _createInputByteStream($stub = false) {\n        return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php",
    "content": "<?php\n\nclass Swift_Mime_ContentEncoder_QpContentEncoderTest extends \\SwiftMailerTestCase{\n    public function testNameIsQuotedPrintable() {\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder(\n            $this->_createCharacterStream(true)\n            );\n        $this->assertEquals('quoted-printable', $encoder->getName());\n    }\n\n    /* -- RFC 2045, 6.7 --\n    (1)   (General 8bit representation) Any octet, except a CR or\n                    LF that is part of a CRLF line break of the canonical\n                    (standard) form of the data being encoded, may be\n                    represented by an \"=\" followed by a two digit\n                    hexadecimal representation of the octet's value.  The\n                    digits of the hexadecimal alphabet, for this purpose,\n                    are \"0123456789ABCDEF\".  Uppercase letters must be\n                    used; lowercase letters are not allowed.  Thus, for\n                    example, the decimal value 12 (US-ASCII form feed) can\n                    be represented by \"=0C\", and the decimal value 61 (US-\n                    ASCII EQUAL SIGN) can be represented by \"=3D\".  This\n                    rule must be followed except when the following rules\n                    allow an alternative encoding.\n                    */\n\n    public function testPermittedCharactersAreNotEncoded() {\n        /* -- RFC 2045, 6.7 --\n        (2)   (Literal representation) Octets with decimal values of\n                    33 through 60 inclusive, and 62 through 126, inclusive,\n                    MAY be represented as the US-ASCII characters which\n                    correspond to those octets (EXCLAMATION POINT through\n                    LESS THAN, and GREATER THAN through TILDE,\n                    respectively).\n                    */\n\n        foreach (array_merge(range(33, 60), range(62, 126)) as $ordinal) {\n            $char = chr($ordinal);\n\n            $os = $this->_createOutputByteStream(true);\n            $charStream = $this->_createCharacterStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importByteStream')\n                       ->once()\n                       ->with($os);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->zeroOrMoreTimes()\n                       ->andReturn(false);\n\n            $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n            $encoder->encodeByteStream($os, $is);\n            $this->assertIdenticalBinary($char, $collection->content);\n        }\n    }\n\n    public function testLinearWhiteSpaceAtLineEndingIsEncoded() {\n        /* -- RFC 2045, 6.7 --\n        (3)   (White Space) Octets with values of 9 and 32 MAY be\n                    represented as US-ASCII TAB (HT) and SPACE characters,\n                    respectively, but MUST NOT be so represented at the end\n                    of an encoded line.  Any TAB (HT) or SPACE characters\n                    on an encoded line MUST thus be followed on that line\n                    by a printable character.  In particular, an \"=\" at the\n                    end of an encoded line, indicating a soft line break\n                    (see rule #5) may follow one or more TAB (HT) or SPACE\n                    characters.  It follows that an octet with decimal\n                    value 9 or 32 appearing at the end of an encoded line\n                    must be represented according to Rule #1.  This rule is\n                    necessary because some MTAs (Message Transport Agents,\n                    programs which transport messages from one user to\n                    another, or perform a portion of such transfers) are\n                    known to pad lines of text with SPACEs, and others are\n                    known to remove \"white space\" characters from the end\n                    of a line.  Therefore, when decoding a Quoted-Printable\n                    body, any trailing white space on a line must be\n                    deleted, as it will necessarily have been added by\n                    intermediate transport agents.\n                    */\n\n        $HT = chr(0x09); //9\n        $SPACE = chr(0x20); //32\n\n        //HT\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                   ->once();\n        $charStream->shouldReceive('importByteStream')\n                   ->once()\n                   ->with($os);\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x09));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x09));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is);\n\n        $this->assertEquals(\"a\\t=09\\r\\nb\", $collection->content);\n\n        //SPACE\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                   ->once();\n        $charStream->shouldReceive('importByteStream')\n                   ->once()\n                   ->with($os);\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x20));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x20));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is);\n\n        $this->assertEquals(\"a =20\\r\\nb\", $collection->content);\n    }\n\n    public function testCRLFIsLeftAlone() {\n        /*\n        (4)   (Line Breaks) A line break in a text body, represented\n                    as a CRLF sequence in the text canonical form, must be\n                    represented by a (RFC 822) line break, which is also a\n                    CRLF sequence, in the Quoted-Printable encoding.  Since\n                    the canonical representation of media types other than\n                    text do not generally include the representation of\n                    line breaks as CRLF sequences, no hard line breaks\n                    (i.e. line breaks that are intended to be meaningful\n                    and to be displayed to the user) can occur in the\n                    quoted-printable encoding of such types.  Sequences\n                    like \"=0D\", \"=0A\", \"=0A=0D\" and \"=0D=0A\" will routinely\n                    appear in non-text data represented in quoted-\n                    printable, of course.\n\n                    Note that many implementations may elect to encode the\n                    local representation of various content types directly\n                    rather than converting to canonical form first,\n                    encoding, and then converting back to local\n                    representation.  In particular, this may apply to plain\n                    text material on systems that use newline conventions\n                    other than a CRLF terminator sequence.  Such an\n                    implementation optimization is permissible, but only\n                    when the combined canonicalization-encoding step is\n                    equivalent to performing the three steps separately.\n                    */\n\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                   ->once();\n        $charStream->shouldReceive('importByteStream')\n                   ->once()\n                   ->with($os);\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('c')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0D));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x0A));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is);\n        $this->assertEquals(\"a\\r\\nb\\r\\nc\\r\\n\", $collection->content);\n    }\n\n    public function testLinesLongerThan76CharactersAreSoftBroken() {\n        /*\n        (5)   (Soft Line Breaks) The Quoted-Printable encoding\n                    REQUIRES that encoded lines be no more than 76\n                    characters long.  If longer lines are to be encoded\n                    with the Quoted-Printable encoding, \"soft\" line breaks\n                    must be used.  An equal sign as the last character on a\n                    encoded line indicates such a non-significant (\"soft\")\n                    line break in the encoded text.\n                    */\n\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                   ->once();\n        $charStream->shouldReceive('importByteStream')\n                   ->once()\n                   ->with($os);\n\n        for ($seq = 0; $seq <= 140; ++$seq) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n        }\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is);\n        $this->assertEquals(str_repeat('a', 75).\"=\\r\\n\".str_repeat('a', 66), $collection->content);\n    }\n\n    public function testMaxLineLengthCanBeSpecified() {\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                   ->once();\n        $charStream->shouldReceive('importByteStream')\n                   ->once()\n                   ->with($os);\n\n        for ($seq = 0; $seq <= 100; ++$seq) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n        }\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is, 0, 54);\n        $this->assertEquals(str_repeat('a', 53).\"=\\r\\n\".str_repeat('a', 48), $collection->content);\n    }\n\n    public function testBytesBelowPermittedRangeAreEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        foreach (range(0, 32) as $ordinal) {\n            $char = chr($ordinal);\n\n            $os = $this->_createOutputByteStream(true);\n            $charStream = $this->_createCharacterStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importByteStream')\n                       ->once()\n                       ->with($os);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->zeroOrMoreTimes()\n                       ->andReturn(false);\n\n            $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n            $encoder->encodeByteStream($os, $is);\n            $this->assertEquals(sprintf('=%02X', $ordinal), $collection->content);\n        }\n    }\n\n    public function testDecimalByte61IsEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        $char = chr(61);\n\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                       ->once();\n        $charStream->shouldReceive('importByteStream')\n                       ->once()\n                       ->with($os);\n        $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(61));\n        $charStream->shouldReceive('readBytes')\n                       ->zeroOrMoreTimes()\n                       ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is);\n        $this->assertEquals(sprintf('=%02X', 61), $collection->content);\n    }\n\n    public function testBytesAbovePermittedRangeAreEncoded() {\n        /*\n        According to Rule (1 & 2)\n        */\n\n        foreach (range(127, 255) as $ordinal) {\n            $char = chr($ordinal);\n\n            $os = $this->_createOutputByteStream(true);\n            $charStream = $this->_createCharacterStream();\n            $is = $this->_createInputByteStream();\n            $collection = new Swift_StreamCollector();\n\n            $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n            $charStream->shouldReceive('flushContents')\n                       ->once();\n            $charStream->shouldReceive('importByteStream')\n                       ->once()\n                       ->with($os);\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array($ordinal));\n            $charStream->shouldReceive('readBytes')\n                       ->zeroOrMoreTimes()\n                       ->andReturn(false);\n\n            $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n            $encoder->encodeByteStream($os, $is);\n            $this->assertEquals(sprintf('=%02X', $ordinal), $collection->content);\n        }\n    }\n\n    public function testFirstLineLengthCanBeDifferent() {\n        $os = $this->_createOutputByteStream(true);\n        $charStream = $this->_createCharacterStream();\n        $is = $this->_createInputByteStream();\n        $collection = new Swift_StreamCollector();\n\n        $is->shouldReceive('write')\n               ->zeroOrMoreTimes()\n               ->andReturnUsing($collection);\n        $charStream->shouldReceive('flushContents')\n                    ->once();\n        $charStream->shouldReceive('importByteStream')\n                    ->once()\n                    ->with($os);\n\n        for ($seq = 0; $seq <= 140; ++$seq) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n        }\n        $charStream->shouldReceive('readBytes')\n                    ->zeroOrMoreTimes()\n                    ->andReturn(false);\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n        $encoder->encodeByteStream($os, $is, 22);\n        $this->assertEquals(\n            str_repeat('a', 53).\"=\\r\\n\".str_repeat('a', 75).\"=\\r\\n\".str_repeat('a', 13),\n            $collection->content\n            );\n    }\n\n    public function testObserverInterfaceCanChangeCharset() {\n        $stream = $this->_createCharacterStream();\n        $stream->shouldReceive('setCharacterSet')\n               ->once()\n               ->with('windows-1252');\n\n        $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($stream);\n        $encoder->charsetChanged('windows-1252');\n    }\n\n    public function testTextIsPreWrapped() {\n        $encoder = $this->createEncoder();\n\n        $input = str_repeat('a', 70).\"\\r\\n\".\n                 str_repeat('a', 70).\"\\r\\n\".\n                 str_repeat('a', 70);\n\n        $os = new Swift_ByteStream_ArrayByteStream();\n        $is = new Swift_ByteStream_ArrayByteStream();\n        $is->write($input);\n\n        $encoder->encodeByteStream($is, $os);\n\n        $this->assertEquals(\n            $input, $os->read(PHP_INT_MAX)\n            );\n    }\n\n    // -- Creation Methods\n\n    private function _createCharacterStream($stub = false) {\n        return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();\n    }\n\n    private function createEncoder() {\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');\n\n        return new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);\n    }\n\n    private function _createOutputByteStream($stub = false) {\n        return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();\n    }\n\n    private function _createInputByteStream($stub = false) {\n        return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php",
    "content": "<?php\n\nclass Swift_Mime_EmbeddedFileTest extends Swift_Mime_AttachmentTest{\n    public function testNestingLevelIsAttachment() {\n        //Overridden\n    }\n\n    public function testNestingLevelIsEmbedded() {\n        $file = $this->_createEmbeddedFile($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(\n            Swift_Mime_MimeEntity::LEVEL_RELATED, $file->getNestingLevel()\n            );\n    }\n\n    public function testIdIsAutoGenerated() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addIdHeader')\n                ->once()\n                ->with('Content-ID', '/^.*?@.*?$/D');\n\n        $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n    }\n\n    public function testDefaultDispositionIsInline() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addParameterizedHeader')\n                ->once()\n                ->with('Content-Disposition', 'inline');\n        $headers->shouldReceive('addParameterizedHeader')\n                ->zeroOrMoreTimes();\n\n        $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n    }\n\n    // -- Private helpers\n\n    protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array()) {\n        return $this->_createEmbeddedFile($headers, $encoder, $cache, $mimeTypes);\n    }\n\n    private function _createEmbeddedFile($headers, $encoder, $cache) {\n        return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php",
    "content": "<?php\n\nclass Swift_Mime_HeaderEncoder_Base64HeaderEncoderTest extends \\PHPUnit_Framework_TestCase{\n    //Most tests are already covered in Base64EncoderTest since this subclass only\n    // adds a getName() method\n\n    public function testNameIsB() {\n        $encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();\n        $this->assertEquals('B', $encoder->getName());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php",
    "content": "<?php\n\nclass Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \\SwiftMailerTestCase{\n    //Most tests are already covered in QpEncoderTest since this subclass only\n    // adds a getName() method\n\n    public function testNameIsQ() {\n        $encoder = $this->_createEncoder(\n            $this->_createCharacterStream(true)\n            );\n        $this->assertEquals('Q', $encoder->getName());\n    }\n\n    public function testSpaceAndTabNeverAppear() {\n        /* -- RFC 2047, 4.\n     Only a subset of the printable ASCII characters may be used in\n     'encoded-text'.  Space and tab characters are not allowed, so that\n     the beginning and end of an 'encoded-word' are obvious.\n     */\n\n        $charStream = $this->_createCharacterStream();\n        $charStream->shouldReceive('readBytes')\n                   ->atLeast()->times(6)\n                   ->andReturn(array(ord('a')), array(0x20), array(0x09), array(0x20), array(ord('b')), false);\n\n        $encoder = $this->_createEncoder($charStream);\n        $this->assertNotRegExp('~[ \\t]~', $encoder->encodeString(\"a \\t b\"),\n            '%s: encoded-words in headers cannot contain LWSP as per RFC 2047.'\n            );\n    }\n\n    public function testSpaceIsRepresentedByUnderscore() {\n        /* -- RFC 2047, 4.2.\n        (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be\n       represented as \"_\" (underscore, ASCII 95.).  (This character may\n       not pass through some internetwork mail gateways, but its use\n       will greatly enhance readability of \"Q\" encoded data with mail\n       readers that do not support this encoding.)  Note that the \"_\"\n       always represents hexadecimal 20, even if the SPACE character\n       occupies a different code position in the character set in use.\n       */\n        $charStream = $this->_createCharacterStream();\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('a')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(0x20));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('b')));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = $this->_createEncoder($charStream);\n        $this->assertEquals('a_b', $encoder->encodeString('a b'),\n            '%s: Spaces can be represented by more readable underscores as per RFC 2047.'\n            );\n    }\n\n    public function testEqualsAndQuestionAndUnderscoreAreEncoded() {\n        /* -- RFC 2047, 4.2.\n        (3) 8-bit values which correspond to printable ASCII characters other\n       than \"=\", \"?\", and \"_\" (underscore), MAY be represented as those\n       characters.  (But see section 5 for restrictions.)  In\n       particular, SPACE and TAB MUST NOT be represented as themselves\n       within encoded words.\n       */\n        $charStream = $this->_createCharacterStream();\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('=')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('?')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('_')));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = $this->_createEncoder($charStream);\n        $this->assertEquals('=3D=3F=5F', $encoder->encodeString('=?_'),\n            '%s: Chars =, ? and _ (underscore) may not appear as per RFC 2047.'\n            );\n    }\n\n    public function testParensAndQuotesAreEncoded() {\n        /* -- RFC 2047, 5 (2).\n     A \"Q\"-encoded 'encoded-word' which appears in a 'comment' MUST NOT\n     contain the characters \"(\", \")\" or \"\n     */\n\n        $charStream = $this->_createCharacterStream();\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('(')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord('\"')));\n        $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array(ord(')')));\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = $this->_createEncoder($charStream);\n        $this->assertEquals('=28=22=29', $encoder->encodeString('(\")'),\n            '%s: Chars (, \" (DQUOTE) and ) may not appear as per RFC 2047.'\n            );\n    }\n\n    public function testOnlyCharactersAllowedInPhrasesAreUsed() {\n        /* -- RFC 2047, 5.\n        (3) As a replacement for a 'word' entity within a 'phrase', for example,\n        one that precedes an address in a From, To, or Cc header.  The ABNF\n        definition for 'phrase' from RFC 822 thus becomes:\n\n        phrase = 1*( encoded-word / word )\n\n        In this case the set of characters that may be used in a \"Q\"-encoded\n        'encoded-word' is restricted to: <upper and lower case ASCII\n        letters, decimal digits, \"!\", \"*\", \"+\", \"-\", \"/\", \"=\", and \"_\"\n        (underscore, ASCII 95.)>.  An 'encoded-word' that appears within a\n        'phrase' MUST be separated from any adjacent 'word', 'text' or\n        'special' by 'linear-white-space'.\n        */\n\n        $allowedBytes = array_merge(\n            range(ord('a'), ord('z')), range(ord('A'), ord('Z')),\n            range(ord('0'), ord('9')),\n            array(ord('!'), ord('*'), ord('+'), ord('-'), ord('/'))\n            );\n\n        foreach (range(0x00, 0xFF) as $byte) {\n            $char = pack('C', $byte);\n\n            $charStream = $this->_createCharacterStream();\n            $charStream->shouldReceive('readBytes')\n                   ->once()\n                   ->andReturn(array($byte));\n            $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n            $encoder = $this->_createEncoder($charStream);\n            $encodedChar = $encoder->encodeString($char);\n\n            if (in_array($byte, $allowedBytes)) {\n                $this->assertEquals($char, $encodedChar,\n                    '%s: Character '.$char.' should not be encoded.'\n                    );\n            } elseif (0x20 == $byte) {\n                //Special case\n                $this->assertEquals('_', $encodedChar,\n                    '%s: Space character should be replaced.'\n                    );\n            } else {\n                $this->assertEquals(sprintf('=%02X', $byte), $encodedChar,\n                    '%s: Byte '.$byte.' should be encoded.'\n                    );\n            }\n        }\n    }\n\n    public function testEqualsNeverAppearsAtEndOfLine() {\n        /* -- RFC 2047, 5 (3).\n        The 'encoded-text' in an 'encoded-word' must be self-contained;\n        'encoded-text' MUST NOT be continued from one 'encoded-word' to\n        another.  This implies that the 'encoded-text' portion of a \"B\"\n        'encoded-word' will be a multiple of 4 characters long; for a \"Q\"\n        'encoded-word', any \"=\" character that appears in the 'encoded-text'\n        portion will be followed by two hexadecimal characters.\n        */\n\n        $input = str_repeat('a', 140);\n\n        $charStream = $this->_createCharacterStream();\n\n        $output = '';\n        $seq = 0;\n        for (; $seq < 140; ++$seq) {\n            $charStream->shouldReceive('readBytes')\n                       ->once()\n                       ->andReturn(array(ord('a')));\n\n            if (75 == $seq) {\n                $output .= \"\\r\\n\"; // =\\r\\n\n            }\n            $output .= 'a';\n        }\n\n        $charStream->shouldReceive('readBytes')\n                   ->zeroOrMoreTimes()\n                   ->andReturn(false);\n\n        $encoder = $this->_createEncoder($charStream);\n        $this->assertEquals($output, $encoder->encodeString($input));\n    }\n\n    // -- Creation Methods\n\n    private function _createEncoder($charStream) {\n        return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream);\n    }\n\n    private function _createCharacterStream($stub = false) {\n        return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_DateHeaderTest extends \\PHPUnit_Framework_TestCase{\n    /* --\n    The following tests refer to RFC 2822, section 3.6.1 and 3.3.\n    */\n\n    public function testTypeIsDateHeader() {\n        $header = $this->_getHeader('Date');\n        $this->assertEquals(Swift_Mime_Header::TYPE_DATE, $header->getFieldType());\n    }\n\n    public function testGetTimestamp() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setTimestamp($timestamp);\n        $this->assertSame($timestamp, $header->getTimestamp());\n    }\n\n    public function testTimestampCanBeSetBySetter() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setTimestamp($timestamp);\n        $this->assertSame($timestamp, $header->getTimestamp());\n    }\n\n    public function testIntegerTimestampIsConvertedToRfc2822Date() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setTimestamp($timestamp);\n        $this->assertEquals(date('r', $timestamp), $header->getFieldBody());\n    }\n\n    public function testSetBodyModel() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setFieldBodyModel($timestamp);\n        $this->assertEquals(date('r', $timestamp), $header->getFieldBody());\n    }\n\n    public function testGetBodyModel() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setTimestamp($timestamp);\n        $this->assertEquals($timestamp, $header->getFieldBodyModel());\n    }\n\n    public function testToString() {\n        $timestamp = time();\n        $header = $this->_getHeader('Date');\n        $header->setTimestamp($timestamp);\n        $this->assertEquals('Date: '.date('r', $timestamp).\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    private function _getHeader($name) {\n        return new Swift_Mime_Headers_DateHeader($name, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_IdentificationHeaderTest extends \\PHPUnit_Framework_TestCase{\n    public function testTypeIsIdHeader() {\n        $header = $this->_getHeader('Message-ID');\n        $this->assertEquals(Swift_Mime_Header::TYPE_ID, $header->getFieldType());\n    }\n\n    public function testValueMatchesMsgIdSpec() {\n        /* -- RFC 2822, 3.6.4.\n     message-id      =       \"Message-ID:\" msg-id CRLF\n\n     in-reply-to     =       \"In-Reply-To:\" 1*msg-id CRLF\n\n     references      =       \"References:\" 1*msg-id CRLF\n\n     msg-id          =       [CFWS] \"<\" id-left \"@\" id-right \">\" [CFWS]\n\n     id-left         =       dot-atom-text / no-fold-quote / obs-id-left\n\n     id-right        =       dot-atom-text / no-fold-literal / obs-id-right\n\n     no-fold-quote   =       DQUOTE *(qtext / quoted-pair) DQUOTE\n\n     no-fold-literal =       \"[\" *(dtext / quoted-pair) \"]\"\n     */\n\n        $header = $this->_getHeader('Message-ID');\n        $header->setId('id-left@id-right');\n        $this->assertEquals('<id-left@id-right>', $header->getFieldBody());\n    }\n\n    public function testIdCanBeRetrievedVerbatim() {\n        $header = $this->_getHeader('Message-ID');\n        $header->setId('id-left@id-right');\n        $this->assertEquals('id-left@id-right', $header->getId());\n    }\n\n    public function testMultipleIdsCanBeSet() {\n        $header = $this->_getHeader('References');\n        $header->setIds(array('a@b', 'x@y'));\n        $this->assertEquals(array('a@b', 'x@y'), $header->getIds());\n    }\n\n    public function testSettingMultipleIdsProducesAListValue() {\n        /* -- RFC 2822, 3.6.4.\n     The \"References:\" and \"In-Reply-To:\" field each contain one or more\n     unique message identifiers, optionally separated by CFWS.\n\n     .. SNIP ..\n\n     in-reply-to     =       \"In-Reply-To:\" 1*msg-id CRLF\n\n     references      =       \"References:\" 1*msg-id CRLF\n     */\n\n        $header = $this->_getHeader('References');\n        $header->setIds(array('a@b', 'x@y'));\n        $this->assertEquals('<a@b> <x@y>', $header->getFieldBody());\n    }\n\n    public function testIdLeftCanBeQuoted() {\n        /* -- RFC 2822, 3.6.4.\n     id-left         =       dot-atom-text / no-fold-quote / obs-id-left\n     */\n\n        $header = $this->_getHeader('References');\n        $header->setId('\"ab\"@c');\n        $this->assertEquals('\"ab\"@c', $header->getId());\n        $this->assertEquals('<\"ab\"@c>', $header->getFieldBody());\n    }\n\n    public function testIdLeftCanContainAnglesAsQuotedPairs() {\n        /* -- RFC 2822, 3.6.4.\n     no-fold-quote   =       DQUOTE *(qtext / quoted-pair) DQUOTE\n     */\n\n        $header = $this->_getHeader('References');\n        $header->setId('\"a\\\\<\\\\>b\"@c');\n        $this->assertEquals('\"a\\\\<\\\\>b\"@c', $header->getId());\n        $this->assertEquals('<\"a\\\\<\\\\>b\"@c>', $header->getFieldBody());\n    }\n\n    public function testIdLeftCanBeDotAtom() {\n        $header = $this->_getHeader('References');\n        $header->setId('a.b+&%$.c@d');\n        $this->assertEquals('a.b+&%$.c@d', $header->getId());\n        $this->assertEquals('<a.b+&%$.c@d>', $header->getFieldBody());\n    }\n\n    public function testInvalidIdLeftThrowsException() {\n        try {\n            $header = $this->_getHeader('References');\n            $header->setId('a b c@d');\n            $this->fail(\n                'Exception should be thrown since \"a b c\" is not valid id-left.'\n                );\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testIdRightCanBeDotAtom() {\n        /* -- RFC 2822, 3.6.4.\n     id-right        =       dot-atom-text / no-fold-literal / obs-id-right\n     */\n\n        $header = $this->_getHeader('References');\n        $header->setId('a@b.c+&%$.d');\n        $this->assertEquals('a@b.c+&%$.d', $header->getId());\n        $this->assertEquals('<a@b.c+&%$.d>', $header->getFieldBody());\n    }\n\n    public function testIdRightCanBeLiteral() {\n        /* -- RFC 2822, 3.6.4.\n     no-fold-literal =       \"[\" *(dtext / quoted-pair) \"]\"\n     */\n\n        $header = $this->_getHeader('References');\n        $header->setId('a@[1.2.3.4]');\n        $this->assertEquals('a@[1.2.3.4]', $header->getId());\n        $this->assertEquals('<a@[1.2.3.4]>', $header->getFieldBody());\n    }\n\n    public function testInvalidIdRightThrowsException() {\n        try {\n            $header = $this->_getHeader('References');\n            $header->setId('a@b c d');\n            $this->fail(\n                'Exception should be thrown since \"b c d\" is not valid id-right.'\n                );\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testMissingAtSignThrowsException() {\n        /* -- RFC 2822, 3.6.4.\n     msg-id          =       [CFWS] \"<\" id-left \"@\" id-right \">\" [CFWS]\n     */\n\n        try {\n            $header = $this->_getHeader('References');\n            $header->setId('abc');\n            $this->fail(\n                'Exception should be thrown since \"abc\" is does not contain @.'\n                );\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testSetBodyModel() {\n        $header = $this->_getHeader('Message-ID');\n        $header->setFieldBodyModel('a@b');\n        $this->assertEquals(array('a@b'), $header->getIds());\n    }\n\n    public function testGetBodyModel() {\n        $header = $this->_getHeader('Message-ID');\n        $header->setId('a@b');\n        $this->assertEquals(array('a@b'), $header->getFieldBodyModel());\n    }\n\n    public function testStringValue() {\n        $header = $this->_getHeader('References');\n        $header->setIds(array('a@b', 'x@y'));\n        $this->assertEquals('References: <a@b> <x@y>'.\"\\r\\n\", $header->toString());\n    }\n\n    private function _getHeader($name) {\n        return new Swift_Mime_Headers_IdentificationHeader($name, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_MailboxHeaderTest extends \\SwiftMailerTestCase{\n    /* -- RFC 2822, 3.6.2 for all tests.\n     */\n\n    private $_charset = 'utf-8';\n\n    public function testTypeIsMailboxHeader() {\n        $header = $this->_getHeader('To', $this->_getEncoder('Q', true));\n        $this->assertEquals(Swift_Mime_Header::TYPE_MAILBOX, $header->getFieldType());\n    }\n\n    public function testMailboxIsSetForAddress() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses('chris@swiftmailer.org');\n        $this->assertEquals(array('chris@swiftmailer.org'),\n            $header->getNameAddressStrings()\n            );\n    }\n\n    public function testMailboxIsRenderedForNameAddress() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn'));\n        $this->assertEquals(\n            array('Chris Corbyn <chris@swiftmailer.org>'), $header->getNameAddressStrings()\n            );\n    }\n\n    public function testAddressCanBeReturnedForAddress() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses('chris@swiftmailer.org');\n        $this->assertEquals(array('chris@swiftmailer.org'), $header->getAddresses());\n    }\n\n    public function testAddressCanBeReturnedForNameAddress() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn'));\n        $this->assertEquals(array('chris@swiftmailer.org'), $header->getAddresses());\n    }\n\n    public function testQuotesInNameAreQuoted() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn, \"DHE\"',\n            ));\n        $this->assertEquals(\n            array('\"Chris Corbyn, \\\"DHE\\\"\" <chris@swiftmailer.org>'),\n            $header->getNameAddressStrings()\n            );\n    }\n\n    public function testEscapeCharsInNameAreQuoted() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn, \\\\escaped\\\\',\n            ));\n        $this->assertEquals(\n            array('\"Chris Corbyn, \\\\\\\\escaped\\\\\\\\\" <chris@swiftmailer.org>'),\n            $header->getNameAddressStrings()\n            );\n    }\n\n    public function testGetMailboxesReturnsNameValuePairs() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn, DHE',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org' => 'Chris Corbyn, DHE'), $header->getNameAddresses()\n            );\n    }\n\n    public function testMultipleAddressesCanBeSetAndFetched() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses(array(\n            'chris@swiftmailer.org', 'mark@swiftmailer.org',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org'),\n            $header->getAddresses()\n            );\n    }\n\n    public function testMultipleAddressesAsMailboxes() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses(array(\n            'chris@swiftmailer.org', 'mark@swiftmailer.org',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null),\n            $header->getNameAddresses()\n            );\n    }\n\n    public function testMultipleAddressesAsMailboxStrings() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses(array(\n            'chris@swiftmailer.org', 'mark@swiftmailer.org',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org'),\n            $header->getNameAddressStrings()\n            );\n    }\n\n    public function testMultipleNamedMailboxesReturnsMultipleAddresses() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org'),\n            $header->getAddresses()\n            );\n    }\n\n    public function testMultipleNamedMailboxesReturnsMultipleMailboxes() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(array(\n                'chris@swiftmailer.org' => 'Chris Corbyn',\n                'mark@swiftmailer.org' => 'Mark Corbyn',\n                ),\n            $header->getNameAddresses()\n            );\n    }\n\n    public function testMultipleMailboxesProducesMultipleMailboxStrings() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(array(\n                'Chris Corbyn <chris@swiftmailer.org>',\n                'Mark Corbyn <mark@swiftmailer.org>',\n                ),\n            $header->getNameAddressStrings()\n            );\n    }\n\n    public function testSetAddressesOverwritesAnyMailboxes() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(\n            array('chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn', ),\n            $header->getNameAddresses()\n            );\n        $this->assertEquals(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org'),\n            $header->getAddresses()\n            );\n\n        $header->setAddresses(array('chris@swiftmailer.org', 'mark@swiftmailer.org'));\n\n        $this->assertEquals(\n            array('chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null),\n            $header->getNameAddresses()\n            );\n        $this->assertEquals(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org'),\n            $header->getAddresses()\n            );\n    }\n\n    public function testNameIsEncodedIfNonAscii() {\n        $name = 'C'.pack('C', 0x8F).'rbyn';\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($name, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('C=8Frbyn');\n\n        $header = $this->_getHeader('From', $encoder);\n        $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris '.$name));\n\n        $addresses = $header->getNameAddressStrings();\n        $this->assertEquals(\n            'Chris =?'.$this->_charset.'?Q?C=8Frbyn?= <chris@swiftmailer.org>',\n            array_shift($addresses)\n            );\n    }\n\n    public function testEncodingLineLengthCalculations() {\n        /* -- RFC 2047, 2.\n        An 'encoded-word' may not be more than 75 characters long, including\n        'charset', 'encoding', 'encoded-text', and delimiters.\n        */\n\n        $name = 'C'.pack('C', 0x8F).'rbyn';\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($name, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('C=8Frbyn');\n\n        $header = $this->_getHeader('From', $encoder);\n        $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris '.$name));\n\n        $header->getNameAddressStrings();\n    }\n\n    public function testGetValueReturnsMailboxStringValue() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            ));\n        $this->assertEquals(\n            'Chris Corbyn <chris@swiftmailer.org>', $header->getFieldBody()\n            );\n    }\n\n    public function testGetValueReturnsMailboxStringValueForMultipleMailboxes() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(\n            'Chris Corbyn <chris@swiftmailer.org>, Mark Corbyn <mark@swiftmailer.org>',\n            $header->getFieldBody()\n            );\n    }\n\n    public function testRemoveAddressesWithSingleValue() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $header->removeAddresses('chris@swiftmailer.org');\n        $this->assertEquals(array('mark@swiftmailer.org'),\n            $header->getAddresses()\n            );\n    }\n\n    public function testRemoveAddressesWithList() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $header->removeAddresses(\n            array('chris@swiftmailer.org', 'mark@swiftmailer.org')\n            );\n        $this->assertEquals(array(), $header->getAddresses());\n    }\n\n    public function testSetBodyModel() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setFieldBodyModel('chris@swiftmailer.org');\n        $this->assertEquals(array('chris@swiftmailer.org' => null), $header->getNameAddresses());\n    }\n\n    public function testGetBodyModel() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setAddresses(array('chris@swiftmailer.org'));\n        $this->assertEquals(array('chris@swiftmailer.org' => null), $header->getFieldBodyModel());\n    }\n\n    public function testToString() {\n        $header = $this->_getHeader('From', $this->_getEncoder('Q', true));\n        $header->setNameAddresses(array(\n            'chris@swiftmailer.org' => 'Chris Corbyn',\n            'mark@swiftmailer.org' => 'Mark Corbyn',\n            ));\n        $this->assertEquals(\n            'From: Chris Corbyn <chris@swiftmailer.org>, '.\n            'Mark Corbyn <mark@swiftmailer.org>'.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    private function _getHeader($name, $encoder) {\n        $header = new Swift_Mime_Headers_MailboxHeader($name, $encoder, new Swift_Mime_Grammar());\n        $header->setCharset($this->_charset);\n\n        return $header;\n    }\n\n    private function _getEncoder($type, $stub = false) {\n        $encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();\n        $encoder->shouldReceive('getName')\n                ->zeroOrMoreTimes()\n                ->andReturn($type);\n\n        return $encoder;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_ParameterizedHeaderTest extends \\SwiftMailerTestCase{\n    private $_charset = 'utf-8';\n    private $_lang = 'en-us';\n\n    public function testTypeIsParameterizedHeader() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $this->assertEquals(Swift_Mime_Header::TYPE_PARAMETERIZED, $header->getFieldType());\n    }\n\n    public function testValueIsReturnedVerbatim() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setValue('text/plain');\n        $this->assertEquals('text/plain', $header->getValue());\n    }\n\n    public function testParametersAreAppended() {\n        /* -- RFC 2045, 5.1\n        parameter := attribute \"=\" value\n\n     attribute := token\n                                    ; Matching of attributes\n                                    ; is ALWAYS case-insensitive.\n\n     value := token / quoted-string\n\n     token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,\n                 or tspecials>\n\n     tspecials :=  \"(\" / \")\" / \"<\" / \">\" / \"@\" /\n                   \",\" / \";\" / \":\" / \"\\\" / <\">\n                   \"/\" / \"[\" / \"]\" / \"?\" / \"=\"\n                   ; Must be in quoted-string,\n                   ; to use within parameter values\n        */\n\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setValue('text/plain');\n        $header->setParameters(array('charset' => 'utf-8'));\n        $this->assertEquals('text/plain; charset=utf-8', $header->getFieldBody());\n    }\n\n    public function testSpaceInParamResultsInQuotedString() {\n        $header = $this->_getHeader('Content-Disposition',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setValue('attachment');\n        $header->setParameters(array('filename' => 'my file.txt'));\n        $this->assertEquals('attachment; filename=\"my file.txt\"',\n            $header->getFieldBody()\n            );\n    }\n\n    public function testLongParamsAreBrokenIntoMultipleAttributeStrings() {\n        /* -- RFC 2231, 3.\n        The asterisk character (\"*\") followed\n        by a decimal count is employed to indicate that multiple parameters\n        are being used to encapsulate a single parameter value.  The count\n        starts at 0 and increments by 1 for each subsequent section of the\n        parameter value.  Decimal values are used and neither leading zeroes\n        nor gaps in the sequence are allowed.\n\n        The original parameter value is recovered by concatenating the\n        various sections of the parameter, in order.  For example, the\n        content-type field\n\n                Content-Type: message/external-body; access-type=URL;\n         URL*0=\"ftp://\";\n         URL*1=\"cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar\"\n\n        is semantically identical to\n\n                Content-Type: message/external-body; access-type=URL;\n                    URL=\"ftp://cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar\"\n\n        Note that quotes around parameter values are part of the value\n        syntax; they are NOT part of the value itself.  Furthermore, it is\n        explicitly permitted to have a mixture of quoted and unquoted\n        continuation fields.\n        */\n\n        $value = str_repeat('a', 180);\n\n        $encoder = $this->_getParameterEncoder();\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), 63, \\Mockery::any())\n                ->andReturn(str_repeat('a', 63).\"\\r\\n\".\n                    str_repeat('a', 63).\"\\r\\n\".str_repeat('a', 54));\n\n        $header = $this->_getHeader('Content-Disposition',\n            $this->_getHeaderEncoder('Q', true), $encoder\n            );\n        $header->setValue('attachment');\n        $header->setParameters(array('filename' => $value));\n        $header->setMaxLineLength(78);\n        $this->assertEquals(\n            'attachment; '.\n            'filename*0*=utf-8\\'\\''.str_repeat('a', 63).\";\\r\\n \".\n            'filename*1*='.str_repeat('a', 63).\";\\r\\n \".\n            'filename*2*='.str_repeat('a', 54),\n            $header->getFieldBody()\n            );\n    }\n\n    public function testEncodedParamDataIncludesCharsetAndLanguage() {\n        /* -- RFC 2231, 4.\n        Asterisks (\"*\") are reused to provide the indicator that language and\n        character set information is present and encoding is being used. A\n        single quote (\"'\") is used to delimit the character set and language\n        information at the beginning of the parameter value. Percent signs\n        (\"%\") are used as the encoding flag, which agrees with RFC 2047.\n\n        Specifically, an asterisk at the end of a parameter name acts as an\n        indicator that character set and language information may appear at\n        the beginning of the parameter value. A single quote is used to\n        separate the character set, language, and actual value information in\n        the parameter value string, and an percent sign is used to flag\n        octets encoded in hexadecimal.  For example:\n\n                Content-Type: application/x-stuff;\n         title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A\n\n        Note that it is perfectly permissible to leave either the character\n        set or language field blank.  Note also that the single quote\n        delimiters MUST be present even when one of the field values is\n        omitted.\n        */\n\n        $value = str_repeat('a', 20).pack('C', 0x8F).str_repeat('a', 10);\n\n        $encoder = $this->_getParameterEncoder();\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, 12, 62, \\Mockery::any())\n                ->andReturn(str_repeat('a', 20).'%8F'.str_repeat('a', 10));\n\n        $header = $this->_getHeader('Content-Disposition',\n            $this->_getHeaderEncoder('Q', true), $encoder\n            );\n        $header->setValue('attachment');\n        $header->setParameters(array('filename' => $value));\n        $header->setMaxLineLength(78);\n        $header->setLanguage($this->_lang);\n        $this->assertEquals(\n            'attachment; filename*='.$this->_charset.\"'\".$this->_lang.\"'\".\n            str_repeat('a', 20).'%8F'.str_repeat('a', 10),\n            $header->getFieldBody()\n            );\n    }\n\n    public function testMultipleEncodedParamLinesAreFormattedCorrectly() {\n        /* -- RFC 2231, 4.1.\n        Character set and language information may be combined with the\n        parameter continuation mechanism. For example:\n\n        Content-Type: application/x-stuff\n     title*0*=us-ascii'en'This%20is%20even%20more%20\n     title*1*=%2A%2A%2Afun%2A%2A%2A%20\n     title*2=\"isn't it!\"\n\n        Note that:\n\n     (1)   Language and character set information only appear at\n           the beginning of a given parameter value.\n\n     (2)   Continuations do not provide a facility for using more\n           than one character set or language in the same\n           parameter value.\n\n     (3)   A value presented using multiple continuations may\n           contain a mixture of encoded and unencoded segments.\n\n     (4)   The first segment of a continuation MUST be encoded if\n           language and character set information are given.\n\n     (5)   If the first segment of a continued parameter value is\n           encoded the language and character set field delimiters\n           MUST be present even when the fields are left blank.\n        */\n\n        $value = str_repeat('a', 20).pack('C', 0x8F).str_repeat('a', 60);\n\n        $encoder = $this->_getParameterEncoder();\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, 12, 62, \\Mockery::any())\n                ->andReturn(str_repeat('a', 20).'%8F'.str_repeat('a', 28).\"\\r\\n\".\n                    str_repeat('a', 32));\n\n        $header = $this->_getHeader('Content-Disposition',\n            $this->_getHeaderEncoder('Q', true), $encoder\n            );\n        $header->setValue('attachment');\n        $header->setParameters(array('filename' => $value));\n        $header->setMaxLineLength(78);\n        $header->setLanguage($this->_lang);\n        $this->assertEquals(\n            'attachment; filename*0*='.$this->_charset.\"'\".$this->_lang.\"'\".\n            str_repeat('a', 20).'%8F'.str_repeat('a', 28).\";\\r\\n \".\n            'filename*1*='.str_repeat('a', 32),\n            $header->getFieldBody()\n            );\n    }\n\n    public function testToString() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setValue('text/html');\n        $header->setParameters(array('charset' => 'utf-8'));\n        $this->assertEquals('Content-Type: text/html; charset=utf-8'.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testValueCanBeEncodedIfNonAscii() {\n        $value = 'fo'.pack('C', 0x8F).'bar';\n\n        $encoder = $this->_getHeaderEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('fo=8Fbar');\n\n        $header = $this->_getHeader('X-Foo', $encoder, $this->_getParameterEncoder(true));\n        $header->setValue($value);\n        $header->setParameters(array('lookslike' => 'foobar'));\n        $this->assertEquals('X-Foo: =?utf-8?Q?fo=8Fbar?=; lookslike=foobar'.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testValueAndParamCanBeEncodedIfNonAscii() {\n        $value = 'fo'.pack('C', 0x8F).'bar';\n\n        $encoder = $this->_getHeaderEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('fo=8Fbar');\n\n        $paramEncoder = $this->_getParameterEncoder();\n        $paramEncoder->shouldReceive('encodeString')\n                     ->once()\n                     ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                     ->andReturn('fo%8Fbar');\n\n        $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder);\n        $header->setValue($value);\n        $header->setParameters(array('says' => $value));\n        $this->assertEquals(\"X-Foo: =?utf-8?Q?fo=8Fbar?=; says*=utf-8''fo%8Fbar\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testParamsAreEncodedWithEncodedWordsIfNoParamEncoderSet() {\n        $value = 'fo'.pack('C', 0x8F).'bar';\n\n        $encoder = $this->_getHeaderEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('fo=8Fbar');\n\n        $header = $this->_getHeader('X-Foo', $encoder, null);\n        $header->setValue('bar');\n        $header->setParameters(array('says' => $value));\n        $this->assertEquals(\"X-Foo: bar; says=\\\"=?utf-8?Q?fo=8Fbar?=\\\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testLanguageInformationAppearsInEncodedWords() {\n        /* -- RFC 2231, 5.\n        5.  Language specification in Encoded Words\n\n        RFC 2047 provides support for non-US-ASCII character sets in RFC 822\n        message header comments, phrases, and any unstructured text field.\n        This is done by defining an encoded word construct which can appear\n        in any of these places.  Given that these are fields intended for\n        display, it is sometimes necessary to associate language information\n        with encoded words as well as just the character set.  This\n        specification extends the definition of an encoded word to allow the\n        inclusion of such information.  This is simply done by suffixing the\n        character set specification with an asterisk followed by the language\n        tag.  For example:\n\n                    From: =?US-ASCII*EN?Q?Keith_Moore?= <moore@cs.utk.edu>\n        */\n\n        $value = 'fo'.pack('C', 0x8F).'bar';\n\n        $encoder = $this->_getHeaderEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('fo=8Fbar');\n\n        $paramEncoder = $this->_getParameterEncoder();\n        $paramEncoder->shouldReceive('encodeString')\n                     ->once()\n                     ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                     ->andReturn('fo%8Fbar');\n\n        $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder);\n        $header->setLanguage('en');\n        $header->setValue($value);\n        $header->setParameters(array('says' => $value));\n        $this->assertEquals(\"X-Foo: =?utf-8*en?Q?fo=8Fbar?=; says*=utf-8'en'fo%8Fbar\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testSetBodyModel() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setFieldBodyModel('text/html');\n        $this->assertEquals('text/html', $header->getValue());\n    }\n\n    public function testGetBodyModel() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setValue('text/plain');\n        $this->assertEquals('text/plain', $header->getFieldBodyModel());\n    }\n\n    public function testSetParameter() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setParameters(array('charset' => 'utf-8', 'delsp' => 'yes'));\n        $header->setParameter('delsp', 'no');\n        $this->assertEquals(array('charset' => 'utf-8', 'delsp' => 'no'),\n            $header->getParameters()\n            );\n    }\n\n    public function testGetParameter() {\n        $header = $this->_getHeader('Content-Type',\n            $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)\n            );\n        $header->setParameters(array('charset' => 'utf-8', 'delsp' => 'yes'));\n        $this->assertEquals('utf-8', $header->getParameter('charset'));\n    }\n\n    // -- Private helper\n\n    private function _getHeader($name, $encoder, $paramEncoder) {\n        $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder,\n            $paramEncoder, new Swift_Mime_Grammar()\n            );\n        $header->setCharset($this->_charset);\n\n        return $header;\n    }\n\n    private function _getHeaderEncoder($type, $stub = false) {\n        $encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();\n        $encoder->shouldReceive('getName')\n                ->zeroOrMoreTimes()\n                ->andReturn($type);\n\n        return $encoder;\n    }\n\n    private function _getParameterEncoder($stub = false) {\n        return $this->getMockery('Swift_Encoder')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_PathHeaderTest extends \\PHPUnit_Framework_TestCase{\n    public function testTypeIsPathHeader() {\n        $header = $this->_getHeader('Return-Path');\n        $this->assertEquals(Swift_Mime_Header::TYPE_PATH, $header->getFieldType());\n    }\n\n    public function testSingleAddressCanBeSetAndFetched() {\n        $header = $this->_getHeader('Return-Path');\n        $header->setAddress('chris@swiftmailer.org');\n        $this->assertEquals('chris@swiftmailer.org', $header->getAddress());\n    }\n\n    public function testAddressMustComplyWithRfc2822() {\n        try {\n            $header = $this->_getHeader('Return-Path');\n            $header->setAddress('chr is@swiftmailer.org');\n            $this->fail('Addresses not valid according to RFC 2822 addr-spec grammar must be rejected.');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testValueIsAngleAddrWithValidAddress() {\n        /* -- RFC 2822, 3.6.7.\n\n            return          =       \"Return-Path:\" path CRLF\n\n            path            =       ([CFWS] \"<\" ([CFWS] / addr-spec) \">\" [CFWS]) /\n                                                            obs-path\n     */\n\n        $header = $this->_getHeader('Return-Path');\n        $header->setAddress('chris@swiftmailer.org');\n        $this->assertEquals('<chris@swiftmailer.org>', $header->getFieldBody());\n    }\n\n    public function testValueIsEmptyAngleBracketsIfEmptyAddressSet() {\n        $header = $this->_getHeader('Return-Path');\n        $header->setAddress('');\n        $this->assertEquals('<>', $header->getFieldBody());\n    }\n\n    public function testSetBodyModel() {\n        $header = $this->_getHeader('Return-Path');\n        $header->setFieldBodyModel('foo@bar.tld');\n        $this->assertEquals('foo@bar.tld', $header->getAddress());\n    }\n\n    public function testGetBodyModel() {\n        $header = $this->_getHeader('Return-Path');\n        $header->setAddress('foo@bar.tld');\n        $this->assertEquals('foo@bar.tld', $header->getFieldBodyModel());\n    }\n\n    public function testToString() {\n        $header = $this->_getHeader('Return-Path');\n        $header->setAddress('chris@swiftmailer.org');\n        $this->assertEquals('Return-Path: <chris@swiftmailer.org>'.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    private function _getHeader($name) {\n        return new Swift_Mime_Headers_PathHeader($name, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php",
    "content": "<?php\n\nclass Swift_Mime_Headers_UnstructuredHeaderTest extends \\SwiftMailerTestCase{\n    private $_charset = 'utf-8';\n\n    public function testTypeIsTextHeader() {\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $this->assertEquals(Swift_Mime_Header::TYPE_TEXT, $header->getFieldType());\n    }\n\n    public function testGetNameReturnsNameVerbatim() {\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $this->assertEquals('Subject', $header->getFieldName());\n    }\n\n    public function testGetValueReturnsValueVerbatim() {\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $header->setValue('Test');\n        $this->assertEquals('Test', $header->getValue());\n    }\n\n    public function testBasicStructureIsKeyValuePair() {\n        /* -- RFC 2822, 2.2\n        Header fields are lines composed of a field name, followed by a colon\n        (\":\"), followed by a field body, and terminated by CRLF.\n        */\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $header->setValue('Test');\n        $this->assertEquals('Subject: Test'.\"\\r\\n\", $header->toString());\n    }\n\n    public function testLongHeadersAreFoldedAtWordBoundary() {\n        /* -- RFC 2822, 2.2.3\n        Each header field is logically a single line of characters comprising\n        the field name, the colon, and the field body.  For convenience\n        however, and to deal with the 998/78 character limitations per line,\n        the field body portion of a header field can be split into a multiple\n        line representation; this is called \"folding\".  The general rule is\n        that wherever this standard allows for folding white space (not\n        simply WSP characters), a CRLF may be inserted before any WSP.\n        */\n\n        $value = 'The quick brown fox jumped over the fence, he was a very very '.\n            'scary brown fox with a bushy tail';\n        $header = $this->_getHeader('X-Custom-Header',\n            $this->_getEncoder('Q', true)\n            );\n        $header->setValue($value);\n        $header->setMaxLineLength(78); //A safe [RFC 2822, 2.2.3] default\n        /*\n        X-Custom-Header: The quick brown fox jumped over the fence, he was a very very\n     scary brown fox with a bushy tail\n        */\n        $this->assertEquals(\n            'X-Custom-Header: The quick brown fox jumped over the fence, he was a'.\n            ' very very'.\"\\r\\n\".//Folding\n            ' scary brown fox with a bushy tail'.\"\\r\\n\",\n            $header->toString(), '%s: The header should have been folded at 78th char'\n            );\n    }\n\n    public function testPrintableAsciiOnlyAppearsInHeaders() {\n        /* -- RFC 2822, 2.2.\n        A field name MUST be composed of printable US-ASCII characters (i.e.,\n        characters that have values between 33 and 126, inclusive), except\n        colon.  A field body may be composed of any US-ASCII characters,\n        except for CR and LF.\n        */\n\n        $nonAsciiChar = pack('C', 0x8F);\n        $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true));\n        $header->setValue($nonAsciiChar);\n        $this->assertRegExp(\n            '~^[^:\\x00-\\x20\\x80-\\xFF]+: [^\\x80-\\xFF\\r\\n]+\\r\\n$~s',\n            $header->toString()\n            );\n    }\n\n    public function testEncodedWordsFollowGeneralStructure() {\n        /* -- RFC 2047, 1.\n        Generally, an \"encoded-word\" is a sequence of printable ASCII\n        characters that begins with \"=?\", ends with \"?=\", and has two \"?\"s in\n        between.\n        */\n\n        $nonAsciiChar = pack('C', 0x8F);\n        $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true));\n        $header->setValue($nonAsciiChar);\n        $this->assertRegExp(\n            '~^X-Test: \\=?.*?\\?.*?\\?.*?\\?=\\r\\n$~s',\n            $header->toString()\n            );\n    }\n\n    public function testEncodedWordIncludesCharsetAndEncodingMethodAndText() {\n        /* -- RFC 2047, 2.\n        An 'encoded-word' is defined by the following ABNF grammar.  The\n        notation of RFC 822 is used, with the exception that white space\n        characters MUST NOT appear between components of an 'encoded-word'.\n\n        encoded-word = \"=?\" charset \"?\" encoding \"?\" encoded-text \"?=\"\n        */\n\n        $nonAsciiChar = pack('C', 0x8F);\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($nonAsciiChar, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('=8F');\n\n        $header = $this->_getHeader('X-Test', $encoder);\n        $header->setValue($nonAsciiChar);\n        $this->assertEquals(\n            'X-Test: =?'.$this->_charset.'?Q?=8F?='.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testEncodedWordsAreUsedToEncodedNonPrintableAscii() {\n        //SPACE and TAB permitted\n        $nonPrintableBytes = array_merge(\n            range(0x00, 0x08), range(0x10, 0x19), array(0x7F)\n            );\n\n        foreach ($nonPrintableBytes as $byte) {\n            $char = pack('C', $byte);\n            $encodedChar = sprintf('=%02X', $byte);\n\n            $encoder = $this->_getEncoder('Q');\n            $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($char, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn($encodedChar);\n\n            $header = $this->_getHeader('X-A', $encoder);\n            $header->setValue($char);\n\n            $this->assertEquals(\n                'X-A: =?'.$this->_charset.'?Q?'.$encodedChar.'?='.\"\\r\\n\",\n                $header->toString(), '%s: Non-printable ascii should be encoded'\n                );\n        }\n    }\n\n    public function testEncodedWordsAreUsedToEncode8BitOctets() {\n        $_8BitBytes = range(0x80, 0xFF);\n\n        foreach ($_8BitBytes as $byte) {\n            $char = pack('C', $byte);\n            $encodedChar = sprintf('=%02X', $byte);\n\n            $encoder = $this->_getEncoder('Q');\n            $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($char, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn($encodedChar);\n\n            $header = $this->_getHeader('X-A', $encoder);\n            $header->setValue($char);\n\n            $this->assertEquals(\n                'X-A: =?'.$this->_charset.'?Q?'.$encodedChar.'?='.\"\\r\\n\",\n                $header->toString(), '%s: 8-bit octets should be encoded'\n                );\n        }\n    }\n\n    public function testEncodedWordsAreNoMoreThan75CharsPerLine() {\n        /* -- RFC 2047, 2.\n        An 'encoded-word' may not be more than 75 characters long, including\n        'charset', 'encoding', 'encoded-text', and delimiters.\n\n        ... SNIP ...\n\n        While there is no limit to the length of a multiple-line header\n        field, each line of a header field that contains one or more\n        'encoded-word's is limited to 76 characters.\n        */\n\n        $nonAsciiChar = pack('C', 0x8F);\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($nonAsciiChar, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('=8F');\n        //Note that multi-line headers begin with LWSP which makes 75 + 1 = 76\n        //Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63\n\n        //* X-Test: is 8 chars\n        $header = $this->_getHeader('X-Test', $encoder);\n        $header->setValue($nonAsciiChar);\n\n        $this->assertEquals(\n            'X-Test: =?'.$this->_charset.'?Q?=8F?='.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testFWSPIsUsedWhenEncoderReturnsMultipleLines() {\n        /* --RFC 2047, 2.\n        If it is desirable to encode more text than will fit in an 'encoded-word' of\n        75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may\n        be used.\n        */\n\n        //Note the Mock does NOT return 8F encoded, the 8F merely triggers\n        // encoding for the sake of testing\n        $nonAsciiChar = pack('C', 0x8F);\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($nonAsciiChar, 8, 63, \\Mockery::any())\n                ->andReturn('line_one_here'.\"\\r\\n\".'line_two_here');\n\n        //Note that multi-line headers begin with LWSP which makes 75 + 1 = 76\n        //Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63\n\n        //* X-Test: is 8 chars\n        $header = $this->_getHeader('X-Test', $encoder);\n        $header->setValue($nonAsciiChar);\n\n        $this->assertEquals(\n            'X-Test: =?'.$this->_charset.'?Q?line_one_here?='.\"\\r\\n\".\n            ' =?'.$this->_charset.'?Q?line_two_here?='.\"\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testAdjacentWordsAreEncodedTogether() {\n        /* -- RFC 2047, 5 (1)\n     Ordinary ASCII text and 'encoded-word's may appear together in the\n     same header field.  However, an 'encoded-word' that appears in a\n     header field defined as '*text' MUST be separated from any adjacent\n     'encoded-word' or 'text' by 'linear-white-space'.\n\n     -- RFC 2047, 2.\n     IMPORTANT: 'encoded-word's are designed to be recognized as 'atom's\n     by an RFC 822 parser.  As a consequence, unencoded white space\n     characters (such as SPACE and HTAB) are FORBIDDEN within an\n     'encoded-word'.\n     */\n\n        //It would be valid to encode all words needed, however it's probably\n        // easiest to encode the longest amount required at a time\n\n        $word = 'w'.pack('C', 0x8F).'rd';\n        $text = 'start '.$word.' '.$word.' then end '.$word;\n        // 'start', ' word word', ' and end', ' word'\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($word.' '.$word, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('w=8Frd_w=8Frd');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($word, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('w=8Frd');\n\n        $header = $this->_getHeader('X-Test', $encoder);\n        $header->setValue($text);\n\n        $headerString = $header->toString();\n\n        $this->assertEquals('X-Test: start =?'.$this->_charset.'?Q?'.\n            'w=8Frd_w=8Frd?= then end =?'.$this->_charset.'?Q?'.\n            'w=8Frd?='.\"\\r\\n\", $headerString,\n            '%s: Adjacent encoded words should appear grouped with WSP encoded'\n            );\n    }\n\n    public function testLanguageInformationAppearsInEncodedWords() {\n        /* -- RFC 2231, 5.\n        5.  Language specification in Encoded Words\n\n        RFC 2047 provides support for non-US-ASCII character sets in RFC 822\n        message header comments, phrases, and any unstructured text field.\n        This is done by defining an encoded word construct which can appear\n        in any of these places.  Given that these are fields intended for\n        display, it is sometimes necessary to associate language information\n        with encoded words as well as just the character set.  This\n        specification extends the definition of an encoded word to allow the\n        inclusion of such information.  This is simply done by suffixing the\n        character set specification with an asterisk followed by the language\n        tag.  For example:\n\n                    From: =?US-ASCII*EN?Q?Keith_Moore?= <moore@cs.utk.edu>\n        */\n\n        $value = 'fo'.pack('C', 0x8F).'bar';\n\n        $encoder = $this->_getEncoder('Q');\n        $encoder->shouldReceive('encodeString')\n                ->once()\n                ->with($value, \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn('fo=8Fbar');\n\n        $header = $this->_getHeader('Subject', $encoder);\n        $header->setLanguage('en');\n        $header->setValue($value);\n        $this->assertEquals(\"Subject: =?utf-8*en?Q?fo=8Fbar?=\\r\\n\",\n            $header->toString()\n            );\n    }\n\n    public function testSetBodyModel() {\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $header->setFieldBodyModel('test');\n        $this->assertEquals('test', $header->getValue());\n    }\n\n    public function testGetBodyModel() {\n        $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));\n        $header->setValue('test');\n        $this->assertEquals('test', $header->getFieldBodyModel());\n    }\n\n    private function _getHeader($name, $encoder) {\n        $header = new Swift_Mime_Headers_UnstructuredHeader($name, $encoder, new Swift_Mime_Grammar());\n        $header->setCharset($this->_charset);\n\n        return $header;\n    }\n\n    private function _getEncoder($type, $stub = false) {\n        $encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();\n        $encoder->shouldReceive('getName')\n                ->zeroOrMoreTimes()\n                ->andReturn($type);\n\n        return $encoder;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php",
    "content": "<?php\n\nclass Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest{\n    public function testNestingLevelIsSubpart() {\n        $part = $this->_createMimePart($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(\n            Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, $part->getNestingLevel()\n            );\n    }\n\n    public function testCharsetIsReturnedFromHeader() {\n        /* -- RFC 2046, 4.1.2.\n        A critical parameter that may be specified in the Content-Type field\n        for \"text/plain\" data is the character set.  This is specified with a\n        \"charset\" parameter, as in:\n\n     Content-type: text/plain; charset=iso-8859-1\n\n        Unlike some other parameter values, the values of the charset\n        parameter are NOT case sensitive.  The default character set, which\n        must be assumed in the absence of a charset parameter, is US-ASCII.\n        */\n\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('charset' => 'iso-8859-1')\n            );\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('iso-8859-1', $part->getCharset());\n    }\n\n    public function testCharsetIsSetInHeader() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('charset' => 'iso-8859-1'), false\n            );\n        $cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->setCharset('utf-8');\n    }\n\n    public function testCharsetIsSetInHeaderIfPassedToSetBody() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('charset' => 'iso-8859-1'), false\n            );\n        $cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->setBody('', 'text/plian', 'utf-8');\n    }\n\n    public function testSettingCharsetNotifiesEncoder() {\n        $encoder = $this->_createEncoder('quoted-printable', false);\n        $encoder->expects($this->once())\n                ->method('charsetChanged')\n                ->with('utf-8');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(),\n            $encoder, $this->_createCache()\n            );\n        $part->setCharset('utf-8');\n    }\n\n    public function testSettingCharsetNotifiesHeaders() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('charsetChanged')\n                ->zeroOrMoreTimes()\n                ->with('utf-8');\n\n        $part = $this->_createMimePart($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $part->setCharset('utf-8');\n    }\n\n    public function testSettingCharsetNotifiesChildren() {\n        $child = $this->_createChild(0, '', false);\n        $child->shouldReceive('charsetChanged')\n              ->once()\n              ->with('windows-874');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->setChildren(array($child));\n        $part->setCharset('windows-874');\n    }\n\n    public function testCharsetChangeUpdatesCharset() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('charset' => 'iso-8859-1'), false\n            );\n        $cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->charsetChanged('utf-8');\n    }\n\n    public function testSettingCharsetClearsCache() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('toString')\n                ->zeroOrMoreTimes()\n                ->andReturn(\"Content-Type: text/plain; charset=utf-8\\r\\n\");\n\n        $cache = $this->_createCache(false);\n\n        $entity = $this->_createEntity($headers, $this->_createEncoder(),\n            $cache\n            );\n\n        $entity->setBody(\"blah\\r\\nblah!\");\n        $entity->toString();\n\n        // Initialize the expectation here because we only care about what happens in setCharset()\n        $cache->shouldReceive('clearKey')\n                ->once()\n                ->with(\\Mockery::any(), 'body');\n\n        $entity->setCharset('iso-2022');\n    }\n\n    public function testFormatIsReturnedFromHeader() {\n        /* -- RFC 3676.\n     */\n\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('format' => 'flowed')\n            );\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('flowed', $part->getFormat());\n    }\n\n    public function testFormatIsSetInHeader() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $cType->shouldReceive('setParameter')->once()->with('format', 'fixed');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->setFormat('fixed');\n    }\n\n    public function testDelSpIsReturnedFromHeader() {\n        /* -- RFC 3676.\n     */\n\n        $cType = $this->_createHeader('Content-Type', 'text/plain',\n            array('delsp' => 'no')\n            );\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertSame(false, $part->getDelSp());\n    }\n\n    public function testDelSpIsSetInHeader() {\n        $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);\n        $cType->shouldReceive('setParameter')->once()->with('delsp', 'yes');\n\n        $part = $this->_createMimePart($this->_createHeaderSet(array(\n            'Content-Type' => $cType, )),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $part->setDelSp(true);\n    }\n\n    public function testFluidInterface() {\n        $part = $this->_createMimePart($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $this->assertSame($part,\n            $part\n            ->setContentType('text/plain')\n            ->setEncoder($this->_createEncoder())\n            ->setId('foo@bar')\n            ->setDescription('my description')\n            ->setMaxLineLength(998)\n            ->setBody('xx')\n            ->setBoundary('xyz')\n            ->setChildren(array())\n            ->setCharset('utf-8')\n            ->setFormat('flowed')\n            ->setDelSp(true)\n            );\n    }\n\n    // -- Private helpers\n\n    //abstract\n    protected function _createEntity($headers, $encoder, $cache) {\n        return $this->_createMimePart($headers, $encoder, $cache);\n    }\n\n    protected function _createMimePart($headers, $encoder, $cache) {\n        return new Swift_Mime_MimePart($headers, $encoder, $cache, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php",
    "content": "<?php\n\nclass Swift_Mime_SimpleHeaderFactoryTest extends \\PHPUnit_Framework_TestCase{\n    private $_factory;\n\n    public function setUp() {\n        $this->_factory = $this->_createFactory();\n    }\n\n    public function testMailboxHeaderIsCorrectType() {\n        $header = $this->_factory->createMailboxHeader('X-Foo');\n        $this->assertInstanceof('Swift_Mime_Headers_MailboxHeader', $header);\n    }\n\n    public function testMailboxHeaderHasCorrectName() {\n        $header = $this->_factory->createMailboxHeader('X-Foo');\n        $this->assertEquals('X-Foo', $header->getFieldName());\n    }\n\n    public function testMailboxHeaderHasCorrectModel() {\n        $header = $this->_factory->createMailboxHeader('X-Foo',\n            array('foo@bar' => 'FooBar')\n            );\n        $this->assertEquals(array('foo@bar' => 'FooBar'), $header->getFieldBodyModel());\n    }\n\n    public function testDateHeaderHasCorrectType() {\n        $header = $this->_factory->createDateHeader('X-Date');\n        $this->assertInstanceof('Swift_Mime_Headers_DateHeader', $header);\n    }\n\n    public function testDateHeaderHasCorrectName() {\n        $header = $this->_factory->createDateHeader('X-Date');\n        $this->assertEquals('X-Date', $header->getFieldName());\n    }\n\n    public function testDateHeaderHasCorrectModel() {\n        $header = $this->_factory->createDateHeader('X-Date', 123);\n        $this->assertEquals(123, $header->getFieldBodyModel());\n    }\n\n    public function testTextHeaderHasCorrectType() {\n        $header = $this->_factory->createTextHeader('X-Foo');\n        $this->assertInstanceof('Swift_Mime_Headers_UnstructuredHeader', $header);\n    }\n\n    public function testTextHeaderHasCorrectName() {\n        $header = $this->_factory->createTextHeader('X-Foo');\n        $this->assertEquals('X-Foo', $header->getFieldName());\n    }\n\n    public function testTextHeaderHasCorrectModel() {\n        $header = $this->_factory->createTextHeader('X-Foo', 'bar');\n        $this->assertEquals('bar', $header->getFieldBodyModel());\n    }\n\n    public function testParameterizedHeaderHasCorrectType() {\n        $header = $this->_factory->createParameterizedHeader('X-Foo');\n        $this->assertInstanceof('Swift_Mime_Headers_ParameterizedHeader', $header);\n    }\n\n    public function testParameterizedHeaderHasCorrectName() {\n        $header = $this->_factory->createParameterizedHeader('X-Foo');\n        $this->assertEquals('X-Foo', $header->getFieldName());\n    }\n\n    public function testParameterizedHeaderHasCorrectModel() {\n        $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar');\n        $this->assertEquals('bar', $header->getFieldBodyModel());\n    }\n\n    public function testParameterizedHeaderHasCorrectParams() {\n        $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar',\n            array('zip' => 'button')\n            );\n        $this->assertEquals(array('zip' => 'button'), $header->getParameters());\n    }\n\n    public function testIdHeaderHasCorrectType() {\n        $header = $this->_factory->createIdHeader('X-ID');\n        $this->assertInstanceof('Swift_Mime_Headers_IdentificationHeader', $header);\n    }\n\n    public function testIdHeaderHasCorrectName() {\n        $header = $this->_factory->createIdHeader('X-ID');\n        $this->assertEquals('X-ID', $header->getFieldName());\n    }\n\n    public function testIdHeaderHasCorrectModel() {\n        $header = $this->_factory->createIdHeader('X-ID', 'xyz@abc');\n        $this->assertEquals(array('xyz@abc'), $header->getFieldBodyModel());\n    }\n\n    public function testPathHeaderHasCorrectType() {\n        $header = $this->_factory->createPathHeader('X-Path');\n        $this->assertInstanceof('Swift_Mime_Headers_PathHeader', $header);\n    }\n\n    public function testPathHeaderHasCorrectName() {\n        $header = $this->_factory->createPathHeader('X-Path');\n        $this->assertEquals('X-Path', $header->getFieldName());\n    }\n\n    public function testPathHeaderHasCorrectModel() {\n        $header = $this->_factory->createPathHeader('X-Path', 'foo@bar');\n        $this->assertEquals('foo@bar', $header->getFieldBodyModel());\n    }\n\n    public function testCharsetChangeNotificationNotifiesEncoders() {\n        $encoder = $this->_createHeaderEncoder();\n        $encoder->expects($this->once())\n                ->method('charsetChanged')\n                ->with('utf-8');\n        $paramEncoder = $this->_createParamEncoder();\n        $paramEncoder->expects($this->once())\n                     ->method('charsetChanged')\n                     ->with('utf-8');\n\n        $factory = $this->_createFactory($encoder, $paramEncoder);\n\n        $factory->charsetChanged('utf-8');\n    }\n\n    // -- Creation methods\n\n    private function _createFactory($encoder = null, $paramEncoder = null) {\n        return new Swift_Mime_SimpleHeaderFactory(\n            $encoder\n                ? $encoder : $this->_createHeaderEncoder(),\n            $paramEncoder\n                ? $paramEncoder : $this->_createParamEncoder(),\n            new Swift_Mime_Grammar()\n            );\n    }\n\n    private function _createHeaderEncoder() {\n        return $this->getMock('Swift_Mime_HeaderEncoder');\n    }\n\n    private function _createParamEncoder() {\n        return $this->getMock('Swift_Encoder');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php",
    "content": "<?php\n\nclass Swift_Mime_SimpleHeaderSetTest extends \\PHPUnit_Framework_TestCase{\n    public function testAddMailboxHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createMailboxHeader')\n                ->with('From', array('person@domain' => 'Person'))\n                ->will($this->returnValue($this->_createHeader('From')));\n\n        $set = $this->_createSet($factory);\n        $set->addMailboxHeader('From', array('person@domain' => 'Person'));\n    }\n\n    public function testAddDateHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createDateHeader')\n                ->with('Date', 1234)\n                ->will($this->returnValue($this->_createHeader('Date')));\n\n        $set = $this->_createSet($factory);\n        $set->addDateHeader('Date', 1234);\n    }\n\n    public function testAddTextHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createTextHeader')\n                ->with('Subject', 'some text')\n                ->will($this->returnValue($this->_createHeader('Subject')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Subject', 'some text');\n    }\n\n    public function testAddParameterizedHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createParameterizedHeader')\n                ->with('Content-Type', 'text/plain', array('charset' => 'utf-8'))\n                ->will($this->returnValue($this->_createHeader('Content-Type')));\n\n        $set = $this->_createSet($factory);\n        $set->addParameterizedHeader('Content-Type', 'text/plain',\n            array('charset' => 'utf-8')\n            );\n    }\n\n    public function testAddIdHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n    }\n\n    public function testAddPathHeaderDelegatesToFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createPathHeader')\n                ->with('Return-Path', 'some@path')\n                ->will($this->returnValue($this->_createHeader('Return-Path')));\n\n        $set = $this->_createSet($factory);\n        $set->addPathHeader('Return-Path', 'some@path');\n    }\n\n    public function testHasReturnsFalseWhenNoHeaders() {\n        $set = $this->_createSet($this->_createFactory());\n        $this->assertFalse($set->has('Some-Header'));\n    }\n\n    public function testAddedMailboxHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createMailboxHeader')\n                ->with('From', array('person@domain' => 'Person'))\n                ->will($this->returnValue($this->_createHeader('From')));\n\n        $set = $this->_createSet($factory);\n        $set->addMailboxHeader('From', array('person@domain' => 'Person'));\n        $this->assertTrue($set->has('From'));\n    }\n\n    public function testAddedDateHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createDateHeader')\n                ->with('Date', 1234)\n                ->will($this->returnValue($this->_createHeader('Date')));\n\n        $set = $this->_createSet($factory);\n        $set->addDateHeader('Date', 1234);\n        $this->assertTrue($set->has('Date'));\n    }\n\n    public function testAddedTextHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createTextHeader')\n                ->with('Subject', 'some text')\n                ->will($this->returnValue($this->_createHeader('Subject')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Subject', 'some text');\n        $this->assertTrue($set->has('Subject'));\n    }\n\n    public function testAddedParameterizedHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createParameterizedHeader')\n                ->with('Content-Type', 'text/plain', array('charset' => 'utf-8'))\n                ->will($this->returnValue($this->_createHeader('Content-Type')));\n\n        $set = $this->_createSet($factory);\n        $set->addParameterizedHeader('Content-Type', 'text/plain',\n            array('charset' => 'utf-8')\n            );\n        $this->assertTrue($set->has('Content-Type'));\n    }\n\n    public function testAddedIdHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertTrue($set->has('Message-ID'));\n    }\n\n    public function testAddedPathHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createPathHeader')\n                ->with('Return-Path', 'some@path')\n                ->will($this->returnValue($this->_createHeader('Return-Path')));\n\n        $set = $this->_createSet($factory);\n        $set->addPathHeader('Return-Path', 'some@path');\n        $this->assertTrue($set->has('Return-Path'));\n    }\n\n    public function testNewlySetHeaderIsSeenByHas() {\n        $factory = $this->_createFactory();\n        $header = $this->_createHeader('X-Foo', 'bar');\n        $set = $this->_createSet($factory);\n        $set->set($header);\n        $this->assertTrue($set->has('X-Foo'));\n    }\n\n    public function testHasCanAcceptOffset() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertTrue($set->has('Message-ID', 0));\n    }\n\n    public function testHasWithIllegalOffsetReturnsFalse() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertFalse($set->has('Message-ID', 1));\n    }\n\n    public function testHasCanDistinguishMultipleHeaders() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($this->_createHeader('Message-ID')));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $this->assertTrue($set->has('Message-ID', 1));\n    }\n\n    public function testGetWithUnspecifiedOffset() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertSame($header, $set->get('Message-ID'));\n    }\n\n    public function testGetWithSpeiciedOffset() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Message-ID');\n        $header2 = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($header1));\n        $factory->expects($this->at(2))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'more@id')\n                ->will($this->returnValue($header2));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $set->addIdHeader('Message-ID', 'more@id');\n        $this->assertSame($header1, $set->get('Message-ID', 1));\n    }\n\n    public function testGetReturnsNullIfHeaderNotSet() {\n        $set = $this->_createSet($this->_createFactory());\n        $this->assertNull($set->get('Message-ID', 99));\n    }\n\n    public function testGetAllReturnsAllHeadersMatchingName() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Message-ID');\n        $header2 = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($header1));\n        $factory->expects($this->at(2))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'more@id')\n                ->will($this->returnValue($header2));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $set->addIdHeader('Message-ID', 'more@id');\n\n        $this->assertEquals(array($header0, $header1, $header2),\n            $set->getAll('Message-ID')\n            );\n    }\n\n    public function testGetAllReturnsAllHeadersIfNoArguments() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Subject');\n        $header2 = $this->_createHeader('To');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Subject', 'thing')\n                ->will($this->returnValue($header1));\n        $factory->expects($this->at(2))\n                ->method('createIdHeader')\n                ->with('To', 'person@example.org')\n                ->will($this->returnValue($header2));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Subject', 'thing');\n        $set->addIdHeader('To', 'person@example.org');\n\n        $this->assertEquals(array($header0, $header1, $header2),\n            $set->getAll()\n            );\n    }\n\n    public function testGetAllReturnsEmptyArrayIfNoneSet() {\n        $set = $this->_createSet($this->_createFactory());\n        $this->assertEquals(array(), $set->getAll('Received'));\n    }\n\n    public function testRemoveWithUnspecifiedOffset() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->remove('Message-ID');\n        $this->assertFalse($set->has('Message-ID'));\n    }\n\n    public function testRemoveWithSpecifiedIndexRemovesHeader() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($header1));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $set->remove('Message-ID', 1);\n        $this->assertFalse($set->has('Message-ID', 1));\n    }\n\n    public function testRemoveWithSpecifiedIndexLeavesOtherHeaders() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($header1));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $set->remove('Message-ID', 1);\n        $this->assertTrue($set->has('Message-ID', 0));\n    }\n\n    public function testRemoveWithInvalidOffsetDoesNothing() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->remove('Message-ID', 50);\n        $this->assertTrue($set->has('Message-ID'));\n    }\n\n    public function testRemoveAllRemovesAllHeadersWithName() {\n        $header0 = $this->_createHeader('Message-ID');\n        $header1 = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header0));\n        $factory->expects($this->at(1))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'other@id')\n                ->will($this->returnValue($header1));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->addIdHeader('Message-ID', 'other@id');\n        $set->removeAll('Message-ID');\n        $this->assertFalse($set->has('Message-ID', 0));\n        $this->assertFalse($set->has('Message-ID', 1));\n    }\n\n    public function testHasIsNotCaseSensitive() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertTrue($set->has('message-id'));\n    }\n\n    public function testGetIsNotCaseSensitive() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertSame($header, $set->get('message-id'));\n    }\n\n    public function testGetAllIsNotCaseSensitive() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $this->assertEquals(array($header), $set->getAll('message-id'));\n    }\n\n    public function testRemoveIsNotCaseSensitive() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->remove('message-id');\n        $this->assertFalse($set->has('Message-ID'));\n    }\n\n    public function testRemoveAllIsNotCaseSensitive() {\n        $header = $this->_createHeader('Message-ID');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createIdHeader')\n                ->with('Message-ID', 'some@id')\n                ->will($this->returnValue($header));\n\n        $set = $this->_createSet($factory);\n        $set->addIdHeader('Message-ID', 'some@id');\n        $set->removeAll('message-id');\n        $this->assertFalse($set->has('Message-ID'));\n    }\n\n    public function testNewInstance() {\n        $set = $this->_createSet($this->_createFactory());\n        $instance = $set->newInstance();\n        $this->assertInstanceof('Swift_Mime_HeaderSet', $instance);\n    }\n\n    public function testToStringJoinsHeadersTogether() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Foo', 'bar')\n                ->will($this->returnValue($this->_createHeader('Foo', 'bar')));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('Zip', 'buttons')\n                ->will($this->returnValue($this->_createHeader('Zip', 'buttons')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Foo', 'bar');\n        $set->addTextHeader('Zip', 'buttons');\n        $this->assertEquals(\n            \"Foo: bar\\r\\n\".\n            \"Zip: buttons\\r\\n\",\n            $set->toString()\n            );\n    }\n\n    public function testHeadersWithoutBodiesAreNotDisplayed() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Foo', 'bar')\n                ->will($this->returnValue($this->_createHeader('Foo', 'bar')));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('Zip', '')\n                ->will($this->returnValue($this->_createHeader('Zip', '')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Foo', 'bar');\n        $set->addTextHeader('Zip', '');\n        $this->assertEquals(\n            \"Foo: bar\\r\\n\",\n            $set->toString()\n            );\n    }\n\n    public function testHeadersWithoutBodiesCanBeForcedToDisplay() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Foo', '')\n                ->will($this->returnValue($this->_createHeader('Foo', '')));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('Zip', '')\n                ->will($this->returnValue($this->_createHeader('Zip', '')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Foo', '');\n        $set->addTextHeader('Zip', '');\n        $set->setAlwaysDisplayed(array('Foo', 'Zip'));\n        $this->assertEquals(\n            \"Foo: \\r\\n\".\n            \"Zip: \\r\\n\",\n            $set->toString()\n            );\n    }\n\n    public function testHeaderSequencesCanBeSpecified() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Third', 'three')\n                ->will($this->returnValue($this->_createHeader('Third', 'three')));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('First', 'one')\n                ->will($this->returnValue($this->_createHeader('First', 'one')));\n        $factory->expects($this->at(2))\n                ->method('createTextHeader')\n                ->with('Second', 'two')\n                ->will($this->returnValue($this->_createHeader('Second', 'two')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Third', 'three');\n        $set->addTextHeader('First', 'one');\n        $set->addTextHeader('Second', 'two');\n\n        $set->defineOrdering(array('First', 'Second', 'Third'));\n\n        $this->assertEquals(\n            \"First: one\\r\\n\".\n            \"Second: two\\r\\n\".\n            \"Third: three\\r\\n\",\n            $set->toString()\n            );\n    }\n\n    public function testUnsortedHeadersAppearAtEnd() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Fourth', 'four')\n                ->will($this->returnValue($this->_createHeader('Fourth', 'four')));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('Fifth', 'five')\n                ->will($this->returnValue($this->_createHeader('Fifth', 'five')));\n        $factory->expects($this->at(2))\n                ->method('createTextHeader')\n                ->with('Third', 'three')\n                ->will($this->returnValue($this->_createHeader('Third', 'three')));\n        $factory->expects($this->at(3))\n                ->method('createTextHeader')\n                ->with('First', 'one')\n                ->will($this->returnValue($this->_createHeader('First', 'one')));\n        $factory->expects($this->at(4))\n                ->method('createTextHeader')\n                ->with('Second', 'two')\n                ->will($this->returnValue($this->_createHeader('Second', 'two')));\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Fourth', 'four');\n        $set->addTextHeader('Fifth', 'five');\n        $set->addTextHeader('Third', 'three');\n        $set->addTextHeader('First', 'one');\n        $set->addTextHeader('Second', 'two');\n\n        $set->defineOrdering(array('First', 'Second', 'Third'));\n\n        $this->assertEquals(\n            \"First: one\\r\\n\".\n            \"Second: two\\r\\n\".\n            \"Third: three\\r\\n\".\n            \"Fourth: four\\r\\n\".\n            \"Fifth: five\\r\\n\",\n            $set->toString()\n            );\n    }\n\n    public function testSettingCharsetNotifiesAlreadyExistingHeaders() {\n        $subject = $this->_createHeader('Subject', 'some text');\n        $xHeader = $this->_createHeader('X-Header', 'some text');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Subject', 'some text')\n                ->will($this->returnValue($subject));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('X-Header', 'some text')\n                ->will($this->returnValue($xHeader));\n        $subject->expects($this->once())\n                ->method('setCharset')\n                ->with('utf-8');\n        $xHeader->expects($this->once())\n                ->method('setCharset')\n                ->with('utf-8');\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Subject', 'some text');\n        $set->addTextHeader('X-Header', 'some text');\n\n        $set->setCharset('utf-8');\n    }\n\n    public function testCharsetChangeNotifiesAlreadyExistingHeaders() {\n        $subject = $this->_createHeader('Subject', 'some text');\n        $xHeader = $this->_createHeader('X-Header', 'some text');\n        $factory = $this->_createFactory();\n        $factory->expects($this->at(0))\n                ->method('createTextHeader')\n                ->with('Subject', 'some text')\n                ->will($this->returnValue($subject));\n        $factory->expects($this->at(1))\n                ->method('createTextHeader')\n                ->with('X-Header', 'some text')\n                ->will($this->returnValue($xHeader));\n        $subject->expects($this->once())\n                ->method('setCharset')\n                ->with('utf-8');\n        $xHeader->expects($this->once())\n                ->method('setCharset')\n                ->with('utf-8');\n\n        $set = $this->_createSet($factory);\n        $set->addTextHeader('Subject', 'some text');\n        $set->addTextHeader('X-Header', 'some text');\n\n        $set->charsetChanged('utf-8');\n    }\n\n    public function testCharsetChangeNotifiesFactory() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('charsetChanged')\n                ->with('utf-8');\n\n        $set = $this->_createSet($factory);\n\n        $set->setCharset('utf-8');\n    }\n\n    // -- Creation methods\n\n    private function _createSet($factory) {\n        return new Swift_Mime_SimpleHeaderSet($factory);\n    }\n\n    private function _createFactory() {\n        return $this->getMock('Swift_Mime_HeaderFactory');\n    }\n\n    private function _createHeader($name, $body = '') {\n        $header = $this->getMock('Swift_Mime_Header');\n        $header->expects($this->any())\n               ->method('getFieldName')\n               ->will($this->returnValue($name));\n        $header->expects($this->any())\n               ->method('toString')\n               ->will($this->returnValue(sprintf(\"%s: %s\\r\\n\", $name, $body)));\n        $header->expects($this->any())\n               ->method('getFieldBody')\n               ->will($this->returnValue($body));\n\n        return $header;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php",
    "content": "<?php\n\nclass Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest{\n    public function testNestingLevelIsSubpart() {\n        //Overridden\n    }\n\n    public function testNestingLevelIsTop() {\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(\n            Swift_Mime_MimeEntity::LEVEL_TOP, $message->getNestingLevel()\n            );\n    }\n\n    public function testDateIsReturnedFromHeader() {\n        $date = $this->_createHeader('Date', 123);\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Date' => $date)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(123, $message->getDate());\n    }\n\n    public function testDateIsSetInHeader() {\n        $date = $this->_createHeader('Date', 123, array(), false);\n        $date->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with(1234);\n        $date->shouldReceive('setFieldBodyModel')\n             ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Date' => $date)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setDate(1234);\n    }\n\n    public function testDateHeaderIsCreatedIfNonePresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addDateHeader')\n                ->once()\n                ->with('Date', 1234);\n        $headers->shouldReceive('addDateHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setDate(1234);\n    }\n\n    public function testDateHeaderIsAddedDuringConstruction() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addDateHeader')\n                ->once()\n                ->with('Date', '/^[0-9]+$/D');\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n    }\n\n    public function testIdIsReturnedFromHeader() {\n        /* -- RFC 2045, 7.\n        In constructing a high-level user agent, it may be desirable to allow\n        one body to make reference to another.  Accordingly, bodies may be\n        labelled using the \"Content-ID\" header field, which is syntactically\n        identical to the \"Message-ID\" header field\n        */\n\n        $messageId = $this->_createHeader('Message-ID', 'a@b');\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Message-ID' => $messageId)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('a@b', $message->getId());\n    }\n\n    public function testIdIsSetInHeader() {\n        $messageId = $this->_createHeader('Message-ID', 'a@b', array(), false);\n        $messageId->shouldReceive('setFieldBodyModel')\n                  ->once()\n                  ->with('x@y');\n        $messageId->shouldReceive('setFieldBodyModel')\n                  ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Message-ID' => $messageId)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setId('x@y');\n    }\n\n    public function testIdIsAutoGenerated() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addIdHeader')\n                ->once()\n                ->with('Message-ID', '/^.*?@.*?$/D');\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n    }\n\n    public function testSubjectIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.5.\n     */\n\n        $subject = $this->_createHeader('Subject', 'example subject');\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Subject' => $subject)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('example subject', $message->getSubject());\n    }\n\n    public function testSubjectIsSetInHeader() {\n        $subject = $this->_createHeader('Subject', '', array(), false);\n        $subject->shouldReceive('setFieldBodyModel')\n                ->once()\n                ->with('foo');\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Subject' => $subject)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setSubject('foo');\n    }\n\n    public function testSubjectHeaderIsCreatedIfNotPresent() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addTextHeader')\n                ->once()\n                ->with('Subject', 'example subject');\n        $headers->shouldReceive('addTextHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setSubject('example subject');\n    }\n\n    public function testReturnPathIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.7.\n     */\n\n        $path = $this->_createHeader('Return-Path', 'bounces@domain');\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Return-Path' => $path)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals('bounces@domain', $message->getReturnPath());\n    }\n\n    public function testReturnPathIsSetInHeader() {\n        $path = $this->_createHeader('Return-Path', '', array(), false);\n        $path->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with('bounces@domain');\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Return-Path' => $path)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setReturnPath('bounces@domain');\n    }\n\n    public function testReturnPathHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addPathHeader')\n                ->once()\n                ->with('Return-Path', 'bounces@domain');\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setReturnPath('bounces@domain');\n    }\n\n    public function testSenderIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.2.\n     */\n\n        $sender = $this->_createHeader('Sender', array('sender@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Sender' => $sender)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('sender@domain' => 'Name'), $message->getSender());\n    }\n\n    public function testSenderIsSetInHeader() {\n        $sender = $this->_createHeader('Sender', array('sender@domain' => 'Name'),\n            array(), false\n            );\n        $sender->shouldReceive('setFieldBodyModel')\n               ->once()\n               ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Sender' => $sender)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setSender(array('other@domain' => 'Other'));\n    }\n\n    public function testSenderHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Sender', (array) 'sender@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setSender('sender@domain');\n    }\n\n    public function testNameCanBeUsedInSenderHeader() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Sender', array('sender@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setSender('sender@domain', 'Name');\n    }\n\n    public function testFromIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.2.\n     */\n\n        $from = $this->_createHeader('From', array('from@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('From' => $from)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('from@domain' => 'Name'), $message->getFrom());\n    }\n\n    public function testFromIsSetInHeader() {\n        $from = $this->_createHeader('From', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $from->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('From' => $from)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setFrom(array('other@domain' => 'Other'));\n    }\n\n    public function testFromIsAddedToHeadersDuringAddFrom() {\n        $from = $this->_createHeader('From', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $from->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('From' => $from)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->addFrom('other@domain', 'Other');\n    }\n\n    public function testFromHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('From', (array) 'from@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setFrom('from@domain');\n    }\n\n    public function testPersonalNameCanBeUsedInFromAddress() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('From', array('from@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setFrom('from@domain', 'Name');\n    }\n\n    public function testReplyToIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.2.\n     */\n\n        $reply = $this->_createHeader('Reply-To', array('reply@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Reply-To' => $reply)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('reply@domain' => 'Name'), $message->getReplyTo());\n    }\n\n    public function testReplyToIsSetInHeader() {\n        $reply = $this->_createHeader('Reply-To', array('reply@domain' => 'Name'),\n            array(), false\n            );\n        $reply->shouldReceive('setFieldBodyModel')\n              ->once()\n              ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Reply-To' => $reply)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setReplyTo(array('other@domain' => 'Other'));\n    }\n\n    public function testReplyToIsAddedToHeadersDuringAddReplyTo() {\n        $replyTo = $this->_createHeader('Reply-To', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $replyTo->shouldReceive('setFieldBodyModel')\n                ->once()\n                ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Reply-To' => $replyTo)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->addReplyTo('other@domain', 'Other');\n    }\n\n    public function testReplyToHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Reply-To', (array) 'reply@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setReplyTo('reply@domain');\n    }\n\n    public function testNameCanBeUsedInReplyTo() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Reply-To', array('reply@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setReplyTo('reply@domain', 'Name');\n    }\n\n    public function testToIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.3.\n     */\n\n        $to = $this->_createHeader('To', array('to@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('To' => $to)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('to@domain' => 'Name'), $message->getTo());\n    }\n\n    public function testToIsSetInHeader() {\n        $to = $this->_createHeader('To', array('to@domain' => 'Name'),\n            array(), false\n            );\n        $to->shouldReceive('setFieldBodyModel')\n           ->once()\n           ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('To' => $to)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setTo(array('other@domain' => 'Other'));\n    }\n\n    public function testToIsAddedToHeadersDuringAddTo() {\n        $to = $this->_createHeader('To', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $to->shouldReceive('setFieldBodyModel')\n           ->once()\n           ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('To' => $to)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->addTo('other@domain', 'Other');\n    }\n\n    public function testToHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('To', (array) 'to@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setTo('to@domain');\n    }\n\n    public function testNameCanBeUsedInToHeader() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('To', array('to@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setTo('to@domain', 'Name');\n    }\n\n    public function testCcIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.3.\n     */\n\n        $cc = $this->_createHeader('Cc', array('cc@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Cc' => $cc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('cc@domain' => 'Name'), $message->getCc());\n    }\n\n    public function testCcIsSetInHeader() {\n        $cc = $this->_createHeader('Cc', array('cc@domain' => 'Name'),\n            array(), false\n            );\n        $cc->shouldReceive('setFieldBodyModel')\n           ->once()\n           ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Cc' => $cc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setCc(array('other@domain' => 'Other'));\n    }\n\n    public function testCcIsAddedToHeadersDuringAddCc() {\n        $cc = $this->_createHeader('Cc', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $cc->shouldReceive('setFieldBodyModel')\n           ->once()\n           ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Cc' => $cc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->addCc('other@domain', 'Other');\n    }\n\n    public function testCcHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Cc', (array) 'cc@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setCc('cc@domain');\n    }\n\n    public function testNameCanBeUsedInCcHeader() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Cc', array('cc@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setCc('cc@domain', 'Name');\n    }\n\n    public function testBccIsReturnedFromHeader() {\n        /* -- RFC 2822, 3.6.3.\n     */\n\n        $bcc = $this->_createHeader('Bcc', array('bcc@domain' => 'Name'));\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Bcc' => $bcc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('bcc@domain' => 'Name'), $message->getBcc());\n    }\n\n    public function testBccIsSetInHeader() {\n        $bcc = $this->_createHeader('Bcc', array('bcc@domain' => 'Name'),\n            array(), false\n            );\n        $bcc->shouldReceive('setFieldBodyModel')\n            ->once()\n            ->with(array('other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Bcc' => $bcc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setBcc(array('other@domain' => 'Other'));\n    }\n\n    public function testBccIsAddedToHeadersDuringAddBcc() {\n        $bcc = $this->_createHeader('Bcc', array('from@domain' => 'Name'),\n            array(), false\n            );\n        $bcc->shouldReceive('setFieldBodyModel')\n            ->once()\n            ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Bcc' => $bcc)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->addBcc('other@domain', 'Other');\n    }\n\n    public function testBccHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Bcc', (array) 'bcc@domain');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setBcc('bcc@domain');\n    }\n\n    public function testNameCanBeUsedInBcc() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Bcc', array('bcc@domain' => 'Name'));\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setBcc('bcc@domain', 'Name');\n    }\n\n    public function testPriorityIsReadFromHeader() {\n        $prio = $this->_createHeader('X-Priority', '2 (High)');\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('X-Priority' => $prio)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(2, $message->getPriority());\n    }\n\n    public function testPriorityIsSetInHeader() {\n        $prio = $this->_createHeader('X-Priority', '2 (High)', array(), false);\n        $prio->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with('5 (Lowest)');\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('X-Priority' => $prio)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setPriority(5);\n    }\n\n    public function testPriorityHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addTextHeader')\n                ->once()\n                ->with('X-Priority', '4 (Low)');\n        $headers->shouldReceive('addTextHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setPriority(4);\n    }\n\n    public function testReadReceiptAddressReadFromHeader() {\n        $rcpt = $this->_createHeader('Disposition-Notification-To',\n            array('chris@swiftmailer.org' => 'Chris')\n            );\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertEquals(array('chris@swiftmailer.org' => 'Chris'),\n            $message->getReadReceiptTo()\n            );\n    }\n\n    public function testReadReceiptIsSetInHeader() {\n        $rcpt = $this->_createHeader('Disposition-Notification-To', array(), array(), false);\n        $rcpt->shouldReceive('setFieldBodyModel')\n             ->once()\n             ->with('mark@swiftmailer.org');\n\n        $message = $this->_createMessage(\n            $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $message->setReadReceiptTo('mark@swiftmailer.org');\n    }\n\n    public function testReadReceiptHeaderIsAddedIfNoneSet() {\n        $headers = $this->_createHeaderSet(array(), false);\n        $headers->shouldReceive('addMailboxHeader')\n                ->once()\n                ->with('Disposition-Notification-To', 'mark@swiftmailer.org');\n        $headers->shouldReceive('addMailboxHeader')\n                ->zeroOrMoreTimes();\n\n        $message = $this->_createMessage($headers, $this->_createEncoder(),\n            $this->_createCache()\n            );\n        $message->setReadReceiptTo('mark@swiftmailer.org');\n    }\n\n    public function testChildrenCanBeAttached() {\n        $child1 = $this->_createChild();\n        $child2 = $this->_createChild();\n\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $message->attach($child1);\n        $message->attach($child2);\n\n        $this->assertEquals(array($child1, $child2), $message->getChildren());\n    }\n\n    public function testChildrenCanBeDetached() {\n        $child1 = $this->_createChild();\n        $child2 = $this->_createChild();\n\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $message->attach($child1);\n        $message->attach($child2);\n\n        $message->detach($child1);\n\n        $this->assertEquals(array($child2), $message->getChildren());\n    }\n\n    public function testEmbedAttachesChild() {\n        $child = $this->_createChild();\n\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $message->embed($child);\n\n        $this->assertEquals(array($child), $message->getChildren());\n    }\n\n    public function testEmbedReturnsValidCid() {\n        $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_RELATED, '',\n            false\n            );\n        $child->shouldReceive('getId')\n              ->zeroOrMoreTimes()\n              ->andReturn('foo@bar');\n\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n\n        $this->assertEquals('cid:foo@bar', $message->embed($child));\n    }\n\n    public function testFluidInterface() {\n        $child = $this->_createChild();\n        $message = $this->_createMessage($this->_createHeaderSet(),\n            $this->_createEncoder(), $this->_createCache()\n            );\n        $this->assertSame($message,\n            $message\n            ->setContentType('text/plain')\n            ->setEncoder($this->_createEncoder())\n            ->setId('foo@bar')\n            ->setDescription('my description')\n            ->setMaxLineLength(998)\n            ->setBody('xx')\n            ->setBoundary('xyz')\n            ->setChildren(array())\n            ->setCharset('iso-8859-1')\n            ->setFormat('flowed')\n            ->setDelSp(false)\n            ->setSubject('subj')\n            ->setDate(123)\n            ->setReturnPath('foo@bar')\n            ->setSender('foo@bar')\n            ->setFrom(array('x@y' => 'XY'))\n            ->setReplyTo(array('ab@cd' => 'ABCD'))\n            ->setTo(array('chris@site.tld', 'mark@site.tld'))\n            ->setCc('john@somewhere.tld')\n            ->setBcc(array('one@site', 'two@site' => 'Two'))\n            ->setPriority(4)\n            ->setReadReceiptTo('a@b')\n            ->attach($child)\n            ->detach($child)\n            );\n    }\n\n    // -- Private helpers\n\n    //abstract\n    protected function _createEntity($headers, $encoder, $cache) {\n        return $this->_createMessage($headers, $encoder, $cache);\n    }\n\n    protected function _createMimePart($headers, $encoder, $cache) {\n        return $this->_createMessage($headers, $encoder, $cache);\n    }\n\n    private function _createMessage($headers, $encoder, $cache) {\n        return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php",
    "content": "<?php\n\nclass Swift_Mime_SimpleMimeEntityTest extends Swift_Mime_AbstractMimeEntityTest{\n    // -- Private helpers\n\n    protected function _createEntity($headerFactory, $encoder, $cache) {\n        return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, new Swift_Mime_Grammar());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_AntiFloodPluginTest extends \\PHPUnit_Framework_TestCase{\n    public function testThresholdCanBeSetAndFetched() {\n        $plugin = new Swift_Plugins_AntiFloodPlugin(10);\n        $this->assertEquals(10, $plugin->getThreshold());\n        $plugin->setThreshold(100);\n        $this->assertEquals(100, $plugin->getThreshold());\n    }\n\n    public function testSleepTimeCanBeSetAndFetched() {\n        $plugin = new Swift_Plugins_AntiFloodPlugin(10, 5);\n        $this->assertEquals(5, $plugin->getSleepTime());\n        $plugin->setSleepTime(1);\n        $this->assertEquals(1, $plugin->getSleepTime());\n    }\n\n    public function testPluginStopsConnectionAfterThreshold() {\n        $transport = $this->_createTransport();\n        $transport->expects($this->once())\n                  ->method('start');\n        $transport->expects($this->once())\n                  ->method('stop');\n\n        $evt = $this->_createSendEvent($transport);\n\n        $plugin = new Swift_Plugins_AntiFloodPlugin(10);\n        for ($i = 0; $i < 12; ++$i) {\n            $plugin->sendPerformed($evt);\n        }\n    }\n\n    public function testPluginCanStopAndStartMultipleTimes() {\n        $transport = $this->_createTransport();\n        $transport->expects($this->exactly(5))\n                  ->method('start');\n        $transport->expects($this->exactly(5))\n                  ->method('stop');\n\n        $evt = $this->_createSendEvent($transport);\n\n        $plugin = new Swift_Plugins_AntiFloodPlugin(2);\n        for ($i = 0; $i < 11; ++$i) {\n            $plugin->sendPerformed($evt);\n        }\n    }\n\n    public function testPluginCanSleepDuringRestart() {\n        $sleeper = $this->getMock('Swift_Plugins_Sleeper');\n        $sleeper->expects($this->once())\n                ->method('sleep')\n                ->with(10);\n\n        $transport = $this->_createTransport();\n        $transport->expects($this->once())\n                  ->method('start');\n        $transport->expects($this->once())\n                  ->method('stop');\n\n        $evt = $this->_createSendEvent($transport);\n\n        $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper);\n        for ($i = 0; $i < 101; ++$i) {\n            $plugin->sendPerformed($evt);\n        }\n    }\n\n    // -- Creation Methods\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n\n    private function _createSendEvent($transport) {\n        $evt = $this->getMockBuilder('Swift_Events_SendEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getSource')\n            ->will($this->returnValue($transport));\n        $evt->expects($this->any())\n            ->method('getTransport')\n            ->will($this->returnValue($transport));\n\n        return $evt;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_BandwidthMonitorPluginTest extends \\PHPUnit_Framework_TestCase{\n    private $_monitor;\n\n    private $_bytes = 0;\n\n    public function setUp() {\n        $this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin();\n    }\n\n    public function testBytesOutIncreasesWhenCommandsSent() {\n        $evt = $this->_createCommandEvent(\"RCPT TO:<foo@bar.com>\\r\\n\");\n\n        $this->assertEquals(0, $this->_monitor->getBytesOut());\n        $this->_monitor->commandSent($evt);\n        $this->assertEquals(23, $this->_monitor->getBytesOut());\n        $this->_monitor->commandSent($evt);\n        $this->assertEquals(46, $this->_monitor->getBytesOut());\n    }\n\n    public function testBytesInIncreasesWhenResponsesReceived() {\n        $evt = $this->_createResponseEvent(\"250 Ok\\r\\n\");\n\n        $this->assertEquals(0, $this->_monitor->getBytesIn());\n        $this->_monitor->responseReceived($evt);\n        $this->assertEquals(8, $this->_monitor->getBytesIn());\n        $this->_monitor->responseReceived($evt);\n        $this->assertEquals(16, $this->_monitor->getBytesIn());\n    }\n\n    public function testCountersCanBeReset() {\n        $evt = $this->_createResponseEvent(\"250 Ok\\r\\n\");\n\n        $this->assertEquals(0, $this->_monitor->getBytesIn());\n        $this->_monitor->responseReceived($evt);\n        $this->assertEquals(8, $this->_monitor->getBytesIn());\n        $this->_monitor->responseReceived($evt);\n        $this->assertEquals(16, $this->_monitor->getBytesIn());\n\n        $evt = $this->_createCommandEvent(\"RCPT TO:<foo@bar.com>\\r\\n\");\n\n        $this->assertEquals(0, $this->_monitor->getBytesOut());\n        $this->_monitor->commandSent($evt);\n        $this->assertEquals(23, $this->_monitor->getBytesOut());\n        $this->_monitor->commandSent($evt);\n        $this->assertEquals(46, $this->_monitor->getBytesOut());\n\n        $this->_monitor->reset();\n\n        $this->assertEquals(0, $this->_monitor->getBytesOut());\n        $this->assertEquals(0, $this->_monitor->getBytesIn());\n    }\n\n    public function testBytesOutIncreasesAccordingToMessageLength() {\n        $message = $this->_createMessageWithByteCount(6);\n        $evt = $this->_createSendEvent($message);\n\n        $this->assertEquals(0, $this->_monitor->getBytesOut());\n        $this->_monitor->sendPerformed($evt);\n        $this->assertEquals(6, $this->_monitor->getBytesOut());\n        $this->_monitor->sendPerformed($evt);\n        $this->assertEquals(12, $this->_monitor->getBytesOut());\n    }\n\n    // -- Creation Methods\n\n    private function _createSendEvent($message) {\n        $evt = $this->getMockBuilder('Swift_Events_SendEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getMessage')\n            ->will($this->returnValue($message));\n\n        return $evt;\n    }\n\n    private function _createCommandEvent($command) {\n        $evt = $this->getMockBuilder('Swift_Events_CommandEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getCommand')\n            ->will($this->returnValue($command));\n\n        return $evt;\n    }\n\n    private function _createResponseEvent($response) {\n        $evt = $this->getMockBuilder('Swift_Events_ResponseEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getResponse')\n            ->will($this->returnValue($response));\n\n        return $evt;\n    }\n\n    private function _createMessageWithByteCount($bytes) {\n        $this->_bytes = $bytes;\n        $msg = $this->getMock('Swift_Mime_Message');\n        $msg->expects($this->any())\n            ->method('toByteStream')\n            ->will($this->returnCallback(array($this, '_write')));\n      /*  $this->_checking(Expectations::create()\n            -> ignoring($msg)->toByteStream(any()) -> calls(array($this, '_write'))\n        ); */\n\n        return $msg;\n    }\n\n    public function _write($is) {\n        for ($i = 0; $i < $this->_bytes; ++$i) {\n            $is->write('x');\n        }\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_DecoratorPluginTest extends \\SwiftMailerTestCase{\n    public function testMessageBodyReceivesReplacements() {\n        $message = $this->_createMessage(\n            $this->_createHeaders(),\n            array('zip@button.tld' => 'Zipathon'),\n            array('chris.corbyn@swiftmailer.org' => 'Chris'),\n            'Subject',\n            'Hello {name}, you are customer #{id}'\n            );\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Hello Zip, you are customer #456');\n        $message->shouldReceive('setBody')\n                ->zeroOrMoreTimes();\n\n        $plugin = $this->_createPlugin(\n            array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))\n            );\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReplacementsCanBeAppliedToSameMessageMultipleTimes() {\n        $message = $this->_createMessage(\n            $this->_createHeaders(),\n            array('zip@button.tld' => 'Zipathon', 'foo@bar.tld' => 'Foo'),\n            array('chris.corbyn@swiftmailer.org' => 'Chris'),\n            'Subject',\n            'Hello {name}, you are customer #{id}'\n            );\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Hello Zip, you are customer #456');\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Hello {name}, you are customer #{id}');\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Hello Foo, you are customer #123');\n        $message->shouldReceive('setBody')\n                ->zeroOrMoreTimes();\n\n        $plugin = $this->_createPlugin(\n            array(\n                'foo@bar.tld' => array('{name}' => 'Foo', '{id}' => '123'),\n                'zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'),\n                )\n            );\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReplacementsCanBeMadeInHeaders() {\n        $headers = $this->_createHeaders(array(\n            $returnPathHeader = $this->_createHeader('Return-Path', 'foo-{id}@swiftmailer.org'),\n            $toHeader = $this->_createHeader('Subject', 'A message for {name}!'),\n        ));\n\n        $message = $this->_createMessage(\n            $headers,\n            array('zip@button.tld' => 'Zipathon'),\n            array('chris.corbyn@swiftmailer.org' => 'Chris'),\n            'A message for {name}!',\n            'Hello {name}, you are customer #{id}'\n            );\n\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Hello Zip, you are customer #456');\n        $toHeader->shouldReceive('setFieldBodyModel')\n                 ->once()\n                 ->with('A message for Zip!');\n        $returnPathHeader->shouldReceive('setFieldBodyModel')\n                         ->once()\n                         ->with('foo-456@swiftmailer.org');\n        $message->shouldReceive('setBody')\n                ->zeroOrMoreTimes();\n        $toHeader->shouldReceive('setFieldBodyModel')\n                 ->zeroOrMoreTimes();\n        $returnPathHeader->shouldReceive('setFieldBodyModel')\n                         ->zeroOrMoreTimes();\n\n        $plugin = $this->_createPlugin(\n            array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))\n            );\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReplacementsAreMadeOnSubparts() {\n        $part1 = $this->_createPart('text/plain', 'Your name is {name}?', '1@x');\n        $part2 = $this->_createPart('text/html', 'Your <em>name</em> is {name}?', '2@x');\n        $message = $this->_createMessage(\n            $this->_createHeaders(),\n            array('zip@button.tld' => 'Zipathon'),\n            array('chris.corbyn@swiftmailer.org' => 'Chris'),\n            'A message for {name}!',\n            'Subject'\n            );\n        $message->shouldReceive('getChildren')\n                ->zeroOrMoreTimes()\n                ->andReturn(array($part1, $part2));\n        $part1->shouldReceive('setBody')\n              ->once()\n              ->with('Your name is Zip?');\n        $part2->shouldReceive('setBody')\n              ->once()\n              ->with('Your <em>name</em> is Zip?');\n        $part1->shouldReceive('setBody')\n              ->zeroOrMoreTimes();\n        $part2->shouldReceive('setBody')\n              ->zeroOrMoreTimes();\n\n        $plugin = $this->_createPlugin(\n            array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))\n            );\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReplacementsCanBeTakenFromCustomReplacementsObject() {\n        $message = $this->_createMessage(\n            $this->_createHeaders(),\n            array('foo@bar' => 'Foobar', 'zip@zap' => 'Zip zap'),\n            array('chris.corbyn@swiftmailer.org' => 'Chris'),\n            'Subject',\n            'Something {a}'\n            );\n\n        $replacements = $this->_createReplacements();\n\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Something b');\n        $message->shouldReceive('setBody')\n                ->once()\n                ->with('Something c');\n        $message->shouldReceive('setBody')\n                ->zeroOrMoreTimes();\n        $replacements->shouldReceive('getReplacementsFor')\n                     ->once()\n                     ->with('foo@bar')\n                     ->andReturn(array('{a}' => 'b'));\n        $replacements->shouldReceive('getReplacementsFor')\n                     ->once()\n                     ->with('zip@zap')\n                     ->andReturn(array('{a}' => 'c'));\n\n        $plugin = $this->_createPlugin($replacements);\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n        $plugin->beforeSendPerformed($evt);\n        $plugin->sendPerformed($evt);\n    }\n\n    // -- Creation methods\n\n    private function _createMessage($headers, $to = array(), $from = null, $subject = null,\n        $body = null) {\n        $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n        foreach ($to as $addr => $name) {\n            $message->shouldReceive('getTo')\n                    ->once()\n                    ->andReturn(array($addr => $name));\n        }\n        $message->shouldReceive('getHeaders')\n                ->zeroOrMoreTimes()\n                ->andReturn($headers);\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn($from);\n        $message->shouldReceive('getSubject')\n                ->zeroOrMoreTimes()\n                ->andReturn($subject);\n        $message->shouldReceive('getBody')\n                ->zeroOrMoreTimes()\n                ->andReturn($body);\n\n        return $message;\n    }\n\n    private function _createPlugin($replacements) {\n        return new Swift_Plugins_DecoratorPlugin($replacements);\n    }\n\n    private function _createReplacements() {\n        return $this->getMockery('Swift_Plugins_Decorator_Replacements')->shouldIgnoreMissing();\n    }\n\n    private function _createSendEvent(Swift_Mime_Message $message) {\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $evt->shouldReceive('getMessage')\n            ->zeroOrMoreTimes()\n            ->andReturn($message);\n\n        return $evt;\n    }\n\n    private function _createPart($type, $body, $id) {\n        $part = $this->getMockery('Swift_Mime_MimeEntity')->shouldIgnoreMissing();\n        $part->shouldReceive('getContentType')\n             ->zeroOrMoreTimes()\n             ->andReturn($type);\n        $part->shouldReceive('getBody')\n             ->zeroOrMoreTimes()\n             ->andReturn($body);\n        $part->shouldReceive('getId')\n             ->zeroOrMoreTimes()\n             ->andReturn($id);\n\n        return $part;\n    }\n\n    private function _createHeaders($headers = array()) {\n        $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();\n        $set->shouldReceive('getAll')\n            ->zeroOrMoreTimes()\n            ->andReturn($headers);\n\n        foreach ($headers as $header) {\n            $set->set($header);\n        }\n\n        return $set;\n    }\n\n    private function _createHeader($name, $body = '') {\n        $header = $this->getMockery('Swift_Mime_Header')->shouldIgnoreMissing();\n        $header->shouldReceive('getFieldName')\n               ->zeroOrMoreTimes()\n               ->andReturn($name);\n        $header->shouldReceive('getFieldBodyModel')\n               ->zeroOrMoreTimes()\n               ->andReturn($body);\n\n        return $header;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_LoggerPluginTest extends \\SwiftMailerTestCase{\n    public function testLoggerDelegatesAddingEntries() {\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with('foo');\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->add('foo');\n    }\n\n    public function testLoggerDelegatesDumpingEntries() {\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('dump')\n               ->will($this->returnValue('foobar'));\n\n        $plugin = $this->_createPlugin($logger);\n        $this->assertEquals('foobar', $plugin->dump());\n    }\n\n    public function testLoggerDelegatesClearingEntries() {\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('clear');\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->clear();\n    }\n\n    public function testCommandIsSentToLogger() {\n        $evt = $this->_createCommandEvent(\"foo\\r\\n\");\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->regExp('~foo\\r\\n~'));\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->commandSent($evt);\n    }\n\n    public function testResponseIsSentToLogger() {\n        $evt = $this->_createResponseEvent(\"354 Go ahead\\r\\n\");\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->regExp('~354 Go ahead\\r\\n~'));\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->responseReceived($evt);\n    }\n\n    public function testTransportBeforeStartChangeIsSentToLogger() {\n        $evt = $this->_createTransportChangeEvent();\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->anything());\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->beforeTransportStarted($evt);\n    }\n\n    public function testTransportStartChangeIsSentToLogger() {\n        $evt = $this->_createTransportChangeEvent();\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->anything());\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->transportStarted($evt);\n    }\n\n    public function testTransportStopChangeIsSentToLogger() {\n        $evt = $this->_createTransportChangeEvent();\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->anything());\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->transportStopped($evt);\n    }\n\n    public function testTransportBeforeStopChangeIsSentToLogger() {\n        $evt = $this->_createTransportChangeEvent();\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->anything());\n\n        $plugin = $this->_createPlugin($logger);\n        $plugin->beforeTransportStopped($evt);\n    }\n\n    public function testExceptionsArePassedToDelegateAndLeftToBubbleUp() {\n        $transport = $this->_createTransport();\n        $evt = $this->_createTransportExceptionEvent();\n        $logger = $this->_createLogger();\n        $logger->expects($this->once())\n               ->method('add')\n               ->with($this->anything());\n\n        $plugin = $this->_createPlugin($logger);\n        try {\n            $plugin->exceptionThrown($evt);\n            $this->fail('Exception should bubble up.');\n        } catch (Swift_TransportException $ex) {\n        }\n    }\n\n    // -- Creation Methods\n\n    private function _createLogger() {\n        return $this->getMock('Swift_Plugins_Logger');\n    }\n\n    private function _createPlugin($logger) {\n        return new Swift_Plugins_LoggerPlugin($logger);\n    }\n\n    private function _createCommandEvent($command) {\n        $evt = $this->getMockBuilder('Swift_Events_CommandEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getCommand')\n            ->will($this->returnValue($command));\n\n        return $evt;\n    }\n\n    private function _createResponseEvent($response) {\n        $evt = $this->getMockBuilder('Swift_Events_ResponseEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getResponse')\n            ->will($this->returnValue($response));\n\n        return $evt;\n    }\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n\n    private function _createTransportChangeEvent() {\n        $evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getSource')\n            ->will($this->returnValue($this->_createTransport()));\n\n        return $evt;\n    }\n\n    public function _createTransportExceptionEvent() {\n        $evt = $this->getMockBuilder('Swift_Events_TransportExceptionEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getException')\n            ->will($this->returnValue(new Swift_TransportException('')));\n\n        return $evt;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php",
    "content": "<?php\n\nclass Swift_Plugins_Loggers_ArrayLoggerTest extends \\PHPUnit_Framework_TestCase{\n    public function testAddingSingleEntryDumpsSingleLine() {\n        $logger = new Swift_Plugins_Loggers_ArrayLogger();\n        $logger->add(\">> Foo\\r\\n\");\n        $this->assertEquals(\">> Foo\\r\\n\", $logger->dump());\n    }\n\n    public function testAddingMultipleEntriesDumpsMultipleLines() {\n        $logger = new Swift_Plugins_Loggers_ArrayLogger();\n        $logger->add(\">> FOO\\r\\n\");\n        $logger->add(\"<< 502 That makes no sense\\r\\n\");\n        $logger->add(\">> RSET\\r\\n\");\n        $logger->add(\"<< 250 OK\\r\\n\");\n\n        $this->assertEquals(\n            \">> FOO\\r\\n\".PHP_EOL.\n            \"<< 502 That makes no sense\\r\\n\".PHP_EOL.\n            \">> RSET\\r\\n\".PHP_EOL.\n            \"<< 250 OK\\r\\n\",\n            $logger->dump()\n            );\n    }\n\n    public function testLogCanBeCleared() {\n        $logger = new Swift_Plugins_Loggers_ArrayLogger();\n        $logger->add(\">> FOO\\r\\n\");\n        $logger->add(\"<< 502 That makes no sense\\r\\n\");\n        $logger->add(\">> RSET\\r\\n\");\n        $logger->add(\"<< 250 OK\\r\\n\");\n\n        $this->assertEquals(\n            \">> FOO\\r\\n\".PHP_EOL.\n            \"<< 502 That makes no sense\\r\\n\".PHP_EOL.\n            \">> RSET\\r\\n\".PHP_EOL.\n            \"<< 250 OK\\r\\n\",\n            $logger->dump()\n            );\n\n        $logger->clear();\n\n        $this->assertEquals('', $logger->dump());\n    }\n\n    public function testLengthCanBeTruncated() {\n        $logger = new Swift_Plugins_Loggers_ArrayLogger(2);\n        $logger->add(\">> FOO\\r\\n\");\n        $logger->add(\"<< 502 That makes no sense\\r\\n\");\n        $logger->add(\">> RSET\\r\\n\");\n        $logger->add(\"<< 250 OK\\r\\n\");\n\n        $this->assertEquals(\n            \">> RSET\\r\\n\".PHP_EOL.\n            \"<< 250 OK\\r\\n\",\n            $logger->dump(),\n            '%s: Log should be truncated to last 2 entries'\n            );\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php",
    "content": "<?php\n\nclass Swift_Plugins_Loggers_EchoLoggerTest extends \\PHPUnit_Framework_TestCase{\n    public function testAddingEntryDumpsSingleLineWithoutHtml() {\n        $logger = new Swift_Plugins_Loggers_EchoLogger(false);\n        ob_start();\n        $logger->add('>> Foo');\n        $data = ob_get_clean();\n\n        $this->assertEquals('>> Foo'.PHP_EOL, $data);\n    }\n\n    public function testAddingEntryDumpsEscapedLineWithHtml() {\n        $logger = new Swift_Plugins_Loggers_EchoLogger(true);\n        ob_start();\n        $logger->add('>> Foo');\n        $data = ob_get_clean();\n\n        $this->assertEquals('&gt;&gt; Foo<br />'.PHP_EOL, $data);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_PopBeforeSmtpPluginTest extends \\PHPUnit_Framework_TestCase{\n    public function testPluginConnectsToPop3HostBeforeTransportStarts() {\n        $connection = $this->_createConnection();\n        $connection->expects($this->once())\n                   ->method('connect');\n\n        $plugin = $this->_createPlugin('pop.host.tld', 110);\n        $plugin->setConnection($connection);\n\n        $transport = $this->_createTransport();\n        $evt = $this->_createTransportChangeEvent($transport);\n\n        $plugin->beforeTransportStarted($evt);\n    }\n\n    public function testPluginDisconnectsFromPop3HostBeforeTransportStarts() {\n        $connection = $this->_createConnection();\n        $connection->expects($this->once())\n                   ->method('disconnect');\n\n        $plugin = $this->_createPlugin('pop.host.tld', 110);\n        $plugin->setConnection($connection);\n\n        $transport = $this->_createTransport();\n        $evt = $this->_createTransportChangeEvent($transport);\n\n        $plugin->beforeTransportStarted($evt);\n    }\n\n    public function testPluginDoesNotConnectToSmtpIfBoundToDifferentTransport() {\n        $connection = $this->_createConnection();\n        $connection->expects($this->never())\n                   ->method('disconnect');\n        $connection->expects($this->never())\n                   ->method('connect');\n\n        $smtp = $this->_createTransport();\n\n        $plugin = $this->_createPlugin('pop.host.tld', 110);\n        $plugin->setConnection($connection);\n        $plugin->bindSmtp($smtp);\n\n        $transport = $this->_createTransport();\n        $evt = $this->_createTransportChangeEvent($transport);\n\n        $plugin->beforeTransportStarted($evt);\n    }\n\n    public function testPluginCanBindToSpecificTransport() {\n        $connection = $this->_createConnection();\n        $connection->expects($this->once())\n                   ->method('connect');\n\n        $smtp = $this->_createTransport();\n\n        $plugin = $this->_createPlugin('pop.host.tld', 110);\n        $plugin->setConnection($connection);\n        $plugin->bindSmtp($smtp);\n\n        $evt = $this->_createTransportChangeEvent($smtp);\n\n        $plugin->beforeTransportStarted($evt);\n    }\n\n    // -- Creation Methods\n\n    private function _createTransport() {\n        return $this->getMock('Swift_Transport');\n    }\n\n    private function _createTransportChangeEvent($transport) {\n        $evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getSource')\n            ->will($this->returnValue($transport));\n        $evt->expects($this->any())\n            ->method('getTransport')\n            ->will($this->returnValue($transport));\n\n        return $evt;\n    }\n\n    public function _createConnection() {\n        return $this->getMock('Swift_Plugins_Pop_Pop3Connection');\n    }\n\n    public function _createPlugin($host, $port, $crypto = null) {\n        return new Swift_Plugins_PopBeforeSmtpPlugin($host, $port, $crypto);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_RedirectingPluginTest extends \\PHPUnit_Framework_TestCase{\n    public function testRecipientCanBeSetAndFetched() {\n        $plugin = new Swift_Plugins_RedirectingPlugin('fabien@example.com');\n        $this->assertEquals('fabien@example.com', $plugin->getRecipient());\n        $plugin->setRecipient('chris@example.com');\n        $this->assertEquals('chris@example.com', $plugin->getRecipient());\n    }\n\n    public function testPluginChangesRecipients() {\n        $message = Swift_Message::newInstance()\n            ->setSubject('...')\n            ->setFrom(array('john@example.com' => 'John Doe'))\n            ->setTo($to = array(\n                'fabien-to@example.com' => 'Fabien (To)',\n                'chris-to@example.com' => 'Chris (To)',\n            ))\n            ->setCc($cc = array(\n                'fabien-cc@example.com' => 'Fabien (Cc)',\n                'chris-cc@example.com' => 'Chris (Cc)',\n            ))\n            ->setBcc($bcc = array(\n                'fabien-bcc@example.com' => 'Fabien (Bcc)',\n                'chris-bcc@example.com' => 'Chris (Bcc)',\n            ))\n            ->setBody('...')\n        ;\n\n        $plugin = new Swift_Plugins_RedirectingPlugin('god@example.com');\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), array('god@example.com' => ''));\n        $this->assertEquals($message->getCc(), array());\n        $this->assertEquals($message->getBcc(), array());\n\n        $plugin->sendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), $to);\n        $this->assertEquals($message->getCc(), $cc);\n        $this->assertEquals($message->getBcc(), $bcc);\n    }\n\n    public function testPluginRespectsUnsetToList() {\n        $message = Swift_Message::newInstance()\n            ->setSubject('...')\n            ->setFrom(array('john@example.com' => 'John Doe'))\n            ->setCc($cc = array(\n                'fabien-cc@example.com' => 'Fabien (Cc)',\n                'chris-cc@example.com' => 'Chris (Cc)',\n            ))\n            ->setBcc($bcc = array(\n                'fabien-bcc@example.com' => 'Fabien (Bcc)',\n                'chris-bcc@example.com' => 'Chris (Bcc)',\n            ))\n            ->setBody('...')\n        ;\n\n        $plugin = new Swift_Plugins_RedirectingPlugin('god@example.com');\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), array('god@example.com' => ''));\n        $this->assertEquals($message->getCc(), array());\n        $this->assertEquals($message->getBcc(), array());\n\n        $plugin->sendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), array());\n        $this->assertEquals($message->getCc(), $cc);\n        $this->assertEquals($message->getBcc(), $bcc);\n    }\n\n    public function testPluginRespectsAWhitelistOfPatterns() {\n        $message = Swift_Message::newInstance()\n            ->setSubject('...')\n            ->setFrom(array('john@example.com' => 'John Doe'))\n            ->setTo($to = array(\n                'fabien-to@example.com' => 'Fabien (To)',\n                'chris-to@example.com' => 'Chris (To)',\n                'lars-to@internal.com' => 'Lars (To)',\n            ))\n            ->setCc($cc = array(\n                'fabien-cc@example.com' => 'Fabien (Cc)',\n                'chris-cc@example.com' => 'Chris (Cc)',\n                'lars-cc@internal.org' => 'Lars (Cc)',\n            ))\n            ->setBcc($bcc = array(\n                'fabien-bcc@example.com' => 'Fabien (Bcc)',\n                'chris-bcc@example.com' => 'Chris (Bcc)',\n                'john-bcc@example.org' => 'John (Bcc)',\n            ))\n            ->setBody('...')\n        ;\n\n        $recipient = 'god@example.com';\n        $patterns = array('/^.*@internal.[a-z]+$/', '/^john-.*$/');\n\n        $plugin = new Swift_Plugins_RedirectingPlugin($recipient, $patterns);\n\n        $this->assertEquals($recipient, $plugin->getRecipient());\n        $this->assertEquals($plugin->getWhitelist(), $patterns);\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), array('lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null));\n        $this->assertEquals($message->getCc(), array('lars-cc@internal.org' => 'Lars (Cc)'));\n        $this->assertEquals($message->getBcc(), array('john-bcc@example.org' => 'John (Bcc)'));\n\n        $plugin->sendPerformed($evt);\n\n        $this->assertEquals($message->getTo(), $to);\n        $this->assertEquals($message->getCc(), $cc);\n        $this->assertEquals($message->getBcc(), $bcc);\n    }\n\n    public function testArrayOfRecipientsCanBeExplicitlyDefined() {\n        $message = Swift_Message::newInstance()\n            ->setSubject('...')\n            ->setFrom(array('john@example.com' => 'John Doe'))\n            ->setTo(array(\n            'fabien@example.com' => 'Fabien',\n            'chris@example.com' => 'Chris (To)',\n            'lars-to@internal.com' => 'Lars (To)',\n        ))\n            ->setCc(array(\n            'fabien@example.com' => 'Fabien',\n            'chris-cc@example.com' => 'Chris (Cc)',\n            'lars-cc@internal.org' => 'Lars (Cc)',\n        ))\n            ->setBcc(array(\n            'fabien@example.com' => 'Fabien',\n            'chris-bcc@example.com' => 'Chris (Bcc)',\n            'john-bcc@example.org' => 'John (Bcc)',\n        ))\n            ->setBody('...')\n        ;\n\n        $recipients = array('god@example.com', 'fabien@example.com');\n        $patterns = array('/^.*@internal.[a-z]+$/');\n\n        $plugin = new Swift_Plugins_RedirectingPlugin($recipients, $patterns);\n\n        $evt = $this->_createSendEvent($message);\n\n        $plugin->beforeSendPerformed($evt);\n\n        $this->assertEquals(\n            $message->getTo(),\n            array('fabien@example.com' => 'Fabien', 'lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null)\n        );\n        $this->assertEquals(\n            $message->getCc(),\n            array('fabien@example.com' => 'Fabien', 'lars-cc@internal.org' => 'Lars (Cc)')\n        );\n        $this->assertEquals($message->getBcc(), array('fabien@example.com' => 'Fabien'));\n    }\n\n    // -- Creation Methods\n\n    private function _createSendEvent(Swift_Mime_Message $message) {\n        $evt = $this->getMockBuilder('Swift_Events_SendEvent')\n                    ->disableOriginalConstructor()\n                    ->getMock();\n        $evt->expects($this->any())\n            ->method('getMessage')\n            ->will($this->returnValue($message));\n\n        return $evt;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_ReporterPluginTest extends \\SwiftMailerTestCase{\n    public function testReportingPasses() {\n        $message = $this->_createMessage();\n        $evt = $this->_createSendEvent();\n        $reporter = $this->_createReporter();\n\n        $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));\n        $evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);\n        $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array());\n        $reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);\n\n        $plugin = new Swift_Plugins_ReporterPlugin($reporter);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReportingFailedTo() {\n        $message = $this->_createMessage();\n        $evt = $this->_createSendEvent();\n        $reporter = $this->_createReporter();\n\n        $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo', 'zip@button' => 'Zip'));\n        $evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);\n        $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));\n        $reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);\n        $reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);\n\n        $plugin = new Swift_Plugins_ReporterPlugin($reporter);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReportingFailedCc() {\n        $message = $this->_createMessage();\n        $evt = $this->_createSendEvent();\n        $reporter = $this->_createReporter();\n\n        $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));\n        $message->shouldReceive('getCc')->zeroOrMoreTimes()->andReturn(array('zip@button' => 'Zip', 'test@test.com' => 'Test'));\n        $evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);\n        $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));\n        $reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);\n        $reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);\n        $reporter->shouldReceive('notify')->once()->with($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS);\n\n        $plugin = new Swift_Plugins_ReporterPlugin($reporter);\n        $plugin->sendPerformed($evt);\n    }\n\n    public function testReportingFailedBcc() {\n        $message = $this->_createMessage();\n        $evt = $this->_createSendEvent();\n        $reporter = $this->_createReporter();\n\n        $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));\n        $message->shouldReceive('getBcc')->zeroOrMoreTimes()->andReturn(array('zip@button' => 'Zip', 'test@test.com' => 'Test'));\n        $evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);\n        $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));\n        $reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);\n        $reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);\n        $reporter->shouldReceive('notify')->once()->with($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS);\n\n        $plugin = new Swift_Plugins_ReporterPlugin($reporter);\n        $plugin->sendPerformed($evt);\n    }\n\n    // -- Creation Methods\n\n    private function _createMessage() {\n        return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n    }\n\n    private function _createSendEvent() {\n        return $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n    }\n\n    private function _createReporter() {\n        return $this->getMockery('Swift_Plugins_Reporter')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php",
    "content": "<?php\n\nclass Swift_Plugins_Reporters_HitReporterTest extends \\PHPUnit_Framework_TestCase{\n    private $_hitReporter;\n    private $_message;\n\n    public function setUp() {\n        $this->_hitReporter = new Swift_Plugins_Reporters_HitReporter();\n        $this->_message = $this->getMock('Swift_Mime_Message');\n    }\n\n    public function testReportingFail() {\n        $this->_hitReporter->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->assertEquals(array('foo@bar.tld'),\n            $this->_hitReporter->getFailedRecipients()\n            );\n    }\n\n    public function testMultipleReports() {\n        $this->_hitReporter->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->_hitReporter->notify($this->_message, 'zip@button',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->assertEquals(array('foo@bar.tld', 'zip@button'),\n            $this->_hitReporter->getFailedRecipients()\n            );\n    }\n\n    public function testReportingPassIsIgnored() {\n        $this->_hitReporter->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->_hitReporter->notify($this->_message, 'zip@button',\n            Swift_Plugins_Reporter::RESULT_PASS\n            );\n        $this->assertEquals(array('foo@bar.tld'),\n            $this->_hitReporter->getFailedRecipients()\n            );\n    }\n\n    public function testBufferCanBeCleared() {\n        $this->_hitReporter->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->_hitReporter->notify($this->_message, 'zip@button',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $this->assertEquals(array('foo@bar.tld', 'zip@button'),\n            $this->_hitReporter->getFailedRecipients()\n            );\n        $this->_hitReporter->clear();\n        $this->assertEquals(array(), $this->_hitReporter->getFailedRecipients());\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php",
    "content": "<?php\n\nclass Swift_Plugins_Reporters_HtmlReporterTest extends \\PHPUnit_Framework_TestCase{\n    private $_html;\n    private $_message;\n\n    public function setUp() {\n        $this->_html = new Swift_Plugins_Reporters_HtmlReporter();\n        $this->_message = $this->getMock('Swift_Mime_Message');\n    }\n\n    public function testReportingPass() {\n        ob_start();\n        $this->_html->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_PASS\n            );\n        $html = ob_get_clean();\n\n        $this->assertRegExp('~ok|pass~i', $html, '%s: Reporter should indicate pass');\n        $this->assertRegExp('~foo@bar\\.tld~', $html, '%s: Reporter should show address');\n    }\n\n    public function testReportingFail() {\n        ob_start();\n        $this->_html->notify($this->_message, 'zip@button',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $html = ob_get_clean();\n\n        $this->assertRegExp('~fail~i', $html, '%s: Reporter should indicate fail');\n        $this->assertRegExp('~zip@button~', $html, '%s: Reporter should show address');\n    }\n\n    public function testMultipleReports() {\n        ob_start();\n        $this->_html->notify($this->_message, 'foo@bar.tld',\n            Swift_Plugins_Reporter::RESULT_PASS\n            );\n        $this->_html->notify($this->_message, 'zip@button',\n            Swift_Plugins_Reporter::RESULT_FAIL\n            );\n        $html = ob_get_clean();\n\n        $this->assertRegExp('~ok|pass~i', $html, '%s: Reporter should indicate pass');\n        $this->assertRegExp('~foo@bar\\.tld~', $html, '%s: Reporter should show address');\n        $this->assertRegExp('~fail~i', $html, '%s: Reporter should indicate fail');\n        $this->assertRegExp('~zip@button~', $html, '%s: Reporter should show address');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php",
    "content": "<?php\n\nclass Swift_Plugins_ThrottlerPluginTest extends \\SwiftMailerTestCase{\n    public function testBytesPerMinuteThrottling() {\n        $sleeper = $this->_createSleeper();\n        $timer = $this->_createTimer();\n\n        //10MB/min\n        $plugin = new Swift_Plugins_ThrottlerPlugin(\n            10000000, Swift_Plugins_ThrottlerPlugin::BYTES_PER_MINUTE,\n            $sleeper, $timer\n            );\n\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(0);\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(1); //expected 0.6\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(1); //expected 1.2 (sleep 1)\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(2); //expected 1.8\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(2); //expected 2.4 (sleep 1)\n        $sleeper->shouldReceive('sleep')->twice()->with(1);\n\n        //10,000,000 bytes per minute\n        //100,000 bytes per email\n\n        // .: (10,000,000/100,000)/60 emails per second = 1.667 emais/sec\n\n        $message = $this->_createMessageWithByteCount(100000); //100KB\n\n        $evt = $this->_createSendEvent($message);\n\n        for ($i = 0; $i < 5; ++$i) {\n            $plugin->beforeSendPerformed($evt);\n            $plugin->sendPerformed($evt);\n        }\n    }\n\n    public function testMessagesPerMinuteThrottling() {\n        $sleeper = $this->_createSleeper();\n        $timer = $this->_createTimer();\n\n        //60/min\n        $plugin = new Swift_Plugins_ThrottlerPlugin(\n            60, Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE,\n            $sleeper, $timer\n            );\n\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(0);\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(0); //expected 1 (sleep 1)\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(2); //expected 2\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(2); //expected 3 (sleep 1)\n        $timer->shouldReceive('getTimestamp')->once()->andReturn(4); //expected 4\n        $sleeper->shouldReceive('sleep')->twice()->with(1);\n\n        //60 messages per minute\n        //1 message per second\n\n        $message = $this->_createMessageWithByteCount(10);\n\n        $evt = $this->_createSendEvent($message);\n\n        for ($i = 0; $i < 5; ++$i) {\n            $plugin->beforeSendPerformed($evt);\n            $plugin->sendPerformed($evt);\n        }\n    }\n\n    // -- Creation Methods\n\n    private function _createSleeper() {\n        return $this->getMockery('Swift_Plugins_Sleeper');\n    }\n\n    private function _createTimer() {\n        return $this->getMockery('Swift_Plugins_Timer');\n    }\n\n    private function _createMessageWithByteCount($bytes) {\n        $msg = $this->getMockery('Swift_Mime_Message');\n        $msg->shouldReceive('toByteStream')\n            ->zeroOrMoreTimes()\n            ->andReturnUsing(function ($is) use ($bytes) {\n                for ($i = 0; $i < $bytes; ++$i) {\n                    $is->write('x');\n                }\n            });\n\n        return $msg;\n    }\n\n    private function _createSendEvent($message) {\n        $evt = $this->getMockery('Swift_Events_SendEvent');\n        $evt->shouldReceive('getMessage')\n            ->zeroOrMoreTimes()\n            ->andReturn($message);\n\n        return $evt;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php",
    "content": "<?php\n\nclass Swift_Signers_DKIMSignerTest extends \\SwiftMailerTestCase{\n    public function setUp() {\n        if (version_compare(phpversion(), '5.4', '<') && !defined('OPENSSL_ALGO_SHA256')) {\n            $this->markTestSkipped(\n                'skipping because of https://bugs.php.net/bug.php?id=61421'\n             );\n        }\n    }\n\n    public function testBasicSigningHeaderManipulation() {\n        $headers = $this->_createHeaders();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        /* @var $signer Swift_Signers_HeaderSigner */\n        $altered = $signer->getAlteredHeaders();\n        $signer->reset();\n        // Headers\n        $signer->setHeaders($headers);\n        // Body\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        // Signing\n        $signer->addSignature($headers);\n    }\n\n    // Default Signing\n    public function testSigningDefaults() {\n        $headerSet = $this->_createHeaderSet();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        $signer->setSignatureTimestamp('1299879181');\n        $altered = $signer->getAlteredHeaders();\n        $this->assertEquals(array('DKIM-Signature'), $altered);\n        $signer->reset();\n        $signer->setHeaders($headerSet);\n        $this->assertFalse($headerSet->has('DKIM-Signature'));\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        $signer->addSignature($headerSet);\n        $this->assertTrue($headerSet->has('DKIM-Signature'));\n        $dkim = $headerSet->getAll('DKIM-Signature');\n        $sig = reset($dkim);\n        $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha1; bh=wlbYcY9O9OPInGJ4D0E/rGsvMLE=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; t=1299879181; b=RMSNelzM2O5MAAnMjT3G3/VF36S3DGJXoPCXR001F1WDReu0prGphWjuzK/m6V1pwqQL8cCNg Hi74mTx2bvyAvmkjvQtJf1VMUOCc9WHGcm1Yec66I3ZWoNMGSWZ1EKAm2CtTzyG0IFw4ml9DI wSkyAFxlgicckDD6FibhqwX4w=');\n    }\n\n    // SHA256 Signing\n    public function testSigning256() {\n        $headerSet = $this->_createHeaderSet();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        $signer->setHashAlgorithm('rsa-sha256');\n        $signer->setSignatureTimestamp('1299879181');\n        $altered = $signer->getAlteredHeaders();\n        $this->assertEquals(array('DKIM-Signature'), $altered);\n        $signer->reset();\n        $signer->setHeaders($headerSet);\n        $this->assertFalse($headerSet->has('DKIM-Signature'));\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        $signer->addSignature($headerSet);\n        $this->assertTrue($headerSet->has('DKIM-Signature'));\n        $dkim = $headerSet->getAll('DKIM-Signature');\n        $sig = reset($dkim);\n        $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; t=1299879181; b=jqPmieHzF5vR9F4mXCAkowuphpO4iJ8IAVuioh1BFZ3VITXZj5jlOFxULJMBiiApm2keJirnh u4mzogj444QkpT3lJg8/TBGAYQPdcvkG3KC0jdyN6QpSgpITBJG2BwWa+keXsv2bkQgLRAzNx qRhP45vpHCKun0Tg9LrwW/KCg=');\n    }\n\n    // Relaxed/Relaxed Hash Signing\n    public function testSigningRelaxedRelaxed256() {\n        $headerSet = $this->_createHeaderSet();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        $signer->setHashAlgorithm('rsa-sha256');\n        $signer->setSignatureTimestamp('1299879181');\n        $signer->setBodyCanon('relaxed');\n        $signer->setHeaderCanon('relaxed');\n        $altered = $signer->getAlteredHeaders();\n        $this->assertEquals(array('DKIM-Signature'), $altered);\n        $signer->reset();\n        $signer->setHeaders($headerSet);\n        $this->assertFalse($headerSet->has('DKIM-Signature'));\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        $signer->addSignature($headerSet);\n        $this->assertTrue($headerSet->has('DKIM-Signature'));\n        $dkim = $headerSet->getAll('DKIM-Signature');\n        $sig = reset($dkim);\n        $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; c=relaxed/relaxed; t=1299879181; b=gzOI+PX6HpZKQFzwwmxzcVJsyirdLXOS+4pgfCpVHQIdqYusKLrhlLeFBTNoz75HrhNvGH6T0 Rt3w5aTqkrWfUuAEYt0Ns14GowLM7JojaFN+pZ4eYnRB3CBBgW6fee4NEMD5WPca3uS09tr1E 10RYh9ILlRtl+84sovhx5id3Y=');\n    }\n\n    // Relaxed/Simple Hash Signing\n    public function testSigningRelaxedSimple256() {\n        $headerSet = $this->_createHeaderSet();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        $signer->setHashAlgorithm('rsa-sha256');\n        $signer->setSignatureTimestamp('1299879181');\n        $signer->setHeaderCanon('relaxed');\n        $altered = $signer->getAlteredHeaders();\n        $this->assertEquals(array('DKIM-Signature'), $altered);\n        $signer->reset();\n        $signer->setHeaders($headerSet);\n        $this->assertFalse($headerSet->has('DKIM-Signature'));\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        $signer->addSignature($headerSet);\n        $this->assertTrue($headerSet->has('DKIM-Signature'));\n        $dkim = $headerSet->getAll('DKIM-Signature');\n        $sig = reset($dkim);\n        $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; c=relaxed; t=1299879181; b=dLPJNec5v81oelyzGOY0qPqTlGnQeNfUNBOrV/JKbStr3NqWGI9jH4JAe2YvO2V32lfPNoby1 4MMzZ6EPkaZkZDDSPa+53YbCPQAlqiD9QZZIUe2UNM33HN8yAMgiWEF5aP7MbQnxeVZMfVLEl 9S8qOImu+K5JZqhQQTL0dgLwA=');\n    }\n\n    // Simple/Relaxed Hash Signing\n    public function testSigningSimpleRelaxed256() {\n        $headerSet = $this->_createHeaderSet();\n        $messageContent = 'Hello World';\n        $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');\n        $signer->setHashAlgorithm('rsa-sha256');\n        $signer->setSignatureTimestamp('1299879181');\n        $signer->setBodyCanon('relaxed');\n        $altered = $signer->getAlteredHeaders();\n        $this->assertEquals(array('DKIM-Signature'), $altered);\n        $signer->reset();\n        $signer->setHeaders($headerSet);\n        $this->assertFalse($headerSet->has('DKIM-Signature'));\n        $signer->startBody();\n        $signer->write($messageContent);\n        $signer->endBody();\n        $signer->addSignature($headerSet);\n        $this->assertTrue($headerSet->has('DKIM-Signature'));\n        $dkim = $headerSet->getAll('DKIM-Signature');\n        $sig = reset($dkim);\n        $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; c=simple/relaxed; t=1299879181; b=M5eomH/zamyzix9kOes+6YLzQZxuJdBP4x3nP9zF2N26eMLG2/cBKbnNyqiOTDhJdYfWPbLIa 1CWnjST0j5p4CpeOkGYuiE+M4TWEZwhRmRWootlPO3Ii6XpbBJKFk1o9zviS7OmXblUUE4aqb yRSIMDhtLdCK5GlaCneFLN7RQ=');\n    }\n\n    // -- Creation Methods\n    private function _createHeaderSet() {\n        $cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream());\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));\n        $grammar = new Swift_Mime_Grammar();\n        $headers = new Swift_Mime_SimpleHeaderSet(new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar));\n\n        return $headers;\n    }\n\n    /**\n     * @return Swift_Mime_Headers\n     */\n    private function _createHeaders() {\n        $x = 0;\n        $cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream());\n        $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();\n        $contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();\n\n        $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));\n        $paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));\n        $grammar = new Swift_Mime_Grammar();\n        $headerFactory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar);\n        $headers = $this->getMockery('Swift_Mime_HeaderSet');\n\n        $headers->shouldReceive('listAll')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('From', 'To', 'Date', 'Subject'));\n        $headers->shouldReceive('has')\n                ->zeroOrMoreTimes()\n                ->with('From')\n                ->andReturn(true);\n        $headers->shouldReceive('getAll')\n                ->zeroOrMoreTimes()\n                ->with('From')\n                ->andReturn(array($headerFactory->createMailboxHeader('From', 'test@test.test')));\n        $headers->shouldReceive('has')\n                ->zeroOrMoreTimes()\n                ->with('To')\n                ->andReturn(true);\n        $headers->shouldReceive('getAll')\n                ->zeroOrMoreTimes()\n                ->with('To')\n                ->andReturn(array($headerFactory->createMailboxHeader('To', 'test@test.test')));\n        $headers->shouldReceive('has')\n                ->zeroOrMoreTimes()\n                ->with('Date')\n                ->andReturn(true);\n        $headers->shouldReceive('getAll')\n                ->zeroOrMoreTimes()\n                ->with('Date')\n                ->andReturn(array($headerFactory->createTextHeader('Date', 'Fri, 11 Mar 2011 20:56:12 +0000 (GMT)')));\n        $headers->shouldReceive('has')\n                ->zeroOrMoreTimes()\n                ->with('Subject')\n                ->andReturn(true);\n        $headers->shouldReceive('getAll')\n                ->zeroOrMoreTimes()\n                ->with('Subject')\n                ->andReturn(array($headerFactory->createTextHeader('Subject', 'Foo Bar Text Message')));\n        $headers->shouldReceive('addTextHeader')\n                ->zeroOrMoreTimes()\n                ->with('DKIM-Signature', \\Mockery::any())\n                ->andReturn(true);\n        $headers->shouldReceive('getAll')\n                ->zeroOrMoreTimes()\n                ->with('DKIM-Signature')\n                ->andReturn(array($headerFactory->createTextHeader('DKIM-Signature', 'Foo Bar Text Message')));\n\n        return $headers;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php",
    "content": "<?php\n\n/**\n * @todo\n */\nclass Swift_Signers_OpenDKIMSignerTest extends \\SwiftMailerTestCase{\n    public function setUp() {\n        if (!extension_loaded('opendkim')) {\n            $this->markTestSkipped(\n                'Need OpenDKIM extension run these tests.'\n             );\n        }\n    }\n\n    public function testBasicSigningHeaderManipulation() {\n    }\n\n    // Default Signing\n    public function testSigningDefaults() {\n    }\n\n    // SHA256 Signing\n    public function testSigning256() {\n    }\n\n    // Relaxed/Relaxed Hash Signing\n    public function testSigningRelaxedRelaxed256() {\n    }\n\n    // Relaxed/Simple Hash Signing\n    public function testSigningRelaxedSimple256() {\n    }\n\n    // Simple/Relaxed Hash Signing\n    public function testSigningSimpleRelaxed256() {\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php",
    "content": "<?php\n\nclass Swift_Signers_SMimeSignerTest extends \\PHPUnit_Framework_TestCase{\n    /**\n     * @var Swift_StreamFilters_StringReplacementFilterFactory\n     */\n    protected $replacementFactory;\n\n    protected $samplesDir;\n\n    public function setUp() {\n        $this->replacementFactory = Swift_DependencyContainer::getInstance()\n            ->lookup('transport.replacementfactory');\n\n        $this->samplesDir = str_replace('\\\\', '/', realpath(__DIR__.'/../../../_samples/')).'/';\n    }\n\n    public function testUnSingedMessage() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $this->assertEquals('Here is the message itself', $message->getBody());\n    }\n\n    public function testSingedMessage() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');\n        $message->attachSigner($signer);\n\n        $messageStream = $this->newFilteredStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!($boundary = $this->getBoundary($headers['content-type']))) {\n            return false;\n        }\n\n        $expectedBody = <<<OEL\nThis is an S/MIME signed message\n\n--$boundary\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: quoted-printable\n\nHere is the message itself\n--$boundary\nContent-Type: application/(x\\-)?pkcs7-signature; name=\"smime\\.p7s\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"smime\\.p7s\"\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n--$boundary--\nOEL;\n        $this->assertValidVerify($expectedBody, $messageStream);\n        unset($messageStream);\n    }\n\n    public function testSingedMessageExtraCerts() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign2.crt', $this->samplesDir.'smime/sign2.key', PKCS7_DETACHED, $this->samplesDir.'smime/intermediate.crt');\n        $message->attachSigner($signer);\n\n        $messageStream = $this->newFilteredStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!($boundary = $this->getBoundary($headers['content-type']))) {\n            return false;\n        }\n\n        $expectedBody = <<<OEL\nThis is an S/MIME signed message\n\n--$boundary\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: quoted-printable\n\nHere is the message itself\n--$boundary\nContent-Type: application/(x\\-)?pkcs7-signature; name=\"smime\\.p7s\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"smime\\.p7s\"\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n--$boundary--\nOEL;\n        $this->assertValidVerify($expectedBody, $messageStream);\n        unset($messageStream);\n    }\n\n    public function testSingedMessageBinary() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key', PKCS7_BINARY);\n        $message->attachSigner($signer);\n\n        $messageStream = $this->newFilteredStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!preg_match('#^application/(x\\-)?pkcs7-mime; smime-type=signed\\-data;#', $headers['content-type'])) {\n            $this->fail('Content-type does not match.');\n\n            return false;\n        }\n\n        $this->assertEquals($headers['content-transfer-encoding'], 'base64');\n        $this->assertEquals($headers['content-disposition'], 'attachment; filename=\"smime.p7m\"');\n\n        $expectedBody = '(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})';\n\n        $messageStreamClean = $this->newFilteredStream();\n\n        $this->assertValidVerify($expectedBody, $messageStream);\n        unset($messageStreamClean, $messageStream);\n    }\n\n    public function testSingedMessageWithAttachments() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $message->attach(Swift_Attachment::fromPath($this->samplesDir.'/files/textfile.zip'));\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');\n        $message->attachSigner($signer);\n\n        $messageStream = $this->newFilteredStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!($boundary = $this->getBoundary($headers['content-type']))) {\n            return false;\n        }\n\n        $expectedBody = <<<OEL\nThis is an S/MIME signed message\n\n--$boundary\nContent-Type: multipart/mixed;\n boundary=\"([a-z0-9\\\\'\\\\(\\\\)\\\\+_\\\\-,\\\\.\\\\/:=\\\\?\\\\ ]{0,69}[a-z0-9\\\\'\\\\(\\\\)\\\\+_\\\\-,\\\\.\\\\/:=\\\\?])\"\n\n\n--\\\\1\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: quoted-printable\n\nHere is the message itself\n\n--\\\\1\nContent-Type: application/zip; name=textfile\\\\.zip\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=textfile\\\\.zip\n\nUEsDBAoAAgAAAMi6VjiOTiKwLgAAAC4AAAAMABUAdGV4dGZpbGUudHh0VVQJAAN3vr5Hd76\\\\+R1V4\nBAD1AfUBVGhpcyBpcyBwYXJ0IG9mIGEgU3dpZnQgTWFpbGVyIHY0IHNtb2tlIHRlc3QuClBLAQIX\nAwoAAgAAAMi6VjiOTiKwLgAAAC4AAAAMAA0AAAAAAAEAAACkgQAAAAB0ZXh0ZmlsZS50eHRVVAUA\nA3e\\\\+vkdVeAAAUEsFBgAAAAABAAEARwAAAG0AAAAAAA==\n\n--\\\\1--\n\n--$boundary\nContent-Type: application/(x\\-)?pkcs7-signature; name=\"smime\\\\.p7s\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"smime\\\\.p7s\"\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n--$boundary--\nOEL;\n\n        $this->assertValidVerify($expectedBody, $messageStream);\n        unset($messageStream);\n    }\n\n    public function testEncryptedMessage() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $originalMessage = $this->cleanMessage($message->toString());\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setEncryptCertificate($this->samplesDir.'smime/encrypt.crt');\n        $message->attachSigner($signer);\n\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!preg_match('#^application/(x\\-)?pkcs7-mime; smime-type=enveloped\\-data;#', $headers['content-type'])) {\n            $this->fail('Content-type does not match.');\n\n            return false;\n        }\n\n        $expectedBody = '(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})';\n\n        $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {\n            $this->fail(sprintf('Decrypt of the message failed. Internal error \"%s\".', openssl_error_string()));\n        }\n\n        $this->assertEquals($originalMessage, $decryptedMessageStream->getContent());\n        unset($decryptedMessageStream, $messageStream);\n    }\n\n    public function testEncryptedMessageWithMultipleCerts() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $originalMessage = $this->cleanMessage($message->toString());\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setEncryptCertificate(array($this->samplesDir.'smime/encrypt.crt', $this->samplesDir.'smime/encrypt2.crt'));\n        $message->attachSigner($signer);\n\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!preg_match('#^application/(x\\-)?pkcs7-mime; smime-type=enveloped\\-data;#', $headers['content-type'])) {\n            $this->fail('Content-type does not match.');\n\n            return false;\n        }\n\n        $expectedBody = '(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})';\n\n        $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {\n            $this->fail(sprintf('Decrypt of the message failed. Internal error \"%s\".', openssl_error_string()));\n        }\n\n        $this->assertEquals($originalMessage, $decryptedMessageStream->getContent());\n        unset($decryptedMessageStream);\n\n        $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt2.crt', array('file://'.$this->samplesDir.'smime/encrypt2.key', 'swift'))) {\n            $this->fail(sprintf('Decrypt of the message failed. Internal error \"%s\".', openssl_error_string()));\n        }\n\n        $this->assertEquals($originalMessage, $decryptedMessageStream->getContent());\n        unset($decryptedMessageStream, $messageStream);\n    }\n\n    public function testSignThenEncryptedMessage() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $signer = new Swift_Signers_SMimeSigner();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');\n        $signer->setEncryptCertificate($this->samplesDir.'smime/encrypt.crt');\n        $message->attachSigner($signer);\n\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!preg_match('#^application/(x\\-)?pkcs7-mime; smime-type=enveloped\\-data;#', $headers['content-type'])) {\n            $this->fail('Content-type does not match.');\n\n            return false;\n        }\n\n        $expectedBody = '(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})';\n\n        $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {\n            $this->fail(sprintf('Decrypt of the message failed. Internal error \"%s\".', openssl_error_string()));\n        }\n\n        $entityString = $decryptedMessageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!($boundary = $this->getBoundary($headers['content-type']))) {\n            return false;\n        }\n\n        $expectedBody = <<<OEL\nThis is an S/MIME signed message\n\n--$boundary\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: quoted-printable\n\nHere is the message itself\n--$boundary\nContent-Type: application/(x\\-)?pkcs7-signature; name=\"smime\\.p7s\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"smime\\.p7s\"\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n--$boundary--\nOEL;\n\n        if (!$this->assertValidVerify($expectedBody, $decryptedMessageStream)) {\n            return false;\n        }\n\n        unset($decryptedMessageStream, $messageStream);\n    }\n\n    public function testEncryptThenSignMessage() {\n        $message = Swift_SignedMessage::newInstance('Wonderful Subject')\n          ->setFrom(array('john@doe.com' => 'John Doe'))\n          ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))\n          ->setBody('Here is the message itself');\n\n        $originalMessage = $this->cleanMessage($message->toString());\n\n        $signer = Swift_Signers_SMimeSigner::newInstance();\n        $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');\n        $signer->setEncryptCertificate($this->samplesDir.'smime/encrypt.crt');\n        $signer->setSignThenEncrypt(false);\n        $message->attachSigner($signer);\n\n        $messageStream = $this->newFilteredStream();\n        $message->toByteStream($messageStream);\n        $messageStream->commit();\n\n        $entityString = $messageStream->getContent();\n        $headers = self::getHeadersOfMessage($entityString);\n\n        if (!($boundary = $this->getBoundary($headers['content-type']))) {\n            return false;\n        }\n\n        $expectedBody = <<<OEL\nThis is an S/MIME signed message\n\n--$boundary\n(?P<encrypted_message>MIME-Version: 1\\.0\nContent-Disposition: attachment; filename=\"smime\\.p7m\"\nContent-Type: application/(x\\-)?pkcs7-mime; smime-type=enveloped-data; name=\"smime\\.p7m\"\nContent-Transfer-Encoding: base64\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n\n)--$boundary\nContent-Type: application/(x\\-)?pkcs7-signature; name=\"smime\\.p7s\"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"smime\\.p7s\"\n\n(?:^[a-zA-Z0-9\\/\\\\r\\\\n+]*={0,2})\n\n--$boundary--\nOEL;\n\n        if (!$this->assertValidVerify($expectedBody, $messageStream)) {\n            return false;\n        }\n\n        $expectedBody = str_replace(\"\\n\", \"\\r\\n\", $expectedBody);\n        if (!preg_match('%'.$expectedBody.'*%m', $entityString, $entities)) {\n            $this->fail('Failed regex match.');\n\n            return false;\n        }\n\n        $messageStreamClean = new Swift_ByteStream_TemporaryFileByteStream();\n        $messageStreamClean->write($entities['encrypted_message']);\n\n        $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();\n\n        if (!openssl_pkcs7_decrypt($messageStreamClean->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {\n            $this->fail(sprintf('Decrypt of the message failed. Internal error \"%s\".', openssl_error_string()));\n        }\n\n        $this->assertEquals($originalMessage, $decryptedMessageStream->getContent());\n        unset($messageStreamClean, $messageStream, $decryptedMessageStream);\n    }\n\n    protected function assertValidVerify($expected, Swift_ByteStream_TemporaryFileByteStream $messageStream) {\n        $actual = $messageStream->getContent();\n\n        // File is UNIX encoded so convert them to correct line ending\n        $expected = str_replace(\"\\n\", \"\\r\\n\", $expected);\n\n        $actual = trim(self::getBodyOfMessage($actual));\n        if (!$this->assertRegExp('%^'.$expected.'$\\s*%m', $actual)) {\n            return false;\n        }\n\n        $opensslOutput = new Swift_ByteStream_TemporaryFileByteStream();\n        $verify = openssl_pkcs7_verify($messageStream->getPath(), null, $opensslOutput->getPath(), array($this->samplesDir.'smime/ca.crt'));\n\n        if (false === $verify) {\n            $this->fail('Verification of the message failed.');\n\n            return false;\n        } elseif (-1 === $verify) {\n            $this->fail(sprintf('Verification of the message failed. Internal error \"%s\".', openssl_error_string()));\n\n            return false;\n        }\n\n        return true;\n    }\n\n    protected function getBoundary($contentType) {\n        if (!preg_match('/boundary=(\"[^\"]+\"|(?:[^\\s]+|$))/is', $contentType, $contentTypeData)) {\n            $this->fail('Failed to find Boundary parameter');\n\n            return false;\n        }\n\n        return trim($contentTypeData[1], '\"');\n    }\n\n    protected function newFilteredStream() {\n        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();\n        $messageStream->addFilter($this->replacementFactory->createFilter(\"\\r\\n\", \"\\n\"), 'CRLF to LF');\n        $messageStream->addFilter($this->replacementFactory->createFilter(\"\\n\", \"\\r\\n\"), 'LF to CRLF');\n\n        return $messageStream;\n    }\n\n    protected static function getBodyOfMessage($message) {\n        return substr($message, strpos($message, \"\\r\\n\\r\\n\"));\n    }\n\n    /**\n     * Strips of the sender headers and Mime-Version.\n     *\n     * @param Swift_ByteStream_TemporaryFileByteStream $messageStream\n     * @param Swift_ByteStream_TemporaryFileByteStream $inputStream\n     */\n    protected function cleanMessage($content) {\n        $newContent = '';\n\n        $headers = self::getHeadersOfMessage($content);\n        foreach ($headers as $headerName => $value) {\n            if (!in_array($headerName, array('content-type', 'content-transfer-encoding', 'content-disposition'))) {\n                continue;\n            }\n\n            $headerName = explode('-', $headerName);\n            $headerName = array_map('ucfirst', $headerName);\n            $headerName = implode('-', $headerName);\n\n            if (strlen($value) > 62) {\n                $value = wordwrap($value, 62, \"\\n \");\n            }\n\n            $newContent .= \"$headerName: $value\\r\\n\";\n        }\n\n        return $newContent.\"\\r\\n\".ltrim(self::getBodyOfMessage($content));\n    }\n\n    /**\n     * Returns the headers of the message.\n     *\n     * Header-names are lowercase.\n     *\n     * @param string $message\n     *\n     * @return array\n     */\n    protected static function getHeadersOfMessage($message) {\n        $headersPosEnd = strpos($message, \"\\r\\n\\r\\n\");\n        $headerData = substr($message, 0, $headersPosEnd);\n        $headerLines = explode(\"\\r\\n\", $headerData);\n\n        if (empty($headerLines)) {\n            return array();\n        }\n\n        $headers = array();\n\n        foreach ($headerLines as $headerLine) {\n            if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) {\n                $headers[$currentHeaderName] .= ' '.trim($headerLine);\n                continue;\n            }\n\n            $header = explode(':', $headerLine, 2);\n            $currentHeaderName = strtolower($header[0]);\n            $headers[$currentHeaderName] = trim($header[1]);\n        }\n\n        return $headers;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php",
    "content": "<?php\n\nclass Swift_StreamFilters_ByteArrayReplacementFilterTest extends \\PHPUnit_Framework_TestCase{\n    public function testBasicReplacementsAreMade() {\n        $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64));\n        $this->assertEquals(\n            array(0x59, 0x60, 0x63, 0x64, 0x65),\n            $filter->filter(array(0x59, 0x60, 0x61, 0x62, 0x65))\n            );\n    }\n\n    public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() {\n        $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64));\n        $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)),\n            '%s: Filter should buffer since 0x61 0x62 is the needle and the ending '.\n            '0x61 could be from 0x61 0x62'\n            );\n    }\n\n    public function testFilterCanMakeMultipleReplacements() {\n        $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(0x63));\n        $this->assertEquals(\n            array(0x60, 0x63, 0x60, 0x63, 0x60),\n            $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60))\n            );\n    }\n\n    public function testMultipleReplacementsCanBeDifferent() {\n        $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(array(0x63), array(0x64)));\n        $this->assertEquals(\n            array(0x60, 0x63, 0x60, 0x64, 0x60),\n            $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60))\n            );\n    }\n\n    public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() {\n        $filter = $this->_createFilter(array(0x0D, 0x0A), array(0x0A));\n        $this->assertFalse($filter->shouldBuffer(array(0x61, 0x62, 0x0D, 0x0A, 0x63)),\n            '%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF'\n            );\n    }\n\n    public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() {\n        $filter = $this->_createFilter(array(array(0x61, 0x62), array(0x63)), array(0x64));\n        $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)),\n            '%s: Filter should buffer since 0x61 0x62 is a needle and the ending '.\n            '0x61 could be from 0x61 0x62'\n            );\n    }\n\n    public function testConvertingAllLineEndingsToCRLFWhenInputIsLF() {\n        $filter = $this->_createFilter(\n            array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n            array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n            );\n\n        $this->assertEquals(\n            array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),\n            $filter->filter(array(0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63))\n            );\n    }\n\n    public function testConvertingAllLineEndingsToCRLFWhenInputIsCR() {\n        $filter = $this->_createFilter(\n            array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n            array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n            );\n\n        $this->assertEquals(\n            array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),\n            $filter->filter(array(0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63))\n            );\n    }\n\n    public function testConvertingAllLineEndingsToCRLFWhenInputIsCRLF() {\n        $filter = $this->_createFilter(\n            array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n            array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n            );\n\n        $this->assertEquals(\n            array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),\n            $filter->filter(array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63))\n            );\n    }\n\n    public function testConvertingAllLineEndingsToCRLFWhenInputIsLFCR() {\n        $filter = $this->_createFilter(\n            array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n            array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n            );\n\n        $this->assertEquals(\n            array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63),\n            $filter->filter(array(0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63))\n            );\n    }\n\n    public function testConvertingAllLineEndingsToCRLFWhenInputContainsLFLF() {\n        //Lighthouse Bug #23\n\n        $filter = $this->_createFilter(\n            array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),\n            array(array(0x0A), array(0x0A), array(0x0D, 0x0A))\n            );\n\n        $this->assertEquals(\n            array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63),\n            $filter->filter(array(0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63))\n            );\n    }\n\n    // -- Creation methods\n\n    private function _createFilter($search, $replace) {\n        return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php",
    "content": "<?php\n\nclass Swift_StreamFilters_StringReplacementFilterFactoryTest extends \\PHPUnit_Framework_TestCase{\n    public function testInstancesOfStringReplacementFilterAreCreated() {\n        $factory = $this->_createFactory();\n        $this->assertInstanceof(\n            'Swift_StreamFilters_StringReplacementFilter',\n            $factory->createFilter('a', 'b')\n        );\n    }\n\n    public function testSameInstancesAreCached() {\n        $factory = $this->_createFactory();\n        $filter1 = $factory->createFilter('a', 'b');\n        $filter2 = $factory->createFilter('a', 'b');\n        $this->assertSame($filter1, $filter2, '%s: Instances should be cached');\n    }\n\n    public function testDifferingInstancesAreNotCached() {\n        $factory = $this->_createFactory();\n        $filter1 = $factory->createFilter('a', 'b');\n        $filter2 = $factory->createFilter('a', 'c');\n        $this->assertNotEquals($filter1, $filter2,\n            '%s: Differing instances should not be cached'\n            );\n    }\n\n    // -- Creation methods\n\n    private function _createFactory() {\n        return new Swift_StreamFilters_StringReplacementFilterFactory();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php",
    "content": "<?php\n\nclass Swift_StreamFilters_StringReplacementFilterTest extends \\PHPUnit_Framework_TestCase{\n    public function testBasicReplacementsAreMade() {\n        $filter = $this->_createFilter('foo', 'bar');\n        $this->assertEquals('XbarYbarZ', $filter->filter('XfooYfooZ'));\n    }\n\n    public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() {\n        $filter = $this->_createFilter('foo', 'bar');\n        $this->assertTrue($filter->shouldBuffer('XfooYf'),\n            '%s: Filter should buffer since \"foo\" is the needle and the ending '.\n            '\"f\" could be from \"foo\"'\n            );\n    }\n\n    public function testFilterCanMakeMultipleReplacements() {\n        $filter = $this->_createFilter(array('a', 'b'), 'foo');\n        $this->assertEquals('XfooYfooZ', $filter->filter('XaYbZ'));\n    }\n\n    public function testMultipleReplacementsCanBeDifferent() {\n        $filter = $this->_createFilter(array('a', 'b'), array('foo', 'zip'));\n        $this->assertEquals('XfooYzipZ', $filter->filter('XaYbZ'));\n    }\n\n    public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() {\n        $filter = $this->_createFilter(\"\\r\\n\", \"\\n\");\n        $this->assertFalse($filter->shouldBuffer(\"foo\\r\\nbar\"),\n            '%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF'\n            );\n    }\n\n    public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() {\n        $filter = $this->_createFilter(array('foo', 'zip'), 'bar');\n        $this->assertTrue($filter->shouldBuffer('XfooYzi'),\n            '%s: Filter should buffer since \"zip\" is a needle and the ending '.\n            '\"zi\" could be from \"zip\"'\n            );\n    }\n\n    // -- Creation methods\n\n    private function _createFilter($search, $replace) {\n        return new Swift_StreamFilters_StringReplacementFilter($search, $replace);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php",
    "content": "<?php\n\nrequire_once __DIR__.'/AbstractSmtpTest.php';\n\nabstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transport_AbstractSmtpTest{\n    public function testRegisterPluginLoadsPluginInEventDispatcher() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $listener = $this->getMockery('Swift_Events_EventListener');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $dispatcher->shouldReceive('bindEventListener')\n                   ->once()\n                   ->with($listener);\n\n        $smtp->registerPlugin($listener);\n    }\n\n    public function testSendingDispatchesBeforeSendEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $message = $this->_createMessage();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('mark@swiftmailer.org' => 'Mark'));\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->once()\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeSendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(1, $smtp->send($message));\n    }\n\n    public function testSendingDispatchesSendEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $message = $this->_createMessage();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('mark@swiftmailer.org' => 'Mark'));\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->once()\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'sendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(1, $smtp->send($message));\n    }\n\n    public function testSendEventCapturesFailures() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('mark@swiftmailer.org' => 'Mark'));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<chris@swiftmailer.org>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<mark@swiftmailer.org>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"500 Not now\\r\\n\");\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'sendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n        $evt->shouldReceive('setFailedRecipients')\n            ->once()\n            ->with(array('mark@swiftmailer.org'));\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(0, $smtp->send($message));\n    }\n\n    public function testSendEventHasResultFailedIfAllFailures() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('mark@swiftmailer.org' => 'Mark'));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<chris@swiftmailer.org>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<mark@swiftmailer.org>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"500 Not now\\r\\n\");\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'sendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n        $evt->shouldReceive('setResult')\n            ->once()\n            ->with(Swift_Events_SendEvent::RESULT_FAILED);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(0, $smtp->send($message));\n    }\n\n    public function testSendEventHasResultTentativeIfSomeFailures() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'mark@swiftmailer.org' => 'Mark',\n                    'chris@site.tld' => 'Chris',\n                ));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<chris@swiftmailer.org>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<mark@swiftmailer.org>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"500 Not now\\r\\n\");\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'sendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n        $evt->shouldReceive('setResult')\n            ->once()\n            ->with(Swift_Events_SendEvent::RESULT_TENTATIVE);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(1, $smtp->send($message));\n    }\n\n    public function testSendEventHasResultSuccessIfNoFailures() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'mark@swiftmailer.org' => 'Mark',\n                    'chris@site.tld' => 'Chris',\n                ));\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'sendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n        $evt->shouldReceive('setResult')\n            ->once()\n            ->with(Swift_Events_SendEvent::RESULT_SUCCESS);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(2, $smtp->send($message));\n    }\n\n    public function testCancellingEventBubbleBeforeSendStopsEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('chris@swiftmailer.org' => null));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('mark@swiftmailer.org' => 'Mark'));\n        $dispatcher->shouldReceive('createSendEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeSendPerformed');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(true);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(0, $smtp->send($message));\n    }\n\n    public function testStartingTransportDispatchesTransportChangeEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'transportStarted');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(false);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n    }\n\n    public function testStartingTransportDispatchesBeforeTransportChangeEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeTransportStarted');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(false);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n    }\n\n    public function testCancellingBubbleBeforeTransportStartStopsEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeTransportStarted');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(true);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n\n        $this->assertFalse($smtp->isStarted(),\n            '%s: Transport should not be started since event bubble was cancelled'\n        );\n    }\n\n    public function testStoppingTransportDispatchesTransportChangeEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'transportStopped');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->stop();\n    }\n\n    public function testStoppingTransportDispatchesBeforeTransportChangeEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent')->shouldIgnoreMissing();\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeTransportStopped');\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->stop();\n    }\n\n    public function testCancellingBubbleBeforeTransportStoppedStopsEvent() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportChangeEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $hasRun = false;\n        $dispatcher->shouldReceive('createTransportChangeEvent')\n                   ->atLeast()->once()\n                   ->with($smtp)\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'beforeTransportStopped')\n                   ->andReturnUsing(function () use (&$hasRun) {\n                       $hasRun = true;\n                   });\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->zeroOrMoreTimes();\n        $evt->shouldReceive('bubbleCancelled')\n            ->zeroOrMoreTimes()\n            ->andReturnUsing(function () use (&$hasRun) {\n                return $hasRun;\n            });\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->stop();\n\n        $this->assertTrue($smtp->isStarted(),\n            '%s: Transport should not be stopped since event bubble was cancelled'\n        );\n    }\n\n    public function testResponseEventsAreGenerated() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_ResponseEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createResponseEvent')\n                   ->atLeast()->once()\n                   ->with($smtp, \\Mockery::any(), \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->atLeast()->once()\n                   ->with($evt, 'responseReceived');\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n    }\n\n    public function testCommandEventsAreGenerated() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_CommandEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $dispatcher->shouldReceive('createCommandEvent')\n                   ->once()\n                   ->with($smtp, \\Mockery::any(), \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'commandSent');\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n    }\n\n    public function testExceptionsCauseExceptionEvents() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportExceptionEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $buf->shouldReceive('readLine')\n            ->atLeast()->once()\n            ->andReturn(\"503 I'm sleepy, go away!\\r\\n\");\n        $dispatcher->shouldReceive('createTransportExceptionEvent')\n                   ->zeroOrMoreTimes()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->once()\n                   ->with($evt, 'exceptionThrown');\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(false);\n\n        try {\n            $smtp->start();\n            $this->fail('TransportException should be thrown on invalid response');\n        } catch (Swift_TransportException $e) {\n        }\n    }\n\n    public function testExceptionBubblesCanBeCancelled() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher(false);\n        $evt = $this->getMockery('Swift_Events_TransportExceptionEvent');\n        $smtp = $this->_getTransport($buf, $dispatcher);\n\n        $buf->shouldReceive('readLine')\n            ->atLeast()->once()\n            ->andReturn(\"503 I'm sleepy, go away!\\r\\n\");\n        $dispatcher->shouldReceive('createTransportExceptionEvent')\n                   ->twice()\n                   ->with($smtp, \\Mockery::any())\n                   ->andReturn($evt);\n        $dispatcher->shouldReceive('dispatchEvent')\n                   ->twice()\n                   ->with($evt, 'exceptionThrown');\n        $evt->shouldReceive('bubbleCancelled')\n            ->atLeast()->once()\n            ->andReturn(true);\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n    }\n\n    // -- Creation Methods\n\n    protected function _createEventDispatcher($stub = true) {\n        return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php",
    "content": "<?php\n\nabstract class Swift_Transport_AbstractSmtpTest extends \\SwiftMailerTestCase{\n    /** Abstract test method */\n    abstract protected function _getTransport($buf);\n\n    public function testStartAccepts220ServiceGreeting() {\n        /* -- RFC 2821, 4.2.\n\n     Greeting = \"220 \" Domain [ SP text ] CRLF\n\n     -- RFC 2822, 4.3.2.\n\n     CONNECTION ESTABLISHMENT\n         S: 220\n         E: 554\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');\n            $smtp->start();\n            $this->assertTrue($smtp->isStarted(), '%s: start() should have started connection');\n        } catch (Exception $e) {\n            $this->fail('220 is a valid SMTP greeting and should be accepted');\n        }\n    }\n\n    public function testBadGreetingCausesException() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"554 I'm busy\\r\\n\");\n        $this->_finishBuffer($buf);\n        try {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');\n            $smtp->start();\n            $this->fail('554 greeting indicates an error and should cause an exception');\n        } catch (Exception $e) {\n            $this->assertFalse($smtp->isStarted(), '%s: start() should have failed');\n        }\n    }\n\n    public function testStartSendsHeloToInitiate() {\n        /* -- RFC 2821, 3.2.\n\n            3.2 Client Initiation\n\n         Once the server has sent the welcoming message and the client has\n         received it, the client normally sends the EHLO command to the\n         server, indicating the client's identity.  In addition to opening the\n         session, use of EHLO indicates that the client is able to process\n         service extensions and requests that the server provide a list of the\n         extensions it supports.  Older SMTP systems which are unable to\n         support service extensions and contemporary clients which do not\n         require service extensions in the mail session being initiated, MAY\n         use HELO instead of EHLO.  Servers MUST NOT return the extended\n         EHLO-style response to a HELO command.  For a particular connection\n         attempt, if the server returns a \"command not recognized\" response to\n         EHLO, the client SHOULD be able to fall back and send HELO.\n\n         In the EHLO command the host sending the command identifies itself;\n         the command may be interpreted as saying \"Hello, I am <domain>\" (and,\n         in the case of EHLO, \"and I support service extension requests\").\n\n       -- RFC 2281, 4.1.1.1.\n\n       ehlo            = \"EHLO\" SP Domain CRLF\n       helo            = \"HELO\" SP Domain CRLF\n\n       -- RFC 2821, 4.3.2.\n\n       EHLO or HELO\n           S: 250\n           E: 504, 550\n\n     */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^HELO .*?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n        } catch (Exception $e) {\n            $this->fail('Starting SMTP should send HELO and accept 250 response');\n        }\n    }\n\n    public function testInvalidHeloResponseCausesException() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^HELO .*?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('504 WTF'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');\n            $smtp->start();\n            $this->fail('Non 250 HELO response should raise Exception');\n        } catch (Exception $e) {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP start() should have failed');\n        }\n    }\n\n    public function testDomainNameIsPlacedInHelo() {\n        /* -- RFC 2821, 4.1.4.\n\n       The SMTP client MUST, if possible, ensure that the domain parameter\n       to the EHLO command is a valid principal host name (not a CNAME or MX\n       name) for its host.  If this is not possible (e.g., when the client's\n       address is dynamically assigned and the client does not have an\n       obvious name), an address literal SHOULD be substituted for the\n       domain name and supplemental information provided that will assist in\n       identifying the client.\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"HELO mydomain.com\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->setLocalDomain('mydomain.com');\n        $smtp->start();\n    }\n\n    public function testSuccessfulMailCommand() {\n        /* -- RFC 2821, 3.3.\n\n        There are three steps to SMTP mail transactions.  The transaction\n        starts with a MAIL command which gives the sender identification.\n\n        .....\n\n        The first step in the procedure is the MAIL command.\n\n            MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>\n\n        -- RFC 2821, 4.1.1.2.\n\n        Syntax:\n\n            \"MAIL FROM:\" (\"<>\" / Reverse-Path)\n                       [SP Mail-parameters] CRLF\n        -- RFC 2821, 4.1.2.\n\n        Reverse-path = Path\n            Forward-path = Path\n            Path = \"<\" [ A-d-l \":\" ] Mailbox \">\"\n            A-d-l = At-domain *( \",\" A-d-l )\n                        ; Note that this form, the so-called \"source route\",\n                        ; MUST BE accepted, SHOULD NOT be generated, and SHOULD be\n                        ; ignored.\n            At-domain = \"@\" domain\n\n        -- RFC 2821, 4.3.2.\n\n        MAIL\n            S: 250\n            E: 552, 451, 452, 550, 553, 503\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n        } catch (Exception $e) {\n            $this->fail('MAIL FROM should accept a 250 response');\n        }\n    }\n\n    public function testInvalidResponseCodeFromMailCausesException() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('553 Bad'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n            $this->fail('MAIL FROM should accept a 250 response');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testSenderIsPreferredOverFrom() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getSender')\n                ->once()\n                ->andReturn(array('another@domain.com' => 'Someone'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<another@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testReturnPathIsPreferredOverSender() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getSender')\n                ->once()\n                ->andReturn(array('another@domain.com' => 'Someone'));\n        $message->shouldReceive('getReturnPath')\n                ->once()\n                ->andReturn('more@domain.com');\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<more@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testSuccessfulRcptCommandWith250Response() {\n        /* -- RFC 2821, 3.3.\n\n     The second step in the procedure is the RCPT command.\n\n            RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>\n\n     The first or only argument to this command includes a forward-path\n     (normally a mailbox and domain, always surrounded by \"<\" and \">\"\n     brackets) identifying one recipient.  If accepted, the SMTP server\n     returns a 250 OK reply and stores the forward-path.  If the recipient\n     is known not to be a deliverable address, the SMTP server returns a\n     550 reply, typically with a string such as \"no such user - \" and the\n     mailbox name (other circumstances and reply codes are possible).\n     This step of the procedure can be repeated any number of times.\n\n        -- RFC 2821, 4.1.1.3.\n\n        This command is used to identify an individual recipient of the mail\n        data; multiple recipients are specified by multiple use of this\n        command.  The argument field contains a forward-path and may contain\n        optional parameters.\n\n        The forward-path normally consists of the required destination\n        mailbox.  Sending systems SHOULD not generate the optional list of\n        hosts known as a source route.\n\n        .......\n\n        \"RCPT TO:\" (\"<Postmaster@\" domain \">\" / \"<Postmaster>\" / Forward-Path)\n                                        [SP Rcpt-parameters] CRLF\n\n        -- RFC 2821, 4.2.2.\n\n            250 Requested mail action okay, completed\n            251 User not local; will forward to <forward-path>\n         (See section 3.4)\n            252 Cannot VRFY user, but will accept message and attempt\n                    delivery\n\n        -- RFC 2821, 4.3.2.\n\n        RCPT\n            S: 250, 251 (but see section 3.4 for discussion of 251 and 551)\n            E: 550, 551, 552, 553, 450, 451, 452, 503, 550\n        */\n\n        //We'll treat 252 as accepted since it isn't really a failure\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n        } catch (Exception $e) {\n            $this->fail('RCPT TO should accept a 250 response');\n        }\n    }\n\n    public function testMailFromCommandIsOnlySentOncePerMessage() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->never()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testMultipleRecipientsSendsMultipleRcpt() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array(\n                    'foo@bar' => null,\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<zip@button>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<test@domain>\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testCcRecipientsSendsMultipleRcpt() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getCc')\n                ->once()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<zip@button>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<test@domain>\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testSendReturnsNumberOfSuccessfulRecipients() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getCc')\n                ->once()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<zip@button>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('501 Nobody here'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<test@domain>\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(2, $smtp->send($message),\n            '%s: 1 of 3 recipients failed so 2 should be returned'\n            );\n    }\n\n    public function testRsetIsSentIfNoSuccessfulRecipients() {\n        /* --RFC 2821, 4.1.1.5.\n\n        This command specifies that the current mail transaction will be\n        aborted.  Any stored sender, recipients, and mail data MUST be\n        discarded, and all buffers and state tables cleared.  The receiver\n        MUST send a \"250 OK\" reply to a RSET command with no arguments.  A\n        reset command may be issued by the client at any time.\n\n        -- RFC 2821, 4.3.2.\n\n        RSET\n            S: 250\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('503 Bad'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RSET\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(0, $smtp->send($message),\n            '%s: 1 of 1 recipients failed so 0 should be returned'\n            );\n    }\n\n    public function testSuccessfulDataCommand() {\n        /* -- RFC 2821, 3.3.\n\n        The third step in the procedure is the DATA command (or some\n        alternative specified in a service extension).\n\n                    DATA <CRLF>\n\n        If accepted, the SMTP server returns a 354 Intermediate reply and\n        considers all succeeding lines up to but not including the end of\n        mail data indicator to be the message text.\n\n        -- RFC 2821, 4.1.1.4.\n\n        The receiver normally sends a 354 response to DATA, and then treats\n        the lines (strings ending in <CRLF> sequences, as described in\n        section 2.3.7) following the command as mail data from the sender.\n        This command causes the mail data to be appended to the mail data\n        buffer.  The mail data may contain any of the 128 ASCII character\n        codes, although experience has indicated that use of control\n        characters other than SP, HT, CR, and LF may cause problems and\n        SHOULD be avoided when possible.\n\n        -- RFC 2821, 4.3.2.\n\n        DATA\n            I: 354 -> data -> S: 250\n                                                E: 552, 554, 451, 452\n            E: 451, 554, 503\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('354 Go ahead'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n        } catch (Exception $e) {\n            $this->fail('354 is the expected response to DATA');\n        }\n    }\n\n    public function testBadDataResponseCausesException() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('451 Bad'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n            $this->fail('354 is the expected response to DATA (not observed)');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testMessageIsStreamedToBufferForData() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('354 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"\\r\\n.\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 OK'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testBadResponseAfterDataTransmissionCausesException() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->once()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->once()\n                ->andReturn(array('foo@bar' => null));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('354 OK'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"\\r\\n.\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('554 Error'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n            $smtp->send($message);\n            $this->fail('250 is the expected response after a DATA transmission (not observed)');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testBccRecipientsAreRemovedFromHeaders() {\n        /* -- RFC 2821, 7.2.\n\n     Addresses that do not appear in the message headers may appear in the\n     RCPT commands to an SMTP server for a number of reasons.  The two\n     most common involve the use of a mailing address as a \"list exploder\"\n     (a single address that resolves into multiple addresses) and the\n     appearance of \"blind copies\".  Especially when more than one RCPT\n     command is present, and in order to avoid defeating some of the\n     purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy\n     the full set of RCPT command arguments into the headers, either as\n     part of trace headers or as informational or private-extension\n     headers.  Since this rule is often violated in practice, and cannot\n     be enforced, sending SMTP systems that are aware of \"bcc\" use MAY\n     find it helpful to send each blind copy as a separate message\n     transaction containing only a single RCPT command.\n     */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getBcc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array());\n        $message->shouldReceive('setBcc')\n                ->zeroOrMoreTimes();\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testEachBccRecipientIsSentASeparateMessage() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getBcc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $message->shouldReceive('setBcc')\n                ->atLeast()->once()\n                ->with(array());\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array('zip@button' => 'Zip Button'));\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array('test@domain' => 'Test user'));\n        $message->shouldReceive('setBcc')\n                ->atLeast()->once()\n                ->with(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(1);\n        $buf->shouldReceive('readLine')->once()->with(1)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<foo@bar>\\r\\n\")->andReturn(2);\n        $buf->shouldReceive('readLine')->once()->with(2)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"DATA\\r\\n\")->andReturn(3);\n        $buf->shouldReceive('readLine')->once()->with(3)->andReturn(\"354 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"\\r\\n.\\r\\n\")->andReturn(4);\n        $buf->shouldReceive('readLine')->once()->with(4)->andReturn(\"250 OK\\r\\n\");\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(5);\n        $buf->shouldReceive('readLine')->once()->with(5)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<zip@button>\\r\\n\")->andReturn(6);\n        $buf->shouldReceive('readLine')->once()->with(6)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"DATA\\r\\n\")->andReturn(7);\n        $buf->shouldReceive('readLine')->once()->with(7)->andReturn(\"354 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"\\r\\n.\\r\\n\")->andReturn(8);\n        $buf->shouldReceive('readLine')->once()->with(8)->andReturn(\"250 OK\\r\\n\");\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(9);\n        $buf->shouldReceive('readLine')->once()->with(9)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<test@domain>\\r\\n\")->andReturn(10);\n        $buf->shouldReceive('readLine')->once()->with(10)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"DATA\\r\\n\")->andReturn(11);\n        $buf->shouldReceive('readLine')->once()->with(11)->andReturn(\"354 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"\\r\\n.\\r\\n\")->andReturn(12);\n        $buf->shouldReceive('readLine')->once()->with(12)->andReturn(\"250 OK\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(3, $smtp->send($message));\n    }\n\n    public function testMessageStateIsRestoredOnFailure() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getBcc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array());\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain.com>\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn(\"451 No\\r\\n\");\n\n        $this->_finishBuffer($buf);\n\n        $smtp->start();\n        try {\n            $smtp->send($message);\n            $this->fail('A bad response was given so exception is expected');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testStopSendsQuitCommand() {\n        /* -- RFC 2821, 4.1.1.10.\n\n        This command specifies that the receiver MUST send an OK reply, and\n        then close the transmission channel.\n\n        The receiver MUST NOT intentionally close the transmission channel\n        until it receives and replies to a QUIT command (even if there was an\n        error).  The sender MUST NOT intentionally close the transmission\n        channel until it sends a QUIT command and SHOULD wait until it\n        receives the reply (even if there was an error response to a previous\n        command).  If the connection is closed prematurely due to violations\n        of the above or system or network failure, the server MUST cancel any\n        pending transaction, but not undo any previously completed\n        transaction, and generally MUST act as if the command or transaction\n        in progress had received a temporary error (i.e., a 4yz response).\n\n        The QUIT command may be issued at any time.\n\n        Syntax:\n            \"QUIT\" CRLF\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"QUIT\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"221 Bye\\r\\n\");\n        $buf->shouldReceive('terminate')\n            ->once();\n\n        $this->_finishBuffer($buf);\n\n        $this->assertFalse($smtp->isStarted());\n        $smtp->start();\n        $this->assertTrue($smtp->isStarted());\n        $smtp->stop();\n        $this->assertFalse($smtp->isStarted());\n    }\n\n    public function testBufferCanBeFetched() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ref = $smtp->getBuffer();\n        $this->assertEquals($buf, $ref);\n    }\n\n    public function testBufferCanBeWrittenToUsingExecuteCommand() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with(\"FOO\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with(1)\n            ->andReturn(\"250 OK\\r\\n\");\n\n        $res = $smtp->executeCommand(\"FOO\\r\\n\");\n        $this->assertEquals(\"250 OK\\r\\n\", $res);\n    }\n\n    public function testResponseCodesAreValidated() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with(\"FOO\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with(1)\n            ->andReturn(\"551 Not ok\\r\\n\");\n\n        try {\n            $smtp->executeCommand(\"FOO\\r\\n\", array(250, 251));\n            $this->fail('A 250 or 251 response was needed but 551 was returned.');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testFailedRecipientsCanBeCollectedByReference() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('getBcc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n        $message->shouldReceive('setBcc')\n                ->atLeast()->once()\n                ->with(array());\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array('zip@button' => 'Zip Button'));\n        $message->shouldReceive('setBcc')\n                ->once()\n                ->with(array('test@domain' => 'Test user'));\n        $message->shouldReceive('setBcc')\n                ->atLeast()->once()\n                ->with(array(\n                    'zip@button' => 'Zip Button',\n                    'test@domain' => 'Test user',\n                ));\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(1);\n        $buf->shouldReceive('readLine')->once()->with(1)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<foo@bar>\\r\\n\")->andReturn(2);\n        $buf->shouldReceive('readLine')->once()->with(2)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"DATA\\r\\n\")->andReturn(3);\n        $buf->shouldReceive('readLine')->once()->with(3)->andReturn(\"354 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"\\r\\n.\\r\\n\")->andReturn(4);\n        $buf->shouldReceive('readLine')->once()->with(4)->andReturn(\"250 OK\\r\\n\");\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(5);\n        $buf->shouldReceive('readLine')->once()->with(5)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<zip@button>\\r\\n\")->andReturn(6);\n        $buf->shouldReceive('readLine')->once()->with(6)->andReturn(\"500 Bad\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RSET\\r\\n\")->andReturn(7);\n        $buf->shouldReceive('readLine')->once()->with(7)->andReturn(\"250 OK\\r\\n\");\n\n        $buf->shouldReceive('write')->once()->with(\"MAIL FROM:<me@domain.com>\\r\\n\")->andReturn(9);\n        $buf->shouldReceive('readLine')->once()->with(9)->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RCPT TO:<test@domain>\\r\\n\")->andReturn(10);\n        $buf->shouldReceive('readLine')->once()->with(10)->andReturn(\"500 Bad\\r\\n\");\n        $buf->shouldReceive('write')->once()->with(\"RSET\\r\\n\")->andReturn(11);\n        $buf->shouldReceive('readLine')->once()->with(11)->andReturn(\"250 OK\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $this->assertEquals(1, $smtp->send($message, $failures));\n        $this->assertEquals(array('zip@button', 'test@domain'), $failures,\n            '%s: Failures should be caught in an array'\n            );\n    }\n\n    public function testSendingRegeneratesMessageId() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $message = $this->_createMessage();\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain.com' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n        $message->shouldReceive('generateId')\n                ->once();\n\n        $this->_finishBuffer($buf);\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    protected function _getBuffer() {\n        return $this->getMockery('Swift_Transport_IoBuffer')->shouldIgnoreMissing();\n    }\n\n    protected function _createMessage() {\n        return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n    }\n\n    protected function _finishBuffer($buf) {\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with(0)\n            ->andReturn('220 server.com foo'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with('~^(EH|HE)LO .*?\\r\\n$~D')\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with('~^MAIL FROM:<.*?>\\r\\n$~D')\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with('~^RCPT TO:<.*?>\\r\\n$~D')\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with(\"DATA\\r\\n\")\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn(\"354 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with(\"\\r\\n.\\r\\n\")\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->with(\"RSET\\r\\n\")\n            ->andReturn($x = uniqid());\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->with($x)\n            ->andReturn(\"250 OK\\r\\n\");\n\n        $buf->shouldReceive('write')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n        $buf->shouldReceive('readLine')\n            ->zeroOrMoreTimes()\n            ->andReturn(false);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php",
    "content": "<?php\n\nclass Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \\SwiftMailerTestCase{\n    private $_agent;\n\n    public function setUp() {\n        $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();\n    }\n\n    public function testKeywordIsCramMd5() {\n        /* -- RFC 2195, 2.\n        The authentication type associated with CRAM is \"CRAM-MD5\".\n        */\n\n        $cram = $this->_getAuthenticator();\n        $this->assertEquals('CRAM-MD5', $cram->getAuthKeyword());\n    }\n\n    public function testSuccessfulAuthentication() {\n        $cram = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"AUTH CRAM-MD5\\r\\n\", array(334))\n             ->andReturn('334 '.base64_encode('<foo@bar>').\"\\r\\n\");\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\\Mockery::any(), array(235));\n\n        $this->assertTrue($cram->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: The buffer accepted all commands authentication should succeed'\n            );\n    }\n\n    public function testAuthenticationFailureSendRsetAndReturnFalse() {\n        $cram = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"AUTH CRAM-MD5\\r\\n\", array(334))\n             ->andReturn('334 '.base64_encode('<foo@bar>').\"\\r\\n\");\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\\Mockery::any(), array(235))\n             ->andThrow(new Swift_TransportException(''));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"RSET\\r\\n\", array(250));\n\n        $this->assertFalse($cram->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: Authentication fails, so RSET should be sent'\n            );\n    }\n\n    // -- Private helpers\n\n    private function _getAuthenticator() {\n        return new Swift_Transport_Esmtp_Auth_CramMd5Authenticator();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php",
    "content": "<?php\n\nclass Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest extends \\SwiftMailerTestCase{\n    private $_agent;\n\n    public function setUp() {\n        $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();\n    }\n\n    public function testKeywordIsLogin() {\n        $login = $this->_getAuthenticator();\n        $this->assertEquals('LOGIN', $login->getAuthKeyword());\n    }\n\n    public function testSuccessfulAuthentication() {\n        $login = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"AUTH LOGIN\\r\\n\", array(334));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(base64_encode('jack').\"\\r\\n\", array(334));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(base64_encode('pass').\"\\r\\n\", array(235));\n\n        $this->assertTrue($login->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: The buffer accepted all commands authentication should succeed'\n            );\n    }\n\n    public function testAuthenticationFailureSendRsetAndReturnFalse() {\n        $login = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"AUTH LOGIN\\r\\n\", array(334));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(base64_encode('jack').\"\\r\\n\", array(334));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(base64_encode('pass').\"\\r\\n\", array(235))\n             ->andThrow(new Swift_TransportException(''));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"RSET\\r\\n\", array(250));\n\n        $this->assertFalse($login->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: Authentication fails, so RSET should be sent'\n            );\n    }\n\n    // -- Private helpers\n\n    private function _getAuthenticator() {\n        return new Swift_Transport_Esmtp_Auth_LoginAuthenticator();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php",
    "content": "<?php\n\nclass Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \\SwiftMailerTestCase{\n    private $_message1 = '4e544c4d535350000100000007020000';\n    private $_message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000';\n    private $_message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000';\n\n    public function setUp() {\n        if (!function_exists('mcrypt_module_open') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) {\n            $this->markTestSkipped(\n                'One of the required functions is not available.'\n             );\n        }\n    }\n\n    public function testKeywordIsNtlm() {\n        $login = $this->_getAuthenticator();\n        $this->assertEquals('NTLM', $login->getAuthKeyword());\n    }\n\n    public function testMessage1Generator() {\n        $login = $this->_getAuthenticator();\n        $message1 = $this->_invokePrivateMethod('createMessage1', $login);\n\n        $this->assertEquals($this->_message1, bin2hex($message1),\n            '%s: We send the smallest ntlm message which should never fail.'\n        );\n    }\n\n    public function testLMv1Generator() {\n        $password = 'test1234';\n        $challenge = 'b019d38bad875c9d';\n        $lmv1 = '1879f60127f8a877022132ec221bcbf3ca016a9f76095606';\n\n        $login = $this->_getAuthenticator();\n        $lmv1Result = $this->_invokePrivateMethod('createLMPassword', $login, array($password, $this->hex2bin($challenge)));\n\n        $this->assertEquals($lmv1, bin2hex($lmv1Result),\n            '%s: The keys should be the same cause we use the same values to generate them.'\n        );\n    }\n\n    public function testLMv2Generator() {\n        $username = 'user';\n        $password = 'SecREt01';\n        $domain = 'DOMAIN';\n        $challenge = '0123456789abcdef';\n        $lmv2 = 'd6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344';\n\n        $login = $this->_getAuthenticator();\n        $lmv2Result = $this->_invokePrivateMethod('createLMv2Password', $login, array($password, $username, $domain, $this->hex2bin($challenge), $this->hex2bin('ffffff0011223344')));\n\n        $this->assertEquals($lmv2, bin2hex($lmv2Result),\n            '%s: The keys should be the same cause we use the same values to generate them.'\n        );\n    }\n\n    public function testMessage3v1Generator() {\n        $username = 'test';\n        $domain = 'TESTNT';\n        $workstation = 'MEMBER';\n        $lmResponse = '1879f60127f8a877022132ec221bcbf3ca016a9f76095606';\n        $ntlmResponse = 'e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a';\n        $message3T = '4e544c4d5353500003000000180018006000000018001800780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d004200450052001879f60127f8a877022132ec221bcbf3ca016a9f76095606e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a';\n\n        $login = $this->_getAuthenticator();\n        $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse)));\n\n        $this->assertEquals($message3T, bin2hex($message3),\n            '%s: We send the same information as the example is created with so this should be the same'\n        );\n    }\n\n    public function testMessage3v2Generator() {\n        $username = 'test';\n        $domain = 'TESTNT';\n        $workstation = 'MEMBER';\n        $lmResponse = 'bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9';\n        $ntlmResponse = 'caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000';\n\n        $login = $this->_getAuthenticator();\n        $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse)));\n\n        $this->assertEquals($this->_message3, bin2hex($message3),\n            '%s: We send the same information as the example is created with so this should be the same'\n        );\n    }\n\n    public function testGetDomainAndUsername() {\n        $username = \"DOMAIN\\user\";\n\n        $login = $this->_getAuthenticator();\n        list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));\n\n        $this->assertEquals('DOMAIN', $domain,\n            '%s: the fetched domain did not match'\n        );\n        $this->assertEquals('user', $user,\n            '%s: the fetched user did not match'\n        );\n    }\n\n    public function testGetDomainAndUsernameWithExtension() {\n        $username = \"domain.com\\user\";\n\n        $login = $this->_getAuthenticator();\n        list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));\n\n        $this->assertEquals('domain.com', $domain,\n            '%s: the fetched domain did not match'\n        );\n        $this->assertEquals('user', $user,\n            '%s: the fetched user did not match'\n        );\n    }\n\n    public function testGetDomainAndUsernameWithAtSymbol() {\n        $username = 'user@DOMAIN';\n\n        $login = $this->_getAuthenticator();\n        list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));\n\n        $this->assertEquals('DOMAIN', $domain,\n            '%s: the fetched domain did not match'\n        );\n        $this->assertEquals('user', $user,\n            '%s: the fetched user did not match'\n        );\n    }\n\n    public function testGetDomainAndUsernameWithAtSymbolAndExtension() {\n        $username = 'user@domain.com';\n\n        $login = $this->_getAuthenticator();\n        list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));\n\n        $this->assertEquals('domain.com', $domain,\n            '%s: the fetched domain did not match'\n        );\n        $this->assertEquals('user', $user,\n            '%s: the fetched user did not match'\n        );\n    }\n\n    public function testSuccessfulAuthentication() {\n        $domain = 'TESTNT';\n        $username = 'test';\n        $secret = 'test1234';\n\n        $ntlm = $this->_getAuthenticator();\n        $agent = $this->_getAgent();\n        $agent->shouldReceive('executeCommand')\n              ->once()\n              ->with('AUTH NTLM '.base64_encode(\n                        $this->_invokePrivateMethod('createMessage1', $ntlm)\n                    ).\"\\r\\n\", array(334))\n              ->andReturn('334 '.base64_encode($this->hex2bin('4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000')));\n        $agent->shouldReceive('executeCommand')\n              ->once()\n              ->with(base64_encode(\n                        $this->_invokePrivateMethod('createMessage3', $ntlm, array($domain, $username, $this->hex2bin('4d0045004d00420045005200'), $this->hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), $this->hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'))\n                    )).\"\\r\\n\", array(235));\n\n        $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')),\n            '%s: The buffer accepted all commands authentication should succeed'\n        );\n    }\n\n    public function testAuthenticationFailureSendRsetAndReturnFalse() {\n        $domain = 'TESTNT';\n        $username = 'test';\n        $secret = 'test1234';\n\n        $ntlm = $this->_getAuthenticator();\n        $agent = $this->_getAgent();\n        $agent->shouldReceive('executeCommand')\n              ->once()\n              ->with('AUTH NTLM '.base64_encode(\n                        $this->_invokePrivateMethod('createMessage1', $ntlm)\n                    ).\"\\r\\n\", array(334))\n              ->andThrow(new Swift_TransportException(''));\n        $agent->shouldReceive('executeCommand')\n              ->once()\n              ->with(\"RSET\\r\\n\", array(250));\n\n        $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')),\n            '%s: Authentication fails, so RSET should be sent'\n        );\n    }\n\n    // -- Private helpers\n    private function _getAuthenticator() {\n        return new Swift_Transport_Esmtp_Auth_NTLMAuthenticator();\n    }\n\n    private function _getAgent() {\n        return $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();\n    }\n\n    private function _invokePrivateMethod($method, $instance, array $args = array()) {\n        $methodC = new ReflectionMethod($instance, trim($method));\n        $methodC->setAccessible(true);\n\n        return $methodC->invokeArgs($instance, $args);\n    }\n\n    /**\n     * Hex2bin replacement for < PHP 5.4.\n     *\n     * @param string $hex\n     *\n     * @return string Binary\n     */\n    protected function hex2bin($hex) {\n        return function_exists('hex2bin') ? hex2bin($hex) : pack('H*', $hex);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php",
    "content": "<?php\n\nclass Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \\SwiftMailerTestCase{\n    private $_agent;\n\n    public function setUp() {\n        $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();\n    }\n\n    public function testKeywordIsPlain() {\n        /* -- RFC 4616, 1.\n        The name associated with this mechanism is \"PLAIN\".\n        */\n\n        $login = $this->_getAuthenticator();\n        $this->assertEquals('PLAIN', $login->getAuthKeyword());\n    }\n\n    public function testSuccessfulAuthentication() {\n        /* -- RFC 4616, 2.\n        The client presents the authorization identity (identity to act as),\n        followed by a NUL (U+0000) character, followed by the authentication\n        identity (identity whose password will be used), followed by a NUL\n        (U+0000) character, followed by the clear-text password.\n        */\n\n        $plain = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with('AUTH PLAIN '.base64_encode(\n                        'jack'.chr(0).'jack'.chr(0).'pass'\n                    ).\"\\r\\n\", array(235));\n\n        $this->assertTrue($plain->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: The buffer accepted all commands authentication should succeed'\n            );\n    }\n\n    public function testAuthenticationFailureSendRsetAndReturnFalse() {\n        $plain = $this->_getAuthenticator();\n\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with('AUTH PLAIN '.base64_encode(\n                        'jack'.chr(0).'jack'.chr(0).'pass'\n                    ).\"\\r\\n\", array(235))\n             ->andThrow(new Swift_TransportException(''));\n        $this->_agent->shouldReceive('executeCommand')\n             ->once()\n             ->with(\"RSET\\r\\n\", array(250));\n\n        $this->assertFalse($plain->authenticate($this->_agent, 'jack', 'pass'),\n            '%s: Authentication fails, so RSET should be sent'\n            );\n    }\n\n    // -- Private helpers\n\n    private function _getAuthenticator() {\n        return new Swift_Transport_Esmtp_Auth_PlainAuthenticator();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php",
    "content": "<?php\n\nclass Swift_Transport_Esmtp_AuthHandlerTest extends \\SwiftMailerTestCase{\n    private $_agent;\n\n    public function setUp() {\n        $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();\n    }\n\n    public function testKeywordIsAuth() {\n        $auth = $this->_createHandler(array());\n        $this->assertEquals('AUTH', $auth->getHandledKeyword());\n    }\n\n    public function testUsernameCanBeSetAndFetched() {\n        $auth = $this->_createHandler(array());\n        $auth->setUsername('jack');\n        $this->assertEquals('jack', $auth->getUsername());\n    }\n\n    public function testPasswordCanBeSetAndFetched() {\n        $auth = $this->_createHandler(array());\n        $auth->setPassword('pass');\n        $this->assertEquals('pass', $auth->getPassword());\n    }\n\n    public function testAuthModeCanBeSetAndFetched() {\n        $auth = $this->_createHandler(array());\n        $auth->setAuthMode('PLAIN');\n        $this->assertEquals('PLAIN', $auth->getAuthMode());\n    }\n\n    public function testMixinMethods() {\n        $auth = $this->_createHandler(array());\n        $mixins = $auth->exposeMixinMethods();\n        $this->assertTrue(in_array('getUsername', $mixins),\n            '%s: getUsername() should be accessible via mixin'\n            );\n        $this->assertTrue(in_array('setUsername', $mixins),\n            '%s: setUsername() should be accessible via mixin'\n            );\n        $this->assertTrue(in_array('getPassword', $mixins),\n            '%s: getPassword() should be accessible via mixin'\n            );\n        $this->assertTrue(in_array('setPassword', $mixins),\n            '%s: setPassword() should be accessible via mixin'\n            );\n        $this->assertTrue(in_array('setAuthMode', $mixins),\n            '%s: setAuthMode() should be accessible via mixin'\n            );\n        $this->assertTrue(in_array('getAuthMode', $mixins),\n            '%s: getAuthMode() should be accessible via mixin'\n            );\n    }\n\n    public function testAuthenticatorsAreCalledAccordingToParamsAfterEhlo() {\n        $a1 = $this->_createMockAuthenticator('PLAIN');\n        $a2 = $this->_createMockAuthenticator('LOGIN');\n\n        $a1->shouldReceive('authenticate')\n           ->never()\n           ->with($this->_agent, 'jack', 'pass');\n        $a2->shouldReceive('authenticate')\n           ->once()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(true);\n\n        $auth = $this->_createHandler(array($a1, $a2));\n        $auth->setUsername('jack');\n        $auth->setPassword('pass');\n\n        $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN'));\n        $auth->afterEhlo($this->_agent);\n    }\n\n    public function testAuthenticatorsAreNotUsedIfNoUsernameSet() {\n        $a1 = $this->_createMockAuthenticator('PLAIN');\n        $a2 = $this->_createMockAuthenticator('LOGIN');\n\n        $a1->shouldReceive('authenticate')\n           ->never()\n           ->with($this->_agent, 'jack', 'pass');\n        $a2->shouldReceive('authenticate')\n           ->never()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(true);\n\n        $auth = $this->_createHandler(array($a1, $a2));\n\n        $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN'));\n        $auth->afterEhlo($this->_agent);\n    }\n\n    public function testSeveralAuthenticatorsAreTriedIfNeeded() {\n        $a1 = $this->_createMockAuthenticator('PLAIN');\n        $a2 = $this->_createMockAuthenticator('LOGIN');\n\n        $a1->shouldReceive('authenticate')\n           ->once()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(false);\n        $a2->shouldReceive('authenticate')\n           ->once()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(true);\n\n        $auth = $this->_createHandler(array($a1, $a2));\n        $auth->setUsername('jack');\n        $auth->setPassword('pass');\n\n        $auth->setKeywordParams(array('PLAIN', 'LOGIN'));\n        $auth->afterEhlo($this->_agent);\n    }\n\n    public function testFirstAuthenticatorToPassBreaksChain() {\n        $a1 = $this->_createMockAuthenticator('PLAIN');\n        $a2 = $this->_createMockAuthenticator('LOGIN');\n        $a3 = $this->_createMockAuthenticator('CRAM-MD5');\n\n        $a1->shouldReceive('authenticate')\n           ->once()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(false);\n        $a2->shouldReceive('authenticate')\n           ->once()\n           ->with($this->_agent, 'jack', 'pass')\n           ->andReturn(true);\n        $a3->shouldReceive('authenticate')\n           ->never()\n           ->with($this->_agent, 'jack', 'pass');\n\n        $auth = $this->_createHandler(array($a1, $a2));\n        $auth->setUsername('jack');\n        $auth->setPassword('pass');\n\n        $auth->setKeywordParams(array('PLAIN', 'LOGIN', 'CRAM-MD5'));\n        $auth->afterEhlo($this->_agent);\n    }\n\n    // -- Private helpers\n\n    private function _createHandler($authenticators) {\n        return new Swift_Transport_Esmtp_AuthHandler($authenticators);\n    }\n\n    private function _createMockAuthenticator($type) {\n        $authenticator = $this->getMockery('Swift_Transport_Esmtp_Authenticator')->shouldIgnoreMissing();\n        $authenticator->shouldReceive('getAuthKeyword')\n                      ->zeroOrMoreTimes()\n                      ->andReturn($type);\n\n        return $authenticator;\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php",
    "content": "<?php\n\nrequire_once dirname(__DIR__).'/EsmtpTransportTest.php';\n\ninterface Swift_Transport_EsmtpHandlerMixin extends Swift_Transport_EsmtpHandler{\n    public function setUsername($user);\n    public function setPassword($pass);\n}\n\nclass Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transport_EsmtpTransportTest{\n    public function testExtensionHandlersAreSortedAsNeeded() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('STARTTLS')\n             ->andReturn(1);\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext2->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('AUTH')\n             ->andReturn(-1);\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2));\n        $this->assertEquals(array($ext2, $ext1), $smtp->getExtensionHandlers());\n    }\n\n    public function testHandlersAreNotifiedOfParams() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .*?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('setKeywordParams')\n             ->once()\n             ->with(array('PLAIN', 'LOGIN'));\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('setKeywordParams')\n             ->zeroOrMoreTimes()\n             ->with(array('123456'));\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2));\n        $smtp->start();\n    }\n\n    public function testSupportedExtensionHandlersAreRunAfterEhlo() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .*?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('afterEhlo')\n             ->once()\n             ->with($smtp);\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('afterEhlo')\n             ->zeroOrMoreTimes()\n             ->with($smtp);\n        $ext3->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext3->shouldReceive('afterEhlo')\n             ->never()\n             ->with($smtp);\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));\n        $smtp->start();\n    }\n\n    public function testExtensionsCanModifyMailFromParams() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher();\n        $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .*?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain> FOO ZIP\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar>\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn(\"250 OK\\r\\n\");\n        $this->_finishBuffer($buf);\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('getMailParams')\n             ->once()\n             ->andReturn('FOO');\n        $ext1->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('AUTH')\n             ->andReturn(-1);\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('getMailParams')\n             ->once()\n             ->andReturn('ZIP');\n        $ext2->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('AUTH')\n             ->andReturn(1);\n        $ext3->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext3->shouldReceive('getMailParams')\n             ->never();\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testExtensionsCanModifyRcptParams() {\n        $buf = $this->_getBuffer();\n        $dispatcher = $this->_createEventDispatcher();\n        $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getFrom')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('me@domain' => 'Me'));\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null));\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"MAIL FROM:<me@domain>\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"250 OK\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"RCPT TO:<foo@bar> FOO ZIP\\r\\n\")\n            ->andReturn(3);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(3)\n            ->andReturn(\"250 OK\\r\\n\");\n        $this->_finishBuffer($buf);\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('getRcptParams')\n             ->once()\n             ->andReturn('FOO');\n        $ext1->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('AUTH')\n             ->andReturn(-1);\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('getRcptParams')\n             ->once()\n             ->andReturn('ZIP');\n        $ext2->shouldReceive('getPriorityOver')\n             ->zeroOrMoreTimes()\n             ->with('AUTH')\n             ->andReturn(1);\n        $ext3->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext3->shouldReceive('getRcptParams')\n             ->never();\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));\n        $smtp->start();\n        $smtp->send($message);\n    }\n\n    public function testExtensionsAreNotifiedOnCommand() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"FOO\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn(\"250 Cool\\r\\n\");\n        $this->_finishBuffer($buf);\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('onCommand')\n             ->once()\n             ->with($smtp, \"FOO\\r\\n\", array(250, 251), \\Mockery::any(), \\Mockery::any());\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('onCommand')\n             ->once()\n             ->with($smtp, \"FOO\\r\\n\", array(250, 251), \\Mockery::any(), \\Mockery::any());\n        $ext3->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext3->shouldReceive('onCommand')\n             ->never()\n             ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));\n        $smtp->start();\n        $smtp->executeCommand(\"FOO\\r\\n\", array(250, 251));\n    }\n\n    public function testChainOfCommandAlgorithmWhenNotifyingExtensions() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n        $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 server.com foo\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-ServerName.tld\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250-AUTH PLAIN LOGIN\\r\\n\");\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn(\"250 SIZE=123456\\r\\n\");\n        $buf->shouldReceive('write')\n            ->never()\n            ->with(\"FOO\\r\\n\");\n        $this->_finishBuffer($buf);\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('onCommand')\n             ->once()\n             ->with($smtp, \"FOO\\r\\n\", array(250, 251), \\Mockery::any(), \\Mockery::any())\n             ->andReturnUsing(function ($a, $b, $c, $d, &$e) {\n                 $e = true;\n\n                 return '250 ok';\n             });\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('SIZE');\n        $ext2->shouldReceive('onCommand')\n             ->never()\n             ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $ext3->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $ext3->shouldReceive('onCommand')\n             ->never()\n             ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));\n        $smtp->start();\n        $smtp->executeCommand(\"FOO\\r\\n\", array(250, 251));\n    }\n\n    public function testExtensionsCanExposeMixinMethods() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('exposeMixinMethods')\n             ->zeroOrMoreTimes()\n             ->andReturn(array('setUsername', 'setPassword'));\n        $ext1->shouldReceive('setUsername')\n             ->once()\n             ->with('mick');\n        $ext1->shouldReceive('setPassword')\n             ->once()\n             ->with('pass');\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2));\n        $smtp->setUsername('mick');\n        $smtp->setPassword('pass');\n    }\n\n    public function testMixinMethodsBeginningWithSetAndNullReturnAreFluid() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('exposeMixinMethods')\n             ->zeroOrMoreTimes()\n             ->andReturn(array('setUsername', 'setPassword'));\n        $ext1->shouldReceive('setUsername')\n             ->once()\n             ->with('mick')\n             ->andReturn(null);\n        $ext1->shouldReceive('setPassword')\n             ->once()\n             ->with('pass')\n             ->andReturn(null);\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2));\n        $ret = $smtp->setUsername('mick');\n        $this->assertEquals($smtp, $ret);\n        $ret = $smtp->setPassword('pass');\n        $this->assertEquals($smtp, $ret);\n    }\n\n    public function testMixinSetterWhichReturnValuesAreNotFluid() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();\n        $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();\n\n        $ext1->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('AUTH');\n        $ext1->shouldReceive('exposeMixinMethods')\n             ->zeroOrMoreTimes()\n             ->andReturn(array('setUsername', 'setPassword'));\n        $ext1->shouldReceive('setUsername')\n             ->once()\n             ->with('mick')\n             ->andReturn('x');\n        $ext1->shouldReceive('setPassword')\n             ->once()\n             ->with('pass')\n             ->andReturn('x');\n        $ext2->shouldReceive('getHandledKeyword')\n             ->zeroOrMoreTimes()\n             ->andReturn('STARTTLS');\n        $this->_finishBuffer($buf);\n\n        $smtp->setExtensionHandlers(array($ext1, $ext2));\n        $this->assertEquals('x', $smtp->setUsername('mick'));\n        $this->assertEquals('x', $smtp->setPassword('pass'));\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php",
    "content": "<?php\n\nclass Swift_Transport_EsmtpTransportTest\n    extends Swift_Transport_AbstractSmtpEventSupportTest{\n    protected function _getTransport($buf, $dispatcher = null) {\n        if (!$dispatcher) {\n            $dispatcher = $this->_createEventDispatcher();\n        }\n\n        return new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);\n    }\n\n    public function testHostCanBeSetAndFetched() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $smtp->setHost('foo');\n        $this->assertEquals('foo', $smtp->getHost(), '%s: Host should be returned');\n    }\n\n    public function testPortCanBeSetAndFetched() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $smtp->setPort(25);\n        $this->assertEquals(25, $smtp->getPort(), '%s: Port should be returned');\n    }\n\n    public function testTimeoutCanBeSetAndFetched() {\n        $buf = $this->_getBuffer();\n        $buf->shouldReceive('setParam')\n            ->once()\n            ->with('timeout', 10);\n\n        $smtp = $this->_getTransport($buf);\n        $smtp->setTimeout(10);\n        $this->assertEquals(10, $smtp->getTimeout(), '%s: Timeout should be returned');\n    }\n\n    public function testEncryptionCanBeSetAndFetched() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $smtp->setEncryption('tls');\n        $this->assertEquals('tls', $smtp->getEncryption(), '%s: Crypto should be returned');\n    }\n\n    public function testStartSendsHeloToInitiate() {\n        //Overridden for EHLO instead\n    }\n\n    public function testStartSendsEhloToInitiate() {\n        /* -- RFC 2821, 3.2.\n\n            3.2 Client Initiation\n\n         Once the server has sent the welcoming message and the client has\n         received it, the client normally sends the EHLO command to the\n         server, indicating the client's identity.  In addition to opening the\n         session, use of EHLO indicates that the client is able to process\n         service extensions and requests that the server provide a list of the\n         extensions it supports.  Older SMTP systems which are unable to\n         support service extensions and contemporary clients which do not\n         require service extensions in the mail session being initiated, MAY\n         use HELO instead of EHLO.  Servers MUST NOT return the extended\n         EHLO-style response to a HELO command.  For a particular connection\n         attempt, if the server returns a \"command not recognized\" response to\n         EHLO, the client SHOULD be able to fall back and send HELO.\n\n         In the EHLO command the host sending the command identifies itself;\n         the command may be interpreted as saying \"Hello, I am <domain>\" (and,\n         in the case of EHLO, \"and I support service extension requests\").\n\n       -- RFC 2281, 4.1.1.1.\n\n       ehlo            = \"EHLO\" SP Domain CRLF\n       helo            = \"HELO\" SP Domain CRLF\n\n       -- RFC 2821, 4.3.2.\n\n       EHLO or HELO\n           S: 250\n           E: 504, 550\n\n     */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n        } catch (Exception $e) {\n            $this->fail('Starting Esmtp should send EHLO and accept 250 response');\n        }\n    }\n\n    public function testHeloIsUsedAsFallback() {\n        /* -- RFC 2821, 4.1.4.\n\n       If the EHLO command is not acceptable to the SMTP server, 501, 500,\n       or 502 failure replies MUST be returned as appropriate.  The SMTP\n       server MUST stay in the same state after transmitting these replies\n       that it was in before the EHLO was received.\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('501 WTF'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^HELO .+?\\r\\n$~D')\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 HELO'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        try {\n            $smtp->start();\n        } catch (Exception $e) {\n            $this->fail(\n                'Starting Esmtp should fallback to HELO if needed and accept 250 response'\n                );\n        }\n    }\n\n    public function testInvalidHeloResponseCausesException() {\n        //Overridden to first try EHLO\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('501 WTF'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^HELO .+?\\r\\n$~D')\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('504 WTF'.\"\\r\\n\");\n        $this->_finishBuffer($buf);\n\n        try {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');\n            $smtp->start();\n            $this->fail('Non 250 HELO response should raise Exception');\n        } catch (Exception $e) {\n            $this->assertFalse($smtp->isStarted(), '%s: SMTP start() should have failed');\n        }\n    }\n\n    public function testDomainNameIsPlacedInEhlo() {\n        /* -- RFC 2821, 4.1.4.\n\n       The SMTP client MUST, if possible, ensure that the domain parameter\n       to the EHLO command is a valid principal host name (not a CNAME or MX\n       name) for its host.  If this is not possible (e.g., when the client's\n       address is dynamically assigned and the client does not have an\n       obvious name), an address literal SHOULD be substituted for the\n       domain name and supplemental information provided that will assist in\n       identifying the client.\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"EHLO mydomain.com\\r\\n\")\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->setLocalDomain('mydomain.com');\n        $smtp->start();\n    }\n\n    public function testDomainNameIsPlacedInHelo() {\n        //Overridden to include ESMTP\n        /* -- RFC 2821, 4.1.4.\n\n       The SMTP client MUST, if possible, ensure that the domain parameter\n       to the EHLO command is a valid principal host name (not a CNAME or MX\n       name) for its host.  If this is not possible (e.g., when the client's\n       address is dynamically assigned and the client does not have an\n       obvious name), an address literal SHOULD be substituted for the\n       domain name and supplemental information provided that will assist in\n       identifying the client.\n        */\n\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(0)\n            ->andReturn(\"220 some.server.tld bleh\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with('~^EHLO .+?\\r\\n$~D')\n            ->andReturn(1);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(1)\n            ->andReturn('501 WTF'.\"\\r\\n\");\n        $buf->shouldReceive('write')\n            ->once()\n            ->with(\"HELO mydomain.com\\r\\n\")\n            ->andReturn(2);\n        $buf->shouldReceive('readLine')\n            ->once()\n            ->with(2)\n            ->andReturn('250 ServerName'.\"\\r\\n\");\n\n        $this->_finishBuffer($buf);\n        $smtp->setLocalDomain('mydomain.com');\n        $smtp->start();\n    }\n\n    public function testFluidInterface() {\n        $buf = $this->_getBuffer();\n        $smtp = $this->_getTransport($buf);\n        $buf->shouldReceive('setParam')\n            ->once()\n            ->with('timeout', 30);\n\n        $ref = $smtp\n            ->setHost('foo')\n            ->setPort(25)\n            ->setEncryption('tls')\n            ->setTimeout(30)\n            ;\n        $this->assertEquals($ref, $smtp);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php",
    "content": "<?php\n\nclass Swift_Transport_FailoverTransportTest extends \\SwiftMailerTestCase{\n    public function testFirstTransportIsUsed() {\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState) {\n               return $connectionState;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState) {\n               if (!$connectionState) {\n                   $connectionState = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->twice()\n           ->with(\\Mockery::anyOf($message1, $message2), \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState) {\n               if ($connectionState) {\n                   return 1;\n               }\n           });\n        $t2->shouldReceive('start')->never();\n        $t2->shouldReceive('send')->never();\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message1));\n        $this->assertEquals(1, $transport->send($message2));\n    }\n\n    public function testMessageCanBeTriedOnNextTransportIfExceptionThrown() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   return 1;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message));\n    }\n\n    public function testZeroIsReturnedIfTransportReturnsZero() {\n        $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n        $t1 = $this->getMockery('Swift_Transport')->shouldIgnoreMissing();\n\n        $connectionState = false;\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState) {\n               return $connectionState;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState) {\n               if (!$connectionState) {\n                   $connectionState = true;\n               }\n           });\n        $testCase = $this;\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState, $testCase) {\n               if (!$connectionState) {\n                   $testCase->fail();\n               }\n\n               return 0;\n           });\n\n        $transport = $this->_getTransport(array($t1));\n        $transport->start();\n        $this->assertEquals(0, $transport->send($message));\n    }\n\n    public function testTransportsWhichThrowExceptionsAreNotRetried() {\n        $e = new Swift_TransportException('maur b0rken');\n\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $message3 = $this->getMockery('Swift_Mime_Message');\n        $message4 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message3, \\Mockery::any());\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message4, \\Mockery::any());\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->times(4)\n           ->with(\\Mockery::anyOf($message1, $message2, $message3, $message4), \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   return 1;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message1));\n        $this->assertEquals(1, $transport->send($message2));\n        $this->assertEquals(1, $transport->send($message3));\n        $this->assertEquals(1, $transport->send($message4));\n    }\n\n    public function testExceptionIsThrownIfAllTransportsDie() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   throw $e;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        try {\n            $transport->send($message);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testStoppingTransportStopsAllDelegates() {\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n\n        $connectionState1 = true;\n        $connectionState2 = true;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('stop')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if ($connectionState1) {\n                   $connectionState1 = false;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('stop')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if ($connectionState2) {\n                   $connectionState2 = false;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $transport->stop();\n    }\n\n    public function testTransportShowsAsNotStartedIfAllDelegatesDead() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   $connectionState1 = false;\n                   throw $e;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   $connectionState2 = false;\n                   throw $e;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        try {\n            $transport->send($message);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n            $this->assertFalse($transport->isStarted());\n        }\n    }\n\n    public function testRestartingTransportRestartsDeadDelegates() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->twice()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   $connectionState1 = false;\n                   throw $e;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message2, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if ($connectionState1) {\n                   return 10;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   $connectionState2 = false;\n                   throw $e;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        try {\n            $transport->send($message1);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n            $this->assertFalse($transport->isStarted());\n        }\n        //Restart and re-try\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        $this->assertEquals(10, $transport->send($message2));\n    }\n\n    public function testFailureReferenceIsPassedToDelegates() {\n        $failures = array();\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n\n        $connectionState = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use ($connectionState) {\n               return $connectionState;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use ($connectionState) {\n               if (!$connectionState) {\n                   $connectionState = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, $failures)\n           ->andReturnUsing(function () use ($connectionState) {\n               if ($connectionState) {\n                   return 1;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1));\n        $transport->start();\n        $transport->send($message, $failures);\n    }\n\n    public function testRegisterPluginDelegatesToLoadedTransports() {\n        $plugin = $this->_createPlugin();\n\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $t1->shouldReceive('registerPlugin')\n           ->once()\n           ->with($plugin);\n        $t2->shouldReceive('registerPlugin')\n           ->once()\n           ->with($plugin);\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->registerPlugin($plugin);\n    }\n\n    // -- Private helpers\n\n    private function _getTransport(array $transports) {\n        $transport = new Swift_Transport_FailoverTransport();\n        $transport->setTransports($transports);\n\n        return $transport;\n    }\n\n    private function _createPlugin() {\n        return $this->getMockery('Swift_Events_EventListener');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php",
    "content": "<?php\n\nclass Swift_Transport_LoadBalancedTransportTest extends \\SwiftMailerTestCase{\n    public function testEachTransportIsUsedInTurn() {\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $testCase = $this;\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $testCase) {\n               if ($connectionState1) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message2, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $testCase) {\n               if ($connectionState2) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t2->shouldReceive('send')\n           ->never()\n           ->with($message1, \\Mockery::any());\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message1));\n        $this->assertEquals(1, $transport->send($message2));\n    }\n\n    public function testTransportsAreReusedInRotatingFashion() {\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $message3 = $this->getMockery('Swift_Mime_Message');\n        $message4 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $testCase = $this;\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $testCase) {\n               if ($connectionState1) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message3, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $testCase) {\n               if ($connectionState1) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message4, \\Mockery::any());\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message2, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $testCase) {\n               if ($connectionState2) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t2->shouldReceive('send')\n           ->never()\n           ->with($message1, \\Mockery::any());\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message4, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $testCase) {\n               if ($connectionState2) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n        $t2->shouldReceive('send')\n           ->never()\n           ->with($message3, \\Mockery::any());\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n\n        $this->assertEquals(1, $transport->send($message1));\n        $this->assertEquals(1, $transport->send($message2));\n        $this->assertEquals(1, $transport->send($message3));\n        $this->assertEquals(1, $transport->send($message4));\n    }\n\n    public function testMessageCanBeTriedOnNextTransportIfExceptionThrown() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $testCase = $this;\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e, $testCase) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n               $testCase->fail();\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $testCase) {\n               if ($connectionState2) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message));\n    }\n\n    public function testMessageIsTriedOnNextTransportIfZeroReturned() {\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if ($connectionState1) {\n                   return 0;\n               }\n\n               return 1;\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if ($connectionState2) {\n                   return 1;\n               }\n\n               return 0;\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message));\n    }\n\n    public function testZeroIsReturnedIfAllTransportsReturnZero() {\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if ($connectionState1) {\n                   return 0;\n               }\n\n               return 1;\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if ($connectionState2) {\n                   return 0;\n               }\n\n               return 1;\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(0, $transport->send($message));\n    }\n\n    public function testTransportsWhichThrowExceptionsAreNotRetried() {\n        $e = new Swift_TransportException('maur b0rken');\n\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $message3 = $this->getMockery('Swift_Mime_Message');\n        $message4 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $testCase = $this;\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e, $testCase) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n               $testCase->fail();\n           });\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message3, \\Mockery::any());\n        $t1->shouldReceive('send')\n           ->never()\n           ->with($message4, \\Mockery::any());\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->times(4)\n           ->with(\\Mockery::anyOf($message1, $message3, $message3, $message4), \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $testCase) {\n               if ($connectionState2) {\n                   return 1;\n               }\n               $testCase->fail();\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertEquals(1, $transport->send($message1));\n        $this->assertEquals(1, $transport->send($message2));\n        $this->assertEquals(1, $transport->send($message3));\n        $this->assertEquals(1, $transport->send($message4));\n    }\n\n    public function testExceptionIsThrownIfAllTransportsDie() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   throw $e;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        try {\n            $transport->send($message);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n        }\n    }\n\n    public function testStoppingTransportStopsAllDelegates() {\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = true;\n        $connectionState2 = true;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('stop')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if ($connectionState1) {\n                   $connectionState1 = false;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('stop')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if ($connectionState2) {\n                   $connectionState2 = false;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $transport->stop();\n    }\n\n    public function testTransportShowsAsNotStartedIfAllDelegatesDead() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   throw $e;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   throw $e;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        try {\n            $transport->send($message);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n            $this->assertFalse($transport->isStarted());\n        }\n    }\n\n    public function testRestartingTransportRestartsDeadDelegates() {\n        $e = new Swift_TransportException('b0rken');\n\n        $message1 = $this->getMockery('Swift_Mime_Message');\n        $message2 = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n        $connectionState1 = false;\n        $connectionState2 = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               return $connectionState1;\n           });\n        $t1->shouldReceive('start')\n           ->twice()\n           ->andReturnUsing(function () use (&$connectionState1) {\n               if (!$connectionState1) {\n                   $connectionState1 = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   $connectionState1 = false;\n                   throw $e;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message2, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState1, $e) {\n               if ($connectionState1) {\n                   return 10;\n               }\n           });\n\n        $t2->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               return $connectionState2;\n           });\n        $t2->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState2) {\n               if (!$connectionState2) {\n                   $connectionState2 = true;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->once()\n           ->with($message1, \\Mockery::any())\n           ->andReturnUsing(function () use (&$connectionState2, $e) {\n               if ($connectionState2) {\n                   throw $e;\n               }\n           });\n        $t2->shouldReceive('send')\n           ->never()\n           ->with($message2, \\Mockery::any());\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        try {\n            $transport->send($message1);\n            $this->fail('All transports failed so Exception should be thrown');\n        } catch (Exception $e) {\n            $this->assertFalse($transport->isStarted());\n        }\n        //Restart and re-try\n        $transport->start();\n        $this->assertTrue($transport->isStarted());\n        $this->assertEquals(10, $transport->send($message2));\n    }\n\n    public function testFailureReferenceIsPassedToDelegates() {\n        $failures = array();\n        $testCase = $this;\n\n        $message = $this->getMockery('Swift_Mime_Message');\n        $t1 = $this->getMockery('Swift_Transport');\n        $connectionState = false;\n\n        $t1->shouldReceive('isStarted')\n           ->zeroOrMoreTimes()\n           ->andReturnUsing(function () use (&$connectionState) {\n               return $connectionState;\n           });\n        $t1->shouldReceive('start')\n           ->once()\n           ->andReturnUsing(function () use (&$connectionState) {\n               if (!$connectionState) {\n                   $connectionState = true;\n               }\n           });\n        $t1->shouldReceive('send')\n           ->once()\n           ->with($message, \\Mockery::on(function (&$var) use (&$failures, $testCase) {\n                return $testCase->varsAreReferences($var, $failures);\n           }))\n           ->andReturnUsing(function () use (&$connectionState) {\n               if ($connectionState) {\n                   return 1;\n               }\n           });\n\n        $transport = $this->_getTransport(array($t1));\n        $transport->start();\n        $transport->send($message, $failures);\n    }\n\n    public function testRegisterPluginDelegatesToLoadedTransports() {\n        $plugin = $this->_createPlugin();\n\n        $t1 = $this->getMockery('Swift_Transport');\n        $t2 = $this->getMockery('Swift_Transport');\n\n        $t1->shouldReceive('registerPlugin')\n           ->once()\n           ->with($plugin);\n        $t2->shouldReceive('registerPlugin')\n           ->once()\n           ->with($plugin);\n\n        $transport = $this->_getTransport(array($t1, $t2));\n        $transport->registerPlugin($plugin);\n    }\n\n    /**\n     * Adapted from Yay_Matchers_ReferenceMatcher.\n     */\n    public function varsAreReferences(&$ref1, &$ref2) {\n        if (is_object($ref2)) {\n            return ($ref1 === $ref2);\n        }\n        if ($ref1 !== $ref2) {\n            return false;\n        }\n\n        $copy = $ref2;\n        $randomString = uniqid('yay');\n        $ref2 = $randomString;\n        $isRef = ($ref1 === $ref2);\n        $ref2 = $copy;\n\n        return $isRef;\n    }\n\n    // -- Private helpers\n\n    private function _getTransport(array $transports) {\n        $transport = new Swift_Transport_LoadBalancedTransport();\n        $transport->setTransports($transports);\n\n        return $transport;\n    }\n\n    private function _createPlugin() {\n        return $this->getMockery('Swift_Events_EventListener');\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php",
    "content": "<?php\n\nclass Swift_Transport_MailTransportTest extends \\SwiftMailerTestCase{\n    public function testTransportInvokesMailOncePerMessage() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $invoker->shouldReceive('mail')\n                ->once();\n\n        $transport->send($message);\n    }\n\n    public function testTransportUsesToFieldBodyInSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $to = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'To' => $to,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $to->shouldReceive('getFieldBody')\n           ->zeroOrMoreTimes()\n           ->andReturn('Foo <foo@bar>');\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with('Foo <foo@bar>', \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testTransportUsesSubjectFieldBodyInSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $subj = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'Subject' => $subj,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $subj->shouldReceive('getFieldBody')\n             ->zeroOrMoreTimes()\n             ->andReturn('Thing');\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), 'Thing', \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testTransportUsesBodyOfMessage() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('toString')\n             ->zeroOrMoreTimes()\n             ->andReturn(\n                \"To: Foo <foo@bar>\\r\\n\".\n                \"\\r\\n\".\n                'This body'\n             );\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), 'This body', \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testTransportSettingUsingReturnPathForExtraParams() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getReturnPath')\n             ->zeroOrMoreTimes()\n             ->andReturn(\n                'foo@bar'\n             );\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), '-f\\'foo@bar\\'');\n\n        $transport->send($message);\n    }\n\n    public function testTransportSettingEmptyExtraParams() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getReturnPath')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $message->shouldReceive('getSender')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $message->shouldReceive('getFrom')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $invoker->shouldReceive('mail')\n            ->once()\n            ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), null);\n\n        $transport->send($message);\n    }\n\n    public function testTransportSettingSettingExtraParamsWithF() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n        $transport->setExtraParams('-x\\'foo\\' -f%s');\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getReturnPath')\n            ->zeroOrMoreTimes()\n            ->andReturn(\n                    'foo@bar'\n                );\n        $message->shouldReceive('getSender')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $message->shouldReceive('getFrom')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $invoker->shouldReceive('mail')\n            ->once()\n            ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), '-x\\'foo\\' -f\\'foo@bar\\'');\n\n        $transport->send($message);\n    }\n\n    public function testTransportSettingSettingExtraParamsWithoutF() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n        $transport->setExtraParams('-x\\'foo\\'');\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getReturnPath')\n            ->zeroOrMoreTimes()\n            ->andReturn(\n                'foo@bar'\n            );\n        $message->shouldReceive('getSender')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $message->shouldReceive('getFrom')\n            ->zeroOrMoreTimes()\n            ->andReturn(null);\n        $invoker->shouldReceive('mail')\n            ->once()\n            ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), '-x\\'foo\\'');\n\n        $transport->send($message);\n    }\n\n    public function testTransportUsesHeadersFromMessage() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('toString')\n            ->zeroOrMoreTimes()\n            ->andReturn(\n                \"Subject: Stuff\\r\\n\".\n                \"\\r\\n\".\n                'This body'\n            );\n        $invoker->shouldReceive('mail')\n            ->once()\n            ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), 'Subject: Stuff'.PHP_EOL, \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testTransportReturnsCountOfAllRecipientsIfInvokerReturnsTrue() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null, 'zip@button' => null));\n        $message->shouldReceive('getCc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('test@test' => null));\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn(true);\n\n        $this->assertEquals(3, $transport->send($message));\n    }\n\n    public function testTransportReturnsZeroIfInvokerReturnsFalse() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $headers = $this->_createHeaders();\n        $message = $this->_createMessage($headers);\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => null, 'zip@button' => null));\n        $message->shouldReceive('getCc')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('test@test' => null));\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any())\n                ->andReturn(false);\n\n        $this->assertEquals(0, $transport->send($message));\n    }\n\n    public function testToHeaderIsRemovedFromHeaderSetDuringSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $to = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'To' => $to,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $headers->shouldReceive('remove')\n                ->once()\n                ->with('To');\n        $headers->shouldReceive('remove')\n                ->zeroOrMoreTimes();\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testSubjectHeaderIsRemovedFromHeaderSetDuringSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $subject = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'Subject' => $subject,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $headers->shouldReceive('remove')\n                ->once()\n                ->with('Subject');\n        $headers->shouldReceive('remove')\n                ->zeroOrMoreTimes();\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testToHeaderIsPutBackAfterSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $to = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'To' => $to,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $headers->shouldReceive('set')\n                ->once()\n                ->with($to);\n        $headers->shouldReceive('set')\n                ->zeroOrMoreTimes();\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testSubjectHeaderIsPutBackAfterSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $subject = $this->_createHeader();\n        $headers = $this->_createHeaders(array(\n            'Subject' => $subject,\n        ));\n        $message = $this->_createMessage($headers);\n\n        $headers->shouldReceive('set')\n                ->once()\n                ->with($subject);\n        $headers->shouldReceive('set')\n                ->zeroOrMoreTimes();\n        $invoker->shouldReceive('mail')\n                ->once()\n                ->with(\\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any(), \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    public function testMessageHeadersOnlyHavePHPEolsDuringSending() {\n        $invoker = $this->_createInvoker();\n        $dispatcher = $this->_createEventDispatcher();\n        $transport = $this->_createTransport($invoker, $dispatcher);\n\n        $subject = $this->_createHeader();\n        $subject->shouldReceive('getFieldBody')->andReturn(\"Foo\\r\\nBar\");\n\n        $headers = $this->_createHeaders(array(\n            'Subject' => $subject,\n        ));\n        $message = $this->_createMessage($headers);\n        $message->shouldReceive('toString')\n            ->zeroOrMoreTimes()\n            ->andReturn(\n                \"From: Foo\\r\\n<foo@bar>\\r\\n\".\n                \"\\r\\n\".\n                \"This\\r\\n\".\n                'body'\n            );\n\n        if (\"\\r\\n\" != PHP_EOL) {\n            $expectedHeaders = \"From: Foo\\n<foo@bar>\\n\";\n            $expectedSubject = \"Foo\\nBar\";\n            $expectedBody = \"This\\nbody\";\n        } else {\n            $expectedHeaders = \"From: Foo\\r\\n<foo@bar>\\r\\n\";\n            $expectedSubject = \"Foo\\r\\nBar\";\n            $expectedBody = \"This\\r\\nbody\";\n        }\n\n        $invoker->shouldReceive('mail')\n            ->once()\n            ->with(\\Mockery::any(), $expectedSubject, $expectedBody, $expectedHeaders, \\Mockery::any());\n\n        $transport->send($message);\n    }\n\n    // -- Creation Methods\n\n    private function _createTransport($invoker, $dispatcher) {\n        return new Swift_Transport_MailTransport($invoker, $dispatcher);\n    }\n\n    private function _createEventDispatcher() {\n        return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing();\n    }\n\n    private function _createInvoker() {\n        return $this->getMockery('Swift_Transport_MailInvoker');\n    }\n\n    private function _createMessage($headers) {\n        $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();\n        $message->shouldReceive('getHeaders')\n                ->zeroOrMoreTimes()\n                ->andReturn($headers);\n\n        return $message;\n    }\n\n    private function _createHeaders($headers = array()) {\n        $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();\n\n        if (count($headers) > 0) {\n            foreach ($headers as $name => $header) {\n                $set->shouldReceive('get')\n                    ->zeroOrMoreTimes()\n                    ->with($name)\n                    ->andReturn($header);\n                $set->shouldReceive('has')\n                    ->zeroOrMoreTimes()\n                    ->with($name)\n                    ->andReturn(true);\n            }\n        }\n\n        $header = $this->_createHeader();\n        $set->shouldReceive('get')\n            ->zeroOrMoreTimes()\n            ->andReturn($header);\n        $set->shouldReceive('has')\n            ->zeroOrMoreTimes()\n            ->andReturn(true);\n\n        return $set;\n    }\n\n    private function _createHeader() {\n        return $this->getMockery('Swift_Mime_Header')->shouldIgnoreMissing();\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php",
    "content": "<?php\n\nclass Swift_Transport_SendmailTransportTest\n    extends Swift_Transport_AbstractSmtpEventSupportTest{\n    protected function _getTransport($buf, $dispatcher = null, $command = '/usr/sbin/sendmail -bs') {\n        if (!$dispatcher) {\n            $dispatcher = $this->_createEventDispatcher();\n        }\n        $transport = new Swift_Transport_SendmailTransport($buf, $dispatcher);\n        $transport->setCommand($command);\n\n        return $transport;\n    }\n\n    protected function _getSendmail($buf, $dispatcher = null) {\n        if (!$dispatcher) {\n            $dispatcher = $this->_createEventDispatcher();\n        }\n        $sendmail = new Swift_Transport_SendmailTransport($buf, $dispatcher);\n\n        return $sendmail;\n    }\n\n    public function testCommandCanBeSetAndFetched() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getSendmail($buf);\n\n        $sendmail->setCommand('/usr/sbin/sendmail -bs');\n        $this->assertEquals('/usr/sbin/sendmail -bs', $sendmail->getCommand());\n        $sendmail->setCommand('/usr/sbin/sendmail -oi -t');\n        $this->assertEquals('/usr/sbin/sendmail -oi -t', $sendmail->getCommand());\n    }\n\n    public function testSendingMessageIn_t_ModeUsesSimplePipe() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getSendmail($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));\n        $message->shouldReceive('toByteStream')\n                ->once()\n                ->with($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('terminate')\n            ->once();\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array(\"\\r\\n\" => \"\\n\", \"\\n.\" => \"\\n..\"));\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array());\n\n        $sendmail->setCommand('/usr/sbin/sendmail -t');\n        $this->assertEquals(2, $sendmail->send($message));\n    }\n\n    public function testSendingIn_t_ModeWith_i_FlagDoesntEscapeDot() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getSendmail($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));\n        $message->shouldReceive('toByteStream')\n                ->once()\n                ->with($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('terminate')\n            ->once();\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array(\"\\r\\n\" => \"\\n\"));\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array());\n\n        $sendmail->setCommand('/usr/sbin/sendmail -i -t');\n        $this->assertEquals(2, $sendmail->send($message));\n    }\n\n    public function testSendingInTModeWith_oi_FlagDoesntEscapeDot() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getSendmail($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));\n        $message->shouldReceive('toByteStream')\n                ->once()\n                ->with($buf);\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('terminate')\n            ->once();\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array(\"\\r\\n\" => \"\\n\"));\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array());\n\n        $sendmail->setCommand('/usr/sbin/sendmail -oi -t');\n        $this->assertEquals(2, $sendmail->send($message));\n    }\n\n    public function testSendingMessageRegeneratesId() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getSendmail($buf);\n        $message = $this->_createMessage();\n\n        $message->shouldReceive('getTo')\n                ->zeroOrMoreTimes()\n                ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));\n        $message->shouldReceive('generateId');\n        $buf->shouldReceive('initialize')\n            ->once();\n        $buf->shouldReceive('terminate')\n            ->once();\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array(\"\\r\\n\" => \"\\n\", \"\\n.\" => \"\\n..\"));\n        $buf->shouldReceive('setWriteTranslations')\n            ->once()\n            ->with(array());\n\n        $sendmail->setCommand('/usr/sbin/sendmail -t');\n        $this->assertEquals(2, $sendmail->send($message));\n    }\n\n    public function testFluidInterface() {\n        $buf = $this->_getBuffer();\n        $sendmail = $this->_getTransport($buf);\n\n        $ref = $sendmail->setCommand('/foo');\n        $this->assertEquals($ref, $sendmail);\n    }\n}\n"
  },
  {
    "path": "website/lib/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php",
    "content": "<?php\n\nclass Swift_Transport_StreamBufferTest extends \\PHPUnit_Framework_TestCase{\n    public function testSettingWriteTranslationsCreatesFilters() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->once())\n                ->method('createFilter')\n                ->with('a', 'b')\n                ->will($this->returnCallback(array($this, '_createFilter')));\n\n        $buffer = $this->_createBuffer($factory);\n        $buffer->setWriteTranslations(array('a' => 'b'));\n    }\n\n    public function testOverridingTranslationsOnlyAddsNeededFilters() {\n        $factory = $this->_createFactory();\n        $factory->expects($this->exactly(2))\n                ->method('createFilter')\n                ->will($this->returnCallback(array($this, '_createFilter')));\n\n        $buffer = $this->_createBuffer($factory);\n        $buffer->setWriteTranslations(array('a' => 'b'));\n        $buffer->setWriteTranslations(array('x' => 'y', 'a' => 'b'));\n    }\n\n    // -- Creation methods\n\n    private function _createBuffer($replacementFactory) {\n        return new Swift_Transport_StreamBuffer($replacementFactory);\n    }\n\n    private function _createFactory() {\n        return $this->getMock('Swift_ReplacementFilterFactory');\n    }\n\n    public function _createFilter() {\n        return $this->getMock('Swift_StreamFilter');\n    }\n}\n"
  },
  {
    "path": "website/lib/xss.js",
    "content": "var entityMap = {\n    \"&\": \"&amp;\",\n    \"<\": \"&lt;\",\n    \">\": \"&gt;\",\n    '\"': '&quot;',\n    \"'\": '&#39;',\n    \"/\": '&#x2F;'\n};\nfunction escapeHtml(string) {\n    return String(string).replace(/[&<>\"'\\/]/g, function (s) {\n        return entityMap[s];\n    });\n}\n\n(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n/**\n * 默认配置\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar FilterCSS = require('cssfilter').FilterCSS;\nvar getDefaultCSSWhiteList = require('cssfilter').getDefaultWhiteList;\nvar _ = require('./util');\n\n// 默认白名单\nfunction getDefaultWhiteList () {\n  return {\n    a:      ['target', 'href', 'title'],\n    abbr:   ['title'],\n    address: [],\n    area:   ['shape', 'coords', 'href', 'alt'],\n    article: [],\n    aside:  [],\n    audio:  ['autoplay', 'controls', 'loop', 'preload', 'src'],\n    b:      [],\n    bdi:    ['dir'],\n    bdo:    ['dir'],\n    big:    [],\n    blockquote: ['cite'],\n    br:     [],\n    caption: [],\n    center: [],\n    cite:   [],\n    code:   [],\n    col:    ['align', 'valign', 'span', 'width'],\n    colgroup: ['align', 'valign', 'span', 'width'],\n    dd:     [],\n    del:    ['datetime'],\n    details: ['open'],\n    div:    [],\n    dl:     [],\n    dt:     [],\n    em:     [],\n    font:   ['color', 'size', 'face'],\n    footer: [],\n    h1:     [],\n    h2:     [],\n    h3:     [],\n    h4:     [],\n    h5:     [],\n    h6:     [],\n    header: [],\n    hr:     [],\n    i:      [],\n    img:    ['src', 'alt', 'title', 'width', 'height'],\n    ins:    ['datetime'],\n    li:     [],\n    mark:   [],\n    nav:    [],\n    ol:     [],\n    p:      [],\n    pre:    [],\n    s:      [],\n    section:[],\n    small:  [],\n    span:   [],\n    sub:    [],\n    sup:    [],\n    strong: [],\n    table:  ['width', 'border', 'align', 'valign'],\n    tbody:  ['align', 'valign'],\n    td:     ['width', 'rowspan', 'colspan', 'align', 'valign'],\n    tfoot:  ['align', 'valign'],\n    th:     ['width', 'rowspan', 'colspan', 'align', 'valign'],\n    thead:  ['align', 'valign'],\n    tr:     ['rowspan', 'align', 'valign'],\n    tt:     [],\n    u:      [],\n    ul:     [],\n    video:  ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width']\n  };\n}\n\n// 默认CSS Filter\nvar defaultCSSFilter = new FilterCSS();\n\n/**\n * 匹配到标签时的处理方法\n *\n * @param {String} tag\n * @param {String} html\n * @param {Object} options\n * @return {String}\n */\nfunction onTag (tag, html, options) {\n  // do nothing\n}\n\n/**\n * 匹配到不在白名单上的标签时的处理方法\n *\n * @param {String} tag\n * @param {String} html\n * @param {Object} options\n * @return {String}\n */\nfunction onIgnoreTag (tag, html, options) {\n  // do nothing\n}\n\n/**\n * 匹配到标签属性时的处理方法\n *\n * @param {String} tag\n * @param {String} name\n * @param {String} value\n * @return {String}\n */\nfunction onTagAttr (tag, name, value) {\n  // do nothing\n}\n\n/**\n * 匹配到不在白名单上的标签属性时的处理方法\n *\n * @param {String} tag\n * @param {String} name\n * @param {String} value\n * @return {String}\n */\nfunction onIgnoreTagAttr (tag, name, value) {\n  // do nothing\n}\n\n/**\n * HTML转义\n *\n * @param {String} html\n */\nfunction escapeHtml (html) {\n  return html.replace(REGEXP_LT, '&lt;').replace(REGEXP_GT, '&gt;');\n}\n\n/**\n * 安全的标签属性值\n *\n * @param {String} tag\n * @param {String} name\n * @param {String} value\n * @param {Object} cssFilter\n * @return {String}\n */\nfunction safeAttrValue (tag, name, value, cssFilter) {\n  // 转换为友好的属性值，再做判断\n  value = friendlyAttrValue(value);\n\n  if (name === 'href' || name === 'src') {\n    // 过滤 href 和 src 属性\n    // 仅允许 http:// | https:// | mailto: | / | # 开头的地址\n    value = _.trim(value);\n    if (value === '#') return '#';\n    if (!(value.substr(0, 7) === 'http://' ||\n         value.substr(0, 8) === 'https://' ||\n         value.substr(0, 7) === 'mailto:' ||\n         value[0] === '#' ||\n         value[0] === '/')) {\n      return '';\n    }\n  } else if (name === 'background') {\n    // 过滤 background 属性 （这个xss漏洞较老了，可能已经不适用）\n    // javascript:\n    REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;\n    if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {\n      return '';\n    }\n  } else if (name === 'style') {\n    // /*注释*/\n    /*REGEXP_DEFAULT_ON_TAG_ATTR_3.lastIndex = 0;\n    if (REGEXP_DEFAULT_ON_TAG_ATTR_3.test(value)) {\n      return '';\n    }*/\n    // expression()\n    REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0;\n    if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) {\n      return '';\n    }\n    // url()\n    REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0;\n    if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) {\n      REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;\n      if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {\n        return '';\n      }\n    }\n    if (cssFilter !== false) {\n      cssFilter = cssFilter || defaultCSSFilter;\n      value = cssFilter.process(value);\n    }\n  }\n\n  // 输出时需要转义<>\"\n  value = escapeAttrValue(value);\n  return value;\n}\n\n// 正则表达式\nvar REGEXP_LT = /</g;\nvar REGEXP_GT = />/g;\nvar REGEXP_QUOTE = /\"/g;\nvar REGEXP_QUOTE_2 = /&quot;/g;\nvar REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/img;\nvar REGEXP_ATTR_VALUE_COLON = /&colon;?/img;\nvar REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/img;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_3 = /\\/\\*|\\*\\//mg;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_4 = /((j\\s*a\\s*v\\s*a|v\\s*b|l\\s*i\\s*v\\s*e)\\s*s\\s*c\\s*r\\s*i\\s*p\\s*t\\s*|m\\s*o\\s*c\\s*h\\s*a)\\:/ig;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_5 = /^[\\s\"'`]*(d\\s*a\\s*t\\s*a\\s*)\\:/ig;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_6 = /^[\\s\"'`]*(d\\s*a\\s*t\\s*a\\s*)\\:\\s*image\\//ig;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_7 = /e\\s*x\\s*p\\s*r\\s*e\\s*s\\s*s\\s*i\\s*o\\s*n\\s*\\(.*/ig;\nvar REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\\s*r\\s*l\\s*\\(.*/ig;\n\n/**\n * 对双引号进行转义\n *\n * @param {String} str\n * @return {String} str\n */\nfunction escapeQuote (str) {\n  return str.replace(REGEXP_QUOTE, '&quot;');\n}\n\n/**\n * 对双引号进行转义\n *\n * @param {String} str\n * @return {String} str\n */\nfunction unescapeQuote (str) {\n  return str.replace(REGEXP_QUOTE_2, '\"');\n}\n\n/**\n * 对html实体编码进行转义\n *\n * @param {String} str\n * @return {String}\n */\nfunction escapeHtmlEntities (str) {\n  return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode (str, code) {\n    return (code[0] === 'x' || code[0] === 'X')\n            ? String.fromCharCode(parseInt(code.substr(1), 16))\n            : String.fromCharCode(parseInt(code, 10));\n  });\n}\n\n/**\n * 对html5新增的危险实体编码进行转义\n *\n * @param {String} str\n * @return {String}\n */\nfunction escapeDangerHtml5Entities (str) {\n  return str.replace(REGEXP_ATTR_VALUE_COLON, ':')\n            .replace(REGEXP_ATTR_VALUE_NEWLINE, ' ');\n}\n\n/**\n * 清除不可见字符\n *\n * @param {String} str\n * @return {String}\n */\nfunction clearNonPrintableCharacter (str) {\n  var str2 = '';\n  for (var i = 0, len = str.length; i < len; i++) {\n    str2 += str.charCodeAt(i) < 32 ? ' ' : str.charAt(i);\n  }\n  return _.trim(str2);\n}\n\n/**\n * 将标签的属性值转换成一般字符，便于分析\n *\n * @param {String} str\n * @return {String}\n */\nfunction friendlyAttrValue (str) {\n  str = unescapeQuote(str);             // 双引号\n  str = escapeHtmlEntities(str);         // 转换HTML实体编码\n  str = escapeDangerHtml5Entities(str);  // 转换危险的HTML5新增实体编码\n  str = clearNonPrintableCharacter(str); // 清除不可见字符\n  return str;\n}\n\n/**\n * 转义用于输出的标签属性值\n *\n * @param {String} str\n * @return {String}\n */\nfunction escapeAttrValue (str) {\n  str = escapeQuote(str);\n  str = escapeHtml(str);\n  return str;\n}\n\n/**\n * 去掉不在白名单中的标签onIgnoreTag处理方法\n */\nfunction onIgnoreTagStripAll () {\n  return '';\n}\n\n/**\n * 删除标签体\n *\n * @param {array} tags 要删除的标签列表\n * @param {function} next 对不在列表中的标签的处理函数，可选\n */\nfunction StripTagBody (tags, next) {\n  if (typeof(next) !== 'function') {\n    next = function () {};\n  }\n\n  var isRemoveAllTag = !Array.isArray(tags);\n  function isRemoveTag (tag) {\n    if (isRemoveAllTag) return true;\n    return (_.indexOf(tags, tag) !== -1);\n  }\n\n  var removeList = [];   // 要删除的位置范围列表\n  var posStart = false;  // 当前标签开始位置\n\n  return {\n    onIgnoreTag: function (tag, html, options) {\n      if (isRemoveTag(tag)) {\n        if (options.isClosing) {\n          var ret = '[/removed]';\n          var end = options.position + ret.length;\n          removeList.push([posStart !== false ? posStart : options.position, end]);\n          posStart = false;\n          return ret;\n        } else {\n          if (!posStart) {\n            posStart = options.position;\n          }\n          return '[removed]';\n        }\n      } else {\n        return next(tag, html, options);\n      }\n    },\n    remove: function (html) {\n      var rethtml = '';\n      var lastPos = 0;\n      _.forEach(removeList, function (pos) {\n        rethtml += html.slice(lastPos, pos[0]);\n        lastPos = pos[1];\n      });\n      rethtml += html.slice(lastPos);\n      return rethtml;\n    }\n  };\n}\n\n/**\n * 去除备注标签\n *\n * @param {String} html\n * @return {String}\n */\nfunction stripCommentTag (html) {\n  return html.replace(STRIP_COMMENT_TAG_REGEXP, '');\n}\nvar STRIP_COMMENT_TAG_REGEXP = /<!--[\\s\\S]*?-->/g;\n\n/**\n * 去除不可见字符\n *\n * @param {String} html\n * @return {String}\n */\nfunction stripBlankChar (html) {\n  var chars = html.split('');\n  chars = chars.filter(function (char) {\n    var c = char.charCodeAt(0);\n    if (c === 127) return false;\n    if (c <= 31) {\n      if (c === 10 || c === 13) return true;\n      return false;\n    }\n    return true;\n  });\n  return chars.join('');\n}\n\n\nexports.whiteList = getDefaultWhiteList();\nexports.getDefaultWhiteList = getDefaultWhiteList;\nexports.onTag = onTag;\nexports.onIgnoreTag = onIgnoreTag;\nexports.onTagAttr = onTagAttr;\nexports.onIgnoreTagAttr = onIgnoreTagAttr;\nexports.safeAttrValue = safeAttrValue;\nexports.escapeHtml = escapeHtml;\nexports.escapeQuote = escapeQuote;\nexports.unescapeQuote = unescapeQuote;\nexports.escapeHtmlEntities = escapeHtmlEntities;\nexports.escapeDangerHtml5Entities = escapeDangerHtml5Entities;\nexports.clearNonPrintableCharacter = clearNonPrintableCharacter;\nexports.friendlyAttrValue = friendlyAttrValue;\nexports.escapeAttrValue = escapeAttrValue;\nexports.onIgnoreTagStripAll = onIgnoreTagStripAll;\nexports.StripTagBody = StripTagBody;\nexports.stripCommentTag = stripCommentTag;\nexports.stripBlankChar = stripBlankChar;\nexports.cssFilter = defaultCSSFilter;\nexports.getDefaultCSSWhiteList = getDefaultCSSWhiteList;\n\n},{\"./util\":4,\"cssfilter\":8}],2:[function(require,module,exports){\n/**\n * 模块入口\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar DEFAULT = require('./default');\nvar parser = require('./parser');\nvar FilterXSS = require('./xss');\n\n\n/**\n * XSS过滤\n *\n * @param {String} html 要过滤的HTML代码\n * @param {Object} options 选项：whiteList, onTag, onTagAttr, onIgnoreTag, onIgnoreTagAttr, safeAttrValue, escapeHtml\n * @return {String}\n */\nfunction filterXSS (html, options) {\n  var xss = new FilterXSS(options);\n  return xss.process(html);\n}\n\n\n// 输出\nexports = module.exports = filterXSS;\nexports.FilterXSS = FilterXSS;\nfor (var i in DEFAULT) exports[i] = DEFAULT[i];\nfor (var i in parser) exports[i] = parser[i];\n\n\n// 在浏览器端使用\nif (typeof window !== 'undefined') {\n  window.filterXSS = module.exports;\n}\n\n},{\"./default\":1,\"./parser\":3,\"./xss\":5}],3:[function(require,module,exports){\n/**\n * 简单 HTML Parser\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar _ = require('./util');\n\n/**\n * 获取标签的名称\n *\n * @param {String} html 如：'<a hef=\"#\">'\n * @return {String}\n */\nfunction getTagName (html) {\n  var i = html.indexOf(' ');\n  if (i === -1) {\n    var tagName = html.slice(1, -1);\n  } else {\n    var tagName = html.slice(1, i + 1);\n  }\n  tagName = _.trim(tagName).toLowerCase();\n  if (tagName.slice(0, 1) === '/') tagName = tagName.slice(1);\n  if (tagName.slice(-1) === '/') tagName = tagName.slice(0, -1);\n  return tagName;\n}\n\n/**\n * 是否为闭合标签\n *\n * @param {String} html 如：'<a hef=\"#\">'\n * @return {Boolean}\n */\nfunction isClosing (html) {\n  return (html.slice(0, 2) === '</');\n}\n\n/**\n * 分析HTML代码，调用相应的函数处理，返回处理后的HTML\n *\n * @param {String} html\n * @param {Function} onTag 处理标签的函数\n *   参数格式： function (sourcePosition, position, tag, html, isClosing)\n * @param {Function} escapeHtml 对HTML进行转义的函数\n * @return {String}\n */\nfunction parseTag (html, onTag, escapeHtml) {\n  'user strict';\n\n  var rethtml = '';        // 待返回的HTML\n  var lastPos = 0;         // 上一个标签结束位置\n  var tagStart = false;    // 当前标签开始位置\n  var quoteStart = false;  // 引号开始位置\n  var currentPos = 0;      // 当前位置\n  var len = html.length;   // HTML长度\n  var currentHtml = '';    // 当前标签的HTML代码\n  var currentTagName = ''; // 当前标签的名称\n\n  // 逐个分析字符\n  for (currentPos = 0; currentPos < len; currentPos++) {\n    var c = html.charAt(currentPos);\n    if (tagStart === false) {\n      if (c === '<') {\n        tagStart = currentPos;\n        continue;\n      }\n    } else {\n      if (quoteStart === false) {\n        if (c === '<') {\n          rethtml += escapeHtml(html.slice(lastPos, currentPos));\n          tagStart = currentPos;\n          lastPos = currentPos;\n          continue;\n        }\n        if (c === '>') {\n          rethtml += escapeHtml(html.slice(lastPos, tagStart));\n          currentHtml = html.slice(tagStart, currentPos + 1);\n          currentTagName = getTagName(currentHtml);\n          rethtml += onTag(tagStart,\n                           rethtml.length,\n                           currentTagName,\n                           currentHtml,\n                           isClosing(currentHtml));\n          lastPos = currentPos + 1;\n          tagStart = false;\n          continue;\n        }\n        // HTML标签内的引号仅当前一个字符是等于号时才有效\n        if ((c === '\"' || c === \"'\") && html.charAt(currentPos - 1) === '=') {\n          quoteStart = c;\n          continue;\n        }\n      } else {\n        if (c === quoteStart) {\n          quoteStart = false;\n          continue;\n        }\n      }\n    }\n  }\n  if (lastPos < html.length) {\n    rethtml += escapeHtml(html.substr(lastPos));\n  }\n\n  return rethtml;\n}\n\n// 不符合属性名称规则的正则表达式\nvar REGEXP_ATTR_NAME = /[^a-zA-Z0-9_:\\.\\-]/img;\n\n/**\n * 分析标签HTML代码，调用相应的函数处理，返回HTML\n *\n * @param {String} html 如标签'<a href=\"#\" target=\"_blank\">' 则为 'href=\"#\" target=\"_blank\"'\n * @param {Function} onAttr 处理属性值的函数\n *   函数格式： function (name, value)\n * @return {String}\n */\nfunction parseAttr (html, onAttr) {\n  'user strict';\n\n  var lastPos = 0;        // 当前位置\n  var retAttrs = [];      // 待返回的属性列表\n  var tmpName = false;    // 临时属性名称\n  var len = html.length;  // HTML代码长度\n\n  function addAttr (name, value) {\n    name = _.trim(name);\n    name = name.replace(REGEXP_ATTR_NAME, '').toLowerCase();\n    if (name.length < 1) return;\n    var ret = onAttr(name, value || '');\n    if (ret) retAttrs.push(ret);\n  };\n\n  // 逐个分析字符\n  for (var i = 0; i < len; i++) {\n    var c = html.charAt(i);\n    var v, j;\n    if (tmpName === false && c === '=') {\n      tmpName = html.slice(lastPos, i);\n      lastPos = i + 1;\n      continue;\n    }\n    if (tmpName !== false) {\n      // HTML标签内的引号仅当前一个字符是等于号时才有效\n      if (i === lastPos && (c === '\"' || c === \"'\") && html.charAt(i - 1) === '=') {\n        j = html.indexOf(c, i + 1);\n        if (j === -1) {\n          break;\n        } else {\n          v = _.trim(html.slice(lastPos + 1, j));\n          addAttr(tmpName, v);\n          tmpName = false;\n          i = j;\n          lastPos = i + 1;\n          continue;\n        }\n      }\n    }\n    if (c === ' ') {\n      if (tmpName === false) {\n        j = findNextEqual(html, i);\n        if (j === -1) {\n          v = _.trim(html.slice(lastPos, i));\n          addAttr(v);\n          tmpName = false;\n          lastPos = i + 1;\n          continue;\n        } else {\n          i = j - 1;\n          continue;\n        }\n      } else {\n        j = findBeforeEqual(html, i - 1);\n        if (j === -1) {\n          v = _.trim(html.slice(lastPos, i));\n          v = stripQuoteWrap(v);\n          addAttr(tmpName, v);\n          tmpName = false;\n          lastPos = i + 1;\n          continue;\n        } else {\n          continue;\n        }\n      }\n    }\n  }\n\n  if (lastPos < html.length) {\n    if (tmpName === false) {\n      addAttr(html.slice(lastPos));\n    } else {\n      addAttr(tmpName, stripQuoteWrap(_.trim(html.slice(lastPos))));\n    }\n  }\n\n  return _.trim(retAttrs.join(' '));\n}\n\nfunction findNextEqual (str, i) {\n  for (; i < str.length; i++) {\n    var c = str[i];\n    if (c === ' ') continue;\n    if (c === '=') return i;\n    return -1;\n  }\n}\n\nfunction findBeforeEqual (str, i) {\n  for (; i > 0; i--) {\n    var c = str[i];\n    if (c === ' ') continue;\n    if (c === '=') return i;\n    return -1;\n  }\n}\n\nfunction isQuoteWrapString (text) {\n  if ((text[0] === '\"' && text[text.length - 1] === '\"') ||\n      (text[0] === '\\'' && text[text.length - 1] === '\\'')) {\n    return true;\n  } else {\n    return false;\n  }\n};\n\nfunction stripQuoteWrap (text) {\n  if (isQuoteWrapString(text)) {\n    return text.substr(1, text.length - 2);\n  } else {\n    return text;\n  }\n};\n\n\nexports.parseTag = parseTag;\nexports.parseAttr = parseAttr;\n\n},{\"./util\":4}],4:[function(require,module,exports){\nmodule.exports = {\n  indexOf: function (arr, item) {\n    var i, j;\n    if (Array.prototype.indexOf) {\n      return arr.indexOf(item);\n    }\n    for (i = 0, j = arr.length; i < j; i++) {\n      if (arr[i] === item) {\n        return i;\n      }\n    }\n    return -1;\n  },\n  forEach: function (arr, fn, scope) {\n    var i, j;\n    if (Array.prototype.forEach) {\n      return arr.forEach(fn, scope);\n    }\n    for (i = 0, j = arr.length; i < j; i++) {\n      fn.call(scope, arr[i], i, arr);\n    }\n  },\n  trim: function (str) {\n    if (String.prototype.trim) {\n      return str.trim();\n    }\n    return str.replace(/(^\\s*)|(\\s*$)/g, '');\n  }\n};\n\n},{}],5:[function(require,module,exports){\n/**\n * 过滤XSS\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar FilterCSS = require('cssfilter').FilterCSS;\nvar DEFAULT = require('./default');\nvar parser = require('./parser');\nvar parseTag = parser.parseTag;\nvar parseAttr = parser.parseAttr;\nvar _ = require('./util');\n\n\n/**\n * 返回值是否为空\n *\n * @param {Object} obj\n * @return {Boolean}\n */\nfunction isNull (obj) {\n  return (obj === undefined || obj === null);\n}\n\n/**\n * 取标签内的属性列表字符串\n *\n * @param {String} html\n * @return {Object}\n *   - {String} html\n *   - {Boolean} closing\n */\nfunction getAttrs (html) {\n  var i = html.indexOf(' ');\n  if (i === -1) {\n    return {\n      html:    '',\n      closing: (html[html.length - 2] === '/')\n    };\n  }\n  html = _.trim(html.slice(i + 1, -1));\n  var isClosing = (html[html.length - 1] === '/');\n  if (isClosing) html = _.trim(html.slice(0, -1));\n  return {\n    html:    html,\n    closing: isClosing\n  };\n}\n\n/**\n * XSS过滤对象\n *\n * @param {Object} options\n *   选项：whiteList, onTag, onTagAttr, onIgnoreTag,\n *        onIgnoreTagAttr, safeAttrValue, escapeHtml\n *        stripIgnoreTagBody, allowCommentTag, stripBlankChar\n *        css{whiteList, onAttr, onIgnoreAttr} css=false表示禁用cssfilter\n */\nfunction FilterXSS (options) {\n  options = options || {};\n\n  if (options.stripIgnoreTag) {\n    if (options.onIgnoreTag) {\n      console.error('Notes: cannot use these two options \"stripIgnoreTag\" and \"onIgnoreTag\" at the same time');\n    }\n    options.onIgnoreTag = DEFAULT.onIgnoreTagStripAll;\n  }\n\n  options.whiteList = options.whiteList || DEFAULT.whiteList;\n  options.onTag = options.onTag || DEFAULT.onTag;\n  options.onTagAttr = options.onTagAttr || DEFAULT.onTagAttr;\n  options.onIgnoreTag = options.onIgnoreTag || DEFAULT.onIgnoreTag;\n  options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT.onIgnoreTagAttr;\n  options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;\n  options.escapeHtml = options.escapeHtml || DEFAULT.escapeHtml;\n  this.options = options;\n\n  if (options.css === false) {\n    this.cssFilter = false;\n  } else {\n    options.css = options.css || {};\n    this.cssFilter = new FilterCSS(options.css);\n  }\n}\n\n/**\n * 开始处理\n *\n * @param {String} html\n * @return {String}\n */\nFilterXSS.prototype.process = function (html) {\n  // 兼容各种奇葩输入\n  html = html || '';\n  html = html.toString();\n  if (!html) return '';\n\n  var me = this;\n  var options = me.options;\n  var whiteList = options.whiteList;\n  var onTag = options.onTag;\n  var onIgnoreTag = options.onIgnoreTag;\n  var onTagAttr = options.onTagAttr;\n  var onIgnoreTagAttr = options.onIgnoreTagAttr;\n  var safeAttrValue = options.safeAttrValue;\n  var escapeHtml = options.escapeHtml;\n  var cssFilter = me.cssFilter;\n\n  // 是否清除不可见字符\n  if (options.stripBlankChar) {\n    html = DEFAULT.stripBlankChar(html);\n  }\n\n  // 是否禁止备注标签\n  if (!options.allowCommentTag) {\n    html = DEFAULT.stripCommentTag(html);\n  }\n\n  // 如果开启了stripIgnoreTagBody\n  var stripIgnoreTagBody = false;\n  if (options.stripIgnoreTagBody) {\n    var stripIgnoreTagBody = DEFAULT.StripTagBody(options.stripIgnoreTagBody, onIgnoreTag);\n    onIgnoreTag = stripIgnoreTagBody.onIgnoreTag;\n  }\n\n  var retHtml = parseTag(html, function (sourcePosition, position, tag, html, isClosing) {\n    var info = {\n      sourcePosition: sourcePosition,\n      position:       position,\n      isClosing:      isClosing,\n      isWhite:        (tag in whiteList)\n    };\n\n    // 调用onTag处理\n    var ret = onTag(tag, html, info);\n    if (!isNull(ret)) return ret;\n\n    // 默认标签处理方法\n    if (info.isWhite) {\n      // 白名单标签，解析标签属性\n      // 如果是闭合标签，则不需要解析属性\n      if (info.isClosing) {\n        return '</' + tag + '>';\n      }\n\n      var attrs = getAttrs(html);\n      var whiteAttrList = whiteList[tag];\n      var attrsHtml = parseAttr(attrs.html, function (name, value) {\n\n        // 调用onTagAttr处理\n        var isWhiteAttr = (_.indexOf(whiteAttrList, name) !== -1);\n        var ret = onTagAttr(tag, name, value, isWhiteAttr);\n        if (!isNull(ret)) return ret;\n\n        // 默认的属性处理方法\n        if (isWhiteAttr) {\n          // 白名单属性，调用safeAttrValue过滤属性值\n          value = safeAttrValue(tag, name, value, cssFilter);\n          if (value) {\n            return name + '=\"' + value + '\"';\n          } else {\n            return name;\n          }\n        } else {\n          // 非白名单属性，调用onIgnoreTagAttr处理\n          var ret = onIgnoreTagAttr(tag, name, value, isWhiteAttr);\n          if (!isNull(ret)) return ret;\n          return;\n        }\n      });\n\n      // 构造新的标签代码\n      var html = '<' + tag;\n      if (attrsHtml) html += ' ' + attrsHtml;\n      if (attrs.closing) html += ' /';\n      html += '>';\n      return html;\n\n    } else {\n      // 非白名单标签，调用onIgnoreTag处理\n      var ret = onIgnoreTag(tag, html, info);\n      if (!isNull(ret)) return ret;\n      return escapeHtml(html);\n    }\n\n  }, escapeHtml);\n\n  // 如果开启了stripIgnoreTagBody，需要对结果再进行处理\n  if (stripIgnoreTagBody) {\n    retHtml = stripIgnoreTagBody.remove(retHtml);\n  }\n\n  return retHtml;\n};\n\n\nmodule.exports = FilterXSS;\n\n},{\"./default\":1,\"./parser\":3,\"./util\":4,\"cssfilter\":8}],6:[function(require,module,exports){\n/**\n * cssfilter\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar DEFAULT = require('./default');\nvar parseStyle = require('./parser');\nvar _ = require('./util');\n\n\n/**\n * 返回值是否为空\n *\n * @param {Object} obj\n * @return {Boolean}\n */\nfunction isNull (obj) {\n  return (obj === undefined || obj === null);\n}\n\n\n/**\n * 创建CSS过滤器\n *\n * @param {Object} options\n *   - {Object} whiteList\n *   - {Object} onAttr\n *   - {Object} onIgnoreAttr\n */\nfunction FilterCSS (options) {\n  options = options || {};\n  options.whiteList = options.whiteList || DEFAULT.whiteList;\n  options.onAttr = options.onAttr || DEFAULT.onAttr;\n  options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT.onIgnoreAttr;\n  this.options = options;\n}\n\nFilterCSS.prototype.process = function (css) {\n  // 兼容各种奇葩输入\n  css = css || '';\n  css = css.toString();\n  if (!css) return '';\n\n  var me = this;\n  var options = me.options;\n  var whiteList = options.whiteList;\n  var onAttr = options.onAttr;\n  var onIgnoreAttr = options.onIgnoreAttr;\n\n  var retCSS = parseStyle(css, function (sourcePosition, position, name, value, source) {\n\n    var check = whiteList[name];\n    var isWhite = false;\n    if (check === true) isWhite = check;\n    else if (typeof check === 'function') isWhite = check(value);\n    else if (check instanceof RegExp) isWhite = check.test(value);\n    if (isWhite !== true) isWhite = false;\n\n    var opts = {\n      position: position,\n      sourcePosition: sourcePosition,\n      source: source,\n      isWhite: isWhite\n    };\n\n    if (isWhite) {\n\n      var ret = onAttr(name, value, opts);\n      if (isNull(ret)) {\n        return name + ':' + value;\n      } else {\n        return ret;\n      }\n\n    } else {\n\n      var ret = onIgnoreAttr(name, value, opts);\n      if (!isNull(ret)) {\n        return ret;\n      }\n\n    }\n  });\n\n  return retCSS;\n};\n\n\nmodule.exports = FilterCSS;\n\n},{\"./default\":7,\"./parser\":9,\"./util\":10}],7:[function(require,module,exports){\n/**\n * cssfilter\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nfunction getDefaultWhiteList () {\n  // 白名单值说明：\n  // true: 允许该属性\n  // Function: function (val) { } 返回true表示允许该属性，其他值均表示不允许\n  // RegExp: regexp.test(val) 返回true表示允许该属性，其他值均表示不允许\n  // 除上面列出的值外均表示不允许\n  var whiteList = {};\n\n  whiteList['align-content'] = false; // default: auto\n  whiteList['align-items'] = false; // default: auto\n  whiteList['align-self'] = false; // default: auto\n  whiteList['alignment-adjust'] = false; // default: auto\n  whiteList['alignment-baseline'] = false; // default: baseline\n  whiteList['all'] = false; // default: depending on individual properties\n  whiteList['anchor-point'] = false; // default: none\n  whiteList['animation'] = false; // default: depending on individual properties\n  whiteList['animation-delay'] = false; // default: 0\n  whiteList['animation-direction'] = false; // default: normal\n  whiteList['animation-duration'] = false; // default: 0\n  whiteList['animation-fill-mode'] = false; // default: none\n  whiteList['animation-iteration-count'] = false; // default: 1\n  whiteList['animation-name'] = false; // default: none\n  whiteList['animation-play-state'] = false; // default: running\n  whiteList['animation-timing-function'] = false; // default: ease\n  whiteList['azimuth'] = false; // default: center\n  whiteList['backface-visibility'] = false; // default: visible\n  whiteList['background'] = true; // default: depending on individual properties\n  whiteList['background-attachment'] = true; // default: scroll\n  whiteList['background-clip'] = true; // default: border-box\n  whiteList['background-color'] = true; // default: transparent\n  whiteList['background-image'] = true; // default: none\n  whiteList['background-origin'] = true; // default: padding-box\n  whiteList['background-position'] = true; // default: 0% 0%\n  whiteList['background-repeat'] = true; // default: repeat\n  whiteList['background-size'] = true; // default: auto\n  whiteList['baseline-shift'] = false; // default: baseline\n  whiteList['binding'] = false; // default: none\n  whiteList['bleed'] = false; // default: 6pt\n  whiteList['bookmark-label'] = false; // default: content()\n  whiteList['bookmark-level'] = false; // default: none\n  whiteList['bookmark-state'] = false; // default: open\n  whiteList['border'] = true; // default: depending on individual properties\n  whiteList['border-bottom'] = true; // default: depending on individual properties\n  whiteList['border-bottom-color'] = true; // default: current color\n  whiteList['border-bottom-left-radius'] = true; // default: 0\n  whiteList['border-bottom-right-radius'] = true; // default: 0\n  whiteList['border-bottom-style'] = true; // default: none\n  whiteList['border-bottom-width'] = true; // default: medium\n  whiteList['border-collapse'] = true; // default: separate\n  whiteList['border-color'] = true; // default: depending on individual properties\n  whiteList['border-image'] = true; // default: none\n  whiteList['border-image-outset'] = true; // default: 0\n  whiteList['border-image-repeat'] = true; // default: stretch\n  whiteList['border-image-slice'] = true; // default: 100%\n  whiteList['border-image-source'] = true; // default: none\n  whiteList['border-image-width'] = true; // default: 1\n  whiteList['border-left'] = true; // default: depending on individual properties\n  whiteList['border-left-color'] = true; // default: current color\n  whiteList['border-left-style'] = true; // default: none\n  whiteList['border-left-width'] = true; // default: medium\n  whiteList['border-radius'] = true; // default: 0\n  whiteList['border-right'] = true; // default: depending on individual properties\n  whiteList['border-right-color'] = true; // default: current color\n  whiteList['border-right-style'] = true; // default: none\n  whiteList['border-right-width'] = true; // default: medium\n  whiteList['border-spacing'] = true; // default: 0\n  whiteList['border-style'] = true; // default: depending on individual properties\n  whiteList['border-top'] = true; // default: depending on individual properties\n  whiteList['border-top-color'] = true; // default: current color\n  whiteList['border-top-left-radius'] = true; // default: 0\n  whiteList['border-top-right-radius'] = true; // default: 0\n  whiteList['border-top-style'] = true; // default: none\n  whiteList['border-top-width'] = true; // default: medium\n  whiteList['border-width'] = true; // default: depending on individual properties\n  whiteList['bottom'] = false; // default: auto\n  whiteList['box-decoration-break'] = true; // default: slice\n  whiteList['box-shadow'] = true; // default: none\n  whiteList['box-sizing'] = true; // default: content-box\n  whiteList['box-snap'] = true; // default: none\n  whiteList['box-suppress'] = true; // default: show\n  whiteList['break-after'] = true; // default: auto\n  whiteList['break-before'] = true; // default: auto\n  whiteList['break-inside'] = true; // default: auto\n  whiteList['caption-side'] = false; // default: top\n  whiteList['chains'] = false; // default: none\n  whiteList['clear'] = true; // default: none\n  whiteList['clip'] = false; // default: auto\n  whiteList['clip-path'] = false; // default: none\n  whiteList['clip-rule'] = false; // default: nonzero\n  whiteList['color'] = true; // default: implementation dependent\n  whiteList['color-interpolation-filters'] = true; // default: auto\n  whiteList['column-count'] = false; // default: auto\n  whiteList['column-fill'] = false; // default: balance\n  whiteList['column-gap'] = false; // default: normal\n  whiteList['column-rule'] = false; // default: depending on individual properties\n  whiteList['column-rule-color'] = false; // default: current color\n  whiteList['column-rule-style'] = false; // default: medium\n  whiteList['column-rule-width'] = false; // default: medium\n  whiteList['column-span'] = false; // default: none\n  whiteList['column-width'] = false; // default: auto\n  whiteList['columns'] = false; // default: depending on individual properties\n  whiteList['contain'] = false; // default: none\n  whiteList['content'] = false; // default: normal\n  whiteList['counter-increment'] = false; // default: none\n  whiteList['counter-reset'] = false; // default: none\n  whiteList['counter-set'] = false; // default: none\n  whiteList['crop'] = false; // default: auto\n  whiteList['cue'] = false; // default: depending on individual properties\n  whiteList['cue-after'] = false; // default: none\n  whiteList['cue-before'] = false; // default: none\n  whiteList['cursor'] = false; // default: auto\n  whiteList['direction'] = false; // default: ltr\n  whiteList['display'] = true; // default: depending on individual properties\n  whiteList['display-inside'] = true; // default: auto\n  whiteList['display-list'] = true; // default: none\n  whiteList['display-outside'] = true; // default: inline-level\n  whiteList['dominant-baseline'] = false; // default: auto\n  whiteList['elevation'] = false; // default: level\n  whiteList['empty-cells'] = false; // default: show\n  whiteList['filter'] = false; // default: none\n  whiteList['flex'] = false; // default: depending on individual properties\n  whiteList['flex-basis'] = false; // default: auto\n  whiteList['flex-direction'] = false; // default: row\n  whiteList['flex-flow'] = false; // default: depending on individual properties\n  whiteList['flex-grow'] = false; // default: 0\n  whiteList['flex-shrink'] = false; // default: 1\n  whiteList['flex-wrap'] = false; // default: nowrap\n  whiteList['float'] = false; // default: none\n  whiteList['float-offset'] = false; // default: 0 0\n  whiteList['flood-color'] = false; // default: black\n  whiteList['flood-opacity'] = false; // default: 1\n  whiteList['flow-from'] = false; // default: none\n  whiteList['flow-into'] = false; // default: none\n  whiteList['font'] = true; // default: depending on individual properties\n  whiteList['font-family'] = true; // default: implementation dependent\n  whiteList['font-feature-settings'] = true; // default: normal\n  whiteList['font-kerning'] = true; // default: auto\n  whiteList['font-language-override'] = true; // default: normal\n  whiteList['font-size'] = true; // default: medium\n  whiteList['font-size-adjust'] = true; // default: none\n  whiteList['font-stretch'] = true; // default: normal\n  whiteList['font-style'] = true; // default: normal\n  whiteList['font-synthesis'] = true; // default: weight style\n  whiteList['font-variant'] = true; // default: normal\n  whiteList['font-variant-alternates'] = true; // default: normal\n  whiteList['font-variant-caps'] = true; // default: normal\n  whiteList['font-variant-east-asian'] = true; // default: normal\n  whiteList['font-variant-ligatures'] = true; // default: normal\n  whiteList['font-variant-numeric'] = true; // default: normal\n  whiteList['font-variant-position'] = true; // default: normal\n  whiteList['font-weight'] = true; // default: normal\n  whiteList['grid'] = false; // default: depending on individual properties\n  whiteList['grid-area'] = false; // default: depending on individual properties\n  whiteList['grid-auto-columns'] = false; // default: auto\n  whiteList['grid-auto-flow'] = false; // default: none\n  whiteList['grid-auto-rows'] = false; // default: auto\n  whiteList['grid-column'] = false; // default: depending on individual properties\n  whiteList['grid-column-end'] = false; // default: auto\n  whiteList['grid-column-start'] = false; // default: auto\n  whiteList['grid-row'] = false; // default: depending on individual properties\n  whiteList['grid-row-end'] = false; // default: auto\n  whiteList['grid-row-start'] = false; // default: auto\n  whiteList['grid-template'] = false; // default: depending on individual properties\n  whiteList['grid-template-areas'] = false; // default: none\n  whiteList['grid-template-columns'] = false; // default: none\n  whiteList['grid-template-rows'] = false; // default: none\n  whiteList['hanging-punctuation'] = false; // default: none\n  whiteList['height'] = true; // default: auto\n  whiteList['hyphens'] = false; // default: manual\n  whiteList['icon'] = false; // default: auto\n  whiteList['image-orientation'] = false; // default: auto\n  whiteList['image-resolution'] = false; // default: normal\n  whiteList['ime-mode'] = false; // default: auto\n  whiteList['initial-letters'] = false; // default: normal\n  whiteList['inline-box-align'] = false; // default: last\n  whiteList['justify-content'] = false; // default: auto\n  whiteList['justify-items'] = false; // default: auto\n  whiteList['justify-self'] = false; // default: auto\n  whiteList['left'] = false; // default: auto\n  whiteList['letter-spacing'] = true; // default: normal\n  whiteList['lighting-color'] = true; // default: white\n  whiteList['line-box-contain'] = false; // default: block inline replaced\n  whiteList['line-break'] = false; // default: auto\n  whiteList['line-grid'] = false; // default: match-parent\n  whiteList['line-height'] = false; // default: normal\n  whiteList['line-snap'] = false; // default: none\n  whiteList['line-stacking'] = false; // default: depending on individual properties\n  whiteList['line-stacking-ruby'] = false; // default: exclude-ruby\n  whiteList['line-stacking-shift'] = false; // default: consider-shifts\n  whiteList['line-stacking-strategy'] = false; // default: inline-line-height\n  whiteList['list-style'] = true; // default: depending on individual properties\n  whiteList['list-style-image'] = true; // default: none\n  whiteList['list-style-position'] = true; // default: outside\n  whiteList['list-style-type'] = true; // default: disc\n  whiteList['margin'] = true; // default: depending on individual properties\n  whiteList['margin-bottom'] = true; // default: 0\n  whiteList['margin-left'] = true; // default: 0\n  whiteList['margin-right'] = true; // default: 0\n  whiteList['margin-top'] = true; // default: 0\n  whiteList['marker-offset'] = false; // default: auto\n  whiteList['marker-side'] = false; // default: list-item\n  whiteList['marks'] = false; // default: none\n  whiteList['mask'] = false; // default: border-box\n  whiteList['mask-box'] = false; // default: see individual properties\n  whiteList['mask-box-outset'] = false; // default: 0\n  whiteList['mask-box-repeat'] = false; // default: stretch\n  whiteList['mask-box-slice'] = false; // default: 0 fill\n  whiteList['mask-box-source'] = false; // default: none\n  whiteList['mask-box-width'] = false; // default: auto\n  whiteList['mask-clip'] = false; // default: border-box\n  whiteList['mask-image'] = false; // default: none\n  whiteList['mask-origin'] = false; // default: border-box\n  whiteList['mask-position'] = false; // default: center\n  whiteList['mask-repeat'] = false; // default: no-repeat\n  whiteList['mask-size'] = false; // default: border-box\n  whiteList['mask-source-type'] = false; // default: auto\n  whiteList['mask-type'] = false; // default: luminance\n  whiteList['max-height'] = true; // default: none\n  whiteList['max-lines'] = false; // default: none\n  whiteList['max-width'] = true; // default: none\n  whiteList['min-height'] = true; // default: 0\n  whiteList['min-width'] = true; // default: 0\n  whiteList['move-to'] = false; // default: normal\n  whiteList['nav-down'] = false; // default: auto\n  whiteList['nav-index'] = false; // default: auto\n  whiteList['nav-left'] = false; // default: auto\n  whiteList['nav-right'] = false; // default: auto\n  whiteList['nav-up'] = false; // default: auto\n  whiteList['object-fit'] = false; // default: fill\n  whiteList['object-position'] = false; // default: 50% 50%\n  whiteList['opacity'] = false; // default: 1\n  whiteList['order'] = false; // default: 0\n  whiteList['orphans'] = false; // default: 2\n  whiteList['outline'] = false; // default: depending on individual properties\n  whiteList['outline-color'] = false; // default: invert\n  whiteList['outline-offset'] = false; // default: 0\n  whiteList['outline-style'] = false; // default: none\n  whiteList['outline-width'] = false; // default: medium\n  whiteList['overflow'] = false; // default: depending on individual properties\n  whiteList['overflow-wrap'] = false; // default: normal\n  whiteList['overflow-x'] = false; // default: visible\n  whiteList['overflow-y'] = false; // default: visible\n  whiteList['padding'] = true; // default: depending on individual properties\n  whiteList['padding-bottom'] = true; // default: 0\n  whiteList['padding-left'] = true; // default: 0\n  whiteList['padding-right'] = true; // default: 0\n  whiteList['padding-top'] = true; // default: 0\n  whiteList['page'] = false; // default: auto\n  whiteList['page-break-after'] = false; // default: auto\n  whiteList['page-break-before'] = false; // default: auto\n  whiteList['page-break-inside'] = false; // default: auto\n  whiteList['page-policy'] = false; // default: start\n  whiteList['pause'] = false; // default: implementation dependent\n  whiteList['pause-after'] = false; // default: implementation dependent\n  whiteList['pause-before'] = false; // default: implementation dependent\n  whiteList['perspective'] = false; // default: none\n  whiteList['perspective-origin'] = false; // default: 50% 50%\n  whiteList['pitch'] = false; // default: medium\n  whiteList['pitch-range'] = false; // default: 50\n  whiteList['play-during'] = false; // default: auto\n  whiteList['position'] = false; // default: static\n  whiteList['presentation-level'] = false; // default: 0\n  whiteList['quotes'] = false; // default: text\n  whiteList['region-fragment'] = false; // default: auto\n  whiteList['resize'] = false; // default: none\n  whiteList['rest'] = false; // default: depending on individual properties\n  whiteList['rest-after'] = false; // default: none\n  whiteList['rest-before'] = false; // default: none\n  whiteList['richness'] = false; // default: 50\n  whiteList['right'] = false; // default: auto\n  whiteList['rotation'] = false; // default: 0\n  whiteList['rotation-point'] = false; // default: 50% 50%\n  whiteList['ruby-align'] = false; // default: auto\n  whiteList['ruby-merge'] = false; // default: separate\n  whiteList['ruby-position'] = false; // default: before\n  whiteList['shape-image-threshold'] = false; // default: 0.0\n  whiteList['shape-outside'] = false; // default: none\n  whiteList['shape-margin'] = false; // default: 0\n  whiteList['size'] = false; // default: auto\n  whiteList['speak'] = false; // default: auto\n  whiteList['speak-as'] = false; // default: normal\n  whiteList['speak-header'] = false; // default: once\n  whiteList['speak-numeral'] = false; // default: continuous\n  whiteList['speak-punctuation'] = false; // default: none\n  whiteList['speech-rate'] = false; // default: medium\n  whiteList['stress'] = false; // default: 50\n  whiteList['string-set'] = false; // default: none\n  whiteList['tab-size'] = false; // default: 8\n  whiteList['table-layout'] = false; // default: auto\n  whiteList['text-align'] = true; // default: start\n  whiteList['text-align-last'] = true; // default: auto\n  whiteList['text-combine-upright'] = true; // default: none\n  whiteList['text-decoration'] = true; // default: none\n  whiteList['text-decoration-color'] = true; // default: currentColor\n  whiteList['text-decoration-line'] = true; // default: none\n  whiteList['text-decoration-skip'] = true; // default: objects\n  whiteList['text-decoration-style'] = true; // default: solid\n  whiteList['text-emphasis'] = true; // default: depending on individual properties\n  whiteList['text-emphasis-color'] = true; // default: currentColor\n  whiteList['text-emphasis-position'] = true; // default: over right\n  whiteList['text-emphasis-style'] = true; // default: none\n  whiteList['text-height'] = true; // default: auto\n  whiteList['text-indent'] = true; // default: 0\n  whiteList['text-justify'] = true; // default: auto\n  whiteList['text-orientation'] = true; // default: mixed\n  whiteList['text-overflow'] = true; // default: clip\n  whiteList['text-shadow'] = true; // default: none\n  whiteList['text-space-collapse'] = true; // default: collapse\n  whiteList['text-transform'] = true; // default: none\n  whiteList['text-underline-position'] = true; // default: auto\n  whiteList['text-wrap'] = true; // default: normal\n  whiteList['top'] = false; // default: auto\n  whiteList['transform'] = false; // default: none\n  whiteList['transform-origin'] = false; // default: 50% 50% 0\n  whiteList['transform-style'] = false; // default: flat\n  whiteList['transition'] = false; // default: depending on individual properties\n  whiteList['transition-delay'] = false; // default: 0s\n  whiteList['transition-duration'] = false; // default: 0s\n  whiteList['transition-property'] = false; // default: all\n  whiteList['transition-timing-function'] = false; // default: ease\n  whiteList['unicode-bidi'] = false; // default: normal\n  whiteList['vertical-align'] = false; // default: baseline\n  whiteList['visibility'] = false; // default: visible\n  whiteList['voice-balance'] = false; // default: center\n  whiteList['voice-duration'] = false; // default: auto\n  whiteList['voice-family'] = false; // default: implementation dependent\n  whiteList['voice-pitch'] = false; // default: medium\n  whiteList['voice-range'] = false; // default: medium\n  whiteList['voice-rate'] = false; // default: normal\n  whiteList['voice-stress'] = false; // default: normal\n  whiteList['voice-volume'] = false; // default: medium\n  whiteList['volume'] = false; // default: medium\n  whiteList['white-space'] = false; // default: normal\n  whiteList['widows'] = false; // default: 2\n  whiteList['width'] = true; // default: auto\n  whiteList['will-change'] = false; // default: auto\n  whiteList['word-break'] = true; // default: normal\n  whiteList['word-spacing'] = true; // default: normal\n  whiteList['word-wrap'] = true; // default: normal\n  whiteList['wrap-flow'] = false; // default: auto\n  whiteList['wrap-through'] = false; // default: wrap\n  whiteList['writing-mode'] = false; // default: horizontal-tb\n  whiteList['z-index'] = false; // default: auto\n\n  return whiteList;\n}\n\n\n/**\n * 匹配到白名单上的一个属性时\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {String}\n */\nfunction onAttr (name, value, options) {\n  // do nothing\n}\n\n/**\n * 匹配到不在白名单上的一个属性时\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {String}\n */\nfunction onIgnoreAttr (name, value, options) {\n  // do nothing\n}\n\n\nexports.whiteList = getDefaultWhiteList();\nexports.getDefaultWhiteList = getDefaultWhiteList;\nexports.onAttr = onAttr;\nexports.onIgnoreAttr = onIgnoreAttr;\n\n},{}],8:[function(require,module,exports){\n/**\n * cssfilter\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar DEFAULT = require('./default');\nvar FilterCSS = require('./css');\n\n\n/**\n * XSS过滤\n *\n * @param {String} css 要过滤的CSS代码\n * @param {Object} options 选项：whiteList, onAttr, onIgnoreAttr\n * @return {String}\n */\nfunction filterCSS (html, options) {\n  var xss = new FilterCSS(options);\n  return xss.process(html);\n}\n\n\n// 输出\nexports = module.exports = filterCSS;\nexports.FilterCSS = FilterCSS;\nfor (var i in DEFAULT) exports[i] = DEFAULT[i];\n\n// 在浏览器端使用\nif (typeof window !== 'undefined') {\n  window.filterCSS = module.exports;\n}\n\n},{\"./css\":6,\"./default\":7}],9:[function(require,module,exports){\n/**\n * cssfilter\n *\n * @author 老雷<leizongmin@gmail.com>\n */\n\nvar _ = require('./util');\n\n\n/**\n * 解析style\n *\n * @param {String} css\n * @param {Function} onAttr 处理属性的函数\n *   参数格式： function (sourcePosition, position, name, value, source)\n * @return {String}\n */\nfunction parseStyle (css, onAttr) {\n  css = _.trimRight(css);\n  if (css[css.length - 1] !== ';') css += ';';\n  var cssLength = css.length;\n  var isParenthesisOpen = false;\n  var lastPos = 0;\n  var i = 0;\n  var retCSS = '';\n\n  function addNewAttr () {\n    // 如果没有正常的闭合圆括号，则直接忽略当前属性\n    if (!isParenthesisOpen) {\n      var source = _.trim(css.slice(lastPos, i));\n      var j = source.indexOf(':');\n      if (j !== -1) {\n        var name = _.trim(source.slice(0, j));\n        var value = _.trim(source.slice(j + 1));\n        // 必须有属性名称\n        if (name) {\n          var ret = onAttr(lastPos, retCSS.length, name, value, source);\n          if (ret) retCSS += ret + '; ';\n        }\n      }\n    }\n    lastPos = i + 1;\n  }\n\n  for (; i < cssLength; i++) {\n    var c = css[i];\n    if (c === '/' && css[i + 1] === '*') {\n      // 备注开始\n      var j = css.indexOf('*/', i + 2);\n      // 如果没有正常的备注结束，则后面的部分全部跳过\n      if (j === -1) break;\n      // 直接将当前位置调到备注结尾，并且初始化状态\n      i = j + 1;\n      lastPos = i + 1;\n      isParenthesisOpen = false;\n    } else if (c === '(') {\n      isParenthesisOpen = true;\n    } else if (c === ')') {\n      isParenthesisOpen = false;\n    } else if (c === ';') {\n      if (isParenthesisOpen) {\n        // 在圆括号里面，忽略\n      } else {\n        addNewAttr();\n      }\n    } else if (c === '\\n') {\n      addNewAttr();\n    }\n  }\n\n  return _.trim(retCSS);\n}\n\nmodule.exports = parseStyle;\n\n},{\"./util\":10}],10:[function(require,module,exports){\nmodule.exports = {\n  indexOf: function (arr, item) {\n    var i, j;\n    if (Array.prototype.indexOf) {\n      return arr.indexOf(item);\n    }\n    for (i = 0, j = arr.length; i < j; i++) {\n      if (arr[i] === item) {\n        return i;\n      }\n    }\n    return -1;\n  },\n  forEach: function (arr, fn, scope) {\n    var i, j;\n    if (Array.prototype.forEach) {\n      return arr.forEach(fn, scope);\n    }\n    for (i = 0, j = arr.length; i < j; i++) {\n      fn.call(scope, arr[i], i, arr);\n    }\n  },\n  trim: function (str) {\n    if (String.prototype.trim) {\n      return str.trim();\n    }\n    return str.replace(/(^\\s*)|(\\s*$)/g, '');\n  },\n  trimRight: function (str) {\n    if (String.prototype.trimRight) {\n      return str.trimRight();\n    }\n    return str.replace(/(\\s*$)/g, '');\n  }\n};\n\n},{}]},{},[2]);\n"
  },
  {
    "path": "website/local_visualizer.php",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Visualizer</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div id=\"container\" class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div id=\"pageContent\" class=\"pageContent text-center\">\n            <div id=\"displayArea\" class=\"col-sm-12 text-center\">\n                <span class=\"glyphicon glyphicon-cloud-upload\" style=\"font-size: 10em;\"></span>\n                <h2 style=\"margin-top: 20px;\">Drop or upload a replay file here</h2>\n\n            </div>\n            <div id='fileSelect' class=\"col-sm-12 text-center\">\n                <label for=\"filePicker\" class=\"btn btn-primary\">Select File</label>\n                <input type=\"file\" id=\"filePicker\" accept=\".hlt\" style=\"display: none;\">\n            </div>\n        </div>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.2/lodash.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.0/seedrandom.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"lib/pixi.min.js\"></script>\n    <script src=\"script/parsereplay.js\"></script>\n    <script src=\"script/visualizer.js\"></script>\n    <script src=\"script/localVisualizer.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/organizationWhitelist.txt",
    "content": "Two Sigma - twosigma.com\nAuburn - auburn.edu\nCornell - cornell.edu\nNYU - nyu.edu\nStanford - stanford.edu\nHarvard - harvard.edu\nHarvard - college.harvard.edu\nHarvard - g.harvard.edu\nHarvard - fas.harvard.edu\nPrinceton - princeton.edu\nYale - yale.edu\nColumbia - columbia.edu\nUPenn - upenn.edu\nBrown - brown.edu\nDartmouth - dartmouth.edu\nMIT - mit.edu\nMIT - alum.mit.edu\nCMU - andrew.cmu.edu\nCMU - cmu.edu\nRIT - rit.edu\nNJU - lamda.nju.edu.cn\nChalmers - chalmers.se\nChalmers - student.chalmers.se\nMcGill - mail.mcgill.ca\nPurdue - purdue.edu\nImperial College - ic.ac.uk\nImperial College - imperial.ac.uk\nEcole Polytechnique - polytechnique.edu\nNTU - ntu.edu.sg\nNTU - e.ntu.edu.sg\nWaterloo - edu.uwaterloo.ca\nWaterloo - uwaterloo.ca\nUC Berkeley - berkeley.edu\nEPFL - epfl.ch\nHarvey Mudd - cs.hmc.edu\nWilliam and Mary - email.wm.edu\nPomona - pomona.edu\nCalifornia Colleges - californiacolleges.edu\nUniversity of Colorado - colorado.edu\nUniversity of Charlotte - uncc.edu\nMissouri S&T - mst.edu\nChapman - chapman.edu\nUC - mail.uc.edu\nUniversity of Arnkansas - uark.edu\nNational Research - nationalresearch.com\nNUS - u.nus.edu\nChapman - mail.chapman.edu\nUniversity of Illinois - illinois.edu\nPunahou - punahou.edu\nUniversity of Alabama - crimson.ua.edu\nUniversity of Florida - ufl.edu\nStonybrook - stonybrook.edu\nArizona State - asu.edu\nRockefeller University - rockefeller.edu\nVirginia Tech - vt.edu\nWorcester Polytechnic - wpi.edu\nNC State - ncsu.edu\nGeorgia Tech - gatech.edu\nUniversity of Virginia - virginia.edu\nBowdoin - bowdoin.edu\nUniversity of Iowa - uiowa.edu\nUniversity of Texas - utexas.edu\nUniversity of Minnesota - umn.edu\nBoston University - bu.edu\nUniversity of Washington - uw.edu\nCalifornia Polytechnic - calpoly.edu\nGrand Valley State University - gvsu.edu\nUC Santa Cruz - ucsc.edu\nUT San Antonio - utsa.edu\nUT San Antonio - my.utsa.edu\nUC Davis - ucdavis.edu\nExeter College - exe-coll.ac.uk\nQuantworks - quantworks.com\nEpitech - epitech.eu\nIST - tecnico.ulisboa.pt\nAmazon - amazon.de\nAmazon - amazon.com\nAcademy for Science and Design - asdnh.org\nKTH - kth.se\nHorace Mann School - horacemann.org\nShaw - shaw.ca\nFuturice - futurice.com\nSeznam - seznam.cz\nBoopsie - boopsie.com\nHCM - hubcitymedia.com\nPaderborn University - mail.upb.de\nTechnical University of Dresden - tu-dresden.de\nAltassian - atlassian.com\nAsimmetric - asimmetric.com\nBinghamton - binghamton.edu\nNational Research University - edu.hse.ru\nProekspert - proekspert.ee\nCarleton University - carleton.ca\nDoubleDutch - doubledutch.me\nRWTH Aachen - rwth-aachen.de\nUniversity of Aveiro - ua.pt\nAllstate - allstate.com\nDreamix - dreamix.eu\nKU Leuven - student.kuleuven.be\nGreen Brick Labs - greenbricklabs.com\nVerst - verst.co\nQueens University - queensu.ca\nQure.ai - qure.ai\nTeleopti - teleopti.com\nUC San Diego - ucsd.edu\nUniversity of Edinburgh - ed.ac.uk\nUniversity of Edinburgh - sms.ed.ac.uk\nUniversity of Bordeaux - u-bordeaux.fr\nUniversity of Bordeaux - etu.u-bordeaux.fr\nWargaming.net - wargaming.net\nGrand Valley State University - mail.gvsu.edu\nGrand Valley State University - gvsu.edu\nAQR - aqr.com\nDerivco - derivco.co.za\nNerdery - nerdery.com\nUniversity of Rochester - u.rochester.edu\nCiti - citi.com\n"
  },
  {
    "path": "website/privacy_policy.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Privacy Policy</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <div class=\"col-sm-12\">\n\n                <h1>Halite Privacy Policy</h1>\n\n                <p>Effective Date November 2, 2016 (last updated November 2, 2016).</p>\n\n                <p><b>This Privacy Policy applies to our websites and platforms.</b></p>\n\n                <p>This Policy describes how Two Sigma Open Source, LLC and its affiliates (“Two Sigma”, “We”, “we”, or “us”) treat personal information collected on the websites and platforms where this policy is located (each a “Site”). This policy does not apply to information Two Sigma collects offline, through email, or through other sites. This policy also does not apply to websites or platforms where it is not posted and where a link to the privacy policy is not provided. It also does not apply to the practices of Two Sigma subsidiaries or other affiliates.</p>\n\n                <p><b>We collect information from and about you.</b></p>\n\n                <p><p>We collect contact information.</b> For example, we might collect your name and email address when you register on our Site. We may also collect company name and information you provide when you edit your profile.</p>\n\n                <p><b>We collect information using Google Analytics.</b> Google Analytics is a web analysis service provided by Google. Google Analytics collects information such your usage of the Site, browser information, and your geographic region. Google utilizes the data collected to track and examine the use of our Site, to prepare reports on its activities and share them with other Google services and Two Sigma.</p>\n\n                <p><b>We collect information you submit or post.</b> We collect the information you post in a public space on our Site. We also collect information when you contact us.</p>\n\n                <p><b>We collect other information.</b> We may collect usage data on how you use our products and services. This may include information about how you interact with notebooks and users on the Site. We may also collect information about your browser. We may also collect your IP address. We might look at what site you came from, or what site you visit when you leave us.</p>\n\n                <p><b>We collect information in different ways.</b></p>\n\n                <p><b>We collect information directly from you.</b> For example, if you register with us, sign up for emails, or download materials from the Site.</p>\n\n                <p><b>We collect information from you passively.</b> We use tracking tools like browser cookies and web beacons. Learn more about these tools and how you can control them, here. Third party analytics services may use cookies and web beacons through our Site (for example Google Analytics) to provide us with information about how you use and interact with our Site.</p>\n\n                <p><b>We get information about you from third parties.</b> For example, our business partners may give us information about you. Social media platforms may also give us information about you. We may combine this information with information you give us.</p>\n\n                <p><b>We collect information as otherwise described at the time of collection.</b></p>\n\n                <p><b>We use information as disclosed and described here.</b></p>\n\n                <p><b>We use information to respond to your requests or questions.</b> For example, we might use your information to confirm your download or use of our products.</p>\n\n                <p><b>We use information to improve our products and services.</b> We might use your information to customize your experience with us. We may do this by looking at site trends or user interests.</p>\n\n                <p><b>We use information for security purposes.</b> We may use information to protect our company, affiliates, our customers, or our website, or a third-party website or platform.</p>\n\n                <p><b>We use information for marketing purposes.M/ For example, we might send you information about new products and services. We might tell you about new features or updates. These might be our own offers or products, or third party offers or products we think you might find interesting.</p>\n\n                <p><b>We use information to communicate with you about your account or our relationship.</b> We may contact you about your use of our services. We may contact you about your account or feedback. We might also contact you about this Policy or our website Terms.</p>\n\n                <p><b>We use information as otherwise described or permitted by law or as we may notify you.</b></p>\n\n                <p><b>We may share information with third parties.</b></p>\n\n                <p><b>We will share information within the Two Sigma family of companies. This includes Two Sigma Investments, LP.</b></p>\n\n                <p><b>We will share information with third parties who perform services on our behalf.</b> For example, we share information with our vendors. We may also share information with companies that operate our websites.</p>\n\n                <p><b>We will share information with third parties on our website and other websites.</b> For example, we may make anonymous usage information publicly available on our Site. Google may use the data collected through Google Analytics to contextualize and personalize the ads of its own advertising network. For Google’s privacy policy see http://www.google.com/analytics/learn/privacy.html.</p>\n\n                <p><b>We will share analytics and usage information with other parties.</b> For example, we share aggregate anonymous usage data we obtain through Google Analytics and through our own analytics with third parties, including other users of Halite and the Site.</p>\n\n                <p><b>We will share information if we think we have to in order to comply with the law or to protect ourselves.</b> For example, we will share information to respond to a court order or subpoena. We may also share it if a government agency or investigatory body requests. We might also share information when we are investigating potential fraud.</p>\n\n                <p><b>We may share information with any successor to all or part of our business.</b> For example, if part of our business was sold or transferred we may give your information as part of that transaction.</p>\n\n                <p><b>We may share information for other reasons we may describe to you.</b></p>\n\n                <p><b>You have certain choices about our marketing and tracking tools.</b></p>\n\n                <p><b>You can opt out of receiving our marketing emails.</b> To stop receiving our promotional emails, simply use the opt-out or unsubscribe method provided in emails you receive from us. If you object to our use of your information for direct marketing purposes, please email us at halite@halite.io.</p>\n\n                <p><b>You can control cookies and tracking tools.</b> Your browser may give you the ability to control cookies. How you do so depends on the type of cookie. Certain browsers can be set to reject browser cookies. To control flash cookies, which we may use on certain websites from time to time, you can go here. Why? Because flash cookies cannot be controlled through your browser settings. Options you select are browser and device specific. And, if you block or delete cookies, not all of the tracking that we have described in this policy will stop.</p>\n\n                <p><b>You can control Google Analytics.</b> Website visitors that don’t want their visit data reported by the Google Analytics JavaScript can install the Google Analytics opt-out browser add-on. This add-on instructs the Google Analytics JavaScript (ga.js) to prohibit sending visit information to Google Analytics. Learn more about the <a href=\"https://support.google.com/analytics/answer/181881?hl=en\">Google Analytics opt-out browser add-on</a>. The Google Analytics opt-out browser add-on does not prevent data or information from being sent to the website itself or in other ways to web analytics services.</p>\n\n                <p><b>Our Do Not Track Policy. Some websites have “do not track” features that allow you to tell a website not to track you. These features are not all uniform. We do not currently respond to those signals.</b> If you block cookies, certain features on our sites may not work. If you block or reject cookies, not all of the tracking described here will stop.</p>\n\n                <p><b>You may access your personal data.</b><br>Your personal data is retained for a period appropriate to the purposes for which it was collected an in compliance with relevant European laws. You are entitled to access your personal data. You are entitled to correct your personal data. You may also delete personal data which relates to you. You may object to further processing of such data, as well as object to receiving marketing emails. You may exercise this right at any time by writing to us at the address listed below.</p>\n\n                <p><b>Your California privacy rights.</b><br>If you reside in California, you have the right to ask us one time each year if we have shared personal information with third parties for their direct marketing purposes. To make a request, please send us an email, or write to us at the address listed below. Indicate in your letter that you are a California resident making a “Shine the Light” inquiry.</p>\n\n                <p><b>This site and children.</b><br>Our site is meant for adults. We do not knowingly collect personally identifiable information from children under 13 without permission from a parent or guardian. If you are a parent or legal guardian and think your child under 13 has given us information, you can email us at halite@halite.io. You can also write to us at the address listed at the end of this policy. Please mark your inquiries “COPPA Information Request.” Parents, you can learn more about how to protect children's privacy on-line <a href=\"https://www.consumer.ftc.gov/articles/0031-protecting-your-childs-privacy-online\">here</a>.</p>\n\n                <p><b>We use standard security measures.</b><br>The Internet is not 100% secure. We cannot promise that your use of our site or software will be completely safe. We encourage you to use caution when using the Internet. We keep personal information as long as it is necessary or relevant for the practices described in this Policy. We also keep information as long as it is necessary or relevant for the practices described in this policy, for internal compliance or record-keeping purposes, or as otherwise required by law.</p>\n\n                <p><b>We store information both in and out of the United States.</b><br>Information we maintain may be stored both within and outside of the United States. If you live outside of the United States, you understand and agree that we may transfer your information to the United States. This site is subject to U.S. laws, which may not afford the same level of protection as those in your country.</p>\n\n                <p><b>We may link to other sites or have third party services on our site we don’t control.</b><br>If you click on a link to a third party site, you will be taken to websites we do not control. This policy does not apply to the privacy practices of that website. Read the privacy policy of other websites carefully. We are not responsible for these third party sites.</p>\n\n                <p><b>Feel free to contact us if you have more questions.</b><br>If you have any questions about this Policy or want to access, delete or correct your information, please email us at halite@halite.io.\n                You can also contact us at:<br>Two Sigma Open Source, LLC<br>100 Avenue of the Americas<br>16th Floor<br>New York, NY 10013<br>Attn: Legal – Halite Privacy Matters</p>\n\n                <p><b>We may update this Policy.</b><br>From time to time we may change our privacy policies. We will notify you of any material changes to our Policy as required by law. We will also post an updated copy on our website. Please check our Site periodically for updates.</p>\n\n                <hr>\n\n                <p>© 2016 Two Sigma Open Source, LLC. ALL RIGHTS RESERVED.</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/recent_games.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Recent Games</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"pageContent\">\n          <div class=\"row\">\n            <div class=\"col-xl-12 col-lg-12 col-md-12\">\n                <div class=\"text-center\" style=\"display: none;\" id=\"noGameMessage\">\n                    <span class=\"glyphicon glyphicon-warning-sign\" style=\"font-size: 8em;\"></span>\n                    <h3>There are no games recorded yet.</h3>\n                </div>\n                <div id=\"gamePanel\" class=\"panel panel-default\">\n                    <div class=\"panel-heading\">\n                        <h3 class=\"panel-title\">Game Feed</h3>\n                    </div>\n                    <table class=\"table\" id=\"gameTable\">\n                        <thead>\n                            <tr id=\"gameTableHeader\">\n                                <th>Time</th><th>Players</th><th>Dimensions</th><th>View</th>\n                            </tr>\n                        </thead>\n                        <tbody id=\"gameTableBody\">\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n          </div>\n        </div>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/recent_games.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/robots.txt",
    "content": "User-agent: *\nDisallow: /cron\nDisallow: /sql\nDisallow: /vendor\nAllow: /\nSitemap: https://halite.io/sitemap.xml\n"
  },
  {
    "path": "website/rules_contest.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Contest Rules</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Contest Rules</h1>\n\n                <h3>Schedule</h3>\n                <p>The Halite contest officially began on November 10 and will end at 11:59 pm EST on February 12. After that, the rankings will be recomputed for about 2 days, and a winner will be announced.</p>\n                <p>Submit early and often!</p>\n\n                <h3>Account Ownership</h3>\n                <p>Though collaboration is highly encouraged, teams are not technically allowed.</p>\n                <p>Each participant may only have one halite account. Participants found to be in control of multiple accounts will be banned forever.</p>\n\n                <h3>Bug Reports</h3>\n                <p>If you find a bug that is exploitable, email us at <a href=\"mailto:halite@halite.io\">halite@halite.io</a>, do not post it on the forums, and do not exploit it.</p>\n                <p>Otherwise, feel free to let us know on <a href=\"http://2016.forums.halite.io\">the forums</a>.</p>\n\n                <h3>Rankings</h3>\n                <p>Rankings are based on the outcome of organized games where bots play against each other. A good analogy is the <a href=\"https://en.wikipedia.org/wiki/Elo_rating_system\">Elo rating system</a> used for chess.</p>\n                <p>More precisely, rankings are computed using a Bayesian algorithm variant of the <a href=\"https://en.wikipedia.org/wiki/Glicko_rating_system\">Glicko system</a>, specifically using the <a href=\"https://www.microsoft.com/en-us/research/project/trueskill-ranking-system/\">TrueSkill</a> Python library available <a href=\"https://github.com/sublee/trueskill\">here</a>.</p>\n                <h3>Prizes</h3>\n                <p><a href=\"https://www.twosigma.com\">Two Sigma</a> (the company that developed Halite) will waive first round interviews for all users ranked as Gold or Diamond (the top 1/16 of contestants). Just give us a shout at referrals@twosigma.com with the subject line \"Halite.\"</b>\n                <p>There's also pride! Bragging rights! Internet royalty! The results of the competition will be officially announced with a link to best players Github profiles and/or blogs (we hope for some great postmortems).</b>\n                </ul>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/rules_game.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n\n   <title>Game Rules</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <?php include 'includes/learn_sidebar.php'; ?>\n            <div class=\"col-sm-9\">\n                <h1>Game Rules</h1>\n\n                <h3>Overview</h3>\n\n                <p>This guide gives a detailed description of how the precise rules of the Halite game work. It is highly recommended that you have already read <a href=\"basics_intro_halite.php\">\"Introducing Halite\"</a> before reading this document.</p>\n\n                <h3>The Game</h3>\n\n                <p>During a move, every piece you control can be given one of five moves: to move NORTH, EAST, SOUTH, WEST, or to remain STILL. When a piece move STILL for a turn, it will permanently increase its Strength by the Production of the tile it sits on.</p>\n\n                <p>Players gain pieces by simply moving their own pieces over Sites on the map. When a piece moves off of a Site, it leaves behind a piece with an identical Owner and with a Strength of 0, in doing so expanding the size of their territory.</p>\n\n                <p>When pieces from the same player try to occupy the same site, the resultant piece has the sum of their strengths. Strengths are capped at 255, so if two pieces with a strength of 150 were to both attempt to occupy the same square, the resultant piece would still have a strength of 255.</p>\n\n                <div class=\"text-center\" style=\"margin-bottom: 18px;\"><img src=\"assets/combination.png\" style=\"max-width: 500px;\"></div>\n\n                <p>When pieces from opposing players try to occupy either the same or cardinally adjacent sites (diagonals are not included), the battle will be resolved according to the relative strengths of the pieces, as each piece decreases the strength of every adjacent or coinciding opposing piece by its own strength. Pieces with a strength of 0 or less are removed from the game, excepting pieces with a strength of 0 which have not engaged in combat during that turn.</p>\n\n                <div class=\"text-center\" style=\"margin-bottom: 18px;\"><img src=\"assets/overkill-2.png\" style=\"max-width: 500px;\"></div>\n\n                <p>Notice how in the above example, the pieces combined prior to fighting.</p>\n\n                <p>Because a piece damages all adjacent enemy pieces, if a piece is killed while attacking multiple pieces, it will output (often significantly) more damage than it had strength. This is referred to as \"overkill\" and means that bots can use their pieces tactically to their own advantage. This is shown in the below examples:</p>\n\n                <div class=\"text-center\" style=\"margin-bottom: 18px;\"><img src=\"assets/overkill-1.png\" style=\"max-width: 500px;\"></div>\n\n                <p>The map is initialized by the environment to have productions and strengths. Combat with map squares works identically to combat with other players except only applies on that square; empty map squares neither apply damage to nor take damage from adjacent squares.</p>\n\n                <p>Players should note that the map does wrap around; if a piece at the top of the map moves North, it will reappear on the bottom of the map, and pieces on the top and bottom of the map will engage in combat (provided that they are in the same column).</p>\n\n                <p>The origin of the map (the point at coordinates (0, 0)) is the north west (top left) corner of the map.</p>\n\n                <p>Players are scored according to the reverse of the order in which they are destroyed. The player last standing wins, whereas the player which was destroyed first comes in last. Bots are scored relatively; in a game with many players it is far better to come in second than to come in last.</p>\n\n                <p>The game ends if one of two conditions are met:\n                    <ul>\n                        <li>Only one player has any pieces left.</li>\n                        <li>10 * sqrt(WIDTH * HEIGHT) turns have been played. Consequently, a small map may end after a few hundred turns, whereas a large map could take thousands.</li>\n                    </ul>\n                </p>\n\n                <p>The maximum number of turns is generally high enough that only the best-matched of bots will reach the turn limit; the majority of games will end before the turn limit is reached. In the event that the turn limit is reached or multiple bots are destroyed on the same turn, they are ranked based on their territory at that point in the game. If there is a tie in the amount of territory each bot possesses, the full territory integral is used as the tiebreaker, although this is a rare occurence.</p>\n\n                <h3>Bot Initialization</h3>\n\n                <p>At the start of the game, each bot is sent some information (accessed using getInit in the starter packages):\n                    <ul>\n                        <li>Their own tag within the map - that is, which player they are.</li>\n                        <li>The initial map state.</li>\n                    </ul>\n                </p>\n\n                <p>Bots are permitted to use time at the beginning of the game to initialize. This initialization might include (but is in no way limited to) getting the initial map and player tag, identifying important, high-production regions on the map, identifying the locations of neighboring players, planning the bot's initial expansion strategy, and/or compiling a model. Once bots are done initializing (before their time is up), they should send a response (sendInit in the starter packages) with their own player name, used for human identification purposes.</p>\n\n                <h3>Turns</h3>\n\n                <p>After all bots have finished setting up, the environment will do the following until endgame conditions are met.</p>\n                    <ol>\n                        <li>Send the present gamestate - map and messages - to all players.</li>\n                        <li>Receive moves from the players.</li>\n                        <li>Kill bots whose responses take longer than their remaining allotted time.</li>\n                        <li>Add strength to pieces which choose to remain where they are.</li>\n                        <li>Simultaneously move (and combine if necessary) all player's pieces. The capping of strengths to 255 occurs here.</li>\n                        <li>Simultaneously damage (and remove if damage equals or exceeds strength) all player's pieces. All pieces will output damage equivalent to their strength when starting this phase, and the damage will apply to all coinciding or adjacent enemy squares.</li>\n                        <li>Check if endgame conditions have been met.</li>\n                    </ol>\n                <p>One should note that because all pieces damage all adjacent enemy pieces, if a piece is killed while attacking multiple pieces, it will output (often significantly) more damage than it had strength. This is referred to as \"overkill\" and means that bots can use their pieces tactically to their own advantage.</p>\n\n                <h3>Timeouts</h3>\n\n                <p>Bots are given 15 seconds to initialize and 1 second for every subsequent turn. Every bot's clock starts ticking once the environment sends its message (be it initialization or frame) to the bot and resets once the environment receives the newline character marking the end of the bot's response. If a bot's clock hits zero, it is ejected from the game and deemed to have lost. It's pieces become part of the map.</p>\n\n                <h3>Maps</h3>\n\n                <p>Maps are randomly generated at the start of each game. The generator does the following:\n                    <ol>\n                        <li>Tries to match the given width and height as closely as it can while still creating a symmetric map. Maps are guaranteed to be the given size or smaller in each dimension; never larger.</li>\n                        <li>Tries to create interesting maps in which there are patches of high production squares and patches of low production squares, with fairly low noise on the small scale.</li>\n                        <li>Always creates symmetric maps. Specifically, the generator generates a chunk of the map and then tesselates, reflects, and shifts it to produce the entire map.</li>\n                    </ol>\n                </p>\n\n                <h3>Replay Files</h3>\n\n                <p>Once a game ends, the environment will output a replay file. See <a href=\"advanced_replay_file.php\">here</a> for more information regarding the replay file format.</p>\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/script/associate.js",
    "content": "$(function() {\n    var customEmailForm = {\n        $firstField: $(\"#firstField\"),\n        $secondField: $(\"#secondField\"),\n        $messageBox: $(\"#messageBox\"),\n        $submitButton: $(\"#customSubmitButton\"),\n        init: function(submitCallback) {\n            this.submitCallback = submitCallback;\n            this.$submitButton.click(this, this.onClick.bind(this));         \n            this.$firstField.keypress(this, this.keypress.bind(this));         \n            this.$secondField.keypress(this, this.keypress.bind(this));         \n        },\n        render: function() {\n            this.$emailLoc.html(this.email);\n        },\n        onClick: function() {\n            if(this.$firstField.val() != this.$secondField.val()) {\n                this.displayMessage(\"Email Mismatch\", \"The two emails that you entered do not match.\", false);\n            } else if(this.$firstField.val() == \"\" || this.$secondField.val() == \"\") {\n                this.displayMessage(\"Empty Fields\", \"Please fill your email twice in the boxes below.\", false);\n            } else {\n                this.displayMessage(\"Success\", \"We've sent a verification email to \"+this.$firstField.val()+\". Redirecting to the front page.\", true);\n                this.submitCallback(this.$firstField.val(), getSelectedText(\"selectionLevel\"), getSelectedText(\"selectionHighSchool\"));\n                setTimeout( function(){ window.location.href = \"index.php\" }, 2000 );\n               \n            }\n        },\n        keypress: function(e) {\n            if(e.which == 13) this.onClick();\n        },\n        displayMessage: function(title, message, isSuccess) {\n            this.$messageBox.append($(\"<div class='alert \"+(isSuccess ? \"alert-success\" : \"alert-danger\")+\" alert-dismissible' role='alert'><button type='button' class='close' id='messageCloseButton' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button><strong>\"+title+\"</strong>&nbsp;&nbsp;\"+message+\"</div>\"))\n        }\n    }\n\n    function getSelectedText(classId) {\n        return $(\"#\"+classId+\">option:selected\").html();\n    }\n\n    function populateSelection(selectionId, selectionList) {\n        var selection = document.getElementById(selectionId);\n        for (i = selection.options.length - 1; i >= 0; i--) {\n            selection.removeChild(i);\n        }\n        for( var item in selectionList ){\n            var option = document.createElement('option');\n            option.innerHTML = selectionList[item];\n            option.value = selectionList[item];\n            selection.appendChild(option);\n        }\n\n    }\n\n    function render() {\n        var session = getSession();\n        var user = (session != null && session.hasOwnProperty(\"userID\")) ? getUser(session[\"userID\"]) : null;\n        if(user != null && parseInt(user.isEmailGood) == 0 && user.email != null && user.email != undefined) {\n            $(\"#waitMessage\").css(\"display\", \"block\");\n            $(\"#levelItems\").css(\"display\", \"none\");\n            $(\"#highSchoolItems\").css(\"display\", \"none\");\n            $(\"#associateMessage\").css(\"display\", \"none\");\n            $(\"#forms\").css(\"display\", \"none\");\n        } else {\n            $(\"#waitMessage\").css(\"display\", \"none\");\n            $(\"#highSchoolItems\").css(\"display\", \"none\");\n            $(\"#associateMessage\").css(\"display\", \"block\");\n            $(\"#forms\").css(\"display\", \"block\");\n        }\n    }\n\n    var schools = getValidHighSchools().map(function(x){ return x['name'] });\n    populateSelection(\"selectionHighSchool\", schools);\n    render();\n\n    document.getElementById(\"selectionLevel\").onchange = function(){\n        if(getSelectedText(\"selectionLevel\") == \"High School\") {\n            $(\"#highSchoolItems\").css(\"display\", \"block\");\n        } else {\n            $(\"#highSchoolItems\").css(\"display\", \"none\");\n        }\n    }\n\n\n    customEmailForm.init(function(email, level, institution) {\n        if(level != \"High School\") {\n            newEmailForProfessional(email, level);\n        } else {\n            newEmailForHighSchool(email, level, institution);\n        }\n    });\n});\n"
  },
  {
    "path": "website/script/backend.js",
    "content": "var url = \"api/web/\";\n// Attempts to store the username/password combo given\n// Returns false if the username is already taken\n// If async returns null\nfunction storeUserDatabase(email, username, password, async) {\n    var result = $.ajax({\n        url: url+\"user\",\n        async: async,\n        method: \"POST\",\n        data: {email: email, username: username, password: password}\n    });\n\n    if(async == true) {\n        return null;\n    }\n\n    console.log(result)\n    return result.responseJSON;\n}\n\nfunction storeUserSession(username, password, async) {\n    $.ajax({\n        url: url+\"session\",\n        async: async,\n        method: \"POST\",\n        data: {username: username, password: password}\n    });\n}\n\n// Uploads source code for users's bot\n// When given the html ID of a form with the userID as a value and the file as another value\nfunction storeBotFile(formID) {\n    if(!$(\"#\"+formID).find(\"input[name='userID']\").length || $(\"#\"+formID).find(\"input[name='userID']\").val().localeCompare(\"\") == 0) {\n        console.log(\"Form not setup correctly. Does not include userID\");\n        throw 1;\n    }\n    var formData = new FormData($(\"#\"+formID)[0]);\n    var result = $.ajax({\n        url: url+\"botFile\",\n        async: false,\n        method: \"POST\",\n        data: formData,\n        processData: false,\n        contentType: false,\n        xhr: function() {\n            var myXhr = $.ajaxSettings.xhr();\n            return myXhr;\n        },\n        success: function(result) {\n            console.log(result);\n        },\n        error: function (xhr, ajaxOptions, thrownError) {\n            console.log(xhr.responseText)\n        }\n    })\n    console.log(result);\n    return result.responseJSON;\n}\n\nfunction getSession() {\n    var result =  $.ajax({\n        url: url+\"session\",\n        async: false,\n        method: 'GET'\n    });\n    return result.responseJSON;\n}\n\nfunction getUser(userID, username, password) {\n    var result = $.ajax({\n        url: url+\"user\",\n        async: false,\n        method: \"GET\",\n        data: {userID: userID, username: username, password: password}\n    });\n    console.log(result)\n    return result.responseJSON;\n}\n\nfunction getActiveUsers(limit, page) {\n    var result = $.ajax({\n        url: url+\"user\",\n        async: false,\n        method: \"GET\",\n        data: {fields: [\"isRunning\"], values: [\"1\"], limit: limit, page: page}\n    });\n    console.log(result)\n    console.log(result.responseJSON)\n    return result.responseJSON;\n}\n\nfunction getLatestGamesForUser(userID, limit, startingID) {\n    console.log(startingID)\n    var result = $.ajax({\n        url: url+\"game\",\n        async: false,\n        method: \"GET\",\n        data: {userID: userID, limit: limit, startingID: startingID}\n    });\n    console.log(startingID)\n    return result.responseJSON;\n}\n\nfunction destroySession(async) {\n    $.ajax({\n        url: url+\"session\",\n        async: async,\n        method: \"DELETE\"\n    });\n}\n\nfunction verifyUser(userID, verificationCode) {\n    return $.ajax({\n        url: url+\"user\",\n        async: false,\n        method: \"POST\",\n        data: {userID: userID, verificationCode: verificationCode}\n    }).responseJSON;\n}\n\nfunction getNumActiveUsers() {\n    return $.ajax({\n        url: url+\"stats\",\n        async: false,\n        method: \"GET\",\n        data: {numActive: 1}\n    }).responseJSON;\n}\n\nfunction getExtraStats(userID) {\n    return $.ajax({\n        url: url+\"extraStats\",\n        async: false,\n        method: \"GET\",\n        data: {userID: userID}\n    }).responseJSON;\n}\n\nfunction getForumSignInURL(payload, signature, userID, email, username) {\n    return $.ajax({\n        url: url+\"forums\",\n        async: false,\n        method: \"GET\",\n        data: {\n            payload: payload,\n            signature: signature,\n            userID: userID,\n            email: email,\n            username: username\n        }\n    }).responseJSON;\n}\n\nfunction getWorkers() {\n    return $.ajax({\n        url: url+\"worker\",\n        async: false,\n        method: \"GET\",\n        data: {}\n    }).responseJSON;\n}\n\nfunction getLatestAnnouncement(userID) {\n    return $.ajax({\n        url: url+\"announcement\",\n        async: false,\n        method: \"GET\",\n        data: {userID: userID}\n    }).responseJSON;\n}\n\nfunction closedAnnouncement(announcementID) {\n    var response = $.ajax({\n        url: url+\"announcement\",\n        async: false,\n        method: \"POST\",\n        data: {announcementID: announcementID}\n    });\n    console.log(response)\n    return response.responseJSON;\n}\n\nfunction getRandomGameName() {\n    var response = $.ajax({\n        url: url+\"game\",\n        async: false,\n        method: \"GET\",\n        data: {random: true}\n    });\n    console.log(response)\n    return response.responseJSON;\n}\n\nfunction getHistories(userID) {\n    var response = $.ajax({\n        url: url+\"history\",\n        async: false,\n        method: \"GET\",\n        data: {userID: userID}\n    });\n    console.log(response)\n    return response.responseJSON;\n}\n\nfunction getThroughput() {\n    return $.ajax({\n        url: url+\"stats\",\n        async: false,\n        method: \"GET\",\n        data: {throughput: 1}\n    }).responseJSON;\n}\n\nfunction getNumSubmissions() {\n    return $.ajax({\n        url: url+\"stats\",\n        async: false,\n        method: \"GET\",\n        data: {numSubmissions: 1}\n    }).responseJSON;\n}\n\nfunction getFilteredUsers(filters, orderBy, limit, page) {\n    var fields = Object.keys(filters);\n    var values = fields.map(function(a) {return filters[a];});\n    var result = $.ajax({\n        url: url+\"user\",\n        async: false,\n        method: \"GET\",\n        data: {fields: fields, values: values, orderBy: orderBy, limit: limit, page: page}\n    });\n    console.log(result)\n\n    return result.responseJSON;\n}\n\nfunction getNotifications() {\n    return $.ajax({\n        url: url+\"notification\",\n        async: false,\n        method: \"GET\"\n    }).responseJSON;\n}\n\nfunction getValidHighSchools() {\n    return $.ajax({\n        url: url+\"highSchool\",\n        async: false,\n        method: \"GET\"\n    }).responseJSON;\n}\n\nfunction getValidHighSchoolByName(name) {\n    return $.ajax({\n        url: url+\"highSchool\",\n        async: false,\n        method: \"GET\",\n        data: {name: name}\n    }).responseJSON;\n}\n\nfunction validateEmail() {\n    return $.ajax({\n        url: url+\"email\",\n        async: false,\n        method: \"GET\",\n        data: {validate: 1}\n    }).responseJSON;\n}\n\nfunction newEmail(email) {\n    // NOTE: These should be PUTs not GETs (since they aren't indempondent). TODO: change\n    return $.ajax({\n        url: url+\"email\",\n        async: false,\n        method: \"GET\",\n        data: {newEmail: email}\n    }).responseJSON;\n}\n\n\nfunction newEmailForProfessional(email, level) {\n    return $.ajax({\n        url: url+\"email\",\n        async: false,\n        method: \"GET\",\n        data: {newEmail: email, newLevel: level}\n    }).responseJSON;\n}\n\nfunction newEmailForHighSchool(email, level, institution) {\n    return $.ajax({\n        url: url+\"email\",\n        async: false,\n        method: \"GET\",\n        data: {newEmail: email, newLevel: level, newInstitution: institution}\n    }).responseJSON;\n}\n\nfunction getGames(previousID) {\n    return $.ajax({\n        url: \"api/web/game\",\n        async: false,\n        method: \"GET\",\n        data: {previousID: previousID}\n    }).responseJSON;\n}\n\nfunction getScoreMedians() {\n    return $.ajax({\n        url: url+\"stats\",\n        async: false,\n        method: \"GET\",\n        data: {scoreMedians: 1}\n    }).responseJSON;\n}\n"
  },
  {
    "path": "website/script/basics_intro_halite.js",
    "content": "$(function() {\n    textFromURL(\"ar1481484242-3993659735.hlt\", $(\"#gameReplay\"), function(data) {\n        console.log(data)\n        if(data != null) {\n            showGame(data, $(\"#gameReplay\"), null, 500, true, true);\n        }\n    });\n})\n"
  },
  {
    "path": "website/script/email.js",
    "content": "$(function() {\n    var customEmailForm = {\n        $firstField: $(\"#firstField\"),\n        $secondField: $(\"#secondField\"),\n        $messageBox: $(\"#messageBox\"),\n        $submitButton: $(\"#customSubmitButton\"),\n        init: function(submitCallback) {\n            this.submitCallback = submitCallback;\n            this.$submitButton.click(this, this.onClick.bind(this));         \n            this.$firstField.keypress(this, this.keypress.bind(this));         \n            this.$secondField.keypress(this, this.keypress.bind(this));         \n        },\n        render: function() {\n            this.$emailLoc.html(this.email);\n        },\n        onClick: function() {\n            if(this.$firstField.val() != this.$secondField.val()) {\n                this.displayMessage(\"Email Mismatch\", \"The two emails that you entered do not match.\", false);\n            } else if(this.$firstField.val() == \"\" || this.$secondField.val() == \"\") {\n                this.displayMessage(\"Empty Fields\", \"Please fill your email twice in the boxes below.\", false);\n            } else {\n                this.displayMessage(\"Success\", \"We've sent a verification email to \"+this.$firstField.val()+\".\", true);\n                this.submitCallback(this.$firstField.val());\n            }\n        },\n        keypress: function(e) {\n            if(e.which == 13) this.onClick();\n        },\n        displayMessage: function(title, message, isSuccess) {\n            this.$messageBox.append($(\"<div class='alert \"+(isSuccess ? \"alert-success\" : \"alert-danger\")+\" alert-dismissible' role='alert'><button type='button' class='close' id='messageCloseButton' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button><strong>\"+title+\"</strong>&nbsp;&nbsp;\"+message+\"</div>\"))\n        }\n    }\n\n    function render() {\n        if(parseInt(user.isEmailGood) == 0) {\n            if(user.email != null && user.email != undefined) {\n                $(\"#waitMessage\").css(\"display\", \"block\");\n\n                $(\"#forms\").css(\"display\", \"none\");\n                $(\"#firstMessage\").css(\"display\", \"none\");\n                $(\"#returningMessage\").css(\"display\", \"none\");\n            } else {\n                $(\"#forms\").css(\"display\", \"block\");\n                $(\"#firstMessage\").css(\"display\", \"block\");\n\n                $(\"#waitMessage\").css(\"display\", \"none\");\n                $(\"#returningMessage\").css(\"display\", \"none\");\n            }\n        } else {\n                $(\"#forms\").css(\"display\", \"block\");\n                $(\"#returningMessage\").css(\"display\", \"block\");\n\n                $(\"#waitMessage\").css(\"display\", \"none\");\n                $(\"#firstMessage\").css(\"display\", \"none\");\n        }\n    }\n\n    var session = getSession();\n    if(session == null) window.location.href = \"index.php\";\n    var user = getUser(session['userID']);\n    if(user == null) window.location.href = \"index.php\";\n\n    render(user);\n\n    customEmailForm.init(function(email) {\n        newEmail(email);\n\n        user.email = email;\n        render(user);\n    });\n});\n"
  },
  {
    "path": "website/script/game.js",
    "content": "$(function () {\n    var replayName = getGET(\"replay\");\n    if(replayName != null && replayName != undefined) {\n        $(\"#pageContent\").html(\"<h1><span class=\\\"glyphicon glyphicon-refresh glyphicon-refresh-animate\\\"></span> Loading replay...</h1>\");\n        var data = textFromURL(replayName, $(\"#pageContent\"), function(data) {\n            console.log(data)\n            if(data != null) {\n                showGame(data, $(\"#pageContent\"), null, null, true, false);\n            }\n        });\n    } else {\n        $(\"#pageContent\").append($(\"<h3>An unexpected error occured. If this error persists, please post on the forums or email us at halite@halite.io.</h3>\"));\n    }\n})\n"
  },
  {
    "path": "website/script/general.js",
    "content": "// Google analytics\n(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n\nga('create', 'UA-80656237-1', 'auto');\nga('send', 'pageview');\n\nfunction getGET(name) {\n    name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n    var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n    results = regex.exec(location.search);\n    return results === null ? null : decodeURIComponent(results[1]);\n}\n\n// The message box should be accessible to all pages\nvar messageBox = {\n    $messageBox: $(\"#messageBox\"),\n    alert: function(title, message, isSuccess, onClose) {\n        this.clear()\n        this.$messageBox.append($(\"<div class='alert \"+(isSuccess ? \"alert-success\" : \"alert-danger\")+\" alert-dismissible' role='alert'><button type='button' class='close' id='messageCloseButton' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button><strong>\"+title+\"</strong>&nbsp;&nbsp;\"+message+\"</div>\"))\n        if(onClose != null) $(\"#messageCloseButton\").click(onClose);\n    },\n    clear: function() {\n        this.$messageBox.empty()\n    }\n};\n\nfunction SmartForm($submitButton, $form, onSubmit) {\n    $submitButton.click(function() {\n        console.log(\"CLICK\");\n        onSubmit();\n    });\n    $form.keypress(function(event) {\n        if (event.which == 13) {\n            event.preventDefault();\n            onSubmit();\n        }\n    });\n};\n\n$(function() {\n    var navbar = {\n        loggedIn: false,\n        $registerUsername: $(\"#register_user\"),\n        $registerEmail: $(\"#register_email\"),\n        $registerPassword: $(\"#register_pass\"),\n        $registerConfirmPassword: $(\"#register_confirm_pass\"),\n        $registerButton: $(\"#register_button\"),\n        $registerForm: $(\"#register_form\"),\n        $logInNav: $(\"#loginNav\"),\n        $logOutNav: $(\"#logoutNav\"),\n        $logOutButton: $(\"#logoutButton\"),\n\n        uploadButton: {\n            $button: $(\"#submitButton\"),\n            $form: $(\"#submitForm\"),\n            $fileInput: $(\"#myFile\"),\n            $submitModal: $(\"#submitModal\"),\n            $submitModalButton: $(\"#submitModalButton\"),\n            init: function(session) {\n                this.session = session;\n                this.$button.click(this, this.buttonClicked.bind(this));\n                this.$submitModalButton.click(this, this.submitModal.bind(this));\n                this.$fileInput.change(this, this.fileChanged.bind(this));\n            },\n            setCredentials: function(userID, password) {\n                this.$form.append(\"<input type='hidden' name='userID' value='\"+userID+\"'>\");\n                this.$form.append(\"<input type='hidden' name='password' value='\"+password+\"'>\");\n            },\n            buttonClicked: function() { \n                var user = getUser(this.session.userID);\n                if(parseInt(user.isRunning) == 1) {\n                    this.$fileInput.click(); \n                } else {\n                    this.$submitModal.modal(\"show\");\n                }\n            },\n            submitModal: function() { \n                this.$fileInput.click(); \n            },\n            fileChanged: function() {\n                this.$submitModal.modal(\"hide\");\n                try {\n                    var uploadOutput = storeBotFile(\"submitForm\");\n                    if(uploadOutput.indexOf(\"desktop\") != -1) {\n                        messageBox.alert(\"Restricted Access\", \"You are not allowed to submit code to Halite from a Two Sigma Desktop. Please use a personal computer on Two Sigma Wifi instead.\", false);\n                    } else if(uploadOutput.indexOf(\"large\") != -1) {\n                        messageBox.alert(\"File Size Error\", \"Your bot file was too big. We only allow submissions less than 20 megabytes. Make sure you aren't packaging unnecessary binaries.\", false);\n                    } else if(uploadOutput.indexOf(\"Compiling\") != -1) {\n                        messageBox.alert(\"Compiling\", \"We are compiling one of your bots. You have to wait until we have finished compiling your bot before you may submit another one.\", false);\n                    } else {\n                        messageBox.alert(\"Bot Submitted\", \"Your bot was successfully uploaded to our servers. <b>If your bot does not compile, you will receive an email in a couple of minutes.</b> Otherwise, you will show up on the leaderboard very soon.\", true)\n                    }\n                } catch (err) {\n                    messageBox.alert(\"File Upload Error\", \"An error occurred while uploading your file. <b>Your file may have been too big</b>. Check to make sure that your file is under <b>20 megabytes</b>. Make sure that you haven't packaged some unnecessary, big binaries. If this persists, post of the forums or email us at halite@halite.io.\", false);\n                }\n            }\n        },\n\n        init: function(session) {\n            new SmartForm(this.$registerButton, this.$registerForm, this.register.bind(this));\n\n            this.uploadButton.init(session);\n            this.$logOutButton.click(this.logOut.bind(this));\n\n            if(session != null && session.userID != null) {\n                this.user = session;\n                this.loggedIn = true;\n            }\n\n            this.render();\n        },\n        register: function() {\n            messageBox.clear();\n\n            var username = this.$registerUsername.val();\n            var email = this.$registerEmail.val();\n            var password = this.$registerPassword.val();\n            var confirmPassword = this.$registerConfirmPassword.val();\n\n            if(password != confirmPassword) {\n                messageBox.alert(\"Passwords Don't Match\", \"Please type in your password correctly.\", false);\n            } else {\n                var resp = storeUserDatabase(email, username, password, false);\n                console.log(resp)\n                if (resp === \"Success\") {\n                    messageBox.alert(\"Verify Your Email\", \"You may not log in until you verify your email.\", true);\n                    storeUserSession(username, password, false);\n                } else  {\n                    if(resp.toLowerCase().indexOf(\"username\") > -1) {\n                        messageBox.alert(\"Registration failed\", \"That username is already taken\", false);\n                    } else if (resp.toLowerCase().indexOf(\"exists\") > -1) {\n                        messageBox.alert(\"Registration failed\", \"That email is already taken\", false);\n                    } else if (resp.toLowerCase().indexOf(\"sigma\") > -1) {\n                        messageBox.alert(\"Registration failed\", \"That email does not end in twosigma.com\", false);\n                    } else {\n                        messageBox.alert(\"Registration failed\", \"That email is invalid\", false);\n                    }\n                }\n            }\n        },\n        logOut: function() {\n            destroySession(false);\n            this.loggedIn = false;\n            this.render();\n        },\n        render: function() {\n            if(this.loggedIn) {\n                this.$logInNav.css(\"display\", \"none\");\n                this.$logOutNav.css(\"display\", \"inline\");\n\n                this.uploadButton.setCredentials(this.user.userID, this.user.password);\n            } else {\n                this.$logInNav.css(\"display\", \"inline\");\n                this.$logOutNav.css(\"display\", \"none\");\n            }\n        }\n    }\n\n    if(getGET(\"forumsLogOut\") != null) {\n        messageBox.alert(\"Logged Out\", \"You have been logged out of forums.halite.io and halite.io\", true);\n        destroySession(false);\n    }\n    if(getGET(\"unsubscribeEmails\")) {\n        messageBox.alert(\"Unsubscribed\", \"You have unsubscribed from all halite emails.\", true)\n    }\n    if(getGET(\"subscribeEmails\")) {\n        messageBox.alert(\"Subscribed\", \"You have subscribed to all halite emails!\", true)\n    }\n    if(getGET(\"emailVerification\")) {\n        messageBox.alert(\"Email Verification\", \"You have successfully verified your email.\", true)\n    }\n\n    var session = getSession();\n    navbar.init(session);\n    if(session != null) {\n        var announcement = getLatestAnnouncement(session.userID);\n        console.log(announcement)\n        if(announcement != null) {\n            messageBox.alert(announcement.header, announcement.body, true, function() {\n                closedAnnouncement(announcement.announcementID);  \n            });\n        }\n    }\n\n})\n"
  },
  {
    "path": "website/script/index.js",
    "content": "$(function() {\n    $(\"#numUsers\").html(getNumActiveUsers());\n    var data = textFromURL(\"ar1482947270-2437412300.hlt\", $(\"#gameReplay\"), function(data) {\n        console.log(data)\n        if(data != null) {\n            showGame(data, $(\"#gameReplay\"), null, 500, true, true, true, 30);\n        }\n    });\n})\n"
  },
  {
    "path": "website/script/leaderTable.js",
    "content": "var leaderTable = {\n    init: function(submissions, startingIndex) {\n        this.startingIndex = startingIndex == null ? 1 : startingIndex;\n        this.cacheDOM();\n        this.setSubmissions(submissions);\n    },\n    cacheDOM: function() {\n        this.$tableBody = $(\"#leaderTableBody\")\n    },\n    sanitize: function() {\n        for(var a = 0; a < this.submissions.length; a++) {\n            this.submissions[a][\"username\"] = escapeHtml(filterXSS(this.submissions[a][\"username\"]));\n            this.submissions[a][\"language\"] = escapeHtml(filterXSS(this.submissions[a][\"language\"]));\nconsole.log(this.submissions[a][\"language\"])\n        }\n    },\n    setSubmissions: function(submissions) {\n        this.submissions = submissions;\n        this.sanitize();\n        this.render();\n    },\n    render: function() {\n        this.$tableBody.empty();\n        this.submissions.sort(function(a, b) {\n            return parseInt(a.rank) - parseInt(b.rank);\n        });\n        console.log(this.submissions)\n        for(var a = 0; a < this.submissions.length; a++) {\n            var user = this.submissions[a];\n            var mu = Math.round(user.mu*100)/100;\n            var sigma = Math.round(user.sigma*100)/100;\n            var score = Math.round((user.mu-(3*user.sigma))*100)/100;\n\n            var $tableRow = $(\"<tr id='user\" + user.userID + \"'></tr>\" );\n            $tableRow.append(\"<th scope='row'>\"+(this.startingIndex+a)+\"</th>\");\n            $tableRow.append(\"<td><a class='username' href='user.php?userID=\"+user.userID+\"'>\"+user.username+\"</a></td>\");\n            $tableRow.append(\"<td>\"+user.tier+\"</td>\");\n            $tableRow.append(\"<td><a href='leaderboard.php?field=language&value=\"+encodeURIComponent(user.language)+\"&heading=\"+encodeURIComponent(user.language)+\"'>\"+user.language+\"</a></td>\");\n            $tableRow.append(\"<td><a href='leaderboard.php?field=level&value=\"+encodeURIComponent(user.level)+\"&heading=\"+encodeURIComponent(user.level)+\"'>\"+user.level+\"</a></td>\");\n            $tableRow.append(\"<td><a href='leaderboard.php?field=organization&value=\"+encodeURIComponent(user.organization)+\"&heading=\"+encodeURIComponent(user.organization)+\"'>\"+user.organization+\"</a></td>\");\n            $tableRow.append(\"<td title='mu: \"+ mu +\" sigma: \"+ sigma +\"'>\"+score+\"</td>\");\n\n            this.$tableBody.append($tableRow);\n        }\n    },\n    getRow: function(userID) {\n        return this.$tableBody.find(\"#user\"+userID);\n    }\n};\n"
  },
  {
    "path": "website/script/leaderboard.js",
    "content": "$(function() {\n    $(\"#numUsers\").html(getNumActiveUsers());\n    var userSearch = {\n        $usernameField: $(\"#usernameField\"),\n        $submitButton: $(\"#usernameSubmitButton\"),\n        init: function() {\n            this.$submitButton.click(this, this.onSubmit.bind(this));         \n            this.$usernameField.keypress(this, this.inputKeypress.bind(this));         \n        },\n        inputKeypress: function(e) {\n            if(e.which == 13) this.onSubmit();\n        },\n        onSubmit: function() {\n            var username = this.$usernameField.val();\n            var user = getUser(null, username);\n            if(user == null || parseInt(user.isRunning) == 0) {\n                messageBox.alert(\"Invalid User\", \"The user \"+username+\" is not on the leaderboard.\", false, null);\n            } else {\n                window.location.href=\"leaderboard.php?userID=\"+user.userID;\n            }\n        }\n    }\n    userSearch.init();\n\n    var USERS_PER_PAGE = 20;\n\n    // What criteria are we using for ranking?\n    var field = getGET(\"field\");\n    var value = getGET(\"value\");\n    var heading = getGET(\"heading\");\n    \n    // Where are we in the rankings?\n    var userID = getGET(\"userID\");\n    var page = getGET(\"page\");\n    if(page == null) {\n        if (userID != null) page = Math.floor((parseInt(getUser(userID)[\"rank\"]) - 1) / USERS_PER_PAGE);\n        else page = 0;\n    } else {\n        page = parseInt(page);\n    }\n\n    // Create leaderboard filters from get params\n    // Set page title \n    var $heading = $(\"#leaderHeading\");\n    var filters = {};\n    filters[\"isRunning\"] = 1;\n    if(field != null && value != null && heading != null) {\n        $heading.html(heading + \" Rankings\");\n        document.title = heading + \" Rankings\";\n        filters[field] = value;\n    } else {\n        $heading.html(\"Current Rankings\");\n    }\n\n    var response = getFilteredUsers(filters, \"rank\", USERS_PER_PAGE, page);\n    leaderTable.init(response['users'], 1+(page == null ? 0 : page)*USERS_PER_PAGE);\n\n    // Highlight if user was linked\n    if(userID != null) {\n        var $username = leaderTable.getRow(userID).find(\".username\");\n        $username.html(\"<mark>\"+$username.html()+\"</mark>\");\n    }\n\n    // Create next and previous buttons\n    // (build links, are they greyed out, etc)\n    var $previous = null;\n    var $next = null;\n\n    var baseURL = location.pathname.substring(location.pathname.lastIndexOf(\"/\") + 1)+\"?\";\n    if(field != null) baseURL += \"field=\"+encodeURIComponent(field);\n    if(value != null) baseURL += \"&value=\"+encodeURIComponent(value);\n    if(heading != null) baseURL += \"&heading=\"+encodeURIComponent(heading);\n\n    if(page != 0) {\n        $previous = $(\"<a/>\");\n        $previous.attr(\"href\", baseURL+\"&page=\"+(page-1));\n    } else {\n        $previous = $(\"<span/>\");\n        $previous.addClass('text-muted');\n    }\n\n    if(response['isNextPage'] == true) {\n        $next = $(\"<a/>\");\n        $next.attr(\"href\", baseURL+\"&page=\"+(page == null ? 1 : page+1));\n    } else {\n        $next = $(\"<span/>\");\n        $next.addClass('text-muted');\n    }\n\n    $previous.addClass(\"pull-left\");\n    $previous.html(\"Previous\");\n    $next.addClass(\"pull-right\");\n    $next.html(\"Next\");\n\n    $footer = $(\"#footer\");\n    $footer.append($previous);\n    $footer.append($next);\n})\n"
  },
  {
    "path": "website/script/localVisualizer.js",
    "content": "$(function () {\n    var $dropZone = $(\"html\");\n    var $filePicker = $(\"#filePicker\");\n    function handleFiles(files) {\n        // only use the first file.\n        file = files[0];\n        console.log(file)\n        var reader = new FileReader();\n\n        reader.onload = (function(filename) { // finished reading file data.\n            return function(e2) {\n                $(\"#displayArea\").empty();\n                $(\"label[for=filePicker]\").text(\"Select another file\");\n                var fsHeight = $(\"#fileSelect\").outerHeight();\n                showGame(textToGame(e2.target.result, filename), $(\"#displayArea\"), null, -fsHeight, true, false, true);\n            };\n        })(file.name);\n        reader.readAsText(file); // start reading the file data.\n    }\n\n    $dropZone.on('dragover', function(e) {\n        e.stopPropagation();\n        e.preventDefault();\n    });\n    $dropZone.on('drop', function(e) {\n        e.stopPropagation();\n        e.preventDefault();\n        var files = e.originalEvent.dataTransfer.files; // Array of all files\n        handleFiles(files)\n    });\n    $filePicker.on('change', function(e) {\n        var files = e.target.files\n        handleFiles(files)\n    });\n})\n"
  },
  {
    "path": "website/script/parsereplay.js",
    "content": "function processFrame(game, frameNum) {\n    var checkSim = false;\n    var gameMap = game.frames[frameNum];\n    if(checkSim) {\n        gameMap = _.cloneDeep(game.frames[frameNum]);\n    }\n    var moves = game.moves[frameNum];\n    var productions = game.productions;\n    var width = game.width;\n    var height = game.height;\n    var numPlayers = game.num_players;\n\n    var STILL = 0;\n    var NORTH = 1;\n    var EAST  = 2;\n    var SOUTH = 3;\n    var WEST  = 4;\n\n    var pieces = [];\n    var stats = [];\n\n    var p, q, y, x;\n\n    function getLocation(loc, direction) {\n        if (direction === STILL) {\n            // nothing\n        } else if (direction === NORTH) {\n            loc.y -= 1;\n        } else if (direction === EAST) {\n            loc.x += 1;\n        } else if (direction === SOUTH) {\n            loc.y += 1;\n        } else if (direction === WEST) {\n            loc.x -= 1;\n        }\n\n        if (loc.x < 0) {\n            loc.x = width - 1;\n        } else {\n            loc.x %= width;\n        }\n\n        if (loc.y < 0) {\n            loc.y = height - 1;\n        } else {\n            loc.y %= height;\n        }\n    }\n\n    for (p = 0; p < numPlayers; p++) {\n        pieces[p] = [];\n        stats[p] = {\n            actualProduction: 0,\n            playerDamageDealt: 0,\n            environmentDamageDealt: 0,\n            damageTaken: 0,\n            capLosses: 0,\n            overkillDamage: 0,\n        };\n        for (y = 0; y < height; y++) {\n            pieces[p][y] = [];\n        }\n    }\n\n    for (y = 0; y < height; y++) {\n        for (x = 0; x < width; x++) {\n            var direction = moves[y][x];\n            var cell = gameMap[y][x];\n            var player = gameMap[y][x].owner - 1;\n            var production = productions[y][x];\n\n            if (gameMap[y][x].owner == 0) continue\n\n            if (direction === STILL) {\n                cell = { owner: gameMap[y][x].owner, strength: gameMap[y][x].strength };\n                if (cell.strength + production <= 255) {\n                    stats[player].actualProduction += production;\n                    cell.strength += production;\n                } else {\n                    stats[player].actualProduction += cell.strength - 255;\n                    stats[player].capLosses += cell.strength + production - 255;\n                    cell.strength = 255;\n                }\n            }\n\n            var newLoc = { x: x, y: y };\n            getLocation(newLoc, direction);\n            if (!_.isUndefined(pieces[player][newLoc.y][newLoc.x])) {\n                if (pieces[player][newLoc.y][newLoc.x] + cell.strength <= 255) {\n                    pieces[player][newLoc.y][newLoc.x] += cell.strength;\n                } else {\n                    stats[player].capLosses += pieces[player][newLoc.y][newLoc.x] + cell.strength - 255;\n                    pieces[player][newLoc.y][newLoc.x] = 255;\n                }\n            } else {\n                pieces[player][newLoc.y][newLoc.x] = cell.strength;\n            }\n\n            // add in a new piece with a strength of 0 if necessary\n            if (_.isUndefined(pieces[player][y][x])) {\n                pieces[player][y][x] = 0;\n            }\n\n            // erase from the game map so that the player can't make another move with the same piece\n            // On second thought, trust that the original game took care of that.\n            if(checkSim) {\n                gameMap[y][x] = { owner: 0, strength: 0 };\n            }\n        }\n    }\n\n    var toInjure = [];\n    var injureMap = [];\n\n    for (p = 0; p < numPlayers; p++) {\n        toInjure[p] = [];\n        for (y = 0; y < height; y++) {\n            toInjure[p][y] = [];\n        }\n    }\n\n    for (y = 0; y < height; y++) {\n        injureMap[y] = [];\n        for (x = 0; x < width; x++) {\n            injureMap[y][x] = 0;\n        }\n    }\n\n    for (y = 0; y < height; y++) {\n        for (x = 0; x < width; x++) {\n            for (p = 0; p < numPlayers; p++) {\n                // if player p has a piece at these coords\n                if (!_.isUndefined(pieces[p][y][x])) {\n                    var damageDone = 0;\n                    // look for other players with pieces here\n                    for (q = 0; q < numPlayers; q++) {\n                        // exclude the same player\n                        if (p !== q) {\n                            for (var dir = STILL; dir <= WEST; dir++) {\n                                // check STILL square\n                                var loc = { x: x, y: y };\n                                getLocation(loc, dir);\n\n                                // if the other player has a piece here\n                                if (!_.isUndefined(pieces[q][loc.y][loc.x])) {\n                                    // add player p's damage\n                                    if (!_.isUndefined(toInjure[q][loc.y][loc.x])) {\n                                        toInjure[q][loc.y][loc.x] += pieces[p][y][x];\n                                        stats[p].playerDamageDealt += pieces[p][y][x];\n                                        damageDone += Math.min(pieces[p][y][x], pieces[q][loc.y][loc.x]);\n                                    } else {\n                                        toInjure[q][loc.y][loc.x] = pieces[p][y][x];\n                                        stats[p].playerDamageDealt += pieces[p][y][x];\n                                        damageDone += Math.min(pieces[p][y][x], pieces[q][loc.y][loc.x]);\n                                    }\n                                }\n                            }\n                        }\n                    }\n\n                    // if the environment can do damage back\n                    if (gameMap[y][x].owner == 0 && gameMap[y][x].strength > 0) {\n                        if (!_.isUndefined(toInjure[p][y][x])) {\n                            toInjure[p][y][x] += gameMap[y][x].strength;\n                        } else {\n                            toInjure[p][y][x] = gameMap[y][x].strength;\n                        }\n                        // and apply damage to the environment\n                        injureMap[y][x] += pieces[p][y][x];\n                        damageDone += Math.min(pieces[p][y][x], gameMap[y][x].strength);\n                        stats[p].environmentDamageDealt += Math.min(pieces[p][y][x], gameMap[y][x].strength);\n                    }\n\n                    if (damageDone > pieces[p][y][x]) {\n                        stats[p].overkillDamage += damageDone - pieces[p][y][x];\n                    }\n                }\n            }\n        }\n    }\n\n    // injure and/or delete pieces. Note >= rather than > indicates that pieces with a strength of 0 are killed.\n    for (p = 0; p < numPlayers; p++) {\n        for (y = 0; y < height; y++) {\n            for (x = 0; x < width; x++) {\n                if (!_.isUndefined(toInjure[p][y][x])) {\n                    if (toInjure[p][y][x] >= pieces[p][y][x]) {\n                        stats[p].damageTaken += pieces[p][y][x];\n                        pieces[p][y][x] = undefined;\n                    } else {\n                        stats[p].damageTaken += toInjure[p][y][x];\n                        pieces[p][y][x] -= toInjure[p][y][x];\n                    }\n                }\n            }\n        }\n    }\n\n    if(checkSim) {\n        // apply damage to map pieces\n        for (y = 0; y < height; y++) {\n            for (x = 0; x < width; x++) {\n                if (gameMap[y][x].strength < injureMap[y][x]) {\n                    gameMap[y][x].strength = 0;\n                } else {\n                    gameMap[y][x].strength -= injureMap[y][x]\n                }\n                gameMap[y][x].owner = 0;\n            }\n        }\n\n        // add pieces back into the map\n        for (p = 0; p < numPlayers; p++) {\n            for (y = 0; y < height; y++) {\n                for (x = 0; x < width; x++) {\n                    if (!_.isUndefined(pieces[p][y][x])) {\n                        gameMap[y][x].owner = p + 1;\n                        gameMap[y][x].strength = pieces[p][y][x];\n                    }\n                }\n            }\n        }\n\n        if (frameNum + 1 < gameMap.num_frames - 1) {\n            if (!_.isEqual(gameMap, game.frames[frameNum + 1])) {\n                throw new Error(\"Evaluated frame did not match actual game map for frame number \" + frameNum);\n            }\n        }\n    }\n\n    return stats;\n}\n\nfunction textToGame(text, seed) {\n    var startParse = new Date();\n    console.log(\"Starting parse at\", startParse);\n    var game = JSON.parse(text)\n\n    if (game.version != 11) {\n        alert(\"Invalid version number: \" + json_game.version);\n    }\n\n    //Adds determinism (when used with https://github.com/davidbau/seedrandom) to color scramble.\n    console.log(seed);\n    Math.seedrandom(seed);\n\n    //Hardcoding colors:\n    var colors = [\n                  '0x9010B9',\n                  '0x005DD0',\n                  '0xF577F2',\n                  '0x23D1DE',\n                  '0xB11243',\n                  '0xFF704B',\n                  '0x00B553',\n                  '0xF8EC31'\n                 ];\n\n    var x, i;\n    for (i = colors.length; i; i--) {\n        var j = Math.floor(Math.random() * i);\n        x = colors[i - 1];\n        colors[i - 1] = colors[j];\n        colors[j] = x;\n    }\n\n    game.players = []\n    game.players.push({name: 'NULL', color: \"0x888888\"});\n    for(i = 0; i < game.num_players; i++) {\n        game.players.push({name: game.player_names[i], color: colors[i] });\n        console.log(game.players[game.players.length - 1].color);\n    }\n    delete game.player_names;\n\n    console.log(game.players);\n\n    var maxProd = 0;\n    for(var a = 0; a < game.height; a++) {\n        for(var b = 0; b < game.width; b++) {\n            if(game.productions[a][b] > maxProd) maxProd = game.productions[a][b];\n        }\n    }\n\n    game.productionNormals = []\n    for(var a = 0; a < game.height; a++) {\n        var row = []\n        for(var b = 0; b < game.width; b++) {\n            row.push(game.productions[a][b] / maxProd);\n        }\n        game.productionNormals.push(row)\n    }\n\n    for(var a = 0; a < game.num_frames; a++) {\n        for(var b = 0; b < game.height; b++) {\n            for(var c = 0; c < game.width; c++) {\n                var array = game.frames[a][b][c];\n                game.frames[a][b][c] = { owner: array[0], strength: array[1] };\n            }\n        }\n    }\n\n    var stats = [];\n    for(var a = 0; a < game.num_frames - 1; a++) {\n        stats[a+1] = processFrame(game, a);\n    }\n\n    //Get game statistics:\n    for(var a = 1; a <= game.num_players; a++) {\n        game.players[a].territories = [];\n        game.players[a].productions = [];\n        game.players[a].strengths = [];\n        game.players[a].actualProduction = [];\n        game.players[a].playerDamageDealt = [];\n        game.players[a].environmentDamageDealt = [];\n        game.players[a].damageTaken = [];\n        game.players[a].capLosses = [];\n\n        for(var b = 0; b < game.num_frames; b++) {\n            var ter = 0, prod = 0, str = 0;\n            for(var c = 0; c < game.height; c++) for(var d = 0; d < game.width; d++) {\n                if(game.frames[b][c][d].owner == a) {\n                    ter++;\n                    prod += game.productions[c][d];\n                    str += game.frames[b][c][d].strength;\n                }\n            }\n            game.players[a].territories.push(ter);\n            game.players[a].productions.push(prod);\n            game.players[a].strengths.push(str);\n            if (b == 0) {\n                game.players[a].actualProduction.push(0);\n                game.players[a].environmentDamageDealt.push(0);\n                game.players[a].damageTaken.push(0);\n                game.players[a].playerDamageDealt.push(0);\n                game.players[a].capLosses.push(0);\n            }\n            else {\n                game.players[a].actualProduction.push(game.players[a].actualProduction[b - 1] + stats[b][a - 1].actualProduction);\n                game.players[a].environmentDamageDealt.push(game.players[a].environmentDamageDealt[b - 1] + stats[b][a - 1].environmentDamageDealt);\n                game.players[a].damageTaken.push(game.players[a].damageTaken[b - 1] + stats[b][a - 1].damageTaken - stats[b][a - 1].environmentDamageDealt);\n                game.players[a].playerDamageDealt.push(game.players[a].playerDamageDealt[b - 1] + stats[b][a - 1].overkillDamage);\n                game.players[a].capLosses.push(game.players[a].capLosses[b - 1] + stats[b][a - 1].capLosses);\n            }\n        }\n    }\n\n    //Normalize game statistics for display\n    var maxPlayerTer = 0, maxPlayerProd = 0, maxPlayerStr = 0, maxActProd = 0;\n    var maxPlrDmgDlt = 0, maxEnvDmgDlt = 0, maxDmgTkn = 0, maxCapLoss = 0;\n    for(var a = 1; a <= game.num_players; a++) {\n        for(var b = 0; b < game.num_frames; b++) {\n            if(game.players[a].territories[b] > maxPlayerTer) maxPlayerTer = game.players[a].territories[b];\n            if(game.players[a].productions[b] > maxPlayerProd) maxPlayerProd = game.players[a].productions[b];\n            if(game.players[a].strengths[b] > maxPlayerStr) maxPlayerStr = game.players[a].strengths[b];\n            if(game.players[a].actualProduction[b] > maxActProd) maxActProd = game.players[a].actualProduction[b];\n            if(game.players[a].playerDamageDealt[b] > maxPlrDmgDlt) maxPlrDmgDlt = game.players[a].playerDamageDealt[b];\n            if(game.players[a].environmentDamageDealt[b] > maxEnvDmgDlt) maxEnvDmgDlt = game.players[a].environmentDamageDealt[b];\n            if(game.players[a].damageTaken[b] > maxDmgTkn) maxDmgTkn = game.players[a].damageTaken[b];\n            if(game.players[a].capLosses[b] > maxCapLoss) maxCapLoss = game.players[a].capLosses[b];\n        }\n    }\n    for(var a = 1; a <= game.num_players; a++) {\n        game.players[a].normTers = [];\n        game.players[a].normProds = [];\n        game.players[a].normStrs = [];\n        game.players[a].normActProd = [];\n        game.players[a].normPlrDmgDlt = [];\n        game.players[a].normEnvDmgDlt = [];\n        game.players[a].normDmgTkn = [];\n        game.players[a].normCapLoss = [];\n        for(var b = 0; b < game.num_frames; b++) {\n            game.players[a].normTers.push(game.players[a].territories[b] / maxPlayerTer);\n            game.players[a].normProds.push(game.players[a].productions[b] / maxPlayerProd);\n            game.players[a].normStrs.push(game.players[a].strengths[b] / maxPlayerStr);\n            game.players[a].normActProd.push(game.players[a].actualProduction[b] / maxActProd);\n            game.players[a].normPlrDmgDlt.push(game.players[a].playerDamageDealt[b] / maxPlrDmgDlt);\n            game.players[a].normEnvDmgDlt.push(game.players[a].environmentDamageDealt[b] / maxEnvDmgDlt);\n            game.players[a].normDmgTkn.push(game.players[a].damageTaken[b] / maxDmgTkn);\n            game.players[a].normCapLoss.push(game.players[a].capLosses[b] / maxCapLoss);\n        }\n    }\n\n    var endParse = new Date();\n    console.log(\"Finished parse at\", endParse);\n    console.log(\"Parse took\", (endParse - startParse) / 1000);\n    return game\n}\n"
  },
  {
    "path": "website/script/recent_games.js",
    "content": "$(function() {\n    var gameTable = {\n        $alternateMessage: $(\"#noGameMessage\"),\n        $panel: $(\"#gamePanel\"),\n        $table: $(\"#gameTable\"),\n        $tableBody: $(\"#gameTableBody\"),\n        lastID: 0,\n        init: function() {\n            var games = getGames();\n            games = this.prepGames(games);\n            this.lastID = games[0].gameID;\n\n            var schedCutoff = 0;\n            var lastTime = games[0].date.valueOf();\n            while (schedCutoff < 15 &&\n                    schedCutoff < games.length - 2 &&\n                    lastTime - games[schedCutoff].date.valueOf() < 60000) {\n                schedCutoff += 1;\n            }\n\n            this.render(games.slice(schedCutoff));\n            var delay = 45000;\n            if(schedCutoff > 0) {\n                delay = this.scheduleGames(games.slice(0, schedCutoff));\n            }\n            window.setTimeout(this.loadMore.bind(this), delay);\n        },\n        prepGames: function(games) {\n            games.forEach(function(game) {\n                var dateComponents = game.timestamp.split(/[- :]/);\n                game.date = new Date(Date.UTC(dateComponents[0], dateComponents[1]-1, dateComponents[2], dateComponents[3], dateComponents[4], dateComponents[5]));\n            });\n            for(var a = 0; a < games.length; a++) games[a].users.sort(function(p1, p2) { return parseInt(p1.rank) - parseInt(p2.rank); });\n            return games;\n        },\n        render: function(games) {\n            if(games.length == 0) {\n                this.$alternateMessage.css(\"display\", \"block\");\n                this.$panel.css(\"display\", \"none\");\n            } else {\n                this.$tableBody.empty();\n                for(var a = 0; a < games.length; a++) {\n                    this.$tableBody.append(this.getTableRow(games[a]));\n                }\n            }\n        },\n        getTableRow: function(game) {\n            playersList = game.users.map(function(player) {\n                return \"<a href='user.php?userID=\"+player.userID+\"'><img src='https://avatars1.githubusercontent.com/u/\"+player.oauthID+\"?s=20' style='border-radius: 2px; width: 20px; height: 20px;' title='(\"+player.userRank+\") \"+player.username+\"'></a>\";\n            }).join(\" \");\n\n            var $row = $(\"<tr><td>\"+game.date.toLocaleTimeString()+\"</td><td>\"+playersList+\"</td><td>\"+game.mapWidth+\"x\"+game.mapHeight+\"</td><td><a href='game.php?replay=\"+game.replayName+\"'><span class='glyphicon glyphicon-film'></span></a></td></tr>\");\n            return $row;\n        },\n        insertGame: function(game) {\n            var $newrow = this.getTableRow(game);\n            $newrow.children('td').css({\"padding\": \"0\"}).wrapInner('<div>');\n            $newrow.find(\"td > div\").css({\"padding\": \"8px\"}).hide();\n            $newrow.prependTo(this.$tableBody)\n            $newrow.find(\"td > div\").slideDown(800);\n\n            // Check for and remove games if there are more than 50\n            $gamerows = this.$tableBody.children(\"tr\");\n            for (i = $gamerows.length-1; i > 50; i--) {\n                $gamerows[i].remove();\n            }\n        },\n        scheduleGames: function(games) {\n            var last = games[games.length-1].date;\n            var nextSlot = 0;\n            var timeMultiple = 1;\n            var span = games[0].date.valueOf() - last.valueOf();\n            if(span < 55000) {\n                timeMultiple = 55000 / span;\n            }\n            for (i=games.length-1; i>=0; i--) {\n                var igFunc = this.insertGame.bind(this);\n                function igFactory(game) {\n                    return function() {\n                        igFunc(game);\n                    }\n                }\n                var callback = igFactory(games[i]);\n                var delay = (games[i].date.valueOf() - last.valueOf()) * timeMultiple;\n                delay = Math.max(delay, nextSlot);\n                nextSlot = delay + 2000;\n                window.setTimeout(callback, delay);\n            }\n            console.log(\"Scheduled \"+games.length+\" games for display in \"+delay/1000);\n            return delay;\n        },\n        loadMore: function() {\n            var newgames = getGames(this.lastID);\n            if(newgames.length == 0) {\n                console.log(\"No more games available.\");\n                window.setTimeout(this.loadMore.bind(this), 60000);\n                return\n            }\n            newgames = this.prepGames(newgames);\n            var nextGet = this.scheduleGames(newgames);\n            nextGet = Math.max(nextGet, 60000);\n            this.lastID = newgames[0].gameID;\n\n            console.log(\"Next get in \"+nextGet/1000);\n            window.setTimeout(this.loadMore.bind(this), nextGet);\n        }\n    }\n\n    gameTable.init();\n})\n"
  },
  {
    "path": "website/script/status.js",
    "content": "$(function() {\n    var statTable = {\n        $tableBody: $(\"#statTableBody\"),\n        init: function(stats) {\n            this.stats = stats;\n            this.render();\n        },\n        render: function() {\n            this.$tableBody.empty();\n            for(var a = 0; a < this.stats.length; a++) {\n                this.$tableBody.append(this.getTableRow(this.stats[a]));\n            }\n\n        },\n        getTableRow: function(stat) {\n            return \"<tr><td>\"+stat.name+\"</td><td>\"+stat.value+\"</td></tr>\";    \n        }\n    };\n\n    var workerTable = {\n        $tableBody: $(\"#workerTableBody\"),\n        init: function(workers) {\n            this.workers = workers;\n            this.render();\n        },\n        render: function() {\n            this.$tableBody.empty();\n            for(var a = 0; a < this.workers.length; a++) {\n                this.$tableBody.append(this.getTableRow(this.workers[a]));\n            }\n\n        },\n        getTableRow: function(worker) {\n            console.log(worker.lastRequestTime);\n            var dateComponents = worker.lastRequestTime.split(/[- :]/);\n            var lastRequestDate = new Date(Date.UTC(dateComponents[0], dateComponents[1]-1, dateComponents[2], dateComponents[3], dateComponents[4], dateComponents[5]));\n            var timeSinceCommunication = Math.round(100*((new Date() - lastRequestDate) / (1000*60))) / 100;\n            return \"<tr><td>\"+worker.workerID+\"</td><td>\"+timeSinceCommunication+\" min</td></tr>\";  \n        }\n    };\n    workerTable.init(getWorkers());\n\n    var throughput = getThroughput();\n    var users = getNumActiveUsers();\n    var averageUsersPerGame = 4;\n    var medians = getScoreMedians();\n    medians[\"mu\"] = Math.round(100*medians[\"mu\"])/100;\n    medians[\"sigma\"] = Math.round(100*medians[\"sigma\"])/100;\n    statTable.init([\n        {name: \"Throughput\", value: throughput},\n        {name: \"Estimated time/game/user (Avg users/game = 4)\", value: ((24*60*users)/(throughput*averageUsersPerGame)).toFixed(2) + \" min\"},\n        {name: \"Active Users\", value: getNumActiveUsers()},\n        {name: \"Total Submissions\", value: getNumSubmissions()},\n        {name: \"Median mu (sigma)\", value: medians[\"mu\"]+\" (\"+medians[\"sigma\"]+\")\"}\n    ]);\n})\n"
  },
  {
    "path": "website/script/user.js",
    "content": "$(function() {\n    var profileCard = {\n        $profileImage: $(\"#profileImage\"),\n        $name: $(\"#name\"),\n        $primaryInfo: $(\"#primaryInfo\"), $secondaryInfo: $(\"#secondaryInfo\"), init: function(user) {\n            this.user = user;\n\n            this.render();\n        },\n        render: function() {\n            var mu = Math.round(this.user.mu*100)/100;\n            var sigma = Math.round(this.user.sigma*100)/100;\n            var score = Math.round((this.user.mu-(3*this.user.sigma))*100)/100;\n\n            var vr = \"<span style='color: #0092a1;'>|</span>\";\n            this.$profileImage.attr(\"src\", \"https://avatars.githubusercontent.com/u/\"+this.user[\"oauthID\"]);\n            this.$name.html(\"<a href='https://github.com/\" + this.user['username'] + \"'>\" + this.user['username'] + \"</a>\");\n\n            this.$primaryInfo.append(\"<a href='leaderboard.php?userID=\"+this.user[\"userID\"]+\"'>Rank \" + this.user['rank']+\"</a>\");\n            this.$primaryInfo.append(\"<br>\");\n            this.$primaryInfo.append(\"<span>\" + this.user['tier'] + \" Tier</span>\");\n            this.$primaryInfo.append(\"<br>\");\n            this.$primaryInfo.append(\"<span title='mu: \"+ mu +\" sigma: \"+ sigma +\"'>\"+ score +\" points</span>\");\n\n            this.$secondaryInfo.append($(\"<span>Made in <a href='leaderboard.php?field=language&heading=\"+encodeURIComponent(this.user['language'])+\"&value=\"+encodeURIComponent(this.user['language'])+\"'>\"+this.user['language']+ \"</a></span>\"));\n            this.$secondaryInfo.append($(\"<br>\"));\n            this.$secondaryInfo.append($(\"<span>At <a href='leaderboard.php?field=level&heading=\"+encodeURIComponent(this.user['level'])+\"&value=\"+encodeURIComponent(this.user['level'])+\"'>\"+this.user['level']+ \"</a> level</span>\"));\n            this.$secondaryInfo.append($(\"<br>\"));\n            if(this.user['organization'] != 'Other') {\n                this.$secondaryInfo.append($(\"<span>Member of <a href='leaderboard.php?field=organization&heading=\"+encodeURIComponent(this.user['organization'])+\"&value=\"+encodeURIComponent(this.user['organization'])+\"'>\"+this.user['organization']+ \"</a></span>\"));\n                this.$secondaryInfo.append($(\"<br>\"));\n            } \n            this.$secondaryInfo.append($(\"<span>\"+this.user['numSubmissions']+\" \"+(parseInt(this.user['numSubmissions']) == 1 ? \"bot\" : \"bots\")+\" submitted</span>\"));\n            this.$secondaryInfo.append($(\"<br>\"));\n            this.$secondaryInfo.append($(\"<span>\"+this.user['numGames']+\" games played</span>\"));\n        }\n    };\n\n    var historyTable = {\n        $panel: $(\"#historyPanel\"),\n        $tableBody: $(\"#historyTableBody\"),\n        init: function(name, histories) {\n            this.name = name;\n            this.histories = histories;\n            this.render();\n        },\n        render: function() {\n            if(this.histories.length == 0) {\n                this.$panel.css(\"display\", \"none\"); \n            } else {\n                this.$panel.css(\"display\", \"block\");    \n                this.$tableBody.empty();\n                for(var a = 0; a < Math.min(5, this.histories.length); a++) {\n                    this.$tableBody.append(this.getTableRow(this.histories[a]));\n                }\n            }\n        },\n        getTableRow: function(history) {\n            return \"<tr><td>\"+this.name+\" v\"+history.versionNumber+\"</td><td>\"+history.lastRank+\" of \"+history.lastNumPlayers+\"</td><td>\"+(history.lastNumGames != null ? history.lastNumGames : \"Not Recorded\")+\"</td></tr>\";\n        }\n    }\n\n    var notifsTable = {\n        $panel: $(\"#notifsPanel\"),\n        $tableBody: $(\"#notifsTableBody\"),\n        modal: {\n            $modal: $(\"#notifModal\"),\n            $title: $(\"#notifModalHeader\"),\n            $body: $(\"#notifModalBody\"),\n            init: function(title, body) {\n                this.title = title;\n                this.body = body;\n\n                this.render();\n            },\n            render: function() {\n                this.$title.html(\"<h3>\"+this.title+\"</h3>\");\n                this.$body.html(this.body);\n            },\n            show: function() {\n                this.$modal.modal(\"show\");\n            }\n        },\n        show: function() {\n            this.$panel.attr(\"display\", \"block\");\n        },\n        init: function(notifs) {\n            this.name = name;\n            this.notifs = notifs;\n            this.render();\n        },\n        render: function() {\n            if(this.notifs.length == 0) {\n                this.$panel.css(\"display\", \"none\"); \n            } else {\n                this.$panel.css(\"display\", \"block\");    \n                this.$tableBody.empty();\n                for(var a = 0; a < Math.min(10, this.notifs.length); a++) {\n                    this.$tableBody.append(this.getTableRow(this.notifs[a]));\n                }\n            }\n        },\n        getTableRow: function(notif) {\n            var titleColor = null;\n            if(parseInt(notif.mood) == -1) titleColor = \"#d9534f\";\n            if(parseInt(notif.mood) == 0) titleColor = \"#5bc0de\";\n            if(parseInt(notif.mood) == 1) titleColor = \"#5cb85c\";\n\n            $title = $(\"<td><b>\"+notif.title+\"</b></td>\");\n            $title.css(\"color\", titleColor);\n\n            var dateComponents = notif.creationTime.split(/[- :]/);\n            var gameDate = new Date(Date.UTC(dateComponents[0], dateComponents[1]-1, dateComponents[2], dateComponents[3], dateComponents[4], dateComponents[5]));\n            var dateString = gameDate.toLocaleString();\n\n            $row = $(\"<tr></tr>\");\n            $row.append($title);\n            $row.append(\"<td>\"+dateString+\"</td>\");\n            $row.css(\"cursor\", \"pointer\");\n            $row.click(this, this.notifClicked.bind(this, notif));\n\n            return $row;\n        },\n        notifClicked: function(notif) {\n            console.log(this);\n            this.modal.init(notif.title, notif.body);\n            this.modal.show();\n        }\n    }\n\n    var statTable = {\n        $tableBody: $(\"#statTableBody\"),\n        stats: [],\n        init: function(stats) {\n            this.stats = stats;\n            this.render();\n        },\n        render: function() {\n            this.$tableBody.empty();\n            for(var a = 0; a < this.stats.length; a++) {\n                this.$tableBody.append(this.getTableRow(this.stats[a]));\n            }\n        },\n        getTableRow: function(stat) {\n            if(stat.mouseOverText != undefined && stat.mouseOverText != null) {\n                return \"<tr><td><span title='\"+stat.mouseOverText+\"' class='has-hover-text'>\"+stat.name+\"</span></td><td><span title='\"+stat.mouseOverText+\"' class='has-hover-text'>\"+stat.value+\"</span></td></tr>\";\n            } else {\n                return \"<tr><td><span>\"+stat.name+\"</span></td><td>\"+stat.value+\"</td></tr>\";\n            }\n        }\n    }\n\n    var gameTable = {\n        $alternateMessage: $(\"#noGameMessage\"),\n        $panel: $(\"#gamePanel\"),\n        $table: $(\"#gameTable\"),\n        $tableHeader: $(\"#gameTableHeader\"),\n        $tableBody: $(\"#gameTableBody\"),\n        $loadButton: $(\"#loadButton\"),\n        games: [],\n        init: function(userID, isMe, getNextGames) {\n            this.userID = userID;\n            this.getNextGames = getNextGames;\n            this.isMe = isMe;\n\n            this.games = getNextGames(this.userID);\n            for(var a = 0; a < this.games.length; a++) this.games[a].users.sort(function(p1, p2) { return parseInt(p1.rank) - parseInt(p2.rank); });\n\n            this.$loadButton.click(this, this.loadMore.bind(this));         \n\n            this.render();\n        },\n        render: function() {\n            if(this.games.length == 0) {\n                this.$alternateMessage.css(\"display\", \"block\");\n                this.$panel.css(\"display\", \"none\");\n            } else {\n                this.$tableHeader.html(\"<th>Time</th><th>Opponents</th><th>Result</th><th>Dimensions</th><th>View</th>\");\n                this.$tableBody.empty();\n                for(var a = 0; a < this.games.length; a++) {\n                    this.$tableBody.append(this.getTableRow(this.games[a]));\n                }\n            }\n        },\n        getTableRow: function(game) {\n            var userID = this.userID;\n\n            playersList = game.users.filter(function(player) {\n                return player.userID != userID;\n            }).map(function(player) {\n                return \"<a href='user.php?userID=\"+player.userID+\"'><img src='https://avatars1.githubusercontent.com/u/\"+player.oauthID+\"?s=20' style='border-radius: 2px; width: 20px; height: 20px;' title='(\"+player.userRank+\") \"+player.username+\"'></a>\";\n            }).join(\" \");\n\n            var thisUser = game.users.find(function(p){return parseInt(p.userID)==userID;});\n            var result = thisUser.rank + \" of \" + game.users.length;\n\n            var dateComponents = game.timestamp.split(/[- :]/);\n            var gameDate = new Date(Date.UTC(dateComponents[0], dateComponents[1]-1, dateComponents[2], dateComponents[3], dateComponents[4], dateComponents[5]));\n\n            var me = null;\n            var numErrors = 0;\n            for(var a = 0; a < game.users.length; a++) {\n                var u = game.users[a];\n                if(u.userID == this.userID) {\n                    me = u;\n                }\n                if(u.errorLogName != undefined && u.errorLogName != null){\n                    numErrors += 1;\n                }\n            }\n            var errorMsg = \"\";\n            if(me.errorLogName != undefined && me.errorLogName != null) {\n                var tooltip = \"Ended game with an error\";\n                if(numErrors > 1) {\n                    tooltip = \"This bot and \"+(numErrors - 1)+\" other\";\n                    if(numErrors > 2) { tooltip += \"s\"; }\n                    tooltip += \" errored out\";\n                }\n                if(this.isMe) {\n                    errorMsg = \"<a target='_blank' href='\"+url+\"errorLog?errorLogName=\"+me.errorLogName+\"'><span class='glyphicon glyphicon-save-file' title='\"+tooltip+\"'></span></a>\";\n                } else {\n                    errorMsg = \"<span class='glyphicon glyphicon-exclamation-sign' title='\"+tooltip+\"'></span>\";\n                }\n            } else if(numErrors == 1) {\n                errorMsg = \"<span class='glyphicon glyphicon-asterisk' title='One opponent errored out.'></span>\";\n            } else if(numErrors > 1) {\n                errorMsg = \"<span class='glyphicon glyphicon-asterisk' title='\"+numErrors+\" opponents errored out.'></span>\";\n            }\n            var $row = $(\"<tr><td>\"+gameDate.toLocaleTimeString()+\"</td><td>\"+playersList+\"</td><td>\"+result+\" \"+errorMsg+\"</td><td>\"+game.mapWidth+\"x\"+game.mapHeight+\"</td><td><a href='game.php?replay=\"+game.replayName+\"'><span class='glyphicon glyphicon-film'></span></a></td></tr>\");\n            return $row;\n        },\n        loadMore: function() {\n            this.games = this.games.concat(this.getNextGames(this.userID, this.games[this.games.length-1].gameID));\n            this.render();\n        }\n    }\n\n    var userIDGET = getGET(\"userID\");\n    if(userIDGET != null || (session = getSession())) {\n        var isMe = (userIDGET == null || userIDGET == undefined);\n        var user = isMe ? getUser(session['userID']) : getUser(userIDGET);\n        user[\"username\"] = escapeHtml(filterXSS(user[\"username\"]));\n        user[\"language\"] = escapeHtml(filterXSS(user[\"language\"]));\n\n        if(user['isRunning'] == 0) {\n            $(\"#normalBody\").css(\"display\", \"none\");\n            $(\"#noBotMessage\").css(\"display\", \"block\");\n        } else {\n            $(document).prop('title', user[\"username\"]);\n\n            profileCard.init(user);\n            gameTable.init(parseInt(user[\"userID\"]), isMe, function(userID, startingID) {\n                var rawGames = getLatestGamesForUser(userID, 5, startingID); \n                var games = [];\n                for(var a = 0; a < rawGames.length; a++) {\n                    games.push(rawGames[a]);\n                }\n                return games;\n            });\n            historyTable.init(user.username, getHistories(user[\"userID\"]));\n\n            if(isMe) {\n                notifsTable.init(getNotifications(user[\"userID\"]));\n                notifsTable.show();\n            }\n        }\n    } else {\n        $(\"#normalBody\").css(\"display\", \"none\");\n        $(\"#loginMessage\").css(\"display\", \"block\");\n    }\n})\n"
  },
  {
    "path": "website/script/visualizer.js",
    "content": "var renderer;\nfunction initPixi() {\n    //Create the root of the scene: stage:\n    stage = new PIXI.Container();\n\n    // Initialize the pixi graphics class for the map:\n    mapGraphics = new PIXI.Graphics();\n\n    // Initialize the pixi graphics class for the graphs:\n    graphGraphics = new PIXI.Graphics();\n\n    renderer = PIXI.autoDetectRenderer(0, 0, { backgroundColor: 0x000000, antialias: true, transparent: true });\n}\n\nfunction showGame(game, $container, maxWidth, maxHeight, showmovement, isminimal, offline, seconds) {\n    if(renderer == null) initPixi();\n\n    $container.empty();\n\n    if(!isminimal) {\n        var $row = $(\"<div class='row'></div>\");\n        $row.append($(\"<div class='col-md-1'></div>\"));\n        $row.append($(\"<div class='col-md-10'></div>\").append($(\"<h3 style='margin-top: 0px;'>\"+game.players.slice(1, game.num_players+1).map(function(p) {\n            var nameComponents = p.name.split(\" \");\n            var name = nameComponents.slice(0, nameComponents.length-1).join(\" \").trim();\n            console.log(name);\n            var user = offline ? null : getUser(null, name);\n            if(user) {\n                return \"<a href='user.php?userID=\"+user.userID+\"' style='color: #\"+p.color.slice(2, p.color.length)+\";'>\"+p.name+\"</a>\"\n            } else {\n                return \"<span style='color: #\"+p.color.slice(2, p.color.length)+\";'>\"+filterXSS(p.name)+\"</span>\"\n            }\n        }).join(\" vs \")+\"</h3>\")));\n        $row.append($(\"<div class='col-md-1' style='text-align: left;'><button type='button' class='btn btn-sm btn-default pull-right' data-toggle='modal' data-target='#myModal'><span class='glyphicon glyphicon-info-sign'></span></button> <div id='myModal' class='modal fade' role='dialog'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal'>&times;</button> <h4 class='modal-title'>Using the Visualizer</h4> </div><div class='modal-body'> <p><ul><li>Space pauses and plays.</li><li>Left and Right arrows navigate through the game.</li><li>Up and Down arrows change the speed of playback, as do the digits keys 1-5.</li><li>Plus (+) and Minus (-) zoom in and out on the graphs.</li><li>Z and X jump to the beginning and end of the game.</li><li>P shows the production heatmap onscreen.</li><li>E toggles the display of extra information.</li><li>W, A, S, and D pan the view around the map. O recenters the origin.</li><li>Comma and Period (< and >) navigate through the game by a single frame.</li><li>One can also click on the graphs to navigate through the game.</li></ul></p></div></div></div></div></div>\"));\n        $container.append($row);\n    }\n    $container.append(renderer.view);\n    $container.append($(\"<br>\"));\n\n    var showExtended = false;\n    var frame = 0;\n    var transit = 0;\n    var framespersec = seconds == null ? 3 : game.num_frames / seconds;\n    var shouldplay = true;\n    var xOffset = 0, yOffset = 0;\n    var zoom = 8;\n    if(game.num_frames / zoom < 3) zoom = game.num_frames / 3;\n    if(zoom < 1) zoom = 1;\n    function centerStartPositions() {\n        var minX = game.width, maxX = 0, minY = game.height, maxY = 0;\n        // find the initial bounding box of all players\n        for(var x=0; x < game.width; x++) {\n            for(var y=0; y < game.height; y++) {\n                if(game.frames[0][y][x].owner != 0) {\n                    if(x < minX) { minX = x; }\n                    if(x > maxX) { maxX = x; }\n                    if(y < minY) { minY = y; }\n                    if(y > maxY) { maxY = y; }\n                }\n            }\n        }\n        // offset by half the difference from the edges rounded toward zero\n        xOffset = ((game.width - 1 - maxX - minX) / 2) | 0;\n        yOffset = ((game.height - 1 - maxY - minY) / 2) | 0;\n    }\n    centerStartPositions();\n\n    window.onresize = function() {\n        var allowedWidth = (maxWidth == null ? $container.width() : maxWidth);\n        var allowedHeight = window.innerHeight - (25 + $(\"canvas\").offset().top);\n        if(maxHeight != null) {\n            if(maxHeight > 0) {\n                allowedHeight = maxHeight - ($(\"canvas\").offset().top - $container.offset().top);\n            } else {\n                // A negative maxHeight signifies extra space to leave for\n                // other page elements following the visualizer\n                allowedHeight += maxHeight;\n            }\n        }\n\n        console.log(window.innerHeight)\n        console.log(allowedHeight)\n        var definingDimension = Math.min(allowedWidth, allowedHeight);\n        if(isminimal) {\n            if(allowedWidth < allowedHeight) {\n                sw = allowedWidth, sh = allowedWidth;\n            } else {\n                sw = allowedHeight, sh = allowedHeight;\n            }\n            mw = sh, mh = sh;\n            renderer.resize(sw, sh);\n            rw = mw / game.width, rh = mh / game.height; //Sizes of rectangles for rendering tiles.\n        }\n        else {\n            var splits = showExtended ? 5 : 4;\n            if(allowedWidth < allowedHeight*splits/3) {\n                sw = allowedWidth, sh = allowedWidth*3/splits;\n            } else {\n                sw = allowedHeight*splits/3, sh = allowedHeight;\n            }\n            mw = sh, mh = sh;\n            renderer.resize(sw, sh);\n            rw = mw / game.width, rh = mh / game.height; //Sizes of rectangles for rendering tiles.\n            if(showExtended) {\n                LEFT_GRAPH_LEFT = mw * 1.025, LEFT_GRAPH_RIGHT = LEFT_GRAPH_LEFT + sw * 0.17;\n            } else {\n                LEFT_GRAPH_LEFT = mw * 1.025, LEFT_GRAPH_RIGHT = sw - 1;\n            }\n            RIGHT_GRAPH_LEFT = mw * 1.35, RIGHT_GRAPH_RIGHT = RIGHT_GRAPH_LEFT + sw * 0.17;\n\n            if(showExtended) {\n                TER_TOP = sh * 0.09, TER_BTM = sh * 0.29;\n                PROD_TOP = sh * 0.33, PROD_BTM = sh * 0.53;\n                STR_TOP = sh * 0.57, STR_BTM = sh * 0.77;\n            } else {\n                TER_TOP = sh * 0.09, TER_BTM = sh * 0.36;\n                PROD_TOP = sh * 0.41, PROD_BTM = sh * 0.675;\n                STR_TOP = sh * 0.725, STR_BTM = sh * 0.99;\n            }\n\n            ENV_DMG_TOP = sh * 0.09, ENV_DMG_BTM = sh * 0.29;\n            ACT_PROD_TOP = sh * 0.33, ACT_PROD_BTM = sh * 0.53;\n            CAP_LOSS_TOP = sh * 0.57, CAP_LOSS_BTM = sh * 0.77;\n\n            PLR_DMG_TOP = sh * 0.81, PLR_DMG_BTM = sh * 0.99;\n            DMG_TKN_TOP = sh * 0.81, DMG_TKN_BTM = sh * 0.99;\n\n            //Create the text for rendering the terrritory, strength, and prod graphs.\n            stage.removeChildren();\n            terText = new PIXI.Text('Territory', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n            terText.anchor = new PIXI.Point(0, 1);\n            terText.position = new PIXI.Point(mw + sh / 32, TER_TOP - sh * 0.005);\n            stage.addChild(terText);\n            prodText = new PIXI.Text('Production', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n            prodText.anchor = new PIXI.Point(0, 1);\n            prodText.position = new PIXI.Point(mw + sh / 32, PROD_TOP - sh * 0.005);\n            stage.addChild(prodText);\n            strText = new PIXI.Text('Strength', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n            strText.anchor = new PIXI.Point(0, 1);\n            strText.position = new PIXI.Point(mw + sh / 32, STR_TOP - sh * 0.005);\n            stage.addChild(strText);\n            if(showExtended) {\n                envDmgText = new PIXI.Text('Environment Damage', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n                envDmgText.anchor = new PIXI.Point(0, 1);\n                envDmgText.position = new PIXI.Point(mw + sh / 2.75, ENV_DMG_TOP - sh * 0.005);\n                stage.addChild(envDmgText);\n                actProdText = new PIXI.Text('Realized Production', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n                actProdText.anchor = new PIXI.Point(0, 1);\n                actProdText.position = new PIXI.Point(mw + sh / 2.75, ACT_PROD_TOP - sh * 0.005);\n                stage.addChild(actProdText);\n                capLossText = new PIXI.Text('Strength Loss to Cap', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n                capLossText.anchor = new PIXI.Point(0, 1);\n                capLossText.position = new PIXI.Point(mw + sh / 2.75, CAP_LOSS_TOP - sh * 0.005);\n                stage.addChild(capLossText);\n                plrDmgDltText = new PIXI.Text('Overkill Damage', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n                plrDmgDltText.anchor = new PIXI.Point(0, 1);\n                plrDmgDltText.position = new PIXI.Point(mw + sh / 32, PLR_DMG_TOP - sh * 0.005);\n                stage.addChild(plrDmgDltText);\n                dmgTknText = new PIXI.Text('Damage Taken', { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n                dmgTknText.anchor = new PIXI.Point(0, 1);\n                dmgTknText.position = new PIXI.Point(mw + sh / 2.75, DMG_TKN_TOP - sh * 0.005);\n                stage.addChild(dmgTknText);\n            }\n            infoText = new PIXI.Text('Frame #' + frame.toString(), { font: (sh / 38).toString() + 'px Arial', fill: 0xffffff });\n            infoText.anchor = new PIXI.Point(0, 1);\n            infoText.position = new PIXI.Point(mw + sh / 32, TER_TOP - sh * 0.05);\n            stage.addChild(infoText);\n            stage.addChild(graphGraphics);\n        }\n        stage.addChild(mapGraphics);\n        console.log(renderer.width, renderer.height);\n    }\n    window.onresize();\n\n    var manager = new PIXI.interaction.InteractionManager(renderer);\n    var mousePressed = false;\n    document.onmousedown = function(e) {\n        mousePressed = true;\n    };\n    document.onmouseup = function(e) {\n        mousePressed = false;\n    };\n\n    renderer.animateFunction = animate;\n    requestAnimationFrame(animate);\n\n    var pressed={};\n    document.onkeydown=function(e){\n        e = e || window.event;\n        pressed[e.keyCode] = true;\n        if(e.keyCode == 32) { //Space\n            shouldplay = !shouldplay;\n        }\n        else if(e.keyCode == 69) { //e\n            showExtended = !showExtended;\n            mapGraphics.clear();\n            graphGraphics.clear();\n            renderer.render(stage);\n            window.onresize();\n        }\n        else if(e.keyCode == 90) { //z\n            frame = 0;\n            transit = 0;\n        }\n        else if(e.keyCode == 88) { //x\n            frame = game.num_frames - 1;\n            transit = 0;\n        }\n        else if(e.keyCode == 188) { //,\n            if(transit == 0) frame--;\n            else transit = 0;\n            if(frame < 0) frame = 0;\n            shouldplay = false;\n        }\n        else if(e.keyCode == 190) { //.\n            frame++;\n            transit = 0;\n            if(frame >= game.num_frames - 1) frame = game.num_frames - 1;\n            shouldplay = false;\n        }\n        else if(e.keyCode == 65 || e.keyCode == 68 || e.keyCode == 87 || e.keyCode == 83) { //wasd\n            xOffset = Math.round(xOffset);\n            yOffset = Math.round(yOffset);\n        }\n        else if(e.keyCode == 79) { //o\n            xOffset = 0;\n            yOffset = 0;\n        }\n        else if(e.keyCode == 187 || e.keyCode == 107) { //= or +\n            zoom *= 1.41421356237;\n            if(game.num_frames / zoom < 3) zoom = game.num_frames / 3;\n        }\n        else if(e.keyCode == 189 || e.keyCode == 109) { //- or - (dash or subtract)\n            zoom /= 1.41421356237;\n            if(zoom < 1) zoom = 1;\n        }\n        else if(e.keyCode == 49) { //1\n            framespersec = 1;\n        }\n        else if(e.keyCode == 50) { //2\n            framespersec = 3;\n        }\n        else if(e.keyCode == 51) { //3\n            framespersec = 6;\n        }\n        else if(e.keyCode == 52) { //4\n            framespersec = 10;\n        }\n        else if(e.keyCode == 53) { //5\n            framespersec = 15;\n        }\n    }\n\n    document.onkeyup=function(e){\n         e = e || window.event;\n         delete pressed[e.keyCode];\n    }\n\n    var lastTime = Date.now();\n\n    function interpolate(c1, c2, v) {\n        var c = { r: v * c2.r + (1 - v) * c1.r, g: v * c2.g + (1 - v) * c1.g, b: v * c2.b + (1- v) * c1.b };\n        function compToHex(c) { var hex = c.toString(16); return hex.length == 1 ? \"0\" + hex : hex; };\n        return \"0x\" + compToHex(Math.round(c.r)) + compToHex(Math.round(c.g)) + compToHex(Math.round(c.b));\n    }\n\n    function animate() {\n\n        if(renderer.animateFunction !== animate) { return; }\n\n        if(!isminimal) {\n            //Clear graphGraphics so that we can redraw freely.\n            graphGraphics.clear();\n\n            //Draw the graphs.\n            var nf = Math.round(game.num_frames / zoom), graphMidFrame = frame;\n            var nf2 = Math.floor(nf / 2);\n            if(graphMidFrame + nf2 >= game.num_frames) graphMidFrame -= ((nf2 + graphMidFrame) - game.num_frames);\n            else if(Math.ceil(graphMidFrame - nf2) < 0) graphMidFrame = nf2;\n            var firstFrame = graphMidFrame - nf2, lastFrame = graphMidFrame + nf2;\n            if(firstFrame < 0) firstFrame = 0;\n            if(lastFrame >= game.num_frames) lastFrame = game.num_frames - 1;\n            nf = lastFrame - firstFrame;\n            var dw = (LEFT_GRAPH_RIGHT - LEFT_GRAPH_LEFT) / (nf);\n            //Normalize values with respect to the range of frames seen by the graph.\n            var maxTer = 0, maxProd = 0, maxStr = 0, maxActProd = 0;\n            var maxPlrDmgDlt = 0, maxEnvDmgDlt = 0, maxDmgTkn = 0, maxCapLoss = 0;\n            for(var a = 1; a <= game.num_players; a++) {\n                for(var b = firstFrame; b <= lastFrame; b++) {\n                    if(game.players[a].territories[b] > maxTer) maxTer = game.players[a].territories[b] * 1.01;\n                    if(game.players[a].productions[b] > maxProd) maxProd = game.players[a].productions[b] * 1.01;\n                    if(game.players[a].strengths[b] > maxStr) maxStr = game.players[a].strengths[b] * 1.01;\n                    if(game.players[a].actualProduction[b] > maxActProd) maxActProd = game.players[a].actualProduction[b] * 1.01;\n                    if(game.players[a].playerDamageDealt[b] > maxPlrDmgDlt) maxPlrDmgDlt = game.players[a].playerDamageDealt[b] * 1.01;\n                    if(game.players[a].environmentDamageDealt[b] > maxEnvDmgDlt) maxEnvDmgDlt = game.players[a].environmentDamageDealt[b] * 1.01;\n                    if(game.players[a].damageTaken[b] > maxDmgTkn) maxDmgTkn = game.players[a].damageTaken[b] * 1.01;\n                    if(game.players[a].capLosses[b] > maxCapLoss) maxCapLoss = game.players[a].capLosses[b] * 1.01;\n                }\n            }\n            function drawGraph(left, top, bottom, data, maxData) {\n                graphGraphics.moveTo(left, (top - bottom) * data[firstFrame] / maxData + bottom);\n                for(var b = firstFrame + 1; b <= lastFrame; b++) {\n                    graphGraphics.lineTo(left + dw * (b - firstFrame), (top - bottom) * data[b] / maxData + bottom);\n                }\n            }\n            for(var a = 1; a <= game.num_players; a++) {\n                graphGraphics.lineStyle(1, game.players[a].color);\n                //Draw ter graph.\n                drawGraph(LEFT_GRAPH_LEFT, TER_TOP, TER_BTM, game.players[a].territories, maxTer);\n                //Draw prod graph.\n                drawGraph(LEFT_GRAPH_LEFT, PROD_TOP, PROD_BTM, game.players[a].productions, maxProd);\n                //Draw str graph.\n                drawGraph(LEFT_GRAPH_LEFT, STR_TOP, STR_BTM, game.players[a].strengths, maxStr);\n                if(showExtended) {\n                    //Draw env dmg graph.\n                    drawGraph(RIGHT_GRAPH_LEFT, ENV_DMG_TOP, ENV_DMG_BTM, game.players[a].environmentDamageDealt, maxEnvDmgDlt);\n                    //Draw act prod graph.\n                    drawGraph(RIGHT_GRAPH_LEFT, ACT_PROD_TOP, ACT_PROD_BTM, game.players[a].actualProduction, maxActProd);\n                    //Draw str loss graph.\n                    drawGraph(RIGHT_GRAPH_LEFT, CAP_LOSS_TOP, CAP_LOSS_BTM, game.players[a].capLosses, maxCapLoss);\n                    //Draw plr dmg dealt.\n                    drawGraph(LEFT_GRAPH_LEFT, PLR_DMG_TOP, PLR_DMG_BTM, game.players[a].playerDamageDealt, maxPlrDmgDlt);\n                    //Draw damage taken.\n                    drawGraph(RIGHT_GRAPH_LEFT, DMG_TKN_TOP, DMG_TKN_BTM, game.players[a].damageTaken, maxDmgTkn);\n                }\n            }\n            //Draw borders.\n            graphGraphics.lineStyle(1, '0xffffff');\n            function drawGraphBorder(left, right, top, bottom) {\n                graphGraphics.moveTo(left + dw * (frame - firstFrame), top);\n                graphGraphics.lineTo(left + dw * (frame - firstFrame), bottom);\n                if((frame - firstFrame) > 0) graphGraphics.lineTo(left, bottom); //Deals with odd disappearing line.;\n                graphGraphics.lineTo(left, top);\n                graphGraphics.lineTo(right, top);\n                graphGraphics.lineTo(right, bottom);\n                graphGraphics.lineTo(left + dw * (frame - firstFrame), bottom);\n            }\n\n            //Draw ter border.\n            drawGraphBorder(LEFT_GRAPH_LEFT, LEFT_GRAPH_RIGHT, TER_TOP, TER_BTM);\n            //Draw prod border.\n            drawGraphBorder(LEFT_GRAPH_LEFT, LEFT_GRAPH_RIGHT, PROD_TOP, PROD_BTM);\n            //Draw str border.\n            drawGraphBorder(LEFT_GRAPH_LEFT, LEFT_GRAPH_RIGHT, STR_TOP, STR_BTM);\n            if(showExtended) {\n                //Draw env dmg border.\n                drawGraphBorder(RIGHT_GRAPH_LEFT, RIGHT_GRAPH_RIGHT, ENV_DMG_TOP, ENV_DMG_BTM);\n                //Draw act prod border.\n                drawGraphBorder(RIGHT_GRAPH_LEFT, RIGHT_GRAPH_RIGHT, ACT_PROD_TOP, ACT_PROD_BTM);\n                //Draw str loss border.\n                drawGraphBorder(RIGHT_GRAPH_LEFT, RIGHT_GRAPH_RIGHT, CAP_LOSS_TOP, CAP_LOSS_BTM);\n                //Draw plr damage dealt.\n                drawGraphBorder(LEFT_GRAPH_LEFT, LEFT_GRAPH_RIGHT, PLR_DMG_TOP, PLR_DMG_BTM);\n                //Draw plr damage taken.\n                drawGraphBorder(RIGHT_GRAPH_LEFT, RIGHT_GRAPH_RIGHT, DMG_TKN_TOP, DMG_TKN_BTM);\n            }\n            //Draw frame/ter text seperator.\n            graphGraphics.moveTo(LEFT_GRAPH_LEFT, TER_TOP - sh * 0.045);\n            graphGraphics.lineTo(RIGHT_GRAPH_RIGHT, TER_TOP - sh * 0.045);\n        }\n\n        //Clear mapGraphics so that we can redraw freely.\n        mapGraphics.clear();\n\n        if(pressed[80]) { //Render productions. Don't update frames or transits. [Using p now for testing]\n            var loc = 0;\n            var pY = Math.round(yOffset);\n            for(var a = 0; a < game.height; a++) {\n                var pX = Math.round(xOffset);\n                for(var b = 0; b < game.width; b++) {\n                    if(game.productionNormals[Math.floor(loc / game.width)][loc % game.width] < 0.33333) mapGraphics.beginFill(interpolate({ r: 40, g: 40, b: 40 }, { r: 128, g: 80, b: 144 }, game.productionNormals[Math.floor(loc / game.width)][loc % game.width] * 3));\n                    else if(game.productionNormals[Math.floor(loc / game.width)][loc % game.width] < 0.66667) mapGraphics.beginFill(interpolate({ r: 128, g: 80, b: 144 }, { r: 176, g: 48, b: 48 }, game.productionNormals[Math.floor(loc / game.width)][loc % game.width] * 3 - 1));\n                    else mapGraphics.beginFill(interpolate({ r: 176, g: 48, b: 48 }, { r: 255, g: 240, b: 16 }, game.productionNormals[Math.floor(loc / game.width)][loc % game.width] * 3 - 2));\n                    mapGraphics.drawRect(rw * pX, rh * pY, rw, rh);\n                    mapGraphics.endFill();\n                    loc++;\n                    pX++;\n                    if(pX == game.width) pX = 0;\n                }\n                pY++;\n                if(pY == game.height) pY = 0;\n            }\n        }\n        else { //Render game and update frames and transits.\n            var loc = 0;\n            var tY = Math.round(yOffset);\n            for(var a = 0; a < game.height; a++) {\n                var tX = Math.round(xOffset);\n                for(var b = 0; b < game.width; b++) {\n                    var site = game.frames[frame][Math.floor(loc / game.width)][loc % game.width];\n                    mapGraphics.beginFill(game.players[site.owner].color, game.productionNormals[Math.floor(loc / game.width)][loc % game.width] * 0.4 + 0.15);\n                    mapGraphics.drawRect(rw * tX, rh * tY, rw, rh);\n                    mapGraphics.endFill();\n                    loc++;\n                    tX++;\n                    if(tX == game.width) tX = 0;\n                }\n                tY++;\n                if(tY == game.height) tY = 0;\n            }\n\n            var t = showmovement ? (-Math.cos(transit * Math.PI) + 1) / 2 : 0;\n            loc = 0;\n            var sY = Math.round(yOffset);\n            for(var a = 0; a < game.height; a++) {\n                var sX = Math.round(xOffset);\n                for(var b = 0; b < game.width; b++) {\n                    var site = game.frames[frame][Math.floor(loc / game.width)][loc % game.width];\n                    if(site.strength == 255) mapGraphics.lineStyle(1, '0xfffff0');\n                    if(site.strength != 0) mapGraphics.beginFill(game.players[site.owner].color);\n                    var pw = rw * Math.sqrt(site.strength > 0 ? site.strength / 255 : 0.1) / 2\n                    var ph = rh * Math.sqrt(site.strength > 0 ? site.strength / 255 : 0.1) / 2;\n                    var direction = frame < game.moves.length ? game.moves[frame][Math.floor(loc / game.width)][loc % game.width] : 0;\n                    var move = t > 0 ? direction : 0;\n                    var sY2 = move == 1 ? sY - 1 : move == 3 ? sY + 1 : sY;\n                    var sX2 = move == 2 ? sX + 1 : move == 4 ? sX - 1 : sX;\n                    if(site.strength == 0 && direction != 0) mapGraphics.lineStyle(1, '0x888888')\n                    var center = new PIXI.Point(rw * ((t * sX2 + (1 - t) * sX) + 0.5), rh * ((t * sY2 + (1 - t) * sY) + 0.5));\n                    var pts = new Array();\n                    const squarescale = 0.75;\n                    pts.push(new PIXI.Point(center.x + squarescale * pw, center.y + squarescale * ph));\n                    pts.push(new PIXI.Point(center.x + squarescale * pw, center.y - squarescale * ph));\n                    pts.push(new PIXI.Point(center.x - squarescale * pw, center.y - squarescale * ph));\n                    pts.push(new PIXI.Point(center.x - squarescale * pw, center.y + squarescale * ph));\n                    mapGraphics.drawPolygon(pts);\n                    if(site.strength != 0) mapGraphics.endFill();\n                    mapGraphics.lineStyle(0, '0xffffff');\n                    loc++;\n                    sX++;\n                    if(sX == game.width) sX = 0;\n                }\n                sY++;\n                if(sY == game.height) sY = 0;\n            }\n\n            var time = Date.now();\n            var dt = time - lastTime;\n            lastTime = time;\n\n            // If we are embedding a game,\n            // we want people to be able to scroll with\n            // the arrow keys\n            if(!isminimal) {\n                //Update frames per sec if up or down arrows are pressed.\n                if(pressed[38]) {\n                    framespersec += 0.05;\n                } else if(pressed[40]) {\n                    framespersec -= 0.05;\n                }\n            }\n\n            if(pressed[39]) {\n                transit = 0;\n                frame++;\n            }\n            else if(pressed[37]) {\n                if(transit != 0) transit = 0;\n                else frame--;\n            }\n            else if(shouldplay) {\n                transit += dt / 1000 * framespersec;\n            }\n        }\n\n        if(!isminimal) {\n            //Update info text:\n            var mousepos = manager.mouse.global;\n            if(mousepos.x < 0 || mousepos.x > sw || mousepos.y < 0 || mousepos.y > sh) { //Mouse is not over renderer.\n                infoText.text = 'Frame #' + frame.toString();\n            }\n            else if(!mousePressed) {\n                infoText.text = 'Frame #' + frame.toString();\n                if(mousepos.x < mw && mousepos.y < mh) { //Over map\n                    var x = (Math.floor(mousepos.x / rw) - xOffset) % game.width, y = (Math.floor(mousepos.y / rh) - yOffset) % game.height;\n                    if(x < 0) x += game.width;\n                    if(y < 0) y += game.height;\n                    infoText.text += ' | Loc: ' + x.toString() + ',' + y.toString();\n                }\n            }\n            else { //Mouse is clicked and over renderer.\n                if(mousepos.x < mw && mousepos.y < mh) { //Over map:\n                    var x = (Math.floor(mousepos.x / rw) - xOffset) % game.width, y = (Math.floor(mousepos.y / rh) - yOffset) % game.height;\n                    if(x < 0) x += game.width;\n                    if(y < 0) y += game.height;\n                    str = game.frames[frame][y][x].strength;\n                    prod = game.productions[y][x];\n                    infoText.text = 'Str: ' + str.toString() + ' | Prod: ' + prod.toString();\n                    if(frame < game.moves.length && game.frames[frame][y][x].owner != 0) {\n                        move = game.moves[frame][y][x];\n                        if(move >= 0 && move < 5) {\n                            move = \"0NESW\"[move];\n                        }\n                        infoText.text += ' | Mv: ' + move.toString();\n                    }\n                }\n                else if(mousepos.x < RIGHT_GRAPH_RIGHT && mousepos.x > LEFT_GRAPH_LEFT) {\n                    frame = firstFrame + Math.round((mousepos.x - LEFT_GRAPH_LEFT) / dw);\n                    if(frame < 0) frame = 0;\n                    if(frame >= game.num_frames) frame = game.num_frames - 1;\n                    transit = 0;\n                    if(mousepos.y > TER_TOP & mousepos.y < TER_BTM) {\n                    }\n                }\n            }\n        }\n\n        //Advance frame if transit moves far enough. Ensure all are within acceptable bounds.\n        while(transit >= 1) {\n            transit--;\n            frame++;\n        }\n        if(frame >= game.num_frames - 1) {\n            frame = game.num_frames - 1;\n            transit = 0;\n        }\n        while(transit < 0) {\n            transit++;\n            frame--;\n        }\n        if(frame < 0) {\n            frame = 0;\n            transit = 0;\n        }\n\n        //Pan if desired.\n        const PAN_SPEED = 1;\n        if(pressed[65]) xOffset += PAN_SPEED;\n        if(pressed[68]) xOffset -= PAN_SPEED\n        if(pressed[87]) yOffset += PAN_SPEED;\n        if(pressed[83]) yOffset -= PAN_SPEED;\n\n        //Reset pan to be in normal bounds:\n        if(Math.round(xOffset) >= game.width) xOffset -= game.width;\n        else if(Math.round(xOffset) < 0) xOffset += game.width;\n        if(Math.round(yOffset) >= game.height) yOffset -= game.height;\n        else if(Math.round(yOffset) < 0) yOffset += game.height;\n\n        //Actually render.\n        renderer.render(stage);\n\n        //Of course, we want to render in the future as well.\n        var idle = (Object.keys(pressed).length === 0) && !shouldplay;\n        setTimeout(function() {\n            requestAnimationFrame(animate);\n        }, 1000 / (idle ? 20.0 : 80.0));\n    }\n}\n\nfunction textFromURL(replayName, $container, callback) {\n    var oReq = new XMLHttpRequest();\n    oReq.open(\"GET\", \"https://storage.googleapis.com/ts2018-halite-1-replays/\"+replayName, true);\n    oReq.responseType = \"arraybuffer\";\n    oReq.onload = function (oEvent) {\n        if (oReq.status != 404) {\n            try {\n                var decoder = new TextDecoder();\n                var text = decoder.decode(pako.ungzip(oReq.response));\n                callback(textToGame(text, replayName));\n            } catch (e) {\n                callback(textToGame(oReq.response, replayName));\n            }\n        } else {\n            $container.html(\"<h1>Gamefile not found</h1><p>The gamefile titled \\\"\"+replayName+\"\\\" could not be found. If this problem persists, post of the forums or email us at halite@halite.io.</h1>\");\n        }\n    }\n    oReq.send(null);\n}\n"
  },
  {
    "path": "website/sql/dummyData.sql",
    "content": "DELETE FROM User;\n\nINSERT INTO User (userID, username, email, compileStatus, isRunning, language, organization) VALUES (2609, 'erdman', 'abc@gmail.com', 0, 1, 'Python', 'Other'), (1017, 'djma', 'abc@gmail.com', 0, 1, 'Java', 'Other'), (3063, 'daniel-shields', 'abc@gmail.com', 0, 1, 'Python', 'Other');\nINSERT INTO Worker (apiKey, ipAddress) VALUES (1, \"127.0.0.1\");\n"
  },
  {
    "path": "website/sql/importDummyData.sh",
    "content": "#!/bin/bash\n\necho \"drop database Halite; create database Halite;\" | mysql -u root -p\nmysql -u root Halite < schema.sql -p\nmysql -u root Halite < dummyData.sql -p\n"
  },
  {
    "path": "website/sql/install.sh",
    "content": "sudo apt-get install -y mysql-server\n\necho \"Starting MySql setup\"\n./importDummyData.sh\n"
  },
  {
    "path": "website/sql/schema.sql",
    "content": "-- MySQL dump 10.13  Distrib 5.5.49, for debian-linux-gnu (x86_64)\n--\n-- Host: localhost    Database: Halite\n-- ------------------------------------------------------\n-- Server version   5.5.49-0ubuntu0.14.04.1\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n/*!40101 SET NAMES utf8 */;\n/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n/*!40103 SET TIME_ZONE='+00:00' */;\n/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n\n--\n-- Table structure for table `Game`\n--\n\nCREATE DATABASE IF NOT EXISTS Halite ;\nuse Halite;\n\nDROP TABLE IF EXISTS `Game`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `Game` (\n  `gameID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `replayName` varchar(64) NOT NULL,\n  `mapWidth` smallint(5) NOT NULL,\n  `mapHeight` smallint(5) NOT NULL,\n  `timestamp` datetime DEFAULT CURRENT_TIMESTAMP,\n  `workerID` mediumint(8) unsigned DEFAULT NULL,\n  PRIMARY KEY (`gameID`)\n) ENGINE=InnoDB AUTO_INCREMENT=407227 DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `GameUser`\n--\n\nDROP TABLE IF EXISTS `GameUser`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `GameUser` (\n  `gameID` mediumint(8) unsigned NOT NULL,\n  `userID` mediumint(8) unsigned NOT NULL,\n  `versionNumber` mediumint(8) unsigned NOT NULL,\n  `errorLogName` varchar(64) DEFAULT NULL,\n  `rank` smallint(5) unsigned NOT NULL,\n  `playerIndex` smallint(5) unsigned NOT NULL,\n  `didTimeout` tinyint(1) unsigned NOT NULL,\n  PRIMARY KEY (`gameID`,`userID`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `User`\n--\n\nDROP TABLE IF EXISTS `User`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `User` (\n  `userID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `oauthID` int(12) unsigned NOT NULL,\n  `oauthProvider` tinyint(1) unsigned NOT NULL,\n  `username` varchar(32) NOT NULL,\n  `email` varchar(64),\n  `githubEmail` varchar(64),\n  `verificationCode` varchar(64),\n  `onEmailList` tinyint(1) NOT NULL DEFAULT 1,\n  `isEmailGood` tinyint(1) unsigned NOT NULL DEFAULT 0,\n  `isRunning` tinyint(1) unsigned NOT NULL DEFAULT 0,\n  `compileStatus` tinyint(1) unsigned NOT NULL DEFAULT 0,\n  `level` enum('High School','Undergraduate','Graduate','Professional') NOT NULL DEFAULT 'Professional',\n  `organization` varchar(64) NOT NULL,\n  `language` varchar(16) DEFAULT NULL,\n  `mu` float NOT NULL DEFAULT 25.000,\n  `sigma` float unsigned NOT NULL DEFAULT 8.333,\n  `rank` smallint(5) DEFAULT NULL,\n  `numSubmissions` smallint(5) NOT NULL DEFAULT 0,\n  `numGames` smallint(5) NOT NULL DEFAULT 0,\n  `creationTime` datetime DEFAULT CURRENT_TIMESTAMP,\n  `updateTime` datetime ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`userID`)\n) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `UserHistory`\n--\n\nDROP TABLE IF EXISTS `UserHistory`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `UserHistory` (\n  `userID` mediumint(8) unsigned NOT NULL,\n  `versionNumber` smallint(5) NOT NULL,\n  `lastRank` smallint(5) NOT NULL,\n  `lastNumPlayers` smallint(5) NOT NULL,\n  `lastNumGames` smallint(5) DEFAULT NULL,\n  `timestamp` datetime DEFAULT CURRENT_TIMESTAMP\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `Announcement`\n--\n\nDROP TABLE IF EXISTS `Announcement`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `Announcement` (\n  `announcementID` mediumint(8) unsigned NOT NULL,\n  `header` varchar(64) NOT NULL,\n  `body` varchar(512) NOT NULL,\n  PRIMARY KEY (`announcementID`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `DoneWithAnnouncement`\n--\n\nDROP TABLE IF EXISTS `DoneWithAnnouncement`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `DoneWithAnnouncement` (\n  `announcementID` mediumint(8) unsigned NOT NULL,\n  `userID` mediumint(8) unsigned NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `UserNotification`\n--\n\nDROP TABLE IF EXISTS `UserNotification`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `UserNotification` (\n  `userNotificationID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `userID` mediumint(8) unsigned NOT NULL,\n  `title` varchar(64) NOT NULL,\n  `body` varchar(2048) NOT NULL,\n  `mood` tinyint(1) NOT NULL,\n  `creationTime` datetime DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`userNotificationID`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `HighSchool`\n--\n\nDROP TABLE IF EXISTS `HighSchool`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `HighSchool` (\n  `name` varchar(64) NOT NULL,\n  PRIMARY KEY(`name`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n\n--\n-- Table structure for table `Worker`\n--\n\nDROP TABLE IF EXISTS `Worker`;\n/*!40101 SET @saved_cs_client     = @@character_set_client */;\n/*!40101 SET character_set_client = utf8 */;\nCREATE TABLE `Worker` (\n  `workerID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `apiKey` mediumint(8) unsigned NOT NULL,\n  `ipAddress` varchar(32) NOT NULL,\n  `numGames` mediumint(8) NOT NULL DEFAULT 0,\n  `numCompiles` smallint(5) NOT NULL DEFAULT 0,\n  `lastRequestTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`workerID`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n/*!40101 SET character_set_client = @saved_cs_client */;\n/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n\n-- Dump completed on 2016-07-22 16:25:27\n"
  },
  {
    "path": "website/status.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>Status</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"pageContent\">\n            <div class=\"row\">\n                <div class=\"col-sm-6\">\n                    <div class=\"panel panel-primary\">\n                        <div class=\"panel-heading\">\n                            <h3 class=\"panel-title\">General Stats</h3>\n                        </div>\n\n                        <table class=\"table\" id=\"statTable\">\n                            <tbody id=\"statTableBody\">\n                            </tbody>\n                        </table>\n                    </div>\n                </div>\n                <div class=\"col-sm-6\">\n                    <div class=\"panel panel-primary\">\n                        <div class=\"panel-heading\">\n                            <h3 class=\"panel-title\">Worker Servers</h3>\n                        </div>\n\n                        <table class=\"table\" id=\"workerTable\">\n                            <thead>\n                                <tr>\n                                    <th>ID</th>\n                                    <th>Last Communication</th>\n                                </tr>\n                            </thead>\n                            <tbody id=\"workerTableBody\">\n                            </tbody>\n                        </table>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/status.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/style/general.css",
    "content": "#jHeader {\n    font-size: 50px;\n}\n\n#myFile {\n    display:none;\n}\n\n#gameFile {\n    display:none;\n}\n\n#navCont {\n    margin:0 auto;\n    width:90%;\n}\n\n#loginNav {\n    display:inline;\n}\n\n#logoutNav {\n    display:none;\n}\n\n#archivedTag {\n    display:none;\n}\n\n.gameRow {\n    display:none;\n}\n\n#leaderTable {\n    padding-bottom:0px;\n    margin-bottom:0px;\n}\n\n.gameRow {\n    background-color:#F8F8F8;\n}\n\n.arrow {\n    height: 16px;\n    width: 16px;\n    cursor: pointer;\n}\n\n.file-icon {\n    height: 16px;\n    width: 16px;\n}\n\n\n.jumbotron-btn {\n    margin-top: 2px;\n    margin-bottom: 2px;\n}\n\n.videoWrapper {\n    position: relative;\n    padding-bottom: 56.25%; /* 16:9 */\n    padding-top: 25px;\n    height: 0;\n}\n.videoWrapper iframe {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n}\n\n.has-hover-text {\n    cursor: pointer;\n}\n"
  },
  {
    "path": "website/style/learn.css",
    "content": "ul:not(.nav), p {\n    line-height: 1.5em;\n}\n\nh1 {\n    padding-top: 20px;\n    padding-bottom: 9px;\n    margin-bottom: 20px;\n    border-bottom: 1px solid #003736; \n    margin-top: 0;\n}\n"
  },
  {
    "path": "website/terms_of_service.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title>TOS</title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n    <link href=\"style/learn.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"row\">\n            <div class=\"col-sm-12\">\n\n                <h1>Terms of Use</h1>\n\n                <p>Your use of the game, Halite, and the website on which these terms reside (collectively, the \"Site\"), and the features at this Site are subject to these Terms of Use, which we may update from time to time. <b>Please read these Terms of Use carefully before using this Site.</b> By accessing Halite, this website and any materials presented herein, or by downloading any products or materials from the Site, you agree to and are bound by the terms, conditions, policies and notices contained on this page (the \"Terms\"), including, but not limited to, conducting this transaction electronically, disclaimers of warranties, damage and remedy exclusions and limitations, and a choice of New York law. The Site is owned or controlled by Two Sigma Open Source, LLC and its affiliates (collectively “Two Sigma”). This Site is intended for users age thirteen or older. If you are under 13 years of age you may not use this Site.  If you are under age 18 (or the age of majority under applicable law), Two Sigma may need your parent or guardian’s consent before your use of the Site is permitted.</p>\n                <p>Two Sigma reserves the right to change these Terms without notice at any time, except in accordance with applicable law. Your use of the Site after we post any changes to these Terms constitutes your agreement to those changes prospectively from the date of such changes. Any such change to these Terms shall be effective upon posting to the Site. Accordingly, you agree to periodically review these Terms when accessing or using the Site.</p>\n                <p>You acknowledge and agree that Two Sigma may temporarily or permanently restrict, suspend or terminate the Terms or your access to, and use of, all or any part of the Site, with or without cause, including but not limited to any breach of these Terms as determined in Two Sigma’s sole and absolute discretion, and without prior notice or liability. Two Sigma will not be liable to you or any third party for any termination of your access to or use of the Site or any content you may have created or posted on the Site. You agree that you do not have any rights in the Site or any content that you create or post to it.</p>\n                <p>Each use of the Site constitutes your agreement to be bound by and comply with the then-current Terms. If, at any time, you do not agree to be bound by or comply with these Terms, then you should cease accessing or using this Site.</p>\n\n                <h2>1. Two Sigma Content, Limited License to Use the Site</h2>\n\n                <p>Two Sigma owns the Site and maintains it in conjunction with its partners. All information and content contained on the Site is intended solely for the use of those persons who have been granted permission to use the Site and who have agreed to these Terms.</p>\n                <p>Content on the Site that is provided by Two Sigma or its licensors, including the Halite game, graphics, images, text, software, code, screen shots, text, digitally downloadable files, trademarks, logos, service marks, product and program names, slogans, and the compilation of the foregoing, including without limitation the name or logo of Halite, Two Sigma, any of its affiliates and/or any other entity described on the Site (\"Two Sigma Content\") is the property of Two Sigma and its licensors, and is protected in the U.S. and internationally under trademark, copyright, and other intellectual property laws. Except as specifically permitted below, nothing contained in these Terms or the Site itself either grants or will be construed to grant to you or any third party, by implication, estoppel or otherwise, any title or interest in, or any license or right to use or reproduce Two Sigma Content contained in the Site. No act of downloading or otherwise copying Two Sigma Content from the Site will transfer title to any software or material to any user hereof. Two Sigma reserves, and may enforce to the fullest extent possible, all rights that it may have with respect to all material contained in the Site.</p>\n                <p>Two Sigma grants you a limited, non-exclusive license to display and otherwise use portions of the Two Sigma Content and this Site solely for your own private, non-commercial, informational purposes only, and to print pages from the Site only in connection with that use.</p>\n                <p>You agree not to download, display or use any Two Sigma Content, other than User Content (as defined herein), located on the Site for use in any publications, in public performances, on websites other than the Site for any other commercial purpose, in connection with products or services that are not those of Two Sigma, in any other manner that is likely to cause confusion among consumers, that disparages or discredits Two Sigma and/or its licensors, that dilutes the strength of Two Sigma or its licensor's property, or that otherwise infringes Two Sigma or its licensors’ intellectual property rights. You further agree to in no other way misuse any Two Sigma Content that appears on this Site.</p>\n                <p>If you are a trademark or copyright owner and you believe that your trademark or copyright rights have been violated, please go to our Proprietary Rights Complaint Process and follow the instructions at that area.</p>\n\n                <h2>2. Usage Parameters</h2>\n                <p>Prohibited Uses. The following requirements apply to your use of the Site: (a) you will not use any electronic communication feature of the Site for any purpose that is unlawful, tortious, abusive, intrusive on another's privacy, harassing, libelous, defamatory, embarrassing, obscene, threatening, or hateful; (b) you will not upload, post, reproduce, or distribute any information, software, or other material protected by copyright or any other intellectual property right (as well as rights of publicity and privacy) without first obtaining the permission of the owner of such rights; (c) you will not collect or store personal data about other users; (d) you will not use the Site for any commercial purpose not expressly approved by Two Sigma in writing; (e) you will not upload, post or otherwise transmit any advertising or promotional materials or any other form of solicitation or unauthorized communication through the Site; (f) you will not upload, post, email, or otherwise transmit any material that contains viruses or any other computer code, files, or programs which might interrupt, limit, or interfere with the functionality of any computer software or hardware or telecommunications equipment; (g) you may not use the Site in any manner that could damage or overburden any Two Sigma server, or any network connected to any Two Sigma server; (h) you may not use the Site in any manner that would interfere with any other party’s use of the Site; and (i) you may not use, transfer, distribute or dispose of any information contained in the Site in any manner that could compete with the business of Two Sigma.</p>\n                <p>User Content. On certain areas of our Site you will be able to submit images, text, comments, data, code, software, written posts and certain other materials (\"User Content\"). You understand that User Content is published on the Site for anyone to view and download and Two Sigma shall not have any liability to you for any use of a third party of your User Content. By submitting User Content, you agree that: (a) you will not post any content that is unlawful, harmful, tortious, defamatory, libelous, obscene, invasive of the privacy of another person, threatening, harassing, abusive, hateful, racist, infringing, pornographic, violent or otherwise objectionable or inappropriate as determined by Two Sigma; (b) you will not post any content that contains personal information about any individual, violates the privacy/publicity of any other individual or entity, or anything that you are under a contractual obligation to keep private or confidential; (c) you will not impersonate any person or organization, including without limitation, the personnel of Two Sigma, or misrepresent an affiliation with another person or organization; (d) you will not post any content that contains viruses, corrupted files, or any other similar software or programs that may adversely affect the operation of the Site, or feature of the Site.</p>\n                <p>You further understand and agree that you have no rights to any account you may have with us, or other access to the Site or features therein and Two Sigma may cancel your account and delete all User Content submitted by you or otherwise associated with your account at any time, without notice, if Two Sigma deems that you have violated these Terms, the law, or for any other reason in Two Sigma’s sole determination. Two Sigma assumes no liability for any information, including User Content, removed from our Site, and reserves the right to permanently restrict access to the Site or a user account.</p>\n                <p>By displaying, publishing, or otherwise posting any User Content on or through the Site, you hereby grant to Two Sigma, users of the Site, and any entity designated by Two Sigma, a non-exclusive, sub-licensable, worldwide, fully-paid, royalty free license to use, modify, publicly perform, publicly display, reproduce, and distribute such User Content, including but not limited to for the purposes of making the User Content available on the Site and allowing other users to view, download, modify, creative derivative works from, edit, and otherwise use User Content without time, territorial, and/or other usage limitations and without the requirement to make payment to you or to any third party or the need to seek any third party permission. This license includes the right to host, index, cache, distribute, and tag any User Content, as well as the right to sublicense User Content to third parties, including other users, for use on other media or platforms known or hereinafter developed, such as for use on mobile phones, in video or software computer programs.</p>\n                <p>For clarity, you continue to retain all ownership rights in your User Content, and you continue to have the right to use your User Content in any way you choose, subject to these Terms and the license described herein. You represent and warrant that you own the content submitted, displayed, published or posted by you on the Site and otherwise have the right to grant the license set forth herein, and the displaying, publishing or posting of any content you submit, and our use thereof, and use thereof by any third party, does not and will not violate the privacy rights, publicity rights, copyrights, trademark rights, patents, contract rights or any other intellectual property rights or other rights of any person or entity.</p>\n                <p>You agree to indemnify and hold Company, its parents, subsidiaries, officers, employees, licensees, customers, and website contractors and each of their officers, employees and agents, and users of the Site, harmless from any claims, damages and expenses, including reasonable attorneys' fees and costs, related to your violation of these Terms, including the Usage policies, or any violations thereof by your dependents or which arises from the use of User Content you submitted, posted, or otherwise provided to Two Sigma or this Site.</p>\n                <p>Means of Access. The Site is generally intended to be viewed by a conventional Web browser. Although you may use other means to access the Site, be aware that the Site may not appear accurately through other access methods, and you use them only at your own risk. You are responsible for setting the cache settings on your browser to ensure that you are receiving the most recent data. You are responsible for obtaining and maintaining all equipment, services and other materials that you need to access and use the Site. You may not use any data mining, robots or similar data gathering and extraction programs or methods, whether automated or manual, to access, acquire, copy or monitor any portion of the Site or any data and content found on the Site, unless such devices or methods are expressly approved in advance by Two Sigma in writing.</p>\n                <p>Usage Monitoring. Two Sigma reserves the right, but does not have the obligation, to access, archive, or monitor any use of this Site, or your use of this Site and your communications to the Site. Any personal information collected during such monitoring will be used in accordance with Two Sigma’s then-current Privacy Policy. By using the Site, you accept Two Sigma’s right to access, archive, and/or monitor usage to ensure service quality, or to evaluate the Site, the security of the Site, compliance with these Terms, compliance with applicable laws, rules or regulations or for any other reason. You agree that Two Sigma’s monitoring activities will not entitle you to any cause of action or other right with respect to the manner in which Two Sigma monitors your Site usage and enforces, or fails to enforce, these Terms. You further agree that in no event will Two Sigma be liable for any damages incurred by you as a result of Two Sigma’s usage monitoring.</p>\n                <p>Unsolicited Ideas. Two Sigma always welcomes consumer feedback and appreciates your interest in sharing your thoughts with Two Sigma. However, it is Two Sigma’s policy not to accept or consider unsolicited ideas from outside Two Sigma, including ideas for new or improved products or packaging, technologies, product names, or promotion or marketing strategies. Should you submit an idea to Two Sigma, despite Two Sigma’s policy, Two Sigma will treat the information as non-confidential and non-proprietary and Two Sigma will be free to use the information for any purpose and will not be obligated to return or acknowledge receipt of your submitted information.</p>\n                <p>Without limiting the previous paragraph, any User Content you submit to Two Sigma or the Site will not be returned to you. Accordingly, you agree that (a) Two Sigma will not treat any such submission as confidential, (b) you cannot sue Two Sigma or initiate any action against Two Sigma for use of the User Content or ideas you submit (including, but not limited to, product or advertising ideas), and (c) you understand and agree that Two Sigma may currently or in the future develop products or services that may be similar or identical to your User Content and Two Sigma does not have to pay you or anyone else if any such product or service is in any way similar to your User Content.</p>\n\n                <h2>3. Disclaimer; No Advice</h2>\n\n                <p>The primary mission of Two Sigma Open Source, LLC (“TSOS”) is to promote, manage and maintain open source software projects. TSOS is affiliated with Two Sigma Investments, LP, Two Sigma Advisers, LP and Two Sigma Securities, LLC, which (along with certain of their affiliates) engage in various investment advisory and broker-dealer activities. However, TSOS is not involved in the financial services businesses of these entities. Under no circumstances should any material on the site be used or considered as an offer to sell or a solicitation of an offer to buy any security, including any interest in any investment fund sponsored or managed by any Two Sigma entity, or any investment advisory services offered by any Two Sigma entity.</p>\n\n                <h2>4. Accounts; Password Protected Areas</h2>\n\n                <p>Portions of the Site which are password-protected may be accessed only by users who have been issued passwords by an authorized representative of Two Sigma. No one may obtain or attempt to obtain unauthorized access to such parts of the Site, or to any other protected materials or information, through any means not intentionally made available by Two Sigma for their specific use. Unauthorized individuals attempting to access, or actually accessing, these areas can be subject to criminal and/or civil prosecution.</p>\n                <p>During any registration process, you must provide complete and accurate information about yourself. It is your responsibility to maintain the currency, completeness, and accuracy of your password and registration data and any loss caused by your failure to do so is your responsibility. You may not have a user name or ID that is indecent or distasteful or that we otherwise determine in our discretion is unacceptable. You are solely responsible for maintaining the confidentiality of your password and account. Additionally, you are solely responsible for any and all activities that occur under your account. You agree to notify Two Sigma immediately of any unauthorized use of your account. You further agree not to email, post, or otherwise disseminate or disclose any user name, ID, password, or other information that provides you access to the Site. Two Sigma is not liable for any loss that you may incur as a result of the unauthorized use of your password or account, either with or without your knowledge.</p>\n\n                <h2>5. Privacy Policy</h2>\n\n                <p>Two Sigma’s Privacy Policy posted on this website applies to use of this Site, and its terms are made a part of these Terms by this reference. Please read our <a href=\"privacy_policy.php\">Privacy Policy</a> for more information about our information collection and use practices.</p>\n\n                <h2>6. No Reliance</h2>\n\n                <p>While Two Sigma uses reasonable efforts to update the information contained in the Site, Two Sigma makes no representations or warranties as to the accuracy, reliability or completeness of any information, Two Sigma Content, or User content, at or on the Site. Any content of the Site is subject to change without notice. Permission by Two Sigma to access this Site should not be construed as, or relied upon as, investment, financial, legal, regulatory, accounting, tax or similar advice. You acknowledge that any reliance on such material or systems will be at your own risk. Two Sigma makes no representations regarding the amount of time that any Two Sigma Content or User Content will be preserved.</p>\n                <p>Two Sigma does not endorse, verify, evaluate or guarantee any information provided by users and nothing shall be considered as an endorsement, verification or guarantee of any User Content. You shall not create or distribute information, including but not limited to advertisements, press releases or other marketing materials, or include links to any sites which contain or suggest an endorsement by Two Sigma without the prior review and written approval of Two Sigma.</p>\n\n                <h2>7. Materials to be Consulted in their Entirety</h2>\n\n                <p>All materials at the Site are meant to be reviewed in their entirety, including any footnotes, legal disclaimers, restrictions, disclosures, hedge clauses and any copyright or proprietary notices, including those contained in these Terms. Any disclaimers, restrictions, disclosures or hedge clauses apply to any partial document or material in the same manner as they do the whole, and will be deemed incorporated in the portion of any material or document that you consult or download.</p>\n\n                <h2>8. Links to Third Party Websites</h2>\n\n                <p>Two Sigma has not reviewed any of the websites that may be linked to the Site, and is not responsible for the content of off-site pages or any other website linked or linking to this Site. Two Sigma is not responsible for the privacy practices of such other websites. Your linking to or use of any websites other than this Site is at your own risk. Two Sigma’s inclusion of links to other websites does not imply any endorsement of any kind by Two Sigma of the material located on or linked to by such websites and should not be deemed as such by any user of the Site. Two Sigma disclaims any responsibility for the products or services offered or the information contained on any websites other than the Site.</p>\n\n                <h2>9. No Warranty</h2>\n\n                <p>TWO SIGMA AND ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, AGENTS AND EMPLOYEES MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THe SITE, TWO SIGMA CONTENT, OR USER CONTENT AND/OR THE ACCURACY, ADEQUACY, RELIABILITY, TIMELINESS, COMPLETENESS, SUITABILITY OR OTHER CHARACTERISTICS OF THE INFORMATION AND MATERIALS CONTAINED ON OR PRESENTED THROUGH THE SITE (INCLUDING, WITHOUT LIMITATION TWO SIGMA CONTENT AND USER CONTENT). THe SITE AND ALL SUCH INFORMATION AND MATERIALS ARE PROVIDED “AS IS”, WITHOUT ANY WARRANTY OF ANY KIND, AND ON AN “AS AVAILABLE” BASIS. TWO SIGMA, TO THE FULLEST EXTENT PERMITTED BY LAW, HEREBY EXPRESSLY DISCLAIMS ALL REPRESENTATIONS AND WARRANTIES, EXPRESS OR IMPLIED, AS TO THE SITE, TWO SIGMA CONTENT, USER CONTENT, ANY MATTER RELATED TO THE SITE AND SUCH INFORMATION AND MATERIALS ON THE SITE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT AND AVAILABILITY. TWO SIGMA EXPRESSLY DISCLAIMS LIABILITY FOR ERRORS AND OMISSIONS IN THE SITE OR THE INFORMATION AND MATERIALS CONTAINED THEREIN.</p>\n                <p>You acknowledge that you are aware that by using this Site, as with any other website on the Internet, you may be subject to security and privacy exploitations, including, eavesdropping, sniffing, spoofing, hacking, breaking passwords, harassment, exposure to objectionable material, posturing, and/or other security or privacy hazards.</p>\n                <p>TWO SIGMA AND ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, AGENTS AND EMPLOYEES FURTHER ASSUME NO RESPONSIBILITY FOR, AND MAKE NO WARRANTIES THAT, INFORMATION, SERVICES OR FUNCTIONS CONTAINED AT THe SITE WILL BE UNINTERRUPTED OR ERROR-FREE, THAT DEFECTS WILL BE CORRECTED, OR THAT THE SITE OR THE SERVER THAT MAKES IT AVAILABLE WILL BE FREE OF VIRUSES, WORMS, “TROJAN HORSES” OR OTHER HARMFUL COMPONENTS. TWO SIGMA AND ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, AGENTS AND EMPLOYEES SHALL NOT BE LIABLE FOR ANY DAMAGES OF ANY TYPE OR KIND TO YOUR COMPUTER, VIRUSES THAT MAY INFECT YOUR COMPUTER, OR SERVICES REPAIRS OR CORRECTIONS THAT MUST BE PERFORMED ON YOUR COMPUTER OR OTHER PROPERTY ON ACCOUNT OF YOUR ACCESS OR USE OF THE SITE.</p>\n\n                <h2>10. Limitation of Liability; Indemnification</h2>\n\n                <p>IN NO EVENT SHALL TWO SIGMA OR ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, CLIENTS, AGENTS OR EMPLOYEES BE LIABLE FOR ANY CLAIMS, LIABILITIES, LOSSES, COSTS OR DAMAGES OF ANY KIND, INCLUDING DIRECT, INDIRECT, PUNITIVE, EXEMPLARY, INCIDENTAL, SPECIAL, LOST PROFITS OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH (I) THE USE OF OR INABILITY TO ACCESS AND/OR USE THE SITE OR WITH ANY DELAY IN USING THE SITE, INCLUDING BUT NOT LIMITED TO LOSS OF REVENUE, TRADING, PROFITS, ANTICIPATED PROFITS, BUSINESS, SAVINGS, GOODWILL, USE, OPPORTUNITY OR DATA; (II) TWO SIGMA CONTENT, USER CONTENT, OR ANY OTHER INFORMATION AND MATERIALS CONTAINED ON OR OBTAINED THROUGH THE SITE; OR (III) OTHERWISE ARISING OUT OF THE ACCESS TO AND/OR USE OF THE SITE. NOR SHALL TWO SIGMA OR ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, CLIENTS, AGENTS OR EMPLOYEES BE RESPONSIBLE FOR ANY DAMAGES WHATSOEVER THAT RESULT FROM MISTAKES, OMISSIONS, INTERRUPTIONS, DELETION OF FILES, ERRORS, DEFECTS, DELAYS IN OPERATION OR TRANSMISSION, OR ANY FAILURE OF PERFORMANCE WHETHER OR NOT CAUSED BY EVENTS BEYOND TWO SIGMA’S REASONABLE CONTROL, INCLUDING BUT NOT LIMITED TO ACTS OF GOD, COMMUNICATIONS LINE FAILURE, THEFT, DESTRUCTION, OR UNAUTHORIZED ACCESS TO THIS SITE'S RECORDS, PROGRAMS, OR SERVICES IN ANY CASE WHETHER BASED ON THEORIES ARISING IN CONTRACT, TORT (INCLUDING BUT NOT LIMITED TO NEGLIGENCE), STRICT LIABILITY OR OTHERWISE. THE FOREGOING LIMITATIONS APPLY EVEN IF TWO SIGMA OR ANY OF ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, CLIENTS, AGENTS OR EMPLOYEES HAVE BEEN ADVISED OF THE POSSIBILITY OF DAMAGES OR COULD HAVE FORESEEN THE DAMAGES. FURTHER, NONE OF TWO SIGMA OR ANY OF ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, CLIENTS, AGENTS OR EMPLOYEES WILL BE RESPONSIBLE FOR ANY FAILURE TO COMPLY, BY YOU OR ANY THIRD PARTY, WITH THESE TERMS OR WITH APPLICABLE FEDERAL, STATE AND/OR LOCAL LAWS. SOME JURISDICTIONS LIMIT THE EXCLUSION OF DAMAGES OR LIMITATION OF LIABILITY, SO THE ABOVE EXCLUSIONS AND LIMITATIONS MAY NOT APPLY TO YOU. IF ANY PART OF THE EXCLUSIONS OR DAMAGES OR LIMITATION OF LIABILITY SET FORTH ABOVE IS UNENFORCEABLE UNDER APPLICABLE LAW, THE AGGREGATE LIABILITY OF TWO SIGMA OR ITS OFFICERS, DIRECTORS, MEMBERS, PRINCIPALS, INVESTORS, AGENTS AND EMPLOYEES WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY SUCH LAW. IN NO EVENT SHALL TWO SIGMA’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSSES AND CAUSES OF ACTION (WHETHER IN CONTRACT OR TORT, INCLUDING BUT NOT LIMITED TO, NEGLIGENCE) EXCEED THE AMOUNT PAID BY YOU, IF ANY, FOR ACCESSING THIS SITE OR $50, WHICHEVER AMOUNT IS LOWER.</p>\n                <p>These limitations of liability will apply regardless of: (i) any negligence or gross negligence of Two Sigma or any of its officers, directors, members, principals, investors, clients, agents or employees or (ii) whether the liability arises in negligence, gross negligence, strict liability, contract, tort (including negligence or gross negligence) or any other theory of legal liability; and will remain in effect even if any remedy fails of its essential purpose.</p>\n                <p>Your sole remedy for dissatisfaction with your use of the Site is to stop using the Site.</p>\n                <p>You hereby agree, at your own expense, to indemnify, defend and hold Two Sigma and its officers, directors, members, principals, investors, agents and employees harmless from and against any and all liability costs incurred by these parties in connection with any claim arising out of any breach by you of these Terms or any of the representations, warranties and covenants made by you herein, including, without limitation, attorneys’ fees and costs. You shall cooperate as fully as reasonably required or requested in the defense of any such claim. Two Sigma reserves the right, at its own expense, to assume the exclusive defense and control of any matter otherwise subject to indemnification by you and you shall not in any event settle any matter without the written consent of Two Sigma.</p>\n\n                <h2>11. General</h2>\n\n                <p>Both you and Two Sigma acknowledge and agree that no partnership is formed and neither of you nor Two Sigma has the power or the authority to obligate or bind the other.</p>\n                <p>These Terms are governed by the internal laws of the State of New York, without reference to its conflicts of laws provisions. You consent to the jurisdiction of, and venue shall lie in, any federal or state court located in the Borough of Manhattan, New York City as the exclusive jurisdiction and venue for the adjudication of all disputes arising out of or relating to the use of the Site.  You further irrevocably and unconditionally waive your right to a jury trial for any claim or cause of action arising out of or relating to the use of the Site. You hereby appoint the Secretary of State of the State of New York as your agent for service of process in any such proceeding. These Terms operate to the fullest extent permissible by law.</p>\n                <p>Any notice to Two Sigma shall be given in writing and sent by registered mail to Two Sigma Open Source, LLC, 100 Avenue of the Americas, 16th Floor, New York, NY 10013, Attention: Halite TOU Matters, or at such successor address as designated by Two Sigma in its sole discretion from time to time.</p>\n                <p>The failure of Two Sigma to comply with these Terms because of an act of God, war, fire, riot, terrorism, earthquake, actions of federal, state or local governmental authorities or for any other reason beyond the reasonable control of Two Sigma, shall not be deemed a breach of these Terms.</p>\n                <p>If Two Sigma fails to act with respect to your breach or anyone else's breach on any occasion, Two Sigma is not waiving its right to act with respect to future or similar breaches.</p>\n                <p>If any provision of these Terms is held to be invalid or unenforceable in any jurisdiction, such provision shall be deemed modified to the minimum extent necessary so that such provision shall no longer be held to be invalid or unenforceable, and these Terms shall be interpreted so as to achieve the intent expressed herein to the greatest extent possible in the jurisdiction in question. Any such modification, invalidity or unenforceability shall be strictly limited both to such provision and to such jurisdiction.</p>\n                <p>This website is not an offer to, or solicitation of, any potential clients or investors for the provision by Two Sigma of investment management, advisory or any other related services. No material listed on this website is or should be construed as investment advice, nor is anything on this website an offer to sell, or a solicitation of an offer to buy, any security or other instrument. Links from this website to third-party websites do not imply any endorsement by the third party of this website or of the link; nor do they imply any endorsement by this firm of the third-party website or of the link</p>\n\n                <hr>\n\n                <p>Last Updated November 2, 2016</p>\n\n                <p>© 2016 Two Sigma Open Source, LLC. ALL RIGHTS RESERVED.</p>\n\n\n            </div>\n        </div>\n        <?php include 'includes/footer.php'; ?>\n    </div>\n\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "website/tutorials/basic/BasicBot.cpp",
    "content": "#include <stdlib.h>\n#include <time.h>\n#include <cstdlib>\n#include <ctime>\n#include <time.h>\n#include <set>\n\n#include \"hlt.hpp\"\n#include \"Networking.hpp\"\n\nint main() {\n    srand(time(NULL));\n\n    std::cout.sync_with_stdio(0);\n\n    unsigned char myID;\n    hlt::GameMap presentMap;\n    getInit(myID, presentMap);\n    sendInit(\"BasicC++Bot\");\n\n    std::set<hlt::Move> moves;\n    while(true) {\n        moves.clear();\n\n        getFrame(presentMap);\n\n        for(unsigned short y = 0; y < presentMap.height; y++) {\n            for(unsigned short x = 0; x < presentMap.width; x++) {\n                hlt::Site site = presentMap.getSite({x, y});\n                if (site.owner == myID) {\n                    unsigned char moveDirection = (unsigned char)(rand() % 5);\n                    if(site.strength < site.production*5) {\n                        moveDirection = STILL;\n                    } else {\n                        for(int d : CARDINALS) {\n                            if(presentMap.getSite({x, y}, d).owner != myID) {\n                                moveDirection = d;\n                            }\n                        }\n                    }\n                    moves.insert({{x, y}, moveDirection});\n                }\n            }\n        }\n        sendFrame(moves);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "website/tutorials/basic/BasicBot.java",
    "content": "import java.util.ArrayList;\n\npublic class BasicBot {\n    public static void main(String[] args) {\n        InitPackage iPackage = Networking.getInit();\n        int myID = iPackage.myID;\n        GameMap gameMap = iPackage.map;\n\n        Networking.sendInit(\"BasicJavaBot\");\n\n        while(true) {\n            ArrayList<Move> moves = new ArrayList<Move>();\n\n            gameMap = Networking.getFrame();\n\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    Site site = gameMap.getSite(new Location(x, y));\n                    if(site.owner == myID) {\n                        Direction moveDirection = Direction.randomDirection();\n                        if(site.strength < site.production*5) {\n                            moveDirection = Direction.STILL;\n                        } else {\n                            for(Direction d : Direction.CARDINALS) {\n                                if(gameMap.getSite(new Location(x, y), d).owner != myID) {\n                                    moveDirection = d;\n                                    break;\n                                }\n                            }\n                        }\n                        moves.add(new Move(new Location(x, y), moveDirection));\n                    }\n                }\n            }\n\n            Networking.sendFrame(moves);\n        }\n    }\n}\n"
  },
  {
    "path": "website/tutorials/basic/BasicBot.py",
    "content": "from hlt import *\nfrom networking import *\n\nmyID, gameMap = getInit()\nsendInit(\"BasicPythonBot\")\n\nwhile True:\n    moves = []\n    gameMap = getFrame()\n\n    for y in range(gameMap.height):\n        for x in range(gameMap.width):\n            site = gameMap.getSite(Location(x, y))\n            if site.owner == myID:\n                direction = random.randint(0, 5)\n                if site.strength < 5*site.production:\n                    direction = STILL\n                else:\n                    for d in CARDINALS:\n                        if gameMap.getSite(Location(x, y), d).owner != myID:\n                            direction = d\n                            break\n                moves.append(Move(Location(x, y), direction))\n\n    sendFrame(moves)\n"
  },
  {
    "path": "website/tutorials/basic/BasicBot.rs",
    "content": "#![allow(non_snake_case)]\n#![allow(warnings)]\n\nextern crate rand;\n#[macro_use] extern crate text_io;\n\n//Notice: due to Rust's extreme dislike of (even private!) global mutables, we do not reset the production values of each tile during get_frame.\n//If you change them, you may not be able to recover the actual production values of the map, so we recommend not editing them.\n//However, if your code calls for it, you're welcome to edit the production values of the sites of the map - just do so at your own risk.\n\nmod hlt;\nuse hlt::{ networking, types };\nuse std::collections::HashMap;\nuse rand::Rng;\n\nfn main() {\n    let (my_id, mut game_map) = networking::get_init();\n    let mut rng = rand::thread_rng();\n    networking::send_init(format!(\"{}{}\", \"RustBot\".to_string(), my_id.to_string()));\n    loop {\n        networking::get_frame(&mut game_map);\n        let mut moves = HashMap::new();\n        for a in 0..game_map.height {\n            for b in 0..game_map.width {\n                let l = hlt::types::Location { x: b, y: a };\n                if game_map.get_site(l, types::STILL).owner == my_id {\n                    let mut dir: u8 = types::STILL;\n                    if { game_map.get_site(l, types::STILL).strength } >= 5 * game_map.get_site(l, types::STILL).production {\n                        dir = (rng.gen::<u32>() % 5) as u8;\n                        for d in types::CARDINALS.iter() {\n                            if game_map.get_site(l, *d).owner != my_id {\n                                dir = *d;\n                            }\n                        }\n                    }\n                    moves.insert(l, dir);\n                }\n            }\n        }\n        networking::send_frame(moves);\n    }\n}"
  },
  {
    "path": "website/tutorials/bfs/BfsBot.java",
    "content": "import java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.Queue;\n\n//Note: to submit this to the server, you'll need to rename BfsBot to be MyBot. It is named as BfsBot to avoid confusion among many different MyBot classes.\nclass BfsBot {\n    public static void main(String[] args) {\n        InitPackage iPackage = Networking.getInit();\n        int myID = iPackage.myID;\n        GameMap gameMap = iPackage.map;\n\n        Networking.sendInit(\"BfsBot #\" + myID);\n\n        while(true) {\n            ArrayList<Move> moves = new ArrayList<Move>();\n            gameMap = Networking.getFrame();\n\n            boolean [][] visited = new boolean[gameMap.height][gameMap.width];\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    visited[y][x] = false;\n                }\n            }\n\n            Direction [][] directions = new Direction[gameMap.height][gameMap.width];\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    directions[y][x] = Direction.STILL;\n                }\n            }\n\n            LinkedList<Location> toVisit = new LinkedList<Location>();\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    Location l = new Location(x, y);\n                    Site site = gameMap.getSite(l);\n                    if(site.owner != myID) {\n                        toVisit.add(l);\n                        visited[y][x] = true;\n                    }\n                }\n            }\n\n            while(!toVisit.isEmpty()) {\n                Location l = toVisit.remove();\n                visited[l.y][l.x] = true;\n                for(Direction d : Direction.CARDINALS) {\n                    Location t = gameMap.getLocation(l, d);\n                    if(!visited[t.y][t.x]) {\n                        toVisit.add(t);\n                        visited[t.y][t.x] = true;\n                        directions[t.y][t.x] = oppositeDirection(d);\n                    }\n                }\n            }\n\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    Site site = gameMap.getSite(new Location(x, y));\n                    if(site.owner == myID) {\n                        if(site.strength > 5 * site.production || site.strength == 255) moves.add(new Move(new Location(x, y), directions[y][x]));\n                        else moves.add(new Move(new Location(x, y), Direction.STILL));\n                    }\n                }\n            }\n\n            Networking.sendFrame(moves);\n        }\n    }\n\n    private static Direction oppositeDirection(Direction d) {\n        if(d == Direction.STILL) return Direction.STILL;\n        if(d == Direction.NORTH) return Direction.SOUTH;\n        if(d == Direction.EAST) return Direction.WEST;\n        if(d == Direction.SOUTH) return Direction.NORTH;\n        if(d == Direction.WEST) return Direction.EAST;\n        return null;\n    }\n}"
  },
  {
    "path": "website/tutorials/machinelearning/MattBot.py",
    "content": "from hlt import *\nfrom networking import *\n\nfrom keras.models import Sequential, model_from_json\nfrom keras.layers import Dense, Activation\nfrom keras.optimizers import SGD, Adam, RMSprop\n\nimport numpy as np\n\nmyID, gameMap = getInit()\n\nmodel = model_from_json(open('my_model_architecture.json').read())\nmodel.load_weights('my_model_weights.h5')\nmodel.compile(loss='mean_squared_error', optimizer=SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True))\n\n\nmaxProduction = 0\nfor y in range(gameMap.height):\n    for x in range(gameMap.width):\n        prod = gameMap.getSite(Location(x, y)).production\n        if prod > maxProduction:\n            maxProduction = prod\n\nsendInit(\"MattCopy\")\n\nwhile True:\n    moves = []\n    gameMap = getFrame()\n    for y in range(gameMap.height):\n        for x in range(gameMap.width):\n            loc = Location(x, y)\n            if gameMap.getSite(loc).owner == myID:\n                box = [gameMap.getSite(gameMap.getLocation(loc, NORTH), WEST), gameMap.getSite(loc, NORTH), gameMap.getSite(gameMap.getLocation(loc, NORTH), EAST), gameMap.getSite(loc, EAST), gameMap.getSite(gameMap.getLocation(loc, SOUTH), EAST), gameMap.getSite(loc, SOUTH), gameMap.getSite(gameMap.getLocation(loc, SOUTH), WEST), gameMap.getSite(loc, WEST)]\n                nnInput = []\n                for site in box:\n                    nnInput += [1 if site.owner == myID else -1, float(site.strength / 255), float(site.production / maxProduction)]\n                nnInput = np.asarray(nnInput).reshape((1, 24))\n\n                output = model.predict(nnInput)[0]\n\n                biggest = -222\n                direction = STILL\n                for d in range(len(output)):\n                    if output[d] > biggest:\n                        biggest = output[d]\n                        direction = d\n                moves.append(Move(loc, direction))\n    sendFrame(moves)\n"
  },
  {
    "path": "website/tutorials/machinelearning/TrainMatt.py",
    "content": "from hlt import *\nfrom networking import *\n\nfrom keras.models import Sequential\nfrom keras.layers import Dense, Activation\nfrom keras.optimizers import SGD, Adam, RMSprop\n\nfrom os import listdir, remove\nfrom os.path import join, isfile\n\ndef loadGame(filename):\n    def stringUntil(gameFile, endChar):\n        returnString = \"\"\n        byte = gameFile.read(1)\n        while byte != endChar.encode(\"utf-8\"):\n            returnString += byte.decode(\"utf-8\")\n            byte = gameFile.read(1)\n        return returnString\n        \n    mattID = None\n    frames = []\n    moves = []\n\n    gameFile = open(filename, \"rb\")\n    try:\n        stringUntil(gameFile, \"\\n\")\n\n        # Get metadata\n        metadata = stringUntil(gameFile, \"\\n\")\n\n        components = metadata.split(\" \")\n        width = int(components.pop(0))\n        height = int(components.pop(0))\n        numPlayers = int(components.pop(0))\n        numFrames = int(components.pop(0))\n\n        # Get matt's playerID\n        for playerID in range(1, numPlayers+1):\n            name = stringUntil(gameFile, \"\\0\")\n            if name == \"adereth\":\n                mattID = playerID\n            stringUntil(gameFile, \"\\n\")\n\n        # Get production\n        productions = [int.from_bytes(gameFile.read(1), byteorder='big') for a in range(width*height)]\n        gameFile.read(1)\n\n        # Get the frames and moves\n        for frameIndex in range(numFrames-1):\n            # Frames\n            frames.append(GameMap(width=width, height=height, numberOfPlayers=numPlayers))\n            x = 0\n            y = 0\n            while y < height:\n                numTiles = int.from_bytes(gameFile.read(1), byteorder='big')\n                ownerID = int.from_bytes(gameFile.read(1), byteorder='big')\n\n                strengths = []\n                for a in range(numTiles):\n                    frames[-1].contents[y][x] = Site(ownerID, int.from_bytes(gameFile.read(1), byteorder='big'), productions[y*width + x])\n\n                    x += 1\n                    if x == width:\n                        x = 0\n                        y += 1\n                        if y == height:\n                            break\n            # Moves\n            moves.append({(index % width, math.floor(index/width)):int.from_bytes(gameFile.read(1), byteorder='big') for index in range(width*height)})\n    finally:\n        gameFile.close()\n    return mattID, frames, moves\n\ndef getNNData():\n    inputs = []\n    correctOutputs = []\n\n    gamePath = \"replays\"\n\n    for filename in [f for f in listdir(gamePath) if isfile(join(gamePath, f))]:\n        print(\"Loading \" + filename)\n\n        mattID, frames, moves = loadGame(join(gamePath, filename))\n        maxProduction = 0\n        for y in range(frames[0].height):\n            for x in range(frames[0].width):\n                prod = frames[0].getSite(Location(x, y)).production\n                if prod > maxProduction:\n                    maxProduction = prod\n        for turnIndex in range(len(moves)):\n            gameMap = frames[turnIndex]\n            for y in range(gameMap.height):\n                for x in range(gameMap.width):\n                    loc = Location(x, y)\n                    if gameMap.getSite(loc).owner == mattID:\n                        box = [gameMap.getSite(gameMap.getLocation(loc, NORTH), WEST), gameMap.getSite(loc, NORTH), gameMap.getSite(gameMap.getLocation(loc, NORTH), EAST), gameMap.getSite(loc, EAST), gameMap.getSite(gameMap.getLocation(loc, SOUTH), EAST), gameMap.getSite(loc, SOUTH), gameMap.getSite(gameMap.getLocation(loc, SOUTH), WEST), gameMap.getSite(loc, WEST)]\n                        nnInput = []\n                        for site in box:\n                            nnInput += [1 if site.owner == mattID else -1, float(site.strength / 255), float(site.production / maxProduction)]\n                        inputs.append(nnInput)\n                        correctOutputs.append([1 if a == moves[turnIndex][(x, y)] else 0 for a in range(5)])\n    return inputs, correctOutputs\ndef trainModel():\n    inputs, correctOutputs = getNNData()\n\n    print(\"Collected data\")\n\n    trainingInputs = inputs[:len(inputs)//2]\n    trainingOutputs = correctOutputs[:len(correctOutputs)//2]\n\n    testInputs = inputs[len(inputs)//2:]\n    testOutputs = correctOutputs[len(correctOutputs)//2:]\n\n    model = Sequential()\n    model.add(Dense(24, input_shape=(24, )))\n    model.add(Activation('tanh'))\n    model.add(Dense(24))\n    model.add(Activation('tanh'))\n    model.add(Dense(5))\n    model.add(Activation('softmax'))\n\n    model.summary()\n\n    model.compile(loss='mean_squared_error', optimizer=SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True))\n\n    model.fit(trainingInputs, trainingOutputs, validation_data=(testInputs, testOutputs))\n    score = model.evaluate(testInputs, testOutputs, verbose=0)\n    print(score)\n\n    json_string = model.to_json()\n    open('my_model_architecture.json', 'w').write(json_string)\n    model.save_weights('my_model_weights.h5', overwrite=True)\n\ntrainModel()\n"
  },
  {
    "path": "website/tutorials/machinelearning/hlt.py",
    "content": "import random\nimport math\nimport copy\n\nSTILL = 0\nNORTH = 1\nEAST = 2\nSOUTH = 3\nWEST = 4\n\nDIRECTIONS = [a for a in range(0, 5)]\nCARDINALS = [a for a in range(1, 5)]\n\nATTACK = 0\nSTOP_ATTACK = 1\n\nclass Location:\n    def __init__(self, x=0, y=0):\n        self.x = x\n        self.y = y\nclass Site:\n    def __init__(self, owner=0, strength=0, production=0):\n        self.owner = owner\n        self.strength = strength\n        self.production = production\nclass Move:\n    def __init__(self, loc=0, direction=0):\n        self.loc = loc\n        self.direction = direction\n\nclass GameMap:\n    def __init__(self, width = 0, height = 0, numberOfPlayers = 0):\n        self.width = width\n        self.height = height\n        self.contents = []\n\n        for y in range(0, self.height):\n            row = []\n            for x in range(0, self.width):\n                row.append(Site(0, 0, 0))\n            self.contents.append(row)\n\n    def inBounds(self, l):\n        return l.x >= 0 and l.x < self.width and l.y >= 0 and l.y < self.height\n\n    def getDistance(self, l1, l2):\n        dx = math.abs(l1.x - l2.x)\n        dy = math.abs(l1.y - l2.y)\n        if dx > self.width / 2:\n            dx = self.width - dx\n        if dy > self.height / 2:\n            dy = self.height - dy\n        return dx + dy\n\n    def getAngle(self, l1, l2):\n        dx = l2.x - l1.x\n        dy = l2.y - l1.y\n\n        if dx > self.width - dx:\n            dx -= self.width\n        elif -dx > self.width + dx:\n            dx += self.width\n\n        if dy > self.height - dy:\n            dy -= self.height\n        elif -dy > self.height + dy:\n            dy += self.height\n        return math.atan2(dy, dx)\n\n    def getLocation(self, loc, direction):\n        l = copy.deepcopy(loc)\n        if direction != STILL:\n            if direction == NORTH:\n                if l.y == 0:\n                    l.y = self.height - 1\n                else:\n                    l.y -= 1\n            elif direction == EAST:\n                if l.x == self.width - 1:\n                    l.x = 0\n                else:\n                    l.x += 1\n            elif direction == SOUTH:\n                if l.y == self.height - 1:\n                    l.y = 0\n                else:\n                    l.y += 1\n            elif direction == WEST:\n                if l.x == 0:\n                    l.x = self.width - 1\n                else:\n                    l.x -= 1\n        return l\n    def getSite(self, l, direction = STILL):\n        l = self.getLocation(l, direction)\n        return self.contents[l.y][l.x]\n"
  },
  {
    "path": "website/tutorials/machinelearning/my_model_architecture.json",
    "content": "{\"class_name\": \"Sequential\", \"sample_weight_mode\": null, \"loss\": \"mean_squared_error\", \"config\": [{\"class_name\": \"Dense\", \"config\": {\"b_regularizer\": null, \"batch_input_shape\": [null, 24], \"W_regularizer\": null, \"output_dim\": 24, \"W_constraint\": null, \"name\": \"dense_1\", \"input_dtype\": \"float32\", \"b_constraint\": null, \"bias\": true, \"activation\": \"linear\", \"trainable\": true, \"input_dim\": null, \"init\": \"glorot_uniform\", \"activity_regularizer\": null}}, {\"class_name\": \"Activation\", \"config\": {\"trainable\": true, \"activation\": \"tanh\", \"name\": \"activation_1\"}}, {\"class_name\": \"Dense\", \"config\": {\"b_regularizer\": null, \"W_regularizer\": null, \"output_dim\": 24, \"W_constraint\": null, \"name\": \"dense_2\", \"b_constraint\": null, \"bias\": true, \"activation\": \"linear\", \"trainable\": true, \"input_dim\": null, \"init\": \"glorot_uniform\", \"activity_regularizer\": null}}, {\"class_name\": \"Activation\", \"config\": {\"trainable\": true, \"activation\": \"tanh\", \"name\": \"activation_2\"}}, {\"class_name\": \"Dense\", \"config\": {\"b_regularizer\": null, \"W_regularizer\": null, \"output_dim\": 5, \"W_constraint\": null, \"name\": \"dense_3\", \"b_constraint\": null, \"bias\": true, \"activation\": \"linear\", \"trainable\": true, \"input_dim\": null, \"init\": \"glorot_uniform\", \"activity_regularizer\": null}}, {\"class_name\": \"Activation\", \"config\": {\"trainable\": true, \"activation\": \"softmax\", \"name\": \"activation_3\"}}], \"keras_version\": \"1.0.5\", \"optimizer\": {\"momentum\": 0.8999999761581421, \"lr\": 0.10000000149011612, \"decay\": 9.999999974752427e-07, \"name\": \"SGD\", \"nesterov\": true}}"
  },
  {
    "path": "website/tutorials/machinelearning/networking.py",
    "content": "from hlt import *\nimport socket\nimport traceback\nimport struct\nfrom ctypes import *\nimport sys\n\n_productions = []\n_width = -1\n_height = -1\n\ndef serializeMoveSet(moves):\n    returnString = \"\"\n    for move in moves:\n        returnString += str(move.loc.x) + \" \" + str(move.loc.y) + \" \" + str(move.direction) + \" \"\n    return returnString\n\ndef deserializeMapSize(inputString):\n    splitString = inputString.split(\" \")\n\n    global _width, _height\n    _width = int(splitString.pop(0))\n    _height = int(splitString.pop(0))\n\ndef deserializeProductions(inputString):\n    splitString = inputString.split(\" \")\n\n    for a in range(0, _height):\n        row = []\n        for b in range(0, _width):\n            row.append(int(splitString.pop(0)))\n        _productions.append(row)\n\ndef deserializeMap(inputString):\n    splitString = inputString.split(\" \")\n\n    m = GameMap(_width, _height)\n\n    y = 0\n    x = 0\n    counter = 0\n    owner = 0\n    while y != m.height:\n        counter = int(splitString.pop(0))\n        owner = int(splitString.pop(0))\n        for a in range(0, counter):\n            m.contents[y][x].owner = owner\n            x += 1\n            if x == m.width:\n                x = 0\n                y += 1\n\n    for a in range(0, _height):\n        for b in range(0, _width):\n            m.contents[a][b].strength = int(splitString.pop(0))\n            m.contents[a][b].production = _productions[a][b]\n\n    return m\n\ndef sendString(toBeSent):\n    toBeSent += '\\n'\n\n    sys.stdout.write(toBeSent)\n    sys.stdout.flush()\n\ndef getString():\n    return sys.stdin.readline().rstrip('\\n')\n\ndef getInit():\n    playerTag = int(getString())\n    deserializeMapSize(getString())\n    deserializeProductions(getString())\n    m = deserializeMap(getString())\n\n    return (playerTag, m)\n\ndef sendInit(name):\n    sendString(name)\n\ndef getFrame():\n    return deserializeMap(getString())\n\ndef sendFrame(moves):\n    sendString(serializeMoveSet(moves))\n"
  },
  {
    "path": "website/tutorials/random/ImprovedRandom.cpp",
    "content": "#include <stdlib.h>\n#include <time.h>\n\n#include \"hlt.hpp\"\n#include \"networking.hpp\"\n\nint main() {\n    srand(time(NULL));\n\n    std::cout.sync_with_stdio(0);\n\n    unsigned char myID;\n    hlt::GameMap presentMap;\n    getInit(myID, presentMap);\n    sendInit(\"C++Bot\");\n\n    std::set<hlt::Move> moves;\n    while(true) {\n        moves.clear();\n\n        getFrame(presentMap);\n\n        for(unsigned short a = 0; a < presentMap.height; a++) {\n            for(unsigned short b = 0; b < presentMap.width; b++) {\n                if (presentMap.getSite({ b, a }).owner == myID) {\n\n                    bool movedPiece = false;\n                    \n                    for(int d : CARDINALS) {\n                        if(presentMap.getSite({ b, a }, d).owner != myID && presentMap.getSite({ b, a }, d).strength < presentMap.getSite({ b, a }).strength) {\n                            moves.insert({ { b, a }, d });\n                            movedPiece = true;\n                            break;\n                        }\n                    }\n\n                    if(!movedPiece && presentMap.getSite({ b, a }).strength < presentMap.getSite({ b, a }).production * 5) {\n                        moves.insert({ { b, a }, STILL });\n                        movedPiece = true;\n                    }\n                    \n                    if(!movedPiece) {\n                        moves.insert({ { b, a }, (bool)(rand() % 2) ? NORTH : WEST });\n                        movedPiece = true;\n                    }\n                }\n            }\n        }\n\n        sendFrame(moves);\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "website/tutorials/random/ImprovedRandom.java",
    "content": "import java.util.ArrayList;\nimport java.util.Random;\n\npublic class ImprovedRandom {\n    public static void main(String[] args) throws java.io.IOException {\n        InitPackage iPackage = Networking.getInit();\n        int myID = iPackage.myID;\n        GameMap gameMap = iPackage.map;\n\n        Networking.sendInit(\"JavaBot\");\n\n        Random rand = new Random();\n\n        while(true) {\n            ArrayList<Move> moves = new ArrayList<Move>();\n\n            gameMap = Networking.getFrame();\n\n            for(int y = 0; y < gameMap.height; y++) {\n                for(int x = 0; x < gameMap.width; x++) {\n                    Site site = gameMap.getSite(new Location(x, y));\n                    if(site.owner == myID) {\n\n                        boolean movedPiece = false;\n                        for(Direction d : Direction.CARDINALS) {\n                            if(gameMap.getSite(new Location(x, y), d).owner != myID && gameMap.getSite(new Location(x, y), d).strength < gameMap.getSite(new Location(x, y)).strength) {\n                                moves.add(new Move(new Location(x, y), d));\n                                movedPiece = true;\n                                break;\n                            }\n                        }\n\n                        if(!movedPiece && gameMap.getSite(new Location(x, y)).strength < gameMap.getSite(new Location(x, y)).production * 5) {\n                            moves.add(new Move(new Location(x, y), Direction.STILL));\n                            movedPiece = true;\n                        }\n\n                        if(!movedPiece) {\n                            moves.add(new Move(new Location(x, y), rand.nextBoolean() ? Direction.NORTH : Direction.WEST));\n                            movedPiece = true;\n                        }\n                    }\n                }\n            }\n            Networking.sendFrame(moves);\n        }\n    }\n}"
  },
  {
    "path": "website/tutorials/random/ImprovedRandom.py",
    "content": "from hlt import *\nfrom networking import *\n\nmyID, gameMap = getInit()\nsendInit(\"PythonBot\")\n\nwhile True:\n    moves = []\n    gameMap = getFrame()\n    for y in range(gameMap.height):\n        for x in range(gameMap.width):\n            if gameMap.getSite(Location(x, y)).owner == myID:\n\n                movedPiece = False\n\n                for d in CARDINALS:\n                    if gameMap.getSite(Location(x, y), d).owner != myID and gameMap.getSite(Location(x, y), d).strength < presentMap.getSite(Location(x, y)).strength:\n                        moves.append(Move(Location(x, y), d))\n                        movedPiece = True\n                        break\n\n                if not movedPiece and gameMap.getSite(Location(x, y)).strength < gameMap.getSite(Location(x, y)).production * 5:\n                    moves.append(Move(Location(x, y), STILL))\n                    movedPiece = True\n\n                if not movedPiece:\n                    moves.append(Move(Location(x, y), NORTH if bool(int(random.random() * 2)) else WEST))\n                    movedPiece = True\n\n    sendFrame(moves)"
  },
  {
    "path": "website/user.php",
    "content": "<html lang=\"en\">\n<head>\n    <?php include 'includes/header.php'; ?>\n\n    <title></title>\n\n    <link href=\"lib/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"style/general.css\" rel=\"stylesheet\">\n</head>\n<body>\n    <div class=\"container\">\n        <?php include 'includes/navbar.php'; ?>\n        <div class=\"modal fade\" id=\"notifModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"notifModalLabel\">\n            <div class=\"modal-dialog\" role=\"document\">\n                <div class=\"modal-content\">\n                    <div class=\"modal-header\" id=\"notifModalHeader\">\n                    </div>\n                    <div class=\"modal-body\" id=\"notifModalBody\">\n                    </div>\n                </div>\n            </div>\n        </div>\n        <div class=\"row\" id=\"loginMessage\" style=\"display: none;\">\n            <div class=\"col-md-12\">\n                <h2><a href=\"https://github.com/login/oauth/authorize?scope=user:email&client_id=2b713362b2f331e1dde3\">Login</a> to see this page.</h2>\n            </div>\n        </div>\n        <div class=\"row\" id=\"noBotMessage\" style=\"display: none;\">\n            <div class=\"col-md-12\">\n                <h2>This user doesn't currently have a bot on the leaderboard!</h2>\n            </div>\n        </div>\n        <div class=\"row\" id=\"normalBody\">\n            <div class=\"col-xl-6 col-lg-5 col-md-12\">\n                <div id=\"profileCard\" class=\"panel panel-default text-center\" style=\"padding: 21px; margin-bottom: 21px;\">\n                    <img id=\"profileImage\" style=\"border-radius: 4px; width: 100%; max-width: 200px;\">\n                    <h1 id=\"name\" style=\"margin-top: 12px\"></h1>\n                    <p id=\"primaryInfo\" style=\"line-height: 1.2em; font-size: 20px;\"></p>\n                    <p id=\"secondaryInfo\" style=\"line-height 1em; margin-bottom: 0px; font-size: 15px;\"></p>\n                </div>\n                <div id=\"notifsPanel\" style='display: none;' class=\"panel panel-default\">\n                    <div class=\"panel-heading\">\n                        <h3 class=\"panel-title\">Events</h3>\n                    </div>\n                    <table class=\"table\" id=\"notifsTable\">\n                        <tbody id=\"notifsTableBody\">\n                        </tbody>\n                    </table>\n                </div>\n                <div id=\"historyPanel\" class=\"panel panel-default\">\n                    <div class=\"panel-heading\">\n                        <h3 class=\"panel-title\">Recent History</h3>\n                    </div>\n                    <table class=\"table\" id=\"historyTable\">\n                        <thead>\n                            <tr id=\"historyTableHeader\">\n                                <th>Version</th>\n                                <th>Final Ranking</th>\n                                <th>Games Played</th>\n                            </tr>\n                        </thead>\n                        <tbody id=\"historyTableBody\">\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"col-xl-6 col-lg-7 col-md-12\">\n                <div class=\"text-center\" style=\"display: none;\" id=\"noGameMessage\">\n                    <span class=\"glyphicon glyphicon-warning-sign\" style=\"font-size: 8em;\"></span>\n                    <h3>There are no games recorded yet.</h3>\n                </div>\n                <div id=\"gamePanel\" class=\"panel panel-default\">\n                    <div class=\"panel-heading\">\n                        <h3 class=\"panel-title\">Game Feed</h3>\n                    </div>\n                    <table class=\"table\" id=\"gameTable\">\n                        <thead>\n                            <tr id=\"gameTableHeader\">\n                            </tr>\n                        </thead>\n                        <tbody id=\"gameTableBody\">\n                        </tbody>\n                    </table>\n                    <button type=\"button\" id=\"loadButton\" class=\"btn btn-default\" style=\"width: 100%;\">Load More</button>\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n    <script src=\"lib/xss.js\"></script>\n    <script src=\"script/backend.js\"></script>\n    <script src=\"script/general.js\"></script>\n    <script src=\"script/user.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "worker/Dockerfile",
    "content": "FROM ubuntu:latest\n\nRUN apt-get update\n\nRUN apt-get install -y sudo\nRUN apt-get install -y curl\n\nRUN apt-get install -y libstdc++6\nRUN apt-get install -y gcc\nRUN apt-get install -y g++\nRUN apt-get install -y python3 python3-pip python3-dev python3-numpy\nRUN curl -sSf https://static.rust-lang.org/rustup.sh | sh\nRUN apt-get install -y python-software-properties\n\nRUN apt-get install -y software-properties-common\nRUN apt-get install -y openjdk-8-jdk\nRUN apt-get install -y scala\n\nRUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF\nRUN echo \"deb http://download.mono-project.com/repo/debian wheezy main\" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list\nRUN apt-get update\nRUN apt-get install -y mono-devel\n\nRUN apt-get install -y ruby\nRUN gem install bundler \n\nRUN apt-get install -y golang\n\nRUN apt-get install -y php\n\nRUN apt-get install -y build-essential\nRUN curl -sL https://deb.nodesource.com/setup_7.x | bash -\nRUN apt-get install -y nodejs\n\nRUN apt-get install -y ocaml\n\nRUN sh -c 'echo \"$(curl -fsSL https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein)\" > /usr/bin/lein'\nRUN chmod a+x /usr/bin/lein\nRUN lein\n\nRUN apt-get install -y git\n\nRUN pip3 install numpy scipy scikit-learn pillow h5py\nRUN pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp35-cp35m-linux_x86_64.whl \nRUN pip3 install keras\n\nRUN apt-get install -y julia\n"
  },
  {
    "path": "worker/archive.py",
    "content": "import zipfile\nimport os\nimport platform\nimport shutil\n\ndef unpack(filePath):\n    \"\"\"Unpacks and deletes a zip file into the files current path\"\"\"\n    folderPath = os.path.dirname(filePath)\n    tempPath = os.path.join(folderPath, \"bot\")\n    os.mkdir(tempPath)\n\n    # Extract the archive into a folder call 'bot'\n    if platform.system() == 'Windows':\n        os.system(\"7z x -o\"+tempPath+\" -y \"+filePath+\". > NUL\")\n    else:\n        os.system(\"unzip -u -d\"+tempPath+\" \"+filePath+\" > /dev/null 2> /dev/null\")\n\n    # Remove __MACOSX folder if present\n    macFolderPath = os.path.join(tempPath, \"__MACOSX\")\n    if os.path.exists(macFolderPath) and os.path.isdir(macFolderPath):\n        shutil.rmtree(macFolderPath)\n\n    # Copy contents of bot folder to folderPath remove bot folder\n    for filename in os.listdir(tempPath):\n        shutil.move(os.path.join(tempPath, filename), os.path.join(folderPath, filename))\n\n    shutil.rmtree(tempPath)\n    os.remove(filePath)\n\ndef zipFolder(folderPath, destinationFilePath):\n    \"\"\"Zips a folder to a path\"\"\"\n    zipFile = zipfile.ZipFile(destinationFilePath, \"w\", zipfile.ZIP_DEFLATED)\n\n    originalDir = os.getcwd()\n    os.chdir(folderPath)\n\n    for rootPath, dirs, files in os.walk(\".\"):\n        for file in files:\n            if os.path.basename(file) != os.path.basename(destinationFilePath):\n                zipFile.write(os.path.join(rootPath, file))\n\n    zipFile.close()\n\n    os.chdir(originalDir)\n"
  },
  {
    "path": "worker/backend.py",
    "content": "import urllib.request\nimport requests\nimport json\nfrom hashlib import md5\nimport configparser\nimport os\nfrom time import gmtime, strftime\n\nconfig = configparser.ConfigParser()\nconfig.read(\"../halite.ini\")\nAPI_KEY = config.get(\"hce\", \"apiKey\")\nMANAGER_URL = config.get(\"hce\", \"managerURL\")\n\ndef getTask():\n    \"\"\"Gets either a run or a compile task from the API\"\"\"\n    content = requests.get(MANAGER_URL+\"task\", params={\"apiKey\": API_KEY}).text\n\n    print(\"Task call %s\\n\" % content)\n    if content == \"null\":\n        return None\n    else:\n        return json.loads(content)\n\ndef getBotHash(userID, isCompile=False):\n    \"\"\"Gets the checksum of a user's bot's zipped source code\"\"\"\n    params = {\"apiKey\": API_KEY, \"userID\": userID}\n    if isCompile:\n            params[\"compile\"] = 1\n\n    result = requests.get(MANAGER_URL+\"botHash\", params=params)\n\n    print(\"Getting bot hash %s\\n\" % result.text)\n    return json.loads(result.text).get(\"hash\")\n\ndef storeBotLocally(userID, storageDir, isCompile=False):\n    \"\"\"Downloads and store's a bot's zip file locally\n    Checks the file's checksum to make sure the file was downloaded properly\n    \"\"\"\n    iterations = 0\n    while iterations < 100:\n        url = MANAGER_URL+\"botFile?apiKey=\"+str(API_KEY)+\"&userID=\"+str(userID)\n        if isCompile: url += \"&compile=1\"\n        print(\"Bot file url %s\\n\" % url)\n\n        remoteZip = urllib.request.urlopen(url)\n        zipFilename = remoteZip.headers.get('Content-disposition').split(\"filename\")[1]\n        zipPath = os.path.join(storageDir, zipFilename)\n        if os.path.exists(zipPath):\n            os.remove(zipPath)\n\n        remoteZipContents = remoteZip.read()\n        remoteZip.close()\n\n        localZip = open(zipPath, \"wb\")\n        localZip.write(remoteZipContents)\n        localZip.close()\n\n        if md5(remoteZipContents).hexdigest() != getBotHash(userID, isCompile):\n            iterations += 1\n            continue\n\n        return zipPath\n\n    raise ValueError\n\ndef storeBotRemotely(userID, zipFilePath):\n    \"\"\"Posts a bot file to the manager\"\"\"\n    zipContents = open(zipFilePath, \"rb\").read()\n    iterations = 0\n\n    while iterations < 100:\n        r = requests.post(MANAGER_URL+\"botFile\", data={\"apiKey\": API_KEY, \"userID\": str(userID)}, files={\"bot.zip\": zipContents})\n        print(\"Posting compiled bot archive %s\\n\" % r.text)\n\n        # Try again if local and remote hashes differ\n        if md5(zipContents).hexdigest() != getBotHash(userID):\n            print(\"Hashes do not match! Redoing file upload...\\n\")\n            iterations += 1\n            continue\n\n        return\n    raise ValueError\n\ndef compileResult(userID, didCompile, language, errors=None):\n    \"\"\"Posts the result of a compilation task\"\"\"\n    r = requests.post(MANAGER_URL+\"compile\", data={\"apiKey\": API_KEY, \"userID\": userID, \"didCompile\": int(didCompile), \"language\": language, \"errors\": errors})\n    print(\"Posting compile result %s\\n\" % r.text)\n\ndef gameResult(width, height, users, replayPath, errorPaths):\n    \"\"\"Posts the result of a game task\"\"\"\n    print(\"Posting game result %s (GMT)\\n\" % str(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime())))\n    files = {os.path.basename(replayPath): open(replayPath, \"rb\").read()}\n    for path in errorPaths:\n        files[os.path.basename(path)] = open(path, \"rb\").read()\n    r = requests.post(MANAGER_URL+\"game\", data={\"apiKey\": API_KEY, \"mapWidth\": str(width), \"mapHeight\": str(height), \"users\": json.dumps(users)}, files=files)\n    print(\"Got game result %s (GMT)\\n\" % str(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime())))\n    print(\"\\n-------Game result:-----\")\n    print(r.text)\n    print(\"------------------------\\n\")\n"
  },
  {
    "path": "worker/buildDocker.sh",
    "content": "docker build -t 'mntruell/halite_sandbox:latest' - < Dockerfile\n"
  },
  {
    "path": "worker/changeAPIKey.py",
    "content": "import sys\nimport configparser\n\napiKey = sys.argv[1]\niniFile = \"../halite.ini\"\n\nparser = configparser.ConfigParser()\nparser.read(iniFile)\nparser[\"hce\"][\"apiKey\"] = str(apiKey)\nparser.write(open(iniFile, \"w\"))\n"
  },
  {
    "path": "worker/compiler.py",
    "content": "# compiler.py\n# Original Author: Jeff Cameron (jeff@jpcameron.com)\n\nimport collections\nimport errno\nimport fnmatch\nimport glob\nimport json\nimport os\nimport os.path\nimport re\nimport shutil\nimport subprocess\nimport sys\nimport time\nfrom optparse import OptionParser\n\ntry:\n    from server_info import server_info\n    MEMORY_LIMIT = server_info.get('memory_limit', 1500)\nexcept ImportError:\n    MEMORY_LIMIT = 1500\n\nBOT = \"MyBot\"\nLANGUAGE_FILE = \"LANGUAGE\"\nSAFEPATH = re.compile('[a-zA-Z0-9_.$-]+$')\n\nclass CD(object):\n    def __init__(self, new_dir):\n        self.new_dir = new_dir\n\n    def __enter__(self):\n        self.org_dir = os.getcwd()\n        os.chdir(self.new_dir)\n        return self.new_dir\n\n    def __exit__(self, type, value, traceback):\n        os.chdir(self.org_dir)\n\ndef safeglob(pattern):\n    safepaths = []\n    for root, dirs, files in os.walk(\".\"):\n        print(\"Walking: \" + root + \" \" + \", \".join(dirs) + \" \" + \", \".join(files))\n        files = fnmatch.filter(files, pattern)\n        for fname in files:\n            print(os.path.splitext(fname)[0])\n            if SAFEPATH.match(fname) and os.path.splitext(fname)[0] != \"RandomBot\":\n                safepaths.append(os.path.join(root, fname))\n    return safepaths\n\ndef safeglob_multi(patterns):\n    safepaths = []\n    for pattern in patterns:\n        safepaths.extend(safeglob(pattern))\n    return safepaths\n\ndef nukeglob(pattern):\n    paths = safeglob(pattern)\n    for path in paths:\n        try:\n            os.unlink(path)\n        except OSError as e:\n            if e.errno != errno.ENOENT:\n                raise\n\ndef _run_cmd(cmd, working_dir, timelimit):\n    absoluteWorkingDir = os.path.abspath(working_dir)\n    cmd = \"docker run -i -v \"+absoluteWorkingDir+\":\"+absoluteWorkingDir+\" mntruell/halite_sandbox:latest sh -c \\\"cd \"+absoluteWorkingDir+\"; \"+cmd+\"\\\"\"\n    print(cmd)\n    process = subprocess.Popen(cmd, cwd=working_dir, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)\n\n    try:\n        rawOut, rawErrors = process.communicate(timeout=timelimit)\n        outString = rawOut.decode(\"utf-8\").strip()\n        out = outString.split(\"\\n\") if outString.isspace() == False and outString != \"\" else None\n\n        errorsString = rawErrors.decode(\"utf-8\").strip()\n        errors = errorsString.split(\"\\n\") if errorsString.isspace() == False and errorsString != \"\" else None\n    except TimeoutExpired as e:\n        out = []\n        errors = [\"Compilation timed out with command %s\" % (cmd,)]\n\n    os.system(\"docker kill $(docker ps -aq)\")\n    os.system(\"docker rm $(docker ps -aq)\")\n    return out, errors\n\n\ndef check_path(path, errors):\n    print(path)\n    if not os.path.exists(path):\n        errors.append(\"Output file \" + str(os.path.basename(path)) + \" was not created.\")\n        return False\n    else:\n        return True\n\nclass Compiler(object):\n    def compile(self, globs, errors):\n        raise NotImplementedError\n\nclass ChmodCompiler(Compiler):\n    def __init__(self, language):\n        self.language = language\n\n    def __str__(self):\n        return \"ChmodCompiler: %s\" % (self.language,)\n\n    def compile(self, bot_dir, globs, errors, timelimit):\n        with CD(bot_dir):\n            for f in safeglob_multi(globs):\n                try:\n                    os.chmod(f, 0o644)\n                except Exception as e:\n                    errors.append(\"Error chmoding %s - %s\\n\" % (f, e))\n        return True\n\nclass ExternalCompiler(Compiler):\n    def __init__(self, args, separate=False, out_files=[], out_ext=None):\n        self.args = args\n        self.separate = separate\n        self.out_files = out_files\n        self.out_ext = out_ext\n        self.stderr_re = re.compile(\"WARNING: IPv4 forwarding is disabled\")\n\n    def __str__(self):\n        return \"ExternalCompiler: %s\" % (' '.join(self.args),)\n\n    def compile(self, bot_dir, globs, errors, timelimit):\n        with CD(bot_dir):\n            print(\"GLOBS: \" + \", \".join(globs))\n            files = safeglob_multi(globs)\n            if (len(\"\".join(globs)) != 0 and len(files) == 0):\n                # no files to compile\n                return True\n\n        try:\n            if self.separate:\n                for filename in files:\n                    print(\"file: \" + filename)\n                    cmdline = \" \".join(self.args + [filename])\n                    cmd_out, cmd_errors = _run_cmd(cmdline, bot_dir, timelimit)\n                    cmd_errors = self.cmd_error_filter(cmd_out, cmd_errors);\n                    if not cmd_errors:\n                        for ofile in self.out_files:\n                            check_path(os.path.join(bot_dir, ofile), cmd_errors)\n                        if self.out_ext:\n                            oname = os.path.splitext(filename)[0] + self.out_ext\n                            check_path(os.path.join(bot_dir, oname), cmd_errors)\n                        if cmd_errors:\n                            cmd_errors += cmd_out\n                    if cmd_errors:\n                        errors += cmd_errors\n                        return False\n            else:\n                cmdline = \" \".join(self.args + files)\n                print(\"Files: \" + \" \".join(files))\n                cmd_out, cmd_errors = _run_cmd(cmdline, bot_dir, timelimit)\n                cmd_errors = self.cmd_error_filter(cmd_out, cmd_errors);\n                if not cmd_errors:\n                    for ofile in self.out_files:\n                        check_path(os.path.join(bot_dir, ofile), cmd_errors)\n                    if self.out_ext:\n                        for filename in files:\n                            oname = os.path.splitext(filename)[0] + self.out_ext\n                            check_path(os.path.join(bot_dir, oname), cmd_errors)\n                    if cmd_errors:\n                        cmd_errors += cmd_out\n                if cmd_errors:\n                    errors += cmd_errors\n                    return False\n        except:\n            pass\n        return True\n\n    def cmd_error_filter(self, cmd_out, cmd_errors):\n        cmd_errors = [line for line in cmd_errors if line is None or self.stderr_re.search(line) is None]\n        return cmd_errors\n\n\nclass ErrorFilterCompiler(ExternalCompiler):\n    def __init__(self, args, separate=False, out_files=[], out_ext=None, stdout_is_error=False, skip_stdout=0, filter_stdout=None, filter_stderr=None):\n        ExternalCompiler.__init__(self, args, separate, out_files, out_ext)\n        self.stdout_is_error = stdout_is_error\n        self.skip_stdout = skip_stdout;\n        if filter_stdout is None:\n            self.stdout_re = None\n        else:\n            self.stdout_re = re.compile(filter_stdout)\n        if filter_stderr is None:\n            self.stderr_re = None\n        else:\n            self.stderr_re = re.compile(filter_stderr)\n\n    def __str__(self):\n        return \"ErrorFilterCompiler: %s\" % (' '.join(self.args),)\n\n    def cmd_error_filter(self, cmd_out, cmd_errors):\n        cmd_errors = ExternalCompiler.cmd_error_filter(self, cmd_out, cmd_errors)\n\n        if self.skip_stdout > 0:\n            del cmd_out[:self.skip_stdout]\n        # Somehow there are None values in the output\n        if self.stdout_re is not None:\n            cmd_out = [line for line in cmd_out if\n                       line is None or not self.stdout_re.search(line)]\n        if self.stderr_re is not None:\n            cmd_errors = [line for line in cmd_errors if\n                          line is None or self.stderr_re.search(line) is None]\n        if self.stdout_is_error:\n            return [line for line in cmd_out if line is not None] + cmd_errors\n\n        return cmd_errors\n\nclass TargetCompiler(Compiler):\n    def __init__(self, args, replacements, outflag=\"-o\"):\n        self.args = args\n        self.replacements = replacements\n        self.outflag = outflag\n\n    def __str__(self):\n        return \"TargetCompiler: %s\" % (' '.join(self.args),)\n\n    def compile(self, bot_dir, globs, errors, timelimit):\n        with CD(bot_dir):\n            sources = safeglob_multi(globs)\n\n        try:\n            for source in sources:\n                head, ext = os.path.splitext(source)\n                if ext in self.replacements:\n                    target = head + self.replacements[ext]\n                else:\n                    errors.append(\"Could not determine target for source file %s.\" % source)\n                    return False\n                cmdline = \" \".join(self.args + [self.outflag, target, source])\n                cmd_out, cmd_errors = _run_cmd(cmdline, bot_dir, timelimit)\n                if cmd_errors:\n                    errors += cmd_errors\n                    return False\n        except:\n            pass\n        return True\n\nPYTHON_EXT_COMPILER = '''\"from distutils.core import setup\nfrom distutils.extension import read_setup_file\nsetup(ext_modules = read_setup_file('setup_exts'), script_args = ['-q', 'build_ext', '-i'])\"'''\n\ncomp_args = {\n    \"Ada\"           : [[\"gcc-4.4\", \"-O3\", \"-funroll-loops\", \"-c\"],\n                             [\"gnatbind\"],\n                             [\"gnatlink\", \"-o\", BOT]],\n    \"C\"             : [[\"gcc\", \"-O3\", \"-funroll-loops\", \"-c\"],\n                             [\"gcc\", \"-O2\", \"-lm\", \"-o\", BOT]],\n    \"C#\"            : [[\"mcs\", \"-warn:0\", \"-optimize+\", \"-pkg:dotnet\", \"-out:%s.exe\" % BOT]],\n    \"Clojure\"     : [[\"lein\", \"uberjar\"]],\n    \"VB\"            : [[\"vbnc\", \"-out:%s.exe\" % BOT]],\n    \"C++\"         : [[\"g++\", \"-O3\", \"-w\", \"-std=c++11\", \"-c\"],\n                             [\"g++\", \"-O2\", \"-lm\", \"-std=c++11\", \"-o\", BOT]],\n    \"D\"             : [[\"dmd\", \"-O\", \"-inline\", \"-release\", \"-noboundscheck\", \"-of\" + BOT]],\n    \"Groovy\"    : [[\"groovyc\"],\n                             [\"jar\", \"cfe\", BOT + \".jar\", BOT]],\n    \"Haskell\" : [[\"ghc\", \"--make\", BOT + \".hs\", \"-O\", \"-v0\"]],\n    \"Java\"        : [[\"javac\", \"-encoding\", \"UTF-8\", \"-J-Xmx%sm\" % (MEMORY_LIMIT)]],\n    \"Lisp\"      : [['sbcl', '--dynamic-space-size', str(MEMORY_LIMIT), '--script', BOT + '.lisp']],\n    \"OCaml\"     : [[\"ocamlbuild -lib unix\", BOT + \".native\"]],\n    \"Pascal\"    : [[\"fpc\", \"-Mdelphi\", \"-Si\", \"-O3\", \"-Xs\", \"-v0\", \"-o\" + BOT]],\n    \"Python\"   : [[\"python3\", \"-c\", PYTHON_EXT_COMPILER]],\n    \"Rust\"      : [[\"cargo\", \"build\", \"--release\", \"-q\"]],\n    \"Scala\"     : [[\"scalac\"]],\n    }\n\ntargets = {\n    \"C\"     : { \".c\" : \".o\" },\n    \"C++\" : { \".c\" : \".o\", \".cpp\" : \".o\", \".cc\" : \".o\" },\n    }\n\nLanguage = collections.namedtuple(\"Language\",\n        ['name', 'out_file', 'main_code_file', 'command', 'nukeglobs',\n            'compilers']\n        )\n\nlanguages = (\n    Language(\"Ada\", BOT, \"MyBot.adb\",\n        \"./MyBot\",\n        [\"*.ali\"],\n        [([\"*.adb\"], ExternalCompiler(comp_args[\"Ada\"][0])),\n            ([\"MyBot.ali\"], ExternalCompiler(comp_args[\"Ada\"][1])),\n            ([\"MyBot.ali\"], ExternalCompiler(comp_args[\"Ada\"][2]))]\n    ),\n    Language(\"C\", BOT, \"MyBot.c\",\n        \"./MyBot\",\n        [\"*.o\", BOT],\n        [([\"*.c\"], TargetCompiler(comp_args[\"C\"][0], targets[\"C\"])),\n            ([\"*.o\"], ExternalCompiler(comp_args[\"C\"][1]))]\n    ),\n    Language(\"C#\", BOT +\".exe\", \"MyBot.cs\",\n        \"mono MyBot.exe\",\n        [BOT + \".exe\"],\n        [([\"*.cs\"], ExternalCompiler(comp_args[\"C#\"][0]))]\n    ),\n    Language(\"VB\", BOT +\".exe\", \"MyBot.vb\",\n        \"mono MyBot.exe\",\n        [BOT + \".exe\"],\n        [([\"*.vb\"],\n            ExternalCompiler(comp_args[\"VB\"][0], out_files=['MyBot.exe']))]\n    ),\n    Language(\"C++\", BOT, \"MyBot.cpp\",\n        \"./MyBot\",\n        [\"*.o\", BOT],\n        [\n            ([\"*.c\", \"*.cpp\", \"*.cc\"],\n                TargetCompiler(comp_args[\"C++\"][0], targets[\"C++\"])),\n            ([\"*.o\"], ExternalCompiler(comp_args[\"C++\"][1]))\n        ]\n    ),\n    Language(\"Clojure\", \"target/\"+BOT +\".jar\", \"project.clj\",\n        \"java -cp target/MyBot.jar MyBot\",\n        [],\n        [([\"\"], ErrorFilterCompiler(comp_args[\"Clojure\"][0], filter_stderr=\"(Retrieving|Compiling)\"))]\n    ),\n    Language(\"CoffeeScript\", BOT +\".coffee\", \"MyBot.coffee\",\n        \"coffee MyBot.coffee\",\n        [],\n        [([\"*.coffee\"], ChmodCompiler(\"CoffeeScript\"))]\n    ),\n    Language(\"D\", BOT, \"MyBot.d\",\n        \"./MyBot\",\n        [\"*.o\", BOT],\n        [([\"*.d\"], ExternalCompiler(comp_args[\"D\"][0]))]\n    ),\n    Language(\"Dart\", BOT +\".dart\", \"MyBot.dart\",\n        \"frogsh MyBot.dart\",\n        [], [([\"*.dart\"], ChmodCompiler(\"Dart\"))]),\n    Language(\"Erlang\", \"my_bot.beam\", \"my_bot.erl\",\n        \"erl -hms\"+ str(MEMORY_LIMIT) +\"m -smp disable -noshell -s my_bot start -s init stop\",\n        [\"*.beam\"],\n        [([\"*.erl\"], ExternalCompiler([\"erlc\"], out_ext=\".beam\"))]\n    ),\n    Language(\"Go\", BOT +\".go\", \"MyBot.go\",\n        \"export GOPATH=\\\"$(pwd)\\\"; go run MyBot.go\",\n        [],\n        [([\"*.go\"], ChmodCompiler(\"Go\"))]\n    ),\n    Language(\"Groovy\", BOT +\".jar\", \"MyBot.groovy\",\n        \"java -Xmx\" + str(MEMORY_LIMIT) + \"m -cp MyBot.jar:/usr/share/groovy/embeddable/groovy-all-1.7.5.jar MyBot\",\n        [\"*.class, *.jar\"],\n        [([\"*.groovy\"], ExternalCompiler(comp_args[\"Groovy\"][0])),\n        ([\"*.class\"], ExternalCompiler(comp_args[\"Groovy\"][1]))]\n    ),\n    Language(\"Haskell\", BOT, \"MyBot.hs\",\n        \"./MyBot +RTS -M\" + str(MEMORY_LIMIT) + \"m\",\n        [BOT],\n        [([\"\"], ExternalCompiler(comp_args[\"Haskell\"][0]))]\n    ),\n    Language(\"Java\", BOT +\".java\", \"MyBot.java\",\n        \"java MyBot\",\n        [\"*.class\", \"*.jar\"],\n        [([\"*.java\"], ErrorFilterCompiler(comp_args[\"Java\"][0], filter_stderr=\"Note:\", out_files=[\"MyBot.class\"]))]\n    ),\n    Language(\"JavaScript\", BOT +\".js\", \"MyBot.js\",\n        \"node MyBot.js\",\n        [],\n        [([\"*.js\"], ChmodCompiler(\"JavaScript\"))]\n    ),\n    Language(\"JAR\", BOT +\".jar\", \"MyBot.jar\",\n        \"java -jar MyBot.jar\",\n        [],\n        [([\"*.jar\"], ChmodCompiler(\"JAR\"))]\n    ),\n    Language(\"Julia\", BOT +\".jl\", \"MyBot.jl\",\n        \"julia MyBot.jl\",\n        [],\n        [([\"*.jl\"], ChmodCompiler(\"Julia\"))]\n    ),\n    Language(\"Lisp\", BOT, \"MyBot.lisp\",\n        \"./MyBot --dynamic-space-size \" + str(MEMORY_LIMIT),\n        [BOT],\n        [([\"\"], ExternalCompiler(comp_args[\"Lisp\"][0]))]\n    ),\n    Language(\"Lua\", BOT +\".lua\", \"MyBot.lua\",\n        \"luajit-2.0.0-beta5 MyBot.lua\",\n        [],\n        [([\"*.lua\"], ChmodCompiler(\"Lua\"))]\n    ),\n    Language(\"OCaml\", BOT +\".native\", \"MyBot.ml\",\n        \"./MyBot.native\",\n        [BOT + \".native\"],\n        [([\"\"], ExternalCompiler(comp_args[\"OCaml\"][0]))]\n    ),\n    Language(\"Octave\", BOT + \".m\", \"MyBot.m\",\n        \"octave -qf MyBot.m\",\n        [],\n        [([\"*.m\"], ChmodCompiler(\"Octave\"))]\n    ),\n    Language(\"Pascal\", BOT, BOT + \".pas\",\n        \"./\" + BOT,\n        [BOT, \"*.o\", \"*.ppu\"],\n        [([BOT + \".pas\"], ErrorFilterCompiler(comp_args[\"Pascal\"][0],\n           stdout_is_error=True, skip_stdout=2,\n           filter_stderr='^/usr/bin/ld: warning: link.res contains output sections; did you forget -T\\?$'))]\n    ),\n    Language(\"Perl\", BOT +\".pl\", \"MyBot.pl\",\n        \"perl MyBot.pl\",\n        [],\n        [([\"*.pl\"], ChmodCompiler(\"Perl\"))]\n    ),\n    Language(\"PHP\", BOT +\".php\", \"MyBot.php\",\n        \"php MyBot.php\",\n        [],\n        [([\"*.php\"], ChmodCompiler(\"PHP\"))]\n    ),\n    Language(\"Python\", BOT +\".py\", \"MyBot.py\",\n        \"python3 MyBot.py\",\n        [\"*.pyc\"],\n        [([\"*.py\"], ChmodCompiler(\"Python\")),\n        ([\"setup_exts\"], ErrorFilterCompiler(comp_args[\"Python\"][0], separate=True, filter_stderr='-Wstrict-prototypes'))]\n    ),\n    Language(\"Racket\", BOT +\".rkt\", \"MyBot.rkt\",\n        \"racket MyBot.rkt\",\n        [],\n        [([\"*.rkt\"], ChmodCompiler(\"Racket\"))]\n    ),\n    Language(\"Ruby\", BOT +\".rb\", \"MyBot.rb\",\n        \"ruby MyBot.rb\",\n        [],\n        [([\"*.rb\"], ChmodCompiler(\"Ruby\"))]\n    ),\n    Language(\"Rust\", \"target/release/\"+BOT, \"Cargo.toml\",\n        \"target/release/MyBot\",\n        [],\n        [([\"\"], ErrorFilterCompiler(comp_args[\"Rust\"][0], filter_stderr=\"warning:\"))]\n    ),\n    Language(\"Scala\", BOT +\".scala\", \"MyBot.scala\",\n        'scala -J-Xmx'+ str(MEMORY_LIMIT) +'m -howtorun:object MyBot',\n        [\"*.scala, *.jar\"],\n        [([\"*.java\"], ExternalCompiler(comp_args[\"Java\"][0])), ([\"*.scala\"], ExternalCompiler(comp_args[\"Scala\"][0]))]\n    ),\n    Language(\"Scheme\", BOT +\".ss\", \"MyBot.ss\",\n        \"./MyBot\",\n        [],\n        [([\"*.ss\"], ChmodCompiler(\"Scheme\"))]\n    ),\n    Language(\"Tcl\", BOT +\".tcl\", \"MyBot.tcl\",\n        \"tclsh8.5 MyBot.tcl\",\n        [],\n        [([\"*.tcl\"], ChmodCompiler(\"Tcl\"))]\n    ),\n)\n\n\ndef compile_function(language, bot_dir, timelimit):\n    with CD(bot_dir):\n        print(\"cd\")\n        for glob in language.nukeglobs:\n            print(\"nuke\")\n            nukeglob(glob)\n\n    errors = []\n    for globs, compiler in language.compilers:\n        try:\n            if not compiler.compile(bot_dir, globs, errors, timelimit):\n                return False, errors\n        except Exception as exc:\n            raise\n            errors.append(\"Compiler %s failed with: %s\"\n                    % (compiler, exc))\n            return False, errors\n    print(\"joining\")\n    compiled_bot_file = os.path.join(bot_dir, language.out_file)\n    print(\"joined\")\n    return check_path(compiled_bot_file, errors), errors\n\n_LANG_NOT_FOUND = \"\"\"Did not find a recognized MyBot.* file.\nPlease add one of the following filenames to your zip file:\n%s\"\"\"\n\ndef detect_language(bot_dir):\n    with CD(bot_dir):\n        detected_langs = [\n            lang for lang in languages if os.path.exists(lang.main_code_file)\n        ]\n        if len(detected_langs) > 1:\n            return None, ['Found multiple MyBot.* files: \\n'+\n                          '\\n'.join([l.main_code_file for l in detected_langs])]\n        elif len(detected_langs) == 0:\n            return None, [_LANG_NOT_FOUND % (\n                '\\n'.join(l.name +\": \"+ l.main_code_file for l in languages),)]\n        else:\n            return detected_langs[0], None\n\ndef detect_language_file(bot_dir):\n    with CD(bot_dir):\n        try:\n            with open(LANGUAGE_FILE, 'r') as lang_file:\n                print(\"detected %s file\" % LANGUAGE_FILE)\n                language_name = lang_file.readline().strip()\n\n                if not language_name:\n                    return None\n                else:\n                    return language_name\n        except IOError:\n            return None\n\ndef get_run_cmd(submission_dir):\n    with CD(submission_dir):\n        if os.path.exists('run.sh'):\n            with open('run.sh') as f:\n                for line in f:\n                    if line[0] != '#':\n                        return line.rstrip('\\r\\n')\n\ndef get_run_lang(submission_dir):\n    with CD(submission_dir):\n        if os.path.exists('run.sh'):\n            with open('run.sh') as f:\n                for line in f:\n                    if line[0] == '#':\n                        return line[1:-1]\n\ndef compile_anything(bot_dir, installTimeLimit=600, timelimit=600, max_error_len = 3072):\n    if os.path.exists(os.path.join(bot_dir, \"install.sh\")):\n        _, errors = _run_cmd(\"chmod +x install.sh; ./install.sh\", bot_dir, installTimeLimit)\n    detected_language, errors = detect_language(bot_dir)\n    print(\"detected language\")\n    if detected_language:\n        print(\"compiling\")\n        compiled, errors = compile_function(detected_language, bot_dir, timelimit)\n        print(\"done compiling\")\n        if compiled:\n            name = detected_language.name\n            run_cmd = detected_language.command\n            run_filename = os.path.join(bot_dir, 'run.sh')\n            print(\"filename:\")\n            print(run_filename)\n            try:\n                with open(run_filename, 'wb') as f:\n                    f.write(bytes('#%s\\n%s\\n' % (name, run_cmd), 'UTF-8'))\n                print(\"file:\")\n                with open(run_filename, 'r') as f:\n                    for line in f:\n                        print(line)\n            except Exception as e:\n                print(\"error\")\n                print(e.strerror)\n\n            # allow LANGUAGE file to override language name\n            override_name = detect_language_file(bot_dir)\n            if override_name:\n                name = override_name\n            return name, None\n        else:\n            # limit length of reported errors\n            if len(errors) > 0 and sum(map(len, errors)) > max_error_len:\n                first_errors = []\n                cur_error = 0\n                length = len(errors[0])\n                while length < (max_error_len / 3): # take 1/3 from start\n                    first_errors.append(errors[cur_error])\n                    cur_error += 1\n                    length += len(errors[cur_error])\n                first_errors.append(\"...\")\n                length += 3\n                end_errors = []\n                cur_error = -1\n                while length <= max_error_len:\n                    end_errors.append(errors[cur_error])\n                    cur_error -= 1\n                    length += len(errors[cur_error])\n                end_errors.reverse()\n                errors = first_errors + end_errors\n\n            return detected_language.name, errors\n    else:\n        return \"Unknown\", errors\n\nif __name__ == \"__main__\":\n    if len(sys.argv) > 1:\n        workingPath = sys.argv[1]\n        print(compile_anything(workingPath))\n"
  },
  {
    "path": "worker/install.sh",
    "content": "#!/bin/bash\n\n##########\n# Checks #\n##########\nif [ ! -f ../halite.ini ]; then\n    echo \"FAIL\\nCannot install worker until a halite.ini file is created.\"\n    return\nfi\n\n##################\n# Compiler tools #\n##################\nadd-apt-repository -y ppa:ubuntu-toolchain-r/test \napt-get -qq update\napt-get -qq install g++-4.9\n\napt-get install -y curl build-essential python3 default-jdk\ncurl -sSf https://static.rust-lang.org/rustup.sh | sh\n\n##########\n# Worker #\n##########\napt-get install -y zip python3-pip\npip3 install requests\npip3 install zip\n\n################\n# Docker SETUP #\n################\napt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D\necho \"deb https://apt.dockerproject.org/repo ubuntu-trusty main\" | sudo tee /etc/apt/sources.list.d/docker.list\napt-get update\napt-get install -y docker-engine\n\n# Use devicemapper storage driver, so that we can limit storage space of containers\nservice docker stop\ndockerd --storage-driver=devicemapper &\nservice docker start\n\n./buildDocker.sh\n\n###############\n# Swap Memory #\n###############\n# Replace line 12\nsed -i '12s/.*/GRUB_CMDLINE_LINUX=\"cgroup_enable=memory swapaccount=1\"/' /etc/default/grub\n\nupdate-grub\n\n###########\n# API Key #\n###########\nif [ \"$#\" -eq 1 ]; then\n    python3 changeAPIKey.py $1\nfi\n\n#################\n# Force g++ 4.9 #\n#################\nupdate-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 10\n\necho \"A reboot is required to complete this installation!\"\n\n"
  },
  {
    "path": "worker/runGame.sh",
    "content": "#!/bin/bash\n\nENVIRONMENT=\"halite\"\nRUNFILE=\"run.sh\"\nWORKINGPATH=\"workingPath\"\n\nif [ ! -f $ENVIRONMENT ]; then\n    echo \"NO ENVIRONMENT!!\"\n    cd ../environment\n    make clean\n    make \n    mv halite ../worker\n    cd ../worker\nfi\n\nWIDTH=$1\nHEIGHT=$2\nNUMBOTS=$3\nBOTSTART=4\n\nmkdir $WORKINGPATH\ncp $ENVIRONMENT $WORKINGPATH\nfor BOT in ${@:$BOTSTART:$NUMBOTS};\n    do mv $BOT $WORKINGPATH;\ndone\n\ncd $WORKINGPATH\nfor BOT in ${@:$BOTSTART:$NUMBOTS}; do\n    chmod +x \"$BOT/$RUNFILE\";\n    chmod 755 \"$BOT/$RUNFILE\";\ndone;\n\nBOTSTARTCOMMANDS=\"\"\nfor i in `seq $BOTSTART $((4+$NUMBOTS-1))`;\ndo\n    BOT=${!i};\n    \n    BOTNAMEINDEX=$(($i+$NUMBOTS));\n    BOTNAME=${!BOTNAMEINDEX};\n\n    BOTSTARTCOMMANDS+=\"\\\"/usr/bin/docker run --net=none --memory='350m' --cpu-shares=1024 --storage-opt size=10G -i -v $PWD/$BOT:$PWD/$BOT mntruell/halite_sandbox:latest sh -c 'cd $PWD/$BOT && ./$RUNFILE'\\\" \"\n    BOTSTARTCOMMANDS+=\"\\\"$BOTNAME\\\" \";\ndone\n\neval \"chmod +x $ENVIRONMENT\"\n\nRUN_GAME_COMMAND=\"./$ENVIRONMENT -q -o -d \\\"$WIDTH $HEIGHT\\\" $BOTSTARTCOMMANDS\"\necho $RUN_GAME_COMMAND;\neval $RUN_GAME_COMMAND;\n\ndocker kill  $(docker ps -aq) >/dev/null\ndocker rm -v $(docker ps -aq) >/dev/null\n\nrm /run/network/ifstate.veth*\n\nmv *.hlt ../\nmv *.log ../\ncd ..\nrm -r $WORKINGPATH\n"
  },
  {
    "path": "worker/startWorkerScreen.sh",
    "content": "#!/bin/bash\n\nif ! screen -list | grep -q \"worker\"; then\n    screen -S worker -Ldm bash -c \"cd ~/Halite/worker; sudo python3 worker.py\"\nfi\n"
  },
  {
    "path": "worker/stopWorkerScreen.sh",
    "content": "#!/bin/bash\n\npkill screen\ndocker kill $(docker ps -aq)\ndocker rm $(docker ps -aq)\n"
  },
  {
    "path": "worker/worker.py",
    "content": "import archive\nimport backend\n\nimport random\n\nimport os\nimport os.path\nimport stat\nimport glob\n\nimport platform\nimport tempfile\n\nfrom time import sleep, gmtime, strftime\n\nfrom compiler import *\n\nimport smtplib\nfrom email.mime.text import MIMEText\n\nimport configparser\n\nimport copy\n\nimport traceback\n\nimport shutil\nimport gzip\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\n\nRUN_GAME_FILE_NAME = \"runGame.sh\"\nHALITE_EMAIL = parser[\"email\"][\"email\"]\nHALITE_EMAIL_PASSWORD = parser[\"email\"][\"password\"]\nSECRET_FOLDER = parser[\"hce\"][\"secretFolder\"]\n\ndef makePath(path):\n    \"\"\"Deletes anything residing at path, creates path, and chmods the directory\"\"\"\n    if os.path.exists(path):\n        shutil.rmtree(path)\n    os.makedirs(path)\n    os.chmod(path, 0o777)\n\ndef executeCompileTask(user, backend):\n    \"\"\"Downloads and compiles a bot. Posts the compiled bot files to the manager.\"\"\"\n    print(\"Compiling a bot with userID %s\\n\" % str(user[\"userID\"]))\n\n    try:\n        workingPath = \"workingPath\"\n        makePath(workingPath)\n\n        botPath = backend.storeBotLocally(int(user[\"userID\"]), workingPath, isCompile=True)\n        archive.unpack(botPath)\n\n        while len([name for name in os.listdir(workingPath) if os.path.isfile(os.path.join(workingPath, name))]) == 0 and len(glob.glob(os.path.join(workingPath, \"*\"))) == 1:\n            singleFolder = glob.glob(os.path.join(workingPath, \"*\"))[0]\n            bufferFolder = os.path.join(workingPath, SECRET_FOLDER)\n            os.mkdir(bufferFolder)\n\n            for filename in os.listdir(singleFolder):\n                shutil.move(os.path.join(singleFolder, filename), os.path.join(bufferFolder, filename))\n            os.rmdir(singleFolder)\n\n            for filename in os.listdir(bufferFolder):\n                shutil.move(os.path.join(bufferFolder, filename), os.path.join(workingPath, filename))\n            os.rmdir(bufferFolder)\n\n        # Rm symlinks\n        os.system(\"find \"+workingPath+\" -type l -delete\")\n\n        language, errors = compile_anything(workingPath)\n        didCompile = True if errors == None else False\n    except Exception as e:\n        language = \"Other\"\n        errors = [\"Your bot caused unexpected behavior in our servers. If you cannot figure out why this happened, please email us at halite@halite.io. We can help.\", \"For our reference, here is the trace of the error: \" + traceback.format_exc()]\n        didCompile = False\n\n    if didCompile:\n        print(\"Bot did compile\\n\")\n        archive.zipFolder(workingPath, os.path.join(workingPath, user[\"userID\"]+\".zip\"))\n        backend.storeBotRemotely(int(user[\"userID\"]), os.path.join(workingPath, user[\"userID\"]+\".zip\"))\n    else:\n        print(\"Bot did not compile\\n\")\n        print(\"Bot errors %s\\n\" % str(errors))\n\n    backend.compileResult(int(user[\"userID\"]), didCompile, language, errors=(None if didCompile else \"\\n\".join(errors)))\n    if os.path.isdir(workingPath):\n        shutil.rmtree(workingPath)\n\ndef downloadUsers(users):\n    for user in users:\n        userDir = str(user[\"userID\"])\n        if os.path.isdir(userDir):\n            shutil.rmtree(userDir)\n        os.mkdir(userDir)\n        archive.unpack(backend.storeBotLocally(user[\"userID\"], userDir))\n\ndef runGame(width, height, users):\n    runGameCommand = \" \".join([RUN_GAME_FILE_NAME, str(width), str(height), str(len(users))]+[a[\"userID\"] for a in users]+[\"\\\"\"+a[\"username\"]+\" v\"+a[\"numSubmissions\"]+\"\\\"\" for a in users])\n\n    print(\"Run game command %s\\n\" % runGameCommand)\n    print(\"Waiting for game output...\\n\")\n    lines =  subprocess.Popen(\"bash \"+runGameCommand, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8').split('\\n')\n    print(\"\\n-----Here is game output: -----\")\n    print(\"\\n\".join(lines))\n    print(\"--------------------------------\\n\")\n    return lines\n\ndef parseGameOutput(output, users):\n    users = copy.deepcopy(users)\n\n    width, height = [int(sz) for sz in output[len(output) - (len(users)+4)].split(\" \")]\n    replayPath = output[len(output) - (len(users)+3)].split(\" \")[0][2:]\n\n    # Get player ranks and scores by parsing shellOutput\n    for lineIndex in range(len(output)-(len(users)+2), len(output)-2):\n        components = output[lineIndex].split(\" \")\n        for cIndex in range(len(components)):\n            if components[cIndex] == \"nan\" or components[cIndex] == \"-nan\":\n                components[cIndex] = 0\n        playerTag = int(components[0])\n        users[playerTag-1][\"playerTag\"] = playerTag\n        users[playerTag-1][\"rank\"] = int(components[1])\n\n    for user in users:\n        user[\"didTimeout\"] = False\n        user[\"errorLogName\"] = None\n\n    errorLine = output[len(output)-1]\n    errorPaths = []\n    if errorLine.isspace() == False:\n        errorPaths = errorLine.strip().split(\" \")\n\n    timeoutLine = output[len(output)-2]\n    if timeoutLine.isspace() == False:\n        timeoutTags = [int(a) for a in timeoutLine.strip().split(\" \")]\n        for index in range(len(timeoutTags)):\n            playerTag = timeoutTags[index]\n            users[playerTag-1][\"didTimeout\"] = True\n            users[playerTag-1][\"errorLogName\"] = os.path.basename(errorPaths[index])\n\n    return width, height, users, replayPath, errorPaths\n\ndef executeGameTask(width, height, users, backend):\n    \"\"\"Downloads compiled bots, runs a game, and posts the results of the game\"\"\"\n    print(\"Running game with width %d, height %d\\n\" % (width, height))\n    print(\"Users objects %s\\n\" % (str(users)))\n\n    downloadUsers(users)\n    width, height, users, replayPath, errorPaths = parseGameOutput(runGame(width, height, users), users)\n\n    replayArchivePath = \"ar\"+replayPath\n    fIn = open(replayPath, 'rb')\n    fOut = gzip.open(replayArchivePath, 'wb')\n    shutil.copyfileobj(fIn, fOut)\n    fIn.close()\n    fOut.close()\n\n    backend.gameResult(width, height, users, replayArchivePath, errorPaths)\n    filelist = glob.glob(\"*.log\")\n    for f in filelist:\n        os.remove(f)\n\n    os.remove(replayPath)\n    os.remove(replayArchivePath)\n\nif __name__ == \"__main__\":\n    print(\"\\n\\n\\n\\nStarting up worker...\\n\\n\\n\")\n    while True:\n        try:\n            print(\"\\n\\n\\nQuerying for new task at time %s (GMT)\\n\" % str(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime())))\n            task = backend.getTask()\n            if \"type\" in task and (task[\"type\"] == \"compile\" or task[\"type\"] == \"game\"):\n                print(\"Got new task at time %s (GMT)\\n\" % str(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime())))\n                print(\"Task object %s\\n\" % str(task))\n                if task[\"type\"] == \"compile\":\n                    print(\"Running a compilation task...\\n\")\n                    executeCompileTask(task[\"user\"], backend)\n                else:\n                    print(\"Running a game task...\\n\")\n                    executeGameTask(int(task[\"width\"]), int(task[\"height\"]), task[\"users\"], backend)\n            else:\n                print(\"No task available at time %s (GMT). Sleeping...\\n\" % str(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime())))\n                sleep(2)\n        except Exception as e:\n            print(\"Error on get task %s\\n\" % str(e))\n            print(\"Sleeping...\\n\")\n            sleep(2)\n\n"
  }
]