[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\nindent_size = 4\nindent_style = space\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"library/redbean\"]\n\tpath = library/redbean\n\turl = https://github.com/gabordemooij/redbean.git\n"
  },
  {
    "path": "LICENSE.md",
    "content": "### GNU GENERAL PUBLIC LICENSE\n\nVersion 3, 29 June 2007\n\nCopyright (C) 2007 Free Software Foundation, Inc.\n<https://fsf.org/>\n\nEveryone is permitted to copy and distribute verbatim copies of this\nlicense document, but changing it is not allowed.\n\n### Preamble\n\nThe GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\nThe licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nthe GNU General Public License is intended to guarantee your freedom\nto share and change all versions of a program--to make sure it remains\nfree software for all its users. We, the Free Software Foundation, use\nthe GNU General Public License for most of our software; it applies\nalso to any other work released this way by its authors. You can apply\nit to your programs, too.\n\nWhen we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\nTo protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights. Therefore, you\nhave certain responsibilities if you distribute copies of the\nsoftware, or if you modify it: responsibilities to respect the freedom\nof others.\n\nFor example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received. You must make sure that they, too, receive\nor can get the source code. And you must show them these terms so they\nknow their rights.\n\nDevelopers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\nFor the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software. For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\nSome devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the\nmanufacturer can do so. This is fundamentally incompatible with the\naim of protecting users' freedom to change the software. The\nsystematic pattern of such abuse occurs in the area of products for\nindividuals to use, which is precisely where it is most unacceptable.\nTherefore, we have designed this version of the GPL to prohibit the\npractice for those products. If such problems arise substantially in\nother domains, we stand ready to extend this provision to those\ndomains in future versions of the GPL, as needed to protect the\nfreedom of users.\n\nFinally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish\nto avoid the special danger that patents applied to a free program\ncould make it effectively proprietary. To prevent this, the GPL\nassures that patents cannot be used to render the program non-free.\n\nThe precise terms and conditions for copying, distribution and\nmodification follow.\n\n### TERMS AND CONDITIONS\n\n#### 0. Definitions.\n\n\"This License\" refers to version 3 of the GNU General Public License.\n\n\"Copyright\" also means copyright-like laws that apply to other kinds\nof works, such as semiconductor masks.\n\n\"The Program\" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as \"you\". \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\nTo \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of\nan exact copy. The resulting work is called a \"modified version\" of\nthe earlier work or a work \"based on\" the earlier work.\n\nA \"covered work\" means either the unmodified Program or a work based\non the Program.\n\nTo \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\nTo \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user\nthrough a computer network, with no transfer of a copy, is not\nconveying.\n\nAn interactive user interface displays \"Appropriate Legal Notices\" to\nthe extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n#### 1. Source Code.\n\nThe \"source code\" for a work means the preferred form of the work for\nmaking modifications to it. \"Object code\" means any non-source form of\na work.\n\nA \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\nThe \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\nThe \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\nThe Corresponding Source need not include anything that users can\nregenerate automatically from other parts of the Corresponding Source.\n\nThe Corresponding Source for a work in source code form is that same\nwork.\n\n#### 2. Basic Permissions.\n\nAll rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\nYou may make, run and propagate covered works that you do not convey,\nwithout conditions so long as your license otherwise remains in force.\nYou may convey covered works to others for the sole purpose of having\nthem make modifications exclusively for you, or provide you with\nfacilities for running those works, provided that you comply with the\nterms of this License in conveying all material for which you do not\ncontrol copyright. Those thus making or running the covered works for\nyou must do so exclusively on your behalf, under your direction and\ncontrol, on terms that prohibit them from making any copies of your\ncopyrighted material outside their relationship with you.\n\nConveying under any other circumstances is permitted solely under the\nconditions stated below. Sublicensing is not allowed; section 10 makes\nit unnecessary.\n\n#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\nNo covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\nWhen you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such\ncircumvention is effected by exercising rights under this License with\nrespect to the covered work, and you disclaim any intention to limit\noperation or modification of the work as a means of enforcing, against\nthe work's users, your or third parties' legal rights to forbid\ncircumvention of technological measures.\n\n#### 4. Conveying Verbatim Copies.\n\nYou may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\nYou may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n#### 5. Conveying Modified Source Versions.\n\nYou may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these\nconditions:\n\n-   a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n-   b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under\n    section 7. This requirement modifies the requirement in section 4\n    to \"keep intact all notices\".\n-   c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy. This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged. This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n-   d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\nA compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n#### 6. Conveying Non-Source Forms.\n\nYou may convey a covered work in object code form under the terms of\nsections 4 and 5, provided that you also convey the machine-readable\nCorresponding Source under the terms of this License, in one of these\nways:\n\n-   a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n-   b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the Corresponding\n    Source from a network server at no charge.\n-   c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source. This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n-   d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge. You need not require recipients to copy the\n    Corresponding Source along with the object code. If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source. Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n-   e) Convey the object code using peer-to-peer transmission,\n    provided you inform other peers where the object code and\n    Corresponding Source of the work are being offered to the general\n    public at no charge under subsection 6d.\n\nA separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\nA \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal,\nfamily, or household purposes, or (2) anything designed or sold for\nincorporation into a dwelling. In determining whether a product is a\nconsumer product, doubtful cases shall be resolved in favor of\ncoverage. For a particular product received by a particular user,\n\"normally used\" refers to a typical or common use of that class of\nproduct, regardless of the status of the particular user or of the way\nin which the particular user actually uses, or expects or is expected\nto use, the product. A product is a consumer product regardless of\nwhether the product has substantial commercial, industrial or\nnon-consumer uses, unless such uses represent the only significant\nmode of use of the product.\n\n\"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to\ninstall and execute modified versions of a covered work in that User\nProduct from a modified version of its Corresponding Source. The\ninformation must suffice to ensure that the continued functioning of\nthe modified object code is in no case prevented or interfered with\nsolely because modification has been made.\n\nIf you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\nThe requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or\nupdates for a work that has been modified or installed by the\nrecipient, or for the User Product in which it has been modified or\ninstalled. Access to a network may be denied when the modification\nitself materially and adversely affects the operation of the network\nor violates the rules and protocols for communication across the\nnetwork.\n\nCorresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n#### 7. Additional Terms.\n\n\"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\nWhen you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\nNotwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders\nof that material) supplement the terms of this License with terms:\n\n-   a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n-   b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n-   c) Prohibiting misrepresentation of the origin of that material,\n    or requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n-   d) Limiting the use for publicity purposes of names of licensors\n    or authors of the material; or\n-   e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n-   f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions\n    of it) with contractual assumptions of liability to the recipient,\n    for any liability that these contractual assumptions directly\n    impose on those licensors and authors.\n\nAll other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\nIf you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\nAdditional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions; the\nabove requirements apply either way.\n\n#### 8. Termination.\n\nYou may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\nHowever, if you cease all violation of this License, then your license\nfrom a particular copyright holder is reinstated (a) provisionally,\nunless and until the copyright holder explicitly and finally\nterminates your license, and (b) permanently, if the copyright holder\nfails to notify you of the violation by some reasonable means prior to\n60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\nTermination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n#### 9. Acceptance Not Required for Having Copies.\n\nYou are not required to accept this License in order to receive or run\na copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n#### 10. Automatic Licensing of Downstream Recipients.\n\nEach time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\nAn \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\nYou may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n#### 11. Patents.\n\nA \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor's \"contributor version\".\n\nA contributor's \"essential patent claims\" are all patent claims owned\nor controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\nEach contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\nIn the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\nIf you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\nIf, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\nA patent license is \"discriminatory\" if it does not include within the\nscope of its coverage, prohibits the exercise of, or is conditioned on\nthe non-exercise of one or more of the rights that are specifically\ngranted under this License. You may not convey a covered work if you\nare a party to an arrangement with a third party that is in the\nbusiness of distributing software, under which you make payment to the\nthird party based on the extent of your activity of conveying the\nwork, and under which the third party grants, to any of the parties\nwho would receive the covered work from you, a discriminatory patent\nlicense (a) in connection with copies of the covered work conveyed by\nyou (or copies made from those copies), or (b) primarily for and in\nconnection with specific products or compilations that contain the\ncovered work, unless you entered into that arrangement, or that patent\nlicense was granted, prior to 28 March 2007.\n\nNothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n#### 12. No Surrender of Others' Freedom.\n\nIf conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under\nthis License and any other pertinent obligations, then as a\nconsequence you may not convey it at all. For example, if you agree to\nterms that obligate you to collect a royalty for further conveying\nfrom those to whom you convey the Program, the only way you could\nsatisfy both those terms and this License would be to refrain entirely\nfrom conveying the Program.\n\n#### 13. Use with the GNU Affero General Public License.\n\nNotwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n#### 14. Revised Versions of this License.\n\nThe Free Software Foundation may publish revised and/or new versions\nof the GNU General Public License from time to time. Such new versions\nwill be similar in spirit to the present version, but may differ in\ndetail to address new problems or concerns.\n\nEach version is given a distinguishing version number. If the Program\nspecifies that a certain numbered version of the GNU General Public\nLicense \"or any later version\" applies to it, you have the option of\nfollowing the terms and conditions either of that numbered version or\nof any later version published by the Free Software Foundation. If the\nProgram does not specify a version number of the GNU General Public\nLicense, you may choose any version ever published by the Free\nSoftware Foundation.\n\nIf the Program specifies that a proxy can decide which future versions\nof the GNU General Public License can be used, that proxy's public\nstatement of acceptance of a version permanently authorizes you to\nchoose that version for the Program.\n\nLater license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n#### 15. Disclaimer of Warranty.\n\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT\nWARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND\nPERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE\nDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR\nCORRECTION.\n\n#### 16. Limitation of Liability.\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR\nCONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES\nARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT\nNOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR\nLOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM\nTO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER\nPARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n\n#### 17. Interpretation of Sections 15 and 16.\n\nIf the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\nEND OF TERMS AND CONDITIONS\n\n### How to Apply These Terms to Your New Programs\n\nIf you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these\nterms.\n\nTo do so, attach the following notices to the program. It is safest to\nattach them to the start of each source file to most effectively state\nthe exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n        <one line to give the program's name and a brief idea of what it does.>\n        Copyright (C) <year>  <name of author>\n\n        This program is free software: you can redistribute it and/or modify\n        it under the terms of the GNU General Public License as published by\n        the Free Software Foundation, either version 3 of the License, or\n        (at your option) any later version.\n\n        This program is distributed in the hope that it will be useful,\n        but WITHOUT ANY WARRANTY; without even the implied warranty of\n        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n        GNU General Public License for more details.\n\n        You should have received a copy of the GNU General Public License\n        along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper\nmail.\n\nIf the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n        <program>  Copyright (C) <year>  <name of author>\n        This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n        This is free software, and you are welcome to redistribute it\n        under certain conditions; type `show c' for details.\n\nThe hypothetical commands \\`show w' and \\`show c' should show the\nappropriate parts of the General Public License. Of course, your\nprogram's commands might be different; for a GUI interface, you would\nuse an \"about box\".\n\nYou should also get your employer (if you work as a programmer) or\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary. For more information on this, and how to apply and follow\nthe GNU GPL, see <https://www.gnu.org/licenses/>.\n\nThe GNU General Public License does not permit incorporating your\nprogram into proprietary programs. If your program is a subroutine\nlibrary, you may consider it more useful to permit linking proprietary\napplications with the library. If this is what you want to do, use the\nGNU Lesser General Public License instead of this License. But first,\nplease read <https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "## GRAPH\n[GRAPH](https://anime.plus) is an extension of your myanimelist.net profile, showing you various information about your anime and manga.\n\n### License\nGRAPH is licensed under the [GNU General Public License version 3](https://www.gnu.org/licenses/gpl-3.0.html) or later.\n\nThe original source code can be found [here](https://github.com/rr-/malgraph4).\n"
  },
  {
    "path": "achievements.md",
    "content": "All genre-based achievements have 4 levels. Count-based badges have 12 levels, and score-based have 3 pseudo-levels. There are some other special badges awarded for achieving something big. In total, we have over 150 images that make you want to watch more anime or read more manga.\n\nIf you're curious about titles that count towards certain badges, read [these files](https://github.com/anime-plus/graph/tree/master/data/achievement), but note that some genre-based achievements have their title list generated automatically from genres on myanimelist.net. These can also have additional titles added manually, to fill up genre holes left by myanimelist.net (e.g. sequel to a historical anime isn't tagged as such).\n\nThresholds for manga/anime genres are 1/2% of titles (up to 10/20) for level 1, 2/4% (up to 20/40) for level 2, 4/8% (up to 40/80) for level 3 and 8/16% (up to 80/160) for the maximum level.\n\n## Anime achievements\n\n### Psychological\nAwarded for watching Psychological anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-dementia-psychological-1.png\" alt=\"\">\n</td>\n<td>\n<strong>What exactly did I just watch?</strong>\n\n<sub>You discovered a whole new world of weird. Keep on watching.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-dementia-psychological-2.png\" alt=\"\">\n</td>\n<td>\n<strong>My mind is full of fu**</strong>\n\n<sub>Your attempt to wrap your mind around this failed completely.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-dementia-psychological-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Is this the real life?</strong>\n\n<sub>It has become hard to distinguish between reality and fiction.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-dementia-psychological-4.gif\" alt=\"\">\n</td>\n<td>\n<strong>「 Ｗｉｒｅｄ Ｓｏｕｎｄ 」</strong>\n\n<sub>You've seen too much. You've transcended humanity and operate on another level now.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### GAR\nAwarded for watching anime with manly men.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-gar-1.png\" alt=\"\">\n</td>\n<td>\n<strong>So manly I can't breathe</strong>\n\n<sub>Watching all those men made you feel like a little girl... and you liked it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-gar-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Testosterone storm</strong>\n\n<sub>Your body has adapted into GAR anime. You can hear your muscles growing.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-gar-3.png\" alt=\"\">\n</td>\n<td>\n<strong>You are already man</strong>\n\n<sub>Resistance is futile. People are simply no match for you.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-gar-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Alpha Male</strong>\n\n<sub>You aren't made out of testosterone. Testosterone is made out of you.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Historical\nAwarded for watching Historical anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-historical-1.png\" alt=\"\">\n</td>\n<td>\n<strong>History class</strong>\n\n<sub>History doesn't have to be boring. There's a lot to learn.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-historical-2.png\" alt=\"\">\n</td>\n<td>\n<strong>A look at passing time</strong>\n\n<sub>Instead of dreaming of the future, you prefer to look back at the past.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-historical-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Archaeologist</strong>\n\n<sub>You have learned that sometimes going further just isn't worth it. And yet you try.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-historical-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Time machine</strong>\n\n<sub>Kids these days are boring. You'd rather watch something heartwarming about siblings catching fireflies.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Horror\nAwarded for watching Horror anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-horror-thriller-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Paranoia fuel</strong>\n\n<sub>It's not like you needed to sleep tonight, anyway.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-horror-thriller-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Too many teeth</strong>\n\n<sub>You know something is following you. You just don't know what.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-horror-thriller-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Extreme phobia</strong>\n\n<sub>You are terrified; you are transfixed.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-horror-thriller-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Flowers of flesh and blood</strong>\n\n<sub>It's far too late, now.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mahou Shoujo\nAwarded for watching anime with magical girls.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mahou-shoujo-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Signed the contract</strong>\n\n<sub>Became a magical girl and started saving the world, step by step.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mahou-shoujo-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Magic is my middle name</strong>\n\n<sub>Transformed into a magical girl: level two. In the name of the Moon, I will punish you!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mahou-shoujo-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Too magical to comprehend</strong>\n\n<sub>Watched so many mahou shoujo anime that you sparkle occasionally.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mahou-shoujo-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Are you a wizard?</strong>\n\n<sub>All limiters removed. You can call yourself a god, a wizard, or whatever you wish. You set the rules.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mecha\nAwarded for watching Mecha anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mecha-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Me? PILOT this thing?!</strong>\n\n<sub>A secret organization wants you to pilot a huge mecha. Can you do it?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mecha-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Engineer</strong>\n\n<sub>After watching over 40 mecha anime you should be able to build your own mobile suit. Remember not to kill the rest of us.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mecha-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Mechazawa</strong>\n\n<sub>Having watched over 80 mecha anime, you've probably became a robot already. Nice job, hero.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mecha-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Pierce the HEAVENS!</strong>\n\n<sub>Do the impossible. See the invisible. ROW ROW FIGHT THE POWAH! You just sang that in your head, didn't you?</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Music\nAwarded for watching Music anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-music-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Gettin' your keys on!</strong>\n\n<sub>You don't know what you've just listened to, but you like it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-music-2.png\" alt=\"\">\n</td>\n<td>\n<strong>This is even better live</strong>\n\n<sub>Proudly display the badges you have earned in the fancafe.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-music-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Dreaming of the city</strong>\n\n<sub>Your musical knowledge has expanded so much you are tempted to make a career out of it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-music-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Hall of Fame</strong>\n\n<sub>The stage is now your second home.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mystery\nAwarded for watching Mystery anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mystery-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Growing suspicions</strong>\n\n<sub>It's suspicious because nothing looks suspicious, and if it looks suspicious from the start it's obviously suspicious.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mystery-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Detective's assistant</strong>\n\n<sub>Now it's your business to know what other people don't know too.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mystery-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Genius detective</strong>\n\n<sub>You're already a genius at unraveling mysteries... but how is it possible that everywhere you go someone ends up dead?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-mystery-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Golden Truth</strong>\n\n<sub>You can solve any mystery by now. The path to the Golden Land has already been revealed to you.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Romance\nAwarded for watching Romance anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-romance-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Stalker</strong>\n\n<sub>I'll stalk you so hard you won't notice me for 24 episodes. Why don't you love me yet?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-romance-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Unrequited love</strong>\n\n<sub>If you won't confess, they'll never know how you feel. But don't bother if you're the best girl - these never win.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-romance-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Sparkles and bubbles</strong>\n\n<sub>Every time you two get close you feel butterflies in your stomach. Now kiss.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-romance-4.gif\" alt=\"\">\n</td>\n<td>\n<strong>Heart full of love</strong>\n\n<sub>So many romance anime! You surely are an expert in relationships already.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Slice of Life\nAwarded for watching Slice of Life anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-slice-of-life-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Normal high school boy</strong>\n\n<sub>Got started into the furious ride with slice-of-life anime.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-slice-of-life-2.png\" alt=\"\">\n</td>\n<td>\n<strong>cute × ( girls + things )</strong>\n\n<sub>Didn't get bored of watching cute girls doing cute things. As if that's possible.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-slice-of-life-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Enjoying life</strong>\n\n<sub>Found the equilibrium between boring and interesting.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-slice-of-life-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Prima Undine</strong>\n\n<sub>Awarded Ph.D. degree in slice-of-life-ology. You can teach others how to stay calm and take it easy.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Space\nAwarded for watching Space anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-space-1.png\" alt=\"\">\n</td>\n<td>\n<strong>3... 2... 1... Liftoff!</strong>\n\n<sub>You've taken one small step for man, not such a giant leap for mankind.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-space-2.png\" alt=\"\">\n</td>\n<td>\n<strong>The Earth looks so small from up here</strong>\n\n<sub>You're finally outside the atmosphere, but there's still a lot to explore.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-space-3.gif\" alt=\"\">\n</td>\n<td>\n<strong>Interstellar traveler</strong>\n\n<sub>You've traveled vast interstellar distances and seen many galaxies in your way.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-space-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Emperor of the Universe</strong>\n\n<sub>You're the ruler of the whole Universe. There's no one with more power than you.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Sports\nAwarded for watching Sports anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-sports-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Knockout!</strong>\n\n<sub>You've held your own in the ring, time to go all the way.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-sports-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Get your head in the game</strong>\n\n<sub>The odds are against you, time to get in the zone.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-sports-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Welcome to the Big Leagues</strong>\n\n<sub>There's no stopping you, just one final push.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-sports-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Olympian</strong>\n\n<sub>First across the finish line, great job!</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Studio Ghibli\nAwarded for watching 10+ anime from Studio Ghibli.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-studio-ghibli.gif\" alt=\"\">\n</td>\n<td>\n<strong>Memories</strong>\n\n<sub>Once you've seen them, you can never forget them.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Boku no Pico\nOne level. Is it the highest, or the lowest possible level a person can achieve? You decide.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-boku-no-pico.png\" alt=\"\">\n</td>\n<td>\n<strong>Feels... weird, man</strong>\n\n<sub>Watched Boku no Pico. This is what you get when you follow /a/'s recommendations.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### School Days\nThis award is a compensation for the intense, paranoid fear of relationships the anime has left you with.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-school-days.png\" alt=\"\">\n</td>\n<td>\n<strong>It's just me and you now</strong>\n\n<sub>Awarded for completing School Days. And they say true romance is dead!</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Light Novel\nAwarded for watching anime with Light Novel source.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-light-novel-1.png\" alt=\"\">\n</td>\n<td>\n<strong>First Chapter</strong>\n\n<sub>Some stories need more progress. Yours is one of those.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-light-novel-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Searcher</strong>\n\n<sub>Everyone has a role. Which is yours?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-light-novel-3.png\" alt=\"\">\n</td>\n<td>\n<strong>The Realization</strong>\n\n<sub>What matters is in the heart. You feel like you can start to see everyone's intentions just by looking at them.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-light-novel-4.png\" alt=\"\">\n</td>\n<td>\n<strong>New Self</strong>\n\n<sub>You have acquired the storytelling and character development required to move your world forward.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Original\nAwarded for watching anime with Original source.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-original-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Uncharted waters</strong>\n\n<sub>You have just stumbled across a wonderful, strange new world.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-original-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Into the jungle</strong>\n\n<sub>The deeper you go, the less you want out.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-original-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Center of the Earth</strong>\n\n<sub>You have forgotten about the outside world; nature has assimilated you. An apple falls - not only have you flowered, you have produced fruit.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-original-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Transcendence</strong>\n\n<sub>You have been returned to the primordial ocean. From the highest point in the sky, you can peer into every universe, and lose yourself in an infinity of stories.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Video Games\nAwarded for watching anime adapted from Games and Visual Novels.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-game-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Eternal Spring</strong>\n\n<sub>It all started one fateful morning in April...</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-game-2.png\" alt=\"\">\n</td>\n<td>\n<strong>At the gates of Eden</strong>\n\n<sub>You're so close to heaven, you can almost feel it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-game-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Banquet of the Golden Witch</strong>\n\n<sub>You've challenged her to a game. There is no turning back, now.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-game-4.gif\" alt=\"\">\n</td>\n<td>\n<strong>Hacking to the Gate</strong>\n\n<sub>All these games have made of you a wizard; you can crack any code without breaking a sweat.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Franchises\nSpecial achievement given upon completing 200+ episodes of 10+ franchises.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-franchise-long.png\" alt=\"\">\n</td>\n<td>\n<strong>Long and hard</strong>\n\n<sub>Ten years ago, you began this journey...</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Shorts\nAwarded for watching anime with episode length of under 15 minutes.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-duration-short-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Blink, and you'll miss it</strong>\n\n<sub>It was over before it started, but it managed to tell an enticing tale.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-duration-short-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Quickie addict</strong>\n\n<sub>You've been saying \"one more\" for the past nine hours.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-duration-short-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Block by block</strong>\n\n<sub>Just like in a game of tetris, you're building something great out of small pieces.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-duration-short-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Short but gold</strong>\n\n<sub>You have learned that some of the greatest things come in small packages.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Long runner\nAwarded for watching 20+ anime that are 100+ episodes long.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-episode-long.png\" alt=\"\">\n</td>\n<td>\n<strong>I like them long</strong>\n\n<sub>Didn't fall asleep while watching long anime series. 100 episodes isn't a big deal to you.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Old anime\nAwarded for watching 20+ old anime (finished in 1980 at most).\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-release-old.gif\" alt=\"\">\n</td>\n<td>\n<strong>VHS master race</strong>\n\n<sub>You overwrote my cartoons with The Karate Kid?! MOOOM!</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Classics\nAwarded for watching anime classics (finished between 1981 and 2000).\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-release-classic-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Cassette tape</strong>\n\n<sub>The first time you watched these, you didn't even know what they were.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-release-classic-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Solid color</strong>\n\n<sub>Bomber jackets, high-waisted jeans, an overload of patterns, and bishies everywhere.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-release-classic-3.png\" alt=\"\">\n</td>\n<td>\n<strong>It's raining... tragic backstories!</strong>\n\n<sub>It might be the nostalgia lens, but you swear things had more substance back then.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-release-classic-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Blockbuster</strong>\n\n<sub>Man, do you feel old as all hell.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Age diversity\nAwarded for watching 40+ anime, all of which started in different years.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-year.png\" alt=\"\">\n</td>\n<td>\n<strong>Chronomaster</strong>\n\n<sub>Your discerning eye has traveled across the aeons of animation.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Pervert\nAre you a pervert? There's a formula: 100 ÷ *anime completed* × (*ecchi anime completed* × 2 + *erotica anime completed* × 3 + *hentai anime completed* × 4)\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-pervert-0.png\" alt=\"\">\n</td>\n<td>\n<strong>Innocent One</strong>\n\n<sub>Puritan, oblivious, or serial killer in the making? Either way, you made it through No Man's Land without glimpsing a single bra. Good job!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-pervert-1.png\" alt=\"\">\n</td>\n<td>\n<strong>I watch anime only for the plot...</strong>\n\n<sub>It's not your fault that there is so much fan service... Right?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-pervert-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Only accidents! I swear!</strong>\n\n<sub>Physics in anime are incredible. When you trip, you always cop a feel.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-pervert-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Hentai Overlord</strong>\n\n<sub>No use denying it! You know what you are...</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mean score\nRelated to mean anime score.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-score-high.png\" alt=\"\">\n</td>\n<td>\n<strong>I love Chinese cartoons</strong>\n\n<sub>Mean anime score higher than 8.5. How about using the whole scale and re-rating stuff? That could make you look less like a fanboy...</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-score-low.png\" alt=\"\">\n</td>\n<td>\n<strong>Watching anime is suffering</strong>\n\n<sub>Mean anime score lower than 5. Someone has to counterweigh the fanboys, right?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-score-very-low.png\" alt=\"\">\n</td>\n<td>\n<strong>Less than three</strong>\n\n<sub>Mean anime score lower than 3. Is it hate, or is it love?</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### No drop\n20+ completed, zero dropped.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-dropped-0.png\" alt=\"\">\n</td>\n<td>\n<strong>Completionist</strong>\n\n<sub>You've managed to survive watching so many anime without dropping any of them. You masochist.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Rewatch\nAwarded for having 20+ rewatches.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-re.gif\" alt=\"\">\n</td>\n<td>\n<strong>Endless Eight</strong>\n\n<sub>Is the replay button stuck?</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Total time spent\nAwarded for reaching certain thresholds in your time spent watching anime.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-time-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Hair antenna</strong>\n\n<sub>Whose watchtime are you calling puny‽</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-time-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Endurance training</strong>\n\n<sub>By doing a daily ten-episode run, you are sure to become a master in no time!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-time-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Consciousness upload</strong>\n\n<sub>Consuming the medium becomes a lot easier once you yourself are raw data.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-time-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Wicked cultured</strong>\n\n<sub>By making a deal with the devil, you have ensured access to even the most obscure of materials.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Total number completed\nNo living being should be able to get to 10k.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-100.png\" alt=\"\">\n</td>\n<td>\n<strong>The first step</strong>\n\n<sub>Watched 100 anime. Congratulations, you broke the magical number. Take a breath now, it will only get more difficult.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-200.png\" alt=\"\">\n</td>\n<td>\n<strong>Casual watcher</strong>\n\n<sub>Watched 200 anime. You're used to seeing character's eyes bigger than their nose. If they have any nose.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-300.png\" alt=\"\">\n</td>\n<td>\n<strong>A millionaire</strong>\n\n<sub>Watched 300 anime. You DID buy all of them, right?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-400.png\" alt=\"\">\n</td>\n<td>\n<strong>Bragging rights</strong>\n\n<sub>Watched 400 anime. That's... a lot. You can be proud of yourself, that's for sure.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-500.png\" alt=\"\">\n</td>\n<td>\n<strong>A lot of free time</strong>\n\n<sub>Watched 500 anime. Now pause, take a breath and stretch a bit. Remember not to sit too close to the screen.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-750.gif\" alt=\"\">\n</td>\n<td>\n<strong>Not even my final form</strong>\n\n<sub>Watched 750 anime. Your power level is way above others'. The only way is up.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-1000.png\" alt=\"\">\n</td>\n<td>\n<strong>Gotta watch them all!</strong>\n\n<sub>Watched 1000 anime. You should already know what that picture means.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-1500.png\" alt=\"\">\n</td>\n<td>\n<strong>The Collector</strong>\n\n<sub>Watched 1500 animes. No, wait. The plural of anime is anime.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-2500.png\" alt=\"\">\n</td>\n<td>\n<strong>The Maniac</strong>\n\n<sub>Watched 2500 anime. Is this healthy? You should contact your doctor.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-5000.png\" alt=\"\">\n</td>\n<td>\n<strong>The Legend</strong>\n\n<sub>Watched 5000 anime. You're one of the chosen ones. You don't even have to brag, since everyone heard about you.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-7500.png\" alt=\"\">\n</td>\n<td>\n<strong>Database Breaker</strong>\n\n<sub>Watched 7.5 × 10³ anime. Are you having fun, breaking all the rules? By the way, since when do we have that many anime in the database?!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/anime-finished-10000.png\" alt=\"\">\n</td>\n<td>\n<strong>This is it</strong>\n\n<sub>Watched 10000 anime. There is no higher level. You can stop now. Everyone, go home.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n## Manga achievements\n\n### Horror\nAwarded for reading Horror manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-horror-1.png\" alt=\"\">\n</td>\n<td>\n<strong>HONEY, I'M HOME</strong>\n\n<sub>WHAT IS FOR DINNER TODAY?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-horror-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Lovely smile of a psychopath</strong>\n\n<sub>You can't spell slaughter without laughter.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-horror-3.png\" alt=\"\">\n</td>\n<td>\n<strong>What have I become?</strong>\n\n<sub>Sweetheart, something's wrong with your make up...</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-horror-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Heart attack</strong>\n\n<sub>Not all surprises are pleasant, but it looks like you love being scared.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mahou Shoujo\nAwarded for reading manga with magical girls.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mahou-shoujo-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Let me lift that curse</strong>\n\n<sub>If you wish hard enough, you can become a magical girl in the blink of an eye.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mahou-shoujo-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Conflict Breaker</strong>\n\n<sub>Fighting hardly solves any problems. There are better ways to live our lives.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mahou-shoujo-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Aim for the top</strong>\n\n<sub>Even if you work alone, never forget your friends who helped you overcome all fears.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mahou-shoujo-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Complete control</strong>\n\n<sub>Read over 32 mahou shoujo manga. At this level magic circles form around you at will.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mystery\nAwarded for reading Mystery manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mystery-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Curiosity</strong>\n\n<sub>If it is you who is curious, no case shall remain unsolved.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mystery-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Determination</strong>\n\n<sub>No matter who the villain is... you WILL find out the answers.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mystery-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Collecting the pieces</strong>\n\n<sub>Sometimes the smallest bit of information can turn the whole case around.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-mystery-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Raw intuition</strong>\n\n<sub>Investigative skills honed up. You know the answers just by looking at mere shards of data.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Romance\nAwarded for reading Romance manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-romance-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Mixed feelings</strong>\n\n<sub>98% hatred, 2% love. Give it some time and these two will reverse.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-romance-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Love me or die</strong>\n\n<sub>Yandere is a form of love too. A rather extreme one, but still!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-romance-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Breaking the chains</strong>\n\n<sub>With love, nothing is impossible. You just have to let someone break you free of restrictions.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-romance-4.gif\" alt=\"\">\n</td>\n<td>\n<strong>Heart that never stops beating</strong>\n\n<sub>When I see you, my kokoro goes doki-doki and the sekai starts to spin around. How could I live without you?</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Sports\nAwarded for reading Sports manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-sports-1.png\" alt=\"\">\n</td>\n<td>\n<strong>The stakes are high</strong>\n\n<sub>Joined the game for real. The more you read, the more addictive it gets.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-sports-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Do you even read?</strong>\n\n<sub>Even during the most exhausting excercise you still find time to read. Can't miss a chapter.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-sports-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Got balls</strong>\n\n<sub>Looking at all this struggling inspires you to become strong yourself.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-sports-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Kuro Basket</strong>\n\n<sub>You know the rules of all games already. The podium is yours!</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Vampires/Demons\nAwarded for reading Vampires/Demons manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-vampire-demons-1.gif\" alt=\"\">\n</td>\n<td>\n<strong>Sweet tooth</strong>\n\n<sub>Donuts? Really? You lived for 500 years just to eat them?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-vampire-demons-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Vegetarian</strong>\n\n<sub>Some creatures prefer juicy fruits instead of sucking blood or eating raw meat. Weaklings.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-vampire-demons-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Carnivore</strong>\n\n<sub>Don't mess with me if you want to keep your limbs attached to your body.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-vampire-demons-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Pure Evil</strong>\n\n<sub>EVIL!!! FANGS! DEMONS! BLOOD! Yeah. That's the stuff.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Boys Love\nAwarded for reading Boys Love manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yaoi-shounen-ai-1.gif\" alt=\"\">\n</td>\n<td>\n<strong>Inner fujoshi awakened</strong>\n\n<sub>I was just taking a peek in this manga I accidentally found... and surprisingly liked it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yaoi-shounen-ai-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Not a day without BL</strong>\n\n<sub>It's already too late to stop and turn back, just remember to watch your back while reading.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yaoi-shounen-ai-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Yaoi detector</strong>\n\n<sub>I don't care! I ship it!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yaoi-shounen-ai-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Full Fledged Fujoshi</strong>\n\n<sub>Yaoi isn't just a genre to you anymore, it's a way of life.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Girls Love\nAwarded for reading Girls Love manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yuri-shoujo-ai-1.png\" alt=\"\">\n</td>\n<td>\n<strong>But that's forbidden love</strong>\n\n<sub>Cute girls doing cute things... right?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yuri-shoujo-ai-2.png\" alt=\"\">\n</td>\n<td>\n<strong>I kissed a girl...</strong>\n\n<sub>...and I liked it!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yuri-shoujo-ai-3.png\" alt=\"\">\n</td>\n<td>\n<strong>All female school</strong>\n\n<sub>There are only girls here to love... but I don't mind it.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-yuri-shoujo-ai-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Lily</strong>\n\n<sub>You feel it everywhere.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Novel\n1+ volumes completed.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-novel-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Cracking the book</strong>\n\n<sub>You didn't get bored reading plain text.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-novel-2.png\" alt=\"\">\n</td>\n<td>\n<strong>IKEA trip</strong>\n\n<sub>Instead of playing Candy Crush, you now read during transit.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-novel-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Personal library</strong>\n\n<sub>The tales you've read have taken you on a journey you never want to end.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-novel-4.png\" alt=\"\">\n</td>\n<td>\n<strong>What is sleep?</strong>\n\n<sub>The more you've learned, the more you wanted to keep on learning.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Long runner\nAwarded for reading 10+ manga that are 20+ volumes long.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-volume-long.png\" alt=\"\">\n</td>\n<td>\n<strong>Long runner</strong>\n\n<sub>The best stories can't be told in less than 20 volumes.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Old manga\nAwarded for reading 10+ old manga (finished in 1980 at most).\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-release-old.png\" alt=\"\">\n</td>\n<td>\n<strong>At the end of the galaxy</strong>\n\n<sub>Your never-ending journey for the most forgotten comic books has finally paid off.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Age diversity\nAwarded for reading 40+ manga, all of which started in different years.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-year.png\" alt=\"\">\n</td>\n<td>\n<strong>Ancient Scholar</strong>\n\n<sub>You witnessed the beginning of the medium. You hope you will not witness its end.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Pervert\nAre you a pervert? There's a formula: 100 ÷ *manga completed* × (*ecchi manga completed* × 2 + *erotica manga completed* × 3 + *hentai manga completed* × 4)\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-pervert-0.png\" alt=\"\">\n</td>\n<td>\n<strong>Chastity belt</strong>\n\n<sub>Mama said that if you touch your no-no square, the Yogi Bear will come and get you. Congratulations on resisting the siren call of h-doujin!</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-pervert-1.png\" alt=\"\">\n</td>\n<td>\n<strong>I peek just a little</strong>\n\n<sub>Wait a minute, this wasn't the men's bath?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-pervert-2.png\" alt=\"\">\n</td>\n<td>\n<strong>We need a blood donor here</strong>\n\n<sub>Even if I die from blood loss, I just can't stop...</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-pervert-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Ero-sennin</strong>\n\n<sub>What do you mean that I am a pervert? I am THE pervert!</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Mean score\nRelated to mean manga score.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-score-high.png\" alt=\"\">\n</td>\n<td>\n<strong>So good I can't handle it</strong>\n\n<sub>Mean manga score above 8.5. Looks like you only pick the best titles to read.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-score-low.png\" alt=\"\">\n</td>\n<td>\n<strong>Professional Critic</strong>\n\n<sub>Mean manga score below 5. Watch out, we got a critic over here.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-score-very-low.png\" alt=\"\">\n</td>\n<td>\n<strong>Best I can do is 2</strong>\n\n<sub>Mean manga score below 3. Aren't you a bit too harsh?</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### No drop\n10+ completed, zero dropped.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-dropped-0.gif\" alt=\"\">\n</td>\n<td>\n<strong>I've seen some sh**</strong>\n\n<sub>Despite seemingly endless suffering, you've never dropped any manga. That's impressive.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Reread\nAwarded for having 10+ rereads.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-re.gif\" alt=\"\">\n</td>\n<td>\n<strong>Take me back</strong>\n\n<sub>Ah, it's every bit as good as the first time.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Total time spent\nAwarded for reaching certain thresholds in your time spent reading manga.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-time-1.png\" alt=\"\">\n</td>\n<td>\n<strong>Downward spiral</strong>\n\n<sub>Once drawn inside this inky whirlpool, you will find yourself sinking faster than the Titanic.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-time-2.png\" alt=\"\">\n</td>\n<td>\n<strong>Revelations (18:14)</strong>\n\n<sub>You've developed quite the appetite. Devouring fifty chapters a day doesn't seem challenging to you anymore.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-time-3.png\" alt=\"\">\n</td>\n<td>\n<strong>Voluntary confinement</strong>\n\n<sub>Every title you read brings you closer to your self.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-time-4.png\" alt=\"\">\n</td>\n<td>\n<strong>Apocryphal Sanctuary</strong>\n\n<sub>You've journeyed through hell and heaven, and learned much in your wanderings.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n\n### Total number completed\nNo living being should be able to get to 10k.\n\n<table>\n<tbody>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-100.png\" alt=\"\">\n</td>\n<td>\n<strong>Casual reader</strong>\n\n<sub>Read 100 manga. Looks like reading doesn't hurt.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-200.gif\" alt=\"\">\n</td>\n<td>\n<strong>Bookworm</strong>\n\n<sub>Read 200 manga. Sitting in your comfortable chair, reading favorite Korean comics. This is bliss.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-300.png\" alt=\"\">\n</td>\n<td>\n<strong>Dat scent</strong>\n\n<sub>Read 300 manga. There's nothing better than the smell of freshly opened book. Or a PDF.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-400.png\" alt=\"\">\n</td>\n<td>\n<strong>Where do I put these?</strong>\n\n<sub>Read 400 manga. Consider investing in another bookshelf, or you'll be swimming in books soon.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-500.png\" alt=\"\">\n</td>\n<td>\n<strong>Half a grand</strong>\n\n<sub>Read 500 manga. Now think of what kind of person you'd be if you didn't start reading manga then. On that particular day...</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-750.png\" alt=\"\">\n</td>\n<td>\n<strong>Read or die</strong>\n\n<sub>Read 750 manga. You managed to make a bow out of paper, but remember that cellulose fibers don't work well as a bulletproof shield.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-1000.png\" alt=\"\">\n</td>\n<td>\n<strong>Librarian</strong>\n\n<sub>Read 1000 manga. You work with books, right? Right?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-1500.png\" alt=\"\">\n</td>\n<td>\n<strong>The floor is books</strong>\n\n<sub>Read 1500 manga. Sleeping on books must be pretty... hard?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-2500.png\" alt=\"\">\n</td>\n<td>\n<strong>Still not enough</strong>\n\n<sub>Read 2500 manga. In search for the perfect story you've read six lifetimes worth of words. Did you find it?</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-5000.png\" alt=\"\">\n</td>\n<td>\n<strong>Sleep deprivation</strong>\n\n<sub>Read 5000 manga. Think of all the mangakas and writers that couldn't sleep just to make this moment happen.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-7500.png\" alt=\"\">\n</td>\n<td>\n<strong>Reincarnation</strong>\n\n<sub>Read 7500 manga. How, exactly? This is not possible for normal humans.</sub>\n</td>\n</tr>\n<tr>\n<td>\n<img src=\"https://anime.plus/image/achievement/manga-finished-10000.png\" alt=\"\">\n</td>\n<td>\n<strong>I've seen it all</strong>\n\n<sub>Read 10000 manga. Ten. Thousand. Manga. An average user's list is shorter than your list of titles starting with \"A\" alone.</sub>\n</td>\n</tr>\n</tbody>\n</table>&nbsp;\n"
  },
  {
    "path": "data/achievement/anime-boku-no-pico.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 202,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"1+\",\n            \"id\": \"anime-boku-no-pico\",\n            \"level\": \"It's Just an Ice Cream\",\n            \"title\": \"Feels... Weird, Man\",\n            \"desc\": \"Watched Boku no Pico. This is what you get when you follow /a/'s recommendations.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"title\",\n        \"titles\":\n        [\n            \"A1639\", //Boku no Pico\n            \"A5391\", //Pico to Chico\n            \"A4866\", //Pico x CoCo x Chico\n            \"A6546\" //Pico: My Little Summer Story\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-dementia-psychological.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 101,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"7-13\",\n            \"id\": \"anime-dementia-psychological-1\",\n            \"level\": \"Psychological: level 1\",\n            \"title\": \"What Exactly Did I Just Watch?\",\n            \"desc\": \"You discovered a whole new world of weird. Keep on watching.\"\n        },\n        {\n            \"threshold\": \"14-27\",\n            \"id\": \"anime-dementia-psychological-2\",\n            \"level\": \"Psychological: level 2\",\n            \"title\": \"My Mind Is Full of Fu**\",\n            \"desc\": \"Your attempt to wrap your mind around this failed completely.\"\n        },\n        {\n            \"threshold\": \"28-55\",\n            \"id\": \"anime-dementia-psychological-3\",\n            \"level\": \"Psychological: level 3\",\n            \"title\": \"Is This the Real Life?\",\n            \"desc\": \"It has become hard to distinguish between reality and fiction.\"\n        },\n        {\n            \"threshold\": \"56+\",\n            \"id\": \"anime-dementia-psychological-4\",\n            \"level\": \"Psychological: level MAX\",\n            \"title\": \"「 Ｗｉｒｅｄ Ｓｏｕｎｄ 」\",\n            \"desc\": \"You've seen too much. You've transcended humanity and operate on another level now.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 40\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-dropped-0.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 309,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20+\",\n            \"id\": \"anime-dropped-0\",\n            \"level\": \"I'll Endure Anything\",\n            \"title\": \"Completionist\",\n            \"desc\": \"You've managed to survive watching so many anime without dropping any of them. You masochist.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"dropped-0\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-duration-short.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 302,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-duration-short-1\",\n            \"level\": \"Shorts: level 1\",\n            \"title\": \"Blink, and You'll Miss It\",\n            \"desc\": \"It was over before it started, but it managed to tell an enticing tale.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-duration-short-2\",\n            \"level\": \"Shorts: level 2\",\n            \"title\": \"Quickie Addict\",\n            \"desc\": \"You've been saying \\\"one more\\\" for the past nine hours.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-duration-short-3\",\n            \"level\": \"Shorts: level 3\",\n            \"title\": \"Block by Block\",\n            \"desc\": \"Just like in a game of tetris, you're building something great out of small pieces.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-duration-short-4\",\n            \"level\": \"Shorts: level MIN\",\n            \"title\": \"Short but Gold\",\n            \"desc\": \"You have learned that some of the greatest things come in small packages.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"duration-short\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-episode-long.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 303,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20+\",\n            \"id\": \"anime-episode-long\",\n            \"level\": \"Anime, That Is\",\n            \"title\": \"I Like Them Long\",\n            \"desc\": \"Didn't fall asleep while watching long anime series. 100 episodes isn't a big deal to you.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"episode-long\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-finished.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 312,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"100-199\",\n            \"id\": \"anime-finished-100\",\n            \"level\": \"Passed 100 Mark\",\n            \"title\": \"The first step\",\n            \"desc\": \"Watched 100 anime. Congratulations, you broke the magical number. Take a breath now, it will only get more difficult.\"\n        },\n        {\n            \"threshold\": \"200-299\",\n            \"id\": \"anime-finished-200\",\n            \"level\": \"Passed 200 Mark\",\n            \"title\": \"Casual watcher\",\n            \"desc\": \"Watched 200 anime. You're used to seeing character's eyes bigger than their nose. If they have any nose.\"\n        },\n        {\n            \"threshold\": \"300-399\",\n            \"id\": \"anime-finished-300\",\n            \"level\": \"Passed 300 Mark\",\n            \"title\": \"A millionaire\",\n            \"desc\": \"Watched 300 anime. You DID buy all of them, right?\"\n        },\n        {\n            \"threshold\": \"400-499\",\n            \"id\": \"anime-finished-400\",\n            \"level\": \"Passed 400 Mark\",\n            \"title\": \"Bragging rights\",\n            \"desc\": \"Watched 400 anime. That's... a lot. You can be proud of yourself, that's for sure.\"\n        },\n        {\n            \"threshold\": \"500-749\",\n            \"id\": \"anime-finished-500\",\n            \"level\": \"Passed 500 Mark\",\n            \"title\": \"A lot of free time\",\n            \"desc\": \"Watched 500 anime. Now pause, take a breath and stretch a bit. Remember not to sit too close to the screen.\"\n        },\n        {\n            \"threshold\": \"750-999\",\n            \"id\": \"anime-finished-750\",\n            \"level\": \"Passed 750 Mark\",\n            \"title\": \"Not Even My Final Form\",\n            \"desc\": \"Watched 750 anime. Your power level is way above others'. The only way is up.\"\n        },\n        {\n            \"threshold\": \"1000-1499\",\n            \"id\": \"anime-finished-1000\",\n            \"level\": \"Passed 1000 Mark\",\n            \"title\": \"Gotta Watch Them All!\",\n            \"desc\": \"Watched 1000 anime. You should already know what that picture means.\"\n        },\n        {\n            \"threshold\": \"1500-2499\",\n            \"id\": \"anime-finished-1500\",\n            \"level\": \"Passed 1500 Mark\",\n            \"title\": \"The Collector\",\n            \"desc\": \"Watched 1500 animes. No, wait. The plural of anime is anime.\"\n        },\n        {\n            \"threshold\": \"2500-4999\",\n            \"id\": \"anime-finished-2500\",\n            \"level\": \"Passed 2500 Mark\",\n            \"title\": \"The Maniac\",\n            \"desc\": \"Watched 2500 anime. Is this healthy? You should contact your doctor.\"\n        },\n        {\n            \"threshold\": \"5000-7499\",\n            \"id\": \"anime-finished-5000\",\n            \"level\": \"Passed 5000 Mark\",\n            \"title\": \"The Legend\",\n            \"desc\": \"Watched 5000 anime. You're one of the chosen ones. You don't even have to brag, since everyone heard about you.\"\n        },\n        {\n            \"threshold\": \"7500-9999\",\n            \"id\": \"anime-finished-7500\",\n            \"level\": \"Passed 7500 Mark\",\n            \"title\": \"Database Breaker\",\n            \"desc\": \"Watched 7.5 × 10³ anime. Are you having fun, breaking all the rules? By the way, since when do we have that many anime in the database?!\"\n        },\n        {\n            \"threshold\": \"10000+\",\n            \"id\": \"anime-finished-10000\",\n            \"level\": \"Passed 10000 Mark\",\n            \"title\": \"This Is It\",\n            \"desc\": \"Watched 10000 anime. There is no higher level. You can stop now. Everyone, go home.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"finished\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-franchise-long.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 301,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10+\",\n            \"id\": \"anime-franchise-long\",\n            \"level\": \"The Process of Acquiring This Achievement, That Is\",\n            \"title\": \"Long and Hard\",\n            \"desc\": \"Ten years ago, you began this journey...\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"franchise\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-game.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 302,\n    \"achievements\": [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-game-1\",\n            \"level\": \"Game: level 1\",\n            \"title\": \"Eternal Spring\",\n            \"desc\": \"It all started one fateful morning in April...\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-game-2\",\n            \"level\": \"Game: level 2\",\n            \"title\": \"At the Gates of Eden\",\n            \"desc\": \"You're so close to heaven, you can almost feel it.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-game-3\",\n            \"level\": \"Game: level 3\",\n            \"title\": \"Banquet of the Golden Witch\",\n            \"desc\": \"You've challenged her to a game. There is no turning back, now.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-game-4\",\n            \"level\": \"Immersion: level MAX\",\n            \"title\": \"Hacking to the Gate\",\n            \"desc\": \"All these games have made of you a wizard; you can crack any code without breaking a sweat.\"\n        }\n    ],\n    \"requirement\": {\n        \"type\": \"source-title\",\n        \"source\": [\n            8,\n            9\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-gar.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 102,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"12-23\",\n            \"id\": \"anime-gar-1\",\n            \"level\": \"GAR: level 1\",\n            \"title\": \"So Manly I Can't Breathe\",\n            \"desc\": \"Watching all those men made you feel like a little girl... and you liked it.\"\n        },\n        {\n            \"threshold\": \"24-43\",\n            \"id\": \"anime-gar-2\",\n            \"level\": \"GAR: level 2\",\n            \"title\": \"Testosterone Storm\",\n            \"desc\": \"Your body has adapted into GAR anime. You can hear your muscles growing.\"\n        },\n        {\n            \"threshold\": \"44-87\",\n            \"id\": \"anime-gar-3\",\n            \"level\": \"GAR: level 3\",\n            \"title\": \"You Are Already Man\",\n            \"desc\": \"Resistance is futile. People are simply no match for you.\"\n        },\n        {\n            \"threshold\": \"88+\",\n            \"id\": \"anime-gar-4\",\n            \"level\": \"GAR: level MAKSHIMUM\",\n            \"title\": \"Alpha Male\",\n            \"desc\": \"You aren't made out of testosterone. Testosterone is made out of you.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"title\",\n        \"titles\":\n        [\n            \"A32998\", //91 Days\n            \"A33964\", //91 Days: Mijikai Rousoku\n            \"A34777\", //91 Days: Toki no Asase/Subete no Kinou/Ashita, Mata Ashita\n            \"A8216\", //Aa Harimanada\n            \"A22831\", //Abarenbou Rikishi!! Matsutarou\n            \"A1292\", //Afro Samurai\n            \"A13709\", //Afro Samurai Movie\n            \"A27939\", //Afro Samurai Pilot\n            \"A4970\", //Afro Samurai: Resurrection\n            \"A47\", //Akira\n            \"A2356\", //Amon: Devilman Mokushiroku\n            \"A35834\", //Angolmois: Genkou Kassenki\n            \"A6721\", //Ankoku Cat\n            \"M36636\", //Ankoku Cat VS\n            \"A1488\", //Area 88\n            \"A284\", //Area 88 (TV)\n            \"A33232\", //Area 88 Movie\n            \"A2402\", //Ashita no Joe\n            \"A2920\", //Ashita no Joe (Movie)\n            \"A2921\", //Ashita no Joe 2\n            \"A2922\", //Ashita no Joe 2 (Movie)\n            \"A19973\", //Ashita no Joe Pilots\n            \"A2251\", //Baccano!\n            \"A3901\", //Baccano! Specials\n            \"A34443\", //Baki\n            \"A39555\", //Baki: Dai Raitaisai-hen\n            \"A33566\", //Baki: Most Evil Death Row Convicts Special Anime\n            \"A58573\", //Baki-dou\n            \"A1468\", //Baoh Raihousha\n            \"A67\", //Basilisk: Kouga Ninpou Chou\n            \"A35964\", //Basilisk: Ouka Ninpouchou\n            \"A404\", //Bastard!! Ankoku no Hakaishin\n            \"A50953\", //Bastard!! Ankoku no Hakaishin (ONA)\n            \"A51366\", //Bastard!! Ankoku no Hakaishin Part 2 (ONA)\n            \"A54141\", //Bastard!! Ankoku no Hakaishin: Jigoku no Chinkonka-hen\n            \"A4094\", //Batman: Gotham Knight\n            \"A1799\", //Battle Fighters Garou Densetsu\n            \"A1800\", //Battle Fighters Garou Densetsu 2\n            \"A3625\", //Battle Royal High School\n            \"A1009\", //Battle Spirits: Ryuuko no Ken\n            \"A37483\", //Bean Bandit\n            \"A9513\", //Beelzebub\n            \"A9120\", //Beelzebub: Hirotta Akachan wa Daimaou!?\n            \"A32379\", //Berserk\n            \"A34055\", //Berserk 2nd Season\n            \"A35676\", //Berserk: Majo no Tsuisou\n            \"A10218\", //Berserk: Ougon Jidaihen I - Haou no Tamago\n            \"A12113\", //Berserk: Ougon Jidaihen II - Doldrey Kouryaku\n            \"A12115\", //Berserk: Ougon Jidaihen III - Kourin\n            \"A35009\", //Berserk Recap\n            \"A2622\", //Big Wars: Kami Utsu Akaki Kouya ni\n            \"A8278\", //Biohazard 4: Incubate\n            \"A5624\", //Biohazard 4D-Executer\n            \"A9544\", //Biohazard: Damnation\n            \"A54398\", //Biohazard: Death Island\n            \"A3446\", //Biohazard: Degeneration\n            \"A42976\", //Biohazard: Infinite Darkness\n            \"A31853\", //Biohazard: Vendetta\n            \"A1269\", //Bio Hunter\n            \"A1520\", //Black Jack\n            \"A2214\", //Black Jack 21\n            \"A1373\", //Black Jack Specials: Inochi wo Meguru Yottsu no Kiseki\n            \"A1521\", //Black Jack the Movie\n            \"A2213\", //Black Jack (TV)\n            \"A4071\", //Black Jack (TV): Hizouban Specials\n            \"A1983\", //Black Jack: Futari no Kuroi Isha\n            \"A10055\", //Black Jack: Heian Sento\n            \"A6246\", //Black Jack: Sora kara Kita Kodomo\n            \"A889\", //Black Lagoon\n            \"A4901\", //Black Lagoon: Roberta's Blood Trail\n            \"A1519\", //Black Lagoon: The Second Barrage\n            \"A6920\", //Blade\n            \"A4151\", //Blade of the Immortal\n            \"A4522\", //Bounty Hunter: The Hard\n            \"A9177\", //Burning Blood\n            \"A3389\", //Bus Gamer\n            \"A17269\", //Captain Herlock\n            \"A4981\", //Casshern Sins\n            \"A1598\", //Casshern: Robot Hunter\n            \"A43763\", //Cestvs: The Roman Fighter\n            \"A978\", //Change!! Getter Robo: Sekai Saigo no Hi\n            \"A2881\", //Chinmoku no Kantai\n            \"A2341\", //Choujin Densetsu Urotsukidouji\n            \"A2360\", //Choujin Densetsu Urotsukidouji 2\n            \"A2345\", //Choujin Densetsu Urotsukidouji 5: Kanketsu-hen\n            \"A2359\", //Choujin Densetsu Urotsukidouji Movie\n            \"A2344\", //Choujin Densetsu Urotsukidouji: Inferno Road\n            \"A2343\", //Choujin Densetsu Urotsukidouji: Mirai-hen\n            \"A37338\", //Chuukan Kanriroku Tonegawa\n            \"A1470\", //City Hunter\n            \"A1471\", //City Hunter 2\n            \"A1472\", //City Hunter 3\n            \"A1473\", //City Hunter '91\n            \"A1474\", //City Hunter: Ai to Shukumei no Magnum\n            \"A1475\", //City Hunter: Bay City Wars\n            \"A1478\", //City Hunter: Goodbye My Sweetheart\n            \"A1476\", //City Hunter: Hyakuman Dollar no Inbou\n            \"A1479\", //City Hunter: Kinkyuu Namachuukei!? Kyouakuhan Saeba Ryou no Saigo\n            \"A37516\", //City Hunter Movie: Shinjuku Private Eyes\n            \"A1477\", //City Hunter: The Secret Service\n            \"A5032\", //Cobra the Animation\n            \"A4646\", //Cobra the Animation: The Psycho-Gun\n            \"A5031\", //Cobra the Animation: Time Drive\n            \"A1676\", //Cosmo Warrior Zero\n            \"A1\", //Cowboy Bebop\n            \"A5\", //Cowboy Bebop: Tengoku no Tobira\n            \"A4037\", //Cowboy Bebop: Yose Atsume Blues\n            \"A2722\", //Crusher Joe\n            \"A2696\", //Crusher Joe OVA\n            \"A1153\", //Crying Freeman\n            \"A1352\", //Cyber City Oedo 808\n            \"A42310\", //Cyberpunk: Edgerunners\n            \"A31050\", //Cyborg 009 VS Devilman\n            \"A18795\", //Dagram vs. Round-Facer\n            \"A7122\", //Dai Yamato Zero-gou\n            \"A1178\", //Detonator Orgun\n            \"A3702\", //Detroit Metal City\n            \"A5065\", //Detroit Metal City: Birth of the Metal Devil\n            \"A2252\", //Devilman\n            \"A35120\", //Devilman: Crybaby\n            \"A37590\", //Devilman: Crybaby - Digest Eizou\n            \"A35952\", //Devilman Memorial\n            \"A2354\", //Devilman: Tanjou-hen\n            \"A2355\", //Devilman: Yochou Sirene-hen\n            \"A1726\", //Devil May Cry\n            \"A2318\", //Dog Soldier\n            \"A5593\", //Dogs: Bullets & Carnage\n            \"A29605\", //Double Hard\n            \"A223\", //Dragon Ball\n            \"A12231\", //Dragon Ball: Episode of Bardock\n            \"A56894\", //Dragon Ball Daima\n            \"A225\", //Dragon Ball GT\n            \"A987\", //Dragon Ball GT: Gokuu Gaiden! Yuuki no Akashi wa Suushinchuu\n            \"A6033\", //Dragon Ball Kai\n            \"A22777\", //Dragon Ball Kai (2014)\n            \"A11359\", //Dragon Ball Kai: Mirai ni Heiwa wo! Goku no Tamashii yo Eien ni\n            \"A502\", //Dragon Ball Movie 1: Shen Long no Densetsu\n            \"A891\", //Dragon Ball Movie 2: Majinjou no Nemuri Hime\n            \"A892\", //Dragon Ball Movie 3: Makafushigi Daibouken\n            \"A893\", //Dragon Ball Movie 4: Saikyou e no Michi\n            \"A5152\", //Dragon Ball: Ossu! Kaette Kita Son Gokuu to Nakama-tachi!!\n            \"A2520\", //Dragon Ball Specials\n            \"A30694\", //Dragon Ball Super\n            \"A36946\", //Dragon Ball Super: Broly\n            \"A38653\", //Dragon Ball Super: Broly - Skytree Super\n            \"A10017\", //Dragon Ball: Super Saiya-jin Zetsumetsu Keikaku\n            \"A48903\", //Dragon Ball Super: Super Hero\n            \"A813\", //Dragon Ball Z\n            \"A6714\", //Dragon Ball Z: Atsumare! Gokuu World\n            \"A894\", //Dragon Ball Z Movie 01: Ora no Gohan wo Kaese!!\n            \"A895\", //Dragon Ball Z Movie 02: Kono Yo de Ichiban Tsuyoi Yatsu\n            \"A896\", //Dragon Ball Z Movie 03: Chikyuu Marugoto Choukessen\n            \"A897\", //Dragon Ball Z Movie 04: Super Saiyajin da Son Gokuu\n            \"A898\", //Dragon Ball Z Movie 05: Tobikkiri no Saikyou tai Saikyou\n            \"A899\", //Dragon Ball Z Movie 06: Gekitotsu!! 100-oku Power no Senshi-tachi\n            \"A900\", //Dragon Ball Z Movie 07: Kyokugen Battle!! Sandai Super Saiyajin\n            \"A901\", //Dragon Ball Z Movie 08: Moetsukiro!! Nessen, Ressen, Chougekisen\n            \"A902\", //Dragon Ball Z Movie 09: Ginga Girigiri!! Bucchigiri no Sugoi Yatsu\n            \"A903\", //Dragon Ball Z Movie 10: Kiken na Futari! Super Senshi wa Nemurenai\n            \"A904\", //Dragon Ball Z Movie 11: Super Senshi Gekiha!! Katsu no wa Ore da\n            \"A905\", //Dragon Ball Z Movie 12: Fukkatsu no Fusion!! Gokuu to Vegeta\n            \"A906\", //Dragon Ball Z Movie 13: Ryuuken Bakuhatsu!! Goku ga Yaraneba Dare ga Yaru\n            \"A14837\", //Dragon Ball Z Movie 14: Kami to Kami\n            \"A25389\", //Dragon Ball Z Movie 15: Fukkatsu no \"F\"\n            \"A984\", //Dragon Ball Z: Saiya-jin Zetsumetsu Keikaku\n            \"A986\", //Dragon Ball Z Special 1: Tatta Hitori no Saishuu Kessen\n            \"A985\", //Dragon Ball Z Special 2: Zetsubou e no Hankou!! Nokosareta Chousenshi - Gohan to Trunks\n            \"A22695\", //Dragon Ball Z: Summer Vacation Special\n            \"A33947\", //Dragon Ball Z: The Real 4-D\n            \"A42449\", //Dragon Ball Z: The Real 4-D at Super Tenkaichi Budokai\n            \"A52282\", //Dragon Ball Z x Kao\n            \"A22699\", //Dragon Ball Z: Zenbu Misemasu Toshi Wasure Dragon Ball Z!\n            \"A31339\", //Drifters\n            \"A36480\", //Drifters (OVA)\n            \"A33032\", //Drifters: Special Edition\n            \"A38360\", //Drifters: The Outlandish Knight\n            \"A12885\", //Dynamic Super Robots Soushingekki\n            \"A5883\", //Examurai Sengoku\n            \"A26209\", //Examurai Sengoku Recap\n            \"A61543\", //Fatal Fury: City of the Wolves\n            \"A34662\", //Fate/Apocrypha\n            \"A36729\", //Fate/Apocrypha Recaps\n            \"A34321\", //Fate/Grand Order: First Order\n            \"A36915\", //Fate/Grand Order: Moonlight/Lostroom\n            \"A38085\", //Fate/Grand Order: Shinsei Entaku Ryouiki Camelot 1 - Wandering; Agateram\n            \"A38086\", //Fate/Grand Order: Shinsei Entaku Ryouiki Camelot 2 - Paladin; Agateram\n            \"A41497\", //Fate/Grand Order: Shuukyoku Tokuiten - Kani Jikan Shinden Solomon\n            \"A51410\", //Fate/Grand Order: Shuukyoku Tokuiten - Kani Jikan Shinden Solomon Specials\n            \"A38084\", //Fate/Grand Order: Zettai Majuu Sensen Babylonia\n            \"A40206\", //Fate/Grand Order: Zettai Majuu Sensen Babylonia - Initium Iter\n            \"A40761\", //Fate/Grand Order: Zettai Majuu Sensen Babylonia Recaps\n            \"A12565\", //Fate/Prototype\n            \"A356\", //Fate/stay night\n            \"A25537\", //Fate/stay night Movie: Heaven's Feel - I. Presage Flower\n            \"A33049\", //Fate/stay night Movie: Heaven's Feel - II. Lost Butterfly\n            \"A33050\", //Fate/stay night Movie: Heaven's Feel - III. Spring Song\n            \"A6922\", //Fate/stay night Movie: Unlimited Blade Works\n            \"A7559\", //Fate/stay night TV Reproduction\n            \"A22297\", //Fate/stay night: Unlimited Blade Works\n            \"A27821\", //Fate/stay night: Unlimited Blade Works Prologue\n            \"A28701\", //Fate/stay night: Unlimited Blade Works 2nd Season\n            \"A31389\", //Fate/stay night: Unlimited Blade Works 2nd Season - Sunny Day\n            \"A55830\", //Fate/strange Fake\n            \"A53127\", //Fate/strange Fake: Whispers of Dawn\n            \"A40982\", //Fate/strange Fake PV\n            \"A10087\", //Fate/Zero\n            \"A11741\", //Fate/Zero 2nd Season\n            \"A13183\", //Fate/Zero Remix\n            \"A317\", //Final Fantasy VII: Advent Children\n            \"A2952\", //Final Fantasy VII: Advent Children Complete\n            \"A6152\", //Final Fantasy VII: Advent Children - Venice Film Festival Footage\n            \"A408\", //Final Fantasy VII: Last Order\n            \"A4298\", //Futari no Joe\n            \"A21821\", //Fuuun Ishin Dai Shogun\n            \"A37657\", //Gakuen Basara\n            \"A25183\", //Gangsta.\n            \"A31561\", //Gangsta. Recap\n            \"A384\", //Gantz\n            \"A395\", //Gantz 2nd Stage\n            \"A32071\", //Gantz:O\n            \"A28537\", //Garo: Guren no Tsuki\n            \"A33709\", //Garo: Guren no Tsuki Special\n            \"A23311\", //Garo: Honoo no Kokuin\n            \"A32415\", //Garo: Honoo no Kokuin - Home\n            \"A28539\", //Garo Movie: Divine Flame\n            \"A36144\", //Garo: Vanishing Line\n            \"A37032\", //Garo: Vanishing Line Recap\n            \"A504\", //Garou Densetsu: The Motion Picture\n            \"A3154\", //Gatchaman\n            \"A3579\", //Getter Robo\n            \"A43741\", //Geter Robo Arc\n            \"A4486\", //Getter Robo G\n            \"A5292\", //Getter Robo Go\n            \"A42153\", //Getter Robo Memorial\n            \"A8252\", //Getter Robo (Movie)\n            \"A7661\", //Giant Killing\n            \"A18771\", //Gifuu Doudou!!: Kanetsugu to Keiji\n            \"A820\", //Ginga Eiyuu Densetsu\n            \"A3016\", //Ginga Eiyuu Densetsu: Arata Naru Tatakai no Overture\n            \"A42886\", //Ginga Eiyuu Densetsu: Die Neue These - Gekitotsu\n            \"A31433\", //Ginga Eiyuu Densetsu: Die Neue These - Kaikou\n            \"A51805\", //Ginga Eiyuu Densetsu: Die Neue These - Sakubou\n            \"A36369\", //Ginga Eiyuu Densetsu: Die Neue These - Seiran 1\n            \"A36370\", //Ginga Eiyuu Densetsu: Die Neue These - Seiran 2\n            \"A36371\", //Ginga Eiyuu Densetsu: Die Neue These - Seiran 3\n            \"A3371\", //Ginga Eiyuu Densetsu Gaiden\n            \"A3665\", //Ginga Eiyuu Densetsu Gaiden (1999)\n            \"A3015\", //Ginga Eiyuu Densetsu Gaiden: Ougon no Tsubasa\n            \"A3014\", //Ginga Eiyuu Densetsu: Waga Yuku wa Hoshi no Taikai\n            \"A915\", //Ginga Densetsu Weed\n            \"A589\", //Ginga Nagareboshi Gin\n            \"A3907\", //Ginga Sengoku Gunyuuden Rai\n            \"A43692\", //Gokushufudou\n            \"A48707\", //Gokushufudou Part 2\n            \"A53148\", //Gokushufudou Season 2\n            \"A37755\", //Golden Douga Gekijou\n            \"A51149\", //Golden Douga Gekijou Specials\n            \"A36028\", //Golden Kamuy\n            \"A37989\", //Golden Kamuy 2nd Season\n            \"A38710\", //Golden Kamuy 2nd Season OVA\n            \"A40059\", //Golden Kamuy 3rd Season\n            \"A50528\", //Golden Kamuy 4th Season\n            \"A61834\", //Golden Kamuy: Inazuma Goutou to Mamushi no Ogin/Shimaenaga\n            \"A37884\", //Golden Kamuy OVA\n            \"A55772\", //Golden Kamuy: Saishuushou\n            \"A62067\", //Golden Kamuy: Sapporo Beer Koujou-hen\n            \"A4039\", //Golgo 13\n            \"A1761\", //Golgo 13: Queen Bee\n            \"A1760\", //Golgo 13: The Professional\n            \"A49895\", //Go! Saitama\n            \"A1859\", //Grappler Baki\n            \"A287\", //Grappler Baki (TV)\n            \"A551\", //Grappler Baki: Saidai Tournament-hen\n            \"A5658\", //Great Mazinger\n            \"A4385\", //Great Mazinger tai Getter Robo\n            \"A4386\", //Great Mazinger tai Getter Robo G: Kuuchuu Dai-Gekitotsu\n            \"A245\", //Great Teacher Onizuka\n            \"A3481\", //Grendizer: Getter Robo G - Great Mazinger Kessen! Daikaijuu\n            \"A31467\", //Grendizer Giga\n            \"A56189\", //Grendizer U\n            \"A2423\", //Grey: Digital Target\n            \"A5041\", //Guin Saga\n            \"A1706\", //Gun Frontier\n            \"A411\", //Gun x Sword\n            \"A267\", //Gungrave\n            \"A2070\", //Guy: Youma Kakusei\n            \"A3002\", //Gyakkyou Burai Kaiji: Ultimate Survivor\n            \"A10271\", //Gyakkyou Burai Kaiji: Hakairoku Hen\n            \"A263\", //Hajime no Ippo\n            \"A12069\", //Hajime no Ippo: Boxer no Kobushi\n            \"A264\", //Hajime no Ippo: Champion Road\n            \"A265\", //Hajime no Ippo: Mashiba vs. Kimura\n            \"A5258\", //Hajime no Ippo: New Challenger\n            \"A19647\", //Hajime no Ippo: Rising\n            \"A42940\", //Hanma Baki: Son of Ogre\n            \"A51318\", //Hanma Baki: Son of Ogre 2nd Season\n            \"A58510\", //Hanma Baki vs. Kengan Ashura\n            \"A10964\", //Heavy\n            \"A270\", //Hellsing\n            \"A777\", //Hellsing Ultimate\n            \"A11077\", //Hellsing: The Dawn\n            \"A7728\", //Hellsing: Psalm of Darkness\n            \"A6904\", //Hellsing I: Digest for Freaks\n            \"A1645\", //Herlock Saga: Nibelung no Yubiwa\n            \"A59712\", //Herlock Saga: Nibelung no Yubiwa Pilot\n            \"A2178\", //Highlander: The Search for Vengeance\n            \"A967\", //Hokuto no Ken\n            \"A1356\", //Hokuto no Ken 2\n            \"A1358\", //Hokuto no Ken Movie\n            \"A7363\", //Hokuto No Ken: Legend of Heroes\n            \"A2174\", //Hokuto no Ken: Raoh Gaiden Gekitou-hen\n            \"A1773\", //Hokuto no Ken: Raoh Gaiden Junai-hen\n            \"A4549\", //Hokuto no Ken: Raoh Gaiden Ten no Haoh\n            \"A4312\", //Hokuto no Ken: Toki-den\n            \"A3027\", //Hokuto no Ken: Yuria-den\n            \"A5291\", //Hokuto no Ken Zero: Kenshiro Den\n            \"A2050\", //Honoo no Tenkousei\n            \"A6090\", //Hon Ran\n            \"A4808\", //Hurricane Polymar\n            \"A16774\", //Inferno Cop\n            \"A17843\", //Inferno Cop: Fact Files\n            \"A31035\", //Inferno Cop Specials\n            \"A33027\", //Infini-T Force\n            \"A36197\", //Infini-T Force Movie: Gatchaman - Saraba Tomo yo\n            \"A1759\", //Jigen Sengokushi: Kuro no Shishi - Jinnai Hen\n            \"A33400\", //Jigoku de Naze Warui\n            \"A666\", //JoJo no Kimyou na Bouken\n            \"A665\", //JoJo no Kimyou na Bouken: Adventure\n            \"A14719\", //JoJo no Kimyou na Bouken (TV)\n            \"A20899\", //JoJo no Kimyou na Bouken Part 3: Stardust Crusaders\n            \"A26055\", //JoJo no Kimyou na Bouken Part 3: Stardust Crusaders 2nd Season\n            \"A31933\", //JoJo no Kimyou na Bouken Part 4: Diamond wa Kudakenai\n            \"A37991\", //JoJo no Kimyou na Bouken Part 5: Ougon no Kaze\n            \"A38972\", //JoJo no Kimyou na Bouken Part 5: Ougon no Kaze Recaps\n            \"A48661\", //JoJo no Kimyou na Bouken Part 6: Stone Ocean\n            \"A51367\", //JoJo no Kimyou na Bouken Part 6: Stone Ocean Part 2\n            \"A53273\", //JoJo no Kimyou na Bouken Part 6: Stone Ocean Part 3\n            \"A3603\", //JoJo no Kimyou na Bouken: Phantom Blood\n            \"A41306\", //JoJo no Kimyou na Bouken: Phantom Blood Pilot\n            \"A52593\", //JoJo no Kimyou na Bouken: The Real 4-D Dio no Sekai\n            \"A12413\", //Jormungand\n            \"A13331\", //Jormungand: Perfect Order\n            \"A15735\", //Jormungand: Perfect Order Recap\n            \"A617\", //Juubee Ninpuuchou\n            \"A618\", //Juubee Ninpuuchou: Ryuuhougyoku-hen\n            \"A2389\", //Kagaku Ninja-tai Gatchaman\n            \"A6374\", //Kagaku Ninja-tai Gatchaman II\n            \"A6375\", //Kagaku Ninja-tai Gatchaman F\n            \"A3153\", //Kagaku Ninja-tai Gatchaman (Movie)\n            \"A52588\", //Kaijuu 8-gou\n            \"A59490\", //Kaijuu 8-gou: Hoshina no Kyuujitsu\n            \"A59177\", //Kaijuu 8-gou 2nd Season\n            \"A59489\", //Kaijuu 8-gou Movie\n            \"A496\", //Kamui no Ken\n            \"A2243\", //Karasu Tengu Kabuto\n            \"A3726\", //Karasu Tengu Kabuto: Ougon no Me no Kemono\n            \"A1777\", //Kaze no Tairiku\n            \"A24439\", //Kekkai Sensen\n            \"A34451\", //Kekkai Sensen & Beyond\n            \"A37364\", //Kekkai Sensen & Beyond OVA\n            \"A30915\", //Kekkai Sensen: Soresaemo Saitei de Saikou na Hibi\n            \"A32574\", //Kekkai Sensen: Ousama no Restaurant no Ousama\n            \"A36903\", //Kengan Ashura\n            \"A40269\", //Kengan Ashura Part 2\n            \"A51369\", //Kengan Ashura Season 2\n            \"A56704\", //Kengan Ashura Season 2 Part 2\n            \"A33\", //Kenpuu Denki Berserk\n            \"A96\", //Kidou Butouden G Gundam\n            \"A31251\", //Kidou Senshi Gundam: Tekketsu no Orphans\n            \"A33051\", //Kidou Senshi Gundam: Tekketsu no Orphans 2nd Season\n            \"A62264\", //Kidou Senshi Gundam: Tekketsu no Orphans - Makuai no Kusabi\n            \"A51569\", //Kidou Senshi Gundam: Tekketsu no Orphans - Tokubetsu-hen\n            \"A62805\", //Kidou Senshi Gundam: Tekketsu no Orphans - Urdr Hunt: Chiisana Chousensha no Kiseki\n            \"A31973\", //Kidou Senshi Gundam Thunderbolt\n            \"A34391\", //Kidou Senshi Gundam Thunderbolt 2nd Season\n            \"A35949\", //Kidou Senshi Gundam Thunderbolt: Bandit Flower\n            \"A33221\", //Kidou Senshi Gundam Thunderbolt: December Sky\n            \"A38000\", //Kimetsu no Yaiba\n            \"A55701\", //Kimetsu no Yaiba: Hashira Geiko-hen\n            \"A51019\", //Kimetsu no Yaiba: Katanakaji no Sato-hen\n            \"A49926\", //Kimetsu no Yaiba: Mugen Ressha-hen\n            \"A47778\", //Kimetsu no Yaiba: Yuukaku-hen\n            \"A40456\", //Kimetsu no Yaiba Movie: Mugen Ressha-hen\n            \"A59192\", //Kimetsu no Yaiba Movie 1: Mugenjou-hen - Akaza Sairai\n            \"A12031\", //Kingdom\n            \"A17389\", //Kingdom 2nd Season\n            \"A40682\", //Kingdom 3rd Season\n            \"A50160\", //Kingdom 4th Season\n            \"A53223\", //Kingdom 5th Season\n            \"A61517\", //Kingdom 6th Season\n            \"A825\", //King of Fighters: Another Day\n            \"A34678\", //Kingsglaive: FFXV Fan Kansha Tokubetsu Movie\n            \"A3272\", //Kinnikuman\n            \"A3273\", //Kinnikuman (1984)\n            \"A3276\", //Kinnikuman: Gyakushuu! Uchuu Kakure Choujin\n            \"A3277\", //Kinnikuman: Haresugata! Seigi Choujin\n            \"A54730\", //Kinnikuman: Kanpeki Choujin Shiso-hen\n            \"A59162\", //Kinnikuman: Kanpeki Choujin Shiso-hen Episode 0\n            \"A59914\", //Kinnikuman: Kanpeki Choujin Shiso-hen Season 2\n            \"A3281\", //Kinnikuman: Kinnikusei Oui Soudatsu-hen\n            \"A3278\", //Kinnikuman: New York Kikiippatsu!\n            \"A3275\", //Kinnikuman: Seigi Choujin vs. Kodai Choujin\n            \"A3279\", //Kinnikuman: Seigi Choujin vs. Senshi Choujin\n            \"A3280\", //Kinnikuman: Kessen! Shichinin no Seigi Choujin vs. Uchuu Nobushi\n            \"A3274\", //Kinnikuman: Ooabare! Segi Choujin\n            \"A1707\", //Kinnikuman II Sei\n            \"A12279\", //Kinnikuman II Sei Muscle: Ninjin Soudatsu sen! Choujin Daisensou\n            \"A6310\", //Kinnikuman II Sei: Second Generations\n            \"A5967\", //Kinnikuman II Sei: Ultimate Muscle\n            \"A5968\", //Kinnikuman II Sei: Ultimate Muscle 2\n            \"A2048\", //Kikou Ryohei Mellowlink\n            \"A33191\", //Kishibe Rohan wa Ugokanai\n            \"A1573\", //Kishin Douji Zenki\n            \"A5828\", //Kishin Douji Zenki Gaiden: Anki Kitan\n            \"A766\", //Kishin Houkou Demonbane\n            \"A1067\", //Kishin Houkou Demonbane (TV)\n            \"A23753\", //Kishin Houkou Demonbane (TV) Specials\n            \"A3064\", //Kizuoibito\n            \"A2346\", //Koroshiya 1 The Animation: Episode 0\n            \"A6293\", //Koukou Butouden Crows\n            \"A2797\", //Koukou Tekken-den Tough\n            \"A2737\", //Kouryuu no Mimi: Mina no Shou\n            \"A4198\", //Koutetsu Jeeg\n            \"A2157\", //Koutetsushin Jeeg\n            \"A851\", //Kyou kara Ore wa!!\n            \"A2293\", //Kyoushoku Soukou Guyver\n            \"A6016\", //Kyoushoku Soukou Guyver (1989)\n            \"A1374\", //Kyoushoku Soukou Guyver (2005)\n            \"A1336\", //Kyoushoku Soukou Guyver II\n            \"A434\", //Legend of Lemnear: Kyokuguro no Tsubasa Valkisas\n            \"A37506\", //Legend of Lemnear: Kyokuguro no Tsubasa Valkisas Pilot Film\n            \"A3676\", //Machine Robo: Revenge of Chronos\n            \"A6577\", //Machine Robo: Leina, The Legend of Wolf Blade\n            \"A474\", //Macross Plus\n            \"A1211\", //Macross Plus Movie Edition\n            \"A3448\", //Mad★Bull 34\n            \"A1455\", //Makai Tenshou\n            \"A499\", //Makai Toshi Shinjuku\n            \"A1628\", //Maou Dante\n            \"A6061\", //Maryuu Senki\n            \"A2253\", //Mazinger Z\n            \"A10625\", //Mazinger Z (Movie)\n            \"A34820\", //Mazinger Z Movie: Infinity\n            \"A3898\", //Mazinger Z tai Devilman\n            \"A4388\", //Mazinger Z tai Dr. Hell\n            \"A4406\", //Mazinger Z tai Ankoku Daishougun\n            \"A1064\", //Mazinkaiser\n            \"A8666\", //Mazinkaiser SKL\n            \"A2734\", //Mazinkaiser: Shitou! Ankoku Dai Shogun\n            \"A1286\", //MD Geist II: Death Force\n            \"A36563\", //Megalo Box\n            \"A37703\", //Megalo Box Specials\n            \"A16255\", //Meisou-Ou Border\n            \"A1879\", //Midnight Eye: Gokuu\n            \"A1880\", //Midnight Eye: Gokuu II\n            \"A5386\", //Miyamoto Musashi: Souken ni Haseru Yume\n            \"A1941\", //Moonlight Mile 1st Season: Lift Off\n            \"A2929\", //Moonlight Mile 2nd Season: Touch Down\n            \"A6946\", //Mudazumo Naki Kaikaku: The Legend of Koizumi\n            \"A39806\", //Mugen no Juunin: Immortal\n            \"A4617\", //Nana Toshi Monogatari: Hokkyokukai Sensen\n            \"A6030\", //Needless\n            \"A8935\", //Nekketsu Uchuujin\n            \"A36517\", //Ninja Batman\n            \"A58964\", //Ninja Batman tai Yakuza League\n            \"A619\", //Ninja Ryuukenden\n            \"A23605\", //Ninja Slayer From Animation\n            \"A19855\", //Nobunagun\n            \"A39539\", //No Guns Life\n            \"A40529\", //No Guns Life 2nd Season\n            \"A40729\", //Nomad: Megalo Box 2\n            \"A48678\", //Nomad: Megalo Box 2 Short Anime\n            \"A7836\", //Notari Matsutarou\n            \"A5040\", //One Outs\n            \"A30276\", //One Punch Man\n            \"A34134\", //One Punch Man 2nd Season\n            \"A39652\", //One Punch Man 2nd Season Commemorative Special\n            \"A39705\", //One Punch Man 2nd Season Specials\n            \"A62653\", //One Punch Man 2nd Season: Ichigeki de Wakaru! Maji Furikaeri!\n            \"A52807\", //One Punch Man 3\n            \"A31704\", //One Punch Man: Road to Hero\n            \"A31772\", //One Punch Man Specials\n            \"A33983\", //Onihei\n            \"A28297\", //Ore Monogatari!!\n            \"A6031\", //Osu!! Karate Bu\n            \"A17903\", //Otokogi\n            \"A35848\", //Promare\n            \"A39991\", //Promare: Galo-hen\n            \"A40313\", //Promare: Lio-hen\n            \"A1027\", //Psychic Force\n            \"A6114\", //Rainbow: Nisha Rokubou no Shichinin\n            \"A6675\", //Redline\n            \"A11483\", //Redline Pilot\n            \"A917\", //Riding Bean\n            \"A3509\", //Riki-Oh: Toukatsu Jigoku\n            \"A3511\", //Riki-Oh 2: Horobi no Ko\n            \"A23\", //Ring ni Kakero 1\n            \"A7793\", //Ring ni Kakero 1: Kage Dou-hen\n            \"A1771\", //Ring ni Kakero 1: Nichibei Kessen-hen\n            \"A34307\", //Ring ni Kakero 1 Pilot\n            \"A10346\", //Ring ni Kakero 1: Sekai Taikai-hen\n            \"A9077\", //Rokudenashi Blues\n            \"A9078\", //Rokudenashi Blues 1993\n            \"A6591\", //Rurouni Kenshin DVD-BOX Special Ending\n            \"A45\", //Rurouni Kenshin: Meiji Kenkaku Romantan\n            \"A50613\", //Rurouni Kenshin: Meiji Kenkaku Romantan (2023)\n            \"A46\", //Rurouni Kenshin: Meiji Kenkaku Romantan - Ishinshishi e no Chinkonka\n            \"A57554\", //Rurouni Kenshin: Meiji Kenkaku Romantan - Kyoto Douran\n            \"A401\", //Rurouni Kenshin: Meiji Kenkaku Romantan - Seisou-hen\n            \"A11441\", //Rurouni Kenshin: Meiji Kenkaku Romantan - Shin Kyoto-hen\n            \"A44\", //Rurouni Kenshin: Meiji Kenkaku Romantan - Tsuioku-hen\n            \"A10334\", //Rurouni Kenshin Recap\n            \"A9716\", //Rurouni Kenshin: Review Special\n            \"A12067\", //Rurouni Kenshin Special\n            \"A4664\", //Rurouni Kenshin: Special Techniques\n            \"A1254\", //Saint Seiya\n            \"A1256\", //Saint Seiya: Jashin Eris\n            \"A1258\", //Saint Seiya: Kamigami no Atsuki Tatakai\n            \"A36040\", //Saint Seiya: Knights of the Zodiac\n            \"A52273\", //Saint Seiya: Knights of the Zodiac - Battle Sanctuary\n            \"A53748\", //Saint Seiya: Knights of the Zodiac - Battle Sanctuary Part 2\n            \"A10687\", //Saint Seiya: Legend of Sanctuary\n            \"A3515\", //Saint Seiya: Meiou Hades Elysion-hen\n            \"A1257\", //Saint Seiya: Meiou Hades Juuni Kyuu-hen\n            \"A6154\", //Saint Seiya: Meiou Hades Juuni Kyuu-hen - Yomigaerishi Gold Saint-tachi no Shinwa\n            \"A1253\", //Saint Seiya: Meiou Hades Meikai-hen\n            \"A12929\", //Saint Seiya Omega\n            \"A6153\", //Saint Seiya Recap\n            \"A1260\", //Saint Seiya: Saishuu Seisen no Senshi-tachi\n            \"A34539\", //Saint Seiya: Saintia Shou\n            \"A1255\", //Saint Seiya: Shinku no Shounen Densetsu\n            \"A28215\", //Saint Seiya: Soul of Gold\n            \"A1259\", //Saint Seiya: Tenkai-hen Josou - Overture\n            \"A6171\", //Saint Seiya: The Lost Canvas - Meiou Shinwa\n            \"A9130\", //Saint Seiya: The Lost Canvas - Meiou Shinwa 2\n            \"A114\", //Sakigake!! Cromartie Koukou\n            \"A2903\", //Sakigake!! Otokojuku\n            \"A4031\", //Sakigake!! Otokojuku Movie\n            \"A1608\", //Salaryman Kintarou\n            \"A166\", //Samurai 7\n            \"A205\", //Samurai Champloo\n            \"A33734\", //Samurai Noodles: The Originator\n            \"A2698\", //Sanctuary\n            \"A3067\", //Saraba Uchuu Senkan Yamato: Ai no Senshi-tachi\n            \"A168\", //s.CRY.ed\n            \"A10592\", //s.CRY.ed Alteration I: Tao\n            \"A12223\", //s.CRY.ed Alteration II: Quan\n            \"A400\", //Seihou Bukyou Outlaw Star\n            \"A4650\", //Seihou Bukyou Outlaw Star Pilot\n            \"A33713\", //Seihou Bukyou Outlaw Star Specials\n            \"A3882\", //Seijuuki Cyguard\n            \"A5355\", //Sengoku Basara\n            \"A23201\", //Sengoku Basara: Judge End\n            \"A9745\", //Sengoku Basara Movie: The Last Party\n            \"A6581\", //Sengoku Basara: Setonai no Gekitotsu! Hi wo Fuku Umi no Daiyousai - Fugaku!!\n            \"A6634\", //Sengoku Basara Two\n            \"A10483\", //Sengoku Basara Two: Ryuko, Itadaki no Chikai! Atsuki Mirai e Kakeru Tamashii!!\n            \"A3005\", //Shadow Skill\n            \"A679\", //Shadow Skill (1996)\n            \"A678\", //Shadow Skill: Eigi\n            \"A1099\", //Shadow Skill: Kurudaryuu Kousatsuhou no Himitsu\n            \"A18683\", //Shibai Taroka\n            \"A2216\", //Shigurui\n            \"A1559\", //Shijou Saikyou no Deshi Kenichi\n            \"A11813\", //Shijou Saikyou no Deshi Kenichi OVA\n            \"A24029\", //Shijou Saikyou no Deshi Kenichi Specials\n            \"A884\", //Shin Angyo Onshi\n            \"A2342\", //Shin Choujin Densetsu Urotsukidouji Mataiden\n            \"A2978\", //Shin Getter Robo\n            \"A938\", //Shin Getter Robo tai Neo Getter Robo\n            \"A1357\", //Shin Hokuto no Ken\n            \"A3398\", //Shin Hurricane Polymar\n            \"A5485\", //Shin Mazinger Shougeki! Z-Hen\n            \"A9749\", //Shin Otokogi\n            \"A4810\", //Shinzou Ningen Casshern\n            \"A1913\", //Shonan Junai Gumi!\n            \"A52642\", //Shounen Sunday CM: Shijou Saikyou no Deshi Kenichi\n            \"A1451\", //Shuranosuke Zanmaken: Shikamamon no Otoko\n            \"A1227\", //Shuten Douji\n            \"A2161\", //Skull Man\n            \"A170\", //Slam Dunk\n            \"A2499\", //Slam Dunk: Hoero Basketman-damashii Hanamichi to Rukawa no Atsuki Natsu\n            \"A52159\", //Slam Dunk: Ketsui no Shouhoku Basket-bu\n            \"A1764\", //Slam Dunk (Movie)\n            \"A2498\", //Slam Dunk: Shouhoku Saidai no Kiki Moero Sakuragi Hanamichi\n            \"A1861\", //Slam Dunk: Zenkoku Seiha Da Sakuragi Hanamichi\n            \"A1285\", //Soukihei MD Geist\n            \"A2582\", //Soukou Kihei Votoms\n            \"A2584\", //Soukou Kihei Votoms: Big Battle\n            \"A8017\", //Soukou Kihei Votoms: Gen-ei Hen\n            \"A2586\", //Soukou Kihei Votoms: Kakuyaku taru Itan\n            \"A8250\", //Soukou Kihei Votoms: Koei Futatabi\n            \"A3256\", //Soukou Kihei Votoms: Pailsen Files\n            \"A7536\", //Soukou Kihei Votoms: Pailsen Files the Movie\n            \"A2585\", //Soukou Kihei Votoms: Red Shoulder Document - Yabou no Roots\n            \"A2583\", //Soukou Kihei Votoms: The Last Red Shoulder\n            \"A12439\", //Soukou Kihei Votoms: Vol.1 Stories of the 'A.T. Votoms'\n            \"A12441\", //Soukou Kihei Votoms: Vol.2 Highlights of the 'A.T. Votoms'\n            \"A12337\", //Soukou Kihei Votoms Recaps\n            \"A1345\", //Soujuu Senshi Psychic Wars\n            \"A5226\", //Souten Kouro\n            \"A1541\", //Souten no Ken\n            \"A36655\", //Souten no Ken: Regenesis\n            \"A37388\", //Souten no Ken: Regenesis 2nd Season\n            \"A3864\", //Souten no Ken Specials\n            \"A2452\", //Space Adventure Cobra\n            \"A2451\", //Space Cobra\n            \"A5742\", //Space Cobra Pilot\n            \"A20057\", //Space☆Dandy\n            \"A25635\", //Space☆Dandy Picture Drama\n            \"A23327\", //Space☆Dandy 2nd Season\n            \"A30246\", //Space☆Dandy 2nd Season Picture Drama\n            \"A1081\", //Space Pirate Captain Herlock: Outside Legend - The Endless Odyssey\n            \"A420\", //Spriggan\n            \"A39489\", //Spriggan (ONA)\n            \"A14629\", //Starship Troopers: Invasion\n            \"A36194\", //Starship Troopers: Red Planet\n            \"A61469\", //Steel Ball Run: JoJo no Kimyou na Bouken\n            \"A3086\", //Strait Jacket\n            \"A2418\", //Stranger: Mukou Hadan\n            \"A14617\", //Stranger: Mukou Hadan Pilot\n            \"A950\", //Street Fighter Alpha: Generations\n            \"A876\", //Street Fighter II V\n            \"A1362\", //Street Fighter II Movie\n            \"A17379\", //Street Fighter II: Yomigaeru Fujiwara-Kyou - Toki wo Kaketa Fighter-tachi\n            \"A41873\", //Street Fighter IV: Aftermath\n            \"A5369\", //Street Fighter IV: Aratanaru Kizuna\n            \"A979\", //Street Fighter Zero The Animation\n            \"A37885\", //Super Dragon Ball Heroes\n            \"A3252\", //Super Express Mazinger 7\n            \"A1603\", //Super Robot Taisen OG: Divine Wars\n            \"A4075\", //Super Robot Taisen OG: Divine Wars Special\n            \"A1544\", //Super Robot Taisen OG: The Animation\n            \"A9241\", //Super Robot Taisen OG: The Inspector\n            \"A8026\", //Super Street Fighter IV\n            \"A2257\", //Taiyou no Kiba Dagram\n            \"A4427\", //Tatakae!! Ramenman\n            \"A16728\", //Tatakae!! Ramenman (Movie)\n            \"A537\", //Tekken\n            \"A51347\", //Tekken: Bloodline\n            \"A10702\", //Tekken: Blood Vengeance\n            \"A2001\", //Tengen Toppa Gurren Lagann\n            \"A5947\", //Tengen Toppa Gurren Lagann Movie: Lagann-hen Special - Viral no Amai Yume\n            \"A4107\", //Tengen Toppa Gurren Lagann Movie: Gurren-hen\n            \"A4565\", //Tengen Toppa Gurren Lagann Movie: Lagann-hen\n            \"A3352\", //Tengen Toppa Gurren Lagann: Mitee Mono wa Miteen da!!\n            \"A10622\", //Tengen Toppa Gurren Lagann: Ore no Gurren wa Pikka-Pika!!\n            \"A4705\", //Tengen Toppa Gurren Lagann Parallel Works\n            \"A8348\", //Tengen Toppa Gurren Lagann Parallel Works 2\n            \"A174\", //Tenjou Tenge\n            \"A760\", //Tenjou Tenge: The Past Chapter\n            \"A448\", //Tenjou Tenge: The Ultimate Fight\n            \"A23723\", //Teppen\n            \"A22687\", //Terra Formars\n            \"A22689\", //Terra Formars: Bugs 2-hen\n            \"A34532\", //Terra Formars: Earth-hen\n            \"A31430\", //Terra Formars Revenge\n            \"A2500\", //The Cockpit\n            \"A45649\", //The First Slam Dunk\n            \"A58047\", //The King of Fighters: Awaken PV\n            \"A35204\", //The King of Fighters: Destiny\n            \"A48582\", //The King of Fighters XV\n            \"A4714\", //The Rapeman\n            \"A3009\", //Tiger Mask\n            \"A18061\", //Tiger Mask (Movie)\n            \"A18063\", //Tiger Mask Fuku Men League Sen\n            \"A5832\", //Tiger Mask Nisei\n            \"A32881\", //Tiger Mask W\n            \"A1703\", //Tokyo Tribe 2\n            \"A10033\", //Toriko\n            \"A10074\", //Toriko 3D: Kaimaku Gourmet Adventure!!\n            \"A11787\", //Toriko: Barbarian Ivy wo Hokaku Seyo!\n            \"A6941\", //Toriko: Jump Super Anime Tour 2009 Special\n            \"A17699\", //Toriko Movie: Bishokushin no Special Menu\n            \"A658\", //Touhai Densetsu Akagi: Yami ni Maiorita Tensai\n            \"A6\", //Trigun\n            \"A4106\", //Trigun: Badlands Rumble\n            \"A52093\", //Trigun Stampede\n            \"A54863\", //Trigun Stargaze\n            \"A1000\", //Uchuu Kaizoku Captain Herlock\n            \"A2470\", //Uchuu Kaizoku Captain Herlock: Arcadia-gou no Nazo\n            \"A1458\", //Uchuu no Kishi Tekkaman\n            \"A1459\", //Uchuu no Kishi Tekkaman Blade\n            \"A1460\", //Uchuu no Kishi Tekkaman Blade II\n            \"A2299\", //Uchuu no Kishi Tekkaman Blade OVA: Burning Clock\n            \"A2301\", //Uchuu no Kishi Tekkaman Blade OVA: Missing Link\n            \"A2300\", //Uchuu no Kishi Tekkaman Blade OVA: Twin Blood\n            \"A2516\", //Uchuu no Senshi\n            \"A1650\", //Uchuu Senkan Yamato\n            \"A1651\", //Uchuu Senkan Yamato 2\n            \"A12029\", //Uchuu Senkan Yamato 2199\n            \"A23249\", //Uchuu Senkan Yamato 2199: Hoshimeguru Hakobune\n            \"A23931\", //Uchuu Senkan Yamato 2199: Tsuioku no Koukai\n            \"A33064\", //Uchuu Senkan Yamato 2202: Ai no Senshi-tachi\n            \"A40389\", //Uchuu Senkan Yamato 2205: Aratanaru Tabidachi\n            \"A3071\", //Uchuu Senkan Yamato: Aratanaru Tabidachi\n            \"A7144\", //Uchuu Senkan Yamato: Fukkatsu-hen\n            \"A53625\", //Uchuu Senkan Yamato II: Yamato yo Eien Nare\n            \"A1652\", //Uchuu Senkan Yamato III\n            \"A53604\", //Uchuu Senkan Yamato III: Taiyoukei no Hakai\n            \"A3072\", //Uchuu Senkan Yamato: Kanketsu-hen\n            \"A711\", //Uchuu Senkan Yamato (Movie)\n            \"A37082\", //Uchuu Senkan Yamato Pilot Film\n            \"A40554\", //\"Uchuu Senkan Yamato\" to Iu Jidai: Seireki 2202-nen no Sentaku\n            \"A1985\", //UFO Robo Grendizer\n            \"A4387\", //UFO Robo Grendizer tai Great Mazinger\n            \"A36858\", //Usuzumizakura: Garo\n            \"A732\", //Vampire Hunter D\n            \"A543\", //Vampire Hunter D: Bloodlust\n            \"A1765\", //Vampire Sensou\n            \"A48617\", //Vegeta Super Yasaijin ni Narou-hen\n            \"A37521\", //Vinland Saga\n            \"A49387\", //Vinland Saga Season 2\n            \"A54463\", //Vinland Saga Season 2: Drowning in the Shadow\n            \"A55272\", //Vinland Saga Season 2: Same Old Story\n            \"A1341\", //Violence Jack: Harlem Bomber-hen\n            \"A1343\", //Violence Jack: Hell's Wind-hen\n            \"A1342\", //Violence Jack: Jigoku Gai-hen\n            \"A961\", //Virtua Fighter\n            \"A36937\", //Virtua Fighter: Costomize Clip\n            \"A1560\", //Voltage Fighter Gowcaizer\n            \"A2202\", //Waga Seishun no Arcadia\n            \"A2203\", //Waga Seishun no Arcadia: Mugen Kidou SSX\n            \"A1959\", //Wild 7\n            \"A1745\", //Wild 7 Another Bouryaku Unga\n            \"A6918\", //Wolverine\n            \"A32534\", //Xiyouji zhi Dasheng Guilai\n            \"A6718\", //Yamato 2520\n            \"A3069\", //Yamato yo Towa ni\n            \"A50855\", //Yamato yo, Towa ni: Rebel 3199\n            \"A43697\", //Yasuke\n            \"A10113\", //Yokohama Meibutsu: Otoko Katayama-gumi!\n            \"A32615\", //Youjo Senki\n            \"A37055\", //Youjo Senki Movie\n            \"A49236\", //Youjo Senki: Sabaku no Pasta Daisakusen\n            \"A34904\", //Youjo Senki: Senkyou Houkoku\n            \"A1107\", //Youjuu Toshi\n            \"A1484\", //Youma\n            \"A30740\", //Young Black Jack\n            \"A1677\", //Young Herlock wo Oe! Cosmo Warrior Zero Gaiden\n            \"A1766\", //Youseiki Suikoden\n            \"A3325\", //Yuusha Exkaiser\n            \"A890\", //Yuusha-Ou GaoGaiGar\n            \"A1382\", //Yuusha-Ou GaoGaiGar Final\n            \"A4416\", //Yuusha-Ou GaoGaiGar Final Grand Glorious Gathering\n            \"A392\", //Yuu☆Yuu☆Hakusho\n            \"A2125\", //Yuu☆Yuu☆Hakusho: Eizou Hakusho - Ankoku Bujutsukai no Shou\n            \"A2126\", //Yuu☆Yuu☆Hakusho: Eizou Hakusho II\n            \"A42880\", //Yuu☆Yuu☆Hakusho: Eizou Hakusho - Opening Ending Encyclopedia\n            \"A883\", //Yuu☆Yuu☆Hakusho: Meikai Shitou-hen - Honoo no Kizuna\n            \"A882\", //Yuu☆Yuu☆Hakusho (Movie)\n            \"A36951\", //Yuu☆Yuu☆Hakusho: Two Shots/Noru ka Soru ka\n            \"A11837\" //Zetman\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-historical.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 103,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-historical-1\",\n            \"level\": \"Historical: level 1\",\n            \"title\": \"History Class\",\n            \"desc\": \"History doesn't have to be boring. There's a lot to learn.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-historical-2\",\n            \"level\": \"Historical: level 2\",\n            \"title\": \"A Look at Passing Time\",\n            \"desc\": \"Instead of dreaming of the future, you prefer to look back at the past.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-historical-3\",\n            \"level\": \"Historical: level 3\",\n            \"title\": \"Archaeologist\",\n            \"desc\": \"You have learned that sometimes going further just isn't worth it. And yet you try.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-historical-4\",\n            \"level\": \"Historical: level MAX\",\n            \"title\": \"Time Machine\",\n            \"desc\": \"Kids these days are boring. You'd rather watch something heartwarming about siblings catching fireflies.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 13,\n        \"titles\":\n        [\n            \"A12561\", //Benkei tai Ushiwaka\n            \"A2800\", //Candy Candy\n            \"A723\", //Candy Candy (Movie)\n            \"A2802\", //Candy Candy: Candy no Natsuyasumi\n            \"A2801\", //Candy Candy: Haru no Yobigoe\n            \"A2830\", //Chibikko Remi to Meiken Kapi\n            \"A724\", //Enzai\n            \"A2553\", //Flanders no Inu\n            \"A2623\", //Flanders no Inu (Movie)\n            \"A24679\", //Flanders no Inu Specials\n            \"A3381\", //Fushigi no Umi no Nadia Specials\n            \"A7775\", //Futatsu no Kurumi\n            \"A26283\", //Gin no Rousokutate\n            \"A336\", //Ginyuu Mokushiroku Meine Liebe\n            \"A1663\", //Haha wo Tazunete Sanzenri\n            \"A23585\", //Haha wo Tazunete Sanzenri Specials\n            \"A2405\", //Hello! Lady Lynn\n            \"A4800\", //Huckleberry Finn Monogatarii\n            \"A2831\", //Ie Naki Ko (Movie)\n            \"A2829\", //Ie Naki Ko Remi\n            \"A10471\", //Ie Naki Ko Remi Specials\n            \"A25087\", //Ie Naki Ko Remi Specials (2001)\n            \"A249\", //InuYasha\n            \"A6811\", //InuYasha: Kanketsu-hen\n            \"A4886\", //InuYasha: Kuroi Tessaiga\n            \"A5900\", //Jean Valjean Monogatari\n            \"A618\", //Juubee Ninpuuchou: Ryuuhougyoku-hen\n            \"A5305\", //Koihime†Musou OVA\n            \"A6707\", //Kuroshitsuji II\n            \"A9136\", //Kuroshitsuji II Specials\n            \"A8068\", //Kuroshitsuji Picture Drama\n            \"A6163\", //Kuroshitsuji Recap\n            \"A6793\", //Kuroshitsuji Special\n            \"A9773\", //Lady Lady!! (1988)\n            \"A4926\", //Marco: Haha wo Tazunete Sanzenri\n            \"A912\", //Ninku\n            \"A16345\", //Ninku: Knife no Bohyou\n            \"A8487\", //Onigamiden\n            \"A6884\", //Ookami to Koushinryou II Specials\n            \"A9716\", //Rurouni Kenshin: Review Special\n            \"A4664\", //Rurouni Kenshin: Special Techniques\n            \"A839\", //Samurai Spirits 2: Asura Zanmaden\n            \"A7774\", //Shin Koihime†Musou OVA\n            \"A8635\", //Shin Koihime†Musou: Live Revolution\n            \"A10297\", //Shin Koihime†Musou: Otome Tairan OVA\n            \"A173\", //Tactics\n            \"A8961\", //Tono to Issho: Ippunkan Gekijou\n            \"A5917\", //Tsuru ni Notte: Tomoko no Bouken\n            \"A4132\" //Wakakusa no Yon Shimai\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-horror-thriller.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 104,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"anime-horror-thriller-1\",\n            \"level\": \"Horror: level 1\",\n            \"title\": \"Paranoia Fuel\",\n            \"desc\": \"It's not like you needed to sleep tonight, anyway.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-horror-thriller-2\",\n            \"level\": \"Horror: level 2\",\n            \"title\": \"Too Many Teeth\",\n            \"desc\": \"You know something is following you. You just don't know what.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-horror-thriller-3\",\n            \"level\": \"Horror: level 3\",\n            \"title\": \"Extreme Phobia\",\n            \"desc\": \"You are terrified; you are transfixed.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"anime-horror-thriller-4\",\n            \"level\": \"Trauma: level MAX\",\n            \"title\": \"Flowers of Flesh and Blood\",\n            \"desc\": \"It's far too late, now.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 14\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-light-novel.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 301,\n    \"achievements\": [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-light-novel-1\",\n            \"level\": \"Light Novel: level 1\",\n            \"title\": \"First Chapter\",\n            \"desc\": \"Some stories need more progress. Yours is one of those.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-light-novel-2\",\n            \"level\": \"Light Novel: level 2\",\n            \"title\": \"Searcher\",\n            \"desc\": \"Everyone has a role. Which is yours?\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-light-novel-3\",\n            \"level\": \"Light Novel: level 3\",\n            \"title\": \"The Realization\",\n            \"desc\": \"What matters is in the heart. You feel like you can start to see everyone's intentions just by looking at them.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-light-novel-4\",\n            \"level\": \"Light Novel: level MAX\",\n            \"title\": \"New Self\",\n            \"desc\": \"You have acquired the storytelling and character development required to move your world forward.\"\n        }\n    ],\n    \"requirement\": {\n        \"type\": \"source-title\",\n        \"source\": 7\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-mahou-shoujo.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 105,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"6-11\",\n            \"id\": \"anime-mahou-shoujo-1\",\n            \"level\": \"Mahou Shoujo: level 1\",\n            \"title\": \"Signed the Contract\",\n            \"desc\": \"Became a magical girl and started saving the world, step by step.\"\n        },\n        {\n            \"threshold\": \"12-23\",\n            \"id\": \"anime-mahou-shoujo-2\",\n            \"level\": \"Mahou Shoujo: level 2\",\n            \"title\": \"Magic Is My Middle Name\",\n            \"desc\": \"Transformed into a magical girl: level two. In the name of the Moon, I will punish you!\"\n        },\n        {\n            \"threshold\": \"24-47\",\n            \"id\": \"anime-mahou-shoujo-3\",\n            \"level\": \"Mahou Shoujo: level 3\",\n            \"title\": \"Too Magical to Comprehend\",\n            \"desc\": \"Watched so many mahou shoujo anime that you sparkle occasionally.\"\n        },\n        {\n            \"threshold\": \"48+\",\n            \"id\": \"anime-mahou-shoujo-4\",\n            \"level\": \"Mahou Shoujo: MAX POWER\",\n            \"title\": \"Are You a Wizard\",\n            \"desc\": \"All limiters removed. You can call yourself a god, a wizard, or whatever you wish. You set the rules.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 66\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-mecha.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 106,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-mecha-1\",\n            \"level\": \"Mecha: level 1\",\n            \"title\": \"Me? PILOT This Thing?!\",\n            \"desc\": \"A secret organization wants you to pilot a huge mecha. Can you do it?\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-mecha-2\",\n            \"level\": \"Mecha: level 2\",\n            \"title\": \"Engineer\",\n            \"desc\": \"After watching over 40 mecha anime you should be able to build your own mobile suit. Remember not to kill the rest of us.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-mecha-3\",\n            \"level\": \"Mecha: level 3\",\n            \"title\": \"Mechazawa\",\n            \"desc\": \"Having watched over 80 mecha anime, you've probably become a robot already. Nice job, hero.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-mecha-4\",\n            \"level\": \"Mecha: level MAX\",\n            \"title\": \"Pierce the HEAVENS!\",\n            \"desc\": \"Do the impossible. See the invisible. ROW ROW FIGHT THE POWAH! You just sang that in your head, didn't you?\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 18\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-music.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 107,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-music-1\",\n            \"level\": \"Music: level 1\",\n            \"title\": \"Gettin' Your Keys On!\",\n            \"desc\": \"You don't know what you've just listened to, but you like it.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-music-2\",\n            \"level\": \"Music: level 2\",\n            \"title\": \"This Is Even Better Live\",\n            \"desc\": \"Proudly display the badges you have earned in the fancafe.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-music-3\",\n            \"level\": \"Music: level 3\",\n            \"title\": \"Dreaming of the City\",\n            \"desc\": \"Your musical knowledge has expanded so much you are tempted to make a career out of it.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-music-4\",\n            \"level\": \"Music: level SUPERSTAR\",\n            \"title\": \"Hall of Fame\",\n            \"desc\": \"The stage is now your second home.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 19\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-mystery.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 108,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"14-27\",\n            \"id\": \"anime-mystery-1\",\n            \"level\": \"Mystery: level 1\",\n            \"title\": \"Growing Suspicions\",\n            \"desc\": \"It's suspicious because nothing looks suspicious, and if it looks suspicious from the start it's obviously suspicious.\"\n        },\n        {\n            \"threshold\": \"28-55\",\n            \"id\": \"anime-mystery-2\",\n            \"level\": \"Mystery: level 2\",\n            \"title\": \"Detective's Assistant\",\n            \"desc\": \"Now it's your business to know what other people don't know too.\"\n        },\n        {\n            \"threshold\": \"56-111\",\n            \"id\": \"anime-mystery-3\",\n            \"level\": \"Mystery: level 3\",\n            \"title\": \"Genius Detective\",\n            \"desc\": \"You're already a genius at unraveling mysteries... but how is it possible that everywhere you go someone ends up dead?\"\n        },\n        {\n            \"threshold\": \"112+\",\n            \"id\": \"anime-mystery-4\",\n            \"level\": \"Mystery: level MAX\",\n            \"title\": \"Golden Truth\",\n            \"desc\": \"You can solve any mystery by now. The path to the Golden Land has already been revealed to you.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 7\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-original.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 301,\n    \"achievements\": [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-original-1\",\n            \"level\": \"Original: level 1\",\n            \"title\": \"Uncharted Waters\",\n            \"desc\": \"You have just stumbled across a wonderful, strange new world.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-original-2\",\n            \"level\": \"Original: level 2\",\n            \"title\": \"Into the Jungle\",\n            \"desc\": \"The deeper you go, the less you want out.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-original-3\",\n            \"level\": \"Original: level 3\",\n            \"title\": \"Center of the Earth\",\n            \"desc\": \"You have forgotten about the outside world; nature has assimilated you. An apple falls - not only have you flowered, you have produced fruit.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-original-4\",\n            \"level\": \"Original: level MAX\",\n            \"title\": \"Transcendence\",\n            \"desc\": \"You have been returned to the primordial ocean. From the highest point in the sky, you can peer into every universe, and lose yourself in an infinity of stories.\"\n        }\n    ],\n    \"requirement\": {\n        \"type\": \"source-title\",\n        \"source\": 1\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-pervert-0.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 307,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"0-24.99\",\n            \"id\": \"anime-pervert-0\",\n            \"level\": \"Saint\",\n            \"title\": \"Innocent One\",\n            \"desc\": \"Puritan, oblivious, or serial killer in the making? Either way, you made it through No Man's Land without glimpsing a single bra. Good job!\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-pervert-1.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 307,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"25-49.99\",\n            \"id\": \"anime-pervert-1\",\n            \"level\": \"\\\"Plot\\\"\",\n            \"title\": \"I Watch Anime Only for the Plot...\",\n            \"desc\": \"It's not your fault that there is so much fan service... Right?\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-pervert-2.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 307,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"50-74.99\",\n            \"id\": \"anime-pervert-2\",\n            \"level\": \"Naughty\",\n            \"title\": \"Only Accidents! I Swear!\",\n            \"desc\": \"Physics in anime are incredible. When you trip, you always cop a feel.\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-pervert-3.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 307,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"75-100\",\n            \"id\": \"anime-pervert-3\",\n            \"level\": \"Pervert\",\n            \"title\": \"Hentai Overlord\",\n            \"desc\": \"No use denying it! You know what you are...\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-re.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 310,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20+\",\n            \"id\": \"anime-re\",\n            \"level\": \"Looping...\",\n            \"title\": \"Endless Eight\",\n            \"desc\": \"Is the replay button stuck?\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"re\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-release-classic.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 305,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-release-classic-1\",\n            \"level\": \"Classics: level 1\",\n            \"title\": \"Cassette Tape\",\n            \"desc\": \"The first time you watched these, you didn't even know what they were.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-release-classic-2\",\n            \"level\": \"Classics: level 2\",\n            \"title\": \"Solid Color\",\n            \"desc\": \"Bomber jackets, high-waisted jeans, an overload of patterns, and bishies everywhere.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-release-classic-3\",\n            \"level\": \"Classics: level 3\",\n            \"title\": \"It's Raining... Tragic Backstories!\",\n            \"desc\": \"It might be the nostalgia lens, but you swear things had more substance back then.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-release-classic-4\",\n            \"level\": \"Nostalgia: level MAX\",\n            \"title\": \"Blockbuster\",\n            \"desc\": \"Man, do you feel old as all hell.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"release-classic\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-release-old.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 304,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20+\",\n            \"id\": \"anime-release-old\",\n            \"level\": \"Pre-1980 Anime\",\n            \"title\": \"VHS Master Race\",\n            \"desc\": \"You overwrote my cartoons with The Karate Kid?! MOOOM!\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"release-old\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-romance.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 109,\n    \"achievements\": [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-romance-1\",\n            \"level\": \"Romance: level 1\",\n            \"title\": \"Stalker\",\n            \"desc\": \"I'll stalk you so hard you won't notice me for 24 episodes. Why don't you love me yet?\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-romance-2\",\n            \"level\": \"Romance: level 2\",\n            \"title\": \"Unrequited Love\",\n            \"desc\": \"If you won't confess, they'll never know how you feel. But don't bother if you're the best girl - these never win.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-romance-3\",\n            \"level\": \"Romance: level 3\",\n            \"title\": \"Sparkles and Bubbles\",\n            \"desc\": \"Every time you two get close you feel butterflies in your stomach. Now kiss.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-romance-4\",\n            \"level\": \"Romance: FULL LOVE\",\n            \"title\": \"Heart Full of Love\",\n            \"desc\": \"So many romance anime! You surely are an expert in relationships already.\"\n        }\n    ],\n    \"requirement\": {\n        \"type\": \"genre-title\",\n        \"genre\": [\n            22,\n            26,\n            28,\n            74\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-school-days.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 203,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"1+\",\n            \"id\": \"anime-school-days\",\n            \"level\": \"Nice Boat\",\n            \"title\": \"It's Just Me and You Now\",\n            \"desc\": \"Awarded for completing School Days. And they say true romance is dead!\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"title\",\n        \"titles\":\n        [\n            \"A2476\" //School Days\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-score-high.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 308,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"8.5-10\",\n            \"id\": \"anime-score-high\",\n            \"level\": \"10/10! EVERYTHING!\",\n            \"title\": \"I Love Chinese Cartoons\",\n            \"desc\": \"Mean anime score higher than 8.5. How about using the whole scale and re-rating stuff? That could make you look less like a fanboy...\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-score-low.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 308,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"3-5\",\n            \"id\": \"anime-score-low\",\n            \"level\": \"My Eyes! It Hurts!\",\n            \"title\": \"Watching Anime Is Suffering\",\n            \"desc\": \"Mean anime score lower than 5. Someone has to counterweigh the fanboys, right?\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-score-very-low.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 308,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"0-2.99\",\n            \"id\": \"anime-score-very-low\",\n            \"level\": \"0/10. Play Next One\",\n            \"title\": \"Less Than Three\",\n            \"desc\": \"Mean anime score lower than 3. Is it hate, or is it love?\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-slice-of-life.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 110,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-slice-of-life-1\",\n            \"level\": \"Slice of Life: level 1\",\n            \"title\": \"Normal High School Boy\",\n            \"desc\": \"Got started into the furious ride with slice-of-life anime.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-slice-of-life-2\",\n            \"level\": \"Slice of Life: level 2\",\n            \"title\": \"Cute × ( Girls + Things )\",\n            \"desc\": \"Didn't get bored of watching cute girls doing cute things. As if that's possible.\"\n        },\n        {\n            \"threshold\": \"80-159\",\n            \"id\": \"anime-slice-of-life-3\",\n            \"level\": \"Slice of Life: level 3\",\n            \"title\": \"Enjoying Life\",\n            \"desc\": \"Found the equilibrium between boring and interesting.\"\n        },\n        {\n            \"threshold\": \"160+\",\n            \"id\": \"anime-slice-of-life-4\",\n            \"level\": \"Slice of Life: level MAX\",\n            \"title\": \"Prima Undine\",\n            \"desc\": \"Awarded Ph.D. degree in slice-of-life-ology. You can teach others how to stay calm and take it easy.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 36\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-space.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 111,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"anime-space-1\",\n            \"level\": \"Space: level 1\",\n            \"title\": \"3... 2... 1... Liftoff!\",\n            \"desc\": \"You've taken one small step for man, not such a giant leap for mankind.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"anime-space-2\",\n            \"level\": \"Space: level 2\",\n            \"title\": \"The Earth Looks So Small from Up Here\",\n            \"desc\": \"You're finally outside the atmosphere, but there's still a lot to explore.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"anime-space-3\",\n            \"level\": \"Space: level 3\",\n            \"title\": \"Interstellar Traveler\",\n            \"desc\": \"You've traveled vast interstellar distances and seen many galaxies in your way.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"anime-space-4\",\n            \"level\": \"Space: level MAX\",\n            \"title\": \"Emperor of the Universe\",\n            \"desc\": \"You're the ruler of the whole Universe. There's no one with more power than you.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 29\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-sports.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 112,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"14-27\",\n            \"id\": \"anime-sports-1\",\n            \"level\": \"Sports: level 1\",\n            \"title\": \"Knockout!\",\n            \"desc\": \"You've held your own in the ring, time to go all the way.\"\n        },\n        {\n            \"threshold\": \"28-55\",\n            \"id\": \"anime-sports-2\",\n            \"level\": \"Sports: level 2\",\n            \"title\": \"Get Your Head in the Game\",\n            \"desc\": \"The odds are against you, time to get in the zone.\"\n        },\n        {\n            \"threshold\": \"56-111\",\n            \"id\": \"anime-sports-3\",\n            \"level\": \"Sports: level 3\",\n            \"title\": \"Welcome to the Big Leagues\",\n            \"desc\": \"There's no stopping you, just one final push.\"\n        },\n        {\n            \"threshold\": \"112+\",\n            \"id\": \"anime-sports-4\",\n            \"level\": \"Sports: level MAX\",\n            \"title\": \"Olympian\",\n            \"desc\": \"First across the finish line, great job!\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 30\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-studio-ghibli.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 201,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10+\",\n            \"id\": \"anime-studio-ghibli\",\n            \"level\": \"Studio Ghibli\",\n            \"title\": \"Memories\",\n            \"desc\": \"Once you've seen them, you can never forget them.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"title\",\n        \"titles\":\n        [\n            \"A2890\", //Gake no Ue no Ponyo\n            \"A1829\", //Gedo Senki\n            \"A1030\", //Heisei Tanuki Gassen Ponpoko\n            \"A578\", //Hotaru no Haka\n            \"A431\", //Howl no Ugoku Shiro\n            \"A16664\", //Kaguya-hime no Monogatari\n            \"A7711\", //Karigurashi no Arrietty\n            \"A16662\", //Kaze Tachinu\n            \"A36699\", //Kimitachi wa Dou Ikiru ka\n            \"A10029\", //Kokurikozaka kara\n            \"A416\", //Kurenai no Buta\n            \"A512\", //Majo no Takkyuubin\n            \"A585\", //Mimi wo Sumaseba\n            \"A164\", //Mononoke Hime\n            \"A597\", //Neko no Ongaeshi\n            \"A199\", //Sen to Chihiro no Kamikakushi\n            \"A513\", //Tenkuu no Shiro Laputa\n            \"A523\", //Tonari no Totoro\n            \"A415\", //Tonari no Yamada-kun\n            \"A21557\", //Omoide no Marnie\n            \"A1029\", //Omoide Poroporo\n            \"A743\" //Umi ga Kikoeru\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-time.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 311,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"14-91.24\",\n            \"id\": \"anime-time-1\",\n            \"level\": \"Time: level 1\",\n            \"title\": \"Hair Antenna\",\n            \"desc\": \"Whose watchtime are you calling puny‽\"\n        },\n        {\n            \"threshold\": \"91.25-182.49\",\n            \"id\": \"anime-time-2\",\n            \"level\": \"Time: level 2\",\n            \"title\": \"Endurance Training\",\n            \"desc\": \"By doing a daily ten-episode run, you are sure to become a master in no time!\"\n        },\n        {\n            \"threshold\": \"182.50-364.99\",\n            \"id\": \"anime-time-3\",\n            \"level\": \"Time: level 3\",\n            \"title\": \"Consciousness Upload\",\n            \"desc\": \"Consuming the medium becomes a lot easier once you yourself are raw data.\"\n        },\n        {\n            \"threshold\": \"365+\",\n            \"id\": \"anime-time-4\",\n            \"level\": \"Youth: WASTED\",\n            \"title\": \"Wicked Cultured\",\n            \"desc\": \"By making a deal with the devil, you have ensured access to even the most obscure of materials.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"time\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/anime-year.json",
    "content": "{\n    \"media\": \"A\",\n    \"order\": 306,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"40+\",\n            \"id\": \"anime-year\",\n            \"level\": \"Tempus Fugit\",\n            \"title\": \"Chronomaster\",\n            \"desc\": \"Your discerning eye has traveled across the aeons of animation.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"year\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-dropped-0.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 307,\n    \"achievements\":\n    [\n        {\n        \"threshold\": \"10+\",\n        \"id\": \"manga-dropped-0\",\n        \"level\": \"And It Still Hurts\",\n        \"title\": \"I've Seen Some Sh**\",\n        \"desc\": \"Despite seemingly endless suffering, you've never dropped any manga. That's impressive.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"dropped-0\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-finished.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 310,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"100-199\",\n            \"id\": \"manga-finished-100\",\n            \"level\": \"Passed 100 Mark\",\n            \"title\": \"Casual Reader\",\n            \"desc\": \"Read 100 manga. Looks like reading doesn't hurt.\"\n        },\n        {\n            \"threshold\": \"200-299\",\n            \"id\": \"manga-finished-200\",\n            \"level\": \"Passed 200 Mark\",\n            \"title\": \"Bookworm\",\n            \"desc\": \"Read 200 manga. Sitting in your comfortable chair, reading favorite Korean comics. This is bliss.\"\n        },\n        {\n            \"threshold\": \"300-399\",\n            \"id\": \"manga-finished-300\",\n            \"level\": \"Passed 300 Mark\",\n            \"title\": \"Dat Scent\",\n            \"desc\": \"Read 300 manga. There's nothing better than the smell of freshly opened book. Or a PDF.\"\n        },\n        {\n            \"threshold\": \"400-499\",\n            \"id\": \"manga-finished-400\",\n            \"level\": \"Passed 400 Mark\",\n            \"title\": \"Where Do I Put These?\",\n            \"desc\": \"Read 400 manga. Consider investing in another bookshelf, or you'll be swimming in books soon.\"\n        },\n        {\n            \"threshold\": \"500-749\",\n            \"id\": \"manga-finished-500\",\n            \"level\": \"Passed 500 Mark\",\n            \"title\": \"Half a Grand\",\n            \"desc\": \"Read 500 manga. Now think of what kind of person you'd be if you didn't start reading manga then. On that particular day...\"\n        },\n        {\n            \"threshold\": \"750-999\",\n            \"id\": \"manga-finished-750\",\n            \"level\": \"Passed 750 Mark\",\n            \"title\": \"Read or Die\",\n            \"desc\": \"Read 750 manga. You managed to make a bow out of paper, but remember that cellulose fibers don't work well as a bulletproof shield.\"\n        },\n        {\n            \"threshold\": \"1000-1499\",\n            \"id\": \"manga-finished-1000\",\n            \"level\": \"Passed 1000 Mark\",\n            \"title\": \"Librarian\",\n            \"desc\": \"Read 1000 manga. You work with books, right? Right?\"\n        },\n        {\n            \"threshold\": \"1500-2499\",\n            \"id\": \"manga-finished-1500\",\n            \"level\": \"Passed 1500 Mark\",\n            \"title\": \"The Floor Is Books\",\n            \"desc\": \"Read 1500 manga. Sleeping on books must be pretty... hard?\"\n        },\n        {\n            \"threshold\": \"2500-4999\",\n            \"id\": \"manga-finished-2500\",\n            \"level\": \"Passed 2500 Mark\",\n            \"title\": \"Still Not Enough\",\n            \"desc\": \"Read 2500 manga. In search for the perfect story you've read six lifetimes worth of words. Did you find it?\"\n        },\n        {\n            \"threshold\": \"5000-7499\",\n            \"id\": \"manga-finished-5000\",\n            \"level\": \"Passed 5000 Mark\",\n            \"title\": \"Sleep Deprivation\",\n            \"desc\": \"Read 5000 manga. Think of all the mangakas and writers that couldn't sleep just to make this moment happen.\"\n        },\n        {\n            \"threshold\": \"7500-9999\",\n            \"id\": \"manga-finished-7500\",\n            \"level\": \"Passed 7500 Mark\",\n            \"title\": \"Reincarnation\",\n            \"desc\": \"Read 7500 manga. How, exactly? This is not possible for normal humans.\"\n        },\n        {\n            \"threshold\": \"10000+\",\n            \"id\": \"manga-finished-10000\",\n            \"level\": \"Passed 10000 Mark\",\n            \"title\": \"I've Seen It All\",\n            \"desc\": \"Read 10000 manga. Ten. Thousand. Manga. An average user's list is shorter than your list of titles starting with \\\"A\\\" alone.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"finished\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-horror.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 101,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-horror-1\",\n            \"level\": \"Horror: level 1\",\n            \"title\": \"HONEY, I'M HOME\",\n            \"desc\": \"WHAT IS FOR DINNER TODAY?\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-horror-2\",\n            \"level\": \"Horror: level 2\",\n            \"title\": \"Lovely Smile of a Psychopath\",\n            \"desc\": \"You can't spell slaughter without laughter.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-horror-3\",\n            \"level\": \"Horror: level 3\",\n            \"title\": \"What Have I Become?\",\n            \"desc\": \"Sweetheart, something's wrong with your make up...\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-horror-4\",\n            \"level\": \"Horror: level MAX\",\n            \"title\": \"Heart Attack\",\n            \"desc\": \"Not all surprises are pleasant, but it looks like you love being scared.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 14\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-mahou-shoujo.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 102,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"2-3\",\n            \"id\": \"manga-mahou-shoujo-1\",\n            \"level\": \"Mahou Shoujo: level 1\",\n            \"title\": \"Let Me Lift That Curse\",\n            \"desc\": \"If you wish hard enough, you can become a magical girl in the blink of an eye.\"\n        },\n        {\n            \"threshold\": \"4-7\",\n            \"id\": \"manga-mahou-shoujo-2\",\n            \"level\": \"Mahou Shoujo: level 2\",\n            \"title\": \"Conflict Breaker\",\n            \"desc\": \"Fighting hardly solves any problems. There are better ways to live our lives.\"\n        },\n        {\n            \"threshold\": \"8-15\",\n            \"id\": \"manga-mahou-shoujo-3\",\n            \"level\": \"Mahou Shoujo: level 3\",\n            \"title\": \"Aim for the Top\",\n            \"desc\": \"Even if you work alone, never forget your friends who helped you overcome all fears.\"\n        },\n        {\n            \"threshold\": \"16+\",\n            \"id\": \"manga-mahou-shoujo-4\",\n            \"level\": \"Mahou Shoujo: MAX POWER\",\n            \"title\": \"Complete Control\",\n            \"desc\": \"Read over 32 mahou shoujo manga. At this level magic circles form around you at will.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 66\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-mystery.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 103,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-mystery-1\",\n            \"level\": \"Mystery: level 1\",\n            \"title\": \"Curiosity\",\n            \"desc\": \"If it is you who is curious, no case shall remain unsolved.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-mystery-2\",\n            \"level\": \"Mystery: level 2\",\n            \"title\": \"Determination\",\n            \"desc\": \"No matter who the villain is... you WILL find out the answers.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-mystery-3\",\n            \"level\": \"Mystery: level 3\",\n            \"title\": \"Collecting the Pieces\",\n            \"desc\": \"Sometimes the smallest bit of information can turn the whole case around.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-mystery-4\",\n            \"level\": \"Mystery: level MAX\",\n            \"title\": \"Raw Intuition\",\n            \"desc\": \"Investigative skills honed up. You know the answers just by looking at mere shards of data.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 7\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-novel.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 301,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-novel-1\",\n            \"level\": \"Novel: level 1\",\n            \"title\": \"Cracking the Book\",\n            \"desc\": \"You didn't get bored reading plain text.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-novel-2\",\n            \"level\": \"Novel: level 2\",\n            \"title\": \"IKEA Trip\",\n            \"desc\": \"Instead of playing Candy Crush, you now read during transit.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-novel-3\",\n            \"level\": \"Novel: level 3\",\n            \"title\": \"Personal Library\",\n            \"desc\": \"The tales you've read have taken you on a journey you never want to end.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-novel-4\",\n            \"level\": \"Bookworm: level MAX\",\n            \"title\": \"What Is Sleep?\",\n            \"desc\": \"The more you've learned, the more you wanted to keep on learning.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"novel\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-pervert-0.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 305,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"0-24.99\",\n            \"id\": \"manga-pervert-0\",\n            \"level\": \"Virgin\",\n            \"title\": \"Chastity Belt\",\n            \"desc\": \"Mama said that if you touch your no-no square, the Yogi Bear will come and get you. Congratulations on resisting the siren call of h-doujin!\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-pervert-1.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 305,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"25-49.99\",\n            \"id\": \"manga-pervert-1\",\n            \"level\": \"Eek!\",\n            \"title\": \"I Peek Just a Little\",\n            \"desc\": \"Wait a minute, this wasn't the men's bath?\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-pervert-2.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 305,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"50-74.99\",\n            \"id\": \"manga-pervert-2\",\n            \"level\": \"Naughty\",\n            \"title\": \"We Need a Blood Donor Here\",\n            \"desc\": \"Even if I die from blood loss, I just can't stop...\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-pervert-3.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 305,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"75-100\",\n            \"id\": \"manga-pervert-3\",\n            \"level\": \"Pervert\",\n            \"title\": \"Ero-sennin\",\n            \"desc\": \"What do you mean that I am a pervert? I am THE pervert!\",\n            \"tooltip\": \"{subject}% pervert\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"pervert\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-re.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 308,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10+\",\n            \"id\": \"manga-re\",\n            \"level\": \"In Time\",\n            \"title\": \"Take Me Back\",\n            \"desc\": \"Ah, it's every bit as good as the first time.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"re\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-release-old.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 303,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10+\",\n            \"id\": \"manga-release-old\",\n            \"level\": \"Pre-1980 Manga\",\n            \"title\": \"At the End of the Galaxy\",\n            \"desc\": \"Your never-ending journey for the most forgotten comic books has finally paid off.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"release-old\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-romance.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 104,\n    \"achievements\": [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-romance-1\",\n            \"level\": \"Romance: level 1\",\n            \"title\": \"Mixed Feelings\",\n            \"desc\": \"98% hatred, 2% love. Give it some time and these two will reverse.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-romance-2\",\n            \"level\": \"Romance: level 2\",\n            \"title\": \"Love Me or Die\",\n            \"desc\": \"Yandere is a form of love too. A rather extreme one, but still!\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-romance-3\",\n            \"level\": \"Romance: level 3\",\n            \"title\": \"Breaking the Chains\",\n            \"desc\": \"With love, nothing is impossible. You just have to let someone break you free of restrictions.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-romance-4\",\n            \"level\": \"Romance: FULL LOVE\",\n            \"title\": \"Heart That Never Stops Beating\",\n            \"desc\": \"When I see you, my kokoro goes doki-doki and the sekai starts to spin around. How could I live without you?\"\n        }\n    ],\n    \"requirement\": {\n        \"type\": \"genre-title\",\n        \"genre\": [\n            22,\n            26,\n            28,\n            75\n        ]\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-score-high.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 306,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"8.5-10\",\n            \"id\": \"manga-score-high\",\n            \"level\": \"Dat Plot\",\n            \"title\": \"So Good I Can't Handle It\",\n            \"desc\": \"Mean manga score above 8.5. Looks like you only pick the best titles to read.\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-score-low.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 306,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"3-5\",\n            \"id\": \"manga-score-low\",\n            \"level\": \"Not Worth My Time\",\n            \"title\": \"Professional Critic\",\n            \"desc\": \"Mean manga score below 5. Watch out, we got a critic over here.\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-score-very-low.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 306,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"0-2.99\",\n            \"id\": \"manga-score-very-low\",\n            \"level\": \"Lowest of the Low\",\n            \"title\": \"Best I Can Do Is 2\",\n            \"desc\": \"Mean manga score below 3. Aren't you a bit too harsh?\",\n            \"tooltip\": \"Mean score: {subject}\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"score\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-sports.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 105,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-sports-1\",\n            \"level\": \"Sports: level 1\",\n            \"title\": \"The Stakes Are High\",\n            \"desc\": \"Joined the game for real. The more you read, the more addictive it gets.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-sports-2\",\n            \"level\": \"Sports: level 2\",\n            \"title\": \"Do You Even Read?\",\n            \"desc\": \"Even during the most exhausting excercise you still find time to read. Can't miss a chapter.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-sports-3\",\n            \"level\": \"Sports: level 3\",\n            \"title\": \"Got Balls\",\n            \"desc\": \"Looking at all this struggling inspires you to become strong yourself.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-sports-4\",\n            \"level\": \"Sports: level MAX\",\n            \"title\": \"Kuro Basket\",\n            \"desc\": \"You know the rules of all games already. The podium is yours!\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 30\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-time.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 309,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"14-91.24\",\n            \"id\": \"manga-time-1\",\n            \"level\": \"Time: level 1\",\n            \"title\": \"Downward Spiral\",\n            \"desc\": \"Once drawn inside this inky whirlpool, you will find yourself sinking faster than the Titanic.\"\n        },\n        {\n            \"threshold\": \"91.25-182.49\",\n            \"id\": \"manga-time-2\",\n            \"level\": \"Time: level 2\",\n            \"title\": \"Revelations (18:14)\",\n            \"desc\": \"You've developed quite the appetite. Devouring fifty chapters a day doesn't seem challenging to you anymore.\"\n        },\n        {\n            \"threshold\": \"182.50-364.99\",\n            \"id\": \"manga-time-3\",\n            \"level\": \"Time: level 3\",\n            \"title\": \"Voluntary Confinement\",\n            \"desc\": \"Every title you read brings you closer to your self.\"\n        },\n        {\n            \"threshold\": \"365+\",\n            \"id\": \"manga-time-4\",\n            \"level\": \"Blindness: level BAT\",\n            \"title\": \"Apocryphal Sanctuary\",\n            \"desc\": \"You've journeyed through hell and heaven, and learned much in your wanderings.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"time\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-vampire-demons.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 106,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-vampire-demons-1\",\n            \"level\": \"Vampires/Demons: level 1\",\n            \"title\": \"Sweet Tooth\",\n            \"desc\": \"Donuts? Really? You lived for 500 years just to eat them?\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-vampire-demons-2\",\n            \"level\": \"Vampires/Demons: level 2\",\n            \"title\": \"Vegetarian\",\n            \"desc\": \"Some creatures prefer juicy fruits instead of sucking blood or eating raw meat. Weaklings.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-vampire-demons-3\",\n            \"level\": \"Vampires/Demons: level 3\",\n            \"title\": \"Carnivore\",\n            \"desc\": \"Don't mess with me if you want to keep your limbs attached to your body.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-vampire-demons-4\",\n            \"level\": \"Vampires/Demons: level MAX\",\n            \"title\": \"Pure Evil\",\n            \"desc\": \"EVIL!!! FANGS! DEMONS! BLOOD! Yeah. That's the stuff.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": [6, 32]\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-volume-long.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 302,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10+\",\n            \"id\": \"manga-volume-long\",\n            \"level\": \"Infinite Stamina\",\n            \"title\": \"Long Runner\",\n            \"desc\": \"The best stories can't be told in less than 20 volumes.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"volume-long\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-yaoi-shounen-ai.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 107,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-yaoi-shounen-ai-1\",\n            \"level\": \"Boys Love: level 1\",\n            \"title\": \"Inner Fujoshi Awakened\",\n            \"desc\": \"I was just taking a peek in this manga I accidentally found... and surprisingly liked it.\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-yaoi-shounen-ai-2\",\n            \"level\": \"Boys Love: level 2\",\n            \"title\": \"Not a Day Without BL\",\n            \"desc\": \"It's already too late to stop and turn back, just remember to watch your back while reading.\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-yaoi-shounen-ai-3\",\n            \"level\": \"Boys Love: level 3\",\n            \"title\": \"Yaoi Detector\",\n            \"desc\": \"I don't care! I ship it!\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-yaoi-shounen-ai-4\",\n            \"level\": \"Boys Love: level MAX\",\n            \"title\": \"Full Fledged Fujoshi\",\n            \"desc\": \"Yaoi isn't just a genre to you anymore, it's a way of life.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 28\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-year.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 304,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"40+\",\n            \"id\": \"manga-year\",\n            \"level\": \"Elder\",\n            \"title\": \"Ancient Scholar\",\n            \"desc\": \"You witnessed the beginning of the medium. You hope you will not witness its end.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"year\"\n    }\n}\n"
  },
  {
    "path": "data/achievement/manga-yuri-shoujo-ai.json",
    "content": "{\n    \"media\": \"M\",\n    \"order\": 108,\n    \"achievements\":\n    [\n        {\n            \"threshold\": \"10-19\",\n            \"id\": \"manga-yuri-shoujo-ai-1\",\n            \"level\": \"Girls Love: level 1\",\n            \"title\": \"But That's Forbidden Love\",\n            \"desc\": \"Cute girls doing cute things... right?\"\n        },\n        {\n            \"threshold\": \"20-39\",\n            \"id\": \"manga-yuri-shoujo-ai-2\",\n            \"level\": \"Girls Love: level 2\",\n            \"title\": \"I Kissed a Girl...\",\n            \"desc\": \"...and I liked it!\"\n        },\n        {\n            \"threshold\": \"40-79\",\n            \"id\": \"manga-yuri-shoujo-ai-3\",\n            \"level\": \"Girls Love: level 3\",\n            \"title\": \"All Female School\",\n            \"desc\": \"There are only girls here to love... but I don't mind it.\"\n        },\n        {\n            \"threshold\": \"80+\",\n            \"id\": \"manga-yuri-shoujo-ai-4\",\n            \"level\": \"Girls Love: level MAX\",\n            \"title\": \"Lily\",\n            \"desc\": \"You feel it everywhere.\"\n        }\n    ],\n    \"requirement\":\n    {\n        \"type\": \"genre-title\",\n        \"genre\": 26\n    }\n}\n"
  },
  {
    "path": "data/banned-creators.lst",
    "content": ""
  },
  {
    "path": "data/banned-franchise-coupling.json",
    "content": "{\n    \"A512\": //Majo no Takkyuubin\n    [\n        \"A35770\" //Hungry Days: Aoharu ka yo.\n    ],\n    \"A2225\": //Alps no Shoujo Heidi\n    [\n        \"A35770\" //Hungry Days: Aoharu ka yo.\n    ],\n    \"A2406\": //Sazae-san\n    [\n        \"A35770\" //Hungry Days: Aoharu ka yo.\n    ],\n    \"A35770\": //Hungry Days: Aoharu ka yo.\n    [\n        \"A512\", //Majo no Takkyuubin\n        \"A2225\", //Alps no Shoujo Heidi\n        \"A2406\" //Sazae-san\n    ],\n    \"A966\": //Crayon Shin-chan\n    [\n        \"A35686\" //Doraemon (2005) Specials\n    ],\n    \"A1412\": //Lupin III\n    [\n        \"A6115\" //Lupin III vs. Detective Conan\n    ],\n    \"A2354\": //Devilman: Tanjou-hen\n    [\n        \"A3898\" //Mazinger Z tai Devilman\n    ],\n    \"A3898\": //Mazinger Z tai Devilman\n    [\n        \"A2252\" //Devilman\n    ],\n    \"A4385\": //Great Mazinger tai Getter Robo\n    [\n        \"A3579\" //Getter Robo\n    ],\n    \"A4386\": //Great Mazinger tai Getter Robo G: Kuuchuu Dai-Gekitotsu\n    [\n        \"A4486\" //Getter Robo G\n    ],\n    \"A6566\": //It's a Rumic World: 50th Anniversary Weekly★Shonen Sunday\n    [\n        \"A210\", //Ranma ½\n        \"A249\", //InuYasha\n        \"A1293\" //Urusei Yatsura\n    ],\n    \"A15785\": //Inazuma Eleven Go vs. Danball Senki W Movie\n    [\n        \"A10507\", //Inazuma Eleven Go\n        \"A12651\" //Danball Senki W\n    ],\n    \"A17819\": //Kyoto Animation: Suiei-hen\n    [\n        \"A18507\" //Free!\n    ],\n    \"A18393\": //Fairy Tail x Rave\n    [\n        \"A246\", //Groove Adventure Rave\n        \"A6702\" //Fairy Tail\n    ],\n    \"A28149\": //Nihon Animator Mihonichi\n    [\n        \"A38055\" //Evangelion: Another Impact (VR)\n    ],\n    \"A38055\": //Evangelion: Another Impact (VR)\n    [\n        \"A28149\" //Nihon Animator Mihonichi\n    ],\n    \"A33512\": //Animegatari x Ghost in the Shell Collab Eizou\n    [\n        \"A30617\" //Animegatari\n    ],\n    \"A37012\": //Animegatari x Shingeki no Kyojin Collab Eizou\n    [\n        \"A30617\" //Animegatari\n    ],\n    \"A33544\": //InaDan Movie x Mameshiba Collab CM\n    [\n        \"A15785\" //Inazuma Eleven Go vs. Danball Senki W Movie\n    ],\n    \"A33547\": //Mameshiba x Gaist Crusher Collab CM\n    [\n        \"A19871\" //Gaist Crusher\n    ],\n    \"A33549\": //Mame-Mofu Collab Animation\n    [\n        \"A5241\" //Mofu☆Mofu\n    ],\n    \"A35631\": //Mahouka x Mameshiba\n    [\n        \"A7261\" //Mameshiba\n    ],\n    \"A35686\": //Doraemon (2005) Specials\n    [\n        \"A966\" //Crayon Shin-chan\n    ],\n    \"M881\": //Cross Epoch\n    [\n        \"M13\", //One Piece\n        \"M42\" //Dragon Ball\n    ],\n    \"M7887\": //Toriko\n    [\n        \"M25146\" //One Piece x Toriko\n    ],\n    \"M25146\": //One Piece x Toriko\n    [\n        \"M13\", //One Piece\n        \"M7887\" //Toriko\n    ],\n    \"M1474\": //Devilman\n    [\n        \"M26751\" //Devilman vs Getter Robo\n    ],\n    \"M1475\": //Devilman Lady\n    [\n        \"M75723\" //Cutie Honey Tai Devilman Lady\n    ],\n    \"M1551\": //Getter Robo\n    [\n        \"M26751\", //Devilman vs Getter Robo\n        \"M37701\" //Super Robot Retsuden\n    ],\n    \"M1639\": //Cyborg 009\n    [\n        \"M95091\" //Cyborg 009 VS Devilman: Breakdown\n    ],\n    \"M7658\": //Cutie Honey\n    [\n        \"M75723\" //Cutie Honey Tai Devilman Lady\n    ],\n    \"M8773\": //Mazinger Z\n    [\n        \"M37701\" //Super Robot Retsuden\n    ],\n    \"M13891\": //Kakioroshi Manga Bangai-hen: Valentine Special\n    [\n        \"M43\", //Eyeshield 21\n        \"M47\", //Katekyou Hitman Reborn!\n        \"M671\", //To LOVE-Ru\n        \"M1414\", //SKET Dance\n        \"M9711\" //Bakuman.\n    ],\n    \"M26751\": //Devilman vs Getter Robo\n    [\n        \"M1474\", //Devilman\n        \"M1551\" //Getter Robo\n    ],\n    \"M30723\": //Koutetsu Jeeg\n    [\n        \"M37701\" //Super Robot Retsuden\n    ],\n    \"M37701\": //Super Robot Retsuden\n    [\n        \"M1551\", //Getter Robo\n        \"M8773\", //Mazinger Z\n        \"M30723\" //Koutetsu Jeeg\n    ],\n    \"M75723\": //Cutie Honey Tai Devilman Lady\n    [\n        \"M1475\", //Devilman Lady\n        \"M7658\" //Cutie Honey\n    ],\n    \"M95091\": //Cyborg 009 VS Devilman: Breakdown\n    [\n        \"M1474\", //Devilman\n        \"M1639\" //Cyborg 009\n    ],\n    \"M16124\": //Maburaho VS Slayers!? - Dragon All Stars Gekitouhen\n    [\n        \"M120\", //Maburaho\n        \"M8876\" //Slayers\n    ],\n    \"M20870\": //Slayers VS Orphen\n    [\n        \"M8876\", //Slayers\n        \"M39745\" //Majutsushi Orphen Hagure Tabi\n    ],\n    \"M47000\": //Nisekyuu!!\n    [\n        \"M31499\", //Nisekoi\n        \"M35243\" //Haikyuu!!\n    ],\n    \"M52389\": //Ore Ride!!\n    [\n        \"M24294\", //Ao Haru Ride\n        \"M36933\" //Ore Monogatari!!\n    ],\n    \"M58193\": //Ore Koi!!\n    [\n        \"M31499\", //Nisekoi\n        \"M36933\" //Ore Monogatari!!\n    ],\n    \"M75053\": //Magazine Heroines on the Beach\n    [\n        \"M8300\", //Baby Steps\n        \"M35003\", //Yamada-kun to 7-nin no Majo\n        \"M47102\", //Aho Girl\n        \"M67019\" //Fuuka\n    ],\n    \"M86414\": //Magazine Boys' Valentine!\n    [\n        \"M8795\", //Area no Kishi\n        \"M47363\", //Kamisama no Iutoori 2\n        \"M65685\", //Real Account\n        \"M67019\" //Fuuka\n    ],\n    \"M88032\": //Magazine Ohanami!!\n    [\n        \"M598\", //Fairy Tail\n        \"M8300\", //Baby Steps\n        \"M35003\", //Yamada-kun to 7-nin no Majo\n        \"M67019\" //Fuuka\n    ],\n    \"M102286\": //Minna no Kochikame\n    [\n        \"M733\", //Kochira Katsushikaku Kameari Kouenmae Hashutsujo\n        \"M1414\", //SKET Dance\n        \"M5664\", //Nurarihyon no Mago\n        \"M10010\", //Beelzebub\n        \"M31499\", //Nisekoi\n        \"M39883\", //Ansatsu Kyoushitsu\n        \"M67545\" //Isobe Isobee Monogatari: Ukiyo wa Tsurai yo\n    ]\n}\n"
  },
  {
    "path": "data/banned-genres.lst",
    "content": ""
  },
  {
    "path": "data/banned-users.lst",
    "content": ""
  },
  {
    "path": "data/cache/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "data/db/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "data/globals-cache.json",
    "content": ""
  },
  {
    "path": "data/logs/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "data/mirror/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "data/queue-media.lst",
    "content": ""
  },
  {
    "path": "data/queue-sizes.json",
    "content": ""
  },
  {
    "path": "data/queue-users-media.lst",
    "content": ""
  },
  {
    "path": "data/queue-users.lst",
    "content": ""
  },
  {
    "path": "data/recs-banned-genres.lst",
    "content": ""
  },
  {
    "path": "data/static-recommendations.lst",
    "content": ""
  },
  {
    "path": "public_html/index.php",
    "content": "<?php\nchdir('..');\nrequire_once('src/core.php');\n\n$dir = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'src', 'Controllers']);\n$classNames = ReflectionHelper::loadClasses($dir);\n$classNames = array_filter($classNames, function($className) {\n\treturn substr_compare($className, 'Controller', -10, 10) === 0;\n});\n\n$controllerContext = new ControllerContext();\n$controllerContext->cache->bypass(!empty($_GET['bypass-cache']));\n$viewContext = new ViewContext();\n$logger = new Logger(__FILE__);\n\nif (!empty(Config::$maintenanceMessage))\n{\n\t$viewContext->viewName = 'maintenance';\n\t$viewContext->layoutName = 'layout-headerless';\n\tView::render($viewContext);\n}\nelseif (isset($_GET['e']))\n{\n\ttry\n\t{\n\t\t$viewContext->viewName = 'error-' . $_GET['e'];\n\t\tView::render($viewContext);\n\t}\n\tcatch (Exception $e)\n\t{\n\t\t$viewContext->viewName = 'error-404';\n\t\tView::render($viewContext);\n\t}\n}\nelse\n{\n\ttry\n\t{\n\t\t$url = $_SERVER['REQUEST_URI'];\n\t\tif (!empty($_SERVER['HTTP_HOST']) and !empty(Config::$enforcedDomain) and $_SERVER['HTTP_HOST'] != Config::$enforcedDomain)\n\t\t{\n\t\t\t$fixedUrl = 'http://' . Config::$enforcedDomain . '/' . trim($_SERVER['REQUEST_URI'], '/');\n\t\t\tHttpHeadersHelper::setCurrentHeader('Location', $fixedUrl);\n\t\t\texit(0);\n\t\t}\n\t\t$controllerContext->url = $url;\n\n\t\t$workingClassName = null;\n\t\tforeach ($classNames as $className)\n\t\t{\n\t\t\tif ($className::parseRequest($url, $controllerContext))\n\t\t\t{\n\t\t\t\t$workingClassName = $className;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!empty($workingClassName))\n\t\t{\n\t\t\t$workingClassName::preWork($controllerContext, $viewContext);\n\t\t\tif ($controllerContext->cache->isFresh($url))\n\t\t\t{\n\t\t\t\t$controllerContext->cache->load($url);\n\t\t\t\tflush();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$f = function() use ($workingClassName, $controllerContext, $viewContext)\n\t\t\t\t{\n\t\t\t\t\t$workingClassName::work($controllerContext, $viewContext);\n\t\t\t\t\tView::render($viewContext);\n\t\t\t\t};\n\t\t\t\tif (!$controllerContext->cache->isBypassed())\n\t\t\t\t{\n\t\t\t\t\t$controllerContext->cache->save($url, $f);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$f();\n\t\t\t\t}\n\t\t\t}\n\t\t\t$workingClassName::postWork($controllerContext, $viewContext);\n\n\t\t\tif (HttpHeadersHelper::getCurrentHeader('Content-Type') == 'text/html')\n\t\t\t{\n\t\t\t\tprintf('<!-- retrieved in %.05fs -->', microtime(true) - $viewContext->renderStart);\n\t\t\t}\n\t\t\texit(0);\n\t\t}\n\n\t\t$viewContext->viewName = 'error-404';\n\t\tView::render($viewContext);\n\t}\n\tcatch (Exception $e)\n\t{\n\t\t#log error information\n\t\t$logger->log($e);\n\t\t$viewContext->viewName = 'error';\n\t\t$viewContext->exception = $e;\n\t\tView::render($viewContext);\n\t}\n\texit(1);\n}\n"
  },
  {
    "path": "public_html/media/css/admin/index.css",
    "content": "fieldset {\n\tborder: 1px solid silver;\n\tmargin-bottom: 1em;\n\tpadding: 1em;\n}\nlabel.aligned {\n\tfloat: left;\n\tposition: absolute;\n\tvertical-align: middle;\n\ttext-align: right;\n\twidth: 6em;\n\tline-height: 1.75em;\n}\nlabel.aligned:after {\n\tdisplay: inline;\n\tcontent: ': ';\n\tmargin-right: 0.5em;\n}\n\nfieldset .control-group div {\n\tposition: relative;\n\tleft: 6em;\n}\n.control-group div {\n\tmargin-left: 0.5em;\n\tmargin-bottom: 1em;\n}\n.control-group button,\n.control-group textarea,\n.control-group input {\n\tmargin-bottom: 0;\n}\n.control-group small {\n\tdisplay: block;\n\tmargin-top: 0;\n}\n.control-group textarea {\n\twidth: 80%;\n\theight: 8em;\n}\n\n.alert {\n\tbackground: whitesmoke;\n\tpadding: 0.5em;\n}\n.alert.info {\n\tbackground: #adf;\n}\n.alert.error {\n\tbackground: #f42;\n\tcolor: white;\n}\n\n.logout {\n\tfloat: right;\n}\n"
  },
  {
    "path": "public_html/media/css/admin/login.css",
    "content": "label.aligned {\n\tfloat: left;\n\tposition: absolute;\n\tvertical-align: middle;\n\ttext-align: right;\n\twidth: 6em;\n\tline-height: 1.75em;\n}\nlabel.aligned:after {\n\tdisplay: inline;\n\tcontent: ': ';\n\tmargin-right: 0.5em;\n}\n\n.control-group>div {\n\tposition: relative;\n\tleft: 6em;\n\tmargin-left: 0.5em;\n\tmargin-bottom: 1em;\n}\n.control-group button,\n.control-group textarea,\n.control-group input {\n\tmargin-bottom: 0;\n}\n\n.alert {\n\tbackground: whitesmoke;\n\tdisplay: inline-block;\n\tpadding: 0.5em;\n}\n.alert.info {\n\tbackground: #adf;\n}\n.alert.error {\n\tbackground: #f42;\n\tcolor: white;\n}\n\n"
  },
  {
    "path": "public_html/media/css/core.css",
    "content": "html {\n    -webkit-text-size-adjust: none;\n    -moz-text-size-adjust: none;\n    -ms-text-size-adjust: none;\n}\n\n* {\n    max-height: 1000000px;\n}\n\n/* base, fonts etc */\nbody {\n    overflow-y: scroll;\n    margin: 0;\n    padding: 0 0 3em 0;\n    text-align: center;\n    background-color: white;\n    font-family: 'Open Sans', 'Verdana', 'Dejavu sans', sans-serif;\n    font-size: 11pt;\n    -webkit-tap-highlight-color: transparent;\n    min-width: 320px;\n}\n\nh1, h2, h3 {\n    font-weight: normal;\n    font-family: 'Ubuntu', sans-serif;\n}\n    h2 {\n        font-size: 1.5em;\n    }\n    h3 {\n        font-size: 1.17em;\n    }\n    h2, h3 {\n        font-weight: normal;\n        text-align: center;\n        margin: 0 0 1em 0;\n        position: relative;\n    }\n    h2:after, h3:after {\n        position: absolute;\n        bottom: -14px;\n        left: 0;\n        width: 100%;\n        height: 8px;\n        border-top: 1px solid #eee;\n        background: center bottom no-repeat radial-gradient(#f6f6f6, #fff 70%);\n        background-size: 100% 16px;\n        content: '';\n    }\n\n.clear {\n    clear: both;\n}\n\n/* links */\na {\n    color: #1969CB;\n    text-decoration: none;\n}\na, a span, a i {\n    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease;\n}\n    a:focus {\n        opacity: .8;\n        outline: 0;\n    }\n    a:hover, a:hover span {\n        color: #2D7DE0;\n        text-decoration: none;\n    }\n\n#notice-wrapper {\n    top: 0;\n    left: 0;\n    width: 100%;\n}\n\n.notice {\n    background: #516ba2;\n    color: black;\n    padding: 10px;\n    font-size: 10pt;\n    font-weight: bold;\n    text-align: center;\n}\n\n.notice a {\n    color: #fff;\n}\n\n#no-script {\n    background: orangered;\n    color: white;\n}\n\n/* ie image border */\nimg {\n    border: 0;\n}\n\n\n\n/* layout */\n.main-wrapper {\n    text-align: left;\n    margin: 0 auto;\n    max-width: 960px;\n    padding: 0;\n}\n\n/* miscellaneous */\n*:first-child {\n    margin-top: 0;\n}\ndiv.section+div.section {\n    margin-top: 1.5em;\n}\nh2 .icon-tooltip,\nh3 .icon-tooltip {\n    float: right;\n    display: block;\n}\n.section-body p {\n    margin: 0.5em;\n}\n\n/* search input */\n.search input {\n    padding: 1px 4px 1px 4px;\n    margin: 0 -1px 0 0;\n    height: 25px;\n}\n.search button {\n    display: inline-block;\n    padding: 1px 12px;\n    margin: 0 -1px 0 0;\n    vertical-align: bottom;\n    height: 25px;\n}\n.search input, .search button {\n    /* fix round corners on chrome */\n    -webkit-appearance: none;\n    /* fix height-padding problem */\n    box-sizing: content-box;\n    -moz-box-sizing: content-box;\n    -webkit-box-sizing: content-box;\n}\n\n/* tooltips */\n.highcharts-tooltip {\n    z-index: 50;\n    padding: 0;\n    margin: 0;\n    visibility: hidden;\n}\n.tooltip {\n    position: absolute;\n    z-index: 50;\n    padding-top: 8px;\n}\n    .tooltip span {\n        float: left;\n    }\n    .tooltip span,\n    .highcharts-tooltip span {\n        position: relative !important;\n        display: inline-block;\n        background: rgba(0, 0, 0, 0.7);\n        color: white !important;\n        border-radius: 0.5em;\n        -webkit-border-radius: 0.5em;\n        padding: 4px 8px !important;\n        font-size: 8pt !important;\n        line-height: 150% !important;\n        text-align: center;\n    }\n        .tooltip span:before {\n            position: absolute;\n            content: ' ';\n            bottom: 100%;\n            left: 50%;\n            width: 0;\n            height: 0;\n            margin-left: -4.5px;\n            border: 5px solid rgba(0, 0, 0, 0);\n            border-bottom-color: rgba(0, 0, 0, 0.7);\n        }\n        .tooltip,\n        .tooltip span,\n        .highcharts-tooltip,\n        .highcharts-tooltip span { cursor: default !important; }\n        .highcharts-tooltip span { white-space: normal !important; }\n        g.highcharts-tooltip { display: none !important }\n\n\n/* tablesorter */\ntable.tablesorter { border-spacing: 0; width: 100%; }\ntable.tablesorter thead th { background-color: #f5f5f5; padding: 0.5em 6px 0.5em 21px; border-right: 1px solid white; }\ntable.tablesorter tbody td { padding: 0.1em 6px 0.1em 6px; }\ntable.tablesorter tbody tr:hover td { background: #f5f5f5; }\ntable.tablesorter thead tr .header { background: #f5f5f5 url('/media/img/bg.gif') no-repeat center left; cursor: pointer; }\ntable.tablesorter thead tr .headerSortUp { background: #2D7DE0 url('/media/img/asc.gif') no-repeat center left; color: white; }\ntable.tablesorter thead tr .headerSortDown { background: #2D7De0 url('/media/img/desc.gif') no-repeat center left; color: white; }\n\n/* misc */\n.ad {\n    margin: 1em auto;\n}\n#adblock-enabled {\n    display: none;\n    background: #f5f5f5;\n    padding: 0.5em;\n    max-width: 728px;\n}\n#adblock-enabled p {\n    margin-bottom: 0;\n}\n#adblock-enabled ul {\n    margin-top: 1em;\n}\n#adblock-enabled li {\n    font-size: 90%;\n}\n#google-ads {\n    width: 728px;\n    border: 1px solid silver;\n    height: 90px;\n    overflow: hidden;\n}\n\nul.horizontal {\n    margin: 0;\n    padding: 0;\n    list-style-type: none;\n}\nul.horizontal li {\n    display: inline-block;\n}\nul.horizontal li:not(:last-child):after {\n    content: '·';\n    display: inline-block;\n    margin: 0 0.75em;\n}\n\n/* form controls */\nlabel,\ninput,\nbutton,\nselect,\ntextarea {\n    font-weight: normal;\n}\n\ntextarea,\ninput,\nselect,\n.btn {\n    background-color: #fff;\n    border: 1px solid #ccc;\n    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;\n    transition: all 0.1s ease;\n    border-radius: 4px;\n    color: #555;\n    display: inline-block;\n    font-size: 14px;\n    margin-bottom: 10px;\n    padding: 4px 6px;\n    vertical-align: middle;\n    /* weird fix for chrome yellow border */\n    outline: 0;\n}\n\ninput {\n    height: 20px;\n    line-height: 20px;\n}\n\n.btn {\n    background: #e6e6e6 linear-gradient(to bottom, #fff, #e6e6e6) repeat-x;\n    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);\n    border: 1px solid #ccc;\n    border-bottom-color: #a2a2a2;\n    border-radius: 4px;\n    color: #333;\n    cursor: pointer;\n    font-size: 14px;\n    padding: 4px 12px;\n    text-align: center;\n    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);\n    /* fix for chrome yellow border */\n    outline: none;\n}\n.btn:hover,\n.btn:focus {\n    background-position: 0 -1em;\n    box-shadow: 0 0 0.5em #eee;\n    border: 1px solid #aaa;\n    color: black;\n    text-decoration: none;\n}\nselect:focus,\ninput:focus {\n    box-shadow: 0 0 0.5em #d1d7e5;\n    border: 1px solid #2D7DE0;\n}\n/* weird fix for firefox' dotted border */\n::-moz-focus-inner {\n    border: 0;\n}\n\n.input-append input,\n.input-prepend input,\n.input-append select,\n.input-prepend select {\n    border-radius: 0 4px 4px 0;\n    margin-bottom: 0;\n    position: relative;\n    vertical-align: top;\n}\n\n.input-apend .add-on:last-child,\n.input-append .btn:last-child {\n    border-radius: 0 4px 4px 0;\n}\n.input-append .add-on,\n.input-prepend .add-on,\n.input-append .btn,\n.input-prepend .btn {\n    vertical-align: top;\n}\n.input-append, .input-prepend {\n    font-size: 0;\n    white-space: nowrap;\n}\n.input-append input,\n.input-append select {\n    border-radius: 4px 0 0 4px;\n}\n"
  },
  {
    "path": "public_html/media/css/glider.css",
    "content": "#glider {\n\tposition: fixed;\n\theight: 100%;\n\twidth: 100%;\n\ttop: 0;\n\tleft: 0;\n\tbackground-color: rgba(0, 0, 0, 0.2);\n\tdisplay: none;\n\tz-index: 99;\n}\n#glider>div {\n\ttop: 200px;\n\tposition: relative;\n\tmargin: 0 auto;\n\tbox-shadow: 0 0 0.5em 1em white;\n\tbackground-color: white;\n\twidth: 96px;\n}\n#glider .target {\n\tbackground-image: url('/media/img/glider.png');\n\tbackground-repeat: no-repeat;\n\tbackground-position: 0 0;\n\twidth: 96px;\n\theight: 96px;\n}\n#glider p {\n\tmargin-bottom: 0;\n\tdisplay: block;\n}\n#glider:after {\n\tcontent: ''; /* fix for rendering resized box on IE */\n}\n#preloader {\n\tbackground: url('/media/img/glider.png');\n}\n"
  },
  {
    "path": "public_html/media/css/header.css",
    "content": "#header {\n\tpadding: 0.5em 0;\n\tmargin: 0 0 1em 0;\n\tborder-bottom: 1px solid #ddd;\n\tfont-size: 115%;\n\tbackground: #f5f5f5 url('/media/img/heading.png') repeat-x bottom;\n}\n#header form {\n\tmargin: 0;\n}\n#header #top-nav {\n\tfloat: right;\n\tvertical-align: middle;\n}\n\n#header .input-append {\n\tvertical-align: middle;\n\tfloat: left;\n}\n\n#logo {\n\tfloat: left;\n}\n#logo a {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\tbackground-repeat: no-repeat;\n\tbackground-image: url('/media/img/logo-header.png');\n\tbackground-position: top right;\n\twidth: 50px;\n\theight: 30px;\n\ttext-decoration: none;\n}\n#logo a span {\n\tdisplay: none;\n}\n\n#header input {\n\tvertical-align: middle;\n\tmargin-left: 0.75em;\n\tdisplay: block;\n\tfloat: left;\n\twidth: 12em;\n}\n#header .btn {\n\tfloat: left;\n\tmargin-right: 1em;\n}\n\n#header .sep {\n\tdisplay: inline-block;\n\twidth: 0;\n\theight: 24px;\n\tborder-left: 1px solid rgba(0, 0, 0, 0.1);\n\tborder-right: 1px solid rgba(255, 255, 255, 0.7);\n\tmargin: 0 0.75em;\n\tvertical-align: middle;\n}\n"
  },
  {
    "path": "public_html/media/css/headerless.css",
    "content": "#main {\n\tmargin-top: 4em;\n}\n.main-wrapper {\n\tmax-width: 960px;\n}\n"
  },
  {
    "path": "public_html/media/css/icons.css",
    "content": "[class^='icon-'],\n[class*=' icon-'] {\n\tdisplay: inline-block;\n\tvertical-align: text-top;\n\tline-height: 16px;\n\twidth: 16px;\n\theight: 16px;\n\tmargin: 0;\n\tbackground-repeat: no-repeat;\n\tbackground-image: url('/media/img/icons.png');\n}\n\n.icon-empty             { background: none; }\n.icon-status-finished   { background-position: 0 0; }\n.icon-status-dropped    { background-position: -17px 0; }\n.icon-status-completing { background-position: -34px 0; }\n.icon-status-onhold     { background-position: -51px 0; }\n.icon-status-planned    { background-position: -68px 0; }\n.icon-search            { background-position: -85px 0; }\n.icon-not-yet-aired     { background-position: 0 -17px; }\n.icon-small-close       { background-position: -17px -17px; }\n.icon-menu-profile      { background-position: -102px 0; width: 20px; height: 20px; }\n.icon-menu-list         { background-position: -123px 0; width: 20px; height: 20px; }\n.icon-menu-ratings      { background-position: -144px 0; width: 20px; height: 20px; }\n.icon-menu-history      { background-position: -165px 0; width: 20px; height: 20px; }\n.icon-menu-favorites    { background-position: -102px -21px; width: 20px; height: 20px; }\n.icon-menu-recommended  { background-position: -123px -21px; width: 20px; height: 20px; }\n.icon-menu-achievements { background-position: -144px -21px; width: 20px; height: 20px; }\n.icon-close { background-position: -186px 0; width: 24px; height: 24px; margin: 0; }\n"
  },
  {
    "path": "public_html/media/css/index/about.css",
    "content": ".fb-wrapper {\n\tmargin-left: 2em;\n}\n"
  },
  {
    "path": "public_html/media/css/index/globals.css",
    "content": ".target {\n\theight: 210px;\n}\nul.infobox {\n\theight: 200px;\n}\n.section-body {\n\tmargin-bottom: 2em;\n}\n\n.queue-sizes .target-wrapper,\n.queue-sizes .target {\n\twidth: 100%;\n}\n"
  },
  {
    "path": "public_html/media/css/index/index.css",
    "content": ".main-wrapper {\n\tmax-width: 960px;\n}\n\n#start {\n\tbackground: #f6f6f6;\n\tposition: relative;\n\tz-index: 1;\n\tbox-shadow: 0 0 5px #aaa inset;\n\ttext-align: center;\n\tpadding: 1.5em;\n}\n\n#start:before {\n\tbackground: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 5em;\n\tcontent: '';\n\tdisplay: block;\n\theight: 100%;\n\tz-index: 2;\n}\n#start:after {\n\tbackground: linear-gradient(to left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\twidth: 5em;\n\tcontent: '';\n\tdisplay: block;\n\theight: 100%;\n\tz-index: 2;\n}\n\n#start span,\n#start label {\n\tline-height: 30px;\n\tvertical-align: middle;\n\tmargin: 0 1em;\n}\n#start span {\n\tfont-size: 90%;\n\twhite-space: pre;\n}\n\nfooter {\n\ttext-align: center;\n\tcolor: silver;\n\tmargin-top: 1em;\n\tfont-size: 95%;\n}\nfooter a {\n\tcolor: silver;\n}\nfooter a:hover,\nfooter a:focus {\n\tcolor: gray;\n\ttext-decoration: none;\n}\n\n#showcase {\n\theight: 20em;\n\tmargin-bottom: 4em;\n\tposition: relative;\n\toverflow: hidden;\n}\n\n#showcase nav {\n\tposition: absolute;\n\tbottom: 0;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 205px;\n}\n#showcase nav ul {\n\tlist-style-type: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n#showcase nav li {\n\tdisplay: inline-block;\n\tpadding: 0;\n\tmargin: 0;\n}\n#showcase nav li:not(:last-of-type) {\n\tmargin-bottom: 2em;\n}\n#showcase nav li a {\n\ttext-decoration: none;\n\tdisplay: inline-block;\n\tcolor: #aaa;\n}\n#showcase nav li.active a span,\n#showcase nav li:hover a span {\n\tcolor: #1969CB;\n}\n#showcase nav li.active i[class*='icon'],\n#showcase nav li:hover i[class*='icon'] {\n\tbackground-color: #1969CB;\n}\n\n#showcase .tab-wrapper {\n\tmargin-left: 205px;\n\tposition: absolute;\n\tleft: 0;\n\tright: 0;\n\tbottom: 0;\n}\n\n#showcase .tab {\n\tdisplay: none;\n\ttext-align: center;\n}\n#showcase .tab img {\n\tmax-width: 80%;\n}\n#showcase .tab img.screenshot {\n\tmargin: 0 auto;\n\tmax-height: 15em;\n}\n\n#showcase .tab:first-child {\n\tdisplay: block;\n}\n#showcase .tab p {\n\tfont-size: 110%;\n\twidth: 85%;\n\tmargin: 1em auto 0 auto;\n}\n\n#showcase i[class^='icon-'] {\n\tline-height: 32px;\n\twidth: 32px;\n\theight: 32px;\n\tbackground-color: #aaa;\n\tfloat: left;\n\tmargin-top: 4px;\n\tmargin-right: 8px;\n}\n#showcase nav span {\n\ttext-decoration: none;\n\tline-height: 20px;\n\twidth: 165px;\n\tfloat: left;\n\tdisplay: inline-block;\n}\n.icon-mg           { background-position: 0px -42px; }\n.icon-suggestions  { background-position: -33px -42px; }\n.icon-achievements { background-position: -66px -42px; }\n.icon-globals      { background-position: -99px -42px; }\n"
  },
  {
    "path": "public_html/media/css/infobox.css",
    "content": ".target-wrapper { width: 79%; }\nul.infobox { float: right; width: 20%; max-width: 20%; overflow: hidden; list-style-type: none; text-align: center; display: table; padding: 0; margin: 0; }\nul.infobox li { margin-bottom: 1em; display: table-row; }\nul.infobox li>div { display: table-cell; vertical-align: middle; }\nul.infobox li span.prefix { display: block; margin: 0; }\nul.infobox li span.prefix:after { content: ':'; }\nul.infobox li span.subject { display: inline-block; margin: 0.1em auto; font-size: 1.75em; }\nul.infobox li span.suffix { display: block; padding: 0; }\n"
  },
  {
    "path": "public_html/media/css/menu.css",
    "content": ".main-wrapper {\n\tmax-width: 960px;\n}\n#logo .sep {\n\tmargin-right: 0;\n}\n\n#menu-wrapper {\n\tfloat: left;\n\tposition: relative;\n\twidth: 180px;\n\tfont-size: 110%;\n}\n#main {\n\tmargin-left: 200px;\n\tmax-width: 960px;\n\toverflow: hidden; /* allow children to clear floats */\n}\n\n#menu {\n\tpadding: 30px 0 16px 0;\n\tposition: relative;\n\tbackground: top right repeat-y linear-gradient(to left, #f6f6f6 0, #fff 8px);\n\tbackground-size: 8px 100%;\n\tbox-shadow: -1px 0 0 #ddd inset;\n}\n#menu:before {\n\tbackground: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0, #fff 16px);\n\tbottom: 0;\n}\n#menu:after {\n\tbackground: linear-gradient(to top, rgba(255, 255, 255, 0) 0, #fff 16px);\n\ttop: 0;\n}\n#menu:before,\n#menu:after {\n\tposition: absolute;\n\tcontent: '';\n\theight: 16px;\n\tright: 0;\n\twidth: 100%;\n}\n#menu hr {\n\tposition: relative;\n\tmargin-right: 1px;\n\tbackground: linear-gradient(to bottom, #f6f6f6 0, rgba(255, 255, 255, 0) 8px);\n\theight: 4px;\n\tborder: 0;\n}\n#menu hr:after {\n\tposition: absolute;\n\tbackground: linear-gradient(to right, #fff 0, rgba(255, 255, 255, 0) 100%);\n\ttop: 0;\n\twidth: 100%;\n\theight: 4px;\n\tcontent: '';\n}\n\n#menu ul {\n\tlist-style-type: none;\n\tmargin: 0;\n\tpadding: 0;\n\tline-height: 2em;\n}\n#menu ul li {\n\tmargin: 0;\n\tpadding: 0;\n\tfont-weight: normal;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\tposition: relative;\n\tfloat: right;\n\tmin-width: 180px;\n}\n#menu ul li a {\n\tdisplay: block;\n\tcolor: dimgray;\n\tpadding: 4px 12px 4px 8px;\n\ttext-align: right;\n\ttext-decoration: none;\n\tmargin: 1px 0;\n}\n#menu ul li.active a {\n\tbackground: white;\n\tborder-left: 3px solid #1969CB;\n\tborder-top: 1px solid #ddd;\n\tborder-bottom: 1px solid #ddd;\n\tborder-radius: 2px 0 0 2px;\n\tcolor: black;\n}\n#menu ul li:not(.active) a:focus,\n#menu ul li:not(.active) a:hover {\n\tborder-right: 3px solid #ddd;\n\tpadding-right: 9px;\n\tcolor: black;\n\ttext-decoration: none;\n}\n\n#menu ul li.active i,\n#menu ul li a:focus i,\n#menu ul li a:hover i {\n\topacity: 1;\n}\n#menu span {\n\tmargin-right: 12px;\n}\n#menu i {\n\tbackground-color: #888;\n\topacity: .75;\n}\n#menu .anime i {\n\tbackground-color: #5B94DA;\n}\n#menu .manga i {\n\tbackground-color: #EBA478;\n}\n\n/* small screens */\n@media (max-width: 599px), (max-device-width: 599px) {\n\t#menu-wrapper {\n\t\twidth: 40px;\n\t}\n\t#menu ul li {\n\t\tfloat: none;\n\t\tmin-width: 0;\n\t}\n\t#main {\n\t\tmargin-left: 60px;\n\t}\n\t#menu span {\n\t\tdisplay: none;\n\t}\n}\n\n/* big screens */\n@media (min-width: 599px) and (min-device-width: 599px) {\n\t#logo {\n\t\twidth: 181px; /*184px -3px for border-right*/\n\t\ttext-align: right;\n\t}\n\t#logo a {\n\t\twidth: 163px;\n\t\theight: 28px;\n\t\tbackground-image: url('/media/img/logo-header-big.png');\n\t}\n}\n"
  },
  {
    "path": "public_html/media/css/mini-sections.css",
    "content": ".left {\n\twidth: 50%;\n\ttext-align: center;\n\tfloat: left;\n}\n.right {\n\twidth: 50%;\n\ttext-align: center;\n\tfloat: right;\n}\n\n.mini-section {\n\tmargin-bottom: 2.5em;\n}\np.big-number span.desc {\n\tfont-size: 110%;\n\tvertical-align: middle;\n}\np.big-number span.value {\n\tfont-size: 150%;\n\tpadding-left: 1em;\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\n\n.bar {\n\tbackground: #eee;\n\theight: 3px;\n\twidth: 12em;\n\tmargin: 0.5em auto;\n\tposition: relative;\n}\n.bar .filled {\n\tbackground: #5B94DA;\n\theight: 3px;\n}\n.bar .tick {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 9px;\n\ttop: -3px;\n\tbackground: black;\n}\n"
  },
  {
    "path": "public_html/media/css/user/achievements.css",
    "content": "img.achi {\n\tfloat: right;\n    padding: 0;\n\tmargin: 0 0 0 0.5em;\n\tposition: relative;\n\tz-index: 3;\n    border-radius: 4px;\n}\nimg.achi.entries-trigger {\n\tcursor: pointer;\n}\nimg.achi.entries-trigger:hover {\n\topacity: 0.85;\n}\n\np.level {\n\tfloat: right;\n\tmargin: 0.3em 0 0 0;\n\tfont-size: 8pt;\n\tcolor: gray;\n}\np.desc {\n\tmargin: 0;\n\tpadding: 0.5em 0;\n}\n\n.progress-wrapper {\n\tposition: relative;\n\toverflow: hidden;\n\tpadding: 0.5em 0;\n\topacity: 0.5;\n}\n\t.progress-wrapper:hover {\n\t\topacity: 1;\n\t}\n\t.progress {\n\t\tbackground: #ddd;\n\t}\n\t.progress .bar {\n\t\tbackground: #2D7DE0;\n\t\theight: 3px;\n\t}\n\nh3 {\n\ttext-align: left;\n\tmargin-bottom: 0;\n}\n.achi-entry h3,\n.achi-entry h3:after,\n.achi-entry h3:before {\n\tbox-shadow: none;\n\tborder: 0;\n\tbackground: 0;\n}\n.achi-entry {\n\tmargin-bottom: 3em;\n}\n.achi-entry.hidden {\n\tdisplay: none;\n}\n\n.previous-msg {\n\ttext-align: center;\n\tpadding-bottom: 0.5em;\n}\n"
  },
  {
    "path": "public_html/media/css/user/entries.css",
    "content": ".entries-wrapper {\n\tdisplay: none;\n\tfont-size: 90%;\n}\n.entries-wrapper ul {\n\tmargin: 0;\n\tpadding-top: 0;\n\tpadding-right: 0;\n\tpadding-bottom: 2em;\n}\n.entries-wrapper .close {\n\tfloat: right;\n\tcursor: pointer;\n\tpadding: 0.5em 0 0.5em 0.5em;\n}\n.entries-wrapper span.details {\n\tcolor: silver;\n\tmargin-left: 0.5em;\n\tfont-size: 92.5%;\n}\n.entries-wrapper p {\n\tmargin: 0.5em 0 0.5em 0.5em;\n}\n"
  },
  {
    "path": "public_html/media/css/user/favorites.css",
    "content": ".decades .target-wrapper {\n\twidth: 100%;\n}\n.decades .target {\n\theight: 300px;\n\twidth: 100%;\n}\n\n.types .target-wrapper {\n\twidth: 100%;\n}\n.types .target {\n\theight: 220px;\n}\n\n.sources .target-wrapper {\n\twidth: 100%;\n}\n.sources .target {\n\theight: 220px;\n}\n\ntable {\n\tfont-size: 90%;\n}\ntable .title {\n\twidth: 100%;\n}\ntable .ord {\n\ttext-align: center;\n}\ntable .mean, table .time, table .count {\n\ttext-align: right;\n}\ntable.tablesorter thead th:first-child {\n\tpadding-left: 6px;\n\tpadding-right: 6px;\n}\n\nspan.info {\n\tfont-size: 7pt;\n\tcolor: gray;\n}\n\ntr.entries-wrapper-row td {\n\tbackground: none !important;\n}\n\n.toggle-decades-msg {\n\ttext-align: center;\n}\n"
  },
  {
    "path": "public_html/media/css/user/history.css",
    "content": ".history-daily .target {\n\theight: 20em;\n}\nul.infobox {\n\theight: 17.5em;\n}\n\n.history-monthly p.unknown {\n\tmargin: 0;\n\tpadding: 1em 0;\n\ttext-align: center;\n}\n.history-monthly table {\n\tempty-cells: show;\n\tborder-spacing: 2px;\n\tmargin: 0 auto;\n}\n.history-monthly table th {\n\ttext-align: center;\n\tfont-weight: normal;\n\tvertical-align: middle;\n}\n.history-monthly table thead th {\n\tpadding-bottom: 8px;\n}\n.history-monthly table th:first-child {\n\ttext-align: center;\n}\n.history-monthly table th.entries-trigger:first-child {\n\tcursor: pointer;\n}\n.history-monthly table {\n\twidth: 100%;\n\ttable-layout: fixed;\n}\n.history-monthly table .box-cell {\n\tpadding: 0;\n}\n.history-monthly thead th {\n\twidth: 7.7%;\n\toverflow: hidden;\n}\n.history-monthly table .box {\n\theight: 2em;\n\tbackground: #1969CB;\n}\n.history-monthly table .box-wrapper {\n\tposition: relative;\n\tz-index: 1;\n}\n.history-monthly table .box-cell.entries-trigger:hover .box-wrapper {\n\tmargin: -1px;\n\tborder: 1px solid white;\n\toutline: 1px solid black;\n\tcursor: pointer;\n\tz-index: 3;\n}\n.history-monthly table .box-cell.now .box-wrapper {\n\tmargin: -1px;\n\tborder: 1px solid white;\n\toutline: 1px solid #ED561B;\n\tz-index: 2;\n}\n"
  },
  {
    "path": "public_html/media/css/user/list.css",
    "content": "table {\n\tfont-size: 90%;\n}\n\ntd.no-score {\n\tcolor: #aaa;\n}\n\nth,\ntd {\n\tpadding: 2px 2px;\n\ttext-align: center;\n}\nth.title,\ntd.title {\n\twidth: 100%;\n\tpadding: 2px 8px;\n\ttext-align: left;\n}\n\ntd.status i {\n\tmargin-top: 1px;\n}\n\n#filter-form {\n\twhite-space: nowrap;\n}\n\n#filter-form label,\n#filter-form input,\n#filter-form select,\n#filter-form button {\n\tvertical-align: middle;\n\tmargin: 0 0.33em;\n}\n\n#filter-form label {\n\tdisplay: inline;\n\tpadding: 0;\n\tmargin: 0 0.5em 0 0;\n\tline-height: 2em;\n}\n#filter-form #filter-title {\n\twidth: 30%;\n}\n#filter-form #filter-status {\n\twidth: 20%;\n}\n#filter-form {\n\ttext-align: center;\n}\nform {\n\tmargin: 0 0 1em 0;\n}\n\n.filter-hint {\n\tdisplay: none;\n}\n\n.higher {\n\tcolor: #007e00;\n}\n.lower {\n\tcolor: #b60000;\n}\n"
  },
  {
    "path": "public_html/media/css/user/profile.css",
    "content": ".updated,\n.queue-pos {\n\tposition: absolute;\n\tfont-size: 65%;\n\tpadding-top: 0.25em;\n}\n.updated {\n\tleft: 0;\n}\n.queue-pos {\n\tright: 0;\n}\n.updated span,\n.queue-pos span {\n\topacity: .25;\n\tpadding: 3px 6px;\n\tdisplay: inline-block;\n\tmargin-top: 2px;\n}\n.updated a,\n.queue-pos a {\n\topacity: .8;\n\tpadding: 3px 6px;\n\tmargin-top: 2px;\n\tdisplay: inline-block;\n\tborder-radius: 4px;\n\t-webkit-animation: update-button-animation 2s infinite;\n\t-ms-animation: update-button-animation 2s infinite;\n\t-o-animation: update-button-animation 2s infinite;\n\tanimation: update-button-animation 2s infinite;\n}\n\n@-webkit-keyframes update-button-animation\n{\n\t0% { background: none; }\n\t20% { background: rgba(45, 125, 224, .3); }\n\t100% { background: none; }\n}\n@-o-keyframes update-button-animation\n{\n\t0% { background: none; }\n\t20% { background: rgba(45, 125, 224, .3); }\n\t100% { background: none; }\n}\n@-ms-keyframes update-button-animation\n{\n\t0% { background: none; }\n\t20% { background: rgba(45, 125, 224, .3); }\n\t100% { background: none; }\n}\n@keyframes update-button-animation\n{\n\t0% { background: none; }\n\t20% { background: rgba(45, 125, 224, .3); }\n\t100% { background: none; }\n}\n\n\n.list-views .suffix {\n\tmargin-left: 0.67em;\n\tcolor: gray;\n}\n\n.friends ul,\n.basic ul {\n\tlist-style-type: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n.friends a {\n\tposition: relative;\n\tfont-size: 120%;\n\tline-height: 1.75em;\n}\n.friends ul li {\n\toverflow: hidden;\n\tdisplay: block;\n\ttext-overflow: ellipsis;\n\tfloat: left;\n\ttext-align: center;\n\twidth: 50%;\n}\n\n.user-pic {\n\twidth: 40%;\n\tfloat: right;\n}\n.user-pic a {\n\tfont-size: 0;\n\tline-height: 0;\n\tmargin: 0;\n\tpadding: 0;\n}\n.user-pic img {\n\tbox-shadow: 0 0 2px rgba(96,96,96,0.5) inset;\n\tborder-radius: 4px;\n\tpadding: 0;\n\tmargin: 0 auto;\n\tbackground-color: rgba(255, 255, 255, 0.6);\n\tbackground-size: cover;\n\tbackground-repeat: no-repeat;\n\tbackground-position: top center;\n\twidth: 100%;\n}\n.user-pic img.unavailable {\n\tbackground-image: url('/media/img/anon.png');\n}\n\n.friends {\n\tmargin-bottom: 2.5em;\n}\n.list-views .bar {\n\tbackground: #EBA478;\n}\n.list-views .anime {\n\tcolor: #5B94DA;\n}\n.list-views .manga {\n\tcolor: #EBA478;\n}\n\nol li {\n\tmargin-bottom: 1em;\n}\n"
  },
  {
    "path": "public_html/media/css/user/ratings.css",
    "content": ".target {\n\theight: 228px;\n\tline-height: 0;\n}\n.rating-length-dist .target {\n\theight: 20em;\n}\n\nul.infobox {\n\theight: 250px;\n}\nul.infobox .btn {\n\tmargin-top: 1em;\n}\n\n.popup-wrapper {\n\tdisplay: none;\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: rgba(0, 0, 0, 0.3);\n\tz-index: 5;\n\ttext-align: center;\n\tfont-size: 0.9em;\n}\n.popup {\n\tbackground: white;\n\tmargin: 10% auto auto auto;\n\tdisplay: inline-block;\n\ttext-align: left;\n\tbox-shadow: 0 0 1em rgba(0, 0, 0, 0.5);\n\tborder-radius: 2px;\n\tpadding: 1em;\n}\n.popup .header {\n\tposition: relative;\n}\n.popup .close {\n\tcursor: pointer;\n\tdisplay: block;\n\tposition: absolute;\n\tz-index: 2;\n\tright: 0;\n\ttop: -0.5em;\n\tpadding: 0.5em 0 0.5em 0.5em;\n}\n\n.export .combo-wrapper p {\n\tdisplay: inline-block;\n\tmargin: 0 1em 0 0;\n}\n.export .combo-wrapper {\n\tline-height: 2em;\n\tvertical-align: middle;\n}\n.export .combo-wrapper select {\n\tdisplay: inline-block;\n\tmargin: 0 1em 0 0;\n\twidth: auto;\n\tmax-width: 40%;\n}\n.export select[name='type'] {\n\tmax-width: 25%;\n\twidth: auto;\n}\n.export select[name='theme'] {\n\tmargin-right: 0;\n}\n.export button {\n\tmargin: 0;\n\tfloat: left;\n}\n.export textarea {\n\tmargin: 1em 0 0 0;\n\twidth: 100%;\n\theight: 7em;\n\tcursor: text !important;\n\t/* fix right padding problem */\n\t-webkit-box-sizing: border-box;\n\t-moz-box-sizing: border-box;\n\tbox-sizing: border-box;\n}\n\n.export .body-wrapper,\n.export .custom-theme p {\n\ttext-align: center;\n}\n.export .body p {\n\tmargin-top: 0;\n}\n.export .preview p {\n\tmargin-top: 1em;\n}\n.export .preview img {\n\tmax-width: 100%;\n\tmax-height: 161px;\n}\n\n.export .body-wrapper {\n\tfloat: left;\n\twidth: 33em;\n\tpadding-right: 1em;\n\tborder-right: 1px solid rgba(0, 0, 0, 0.1);\n\tmargin-right: -1em;\n}\n.export .custom-theme {\n\tfloat: right;\n\tdisplay: none;\n\tmargin-left: 2em;\n}\n.export .custom-theme p {\n\ttext-align: left;\n\toverflow: hidden;\n\twhite-space: pre;\n}\n.export .custom-theme select {\n\twidth: 200px;\n}\n.export .custom-theme input {\n\twidth: calc(200px - 14px);\n}\n"
  },
  {
    "path": "public_html/media/css/user/recommendations.css",
    "content": ".missing .undelete-msg {\n\ttext-align: center;\n\tdisplay: none;\n}\n\n.missing .center {\n\ttext-align: center;\n}\n\n.missing table {\n\tfont-size: 90%;\n\ttable-layout: fixed;\n\twidth: 100%;\n\tborder-spacing: 0;\n\tline-height: 1.6em;\n}\n\n.missing table tbody tr:first-child td {\n\tpadding: 0.5em 0.5em;\n\tbox-shadow: inset 0 1em 1em -1em #ddd;\n\tvertical-align: top;\n}\n.missing table thead tr th {\n\tpadding: 0.5em 1em;\n\tbackground: whitesmoke;\n\twidth: 50%;\n}\n/* multiple tbody are used for highlighting (more) link row along with proposition row */\n.missing table tbody:hover tr td {\n\tbackground: #f5f5f5;\n}\n\n.missing table td ul {\n\toverflow: hidden;\n\tlist-style-type: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n.missing table td ul li {\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\tpadding-right: 20px;\n\tposition: relative;\n}\n\n.missing i.left {\n\tmargin-right: 4px;\n}\n\n.missing i.right {\n\tposition: absolute;\n\tright: 4px;\n}\n\n\n.original img {\n\twidth: 80px;\n\tmargin-right: 0.5em;\n\tfloat: left;\n}\n.original .details-wrapper .header:after {\n\tmargin: 0.1em 0;\n\tcontent: '';\n\theight: 1px;\n\tdisplay: block;\n\tbackground: #e6e6e6 linear-gradient(to right, #e6e6e6, #fff) repeat-y;\n}\n.original .details-wrapper {\n\tfloat: left;\n\twidth: 240px;\n\tline-height: 1.5em;\n}\n.original .details-wrapper div {\n\twhite-space: pre;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n.original .details {\n\tfont-size: 85%;\n}\n\n.original ul {\n\tmargin: 0;\n\tpadding: 0;\n}\n.original li {\n\tpadding: 0;\n\tmargin: 0 1em 1em 0;\n\tvertical-align: top;\n\tdisplay: inline-block;\n}\n"
  },
  {
    "path": "public_html/media/js/glider.js",
    "content": "//animate glider - change background position every x ms\nfunction animateGlider()\n{\n\tvar pos = $('#glider .target').css('background-position');\n\tvar matches = pos.match(/(-?\\d+)/g);\n\tvar left = matches[0];\n\tvar top = matches[1];\n\tleft -= 96;\n\tif (left <= 96 * -4)\n\t{\n\t\tleft = 0;\n\t}\n\t$('#glider .target').css('background-position', left + 'px ' + top + 'px');\n\n\tvar diff = (new Date() - $('#glider').data('start')) / 1000;\n\tfor (var i in messages)\n\t{\n\t\tvar subMessages = messages[i];\n\t\tvar message = subMessages[Math.floor(Math.random() * subMessages.length)];\n\t\tif (diff >= i)\n\t\t{\n\t\t\tdelete messages[i];\n\t\t\t$('#glider p').fadeOut(function()\n\t\t\t{\n\t\t\t\t$(this).html(message).fadeIn();\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nvar messages =\n{\n\t5:\n\t[\n\t\t'downloading your data&hellip;',\n\t\t'performing magic tricks&hellip;',\n\t\t'reticulating splines&hellip;',\n\t\t'making you read this text&hellip;',\n\t\t'preparing the awesome&hellip;',\n\t\t'cropping avatars&hellip;'\n\t],\n\n\t10:\n\t[\n\t\t'applying final touches&hellip;',\n\t\t'antialiasing buttons&hellip;',\n\t\t'rendering gradients&hellip;',\n\t\t'please wait&hellip;',\n\t\t'connecting the dots&hellip;'\n\t],\n\n\t15:\n\t[\n\t\t'[your ad here]',\n\t\t'proving P=NP&hellip;',\n\t\t'warming up the server&hellip;',\n\t\t'breaking fourth wall&hellip;',\n\t\t'signing the contract&hellip;'\n\t],\n\n\t22:\n\t[\n\t\t'this shouldn&rsquo;t take much longer.',\n\t\t'don&rsquo;t panic yet.',\n\t\t'the engine needs some oil.',\n\t\t'moving the gears&hellip;',\n\t\t'randomizing messages&hellip;'\n\t],\n\n\t30:\n\t[\n\t\t'yep, still loading.',\n\t\t'loading just according to keikaku.',\n\t\t'analyzing your taste&hellip;',\n\t\t'transforming to final form&hellip;'\n\t],\n\n\t40:\n\t[\n\t\t'does your list even end?',\n\t\t'you should have clicked harder.',\n\t\t'there&rsquo;s a reward at the end.',\n\t\t'tick&hellip; tock&hellip;'\n\t],\n\n\t50:\n\t[\n\t\t'the game.',\n\t\t'your stats will appear any second now.',\n\t\t'good things come to those who wait.',\n\t\t'it&rsquo;ll be worth the wait.'\n\t],\n\n\t60:\n\t[\n\t\t'loading&hellip;'\n\t],\n\n\t90:\n\t[\n\t\t'yawn.',\n\t\t'hmm&hellip;'\n\t],\n\n\t100:\n\t[\n\t\t'does your list even end?',\n\t\t'please wait a bit longer.'\n\t],\n\n\t110:\n\t[\n\t\t'loading&hellip;'\n\t]\n};\n\n//show glider\nfunction showGlider()\n{\n\t$('#glider').data('start', new Date());\n\t$('#glider').fadeIn('slow');\n\twindow.setInterval(animateGlider, 550);\n}\n\n//show glider with short delay\nvar timeout;\nfunction showGliderDelayed()\n{\n\ttimeout = window.setTimeout(showGlider, 550);\n}\n\n//attach glider showing to an event to an element\nfunction attachGlider(elems, event)\n{\n\telems.each(function()\n\t{\n\t\tvar target = $(this);\n\t\ttarget.bind(event, function(e, data)\n\t\t{\n\t\t\tif (e.isPropagationStopped())\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//supress showing glider on middle mouse button click\n\t\t\tif (!(e.type == 'click' && e.which == 2))\n\t\t\t{\n\t\t\t\tshowGliderDelayed();\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t});\n}\n\n$(function()\n{\n\t//fix some weird history issues on some browsers\n\t$(window).unload(function()\n\t{\n\t\tif (timeout)\n\t\t{\n\t\t\twindow.clearTimeout(timeout);\n\t\t}\n\t});\n\n\tattachGlider($('a.waitable, button.waitable'), 'click');\n\tattachGlider($('form.waitable'), 'submit');\n});\n"
  },
  {
    "path": "public_html/media/js/highcharts-mg.js",
    "content": "Highcharts.theme =\n{\n\tcolors:\n\t[\n\t\t'#1969CB',\n\t\t'#ED561B',\n\t\t'#50B432',\n\t\t'#DDDF00',\n\t\t'#24CBE5',\n\t\t'#64E572',\n\t\t'#FF9655',\n\t\t'#FFF263',\n\t\t'#6AF9C4'\n\t],\n\n\tcredits:\n\t{'enabled': false},\n\n\tchart:\n\t{\n\t\tplotShadow: false,\n\t\tbackgroundColor: 'rgba(255, 255, 255, 0)',\n\t\tspacingTop: 0,\n\t\tspacingBottom: 0,\n\t\tspacingLeft: 0,\n\t\tspacingRight: 0,\n\t\talignTicks: false,\n\t},\n\n\ttitle: false,\n\tlegend:\n\t{\n\tenabled: false\n\t},\n\n\txAxis:\n\t{\n\t\tgridLineWidth: 1,\n\t\tminorGridLineColor: '#f5f5f5',\n\t\tgridLineColor: '#f5f5f5',\n\t\tlineColor: '#000',\n\t\ttickColor: '#000',\n\t\tlabels:\n\t\t{\n\t\t\tstyle:\n\t\t\t{\n\t\t\t\tcolor: '#000',\n\t\t\t\tfont: '8pt Verdana, Dejavu Sans, sans-serif'\n\t\t\t}\n\t\t},\n\t\ttitle:\n\t\t{\n\t\t\tstyle:\n\t\t\t{\n\t\t\t\tcolor: '#333',\n\t\t\t\tfontWeight: 'bold',\n\t\t\t\tfontSize: '9pt',\n\t\t\t\tfontFamily: 'Verdana, Dejavu Sans, sans-serif'\n\n\t\t\t}\n\t\t}\n\t},\n\n\tyAxis:\n\t{\n\t\tminorTickInterval: 'auto',\n\t\tgridLineColor: '#ddd',\n\t\tminorGridLineColor: '#f5f5f5',\n\t\tlineColor: '#000',\n\t\tlineWidth: 1,\n\t\ttickWidth: 1,\n\t\ttickColor: '#000',\n\t\tlabels:\n\t\t{\n\t\t\tstyle:\n\t\t\t{\n\t\t\t\tcolor: '#000',\n\t\t\t\tfont: '8pt Verdana, Dejavu Sans, sans-serif'\n\t\t\t}\n\t\t},\n\t\ttitle:\n\t\t{\n\t\t\tstyle:\n\t\t\t{\n\t\t\t\tcolor: '#333',\n\t\t\t\tfontWeight: 'bold',\n\t\t\t\tfontSize: '9pt',\n\t\t\t\tfontFamily: 'Verdana, Dejavu Sans, sans-serif'\n\t\t\t}\n\t\t}\n\t},\n\n\tlabels:\n\t{\n\t\tstyle:\n\t\t{\n\t\t\tcolor: '#99b'\n\t\t}\n\t},\n\n\tplotOptions:\n\t{\n\t\tbar:\n\t\t{\n\t\t\tpointWidth: 18,\n\t\t\tborderWidth: 1,\n\t\t\tshadow: false,\n\t\t},\n\t\tcolumn:\n\t\t{\n\t\t\tpointWidth: 18,\n\t\t\tborderWidth: 1,\n\t\t\tshadow: false,\n\t\t},\n\t\tline:\n\t\t{\n\t\t\tshadow: false,\n\t\t}\n\t},\n\n\ttooltip:\n\t{\n\t\tbackgroundColor: 'auto',\n\t\tstyle:\n\t\t{\n\t\t},\n\t\tuseHTML: true,\n\t\tshadow: false,\n\t\tborderWidth: 0\n\t}\n\n};\n\n// Apply the theme\nvar highchartsOptions = Highcharts.setOptions(Highcharts.theme);\n"
  },
  {
    "path": "public_html/media/js/index/index.js",
    "content": "var lastNum = 0;\n\nfunction switchShowcaseTab(num)\n{\n\t$('#showcase nav li').removeClass('active');\n\t$('#showcase nav li').eq(num).addClass('active');\n\tif (lastNum == num)\n\t{\n\t\treturn;\n\t}\n\tlastNum = num;\n\t$('#showcase .tab').slideUp('fast');\n\t$('#showcase .tab').eq(num).slideDown('fast');\n}\n\nfunction nextShowcaseTab()\n{\n\tvar num = $('#showcase nav li.active').index();\n\tnum ++;\n\tnum %= $('#showcase nav li').length;\n\tswitchShowcaseTab(num);\n}\n\n$(function()\n{\n\t$('#main .search input').focus();\n\n\tvar timeout = window.setInterval(nextShowcaseTab, 5000);\n\n\t$('#showcase nav li').each(function(i, index)\n\t{\n\t\t$(this).click(function(e)\n\t\t{\n\t\t\twindow.clearTimeout(timeout);\n\t\t\tswitchShowcaseTab(i);\n\t\t\te.preventDefault();\n\t\t});\n\t});\n\n\tswitchShowcaseTab(0);\n});\n"
  },
  {
    "path": "public_html/media/js/jquery.cookie.js",
    "content": "/*!\n * jQuery Cookie Plugin v1.4.1\n * https://github.com/carhartl/jquery-cookie\n *\n * Copyright 2006, 2014 Klaus Hartl\n * Released under the MIT license\n */\n(function (factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\t// AMD (Register as an anonymous module)\n\t\tdefine(['jquery'], factory);\n\t} else if (typeof exports === 'object') {\n\t\t// Node/CommonJS\n\t\tmodule.exports = factory(require('jquery'));\n\t} else {\n\t\t// Browser globals\n\t\tfactory(jQuery);\n\t}\n}(function ($) {\n\n\tvar pluses = /\\+/g;\n\n\tfunction encode(s) {\n\t\treturn config.raw ? s : encodeURIComponent(s);\n\t}\n\n\tfunction decode(s) {\n\t\treturn config.raw ? s : decodeURIComponent(s);\n\t}\n\n\tfunction stringifyCookieValue(value) {\n\t\treturn encode(config.json ? JSON.stringify(value) : String(value));\n\t}\n\n\tfunction parseCookieValue(s) {\n\t\tif (s.indexOf('\"') === 0) {\n\t\t\t// This is a quoted cookie as according to RFC2068, unescape...\n\t\t\ts = s.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');\n\t\t}\n\n\t\ttry {\n\t\t\t// Replace server-side written pluses with spaces.\n\t\t\t// If we can't decode the cookie, ignore it, it's unusable.\n\t\t\t// If we can't parse the cookie, ignore it, it's unusable.\n\t\t\ts = decodeURIComponent(s.replace(pluses, ' '));\n\t\t\treturn config.json ? JSON.parse(s) : s;\n\t\t} catch(e) {}\n\t}\n\n\tfunction read(s, converter) {\n\t\tvar value = config.raw ? s : parseCookieValue(s);\n\t\treturn $.isFunction(converter) ? converter(value) : value;\n\t}\n\n\tvar config = $.cookie = function (key, value, options) {\n\n\t\t// Write\n\n\t\tif (arguments.length > 1 && !$.isFunction(value)) {\n\t\t\toptions = $.extend({}, config.defaults, options);\n\n\t\t\tif (typeof options.expires === 'number') {\n\t\t\t\tvar days = options.expires, t = options.expires = new Date();\n\t\t\t\tt.setMilliseconds(t.getMilliseconds() + days * 864e+5);\n\t\t\t}\n\n\t\t\treturn (document.cookie = [\n\t\t\t\tencode(key), '=', stringifyCookieValue(value),\n\t\t\t\toptions.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE\n\t\t\t\toptions.path    ? '; path=' + options.path : '',\n\t\t\t\toptions.domain  ? '; domain=' + options.domain : '',\n\t\t\t\toptions.secure  ? '; secure' : ''\n\t\t\t].join(''));\n\t\t}\n\n\t\t// Read\n\n\t\tvar result = key ? undefined : {},\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all. Also prevents odd result when\n\t\t\t// calling $.cookie().\n\t\t\tcookies = document.cookie ? document.cookie.split('; ') : [],\n\t\t\ti = 0,\n\t\t\tl = cookies.length;\n\n\t\tfor (; i < l; i++) {\n\t\t\tvar parts = cookies[i].split('='),\n\t\t\t\tname = decode(parts.shift()),\n\t\t\t\tcookie = parts.join('=');\n\n\t\t\tif (key === name) {\n\t\t\t\t// If second argument (value) is a function it's a converter...\n\t\t\t\tresult = read(cookie, value);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Prevent storing a cookie that we couldn't decode.\n\t\t\tif (!key && (cookie = read(cookie)) !== undefined) {\n\t\t\t\tresult[name] = cookie;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tconfig.defaults = {};\n\n\t$.removeCookie = function (key, options) {\n\t\t// Must not alter options, thus extending a fresh object...\n\t\t$.cookie(key, '', $.extend({}, options, { expires: -1 }));\n\t\treturn !$.cookie(key);\n\t};\n\n}));\n"
  },
  {
    "path": "public_html/media/js/jquery.farbtastic.js",
    "content": "// Farbtastic 2.0.0-alpha.1\n(function ($) {\n\nvar __debug = false;\n\n$.fn.farbtastic = function (options) {\n  $.farbtastic(this, options);\n  return this;\n};\n\n$.farbtastic = function (container, options) {\n  var container = $(container)[0];\n  return container.farbtastic || (container.farbtastic = new $._farbtastic(container, options));\n}\n\n$._farbtastic = function (container, options) {\n  var fb = this;\n\n  /////////////////////////////////////////////////////\n\n  /**\n   * Link to the given element(s) or callback.\n   */\n  fb.linkTo = function (callback) {\n    // Unbind previous nodes\n    if (typeof fb.callback == 'object') {\n      $(fb.callback).unbind('keyup', fb.updateValue);\n    }\n\n    // Reset color\n    fb.color = null;\n\n    // Bind callback or elements\n    if (typeof callback == 'function') {\n      fb.callback = callback;\n    }\n    else if (typeof callback == 'object' || typeof callback == 'string') {\n      fb.callback = $(callback);\n      fb.callback.bind('keyup', fb.updateValue);\n      if (fb.callback[0].value) {\n        fb.setColor(fb.callback[0].value);\n      }\n    }\n    return this;\n  }\n  fb.updateValue = function (event) {\n    if (this.value && this.value != fb.color) {\n      fb.setColor(this.value);\n    }\n  }\n\n  /**\n   * Change color with HTML syntax #123456\n   */\n  fb.setColor = function (color) {\n    var unpack = fb.unpack(color);\n    if (fb.color != color && unpack) {\n      fb.color = color;\n      fb.rgb = unpack;\n      fb.hsl = fb.RGBToHSL(fb.rgb);\n      fb.updateDisplay();\n    }\n    return this;\n  }\n\n  /**\n   * Change color with HSL triplet [0..1, 0..1, 0..1]\n   */\n  fb.setHSL = function (hsl) {\n    fb.hsl = hsl;\n    fb.rgb = fb.HSLToRGB(hsl);\n    fb.color = fb.pack(fb.rgb);\n    fb.updateDisplay();\n    return this;\n  }\n\n  /////////////////////////////////////////////////////\n\n  /**\n   * Initialize the color picker widget.\n   */\n  fb.initWidget = function () {\n\n    // Insert markup and size accordingly.\n    var dim = {\n      width: options.width,\n      height: options.width\n    };\n    $(container)\n      .html(\n        '<div class=\"farbtastic\" style=\"position: relative\">' +\n          '<div class=\"farbtastic-solid\"></div>' +\n          '<canvas class=\"farbtastic-mask\"></canvas>' +\n          '<canvas class=\"farbtastic-overlay\"></canvas>' +\n        '</div>'\n      )\n      .find('*').attr(dim).css(dim).end()\n      .find('div>*').css('position', 'absolute');\n\n    // IE Fix: Recreate canvas elements with doc.createElement and excanvas.\n    $.browser.msie || false && $('canvas', container).each(function () {\n      // Fetch info.\n      var attr = { 'class': $(this).attr('class'), style: this.getAttribute('style') },\n          e = document.createElement('canvas');\n      // Replace element.\n      $(this).before($(e).attr(attr)).remove();\n      // Init with explorerCanvas.\n      G_vmlCanvasManager && G_vmlCanvasManager.initElement(e);\n      // Set explorerCanvas elements dimensions and absolute positioning.\n      $(e).attr(dim).css(dim).css('position', 'absolute')\n        .find('*').attr(dim).css(dim);\n    });\n\n    // Determine layout\n    fb.radius = (options.width - options.wheelWidth) / 2 - 1;\n    fb.square = Math.floor((fb.radius - options.wheelWidth / 2) * 0.7) - 1;\n    fb.mid = Math.floor(options.width / 2);\n    fb.markerSize = options.wheelWidth * 0.3;\n    fb.solidFill = $('.farbtastic-solid', container).css({\n      width: fb.square * 2 - 1,\n      height: fb.square * 2 - 1,\n      left: fb.mid - fb.square,\n      top: fb.mid - fb.square\n    });\n\n    // Set up drawing context.\n    fb.cnvMask = $('.farbtastic-mask', container);\n    fb.ctxMask = fb.cnvMask[0].getContext('2d');\n    fb.cnvOverlay = $('.farbtastic-overlay', container);\n    fb.ctxOverlay = fb.cnvOverlay[0].getContext('2d');\n    fb.ctxMask.translate(fb.mid, fb.mid);\n    fb.ctxOverlay.translate(fb.mid, fb.mid);\n\n    // Draw widget base layers.\n    fb.drawCircle();\n    fb.drawMask();\n  }\n\n  /**\n   * Draw the color wheel.\n   */\n  fb.drawCircle = function () {\n    var tm = +(new Date());\n    // Draw a hue circle with a bunch of gradient-stroked beziers.\n    // Have to use beziers, as gradient-stroked arcs don't work.\n    var n = 24,\n        r = fb.radius,\n        w = options.wheelWidth,\n        nudge = 8 / r / n * Math.PI, // Fudge factor for seams.\n        m = fb.ctxMask,\n        angle1 = 0, color1, d1;\n    m.save();\n    m.lineWidth = w / r;\n    m.scale(r, r);\n    // Each segment goes from angle1 to angle2.\n    for (var i = 0; i <= n; ++i) {\n      var d2 = i / n,\n          angle2 = d2 * Math.PI * 2,\n          // Endpoints\n          x1 = Math.sin(angle1), y1 = -Math.cos(angle1);\n          x2 = Math.sin(angle2), y2 = -Math.cos(angle2),\n          // Midpoint chosen so that the endpoints are tangent to the circle.\n          am = (angle1 + angle2) / 2,\n          tan = 1 / Math.cos((angle2 - angle1) / 2),\n          xm = Math.sin(am) * tan, ym = -Math.cos(am) * tan,\n          // New color\n          color2 = fb.pack(fb.HSLToRGB([d2, 1, 0.5]));\n      if (i > 0) {\n        if ($.browser.msie || false) {\n          // IE's gradient calculations mess up the colors. Correct along the diagonals.\n          var corr = (1 + Math.min(Math.abs(Math.tan(angle1)), Math.abs(Math.tan(Math.PI / 2 - angle1)))) / n;\n          color1 = fb.pack(fb.HSLToRGB([d1 - 0.15 * corr, 1, 0.5]));\n          color2 = fb.pack(fb.HSLToRGB([d2 + 0.15 * corr, 1, 0.5]));\n          // Create gradient fill between the endpoints.\n          var grad = m.createLinearGradient(x1, y1, x2, y2);\n          grad.addColorStop(0, color1);\n          grad.addColorStop(1, color2);\n          m.fillStyle = grad;\n          // Draw quadratic curve segment as a fill.\n          var r1 = (r + w / 2) / r, r2 = (r - w / 2) / r; // inner/outer radius.\n          m.beginPath();\n          m.moveTo(x1 * r1, y1 * r1);\n          m.quadraticCurveTo(xm * r1, ym * r1, x2 * r1, y2 * r1);\n          m.lineTo(x2 * r2, y2 * r2);\n          m.quadraticCurveTo(xm * r2, ym * r2, x1 * r2, y1 * r2);\n          m.fill();\n        }\n        else {\n          // Create gradient fill between the endpoints.\n          var grad = m.createLinearGradient(x1, y1, x2, y2);\n          grad.addColorStop(0, color1);\n          grad.addColorStop(1, color2);\n          m.strokeStyle = grad;\n          // Draw quadratic curve segment.\n          m.beginPath();\n          m.moveTo(x1, y1);\n          m.quadraticCurveTo(xm, ym, x2, y2);\n          m.stroke();\n        }\n      }\n      // Prevent seams where curves join.\n      angle1 = angle2 - nudge; color1 = color2; d1 = d2;\n    }\n    m.restore();\n    __debug && $('body').append('<div>drawCircle '+ (+(new Date()) - tm) +'ms');\n  };\n\n  /**\n   * Draw the saturation/luminance mask.\n   */\n  fb.drawMask = function () {\n    var tm = +(new Date());\n\n    // Iterate over sat/lum space and calculate appropriate mask pixel values.\n    var size = fb.square * 2, sq = fb.square;\n    function calculateMask(sizex, sizey, outputPixel) {\n      var isx = 1 / sizex, isy = 1 / sizey;\n      for (var y = 0; y <= sizey; ++y) {\n        var l = 1 - y * isy;\n        for (var x = 0; x <= sizex; ++x) {\n          var s = 1 - x * isx;\n          // From sat/lum to alpha and color (grayscale)\n          var a = 1 - 2 * Math.min(l * s, (1 - l) * s);\n          var c = (a > 0) ? ((2 * l - 1 + a) * .5 / a) : 0;\n          outputPixel(x, y, c, a);\n        }\n      }\n    }\n\n    // Method #1: direct pixel access (new Canvas).\n    if (fb.ctxMask.getImageData) {\n      // Create half-resolution buffer.\n      var sz = Math.floor(size / 2);\n      var buffer = document.createElement('canvas');\n      buffer.width = buffer.height = sz + 1;\n      var ctx = buffer.getContext('2d');\n      var frame = ctx.getImageData(0, 0, sz + 1, sz + 1);\n\n      var i = 0;\n      calculateMask(sz, sz, function (x, y, c, a) {\n        frame.data[i++] = frame.data[i++] = frame.data[i++] = c * 255;\n        frame.data[i++] = a * 255;\n      });\n\n      ctx.putImageData(frame, 0, 0);\n      fb.ctxMask.drawImage(buffer, 0, 0, sz + 1, sz + 1, -sq, -sq, sq * 2, sq * 2);\n    }\n    // Method #2: drawing commands (old Canvas).\n    else if (!($.browser.msie || false)) {\n      // Render directly at half-resolution\n      var sz = Math.floor(size / 2);\n      calculateMask(sz, sz, function (x, y, c, a) {\n        c = Math.round(c * 255);\n        fb.ctxMask.fillStyle = 'rgba(' + c + ', ' + c + ', ' + c + ', ' + a +')';\n        fb.ctxMask.fillRect(x * 2 - sq - 1, y * 2 - sq - 1, 2, 2);\n      });\n    }\n    // Method #3: vertical DXImageTransform gradient strips (IE).\n    else {\n      var cache_last, cache, w = 6; // Each strip is 6 pixels wide.\n      var sizex = Math.floor(size / w);\n      // 6 vertical pieces of gradient per strip.\n      calculateMask(sizex, 6, function (x, y, c, a) {\n        if (x == 0) {\n          cache_last = cache;\n          cache = [];\n        }\n        c = Math.round(c * 255);\n        a = Math.round(a * 255);\n        // We can only start outputting gradients once we have two rows of pixels.\n        if (y > 0) {\n          var c_last = cache_last[x][0],\n              a_last = cache_last[x][1],\n              color1 = fb.packDX(c_last, a_last),\n              color2 = fb.packDX(c, a),\n              y1 = Math.round(fb.mid + ((y - 1) * .333 - 1) * sq),\n              y2 = Math.round(fb.mid + (y * .333 - 1) * sq);\n          $('<div>').css({\n            position: 'absolute',\n            filter: \"progid:DXImageTransform.Microsoft.Gradient(StartColorStr=\"+ color1 +\", EndColorStr=\"+ color2 +\", GradientType=0)\",\n            top: y1,\n            height: y2 - y1,\n            // Avoid right-edge sticking out.\n            left: fb.mid + (x * w - sq - 1),\n            width: w - (x == sizex ? Math.round(w / 2) : 0)\n          }).appendTo(fb.cnvMask);\n        }\n        cache.push([c, a]);\n      });\n    }\n    __debug && $('body').append('<div>drawMask '+ (+(new Date()) - tm) +'ms');\n  }\n\n  /**\n   * Draw the selection markers.\n   */\n  fb.drawMarkers = function () {\n    // Determine marker dimensions\n    var sz = options.width, lw = Math.ceil(fb.markerSize / 4), r = fb.markerSize - lw + 1;\n    var angle = fb.hsl[0] * 6.28,\n        x1 =  Math.sin(angle) * fb.radius,\n        y1 = -Math.cos(angle) * fb.radius,\n        x2 = 2 * fb.square * (.5 - fb.hsl[1]),\n        y2 = 2 * fb.square * (.5 - fb.hsl[2]),\n        c1 = fb.invert ? '#fff' : '#000',\n        c2 = fb.invert ? '#000' : '#fff';\n    var circles = [\n      { x: x1, y: y1, r: r,             c: '#000', lw: lw + 1 },\n      { x: x1, y: y1, r: fb.markerSize, c: '#fff', lw: lw },\n      { x: x2, y: y2, r: r,             c: c2,     lw: lw + 1 },\n      { x: x2, y: y2, r: fb.markerSize, c: c1,     lw: lw },\n    ];\n\n    // Update the overlay canvas.\n    fb.ctxOverlay.clearRect(-fb.mid, -fb.mid, sz, sz);\n    for (var i = 0; i < circles.length; i++) {\n      var c = circles[i];\n      fb.ctxOverlay.lineWidth = c.lw;\n      fb.ctxOverlay.strokeStyle = c.c;\n      fb.ctxOverlay.beginPath();\n      fb.ctxOverlay.arc(c.x, c.y, c.r, 0, Math.PI * 2, true);\n      fb.ctxOverlay.stroke();\n    }\n  }\n\n  /**\n   * Update the markers and styles\n   */\n  fb.updateDisplay = function () {\n    // Determine whether labels/markers should invert.\n    fb.invert = (fb.rgb[0] * 0.3 + fb.rgb[1] * .59 + fb.rgb[2] * .11) <= 0.6;\n\n    // Update the solid background fill.\n    fb.solidFill.css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));\n\n    // Draw markers\n    fb.drawMarkers();\n\n    // Linked elements or callback\n    if (typeof fb.callback == 'object') {\n      // Set background/foreground color\n      $(fb.callback).css({\n        backgroundColor: fb.color,\n        color: fb.invert ? '#fff' : '#000'\n      });\n\n      // Change linked value\n      $(fb.callback).each(function() {\n        if ((typeof this.value == 'string') && this.value != fb.color) {\n          this.value = fb.color;\n        }\n      }).change();\n    }\n    else if (typeof fb.callback == 'function') {\n      fb.callback.call(fb, fb.color);\n    }\n  }\n\n  /**\n   * Helper for returning coordinates relative to the center.\n   */\n  fb.widgetCoords = function (event) {\n    return {\n      x: event.pageX - fb.offset.left - fb.mid,\n      y: event.pageY - fb.offset.top - fb.mid\n    };\n  }\n\n  /**\n   * Mousedown handler\n   */\n  fb.mousedown = function (event) {\n    // Capture mouse\n    if (!$._farbtastic.dragging) {\n      $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);\n      $._farbtastic.dragging = true;\n    }\n\n    // Update the stored offset for the widget.\n    fb.offset = $(container).offset();\n\n    // Check which area is being dragged\n    var pos = fb.widgetCoords(event);\n    fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) > (fb.square + 2);\n\n    // Process\n    fb.mousemove(event);\n    return false;\n  }\n\n  /**\n   * Mousemove handler\n   */\n  fb.mousemove = function (event) {\n    // Get coordinates relative to color picker center\n    var pos = fb.widgetCoords(event);\n\n    // Set new HSL parameters\n    if (fb.circleDrag) {\n      var hue = Math.atan2(pos.x, -pos.y) / 6.28;\n      fb.setHSL([(hue + 1) % 1, fb.hsl[1], fb.hsl[2]]);\n    }\n    else {\n      var sat = Math.max(0, Math.min(1, -(pos.x / fb.square / 2) + .5));\n      var lum = Math.max(0, Math.min(1, -(pos.y / fb.square / 2) + .5));\n      fb.setHSL([fb.hsl[0], sat, lum]);\n    }\n    return false;\n  }\n\n  /**\n   * Mouseup handler\n   */\n  fb.mouseup = function () {\n    // Uncapture mouse\n    $(document).unbind('mousemove', fb.mousemove);\n    $(document).unbind('mouseup', fb.mouseup);\n    $._farbtastic.dragging = false;\n  }\n\n  /* Various color utility functions */\n  fb.dec2hex = function (x) {\n    return (x < 16 ? '0' : '') + x.toString(16);\n  }\n\n  fb.packDX = function (c, a) {\n    return '#' + fb.dec2hex(a) + fb.dec2hex(c) + fb.dec2hex(c) + fb.dec2hex(c);\n  };\n\n  fb.pack = function (rgb) {\n    var r = Math.round(rgb[0] * 255);\n    var g = Math.round(rgb[1] * 255);\n    var b = Math.round(rgb[2] * 255);\n    return '#' + fb.dec2hex(r) + fb.dec2hex(g) + fb.dec2hex(b);\n  };\n\n  fb.unpack = function (color) {\n    if (color.length == 7) {\n      function x(i) {\n        return parseInt(color.substring(i, i + 2), 16) / 255;\n      }\n      return [ x(1), x(3), x(5) ];\n    }\n    else if (color.length == 4) {\n      function x(i) {\n        return parseInt(color.substring(i, i + 1), 16) / 15;\n      }\n      return [ x(1), x(2), x(3) ];\n    }\n  };\n\n  fb.HSLToRGB = function (hsl) {\n    var m1, m2, r, g, b;\n    var h = hsl[0], s = hsl[1], l = hsl[2];\n    m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;\n    m1 = l * 2 - m2;\n    return [\n      this.hueToRGB(m1, m2, h + 0.33333),\n      this.hueToRGB(m1, m2, h),\n      this.hueToRGB(m1, m2, h - 0.33333)\n    ];\n  };\n\n  fb.hueToRGB = function (m1, m2, h) {\n    h = (h + 1) % 1;\n    if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;\n    if (h * 2 < 1) return m2;\n    if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;\n    return m1;\n  };\n\n  fb.RGBToHSL = function (rgb) {\n    var r = rgb[0], g = rgb[1], b = rgb[2],\n        min = Math.min(r, g, b),\n        max = Math.max(r, g, b),\n        delta = max - min,\n        h = 0,\n        s = 0,\n        l = (min + max) / 2;\n    if (l > 0 && l < 1) {\n      s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));\n    }\n    if (delta > 0) {\n      if (max == r && max != g) h += (g - b) / delta;\n      if (max == g && max != b) h += (2 + (b - r) / delta);\n      if (max == b && max != r) h += (4 + (r - g) / delta);\n      h /= 6;\n    }\n    return [h, s, l];\n  };\n\n  // Parse options.\n  if (!options.callback) {\n    options = { callback: options };\n  }\n  options = $.extend({\n    width: 300,\n    wheelWidth: (options.width || 300) / 10,\n    callback: null\n  }, options);\n\n  // Initialize.\n  fb.initWidget();\n\n  // Install mousedown handler (the others are set on the document on-demand)\n  $('canvas.farbtastic-overlay', container).mousedown(fb.mousedown);\n\n  // Set linked elements/callback\n  if (options.callback) {\n    fb.linkTo(options.callback);\n  }\n  // Set to gray.\n  if (!fb.color) fb.setColor('#808080');\n}\n\n})(jQuery);\n"
  },
  {
    "path": "public_html/media/js/jquery.highcharts.js",
    "content": "/*\n Highcharts JS v4.1.5 (2015-04-13)\n\n (c) 2009-2014 Torstein Honsi\n\n License: www.highcharts.com/license\n*/\n(function(){function z(){var a,b=arguments,c,d={},e=function(a,b){var c,d;typeof a!==\"object\"&&(a={});for(d in b)b.hasOwnProperty(d)&&(c=b[d],a[d]=c&&typeof c===\"object\"&&Object.prototype.toString.call(c)!==\"[object Array]\"&&d!==\"renderTo\"&&typeof c.nodeType!==\"number\"?e(a[d]||{},c):b[d]);return a};b[0]===!0&&(d=b[1],b=Array.prototype.slice.call(b,2));c=b.length;for(a=0;a<c;a++)d=e(d,b[a]);return d}function B(a,b){return parseInt(a,b||10)}function Da(a){return typeof a===\"string\"}function ca(a){return a&&\ntypeof a===\"object\"}function Ha(a){return Object.prototype.toString.call(a)===\"[object Array]\"}function qa(a){return typeof a===\"number\"}function Ea(a){return V.log(a)/V.LN10}function ha(a){return V.pow(10,a)}function ia(a,b){for(var c=a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function s(a){return a!==u&&a!==null}function L(a,b,c){var d,e;if(Da(b))s(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(s(b)&&ca(b))for(d in b)a.setAttribute(d,b[d]);return e}function ra(a){return Ha(a)?\na:[a]}function F(a,b){if(ya&&!ba&&b&&b.opacity!==u)b.filter=\"alpha(opacity=\"+b.opacity*100+\")\";r(a.style,b)}function Z(a,b,c,d,e){a=A.createElement(a);b&&r(a,b);e&&F(a,{padding:0,border:R,margin:0});c&&F(a,c);d&&d.appendChild(a);return a}function ja(a,b){var c=function(){return u};c.prototype=new a;r(c.prototype,b);return c}function Ia(a,b){return Array((b||2)+1-String(a).length).join(0)+a}function Wa(a){return(eb&&eb(a)||nb||0)*6E4}function Ja(a,b){for(var c=\"{\",d=!1,e,f,g,h,i,j=[];(c=a.indexOf(c))!==\n-1;){e=a.slice(0,c);if(d){f=e.split(\":\");g=f.shift().split(\".\");i=g.length;e=b;for(h=0;h<i;h++)e=e[g[h]];if(f.length)f=f.join(\":\"),g=/\\.([0-9])/,h=P.lang,i=void 0,/f$/.test(f)?(i=(i=f.match(g))?i[1]:-1,e!==null&&(e=w.numberFormat(e,i,h.decimalPoint,f.indexOf(\",\")>-1?h.thousandsSep:\"\"))):e=Oa(f,e)}j.push(e);a=a.slice(c+1);c=(d=!d)?\"}\":\"{\"}j.push(a);return j.join(\"\")}function ob(a){return V.pow(10,U(V.log(a)/V.LN10))}function pb(a,b,c,d,e){var f,g=a,c=p(c,1);f=a/c;b||(b=[1,2,2.5,5,10],d===!1&&(c===\n1?b=[1,2,5,10]:c<=0.1&&(b=[1/c])));for(d=0;d<b.length;d++)if(g=b[d],e&&g*c>=a||!e&&f<=(b[d]+(b[d+1]||b[d]))/2)break;g*=c;return g}function qb(a,b){var c=a.length,d,e;for(e=0;e<c;e++)a[e].ss_i=e;a.sort(function(a,c){d=b(a,c);return d===0?a.ss_i-c.ss_i:d});for(e=0;e<c;e++)delete a[e].ss_i}function Pa(a){for(var b=a.length,c=a[0];b--;)a[b]<c&&(c=a[b]);return c}function Fa(a){for(var b=a.length,c=a[0];b--;)a[b]>c&&(c=a[b]);return c}function Qa(a,b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),\ndelete a[c]}function Ra(a){fb||(fb=Z(Ka));a&&fb.appendChild(a);fb.innerHTML=\"\"}function ka(a,b){var c=\"Highcharts error #\"+a+\": www.highcharts.com/errors/\"+a;if(b)throw c;H.console&&console.log(c)}function da(a){return parseFloat(a.toPrecision(14))}function Sa(a,b){za=p(a,b.animation)}function Cb(){var a=P.global,b=a.useUTC,c=b?\"getUTC\":\"get\",d=b?\"setUTC\":\"set\";Aa=a.Date||window.Date;nb=b&&a.timezoneOffset;eb=b&&a.getTimezoneOffset;gb=function(a,c,d,h,i,j){var k;b?(k=Aa.UTC.apply(0,arguments),k+=\nWa(k)):k=(new Aa(a,c,p(d,1),p(h,0),p(i,0),p(j,0))).getTime();return k};rb=c+\"Minutes\";sb=c+\"Hours\";tb=c+\"Day\";Xa=c+\"Date\";Ya=c+\"Month\";Za=c+\"FullYear\";Db=d+\"Milliseconds\";Eb=d+\"Seconds\";Fb=d+\"Minutes\";Gb=d+\"Hours\";ub=d+\"Date\";vb=d+\"Month\";wb=d+\"FullYear\"}function K(){}function Ta(a,b,c,d){this.axis=a;this.pos=b;this.type=c||\"\";this.isNew=!0;!c&&!d&&this.addLabel()}function Hb(a,b,c,d,e){var f=a.chart.inverted;this.axis=a;this.isNegative=c;this.options=b;this.x=d;this.total=null;this.points={};this.stack=\ne;this.alignOptions={align:b.align||(f?c?\"left\":\"right\":\"center\"),verticalAlign:b.verticalAlign||(f?\"middle\":c?\"bottom\":\"top\"),y:p(b.y,f?4:c?14:-6),x:p(b.x,f?c?-6:6:0)};this.textAlign=b.textAlign||(f?c?\"right\":\"left\":\"center\")}var u,A=document,H=window,V=Math,x=V.round,U=V.floor,sa=V.ceil,t=V.max,I=V.min,O=V.abs,W=V.cos,$=V.sin,la=V.PI,ga=la*2/360,Ba=navigator.userAgent,Ib=H.opera,ya=/(msie|trident)/i.test(Ba)&&!Ib,hb=A.documentMode===8,xb=/AppleWebKit/.test(Ba),La=/Firefox/.test(Ba),Jb=/(Mobile|Android|Windows Phone)/.test(Ba),\nCa=\"http://www.w3.org/2000/svg\",ba=!!A.createElementNS&&!!A.createElementNS(Ca,\"svg\").createSVGRect,Nb=La&&parseInt(Ba.split(\"Firefox/\")[1],10)<4,ea=!ba&&!ya&&!!A.createElement(\"canvas\").getContext,$a,ab,Kb={},yb=0,fb,P,Oa,za,zb,G,ma=function(){return u},X=[],bb=0,Ka=\"div\",R=\"none\",Ob=/^[0-9]+$/,ib=[\"plotTop\",\"marginRight\",\"marginBottom\",\"plotLeft\"],Pb=\"stroke-width\",Aa,gb,nb,eb,rb,sb,tb,Xa,Ya,Za,Db,Eb,Fb,Gb,ub,vb,wb,J={},w;w=H.Highcharts=H.Highcharts?ka(16,!0):{};w.seriesTypes=J;var r=w.extend=function(a,\nb){var c;a||(a={});for(c in b)a[c]=b[c];return a},p=w.pick=function(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],c!==u&&c!==null)return c},cb=w.wrap=function(a,b,c){var d=a[b];a[b]=function(){var a=Array.prototype.slice.call(arguments);a.unshift(d);return c.apply(this,a)}};Oa=function(a,b,c){if(!s(b)||isNaN(b))return\"Invalid date\";var a=p(a,\"%Y-%m-%d %H:%M:%S\"),d=new Aa(b-Wa(b)),e,f=d[sb](),g=d[tb](),h=d[Xa](),i=d[Ya](),j=d[Za](),k=P.lang,l=k.weekdays,d=r({a:l[g].substr(0,3),A:l[g],\nd:Ia(h),e:h,w:g,b:k.shortMonths[i],B:k.months[i],m:Ia(i+1),y:j.toString().substr(2,2),Y:j,H:Ia(f),I:Ia(f%12||12),l:f%12||12,M:Ia(d[rb]()),p:f<12?\"AM\":\"PM\",P:f<12?\"am\":\"pm\",S:Ia(d.getSeconds()),L:Ia(x(b%1E3),3)},w.dateFormats);for(e in d)for(;a.indexOf(\"%\"+e)!==-1;)a=a.replace(\"%\"+e,typeof d[e]===\"function\"?d[e](b):d[e]);return c?a.substr(0,1).toUpperCase()+a.substr(1):a};G={millisecond:1,second:1E3,minute:6E4,hour:36E5,day:864E5,week:6048E5,month:24192E5,year:314496E5};w.numberFormat=function(a,b,\nc,d){var e=P.lang,a=+a||0,f=b===-1?I((a.toString().split(\".\")[1]||\"\").length,20):isNaN(b=O(b))?2:b,b=c===void 0?e.decimalPoint:c,d=d===void 0?e.thousandsSep:d,e=a<0?\"-\":\"\",c=String(B(a=O(a).toFixed(f))),g=c.length>3?c.length%3:0;return e+(g?c.substr(0,g)+d:\"\")+c.substr(g).replace(/(\\d{3})(?=\\d)/g,\"$1\"+d)+(f?b+O(a-c).toFixed(f).slice(2):\"\")};zb={init:function(a,b,c){var b=b||\"\",d=a.shift,e=b.indexOf(\"C\")>-1,f=e?7:3,g,b=b.split(\" \"),c=[].concat(c),h,i,j=function(a){for(g=a.length;g--;)a[g]===\"M\"&&a.splice(g+\n1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(j(b),j(c));a.isArea&&(h=b.splice(b.length-6,6),i=c.splice(c.length-6,6));if(d<=c.length/f&&b.length===c.length)for(;d--;)c=[].concat(c).splice(0,f).concat(c);a.shift=0;if(b.length)for(a=c.length;b.length<a;)d=[].concat(b).splice(b.length-f,f),e&&(d[f-6]=d[f-2],d[f-5]=d[f-1]),b=b.concat(d);h&&(b=b.concat(h),c=c.concat(i));return[b,c]},step:function(a,b,c,d){var e=[],f=a.length;if(c===1)e=d;else if(f===b.length&&c<1)for(;f--;)d=parseFloat(a[f]),e[f]=isNaN(d)?a[f]:\nc*parseFloat(b[f]-d)+d;else e=b;return e}};(function(a){H.HighchartsAdapter=H.HighchartsAdapter||a&&{init:function(b){var c=a.fx;a.extend(a.easing,{easeOutQuad:function(a,b,c,g,h){return-g*(b/=h)*(b-2)+c}});a.each([\"cur\",\"_default\",\"width\",\"height\",\"opacity\"],function(b,e){var f=c.step,g;e===\"cur\"?f=c.prototype:e===\"_default\"&&a.Tween&&(f=a.Tween.propHooks[e],e=\"set\");(g=f[e])&&(f[e]=function(a){var c,a=b?a:this;if(a.prop!==\"align\")return c=a.elem,c.attr?c.attr(a.prop,e===\"cur\"?u:a.now):g.apply(this,\narguments)})});cb(a.cssHooks.opacity,\"get\",function(a,b,c){return b.attr?b.opacity||0:a.call(this,b,c)});this.addAnimSetter(\"d\",function(a){var c=a.elem,f;if(!a.started)f=b.init(c,c.d,c.toD),a.start=f[0],a.end=f[1],a.started=!0;c.attr(\"d\",b.step(a.start,a.end,a.pos,c.toD))});this.each=Array.prototype.forEach?function(a,b){return Array.prototype.forEach.call(a,b)}:function(a,b){var c,g=a.length;for(c=0;c<g;c++)if(b.call(a[c],a[c],c,a)===!1)return c};a.fn.highcharts=function(){var a=\"Chart\",b=arguments,\nc,g;if(this[0]){Da(b[0])&&(a=b[0],b=Array.prototype.slice.call(b,1));c=b[0];if(c!==u)c.chart=c.chart||{},c.chart.renderTo=this[0],new w[a](c,b[1]),g=this;c===u&&(g=X[L(this[0],\"data-highcharts-chart\")])}return g}},addAnimSetter:function(b,c){a.Tween?a.Tween.propHooks[b]={set:c}:a.fx.step[b]=c},getScript:a.getScript,inArray:a.inArray,adapterRun:function(b,c){return a(b)[c]()},grep:a.grep,map:function(a,c){for(var d=[],e=0,f=a.length;e<f;e++)d[e]=c.call(a[e],a[e],e,a);return d},offset:function(b){return a(b).offset()},\naddEvent:function(b,c,d){a(b).bind(c,d)},removeEvent:function(b,c,d){var e=A.removeEventListener?\"removeEventListener\":\"detachEvent\";A[e]&&b&&!b[e]&&(b[e]=function(){});a(b).unbind(c,d)},fireEvent:function(b,c,d,e){var f=a.Event(c),g=\"detached\"+c,h;!ya&&d&&(delete d.layerX,delete d.layerY,delete d.returnValue);r(f,d);b[c]&&(b[g]=b[c],b[c]=null);a.each([\"preventDefault\",\"stopPropagation\"],function(a,b){var c=f[b];f[b]=function(){try{c.call(f)}catch(a){b===\"preventDefault\"&&(h=!0)}}});a(b).trigger(f);\nb[g]&&(b[c]=b[g],b[g]=null);e&&!f.isDefaultPrevented()&&!h&&e(f)},washMouseEvent:function(a){var c=a.originalEvent||a;if(c.pageX===u)c.pageX=a.pageX,c.pageY=a.pageY;return c},animate:function(b,c,d){var e=a(b);if(!b.style)b.style={};if(c.d)b.toD=c.d,c.d=1;e.stop();c.opacity!==u&&b.attr&&(c.opacity+=\"px\");b.hasAnim=1;e.animate(c,d)},stop:function(b){b.hasAnim&&a(b).stop()}}})(H.jQuery);var T=H.HighchartsAdapter,D=T||{};T&&T.init.call(T,zb);var jb=D.adapterRun,Qb=D.getScript,Ma=D.inArray,m=w.each=D.each,\nkb=D.grep,Rb=D.offset,Ua=D.map,N=D.addEvent,Y=D.removeEvent,M=D.fireEvent,Sb=D.washMouseEvent,lb=D.animate,db=D.stop;P={colors:\"#7cb5ec,#434348,#90ed7d,#f7a35c,#8085e9,#f15c80,#e4d354,#2b908f,#f45b5b,#91e8e1\".split(\",\"),symbols:[\"circle\",\"diamond\",\"square\",\"triangle\",\"triangle-down\"],lang:{loading:\"Loading...\",months:\"January,February,March,April,May,June,July,August,September,October,November,December\".split(\",\"),shortMonths:\"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec\".split(\",\"),weekdays:\"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday\".split(\",\"),\ndecimalPoint:\".\",numericSymbols:\"k,M,G,T,P,E\".split(\",\"),resetZoom:\"Reset zoom\",resetZoomTitle:\"Reset zoom level 1:1\",thousandsSep:\" \"},global:{useUTC:!0,canvasToolsURL:\"http://code.highcharts.com/4.1.5/modules/canvas-tools.js\",VMLRadialGradientURL:\"http://code.highcharts.com/4.1.5/gfx/vml-radial-gradient.png\"},chart:{borderColor:\"#4572A7\",borderRadius:0,defaultSeriesType:\"line\",ignoreHiddenSeries:!0,spacing:[10,10,15,10],backgroundColor:\"#FFFFFF\",plotBorderColor:\"#C0C0C0\",resetZoomButton:{theme:{zIndex:20},\nposition:{align:\"right\",x:-10,y:10}}},title:{text:\"Chart title\",align:\"center\",margin:15,style:{color:\"#333333\",fontSize:\"18px\"}},subtitle:{text:\"\",align:\"center\",style:{color:\"#555555\"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1E3},events:{},lineWidth:2,marker:{lineWidth:0,radius:4,lineColor:\"#FFFFFF\",states:{hover:{enabled:!0,lineWidthPlus:1,radiusPlus:2},select:{fillColor:\"#FFFFFF\",lineColor:\"#000000\",lineWidth:2}}},point:{events:{}},dataLabels:{align:\"center\",\nformatter:function(){return this.y===null?\"\":w.numberFormat(this.y,-1)},style:{color:\"contrast\",fontSize:\"11px\",fontWeight:\"bold\",textShadow:\"0 0 6px contrast, 0 0 3px contrast\"},verticalAlign:\"bottom\",x:0,y:0,padding:5},cropThreshold:300,pointRange:0,states:{hover:{lineWidthPlus:1,marker:{},halo:{size:10,opacity:0.25}},select:{marker:{}}},stickyTracking:!0,turboThreshold:1E3}},labels:{style:{position:\"absolute\",color:\"#3E576F\"}},legend:{enabled:!0,align:\"center\",layout:\"horizontal\",labelFormatter:function(){return this.name},\nborderColor:\"#909090\",borderRadius:0,navigation:{activeColor:\"#274b6d\",inactiveColor:\"#CCC\"},shadow:!1,itemStyle:{color:\"#333333\",fontSize:\"12px\",fontWeight:\"bold\"},itemHoverStyle:{color:\"#000\"},itemHiddenStyle:{color:\"#CCC\"},itemCheckboxStyle:{position:\"absolute\",width:\"13px\",height:\"13px\"},symbolPadding:5,verticalAlign:\"bottom\",x:0,y:0,title:{style:{fontWeight:\"bold\"}}},loading:{labelStyle:{fontWeight:\"bold\",position:\"relative\",top:\"45%\"},style:{position:\"absolute\",backgroundColor:\"white\",opacity:0.5,\ntextAlign:\"center\"}},tooltip:{enabled:!0,animation:ba,backgroundColor:\"rgba(249, 249, 249, .85)\",borderWidth:1,borderRadius:3,dateTimeLabelFormats:{millisecond:\"%A, %b %e, %H:%M:%S.%L\",second:\"%A, %b %e, %H:%M:%S\",minute:\"%A, %b %e, %H:%M\",hour:\"%A, %b %e, %H:%M\",day:\"%A, %b %e, %Y\",week:\"Week from %A, %b %e, %Y\",month:\"%B %Y\",year:\"%Y\"},footerFormat:\"\",headerFormat:'<span style=\"font-size: 10px\">{point.key}</span><br/>',pointFormat:'<span style=\"color:{point.color}\">\\u25CF</span> {series.name}: <b>{point.y}</b><br/>',\nshadow:!0,snap:Jb?25:10,style:{color:\"#333333\",cursor:\"default\",fontSize:\"12px\",padding:\"8px\",whiteSpace:\"nowrap\"}},credits:{enabled:!0,text:\"Highcharts.com\",href:\"http://www.highcharts.com\",position:{align:\"right\",x:-10,verticalAlign:\"bottom\",y:-5},style:{cursor:\"pointer\",color:\"#909090\",fontSize:\"9px\"}}};var aa=P.plotOptions,T=aa.line;Cb();var Tb=/rgba\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]?(?:\\.[0-9]+)?)\\s*\\)/,Ub=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,\nVb=/rgb\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/,na=function(a){var b=[],c,d;(function(a){a&&a.stops?d=Ua(a.stops,function(a){return na(a[1])}):(c=Tb.exec(a))?b=[B(c[1]),B(c[2]),B(c[3]),parseFloat(c[4],10)]:(c=Ub.exec(a))?b=[B(c[1],16),B(c[2],16),B(c[3],16),1]:(c=Vb.exec(a))&&(b=[B(c[1]),B(c[2]),B(c[3]),1])})(a);return{get:function(c){var f;d?(f=z(a),f.stops=[].concat(f.stops),m(d,function(a,b){f.stops[b]=[f.stops[b][0],a.get(c)]})):f=b&&!isNaN(b[0])?c===\"rgb\"?\"rgb(\"+b[0]+\",\"+\nb[1]+\",\"+b[2]+\")\":c===\"a\"?b[3]:\"rgba(\"+b.join(\",\")+\")\":a;return f},brighten:function(a){if(d)m(d,function(b){b.brighten(a)});else if(qa(a)&&a!==0){var c;for(c=0;c<3;c++)b[c]+=B(a*255),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this},rgba:b,setOpacity:function(a){b[3]=a;return this},raw:a}};K.prototype={opacity:1,textProps:\"fontSize,fontWeight,fontFamily,fontStyle,color,lineHeight,width,textDecoration,textShadow\".split(\",\"),init:function(a,b){this.element=b===\"span\"?Z(b):A.createElementNS(Ca,b);\nthis.renderer=a},animate:function(a,b,c){b=p(b,za,!0);db(this);if(b){b=z(b,{});if(c)b.complete=c;lb(this,a,b)}else this.attr(a),c&&c();return this},colorGradient:function(a,b,c){var d=this.renderer,e,f,g,h,i,j,k,l,n,o,q=[];a.linearGradient?f=\"linearGradient\":a.radialGradient&&(f=\"radialGradient\");if(f){g=a[f];h=d.gradients;j=a.stops;n=c.radialReference;Ha(g)&&(a[f]=g={x1:g[0],y1:g[1],x2:g[2],y2:g[3],gradientUnits:\"userSpaceOnUse\"});f===\"radialGradient\"&&n&&!s(g.gradientUnits)&&(g=z(g,{cx:n[0]-n[2]/\n2+g.cx*n[2],cy:n[1]-n[2]/2+g.cy*n[2],r:g.r*n[2],gradientUnits:\"userSpaceOnUse\"}));for(o in g)o!==\"id\"&&q.push(o,g[o]);for(o in j)q.push(j[o]);q=q.join(\",\");h[q]?a=h[q].attr(\"id\"):(g.id=a=\"highcharts-\"+yb++,h[q]=i=d.createElement(f).attr(g).add(d.defs),i.stops=[],m(j,function(a){a[1].indexOf(\"rgba\")===0?(e=na(a[1]),k=e.get(\"rgb\"),l=e.get(\"a\")):(k=a[1],l=1);a=d.createElement(\"stop\").attr({offset:a[0],\"stop-color\":k,\"stop-opacity\":l}).add(i);i.stops.push(a)}));c.setAttribute(b,\"url(\"+d.url+\"#\"+a+\")\")}},\napplyTextShadow:function(a){var b=this.element,c,d=a.indexOf(\"contrast\")!==-1,e=this.renderer.forExport||b.style.textShadow!==u&&!ya;d&&(a=a.replace(/contrast/g,this.renderer.getContrast(b.style.fill)));e?d&&F(b,{textShadow:a}):(this.fakeTS=!0,this.ySetter=this.xSetter,c=[].slice.call(b.getElementsByTagName(\"tspan\")),m(a.split(/\\s?,\\s?/g),function(a){var d=b.firstChild,e,i,a=a.split(\" \");e=a[a.length-1];(i=a[a.length-2])&&m(c,function(a,c){var f;c===0&&(a.setAttribute(\"x\",b.getAttribute(\"x\")),c=b.getAttribute(\"y\"),\na.setAttribute(\"y\",c||0),c===null&&b.setAttribute(\"y\",0));f=a.cloneNode(1);L(f,{\"class\":\"highcharts-text-shadow\",fill:e,stroke:e,\"stroke-opacity\":1/t(B(i),3),\"stroke-width\":i,\"stroke-linejoin\":\"round\"});b.insertBefore(f,d)})}))},attr:function(a,b){var c,d,e=this.element,f,g=this,h;typeof a===\"string\"&&b!==u&&(c=a,a={},a[c]=b);if(typeof a===\"string\")g=(this[a+\"Getter\"]||this._defaultGetter).call(this,a,e);else{for(c in a){d=a[c];h=!1;this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(c)&&\n(f||(this.symbolAttr(a),f=!0),h=!0);if(this.rotation&&(c===\"x\"||c===\"y\"))this.doTransform=!0;h||(this[c+\"Setter\"]||this._defaultSetter).call(this,d,c,e);this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(c)&&this.updateShadows(c,d)}if(this.doTransform)this.updateTransform(),this.doTransform=!1}return g},updateShadows:function(a,b){for(var c=this.shadows,d=c.length;d--;)c[d].setAttribute(a,a===\"height\"?t(b-(c[d].cutHeight||0),0):a===\"d\"?this.d:b)},addClass:function(a){var b=this.element,\nc=L(b,\"class\")||\"\";c.indexOf(a)===-1&&L(b,\"class\",c+\" \"+a);return this},symbolAttr:function(a){var b=this;m(\"x,y,r,start,end,width,height,innerR,anchorX,anchorY\".split(\",\"),function(c){b[c]=p(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr(\"clip-path\",a?\"url(\"+this.renderer.url+\"#\"+a.id+\")\":R)},crisp:function(a){var b,c={},d,e=a.strokeWidth||this.strokeWidth||0;d=x(e)%2/2;a.x=U(a.x||this.x||0)+d;a.y=U(a.y||this.y||0)+d;a.width=\nU((a.width||this.width||0)-2*d);a.height=U((a.height||this.height||0)-2*d);a.strokeWidth=e;for(b in a)this[b]!==a[b]&&(this[b]=c[b]=a[b]);return c},css:function(a){var b=this.styles,c={},d=this.element,e,f,g=\"\";e=!b;if(a&&a.color)a.fill=a.color;if(b)for(f in a)a[f]!==b[f]&&(c[f]=a[f],e=!0);if(e){e=this.textWidth=a&&a.width&&d.nodeName.toLowerCase()===\"text\"&&B(a.width)||this.textWidth;b&&(a=r(b,c));this.styles=a;e&&(ea||!ba&&this.renderer.forExport)&&delete a.width;if(ya&&!ba)F(this.element,a);else{b=\nfunction(a,b){return\"-\"+b.toLowerCase()};for(f in a)g+=f.replace(/([A-Z])/g,b)+\":\"+a[f]+\";\";L(d,\"style\",g)}e&&this.added&&this.renderer.buildText(this)}return this},on:function(a,b){var c=this,d=c.element;ab&&a===\"click\"?(d.ontouchstart=function(a){c.touchEventFired=Aa.now();a.preventDefault();b.call(d,a)},d.onclick=function(a){(Ba.indexOf(\"Android\")===-1||Aa.now()-(c.touchEventFired||0)>1100)&&b.call(d,a)}):d[\"on\"+a]=b;return this},setRadialReference:function(a){this.element.radialReference=a;return this},\ntranslate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(){this.inverted=!0;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.scaleX,d=this.scaleY,e=this.inverted,f=this.rotation,g=this.element;e&&(a+=this.attr(\"width\"),b+=this.attr(\"height\"));a=[\"translate(\"+a+\",\"+b+\")\"];e?a.push(\"rotate(90) scale(-1,1)\"):f&&a.push(\"rotate(\"+f+\" \"+(g.getAttribute(\"x\")||0)+\" \"+(g.getAttribute(\"y\")||0)+\")\");(s(c)||s(d))&&\na.push(\"scale(\"+p(c,1)+\" \"+p(d,1)+\")\");a.length&&g.setAttribute(\"transform\",a.join(\" \"))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,c){var d,e,f,g,h={};e=this.renderer;f=e.alignedObjects;if(a){if(this.alignOptions=a,this.alignByTranslate=b,!c||Da(c))this.alignTo=d=c||\"renderer\",ia(f,this),f.push(this),c=null}else a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo;c=p(c,e[d],e);d=a.align;e=a.verticalAlign;f=(c.x||0)+(a.x||0);g=(c.y||0)+\n(a.y||0);if(d===\"right\"||d===\"center\")f+=(c.width-(a.width||0))/{right:1,center:2}[d];h[b?\"translateX\":\"x\"]=x(f);if(e===\"bottom\"||e===\"middle\")g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1);h[b?\"translateY\":\"y\"]=x(g);this[this.placed?\"animate\":\"attr\"](h);this.placed=!0;this.alignAttr=h;return this},getBBox:function(a){var b,c=this.renderer,d,e=this.rotation,f=this.element,g=this.styles,h=e*ga;d=this.textStr;var i,j=f.style,k,l;d!==u&&(l=[\"\",e||0,g&&g.fontSize,f.style.width].join(\",\"),l=d===\n\"\"||Ob.test(d)?\"num:\"+d.toString().length+l:d+l);l&&!a&&(b=c.cache[l]);if(!b){if(f.namespaceURI===Ca||c.forExport){try{k=this.fakeTS&&function(a){m(f.querySelectorAll(\".highcharts-text-shadow\"),function(b){b.style.display=a})},La&&j.textShadow?(i=j.textShadow,j.textShadow=\"\"):k&&k(R),b=f.getBBox?r({},f.getBBox()):{width:f.offsetWidth,height:f.offsetHeight},i?j.textShadow=i:k&&k(\"\")}catch(n){}if(!b||b.width<0)b={width:0,height:0}}else b=this.htmlGetBBox();if(c.isSVG){a=b.width;d=b.height;if(ya&&g&&\ng.fontSize===\"11px\"&&d.toPrecision(3)===\"16.9\")b.height=d=14;if(e)b.width=O(d*$(h))+O(a*W(h)),b.height=O(d*W(h))+O(a*$(h))}c.cache[l]=b}return b},show:function(a){a&&this.element.namespaceURI===Ca?this.element.removeAttribute(\"visibility\"):this.attr({visibility:a?\"inherit\":\"visible\"});return this},hide:function(){return this.attr({visibility:\"hidden\"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.attr({y:-9999})}})},add:function(a){var b=this.renderer,\nc=this.element,d;if(a)this.parentGroup=a;this.parentInverted=a&&a.inverted;this.textStr!==void 0&&b.buildText(this);this.added=!0;if(!a||a.handleZ||this.zIndex)d=this.zIndexSetter();d||(a?a.element:b.box).appendChild(c);if(this.onAdd)this.onAdd();return this},safeRemoveChild:function(a){var b=a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this,b=a.element||{},c=a.shadows,d=a.renderer.isSVG&&b.nodeName===\"SPAN\"&&a.parentGroup,e,f;b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=\nnull;db(a);if(a.clipPath)a.clipPath=a.clipPath.destroy();if(a.stops){for(f=0;f<a.stops.length;f++)a.stops[f]=a.stops[f].destroy();a.stops=null}a.safeRemoveChild(b);for(c&&m(c,function(b){a.safeRemoveChild(b)});d&&d.div&&d.div.childNodes.length===0;)b=d.parentGroup,a.safeRemoveChild(d.div),delete d.div,d=b;a.alignTo&&ia(a.renderer.alignedObjects,a);for(e in a)delete a[e];return null},shadow:function(a,b,c){var d=[],e,f,g=this.element,h,i,j,k;if(a){i=p(a.width,3);j=(a.opacity||0.15)/i;k=this.parentInverted?\n\"(-1,-1)\":\"(\"+p(a.offsetX,1)+\", \"+p(a.offsetY,1)+\")\";for(e=1;e<=i;e++){f=g.cloneNode(0);h=i*2+1-2*e;L(f,{isShadow:\"true\",stroke:a.color||\"black\",\"stroke-opacity\":j*e,\"stroke-width\":h,transform:\"translate\"+k,fill:R});if(c)L(f,\"height\",t(L(f,\"height\")-h,0)),f.cutHeight=h;b?b.element.appendChild(f):g.parentNode.insertBefore(f,g);d.push(f)}this.shadows=d}return this},xGetter:function(a){this.element.nodeName===\"circle\"&&(a={x:\"cx\",y:\"cy\"}[a]||a);return this._defaultGetter(a)},_defaultGetter:function(a){a=\np(this[a],this.element?this.element.getAttribute(a):null,0);/^[\\-0-9\\.]+$/.test(a)&&(a=parseFloat(a));return a},dSetter:function(a,b,c){a&&a.join&&(a=a.join(\" \"));/(NaN| {2}|^$)/.test(a)&&(a=\"M 0 0\");c.setAttribute(b,a);this[b]=a},dashstyleSetter:function(a){var b;if(a=a&&a.toLowerCase()){a=a.replace(\"shortdashdotdot\",\"3,1,1,1,1,1,\").replace(\"shortdashdot\",\"3,1,1,1\").replace(\"shortdot\",\"1,1,\").replace(\"shortdash\",\"3,1,\").replace(\"longdash\",\"8,3,\").replace(/dot/g,\"1,3,\").replace(\"dash\",\"4,3,\").replace(/,$/,\n\"\").split(\",\");for(b=a.length;b--;)a[b]=B(a[b])*this[\"stroke-width\"];a=a.join(\",\").replace(\"NaN\",\"none\");this.element.setAttribute(\"stroke-dasharray\",a)}},alignSetter:function(a){this.element.setAttribute(\"text-anchor\",{left:\"start\",center:\"middle\",right:\"end\"}[a])},opacitySetter:function(a,b,c){this[b]=a;c.setAttribute(b,a)},titleSetter:function(a){var b=this.element.getElementsByTagName(\"title\")[0];b||(b=A.createElementNS(Ca,\"title\"),this.element.appendChild(b));b.textContent=String(p(a),\"\").replace(/<[^>]*>/g,\n\"\")},textSetter:function(a){if(a!==this.textStr)delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this)},fillSetter:function(a,b,c){typeof a===\"string\"?c.setAttribute(b,a):a&&this.colorGradient(a,b,c)},zIndexSetter:function(a,b){var c=this.renderer,d=this.parentGroup,c=(d||c).element||c.box,e,f,g=this.element,h;e=this.added;var i;s(a)&&(g.setAttribute(b,a),a=+a,this[b]===a&&(e=!1),this[b]=a);if(e){if((a=this.zIndex)&&d)d.handleZ=!0;d=c.childNodes;for(i=0;i<d.length&&!h;i++)if(e=\nd[i],f=L(e,\"zIndex\"),e!==g&&(B(f)>a||!s(a)&&s(f)))c.insertBefore(g,e),h=!0;h||c.appendChild(g)}return h},_defaultSetter:function(a,b,c){c.setAttribute(b,a)}};K.prototype.yGetter=K.prototype.xGetter;K.prototype.translateXSetter=K.prototype.translateYSetter=K.prototype.rotationSetter=K.prototype.verticalAlignSetter=K.prototype.scaleXSetter=K.prototype.scaleYSetter=function(a,b){this[b]=a;this.doTransform=!0};K.prototype[\"stroke-widthSetter\"]=K.prototype.strokeSetter=function(a,b,c){this[b]=a;if(this.stroke&&\nthis[\"stroke-width\"])this.strokeWidth=this[\"stroke-width\"],K.prototype.fillSetter.call(this,this.stroke,\"stroke\",c),c.setAttribute(\"stroke-width\",this[\"stroke-width\"]),this.hasStroke=!0;else if(b===\"stroke-width\"&&a===0&&this.hasStroke)c.removeAttribute(\"stroke\"),this.hasStroke=!1};var ta=function(){this.init.apply(this,arguments)};ta.prototype={Element:K,init:function(a,b,c,d,e){var f=location,g,d=this.createElement(\"svg\").attr({version:\"1.1\"}).css(this.getStyle(d));g=d.element;a.appendChild(g);\na.innerHTML.indexOf(\"xmlns\")===-1&&L(g,\"xmlns\",Ca);this.isSVG=!0;this.box=g;this.boxWrapper=d;this.alignedObjects=[];this.url=(La||xb)&&A.getElementsByTagName(\"base\").length?f.href.replace(/#.*?$/,\"\").replace(/([\\('\\)])/g,\"\\\\$1\").replace(/ /g,\"%20\"):\"\";this.createElement(\"desc\").add().element.appendChild(A.createTextNode(\"Created with Highcharts 4.1.5\"));this.defs=this.createElement(\"defs\").add();this.forExport=e;this.gradients={};this.cache={};this.setSize(b,c,!1);var h;if(La&&a.getBoundingClientRect)this.subPixelFix=\nb=function(){F(a,{left:0,top:0});h=a.getBoundingClientRect();F(a,{left:sa(h.left)-h.left+\"px\",top:sa(h.top)-h.top+\"px\"})},b(),N(H,\"resize\",b)},getStyle:function(a){return this.style=r({fontFamily:'\"Lucida Grande\", \"Lucida Sans Unicode\", Arial, Helvetica, sans-serif',fontSize:\"12px\"},a)},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();Qa(this.gradients||{});this.gradients=null;if(a)this.defs=a.destroy();\nthis.subPixelFix&&Y(H,\"resize\",this.subPixelFix);return this.alignedObjects=null},createElement:function(a){var b=new this.Element;b.init(this,a);return b},draw:function(){},buildText:function(a){for(var b=a.element,c=this,d=c.forExport,e=p(a.textStr,\"\").toString(),f=e.indexOf(\"<\")!==-1,g=b.childNodes,h,i,j=L(b,\"x\"),k=a.styles,l=a.textWidth,n=k&&k.lineHeight,o=k&&k.textShadow,q=k&&k.textOverflow===\"ellipsis\",y=g.length,S=l&&!a.added&&this.box,C=function(a){return n?B(n):c.fontMetrics(/(px|em)$/.test(a&&\na.style.fontSize)?a.style.fontSize:k&&k.fontSize||c.style.fontSize||12,a).h},v=function(a){return a.replace(/&lt;/g,\"<\").replace(/&gt;/g,\">\")};y--;)b.removeChild(g[y]);!f&&!o&&!q&&e.indexOf(\" \")===-1?b.appendChild(A.createTextNode(v(e))):(h=/<.*style=\"([^\"]+)\".*>/,i=/<.*href=\"(http[^\"]+)\".*>/,S&&S.appendChild(b),e=f?e.replace(/<(b|strong)>/g,'<span style=\"font-weight:bold\">').replace(/<(i|em)>/g,'<span style=\"font-style:italic\">').replace(/<a/g,\"<span\").replace(/<\\/(b|strong|i|em|a)>/g,\"</span>\").split(/<br.*?>/g):\n[e],e[e.length-1]===\"\"&&e.pop(),m(e,function(e,f){var g,n=0,e=e.replace(/<span/g,\"|||<span\").replace(/<\\/span>/g,\"</span>|||\");g=e.split(\"|||\");m(g,function(e){if(e!==\"\"||g.length===1){var o={},y=A.createElementNS(Ca,\"tspan\"),p;h.test(e)&&(p=e.match(h)[1].replace(/(;| |^)color([ :])/,\"$1fill$2\"),L(y,\"style\",p));i.test(e)&&!d&&(L(y,\"onclick\",'location.href=\"'+e.match(i)[1]+'\"'),F(y,{cursor:\"pointer\"}));e=v(e.replace(/<(.|\\n)*?>/g,\"\")||\" \");if(e!==\" \"){y.appendChild(A.createTextNode(e));if(n)o.dx=0;\nelse if(f&&j!==null)o.x=j;L(y,o);b.appendChild(y);!n&&f&&(!ba&&d&&F(y,{display:\"block\"}),L(y,\"dy\",C(y)));if(l){for(var o=e.replace(/([^\\^])-/g,\"$1- \").split(\" \"),m=g.length>1||f||o.length>1&&k.whiteSpace!==\"nowrap\",S,s,ua,u=[],t=C(y),x=1,r=a.rotation,z=e,w=z.length;(m||q)&&(o.length||u.length);)a.rotation=0,S=a.getBBox(!0),ua=S.width,!ba&&c.forExport&&(ua=c.measureSpanWidth(y.firstChild.data,a.styles)),S=ua>l,s===void 0&&(s=S),q&&s?(w/=2,z===\"\"||!S&&w<0.5?o=[]:(S&&(s=!0),z=e.substring(0,z.length+\n(S?-1:1)*sa(w)),o=[z+\"…\"],y.removeChild(y.firstChild))):!S||o.length===1?(o=u,u=[],o.length&&(x++,y=A.createElementNS(Ca,\"tspan\"),L(y,{dy:t,x:j}),p&&L(y,\"style\",p),b.appendChild(y)),ua>l&&(l=ua)):(y.removeChild(y.firstChild),u.unshift(o.pop())),o.length&&y.appendChild(A.createTextNode(o.join(\" \").replace(/- /g,\"-\")));s&&a.attr(\"title\",a.textStr);a.rotation=r}n++}}})}),S&&S.removeChild(b),o&&a.applyTextShadow&&a.applyTextShadow(o))},getContrast:function(a){a=na(a).rgba;return a[0]+a[1]+a[2]>384?\"#000\":\n\"#FFF\"},button:function(a,b,c,d,e,f,g,h,i){var j=this.label(a,b,c,i,null,null,null,null,\"button\"),k=0,l,n,o,q,y,p,a={x1:0,y1:0,x2:0,y2:1},e=z({\"stroke-width\":1,stroke:\"#CCCCCC\",fill:{linearGradient:a,stops:[[0,\"#FEFEFE\"],[1,\"#F6F6F6\"]]},r:2,padding:5,style:{color:\"black\"}},e);o=e.style;delete e.style;f=z(e,{stroke:\"#68A\",fill:{linearGradient:a,stops:[[0,\"#FFF\"],[1,\"#ACF\"]]}},f);q=f.style;delete f.style;g=z(e,{stroke:\"#68A\",fill:{linearGradient:a,stops:[[0,\"#9BD\"],[1,\"#CDF\"]]}},g);y=g.style;delete g.style;\nh=z(e,{style:{color:\"#CCC\"}},h);p=h.style;delete h.style;N(j.element,ya?\"mouseover\":\"mouseenter\",function(){k!==3&&j.attr(f).css(q)});N(j.element,ya?\"mouseout\":\"mouseleave\",function(){k!==3&&(l=[e,f,g][k],n=[o,q,y][k],j.attr(l).css(n))});j.setState=function(a){(j.state=k=a)?a===2?j.attr(g).css(y):a===3&&j.attr(h).css(p):j.attr(e).css(o)};return j.on(\"click\",function(){k!==3&&d.call(j)}).attr(e).css(r({cursor:\"default\"},o))},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=x(a[1])-b%2/2);a[2]===a[5]&&\n(a[2]=a[5]=x(a[2])+b%2/2);return a},path:function(a){var b={fill:R};Ha(a)?b.d=a:ca(a)&&r(b,a);return this.createElement(\"path\").attr(b)},circle:function(a,b,c){a=ca(a)?a:{x:a,y:b,r:c};b=this.createElement(\"circle\");b.xSetter=function(a){this.element.setAttribute(\"cx\",a)};b.ySetter=function(a){this.element.setAttribute(\"cy\",a)};return b.attr(a)},arc:function(a,b,c,d,e,f){if(ca(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x;a=this.symbol(\"arc\",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0});\na.r=c;return a},rect:function(a,b,c,d,e,f){var e=ca(a)?a.r:e,g=this.createElement(\"rect\"),a=ca(a)?a:a===u?{}:{x:a,y:b,width:t(c,0),height:t(d,0)};if(f!==u)a.strokeWidth=f,a=g.crisp(a);if(e)a.r=e;g.rSetter=function(a){L(this.element,{rx:a,ry:a})};return g.attr(a)},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[p(c,!0)?\"animate\":\"attr\"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement(\"g\");return s(a)?b.attr({\"class\":\"highcharts-\"+\na}):b},image:function(a,b,c,d,e){var f={preserveAspectRatio:R};arguments.length>1&&r(f,{x:b,y:c,width:d,height:e});f=this.createElement(\"image\").attr(f);f.element.setAttributeNS?f.element.setAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\",a):f.element.setAttribute(\"hc-svg-href\",a);return f},symbol:function(a,b,c,d,e,f){var g,h=this.symbols[a],h=h&&h(x(b),x(c),d,e,f),i=/^url\\((.*?)\\)$/,j,k;if(h)g=this.path(h),r(g,{symbolName:a,x:b,y:c,width:d,height:e}),f&&r(g,f);else if(i.test(a))k=function(a,b){a.element&&\n(a.attr({width:b[0],height:b[1]}),a.alignByTranslate||a.translate(x((d-b[0])/2),x((e-b[1])/2)))},j=a.match(i)[1],a=Kb[j]||f&&f.width&&f.height&&[f.width,f.height],g=this.image(j).attr({x:b,y:c}),g.isImg=!0,a?k(g,a):(g.attr({width:0,height:0}),Z(\"img\",{onload:function(){k(g,Kb[j]=[this.width,this.height])},src:j}));return g},symbols:{circle:function(a,b,c,d){var e=0.166*c;return[\"M\",a+c/2,b,\"C\",a+c+e,b,a+c+e,b+d,a+c/2,b+d,\"C\",a-e,b+d,a-e,b,a+c/2,b,\"Z\"]},square:function(a,b,c,d){return[\"M\",a,b,\"L\",\na+c,b,a+c,b+d,a,b+d,\"Z\"]},triangle:function(a,b,c,d){return[\"M\",a+c/2,b,\"L\",a+c,b+d,a,b+d,\"Z\"]},\"triangle-down\":function(a,b,c,d){return[\"M\",a,b,\"L\",a+c,b,a+c/2,b+d,\"Z\"]},diamond:function(a,b,c,d){return[\"M\",a+c/2,b,\"L\",a+c,b+d/2,a+c/2,b+d,a,b+d/2,\"Z\"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-0.001,d=e.innerR,h=e.open,i=W(f),j=$(f),k=W(g),g=$(g),e=e.end-f<la?0:1;return[\"M\",a+c*i,b+c*j,\"A\",c,c,0,e,1,a+c*k,b+c*g,h?\"M\":\"L\",a+d*k,b+d*g,\"A\",d,d,0,e,0,a+d*i,b+d*j,h?\"\":\"Z\"]},callout:function(a,\nb,c,d,e){var f=I(e&&e.r||0,c,d),g=f+6,h=e&&e.anchorX,i=e&&e.anchorY,e=x(e.strokeWidth||0)%2/2;a+=e;b+=e;e=[\"M\",a+f,b,\"L\",a+c-f,b,\"C\",a+c,b,a+c,b,a+c,b+f,\"L\",a+c,b+d-f,\"C\",a+c,b+d,a+c,b+d,a+c-f,b+d,\"L\",a+f,b+d,\"C\",a,b+d,a,b+d,a,b+d-f,\"L\",a,b+f,\"C\",a,b,a,b,a+f,b];h&&h>c&&i>b+g&&i<b+d-g?e.splice(13,3,\"L\",a+c,i-6,a+c+6,i,a+c,i+6,a+c,b+d-f):h&&h<0&&i>b+g&&i<b+d-g?e.splice(33,3,\"L\",a,i+6,a-6,i,a,i-6,a,b+f):i&&i>d&&h>a+g&&h<a+c-g?e.splice(23,3,\"L\",h+6,b+d,h,b+d+6,h-6,b+d,a+f,b+d):i&&i<0&&h>a+g&&h<a+c-g&&\ne.splice(3,3,\"L\",h-6,b,h,b-6,h+6,b,c-f,b);return e}},clipRect:function(a,b,c,d){var e=\"highcharts-\"+yb++,f=this.createElement(\"clipPath\").attr({id:e}).add(this.defs),a=this.rect(a,b,c,d,0).add(f);a.id=e;a.clipPath=f;a.count=0;return a},text:function(a,b,c,d){var e=ea||!ba&&this.forExport,f={};if(d&&!this.forExport)return this.html(a,b,c);f.x=Math.round(b||0);if(c)f.y=Math.round(c);if(a||a===0)f.text=a;a=this.createElement(\"text\").attr(f);e&&a.css({position:\"absolute\"});if(!d)a.xSetter=function(a,\nb,c){var d=c.getElementsByTagName(\"tspan\"),e,f=c.getAttribute(b),n;for(n=0;n<d.length;n++)e=d[n],e.getAttribute(b)===f&&e.setAttribute(b,a);c.setAttribute(b,a)};return a},fontMetrics:function(a,b){a=a||this.style.fontSize;if(b&&H.getComputedStyle)b=b.element||b,a=H.getComputedStyle(b,\"\").fontSize;var a=/px/.test(a)?B(a):/em/.test(a)?parseFloat(a)*12:12,c=a<24?a+3:x(a*1.2),d=x(c*0.8);return{h:c,b:d,f:a}},rotCorr:function(a,b,c){var d=a;b&&c&&(d=t(d*W(b*ga),4));return{x:-a/3*$(b*ga),y:d}},label:function(a,\nb,c,d,e,f,g,h,i){function j(){var a,b;a=q.element.style;p=(fa===void 0||t===void 0||o.styles.textAlign)&&s(q.textStr)&&q.getBBox();o.width=(fa||p.width||0)+2*v+ua;o.height=(t||p.height||0)+2*v;I=v+n.fontMetrics(a&&a.fontSize,q).b;if(D){if(!y)a=x(-C*v),b=h?-I:0,o.box=y=d?n.symbol(d,a,b,o.width,o.height,E):n.rect(a,b,o.width,o.height,0,E[Pb]),y.attr(\"fill\",R).add(o);y.isImg||y.attr(r({width:x(o.width),height:x(o.height)},E));E=null}}function k(){var a=o.styles,a=a&&a.textAlign,b=ua+v*(1-C),c;c=h?0:\nI;if(s(fa)&&p&&(a===\"center\"||a===\"right\"))b+={center:0.5,right:1}[a]*(fa-p.width);if(b!==q.x||c!==q.y)q.attr(\"x\",b),c!==u&&q.attr(q.element.nodeName===\"SPAN\"?\"y\":\"translateY\",c);q.x=b;q.y=c}function l(a,b){y?y.attr(a,b):E[a]=b}var n=this,o=n.g(i),q=n.text(\"\",0,0,g).attr({zIndex:1}),y,p,C=0,v=3,ua=0,fa,t,w,A,B=0,E={},I,D;o.onAdd=function(){q.add(o);o.attr({text:a||a===0?a:\"\",x:b,y:c});y&&s(e)&&o.attr({anchorX:e,anchorY:f})};o.widthSetter=function(a){fa=a};o.heightSetter=function(a){t=a};o.paddingSetter=\nfunction(a){if(s(a)&&a!==v)v=o.padding=a,k()};o.paddingLeftSetter=function(a){s(a)&&a!==ua&&(ua=a,k())};o.alignSetter=function(a){C={left:0,center:0.5,right:1}[a]};o.textSetter=function(a){a!==u&&q.textSetter(a);j();k()};o[\"stroke-widthSetter\"]=function(a,b){a&&(D=!0);B=a%2/2;l(b,a)};o.strokeSetter=o.fillSetter=o.rSetter=function(a,b){b===\"fill\"&&a&&(D=!0);l(b,a)};o.anchorXSetter=function(a,b){e=a;l(b,a+B-w)};o.anchorYSetter=function(a,b){f=a;l(b,a-A)};o.xSetter=function(a){o.x=a;C&&(a-=C*((fa||p.width)+\nv));w=x(a);o.attr(\"translateX\",w)};o.ySetter=function(a){A=o.y=x(a);o.attr(\"translateY\",A)};var G=o.css;return r(o,{css:function(a){if(a){var b={},a=z(a);m(o.textProps,function(c){a[c]!==u&&(b[c]=a[c],delete a[c])});q.css(b)}return G.call(o,a)},getBBox:function(){return{width:p.width+2*v,height:p.height+2*v,x:p.x-v,y:p.y-v}},shadow:function(a){y&&y.shadow(a);return o},destroy:function(){Y(o.element,\"mouseenter\");Y(o.element,\"mouseleave\");q&&(q=q.destroy());y&&(y=y.destroy());K.prototype.destroy.call(o);\no=n=j=k=l=null}})}};$a=ta;r(K.prototype,{htmlCss:function(a){var b=this.element;if(b=a&&b.tagName===\"SPAN\"&&a.width)delete a.width,this.textWidth=b,this.updateTransform();if(a&&a.textOverflow===\"ellipsis\")a.whiteSpace=\"nowrap\",a.overflow=\"hidden\";this.styles=r(this.styles,a);F(this.element,a);return this},htmlGetBBox:function(){var a=this.element;if(a.nodeName===\"text\")a.style.position=\"absolute\";return{x:a.offsetLeft,y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}},htmlUpdateTransform:function(){if(this.added){var a=\nthis.renderer,b=this.element,c=this.translateX||0,d=this.translateY||0,e=this.x||0,f=this.y||0,g=this.textAlign||\"left\",h={left:0,center:0.5,right:1}[g],i=this.shadows,j=this.styles;F(b,{marginLeft:c,marginTop:d});i&&m(i,function(a){F(a,{marginLeft:c+1,marginTop:d+1})});this.inverted&&m(b.childNodes,function(c){a.invertChild(c,b)});if(b.tagName===\"SPAN\"){var k=this.rotation,l,n=B(this.textWidth),o=[k,g,b.innerHTML,this.textWidth].join(\",\");if(o!==this.cTT){l=a.fontMetrics(b.style.fontSize).b;s(k)&&\nthis.setSpanRotation(k,h,l);i=p(this.elemWidth,b.offsetWidth);if(i>n&&/[ \\-]/.test(b.textContent||b.innerText))F(b,{width:n+\"px\",display:\"block\",whiteSpace:j&&j.whiteSpace||\"normal\"}),i=n;this.getSpanCorrection(i,l,h,k,g)}F(b,{left:e+(this.xCorr||0)+\"px\",top:f+(this.yCorr||0)+\"px\"});if(xb)l=b.offsetHeight;this.cTT=o}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,c){var d={},e=ya?\"-ms-transform\":xb?\"-webkit-transform\":La?\"MozTransform\":Ib?\"-o-transform\":\"\";d[e]=d.transform=\"rotate(\"+a+\"deg)\";\nd[e+(La?\"Origin\":\"-origin\")]=d.transformOrigin=b*100+\"% \"+c+\"px\";F(this.element,d)},getSpanCorrection:function(a,b,c){this.xCorr=-a*c;this.yCorr=-b}});r(ta.prototype,{html:function(a,b,c){var d=this.createElement(\"span\"),e=d.element,f=d.renderer;d.textSetter=function(a){a!==e.innerHTML&&delete this.bBox;e.innerHTML=this.textStr=a};d.xSetter=d.ySetter=d.alignSetter=d.rotationSetter=function(a,b){b===\"align\"&&(b=\"textAlign\");d[b]=a;d.htmlUpdateTransform()};d.attr({text:a,x:x(b),y:x(c)}).css({position:\"absolute\",\nfontFamily:this.style.fontFamily,fontSize:this.style.fontSize});e.style.whiteSpace=\"nowrap\";d.css=d.htmlCss;if(f.isSVG)d.add=function(a){var b,c=f.box.parentNode,j=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)j.push(a),a=a.parentGroup;m(j.reverse(),function(a){var d;b=a.div=a.div||Z(Ka,{className:L(a.element,\"class\")},{position:\"absolute\",left:(a.translateX||0)+\"px\",top:(a.translateY||0)+\"px\"},b||c);d=b.style;r(a,{translateXSetter:function(b,c){d.left=b+\"px\";a[c]=b;a.doTransform=!0},translateYSetter:function(b,\nc){d.top=b+\"px\";a[c]=b;a.doTransform=!0},visibilitySetter:function(a,b){d[b]=a}})})}}else b=c;b.appendChild(e);d.added=!0;d.alignOnAdd&&d.htmlUpdateTransform();return d};return d}});if(!ba&&!ea){D={init:function(a,b){var c=[\"<\",b,' filled=\"f\" stroked=\"f\"'],d=[\"position: \",\"absolute\",\";\"],e=b===Ka;(b===\"shape\"||e)&&d.push(\"left:0;top:0;width:1px;height:1px;\");d.push(\"visibility: \",e?\"hidden\":\"visible\");c.push(' style=\"',d.join(\"\"),'\"/>');if(b)c=e||b===\"span\"||b===\"img\"?c.join(\"\"):a.prepVML(c),this.element=\nZ(c);this.renderer=a},add:function(a){var b=this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;a&&a.inverted&&b.invertChild(c,d);d.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();return this},updateTransform:K.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,b=W(a*ga),c=$(a*ga);F(this.element,{filter:a?[\"progid:DXImageTransform.Microsoft.Matrix(M11=\",b,\", M12=\",-c,\", M21=\",c,\", M22=\",b,\", sizingMethod='auto expand')\"].join(\"\"):\nR})},getSpanCorrection:function(a,b,c,d,e){var f=d?W(d*ga):1,g=d?$(d*ga):0,h=p(this.elemHeight,this.element.offsetHeight),i;this.xCorr=f<0&&-a;this.yCorr=g<0&&-h;i=f*g<0;this.xCorr+=g*b*(i?1-c:c);this.yCorr-=f*b*(d?i?c:1-c:1);e&&e!==\"left\"&&(this.xCorr-=a*c*(f<0?-1:1),d&&(this.yCorr-=h*c*(g<0?-1:1)),F(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)if(qa(a[b]))c[b]=x(a[b]*10)-5;else if(a[b]===\"Z\")c[b]=\"x\";else if(c[b]=a[b],a.isArc&&(a[b]===\"wa\"||a[b]===\"at\"))c[b+5]===\nc[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1);return c.join(\" \")||\"x\"},clip:function(a){var b=this,c;a?(c=a.members,ia(c,b),c.push(b),b.destroyClip=function(){ia(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:hb?\"inherit\":\"rect(auto)\"});return b.css(a)},css:K.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Ra(a)},destroy:function(){this.destroyClip&&this.destroyClip();return K.prototype.destroy.apply(this)},on:function(a,b){this.element[\"on\"+\na]=function(){var a=H.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);c=a.length;if(c===9||c===11)a[c-4]=a[c-2]=B(a[c-2])-10*b;return a.join(\" \")},shadow:function(a,b,c){var d=[],e,f=this.element,g=this.renderer,h,i=f.style,j,k=f.path,l,n,o,q;k&&typeof k.value!==\"string\"&&(k=\"x\");n=k;if(a){o=p(a.width,3);q=(a.opacity||0.15)/o;for(e=1;e<=3;e++){l=o*2+1-2*e;c&&(n=this.cutOffPath(k.value,l+0.5));j=['<shape isShadow=\"true\" strokeweight=\"',l,'\" filled=\"false\" path=\"',\nn,'\" coordsize=\"10 10\" style=\"',f.style.cssText,'\" />'];h=Z(g.prepVML(j),null,{left:B(i.left)+p(a.offsetX,1),top:B(i.top)+p(a.offsetY,1)});if(c)h.cutOff=l+1;j=['<stroke color=\"',a.color||\"black\",'\" opacity=\"',q*e,'\"/>'];Z(g.prepVML(j),null,null,h);b?b.element.appendChild(h):f.parentNode.insertBefore(h,f);d.push(h)}this.shadows=d}return this},updateShadows:ma,setAttr:function(a,b){hb?this.element[a]=b:this.element.setAttribute(a,b)},classSetter:function(a){this.element.className=a},dashstyleSetter:function(a,\nb,c){(c.getElementsByTagName(\"stroke\")[0]||Z(this.renderer.prepVML([\"<stroke/>\"]),null,null,c))[b]=a||\"solid\";this[b]=a},dSetter:function(a,b,c){var d=this.shadows,a=a||[];this.d=a.join&&a.join(\" \");c.path=a=this.pathToVML(a);if(d)for(c=d.length;c--;)d[c].path=d[c].cutOff?this.cutOffPath(a,d[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var d=c.nodeName;if(d===\"SPAN\")c.style.color=a;else if(d!==\"IMG\")c.filled=a!==R,this.setAttr(\"fillcolor\",this.renderer.color(a,c,b,this))},opacitySetter:ma,\nrotationSetter:function(a,b,c){c=c.style;this[b]=c[b]=a;c.left=-x($(a*ga)+1)+\"px\";c.top=x(W(a*ga))+\"px\"},strokeSetter:function(a,b,c){this.setAttr(\"strokecolor\",this.renderer.color(a,c,b))},\"stroke-widthSetter\":function(a,b,c){c.stroked=!!a;this[b]=a;qa(a)&&(a+=\"px\");this.setAttr(\"strokeweight\",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){a===\"inherit\"&&(a=\"visible\");this.shadows&&m(this.shadows,function(c){c.style[b]=a});c.nodeName===\"DIV\"&&(a=a===\"hidden\"?\"-999em\":\n0,hb||(c.style[b]=a?\"visible\":\"hidden\"),b=\"top\");c.style[b]=a},xSetter:function(a,b,c){this[b]=a;b===\"x\"?b=\"left\":b===\"y\"&&(b=\"top\");this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a,b,c){c.style[b]=a}};w.VMLElement=D=ja(K,D);D.prototype.ySetter=D.prototype.widthSetter=D.prototype.heightSetter=D.prototype.xSetter;var Na={Element:D,isIE8:Ba.indexOf(\"MSIE 8.0\")>-1,init:function(a,b,c,d){var e;this.alignedObjects=[];d=this.createElement(Ka).css(r(this.getStyle(d),\n{position:\"relative\"}));e=d.element;a.appendChild(d.element);this.isVML=!0;this.box=e;this.boxWrapper=d;this.cache={};this.setSize(b,c,!1);if(!A.namespaces.hcv){A.namespaces.add(\"hcv\",\"urn:schemas-microsoft-com:vml\");try{A.createStyleSheet().cssText=\"hcv\\\\:fill, hcv\\\\:path, hcv\\\\:shape, hcv\\\\:stroke{ behavior:url(#default#VML); display: inline-block; } \"}catch(f){A.styleSheets[0].cssText+=\"hcv\\\\:fill, hcv\\\\:path, hcv\\\\:shape, hcv\\\\:stroke{ behavior:url(#default#VML); display: inline-block; } \"}}},\nisHidden:function(){return!this.box.offsetWidth},clipRect:function(a,b,c,d){var e=this.createElement(),f=ca(a);return r(e,{members:[],count:0,left:(f?a.x:a)+1,top:(f?a.y:b)+1,width:(f?a.width:c)-1,height:(f?a.height:d)-1,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-(c===\"shape\"?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:\"rect(\"+x(a?e:d)+\"px,\"+x(a?f:b)+\"px,\"+x(a?b:f)+\"px,\"+x(a?d:e)+\"px)\"};!a&&hb&&c===\"DIV\"&&r(d,{width:b+\"px\",height:f+\"px\"});return d},\nupdateClipping:function(){m(e.members,function(a){a.element&&a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var e=this,f,g=/^rgba/,h,i,j=R;a&&a.linearGradient?i=\"gradient\":a&&a.radialGradient&&(i=\"pattern\");if(i){var k,l,n=a.linearGradient||a.radialGradient,o,q,y,p,C,v=\"\",a=a.stops,s,fa=[],t=function(){h=['<fill colors=\"'+fa.join(\",\")+'\" opacity=\"',y,'\" o:opacity2=\"',q,'\" type=\"',i,'\" ',v,'focus=\"100%\" method=\"any\" />'];Z(e.prepVML(h),null,null,b)};o=a[0];s=a[a.length-1];o[0]>0&&a.unshift([0,o[1]]);\ns[0]<1&&a.push([1,s[1]]);m(a,function(a,b){g.test(a[1])?(f=na(a[1]),k=f.get(\"rgb\"),l=f.get(\"a\")):(k=a[1],l=1);fa.push(a[0]*100+\"% \"+k);b?(y=l,p=k):(q=l,C=k)});if(c===\"fill\")if(i===\"gradient\")c=n.x1||n[0]||0,a=n.y1||n[1]||0,o=n.x2||n[2]||0,n=n.y2||n[3]||0,v='angle=\"'+(90-V.atan((n-a)/(o-c))*180/la)+'\"',t();else{var j=n.r,u=j*2,x=j*2,r=n.cx,E=n.cy,z=b.radialReference,w,j=function(){z&&(w=d.getBBox(),r+=(z[0]-w.x)/w.width-0.5,E+=(z[1]-w.y)/w.height-0.5,u*=z[2]/w.width,x*=z[2]/w.height);v='src=\"'+P.global.VMLRadialGradientURL+\n'\" size=\"'+u+\",\"+x+'\" origin=\"0.5,0.5\" position=\"'+r+\",\"+E+'\" color2=\"'+C+'\" ';t()};d.added?j():d.onAdd=j;j=p}else j=k}else if(g.test(a)&&b.tagName!==\"IMG\")f=na(a),h=[\"<\",c,' opacity=\"',f.get(\"a\"),'\"/>'],Z(this.prepVML(h),null,null,b),j=f.get(\"rgb\");else{j=b.getElementsByTagName(c);if(j.length)j[0].opacity=1,j[0].type=\"solid\";j=a}return j},prepVML:function(a){var b=this.isIE8,a=a.join(\"\");b?(a=a.replace(\"/>\",' xmlns=\"urn:schemas-microsoft-com:vml\" />'),a=a.indexOf('style=\"')===-1?a.replace(\"/>\",' style=\"display:inline-block;behavior:url(#default#VML);\" />'):\na.replace('style=\"','style=\"display:inline-block;behavior:url(#default#VML);')):a=a.replace(\"<\",\"<hcv:\");return a},text:ta.prototype.html,path:function(a){var b={coordsize:\"10 10\"};Ha(a)?b.d=a:ca(a)&&r(b,a);return this.createElement(\"shape\").attr(b)},circle:function(a,b,c){var d=this.symbol(\"circle\");if(ca(a))c=a.r,b=a.y,a=a.x;d.isCircle=!0;d.r=c;return d.attr({x:a,y:b})},g:function(a){var b;a&&(b={className:\"highcharts-\"+a,\"class\":\"highcharts-\"+a});return this.createElement(Ka).attr(b)},image:function(a,\nb,c,d,e){var f=this.createElement(\"img\").attr({src:a});arguments.length>1&&f.attr({x:b,y:c,width:d,height:e});return f},createElement:function(a){return a===\"rect\"?this.symbol(a):ta.prototype.createElement.call(this,a)},invertChild:function(a,b){var c=this,d=b.style,e=a.tagName===\"IMG\"&&a.style;F(a,{flip:\"x\",left:B(d.width)-(e?B(e.top):1),top:B(d.height)-(e?B(e.left):1),rotation:-90});m(a.childNodes,function(b){c.invertChild(b,a)})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c||\nd,c=e.innerR,d=W(f),i=$(f),j=W(g),k=$(g);if(g-f===0)return[\"x\"];f=[\"wa\",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*j,b+h*k];e.open&&!c&&f.push(\"e\",\"M\",a,b);f.push(\"at\",a-c,b-c,a+c,b+c,a+c*j,b+c*k,a+c*d,b+c*i,\"x\",\"e\");f.isArc=!0;return f},circle:function(a,b,c,d,e){e&&(c=d=2*e.r);e&&e.isCircle&&(a-=c/2,b-=d/2);return[\"wa\",a,b,a+c,b+d,a+c,b+d/2,a+c,b+d/2,\"e\"]},rect:function(a,b,c,d,e){return ta.prototype.symbols[!s(e)||!e.r?\"square\":\"callout\"].call(0,a,b,c,d,e)}}};w.VMLRenderer=D=function(){this.init.apply(this,\narguments)};D.prototype=z(ta.prototype,Na);$a=D}ta.prototype.measureSpanWidth=function(a,b){var c=A.createElement(\"span\"),d;d=A.createTextNode(a);c.appendChild(d);F(c,b);this.box.appendChild(c);d=c.offsetWidth;Ra(c);return d};var Lb;if(ea)w.CanVGRenderer=D=function(){Ca=\"http://www.w3.org/1999/xhtml\"},D.prototype.symbols={},Lb=function(){function a(){var a=b.length,d;for(d=0;d<a;d++)b[d]();b=[]}var b=[];return{push:function(c,d){b.length===0&&Qb(d,a);b.push(c)}}}(),$a=D;Ta.prototype={addLabel:function(){var a=\nthis.axis,b=a.options,c=a.chart,d=a.categories,e=a.names,f=this.pos,g=b.labels,h=a.tickPositions,i=f===h[0],j=f===h[h.length-1],e=d?p(d[f],e[f],f):f,d=this.label,h=h.info,k;a.isDatetimeAxis&&h&&(k=b.dateTimeLabelFormats[h.higherRanks[f]||h.unitName]);this.isFirst=i;this.isLast=j;b=a.labelFormatter.call({axis:a,chart:c,isFirst:i,isLast:j,dateTimeLabelFormat:k,value:a.isLog?da(ha(e)):e});s(d)?d&&d.attr({text:b}):(this.labelLength=(this.label=d=s(b)&&g.enabled?c.renderer.text(b,0,0,g.useHTML).css(z(g.style)).add(a.labelGroup):\nnull)&&d.getBBox().width,this.rotation=0)},getLabelSize:function(){return this.label?this.label.getBBox()[this.axis.horiz?\"height\":\"width\"]:0},handleOverflow:function(a){var b=this.axis,c=a.x,d=b.chart.chartWidth,e=b.chart.spacing,f=p(b.labelLeft,e[3]),e=p(b.labelRight,d-e[1]),g=this.label,h=this.rotation,i={left:0,center:0.5,right:1}[b.labelAlign],j=g.getBBox().width,k=b.slotWidth,l;if(h)h<0&&c-i*j<f?l=x(c/W(h*ga)-f):h>0&&c+i*j>e&&(l=x((d-c)/W(h*ga)));else{d=c-i*j;c+=i*j;if(d<f)k-=f-d,a.x=f,g.attr({align:\"left\"});\nelse if(c>e)k-=c-e,a.x=e,g.attr({align:\"right\"});if(j>k||b.autoRotation&&g.styles.width)l=k}l&&g.css({width:l,textOverflow:\"ellipsis\"})},getPosition:function(a,b,c,d){var e=this.axis,f=e.chart,g=d&&f.oldChartHeight||f.chartHeight;return{x:a?e.translate(b+c,null,null,d)+e.transB:e.left+e.offset+(e.opposite?(d&&f.oldChartWidth||f.chartWidth)-e.right-e.left:0),y:a?g-e.bottom+e.offset-(e.opposite?e.height:0):g-e.translate(b+c,null,null,d)-e.transB}},getLabelPosition:function(a,b,c,d,e,f,g,h){var i=this.axis,\nj=i.transA,k=i.reversed,l=i.staggerLines,n=i.tickRotCorr||{x:0,y:0},c=p(e.y,n.y+(i.side===2?8:-(c.getBBox().height/2))),a=a+e.x+n.x-(f&&d?f*j*(k?-1:1):0),b=b+c-(f&&!d?f*j*(k?1:-1):0);l&&(b+=g/(h||1)%l*(i.labelOffset/l));return{x:a,y:x(b)}},getMarkPath:function(a,b,c,d,e,f){return f.crispLine([\"M\",a,b,\"L\",a+(e?0:-c),b+(e?c:0)],d)},render:function(a,b,c){var d=this.axis,e=d.options,f=d.chart.renderer,g=d.horiz,h=this.type,i=this.label,j=this.pos,k=e.labels,l=this.gridLine,n=h?h+\"Grid\":\"grid\",o=h?h+\n\"Tick\":\"tick\",q=e[n+\"LineWidth\"],y=e[n+\"LineColor\"],m=e[n+\"LineDashStyle\"],C=e[o+\"Length\"],n=e[o+\"Width\"]||0,v=e[o+\"Color\"],s=e[o+\"Position\"],o=this.mark,fa=k.step,t=!0,x=d.tickmarkOffset,r=this.getPosition(g,j,x,b),w=r.x,r=r.y,z=g&&w===d.pos+d.len||!g&&r===d.pos?-1:1,c=p(c,1);this.isActive=!0;if(q){j=d.getPlotLinePath(j+x,q*z,b,!0);if(l===u){l={stroke:y,\"stroke-width\":q};if(m)l.dashstyle=m;if(!h)l.zIndex=1;if(b)l.opacity=0;this.gridLine=l=q?f.path(j).attr(l).add(d.gridGroup):null}if(!b&&l&&j)l[this.isNew?\n\"attr\":\"animate\"]({d:j,opacity:c})}if(n&&C)s===\"inside\"&&(C=-C),d.opposite&&(C=-C),h=this.getMarkPath(w,r,C,n*z,g,f),o?o.animate({d:h,opacity:c}):this.mark=f.path(h).attr({stroke:v,\"stroke-width\":n,opacity:c}).add(d.axisGroup);if(i&&!isNaN(w))i.xy=r=this.getLabelPosition(w,r,i,g,k,x,a,fa),this.isFirst&&!this.isLast&&!p(e.showFirstLabel,1)||this.isLast&&!this.isFirst&&!p(e.showLastLabel,1)?t=!1:g&&!d.isRadial&&!k.step&&!k.rotation&&!b&&c!==0&&this.handleOverflow(r),fa&&a%fa&&(t=!1),t&&!isNaN(r.y)?\n(r.opacity=c,i[this.isNew?\"attr\":\"animate\"](r),this.isNew=!1):i.attr(\"y\",-9999)},destroy:function(){Qa(this,this.axis)}};w.PlotLineOrBand=function(a,b){this.axis=a;if(b)this.options=b,this.id=b.id};w.PlotLineOrBand.prototype={render:function(){var a=this,b=a.axis,c=b.horiz,d=a.options,e=d.label,f=a.label,g=d.width,h=d.to,i=d.from,j=s(i)&&s(h),k=d.value,l=d.dashStyle,n=a.svgElem,o=[],q,y=d.color,p=d.zIndex,m=d.events,v={},t=b.chart.renderer;b.isLog&&(i=Ea(i),h=Ea(h),k=Ea(k));if(g){if(o=b.getPlotLinePath(k,\ng),v={stroke:y,\"stroke-width\":g},l)v.dashstyle=l}else if(j){o=b.getPlotBandPath(i,h,d);if(y)v.fill=y;if(d.borderWidth)v.stroke=d.borderColor,v[\"stroke-width\"]=d.borderWidth}else return;if(s(p))v.zIndex=p;if(n)if(o)n.animate({d:o},null,n.onGetPath);else{if(n.hide(),n.onGetPath=function(){n.show()},f)a.label=f=f.destroy()}else if(o&&o.length&&(a.svgElem=n=t.path(o).attr(v).add(),m))for(q in d=function(b){n.on(b,function(c){m[b].apply(a,[c])})},m)d(q);if(e&&s(e.text)&&o&&o.length&&b.width>0&&b.height>\n0){e=z({align:c&&j&&\"center\",x:c?!j&&4:10,verticalAlign:!c&&j&&\"middle\",y:c?j?16:10:j?6:-4,rotation:c&&!j&&90},e);if(!f){v={align:e.textAlign||e.align,rotation:e.rotation};if(s(p))v.zIndex=p;a.label=f=t.text(e.text,0,0,e.useHTML).attr(v).css(e.style).add()}b=[o[1],o[4],j?o[6]:o[1]];j=[o[2],o[5],j?o[7]:o[2]];o=Pa(b);c=Pa(j);f.align(e,!1,{x:o,y:c,width:Fa(b)-o,height:Fa(j)-c});f.show()}else f&&f.hide();return a},destroy:function(){ia(this.axis.plotLinesAndBands,this);delete this.axis;Qa(this)}};var va=\nw.Axis=function(){this.init.apply(this,arguments)};va.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:\"%H:%M:%S.%L\",second:\"%H:%M:%S\",minute:\"%H:%M\",hour:\"%H:%M\",day:\"%e. %b\",week:\"%e. %b\",month:\"%b '%y\",year:\"%Y\"},endOnTick:!1,gridLineColor:\"#D8D8D8\",labels:{enabled:!0,style:{color:\"#606060\",cursor:\"default\",fontSize:\"11px\"},x:0,y:15},lineColor:\"#C0D0E0\",lineWidth:1,minPadding:0.01,maxPadding:0.01,minorGridLineColor:\"#E0E0E0\",minorGridLineWidth:1,minorTickColor:\"#A0A0A0\",minorTickLength:2,\nminorTickPosition:\"outside\",startOfWeek:1,startOnTick:!1,tickColor:\"#C0D0E0\",tickLength:10,tickmarkPlacement:\"between\",tickPixelInterval:100,tickPosition:\"outside\",tickWidth:1,title:{align:\"middle\",style:{color:\"#707070\"}},type:\"linear\"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:\"Values\"},stackLabels:{enabled:!1,formatter:function(){return w.numberFormat(this.total,\n-1)},style:z(aa.line.dataLabels.style,{color:\"#000000\"})}},defaultLeftAxisOptions:{labels:{x:-15,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{autoRotation:[-45],x:0,y:null},title:{rotation:0}},defaultTopAxisOptions:{labels:{autoRotation:[-45],x:0,y:-15},title:{rotation:0}},init:function(a,b){var c=b.isX;this.horiz=a.inverted?!c:c;this.coll=(this.isXAxis=c)?\"xAxis\":\"yAxis\";this.opposite=b.opposite;this.side=b.side||\n(this.horiz?this.opposite?0:2:this.opposite?1:3);this.setOptions(b);var d=this.options,e=d.type;this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter;this.userOptions=b;this.minPixelPadding=0;this.chart=a;this.reversed=d.reversed;this.zoomEnabled=d.zoomEnabled!==!1;this.categories=d.categories||e===\"category\";this.names=this.names||[];this.isLog=e===\"logarithmic\";this.isDatetimeAxis=e===\"datetime\";this.isLinked=s(d.linkedTo);this.ticks={};this.labelEdge=[];this.minorTicks={};this.plotLinesAndBands=\n[];this.alternateBands={};this.len=0;this.minRange=this.userMinRange=d.minRange||d.maxZoom;this.range=d.range;this.offset=d.offset||0;this.stacks={};this.oldStacks={};this.min=this.max=null;this.crosshair=p(d.crosshair,ra(a.options.tooltip.crosshairs)[c?0:1],!1);var f,d=this.options.events;Ma(this,a.axes)===-1&&(c&&!this.isColorAxis?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this));this.series=this.series||[];if(a.inverted&&c&&this.reversed===u)this.reversed=!0;this.removePlotLine=\nthis.removePlotBand=this.removePlotBandOrLine;for(f in d)N(this,f,d[f]);if(this.isLog)this.val2lin=Ea,this.lin2val=ha},setOptions:function(a){this.options=z(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],z(P[this.coll],a))},defaultLabelFormatter:function(){var a=this.axis,b=this.value,c=a.categories,d=this.dateTimeLabelFormat,e=P.lang.numericSymbols,f=e&&e.length,\ng,h=a.options.labels.format,a=a.isLog?b:a.tickInterval;if(h)g=Ja(h,this);else if(c)g=b;else if(d)g=Oa(d,b);else if(f&&a>=1E3)for(;f--&&g===u;)c=Math.pow(1E3,f+1),a>=c&&e[f]!==null&&(g=w.numberFormat(b/c,-1)+e[f]);g===u&&(g=O(b)>=1E4?w.numberFormat(b,0):w.numberFormat(b,-1,u,\"\"));return g},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.ignoreMinPadding=a.ignoreMaxPadding=null;a.buildStacks&&a.buildStacks();m(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries){var d;\nd=c.options.threshold;var e;a.hasVisibleSeries=!0;a.isLog&&d<=0&&(d=null);if(a.isXAxis){if(d=c.xData,d.length)a.dataMin=I(p(a.dataMin,d[0]),Pa(d)),a.dataMax=t(p(a.dataMax,d[0]),Fa(d))}else{c.getExtremes();e=c.dataMax;c=c.dataMin;if(s(c)&&s(e))a.dataMin=I(p(a.dataMin,c),c),a.dataMax=t(p(a.dataMax,e),e);if(s(d))if(a.dataMin>=d)a.dataMin=d,a.ignoreMinPadding=!0;else if(a.dataMax<d)a.dataMax=d,a.ignoreMaxPadding=!0}}})},translate:function(a,b,c,d,e,f){var g=1,h=0,i=d?this.oldTransA:this.transA,d=d?this.oldMin:\nthis.min,j=this.minPixelPadding,e=(this.doPostTranslate||this.isLog&&e)&&this.lin2val;if(!i)i=this.transA;if(c)g*=-1,h=this.len;this.reversed&&(g*=-1,h-=g*(this.sector||this.len));b?(a=a*g+h,a-=j,a=a/i+d,e&&(a=this.lin2val(a))):(e&&(a=this.val2lin(a)),f===\"between\"&&(f=0.5),a=g*(a-d)*i+h+g*j+(qa(f)?i*f*this.pointRange:0));return a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-(b?0:this.pos),!0,!this.horiz,null,\n!0)},getPlotLinePath:function(a,b,c,d,e){var f=this.chart,g=this.left,h=this.top,i,j,k=c&&f.oldChartHeight||f.chartHeight,l=c&&f.oldChartWidth||f.chartWidth,n;i=this.transB;var o=function(a,b,c){if(a<b||a>c)d?a=I(t(b,a),c):n=!0;return a},e=p(e,this.translate(a,null,null,c)),a=c=x(e+i);i=j=x(k-e-i);isNaN(e)?n=!0:this.horiz?(i=h,j=k-this.bottom,a=c=o(a,g,g+this.width)):(a=g,c=l-this.right,i=j=o(i,h,h+this.height));return n&&!d?null:f.renderer.crispLine([\"M\",a,i,\"L\",c,j],b||1)},getLinearTickPositions:function(a,\nb,c){var d,e=da(U(b/a)*a),f=da(sa(c/a)*a),g=[];if(b===c&&qa(b))return[b];for(b=e;b<=f;){g.push(b);b=da(b+a);if(b===d)break;d=b}return g},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[],e,f=this.min;e=this.max;var g=e-f;if(g&&g/c<this.len/3)if(this.isLog){a=b.length;for(e=1;e<a;e++)d=d.concat(this.getLogTickPositions(c,b[e-1],b[e],!0))}else if(this.isDatetimeAxis&&a.minorTickInterval===\"auto\")d=d.concat(this.getTimeTicks(this.normalizeTimeTickInterval(c),\nf,e,a.startOfWeek));else for(b=f+(b[0]-f)%c;b<=e;b+=c)d.push(b);this.trimTicks(d);return d},adjustForMinRange:function(){var a=this.options,b=this.min,c=this.max,d,e=this.dataMax-this.dataMin>=this.minRange,f,g,h,i,j;if(this.isXAxis&&this.minRange===u&&!this.isLog)s(a.min)||s(a.max)?this.minRange=null:(m(this.series,function(a){i=a.xData;for(g=j=a.xIncrement?1:i.length-1;g>0;g--)if(h=i[g]-i[g-1],f===u||h<f)f=h}),this.minRange=I(f*5,this.dataMax-this.dataMin));if(c-b<this.minRange){var k=this.minRange;\nd=(k-c+b)/2;d=[b-d,p(a.min,b-d)];if(e)d[2]=this.dataMin;b=Fa(d);c=[b+k,p(a.max,b+k)];if(e)c[2]=this.dataMax;c=Pa(c);c-b<k&&(d[0]=c-k,d[1]=p(a.min,c-k),b=Fa(d))}this.min=b;this.max=c},setAxisTranslation:function(a){var b=this,c=b.max-b.min,d=b.axisPointRange||0,e,f=0,g=0,h=b.linkedParent,i=!!b.categories,j=b.transA,k=b.isXAxis;if(k||i||d)if(h?(f=h.minPointOffset,g=h.pointRangePadding):m(b.series,function(a){var h=i?1:k?a.pointRange:b.axisPointRange||0,j=a.options.pointPlacement,q=a.closestPointRange;\nh>c&&(h=0);d=t(d,h);b.single||(f=t(f,Da(j)?0:h/2),g=t(g,j===\"on\"?0:h));!a.noSharedTooltip&&s(q)&&(e=s(e)?I(e,q):q)}),h=b.ordinalSlope&&e?b.ordinalSlope/e:1,b.minPointOffset=f*=h,b.pointRangePadding=g*=h,b.pointRange=I(d,c),k)b.closestPointRange=e;if(a)b.oldTransA=j;b.translationSlope=b.transA=j=b.len/(c+g||1);b.transB=b.horiz?b.left:b.bottom;b.minPixelPadding=j*f},setTickInterval:function(a){var b=this,c=b.chart,d=b.options,e=b.isLog,f=b.isDatetimeAxis,g=b.isXAxis,h=b.isLinked,i=d.maxPadding,j=d.minPadding,\nk=d.tickInterval,l=d.tickPixelInterval,n=b.categories;!f&&!n&&!h&&this.getTickAmount();h?(b.linkedParent=c[b.coll][d.linkedTo],c=b.linkedParent.getExtremes(),b.min=p(c.min,c.dataMin),b.max=p(c.max,c.dataMax),d.type!==b.linkedParent.options.type&&ka(11,1)):(b.min=p(b.userMin,d.min,b.dataMin),b.max=p(b.userMax,d.max,b.dataMax));if(e)!a&&I(b.min,p(b.dataMin,b.min))<=0&&ka(10,1),b.min=da(Ea(b.min)),b.max=da(Ea(b.max));if(b.range&&s(b.max))b.userMin=b.min=t(b.min,b.max-b.range),b.userMax=b.max,b.range=\nnull;b.beforePadding&&b.beforePadding();b.adjustForMinRange();if(!n&&!b.axisPointRange&&!b.usePercentage&&!h&&s(b.min)&&s(b.max)&&(c=b.max-b.min)){if(!s(d.min)&&!s(b.userMin)&&j&&(b.dataMin<0||!b.ignoreMinPadding))b.min-=c*j;if(!s(d.max)&&!s(b.userMax)&&i&&(b.dataMax>0||!b.ignoreMaxPadding))b.max+=c*i}if(qa(d.floor))b.min=t(b.min,d.floor);if(qa(d.ceiling))b.max=I(b.max,d.ceiling);b.tickInterval=b.min===b.max||b.min===void 0||b.max===void 0?1:h&&!k&&l===b.linkedParent.options.tickPixelInterval?b.linkedParent.tickInterval:\np(k,this.tickAmount?(b.max-b.min)/t(this.tickAmount-1,1):void 0,n?1:(b.max-b.min)*l/t(b.len,l));g&&!a&&m(b.series,function(a){a.processData(b.min!==b.oldMin||b.max!==b.oldMax)});b.setAxisTranslation(!0);b.beforeSetTickPositions&&b.beforeSetTickPositions();if(b.postProcessTickInterval)b.tickInterval=b.postProcessTickInterval(b.tickInterval);if(b.pointRange)b.tickInterval=t(b.pointRange,b.tickInterval);a=p(d.minTickInterval,b.isDatetimeAxis&&b.closestPointRange);if(!k&&b.tickInterval<a)b.tickInterval=\na;if(!f&&!e&&!k)b.tickInterval=pb(b.tickInterval,null,ob(b.tickInterval),p(d.allowDecimals,!(b.tickInterval>0.5&&b.tickInterval<5&&b.max>1E3&&b.max<9999)),!!this.tickAmount);if(!this.tickAmount&&this.len)b.tickInterval=b.unsquish();this.setTickPositions()},setTickPositions:function(){var a=this.options,b,c=a.tickPositions,d=a.tickPositioner,e=a.startOnTick,f=a.endOnTick,g;this.tickmarkOffset=this.categories&&a.tickmarkPlacement===\"between\"&&this.tickInterval===1?0.5:0;this.minorTickInterval=a.minorTickInterval===\n\"auto\"&&this.tickInterval?this.tickInterval/5:a.minorTickInterval;this.tickPositions=b=a.tickPositions&&a.tickPositions.slice();if(!b&&(this.tickPositions=b=this.isDatetimeAxis?this.getTimeTicks(this.normalizeTimeTickInterval(this.tickInterval,a.units),this.min,this.max,a.startOfWeek,this.ordinalPositions,this.closestPointRange,!0):this.isLog?this.getLogTickPositions(this.tickInterval,this.min,this.max):this.getLinearTickPositions(this.tickInterval,this.min,this.max),d&&(d=d.apply(this,[this.min,\nthis.max]))))this.tickPositions=b=d;if(!this.isLinked)this.trimTicks(b,e,f),this.min===this.max&&s(this.min)&&!this.tickAmount&&(g=!0,this.min-=0.5,this.max+=0.5),this.single=g,!c&&!d&&this.adjustTickAmount()},trimTicks:function(a,b,c){var d=a[0],e=a[a.length-1],f=this.minPointOffset||0;b?this.min=d:this.min-f>d&&a.shift();c?this.max=e:this.max+f<e&&a.pop();a.length===0&&s(d)&&a.push((e+d)/2)},getTickAmount:function(){var a={},b,c=this.options,d=c.tickAmount,e=c.tickPixelInterval;!s(c.tickInterval)&&\nthis.len<e&&!this.isRadial&&!this.isLog&&c.startOnTick&&c.endOnTick&&(d=2);!d&&this.chart.options.chart.alignTicks!==!1&&c.alignTicks!==!1&&(m(this.chart[this.coll],function(c){var d=c.options,c=c.horiz,d=[c?d.left:d.top,c?d.width:d.height,d.pane].join(\",\");a[d]?b=!0:a[d]=1}),b&&(d=sa(this.len/e)+1));if(d<4)this.finalTickAmt=d,d=5;this.tickAmount=d},adjustTickAmount:function(){var a=this.tickInterval,b=this.tickPositions,c=this.tickAmount,d=this.finalTickAmt,e=b&&b.length;if(e<c){for(;b.length<c;)b.push(da(b[b.length-\n1]+a));this.transA*=(e-1)/(c-1);this.max=b[b.length-1]}else e>c&&(this.tickInterval*=2,this.setTickPositions());if(s(d)){for(a=c=b.length;a--;)(d===3&&a%2===1||d<=2&&a>0&&a<c-1)&&b.splice(a,1);this.finalTickAmt=u}},setScale:function(){var a=this.stacks,b,c,d,e;this.oldMin=this.min;this.oldMax=this.max;this.oldAxisLength=this.len;this.setAxisSize();e=this.len!==this.oldAxisLength;m(this.series,function(a){if(a.isDirtyData||a.isDirty||a.xAxis.isDirty)d=!0});if(e||d||this.isLinked||this.forceRedraw||\nthis.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax){if(!this.isXAxis)for(b in a)for(c in a[b])a[b][c].total=null,a[b][c].cum=0;this.forceRedraw=!1;this.getSeriesExtremes();this.setTickInterval();this.oldUserMin=this.userMin;this.oldUserMax=this.userMax;if(!this.isDirty)this.isDirty=e||this.min!==this.oldMin||this.max!==this.oldMax}else if(!this.isXAxis){if(this.oldStacks)a=this.stacks=this.oldStacks;for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total}},setExtremes:function(a,b,c,d,e){var f=\nthis,g=f.chart,c=p(c,!0);m(f.series,function(a){delete a.kdTree});e=r(e,{min:a,max:b});M(f,\"setExtremes\",e,function(){f.userMin=a;f.userMax=b;f.eventArgs=e;f.isDirtyExtremes=!0;c&&g.redraw(d)})},zoom:function(a,b){var c=this.dataMin,d=this.dataMax,e=this.options;this.allowZoomOutside||(s(c)&&a<=I(c,p(e.min,c))&&(a=u),s(d)&&b>=t(d,p(e.max,d))&&(b=u));this.displayBtn=a!==u||b!==u;this.setExtremes(a,b,!1,u,{trigger:\"zoom\"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||\n0,d=this.horiz,e=p(b.width,a.plotWidth-c+(b.offsetRight||0)),f=p(b.height,a.plotHeight),g=p(b.top,a.plotTop),b=p(b.left,a.plotLeft+c),c=/%$/;c.test(f)&&(f=parseFloat(f)/100*a.plotHeight);c.test(g)&&(g=parseFloat(g)/100*a.plotHeight+a.plotTop);this.left=b;this.top=g;this.width=e;this.height=f;this.bottom=a.chartHeight-f-g;this.right=a.chartWidth-e-b;this.len=t(d?e:f,0);this.pos=d?b:g},getExtremes:function(){var a=this.isLog;return{min:a?da(ha(this.min)):this.min,max:a?da(ha(this.max)):this.max,dataMin:this.dataMin,\ndataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?ha(this.min):this.min,b=b?ha(this.max):this.max;c>a||a===null?a=c:b<a&&(a=b);return this.translate(a,0,1,0,1)},autoLabelAlign:function(a){a=(p(a,0)-this.side*90+720)%360;return a>15&&a<165?\"right\":a>195&&a<345?\"left\":\"center\"},unsquish:function(){var a=this.ticks,b=this.options.labels,c=this.horiz,d=this.tickInterval,e=d,f=this.len/(((this.categories?1:0)+this.max-this.min)/d),g,h=b.rotation,\ni=this.chart.renderer.fontMetrics(b.style.fontSize,a[0]&&a[0].label),j,k=Number.MAX_VALUE,l,n=function(a){a/=f||1;a=a>1?sa(a):1;return a*d};c?(l=s(h)?[h]:f<p(b.autoRotationLimit,80)&&!b.staggerLines&&!b.step&&b.autoRotation)&&m(l,function(a){var b;if(a===h||a&&a>=-90&&a<=90)j=n(O(i.h/$(ga*a))),b=j+O(a/360),b<k&&(k=b,g=a,e=j)}):e=n(i.h);this.autoRotation=l;this.labelRotation=g;return e},renderUnsquish:function(){var a=this.chart,b=a.renderer,c=this.tickPositions,d=this.ticks,e=this.options.labels,\nf=this.horiz,g=a.margin,h=this.slotWidth=f&&!e.step&&!e.rotation&&(this.staggerLines||1)*a.plotWidth/c.length||!f&&(g[3]&&g[3]-a.spacing[3]||a.chartWidth*0.33),i=t(1,x(h-2*(e.padding||5))),j={},g=b.fontMetrics(e.style.fontSize,d[0]&&d[0].label),k,l=0;if(!Da(e.rotation))j.rotation=e.rotation;if(this.autoRotation)m(c,function(a){if((a=d[a])&&a.labelLength>l)l=a.labelLength}),l>i&&l>g.h?j.rotation=this.labelRotation:this.labelRotation=0;else if(h){k={width:i+\"px\",textOverflow:\"clip\"};for(h=c.length;!f&&\nh--;)if(i=c[h],i=d[i].label)if(i.styles.textOverflow===\"ellipsis\"&&i.css({textOverflow:\"clip\"}),i.getBBox().height>this.len/c.length-(g.h-g.f))i.specCss={textOverflow:\"ellipsis\"}}j.rotation&&(k={width:(l>a.chartHeight*0.5?a.chartHeight*0.33:a.chartHeight)+\"px\",textOverflow:\"ellipsis\"});this.labelAlign=j.align=e.align||this.autoLabelAlign(this.labelRotation);m(c,function(a){var b=(a=d[a])&&a.label;if(b)k&&b.css(z(k,b.specCss)),delete b.specCss,b.attr(j),a.rotation=j.rotation});this.tickRotCorr=b.rotCorr(g.b,\nthis.labelRotation||0,this.side===2)},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,j,k,l=0,n,o=0,q=d.title,y=d.labels,S=0,C=b.axisOffset,b=b.clipOffset,v=[-1,1,1,-1][h],r;a.hasData=j=a.hasVisibleSeries||s(a.min)&&s(a.max)&&!!e;a.showAxis=k=j||p(d.showEmpty,!0);a.staggerLines=a.horiz&&y.staggerLines;if(!a.axisGroup)a.gridGroup=c.g(\"grid\").attr({zIndex:d.gridZIndex||1}).add(),a.axisGroup=c.g(\"axis\").attr({zIndex:d.zIndex||\n2}).add(),a.labelGroup=c.g(\"axis-labels\").attr({zIndex:y.zIndex||7}).addClass(\"highcharts-\"+a.coll.toLowerCase()+\"-labels\").add();if(j||a.isLinked){if(m(e,function(b){f[b]?f[b].addLabel():f[b]=new Ta(a,b)}),a.renderUnsquish(),m(e,function(b){if(h===0||h===2||{1:\"left\",3:\"right\"}[h]===a.labelAlign)S=t(f[b].getLabelSize(),S)}),a.staggerLines)S*=a.staggerLines,a.labelOffset=S}else for(r in f)f[r].destroy(),delete f[r];if(q&&q.text&&q.enabled!==!1){if(!a.axisTitle)a.axisTitle=c.text(q.text,0,0,q.useHTML).attr({zIndex:7,\nrotation:q.rotation||0,align:q.textAlign||{low:\"left\",middle:\"center\",high:\"right\"}[q.align]}).addClass(\"highcharts-\"+this.coll.toLowerCase()+\"-title\").css(q.style).add(a.axisGroup),a.axisTitle.isNew=!0;if(k)l=a.axisTitle.getBBox()[g?\"height\":\"width\"],n=q.offset,o=s(n)?0:p(q.margin,g?5:10);a.axisTitle[k?\"show\":\"hide\"]()}a.offset=v*p(d.offset,C[h]);a.tickRotCorr=a.tickRotCorr||{x:0,y:0};c=h===2?a.tickRotCorr.y:0;g=S+o+(S&&v*(g?p(y.y,a.tickRotCorr.y+8):y.x)-c);a.axisTitleMargin=p(n,g);C[h]=t(C[h],a.axisTitleMargin+\nl+v*a.offset,g);b[i]=t(b[i],U(d.lineWidth/2)*2)},getLinePath:function(a){var b=this.chart,c=this.opposite,d=this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d,d=b.chartHeight-this.bottom-(c?this.height:0)+d;c&&(a*=-1);return b.renderer.crispLine([\"M\",e?this.left:f,e?d:this.top,\"L\",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=B(e.style.fontSize||\n12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*this.axisTitleMargin+(this.side===2?i:0);return{x:a?d:b+(g?this.width:0)+h+(e.x||0),y:a?b-(g?this.height:0)+h:d+(e.y||0)}},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.isLog,f=a.isLinked,g=a.tickPositions,h=a.axisTitle,i=a.ticks,j=a.minorTicks,k=a.alternateBands,l=d.stackLabels,n=d.alternateGridColor,o=a.tickmarkOffset,q=d.lineWidth,y,p=b.hasRendered&&s(a.oldMin)&&!isNaN(a.oldMin);\ny=a.hasData;var C=a.showAxis,v,r;a.labelEdge.length=0;a.overlap=!1;m([i,j,k],function(a){for(var b in a)a[b].isActive=!1});if(y||f){a.minorTickInterval&&!a.categories&&m(a.getMinorTickPositions(),function(b){j[b]||(j[b]=new Ta(a,b,\"minor\"));p&&j[b].isNew&&j[b].render(null,!0);j[b].render(null,!1,1)});if(g.length&&(m(g,function(b,c){if(!f||b>=a.min&&b<=a.max)i[b]||(i[b]=new Ta(a,b)),p&&i[b].isNew&&i[b].render(c,!0,0.1),i[b].render(c)}),o&&(a.min===0||a.single)))i[-1]||(i[-1]=new Ta(a,-1,null,!0)),\ni[-1].render(-1);n&&m(g,function(b,c){if(c%2===0&&b<a.max)k[b]||(k[b]=new w.PlotLineOrBand(a)),v=b+o,r=g[c+1]!==u?g[c+1]+o:a.max,k[b].options={from:e?ha(v):v,to:e?ha(r):r,color:n},k[b].render(),k[b].isActive=!0});if(!a._addedPlotLB)m((d.plotLines||[]).concat(d.plotBands||[]),function(b){a.addPlotBandOrLine(b)}),a._addedPlotLB=!0}m([i,j,k],function(a){var c,d,e=[],f=za?za.duration||500:0,g=function(){for(d=e.length;d--;)a[e[d]]&&!a[e[d]].isActive&&(a[e[d]].destroy(),delete a[e[d]])};for(c in a)if(!a[c].isActive)a[c].render(c,\n!1,0),a[c].isActive=!1,e.push(c);a===k||!b.hasRendered||!f?g():f&&setTimeout(g,f)});if(q)y=a.getLinePath(q),a.axisLine?a.axisLine.animate({d:y}):a.axisLine=c.path(y).attr({stroke:d.lineColor,\"stroke-width\":q,zIndex:7}).add(a.axisGroup),a.axisLine[C?\"show\":\"hide\"]();if(h&&C)h[h.isNew?\"attr\":\"animate\"](a.getTitlePosition()),h.isNew=!1;l&&l.enabled&&a.renderStackTotals();a.isDirty=!1},redraw:function(){this.render();m(this.plotLinesAndBands,function(a){a.render()});m(this.series,function(a){a.isDirty=\n!0})},destroy:function(a){var b=this,c=b.stacks,d,e=b.plotLinesAndBands;a||Y(b);for(d in c)Qa(c[d]),c[d]=null;m([b.ticks,b.minorTicks,b.alternateBands],function(a){Qa(a)});for(a=e.length;a--;)e[a].destroy();m(\"stackTotalGroup,axisLine,axisTitle,axisGroup,cross,gridGroup,labelGroup\".split(\",\"),function(a){b[a]&&(b[a]=b[a].destroy())});this.cross&&this.cross.destroy()},drawCrosshair:function(a,b){var c,d=this.crosshair,e=d.animation;if(!this.crosshair||(s(b)||!p(this.crosshair.snap,!0))===!1)this.hideCrosshair();\nelse if(p(d.snap,!0)?s(b)&&(c=this.isXAxis?b.plotX:this.len-b.plotY):c=this.horiz?a.chartX-this.pos:this.len-a.chartY+this.pos,c=this.isRadial?this.getPlotLinePath(this.isXAxis?b.x:p(b.stackY,b.y))||null:this.getPlotLinePath(null,null,null,null,c)||null,c===null)this.hideCrosshair();else if(this.cross)this.cross.attr({visibility:\"visible\"})[e?\"animate\":\"attr\"]({d:c},e);else{e=this.categories&&!this.isRadial;e={\"stroke-width\":d.width||(e?this.transA:1),stroke:d.color||(e?\"rgba(155,200,255,0.2)\":\"#C0C0C0\"),\nzIndex:d.zIndex||2};if(d.dashStyle)e.dashstyle=d.dashStyle;this.cross=this.chart.renderer.path(c).attr(e).add()}},hideCrosshair:function(){this.cross&&this.cross.hide()}};r(va.prototype,{getPlotBandPath:function(a,b){var c=this.getPlotLinePath(b,null,null,!0),d=this.getPlotLinePath(a,null,null,!0);d&&c&&d.toString()!==c.toString()?d.push(c[4],c[5],c[1],c[2]):d=null;return d},addPlotBand:function(a){return this.addPlotBandOrLine(a,\"plotBands\")},addPlotLine:function(a){return this.addPlotBandOrLine(a,\n\"plotLines\")},addPlotBandOrLine:function(a,b){var c=(new w.PlotLineOrBand(this,a)).render(),d=this.userOptions;c&&(b&&(d[b]=d[b]||[],d[b].push(a)),this.plotLinesAndBands.push(c));return c},removePlotBandOrLine:function(a){for(var b=this.plotLinesAndBands,c=this.options,d=this.userOptions,e=b.length;e--;)b[e].id===a&&b[e].destroy();m([c.plotLines||[],d.plotLines||[],c.plotBands||[],d.plotBands||[]],function(b){for(e=b.length;e--;)b[e].id===a&&ia(b,b[e])})}});va.prototype.getTimeTicks=function(a,b,\nc,d){var e=[],f={},g=P.global.useUTC,h,i=new Aa(b-Wa(b)),j=a.unitRange,k=a.count;if(s(b)){i[Db](j>=G.second?0:k*U(i.getMilliseconds()/k));if(j>=G.second)i[Eb](j>=G.minute?0:k*U(i.getSeconds()/k));if(j>=G.minute)i[Fb](j>=G.hour?0:k*U(i[rb]()/k));if(j>=G.hour)i[Gb](j>=G.day?0:k*U(i[sb]()/k));if(j>=G.day)i[ub](j>=G.month?1:k*U(i[Xa]()/k));j>=G.month&&(i[vb](j>=G.year?0:k*U(i[Ya]()/k)),h=i[Za]());j>=G.year&&(h-=h%k,i[wb](h));if(j===G.week)i[ub](i[Xa]()-i[tb]()+p(d,1));b=1;if(nb||eb)i=i.getTime(),i=new Aa(i+\nWa(i));h=i[Za]();for(var d=i.getTime(),l=i[Ya](),n=i[Xa](),o=(G.day+(g?Wa(i):i.getTimezoneOffset()*6E4))%G.day;d<c;)e.push(d),j===G.year?d=gb(h+b*k,0):j===G.month?d=gb(h,l+b*k):!g&&(j===G.day||j===G.week)?d=gb(h,l,n+b*k*(j===G.day?1:7)):d+=j*k,b++;e.push(d);m(kb(e,function(a){return j<=G.hour&&a%G.day===o}),function(a){f[a]=\"day\"})}e.info=r(a,{higherRanks:f,totalRange:j*k});return e};va.prototype.normalizeTimeTickInterval=function(a,b){var c=b||[[\"millisecond\",[1,2,5,10,20,25,50,100,200,500]],[\"second\",\n[1,2,5,10,15,30]],[\"minute\",[1,2,5,10,15,30]],[\"hour\",[1,2,3,4,6,8,12]],[\"day\",[1,2]],[\"week\",[1,2]],[\"month\",[1,2,3,4,6]],[\"year\",null]],d=c[c.length-1],e=G[d[0]],f=d[1],g;for(g=0;g<c.length;g++)if(d=c[g],e=G[d[0]],f=d[1],c[g+1]&&a<=(e*f[f.length-1]+G[c[g+1][0]])/2)break;e===G.year&&a<5*e&&(f=[1,2,5]);c=pb(a/e,f,d[0]===\"year\"?t(ob(a/e),1):1);return{unitRange:e,count:c,unitName:d[0]}};va.prototype.getLogTickPositions=function(a,b,c,d){var e=this.options,f=this.len,g=[];if(!d)this._minorAutoInterval=\nnull;if(a>=0.5)a=x(a),g=this.getLinearTickPositions(a,b,c);else if(a>=0.08)for(var f=U(b),h,i,j,k,l,e=a>0.3?[1,2,4]:a>0.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];f<c+1&&!l;f++){i=e.length;for(h=0;h<i&&!l;h++)j=Ea(ha(f)*e[h]),j>b&&(!d||k<=c)&&k!==u&&g.push(k),k>c&&(l=!0),k=j}else if(b=ha(b),c=ha(c),a=e[d?\"minorTickInterval\":\"tickInterval\"],a=p(a===\"auto\"?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=pb(a,null,ob(a)),g=Ua(this.getLinearTickPositions(a,\nb,c),Ea),!d)this._minorAutoInterval=a/5;if(!d)this.tickInterval=a;return g};var Mb=w.Tooltip=function(){this.init.apply(this,arguments)};Mb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=B(d.padding);this.chart=a;this.options=b;this.crosshairs=[];this.now={x:0,y:0};this.isHidden=!0;this.label=a.renderer.label(\"\",0,0,b.shape||\"callout\",null,null,b.useHTML,null,\"tooltip\").attr({padding:e,fill:b.backgroundColor,\"stroke-width\":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).add().attr({y:-9999});\nea||this.label.shadow(b.shadow);this.shared=b.shared},destroy:function(){if(this.label)this.label=this.label.destroy();clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,b,c,d){var e=this,f=e.now,g=e.options.animation!==!1&&!e.isHidden&&(O(a-f.x)>1||O(b-f.y)>1),h=e.followPointer||e.len>1;r(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?u:g?(2*f.anchorX+c)/3:c,anchorY:h?u:g?(f.anchorY+d)/2:d});e.label.attr(f);if(g)clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&\ne.move(a,b,c,d)},32)},hide:function(a){var b=this,c;clearTimeout(this.hideTimer);if(!this.isHidden)c=this.chart.hoverPoints,this.hideTimer=setTimeout(function(){b.label.fadeOut();b.isHidden=!0},p(a,this.options.hideDelay,500)),c&&m(c,function(a){a.setState()}),this.chart.hoverPoints=null,this.chart.hoverSeries=null},getAnchor:function(a,b){var c,d=this.chart,e=d.inverted,f=d.plotTop,g=d.plotLeft,h=0,i=0,j,k,a=ra(a);c=a[0].tooltipPos;this.followPointer&&b&&(b.chartX===u&&(b=d.pointer.normalize(b)),\nc=[b.chartX-d.plotLeft,b.chartY-f]);c||(m(a,function(a){j=a.series.yAxis;k=a.series.xAxis;h+=a.plotX+(!e&&k?k.left-g:0);i+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&j?j.top-f:0)}),h/=a.length,i/=a.length,c=[e?d.plotWidth-i:h,this.shared&&!e&&a.length>1&&b?b.chartY-f:e?d.plotHeight-h:i]);return Ua(c,x)},getPosition:function(a,b,c){var d=this.chart,e=this.distance,f={},g=c.h,h,i=[\"y\",d.chartHeight,b,c.plotY+d.plotTop],j=[\"x\",d.chartWidth,a,c.plotX+d.plotLeft],k=p(c.ttBelow,d.inverted&&!c.negative||\n!d.inverted&&c.negative),l=function(a,b,c,d){var h=c<d-e,i=d+e+c<b,j=d-e-c;d+=e;if(k&&i)f[a]=d;else if(!k&&h)f[a]=j;else if(h)f[a]=j-g<0?j:j-g;else if(i)f[a]=d+g+c>b?d:d+g;else return!1},n=function(a,b,c,d){if(d<e||d>b-e)return!1;else f[a]=d<c/2?1:d>b-c/2?b-c-2:d-c/2},o=function(a){var b=i;i=j;j=b;h=a},q=function(){l.apply(0,i)!==!1?n.apply(0,j)===!1&&!h&&(o(!0),q()):h?f.x=f.y=0:(o(!0),q())};(d.inverted||this.len>1)&&o();q();return f},defaultFormatter:function(a){var b=this.points||ra(this),c;c=[a.tooltipFooterHeaderFormatter(b[0])];\nc=c.concat(a.bodyFormatter(b));c.push(a.tooltipFooterHeaderFormatter(b[0],!0));return c.join(\"\")},refresh:function(a,b){var c=this.chart,d=this.label,e=this.options,f,g,h={},i,j=[];i=e.formatter||this.defaultFormatter;var h=c.hoverPoints,k,l=this.shared;clearTimeout(this.hideTimer);this.followPointer=ra(a)[0].series.tooltipOptions.followPointer;g=this.getAnchor(a,b);f=g[0];g=g[1];l&&(!a.series||!a.series.noSharedTooltip)?(c.hoverPoints=a,h&&m(h,function(a){a.setState()}),m(a,function(a){a.setState(\"hover\");\nj.push(a.getLabelConfig())}),h={x:a[0].category,y:a[0].y},h.points=j,this.len=j.length,a=a[0]):h=a.getLabelConfig();i=i.call(h,this);h=a.series;this.distance=p(h.tooltipOptions.distance,16);i===!1?this.hide():(this.isHidden&&(db(d),d.attr(\"opacity\",1).show()),d.attr({text:i}),k=e.borderColor||a.color||h.color||\"#606060\",d.attr({stroke:k}),this.updatePosition({plotX:f,plotY:g,negative:a.negative,ttBelow:a.ttBelow,h:a.shapeArgs&&a.shapeArgs.height||0}),this.isHidden=!1);M(c,\"tooltipRefresh\",{text:i,\nx:f+c.plotLeft,y:g+c.plotTop,borderColor:k})},updatePosition:function(a){var b=this.chart,c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(x(c.x),x(c.y),a.plotX+b.plotLeft,a.plotY+b.plotTop)},getXDateFormat:function(a,b,c){var d,b=b.dateTimeLabelFormats,e=c&&c.closestPointRange,f,g={millisecond:15,second:12,minute:9,hour:6,day:3},h,i;if(e){h=Oa(\"%m-%d %H:%M:%S.%L\",a.x);for(f in G){if(e===G.week&&+Oa(\"%w\",a.x)===c.options.startOfWeek&&h.substr(6)===\n\"00:00:00.000\"){f=\"week\";break}else if(G[f]>e){f=i;break}else if(g[f]&&h.substr(g[f])!==\"01-01 00:00:00.000\".substr(g[f]))break;f!==\"week\"&&(i=f)}f&&(d=b[f])}else d=b.day;return d||b.year},tooltipFooterHeaderFormatter:function(a,b){var c=b?\"footer\":\"header\",d=a.series,e=d.tooltipOptions,f=e.xDateFormat,g=d.xAxis,h=g&&g.options.type===\"datetime\"&&qa(a.key),c=e[c+\"Format\"];h&&!f&&(f=this.getXDateFormat(a,e,g));h&&f&&(c=c.replace(\"{point.key}\",\"{point.key:\"+f+\"}\"));return Ja(c,{point:a,series:d})},bodyFormatter:function(a){return Ua(a,\nfunction(a){var c=a.series.tooltipOptions;return(c.pointFormatter||a.point.tooltipFormatter).call(a.point,c.pointFormat)})}};var oa;ab=A.documentElement.ontouchstart!==u;var Va=w.Pointer=function(a,b){this.init(a,b)};Va.prototype={init:function(a,b){var c=b.chart,d=c.events,e=ea?\"\":c.zoomType,c=a.inverted,f;this.options=b;this.chart=a;this.zoomX=f=/x/.test(e);this.zoomY=e=/y/.test(e);this.zoomHor=f&&!c||e&&c;this.zoomVert=e&&!c||f&&c;this.hasZoom=f||e;this.runChartClick=d&&!!d.click;this.pinchDown=\n[];this.lastValidTouch={};if(w.Tooltip&&b.tooltip.enabled)a.tooltip=new Mb(a,b.tooltip),this.followTouchMove=p(b.tooltip.followTouchMove,!0);this.setDOMEvents()},normalize:function(a,b){var c,d,a=a||window.event,a=Sb(a);if(!a.target)a.target=a.srcElement;d=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a;if(!b)this.chartPosition=b=Rb(this.chart.container);d.pageX===u?(c=t(a.x,a.clientX-b.left),d=a.y):(c=d.pageX-b.left,d=d.pageY-b.top);return r(a,{chartX:x(c),chartY:x(d)})},getCoordinates:function(a){var b=\n{xAxis:[],yAxis:[]};m(this.chart.axes,function(c){b[c.isXAxis?\"xAxis\":\"yAxis\"].push({axis:c,value:c.toValue(a[c.horiz?\"chartX\":\"chartY\"])})});return b},runPointActions:function(a){var b=this.chart,c=b.series,d=b.tooltip,e=d?d.shared:!1,f=b.hoverPoint,g=b.hoverSeries,h,i=b.chartWidth,j=b.chartWidth,k,l=[],n,o;if(!e&&!g)for(h=0;h<c.length;h++)if(c[h].directTouch||!c[h].options.stickyTracking)c=[];!e&&g&&g.directTouch&&f?n=f:(m(c,function(b){k=b.noSharedTooltip&&e;b.visible&&!k&&p(b.options.enableMouseTracking,\n!0)&&(o=b.searchPoint(a))&&l.push(o)}),m(l,function(a){if(a&&s(a.plotX)&&s(a.plotY)&&(a.dist.distX<i||(a.dist.distX===i||a.series.kdDimensions>1)&&a.dist.distR<j))i=a.dist.distX,j=a.dist.distR,n=a}));if(n&&(n!==f||d&&d.isHidden))if(e&&!n.series.noSharedTooltip){for(h=l.length;h--;)(l[h].clientX!==n.clientX||l[h].series.noSharedTooltip)&&l.splice(h,1);l.length&&d&&d.refresh(l,a);m(l,function(b){if(b!==n)b.onMouseOver(a)});(g&&g.directTouch&&f||n).onMouseOver(a)}else d&&d.refresh(n,a),n.onMouseOver(a);\nelse c=g&&g.tooltipOptions.followPointer,d&&c&&!d.isHidden&&(c=d.getAnchor([{}],a),d.updatePosition({plotX:c[0],plotY:c[1]}));if(d&&!this._onDocumentMouseMove)this._onDocumentMouseMove=function(a){if(X[oa])X[oa].pointer.onDocumentMouseMove(a)},N(A,\"mousemove\",this._onDocumentMouseMove);m(b.axes,function(b){b.drawCrosshair(a,p(n,f))})},reset:function(a,b){var c=this.chart,d=c.hoverSeries,e=c.hoverPoint,f=c.tooltip,g=f&&f.shared?c.hoverPoints:e;(a=a&&f&&g)&&ra(g)[0].plotX===u&&(a=!1);if(a)f.refresh(g),\ne&&(e.setState(e.state,!0),m(c.axes,function(b){p(b.options.crosshair&&b.options.crosshair.snap,!0)?b.drawCrosshair(null,a):b.hideCrosshair()}));else{if(e)e.onMouseOut();if(d)d.onMouseOut();f&&f.hide(b);if(this._onDocumentMouseMove)Y(A,\"mousemove\",this._onDocumentMouseMove),this._onDocumentMouseMove=null;m(c.axes,function(a){a.hideCrosshair()});this.hoverX=null}},scaleGroups:function(a,b){var c=this.chart,d;m(c.series,function(e){d=a||e.getPlotBox();e.xAxis&&e.xAxis.zoomEnabled&&(e.group.attr(d),\ne.markerGroup&&(e.markerGroup.attr(d),e.markerGroup.clip(b?c.clipRect:null)),e.dataLabelsGroup&&e.dataLabelsGroup.attr(d))});c.clipRect.attr(b||c.clipBox)},dragStart:function(a){var b=this.chart;b.mouseIsDown=a.type;b.cancelClick=!1;b.mouseDownX=this.mouseDownX=a.chartX;b.mouseDownY=this.mouseDownY=a.chartY},drag:function(a){var b=this.chart,c=b.options.chart,d=a.chartX,e=a.chartY,f=this.zoomHor,g=this.zoomVert,h=b.plotLeft,i=b.plotTop,j=b.plotWidth,k=b.plotHeight,l,n=this.mouseDownX,o=this.mouseDownY,\nq=c.panKey&&a[c.panKey+\"Key\"];d<h?d=h:d>h+j&&(d=h+j);e<i?e=i:e>i+k&&(e=i+k);this.hasDragged=Math.sqrt(Math.pow(n-d,2)+Math.pow(o-e,2));if(this.hasDragged>10){l=b.isInsidePlot(n-h,o-i);if(b.hasCartesianSeries&&(this.zoomX||this.zoomY)&&l&&!q&&!this.selectionMarker)this.selectionMarker=b.renderer.rect(h,i,f?1:j,g?1:k,0).attr({fill:c.selectionMarkerFill||\"rgba(69,114,167,0.25)\",zIndex:7}).add();this.selectionMarker&&f&&(d-=n,this.selectionMarker.attr({width:O(d),x:(d>0?0:d)+n}));this.selectionMarker&&\ng&&(d=e-o,this.selectionMarker.attr({height:O(d),y:(d>0?0:d)+o}));l&&!this.selectionMarker&&c.panning&&b.pan(a,c.panning)}},drop:function(a){var b=this,c=this.chart,d=this.hasPinched;if(this.selectionMarker){var e={xAxis:[],yAxis:[],originalEvent:a.originalEvent||a},f=this.selectionMarker,g=f.attr?f.attr(\"x\"):f.x,h=f.attr?f.attr(\"y\"):f.y,i=f.attr?f.attr(\"width\"):f.width,j=f.attr?f.attr(\"height\"):f.height,k;if(this.hasDragged||d)m(c.axes,function(c){if(c.zoomEnabled&&s(c.min)&&(d||b[{xAxis:\"zoomX\",\nyAxis:\"zoomY\"}[c.coll]])){var f=c.horiz,o=a.type===\"touchend\"?c.minPixelPadding:0,q=c.toValue((f?g:h)+o),f=c.toValue((f?g+i:h+j)-o);e[c.coll].push({axis:c,min:I(q,f),max:t(q,f)});k=!0}}),k&&M(c,\"selection\",e,function(a){c.zoom(r(a,d?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();d&&this.scaleGroups()}if(c)F(c.container,{cursor:c._cursor}),c.cancelClick=this.hasDragged>10,c.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[]},onContainerMouseDown:function(a){a=\nthis.normalize(a);a.preventDefault&&a.preventDefault();this.dragStart(a)},onDocumentMouseUp:function(a){X[oa]&&X[oa].pointer.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,a=this.normalize(a,c);c&&!this.inClass(a.target,\"highcharts-tracker\")&&!b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.reset()},onContainerMouseLeave:function(){var a=X[oa];if(a)a.pointer.reset(),a.pointer.chartPosition=null},onContainerMouseMove:function(a){var b=this.chart;oa=b.index;\na=this.normalize(a);a.returnValue=!1;b.mouseIsDown===\"mousedown\"&&this.drag(a);(this.inClass(a.target,\"highcharts-tracker\")||b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop))&&!b.openMenu&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=L(a,\"class\"))if(c.indexOf(b)!==-1)return!0;else if(c.indexOf(\"highcharts-container\")!==-1)return!1;a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries,c=(a=a.relatedTarget||a.toElement)&&a.point&&a.point.series;if(b&&\n!b.options.stickyTracking&&!this.inClass(a,\"highcharts-tooltip\")&&c!==b)b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,a=this.normalize(a);a.originalEvent=a;a.cancelBubble=!0;b.cancelClick||(c&&this.inClass(a.target,\"highcharts-tracker\")?(M(c.series,\"click\",r(a,{point:c})),b.hoverPoint&&c.firePointEvent(\"click\",a)):(r(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-e)&&M(b,\"click\",a)))},setDOMEvents:function(){var a=this,b=a.chart.container;\nb.onmousedown=function(b){a.onContainerMouseDown(b)};b.onmousemove=function(b){a.onContainerMouseMove(b)};b.onclick=function(b){a.onContainerClick(b)};N(b,\"mouseleave\",a.onContainerMouseLeave);bb===1&&N(A,\"mouseup\",a.onDocumentMouseUp);if(ab)b.ontouchstart=function(b){a.onContainerTouchStart(b)},b.ontouchmove=function(b){a.onContainerTouchMove(b)},bb===1&&N(A,\"touchend\",a.onDocumentTouchEnd)},destroy:function(){var a;Y(this.chart.container,\"mouseleave\",this.onContainerMouseLeave);bb||(Y(A,\"mouseup\",\nthis.onDocumentMouseUp),Y(A,\"touchend\",this.onDocumentTouchEnd));clearInterval(this.tooltipTimeout);for(a in this)this[a]=null}};r(w.Pointer.prototype,{pinchTranslate:function(a,b,c,d,e,f){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,b,c,d,e,f);(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,b,c,d,e,f)},pinchTranslateDirection:function(a,b,c,d,e,f,g,h){var i=this.chart,j=a?\"x\":\"y\",k=a?\"X\":\"Y\",l=\"chart\"+k,n=a?\"width\":\"height\",o=i[\"plot\"+(a?\"Left\":\"Top\")],q,p,\nm=h||1,C=i.inverted,v=i.bounds[a?\"h\":\"v\"],s=b.length===1,r=b[0][l],t=c[0][l],u=!s&&b[1][l],x=!s&&c[1][l],w,c=function(){!s&&O(r-u)>20&&(m=h||O(t-x)/O(r-u));p=(o-t)/m+r;q=i[\"plot\"+(a?\"Width\":\"Height\")]/m};c();b=p;b<v.min?(b=v.min,w=!0):b+q>v.max&&(b=v.max-q,w=!0);w?(t-=0.8*(t-g[j][0]),s||(x-=0.8*(x-g[j][1])),c()):g[j]=[t,x];C||(f[j]=p-o,f[n]=q);f=C?1/m:m;e[n]=q;e[j]=b;d[C?a?\"scaleY\":\"scaleX\":\"scale\"+k]=m;d[\"translate\"+k]=f*o+(t-f*r)},pinch:function(a){var b=this,c=b.chart,d=b.pinchDown,e=a.touches,\nf=e.length,g=b.lastValidTouch,h=b.hasZoom,i=b.selectionMarker,j={},k=f===1&&(b.inClass(a.target,\"highcharts-tracker\")&&c.runTrackerClick||b.runChartClick),l={};h&&!k&&a.preventDefault();Ua(e,function(a){return b.normalize(a)});if(a.type===\"touchstart\")m(e,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),g.x=[d[0].chartX,d[1]&&d[1].chartX],g.y=[d[0].chartY,d[1]&&d[1].chartY],m(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?\"h\":\"v\"],d=a.minPixelPadding,e=a.toPixels(p(a.options.min,\na.dataMin)),f=a.toPixels(p(a.options.max,a.dataMax)),g=I(e,f),e=t(e,f);b.min=I(a.pos,g-d);b.max=t(a.pos+a.len,e+d)}}),b.res=!0;else if(d.length){if(!i)b.selectionMarker=i=r({destroy:ma},c.plotBox);b.pinchTranslate(d,e,j,i,l,g);b.hasPinched=h;b.scaleGroups(j,l);if(!h&&b.followTouchMove&&f===1)this.runPointActions(b.normalize(a));else if(b.res)b.res=!1,this.reset(!1,0)}},onContainerTouchStart:function(a){var b=this.chart;oa=b.index;a.touches.length===1?(a=this.normalize(a),b.isInsidePlot(a.chartX-b.plotLeft,\na.chartY-b.plotTop)&&!b.openMenu?(this.runPointActions(a),this.pinch(a)):this.reset()):a.touches.length===2&&this.pinch(a)},onContainerTouchMove:function(a){(a.touches.length===1||a.touches.length===2)&&this.pinch(a)},onDocumentTouchEnd:function(a){X[oa]&&X[oa].pointer.drop(a)}});if(H.PointerEvent||H.MSPointerEvent){var wa={},Ab=!!H.PointerEvent,Wb=function(){var a,b=[];b.item=function(a){return this[a]};for(a in wa)wa.hasOwnProperty(a)&&b.push({pageX:wa[a].pageX,pageY:wa[a].pageY,target:wa[a].target});\nreturn b},Bb=function(a,b,c,d){a=a.originalEvent||a;if((a.pointerType===\"touch\"||a.pointerType===a.MSPOINTER_TYPE_TOUCH)&&X[oa])d(a),d=X[oa].pointer,d[b]({type:c,target:a.currentTarget,preventDefault:ma,touches:Wb()})};r(Va.prototype,{onContainerPointerDown:function(a){Bb(a,\"onContainerTouchStart\",\"touchstart\",function(a){wa[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){Bb(a,\"onContainerTouchMove\",\"touchmove\",function(a){wa[a.pointerId]={pageX:a.pageX,\npageY:a.pageY};if(!wa[a.pointerId].target)wa[a.pointerId].target=a.currentTarget})},onDocumentPointerUp:function(a){Bb(a,\"onDocumentTouchEnd\",\"touchend\",function(a){delete wa[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,Ab?\"pointerdown\":\"MSPointerDown\",this.onContainerPointerDown);a(this.chart.container,Ab?\"pointermove\":\"MSPointerMove\",this.onContainerPointerMove);a(A,Ab?\"pointerup\":\"MSPointerUp\",this.onDocumentPointerUp)}});cb(Va.prototype,\"init\",function(a,b,c){a.call(this,b,\nc);this.hasZoom&&F(b.container,{\"-ms-touch-action\":R,\"touch-action\":R})});cb(Va.prototype,\"setDOMEvents\",function(a){a.apply(this);(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(N)});cb(Va.prototype,\"destroy\",function(a){this.batchMSEvents(Y);a.call(this)})}var mb=w.Legend=function(a,b){this.init(a,b)};mb.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=b.itemMarginTop||0;this.options=b;if(b.enabled)c.itemStyle=d,c.itemHiddenStyle=z(d,b.itemHiddenStyle),c.itemMarginTop=e,c.padding=\nd=p(b.padding,8),c.initialItemX=d,c.initialItemY=d-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.symbolWidth=p(b.symbolWidth,16),c.pages=[],c.render(),N(c.chart,\"endResize\",function(){c.positionCheckboxes()})},colorizeItem:function(a,b){var c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.legendColor||a.color||\"#CCC\":g,g=a.options&&a.options.marker,i={fill:h},j;d&&d.css({fill:c,color:c});e&&e.attr({stroke:h});if(f){if(g&&f.isMarker)for(j in i.stroke=\nh,g=a.convertAttribs(g),g)d=g[j],d!==u&&(i[j]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;a.legendGroup&&a.legendGroup.translate(b?e:this.legendWidth-e-2*c-4,d);if(f)f.x=e,f.y=d},destroyItem:function(a){var b=a.checkbox;m([\"legendItem\",\"legendLine\",\"legendSymbol\",\"legendGroup\"],function(b){a[b]&&(a[b]=a[b].destroy())});b&&Ra(a.checkbox)},clearItems:function(){var a=this;m(a.getAllItems(),function(b){a.destroyItem(b)})},\ndestroy:function(){var a=this.group,b=this.box;if(b)this.box=b.destroy();if(a)this.group=a.destroy()},positionCheckboxes:function(a){var b=this.group.alignAttr,c,d=this.clipHeight||this.legendHeight;if(b)c=b.translateY,m(this.allItems,function(e){var f=e.checkbox,g;f&&(g=c+f.y+(a||0)+3,F(f,{left:b.translateX+e.checkboxOffset+f.x-20+\"px\",top:g+\"px\",display:g>c-6&&g<c+d-6?\"\":R}))})},renderTitle:function(){var a=this.padding,b=this.options.title,c=0;if(b.text){if(!this.title)this.title=this.chart.renderer.label(b.text,\na-3,a-4,null,null,null,null,null,\"legend-title\").attr({zIndex:1}).css(b.style).add(this.group);a=this.title.getBBox();c=a.height;this.offsetWidth=a.width;this.contentGroup.attr({translateY:c})}this.titleHeight=c},renderItem:function(a){var b=this.chart,c=b.renderer,d=this.options,e=d.layout===\"horizontal\",f=this.symbolWidth,g=d.symbolPadding,h=this.itemStyle,i=this.itemHiddenStyle,j=this.padding,k=e?p(d.itemDistance,20):0,l=!d.rtl,n=d.width,o=d.itemMarginBottom||0,q=this.itemMarginTop,y=this.initialItemX,\nm=a.legendItem,s=a.series&&a.series.drawLegendSymbol?a.series:a,v=s.options,v=this.createCheckboxForItem&&v&&v.showCheckbox,r=d.useHTML;if(!m){a.legendGroup=c.g(\"legend-item\").attr({zIndex:1}).add(this.scrollGroup);a.legendItem=m=c.text(d.labelFormat?Ja(d.labelFormat,a):d.labelFormatter.call(a),l?f+g:-g,this.baseline||0,r).css(z(a.visible?h:i)).attr({align:l?\"left\":\"right\",zIndex:2}).add(a.legendGroup);if(!this.baseline)this.fontMetrics=c.fontMetrics(h.fontSize,m),this.baseline=this.fontMetrics.f+\n3+q,m.attr(\"y\",this.baseline);s.drawLegendSymbol(this,a);this.setItemEvents&&this.setItemEvents(a,m,r,h,i);this.colorizeItem(a,a.visible);v&&this.createCheckboxForItem(a)}c=m.getBBox();f=a.checkboxOffset=d.itemWidth||a.legendItemWidth||f+g+c.width+k+(v?20:0);this.itemHeight=g=x(a.legendItemHeight||c.height);if(e&&this.itemX-y+f>(n||b.chartWidth-2*j-y-d.x))this.itemX=y,this.itemY+=q+this.lastLineHeight+o,this.lastLineHeight=0;this.maxItemWidth=t(this.maxItemWidth,f);this.lastItemY=q+this.itemY+o;this.lastLineHeight=\nt(g,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];e?this.itemX+=f:(this.itemY+=q+g+o,this.lastLineHeight=g);this.offsetWidth=n||t((e?this.itemX-y-k:f)+j,this.offsetWidth)},getAllItems:function(){var a=[];m(this.chart.series,function(b){var c=b.options;if(p(c.showInLegend,!s(c.linkedTo)?u:!1,!0))a=a.concat(b.legendItems||(c.legendType===\"point\"?b.data:b))});return a},adjustMargins:function(a,b){var c=this.chart,d=this.options,e=d.align[0]+d.verticalAlign[0]+d.layout[0];this.display&&\n!d.floating&&m([/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/],function(f,g){f.test(e)&&!s(a[g])&&(c[ib[g]]=t(c[ib[g]],c.legend[(g+1)%2?\"legendHeight\":\"legendWidth\"]+[1,-1,-1,1][g]*d[g%2?\"x\":\"y\"]+p(d.margin,12)+b[g]))})},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.group,e,f,g,h,i=a.box,j=a.options,k=a.padding,l=j.borderWidth,n=j.backgroundColor;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;if(!d)a.group=d=c.g(\"legend\").attr({zIndex:7}).add(),\na.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup);a.renderTitle();e=a.getAllItems();qb(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});j.reversed&&e.reverse();a.allItems=e;a.display=f=!!e.length;a.lastLineHeight=0;m(e,function(b){a.renderItem(b)});g=(j.width||a.offsetWidth)+k;h=a.lastItemY+a.lastLineHeight+a.titleHeight;h=a.handleOverflow(h);h+=k;if(l||n){if(i){if(g>0&&h>0)i[i.isNew?\"attr\":\"animate\"](i.crisp({width:g,\nheight:h})),i.isNew=!1}else a.box=i=c.rect(0,0,g,h,j.borderRadius,l||0).attr({stroke:j.borderColor,\"stroke-width\":l||0,fill:n||R}).add(d).shadow(j.shadow),i.isNew=!0;i[f?\"show\":\"hide\"]()}a.legendWidth=g;a.legendHeight=h;m(e,function(b){a.positionItem(b)});f&&d.align(r({width:g,height:h},j),!0,\"spacingBox\");b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+(e.verticalAlign===\"top\"?-f:f)-this.padding,g=\ne.maxHeight,h,i=this.clipRect,j=e.navigation,k=p(j.animation,!0),l=j.arrowSize||12,n=this.nav,o=this.pages,q,y=this.allItems;e.layout===\"horizontal\"&&(f/=2);g&&(f=I(f,g));o.length=0;if(a>f&&!e.useHTML){this.clipHeight=h=t(f-20-this.titleHeight-this.padding,0);this.currentPage=p(this.currentPage,1);this.fullHeight=a;m(y,function(a,b){var c=a._legendItemPos[1],d=x(a.legendItem.getBBox().height),e=o.length;if(!e||c-o[e-1]>h&&(q||c)!==o[e-1])o.push(q||c),e++;b===y.length-1&&c+d-o[e-1]>h&&o.push(c);c!==\nq&&(q=c)});if(!i)i=b.clipRect=d.clipRect(0,this.padding,9999,0),b.contentGroup.clip(i);i.attr({height:h});if(!n)this.nav=n=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol(\"triangle\",0,0,l,l).on(\"click\",function(){b.scroll(-1,k)}).add(n),this.pager=d.text(\"\",15,10).css(j.style).add(n),this.down=d.symbol(\"triangle-down\",0,0,l,l).on(\"click\",function(){b.scroll(1,k)}).add(n);b.scroll(0);a=f}else if(n)i.attr({height:c.chartHeight}),n.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=\n0;return a},scroll:function(a,b){var c=this.pages,d=c.length,e=this.currentPage+a,f=this.clipHeight,g=this.options.navigation,h=g.activeColor,g=g.inactiveColor,i=this.pager,j=this.padding;e>d&&(e=d);if(e>0)b!==u&&Sa(b,this.chart),this.nav.attr({translateX:j,translateY:f+this.padding+7+this.titleHeight,visibility:\"visible\"}),this.up.attr({fill:e===1?g:h}).css({cursor:e===1?\"default\":\"pointer\"}),i.attr({text:e+\"/\"+d}),this.down.attr({x:18+this.pager.getBBox().width,fill:e===d?g:h}).css({cursor:e===\nd?\"default\":\"pointer\"}),c=-c[e-1]+this.initialItemY,this.scrollGroup.animate({translateY:c}),this.currentPage=e,this.positionCheckboxes(c)}};Na=w.LegendSymbolMixin={drawRectangle:function(a,b){var c=a.options.symbolHeight||a.fontMetrics.f;b.legendSymbol=this.chart.renderer.rect(0,a.baseline-c+1,a.symbolWidth,c,a.options.symbolRadius||0).attr({zIndex:3}).add(b.legendGroup)},drawLineMarker:function(a){var b=this.options,c=b.marker,d;d=a.symbolWidth;var e=this.chart.renderer,f=this.legendGroup,a=a.baseline-\nx(a.fontMetrics.b*0.3),g;if(b.lineWidth){g={\"stroke-width\":b.lineWidth};if(b.dashStyle)g.dashstyle=b.dashStyle;this.legendLine=e.path([\"M\",0,a,\"L\",d,a]).attr(g).add(f)}if(c&&c.enabled!==!1)b=c.radius,this.legendSymbol=d=e.symbol(this.symbol,d/2-b,a-b,2*b,2*b).add(f),d.isMarker=!0}};(/Trident\\/7\\.0/.test(Ba)||La)&&cb(mb.prototype,\"positionItem\",function(a,b){var c=this,d=function(){b._legendItemPos&&a.call(c,b)};d();setTimeout(d)});D=w.Chart=function(){this.init.apply(this,arguments)};D.prototype=\n{callbacks:[],init:function(a,b){var c,d=a.series;a.series=null;c=z(P,a);c.series=a.series=d;this.userOptions=a;d=c.chart;this.margin=this.splashArray(\"margin\",d);this.spacing=this.splashArray(\"spacing\",d);var e=d.events;this.bounds={h:{},v:{}};this.callback=b;this.isResizing=0;this.options=c;this.axes=[];this.series=[];this.hasCartesianSeries=d.showAxes;var f=this,g;f.index=X.length;X.push(f);bb++;d.reflow!==!1&&N(f,\"load\",function(){f.initReflow()});if(e)for(g in e)N(f,g,e[g]);f.xAxis=[];f.yAxis=\n[];f.animation=ea?!1:p(d.animation,!0);f.pointCount=f.colorCounter=f.symbolCounter=0;f.firstRender()},initSeries:function(a){var b=this.options.chart;(b=J[a.type||b.type||b.defaultSeriesType])||ka(17,!0);b=new b;b.init(this,a);return b},isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight},redraw:function(a){var b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,g,h,i=this.hasCartesianSeries,j=this.isDirtyBox,k=c.length,\nl=k,n=this.renderer,o=n.isHidden(),q=[];Sa(a,this);o&&this.cloneRenderTo();for(this.layOutTitles();l--;)if(a=c[l],a.options.stacking&&(g=!0,a.isDirty)){h=!0;break}if(h)for(l=k;l--;)if(a=c[l],a.options.stacking)a.isDirty=!0;m(c,function(a){a.isDirty&&a.options.legendType===\"point\"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=!1;g&&this.getStacks();if(i&&!this.isResizing)this.maxTicks=null,m(b,function(a){a.setScale()});this.getMargins();i&&(m(b,function(a){a.isDirty&&(j=!0)}),m(b,\nfunction(a){if(a.isDirtyExtremes)a.isDirtyExtremes=!1,q.push(function(){M(a,\"afterSetExtremes\",r(a.eventArgs,a.getExtremes()));delete a.eventArgs});(j||g)&&a.redraw()}));j&&this.drawChartBox();m(c,function(a){a.isDirty&&a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});d&&d.reset(!0);n.draw();M(this,\"redraw\");o&&this.cloneRenderTo(!0);m(q,function(a){a.call()})},get:function(a){var b=this.axes,c=this.series,d,e;for(d=0;d<b.length;d++)if(b[d].options.id===a)return b[d];for(d=0;d<c.length;d++)if(c[d].options.id===\na)return c[d];for(d=0;d<c.length;d++){e=c[d].points||[];for(b=0;b<e.length;b++)if(e[b].id===a)return e[b]}return null},getAxes:function(){var a=this,b=this.options,c=b.xAxis=ra(b.xAxis||{}),b=b.yAxis=ra(b.yAxis||{});m(c,function(a,b){a.index=b;a.isX=!0});m(b,function(a,b){a.index=b});c=c.concat(b);m(c,function(b){new va(a,b)})},getSelectedPoints:function(){var a=[];m(this.series,function(b){a=a.concat(kb(b.points||[],function(a){return a.selected}))});return a},getSelectedSeries:function(){return kb(this.series,\nfunction(a){return a.selected})},getStacks:function(){var a=this;m(a.yAxis,function(a){if(a.stacks&&a.hasVisibleSeries)a.oldStacks=a.stacks});m(a.series,function(b){if(b.options.stacking&&(b.visible===!0||a.options.chart.ignoreHiddenSeries===!1))b.stackKey=b.type+p(b.options.stack,\"\")})},setTitle:function(a,b,c){var g;var d=this,e=d.options,f;f=e.title=z(e.title,a);g=e.subtitle=z(e.subtitle,b),e=g;m([[\"title\",a,f],[\"subtitle\",b,e]],function(a){var b=a[0],c=d[b],e=a[1],a=a[2];c&&e&&(d[b]=c=c.destroy());\na&&a.text&&!c&&(d[b]=d.renderer.text(a.text,0,0,a.useHTML).attr({align:a.align,\"class\":\"highcharts-\"+b,zIndex:a.zIndex||4}).css(a.style).add())});d.layOutTitles(c)},layOutTitles:function(a){var b=0,c=this.title,d=this.subtitle,e=this.options,f=e.title,e=e.subtitle,g=this.renderer,h=this.spacingBox.width-44;if(c&&(c.css({width:(f.width||h)+\"px\"}).align(r({y:g.fontMetrics(f.style.fontSize,c).b-3},f),!1,\"spacingBox\"),!f.floating&&!f.verticalAlign))b=c.getBBox().height;d&&(d.css({width:(e.width||h)+\"px\"}).align(r({y:b+\n(f.margin-13)+g.fontMetrics(f.style.fontSize,d).b},e),!1,\"spacingBox\"),!e.floating&&!e.verticalAlign&&(b=sa(b+d.getBBox().height)));c=this.titleOffset!==b;this.titleOffset=b;if(!this.isDirtyBox&&c)this.isDirtyBox=c,this.hasRendered&&p(a,!0)&&this.isDirtyBox&&this.redraw()},getChartSize:function(){var a=this.options.chart,b=a.width,a=a.height,c=this.renderToClone||this.renderTo;if(!s(b))this.containerWidth=jb(c,\"width\");if(!s(a))this.containerHeight=jb(c,\"height\");this.chartWidth=t(0,b||this.containerWidth||\n600);this.chartHeight=t(0,p(a,this.containerHeight>19?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;a?b&&(this.renderTo.appendChild(c),Ra(b),delete this.renderToClone):(c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c),this.renderToClone=b=this.renderTo.cloneNode(0),F(b,{position:\"absolute\",top:\"-9999px\",display:\"block\"}),b.style.setProperty&&b.style.setProperty(\"display\",\"block\",\"important\"),A.body.appendChild(b),c&&b.appendChild(c))},\ngetContainer:function(){var a,b=this.options.chart,c,d,e;this.renderTo=a=b.renderTo;e=\"highcharts-\"+yb++;if(Da(a))this.renderTo=a=A.getElementById(a);a||ka(13,!0);c=B(L(a,\"data-highcharts-chart\"));!isNaN(c)&&X[c]&&X[c].hasRendered&&X[c].destroy();L(a,\"data-highcharts-chart\",this.index);a.innerHTML=\"\";!b.skipClone&&!a.offsetWidth&&this.cloneRenderTo();this.getChartSize();c=this.chartWidth;d=this.chartHeight;this.container=a=Z(Ka,{className:\"highcharts-container\"+(b.className?\" \"+b.className:\"\"),id:e},\nr({position:\"relative\",overflow:\"hidden\",width:c+\"px\",height:d+\"px\",textAlign:\"left\",lineHeight:\"normal\",zIndex:0,\"-webkit-tap-highlight-color\":\"rgba(0,0,0,0)\"},b.style),this.renderToClone||a);this._cursor=a.style.cursor;this.renderer=b.forExport?new ta(a,c,d,b.style,!0):new $a(a,c,d,b.style);ea&&this.renderer.create(this,a,c,d);this.renderer.chartIndex=this.index},getMargins:function(a){var b=this.spacing,c=this.margin,d=this.titleOffset;this.resetMargins();if(d&&!s(c[0]))this.plotTop=t(this.plotTop,\nd+this.options.title.margin+b[0]);this.legend.adjustMargins(c,b);this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin);this.extraTopMargin&&(this.plotTop+=this.extraTopMargin);a||this.getAxisMargins()},getAxisMargins:function(){var a=this,b=a.axisOffset=[0,0,0,0],c=a.margin;a.hasCartesianSeries&&m(a.axes,function(a){a.getOffset()});m(ib,function(d,e){s(c[e])||(a[d]+=b[e])});a.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,d=b.renderTo,e=c.width||jb(d,\"width\"),f=c.height||\njb(d,\"height\"),c=a?a.target:H,d=function(){if(b.container)b.setSize(e,f,!1),b.hasUserSize=null};if(!b.hasUserSize&&!b.isPrinting&&e&&f&&(c===H||c===A)){if(e!==b.containerWidth||f!==b.containerHeight)clearTimeout(b.reflowTimeout),a?b.reflowTimeout=setTimeout(d,100):d();b.containerWidth=e;b.containerHeight=f}},initReflow:function(){var a=this,b=function(b){a.reflow(b)};N(H,\"resize\",b);N(a,\"destroy\",function(){Y(H,\"resize\",b)})},setSize:function(a,b,c){var d=this,e,f,g;d.isResizing+=1;g=function(){d&&\nM(d,\"endResize\",null,function(){d.isResizing-=1})};Sa(c,d);d.oldChartHeight=d.chartHeight;d.oldChartWidth=d.chartWidth;if(s(a))d.chartWidth=e=t(0,x(a)),d.hasUserSize=!!e;if(s(b))d.chartHeight=f=t(0,x(b));(za?lb:F)(d.container,{width:e+\"px\",height:f+\"px\"},za);d.setChartSize(!0);d.renderer.setSize(e,f,c);d.maxTicks=null;m(d.axes,function(a){a.isDirty=!0;a.setScale()});m(d.series,function(a){a.isDirty=!0});d.isDirtyLegend=!0;d.isDirtyBox=!0;d.layOutTitles();d.getMargins();d.redraw(c);d.oldChartHeight=\nnull;M(d,\"resize\");za===!1?g():setTimeout(g,za&&za.duration||500)},setChartSize:function(a){var b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,g=this.spacing,h=this.clipOffset,i,j,k,l;this.plotLeft=i=x(this.plotLeft);this.plotTop=j=x(this.plotTop);this.plotWidth=k=t(0,x(d-i-this.marginRight));this.plotHeight=l=t(0,x(e-j-this.marginBottom));this.plotSizeX=b?l:k;this.plotSizeY=b?k:l;this.plotBorderWidth=f.plotBorderWidth||0;this.spacingBox=c.spacingBox={x:g[3],\ny:g[0],width:d-g[3]-g[1],height:e-g[0]-g[2]};this.plotBox=c.plotBox={x:i,y:j,width:k,height:l};d=2*U(this.plotBorderWidth/2);b=sa(t(d,h[3])/2);c=sa(t(d,h[0])/2);this.clipBox={x:b,y:c,width:U(this.plotSizeX-t(d,h[1])/2-b),height:t(0,U(this.plotSizeY-t(d,h[2])/2-c))};a||m(this.axes,function(a){a.setAxisSize();a.setAxisTranslation()})},resetMargins:function(){var a=this;m(ib,function(b,c){a[b]=p(a.margin[c],a.spacing[c])});a.axisOffset=[0,0,0,0];a.clipOffset=[0,0,0,0]},drawChartBox:function(){var a=\nthis.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,f=this.plotBackground,g=this.plotBorder,h=this.plotBGImage,i=a.borderWidth||0,j=a.backgroundColor,k=a.plotBackgroundColor,l=a.plotBackgroundImage,n=a.plotBorderWidth||0,o,q=this.plotLeft,p=this.plotTop,m=this.plotWidth,s=this.plotHeight,v=this.plotBox,r=this.clipRect,t=this.clipBox;o=i+(a.shadow?8:0);if(i||j)if(e)e.animate(e.crisp({width:c-o,height:d-o}));else{e={fill:j||R};if(i)e.stroke=a.borderColor,e[\"stroke-width\"]=\ni;this.chartBackground=b.rect(o/2,o/2,c-o,d-o,a.borderRadius,i).attr(e).addClass(\"highcharts-background\").add().shadow(a.shadow)}if(k)f?f.animate(v):this.plotBackground=b.rect(q,p,m,s,0).attr({fill:k}).add().shadow(a.plotShadow);if(l)h?h.animate(v):this.plotBGImage=b.image(l,q,p,m,s).add();r?r.animate({width:t.width,height:t.height}):this.clipRect=b.clipRect(t);if(n)g?g.animate(g.crisp({x:q,y:p,width:m,height:s,strokeWidth:-n})):this.plotBorder=b.rect(q,p,m,s,0,-n).attr({stroke:a.plotBorderColor,\n\"stroke-width\":n,fill:R,zIndex:1}).add();this.isDirtyBox=!1},propFromSeries:function(){var a=this,b=a.options.chart,c,d=a.options.series,e,f;m([\"inverted\",\"angular\",\"polar\"],function(g){c=J[b.type||b.defaultSeriesType];f=a[g]||b[g]||c&&c.prototype[g];for(e=d&&d.length;!f&&e--;)(c=J[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a=this,b=a.series;m(b,function(a){a.linkedSeries.length=0});m(b,function(b){var d=b.options.linkedTo;if(Da(d)&&(d=d===\":previous\"?a.series[b.index-\n1]:a.get(d)))d.linkedSeries.push(b),b.linkedParent=d})},renderSeries:function(){m(this.series,function(a){a.translate();a.render()})},renderLabels:function(){var a=this,b=a.options.labels;b.items&&m(b.items,function(c){var d=r(b.style,c.style),e=B(d.left)+a.plotLeft,f=B(d.top)+a.plotTop+12;delete d.left;delete d.top;a.renderer.text(c.html,e,f).attr({zIndex:2}).css(d).add()})},render:function(){var a=this.axes,b=this.renderer,c=this.options,d,e,f,g;this.setTitle();this.legend=new mb(this,c.legend);\nthis.getStacks();this.getMargins(!0);this.setChartSize();d=this.plotWidth;e=this.plotHeight-=13;m(a,function(a){a.setScale()});this.getAxisMargins();f=d/this.plotWidth>1.1;g=e/this.plotHeight>1.1;if(f||g)this.maxTicks=null,m(a,function(a){(a.horiz&&f||!a.horiz&&g)&&a.setTickInterval(!0)}),this.getMargins();this.drawChartBox();this.hasCartesianSeries&&m(a,function(a){a.render()});if(!this.seriesGroup)this.seriesGroup=b.g(\"series-group\").attr({zIndex:3}).add();this.renderSeries();this.renderLabels();\nthis.showCredits(c.credits);this.hasRendered=!0},showCredits:function(a){if(a.enabled&&!this.credits)this.credits=this.renderer.text(a.text,0,0).on(\"click\",function(){if(a.href)location.href=a.href}).attr({align:a.position.align,zIndex:8}).css(a.style).add().align(a.position)},destroy:function(){var a=this,b=a.axes,c=a.series,d=a.container,e,f=d&&d.parentNode;M(a,\"destroy\");X[a.index]=u;bb--;a.renderTo.removeAttribute(\"data-highcharts-chart\");Y(a);for(e=b.length;e--;)b[e]=b[e].destroy();for(e=c.length;e--;)c[e]=\nc[e].destroy();m(\"title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer\".split(\",\"),function(b){var c=a[b];c&&c.destroy&&(a[b]=c.destroy())});if(d)d.innerHTML=\"\",Y(d),f&&Ra(d);for(e in a)delete a[e]},isReadyToRender:function(){var a=this;return!ba&&H==H.top&&A.readyState!==\"complete\"||ea&&!H.canvg?(ea?Lb.push(function(){a.firstRender()},a.options.global.canvasToolsURL):A.attachEvent(\"onreadystatechange\",\nfunction(){A.detachEvent(\"onreadystatechange\",a.firstRender);A.readyState===\"complete\"&&a.firstRender()}),!1):!0},firstRender:function(){var a=this,b=a.options,c=a.callback;if(a.isReadyToRender()){a.getContainer();M(a,\"init\");a.resetMargins();a.setChartSize();a.propFromSeries();a.getAxes();m(b.series||[],function(b){a.initSeries(b)});a.linkSeries();M(a,\"beforeRender\");if(w.Pointer)a.pointer=new Va(a,b);a.render();a.renderer.draw();c&&c.apply(a,[a]);m(a.callbacks,function(b){a.index!==u&&b.apply(a,\n[a])});M(a,\"load\");a.cloneRenderTo(!0)}},splashArray:function(a,b){var c=b[a],c=ca(c)?c:[c,c,c,c];return[p(b[a+\"Top\"],c[0]),p(b[a+\"Right\"],c[1]),p(b[a+\"Bottom\"],c[2]),p(b[a+\"Left\"],c[3])]}};var Xb=w.CenteredSeriesMixin={getCenter:function(){var a=this.options,b=this.chart,c=2*(a.slicedOffset||0),d=b.plotWidth-2*c,b=b.plotHeight-2*c,e=a.center,e=[p(e[0],\"50%\"),p(e[1],\"50%\"),a.size||\"100%\",a.innerSize||0],f=I(d,b),g,h,i;for(h=0;h<4;++h)i=e[h],g=/%$/.test(i),a=h<2||h===2&&g,e[h]=(g?[d,b,f,e[2]][h]*B(i)/\n100:B(i))+(a?c:0);return e}},Ga=function(){};Ga.prototype={init:function(a,b,c){this.series=a;this.color=a.color;this.applyOptions(b,c);this.pointAttr={};if(a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length))a.colorCounter=0;a.chart.pointCount++;return this},applyOptions:function(a,b){var c=this.series,d=c.options.pointValKey||c.pointValKey,a=Ga.prototype.optionsToObject.call(this,a);r(this,a);this.options=this.options?\nr(this.options,a):a;if(d)this.y=this[d];if(this.x===u&&c)this.x=b===u?c.autoIncrement():b;return this},optionsToObject:function(a){var b={},c=this.series,d=c.options.keys,e=d||c.pointArrayMap||[\"y\"],f=e.length,g=0,h=0;if(typeof a===\"number\"||a===null)b[e[0]]=a;else if(Ha(a)){if(!d&&a.length>f){c=typeof a[0];if(c===\"string\")b.name=a[0];else if(c===\"number\")b.x=a[0];g++}for(;h<f;)b[e[h++]]=a[g++]}else if(typeof a===\"object\"){b=a;if(a.dataLabels)c._hasPointLabels=!0;if(a.marker)c._hasPointMarkers=!0}return b},\ndestroy:function(){var a=this.series.chart,b=a.hoverPoints,c;a.pointCount--;if(b&&(this.setState(),ia(b,this),!b.length))a.hoverPoints=null;if(this===a.hoverPoint)this.onMouseOut();if(this.graphic||this.dataLabel)Y(this),this.destroyElements();this.legendItem&&a.legend.destroyItem(this);for(c in this)this[c]=null},destroyElements:function(){for(var a=\"graphic,dataLabel,dataLabelUpper,group,connector,shadowGroup\".split(\",\"),b,c=6;c--;)b=a[c],this[b]&&(this[b]=this[b].destroy())},getLabelConfig:function(){return{x:this.category,\ny:this.y,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var b=this.series,c=b.tooltipOptions,d=p(c.valueDecimals,\"\"),e=c.valuePrefix||\"\",f=c.valueSuffix||\"\";m(b.pointArrayMap||[\"y\"],function(b){b=\"{point.\"+b;if(e||f)a=a.replace(b+\"}\",e+b+\"}\"+f);a=a.replace(b+\"}\",b+\":,.\"+d+\"f}\")});return Ja(a,{point:this,series:this.series})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||\nd.options&&d.options.events&&d.options.events[a])&&this.importEvents();a===\"click\"&&e.allowPointSelect&&(c=function(a){d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)});M(this,a,b,c)}};var Q=w.Series=function(){};Q.prototype={isCartesian:!0,type:\"line\",pointClass:Ga,sorted:!0,requireSorting:!0,pointAttrToOptions:{stroke:\"lineColor\",\"stroke-width\":\"lineWidth\",fill:\"fillColor\",r:\"radius\"},axisTypes:[\"xAxis\",\"yAxis\"],colorCounter:0,parallelArrays:[\"x\",\"y\"],init:function(a,b){var c=this,d,e,f=a.series,\ng=function(a,b){return p(a.options.index,a._i)-p(b.options.index,b._i)};c.chart=a;c.options=b=c.setOptions(b);c.linkedSeries=[];c.bindAxes();r(c,{name:b.name,state:\"\",pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0});if(ea)b.animation=!1;e=b.events;for(d in e)N(c,d,e[d]);if(e&&e.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)a.runTrackerClick=!0;c.getColor();c.getSymbol();m(c.parallelArrays,function(a){c[a+\"Data\"]=[]});c.setData(b.data,!1);if(c.isCartesian)a.hasCartesianSeries=\n!0;f.push(c);c._i=f.length-1;qb(f,g);this.yAxis&&qb(this.yAxis.series,g);m(f,function(a,b){a.index=b;a.name=a.name||\"Series \"+(b+1)})},bindAxes:function(){var a=this,b=a.options,c=a.chart,d;m(a.axisTypes||[],function(e){m(c[e],function(c){d=c.options;if(b[e]===d.index||b[e]!==u&&b[e]===d.id||b[e]===u&&d.index===0)c.series.push(a),a[e]=c,c.isDirty=!0});!a[e]&&a.optionalAxis!==e&&ka(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments;m(c.parallelArrays,typeof b===\"number\"?function(d){var f=\nd===\"y\"&&c.toYData?c.toYData(a):a[d];c[d+\"Data\"][b]=f}:function(a){Array.prototype[b].apply(c[a+\"Data\"],Array.prototype.slice.call(d,2))})},autoIncrement:function(){var a=this.options,b=this.xIncrement,c,d=a.pointIntervalUnit,b=p(b,a.pointStart,0);this.pointInterval=c=p(this.pointInterval,a.pointInterval,1);if(d===\"month\"||d===\"year\")a=new Aa(b),a=d===\"month\"?+a[vb](a[Ya]()+c):+a[wb](a[Za]()+c),c=a-b;this.xIncrement=b+c;return b},getSegments:function(){var a=-1,b=[],c,d=this.points,e=d.length;if(e)if(this.options.connectNulls){for(c=\ne;c--;)d[c].y===null&&d.splice(c,1);d.length&&(b=[d])}else m(d,function(c,g){c.y===null?(g>a+1&&b.push(d.slice(a+1,g)),a=g):g===e-1&&b.push(d.slice(a+1,g+1))});this.segments=b},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},d=b.plotOptions||{},e=c[this.type];this.userOptions=a;c=z(e,c.series,a);this.tooltipOptions=z(P.tooltip,P.plotOptions[this.type].tooltip,b.tooltip,d.series&&d.series.tooltip,d[this.type]&&d[this.type].tooltip,a.tooltip);e.marker===null&&delete c.marker;\nthis.zoneAxis=c.zoneAxis;a=this.zones=(c.zones||[]).slice();if((c.negativeColor||c.negativeFillColor)&&!c.zones)a.push({value:c[this.zoneAxis+\"Threshold\"]||c.threshold||0,color:c.negativeColor,fillColor:c.negativeFillColor});a.length&&s(a[a.length-1].value)&&a.push({color:this.color,fillColor:this.fillColor});return c},getCyclic:function(a,b,c){var d=this.userOptions,e=\"_\"+a+\"Index\",f=a+\"Counter\";b||(s(d[e])?b=d[e]:(d[e]=b=this.chart[f]%c.length,this.chart[f]+=1),b=c[b]);this[a]=b},getColor:function(){this.options.colorByPoint||\nthis.getCyclic(\"color\",this.options.color||aa[this.type].color,this.chart.options.colors)},getSymbol:function(){var a=this.options.marker;this.getCyclic(\"symbol\",a.symbol,this.chart.options.symbols);if(/^url/.test(this.symbol))a.radius=0},drawLegendSymbol:Na.drawLineMarker,setData:function(a,b,c,d){var e=this,f=e.points,g=f&&f.length||0,h,i=e.options,j=e.chart,k=null,l=e.xAxis,n=l&&!!l.categories,o=i.turboThreshold,q=this.xData,y=this.yData,s=(h=e.pointArrayMap)&&h.length,a=a||[];h=a.length;b=p(b,\n!0);if(d!==!1&&h&&g===h&&!e.cropped&&!e.hasGroupedData&&e.visible)m(a,function(a,b){f[b].update(a,!1,null,!1)});else{e.xIncrement=null;e.pointRange=n?1:i.pointRange;e.colorCounter=0;m(this.parallelArrays,function(a){e[a+\"Data\"].length=0});if(o&&h>o){for(c=0;k===null&&c<h;)k=a[c],c++;if(qa(k)){n=p(i.pointStart,0);i=p(i.pointInterval,1);for(c=0;c<h;c++)q[c]=n,y[c]=a[c],n+=i;e.xIncrement=n}else if(Ha(k))if(s)for(c=0;c<h;c++)i=a[c],q[c]=i[0],y[c]=i.slice(1,s+1);else for(c=0;c<h;c++)i=a[c],q[c]=i[0],y[c]=\ni[1];else ka(12)}else for(c=0;c<h;c++)if(a[c]!==u&&(i={series:e},e.pointClass.prototype.applyOptions.apply(i,[a[c]]),e.updateParallelArrays(i,c),n&&i.name))l.names[i.x]=i.name;Da(y[0])&&ka(14,!0);e.data=[];e.options.data=a;for(c=g;c--;)f[c]&&f[c].destroy&&f[c].destroy();if(l)l.minRange=l.userMinRange;e.isDirty=e.isDirtyData=j.isDirtyBox=!0;c=!1}b&&j.redraw(c)},processData:function(a){var b=this.xData,c=this.yData,d=b.length,e;e=0;var f,g,h=this.xAxis,i,j=this.options;i=j.cropThreshold;var k=this.isCartesian,\nl,n;if(k&&!this.isDirty&&!h.isDirty&&!this.yAxis.isDirty&&!a)return!1;if(h)a=h.getExtremes(),l=a.min,n=a.max;if(k&&this.sorted&&(!i||d>i||this.forceCrop))if(b[d-1]<l||b[0]>n)b=[],c=[];else if(b[0]<l||b[d-1]>n)e=this.cropData(this.xData,this.yData,l,n),b=e.xData,c=e.yData,e=e.start,f=!0;for(i=b.length-1;i>=0;i--)d=b[i]-b[i-1],d>0&&(g===u||d<g)?g=d:d<0&&this.requireSorting&&ka(15);this.cropped=f;this.cropStart=e;this.processedXData=b;this.processedYData=c;if(j.pointRange===null)this.pointRange=g||1;\nthis.closestPointRange=g},cropData:function(a,b,c,d){var e=a.length,f=0,g=e,h=p(this.cropShoulder,1),i;for(i=0;i<e;i++)if(a[i]>=c){f=t(0,i-h);break}for(;i<e;i++)if(a[i]>d){g=i+h;break}return{xData:a.slice(f,g),yData:b.slice(f,g),start:f,end:g}},generatePoints:function(){var a=this.options.data,b=this.data,c,d=this.processedXData,e=this.processedYData,f=this.pointClass,g=d.length,h=this.cropStart||0,i,j=this.hasGroupedData,k,l=[],n;if(!b&&!j)b=[],b.length=a.length,b=this.data=b;for(n=0;n<g;n++)i=h+\nn,j?l[n]=(new f).init(this,[d[n]].concat(ra(e[n]))):(b[i]?k=b[i]:a[i]!==u&&(b[i]=k=(new f).init(this,a[i],d[n])),l[n]=k),l[n].index=i;if(b&&(g!==(c=b.length)||j))for(n=0;n<c;n++)if(n===h&&!j&&(n+=g),b[n])b[n].destroyElements(),b[n].plotX=u;this.data=b;this.points=l},getExtremes:function(a){var b=this.yAxis,c=this.processedXData,d,e=[],f=0;d=this.xAxis.getExtremes();var g=d.min,h=d.max,i,j,k,l,a=a||this.stackedYData||this.processedYData;d=a.length;for(l=0;l<d;l++)if(j=c[l],k=a[l],i=k!==null&&k!==u&&\n(!b.isLog||k.length||k>0),j=this.getExtremesFromAll||this.cropped||(c[l+1]||j)>=g&&(c[l-1]||j)<=h,i&&j)if(i=k.length)for(;i--;)k[i]!==null&&(e[f++]=k[i]);else e[f++]=k;this.dataMin=Pa(e);this.dataMax=Fa(e)},translate:function(){this.processedXData||this.processData();this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,e=this.yAxis,f=this.points,g=f.length,h=!!this.modifyValue,i=a.pointPlacement,j=i===\"between\"||qa(i),k=a.threshold,l,n,o,q=Number.MAX_VALUE,a=0;a<g;a++){var m=\nf[a],r=m.x,C=m.y;n=m.low;var v=b&&e.stacks[(this.negStacks&&C<k?\"-\":\"\")+this.stackKey];if(e.isLog&&C!==null&&C<=0)m.y=C=null,ka(10);m.plotX=l=c.translate(r,0,0,0,1,i,this.type===\"flags\");if(b&&this.visible&&v&&v[r])v=v[r],C=v.points[this.index+\",\"+a],n=C[0],C=C[1],n===0&&(n=p(k,e.min)),e.isLog&&n<=0&&(n=null),m.total=m.stackTotal=v.total,m.percentage=v.total&&m.y/v.total*100,m.stackY=C,v.setOffset(this.pointXOffset||0,this.barW||0);m.yBottom=s(n)?e.translate(n,0,1,0,1):null;h&&(C=this.modifyValue(C,\nm));m.plotY=n=typeof C===\"number\"&&C!==Infinity?I(t(-1E5,e.translate(C,0,1,0,1)),1E5):u;m.isInside=n!==u&&n>=0&&n<=e.len&&l>=0&&l<=c.len;m.clientX=j?c.translate(r,0,0,0,1):l;m.negative=m.y<(k||0);m.category=d&&d[m.x]!==u?d[m.x]:m.x;a&&(q=I(q,O(l-o)));o=l}this.closestPointRangePx=q;this.getSegments()},setClip:function(a){var b=this.chart,c=b.renderer,d=b.inverted,e=this.clipBox,f=e||b.clipBox,g=this.sharedClipKey||[\"_sharedClip\",a&&a.duration,a&&a.easing,f.height].join(\",\"),h=b[g],i=b[g+\"m\"];if(!h){if(a)f.width=\n0,b[g+\"m\"]=i=c.clipRect(-99,d?-b.plotLeft:-b.plotTop,99,d?b.chartWidth:b.chartHeight);b[g]=h=c.clipRect(f)}a&&(h.count+=1);if(this.options.clip!==!1)this.group.clip(a||e?h:b.clipRect),this.markerGroup.clip(i),this.sharedClipKey=g;a||(h.count-=1,h.count<=0&&g&&b[g]&&(e||(b[g]=b[g].destroy()),b[g+\"m\"]&&(b[g+\"m\"]=b[g+\"m\"].destroy())))},animate:function(a){var b=this.chart,c=this.options.animation,d;if(c&&!ca(c))c=aa[this.type].animation;a?this.setClip(c):(d=this.sharedClipKey,(a=b[d])&&a.animate({width:b.plotSizeX},\nc),b[d+\"m\"]&&b[d+\"m\"].animate({width:b.plotSizeX+99},c),this.animate=null)},afterAnimate:function(){this.setClip();M(this,\"afterAnimate\")},drawPoints:function(){var a,b=this.points,c=this.chart,d,e,f,g,h,i,j,k,l=this.options.marker,n=this.pointAttr[\"\"],o,q,m,s=this.markerGroup,t=p(l.enabled,this.xAxis.isRadial,this.closestPointRangePx>2*l.radius);if(l.enabled!==!1||this._hasPointMarkers)for(f=b.length;f--;)if(g=b[f],d=U(g.plotX),e=g.plotY,k=g.graphic,o=g.marker||{},q=!!g.marker,a=t&&o.enabled===u||\no.enabled,m=g.isInside,a&&e!==u&&!isNaN(e)&&g.y!==null)if(a=g.pointAttr[g.selected?\"select\":\"\"]||n,h=a.r,i=p(o.symbol,this.symbol),j=i.indexOf(\"url\")===0,k)k[m?\"show\":\"hide\"](!0).animate(r({x:d-h,y:e-h},k.symbolName?{width:2*h,height:2*h}:{}));else{if(m&&(h>0||j))g.graphic=c.renderer.symbol(i,d-h,e-h,2*h,2*h,q?o:l).attr(a).add(s)}else if(k)g.graphic=k.destroy()},convertAttribs:function(a,b,c,d){var e=this.pointAttrToOptions,f,g,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=p(a[g],b[f],\nc[f],d[f]);return h},getAttribs:function(){var a=this,b=a.options,c=aa[a.type].marker?b.marker:b,d=c.states,e=d.hover,f,g=a.color,h=a.options.negativeColor;f={stroke:g,fill:g};var i=a.points||[],j,k=[],l,n=a.pointAttrToOptions;l=a.hasPointSpecificOptions;var o=c.lineColor,q=c.fillColor;j=b.turboThreshold;var p=a.zones,t=a.zoneAxis||\"y\",C;b.marker?(e.radius=e.radius||c.radius+e.radiusPlus,e.lineWidth=e.lineWidth||c.lineWidth+e.lineWidthPlus):(e.color=e.color||na(e.color||g).brighten(e.brightness).get(),\ne.negativeColor=e.negativeColor||na(e.negativeColor||h).brighten(e.brightness).get());k[\"\"]=a.convertAttribs(c,f);m([\"hover\",\"select\"],function(b){k[b]=a.convertAttribs(d[b],k[\"\"])});a.pointAttr=k;g=i.length;if(!j||g<j||l)for(;g--;){j=i[g];if((c=j.options&&j.options.marker||j.options)&&c.enabled===!1)c.radius=0;if(p.length){l=0;for(f=p[l];j[t]>=f.value;)f=p[++l];j.color=j.fillColor=f.color}l=b.colorByPoint||j.color;if(j.options)for(C in n)s(c[n[C]])&&(l=!0);if(l){c=c||{};l=[];d=c.states||{};f=d.hover=\nd.hover||{};if(!b.marker)f.color=f.color||!j.options.color&&e[j.negative&&h?\"negativeColor\":\"color\"]||na(j.color).brighten(f.brightness||e.brightness).get();f={color:j.color};if(!q)f.fillColor=j.color;if(!o)f.lineColor=j.color;c.hasOwnProperty(\"color\")&&!c.color&&delete c.color;l[\"\"]=a.convertAttribs(r(f,c),k[\"\"]);l.hover=a.convertAttribs(d.hover,k.hover,l[\"\"]);l.select=a.convertAttribs(d.select,k.select,l[\"\"])}else l=k;j.pointAttr=l}},destroy:function(){var a=this,b=a.chart,c=/AppleWebKit\\/533/.test(Ba),\nd,e=a.data||[],f,g,h;M(a,\"destroy\");Y(a);m(a.axisTypes||[],function(b){if(h=a[b])ia(h.series,a),h.isDirty=h.forceRedraw=!0});a.legendItem&&a.chart.legend.destroyItem(a);for(d=e.length;d--;)(f=e[d])&&f.destroy&&f.destroy();a.points=null;clearTimeout(a.animationTimeout);for(g in a)a[g]instanceof K&&!a[g].survive&&(d=c&&g===\"group\"?\"hide\":\"destroy\",a[g][d]());if(b.hoverSeries===a)b.hoverSeries=null;ia(b.series,a);for(g in a)delete a[g]},getSegmentPath:function(a){var b=this,c=[],d=b.options.step;m(a,\nfunction(e,f){var g=e.plotX,h=e.plotY,i;b.getPointSpline?c.push.apply(c,b.getPointSpline(a,e,f)):(c.push(f?\"L\":\"M\"),d&&f&&(i=a[f-1],d===\"right\"?c.push(i.plotX,h):d===\"center\"?c.push((i.plotX+g)/2,i.plotY,(i.plotX+g)/2,h):c.push(g,i.plotY)),c.push(e.plotX,e.plotY))});return c},getGraphPath:function(){var a=this,b=[],c,d=[];m(a.segments,function(e){c=a.getSegmentPath(e);e.length>1?b=b.concat(c):d.push(e[0])});a.singlePoints=d;return a.graphPath=b},drawGraph:function(){var a=this,b=this.options,c=[[\"graph\",\nb.lineColor||this.color,b.dashStyle]],d=b.lineWidth,e=b.linecap!==\"square\",f=this.getGraphPath(),g=this.fillGraph&&this.color||R;m(this.zones,function(d,e){c.push([\"zoneGraph\"+e,d.color||a.color,d.dashStyle||b.dashStyle])});m(c,function(c,i){var j=c[0],k=a[j];if(k)db(k),k.animate({d:f});else if((d||g)&&f.length)k={stroke:c[1],\"stroke-width\":d,fill:g,zIndex:1},c[2]?k.dashstyle=c[2]:e&&(k[\"stroke-linecap\"]=k[\"stroke-linejoin\"]=\"round\"),a[j]=a.chart.renderer.path(f).attr(k).add(a.group).shadow(i<2&&\nb.shadow)})},applyZones:function(){var a=this,b=this.chart,c=b.renderer,d=this.zones,e,f,g=this.clips||[],h,i=this.graph,j=this.area,k=t(b.chartWidth,b.chartHeight),l=this[(this.zoneAxis||\"y\")+\"Axis\"],n=l.reversed,o=l.horiz,q=!1;if(d.length&&(i||j))i&&i.hide(),j&&j.hide(),m(d,function(d,m){e=p(f,n?o?b.plotWidth:0:o?0:l.toPixels(l.min));f=x(l.toPixels(p(d.value,l.max),!0));e=l.isXAxis?e>f?f:e:e<f?f:e;q&&(e=f=l.toPixels(l.max));if(l.isXAxis){if(h={x:n?f:e,y:0,width:Math.abs(e-f),height:k},!o)h.x=b.plotHeight-\nh.x}else if(h={x:0,y:n?e:f,width:k,height:Math.abs(e-f)},o)h.y=b.plotWidth-h.y;b.inverted&&c.isVML&&(h=l.isXAxis?{x:0,y:n?e:f,height:h.width,width:b.chartWidth}:{x:h.y-b.plotLeft-b.spacingBox.x,y:0,width:h.height,height:b.chartHeight});g[m]?g[m].animate(h):(g[m]=c.clipRect(h),i&&a[\"zoneGraph\"+m].clip(g[m]),j&&a[\"zoneArea\"+m].clip(g[m]));q=d.value>l.max}),this.clips=g},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};m([\"group\",\"markerGroup\"],function(c){b[c]&&b[c].attr(a).invert()})}\nvar b=this,c=b.chart;if(b.xAxis)N(c,\"resize\",a),N(b,\"destroy\",function(){Y(c,\"resize\",a)}),a(),b.invertGroups=a},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;g&&(this[a]=f=this.chart.renderer.g(b).attr({visibility:c,zIndex:d||0.1}).add(e));f[g?\"attr\":\"animate\"](this.getPlotBox());return f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;if(a.inverted)b=c,c=this.xAxis;return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=\nthis,b=a.chart,c,d=a.options,e=(c=d.animation)&&!!a.animate&&b.renderer.isSVG&&p(c.duration,500)||0,f=a.visible?\"visible\":\"hidden\",g=d.zIndex,h=a.hasRendered,i=b.seriesGroup;c=a.plotGroup(\"group\",\"series\",f,g,i);a.markerGroup=a.plotGroup(\"markerGroup\",\"markers\",f,g,i);e&&a.animate(!0);a.getAttribs();c.inverted=a.isCartesian?b.inverted:!1;a.drawGraph&&(a.drawGraph(),a.applyZones());m(a.points,function(a){a.redraw&&a.redraw()});a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&\na.options.enableMouseTracking!==!1&&a.drawTracker();b.inverted&&a.invertGroups();d.clip!==!1&&!a.sharedClipKey&&!h&&c.clip(b.clipRect);e&&a.animate();if(!h)e?a.animationTimeout=setTimeout(function(){a.afterAnimate()},e):a.afterAnimate();a.isDirty=a.isDirtyData=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirtyData,c=this.isDirty,d=this.group,e=this.xAxis,f=this.yAxis;d&&(a.inverted&&d.attr({width:a.plotWidth,height:a.plotHeight}),d.animate({translateX:p(e&&e.left,a.plotLeft),translateY:p(f&&\nf.top,a.plotTop)}));this.translate();this.render();b&&M(this,\"updatedData\");(c||b)&&delete this.kdTree},kdDimensions:1,kdTree:null,kdAxisArray:[\"clientX\",\"plotY\"],kdComparer:\"distX\",searchPoint:function(a){var b=this.xAxis,c=this.yAxis,d=this.chart.inverted;return this.searchKDTree({clientX:d?b.len-a.chartY+b.pos:a.chartX-b.pos,plotY:d?c.len-a.chartX+c.pos:a.chartY-c.pos})},buildKDTree:function(){function a(b,d,g){var h,i;if(i=b&&b.length)return h=c.kdAxisArray[d%g],b.sort(function(a,b){return a[h]-\nb[h]}),i=Math.floor(i/2),{point:b[i],left:a(b.slice(0,i),d+1,g),right:a(b.slice(i+1),d+1,g)}}function b(){var b=kb(c.points,function(a){return a.y!==null});c.kdTree=a(b,d,d)}var c=this,d=c.kdDimensions;delete c.kdTree;c.options.kdSync?b():setTimeout(b)},searchKDTree:function(a){function b(a,h,i,j){var k=h.point,l=c.kdAxisArray[i%j],n,o=k;n=s(a[e])&&s(k[e])?Math.pow(a[e]-k[e],2):null;var m=s(a[f])&&s(k[f])?Math.pow(a[f]-k[f],2):null,p=(n||0)+(m||0);n={distX:s(n)?Math.sqrt(n):Number.MAX_VALUE,distY:s(m)?\nMath.sqrt(m):Number.MAX_VALUE,distR:s(p)?Math.sqrt(p):Number.MAX_VALUE};k.dist=n;l=a[l]-k[l];n=l<0?\"left\":\"right\";h[n]&&(n=b(a,h[n],i+1,j),o=n.dist[d]<o.dist[d]?n:k,k=l<0?\"right\":\"left\",h[k]&&Math.sqrt(l*l)<o.dist[d]&&(a=b(a,h[k],i+1,j),o=a.dist[d]<o.dist[d]?a:o));return o}var c=this,d=this.kdComparer,e=this.kdAxisArray[0],f=this.kdAxisArray[1];this.kdTree||this.buildKDTree();if(this.kdTree)return b(a,this.kdTree,this.kdDimensions,this.kdDimensions)}};Hb.prototype={destroy:function(){Qa(this,this.axis)},\nrender:function(a){var b=this.options,c=b.format,c=c?Ja(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:\"hidden\"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,rotation:b.rotation,visibility:\"hidden\"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=c.reversed,f=this.isNegative&&!f||!this.isNegative&&f,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0),c=O(g-c),h=d.xAxis[0].translate(this.x)+\na,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};if(e=this.label)e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?\"show\":\"hide\"](!0)}};va.prototype.buildStacks=function(){var a=this.series,b=p(this.options.reversedStacks,!0),c=a.length;if(!this.isXAxis){for(this.usePercentage=!1;c--;)a[b?c:a.length-c-1].setStackedPoints();if(this.usePercentage)for(c=0;c<a.length;c++)a[c].setPercentStacks()}};va.prototype.renderStackTotals=\nfunction(){var a=this.chart,b=a.renderer,c=this.stacks,d,e,f=this.stackTotalGroup;if(!f)this.stackTotalGroup=f=b.g(\"stack-labels\").attr({visibility:\"visible\",zIndex:6}).add();f.translate(a.plotLeft,a.plotTop);for(d in c)for(e in a=c[d],a)a[e].render(f)};Q.prototype.setStackedPoints=function(){if(this.options.stacking&&!(this.visible!==!0&&this.chart.options.chart.ignoreHiddenSeries!==!1)){var a=this.processedXData,b=this.processedYData,c=[],d=b.length,e=this.options,f=e.threshold,g=e.stack,e=e.stacking,\nh=this.stackKey,i=\"-\"+h,j=this.negStacks,k=this.yAxis,l=k.stacks,n=k.oldStacks,o,m,p,s,r,v;for(s=0;s<d;s++){r=a[s];v=b[s];p=this.index+\",\"+s;m=(o=j&&v<f)?i:h;l[m]||(l[m]={});if(!l[m][r])n[m]&&n[m][r]?(l[m][r]=n[m][r],l[m][r].total=null):l[m][r]=new Hb(k,k.options.stackLabels,o,r,g);m=l[m][r];m.points[p]=[m.cum||0];e===\"percent\"?(o=o?h:i,j&&l[o]&&l[o][r]?(o=l[o][r],m.total=o.total=t(o.total,m.total)+O(v)||0):m.total=da(m.total+(O(v)||0))):m.total=da(m.total+(v||0));m.cum=(m.cum||0)+(v||0);m.points[p].push(m.cum);\nc[s]=m.cum}if(e===\"percent\")k.usePercentage=!0;this.stackedYData=c;k.oldStacks={}}};Q.prototype.setPercentStacks=function(){var a=this,b=a.stackKey,c=a.yAxis.stacks,d=a.processedXData;m([b,\"-\"+b],function(b){var e;for(var f=d.length,g,h;f--;)if(g=d[f],e=(h=c[b]&&c[b][g])&&h.points[a.index+\",\"+f],g=e)h=h.total?100/h.total:0,g[0]=da(g[0]*h),g[1]=da(g[1]*h),a.stackedYData[f]=g[1]})};r(D.prototype,{addSeries:function(a,b,c){var d,e=this;a&&(b=p(b,!0),M(e,\"addSeries\",{options:a},function(){d=e.initSeries(a);\ne.isDirtyLegend=!0;e.linkSeries();b&&e.redraw(c)}));return d},addAxis:function(a,b,c,d){var e=b?\"xAxis\":\"yAxis\",f=this.options;new va(this,z(a,{index:this[e].length,isX:b}));f[e]=ra(f[e]||{});f[e].push(a);p(c,!0)&&this.redraw(d)},showLoading:function(a){var b=this,c=b.options,d=b.loadingDiv,e=c.loading,f=function(){d&&F(d,{left:b.plotLeft+\"px\",top:b.plotTop+\"px\",width:b.plotWidth+\"px\",height:b.plotHeight+\"px\"})};if(!d)b.loadingDiv=d=Z(Ka,{className:\"highcharts-loading\"},r(e.style,{zIndex:10,display:R}),\nb.container),b.loadingSpan=Z(\"span\",null,e.labelStyle,d),N(b,\"redraw\",f);b.loadingSpan.innerHTML=a||c.lang.loading;if(!b.loadingShown)F(d,{opacity:0,display:\"\"}),lb(d,{opacity:e.style.opacity},{duration:e.showDuration||0}),b.loadingShown=!0;f()},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&lb(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){F(b,{display:R})}});this.loadingShown=!1}});r(Ga.prototype,{update:function(a,b,c,d){function e(){f.applyOptions(a);if(ca(a)&&\n!Ha(a))f.redraw=function(){if(h)a&&a.marker&&a.marker.symbol?f.graphic=h.destroy():h.attr(f.pointAttr[f.state||\"\"]);if(a&&a.dataLabels&&f.dataLabel)f.dataLabel=f.dataLabel.destroy();f.redraw=null};i=f.index;g.updateParallelArrays(f,i);if(l&&f.name)l[f.x]=f.name;k.data[i]=f.options;g.isDirty=g.isDirtyData=!0;if(!g.fixedBox&&g.hasCartesianSeries)j.isDirtyBox=!0;j.legend.display&&k.legendType===\"point\"&&(g.updateTotals(),j.legend.clearItems());b&&j.redraw(c)}var f=this,g=f.series,h=f.graphic,i,j=g.chart,\nk=g.options,l=g.xAxis&&g.xAxis.names,b=p(b,!0);d===!1?e():f.firePointEvent(\"update\",{options:a},e)},remove:function(a,b){this.series.removePoint(Ma(this,this.series.data),a,b)}});r(Q.prototype,{addPoint:function(a,b,c,d){var e=this,f=e.options,g=e.data,h=e.graph,i=e.area,j=e.chart,k=e.xAxis&&e.xAxis.names,l=h&&h.shift||0,n=[\"graph\",\"area\"],h=f.data,o,q=e.xData;Sa(d,j);if(c){for(d=e.zones.length;d--;)n.push(\"zoneGraph\"+d,\"zoneArea\"+d);m(n,function(a){if(e[a])e[a].shift=l+1})}if(i)i.isArea=!0;b=p(b,\n!0);i={series:e};e.pointClass.prototype.applyOptions.apply(i,[a]);n=i.x;d=q.length;if(e.requireSorting&&n<q[d-1])for(o=!0;d&&q[d-1]>n;)d--;e.updateParallelArrays(i,\"splice\",d,0,0);e.updateParallelArrays(i,d);if(k&&i.name)k[n]=i.name;h.splice(d,0,a);o&&(e.data.splice(d,0,null),e.processData());f.legendType===\"point\"&&e.generatePoints();c&&(g[0]&&g[0].remove?g[0].remove(!1):(g.shift(),e.updateParallelArrays(i,\"shift\"),h.shift()));e.isDirty=!0;e.isDirtyData=!0;b&&(e.getAttribs(),j.redraw())},removePoint:function(a,\nb,c){var d=this,e=d.data,f=e[a],g=d.points,h=d.chart,i=function(){e.length===g.length&&g.splice(a,1);e.splice(a,1);d.options.data.splice(a,1);d.updateParallelArrays(f||{series:d},\"splice\",a,1);f&&f.destroy();d.isDirty=!0;d.isDirtyData=!0;b&&h.redraw()};Sa(c,h);b=p(b,!0);f?f.firePointEvent(\"remove\",null,i):i()},remove:function(a,b){var c=this,d=c.chart,a=p(a,!0);if(!c.isRemoving)c.isRemoving=!0,M(c,\"remove\",null,function(){c.destroy();d.isDirtyLegend=d.isDirtyBox=!0;d.linkSeries();a&&d.redraw(b)});\nc.isRemoving=!1},update:function(a,b){var c=this,d=this.chart,e=this.userOptions,f=this.type,g=J[f].prototype,h=[\"group\",\"markerGroup\",\"dataLabelsGroup\"],i;if(a.type&&a.type!==f||a.zIndex!==void 0)h.length=0;m(h,function(a){h[a]=c[a];delete c[a]});a=z(e,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a);this.remove(!1);for(i in g)this[i]=u;r(this,J[a.type||f].prototype);m(h,function(a){c[a]=h[a]});this.init(d,a);d.linkSeries();p(b,!0)&&d.redraw(!1)}});r(va.prototype,\n{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=z(this.userOptions,a);this.destroy(!0);this._addedPlotLB=u;this.init(c,r(a,{events:u}));c.isDirtyBox=!0;p(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);ia(b.axes,this);ia(b[c],this);b.options[c].splice(this.options.index,1);m(b[c],function(a,b){a.options.index=b});this.destroy();b.isDirtyBox=!0;p(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},\nb)},setCategories:function(a,b){this.update({categories:a},b)}});var xa=ja(Q);J.line=xa;aa.area=z(T,{threshold:0});var pa=ja(Q,{type:\"area\",getSegments:function(){var a=this,b=[],c=[],d=[],e=this.xAxis,f=this.yAxis,g=f.stacks[this.stackKey],h={},i,j,k=this.points,l=this.options.connectNulls,n,o;if(this.options.stacking&&!this.cropped){for(n=0;n<k.length;n++)h[k[n].x]=k[n];for(o in g)g[o].total!==null&&d.push(+o);d.sort(function(a,b){return a-b});m(d,function(b){var d=0,k;if(!l||h[b]&&h[b].y!==null)if(h[b])c.push(h[b]);\nelse{for(n=a.index;n<=f.series.length;n++)if(k=g[b].points[n+\",\"+b]){d=k[1];break}i=e.translate(b);j=f.toPixels(d,!0);c.push({y:null,plotX:i,clientX:i,plotY:j,yBottom:j,onMouseOver:ma})}});c.length&&b.push(c)}else Q.prototype.getSegments.call(this),b=this.segments;this.segments=b},getSegmentPath:function(a){var b=Q.prototype.getSegmentPath.call(this,a),c=[].concat(b),d,e=this.options;d=b.length;var f=this.yAxis.getThreshold(e.threshold),g;d===3&&c.push(\"L\",b[1],b[2]);if(e.stacking&&!this.closedStacks)for(d=\na.length-1;d>=0;d--)g=p(a[d].yBottom,f),d<a.length-1&&e.step&&c.push(a[d+1].plotX,g),c.push(a[d].plotX,g);else this.closeSegment(c,a,f);this.areaPath=this.areaPath.concat(c);return b},closeSegment:function(a,b,c){a.push(\"L\",b[b.length-1].plotX,c,\"L\",b[0].plotX,c)},drawGraph:function(){this.areaPath=[];Q.prototype.drawGraph.apply(this);var a=this,b=this.areaPath,c=this.options,d=[[\"area\",this.color,c.fillColor]];m(this.zones,function(b,f){d.push([\"zoneArea\"+f,b.color||a.color,b.fillColor||c.fillColor])});\nm(d,function(d){var f=d[0],g=a[f];g?g.animate({d:b}):a[f]=a.chart.renderer.path(b).attr({fill:p(d[2],na(d[1]).setOpacity(p(c.fillOpacity,0.75)).get()),zIndex:0}).add(a.group)})},drawLegendSymbol:Na.drawRectangle});J.area=pa;aa.spline=z(T);xa=ja(Q,{type:\"spline\",getPointSpline:function(a,b,c){var d=b.plotX,e=b.plotY,f=a[c-1],g=a[c+1],h,i,j,k;if(f&&g){a=f.plotY;j=g.plotX;var g=g.plotY,l;h=(1.5*d+f.plotX)/2.5;i=(1.5*e+a)/2.5;j=(1.5*d+j)/2.5;k=(1.5*e+g)/2.5;l=(k-i)*(j-d)/(j-h)+e-k;i+=l;k+=l;i>a&&i>e?\n(i=t(a,e),k=2*e-i):i<a&&i<e&&(i=I(a,e),k=2*e-i);k>g&&k>e?(k=t(g,e),i=2*e-k):k<g&&k<e&&(k=I(g,e),i=2*e-k);b.rightContX=j;b.rightContY=k}c?(b=[\"C\",f.rightContX||f.plotX,f.rightContY||f.plotY,h||d,i||e,d,e],f.rightContX=f.rightContY=null):b=[\"M\",d,e];return b}});J.spline=xa;aa.areaspline=z(aa.area);pa=pa.prototype;xa=ja(xa,{type:\"areaspline\",closedStacks:!0,getSegmentPath:pa.getSegmentPath,closeSegment:pa.closeSegment,drawGraph:pa.drawGraph,drawLegendSymbol:Na.drawRectangle});J.areaspline=xa;aa.column=\nz(T,{borderColor:\"#FFFFFF\",borderRadius:0,groupPadding:0.2,marker:null,pointPadding:0.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:0.1,shadow:!1,halo:!1},select:{color:\"#C0C0C0\",borderColor:\"#000000\",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},stickyTracking:!1,tooltip:{distance:6},threshold:0});xa=ja(Q,{type:\"column\",pointAttrToOptions:{stroke:\"borderColor\",fill:\"color\",r:\"borderRadius\"},cropShoulder:0,directTouch:!0,trackerGroups:[\"group\",\"dataLabelsGroup\"],\nnegStacks:!0,init:function(){Q.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasRendered&&m(b.series,function(b){if(b.type===a.type)b.isDirty=!0})},getColumnMetrics:function(){var a=this,b=a.options,c=a.xAxis,d=a.yAxis,e=c.reversed,f,g={},h,i=0;b.grouping===!1?i=1:m(a.chart.series,function(b){var c=b.options,e=b.yAxis;if(b.type===a.type&&b.visible&&d.len===e.len&&d.pos===e.pos)c.stacking?(f=b.stackKey,g[f]===u&&(g[f]=i++),h=g[f]):c.grouping!==!1&&(h=i++),b.columnIndex=h});var c=I(O(c.transA)*\n(c.ordinalSlope||b.pointRange||c.closestPointRange||c.tickInterval||1),c.len),j=c*b.groupPadding,k=(c-2*j)/i,l=b.pointWidth,b=s(l)?(k-l)/2:k*b.pointPadding,l=p(l,k-2*b);return a.columnMetrics={width:l,offset:b+(j+((e?i-(a.columnIndex||0):a.columnIndex)||0)*k-c/2)*(e?-1:1)}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=p(c.borderWidth,a.closestPointRange*a.xAxis.transA<2?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=p(c.minPointLength,5),h=a.getColumnMetrics(),\ni=h.width,j=a.barW=t(i,1+2*d),k=a.pointXOffset=h.offset,l=-(d%2?0.5:0),n=d%2?0.5:1;b.inverted&&(f-=0.5,b.renderer.isVML&&(n+=1));c.pointPadding&&(j=sa(j));Q.prototype.translate.apply(a);m(a.points,function(c){var d=p(c.yBottom,f),h=I(t(-999-d,c.plotY),e.len+999+d),m=c.plotX+k,s=j,r=I(h,d),u,w;u=t(h,d)-r;O(u)<g&&g&&(u=g,w=!e.reversed&&!c.negative||e.reversed&&c.negative,r=x(O(r-f)>g?d-g:f-(w?g:0)));c.barX=m;c.pointWidth=i;c.tooltipPos=b.inverted?[e.len+e.pos-b.plotLeft-h,a.xAxis.len-m-s/2]:[m+s/2,\nh+e.pos-b.plotTop];s=x(m+s)+l;m=x(m)+l;s-=m;d=O(r)<0.5;u=I(x(r+u)+n,9E4);r=x(r)+n;u-=r;d&&(r-=1,u+=1);c.shapeType=\"rect\";c.shapeArgs={x:m,y:r,width:s,height:u}})},getSymbol:ma,drawLegendSymbol:Na.drawRectangle,drawGraph:ma,drawPoints:function(){var a=this,b=this.chart,c=a.options,d=b.renderer,e=c.animationLimit||250,f,g;m(a.points,function(h){var i=h.plotY,j=h.graphic;if(i!==u&&!isNaN(i)&&h.y!==null)f=h.shapeArgs,i=s(a.borderWidth)?{\"stroke-width\":a.borderWidth}:{},g=h.pointAttr[h.selected?\"select\":\n\"\"]||a.pointAttr[\"\"],j?(db(j),j.attr(i)[b.pointCount<e?\"animate\":\"attr\"](z(f))):h.graphic=d[h.shapeType](f).attr(i).attr(g).add(a.group).shadow(c.shadow,null,c.stacking&&!c.borderRadius);else if(j)h.graphic=j.destroy()})},animate:function(a){var b=this.yAxis,c=this.options,d=this.chart.inverted,e={};if(ba)a?(e.scaleY=0.001,a=I(b.pos+b.len,t(b.pos,b.toPixels(c.threshold))),d?e.translateX=a-b.len:e.translateY=a,this.group.attr(e)):(e.scaleY=1,e[d?\"translateX\":\"translateY\"]=b.pos,this.group.animate(e,\nthis.options.animation),this.animate=null)},remove:function(){var a=this,b=a.chart;b.hasRendered&&m(b.series,function(b){if(b.type===a.type)b.isDirty=!0});Q.prototype.remove.apply(a,arguments)}});J.column=xa;aa.bar=z(aa.column);pa=ja(xa,{type:\"bar\",inverted:!0});J.bar=pa;aa.scatter=z(T,{lineWidth:0,marker:{enabled:!0},tooltip:{headerFormat:'<span style=\"color:{series.color}\">\\u25CF</span> <span style=\"font-size: 10px;\"> {series.name}</span><br/>',pointFormat:\"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>\"}});\npa=ja(Q,{type:\"scatter\",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:[\"group\",\"markerGroup\",\"dataLabelsGroup\"],takeOrdinalPosition:!1,kdDimensions:2,kdComparer:\"distR\",drawGraph:function(){this.options.lineWidth&&Q.prototype.drawGraph.call(this)}});J.scatter=pa;aa.pie=z(T,{borderColor:\"#FFFFFF\",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name},x:0},ignoreHiddenPoint:!0,legendType:\"point\",marker:null,\nsize:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:0.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}});T={type:\"pie\",isCartesian:!1,pointClass:ja(Ga,{init:function(){Ga.prototype.init.apply(this,arguments);var a=this,b;r(a,{visible:a.visible!==!1,name:p(a.name,\"Slice\")});b=function(b){a.slice(b.type===\"select\")};N(a,\"select\",b);N(a,\"unselect\",b);return a},setVisible:function(a,b){var c=this,d=c.series,e=d.chart,f=!d.isDirty&&d.options.ignoreHiddenPoint;if(a!==c.visible||\nb)if(c.visible=c.options.visible=a=a===u?!c.visible:a,d.options.data[Ma(c,d.data)]=c.options,m([\"graphic\",\"dataLabel\",\"connector\",\"shadowGroup\"],function(b){if(c[b])c[b][a?\"show\":\"hide\"](!0)}),c.legendItem&&(e.hasRendered&&(d.updateTotals(),e.legend.clearItems(),f||e.legend.render()),e.legend.colorizeItem(c,a)),f)d.isDirty=!0,e.redraw()},slice:function(a,b,c){var d=this.series;Sa(c,d.chart);p(b,!0);this.sliced=this.options.sliced=a=s(a)?a:!this.sliced;d.options.data[Ma(this,d.data)]=this.options;\na=a?this.slicedTranslation:{translateX:0,translateY:0};this.graphic.animate(a);this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,noSharedTooltip:!0,trackerGroups:[\"group\",\"dataLabelsGroup\"],axisTypes:[],pointAttrToOptions:{stroke:\"borderColor\",\"stroke-width\":\"borderWidth\",\nfill:\"color\"},getColor:ma,animate:function(a){var b=this,c=b.points,d=b.startAngleRad;if(!a)m(c,function(a){var c=a.graphic,g=a.shapeArgs;c&&(c.attr({r:a.startR||b.center[3]/2,start:d,end:d}),c.animate({r:g.r,start:g.start,end:g.end},b.options.animation))}),b.animate=null},setData:function(a,b,c,d){Q.prototype.setData.call(this,a,!1,c,d);this.processData();this.generatePoints();p(b,!0)&&this.chart.redraw(c)},updateTotals:function(){var a,b=0,c,d,e,f=this.options.ignoreHiddenPoint;c=this.points;d=\nc.length;for(a=0;a<d;a++){e=c[a];if(e.y<0)e.y=null;b+=f&&!e.visible?0:e.y}this.total=b;for(a=0;a<d;a++)e=c[a],e.percentage=b>0&&(e.visible||!f)?e.y/b*100:0,e.total=b},generatePoints:function(){Q.prototype.generatePoints.call(this);this.updateTotals()},translate:function(a){this.generatePoints();var b=0,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,f,g,h,i=c.startAngle||0,j=this.startAngleRad=la/180*(i-90),i=(this.endAngleRad=la/180*(p(c.endAngle,i+360)-90))-j,k=this.points,l=c.dataLabels.distance,\nc=c.ignoreHiddenPoint,n,m=k.length,q;if(!a)this.center=a=this.getCenter();this.getX=function(b,c){h=V.asin(I((b-a[1])/(a[2]/2+l),1));return a[0]+(c?-1:1)*W(h)*(a[2]/2+l)};for(n=0;n<m;n++){q=k[n];f=j+b*i;if(!c||q.visible)b+=q.percentage/100;g=j+b*i;q.shapeType=\"arc\";q.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:x(f*1E3)/1E3,end:x(g*1E3)/1E3};h=(g+f)/2;h>1.5*la?h-=2*la:h<-la/2&&(h+=2*la);q.slicedTranslation={translateX:x(W(h)*d),translateY:x($(h)*d)};f=W(h)*a[2]/2;g=$(h)*a[2]/2;q.tooltipPos=\n[a[0]+f*0.7,a[1]+g*0.7];q.half=h<-la/2||h>la/2?1:0;q.angle=h;e=I(e,l/2);q.labelPos=[a[0]+f+W(h)*l,a[1]+g+$(h)*l,a[0]+f+W(h)*e,a[1]+g+$(h)*e,a[0]+f,a[1]+g,l<0?\"center\":q.half?\"right\":\"left\",h]}},drawGraph:null,drawPoints:function(){var a=this,b=a.chart.renderer,c,d,e=a.options.shadow,f,g;if(e&&!a.shadowGroup)a.shadowGroup=b.g(\"shadow\").add(a.group);m(a.points,function(h){var i=h.options.visible;d=h.graphic;g=h.shapeArgs;f=h.shadowGroup;if(e&&!f)f=h.shadowGroup=b.g(\"shadow\").add(a.shadowGroup);c=h.sliced?\nh.slicedTranslation:{translateX:0,translateY:0};f&&f.attr(c);d?d.animate(r(g,c)):h.graphic=d=b[h.shapeType](g).setRadialReference(a.center).attr(h.pointAttr[h.selected?\"select\":\"\"]).attr({\"stroke-linejoin\":\"round\"}).attr(c).add(a.group).shadow(e,f);i!==void 0&&h.setVisible(i,!0)})},searchPoint:ma,sortByAngle:function(a,b){a.sort(function(a,d){return a.angle!==void 0&&(d.angle-a.angle)*b})},drawLegendSymbol:Na.drawRectangle,getCenter:Xb.getCenter,getSymbol:ma};T=ja(Q,T);J.pie=T;Q.prototype.drawDataLabels=\nfunction(){var a=this,b=a.options,c=b.cursor,d=b.dataLabels,e=a.points,f,g,h=a.hasRendered||0,i,j,k=a.chart.renderer;if(d.enabled||a._hasPointLabels)a.dlProcessOptions&&a.dlProcessOptions(d),j=a.plotGroup(\"dataLabelsGroup\",\"data-labels\",d.defer?\"hidden\":\"visible\",d.zIndex||6),p(d.defer,!0)&&(j.attr({opacity:+h}),h||N(a,\"afterAnimate\",function(){a.visible&&j.show();j[b.animation?\"animate\":\"attr\"]({opacity:1},{duration:200})})),g=d,m(e,function(e){var h,m=e.dataLabel,q,t,x=e.connector,w=!0,v,A={};f=\ne.dlOptions||e.options&&e.options.dataLabels;h=p(f&&f.enabled,g.enabled);if(m&&!h)e.dataLabel=m.destroy();else if(h){d=z(g,f);v=d.style;h=d.rotation;q=e.getLabelConfig();i=d.format?Ja(d.format,q):d.formatter.call(q,d);v.color=p(d.color,v.color,a.color,\"black\");if(m)if(s(i))m.attr({text:i}),w=!1;else{if(e.dataLabel=m=m.destroy(),x)e.connector=x.destroy()}else if(s(i)){m={fill:d.backgroundColor,stroke:d.borderColor,\"stroke-width\":d.borderWidth,r:d.borderRadius||0,rotation:h,padding:d.padding,zIndex:1};\nif(v.color===\"contrast\")A.color=d.inside||d.distance<0||b.stacking?k.getContrast(e.color||a.color):\"#000000\";if(c)A.cursor=c;for(t in m)m[t]===u&&delete m[t];m=e.dataLabel=k[h?\"text\":\"label\"](i,0,-999,d.shape,null,null,d.useHTML).attr(m).css(r(v,A)).add(j).shadow(d.shadow)}m&&a.alignDataLabel(e,m,d,null,w)}})};Q.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=p(a.plotX,-999),i=p(a.plotY,-999),j=b.getBBox(),k=f.renderer.fontMetrics(c.style.fontSize).b,l=this.visible&&(a.series.forceDL||\nf.isInsidePlot(h,x(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g));if(l)d=r({x:g?f.plotWidth-i:h,y:x(g?f.plotHeight-h:i),width:0,height:0},d),r(c,{width:j.width,height:j.height}),c.rotation?(a=f.renderer.rotCorr(k,c.rotation),b[e?\"attr\":\"animate\"]({x:d.x+c.x+d.width/2+a.x,y:d.y+c.y+d.height/2}).attr({align:c.align})):(b.align(c,null,d),g=b.alignAttr,p(c.overflow,\"justify\")===\"justify\"?this.justifyDataLabel(b,c,g,j,d,e):p(c.crop,!0)&&(l=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+j.width,g.y+\nj.height)),c.shape&&b.attr({anchorX:a.plotX,anchorY:a.plotY}));if(!l)b.attr({y:-999}),b.placed=!1};Q.prototype.justifyDataLabel=function(a,b,c,d,e,f){var g=this.chart,h=b.align,i=b.verticalAlign,j,k,l=a.box?0:a.padding||0;j=c.x+l;if(j<0)h===\"right\"?b.align=\"left\":b.x=-j,k=!0;j=c.x+d.width-l;if(j>g.plotWidth)h===\"left\"?b.align=\"right\":b.x=g.plotWidth-j,k=!0;j=c.y+l;if(j<0)i===\"bottom\"?b.verticalAlign=\"top\":b.y=-j,k=!0;j=c.y+d.height-l;if(j>g.plotHeight)i===\"top\"?b.verticalAlign=\"bottom\":b.y=g.plotHeight-\nj,k=!0;if(k)a.placed=!f,a.align(b,null,e)};if(J.pie)J.pie.prototype.drawDataLabels=function(){var a=this,b=a.data,c,d=a.chart,e=a.options.dataLabels,f=p(e.connectorPadding,10),g=p(e.connectorWidth,1),h=d.plotWidth,i=d.plotHeight,j,k,l=p(e.softConnector,!0),n=e.distance,o=a.center,q=o[2]/2,r=o[1],s=n>0,u,v,w,z=[[],[]],A,B,D,G,E,F=[0,0,0,0],M=function(a,b){return b.y-a.y};if(a.visible&&(e.enabled||a._hasPointLabels)){Q.prototype.drawDataLabels.apply(a);m(b,function(a){a.dataLabel&&a.visible&&z[a.half].push(a)});\nfor(G=2;G--;){var J=[],N=[],H=z[G],L=H.length,K;if(L){a.sortByAngle(H,G-0.5);for(E=b=0;!b&&H[E];)b=H[E]&&H[E].dataLabel&&(H[E].dataLabel.getBBox().height||21),E++;if(n>0){v=I(r+q+n,d.plotHeight);for(E=t(0,r-q-n);E<=v;E+=b)J.push(E);v=J.length;if(L>v){c=[].concat(H);c.sort(M);for(E=L;E--;)c[E].rank=E;for(E=L;E--;)H[E].rank>=v&&H.splice(E,1);L=H.length}for(E=0;E<L;E++){c=H[E];w=c.labelPos;c=9999;var R,P;for(P=0;P<v;P++)R=O(J[P]-w[1]),R<c&&(c=R,K=P);if(K<E&&J[E]!==null)K=E;else for(v<L-E+K&&J[E]!==null&&\n(K=v-L+E);J[K]===null;)K++;N.push({i:K,y:J[K]});J[K]=null}N.sort(M)}for(E=0;E<L;E++){c=H[E];w=c.labelPos;u=c.dataLabel;D=c.visible===!1?\"hidden\":\"inherit\";c=w[1];if(n>0){if(v=N.pop(),K=v.i,B=v.y,c>B&&J[K+1]!==null||c<B&&J[K-1]!==null)B=I(t(0,c),d.plotHeight)}else B=c;A=e.justify?o[0]+(G?-1:1)*(q+n):a.getX(B===r-q-n||B===r+q+n?c:B,G);u._attr={visibility:D,align:w[6]};u._pos={x:A+e.x+({left:f,right:-f}[w[6]]||0),y:B+e.y-10};u.connX=A;u.connY=B;if(this.options.size===null)v=u.width,A-v<f?F[3]=t(x(v-\nA+f),F[3]):A+v>h-f&&(F[1]=t(x(A+v-h+f),F[1])),B-b/2<0?F[0]=t(x(-B+b/2),F[0]):B+b/2>i&&(F[2]=t(x(B+b/2-i),F[2]))}}}if(Fa(F)===0||this.verifyDataLabelOverflow(F))this.placeDataLabels(),s&&g&&m(this.points,function(b){j=b.connector;w=b.labelPos;if((u=b.dataLabel)&&u._pos)D=u._attr.visibility,A=u.connX,B=u.connY,k=l?[\"M\",A+(w[6]===\"left\"?5:-5),B,\"C\",A,B,2*w[2]-w[4],2*w[3]-w[5],w[2],w[3],\"L\",w[4],w[5]]:[\"M\",A+(w[6]===\"left\"?5:-5),B,\"L\",w[2],w[3],\"L\",w[4],w[5]],j?(j.animate({d:k}),j.attr(\"visibility\",D)):\nb.connector=j=a.chart.renderer.path(k).attr({\"stroke-width\":g,stroke:e.connectorColor||b.color||\"#606060\",visibility:D}).add(a.dataLabelsGroup);else if(j)b.connector=j.destroy()})}},J.pie.prototype.placeDataLabels=function(){m(this.points,function(a){var a=a.dataLabel,b;if(a)(b=a._pos)?(a.attr(a._attr),a[a.moved?\"animate\":\"attr\"](b),a.moved=!0):a&&a.attr({y:-999})})},J.pie.prototype.alignDataLabel=ma,J.pie.prototype.verifyDataLabelOverflow=function(a){var b=this.center,c=this.options,d=c.center,e=\nc=c.minSize||80,f;d[0]!==null?e=t(b[2]-t(a[1],a[3]),c):(e=t(b[2]-a[1]-a[3],c),b[0]+=(a[3]-a[1])/2);d[1]!==null?e=t(I(e,b[2]-t(a[0],a[2])),c):(e=t(I(e,b[2]-a[0]-a[2]),c),b[1]+=(a[0]-a[2])/2);e<b[2]?(b[2]=e,this.translate(b),m(this.points,function(a){if(a.dataLabel)a.dataLabel._pos=null}),this.drawDataLabels&&this.drawDataLabels()):f=!0;return f};if(J.column)J.column.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart.inverted,g=a.series,h=a.dlBox||a.shapeArgs,i=a.below||a.plotY>p(this.translatedThreshold,\ng.yAxis.len),j=p(c.inside,!!this.options.stacking);if(h&&(d=z(h),f&&(d={x:g.yAxis.len-d.y-d.height,y:g.xAxis.len-d.x-d.width,width:d.height,height:d.width}),!j))f?(d.x+=i?0:d.width,d.width=0):(d.y+=i?d.height:0,d.height=0);c.align=p(c.align,!f||j?\"center\":i?\"right\":\"left\");c.verticalAlign=p(c.verticalAlign,f||j?\"middle\":i?\"top\":\"bottom\");Q.prototype.alignDataLabel.call(this,a,b,c,d,e)};(function(a){var b=a.Chart,c=a.each,d=HighchartsAdapter.addEvent;b.prototype.callbacks.push(function(a){function b(){var d=\n[];c(a.series,function(a){var b=a.options.dataLabels;(b.enabled||a._hasPointLabels)&&!b.allowOverlap&&a.visible&&c(a.points,function(a){if(a.dataLabel)a.dataLabel.labelrank=a.labelrank,d.push(a.dataLabel)})});a.hideOverlappingLabels(d)}b();d(a,\"redraw\",b)});b.prototype.hideOverlappingLabels=function(a){var b=a.length,c,d,i,j;for(d=0;d<b;d++)if(c=a[d])c.oldOpacity=c.opacity,c.newOpacity=1;for(d=0;d<b;d++){i=a[d];for(c=d+1;c<b;++c)if(j=a[c],i&&j&&i.placed&&j.placed&&i.newOpacity!==0&&j.newOpacity!==\n0&&!(j.alignAttr.x>i.alignAttr.x+i.width||j.alignAttr.x+j.width<i.alignAttr.x||j.alignAttr.y>i.alignAttr.y+i.height||j.alignAttr.y+j.height<i.alignAttr.y))(i.labelrank<j.labelrank?i:j).newOpacity=0}for(d=0;d<b;d++)if(c=a[d]){if(c.oldOpacity!==c.newOpacity&&c.placed)c.alignAttr.opacity=c.newOpacity,c[c.isOld&&c.newOpacity?\"animate\":\"attr\"](c.alignAttr);c.isOld=!0}}})(w);T=w.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(a){for(var c=\na.target,d;c&&!d;)d=c.point,c=c.parentNode;if(d!==u&&d!==b.hoverPoint)d.onMouseOver(a)};m(a.points,function(a){if(a.graphic)a.graphic.element.point=a;if(a.dataLabel)a.dataLabel.element.point=a});if(!a._hasTracking)m(a.trackerGroups,function(b){if(a[b]&&(a[b].addClass(\"highcharts-tracker\").on(\"mouseover\",f).on(\"mouseout\",function(a){c.onTrackerMouseOut(a)}).css(e),ab))a[b].on(\"touchstart\",f)}),a._hasTracking=!0},drawTrackerGraph:function(){var a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:\na.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,j=a.tracker,k=b.cursor,l=k&&{cursor:k},k=a.singlePoints,n,o=function(){if(f.hoverSeries!==a)a.onMouseOver()},p=\"rgba(192,192,192,\"+(ba?1.0E-4:0.002)+\")\";if(e&&!c)for(n=e+1;n--;)d[n]===\"M\"&&d.splice(n+1,0,d[n+1]-i,d[n+2],\"L\"),(n&&d[n]===\"M\"||n===e)&&d.splice(n,0,\"L\",d[n-2]+i,d[n-1]);for(n=0;n<k.length;n++)e=k[n],d.push(\"M\",e.plotX-i,e.plotY,\"L\",e.plotX+i,e.plotY);j?j.attr({d:d}):(a.tracker=h.path(d).attr({\"stroke-linejoin\":\"round\",\nvisibility:a.visible?\"visible\":\"hidden\",stroke:p,fill:c?p:R,\"stroke-width\":b.lineWidth+(c?0:2*i),zIndex:2}).add(a.group),m([a.tracker,a.markerGroup],function(a){a.addClass(\"highcharts-tracker\").on(\"mouseover\",o).on(\"mouseout\",function(a){g.onTrackerMouseOut(a)}).css(l);if(ab)a.on(\"touchstart\",o)}))}};if(J.column)xa.prototype.drawTracker=T.drawTrackerPoint;if(J.pie)J.pie.prototype.drawTracker=T.drawTrackerPoint;if(J.scatter)pa.prototype.drawTracker=T.drawTrackerPoint;r(mb.prototype,{setItemEvents:function(a,\nb,c,d,e){var f=this;(c?b:a.legendGroup).on(\"mouseover\",function(){a.setState(\"hover\");b.css(f.options.itemHoverStyle)}).on(\"mouseout\",function(){b.css(a.visible?d:e);a.setState()}).on(\"click\",function(b){var c=function(){a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent(\"legendItemClick\",b,c):M(a,\"legendItemClick\",b,c)})},createCheckboxForItem:function(a){a.checkbox=Z(\"input\",{type:\"checkbox\",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container);\nN(a.checkbox,\"click\",function(b){M(a.series||a,\"checkboxClick\",{checked:b.target.checked,item:a},function(){a.select()})})}});P.legend.itemStyle.cursor=\"pointer\";r(D.prototype,{showResetZoom:function(){var a=this,b=P.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,f=c.relativeTo===\"chart\"?null:\"plotBox\";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=\nthis;M(a,\"selection\",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c=this.pointer,d=!1,e;!a||a.resetSelection?m(this.axes,function(a){b=a.zoom()}):m(a.xAxis.concat(a.yAxis),function(a){var e=a.axis,h=e.isXAxis;if(c[h?\"zoomX\":\"zoomY\"]||c[h?\"pinchX\":\"pinchY\"])b=e.zoom(a.min,a.max),e.displayBtn&&(d=!0)});e=this.resetZoomButton;if(d&&!e)this.showResetZoom();else if(!d&&ca(e))this.resetZoomButton=e.destroy();b&&this.redraw(p(this.options.chart.animation,a&&a.animation,this.pointCount<\n100))},pan:function(a,b){var c=this,d=c.hoverPoints,e;d&&m(d,function(a){a.setState()});m(b===\"xy\"?[1,0]:[1],function(b){var d=a[b?\"chartX\":\"chartY\"],h=c[b?\"xAxis\":\"yAxis\"][0],i=c[b?\"mouseDownX\":\"mouseDownY\"],j=(h.pointRange||0)/2,k=h.getExtremes(),l=h.toValue(i-d,!0)+j,j=h.toValue(i+c[b?\"plotWidth\":\"plotHeight\"]-d,!0)-j,i=i>d;if(h.series.length&&(i||l>I(k.dataMin,k.min))&&(!i||j<t(k.dataMax,k.max)))h.setExtremes(l,j,!1,!1,{trigger:\"pan\"}),e=!0;c[b?\"mouseDownX\":\"mouseDownY\"]=d});e&&c.redraw(!1);F(c.container,\n{cursor:\"move\"})}});r(Ga.prototype,{select:function(a,b){var c=this,d=c.series,e=d.chart,a=p(a,!c.selected);c.firePointEvent(a?\"select\":\"unselect\",{accumulate:b},function(){c.selected=c.options.selected=a;d.options.data[Ma(c,d.data)]=c.options;c.setState(a&&\"select\");b||m(e.getSelectedPoints(),function(a){if(a.selected&&a!==c)a.selected=a.options.selected=!1,d.options.data[Ma(a,d.data)]=a.options,a.setState(\"\"),a.firePointEvent(\"unselect\")})})},onMouseOver:function(a){var b=this.series,c=b.chart,\nd=c.tooltip,e=c.hoverPoint;if(c.hoverSeries!==b)b.onMouseOver();if(e&&e!==this)e.onMouseOut();this.firePointEvent(\"mouseOver\");d&&(!d.shared||b.noSharedTooltip)&&d.refresh(this,a);this.setState(\"hover\");c.hoverPoint=this},onMouseOut:function(){var a=this.series.chart,b=a.hoverPoints;this.firePointEvent(\"mouseOut\");if(!b||Ma(this,b)===-1)this.setState(),a.hoverPoint=null},importEvents:function(){if(!this.hasImportedEvents){var a=z(this.series.options.point,this.options).events,b;this.events=a;for(b in a)N(this,\nb,a[b]);this.hasImportedEvents=!0}},setState:function(a,b){var c=this.plotX,d=this.plotY,e=this.series,f=e.options.states,g=aa[e.type].marker&&e.options.marker,h=g&&!g.enabled,i=g&&g.states[a],j=i&&i.enabled===!1,k=e.stateMarkerGraphic,l=this.marker||{},n=e.chart,m=e.halo,p,a=a||\"\";p=this.pointAttr[a]||e.pointAttr[a];if(!(a===this.state&&!b||this.selected&&a!==\"select\"||f[a]&&f[a].enabled===!1||a&&(j||h&&i.enabled===!1)||a&&l.states&&l.states[a]&&l.states[a].enabled===!1)){if(this.graphic)g=g&&this.graphic.symbolName&&\np.r,this.graphic.attr(z(p,g?{x:c-g,y:d-g,width:2*g,height:2*g}:{})),k&&k.hide();else{if(a&&i)if(g=i.radius,l=l.symbol||e.symbol,k&&k.currentSymbol!==l&&(k=k.destroy()),k)k[b?\"animate\":\"attr\"]({x:c-g,y:d-g});else if(l)e.stateMarkerGraphic=k=n.renderer.symbol(l,c-g,d-g,2*g,2*g).attr(p).add(e.markerGroup),k.currentSymbol=l;if(k)k[a&&n.isInsidePlot(c,d,n.inverted)?\"show\":\"hide\"]()}if((c=f[a]&&f[a].halo)&&c.size){if(!m)e.halo=m=n.renderer.path().add(n.seriesGroup);m.attr(r({fill:na(this.color||e.color).setOpacity(c.opacity).get()},\nc.attributes))[b?\"animate\":\"attr\"]({d:this.haloPath(c.size)})}else m&&m.attr({d:[]});this.state=a}},haloPath:function(a){var b=this.series,c=b.chart,d=b.getPlotBox(),e=c.inverted;return c.renderer.symbols.circle(d.translateX+(e?b.yAxis.len-this.plotY:this.plotX)-a,d.translateY+(e?b.xAxis.len-this.plotX:this.plotY)-a,a*2,a*2)}});r(Q.prototype,{onMouseOver:function(){var a=this.chart,b=a.hoverSeries;if(b&&b!==this)b.onMouseOut();this.options.events.mouseOver&&M(this,\"mouseOver\");this.setState(\"hover\");\na.hoverSeries=this},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;if(d)d.onMouseOut();this&&a.events.mouseOut&&M(this,\"mouseOut\");c&&!a.stickyTracking&&(!c.shared||this.noSharedTooltip)&&c.hide();this.setState();b.hoverSeries=null},setState:function(a){var b=this.options,c=this.graph,d=b.states,e=b.lineWidth,b=0,a=a||\"\";if(this.state!==a&&(this.state=a,!(d[a]&&d[a].enabled===!1)&&(a&&(e=d[a].lineWidth||e+(d[a].lineWidthPlus||0)),c&&!c.dashstyle))){a={\"stroke-width\":e};\nfor(c.attr(a);this[\"zoneGraph\"+b];)this[\"zoneGraph\"+b].attr(a),b+=1}},setVisible:function(a,b){var c=this,d=c.chart,e=c.legendItem,f,g=d.options.chart.ignoreHiddenSeries,h=c.visible;f=(c.visible=a=c.userOptions.visible=a===u?!h:a)?\"show\":\"hide\";m([\"group\",\"dataLabelsGroup\",\"markerGroup\",\"tracker\"],function(a){if(c[a])c[a][f]()});if(d.hoverSeries===c||(d.hoverPoint&&d.hoverPoint.series)===c)c.onMouseOut();e&&d.legend.colorizeItem(c,a);c.isDirty=!0;c.options.stacking&&m(d.series,function(a){if(a.options.stacking&&\na.visible)a.isDirty=!0});m(c.linkedSeries,function(b){b.setVisible(a,!1)});if(g)d.isDirtyBox=!0;b!==!1&&d.redraw();M(c,f)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===u?!this.selected:a;if(this.checkbox)this.checkbox.checked=a;M(this,a?\"select\":\"unselect\")},drawTracker:T.drawTrackerGraph});r(w,{Color:na,Point:Ga,Tick:Ta,Renderer:$a,SVGElement:K,SVGRenderer:ta,arrayMin:Pa,arrayMax:Fa,charts:X,dateFormat:Oa,error:ka,format:Ja,pathAnim:zb,\ngetOptions:function(){return P},hasBidiBug:Nb,isTouchDevice:Jb,setOptions:function(a){P=z(!0,P,a);Cb();return P},addEvent:N,removeEvent:Y,createElement:Z,discardElement:Ra,css:F,each:m,map:Ua,merge:z,splat:ra,extendClass:ja,pInt:B,svg:ba,canvas:ea,vml:!ba&&!ea,product:\"Highcharts\",version:\"4.1.5\"})})();\n"
  },
  {
    "path": "public_html/media/js/jquery.tablesorter.js",
    "content": "\n(function($){$.extend({tablesorter:new\nfunction(){var parsers=[],widgets=[];this.defaults={cssHeader:\"header\",cssAsc:\"headerSortUp\",cssDesc:\"headerSortDown\",cssChildRow:\"expand-child\",sortInitialOrder:\"asc\",sortMultiSortKey:\"shiftKey\",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:\"simple\",parsers:{},widgets:[],widgetZebra:{css:[\"even\",\"odd\"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:\"us\",decimal:'/\\.|\\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+\",\"+(new Date().getTime()-d.getTime())+\"ms\");}this.benchmark=benchmark;function log(s){if(typeof console!=\"undefined\"&&typeof console.debug!=\"undefined\"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug=\"\";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+=\"column:\"+i+\" parser:\"+p.id+\"\\n\";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark(\"Building cache for \"+totalRows+\" rows:\",cacheTime);}return cache;};function getElementText(config,node){var text=\"\";if(!node)return\"\";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction==\"simple\"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)==\"function\"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark(\"Rebuilt table:\",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger(\"sortEnd\");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+\"-\"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark(\"Built headers:\",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+\"-\"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1\nvar firstAvailCol;if(typeof(matrix[rowIndex])==\"undefined\"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])==\"undefined\"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])==\"undefined\"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]=\"x\";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!=\"Number\"){return(v.toLowerCase()==\"desc\")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$(\"tr:first td\",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp=\"var sortWrapper = function(a,b) {\",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type==\"text\")?((order==0)?makeSortFunction(\"text\",\"asc\",c):makeSortFunction(\"text\",\"desc\",c)):((order==0)?makeSortFunction(\"numeric\",\"asc\",c):makeSortFunction(\"numeric\",\"desc\",c));var e=\"e\"+i;dynamicExp+=\"var \"+e+\" = \"+s;dynamicExp+=\"if(\"+e+\") { return \"+e+\"; } \";dynamicExp+=\"else { \";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+=\"return a[\"+orgOrderCol+\"]-b[\"+orgOrderCol+\"];\";for(var i=0;i<l;i++){dynamicExp+=\"}; \";}dynamicExp+=\"return 0; \";dynamicExp+=\"}; \";if(table.config.debug){benchmark(\"Evaling expression:\"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark(\"Sorting on \"+sortList.toString()+\" and dir \"+order+\" time:\",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a=\"a[\"+index+\"]\",b=\"b[\"+index+\"]\";if(type=='text'&&direction=='asc'){return\"(\"+a+\" == \"+b+\" ? 0 : (\"+a+\" === null ? Number.POSITIVE_INFINITY : (\"+b+\" === null ? Number.NEGATIVE_INFINITY : (\"+a+\" < \"+b+\") ? -1 : 1 )));\";}else if(type=='text'&&direction=='desc'){return\"(\"+a+\" == \"+b+\" ? 0 : (\"+a+\" === null ? Number.POSITIVE_INFINITY : (\"+b+\" === null ? Number.NEGATIVE_INFINITY : (\"+b+\" < \"+a+\") ? -1 : 1 )));\";}else if(type=='numeric'&&direction=='asc'){return\"(\"+a+\" === null && \"+b+\" === null) ? 0 :(\"+a+\" === null ? Number.POSITIVE_INFINITY : (\"+b+\" === null ? Number.NEGATIVE_INFINITY : \"+a+\" - \"+b+\"));\";}else if(type=='numeric'&&direction=='desc'){return\"(\"+a+\" === null && \"+b+\" === null) ? 0 :(\"+a+\" === null ? Number.POSITIVE_INFINITY : (\"+b+\" === null ? Number.NEGATIVE_INFINITY : \"+b+\" - \"+a+\"));\";}};function makeSortText(i){return\"((a[\"+i+\"] < b[\"+i+\"]) ? -1 : ((a[\"+i+\"] > b[\"+i+\"]) ? 1 : 0));\";};function makeSortTextDesc(i){return\"((b[\"+i+\"] < a[\"+i+\"]) ? -1 : ((b[\"+i+\"] > a[\"+i+\"]) ? 1 : 0));\";};function makeSortNumeric(i){return\"a[\"+i+\"]-b[\"+i+\"];\";};function makeSortNumericDesc(i){return\"b[\"+i+\"]-a[\"+i+\"];\";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,\"tablesorter\",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger(\"sortStart\");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind(\"update\",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind(\"updateCell\",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind(\"sorton\",function(e,list){$(this).trigger(\"sortStart\");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind(\"appendCache\",function(){appendToTable(this,cache);}).bind(\"applyWidgetId\",function(e,id){getWidgetById(id).format(this);}).bind(\"applyWidgets\",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger(\"sorton\",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML=\"\";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:\"text\",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:\"text\"});ts.addParser({id:\"digit\",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:\"numeric\"});ts.addParser({id:\"currency\",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),\"\"));},type:\"numeric\"});ts.addParser({id:\"ipAddress\",is:function(s){return/^\\d{2,3}[\\.]\\d{2,3}[\\.]\\d{2,3}[\\.]\\d{2,3}$/.test(s);},format:function(s){var a=s.split(\".\"),r=\"\",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+=\"0\"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:\"numeric\"});ts.addParser({id:\"url\",is:function(s){return/^(https?|ftp|file):\\/\\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\\/\\//),''));},type:\"text\"});ts.addParser({id:\"isoDate\",is:function(s){return/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!=\"\")?new Date(s.replace(new RegExp(/-/g),\"/\")).getTime():\"0\");},type:\"numeric\"});ts.addParser({id:\"percent\",is:function(s){return/\\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),\"\"));},type:\"numeric\"});ts.addParser({id:\"usLongDate\",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:\"numeric\"});ts.addParser({id:\"shortDate\",is:function(s){return/\\d{1,2}[\\/\\-]\\d{1,2}[\\/\\-]\\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\\-/g,\"/\");if(c.dateFormat==\"us\"){s=s.replace(/(\\d{1,2})[\\/\\-](\\d{1,2})[\\/\\-](\\d{4})/,\"$3/$1/$2\");}else if (c.dateFormat == \"pt\") {s = s.replace(/(\\d{1,2})[\\/\\-](\\d{1,2})[\\/\\-](\\d{4})/, \"$3/$2/$1\");} else if(c.dateFormat==\"uk\"){s=s.replace(/(\\d{1,2})[\\/\\-](\\d{1,2})[\\/\\-](\\d{4})/,\"$3/$2/$1\");}else if(c.dateFormat==\"dd/mm/yy\"||c.dateFormat==\"dd-mm-yy\"){s=s.replace(/(\\d{1,2})[\\/\\-](\\d{1,2})[\\/\\-](\\d{2})/,\"$1/$2/$3\");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:\"numeric\"});ts.addParser({id:\"time\",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date(\"2000/01/01 \"+s).getTime());},type:\"numeric\"});ts.addParser({id:\"metadata\",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:\"numeric\"});ts.addWidget({id:\"zebra\",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$(\"tr:visible\",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark(\"Applying Zebra widget\",time);}}});})(jQuery);\n"
  },
  {
    "path": "public_html/media/js/misc.js",
    "content": "$.fn.hasAttr = function(name)\n{\n\treturn this.attr(name) !== undefined;\n};\n\n$(function()\n{\n\t$('.search').submit(function(e)\n\t{\n\t\tvar userName = $(this).find('[name=user-name]').val();\n\t\tif (userName.replace(/^\\s+|\\s+$/, '') == '')\n\t\t{\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\t$(this).find('[name=user-name]').val('');\n\t\t}\n\t});\n\n\t$('.tooltip, .tooltip span, .highcharts-tooltip, .highcharts-tooltip span')\n\t\t.click(function(e)\n\t\t{\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\t$(this).hide();\n\t\t\t$(document.elementFromPoint(e.clientX,e.clientY)).trigger(\"click\");\n\t\t\t$(this).show();\n\t\t});\n});\n\nfunction getProcessedDate()\n{\n\treturn new Date(Date.parse($('#processed').val()));\n}\n\nfunction ucfirst(str)\n{\n\tstr += '';\n\tvar f = str.charAt(0).toUpperCase();\n\treturn f + str.substr(1);\n}\n\nfunction lpad(str, width)\n{\n\tstr += '';\n\treturn str.length >= width\n\t\t? str\n\t\t: new Array(width - str.length + 1).join('0') + str;\n}\n"
  },
  {
    "path": "public_html/media/js/tooltips.js",
    "content": "$(function()\n{\n\t/* timeouts to prevent flickering */\n\tfunction stopTooltipRemoval(target)\n\t{\n\t\tvar timeout = $(target).data('tooltip-hide-timeout');\n\t\twindow.clearTimeout(timeout);\n\t\t$(target).data('tooltip-hide-timeout', null);\n\t}\n\n\tfunction startTooltipRemoval(target)\n\t{\n\t}\n\n\t$('[data-tooltip]').each(function()\n\t{\n\t\t$(this).mouseenter(function()\n\t\t{\n\t\t\tvar target = $(this);\n\t\t\tvar title = $(target).attr('data-tooltip');\n\t\t\tvar pos = target.prev().attr('class') === 'delete-trigger' ? 'left' : 'center'\n\t\t\tvar posMy = pos + ' top';\n\t\t\tvar posAt = pos + ' bottom';\n\n\t\t\tvar div = $('<div class=\"tooltip\"/>').append($('<span>').html(title.replace(/\\|/g, '<br>').replace(/'/g, '&rsquo;')));\n\t\t\t$(target).data('tooltip', div);\n\n\t\t\t$('body').append(div);\n\t\t\t$(div).position(\n\t\t\t{\n\t\t\t\tof: $(target),\n\t\t\t\tmy: posMy,\n\t\t\t\tat: posAt,\n\t\t\t\tcollision: 'fit fit'\n\t\t\t}).mouseenter(function()\n\t\t\t{\n\t\t\t\tstopTooltipRemoval(target);\n\t\t\t}).mouseleave(function()\n\t\t\t{\n\t\t\t\tstartTooltipRemoval(target);\n\t\t\t}).show();\n\n\t\t}).mouseleave(function()\n\t\t{\n\t\t\tvar target = $(this);\n\t\t\tvar div = $(target).data('tooltip');\n\t\t\tif (!div)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdiv.remove();\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "public_html/media/js/user/achievements.js",
    "content": "$(function()\n{\n\t$('.entries-trigger').click(function(e)\n\t{\n\t\tvar target = $(this).parents('.achi-entry').find('.entries-wrapper');\n\t\ttoggleEntries(target, [], false);\n\t\te.preventDefault();\n\t});\n\t$('.previous-msg a').click(function(e)\n\t{\n\t\tvar targets = $(this).parents('.section').find('.achi-entry.hidden');\n\t\ttargets.each(function()\n\t\t{\n\t\t\tvar target = $(this);\n\t\t\tif (target.is(':hidden'))\n\t\t\t{\n\t\t\t\ttarget.find('.entries-wrapper').hide();\n\t\t\t\ttarget.show();\n\t\t\t\ttarget.css('height', $(this).height());\n\t\t\t\ttarget.hide();\n\t\t\t\ttarget.slideDown(function()\n\t\t\t\t{\n\t\t\t\t\ttarget.css('height', '');\n\t\t\t\t});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttarget.slideUp();\n\t\t\t}\n\t\t});\n\t\t$(this).fadeOut('fast', function()\n\t\t{\n\t\t\t$(this).text($(this).text() == 'Show them' ? 'Hide them' : 'Show them').fadeIn('fast');\n\t\t});\n\t\te.preventDefault();\n\t});\n});\n"
  },
  {
    "path": "public_html/media/js/user/entries.js",
    "content": "var resetHeight = function()\n{\n\t$('body').css('min-height', '');\n}\n\nvar slideUp = function(target, cb)\n{\n\tif (typeof(cb) === 'undefined')\n\t{\n\t\tcb = resetHeight;\n\t}\n\ttarget.stop(true, true).slideUp('fast', cb);\n}\n\nvar slideDown = function(target)\n{\n\ttarget.show();\n\ttarget.css('height', 'auto');\n\tvar height = target.height();\n\ttarget.stop(true, true); //this can make target hidden\n\ttarget.css('height', '0').show();\n\ttarget.animate({'height': height}, 'medium', resetHeight);\n}\n\nfunction toggleEntries(target, data, ajax, cb)\n{\n\tif (typeof(cb) === 'undefined')\n\t{\n\t\tcb = function()\n\t\t{\n\t\t}\n\t}\n\tif (typeof(ajax) === 'undefined')\n\t{\n\t\tajax = true;\n\t}\n\tvar url = '/' + $('#user-name').val() + '/entries,' + $('#media').val();\n\tvar uniqueId = JSON.stringify(data);\n\tif (target.data('unique-id') == uniqueId)\n\t{\n\t\tif (target.is(':visible'))\n\t\t{\n\t\t\tslideUp(target);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcb();\n\t\t\tslideDown(target);\n\t\t}\n\t\treturn;\n\t}\n\n\t$('body').css('min-height', $('body').height() + 'px');\n\n\ttarget.data('unique-id', uniqueId);\n\tslideUp(target, function()\n\t{\n\t\tif (ajax)\n\t\t{\n\t\t\t$.get(url, data, function(response)\n\t\t\t{\n\t\t\t\ttarget.html(response);\n\t\t\t\tcb();\n\t\t\t\tslideDown(target);\n\t\t\t});\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcb();\n\t\t\tslideDown(target);\n\t\t}\n\t});\n}\n\n$(function()\n{\n\t$('.entries-wrapper').on('click', '.close', function(event)\n\t{\n\t\tvar target = $(this).parents('.entries-wrapper');\n\t\tif ($(target).hasClass('singular'))\n\t\t{\n\t\t\ttarget = $(this).parents('.entries-wrapper');\n\t\t}\n\t\tslideUp(target);\n\t\tevent.preventDefault();\n\t});\n});\n"
  },
  {
    "path": "public_html/media/js/user/favorites.js",
    "content": "$(function()\n{\n\t$('.genres, .creators').each(function()\n\t{\n\t\tvar section = $(this);\n\t\tsection.find('.entries-trigger').click(function(e)\n\t\t{\n\t\t\te.preventDefault();\n\t\t\tvar target = $(this);\n\t\t\ttoggleEntries(section.find('.entries-wrapper'),\n\t\t\t\t{'sender': target.attr('data-sender'), 'filter-param': target.attr('data-id')},\n\t\t\t\ttrue,\n\t\t\t\tfunction()\n\t\t\t\t{\n\t\t\t\t\tsection.find('.entries-wrapper-row').insertAfter(target.parents('tr'));\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t});\n\n\t$.tablesorter.addWidget(\n\t{\n\t\tid: 'ord',\n\t\tformat: function(table)\n\t\t{\n\t\t\tfor (var i = 0; i < table.tBodies[0].rows.length; i ++)\n\t\t\t{\n\t\t\t\t$('tbody tr:not(.entries-wrapper-row):eq(' + i + ') td.ord', table).text(i + 1);\n\t\t\t}\n\t\t}\n\t});\n\n\tvar opt = {\n\t\theaders:\n\t\t{\n\t\t\t0:\n\t\t\t{\n\t\t\t\tsorter: false\n\t\t\t},\n\t\t\t5:\n\t\t\t{\n\t\t\t\tsorter: 'percent'\n\t\t\t}\n\t\t},\n\n\t\twidgets:\n\t\t[\n\t\t\t'ord'\n\t\t],\n\n\t\tsortList:\n\t\t[\n\t\t\t[4,1]\n\t\t]\n\t};\n\n\t$('table').tablesorter(opt);\n\n\t$('.toggle-decades').click(function(e)\n\t{\n\t\t//decadesChart.series[1].setVisible(!decadesChart.series[1].visible);\n\t\tif (decadesChart.series[0].visible && decadesChart.series[1].visible)\n\t\t{\n\t\t\tdecadesChart.xAxis[0].axisTitle.attr({text: 'Years'});\n\t\t\tdecadesChart.series[0].show();\n\t\t\tdecadesChart.series[1].hide();\n\t\t}\n\t\telse if (decadesChart.series[0].visible)\n\t\t{\n\t\t\tdecadesChart.xAxis[0].axisTitle.attr({text: 'Decades'});\n\t\t\tdecadesChart.series[0].hide();\n\t\t\tdecadesChart.series[1].show();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdecadesChart.xAxis[0].axisTitle.attr({text: 'Years and decades'});\n\t\t\tdecadesChart.series[0].show();\n\t\t\tdecadesChart.series[1].show();\n\t\t}\n\t\te.preventDefault();\n\t});\n\n\tlet zoomed = false;\n\n\t$('.toggle-zoom').click(function(e) {\n\t\te.preventDefault();\n\n\t\tif (zoomed) {\n\t\t\tdecadesChart.yAxis[0].setExtremes(decadesChart.yAxis[0].getExtremes().dataMin, decadesChart.yAxis[0].getExtremes().dataMax);\n\t\t} else {\n\t\t\tdecadesChart.yAxis[0].setExtremes(0, 10);\n\t\t}\n\n\t\tzoomed = !zoomed;\n\t});\n});\n"
  },
  {
    "path": "public_html/media/js/user/history.js",
    "content": "$(function()\n{\n\t$('.history-monthly .entries-trigger').click(function(e)\n\t{\n\t\tvar key = $(this).attr('data-key');\n\t\ttoggleEntries($('.history-monthly .entries-wrapper'), {'sender': 'monthly-history', 'filter-param': key}, false, function()\n\t\t{\n\t\t\t$('.history-monthly .entries-wrapper .entries-sub-wrapper').hide();\n\t\t\t$('.history-monthly .entries-wrapper #' + key).show();\n\t\t});\n\t\te.preventDefault();\n\t});\n});\n"
  },
  {
    "path": "public_html/media/js/user/list.js",
    "content": "$(function()\n{\n\tif ($('th.unique').length > 0)\n\t{\n\t\tsortList =\n\t\t[\n\t\t\t[1,0],\n\t\t\t[2,0]\n\t\t];\n\t}\n\telse\n\t{\n\t\tsortList =\n\t\t[\n\t\t\t[2,1],\n\t\t\t[1,0]\n\t\t];\n\t}\n\t$('table').tablesorter(\n\t{\n\t\ttextExtraction: function(node)\n\t\t{\n\t\t\treturn $(node).attr('data-sorter');\n\t\t},\n\t\tsortList : sortList\n\t});\n\n\t$(window).trigger('resize');\n\n\t$('#filter-status').change(function()\n\t{\n\t\t$('#filter-form').submit();\n\t});\n\n\t$('#filter-title').keyup(function()\n\t{\n\t\t$('#filter-form').submit();\n\t});\n\n\t$('#filter-clear').click(function(e)\n\t{\n\t\te.preventDefault();\n\t\t$('#filter-title').val('');\n\t\t$('#filter-status').val('');\n\t\t$('#filter-form').submit();\n\t});\n\n\t$('#filter-form').submit(function(e)\n\t{\n\t\te.preventDefault();\n\t\tvar filterTitle = $('#filter-title').val().toLowerCase();\n\t\tvar filterStatus = $('#filter-status').val();\n\t\tvar visible = 0;\n\t\tvar total = 0;\n\t\t$('.section table tbody tr').each(function(i, e)\n\t\t{\n\t\t\tvar show = true;\n\t\t\tshow &= (filterTitle == '' || $(this).find('.title').text().toLowerCase().indexOf(filterTitle) >= 0);\n\t\t\tshow &= (filterStatus == '' || $(this).find('.status-' + filterStatus).length > 0);\n\t\t\t$(this).css('display', show ? 'table-row' : 'none');\n\t\t\tvisible += show;\n\t\t\ttotal += 1;\n\t\t});\n\t\t$('.section .filter-hint-shown').text(visible);\n\t\t$('.section .filter-hint-total').text(total);\n\t\t$('.section table').toggle(visible > 0);\n\t\t$('.section .filter-hint').toggle(visible < total);\n\t});\n\n\t$('#filter-title').focus();\n});\n"
  },
  {
    "path": "public_html/media/js/user/profile.js",
    "content": "function getProfileAge()\n{\n\tvar now = new Date();\n\tvar then = new Date($('#profile-details').attr('data-date'));\n\tvar diff = now - then;\n\tdiff /= 1000.0;\n\treturn diff;\n}\n\nfunction updatePosition()\n{\n\tvar target = $('.queue-pos');\n\tvar positionUrl = $('#profile-details').attr('data-queue-pos-url');\n\tvar enqueueUrl = $('#profile-details').attr('data-queue-add-url');\n\tvar queueMinWait = parseInt($('#profile-details').attr('data-queue-min-wait'));\n\tvar oldTooltip = target.attr('data-tooltip');\n\tvar updatingBanned = $('#profile-details').attr('data-ban-state') == '1';\n\t$.get(positionUrl, function(data)\n\t{\n\t\ttext = 'Pos. in queue: ' + data.pos;\n\t\tif (data.pos)\n\t\t\ttarget.text(text).wrapInner('<span>');\n\t\telse\n\t\t{\n\t\t\ttarget.removeAttr('data-tooltip');\n\t\t\tvar profileAge = getProfileAge();\n\t\t\tif (profileAge < queueMinWait)\n\t\t\t{\n\t\t\t\ttarget.text('Using fresh data').wrapInner('<span>');\n\t\t\t}\n\t\t\telse if (updatingBanned)\n\t\t\t{\n\t\t\t\ttarget.text('Cannot update').wrapInner('<span>');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar updateLink = $('<a href=\"#\">Click to update</a>');\n\t\t\t\tupdateLink.click(function(e)\n\t\t\t\t\t{\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t$.get(enqueueUrl, function(data)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttarget.attr('data-tooltip', oldTooltip);\n\t\t\t\t\t\t\tupdatePosition();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\ttarget.html(updateLink);\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction updateTime()\n{\n\tvar profileAge = getProfileAge();\n\tvar target = $('.updated');\n\tvar text = '';\n\tif (profileAge < 60)\n\t{\n\t\ttext = 'just now';\n\t}\n\telse if (profileAge < 60 * 60)\n\t{\n\t\ttext = (profileAge / 60).toFixed(0) + ' minutes ago';\n\t}\n\telse if (profileAge < 24 * 60 * 60)\n\t{\n\t\ttext = (profileAge / 3600).toFixed(1) + ' hours ago';\n\t}\n\telse\n\t{\n\t\ttext = (profileAge / 86400).toFixed(1) + ' days ago';\n\t}\n\n\ttarget.text(text).wrapInner('<span>');\n}\n\n$(function()\n{\n\tupdatePosition();\n\tupdateTime();\n});\n"
  },
  {
    "path": "public_html/media/js/user/ratings.js",
    "content": "var _params = {};\n\n$(function()\n{\n\t$('.export-trigger').click(function(e)\n\t{\n\t\te.preventDefault();\n\t\tvar target = $('.export.popup');\n\t\t$('.popup-wrapper').fadeIn('fast');\n\t\tupdatePreview(target);\n\t});\n\n\tfunction updatePreview(target)\n\t{\n\t\tvar img = $(target).find('img');\n\t\tvar matches = $(target).find('textarea').val().match(/\\[img\\](.*)\\[\\/img]/);\n\t\tvar newSrc = matches[1];\n\t\tif (img.attr('src') != newSrc)\n\t\t{\n\t\t\timg.attr('src', newSrc);\n\t\t}\n\t}\n\n\t/* prepate type selector */\n\tvar types =\n\t[\n\t\t{ 'type': 1, 'name': 'Anime' },\n\t\t{ 'type': 2, 'name': 'Manga' },\n\t\t{ 'type': 3, 'name': 'Anime & manga' },\n\t];\n\t$('select[name=\\'type\\']').each(function()\n\t{\n\t\tfor (var i in types)\n\t\t{\n\t\t\t$(this).append($('<option/>').text(types[i]['name']).data('type', types[i]['type']));\n\t\t}\n\t\t$(this).change(function()\n\t\t{\n\t\t\tvar textarea = $(this).parents('.export').find('textarea');\n\t\t\tvar type = $(this).find('option:selected').data('type');\n\t\t\tupdateParams({0: type});\n\t\t\tupdatePreview($(this).parents('.export'));\n\t\t});\n\t});\n\n\tfunction resetParams()\n\t{\n\t\t_params = {0: _params[0]};\n\t}\n\n\tfunction updateParams(params)\n\t{\n\t\tvar textarea = $('.export.popup textarea');\n\t\tfor (var k in params) {\n            _params[k] = params[k];\n        }\n        params = [];\n        for (var k in _params) {\n            params.push(_params[k]);\n        }\n\n\t\tvar newText = btoa(JSON.stringify(params)).replace(/=/g, '');\n\t\ttextarea.val(textarea.val().replace(/\\/[^\\/]+\\/(\\d{10})/, '/' + newText + '/$1'));\n\t\treturn _params;\n\t}\n\n\tvar defaultParams = { 1: 'a4c0f4', 2: '13459a', 3: 'f8fafe', 4: 'eff2f8', 5: 'ffffffff', 6: '000000', 7: 'aaaaaa', 8: '577fc2', 9: '577fc2' };\n\n\t/* prepare theme selecton */\n\tvar themes =\n\t[\n\t\t{ 'params': { }, 'name': 'Blue (default)' },\n\t\t{ 'params': { 1: '00ffaaaa', 2: '00ee6677', 3: 'c0ffaaaa', 4: 'c0ee6677', 5: 'ffffffff', 6: '20442233', 7: '85aa4444', 8: '00cc5566', 9: '00cc5566' }, 'name': 'Pink' },\n\t\t{ 'params': { 1: '0044ff44', 2: '00008800', 3: 'dd44ff44', 4: 'dd00aa00', 5: 'ffffffff', 6: '20227722', 7: '90227722', 8: '00227722', 9: '00227722' }, 'name': 'Green' },\n\t\t{ 'params': { 1: '00eecc05', 2: '00dd2200', 3: 'aaffdd00', 4: 'aaff0000', 5: 'ffffffff', 6: '20220700', 7: '90220700', 8: '00220700', 9: '00220700' }, 'name': 'Flame (yellow + red)' },\n\t\t{ 'params': { 1: 'aa000000', 2: '33000000', 3: 'ff000000', 4: 'dd000000', 5: 'ffffffff', 6: '20000000', 7: '90000000', 8: '20000000', 9: '20000000' }, 'name': 'Gray' },\n\t\t{ 'params': { 1: '0084a0d4', 2: '0003359a', 3: '00446084', 4: '0001156a', 5: '00000000', 6: '00779fe2', 7: '50779fe2', 8: '00779fe2', 9: '00779fe2' }, 'name': 'unBlue (blue on black)' },\n\t\t{ 'params': { 1: '0044ff44', 2: '00008800', 3: '00004400', 4: '00008800', 5: '00000000', 6: '2044ff44', 7: '00008800', 8: '0033aa33', 9: '0033aa33' }, 'name': 'Matrix (green on black)' },\n\t\t{ 'params': { }, 'name': 'Custom' },\n\t];\n\n\t$('select[name=\\'theme\\']').each(function()\n\t{\n\t\tfor (var i in themes)\n\t\t{\n\t\t\t$(this).append($('<option/>').text(themes[i]['name']).data('params', themes[i]['params']));\n\t\t}\n\t\t$(this).change(function()\n\t\t{\n\t\t\tvar target = $(this).parents('.export');\n\t\t\tvar params = $(this).find('option:selected').data('params');\n\t\t\tif ($(this).find('option:selected').text() == 'Blue (default)')\n\t\t\t{\n\t\t\t\tresetParams();\n\t\t\t}\n\n\t\t\tif ($(this).find('option:selected').text() == 'Custom')\n\t\t\t{\n\t\t\t\tupdateParams(defaultParams);\n\t\t\t\ttarget.find('select.color').trigger('change'); /*update colorpicker on theme change*/\n\t\t\t\ttarget.data('interval', window.setInterval(function()\n\t\t\t\t{\n\t\t\t\t\tupdatePreview(target);\n\t\t\t\t}, 750));\n\t\t\t\ttarget.find('.custom-theme').animate({width: 'show'});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttarget.find('.custom-theme').animate({width: 'hide'});\n\t\t\t\twindow.clearInterval(target.data('interval'));\n\t\t\t\tupdateParams(params);\n\t\t\t\tupdatePreview(target);\n\t\t\t}\n\t\t});\n\t});\n\n\t/* select text in textarea on click */\n\t$('.export textarea').click(function()\n\t{\n\t\t$(this).select();\n\t});\n\n\tfunction changeColor(color)\n\t{\n\t\tif (!$('.export .colorpicker').is(':visible'))\n            return;\n        $('.export input.hex').val(color);\n\t\tvar key = $('.export select.color').val();\n\t\tvar value = color.substr(1);\n\t\tvar newParams = {};\n\t\tnewParams[key] = value;\n\t\tupdateParams(newParams);\n\t}\n\n\t/* custom theme editing */\n\tvar opt =\n\t{\n\t\tcallback: changeColor,\n\t\twidth: 200,\n\t\theight: 200\n\t};\n\t$.farbtastic($('.export .colorpicker'), opt).target = $(this);\n\n\t$('.export select.color').change(function()\n\t{\n\t\tvar key = $(this).val();\n\t\tvar params = updateParams({});\n\t\tvar param = params[key];\n\t\tvar color = param.length === 8 ? param.substring(2) : param;\n\t\t$.farbtastic($('.export .colorpicker')).setColor('#' + color);\n\t\tchangeColor('#' + param);\n    });\n\n\t$('.export input.hex').on('keyup', function()\n\t{\n        if (/^#[0-9a-f]{6}$/i.test($(this).val())) {\n            $.farbtastic($('.export .colorpicker')).setColor($(this).val());\n        } else if (/^#[0-9a-f]{8}$/i.test($(this).val())) {\n\t\t\t$.farbtastic($('.export .colorpicker')).setColor('#' + $(this).val().substring(3));\n\t\t\tchangeColor($(this).val());\n\t\t} else if ($(this).val() === 'transparent') {\n\t\t\tchangeColor('#ffffffff');\n\t\t\t$(this).val('transparent');\n\t\t}\n    });\n\n\t$('.export .close').click(function(e)\n\t{\n\t\t$('.popup-wrapper').fadeOut('fast');\n\t\te.preventDefault();\n\t});\n\n\tupdateParams({0: 1});\n});\n"
  },
  {
    "path": "public_html/media/js/user/recommendations.js",
    "content": "$(function()\n{\n\tvar userName = $('#user-name').val();\n\tvar media = $('#media').val();\n\n\tif (typeof(Storage) === 'undefined')\n\t{\n\t\t$('.missing .delete-trigger').hide();\n\t\treturn;\n\t}\n\n\n\n\tvar readHidden = function(userName)\n\t{\n\t\tvar storageHidden = typeof(localStorage.hidden) !== 'undefined'\n\t\t\t? JSON.parse(localStorage.hidden)\n\t\t\t: {};\n\t\tif (userName in storageHidden)\n\t\t{\n\t\t\treturn storageHidden[userName];\n\t\t}\n\t\treturn [];\n\t}\n\n\n\n\tvar writeHidden = function(userName, hidden)\n\t{\n\t\t//filter out duplicates\n\t\thidden = hidden.filter(function(el,index,arr)\n\t\t{\n\t\t\treturn index == arr.indexOf(el);\n\t\t});\n\t\tvar storageHidden = typeof(localStorage.hidden) !== 'undefined'\n\t\t\t? JSON.parse(localStorage.hidden)\n\t\t\t: {};\n\t\tstorageHidden[userName] = hidden;\n\t\t//filter out empty users\n\t\tfor (var key in storageHidden)\n\t\t{\n\t\t\tif (storageHidden[key].length == 0)\n\t\t\t{\n\t\t\t\tdelete storageHidden[key]; //it's safe in js\n\t\t\t}\n\t\t}\n\t\tlocalStorage.hidden = JSON.stringify(storageHidden);\n\t}\n\n\tvar hide = function(target, fast)\n\t{\n\t\tvar prevState = $.fx.off;\n\t\tif (fast)\n\t\t{\n\t\t\t$.fx.off = true;\n\t\t}\n\t\ttarget.addClass('hidden');\n\t\ttarget.slideUp(function()\n\t\t{\n\t\t\tvar tr = target.parents('tr');\n\t\t\tvar ul = target.parents('ul');\n\t\t\ttarget.hide();\n\t\t\tif (ul.find('li:not(.hidden)').length == 0)\n\t\t\t{\n\t\t\t\ttr.find('td').slideUp('fast');\n\t\t\t}\n\t\t});\n\n\t\tvar hidden = readHidden(userName);\n\t\tvar filtered = $.grep(hidden, function(item, index)\n\t\t{\n\t\t\treturn item.indexOf(media) == 0;\n\t\t});\n\t\t$('.missing .undelete-msg strong').text(filtered.length);\n\t\t$('.missing .undelete-msg').slideDown();\n\t\t$.fx.off = prevState;\n\t}\n\n\t$('.missing .delete-trigger').click(function(e)\n\t{\n\t\tvar key = $(this).parents('li').attr('data-id');\n\t\tvar hidden = readHidden(userName);\n\t\thidden.push(key);\n\t\twriteHidden(userName, hidden);\n\t\t$('[data-id=\\'' + key + '\\']').each(function () {\n\t\t\thide($(this), false);\n\t\t});\n\t\te.preventDefault();\n\t});\n\n\t$('.missing .delete-trigger-alt-setting, .missing .delete-trigger-alt-version, .missing .delete-trigger-spin-off, .missing .delete-trigger-character, .missing .delete-trigger-summary, .missing .delete-trigger-side-story, .missing .delete-trigger-other').click(function (e) {\n\t\te.preventDefault();\n\n\t\tvar type = 'Other';\n\n\t\tvar c = $(this).attr('class').replace('delete-trigger-', '');\n\n\t\tif (c === 'alt-setting') {\n\t\t\ttype = 'Alt. setting';\n\t\t} else if (c === 'alt-version') {\n\t\t\ttype = 'Alt. version';\n\t\t} else if (c === 'spin-off') {\n\t\t\ttype = 'Spin-off';\n\t\t} else if (c === 'character') {\n\t\t\ttype = 'Character';\n\t\t} else if (c === 'summary') {\n\t\t\ttype = 'Summary';\n\t\t} else if (c === 'side-story') {\n\t\t\ttype = 'Side story';\n\t\t}\n\n\t\t$('[data-tooltip=\"' + type + '\"]').each(function () {\n\t\t\tvar id = $(this).parents('li').attr('data-id');\n\n\t\t\tvar ids = readHidden(userName);\n\n\t\t\tids.push(id);\n\n\t\t\twriteHidden(userName, ids);\n\n\t\t\t$('[data-id=\"' + id + '\"]').each(function () {\n\t\t\t\thide($(this), true);\n\t\t\t});\n\t\t});\n\t});\n\n\t$('.missing .undelete-trigger').click(function(e)\n\t{\n\t\tvar hidden = readHidden(userName);\n\t\tvar filtered = $.grep(hidden, function(item, index)\n\t\t{\n\t\t\treturn item.indexOf(media) != 0;\n\t\t});\n\t\twriteHidden(userName, filtered);\n\n\t\t$('.missing .undelete-msg').slideUp(function()\n\t\t{\n\t\t\t$('.missing li.hidden').each(function()\n\t\t\t{\n\t\t\t\t$(this).parents('tr').find('td').slideDown();\n\t\t\t\t$(this).slideDown();\n\t\t\t});\n\t\t\t$('.missing li.hidden').removeClass('hidden');\n\t\t});\n\t\te.preventDefault();\n\t});\n\n\n\n\tvar hidden = readHidden(userName);\n\tfor (var i in hidden)\n\t{\n\t\tvar key = hidden[i];\n\t\tif (key.indexOf(media) == 0)\n\t\t{\n\t\t\t$('[data-id=\\'' + key + '\\']').each(function () {\n\t\t\t\thide($(this), true);\n\t\t\t});\n\t\t}\n\t}\n});\n"
  },
  {
    "path": "public_html/robots.txt",
    "content": ""
  },
  {
    "path": "script/cron-cache.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\nCronRunner::run(__FILE__, function($logger)\n{\n\t$cache = new Cache();\n\t$allFiles = $cache->getAllFiles();\n\t$usedFiles = $cache->getUsedFiles();\n\t$unusedFiles = array_diff($allFiles, $usedFiles);\n\tforeach ($unusedFiles as $path)\n\t{\n\t\tunlink($path);\n\t}\n\t$logger->log('Deleted: %s, left: %d', count($unusedFiles), count($usedFiles));\n});\n"
  },
  {
    "path": "script/cron-globals.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\nCronRunner::run(__FILE__, function($logger)\n{\n\t$userCount = 0;\n    $userCountAll = 0;\n\t$mediaCount = [];\n\t$distArr = [];\n\tforeach (Media::getConstList() as $media)\n\t{\n\t\t$distArr[$media] = [];\n\t\t$mediaCount[$media] = Model_Media::getCount($media);\n\t}\n\tforeach (Database::getAllDbNames() as $dbName)\n\t{\n\t\t$logger->log($dbName);\n\t\tDatabase::attachDatabase($dbName);\n\t\tforeach (Media::getConstList() as $media)\n\t\t{\n\t\t\t$localDist = Model_MixedUserMedia::getRatingDistribution($media);\n\t\t\tforeach ($localDist->getGroupsKeys() as $key)\n\t\t\t{\n\t\t\t\tif (!isset($distArr[$media][$key]))\n\t\t\t\t{\n\t\t\t\t\t$distArr[$media][$key] = 0;\n\t\t\t\t}\n\t\t\t\t$distArr[$media][$key] += $localDist->getGroupSize($key);\n\t\t\t}\n\t\t}\n\t\t$userCount += Model_User::getCount();\n        $userCountAll += Model_User::getCountAll();\n\t}\n\n\t$globalsCache =\n\t[\n\t\t'user-count' => $userCount,\n        'user-count-all' => $userCountAll,\n\t\t'media-count' => $mediaCount,\n\t\t'rating-dist' => $distArr,\n\t];\n\tTextHelper::putJson(Config::$globalsCachePath, $globalsCache);\n});\n"
  },
  {
    "path": "script/cron-queue-sizes.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\nCronRunner::run(__FILE__, function($logger)\n{\n\t$limit = 2*24*60/5;\n\t$queueSizes = TextHelper::loadJson(Config::$userQueueSizesPath, true);\n\t$userQueue = new Queue(Config::$userQueuePath);\n\t$mediaQueue = new Queue(Config::$mediaQueuePath);\n\n\t$key = date('c');\n\t$queueSizes[$key] = [$userQueue->size(), $mediaQueue->size()];\n\tksort($queueSizes, SORT_NATURAL | SORT_FLAG_CASE);\n\twhile (count($queueSizes) > $limit)\n\t{\n\t\tarray_shift($queueSizes);\n\t}\n\n\tTextHelper::putJson(Config::$userQueueSizesPath, $queueSizes);\n});\n"
  },
  {
    "path": "script/cron-queue.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\nfunction processQueue($queue, $count, $maxAttempts, $logger, $callback)\n{\n\t$processed = 0;\n\twhile ($processed < $count)\n\t{\n\t\t$queueItem = $queue->peek();\n\t\tif ($queueItem === null)\n\t\t\tbreak;\n\n\t\t$key = $queueItem->item;\n\t\t$errors = false;\n\n\t\ttry\n\t\t{\n\t\t\t$callback($key);\n\t\t}\n\t\tcatch (BadProcessorKeyException $e)\n\t\t{\n\t\t\t$logger->log('error: ' . $e->getMessage());\n\t\t}\n\t\tcatch (DocumentException $e)\n\t\t{\n\t\t\t$logger->log('error: ' . $e->getMessage());\n\t\t\t$errors = true;\n\t\t}\n\t\tcatch (DownloadFailureException $e)\n\t\t{\n\t\t\t$logger->log('error: ' . $e->getMessage());\n\t\t\t$errors = true;\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$logger->log('error');\n\t\t\t$logger->log($e);\n\t\t\t$errors = true;\n\t\t}\n\n\t\tif (!$errors)\n\t\t{\n\t\t\t$queue->dequeue();\n\t\t}\n\t\telse\n\t\t{\n            $queue->dequeue();\n\n            $enqueueAtStart = $queueItem->attempts < $maxAttempts;\n\n            if ($enqueueAtStart) {\n                $queueItem->attempts ++;\n\n                $queue->enqueue($queueItem, $enqueueAtStart);\n            }\n\t\t}\n\n\t\t++ $processed;\n\t}\n}\n\nCronRunner::run(__FILE__, function($logger)\n{\n\t$userProcessor = new UserProcessor();\n    $userMediaProcessor = new UserMediaProcessor();\n\t$mediaProcessors =\n\t[\n\t\tMedia::Anime => new AnimeProcessor(),\n\t\tMedia::Manga => new MangaProcessor()\n\t];\n\n\t$userQueue = new Queue(Config::$userQueuePath);\n    $userMediaQueue = new Queue(Config::$userMediaQueuePath);\n    $mediaQueue = new Queue(Config::$mediaQueuePath);\n\n    if ($userQueue->size() < Config::$usersPerCronRun)\n    {\n        Config::$mediaPerCronRun = floor(Config::$mediaPerCronRun / Config::$usersPerCronRun * (Config::$usersPerCronRun - $userQueue->size()));\n\n        Config::$usersPerCronRun = max($userQueue->size(), $userMediaQueue->size());\n    }\n    else\n    {\n        Config::$mediaPerCronRun = 0;\n    }\n\n\tDownloader::setLogger($logger);\n\n\t#process users\n\tprocessQueue(\n\t\t$userQueue,\n\t\tConfig::$usersPerCronRun,\n\t\tConfig::$userQueueMaxAttempts,\n\t\t$logger,\n\t\tfunction($userName) use ($userProcessor, $mediaQueue, $logger)\n\t\t{\n\t\t\tDatabase::selectUser($userName);\n\t\t\t$logger->log('Processing user %s... ', $userName);\n\n\t\t\t#process the user\n\t\t\t$userContext = $userProcessor->process($userName);\n\n\t\t\t#remove associated cache\n\t\t\t$cache = new Cache();\n\t\t\t$cache->setPrefix($userName);\n\t\t\tforeach ($cache->getAllFiles() as $path)\n\t\t\t\tunlink($path);\n\n\t\t\t#append media to queue\n\t\t\t$mediaIds = [];\n\t\t\tforeach (Media::getConstList() as $media)\n\t\t\t{\n\t\t\t\tforeach ($userContext->user->getMixedUserMedia($media) as $entry)\n\t\t\t\t{\n\t\t\t\t\t$mediaAge = time() - (isset($entry->processed) ? strtotime($entry->processed) : 0);\n\t\t\t\t\tif ($mediaAge > Config::$mediaQueueMinWait)\n\t\t\t\t\t\t$mediaIds []= TextHelper::serializeMediaId($entry);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$mediaQueue->enqueueMultiple(array_map(function($mediaId)\n\t\t\t\t{\n\t\t\t\t\treturn new QueueItem($mediaId);\n\t\t\t\t}, $mediaIds));\n\n\t\t\t$logger->log('ok');\n\t\t});\n\n\t#process users media\n\tprocessQueue(\n\t\t$userMediaQueue,\n\t\tConfig::$usersPerCronRun,\n\t\tConfig::$userQueueMaxAttempts,\n\t\t$logger,\n\t\tfunction($userName) use ($userMediaProcessor, $mediaQueue, $logger)\n\t\t{\n\t\t\tDatabase::selectUser($userName);\n\t\t\t$logger->log('Processing user %s... ', $userName);\n\n\t\t\t#process the user\n\t\t\t$userContext = $userMediaProcessor->process($userName);\n\n\t\t\t#remove associated cache\n\t\t\t$cache = new Cache();\n\t\t\t$cache->setPrefix($userName);\n\t\t\tforeach ($cache->getAllFiles() as $path)\n\t\t\t\tunlink($path);\n\n\t\t\t#append media to queue\n\t\t\t$mediaIds = [];\n\t\t\tforeach (Media::getConstList() as $media)\n\t\t\t{\n\t\t\t\tforeach ($userContext->user->getMixedUserMedia($media) as $entry)\n\t\t\t\t{\n\t\t\t\t\t$mediaAge = time() - (isset($entry->processed) ? strtotime($entry->processed) : 0);\n\t\t\t\t\tif ($mediaAge > Config::$mediaQueueMinWait)\n\t\t\t\t\t\t$mediaIds []= TextHelper::serializeMediaId($entry);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$mediaQueue->enqueueMultiple(array_map(function($mediaId)\n\t\t\t\t{\n\t\t\t\t\treturn new QueueItem($mediaId);\n\t\t\t\t}, $mediaIds));\n\n\t\t\t$logger->log('ok');\n\t\t});\n\n\t$mediaIds = [];\n\tforeach (Media::getConstList() as $media)\n\t{\n\t\t$entries = Model_Media::getOldest($media, 100);\n\t\tforeach ($entries as $entry)\n\t\t{\n\t\t\t$mediaAge = time() - (isset($entry->processed) ? strtotime($entry->processed) : 0);\n\t\t\tif ($mediaAge > Config::$mediaQueueMinWait)\n\t\t\t\t$mediaIds []= TextHelper::serializeMediaId($entry);\n\t\t}\n\t}\n\t$mediaQueue->enqueueMultiple(array_map(function($mediaId)\n\t\t{\n\t\t\treturn new QueueItem($mediaId);\n\t\t}, $mediaIds));\n\n\n\n\t#process media\n\tprocessQueue(\n\t\t$mediaQueue,\n\t\tConfig::$mediaPerCronRun,\n\t\tConfig::$mediaQueueMaxAttempts,\n\t\t$logger,\n\t\tfunction($key) use ($mediaProcessors, $logger)\n\t\t{\n\t\t\tlist ($media, $malId) = TextHelper::deserializeMediaId($key);\n\t\t\t$logger->log('Processing %s #%d... ', Media::toString($media), $malId);\n\n\t\t\t#process the media\n\t\t\t$mediaProcessors[$media]->process($malId);\n\n\t\t\t$logger->log('ok');\n\t\t});\n});\n"
  },
  {
    "path": "script/cron-users.php",
    "content": "<?php\nrequire __DIR__ . '/../src/core.php';\n\nforeach (Database::getAllDbNames() as $database)\n{\n    Database::attachDatabase($database);\n\n    $users = R::getAll(\"SELECT `id` FROM user WHERE `join_date` IS NULL OR `processed` IS NULL OR `processed` < ?\", [date('Y-m-d H:i:s', strtotime('-1 month'))]);\n\n    foreach ($users as $user)\n    {\n        R::exec(\"DELETE FROM userfriend WHERE `user_id` = ?\", [$user['id']]);\n\n        R::exec(\"DELETE FROM userhistory WHERE `user_id` = ?\", [$user['id']]);\n\n        R::exec(\"DELETE FROM usermedia WHERE `user_id` = ?\", [$user['id']]);\n\n        R::exec(\"DELETE FROM user WHERE `id` = ?\", [$user['id']]);\n    }\n}\n\n$databases = [\n    '00',\n    '01',\n    '02',\n    '03',\n    '04',\n    '05',\n    '06',\n    '07',\n    '08',\n    '09',\n    '0a',\n    '0b',\n    '0c',\n    '0d',\n    '0e',\n    '0f',\n    '10',\n    '11',\n    '12',\n    '13',\n    '14',\n    '15',\n    '16',\n    '17',\n    '18',\n    '19',\n    '1a',\n    '1b',\n    '1c',\n    '1d',\n    '1e',\n    '1f',\n    '20',\n    '21',\n    '22',\n    '23',\n    '24',\n    '25',\n    '26',\n    '27',\n    '28',\n    '29',\n    '2a',\n    '2b',\n    '2c',\n    '2d',\n    '2e',\n    '2f',\n    '30',\n    '31',\n    '32',\n    '33',\n    '34',\n    '35',\n    '36',\n    '37',\n    '38',\n    '39',\n    '3a',\n    '3b',\n    '3c',\n    '3d',\n    '3e',\n    '3f',\n];\n\nforeach ($databases as $database)\n{\n    Database::loadDatabase('user-' . $database . '.sqlite');\n\n    R::exec(\"VACUUM\");\n}\n\nDatabase::loadDatabase('media.sqlite');\n\nR::exec(\"VACUUM\");\n"
  },
  {
    "path": "script/make-db.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\ntry\n{\n\t$path1 = tempnam(sys_get_temp_dir(), '');\n\tDatabase::loadDatabase($path1);\n\tR::freeze(false);\n\tR::exec('CREATE TABLE IF NOT EXISTS user (\n\t\tid INTEGER PRIMARY KEY,\n\t\tname VARCHAR(32) UNIQUE,\n\t\tpicture_url VARCHAR(256),\n\t\tjoin_date VARCHAR(10), --TIMESTAMP\n\t\tmal_id INTEGER,\n\t\tcomments INTEGER,\n\t\tposts INTEGER,\n\t\tbirthday VARCHAR(10), --TIMESTAMP\n\t\tlocation VARCHAR(100),\n\t\twebsite VARCHAR(100),\n\t\tgender VARCHAR(1),\n\t\tprocessed TIMESTAMP,\n\t\tcool BOOLEAN,\n\n\t\tanime_views INTEGER,\n\t\tanime_days_spent FLOAT,\n\t\tanime_private BOOLEAN,\n\t\tmanga_views INTEGER,\n\t\tmanga_days_spent FLOAT,\n\t\tmanga_private BOOLEAN\n\t)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS userfriend (\n\t\tid INTEGER PRIMARY KEY,\n\t\tuser_id INTEGER,\n\t\tname VARCHAR(32),\n\t\tUNIQUE (user_id, name)\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_userfriend_user_id ON userfriend (user_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS userhistory (\n\t\tid INTEGER PRIMARY KEY,\n\t\tuser_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tmedia VARCHAR(1),\n\t\tprogress INTEGER,\n\t\ttimestamp TIMESTAMP\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_userhistory_user_id ON userhistory (user_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS usermedia (\n\t\tid INTEGER PRIMARY KEY,\n\t\tuser_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tmedia VARCHAR(1),\n\t\tscore INTEGER,\n\t\tstart_date VARCHAR(10), --TIMESTAMP\n\t\tend_date VARCHAR(10), --TIMESTAMP\n\t\tstatus VARCHAR(1),\n\n\t\tfinished_episodes INTEGER,\n\t\tfinished_chapters INTEGER,\n\t\tfinished_volumes INTEGER\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_usermedia_user_id ON usermedia (user_id)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_usermedia_score ON usermedia(score)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_usermedia_media_score ON usermedia(media,score)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_usermedia_media_mal_id ON usermedia(media,mal_id)');\n\n\tforeach (Database::getAllDbNames() as $dbName)\n\t{\n\t\t$path2 = Config::$dbPath . DIRECTORY_SEPARATOR . $dbName;\n\t\tcopy($path1, $path2);\n\t}\n\tunlink($path1);\n\n\n\n\tDatabase::loadDatabase('media.sqlite');\n\tR::freeze(false);\n\tR::exec('CREATE TABLE IF NOT EXISTS media (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmal_id INTEGER,\n\t\tmedia VARCHAR(1),\n\t\ttitle VARCHAR(96),\n\t\tsub_type INTEGER,\n        source INTEGER,\n\t\tpicture_url VARCHAR(256),\n\t\taverage_score FLOAT,\n\t\taverage_score_users INTEGER,\n\t\tranking INTEGER,\n\t\tpopularity INTEGER,\n\t\tmembers INTEGER,\n\t\tfavorites INTEGER,\n\t\tpublishing_status VARCHAR(1),\n\t\tpublished_from VARCHAR(10), --TIMESTAMP\n\t\tpublished_to VARCHAR(10), --TIMESTAMP\n\t\tprocessed TIMESTAMP,\n\t\tfranchise VARCHAR(10),\n\n\t\tduration INTEGER,\n\t\tepisodes INTEGER,\n\t\tchapters INTEGER,\n\t\tvolumes INTEGER,\n\t\tserialization_id INTEGER,\n\t\tserialization_name VARCHAR(32),\n\n\t\tUNIQUE (media, mal_id)\n\t)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS mediagenre (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmedia_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tname VARCHAR(30)\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_mediagenre_media_id ON mediagenre (media_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS mediarelation (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmedia_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tmedia VARCHAR(1),\n\t\ttype INTEGER\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_mediarelation_media_id ON mediarelation (media_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS animeproducer (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmedia_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tname VARCHAR(32)\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_animeproducer_media_id ON animeproducer (media_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS mangaauthor (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmedia_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tname VARCHAR(32)\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_mangaauthor_media_id ON mangaauthor (media_id)');\n\n\tR::exec('CREATE TABLE IF NOT EXISTS mediarec (\n\t\tid INTEGER PRIMARY KEY,\n\t\tmedia_id INTEGER,\n\t\tmal_id INTEGER,\n\t\tcount INTEGER\n\t)');\n\tR::exec('CREATE INDEX IF NOT EXISTS idx_mediarec_mediaid ON mediarec (media_id)');\n}\ncatch (Exception $e)\n{\n\techo $e . PHP_EOL;\n}\n"
  },
  {
    "path": "script/process.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\n$processors = [\n\t'user' => new UserProcessor(),\n\t'manga' => new MangaProcessor(),\n\t'anime' => new AnimeProcessor(),\n];\n\narray_shift($argv);\n$pkey = array_shift($argv);\n\nif (!isset($processors[$pkey]))\n{\n\tprintf('Usage: %s %s KEY1 [KEY2, ...]' . PHP_EOL,\n\t\t__FILE__, join('|', array_keys($processors)));\n\n\texit(1);\n}\n$processor = $processors[$pkey];\n\n$logger = new Logger();\nDownloader::setLogger($logger);\n$exitCode = 0;\nforeach ($argv as $key)\n{\n\t$logger->log('Processing %s %s', $pkey, is_numeric($key) ? '#' . $key : $key);\n\n\ttry\n\t{\n\t\tif ($pkey === 'user')\n\t\t\tDatabase::selectUser($key);\n\n\t\t$processor->process($key);\n\t}\n\tcatch (BadProcessorKeyException $e)\n\t{\n\t\t$logger->log($e->getMessage());\n\t}\n\tcatch (DocumentException $e)\n\t{\n\t\t$logger->log($e->getMessage());\n\t\t$exitCode = 1;\n\t}\n\tcatch (Exception $e)\n\t{\n\t\t$logger->log($e);\n\t\t$exitCode = 1;\n\t}\n}\nexit($exitCode);\n"
  },
  {
    "path": "script/queue-all-media.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\n$mediaQueue = new Queue(Config::$mediaQueuePath);\n\n$query = \"SELECT id, media, mal_id FROM media\";\n$media = R::getAll($query);\n\n$mediaIds = [];\nforeach ($media as $entry)\n{\n\ttry\n\t{\n\t\t$mediaIds []= TextHelper::serializeMediaId($entry);\n\t}\n\tcatch (InvalidArgumentException $e)\n\t{\n\t\techo 'Media ' . print_r($entry) . ' cannot be serialized';\n\t}\n}\n\n$mediaQueue->enqueueMultiple(array_map(function($mediaId)\n\t{\n\t\treturn new QueueItem($mediaId);\n\t}, $mediaIds));\n"
  },
  {
    "path": "script/unnuke-media.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\n$mediaProcessors =\n[\n\tMedia::Anime => new AnimeProcessor(),\n\tMedia::Manga => new MangaProcessor()\n];\n\n$mediaIds = [];\nforeach (Database::getAllDbNames() as $dbName)\n{\n\tDatabase::attachDatabase($dbName);\n\t$query = 'SELECT um.mal_id, um.media FROM usermedia um' .\n\t\t' GROUP BY um.media, um.mal_id' .\n\t\t' HAVING NOT EXISTS(' .\n\t\t\t'SELECT null FROM media m' .\n\t\t\t' WHERE m.mal_id = um.mal_id AND m.media = um.media' .\n\t\t') ORDER BY um.mal_id';\n\t$localMediaIds = array_map(function($row)\n\t\t{\n\t\t\t$row =ReflectionHelper::arrayToClass($row);\n\t\t\treturn TextHelper::serializeMediaId($row);\n\t\t},\n\t\tR::getAll($query));\n\t$mediaIds = array_merge($mediaIds, $localMediaIds);\n}\n$mediaIds = array_unique($mediaIds);\n\n$pad = strlen(count($mediaIds));\n$done = 0;\n$exitCode = 0;\nforeach ($mediaIds as $mediaId)\n{\n\ttry\n\t{\n\t\t++ $done;\n\t\tlist($media, $malId) = TextHelper::deserializeMediaId($mediaId);\n\t\tprintf(\"(%0{$pad}d/%d) Processing %s #%d\" . PHP_EOL,\n\t\t\t$done, count($mediaIds),\n\t\t\tMedia::toString($media), $malId);\n\n\t\t$mediaProcessors[$media]->process($malId);\n\t}\n\tcatch (Exception $e)\n\t{\n\t\techo $e->getMessage() . PHP_EOL;\n\t\t$exitCode = 1;\n\t}\n}\nexit($exitCode);\n"
  },
  {
    "path": "script/unnuke-users.php",
    "content": "<?php\nrequire_once __DIR__ . '/../src/core.php';\n\n$limit = 500;\n$userProcessor = new UserProcessor();\n\n$oldNames = [];\n$newNames = [];\nforeach (Database::getAllDbNames() as $dbName)\n{\n\tDatabase::attachDatabase($dbName);\n\t$query = 'SELECT name FROM userfriend' .\n\t\t' GROUP BY name' .\n\t\t' ORDER BY RANDOM()' .\n\t\t' LIMIT ?';\n\t$localNewNames = array_map(function($x) { return $x['name']; },\n\t\tR::getAll($query, [$limit]));\n\n\t$query = 'SELECT name FROM user ORDER BY name LIMIT ?';\n\t$localOldNames = array_map(function($x) { return $x['name']; },\n\t\tR::getAll($query, [$limit]));\n\n\t$oldNames = array_merge($oldNames, $localOldNames);\n\t$newNames = array_merge($newNames, $localNewNames);\n}\n$newNames = array_diff($newNames, $oldNames);\n$newNames = array_slice($newNames, 0, $limit);\n\n$pad = strlen(count($newNames));\n$done = 0;\n$exitCode = 0;\nforeach ($newNames as $name)\n{\n\ttry\n\t{\n\t\t++ $done;\n\t\tprintf(\"(%0{$pad}d/%d) Processing user %s\" . PHP_EOL,\n\t\t\t$done, count($newNames), $name);\n\n\t\t$userProcessor->process($name);\n\t}\n\tcatch (Exception $e)\n\t{\n\t\techo $e->getMessage() . PHP_EOL;\n\t\t$exitCode = 1;\n\t}\n}\nexit($exitCode);\n"
  },
  {
    "path": "src/.gitignore",
    "content": "Config.php\n"
  },
  {
    "path": "src/Cache.php",
    "content": "<?php\nclass Cache\n{\n\tprivate $bypassCache;\n\tprivate $prefix = null;\n\n\t//warning: affects getAllFiles() and getUsedFiles()\n\tpublic function setPrefix($prefix)\n\t{\n\t\t$this->prefix = md5(strtolower($prefix));\n\t}\n\n\tpublic function bypass($doBypass)\n\t{\n\t\t$this->bypassCache = $doBypass;\n\t}\n\n\tpublic function isBypassed()\n\t{\n\t\treturn $this->bypassCache;\n\t}\n\n\tprivate function urlToPath($url)\n\t{\n\t\t$url = strtolower($url);\n\t\t$url = rtrim($url, '/');\n\t\t$name = $this->prefix . md5($url) . sha1($url);\n\t\treturn Config::$cachePath . DIRECTORY_SEPARATOR . $name;\n\t}\n\n\tpublic function load($url)\n\t{\n\t\t$path = $this->urlToPath($url);\n\t\t$data = file_get_contents($path);\n\t\t$pos = strpos($data, \"\\n\\n\");\n\t\t$headers = unserialize(substr($data, 0, $pos));\n\t\t$contents = substr($data, $pos + 2);\n\t\tforeach ($headers as $key => $value)\n\t\t{\n\t\t\tHttpHeadersHelper::setCurrentHeader($key, $value);\n\t\t}\n\t\techo $contents;\n\t}\n\n\tpublic function exists($url)\n\t{\n\t\t$path = $this->urlToPath($url);\n\t\treturn file_exists($path);\n\t}\n\n\tpublic function isFresh($url)\n\t{\n\t\t$path = $this->urlToPath($url);\n\t\tif (!$this->exists($url))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif ($this->isBypassed())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (!Config::$cacheEnabled)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (time() - filemtime($path) > Config::$cacheTimeToLive)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function save($url, $renderFunction)\n\t{\n\t\t$path = $this->urlToPath($url);\n\t\tob_start();\n\n\t\t$renderFunction();\n\t\tflush();\n\n\t\t$headers = HttpHeadersHelper::getCurrentHeaders();\n\t\t$contents = ob_get_contents();\n\t\tob_end_clean();\n\n\t\t$handle = fopen($path, 'wb');\n\t\tflock($handle, LOCK_EX);\n\t\tfwrite($handle, serialize($headers));\n\t\tfwrite($handle, \"\\n\\n\");\n\t\tfwrite($handle, $contents);\n\t\tfclose($handle);\n\n\t\techo $contents;\n\t}\n\n\tpublic function getAllFiles()\n\t{\n\t\treturn glob(Config::$cachePath . DIRECTORY_SEPARATOR . $this->prefix . '*');\n\t}\n\n\tpublic function getUsedFiles()\n\t{\n\t\t$ttl = Config::$cacheTimeToLive;\n\t\t$allFiles = $this->getAllFiles();\n\t\t$usedFiles = [];\n\t\tforeach ($allFiles as $path)\n\t\t{\n\t\t\t$age = time() - filemtime($path);\n\t\t\tif ($age <= $ttl)\n\t\t\t{\n\t\t\t\t$usedFiles []= $path;\n\t\t\t}\n\t\t}\n\t\treturn $usedFiles;\n\t}\n}\n"
  },
  {
    "path": "src/Config.example.php",
    "content": "<?php\nclass Config extends Singleton\n{\n    static $cronInterval;\n    static $usersPerCronRun;\n    static $userQueuePath;\n    static $userMediaQueuePath;\n    static $userQueueMinWait;\n    static $userQueueMaxAttempts;\n    static $mediaPerCronRun;\n    static $mediaPerCronRunMore;\n    static $mediaQueuePath;\n    static $mediaQueueMinWait;\n    static $mediaQueueMaxAttempts;\n    static $downloaderUserAgent;\n    static $downloaderProxy;\n    static $downloaderCookieFilePath;\n    static $downloaderMaxParallelJobs;\n    static $downloaderMaxTimeout;\n    static $downloaderUseMultiHandles;\n    static $mirrorPath;\n    static $mirrorPurgeFailures;\n    static $mirrorEnabled;\n    static $cachePath;\n    static $cacheEnabled;\n    static $cacheTimeToLive;\n    static $dbPath;\n    static $dbCount;\n    static $maxDbBindings;\n    static $maxProcessingAttempts;\n    static $transactionCommitFrequency;\n    static $bannedUsersListPath;\n    static $bannedGenresListPath;\n    static $bannedCreatorsListPath;\n    static $bannedGenresForRecsListPath;\n    static $bannedFranchiseCouplingListPath;\n    static $staticRecommendationListPath;\n    static $achievementsDefinitionsDirectory;\n    static $maxLogSize;\n    static $logsPath;\n    static $keepOldLogs;\n    static $globalsCachePath;\n    static $userQueueSizesPath;\n    static $mediaDirectory;\n    static $imageDirectory;\n    static $mediaUrl;\n    static $imageUrl;\n    static $baseUrl;\n    static $googleAnalyticsEnabled;\n    static $adminPassword;\n    static $maintenanceMessage;\n    static $noticeMessage;\n    static $alertMessage;\n    static $sendReferrer;\n    static $enforcedDomain;\n    static $title;\n\n    public static function doInit()\n    {\n        $dataRootDir = join(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data', '']);\n        $htmlRootDir = join(DIRECTORY_SEPARATOR, [__DIR__, '..', 'public_html']);\n\n        self::$title = 'anime.plus';\n\n        self::$cronInterval = 5;\n        self::$usersPerCronRun = 10;\n        self::$userQueuePath = $dataRootDir . 'queue-users.lst';\n        self::$userMediaQueuePath = $dataRootDir . 'queue-users-media.lst';\n        self::$userQueueMinWait = 60 * 60;\n        self::$userQueueMaxAttempts = 0;\n        self::$mediaPerCronRun = 30;\n        self::$mediaQueuePath = $dataRootDir . 'queue-media.lst';\n        self::$mediaQueueMinWait = 28 * 24 * 60 * 60;\n        self::$mediaQueueMaxAttempts = 0;\n\n        self::$downloaderUserAgent = 'GRAPH';\n        self::$downloaderProxy = null;\n        self::$downloaderCookieFilePath = $dataRootDir . 'cookies.dat';\n        self::$downloaderMaxParallelJobs = 1;\n        self::$downloaderMaxTimeout = 30000;\n        self::$downloaderUseMultiHandles = false;\n\n        self::$mirrorEnabled = false;\n        self::$mirrorPath = $dataRootDir . 'mirror';\n        self::$mirrorPurgeFailures = true;\n        self::$cacheEnabled = true;\n        self::$cachePath = $dataRootDir . 'cache';\n        self::$cacheTimeToLive = 60 * 60;\n\n        self::$dbPath = $dataRootDir . 'db';\n        self::$dbCount = 64;\n        self::$transactionCommitFrequency = 20;\n        self::$maxDbBindings = 50;\n        self::$maxProcessingAttempts = 0;\n\n        self::$bannedUsersListPath = $dataRootDir . 'banned-users.lst';\n        self::$bannedGenresListPath = $dataRootDir . 'banned-genres.lst';\n        self::$bannedCreatorsListPath = $dataRootDir . 'banned-creators.lst';\n        self::$bannedGenresForRecsListPath = $dataRootDir . 'recs-banned-genres.lst';\n        self::$bannedFranchiseCouplingListPath = $dataRootDir . 'banned-franchise-coupling.json';\n        self::$staticRecommendationListPath = $dataRootDir . 'static-recommendations.lst';\n        self::$achievementsDefinitionsDirectory = $dataRootDir . 'achievement';\n\n        self::$maxLogSize = 1024 * 1024;\n        self::$keepOldLogs = false;\n        self::$logsPath = $dataRootDir . 'logs';\n        self::$globalsCachePath = $dataRootDir . 'globals-cache.json';\n        self::$userQueueSizesPath = $dataRootDir . 'queue-sizes.json';\n\n        self::$mediaDirectory = $htmlRootDir . DIRECTORY_SEPARATOR . 'media';\n        self::$imageDirectory = $htmlRootDir . DIRECTORY_SEPARATOR . 'image';\n        self::$mediaUrl = '/media/';\n        self::$imageUrl = '/image/';\n        self::$baseUrl = 'https://anime.plus/';\n        self::$googleAnalyticsEnabled = true;\n        self::$adminPassword = '';\n        self::$maintenanceMessage = null;\n        self::$noticeMessage = '<a href=\"https://myanimelist.net/clubs.php?cid=67199\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">JOIN OUR CLUB SENPAI</a>';\n        self::$alertMessage = null;\n        self::$sendReferrer = true;\n        self::$enforcedDomain = null;\n    }\n}\n\nConfig::init();\n"
  },
  {
    "path": "src/ControllerModules/AbstractControllerModule.php",
    "content": "<?php\nabstract class AbstractControllerModule\n{\n\t/**\n\t* This method contains all code that is executed whenver user visits\n\t* specific module.\n\t**/\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\t/**\n\t* This method returns what kind of text is allowed within URL to get\n\t* specific module to run. For example, returning ['list', 'lists'] will\n\t* trigger this module for example.com/nick/list as well as\n\t* example.com/nick/lists.\n\t*/\n\tpublic static function getUrlParts()\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\t/**\n\t* This method constructs the URL that is going to be used in layouts,\n\t* views, etc.\n\t*/\n\tpublic static function url()\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\t/**\n\t* This method returns the position of given controller module in the list\n\t* of available modules.\n\t*/\n\tpublic static function getOrder()\n\t{\n\t\treturn - 1;\n\t}\n\n\t/**\n\t* This method contains all code that is executed before cache engine kicks\n\t* in.\n\t*/\n\tpublic static function preWork(&$controllerContext, &$viewContext)\n\t{\n\t}\n\n\t/**\n\t* This method is executed after everything is rendered in view.\n\t*/\n\tpublic static function postWork(&$controllerContext, &$viewContext)\n\t{\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/AbstractUserControllerModule.php",
    "content": "<?php\nabstract class AbstractUserControllerModule extends AbstractControllerModule\n{\n\t/**\n\t* This method returns the text that is rendered in the menu in layout.\n\t*/\n\tpublic static function getText(ViewContext $viewContext, $media)\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\t/**\n\t* This method returns what sections of menu in layout should this module be\n\t* rendered in.\n\t*/\n\tpublic static function getMediaAvailability()\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\t/**\n\t* This method constructs the URL that is going to be used in layouts,\n\t* views, etc.\n\t*/\n\tpublic static function url()\n\t{\n\t\t$args = func_get_args();\n\t\t$userName = array_shift($args);\n\t\t$media = array_shift($args);\n\n\t\t$urlParts = static::getUrlParts();\n\t\t$bestPart = array_shift($urlParts);\n\t\twhile (empty($bestPart) and !empty($urlParts))\n\t\t{\n\t\t\t$bestPart = array_shift($urlParts);\n\t\t}\n\t\t$url = '/' . $userName;\n\t\t$url .= $bestPart === 'profile' ? '' : '/' . $bestPart;\n\t\tif (!empty(static::getMediaAvailability()))\n\t\t{\n\t\t\t$url .= ',' . Media::toString($media);\n\t\t}\n\t\treturn $url;\n\t}\n\n\tpublic static function getContentType()\n\t{\n\t\treturn 'text/html';\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/AdminControllerIndexModule.php",
    "content": "<?php\nclass AdminControllerIndexModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['a'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/a';\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n        $viewContext->viewName = 'admin-index';\n\t\t$viewContext->meta->title =  'Admin - ' . Config::$title;\n\t\tWebMediaHelper::addCustom($viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/AdminControllerLoginModule.php",
    "content": "<?php\nclass AdminControllerLoginModule extends AbstractControllerModule\n{\n    public static function getUrlParts()\n    {\n        return ['a/login'];\n    }\n    \n    public static function url()\n    {\n        return '/a/login';\n    }\n    \n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'admin-login';\n        \n        $viewContext->meta->title = 'Admin - ' . Config::$title;\n        \n        WebMediaHelper::addCustom($viewContext);\n        \n        if (isset($_POST['password'])) {\n            $viewContext->entered = $_POST['password'];\n            \n            if ($_POST['password'] === Config::$adminPassword) {\n                $_SESSION['logged-in'] = $_POST['password'];\n            }\n            \n            if (isset($_SESSION['logged-in'])) {\n                $uri = AdminControllerIndexModule::url();\n                \n                $viewContext->viewName = null;\n                \n                HttpHeadersHelper::setCurrentHeader('Location', $uri);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/AdminControllerLogoutModule.php",
    "content": "<?php\nclass AdminControllerLogoutModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['a/logout'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/a/logout';\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$viewContext->viewName = null;\n\t\tunset($_SESSION['logged-in']);\n\t\t$url = AdminControllerLoginModule::url();\n\t\tHttpHeadersHelper::setCurrentHeader('Location', $url);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/AdminControllerMiscModule.php",
    "content": "<?php\nclass AdminControllerMiscModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['a/misc'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/a/misc';\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\ttry\n\t\t{\n\t\t\tif (empty($_POST['action']))\n\t\t\t{\n\t\t\t\tthrow new Exception('No action specified');\n\t\t\t}\n\t\t\t$action = $_POST['action'];\n\n\n\t\t\tif ($action == 'wipe-cache')\n\t\t\t{\n\t\t\t\t$deleted = 0;\n\t\t\t\tforeach ($controllerContext->cache->getAllFiles() as $path)\n\t\t\t\t{\n\t\t\t\t\t$deleted ++;\n\t\t\t\t\tunlink($path);\n\t\t\t\t}\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = 'Deleted ' . $deleted . ' files';\n\t\t\t}\n\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Exception('Unknown action: ' . $action);\n\t\t\t}\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$viewContext->messageType = 'error';\n\t\t\t$viewContext->message = $e->getMessage();\n\t\t}\n\n\t\t$viewContext->viewName = 'admin-index';\n\t\t$viewContext->meta->title = 'Admin - ' . Config::$title;\n\t\tWebMediaHelper::addCustom($viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/AdminControllerProcessorModule.php",
    "content": "<?php\nclass AdminControllerProcessorModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['a/process'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/a/process';\n\t}\n\n\tprivate static function getChosenMedia($modelIds)\n\t{\n\t\t$chosenMedia =\n\t\t[\n\t\t\tMedia::Anime => [],\n\t\t\tMedia::Manga => [],\n\t\t];\n\n\t\tforeach ($modelIds as $modelId)\n\t\t{\n\t\t\tif (!preg_match('/([AM])(\\d+)(-\\1(\\d+))?/i', $modelId, $matches))\n\t\t\t{\n\t\t\t\tthrow new Exception('Bad media ID: ' . $modelId);\n\t\t\t}\n\n\t\t\t$media = strtoupper($matches[1]);\n\t\t\t$mediaId1 = intval($matches[2]);\n\t\t\t$mediaId2 = isset($matches[4]) ? intval($matches[4]) : $mediaId1;\n\t\t\tforeach (range($mediaId1, $mediaId2) as $mediaId)\n\t\t\t{\n\t\t\t\t$chosenMedia[$media] []= $mediaId;\n\t\t\t}\n\t\t}\n\n\t\tforeach ($chosenMedia as $media => $ids)\n\t\t{\n\t\t\t$chosenMedia[$media] = array_unique($ids);\n\t\t}\n\n\t\treturn $chosenMedia;\n\t}\n\n\tprivate static function getChosenUsers($modelIds)\n\t{\n\t\t$chosenUsers = [];\n\t\tforeach ($modelIds as $modelId)\n\t\t{\n\t\t\t$chosenUsers []= $modelId;\n\t\t}\n\t\treturn $chosenUsers;\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\ttry\n\t\t{\n\t\t\tif (empty($_POST['sender']))\n\t\t\t{\n\t\t\t\tthrow new Exception('No sender specified');\n\t\t\t}\n\t\t\t$sender = $_POST['sender'];\n\n\t\t\tif (empty($_POST['action']))\n\t\t\t{\n\t\t\t\tthrow new Exception('No action specified');\n\t\t\t}\n\t\t\t$action = $_POST['action'];\n\n\t\t\tif (empty($_POST['model-ids']))\n\t\t\t{\n\t\t\t\tthrow new Exception('No model ids specified');\n\t\t\t}\n\t\t\t$modelIds = array_map('trim', preg_split('/[,;]/', $_POST['model-ids']));\n\n\t\t\t$chosenMedia = [];\n\t\t\t$chosenUsers = [];\n\t\t\tswitch ($sender)\n\t\t\t{\n\t\t\t\tcase 'media':\n\t\t\t\t\t$chosenMedia = self::getChosenMedia($modelIds);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'user':\n\t\t\t\t\t$chosenUsers = self::getChosenUsers($modelIds);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Exception('Unknown sender: ' . $sender);\n\t\t\t}\n\n\t\t\tif ($action == 'refresh')\n\t\t\t{\n\t\t\t\t$num = 0;\n\t\t\t\t$startTime = microtime(true);\n\t\t\t\t$mediaProcessors =\n\t\t\t\t[\n\t\t\t\t\tMedia::Anime => new AnimeProcessor(),\n\t\t\t\t\tMedia::Manga => new MangaProcessor(),\n\t\t\t\t];\n\t\t\t\t$userProcessor = new UserProcessor();\n                $userMediaProcessor = new UserMediaProcessor();\n\n\t\t\t\tforeach ($chosenMedia as $media => $ids)\n\t\t\t\t{\n\t\t\t\t\tforeach ($ids as $id)\n\t\t\t\t\t{\n\t\t\t\t\t\t$mediaProcessors[$media]->process($id);\n\t\t\t\t\t\t++ $num;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tforeach ($chosenUsers as $user)\n\t\t\t\t{\n\t\t\t\t\t$userProcessor->process($user);\n                    $userMediaProcessor->process($user);\n\t\t\t\t\t++ $num;\n\t\t\t\t}\n\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = sprintf('Successfully processed %d entities in %.02fs', $num, microtime(true) - $startTime);\n\t\t\t}\n\n\t\t\telseif ($action == 'wipe-cache')\n\t\t\t{\n\t\t\t\t$deleted = 0;\n\t\t\t\tforeach ($chosenUsers as $userName)\n\t\t\t\t{\n\t\t\t\t\t$cache = new Cache();\n\t\t\t\t\t$cache->setPrefix($userName);\n\n\t\t\t\t\tforeach ($cache->getAllFiles() as $path)\n\t\t\t\t\t{\n\t\t\t\t\t\t$deleted ++;\n\t\t\t\t\t\tunlink($path);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = 'Deleted ' . $deleted . ' files';\n\t\t\t}\n\n\t\t\telseif ($action == 'unban' or $action == 'soft-ban' or $action == 'hard-ban')\n\t\t\t{\n\t\t\t\tswitch ($action)\n\t\t\t\t{\n\t\t\t\t\tcase 'unban':\n\t\t\t\t\t\t$banState = BanHelper::USER_BAN_NONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'soft-ban':\n\t\t\t\t\t\t$banState = BanHelper::USER_BAN_QUEUE_ONLY;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'hard-ban':\n\t\t\t\t\t\t$banState = BanHelper::USER_BAN_TOTAL;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Exception('Wrong ban state');\n\t\t\t\t}\n\t\t\t\t$changed = 0;\n\t\t\t\tforeach ($chosenUsers as $userName)\n\t\t\t\t{\n\t\t\t\t\tBanHelper::setUserBanState($userName, $banState);\n\t\t\t\t\t++ $changed;\n\t\t\t\t}\n\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = sprintf('Successfully updated %d users', $changed);\n\t\t\t}\n\n\t\t\telseif ($action == 'reset-franchise')\n\t\t\t{\n\t\t\t\t$num = 0;\n\n\t\t\t\tforeach ($chosenMedia as $media => $ids)\n\t\t\t\t{\n\t\t\t\t\t$query = 'UPDATE media SET franchise = NULL WHERE media = ? AND mal_id IN (' . R::genSlots($ids) . ')';\n\t\t\t\t\tR::exec($query, array_merge([$media], $ids));\n\t\t\t\t\t$num += count($ids);\n\t\t\t\t}\n\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = sprintf('Successfully reset franchise for %d entities. Don\\'t forget to refresh them now!', $num);\n\t\t\t}\n\n\t\t\telseif ($action == 'remove')\n\t\t\t{\n\t\t\t\t$num = 0;\n\n\t\t\t\tforeach ($chosenMedia as $media => $ids)\n\t\t\t\t{\n\t\t\t\t\t$query = 'DELETE FROM media WHERE media = ? AND mal_id IN (' . R::genSlots($ids) . ')';\n\t\t\t\t\tR::exec($query, array_merge([$media], $ids));\n\t\t\t\t\t$num += count($ids);\n\t\t\t\t}\n\n\t\t\t\t$viewContext->messageType = 'info';\n\t\t\t\t$viewContext->message = sprintf('Successfully removed %d entities.', $num);\n\t\t\t}\n\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Exception('Unknown action: ' . $action);\n\t\t\t}\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$viewContext->messageType = 'error';\n\t\t\t$viewContext->message = $e->getMessage();\n\t\t}\n\n\t\t$viewContext->viewName = 'admin-index';\n\t\t$viewContext->meta->title = 'Admin - ' . Config::$title;\n\t\tWebMediaHelper::addCustom($viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/IndexControllerAboutModule.php",
    "content": "<?php\nclass IndexControllerAboutModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['s/about'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/s/about';\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$viewContext->viewName = 'index-about';\n\t\t$viewContext->meta->title = 'About - ' . Config::$title;\n\t\tWebMediaHelper::addCustom($viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/IndexControllerGlobalsModule.php",
    "content": "<?php\nclass IndexControllerGlobalsModule extends AbstractControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['s/globals'];\n\t}\n\n\tpublic static function url()\n\t{\n\t\treturn '/s/globals';\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$viewContext->viewName = 'index-globals';\n\t\t$viewContext->meta->title = 'Global statistics - ' . Config::$title;\n\t\t$viewContext->meta->description = 'Global community statistics on ' . Config::$title . ', an online tool that extends your myanimelist.net profile.';\n\t\tWebMediaHelper::addHighcharts($viewContext);\n\t\tWebMediaHelper::addInfobox($viewContext);\n\t\tWebMediaHelper::addMiniSections($viewContext);\n\t\tWebMediaHelper::addCustom($viewContext);\n\n\t\t$globalsCache = file_exists(Config::$globalsCachePath)\n\t\t\t? TextHelper::loadJson(Config::$globalsCachePath, true)\n\t\t\t: [];\n\n\t\t$viewContext->userCount = $globalsCache['user-count'];\n        $viewContext->userCountAll = $globalsCache['user-count-all'];\n\t\t$viewContext->mediaCount = $globalsCache['media-count'];\n\t\t$viewContext->ratingDistribution = array_map(function($v) { return RatingDistribution::fromArray($v); }, $globalsCache['rating-dist']);\n\t\t$viewContext->queuedUserCount = (new Queue(Config::$userQueuePath))->size();\n\t\t$viewContext->queueSizes = TextHelper::loadJson(Config::$userQueueSizesPath, true);\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/IndexControllerIndexModule.php",
    "content": "<?php\nclass IndexControllerIndexModule extends AbstractControllerModule\n{\n    public static function getUrlParts()\n    {\n        return ['', 'index'];\n    }\n\n    public static function url()\n    {\n        return '/';\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'index-index';\n        $viewContext->layoutName = 'layout-headerless';\n        WebMediaHelper::addCustom($viewContext);\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/IndexControllerSearchModule.php",
    "content": "<?php\nclass IndexControllerSearchModule extends AbstractControllerModule\n{\n    public static function getUrlParts()\n    {\n        return ['s/search'];\n    }\n    \n    public static function url()\n    {\n        return '/s/search';\n    }\n    \n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $username = !empty($_POST['user-name']) ? trim($_POST['user-name']) : '';\n        \n        if (empty($username)) {\n            $viewContext->layoutName = null;\n            \n            $uri = IndexControllerIndexModule::url();\n            \n            HttpHeadersHelper::setCurrentHeader('Location', $uri);\n            \n            return;\n        }\n        \n        if (!preg_match('#^' . UserController::getUserRegex() . '$#', $username)) {\n            $viewContext->viewName = 'error-user-invalid';\n            \n            $viewContext->meta->noIndex = true;\n            \n            return;\n        }\n        \n        $viewContext->layoutName = null;\n        \n        $uri = UserControllerProfileModule::url($username);\n        \n        HttpHeadersHelper::setCurrentHeader('Location', $uri . '?referral=search');\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerAchievementsModule.php",
    "content": "<?php\nclass UserControllerAchievementsModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return 'Achievements';\n    }\n\n    public static function getUrlParts()\n    {\n        return ['achievements'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 6;\n    }\n\n    private static function getThreshold($achievement)\n    {\n        $threshold = $achievement->threshold;\n\n        if (preg_match('/^([0-9.]+)\\+$/', $threshold, $matches)) {\n            return [floatval($matches[1]), null];\n        } elseif (preg_match('/^([0-9.]+)(\\.\\.|-)([0-9.]+)$/', $threshold, $matches)) {\n            return [floatval($matches[1]), floatval($matches[3])];\n        }\n\n        throw new Exception('Invalid threshold: ' . $threshold);\n    }\n\n    public static function getAchievementsDefinitions()\n    {\n        $dir = Config::$achievementsDefinitionsDirectory;\n        $imgFiles = scandir(Config::$imageDirectory . DIRECTORY_SEPARATOR . 'achievement');\n        $definitions = array_fill_keys(Media::getConstList(), []);\n\n        foreach (glob($dir . DIRECTORY_SEPARATOR . '*.json') as $file) {\n            $definition = TextHelper::loadJson($file);\n\n            $prevAch = null;\n\n            foreach ($definition->achievements as &$ach) {\n                foreach ($imgFiles as $f) {\n                    if (preg_match('/' . $ach->id . '[^0-9a-zA-Z_-]/', $f)) {\n                        $ach->path = $f;\n                    }\n                }\n\n                $ach->next = null;\n            }\n\n            foreach ($definition->achievements as &$ach) {\n                if ($prevAch !== null) {\n                    $prevAch->next = $ach;\n                }\n\n                $ach->prev = $prevAch;\n                $prevAch = &$ach;\n            }\n\n            unset($ach);\n            unset($prevAch);\n\n            $definitions[$definition->media] []= $definition;\n        }\n\n        foreach (Media::getConstList() as $key) {\n            uasort($definitions[$key], function($a, $b)\n            {\n                return $a->order - $b->order;\n            });\n        }\n\n        return $definitions;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-achievements';\n        $viewContext->meta->title = $viewContext->user->name . ' - Achievements (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' achievements.';\n        WebMediaHelper::addEntries($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n\n        $achList = self::getAchievementsDefinitions();\n\n        $list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $listFinished = UserMediaFilter::doFilter($list, UserMediaFilter::finished());\n        $listNonPlanned = UserMediaFilter::doFilter($list, UserMediaFilter::nonPlanned());\n        $listDropped = UserMediaFilter::doFilter($list, UserMediaFilter::dropped());\n        $distribution = RatingDistribution::fromEntries($listNonPlanned);\n\n        $evaluators = [\n            'title' => function ($groupData) use ($listFinished) {\n                $entries = UserMediaFilter::doFilter($listFinished, UserMediaFilter::givenMedia($groupData->requirement->titles));\n\n                return [count($entries), $entries];\n            },\n            'genre-title' => function ($groupData) use ($listFinished) {\n                $entries1 = UserMediaFilter::doFilter($listFinished, UserMediaFilter::genre($groupData->requirement->genre, $listFinished));\n\n                $entries2 = !empty($groupData->requirement->titles) ? UserMediaFilter::doFilter($listFinished, UserMediaFilter::givenMedia($groupData->requirement->titles)) : [];\n\n                $entries = array_merge($entries1, $entries2);\n\n                $entries = array_intersect_key($entries, array_unique(array_map(function ($entry) {\n                    return $entry->media . $entry->mal_id;\n                }, $entries)));\n\n                return [count($entries), $entries];\n            },\n            'source-title' => function ($groupData) use ($listFinished) {\n                $entries1 = UserMediaFilter::doFilter($listFinished, UserMediaFilter::source($groupData->requirement->source));\n\n                $entries2 = !empty($groupData->requirement->titles) ? UserMediaFilter::doFilter($listFinished, UserMediaFilter::givenMedia($groupData->requirement->titles)) : [];\n\n                $entries = array_merge($entries1, $entries2);\n\n                $entries = array_intersect_key($entries, array_unique(array_map(function ($entry) {\n                    return $entry->media . $entry->mal_id;\n                }, $entries)));\n\n                return [count($entries), $entries];\n            },\n            'finished' => function ($groupData) use ($listFinished) {\n                return [count($listFinished), null];\n            },\n            'dropped-0' => function ($groupData) use ($listFinished, $listDropped) {\n                if (count($listDropped)) {\n                    return [0, null];\n                }\n\n                return [count($listFinished), null];\n            },\n            'score' => function ($groupData) use ($listNonPlanned, $distribution) {\n                if ($distribution->getRatedCount()) {\n                    return [$distribution->getMeanScore(), null];\n                }\n\n                return [null, null];\n            },\n            'release-old' => function ($groupData) use ($listFinished) {\n                $entries = UserMediaFilter::doFilter($listFinished, function ($entry) {\n                    $yearTo = substr($entry->published_to ?? '????', 0, 4);\n\n                    return $yearTo !== '????' && intval($yearTo) < 1981;\n                });\n\n                return [count($entries), $entries];\n            },\n            'release-classic' => function ($groupData) use ($listFinished) {\n                $entries = UserMediaFilter::doFilter($listFinished, function ($entry) {\n                    $yearTo = substr($entry->published_to ?? '????', 0, 4);\n\n                    return $yearTo !== '????' && intval($yearTo) < 2001 && intval($yearTo) > 1980;\n                });\n\n                return [count($entries), $entries];\n            },\n            'duration-short' => function ($groupData) use ($listFinished) {\n                $entries = UserMediaFilter::doFilter($listFinished, function ($entry) {\n                    return $entry->duration > 0 && $entry->duration < 16;\n                });\n\n                return [count($entries), $entries];\n            },\n            'episode-long' => function ($groupData) use ($listNonPlanned) {\n                $entries = UserMediaFilter::doFilter($listNonPlanned, function ($entry) {\n                    return $entry->finished_episodes > 99;\n                });\n\n                return [count($entries), $entries];\n            },\n            'volume-long' => function ($groupData) use ($listNonPlanned) {\n                $entries = UserMediaFilter::doFilter($listNonPlanned, function ($entry) {\n                    return $entry->finished_volumes > 19;\n                });\n\n                return [count($entries), $entries];\n            },\n            'franchise' => function ($groupData) use ($listNonPlanned) {\n                $franchises = array_filter(Model_MixedUserMedia::getFranchises($listNonPlanned), function ($franchise) {\n                    if (count($franchise->ownEntries) < 2) {\n                        return false;\n                    }\n\n                    $episodes = 0;\n\n                    foreach ($franchise->ownEntries as $entry) {\n                        $episodes += $entry->finished_episodes;\n                    }\n\n                    return $episodes > 199;\n                });\n\n                $entries = [];\n\n                foreach ($franchises as $franchise) {\n                    foreach ($franchise->ownEntries as $entry) {\n                        $entries[] = $entry;\n                    }\n                }\n\n                return [count($franchises), $entries];\n            },\n            'novel' => function ($groupData) use ($listNonPlanned) {\n                $entries = UserMediaFilter::doFilter($listNonPlanned, function ($entry) {\n                    return (intval($entry->sub_type) === MangaMediaType::Novel || intval($entry->sub_type) === MangaMediaType::LightNovel) && $entry->finished_volumes > 0;\n                });\n\n                return [count($entries), $entries];\n            },\n            'pervert' => function ($groupData) use ($listFinished) {\n                $entriesCount = count($listFinished);\n\n                if ($entriesCount) {\n                    $entriesEcchi = UserMediaFilter::doFilter($listFinished, UserMediaFilter::genre(9, $listFinished));\n\n                    $entriesErotica = UserMediaFilter::doFilter($listFinished, UserMediaFilter::genre(49, $listFinished));\n\n                    $entriesHentai = UserMediaFilter::doFilter($listFinished, UserMediaFilter::genre(12, $listFinished));\n\n                    $entries = array_merge($entriesErotica, $entriesEcchi, $entriesHentai);\n\n                    $entries = array_intersect_key($entries, array_unique(array_map(function ($entry) {\n                        return $entry->media . $entry->mal_id;\n                    }, $entries)));\n\n                    $score = round(100 / $entriesCount * (count($entriesEcchi) * 2 + count($entriesErotica) * 3 + count($entriesHentai) * 4), 2);\n\n                    if ($score > 100) {\n                        $score = 100;\n                    }\n\n                    return [$score, $entries];\n                }\n\n                return [null, null];\n            },\n            'time' => function ($groupData) use ($listNonPlanned) {\n                $distribution = RatingTimeDistribution::fromEntries($listNonPlanned);\n\n                return [floatval(sprintf('%.02f', $distribution->getTotalTime() / 1440.)), null];\n            },\n            're' => function ($groupData) use ($viewContext) {\n                return [$viewContext->media === 'M' ? $viewContext->user->manga_views : $viewContext->user->anime_views, null];\n            },\n            'year' => function ($groupData) use ($listFinished) {\n                $years = [];\n\n                foreach ($listFinished as $entry)\n                {\n                    $year = substr($entry->published_from ?? '????', 0, 4);\n\n                    if (ctype_digit($year))\n                    {\n                        $years[$year] = true;\n                    }\n                }\n\n                return [count($years), null];\n            },\n        ];\n\n        $achievements = [];\n        $hiddenCount = 0;\n\n        foreach ($achList[$viewContext->media] as $group => $groupData) {\n            //get subject and entries basing on requirement type\n            $evaluator = $evaluators[$groupData->requirement->type];\n            list ($subject, $entriesOwned) = $evaluator($groupData);\n\n            $groupData->achievements = array_reverse($groupData->achievements);\n\n            if ($subject === null) {\n                continue;\n            }\n\n            //give first achievement for which the subject fits into its threshold\n            $localAchievements = [];\n\n            foreach ($groupData->achievements as &$ach) {\n                list($a, $b) = self::getThreshold($ach);\n                $ach->thresholdLeft = $a;\n                $ach->thresholdRight = $b;\n                $ach->earned = ((($subject >= $a) or ($a === null)) and (($subject <= $b) or ($b === null)));\n\n                if ($ach->next and $ach->next->earned) {\n                    $ach->earned = true;\n                    $ach->hidden = true;\n                    $hiddenCount ++;\n                } else {\n                    $ach->hidden = false;\n                }\n\n                if ($ach->earned) {\n                    //put additional info\n                    if (!empty($entriesOwned)) {\n                        DataSorter::sort($entriesOwned, DataSorter::Title);\n                        $ach->entries = $entriesOwned;\n                    }\n\n                    $ach->progress = 100;\n                    $ach->subject = round($subject, 2);\n\n                    if ($ach->next) {\n                        $ach->progress = ($subject - $a) * 100.0 / ($ach->next->thresholdLeft - $a);\n                    }\n\n                    $localAchievements []= $ach;\n                }\n            }\n\n            $achievements = array_merge($achievements, array_reverse($localAchievements));\n        }\n\n        $viewContext->achievements = $achievements;\n        $viewContext->private = $viewContext->user->isUserMediaPrivate($viewContext->media);\n        $viewContext->hiddenCount = $hiddenCount;\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerEntriesModule.php",
    "content": "<?php\nclass UserControllerEntriesModule extends AbstractUserControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['entries'];\n\t}\n\n\tpublic static function getMediaAvailability()\n\t{\n\t\treturn [];\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$sender = $_GET['sender'] ?? null;\n\t\t$filterParam = isset($_GET['filter-param']) ? $_GET['filter-param'] : null;\n\t\tif (isset($_GET['media']) and in_array($_GET['media'], Media::getConstList()))\n\t\t{\n\t\t\t$viewContext->media = $_GET['media'];\n\t\t}\n\n\t\t$viewContext->viewName = 'user-entries-' . $sender;\n\t\t$viewContext->layoutName = 'layout-ajax';\n\t\t$viewContext->filterParam = $filterParam;\n\t\t$list = $viewContext->user->getMixedUserMedia($viewContext->media);\n\n\t\t$computeMeanScore = null;\n\t\tswitch ($sender)\n\t\t{\n\t\t\tcase 'ratings':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::score($filterParam)\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'length':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::nonMovie(),\n\t\t\t\t\tUserMediaFilter::lengthGroup($filterParam)\n\t\t\t\t);\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'type':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::type($filterParam)\n\t\t\t\t);\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n            case 'source':\n                $filter = UserMediaFilter::combine(\n                    UserMediaFilter::nonPlanned(),\n                    UserMediaFilter::source($filterParam)\n                );\n                $computeMeanScore = true;\n                break;\n\n\t\t\tcase 'year':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::publishedYear($filterParam)\n\t\t\t\t);\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'decade':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::publishedDecade($filterParam)\n\t\t\t\t);\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'creator':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::creator($filterParam, $list)\n\t\t\t\t);\n\t\t\t\tswitch ($viewContext->media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime:\n\t\t\t\t\t\t$table = 'animeproducer';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Media::Manga:\n\t\t\t\t\t\t$table = 'mangaauthor';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new BadMediaException();\n\t\t\t\t}\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'genre':\n\t\t\t\t$filter = UserMediaFilter::combine(\n\t\t\t\t\tUserMediaFilter::nonPlanned(),\n\t\t\t\t\tUserMediaFilter::genre($filterParam, $list)\n\t\t\t\t);\n\t\t\t\t$computeMeanScore = true;\n\t\t\t\tbreak;\n\n\t\t\tcase 'franchises':\n\t\t\t\t$filter = UserMediaFilter::nonPlanned();\n\t\t\t\tbreak;\n\t\t\tcase 'mismatches':\n\n\t\t\t\t$filter = null;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Exception('Unknown sender (' . $sender . ')');\n\t\t}\n\n\t\t$list = UserMediaFilter::doFilter($list, $filter);\n\t\t$isPrivate = $viewContext->user->isUserMediaPrivate($viewContext->media);\n\n\t\tif (!$isPrivate)\n\t\t{\n\t\t\tif ($computeMeanScore)\n\t\t\t{\n\t\t\t\t$dist = RatingDistribution::fromEntries($list);\n\t\t\t\t$viewContext->meanScore = $dist->getMeanScore();\n\t\t\t}\n\t\t\tif ($sender == 'franchises')\n\t\t\t{\n\t\t\t\t$franchises = Model_MixedUserMedia::getFranchises($list);\n\t\t\t\tforeach ($franchises as &$franchise)\n\t\t\t\t{\n\t\t\t\t\t$dist = RatingDistribution::fromEntries($franchise->ownEntries);\n\t\t\t\t\t$franchise->meanScore = $dist->getMeanScore();\n                    DataSorter::sort($franchise->ownEntries, DataSorter::MediaMalId);\n\t\t\t\t}\n\t\t\t\tunset($franchise);\n\t\t\t\tDataSorter::sort($franchises, DataSorter::MeanScore);\n\t\t\t\t$viewContext->franchises = array_filter($franchises, function($franchise) { return count($franchise->ownEntries) > 1; });\n\t\t\t}\n\t\t\telseif ($sender == 'mismatches')\n\t\t\t{\n\t\t\t\t$entries = $viewContext->user->getMismatchedUserMedia($list);\n\t\t\t\tDataSorter::sort($entries, DataSorter::Title);\n\t\t\t\t$viewContext->entries = $entries;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tDataSorter::sort($list, DataSorter::Title);\n\t\t\t\t$viewContext->entries = $list;\n\t\t\t}\n\t\t}\n\n\t\t$viewContext->isPrivate = $isPrivate;\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerExportModule.php",
    "content": "<?php\nclass UserControllerExportModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n    }\n\n    public static function getUrlParts()\n    {\n        return ['export'];\n    }\n\n    public static function url()\n    {\n        $args = func_get_args();\n        $userName = array_shift($args);\n        $media = array_shift($args);\n        $settings = array_shift($args);\n\n        $url = '/' . $userName . '/' . str_replace('=', '', base64_encode($settings)) . '/' . time();\n        return UrlHelper::absoluteUrl($url);\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [];\n    }\n\n    public static function getOrder()\n    {\n    }\n\n    public static function getContentType()\n    {\n        return 'image/png';\n    }\n\n    const IMAGE_TYPE_ANIME = 1;\n    const IMAGE_TYPE_MANGA = 2;\n    const IMAGE_TYPE_ANIME_MANGA = 3;\n\n    const COLOR_BARS1 = 1;\n    const COLOR_BARS2 = 2;\n    const COLOR_BAR_GUIDES1 = 3;\n    const COLOR_BAR_GUIDES2 = 4;\n    const COLOR_BACKGROUND = 5;\n    const COLOR_FONT_DARK = 6;\n    const COLOR_FONT_LIGHT = 7;\n    const COLOR_TITLE = 8;\n    const COLOR_LOGO = 9;\n\n    private static function mixColors($c1, $c2, $r)\n    {\n        $c3 = 0;\n        for ($i = 0; $i < 4; $i ++)\n        {\n            $comp = ($c1 & 0xff) + (($c2 & 0xff) - ($c1 & 0xff)) * $r;\n            $c3 |= ((int) $comp << ($i << 3));\n            $c1 >>= 8;\n            $c2 >>= 8;\n        }\n        return $c3;\n    }\n\n    private static function drawGradient($img, $x1, $y1, $x2, $y2, $c1, $c2)\n    {\n        if ($x2 < $x1)\n        {\n            list($x1, $x2, $c1, $c2) =\n                [$x2, $x1, $c2, $c1];\n        }\n        $delta = 1. / max(1, $x2 - $x1);\n        for ($x = $x1, $r = 0; $x <= $x2; $x ++, $r += $delta)\n        {\n            $c = self::mixColors($c1, $c2, $r);\n            imageline($img, $x, $y1, $x, $y2, $c);\n        }\n    }\n\n    private static function drawCopy($dst, $src, $x, $y)\n    {\n        imagecopy($dst, $src, $x, $y, 0, 0, imagesx($src), imagesy($src));\n    }\n\n    private static function getBoundingBox($fontSize, $fontPath, $text)\n    {\n        $bbox = imagettfbbox($fontSize, 0, $fontPath, $text);\n        $ret = new StdClass;\n        $ret->x1 = $bbox[6];\n        $ret->x2 = $bbox[2];\n        $ret->y1 = $bbox[5];\n        $ret->y2 = $bbox[1];\n        $ret->x = $ret->x1;\n        $ret->y = -$ret->y1;\n        $ret->width = abs($ret->x2 - $ret->x1);\n        $ret->height = abs($ret->y2 - $ret->y1);\n        return $ret;\n    }\n\n\n\n    private static function getIconImage($settings)\n    {\n        $iconImageMask = imagecreatefrompng(Config::$mediaDirectory . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'export-mask.png');\n        $img = imagecreatetruecolor(imagesx($iconImageMask), imagesy($iconImageMask));\n        imagefilledrectangle($img, 0, 0, imagesx($img), imagesy($img), $settings->colors[self::COLOR_BACKGROUND]);\n        imagealphablending($img, false);\n        for ($y = 0; $y < imagesy($img); $y ++)\n        {\n            for ($x = 0; $x < imagesx($img); $x ++)\n            {\n                $r = imagecolorat($iconImageMask, $x, $y);\n                $r &= 0xff;\n                $r /= 255.0;\n                $c = self::mixColors($settings->colors[self::COLOR_BACKGROUND], $settings->colors[self::COLOR_LOGO], $r);\n                imagesetpixel($img, $x, $y, $c);\n            }\n        }\n        return $img;\n    }\n\n\n\n    private static function getBarsImage($settings, $distribution, $mirror = false)\n    {\n        $groups = $distribution->getGroupsSizes(AbstractDistribution::IGNORE_NULL_KEY);\n        $max = $distribution->getLargestGroupSize(AbstractDistribution::IGNORE_NULL_KEY);\n        $img = imagecreatetruecolor($settings->barWidth, ($settings->barHeight + $settings->barPadding) * count($groups));\n        imagealphablending($img, false);\n        $gx1 = $mirror\n            ? imagesx($img)\n            : 0;\n        $gx2 = imagesx($img) - $gx1;\n        self::drawGradient($img, $gx1, 0, $gx2, imagesy($img), $settings->colors[self::COLOR_BARS1], $settings->colors[self::COLOR_BARS2]);\n\n        $i = 0;\n        foreach ($groups as $count)\n        {\n            ++ $i;\n            $y1 = ($i - 1) * ($settings->barHeight + $settings->barPadding);\n            $y2 = $i * ($settings->barHeight + $settings->barPadding);\n            $x1 = $mirror\n                ? imagesx($img) - $count * imagesx($img) / max(1, $max)\n                : $count * imagesx($img) / max(1, $max);\n            $x2 = $mirror\n                ? 0\n                : imagesx($img);\n            imagefilledrectangle($img, (int) $x1, (int) $y1, (int) $x2, (int) $y2, (int) $settings->colors[self::COLOR_BACKGROUND]);\n        }\n        foreach ($distribution->getGroupsSizes(AbstractDistribution::IGNORE_NULL_KEY) as $i => $count)\n        {\n            $y1 = $i * ($settings->barHeight + $settings->barPadding);\n            $y2 = $i * ($settings->barHeight + $settings->barPadding) + $settings->barPadding - 1;\n            self::drawGradient($img, $gx1, $y1, $gx2, $y2, $settings->colors[self::COLOR_BAR_GUIDES1], $settings->colors[self::COLOR_BAR_GUIDES2]);\n        }\n        return $img;\n    }\n\n\n\n    private static function getBarsAxesImage($settings, $center = false)\n    {\n        $margin = 6;\n        $texts = array_map(function($x) { return \" $x \"; }, range(10, 1));\n        $w = 0;\n        foreach ($texts as $text)\n        {\n            $w = max($w, self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text)->width);\n        }\n        $w += $margin;\n        $img = imagecreatetruecolor($w, ($settings->barHeight + $settings->barPadding) * count($texts));\n        imagealphablending($img, false);\n        imagefilledrectangle($img, 0, 0, imagesx($img), imagesy($img), $settings->colors[self::COLOR_BACKGROUND]);\n        imagealphablending($img, true);\n\n        $i = 0;\n        foreach ($texts as $text)\n        {\n            $bbox = self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text);\n            if ($center)\n            {\n                $x = ($w - $bbox->width) / 2.0;\n            }\n            else\n            {\n                $x = $w - $bbox->width - $margin;\n            }\n            $y = $i * ($settings->barHeight + $settings->barPadding);\n            $y += ($settings->barHeight + $settings->barPadding - $bbox->height) >> 1;\n            $x += $bbox->x;\n            $y += $bbox->y;\n            imagettftext($img, $settings->fontSizeNormal, 0, $x, $y, $settings->colors[self::COLOR_FONT_DARK], $settings->font, $text);\n            ++ $i;\n        }\n        return $img;\n    }\n\n\n\n    private static function getBarsBandsImage($settings, $distribution, $mirror = false)\n    {\n        $margin = 6;\n        $distributionArray = [];\n        foreach ($distribution->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY) as $key)\n        {\n            $distributionArray[$key] = $distribution->getGroupSize($key);\n        }\n        $percentages = TextHelper::roundPercentages($distributionArray);\n        $texts1 = array_map(function($x) { return \" $x \"; }, $distributionArray);\n        $texts2 = array_map(function($x) { return \" ($x%) \"; }, $percentages);\n        $bbox1 = [];\n        $bbox2 = [];\n        $w = 0;\n        foreach (array_keys($texts1) as $key)\n        {\n            $text1 = $texts1[$key];\n            $text2 = $texts2[$key];\n            $bbox1[$key] = self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text1);\n            $bbox2[$key] = self::getBoundingBox($settings->fontSizeSmall, $settings->font, $text2);\n            $w = max($w, $bbox1[$key]->width + $bbox2[$key]->width);\n        }\n        $w += $margin;\n        $img = imagecreatetruecolor($w, ($settings->barHeight + $settings->barPadding) * count($percentages));\n        imagealphablending($img, false);\n        imagefilledrectangle($img, 0, 0, imagesx($img), imagesy($img), $settings->colors[self::COLOR_BACKGROUND]);\n        imagealphablending($img, true);\n\n        $bbox1max = max(array_map(function($bbox) { return $bbox->width; }, $bbox1));\n        $bbox2max = max(array_map(function($bbox) { return $bbox->width; }, $bbox2));\n        $i = 0;\n        foreach (array_keys($texts1) as $key)\n        {\n            $text1 = $texts1[$key];\n            $text2 = $texts2[$key];\n            $x = $mirror\n                ? $bbox2max + $bbox1max - $bbox1[$key]->width\n                : $margin + $bbox1max - $bbox1[$key]->width;\n            $x += $bbox1[$key]->x;\n            $yb = $i * ($settings->barHeight + $settings->barPadding);\n            $y = $yb;\n            $y += ($settings->barHeight + $settings->barPadding - $bbox1[$key]->height) >> 1;\n            $y += $bbox1[$key]->y;\n            imagettftext($img, $settings->fontSizeNormal, 0, $x, $y, $settings->colors[self::COLOR_FONT_DARK], $settings->font, $text1);\n\n            $x = $mirror\n                ? $bbox2max - $bbox2[$key]->width\n                : $margin + $bbox1max;\n            $x += $bbox2[$key]->x;\n            $y = $yb;\n            $y += ($settings->barHeight + $settings->barPadding - $bbox2[$key]->height) >> 1;\n            $y += $bbox2[$key]->y;\n            imagettftext($img, $settings->fontSizeSmall, 0, $x, $y, $settings->colors[self::COLOR_FONT_LIGHT], $settings->font, $text2);\n\n            ++ $i;\n        }\n        return $img;\n    }\n\n\n\n    private static function getFooterImage($settings, $distribution, $media, $mirror = false)\n    {\n        $text = 'mean rated:';\n        $bboxSmall = self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text);\n        $text = join(' ', array_map(function($x) { return ucfirst(Media::toString($x)); }, Media::getConstList()));\n        $bboxBig = self::getBoundingBox($settings->fontSizeBig, $settings->font, $text);\n\n        $w = $settings->barWidth;\n        $h = $bboxBig->height;\n        $img = imagecreatetruecolor($w, $h);\n        imagealphablending($img, false);\n        imagefilledrectangle($img, 0, 0, $w, $h, $settings->colors[self::COLOR_BACKGROUND]);\n        imagealphablending($img, true);\n\n        $text = ' ' . ucfirst(Media::toString($media));\n        $bbox = self::getBoundingBox($settings->fontSizeBig, $settings->font, 'Anime  ');\n        $x = $bbox->x + ($mirror ? $w - $bbox->width : 0);\n        $y = $bbox->y + (($h - $bboxBig->height) >> 1);\n        imagettftext($img, $settings->fontSizeBig, 0, $x, $y, $settings->colors[self::COLOR_TITLE], $settings->font, $text);\n        $lx = $mirror ? $w - $bbox->width : $bbox->width;\n\n        $text1 = 'mean: ';\n        $text2 = sprintf('%.02f', $distribution->getMeanScore());\n        $bbox1 = self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text1);\n        $bbox2 = self::getBoundingBox($settings->fontSizeBig, $settings->font, $text2);\n        $x = $bbox1->x + ($mirror ? 0 : ($w - $bbox1->width - $bbox2->width));\n        $y = $bbox2->y/*ugly but works*/ + (($bbox2->height - $bboxSmall->height) >> 1);\n        imagettftext($img, $settings->fontSizeNormal, 0, $x, $y, $settings->colors[self::COLOR_FONT_LIGHT], $settings->font, $text1);\n        $x += $bbox1->width + $bbox2->x;\n        $y = $bboxBig->y + (($h - $bboxBig->height) >> 1);\n        imagettftext($img, $settings->fontSizeBig, 0, $x, $y, $settings->colors[self::COLOR_FONT_DARK], $settings->font, $text2);\n        $rx = $mirror ? $bbox1->width + $bbox2->width : $w - $bbox1->width - $bbox2->width;\n\n        $text1 = 'rated: ';\n        $text2 = $distribution->getRatedCount();\n        $bbox1 = self::getBoundingBox($settings->fontSizeNormal, $settings->font, $text1);\n        $bbox2 = self::getBoundingBox($settings->fontSizeBig, $settings->font, $text2);\n        $x = $bbox1->x + $lx + (($rx - $lx - $bbox1->width - $bbox2->width) >> 1);\n        $y = $bbox2->y/*ugly but works*/ + (($bbox2->height - $bboxSmall->height) >> 1);\n        imagettftext($img, $settings->fontSizeNormal, 0, $x, $y, $settings->colors[self::COLOR_FONT_LIGHT], $settings->font, $text1);\n        $x += $bbox1->width + $bbox2->x;\n        $y = $bboxBig->y + (($h - $bboxBig->height) >> 1);\n        imagettftext($img, $settings->fontSizeBig, 0, $x, $y, $settings->colors[self::COLOR_FONT_DARK], $settings->font, $text2);\n        return $img;\n    }\n\n\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $ratingDistribution = [];\n        foreach (Media::getConstList() as $media)\n        {\n            $entries = $viewContext->user->getMixedUserMedia($media);\n            $entriesNonPlanned = UserMediaFilter::doFilter($entries, [UserMEdiaFilter::nonPlanned()]);\n            $ratingDistribution[$media] = RatingDistribution::fromEntries($entries);\n        }\n\n        //get input data from GET\n        $userSettings = !empty($_GET['settings']) ? json_decode(base64_decode($_GET['settings']), true) : [];\n        $imageType = !empty($userSettings[0])\n            ? $userSettings[0]\n            : null;\n        if (!in_array($imageType, [self::IMAGE_TYPE_ANIME, self::IMAGE_TYPE_MANGA, self::IMAGE_TYPE_ANIME_MANGA]))\n        {\n            $imageType = self::IMAGE_TYPE_ANIME;\n        }\n\n        $settings = new StdClass();\n        $settings->font = Config::$mediaDirectory . DIRECTORY_SEPARATOR . 'font' . DIRECTORY_SEPARATOR . 'OpenSans-Regular.ttf';\n        $settings->fontSizeSmall = 7;\n        $settings->fontSizeNormal = 9;\n        $settings->fontSizeBig = 10.5;\n        $settings->barWidth = 220;\n        $settings->barHeight = 11;\n        $settings->barPadding = 1;\n        $settings->colors =\n        [\n            self::COLOR_BARS1       => '00a4c0f4',\n            self::COLOR_BARS2       => '0013459a',\n            self::COLOR_BAR_GUIDES1 => 'eea4c0f4',\n            self::COLOR_BAR_GUIDES2 => 'ee13459a',\n            self::COLOR_BACKGROUND  => 'ffffffff',\n            self::COLOR_FONT_DARK   => '00000000',\n            self::COLOR_FONT_LIGHT  => 'aa000000',\n            self::COLOR_TITLE       => '00577fc2',\n            self::COLOR_LOGO        => '00577fc2',\n        ];\n        foreach (array_keys($settings->colors) as $key)\n        {\n            if (isset($userSettings[$key]))\n            {\n                $value = $userSettings[$key];\n                assert(in_array(strlen($value), [6, 8]));\n                $settings->colors[$key] = $value;\n            }\n        }\n\n        $settings->colors = array_map(function($color)\n        {\n            $value = array_map('hexdec', str_split($color, 2));\n            if (count($value) == 3)\n            {\n                array_unshift($value, 0);\n            }\n            $value[0] >>= 1;\n            $c = 0;\n            while (!empty($value))\n            {\n                $c <<= 8;\n                $c |= array_shift($value);\n            }\n            return $c;\n        }, $settings->colors);\n\n        $margin = 6;\n        $iconImage = self::getIconImage($settings);\n        if ($imageType == self::IMAGE_TYPE_ANIME || $imageType == self::IMAGE_TYPE_MANGA)\n        {\n            $media = $imageType == self::IMAGE_TYPE_ANIME ? Media::Anime : Media::Manga;\n            $barsImage = self::getBarsImage($settings, $ratingDistribution[$media], false);\n            $barsAxesImage = self::getBarsAxesImage($settings, false);\n            $barsBandsImage = self::getBarsBandsImage($settings, $ratingDistribution[$media], false);\n            $footerImage = self::getFooterImage($settings, $ratingDistribution[$media], $media, false);\n            $w = imagesx($barsImage) + imagesx($barsAxesImage) + imagesx($barsBandsImage);\n            $h = imagesy($barsImage) + $margin + imagesy($footerImage);\n            $img = imagecreatetruecolor($w, $h);\n            imagealphablending($img, false);\n            imagefilledrectangle($img, 0, 0, $w, $h, $settings->colors[self::COLOR_BACKGROUND]);\n            $x = 0;\n            $y = imagesy($barsAxesImage) + $margin;\n            self::drawCopy($img, $barsAxesImage, $x, 0); $x += imagesx($barsAxesImage);\n            self::drawCopy($img, $barsImage, $x, 0);\n            self::drawCopy($img, $footerImage, $x, $y); $x += imagesx($barsImage);\n            self::drawCopy($img, $barsBandsImage, $x, 0); $x += imagesx($barsBandsImage);\n            $x = (imagesx($barsAxesImage) - imagesx($iconImage)) >> 1;\n            self::drawCopy($img, $iconImage, $x, $y - 3);\n        }\n        else\n        {\n            $barsImage1 = self::getBarsImage($settings, $ratingDistribution[Media::Anime], true);\n            $barsImage2 = self::getBarsImage($settings, $ratingDistribution[Media::Manga], false);\n            $barsAxesImage = self::getBarsAxesImage($settings, true);\n            $barsBandsImage1 = self::getBarsBandsImage($settings, $ratingDistribution[Media::Anime], true);\n            $barsBandsImage2 = self::getBarsBandsImage($settings, $ratingDistribution[Media::Manga], false);\n            $footerImage1 = self::getFooterImage($settings, $ratingDistribution[Media::Anime], Media::Anime, true);\n            $footerImage2 = self::getFooterImage($settings, $ratingDistribution[Media::Manga], Media::Manga, false);\n            $w = imagesx($barsImage1) + imagesx($barsImage2) + imagesx($barsAxesImage) + imagesx($barsBandsImage1) + imagesx($barsBandsImage2);\n            $h = imagesy($barsImage1) + $margin + imagesy($footerImage1);\n            $img = imagecreatetruecolor($w, $h);\n            imagealphablending($img, false);\n            imagefilledrectangle($img, 0, 0, $w, $h, $settings->colors[self::COLOR_BACKGROUND]);\n            $x = 0;\n            $y = imagesy($barsAxesImage) + $margin;\n            self::drawCopy($img, $barsBandsImage1, $x, 0); $x += imagesx($barsBandsImage1);\n            self::drawCopy($img, $barsImage1, $x, 0);\n            self::drawCopy($img, $footerImage1, $x, $y); $x += imagesx($barsImage1);\n            self::drawCopy($img, $barsAxesImage, $x, 0); $x += imagesx($barsAxesImage);\n            self::drawCopy($img, $barsImage2, $x, 0);\n            self::drawCopy($img, $footerImage2, $x, $y); $x += imagesx($barsImage2);\n            self::drawCopy($img, $barsBandsImage2, $x, 0);\n            $x = imagesx($barsBandsImage1) + imagesx($barsImage1) + ((imagesx($barsAxesImage) - imagesx($iconImage)) >> 1);\n            self::drawCopy($img, $iconImage, $x, $y - 3);\n        }\n        imagesavealpha($img, true);\n\n        $viewContext->layoutName = null;\n        HttpHeadersHelper::setCurrentHeader('Cache-Control', 'no-cache, must-revalidate');\n        HttpHeadersHelper::setCurrentHeader('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');\n        imagepng($img);\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerFavoritesModule.php",
    "content": "<?php\nclass UserControllerFavoritesModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return 'Favorites';\n    }\n\n    public static function getUrlParts()\n    {\n        return ['favorites'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 4;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-favorites';\n        $viewContext->meta->title = $viewContext->user->name . ' - Favorites (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' favorites.';\n        WebMediaHelper::addHighcharts($viewContext);\n        WebMediaHelper::addTablesorter($viewContext);\n        WebMediaHelper::addInfobox($viewContext);\n        WebMediaHelper::addEntries($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n\n        $list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $listNonPlanned = UserMediaFilter::doFilter($list, UserMediaFilter::nonPlanned());\n\n        $favCreators = MediaCreatorDistribution::fromEntries($listNonPlanned);\n        $favGenres = MediaGenreDistribution::fromEntries($listNonPlanned);\n        $favYears = MediaYearDistribution::fromEntries($listNonPlanned);\n        $favDecades = MediaDecadeDistribution::fromEntries($listNonPlanned);\n        $favTypes = MediaTypeDistribution::fromEntries($listNonPlanned);\n        $favSources = MediaSourceDistribution::fromEntries($listNonPlanned);\n        $viewContext->favCreators = $favCreators;\n        $viewContext->favGenres = $favGenres;\n        $viewContext->favYears = $favYears;\n        $viewContext->favDecades = $favDecades;\n        $viewContext->favTypes = $favTypes;\n        $viewContext->favSources = $favSources;\n\n        $distMeanScore = [];\n        $distTimeSpent = [];\n\n        foreach ([$favCreators, $favGenres, $favDecades, $favYears] as $dist) {\n            $meanScore = [];\n            $timeSpent = [];\n\n            foreach ($dist->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY) as $safeKey => $key) {\n                $meanScore[$safeKey] = 0;\n                $timeSpent[$safeKey] = 0;\n                $subEntries = $dist->getGroupEntries($key);\n                $scoreCount = 0;\n\n                foreach ($subEntries as $entry) {\n                    $timeSpent[$safeKey] += $entry->finished_duration;\n                    $meanScore[$safeKey] += $entry->score;\n                    $scoreCount += $entry->score > 0;\n                }\n\n                $meanScore[$safeKey] /= max(1, $scoreCount);\n            }\n\n            $distMeanScore[get_class($dist)] = $meanScore;\n            $distTimeSpent[get_class($dist)] = $timeSpent;\n        }\n\n        $viewContext->creatorScores = $distMeanScore[get_class($favCreators)];\n        $viewContext->genreScores = $distMeanScore[get_class($favGenres)];\n        $viewContext->yearScores = $distMeanScore[get_class($favYears)];\n        $viewContext->decadeScores = $distMeanScore[get_class($favDecades)];\n        $viewContext->creatorTimeSpent = $distTimeSpent[get_class($favCreators)];\n        $viewContext->genreTimeSpent = $distTimeSpent[get_class($favGenres)];\n\n        $viewContext->typePercentages = TextHelper::roundPercentages($favTypes->getGroupsSizes(), 1);\n        $viewContext->sourcePercentages = TextHelper::roundPercentages($favSources->getGroupsSizes(), 1);\n\n        $viewContext->genreValues = DistributionEvaluator::evaluate($favGenres);\n        $viewContext->creatorValues = DistributionEvaluator::evaluate($favCreators);\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerHistoryModule.php",
    "content": "<?php\nclass UserControllerHistoryModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return 'History';\n    }\n\n    public static function getUrlParts()\n    {\n        return ['history'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 3;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-history';\n        $viewContext->meta->title = $viewContext->user->name . ' - History (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' history.';\n        WebMediaHelper::addHighcharts($viewContext);\n        WebMediaHelper::addInfobox($viewContext);\n        WebMediaHelper::addEntries($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n\n        $list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $listFinished = UserMediaFilter::doFilter($list, UserMediaFilter::finished());\n\n        $monthlyHistoryGroups = [];\n        $monthlyHistoryGroupsScores = [];\n        $yearlyHistoryGroupsScores = [];\n        $unknownEntries = [];\n        $max = 0;\n        foreach ($listFinished as $entry)\n        {\n            $key = $entry->end_date;\n            list ($year, $month, $day) = array_map('intval', explode('-', $key));\n            if (!$year || $year < 1900)\n            {\n                $unknownEntries []= $entry;\n                continue;\n            }\n\n            if (!isset($monthlyHistoryGroups[$year]))\n            {\n                $monthlyHistoryGroups[$year] = [];\n            }\n            if (!isset($monthlyHistoryGroups[$year][$month]))\n            {\n                $monthlyHistoryGroups[$year][$month] = [];\n            }\n            $monthlyHistoryGroups[$year][$month][] = $entry;\n            $max = max($max, count($monthlyHistoryGroups[$year][$month]));\n        }\n\n        foreach ($monthlyHistoryGroups as $y => $months)\n        {\n            $countY = 0;\n\n            $scoreY = 0;\n\n            foreach ($months as $m => $entries)\n            {\n                $countM = 0;\n\n                $scoreM = 0;\n\n                foreach ($entries as $entry)\n                {\n                    if ($entry->score > 0)\n                    {\n                        $countY += 1;\n\n                        $scoreY += $entry->score;\n\n                        $countM += 1;\n\n                        $scoreM += $entry->score;\n                    }\n                }\n\n                $monthlyHistoryGroupsScores[$y][$m] = $countM > 0 ? round($scoreM / $countM, 2) : 0;\n            }\n\n            $yearlyHistoryGroupsScores[$y] = $countY > 0 ? round($scoreY / $countY, 2) : 0;\n        }\n\n        $count = 0;\n\n        $score = 0;\n\n        foreach ($unknownEntries as $entry)\n        {\n            if ($entry->score > 0)\n            {\n                $count += 1;\n\n                $score += $entry->score;\n            }\n        }\n\n        $unknownEntriesScore = $count > 0 ? round($score / $count, 2) : 0;\n\n        krsort($monthlyHistoryGroups, SORT_NUMERIC);\n        foreach ($monthlyHistoryGroups as &$group)\n        {\n            ksort($group, SORT_NUMERIC);\n        }\n        unset($group);\n        $viewContext->monthlyHistoryMax = $max;\n        $viewContext->monthlyHistoryGroups = $monthlyHistoryGroups;\n        $viewContext->monthlyHistoryGroupsScores = $monthlyHistoryGroupsScores;\n        $viewContext->yearlyHistoryGroupsScores = $yearlyHistoryGroupsScores;\n        $viewContext->monthlyHistoryUnknownEntries = $unknownEntries;\n        $viewContext->monthlyHistoryUnknownEntriesScore = $unknownEntriesScore;\n\n        $dailyHistory = $viewContext->user->getHistory($viewContext->media);\n        $dailyHistoryGroups = [];\n        foreach ($dailyHistory as $historyEntry)\n        {\n            $key = date('Y-m-d', strtotime($historyEntry->timestamp));\n            if (!isset($dailyHistoryGroups[$key]))\n            {\n                $dailyHistoryGroups[$key] = [];\n            }\n            $dailyHistoryGroups[$key] []= $historyEntry;\n        }\n        krsort($dailyHistoryGroups);\n        $viewContext->dailyHistoryGroups = $dailyHistoryGroups;\n\n        $viewContext->isPrivate = $viewContext->user->isUserMediaPrivate($viewContext->media);\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerListsModule.php",
    "content": "<?php\nclass UserControllerListsModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return ucfirst(Media::toString($media) . ' list');\n    }\n\n    public static function getUrlParts()\n    {\n        return ['list'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 1;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-list';\n        $viewContext->meta->title = $viewContext->user->name . ' - List (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' list.';\n        WebMediaHelper::addTablesorter($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n        \n        $viewContext->list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $viewContext->private = $viewContext->user->isUserMediaPrivate($viewContext->media);\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerProfileModule.php",
    "content": "<?php\nclass UserControllerProfileModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return $viewContext->user->name;\n    }\n\n    public static function getUrlParts()\n    {\n        return ['profile', ''];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [];\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-profile';\n        $viewContext->meta->title = $viewContext->user->name . '\\'s profile - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s profile.';\n        WebMediaHelper::addEntries($viewContext);\n        WebMediaHelper::addMiniSections($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n\n        $viewContext->yearsOnMal = null;\n\n        if (intval($viewContext->user->join_date)) {\n            list ($year, $month, $day) = explode('-', $viewContext->user->join_date);\n            $time = mktime(0, 0, 0, $month, $day, $year);\n            $diff = time() - $time;\n            $diff /= 3600 * 24;\n            $viewContext->yearsOnMal = $diff / 361.25;\n        }\n\n        $viewContext->friends = $viewContext->user->getFriends();\n\n        $viewContext->finished = [];\n        $viewContext->meanUserScore = [];\n        $viewContext->franchiseCount = [];\n        $viewContext->mismatchedCount = [];\n\n        $globalsCache = file_exists(Config::$globalsCachePath) ? TextHelper::loadJson(Config::$globalsCachePath, true) : [];\n\n        $viewContext->meanGlobalScore = array_map(function($v) {\n            return RatingDistribution::fromArray($v)->getMeanScore();\n        }, $globalsCache['rating-dist']);\n\n        foreach (Media::getConstList() as $media) {\n            $list = $viewContext->user->getMixedUserMedia($media);\n\n            $listFinished = UserMediaFilter::doFilter($list, UserMediaFilter::finished());\n            $viewContext->finished[$media] = count($listFinished);\n            unset($listFinished);\n\n            $listNonPlanned = UserMediaFilter::doFilter($list, UserMediaFilter::nonPlanned());\n            $viewContext->meanUserScore[$media] = RatingDistribution::fromEntries($listNonPlanned)->getMeanScore();\n            $viewContext->meanGlobalScore[$media] ??= 0;\n            $franchises = Model_MixedUserMedia::getFranchises($listNonPlanned);\n            $viewContext->franchiseCount[$media] = count(array_filter($franchises, function($franchise) { return count($franchise->ownEntries) > 1; }));\n            unset($franchises);\n            unset($listNonPlanned);\n\n            if ($media == Media::Anime) {\n                $viewContext->episodes = array_sum(array_map(function($mixedMediaEntry) { return $mixedMediaEntry->finished_episodes; }, $list));\n            } else {\n                $viewContext->chapters = array_sum(array_map(function($mixedMediaEntry) { return $mixedMediaEntry->finished_chapters; }, $list));\n            }\n\n            $mismatched = $viewContext->user->getMismatchedUserMedia($list);\n            $viewContext->mismatchedCount[$media] = count($mismatched);\n            unset($mismatched);\n            unset($list);\n        }\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerQueueAddModule.php",
    "content": "<?php\nclass UserControllerQueueAddModule extends AbstractUserControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['queue-add'];\n\t}\n\n\tpublic static function getMediaAvailability()\n\t{\n\t\treturn [];\n\t}\n\n\tpublic static function preWork(&$controllerContext, &$viewContext)\n\t{\n\t\tparent::preWork($controllerContext, $viewContext);\n\t\t$controllerContext->cache->bypass(true);\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$queue = new Queue(Config::$userQueuePath);\n        $queueMedia = new Queue(Config::$userMediaQueuePath);\n\t\t$queueItem = new QueueItem(strtolower($controllerContext->userName));\n\t\t$user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$controllerContext->userName]);\n\t\t$profileAge = (time() - (isset($user->processed) ? strtotime($user->processed) : 0));\n\t\t$banned = BanHelper::getUserBanState($controllerContext->userName) != BanHelper::USER_BAN_NONE;\n        if ($profileAge > Config::$userQueueMinWait && !$banned)\n        {\n\t\t\t$queue->enqueue($queueItem);\n            $queueMedia->enqueue($queueItem);\n        }\n\n\t\t$j['user'] = $controllerContext->userName;\n\t\t$j['pos'] = $queue->seek($queueItem);\n\n\t\t$viewContext->layoutName = 'layout-json';\n\t\t$viewContext->json = $j;\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerQueuePositionModule.php",
    "content": "<?php\nclass UserControllerQueuePositionModule extends AbstractUserControllerModule\n{\n\tpublic static function getUrlParts()\n\t{\n\t\treturn ['queue-pos'];\n\t}\n\n\tpublic static function getMediaAvailability()\n\t{\n\t\treturn [];\n\t}\n\n\tpublic static function preWork(&$controllerContext, &$viewContext)\n\t{\n\t\tparent::preWork($controllerContext, $viewContext);\n\t\t$controllerContext->cache->bypass(true);\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\t$queue = new Queue(Config::$userQueuePath);\n\t\t$queueItem = new QueueItem(strtolower($controllerContext->userName));\n\t\t$j['user'] = $controllerContext->userName;\n\t\t$j['pos'] = $queue->seek($queueItem);\n\n\t\t$viewContext->layoutName = 'layout-json';\n\t\t$viewContext->json = $j;\n\t}\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerRatingsModule.php",
    "content": "<?php\nclass UserControllerRatingsModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return 'Ratings';\n    }\n\n    public static function getUrlParts()\n    {\n        return ['ratings'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 2;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-ratings';\n        $viewContext->meta->title = $viewContext->user->name . ' - Ratings (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' ratings.';\n        WebMediaHelper::addHighcharts($viewContext);\n        WebMediaHelper::addFarbtastic($viewContext);\n        WebMediaHelper::addInfobox($viewContext);\n        WebMediaHelper::addEntries($viewContext);\n        WebMediaHelper::addCustom($viewContext);\n\n        $list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $list = UserMediaFilter::doFilter($list, UserMediaFilter::nonPlanned());\n        $viewContext->ratingDistribution = RatingDistribution::fromEntries($list);\n        $viewContext->ratingTimeDistribution = RatingTimeDistribution::fromEntries($list);\n        $listNoMovies = UserMediaFilter::doFilter($list, UserMediaFilter::nonMovie());\n        $viewContext->lengthDistribution = MediaLengthDistribution::fromEntries($listNoMovies);\n\n        $f = explode('-', $viewContext->user->join_date ?? '');\n\n        if (count($f) != 3) {\n            $viewContext->earliestTimeKnown = null;\n            $viewContext->meanTime = null;\n        } else {\n            list($year, $month, $day) = $f;\n            $earliest = mktime(0, 0, 0, $month, $day, $year);\n            $totalTime = 0;\n\n            foreach ($list as $mixedUserMedia) {\n                $totalTime += $mixedUserMedia->finished_duration;\n\n                foreach ([$mixedUserMedia->start_date, $mixedUserMedia->end_date] as $k) {\n                    $f = explode('-', $k);\n\n                    if (count($f) != 3) {\n                        continue;\n                    }\n\n                    $year = intval($f[0]);\n                    $month = intval($f[1]);\n                    $day = intval($f[2]);\n\n                    if (!$year or !$month or !$day) {\n                        continue;\n                    }\n\n                    $time = mktime(0, 0, 0, $month, $day, $year);\n\n                    if ($time < $earliest) {\n                        $earliest = $time;\n                    }\n                }\n            }\n\n            $viewContext->earliestTimeKnown = $earliest;\n            $viewContext->meanTime = $totalTime / max(1, (time() - $earliest) / (24. * 3600.0));\n        }\n    }\n}\n"
  },
  {
    "path": "src/ControllerModules/UserControllerRecommendationsModule.php",
    "content": "<?php\nclass RecommendationsEngine\n{\n    private $media;\n    private $list;\n    private $allFranchises;\n\n    public function __construct($media, $list)\n    {\n        $this->media = $media;\n\n        $keyedList = [];\n\n        foreach ($list as $entry) {\n            $key = $entry->media . $entry->mal_id;\n            $keyedList[$key] = $entry;\n        }\n\n        $this->allFranchises = Model_MixedUserMedia::getFranchises($keyedList, true);\n        $this->list = $keyedList;\n    }\n\n    private static function addRecsFromRecommendations($list)\n    {\n        Model_MixedUserMedia::attachRecommendations($list);\n\n        $count = 0;\n        $meanScore = 0;\n\n        foreach ($list as $entry) {\n            $meanScore += $entry->score;\n            $count += $entry->score > 0;\n        }\n\n        $meanScore /= max(1, $count);\n\n        $weightsMax = [];\n        $weightsSum = [];\n        $weightsCount = [];\n\n        foreach ($list as $entry) {\n            foreach ($entry->recommendations as $rec) {\n                $key = $entry->media . $rec['mal_id'];\n                $score = $entry->score ?: $entry->average_score;\n                $count = $rec['count'];\n\n                if (!isset($weightsMax[$key])) {\n                    $weightsSum[$key] = $score * $count;\n                    $weightsCount[$key] = $count;\n                    $weightsMax[$key] = $count;\n                } else {\n                    $weightsSum[$key] += $score * $count;\n                    $weightsCount[$key] += $count;\n\n                    if ($count > $weightsMax[$key]) {\n                        $weightsMax[$key] = $count;\n                    }\n                }\n            }\n        }\n\n        $weights = [];\n\n        foreach (array_keys($weightsSum) as $key) {\n            $maxWeight = $weightsMax[$key];\n            $sum = $weightsSum[$key];\n            $count = $weightsCount[$key];\n            #the more recommendations, the more close it will be to source scores (log scale)\n            $const = 1.2;\n            $weight = pow($const, - $count);\n            $weights[$key] = (1 - $weight) * ($sum / max(1, $count)) + $weight * $meanScore;\n        }\n\n        return $weights;\n    }\n\n    private static function addRecsFromStaticRecommendations($media)\n    {\n        $staticRecIds = TextHelper::loadSimpleList(Config::$staticRecommendationListPath);\n        $weights = [];\n\n        foreach ($staticRecIds as $id) {\n            $recMedia = substr($id, 0, 1);\n\n            if ($recMedia == $media) {\n                $weights[$id] = null;\n            }\n        }\n\n        return $weights;\n    }\n\n    private static function getRecsFromWeights($weights)\n    {\n        $entries = Model_MixedUserMedia::getFromIdList(array_keys($weights));\n        $finalEntries = [];\n\n        foreach ($entries as $entry) {\n            $key = $entry->media . $entry->mal_id;\n            $entry->hypothetical_score = $weights[$key] ?: $entry->average_score;\n            $finalEntries[$key] = $entry;\n        }\n\n        return $finalEntries;\n    }\n\n    private static function trimByValue($input, $goal)\n    {\n        arsort($input, SORT_NUMERIC);\n\n        return array_slice($input, 0, $goal);\n    }\n\n    private static function trimByScore($input, $goal)\n    {\n        uasort($input, function($a, $b)\n        {\n            return $a->hypothetical_score <= $b->hypothetical_score ? 1 : -1;\n        });\n\n        return array_slice($input, 0, $goal);\n    }\n\n    private static function filterKeys($input, $filteredKeys)\n    {\n        $output = [];\n\n        foreach ($input as $key => $value) {\n            if (!isset($filteredKeys[$key])) {\n                $output[$key] = $value;\n            }\n        }\n\n        return $output;\n    }\n\n    private static function filterBannedGenres($selectedEntries)\n    {\n        Model_MixedUserMedia::attachGenres($selectedEntries);\n        $finalEntries = [];\n\n        foreach ($selectedEntries as $key => $entry) {\n            $add = true;\n\n            foreach ($entry->genres as $genre) {\n                if (BanHelper::isGenreBannedForRecs($entry->media, $genre->mal_id)) {\n                    $add = false;\n\n                    break;\n                }\n            }\n\n            if ($add) {\n                $finalEntries[$key] = $entry;\n            }\n        }\n\n        return $finalEntries;\n    }\n\n    private static function filterFranchises($selectedEntries)\n    {\n        $skipAnimeTypes = [\n            AnimeMediaType::OVA,\n            AnimeMediaType::Special,\n            AnimeMediaType::Music,\n            AnimeMediaType::CM,\n            AnimeMediaType::PV,\n            AnimeMediaType::TV_Special,\n            AnimeMediaType::Unknown,\n        ];\n\n        $skipMangaTypes = [\n            MangaMediaType::Oneshot,\n            MangaMediaType::Doujinshi,\n            MangaMediaType::Unknown,\n        ];\n        \n        $franchises = Model_MixedUserMedia::getFranchises($selectedEntries, true);\n        $finalEntries = [];\n\n        foreach ($franchises as $franchise) {\n            DataSorter::sort($franchise->allEntries, DataSorter::MediaMalId);\n            DataSorter::sort($franchise->ownEntries, DataSorter::MediaMalId);\n\n            $entryToAdd = null;\n            $franchiseSize = 0;\n\n            foreach ($franchise->allEntries as $entry) {\n                if ($entry->publishing_status === MediaStatus::NotYetPublished) {\n                    continue;\n                }\n\n                if ($entry->media === Media::Anime) {\n                    $franchiseSize += $entry->episodes;\n                    \n                    if (in_array($entry->sub_type, $skipAnimeTypes))\n                    {\n                        continue;\n                    }\n                } elseif ($entry->media === Media::Manga) {\n                    $franchiseSize += $entry->chapters;\n\n                    if (in_array($entry->sub_type, $skipMangaTypes))\n                    {\n                        continue;\n                    }\n                }\n\n                if ($entryToAdd === null) {\n                    $entryToAdd = $entry;\n                }\n            }\n\n            if ($entryToAdd === null) {\n                continue;\n            }\n\n            $key = $entryToAdd->media . $entryToAdd->mal_id;\n            $entryToAdd->franchiseSize = $franchiseSize;\n\n            if (!isset($entryToAdd->hypothetical_score)) {\n                $entryToAdd->hypothetical_score = reset($franchise->ownEntries)->hypothetical_score;\n            }\n\n            $finalEntries[$key] = $entryToAdd;\n        }\n\n        return $finalEntries;\n    }\n\n    public function getNewRecommendations($goal)\n    {\n        $dontRecommend = [];\n\n        foreach ($this->allFranchises as $franchise) {\n            foreach ($franchise->allEntries as $entry) {\n                $key = $entry->media . $entry->mal_id;\n                $dontRecommend[$key] = true;\n            }\n        }\n\n        $selectedEntries = [];\n\n        $weights1 = self::addRecsFromRecommendations($this->list);\n        $weights1 = self::filterKeys($weights1, $dontRecommend);\n        $weights1 = self::trimByValue($weights1, $goal * 10);\n\n        $weights2 = self::addRecsFromStaticRecommendations($this->media);\n        $weights2 = self::filterKeys($weights2, $dontRecommend);\n\n        $allWeights = array_merge($weights2, $weights1);\n\n        $selectedEntries = self::getRecsFromWeights($allWeights);\n\n        $selectedEntries = self::trimByScore($selectedEntries, $goal * 10);\n        $selectedEntries = self::filterBannedGenres($selectedEntries);\n\n        $selectedEntries = self::trimByScore($selectedEntries, $goal * 3);\n        $selectedEntries = self::filterFranchises($selectedEntries);\n\n        $selectedEntries = self::trimByScore($selectedEntries, $goal);\n\n        //reattach stuff that might have been lost due to whatever reason\n        foreach ($selectedEntries as $entry) {\n            $entry->media_id = $entry->id;\n        }\n\n        Model_MixedUserMedia::attachGenres($selectedEntries);\n\n        return $selectedEntries;\n    }\n\n    public function getMissingTitles()\n    {\n        $titles = Model_MixedUserMedia::attachMissingRelations($this->list, $this->media);\n\n        $titles = array_filter($titles, function ($title)\n        {\n            return $title->status !== UserListStatus::Planned && $title->status !== UserListStatus::Dropped && !empty($title->relations);\n        });\n\n        DataSorter::sort($titles, DataSorter::Title);\n\n        return $titles;\n    }\n\n    public function getMissingTitlesCount($titles)\n    {\n        $map = [];\n\n        foreach ($titles as $title)\n        {\n            foreach ($title->relations as $relation)\n            {\n                $map[$relation->id] = true;\n            }\n        }\n\n        return count($map);\n    }\n}\n\nclass UserControllerRecommendationsModule extends AbstractUserControllerModule\n{\n    public static function getText(ViewContext $viewContext, $media)\n    {\n        return 'Recommended';\n    }\n\n    public static function getUrlParts()\n    {\n        return ['recommendations'];\n    }\n\n    public static function getMediaAvailability()\n    {\n        return [Media::Anime, Media::Manga];\n    }\n\n    public static function getOrder()\n    {\n        return 5;\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        $viewContext->viewName = 'user-recommendations';\n        $viewContext->meta->title = $viewContext->user->name . ' - Recommendations (' . Media::toString($viewContext->media) . ') - ' . Config::$title;\n        $viewContext->meta->description = $viewContext->user->name . '\\'s ' . Media::toString($viewContext->media) . ' recommendations.';\n        WebMediaHelper::addCustom($viewContext);\n\n        $list = $viewContext->user->getMixedUserMedia($viewContext->media);\n        $recsEngine = new RecommendationsEngine($viewContext->media, $list);\n\n        $goal = 20;\n        $viewContext->newRecommendations = $recsEngine->getNewRecommendations($goal);\n        $viewContext->missingTitles = $recsEngine->getMissingTitles();\n        $viewContext->missingTitlesCount = $recsEngine->getMissingTitlesCount($viewContext->missingTitles);\n        $viewContext->private = $viewContext->user->isUserMediaPrivate($viewContext->media);\n    }\n}\n"
  },
  {
    "path": "src/Controllers/AbstractController.php",
    "content": "<?php\nabstract class AbstractController\n{\n\tpublic static function parseRequest($url, &$controllerContext)\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\tpublic static function preWork(&$controllerContext, &$viewContext)\n\t{\n\t\t$module = $controllerContext->module;\n\t\t$module::preWork($controllerContext, $viewContext);\n\t}\n\n\tpublic static function postWork(&$controllerContext, &$viewContext)\n\t{\n\t\t$module = $controllerContext->module;\n\t\t$module::postWork($controllerContext, $viewContext);\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\tthrow new UnimplementedException();\n\t}\n\n\tprotected static function getAvailableModulesRegex()\n\t{\n\t\t$urlParts = [];\n\t\tforeach (static::getAvailableModules() as $className)\n\t\t{\n\t\t\t$urlParts = array_merge($urlParts, $className::getUrlParts());\n\t\t}\n\t\t$modulesRegex = implode('|', array_map(function($urlPart)\n\t\t{\n\t\t\tif (empty($urlPart))\n\t\t\t{\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\treturn '/' . $urlPart;\n\t\t}, $urlParts));\n\t\treturn $modulesRegex;\n\t}\n\n\tprotected static function getModuleByUrlPart($urlPart)\n\t{\n\t\tforeach (self::getAvailableModules() as $module)\n\t\t{\n\t\t\tif (in_array($urlPart, $module::getUrlParts()))\n\t\t\t{\n\t\t\t\treturn $module;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t* Create a mapping of controller modules to their respectable controllers\n\t*/\n\tprivate static $modules = [];\n\tpublic static function init()\n\t{\n\t\t$dir = implode(DIRECTORY_SEPARATOR, ['src', 'ControllerModules']);\n\t\t$classNames = ReflectionHelper::loadClasses($dir);\n\t\tforeach ($classNames as $className)\n\t\t{\n\t\t\t$pos = strpos($className, 'Controller');\n\t\t\t$controllerClassName = substr($className, 0, $pos + 10);\n\t\t\tif (!isset(self::$modules[$controllerClassName]))\n\t\t\t{\n\t\t\t\tself::$modules[$controllerClassName] = [];\n\t\t\t}\n\t\t\tself::$modules[$controllerClassName] []= $className;\n\t\t}\n\t\tforeach (self::$modules as $controllerClassName => &$classNames)\n\t\t{\n\t\t\tuasort($classNames, function($a, $b)\n\t\t\t{\n\t\t\t\treturn $a::getOrder() - $b::getOrder();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t* Returns list of available modules within derived class\n\t*/\n\tpublic static function getAvailableModules()\n\t{\n\t\t$self = get_called_class();\n\t\tif (empty(self::$modules[$self]))\n\t\t{\n\t\t\treturn [];\n\t\t}\n\t\treturn self::$modules[$self];\n\t}\n}\n\nAbstractController::init();\n"
  },
  {
    "path": "src/Controllers/AdminController.php",
    "content": "<?php\nclass AdminController extends AbstractController\n{\n\tpublic static function parseRequest($url, &$controllerContext)\n\t{\n\t\t$modulesRegex = self::getAvailableModulesRegex();\n\t\t$regex = '^/?(' . $modulesRegex . ')/?$';\n\t\tif (!preg_match('#' . $regex . '#', $url, $matches))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t$rawModule = trim($matches[1], '/');\n\t\t$controllerContext->rawModule = $rawModule;\n\t\t$controllerContext->module = self::getModuleByUrlPart($rawModule);\n\t\t$controllerContext->cache->bypass(true);\n\t\tassert(!empty($controllerContext->module));\n\t\treturn true;\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\tsession_start();\n\t\tif (!isset($_SESSION['logged-in']))\n\t\t{\n\t\t\t$controllerContext->module = 'AdminControllerLoginModule';\n\t\t}\n\n\t\tHttpHeadersHelper::setCurrentHeader('Content-Type', 'text/html');\n        $viewContext->meta->noIndex = true;\n\t\tassert(!empty($controllerContext->module));\n\t\t$module = $controllerContext->module;\n\t\t$module::work($controllerContext, $viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/Controllers/ControllerContext.php",
    "content": "<?php\nclass ControllerContext\n{\n\tpublic function __construct()\n\t{\n\t\t$this->cache = new Cache();\n\t}\n}\n"
  },
  {
    "path": "src/Controllers/IndexController.php",
    "content": "<?php\nclass IndexController extends AbstractController\n{\n\tpublic static function parseRequest($url, &$controllerContext)\n\t{\n\t\t$modulesRegex = self::getAvailableModulesRegex();\n\t\t$regex = '^/?(' . $modulesRegex . ')/?$';\n\t\tif (!preg_match('#' . $regex . '#', $url, $matches))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t$rawModule = trim($matches[1], '/');\n\t\t$controllerContext->rawModule = $rawModule;\n\t\t$controllerContext->module = self::getModuleByUrlPart($rawModule);\n\t\tassert(!empty($controllerContext->module));\n\t\treturn true;\n\t}\n\n\tpublic static function preWork(&$controllerContext, &$viewContext)\n\t{\n\t\t$controllerContext->cache->bypass(true);\n\t}\n\n\tpublic static function work(&$controllerContext, &$viewContext)\n\t{\n\t\tHttpHeadersHelper::setCurrentHeader('Content-Type', 'text/html');\n\t\tassert(!empty($controllerContext->module));\n\t\t$module = $controllerContext->module;\n\t\t$module::work($controllerContext, $viewContext);\n\t}\n}\n"
  },
  {
    "path": "src/Controllers/UserController.php",
    "content": "<?php\nclass UserController extends AbstractController\n{\n    public static function getUserRegex()\n    {\n        return '[0-9a-zA-Z_-]{2,}';\n    }\n\n    public static function parseRequest($url, &$controllerContext)\n    {\n        $userRegex = self::getUserRegex();\n        $modulesRegex = self::getAvailableModulesRegex();\n        $mediaParts = array_map(['Media', 'toString'], Media::getConstList());\n        $mediaRegex = implode('|', $mediaParts);\n\n        $regex =\n            '^/?' .\n            '(' . $userRegex . ')' .\n            '(' . $modulesRegex . ')' .\n            '(,(' . $mediaRegex . '))?' .\n            '/?($|\\?)';\n\n        if (!preg_match('#' . $regex . '#', $url, $matches))\n        {\n            return false;\n        }\n\n        $controllerContext->userName = $matches[1];\n        $media = !empty($matches[4]) ? $matches[4] : 'anime';\n        switch ($media)\n        {\n            case 'anime': $controllerContext->media = Media::Anime; break;\n            case 'manga': $controllerContext->media = Media::Manga; break;\n            default: throw new BadMediaException();\n        }\n        $rawModule = ltrim($matches[2], '/') ?: 'profile';\n        $controllerContext->rawModule = $rawModule;\n        $controllerContext->module = self::getModuleByUrlPart($rawModule);\n        assert(!empty($controllerContext->module));\n        return true;\n    }\n\n    public static function preWork(&$controllerContext, &$viewContext)\n    {\n        $viewContext->meta->noIndex = true;\n        \n        $controllerContext->cache->setPrefix($controllerContext->userName);\n        if (BanHelper::getUserBanState($controllerContext->userName) == BanHelper::USER_BAN_TOTAL)\n        {\n            $controllerContext->cache->bypass(true);\n            $viewContext->userName = $controllerContext->userName;\n            $viewContext->viewName = 'error-user-blocked';\n            $viewContext->meta->title = 'User blocked - ' . Config::$title;\n            return;\n        }\n\n        $module = $controllerContext->module;\n        HttpHeadersHelper::setCurrentHeader('Content-Type', $module::getContentType());\n        $viewContext->media = $controllerContext->media;\n        $viewContext->module = $controllerContext->module;\n        $viewContext->contentType = $module::getContentType();\n        if ($viewContext->contentType != 'text/html')\n        {\n            $viewContext->layoutName = 'layout-raw';\n        }\n\n        Database::selectUser($controllerContext->userName);\n        $user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$controllerContext->userName]);\n        if (empty($user)) {\n            if (!isset($_GET['referral'])) {\n                $controllerContext->cache->bypass(true);\n\n                $viewContext->userName = $controllerContext->userName;\n\n                $viewContext->viewName = 'error-user-not-found';\n\n                $viewContext->meta->title = 'User not found &#8212; ' . Config::$title;\n\n                return;\n            }\n\n            $queue = new Queue(Config::$userQueuePath);\n            $queueMedia = new Queue(Config::$userMediaQueuePath);\n            $queueItem = new QueueItem(strtolower($controllerContext->userName));\n            $queue->enqueue($queueItem);\n            $queueMedia->enqueue($queueItem);\n            $viewContext->queuePosition = $queue->seek($queueItem);\n\n            $controllerContext->cache->bypass(true);\n            //try to load cache, if it exists\n            $url = $controllerContext->url;\n            if ($controllerContext->cache->exists($url))\n            {\n                $controllerContext->cache->load($url);\n                flush();\n                $viewContext->layoutName  = null;\n                $viewContext->viewName = null;\n                return;\n            }\n            $viewContext->userName = $controllerContext->userName;\n            $viewContext->viewName = 'error-user-enqueued';\n            $viewContext->meta->title = 'User enqueued - ' . Config::$title;\n            return;\n        }\n\n        $viewContext->user = $user;\n        $viewContext->meta->styles []= '/media/css/menu.css';\n        $viewContext->updateWait = Config::$userQueueMinWait;\n\n        $module = $controllerContext->module;\n        $module::preWork($controllerContext, $viewContext);\n    }\n\n    public static function work(&$controllerContext, &$viewContext)\n    {\n        assert(!empty($controllerContext->module));\n        if (!empty($viewContext->user))\n        {\n            $module = $controllerContext->module;\n            $module::work($controllerContext, $viewContext);\n            $viewContext->userMenu = true;\n        }\n    }\n}\n"
  },
  {
    "path": "src/CronRunner.php",
    "content": "<?php\nclass CronRunner\n{\n\tprivate static $finished = false;\n\n\tpublic static function shutdown($logger)\n\t{\n\t\tif (!self::$finished)\n\t\t{\n\t\t\t$logger->log('Finished abnormally');\n\t\t\texit(1);\n\t\t}\n\t}\n\n\tpublic static function run($fileName, $callback)\n\t{\n\t\t$logger = new Logger($fileName);\n\n\t\ttry\n\t\t{\n\t\t\tSingleInstance::run($fileName);\n\t\t}\n\t\tcatch (InstanceAlreadyRunningException $e)\n\t\t{\n\t\t\t$logger->log('Already running');\n\t\t\tself::$finished = true;\n\t\t\texit(1);\n\t\t}\n\n\t\t$logger->log('Working');\n\n\t\tregister_shutdown_function([get_class(), 'shutdown'], $logger);\n\n\t\ttry\n\t\t{\n\t\t\t$callback($logger);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$logger->log($e);\n\t\t\t$logger->log('Finished with errors');\n\t\t\tself::$finished = true;\n\t\t\texit(1);\n\t\t}\n\n\t\t$logger->log('Finished');\n\t\tself::$finished = true;\n\t\texit(0);\n\t}\n}\n"
  },
  {
    "path": "src/Database.php",
    "content": "<?php\n\nclass Database extends Singleton\n{\n\tpublic static function doInit()\n\t{\n\t\tinclude implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'library', 'redbean', 'RedBean', 'redbean.inc.php']);\n\t\tReflectionHelper::loadClasses(__DIR__ . DIRECTORY_SEPARATOR . 'Models');\n\t\tself::loadDatabase('media.sqlite');\n\t}\n\n\tpublic static function userNameToDbName($userName)\n\t{\n\t\t$names = self::getAllDbNames();\n\t\tmt_srand(crc32(strtolower($userName)));\n\t\treturn $names[mt_rand(0, count($names) - 1)];\n\t}\n\n\tpublic static function getAllDbNames()\n\t{\n\t\t$ret = [];\n\t\tforeach (range(0, Config::$dbCount - 1) as $i)\n\t\t{\n\t\t\t$ret []= sprintf('user-%02x.sqlite', $i);\n\t\t}\n\t\treturn $ret;\n\t}\n\n\tpublic static function selectUser($userName)\n\t{\n\t\treturn self::attachDatabase(self::userNameToDbName($userName));\n\t}\n\n\tpublic static function loadDatabase($dbFile)\n\t{\n\t\t$path = strpos($dbFile, DIRECTORY_SEPARATOR) === false\n\t\t\t? Config::$dbPath . DIRECTORY_SEPARATOR . $dbFile\n\t\t\t: $dbFile;\n\t\t$dsn = 'sqlite:' . $path;\n\t\t$key = basename($path);\n\t\tR::addDatabase($key, $dsn, null, null, true);\n\t\tR::selectDatabase($key);\n\t\tR::exec('PRAGMA foreign_keys=ON');\n\t\tR::exec('PRAGMA temp_store=MEMORY');\n\t}\n\n\tprivate static $attached = false;\n\tpublic static function attachDatabase($dbFile)\n\t{\n\t\tif (self::$attached)\n\t\t{\n\t\t\tR::exec('DETACH DATABASE userdb');\n\t\t}\n\t\t$path = Config::$dbPath . DIRECTORY_SEPARATOR . $dbFile;\n\t\tR::exec('ATTACH DATABASE ? AS userdb', [$path]);\n\t\tself::$attached = true;\n\t}\n\n\tpublic static function insert($tableName, $allRows)\n\t{\n\t\tif (empty($allRows))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tif (!is_array(reset($allRows)))\n\t\t{\n\t\t\t$allRows = [$allRows];\n\t\t}\n\n\t\t$lastInsertId = null;\n\t\tforeach (array_chunk($allRows, Config::$maxDbBindings) as $rows)\n\t\t{\n\t\t\t$columns = array_keys(reset($rows));\n\t\t\t$single = '(' . join(', ', array_fill(0, count($columns), '?')) . ')';\n\t\t\t$query = sprintf('INSERT INTO %s(%s) VALUES %s',\n\t\t\t\t$tableName,\n\t\t\t\tjoin(', ', $columns),\n\t\t\t\tjoin(', ', array_fill(0, count($rows), $single))\n\t\t\t);\n\t\t\t$flattened = call_user_func_array('array_merge', array_map('array_values', $rows));\n\n\t\t\t$lastInsertId = R::exec($query, $flattened);\n\t\t}\n\t\treturn $lastInsertId;\n\t}\n\n\tpublic static function delete($tableName, $conditions)\n\t{\n\t\t$single = [];\n\t\tforeach ($conditions as $key => $value)\n\t\t{\n\t\t\t$single []= $key . ' = ?';\n\t\t}\n\t\t$query = sprintf('DELETE FROM %s WHERE %s',\n\t\t\t$tableName,\n\t\t\tjoin(' AND ', $single));\n\n\t\tR::exec($query, array_values($conditions));\n\t}\n}\n\nDatabase::init();\n"
  },
  {
    "path": "src/Document.php",
    "content": "<?php\nclass Document\n{\n\tpublic $headers;\n\tpublic $content;\n\tpublic $url;\n\tpublic $code;\n\n\tpublic function __construct($url, $code, $headers, $content)\n\t{\n\t\t$this->url = $url;\n\t\t$this->code = $code;\n\t\t$this->headers = $headers;\n\t\t$this->content = $content;\n\t}\n}\n"
  },
  {
    "path": "src/Downloader.php",
    "content": "<?php\nclass Downloader\n{\n\tprotected static $logger;\n\n\tpublic static function setLogger(Logger $logger)\n\t{\n\t\tself::$logger = $logger;\n\t}\n\n\tprivate static function prepareHandle($url)\n\t{\n        sleep(2);\n\n        $handle = curl_init();\n\t\tcurl_setopt($handle, CURLOPT_URL, $url);\n\t\tcurl_setopt($handle, CURLOPT_HEADER, 1);\n\t\tcurl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);\n\t\tcurl_setopt($handle, CURLOPT_ENCODING, '');\n\t\tcurl_setopt($handle, CURLOPT_COOKIEJAR, Config::$downloaderCookieFilePath);\n\t\tcurl_setopt($handle, CURLOPT_COOKIEFILE, Config::$downloaderCookieFilePath);\n\t\tcurl_setopt($handle, CURLOPT_USERAGENT, Config::$downloaderUserAgent);\n\t\tcurl_setopt($handle, CURLOPT_TIMEOUT_MS, Config::$downloaderMaxTimeout);\n\t\tif (Config::$downloaderProxy != '')\n\t\t\tcurl_setopt($handle, CURLOPT_PROXY, Config::$downloaderProxy);\n\t\treturn $handle;\n\t}\n\n\tprivate static function parseResult($result, $url)\n\t{\n\t\t$pos = strpos($result, \"\\r\\n\\r\\n\");\n\t\t$content = substr($result, $pos + 4);\n\t\t$headerLines = explode(\"\\r\\n\", substr($result, 0, $pos));\n\n\t\tpreg_match('/\\d{3}/', array_shift($headerLines), $matches);\n\t\tif (!isset($matches[0]))\n\t\t\tthrow new DownloadFailureException($url, 'Server didn\\'t return response code');\n\t\t$code = intval($matches[0]);\n\t\t$headers = HttpHeadersHelper::parseHeaderLines($headerLines);\n\t\treturn new Document($url, $code, $headers, $content);\n\t}\n\n\tprivate static function urlToPath($url)\n\t{\n\t\treturn Config::$mirrorPath . DIRECTORY_SEPARATOR . rawurlencode($url) . '.dat';\n\t}\n\n\tpublic static function purgeCache(array $urls)\n\t{\n\t\tforeach ($urls as $url)\n\t\t{\n\t\t\t$path = self::urlToPath($url);\n\t\t\tif (file_exists($path))\n\t\t\t{\n\t\t\t\tunlink($path);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static function download($url)\n\t{\n\t\t$downloaded = self::downloadMulti([$url]);\n\t\treturn array_shift($downloaded);\n\t}\n\n\tpublic static function downloadMulti(array $urls)\n\t{\n\t\t$handles = [];\n\t\t$documents = [];\n\t\t$allUrls = array_combine($urls, $urls);\n\n\t\t//if mirror exists, load its content and purge url from download queue\n\t\tif (Config::$mirrorEnabled)\n\t\t{\n\t\t\tforeach ($allUrls + [] as $url)\n\t\t\t{\n\t\t\t\t$path = self::urlToPath($url);\n\t\t\t\tif (file_exists($path))\n\t\t\t\t{\n\t\t\t\t\tif (self::$logger)\n\t\t\t\t\t\tself::$logger->log('Loading from mirror ' . $url);\n\t\t\t\t\t$rawResult = file_get_contents($path);\n\t\t\t\t\t$documents[$url] = self::parseResult($rawResult, $url);\n\t\t\t\t\tunset($allUrls[$url]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach (array_chunk($allUrls, Config::$downloaderMaxParallelJobs) as $urls)\n\t\t{\n            if (self::$logger)\n\t\t\t{\n\t\t\t\tforeach ($urls as $url)\n\t\t\t\t\tself::$logger->log('Downloading ' . $url);\n\t\t\t}\n\n\t\t\tif (Config::$downloaderUseMultiHandles)\n\t\t\t{\n\t\t\t\t//prepare curl handles\n\t\t\t\t$multiHandle = curl_multi_init();\n\t\t\t\tforeach ($urls as $url)\n\t\t\t\t{\n\t\t\t\t\t$handle = self::prepareHandle($url);\n\t\t\t\t\tcurl_multi_add_handle($multiHandle, $handle);\n\t\t\t\t\t$handles[$url] = $handle;\n\t\t\t\t}\n\n\t\t\t\t//run the query\n\t\t\t\t$running = null;\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\t$status = curl_multi_exec($multiHandle, $running);\n\t\t\t\t}\n\t\t\t\twhile ($status == CURLM_CALL_MULTI_PERFORM);\n\t\t\t\twhile ($running and $status == CURLM_OK)\n\t\t\t\t{\n\t\t\t\t\tif (curl_multi_select($multiHandle) != -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdo\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$status = curl_multi_exec($multiHandle, $running);\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile ($status == CURLM_CALL_MULTI_PERFORM);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//get the documents from curl\n\t\t\t\tforeach ($handles as $url => $handle)\n\t\t\t\t{\n\t\t\t\t\t$rawResult = curl_multi_getcontent($handle);\n\t\t\t\t\tif (Config::$mirrorEnabled)\n\t\t\t\t\t{\n\t\t\t\t\t\tfile_put_contents(self::urlToPath($url), $rawResult);\n\t\t\t\t\t}\n\t\t\t\t\t$documents[$url] = self::parseResult($rawResult, $url);\n\t\t\t\t\tcurl_multi_remove_handle($multiHandle, $handle);\n\t\t\t\t}\n\n\t\t\t\t//close curl handles\n\t\t\t\tcurl_multi_close($multiHandle);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach ($urls as $url)\n\t\t\t\t{\n\t\t\t\t\t$handle = self::prepareHandle($url);\n\t\t\t\t\t$rawResult = curl_exec($handle);\n\t\t\t\t\tcurl_close($handle);\n\n\t\t\t\t\tif (Config::$mirrorEnabled)\n\t\t\t\t\t{\n\t\t\t\t\t\tfile_put_contents(self::urlToPath($url), $rawResult);\n\t\t\t\t\t}\n\t\t\t\t\t$documents[$url] = self::parseResult($rawResult, $url);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $documents;\n\t}\n}\n"
  },
  {
    "path": "src/Enums/AnimeMediaSource.php",
    "content": "<?php\nclass AnimeMediaSource extends Enum\n{\n\tconst UNKNOWN = 0;\n    const ORIGINAL = 1;\n\tconst MANGA = 2;\n    const FOUR_KOMA_MANGA = 3;\n    const WEB_MANGA = 4;\n    const NOVEL = 6;\n    const LIGHT_NOVEL = 7;\n    const VISUAL_NOVEL = 8;\n    const GAME = 9;\n    const CARD_GAME = 10;\n    const BOOK = 11;\n    const PICTURE_BOOK = 12;\n    const RADIO = 13;\n    const MUSIC = 14;\n    const WEB_NOVEL = 15;\n    const MIXED_MEDIA = 16;\n\n    public static function toString($source)\n\t{\n\t\tswitch ($source)\n\t\t{\n\t\t\tcase self::ORIGINAL:\n\t\t\t\treturn 'original';\n\t\t\tcase self::MANGA:\n                return 'manga';\n            case self::FOUR_KOMA_MANGA:\n                return '4-koma manga';\n\t\t\tcase self::WEB_MANGA:\n\t\t\t\treturn 'web manga';\n\t\t\tcase self::NOVEL:\n\t\t\t\treturn 'novel';\n\t\t\tcase self::LIGHT_NOVEL:\n\t\t\t\treturn 'light novel';\n\t\t\tcase self::VISUAL_NOVEL:\n\t\t\t\treturn 'visual novel';\n            case self::GAME:\n                return 'game';\n            case self::CARD_GAME:\n                return 'card game';\n            case self::BOOK:\n                return 'book';\n            case self::PICTURE_BOOK:\n                return 'picture book';\n            case self::RADIO:\n                return 'radio';\n            case self::MUSIC:\n                return 'music';\n            case self::WEB_NOVEL:\n                return 'web novel';\n            case self::MIXED_MEDIA:\n                return 'mixed media';\n            default:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/AnimeMediaType.php",
    "content": "<?php\nclass AnimeMediaType extends MediaType\n{\n\tconst Unknown = 0;\n\tconst TV = 1;\n\tconst OVA = 2;\n\tconst Movie = 3;\n\tconst Special = 4;\n\tconst ONA = 5;\n\tconst Music = 6;\n    const CM = 7;\n    const PV = 8;\n    const TV_Special = 9;\n\n\tpublic static function toString($type, $media = null)\n\t{\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase self::TV:\n\t\t\t\treturn 'TV';\n\t\t\tcase self::OVA:\n\t\t\t\treturn 'OVA';\n\t\t\tcase self::Movie:\n\t\t\t\treturn 'movie';\n\t\t\tcase self::Special:\n\t\t\t\treturn 'special';\n\t\t\tcase self::ONA:\n\t\t\t\treturn 'ONA';\n\t\t\tcase self::Music:\n\t\t\t\treturn 'music';\n            case self::CM:\n                return 'CM';\n            case self::PV:\n                return 'PV';\n            case self::TV_Special:\n                return 'TV special';\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/Enum.php",
    "content": "<?php\nabstract class Enum\n{\n\tpublic static function getConstList()\n\t{\n\t\treturn (new ReflectionClass(get_called_class()))->getConstants();\n\t}\n}\n"
  },
  {
    "path": "src/Enums/MangaMediaType.php",
    "content": "<?php\nclass MangaMediaType extends MediaType\n{\n\tconst Unknown = 0;\n\tconst Manga = 1;\n\tconst Novel = 2;\n\tconst Oneshot = 3;\n\tconst Doujinshi = 4;\n\tconst Manhwa = 5;\n    const Manhua = 6;\n    const LightNovel = 7;\n\n\tpublic static function toString($type, $media = null)\n\t{\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase self::Manga:\n\t\t\t\treturn 'manga';\n\t\t\tcase self::Novel:\n                return 'novel';\n            case self::LightNovel:\n                return 'light novel';\n\t\t\tcase self::Oneshot:\n\t\t\t\treturn 'one-shot';\n\t\t\tcase self::Doujinshi:\n\t\t\t\treturn 'doujinshi';\n\t\t\tcase self::Manhwa:\n\t\t\t\treturn 'manhwa';\n\t\t\tcase self::Manhua:\n\t\t\t\treturn 'manhua';\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/Media.php",
    "content": "<?php\nclass Media extends Enum\n{\n\tconst Anime = 'A';\n\tconst Manga = 'M';\n\n\tpublic static function toString($media)\n\t{\n\t\tswitch ($media)\n\t\t{\n\t\t\tcase self::Anime:\n\t\t\t\treturn 'anime';\n\t\t\tcase self::Manga:\n\t\t\t\treturn 'manga';\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/MediaRelation.php",
    "content": "<?php\nclass MediaRelation extends Enum\n{\n\tconst Sequel = 1;\n\tconst Prequel = 2;\n\tconst SideStory = 3;\n\tconst ParentStory = 4;\n\tconst Adaptation = 5;\n\tconst AlternativeVersion = 6;\n\tconst Summary = 7;\n\tconst Character = 8;\n\tconst SpinOff = 9;\n\tconst AlternativeSetting = 10;\n\tconst Other = 11;\n\tconst FullStory = 12;\n\n\tpublic static function toString($type, $media = null)\n\t{\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase self::Sequel:\n\t\t\t\treturn 'sequel';\n\t\t\tcase self::Prequel:\n\t\t\t\treturn 'prequel';\n\t\t\tcase self::SideStory:\n\t\t\t\treturn 'side story';\n\t\t\tcase self::ParentStory:\n\t\t\t\treturn 'parent story';\n\t\t\tcase self::Adaptation:\n\t\t\t\treturn 'adaptation';\n\t\t\tcase self::AlternativeVersion:\n\t\t\t\treturn 'alt. version';\n            case self::Summary:\n                return 'summary';\n            case self::Character:\n                return 'character';\n            case self::SpinOff:\n                return 'spin-off';\n\t\t\tcase self::AlternativeSetting:\n\t\t\t\treturn 'alt. setting';\n\t\t\tcase self::Other:\n\t\t\t\treturn 'other';\n\t\t\tcase self::FullStory:\n\t\t\t\treturn 'full story';\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/MediaStatus.php",
    "content": "<?php\nclass MediaStatus extends Enum\n{\n\tconst NotYetPublished = 'N';\n    const Publishing = 'P';\n    const Hiatus = 'H';\n    const Discontinued = 'D';\n\tconst Finished = 'F';\n\n\tpublic static function toString($mediaStatus, $media = null)\n\t{\n\t\tswitch ($mediaStatus)\n\t\t{\n\t\t\tcase self::NotYetPublished:\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime: return 'not yet aired';\n\t\t\t\t\tdefault: return 'not yet published';\n\t\t\t\t}\n\t\t\tcase self::Publishing:\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime: return 'airing';\n\t\t\t\t\tdefault: return 'publishing';\n                }\n            case self::Hiatus:\n                return 'on hiatus';\n            case self::Discontinued:\n                return 'discontinued';\n\t\t\tcase self::Finished:\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime: return 'finished airing';\n\t\t\t\t\tdefault: return 'published';\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/MediaType.php",
    "content": "<?php\nclass MediaType extends Enum\n{\n\tpublic static function toString($type, $media)\n\t{\n\t\tswitch ($media)\n\t\t{\n\t\t\tcase Media::Anime:\n\t\t\t\treturn AnimeMediaType::toString($type);\n\t\t\tcase Media::Manga:\n\t\t\t\treturn MangaMediaType::toString($type);\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Enums/UserListStatus.php",
    "content": "<?php\nclass UserListStatus extends Enum\n{\n\tconst Dropped = 'D';\n\tconst OnHold = 'H';\n\tconst Completing = 'C';\n\tconst Finished = 'F';\n\tconst Planned = 'P';\n\tconst Unknown = '?';\n\n\tpublic static function toString($status, $media = null)\n\t{\n\t\tswitch ($status)\n\t\t{\n\t\t\tcase self::Dropped:\n\t\t\t\treturn 'dropped';\n\t\t\tcase self::OnHold:\n\t\t\t\treturn 'on-hold';\n\t\t\tcase self::Completing:\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime: return 'watching';\n\t\t\t\t\tcase Media::Manga: return 'reading';\n\t\t\t\t}\n\t\t\t\treturn 'completing';\n\t\t\tcase self::Finished:\n\t\t\t\treturn 'finished';\n\t\t\tcase self::Planned:\n\t\t\t\treturn 'planned';\n\t\t\tdefault:\n\t\t\t\treturn 'unknown';\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/ErrorHandler.php",
    "content": "<?php\nclass ErrorHandler extends Singleton\n{\n\tpublic static function suppress()\n\t{\n\t\tset_error_handler(function($errno, $errstr, $errfile, $errline) {});\n\t}\n\n\tpublic static function restore()\n\t{\n\t\trestore_error_handler();\n\t}\n\n\tpublic static function doInit()\n\t{\n\t\terror_reporting(E_ALL);\n\t\tset_error_handler([__CLASS__, 'handler']);\n\t}\n\n\tpublic static function handler(\n\t\t$errorId,\n\t\t$errorString,\n\t\t$errorFile,\n\t\t$errorLine)\n\t{\n\t\tthrow new ErrorException(\n\t\t\t$errorString,\n\t\t\t$errorId,\n\t\t\t0,\n\t\t\t$errorFile,\n\t\t\t$errorLine);\n\t}\n}\n\nErrorHandler::init();\n"
  },
  {
    "path": "src/Exceptions/BadMediaException.php",
    "content": "<?php\nclass BadMediaException extends Exception\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct('Unknown media type!');\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/BadProcessorDocumentException.php",
    "content": "<?php\nclass BadProcessorDocumentException extends DocumentException\n{\n\tpublic function __construct(Document $document, $message)\n\t{\n\t\tparent::__construct($document, 'Bad document (' . $message . ') in ' . $document->url);\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/BadProcessorKeyException.php",
    "content": "<?php\nclass BadProcessorKeyException extends Exception\n{\n\tpublic function __construct($key)\n\t{\n\t\tparent::__construct('Can\\'t process ' . $key . ' - not found on MAL');\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/DocumentException.php",
    "content": "<?php\nclass DocumentException extends Exception\n{\n\tpublic function __construct(Document $document, $message)\n\t{\n\t\t$this->document = $document;\n\t\tparent::__construct($message);\n\t}\n\n\tpublic function getDocument()\n\t{\n\t\treturn $this->document;\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/DownloadFailureException.php",
    "content": "<?php\nclass DownloadFailureException extends Exception\n{\n\tpublic function __construct($url, $reason = null)\n\t{\n\t\t$msg = $reason\n\t\t\t? sprintf('Download failure: %s (%s)', $url, $reason)\n\t\t\t: sprintf('Download failure: %s', $url);\n\t\tparent::__construct($msg);\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/InstanceAlreadyRunningException.php",
    "content": "<?php\nclass InstanceAlreadyRunningException extends Exception\n{\n\tpublic function __construct($scriptName)\n\t{\n\t\tparent::__construct('An instance of this script (' . $scriptName . ') is already running!');\n\t}\n}\n"
  },
  {
    "path": "src/Exceptions/UnimplementedException.php",
    "content": "<?php\nclass UnimplementedException extends Exception\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct('Method not implemented.');\n\t}\n}\n"
  },
  {
    "path": "src/Helpers/BanHelper.php",
    "content": "<?php\nclass BanHelper extends Singleton\n{\n\tconst USER_BAN_NONE = 0;\n\tconst USER_BAN_QUEUE_ONLY = 1;\n\tconst USER_BAN_TOTAL = 2;\n\n\tprivate static $bannedUsers;\n\tprivate static $bannedGenres;\n\tprivate static $bannedCreators;\n\tprivate static $bannedGenresForRecs;\n\tprivate static $bannedFranchiseCoupling;\n\n\tpublic static function doInit()\n\t{\n\t\t$list = TextHelper::loadSimpleList(Config::$bannedUsersListPath);\n\t\tforeach ($list as $line)\n\t\t{\n\t\t\t$tmp = strpos($line, \"\\t\") === false\n\t\t\t\t? [$line, self::USER_BAN_TOTAL]\n\t\t\t\t: explode(\"\\t\", $line);\n\t\t\tlist ($userName, $banType) = $tmp;\n\t\t\tself::$bannedUsers[strtolower($userName)] = $banType;\n\t\t}\n\n\t\tself::$bannedGenres = TextHelper::loadSimpleList(Config::$bannedGenresListPath);\n\t\tself::$bannedCreators = TextHelper::loadSimpleList(Config::$bannedCreatorsListPath);\n\t\tself::$bannedGenresForRecs = TextHelper::loadSimpleList(Config::$bannedGenresForRecsListPath);\n\t\tself::$bannedFranchiseCoupling = TextHelper::loadJson(Config::$bannedFranchiseCouplingListPath, true);\n\t}\n    \n\tpublic static function getUserBanState($userName)\n\t{\n\t\treturn isset(self::$bannedUsers[strtolower($userName)])\n\t\t\t? self::$bannedUsers[strtolower($userName)]\n\t\t\t: self::USER_BAN_NONE;\n\t}\n\n\tpublic static function setUserBanState($userName, $banState)\n\t{\n\t\tif ($banState != self::USER_BAN_NONE)\n\t\t{\n\t\t\tself::$bannedUsers[strtolower($userName)] = $banState;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tunset(self::$bannedUsers[strtolower($userName)]);\n\t\t}\n\n\t\t$list = [];\n\t\tforeach (self::$bannedUsers as $user => $banState)\n\t\t{\n\t\t\t$list []= $user . \"\\t\" . $banState;\n\t\t}\n\t\tTextHelper::putSimpleList(Config::$bannedUsersListPath, $list);\n\t}\n\n\tpublic static function isGenreBanned($media, $genreId)\n\t{\n\t\treturn in_array($media . $genreId, self::$bannedGenres);\n\t}\n\n\tpublic static function isCreatorBanned($media, $creatorId)\n\t{\n\t\treturn in_array($media . $creatorId, self::$bannedCreators);\n\t}\n\n\tpublic static function isGenreBannedForRecs($media, $genreId)\n\t{\n\t\treturn in_array($media . $genreId, self::$bannedGenresForRecs);\n\t}\n    \n\tpublic static function isFranchiseCouplingBanned($media1, $idMal1, $media2, $idMal2)\n\t{\n        $key1 = $media1 . $idMal1;\n        \n\t\t$key2 = $media2 . $idMal2;\n        \n        if (isset(self::$bannedFranchiseCoupling[$key2]) && in_array($key1, self::$bannedFranchiseCoupling[$key2])) {\n            return true;\n        }\n        \n\t\treturn false;\n\t}\n}\n\nBanHelper::init();\n"
  },
  {
    "path": "src/Helpers/BenchmarkHelper.php",
    "content": "<?php\nclass BenchmarkHelper extends Singleton\n{\n\tprivate static $start;\n\tprivate static $prev;\n\n\tpublic static function benchmark($message = 'ping')\n\t{\n\t\t$now = microtime(true);\n\t\t$delta = $now - self::$prev;\n\t\t$deltaBig = $now - self::$start;\n\t\tself::$prev = $now;\n\n\t\tHttpHeadersHelper::setCurrentHeader('Content-Type', 'text/plain');\n\t\tprintf('%.05f/%.05f: %s' . PHP_EOL, $delta, $deltaBig, $message);\n\t}\n\n\tpublic static function doInit()\n\t{\n\t\tself::$prev = self::$start = microtime(true);\n\t}\n}\n\nBenchmarkHelper::init();\n"
  },
  {
    "path": "src/Helpers/HttpHeadersHelper.php",
    "content": "<?php\nclass HttpHeadersHelper\n{\n\tpublic static function getCurrentHeaders()\n\t{\n\t\t$headerLines = headers_list();\n\t\treturn self::parseHeaderLines($headerLines);\n\t}\n\n\tpublic static function parseHeaderLines($headerLines)\n\t{\n\t\t$headers = [];\n\t\tforeach ($headerLines as $line)\n\t\t{\n\t\t\tlist($key, $value) = explode(': ', $line);\n\t\t\tif (!isset($headers[$key]))\n\t\t\t{\n\t\t\t\t$headers[$key] = $value;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$headers[$key] = array_merge(\n\t\t\t\t\tarray($headers[$key]),\n\t\t\t\t\tarray($value));\n\t\t\t}\n\t\t}\n\t\treturn $headers;\n\t}\n\n\tpublic static function headersSent()\n\t{\n\t\treturn headers_sent();\n\t}\n\n\tpublic static function getCurrentHeader($givenKey)\n\t{\n\t\tforeach (self::getCurrentHeaders() as $key => $val)\n\t\t{\n\t\t\tif (trim(strtolower($givenKey)) == strtolower($key))\n\t\t\t{\n\t\t\t\treturn $val;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic static function setCurrentHeader($key, $value)\n\t{\n\t\tif (isset($_SERVER['HTTP_HOST']))\n\t\t{\n\t\t\theader(\"$key: $value\");\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Helpers/ReflectionHelper.php",
    "content": "<?php\nclass ReflectionHelper\n{\n\tpublic static function loadClasses($dir)\n\t{\n\t\t$oldClassNames = get_declared_classes();\n\t\tforeach (glob($dir . DIRECTORY_SEPARATOR . '*') as $fileName)\n\t\t{\n\t\t\tif (is_file($fileName))\n\t\t\t{\n\t\t\t\tinclude $fileName;\n\t\t\t}\n\t\t}\n\t\t$newClassNames = get_declared_classes();\n\n\t\t$classNames = array_diff($newClassNames, $oldClassNames);\n\t\t$classNames = array_filter($classNames, [__CLASS__, 'isConcrete']);\n\t\treturn $classNames;\n\t}\n\n\tpublic static function isAbstract($className)\n\t{\n\t\t$class = new ReflectionClass($className);\n\t\treturn $class->isAbstract();\n\t}\n\n\tpublic static function isConcrete($className)\n\t{\n\t\treturn !self::isAbstract($className);\n\t}\n\n\tpublic static function arrayToClass(array $array, $className = null)\n\t{\n\t\t$x = $className === null\n\t\t\t? new StdClass\n\t\t\t: new $className;\n\t\tforeach ($array as $key => $val)\n\t\t{\n\t\t\t$x->$key = $val;\n\t\t}\n\t\treturn $x;\n\t}\n\n\tpublic static function arraysToClasses(array $array, $className = null)\n\t{\n\t\t$x = [];\n\t\tforeach ($array as $key => $subArray)\n\t\t{\n\t\t\t$x[$key] = self::arrayToClass($subArray, $className);\n\t\t}\n\t\treturn $x;\n\t}\n}\n"
  },
  {
    "path": "src/Helpers/TextHelper.php",
    "content": "<?php\nclass TextHelper\n{\n\tconst TIME_MINUTES = 1;\n\tconst TIME_HOURS = 2;\n\n\tpublic static function loadJson($path, $fetchAsArray = false)\n\t{\n\t\t$content = file_get_contents($path);\n\n\t\t$content = preg_replace(['#//(.*)$#m', '#\\#(.*)$#m'], '', $content);\n\n\t\treturn json_decode($content, $fetchAsArray);\n\t}\n\n\tpublic static function loadSimpleList($path)\n\t{\n\t\t$contents = file_get_contents($path);\n\t\t$contents = preg_replace('/#(.*)$/m', '', $contents);\n\t\t$lines = explode(\"\\n\", $contents);\n\t\t$lines = array_map('trim', $lines);\n\t\t$lines = array_filter($lines);\n\t\treturn $lines;\n\t}\n\n\tpublic static function putSimpleList($path, $lines)\n\t{\n\t\t$lines = array_map('trim', $lines);\n\t\t$lines = array_filter($lines);\n\t\t$contents = implode(\"\\n\", $lines);\n\t\tfile_put_contents($path, $contents);\n\t}\n\n\tpublic static function putJson($path, $json)\n\t{\n\t\t$contents = json_encode($json);\n\t\tfile_put_contents($path, $contents);\n\t}\n\n\tpublic static function getTimeText($totalSeconds, $precision)\n\t{\n\t\t$totalMinutes = $totalSeconds / 60.;\n\n\t\t$hours = floor($totalMinutes / 60.);\n\t\t$minutes = $totalMinutes % 60;\n\n\t\t$wait = '';\n\t\tif ($hours > 0 or $precision == self::TIME_HOURS)\n\t\t{\n\t\t\t$wait .= $hours . ' hour';\n\t\t\tif ($hours != 1)\n\t\t\t\t$wait .= 's';\n\t\t\t$wait .= ' ';\n\t\t}\n\n\t\tif ($precision != selF::TIME_HOURS)\n\t\t{\n\t\t\t$wait .= $minutes . ' minute';\n\t\t\tif ($minutes != 1)\n\t\t\t\t$wait .= 's';\n\t\t}\n\n\t\treturn trim($wait);\n\t}\n\n\tpublic static function getVolumesText($plural, $short = false)\n\t{\n\t\treturn self::getMediaCustomUnitText('vol', 'volume', $plural, $short);\n\t}\n\n\tpublic static function getMediaUnitText($media, $plural = false, $short = false)\n\t{\n\t\tswitch ($media)\n\t\t{\n\t\t\tcase Media::Anime:\n\t\t\t\treturn self::getMediaCustomUnitText('ep', 'episode', $plural, $short);\n\t\t\tcase Media::Manga:\n\t\t\t\treturn self::getMediaCustomUnitText('chap', 'chapter', $plural, $short);\n\t\t}\n\t\tthrow new BadMediaException();\n\t}\n\n\tpublic static function getNumberedMediaUnitText($media, $number, $short = false)\n\t{\n\t\t$plural = false;\n\t\t$prefix = $number;\n\t\tif ($prefix == 0)\n\t\t{\n\t\t\t$prefix = '?';\n\t\t\t$plural = true;\n\t\t}\n\t\telseif ($prefix > 1)\n\t\t{\n\t\t\t$plural = true;\n\t\t}\n\t\t$suffix = self::getMediaUnitText($media, $plural, $short);\n\t\treturn $prefix . ' ' . $suffix;\n\t}\n\n\tpublic static function getMediaCustomUnitText($shortForm, $longForm, $plural, $short)\n\t{\n\t\t$text = $short ? $shortForm : $longForm;\n\t\tif ($plural)\n\t\t{\n\t\t\t$text .= 's';\n\t\t}\n\t\treturn $text;\n\t}\n\n\tpublic static function replaceTokens($input, array $tokens)\n\t{\n        $output = $input;\n\t\tforeach ($tokens as $key => $val)\n\t\t{\n\t\t\tif (is_object($val) || is_array($val) || is_null($val))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$output = str_replace('{' . $key . '}', $val, $output);\n\t\t}\n\t\t$output = preg_replace('/\\{[\\w_-]+\\}/', '[unknown]', $output);\n\t\treturn $output;\n\t}\n\n\tpublic static function roundPercentages($distribution, $precision = 0)\n\t{\n\t\t//largest remainder method\n\t\t$total = max(array_sum($distribution), 1);\n\t\t$percentages = array_map(function($x) use ($total)\n\t\t{\n\t\t\treturn $x * 100.0 / $total;\n\t\t}, $distribution);\n\n\t\tasort($percentages, SORT_NUMERIC);\n\t\t$percentagesRounded = array_map(function ($x) use ($precision)\n\t\t{\n\t\t\treturn round($x, $precision);\n\t\t}, $percentages);\n\n\t\tif (!$precision)\n        {\n            $keys = array_keys($percentages);\n            $sum = array_sum($percentagesRounded);\n            if ($sum == 0)\n            {\n                return $distribution;\n            }\n            while ($sum < 100)\n            {\n                assert(!empty($keys));\n                $key = array_shift($keys);\n                if ($distribution[$key] != 0)\n                {\n                    $percentagesRounded[$key] ++;\n                    $sum ++;\n                }\n            }\n        }\n\n\t\treturn $percentagesRounded;\n\t}\n\n\tpublic static function serializeMediaId($entry)\n\t{\n\t\tif (is_object($entry))\n\t\t{\n\t\t\treturn $entry->media . $entry->mal_id;\n\t\t}\n\t\telse if (is_array($entry) and isset($entry['media']) and isset($entry['mal_id']))\n\t\t{\n\t\t\treturn $entry['media'] . $entry['mal_id'];\n\t\t}\n\t\telse\n\t\t\tthrow new InvalidArgumentException();\n\t}\n\n\tpublic static function deserializeMediaId($id)\n\t{\n\t\t$media = substr($id, 0, 1);\n\t\t$malId = intval(substr($id, 1));\n\t\treturn [$media, $malId];\n\t}\n\n\tpublic static function roundDecimal($number, $places = 0)\n\t{\n\t\treturn self::roundDecimalWithFunction($number, $places, 'round');\n\t}\n\n\tpublic static function floorDecimal($number, $places = 0)\n\t{\n\t\treturn self::roundDecimalWithFunction($number, $places, 'floor');\n\t}\n\n\tpublic static function ceilDecimal($number, $places = 0)\n\t{\n\t\treturn self::roundDecimalWithFunction($number, $places, 'ceil');\n\t}\n\n\tprivate static function roundDecimalWithFunction($number, $places, $function)\n\t{\n\t\tif ($places >= 0)\n\t\t{\n\t\t\t$multiplier = pow(10, $places);\n\t\t\treturn sprintf('%.' . $places . 'f', $function($number * $multiplier) / $multiplier);\n\t\t}\n\t\telse\n\t\t\tthrow new InvalidArgumentException();\n\t}\n\n    public static function mailJavaScript($mail)\n    {\n        return $mail;\n    }\n}\n"
  },
  {
    "path": "src/Helpers/UrlHelper.php",
    "content": "<?php\nclass UrlHelper\n{\n\tpublic static function absoluteUrl($relativeUrl = null, $params = [])\n\t{\n\t\tif ($relativeUrl === null)\n\t\t{\n\t\t\t$relativeUrl = '/' . ltrim($_SERVER['REQUEST_URI'], '/');\n\t\t}\n\t\tif (strpos($relativeUrl, ':') !== false)\n\t\t{\n\t\t\t$absoluteUrl = $relativeUrl;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$absoluteUrl = !empty(Config::$baseUrl)\n\t\t\t\t? Config::$baseUrl\n\t\t\t\t: $_SERVER['HTTP_HOST'];\n\t\t\t$absoluteUrl = rtrim($absoluteUrl, '/') . '/';\n\t\t\t$absoluteUrl .= ltrim($relativeUrl, '/');\n\t\t}\n\t\tif (!empty($params))\n\t\t{\n\t\t\t$frag = strpos($absoluteUrl, '?') === false ? '?' : '&';\n\t\t\t$absoluteUrl .= $frag . http_build_query($params);\n\t\t}\n\t\t$absoluteUrl = preg_replace('/(?<!:)\\/\\//', '/', $absoluteUrl);\n\t\treturn $absoluteUrl;\n\t}\n\n\tpublic static function currentUrl()\n\t{\n\t\treturn self::absoluteUrl(null);\n\t}\n}\n"
  },
  {
    "path": "src/Helpers/WebMediaHelper.php",
    "content": "<?php\nclass WebMediaHelper\n{\n\tpublic static function addFarbtastic($viewContext)\n\t{\n\t\t$viewContext->meta->scripts []= '/media/js/jquery.farbtastic.js';\n\t}\n\n\tpublic static function addHighcharts($viewContext)\n\t{\n\t\t$viewContext->meta->scripts []= '/media/js/jquery.highcharts.js';\n\t\t$viewContext->meta->scripts []= '/media/js/highcharts-mg.js';\n\t}\n\n\tpublic static function addTablesorter($viewContext)\n\t{\n\t\t$viewContext->meta->scripts []= '/media/js/jquery.tablesorter.js';\n\t}\n\n\tpublic static function addMiniSections($viewContext)\n\t{\n\t\t$viewContext->meta->styles []= '/media/css/mini-sections.css';\n\t}\n\n\tpublic static function addInfobox($viewContext)\n\t{\n\t\t$viewContext->meta->styles []= '/media/css/infobox.css';\n\t}\n\n\tpublic static function addEntries($viewContext)\n\t{\n\t\t$viewContext->meta->styles []= '/media/css/user/entries.css';\n\t\t$viewContext->meta->scripts []= '/media/js/user/entries.js';\n\t}\n\n\tpublic static function addJquery($viewContext)\n\t{\n\t\t$viewContext->meta->scripts []= 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';\n\t\t$viewContext->meta->scripts []= 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/ui/jquery.ui.position.min.js';\n\t\t$viewContext->meta->scripts []= '/media/js/jquery.cookie.js';\n\t}\n\n\tpublic static function addGlider($viewContext)\n\t{\n\t\t$viewContext->meta->styles []= '/media/css/glider.css';\n\t\t$viewContext->meta->scripts []= '/media/js/glider.js';\n\t}\n\n\tpublic static function addBasic($viewContext)\n\t{\n\t\tself::addJquery($viewContext);\n\t\t$viewContext->meta->styles []= 'https://fonts.googleapis.com/css?family=Open+Sans|Ubuntu';\n\t\t$viewContext->meta->styles []= '/media/css/core.css';\n\t\t$viewContext->meta->styles []= '/media/css/icons.css';\n\t\t$viewContext->meta->scripts []= '/media/js/misc.js';\n\t\t$viewContext->meta->scripts []= '/media/js/tooltips.js';\n\t\tself::addGlider($viewContext);\n\t}\n\n\tpublic static function addHeader($viewContext)\n\t{\n\t\tarray_unshift($viewContext->meta->styles, '/media/css/header.css');\n\t}\n\n\tpublic static function addHeaderless($viewContext)\n\t{\n\t\tarray_unshift($viewContext->meta->styles, '/media/css/headerless.css');\n\t}\n\n\tpublic static function addCustom($viewContext)\n\t{\n\t\t$baseName = str_replace('-', DIRECTORY_SEPARATOR, $viewContext->viewName);\n\t\t$name = 'css' . DIRECTORY_SEPARATOR . $baseName . '.css';\n\t\tif (file_exists(Config::$mediaDirectory . DIRECTORY_SEPARATOR . $name))\n\t\t{\n\t\t\t$viewContext->meta->styles []= str_replace('//', '/', Config::$mediaUrl . str_replace(DIRECTORY_SEPARATOR, '/', $name));\n\t\t}\n\t\t$name = 'js' . DIRECTORY_SEPARATOR . $baseName . '.js';\n\t\tif (file_exists(Config::$mediaDirectory . DIRECTORY_SEPARATOR . $name))\n\t\t{\n\t\t\t$viewContext->meta->scripts []= str_replace('//', '/', Config::$mediaUrl . '/' . str_replace(DIRECTORY_SEPARATOR, '/', $name));\n\t\t}\n\t}\n\n\tpublic static function download()\n\t{\n\t\t$urls = [\n\t\t\t'http://cdn.ucb.org.br/Scripts/tablesorter/jquery.tablesorter.min.js'\n\t\t\t\t=> join(DIRECTORY_SEPARATOR, [Config::$mediaDirectory, 'js', 'jquery.tablesorter.js']),\n\t\t\t'http://code.highcharts.com/highcharts.js'\n\t\t\t\t=> join(DIRECTORY_SEPARATOR, [Config::$mediaDirectory, 'js', 'jquery.highcharts.js']),\n\t\t\t'https://raw.github.com/mattfarina/farbtastic/cf1c85ae79af05b6530b53a37b3aace8fa992ca7/src/farbtastic.js'\n\t\t\t\t=> join(DIRECTORY_SEPARATOR, [Config::$mediaDirectory, 'js', 'jquery.farbtastic.js']),\n\t\t\t'https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js'\n\t\t\t\t=> join(DIRECTORY_SEPARATOR, [Config::$mediaDirectory, 'js', 'jquery.cookie.js']),\n\t\t];\n\t\t$results = Downloader::downloadMulti(array_keys($urls));\n\t\tforeach ($results as $url => $result)\n\t\t{\n\t\t\t$srcContent = $result->content;\n\t\t\t$dstPath = $urls[$url];\n\t\t\techo md5($srcContent) . ' --> ' . $dstPath . PHP_EOL;\n\t\t\tfile_put_contents($dstPath, $srcContent);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Logger.php",
    "content": "<?php\nclass Logger\n{\n\tprivate $path;\n\tprivate $baseName;\n\tprivate $fragmentOpen = false;\n\tprivate $handle = null;\n\n\tpublic function __construct($name = null)\n\t{\n\t\tif ($name)\n\t\t{\n\t\t\t$fileName = basename($name) . '.log';\n\t\t\t$this->baseName = $fileName;\n\t\t\t$this->path = Config::$logsPath . DIRECTORY_SEPARATOR . $fileName;\n\t\t}\n\t}\n\n\tpublic function __destruct()\n\t{\n\t\t$this->closefile();\n\t\t$this->rotateIfNeeded();\n\t}\n\n\tprivate function openFile()\n\t{\n\t\tif ($this->handle === null and $this->path)\n\t\t{\n\t\t\t$this->handle = fopen($this->path, 'ab');\n\t\t\tflock($this->handle, LOCK_EX);\n\t\t}\n\t}\n\n\tprivate function write($string)\n\t{\n\t\tif ($this->handle !== null)\n\t\t\tfwrite($this->handle, $string);\n\n\t\t$this->fragmentOpen = true;\n\n\t\tif (!isset($_SERVER['HTTP_HOST']))\n\t\t{\n\t\t\techo $string;\n\t\t\tflush();\n\t\t}\n\t}\n\n\tprivate function closeFile()\n\t{\n\t\t$this->fragmentOpen = false;\n\n\t\tif ($this->handle !== null and $this->path)\n\t\t\tfclose($this->handle);\n\n\t\t$this->handle = null;\n\t}\n\n\tprivate function decorate($data)\n\t{\n\t\tif ($this->fragmentOpen)\n\t\t\treturn $data;\n\t\treturn sprintf('[%s|%04x] %s', date('Y-m-d H:i:s'), getmypid(), $data);\n\t}\n\n\n\n\tpublic function purge()\n\t{\n\t\tif ($this->path)\n\t\t{\n\t\t\t$handle = fopen($this->path, 'wb');\n\t\t\tfclose($handle);\n\t\t}\n\t}\n\n\tpublic function logFragment($data)\n\t{\n\t\t$this->openFile();\n\t\t$data = call_user_func_array('sprintf', func_get_args());\n\t\t$data = $this->decorate($data);\n\t\t$this->write($data);\n\t\t#do not close the file handle\n\t\t#prevents lines from breaking when multiple instances are run\n\t}\n\n\tpublic function log($data)\n\t{\n\t\t$this->openFile();\n\t\t$data = call_user_func_array('sprintf', func_get_args());\n\t\t$data = $this->decorate($data);\n\t\t$data .= PHP_EOL;\n\t\t$this->write($data);\n\t\t$this->closeFile();\n\t}\n\n\n\n\tprivate function getAllFiles()\n\t{\n\t\tif (!$this->path)\n\t\t\treturn [];\n\n\t\t$files = glob(dirname($this->path) . DIRECTORY_SEPARATOR . '*');\n\t\t$files = array_filter($files, function($x)\n\t\t{\n\t\t\treturn basename($x) != basename($this->path)\n\t\t\t\tand strpos($x, $this->baseName) !== false;\n\t\t});\n\t\tnatcasesort($files);\n\t\tarray_unshift($files, $this->path);\n\t\treturn $files;\n\t}\n\n\tprivate function rotateIfNeeded()\n\t{\n\t\tif ($this->path and file_exists($this->path) and filesize($this->path) > Config::$maxLogSize)\n\t\t\t$this->rotate();\n\t}\n\n\tprivate function rotate()\n\t{\n\t\tif (!$this->path)\n\t\t\treturn;\n\n\t\t$newLogNumber = 1;\n\t\tif (Config::$keepOldLogs)\n\t\t{\n\t\t\t$files = $this->getAllFiles();\n\t\t\t$lastFile = end($files);\n\n\t\t\tif (preg_match('{^.*\\.(\\d+)(\\.log)?$}', $lastFile, $matches))\n\t\t\t\t$newLogNumber = intval($matches[1]) + 1;\n\t\t}\n\n\t\t$newPath = dirname($this->path) . DIRECTORY_SEPARATOR . $this->baseName . '.' . $newLogNumber . '.log';\n\t\trename($this->path, $newPath);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/DataSorter.php",
    "content": "<?php\nclass DataSorter\n{\n\tconst MediaMalId = 0;\n\tconst Title = 1;\n\tconst Score = 2;\n\tconst MeanScore = 3;\n\n\tpublic static function sort(&$entries, $sortType)\n\t{\n\t\tswitch ($sortType)\n\t\t{\n\t\t\tcase self::Title:\n\t\t\t\t$cb = function($a, $b)\n\t\t\t\t{\n\t\t\t\t\treturn strnatcasecmp($a->title, $b->title);\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase self::Score:\n\t\t\t\t$cb = function($a, $b)\n\t\t\t\t{\n\t\t\t\t\treturn $a->score < $b->score ? 1 : -1;\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase self::MeanScore:\n\t\t\t\t$cb = function($a, $b)\n\t\t\t\t{\n\t\t\t\t\treturn $a->meanScore < $b->meanScore ? 1 : -1;\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase self::MediaMalId:\n\t\t\t\t$cb = function($a, $b)\n\t\t\t\t{\n\t\t\t\t\treturn strcmp(sprintf('%s%05d', $a->media, $a->mal_id), sprintf('%s%05d', $b->media, $b->mal_id));\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new RuntimeException('Bad sort type');\n\t\t}\n\t\tusort($entries, $cb);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/DistributionEvaluator.php",
    "content": "<?php\nclass DistributionEvaluator\n{\n\tpublic static function evaluate(AbstractDistribution $dist)\n\t{\n\t\t$values = [];\n\t\t$allEntries = $dist->getAllEntries();\n\t\t$meanScore = 0;\n\t\t$rated = 0;\n\t\t$unrated = 0;\n\t\tforeach ($allEntries as $entry)\n\t\t{\n\t\t\t$meanScore += $entry->score;\n\t\t\tif ($entry->score)\n\t\t\t{\n\t\t\t\t$rated ++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$unrated ++;\n\t\t\t}\n\t\t}\n\t\t$meanScore /= max(1, $rated);\n\t\t$largestGroupSize = $dist->getLargestGroupSize();\n\n\t\tforeach ($dist->getGroupsKeys() as $safeKey => $key)\n\t\t{\n\t\t\t$entry = [];\n\t\t\t$localMeanScore = 0;\n\t\t\t$localRated = 0;\n\t\t\t$localUnrated = 0;\n\t\t\tforeach ($dist->getGroupEntries($key) as $entry)\n\t\t\t{\n\t\t\t\t$localMeanScore += $entry->score;\n\t\t\t\tif ($entry->score)\n\t\t\t\t{\n\t\t\t\t\t$localRated ++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$localUnrated ++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$localMeanScore = $localMeanScore / max(1, $localRated);\n\t\t\t$localMeanScore = $localMeanScore * $localRated + $meanScore * $localUnrated;\n\t\t\t$localMeanScore /= (float) max(1, $dist->getGroupSize($key));\n\t\t\t$weight = $dist->getGroupSize($key) / max(1, $largestGroupSize);\n\t\t\t$weight = 1 - pow(1 - pow($weight, 8. / 9.), 2);\n\t\t\t$value = $meanScore + ($localMeanScore - $meanScore) * $weight;\n\t\t\t$values[$safeKey] = $value;\n\t\t}\n\t\treturn $values;\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/AbstractDistribution.php",
    "content": "<?php\nabstract class AbstractDistribution\n{\n\tconst IGNORE_NULL_KEY = 1;\n\tconst IGNORE_EMPTY_GROUPS = 2;\n\n\tprotected $groups = [];\n\tprotected $entries = [];\n\tprotected $keys = [];\n\n\t/**\n\t* Public constructors\n\t*/\n\n\tprotected function __construct()\n\t{\n\t}\n\n\tpublic static function fromArray(array $arrayDist)\n\t{\n\t\t$dist = new static();\n\t\tforeach ($arrayDist as $key => $count)\n\t\t{\n\t\t\t$dist->groups[$key] = intval($count);\n\t\t\t$dist->entries[$key] = [];\n\t\t\t$dist->keys[$key] = $key;\n\t\t}\n\t\t$dist->finalize();\n\t\treturn $dist;\n\t}\n\n\tpublic static function fromEntries(array $entries = [])\n\t{\n\t\t$dist = new static();\n\t\tforeach ($entries as $entry)\n\t\t{\n\t\t\t$dist->addEntry($entry);\n\t\t}\n\t\t$dist->finalize();\n\t\treturn $dist;\n\t}\n\n\tprotected abstract function addEntry($entry);\n\n\t/**\n\t* AbstractDistribution construction\n\t*/\n\n\tprotected function finalize()\n\t{\n\t}\n\n\tprivate static function serializeKey($key)\n\t{\n\t\tif (is_object($key))\n\t\t{\n\t\t\tif (!empty($key->mal_id))\n\t\t\t\treturn $key->mal_id;\n\t\t\treturn serialize($key);\n\t\t}\n\t\treturn (string) $key;\n\t}\n\n\tprotected function addGroup($key)\n\t{\n\t\t$safeKey = self::serializeKey($key);\n\t\tif (!isset($this->keys[$safeKey]))\n\t\t{\n\t\t\t$this->groups[$safeKey] = 0;\n\t\t\t$this->entries[$safeKey] = [];\n\t\t\t$this->keys[$safeKey] = $key;\n\t\t}\n\t}\n\n\tpublic function addToGroup($key, $entry, $weight = 1)\n\t{\n\t\t$this->addGroup($key);\n\t\t$safeKey = self::serializeKey($key);\n\t\t$this->groups[$safeKey] += $weight;\n\t\t$this->entries[$safeKey] []= $entry;\n\t}\n\n\tpublic function getGroupEntries($key)\n\t{\n\t\t$safeKey = self::serializeKey($key);\n\t\tif (!isset($this->entries[$safeKey]))\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->entries[$safeKey];\n\t}\n\n\tpublic function getGroupSize($key)\n\t{\n\t\t$safeKey = self::serializeKey($key);\n\t\tif (!isset($this->groups[$safeKey]))\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->groups[$safeKey];\n\t}\n\n\n\n\tpublic function getGroupsKeys($flags = 0)\n\t{\n\t\t$x = [];\n\t\tforeach (array_keys($this->groups) as $k)\n\t\t{\n\t\t\t$x[$k] = $this->keys[$k];\n\t\t}\n\t\tif ($flags & self::IGNORE_NULL_KEY)\n\t\t{\n\t\t\tunset($x[$this->getNullGroupKey()]);\n\t\t}\n\t\tif ($flags & self::IGNORE_EMPTY_GROUPS)\n\t\t{\n\t\t\t$x = array_filter($x, function($key)\n\t\t\t{\n\t\t\t\treturn $this->getGroupSize($key) > 0;\n\t\t\t});\n\t\t}\n\t\treturn $x;\n\t}\n\n\tpublic function getGroupsEntries($flags = 0)\n\t{\n\t\t$keys = $this->getGroupsKeys($flags);\n\t\t$x = [];\n\t\tforeach ($keys as $key)\n\t\t{\n\t\t\t$safeKey = self::serializeKey($key);\n\t\t\t$x[$safeKey] = $this->getGroupEntries($key);\n\t\t}\n\t\treturn $x;\n\t}\n\n\tpublic function getAllEntries($flags = 0)\n\t{\n\t\t$groups = self::getGroupsEntries($flags);\n\t\tif ($groups === null)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\t$x = [];\n\t\tforeach ($groups as $key => $entries)\n\t\t{\n\t\t\tforeach ($entries as $entry)\n\t\t\t{\n\t\t\t\t$x[$entry->id] = $entry;\n\t\t\t}\n\t\t}\n\t\treturn $x;\n\t}\n\n\tpublic function getGroupsSizes($flags = 0)\n\t{\n\t\t$keys = $this->getGroupsKeys($flags);\n\t\t$x = [];\n\t\tforeach ($keys as $key)\n\t\t{\n\t\t\t$safeKey = self::serializeKey($key);\n\t\t\t$x[$safeKey] = $this->getGroupSize($key);\n\t\t}\n\t\treturn $x;\n\t}\n\n\tpublic function getLargestGroupSize($flags = 0)\n\t{\n\t\t$x = $this->getGroupsSizes($flags);\n\t\tif (empty($x))\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\treturn max($x);\n\t}\n\n\tpublic function getLargestGroupKey($flags = 0)\n\t{\n\t\treturn $this->keys[array_search($this->getLargestGroupSize($flags), $this->groups)];\n\t}\n\n\tpublic function getSmallestGroupSize($flags = 0)\n\t{\n\t\t$x = $this->getGroupsSizes($flags);\n\t\treturn min($x);\n\t}\n\n\tpublic function getSmallestGroupKey($flags = 0)\n\t{\n\t\treturn $this->keys[array_search($this->getSmallestGroupSize($flags), $this->groups)];\n\t}\n\n\tpublic function getTotalSize($flags = 0)\n\t{\n\t\treturn array_sum($this->getGroupsSizes($flags));\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaCreatorDistribution.php",
    "content": "<?php\nclass MediaCreatorDistribution extends AbstractDistribution\n{\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tpublic static function fromEntries(array $entries = [])\n\t{\n\t\t$dist = new self();\n\t\tif (!empty($entries))\n\t\t{\n\t\t\tModel_MixedUserMedia::attachCreators($entries);\n\t\t\tforeach ($entries as $entry)\n\t\t\t{\n\t\t\t\t$dist->addEntry($entry);\n\t\t\t}\n\t\t}\n\t\t$dist->finalize();\n\t\treturn $dist;\n\t}\n\n\tprotected function addEntry($entry)\n\t{\n\t\tforeach ($entry->creators as $creator)\n\t\t{\n\t\t\t$this->addToGroup($creator, $entry);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaDecadeDistribution.php",
    "content": "<?php\nclass MediaDecadeDistribution extends AbstractDistribution\n{\n\tprotected function finalize()\n\t{\n\t\tif (!empty($this->keys))\n\t\t{\n\t\t\t$min = $max = null;\n\t\t\tforeach ($this->keys as $safeKey => $key)\n\t\t\t{\n\t\t\t\tif ($safeKey == $this->getNullGroupKey())\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif ($min === null or $safeKey < $min)\n\t\t\t\t{\n\t\t\t\t\t$min = $safeKey;\n\t\t\t\t}\n\t\t\t\tif ($max === null or $safeKey > $max)\n\t\t\t\t{\n\t\t\t\t\t$max = $safeKey;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor ($i = $min + 10; $i < $max; $i += 10)\n\t\t\t{\n\t\t\t\t$this->addGroup($i);\n\t\t\t}\n\t\t}\n\n\t\tkrsort($this->groups, SORT_NUMERIC);\n\t\tkrsort($this->entries, SORT_NUMERIC);\n\t}\n\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tpublic static function getPublishedDecade($entry)\n\t{\n\t\t$year = MediaYearDistribution::getPublishedYear($entry);\n\t\t$decade = floor($year / 10) * 10;\n\t\treturn $decade;\n\t}\n\n\tprotected function addEntry($entry)\n\t{\n\t\t$this->addToGroup(self::getPublishedDecade($entry), $entry);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaGenreDistribution.php",
    "content": "<?php\nclass MediaGenreDistribution extends AbstractDistribution\n{\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tpublic static function fromEntries(array $entries = [])\n\t{\n\t\t$dist = new self();\n\t\tModel_MixedUserMedia::attachGenres($entries);\n\t\tforeach ($entries as $entry)\n\t\t{\n\t\t\t$dist->addEntry($entry);\n\t\t}\n\t\t$dist->finalize();\n\t\treturn $dist;\n\t}\n\n\tpublic function addEntry($entry)\n\t{\n\t\tforeach ($entry->genres as $genre)\n\t\t{\n\t\t\t$this->addToGroup($genre, $entry);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaLengthDistribution.php",
    "content": "<?php\nclass MediaLengthDistribution extends AbstractDistribution\n{\n\tprotected function finalize()\n\t{\n\t\t$f = function($a, $b)\n\t\t{\n\t\t\tif ($b == '?')\n\t\t\t{\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\telseif ($a == '?')\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn intval($a) - intval($b);\n\t\t\t}\n\t\t};\n\t\tuksort($this->groups, $f);\n\t\tuksort($this->entries, $f);\n\t}\n\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tpublic static function getThresholds($media)\n\t{\n\t\tswitch ($media)\n\t\t{\n\t\t\tcase Media::Anime: return [1, 6, 13, 26, 52, 100];\n\t\t\tcase Media::Manga: return [1, 10, 25, 50, 100, 200];\n\t\t}\n\t\tthrow new BadMediaException();\n\t}\n\n\tpublic static function getGroup($entry)\n\t{\n\t\t$thresholds = self::getThresholds($entry->media);\n\t\t$thresholds = array_reverse($thresholds);\n\t\t$thresholds []= 0;\n\n\t\tswitch ($entry->media)\n\t\t{\n\t\t\tcase Media::Anime: $length = $entry->episodes; break;\n\t\t\tcase Media::Manga: $length = $entry->chapters; break;\n\t\t\tdefault: throw new BadMediaException();\n\t\t}\n\t\t$group = '?';\n\t\tif ($length > 0)\n\t\t{\n\t\t\tforeach ($thresholds as $i => $threshold)\n\t\t\t{\n\t\t\t\tif ($length > $threshold)\n\t\t\t\t{\n\t\t\t\t\tif ($i == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$group = strval($threshold + 1) . '+';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$a = $thresholds[$i - 1];\n\t\t\t\t\t\t$b = $threshold + 1;\n\t\t\t\t\t\tif ($a == $b or $threshold == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group = strval($a);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group = strval($b) . '-' . strval($a);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $group;\n\t}\n\n\tpublic function addEntry($entry)\n\t{\n\t\t$group = self::getGroup($entry);\n\t\t$this->addToGroup($group, $entry);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaSourceDistribution.php",
    "content": "<?php\nclass MediaSourceDistribution extends AbstractDistribution\n{\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tprotected function addEntry($entry)\n\t{\n\t\t$this->addToGroup($entry->source ?? 0, $entry);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaTypeDistribution.php",
    "content": "<?php\nclass MediaTypeDistribution extends AbstractDistribution\n{\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tprotected function addEntry($entry)\n\t{\n\t\t$this->addToGroup($entry->sub_type, $entry);\n\t}\n}\n\n"
  },
  {
    "path": "src/ModelUtils/Distributions/MediaYearDistribution.php",
    "content": "<?php\nclass MediaYearDistribution extends AbstractDistribution\n{\n\tprotected function finalize()\n\t{\n\t\t/*if (!empty($this->keys))\n\t\t{\n\t\t\t$min = $max = reset($this->keys);\n\t\t\twhile (list($i,) = each($this->keys))\n\t\t\t{\n\t\t\t\tif ($min > $i)\n\t\t\t\t{\n\t\t\t\t\t$min = $i;\n\t\t\t\t}\n\t\t\t\telseif ($max < $i)\n\t\t\t\t{\n\t\t\t\t\t$max = $i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor ($i = $min + 1; $i < $max; $i ++)\n\t\t\t{\n\t\t\t\t$this->addGroup($i);\n\t\t\t}\n\t\t}*/\n\n\t\tkrsort($this->groups, SORT_NUMERIC);\n\t\tkrsort($this->entries, SORT_NUMERIC);\n\t}\n\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn null;\n\t}\n\n\tpublic static function getPublishedYear($entry)\n\t{\n\t\t$yearA = intval(substr($entry->published_from ?? '0', 0, 4));\n\t\t$yearB = intval(substr($entry->published_to ?? '0', 0, 4));\n\t\tif (!$yearA and !$yearB)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\telseif (!$yearA)\n\t\t{\n\t\t\treturn $yearB;\n\t\t}\n\t\treturn $yearA;\n\t}\n\n\tpublic function addEntry($entry)\n\t{\n\t\t$this->addToGroup(self::getPublishedYear($entry), $entry);\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/RatingDistribution.php",
    "content": "<?php\nclass RatingDistribution extends AbstractDistribution\n{\n\tprotected function finalize()\n\t{\n\t\tforeach (range(10, 0) as $x)\n\t\t{\n\t\t\t$this->addGroup($x);\n\t\t}\n\n\t\tkrsort($this->groups, SORT_NUMERIC);\n\t\tkrsort($this->entries, SORT_NUMERIC);\n\t}\n\n\tprotected function addEntry($entry)\n\t{\n\t\t$this->addToGroup($entry->score, $entry);\n\t}\n\n\tpublic function getNullGroupKey()\n\t{\n\t\treturn 0;\n\t}\n\n\tpublic function getRatedCount()\n\t{\n\t\treturn $this->getTotalSize(self::IGNORE_NULL_KEY);\n\t}\n\n\tpublic function getUnratedCount()\n\t{\n\t\treturn $this->getGroupSize($this->getNullGroupKey());\n\t}\n\n\tpublic function getMeanScore()\n\t{\n\t\t$mean = 0;\n\t\t$totalSize = 0;\n\t\tforeach ($this->groups as $safeKey => $size)\n\t\t{\n\t\t\tif ($safeKey == $this->getNullGroupKey())\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$mean += $safeKey * $size;\n\t\t\t$totalSize += $size;\n\t\t}\n\t\tif ($totalSize == 0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\treturn $mean / max(1, $totalSize);\n\t}\n\n\tpublic function getStandardDeviation()\n\t{\n\t\t$standardDeviation = 0;\n\t\t$meanScore = $this->getMeanScore();\n\t\tforeach ($this->groups as $score => $size)\n\t\t{\n\t\t\tif ($score != $this->getNullGroupKey())\n\t\t\t{\n\t\t\t\t$standardDeviation += $size * pow($score - $meanScore, 2);\n\t\t\t}\n\t\t}\n\t\t$standardDeviation /= max(1, $this->getRatedCount() - 1);\n\t\t$standardDeviation = sqrt($standardDeviation);\n\t\treturn $standardDeviation;\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/Distributions/RatingTimeDistribution.php",
    "content": "<?php\nclass RatingTimeDistribution extends RatingDistribution\n{\n\tpublic function addEntry($entry)\n\t{\n\t\t$this->addToGroup($entry->score, $entry, $entry->finished_duration);\n\t}\n\n\tpublic function getTotalTime()\n\t{\n\t\treturn $this->getTotalSize();\n\t}\n}\n"
  },
  {
    "path": "src/ModelUtils/UserMediaFilter.php",
    "content": "<?php\nclass UserMediaFilter\n{\n\tpublic static function doFilter($entries, $filters)\n\t{\n\t\tif (empty($filters))\n\t\t{\n\t\t\treturn $entries;\n\t\t}\n\t\tforeach ((array) $filters as $filter)\n\t\t{\n\t\t\t$entries = array_filter($entries, $filter);\n\t\t}\n\t\treturn $entries;\n\t}\n\n\tpublic static function nonPlanned()\n\t{\n\t\treturn function($row)\n\t\t{\n\t\t\treturn $row->status != UserListStatus::Planned;\n\t\t};\n\t}\n\n\tpublic static function dropped()\n\t{\n\t\treturn function($row)\n\t\t{\n\t\t\treturn $row->status == UserListStatus::Dropped;\n\t\t};\n\t}\n\n\tpublic static function finished()\n\t{\n\t\treturn function($row)\n\t\t{\n\t\t\treturn $row->status == UserListStatus::Finished;\n\t\t};\n\t}\n\n\tpublic static function score($score)\n\t{\n\t\t$score = intval($score);\n\t\treturn function($row) use ($score)\n\t\t{\n\t\t\treturn intval($row->score) == $score;\n\t\t};\n\t}\n\n\tpublic static function combine()\n\t{\n\t\treturn func_get_args();\n\t}\n\n\tpublic static function lengthGroup($group)\n\t{\n\t\treturn function($row) use ($group)\n\t\t{\n\t\t\treturn MediaLengthDistribution::getGroup($row) == $group;\n\t\t};\n\t}\n\n\tpublic static function publishedYear($year)\n\t{\n\t\treturn function($row) use ($year)\n\t\t{\n\t\t\treturn MediaYearDistribution::getPublishedYear($row) == $year;\n\t\t};\n\t}\n\n\tpublic static function publishedDecade($decade)\n\t{\n\t\treturn function($row) use ($decade)\n\t\t{\n\t\t\treturn MediaDecadeDistribution::getPublishedDecade($row) == $decade;\n\t\t};\n\t}\n\n\tpublic static function nonMovie()\n\t{\n\t\treturn function($row)\n\t\t{\n\t\t\treturn !($row->sub_type == AnimeMediaType::Movie and $row->media == Media::Anime);\n\t\t};\n\t}\n\n\tpublic static function type($type)\n\t{\n\t\treturn function($row) use ($type)\n\t\t{\n\t\t\treturn $row->sub_type == $type;\n\t\t};\n\t}\n\n\tpublic static function creator($creatorIds, $list)\n\t{\n\t\tif (empty($list))\n\t\t{\n\t\t\treturn [];\n\t\t}\n\t\tif (!is_array($creatorIds))\n\t\t{\n\t\t\t$creatorIds = [$creatorIds];\n\t\t}\n\t\t$media = reset($list)->media;\n\t\t$tblName = Model_MixedUserMedia::createTemporaryTable($list);\n\t\tswitch ($media)\n\t\t{\n\t\t\tcase Media::Anime:\n\t\t\t\t$table = 'animeproducer';\n\t\t\t\tbreak;\n\t\t\tcase Media::Manga:\n\t\t\t\t$table = 'mangaauthor';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new BadMediaException();\n\t\t}\n\t\t$query = 'SELECT * FROM ' . $table . ' mc INNER JOIN ' . $tblName . ' ON mc.media_id = ' . $tblName . '.media_id WHERE mc.mal_id IN (' . R::genSlots($creatorIds) . ')';\n\t\t$data = R::getAll($query, $creatorIds);\n\t\tModel_MixedUserMedia::dropTemporaryTable($tblName);\n\n\t\t$data = array_map(function($x) { return $x['media_id']; }, $data);\n\t\t$data = array_flip($data);\n\t\treturn function($row) use ($data)\n\t\t{\n\t\t\treturn isset($data[$row->media_id]);\n\t\t};\n\t}\n\n\n\tpublic static function genre($genreIds, $list)\n\t{\n\t\tif (empty($list))\n\t\t{\n\t\t\treturn [];\n\t\t}\n\t\tif (!is_array($genreIds))\n\t\t{\n\t\t\t$genreIds = [$genreIds];\n\t\t}\n\t\t$tblName = Model_MixedUserMedia::createTemporaryTable($list);\n\t\t$query = 'SELECT * FROM mediagenre mg INNER JOIN ' . $tblName . ' ON mg.media_id = ' . $tblName . '.media_id WHERE mg.mal_id IN (' . R::genSlots($genreIds) . ')';\n\t\t$data = R::getAll($query, $genreIds);\n\t\tModel_MixedUserMedia::dropTemporaryTable($tblName);\n\n\t\t$data = array_map(function($x) { return $x['media_id']; }, $data);\n\t\t$data = array_flip($data);\n\t\treturn function($row) use ($data)\n\t\t{\n\t\t\treturn isset($data[$row->media_id]);\n\t\t};\n\t}\n\n\tpublic static function source($sources)\n\t{\n\t\tif (!is_array($sources))\n        {\n            $sources = [$sources];\n        }\n\n        return function($row) use ($sources)\n\t\t{\n            return in_array($row->source ?? 0, $sources);\n\t\t};\n\t}\n\n\tpublic static function givenMedia($mediaList)\n\t{\n\t\treturn function($e) use ($mediaList)\n\t\t{\n\t\t\treturn in_array($e->media . $e->mal_id, $mediaList);\n\t\t};\n\t}\n}\n"
  },
  {
    "path": "src/Models/Model_Media.php",
    "content": "<?php\nclass Model_Media extends RedBean_SimpleModel\n{\n\tpublic static function getCount($media)\n\t{\n\t\t$query = 'SELECT COUNT(*) AS count FROM media WHERE media = ?';\n\t\treturn intval(R::getAll($query, [$media])[0]['count']);\n\t}\n\n\tpublic static function getOldest($media, $number)\n\t{\n\t\treturn R::find('media', 'media = ? ORDER BY processed ASC LIMIT ?', [$media, $number]);\n\t}\n}\n"
  },
  {
    "path": "src/Models/Model_MixedUserMedia.php",
    "content": "<?php\nclass Model_MixedUserMedia\n{\n    public function __construct(array $columns)\n    {\n        foreach ($columns as $key => $value)\n        {\n            $this->$key = $value;\n        }\n\n        if ($this->media == Media::Anime)\n        {\n            if (isset($this->finished_episodes))\n            {\n                $this->finished_duration = $this->duration * $this->finished_episodes;\n            }\n        }\n        elseif ($this->media == Media::Manga)\n        {\n            $duration = 8;\n\n            if ($this->sub_type == MangaMediaType::Novel || $this->sub_type == MangaMediaType::LightNovel)\n            {\n                $duration = 32;\n            }\n\n            $durationChapters = 0;\n\n            if (isset($this->finished_chapters))\n            {\n                $durationChapters = $duration * $this->finished_chapters;\n            }\n\n            $durationVolumes = 0;\n\n            if (isset($this->finished_volumes))\n            {\n                $durationVolumes = $duration * 9 * $this->finished_volumes;\n            }\n\n            $this->finished_duration = max($durationChapters, $durationVolumes);\n        }\n\n        if (empty($this->title))\n        {\n            $this->title = 'Unknown ' . Media::toString($this->media) . ' entry #' . $this->mal_id;\n        }\n\n        $this->mal_link = 'https://myanimelist.net/' . Media::toString($this->media) . '/' . $this->mal_id;\n    }\n\n    public function getSeason()\n    {\n        $monthMap = [\n            1 => 'winter',\n            2 => 'winter',\n            3 => 'spring',\n            4 => 'spring',\n            5 => 'spring',\n            6 => 'summer',\n            7 => 'summer',\n            8 => 'summer',\n            9 => 'fall',\n            10 => 'fall',\n            11 => 'fall',\n            12 => 'winter',\n        ];\n\n        $yearA = intval(substr($this->published_from ?? '0', 0, 4));\n        $yearB = intval(substr($this->published_to ?? '0', 0, 4));\n        $monthA = intval(substr($this->published_from ?? '0', 5, 2));\n        $monthB = intval(substr($this->published_to ?? '0', 5, 2));\n        if (!$yearA and !$yearB)\n        {\n            return null;\n        }\n        elseif (!$yearA)\n        {\n            if ($monthB)\n            {\n                return $monthMap[$monthB] . ' ' . $yearB;\n            }\n            return strval($yearB);\n        }\n        if ($monthA)\n        {\n            return $monthMap[$monthA] . ' ' . $yearA;\n        }\n        return strval($yearA);\n    }\n\n\n    public static function getFromIdList($list)\n    {\n        $allEntries = [];\n        foreach (array_chunk($list, Config::$maxDbBindings) as $chunk)\n        {\n            $query = 'SELECT m.*, m.id AS media_id FROM media m WHERE m.media || m.mal_id IN (' . R::genSlots($chunk) . ')';\n            $rows = R::getAll($query, $chunk);\n            $entries = array_map(function($entry) { return new Model_MixedUserMedia($entry); }, $rows);\n            $allEntries = array_merge($allEntries, $entries);\n        }\n        return $allEntries;\n    }\n\n    public static function getRatingDistribution($media, $doRecompute = false)\n    {\n        $query = 'SELECT score, COUNT(score) AS count FROM usermedia WHERE media = ? GROUP BY score';\n        $result = R::getAll($query, [$media]);\n        $dist[$media] = [];\n        foreach ($result as $row)\n        {\n            $count = $row['count'];\n            $score = $row['score'];\n            $dist[$media][$score] = $count;\n        }\n        return RatingDistribution::fromArray($dist[$media]);\n    }\n\n    /**\n    * Map entries to dictionary of franchise->entries\n    */\n    private static function clusterize($entries)\n    {\n        $clusters = [];\n        foreach ($entries as $entry)\n        {\n            if (!isset($clusters[$entry->franchise]))\n            {\n                $clusters[$entry->franchise] = [];\n            }\n            $clusters[$entry->franchise] []= $entry;\n        }\n        return $clusters;\n    }\n\n    public static function getFranchises(array $ownEntries, $loadEverything = false)\n    {\n        $ownClusters = self::clusterize($ownEntries);\n\n        if ($loadEverything)\n        {\n            $tblName = 'hurr';\n            $query = 'CREATE TEMPORARY TABLE ' . $tblName . ' (franchise VARCHAR(10))';\n            R::exec($query);\n            foreach (array_chunk(array_keys($ownClusters), Config::$maxDbBindings) as $chunk)\n            {\n                $query = 'INSERT INTO ' . $tblName . ' VALUES ' . join(',', array_fill(0, count($chunk), '(?)'));\n                R::exec($query, $chunk);\n            }\n            $query = 'SELECT * FROM media INNER JOIN ' . $tblName . ' ON media.franchise = ' . $tblName . '.franchise';\n            $rows = R::getAll($query);\n            $query = 'DROP TABLE ' . $tblName;\n            R::exec($query);\n\n            $allEntries = array_map(function($entry) { return new Model_MixedUserMedia($entry); }, $rows);\n            $allClusters = self::clusterize($allEntries);\n        }\n\n        $franchises = [];\n        foreach ($ownClusters as $key => $ownCluster)\n        {\n            $franchise = new StdClass;\n            $franchise->allEntries =\n                !empty($allClusters[$key])\n                ? $allClusters[$key]\n                : [];\n            $franchise->ownEntries = array_values($ownCluster);\n            $franchises []= $franchise;\n        }\n        return $franchises;\n    }\n\n    public static function attachGenres(array &$entries)\n    {\n        $tblName = self::createTemporaryTable($entries);\n        $query = 'SELECT * FROM mediagenre mg INNER JOIN ' . $tblName . ' ON mg.media_id = ' . $tblName . '.media_id';\n        $rows = R::getAll($query);\n        self::dropTemporaryTable($tblName);\n\n        $data = ReflectionHelper::arraysToClasses($rows);\n        $map = [];\n        foreach ($entries as $entry)\n        {\n            $entry->genres = [];\n            $map[$entry->media_id] = $entry;\n        }\n\n        foreach ($data as $row)\n        {\n            if (!isset($map[$row->media_id]))\n            {\n                continue;\n            }\n            if (BanHelper::isGenreBanned($map[$row->media_id]->media, $row->mal_id))\n            {\n                continue;\n            }\n            $map[$row->media_id]->genres []= $row;\n        }\n    }\n\n    public static function attachCreators(array &$entries)\n    {\n        $tblName = self::createTemporaryTable($entries);\n        switch (reset($entries)->media)\n        {\n            case Media::Anime:\n                $table = 'animeproducer';\n                break;\n            case Media::Manga:\n                $table = 'mangaauthor';\n                break;\n            default:\n                throw new BadMediaException();\n        }\n        $query = 'SELECT * FROM ' . $table . ' mc INNER JOIN ' . $tblName . ' ON mc.media_id = ' . $tblName . '.media_id';\n        $rows = R::getAll($query);\n        self::dropTemporaryTable($tblName);\n\n        $data = ReflectionHelper::arraysToClasses($rows);\n        $map = [];\n        foreach ($entries as $entry)\n        {\n            $entry->creators = [];\n            $map[$entry->media_id] = $entry;\n        }\n\n        foreach ($data as $row)\n        {\n            if (!isset($map[$row->media_id]))\n            {\n                continue;\n            }\n            if (BanHelper::isCreatorBanned($map[$row->media_id]->media, $row->mal_id))\n            {\n                continue;\n            }\n            $map[$row->media_id]->creators []= $row;\n        }\n    }\n\n    public static function attachRecommendations(array &$entries)\n    {\n        $tblName = self::createTemporaryTable($entries);\n        $query = 'SELECT * FROM mediarec mr INNER JOIN ' . $tblName . ' ON mr.media_id = ' . $tblName . '.media_id';\n        $rows = R::getAll($query);\n        self::dropTemporaryTable($tblName);\n\n        $map = [];\n        foreach ($entries as $entry)\n        {\n            $entry->recommendations = [];\n            $map[$entry->media_id] = $entry;\n        }\n\n        foreach ($rows as $row)\n        {\n            $map[$row['media_id']]->recommendations []= $row;\n        }\n    }\n\n    public static function attachMissingRelations(array $titles, string $media)\n    {\n        $t = self::createTemporaryTable($titles);\n\n        $rows = R::getAll('SELECT m.*, mr.media_id, mr.type relation_type FROM media m INNER JOIN mediarelation mr ON m.mal_id = mr.mal_id INNER JOIN ' . $t . ' ON mr.media_id = ' . $t . '.media_id WHERE m.media = ? AND mr.media = ?', [$media, $media]);\n\n        self::dropTemporaryTable($t);\n\n        $map = [];\n\n        foreach ($titles as $title)\n        {\n            $title->relations = [];\n            \n            $map[$title->media_id] = $title;\n        }\n\n        foreach ($rows as $row)\n        {\n            if (!isset($map[$row['id']]))\n            {\n                $map[$row['media_id']]->relations[] = new Model_MixedUserMedia($row);\n            }\n        }\n\n        return $titles;\n    }\n\n    private static $temporaryTables = [];\n    public static function createTemporaryTable(array $entries)\n    {\n        $ids = array_map(function($entry) { return $entry->media_id; }, $entries);\n        $uniqueId = md5(join(',', $ids));\n        $tblName = 'hurr_' . $uniqueId;\n\n        if (!isset(self::$temporaryTables[$tblName]))\n        {\n            self::$temporaryTables[$tblName] = true;\n            $query = 'CREATE TEMPORARY TABLE ' . $tblName . ' (media_id INTEGER)';\n            R::exec($query);\n            foreach (array_chunk($ids, Config::$maxDbBindings) as $chunk)\n            {\n                $query = 'INSERT INTO ' . $tblName . ' VALUES ' . join(',', array_fill(0, count($chunk), '(?)'));\n                R::exec($query, $chunk);\n            }\n        }\n\n        return $tblName;\n    }\n\n    public static function dropTemporaryTable($tblName)\n    {\n        #$query = 'DROP TABLE ' . $tblName;\n        #R::exec($query);\n    }\n}\n"
  },
  {
    "path": "src/Models/Model_User.php",
    "content": "<?php\nclass Model_User extends RedBean_SimpleModel\n{\n\tpublic function getMixedUserMedia($media)\n\t{\n\t\t$query = 'SELECT m.*, um.*, m.id AS media_id FROM usermedia um' .\n\t\t\t' LEFT JOIN media m ON m.media = um.media AND m.mal_id = um.mal_id' .\n\t\t\t' WHERE um.user_id = ?';\n\t\t$rows = R::getAll($query, [$this->id]);\n\t\t$rows = array_filter($rows, function($row) use ($media) { return $row['media'] == $media; });\n\t\treturn array_map(function($row) { return new Model_MixedUserMedia($row); }, $rows);\n\t}\n\n\tpublic function getFriends()\n\t{\n\t\t$query = 'SELECT * FROM userfriend' .\n\t\t\t' WHERE user_id = ?' .\n\t\t\t' ORDER BY name COLLATE NOCASE ASC';\n\t\t$rows = R::getAll($query, [$this->id]);\n\t\treturn ReflectionHelper::arraysToClasses($rows);\n\t}\n\n\tpublic function getHistory($media)\n\t{\n\t\t$result = [];\n\t\t$query = 'SELECT m.*, uh.*, m.id AS media_id FROM userhistory uh' .\n\t\t\t' LEFT JOIN media m ON m.media = uh.media AND m.mal_id = uh.mal_id' .\n\t\t\t' WHERE uh.user_id = ? AND uh.media = ?' .\n\t\t\t' ORDER BY timestamp DESC';\n\t\t$rows = R::getAll($query, [$this->id, $media]);\n\t\treturn array_map(function($row) { return new Model_MixedUserMedia($row); }, $rows);\n\t}\n\n\tpublic function isUserMediaPrivate($media)\n\t{\n\t\treturn $this->{Media::toString($media) . '_private'};\n\t}\n\n\tpublic static function getCount()\n\t{\n        $query = 'SELECT COUNT(*) AS `count` FROM user WHERE `processed` > ?';\n        \n        return intval(R::getAll($query, [date('Y-m-d H:i:s', strtotime('-1 month'))])[0]['count']);\n\t}\n    \n\tpublic static function getCountAll()\n\t{\n        $query = 'SELECT COUNT(*) AS `count` FROM user';\n        \n        return intval(R::getAll($query, [])[0]['count']);\n\t}\n\n\tpublic static function getCoolUsers($goal)\n\t{\n\t\t$query = 'SELECT id FROM user WHERE cool = 1 ORDER BY RANDOM() LIMIT ?';\n\t\t$userIds = array_map(function($x) { return intval($x['id']); }, R::getAll($query, [$goal]));\n\t\tif (empty($userIds))\n\t\t{\n\t\t\treturn [];\n\t\t}\n\n\t\t$query = 'id IN (' . R::genSlots($userIds) . ')';\n\t\t$result = R::findAll('user', $query, $userIds);\n\t\treturn array_map(function($x) { return $x->box(); }, $result);\n\t}\n\n\tpublic function getMismatchedUserMedia(array $entries)\n\t{\n\t\t$entriesMismatched = [];\n\t\tforeach ($entries as $entry)\n\t\t{\n\t\t\tif ($entry->media == Media::Anime)\n\t\t\t{\n\t\t\t\t$a = $entry->finished_episodes;\n\t\t\t\t$b = $entry->episodes;\n\t\t\t} else {\n\t\t\t\t$a = $entry->finished_chapters;\n\t\t\t\t$b = $entry->chapters;\n\t\t\t}\n\t\t\tif ($a != $b and ($b > 0 or $entry->publishing_status == MediaStatus::Publishing) and $entry->status == UserListStatus::Finished)\n\t\t\t{\n\t\t\t\t$entriesMismatched []= $entry;\n\t\t\t}\n\t\t}\n\t\treturn $entriesMismatched;\n\t}\n}\n"
  },
  {
    "path": "src/Processors/AbstractProcessor.php",
    "content": "<?php\nabstract class AbstractProcessor\n{\n\tpublic abstract function getSubProcessors($key);\n\n\tpublic function beforeProcessing(&$context)\n\t{\n\t}\n\n\tpublic function afterProcessing(&$context)\n\t{\n\t}\n\n\tpublic function onProcessingError(&$context)\n\t{\n\t\tthrow $context->exception;\n\t}\n\n\tpublic function process($key)\n\t{\n\t\tif (empty($key))\n\t\t\treturn null;\n\n\t\t$urls = [];\n\t\ttry\n\t\t{\n\t\t\t$context = new ProcessingContext();\n\t\t\t$context->key = $key;\n\n\t\t\t$subProcessors = $this->getSubProcessors($key);\n\t\t\t$urlMap = [];\n\t\t\tforeach ($subProcessors as $processor)\n\t\t\t{\n\t\t\t\tforeach ($processor->getURLs($key) as $url)\n\t\t\t\t{\n\t\t\t\t\tif (!isset($urlMap[$url]))\n\t\t\t\t\t\t$urlMap[$url] = [];\n\t\t\t\t\t$urlMap[$url] []= $processor;\n\t\t\t\t\t$urls[$url] = $url;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$documents = Downloader::downloadMulti($urls);\n            \n            foreach ($documents as $document) {\n                if ($document->code === 403) {\n                    $document->content = '403';\n                    \n                    continue;\n                }\n                \n                if (empty($document->content)) {\n                    throw new DownloadFailureException($document->url, 'Empty document');\n                }\n                \n                $document->content = '<?xml encoding=\"utf-8\"?>' . $document->content;\n            }\n            \n\t\t\t$f = function() use ($subProcessors, $context, $urlMap, $documents)\n\t\t\t{\n\t\t\t\tforeach ($subProcessors as $subProcessor)\n\t\t\t\t{\n\t\t\t\t\t$sourceDocuments = $documents;\n\n\t\t\t\t\t$subUrls = [];\n\t\t\t\t\tforeach ($urlMap as $url => $urlProcessors)\n\t\t\t\t\t\tif (in_array($subProcessor, $urlProcessors))\n\t\t\t\t\t\t\t$subUrls []= $url;\n\n\t\t\t\t\t$attempts = 0;\n\t\t\t\t\twhile (true)\n\t\t\t\t\t{\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$subDocuments = [];\n\t\t\t\t\t\t\tforeach ($subUrls as $url)\n\t\t\t\t\t\t\t\t$subDocuments []= $sourceDocuments[$url];\n\t\t\t\t\t\t\t$subProcessor->process($subDocuments, $context);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (BadProcessorKeyException $e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow $e;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (DocumentException $e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sourceDocuments[$e->getDocument()->url] = Downloader::download($e->getDocument()->url);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (Exception $e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sourceDocuments = Downloader::downloadMulti($subUrls);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t++ $attempts;\n\t\t\t\t\t\tif ($attempts > Config::$maxProcessingAttempts)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow !isset($e)\n\t\t\t\t\t\t\t\t? new Exception('Too many attempts')\n\t\t\t\t\t\t\t\t: $e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t$this->beforeProcessing($context);\n\t\t\ttry\n\t\t\t{\n\t\t\t\tR::transaction($f);\n\t\t\t}\n\t\t\tcatch (Exception $e)\n\t\t\t{\n\t\t\t\t$context->exception = $e;\n\t\t\t\t$this->onProcessingError($context);\n\t\t\t}\n\t\t\t$this->afterProcessing($context);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\tif (Config::$mirrorPurgeFailures)\n\t\t\t\tDownloader::purgeCache($urls);\n\t\t\tthrow $e;\n\t\t}\n\n\t\treturn $context;\n\t}\n}\n"
  },
  {
    "path": "src/Processors/AnimeProcessor.php",
    "content": "<?php\nclass AnimeProcessor extends AbstractProcessor\n{\n\tpublic function beforeProcessing(&$context)\n\t{\n\t\t$media = R::findOne('media', 'mal_id = ? AND media = ?', [$context->key, Media::Anime]);\n\t\tif (empty($media))\n\t\t{\n\t\t\t$media = R::dispense('media');\n\t\t\t$media->mal_id = $context->key;\n\t\t\t$media->media = Media::Anime;\n\t\t\tR::store($media);\n\t\t}\n\t\t$context->media = $media;\n\t}\n\n\tpublic function getSubProcessors($key)\n\t{\n\t\t$subProcessors = [];\n\t\t$subProcessors []= new MediaSubProcessorBasic(Media::Anime);\n\t\t$subProcessors []= new MediaSubProcessorGenres(Media::Anime);\n\t\t$subProcessors []= new MediaSubProcessorRelations(Media::Anime);\n\t\t$subProcessors []= new MediaSubProcessorFranchises(Media::Anime);\n\t\t$subProcessors []= new MediaSubProcessorRecommendations(Media::Anime);\n\t\t$subProcessors []= new AnimeSubProcessorBasic();\n\t\t$subProcessors []= new AnimeSubProcessorProducers();\n\t\treturn $subProcessors;\n\t}\n\n\tpublic function onProcessingError(&$context)\n\t{\n\t\tif ($context->exception instanceof BadProcessorKeyException)\n\t\t{\n\t\t\tDatabase::delete('mediagenre', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('mediarelation', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('mediarec', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('animeproducer', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('media', ['id' => $context->media->id]);\n\t\t}\n\t\tthrow $context->exception;\n\t}\n}\n"
  },
  {
    "path": "src/Processors/MangaProcessor.php",
    "content": "<?php\nclass MangaProcessor extends AbstractProcessor\n{\n\tpublic function beforeProcessing(&$context)\n\t{\n\t\t$media = R::findOne('media', 'mal_id = ? AND media = ?', [$context->key, Media::Manga]);\n\t\tif (empty($media))\n\t\t{\n\t\t\t$media = R::dispense('media');\n\t\t\t$media->mal_id = $context->key;\n\t\t\t$media->media = Media::Manga;\n\t\t\tR::store($media);\n\t\t}\n\t\t$context->media = $media;\n\t}\n\n\tpublic function getSubProcessors($key)\n\t{\n\t\t$subProcessors = [];\n\t\t$subProcessors []= new MediaSubProcessorBasic(Media::Manga);\n\t\t$subProcessors []= new MediaSubProcessorGenres(Media::Manga);\n\t\t$subProcessors []= new MediaSubProcessorRelations(Media::Manga);\n\t\t$subProcessors []= new MediaSubProcessorFranchises(Media::Manga);\n\t\t$subProcessors []= new MediaSubProcessorRecommendations(Media::Manga);\n\t\t$subProcessors []= new MangaSubProcessorBasic();\n\t\t$subProcessors []= new MangaSubProcessorAuthors();\n\t\treturn $subProcessors;\n\t}\n\n\tpublic function onProcessingError(&$context)\n\t{\n\t\tif ($context->exception instanceof BadProcessorKeyException)\n\t\t{\n\t\t\tDatabase::delete('mediagenre', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('mediarelation', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('mediarec', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('mangaauthor', ['media_id' => $context->media->id]);\n\t\t\tDatabase::delete('media', ['id' => $context->media->id]);\n\t\t}\n\t\tthrow $context->exception;\n\t}\n}\n"
  },
  {
    "path": "src/Processors/ProcessingContext.php",
    "content": "<?php\nclass ProcessingContext\n{\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/AbstractSubProcessor.php",
    "content": "<?php\nabstract class AbstractSubProcessor\n{\n\tstatic $domCache = [];\n\n\tprotected static function getDOM(Document $document)\n\t{\n\t\tif (isset(self::$domCache[$document->url]))\n\t\t\treturn self::$domCache[$document->url];\n\n\t\t$dom = new DOMDocument;\n\t\t$dom->preserveWhiteSpace = false;\n\t\tErrorHandler::suppress();\n\t\t$dom->loadHTML($document->content);\n\t\tErrorHandler::restore();\n\n\t\tif (count(self::$domCache) > 20)\n\t\t\tself::$domCache = [];\n\t\tself::$domCache[$document->url] = $dom;\n\t\treturn $dom;\n\t}\n\n\tprotected static function getNodeValue(DOMXPath $xpath, $query, DOMNode $parentNode = null, $attrib = null)\n\t{\n\t\t$node = $xpath->query($query, $parentNode)->item(0);\n\t\tif (!empty($node))\n\t\t{\n\t\t\treturn $attrib\n\t\t\t\t? $node->getAttribute($attrib)\n\t\t\t\t: $node->nodeValue;\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic abstract function process(array $documents, &$context);\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/AnimeSubProcessorBasic.php",
    "content": "<?php\nclass AnimeSubProcessorBasic extends MediaSubProcessor\n{\n    public function __construct()\n    {\n        parent::__construct(Media::Anime);\n    }\n\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n\n        $dom = self::getDOM($document);\n\n        $xpath = new DOMXPath($dom);\n\n        $source = self::getNodeValue($xpath, '//span[text() = \\'Source:\\']/../a');\n\n        if ($source === null) {\n            $source = self::getNodeValue($xpath, '//span[text() = \\'Source:\\']/following-sibling::node()[self::text()]');\n        }\n\n        $source = strtolower(Strings::removeSpaces($source));\n\n        $source = Strings::makeEnum($source, [\n            'original' => AnimeMediaSource::ORIGINAL,\n            'manga' => AnimeMediaSource::MANGA,\n            '4-koma manga' => AnimeMediaSource::FOUR_KOMA_MANGA,\n            'web manga' => AnimeMediaSource::WEB_MANGA,\n            'novel' => AnimeMediaSource::NOVEL,\n            'light novel' => AnimeMediaSource::LIGHT_NOVEL,\n            'visual novel' => AnimeMediaSource::VISUAL_NOVEL,\n            'game' => AnimeMediaSource::GAME,\n            'card game' => AnimeMediaSource::CARD_GAME,\n            'book' => AnimeMediaSource::BOOK,\n            'picture book' => AnimeMediaSource::PICTURE_BOOK,\n            'radio' => AnimeMediaSource::RADIO,\n            'music' => AnimeMediaSource::MUSIC,\n            'web novel' => AnimeMediaSource::WEB_NOVEL,\n            'mixed media' => AnimeMediaSource::MIXED_MEDIA,\n        ], AnimeMediaSource::UNKNOWN);\n\n        preg_match_all('#([0-9]+) (hr|min|sec)#', self::getNodeValue($xpath, '//span[text() = \\'Duration:\\']/following-sibling::node()[self::text()]'), $matches);\n\n        array_reverse($matches);\n\n        $duration = 0;\n\n        foreach ($matches[1] as $key => $value) {\n            switch ($matches[2][$key]) {\n                case 'hr':\n                    $duration += $value * 60;\n\n                    break;\n                case 'min':\n                    $duration += $value;\n\n                    break;\n                case 'sec':\n                    $duration++;\n\n                    break;\n            }\n        }\n\n        preg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \\'Episodes:\\']/following-sibling::node()[self::text()]'), $matches);\n\n        $episodes = Strings::makeInteger($matches[0][0]);\n\n        $media = &$context->media;\n\n        $media->source = $source;\n        $media->duration = $duration;\n        $media->episodes = $episodes;\n\n        R::store($media);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/AnimeSubProcessorProducers.php",
    "content": "<?php\nclass AnimeSubProcessorProducers extends MediaSubProcessor\n{\n    public function __construct()\n    {\n        parent::__construct(Media::Anime);\n    }\n    \n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n        \n        $dom = self::getDOM($document);\n        \n        $xpath = new DOMXPath($dom);\n        \n        Database::delete(\n            'animeproducer',\n            [\n                'media_id' => $context->media->id\n            ]\n        );\n        \n        $data = [];\n        \n        foreach ($xpath->query('//span[text() = \\'Studios:\\']/../a') as $node) {\n            if (!preg_match('#/producer/([0-9]+)/#', $node->getAttribute('href'), $matches)) {\n                continue;\n            }\n            \n            $producerIdMal = Strings::makeInteger($matches[1]);\n            \n            $producerName = Strings::removeSpaces($node->textContent);\n            \n            $data[] = [\n                'media_id' => $context->media->id,\n                'mal_id' => $producerIdMal,\n                'name' => $producerName,\n            ];\n        }\n        \n        Database::insert('animeproducer', $data);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MangaSubProcessorAuthors.php",
    "content": "<?php\nclass MangaSubProcessorAuthors extends MediaSubProcessor\n{\n    public function __construct()\n    {\n        parent::__construct(Media::Manga);\n    }\n    \n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n        \n        $dom = self::getDOM($document);\n        \n        $xpath = new DOMXPath($dom);\n        \n        Database::delete(\n            'mangaauthor',\n            [\n                'media_id' => $context->media->id\n            ]\n        );\n        \n        $data = [];\n        \n        foreach ($xpath->query('//span[text() = \\'Authors:\\']/../a') as $node) {\n            if (!preg_match('#/people/([0-9]+)/#', $node->getAttribute('href'), $matches)) {\n                continue;\n            }\n            \n            $authorIdMal = Strings::makeInteger($matches[1]);\n            \n            $authorName = Strings::removeSpaces($node->nodeValue);\n            \n            $data[] = [\n                'media_id' => $context->media->id,\n                'mal_id' => $authorIdMal,\n                'name' => $authorName\n            ];\n        }\n        \n        Database::insert('mangaauthor', $data);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MangaSubProcessorBasic.php",
    "content": "<?php\nclass MangaSubProcessorBasic extends MediaSubProcessor\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct(Media::Manga);\n\t}\n\n\tpublic function process(array $documents, &$context)\n\t{\n\t\t$doc = $documents[self::URL_MEDIA];\n\t\t$dom = self::getDOM($doc);\n\t\t$xpath = new DOMXPath($dom);\n\n\t\t//chapter count\n\t\tpreg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \\'Chapters:\\']/following-sibling::node()[self::text()]'), $matches);\n\t\t$chapterCount = Strings::makeInteger($matches[0][0]);\n\n\t\t//volume count\n\t\tpreg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \\'Volumes:\\']/following-sibling::node()[self::text()]'), $matches);\n\t\t$volumeCount = Strings::makeInteger($matches[0][0]);\n\n\t\t//serialization\n\t\t$serializationMalId = null;\n\t\t$serializationName = null;\n\t\t$q = $xpath->query('//span[text() = \\'Serialization:\\']/../a');\n\t\tif ($q->length > 0)\n\t\t{\n\t\t\t$node = $q->item(0);\n\t\t\tpreg_match('#/magazine/([0-9]+)/#', $node->getAttribute('href'), $matches);\n\t\t\t$serializationMalId = Strings::makeInteger($matches[1]);\n\t\t\t$serializationName = Strings::removeSpaces($q->item(0)->nodeValue);\n\t\t}\n\n\t\t$media = &$context->media;\n\t\t$media->chapters = $chapterCount;\n\t\t$media->volumes = $volumeCount;\n\t\t$media->serialization_id = $serializationMalId;\n\t\t$media->serialization_name = $serializationName;\n\t\tR::store($media);\n\t}\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessor.php",
    "content": "<?php\nabstract class MediaSubProcessor extends AbstractSubProcessor\n{\n\tconst URL_MEDIA = 0;\n\tconst URL_RECS = 1;\n\tprotected $media;\n\n\tpublic function __construct($media)\n\t{\n\t\t$this->media = $media;\n\t}\n\n\tpublic function getURLs($id)\n\t{\n\t\t$infix = Media::toString($this->media);\n\t\tif ($infix === null)\n\t\t\tthrow new BadMediaException();\n\n\t\treturn\n\t\t[\n\t\t\tself::URL_MEDIA => 'https://myanimelist.net/' . $infix . '/' . $id,\n\t\t\tself::URL_RECS => 'https://myanimelist.net/' . $infix . '/' . $id . '/dummy/userrecs',\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessorBasic.php",
    "content": "<?php\nclass MediaSubProcessorBasic extends MediaSubProcessor\n{\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n\n        $dom = self::getDOM($document);\n\n        $xpath = new DOMXPath($dom);\n\n        if ($xpath->query('//div[@class = \\'error404\\']')->length >= 1) {\n            throw new BadProcessorKeyException($context->key);\n        }\n\n        $title = self::getNodeValue($xpath, '//meta[@property = \\'og:title\\']', null, 'content');\n\n        if ($title === null) {\n            throw new BadProcessorDocumentException($document, 'empty title');\n        }\n\n        $title = Strings::removeSpaces($title);\n\n        if ($title === '') {\n            throw new BadProcessorDocumentException($document, 'empty title');\n        }\n\n        $type = self::getNodeValue($xpath, '//span[text() = \\'Type:\\']/../a');\n\n        if ($type === null) {\n            $type = self::getNodeValue($xpath, '//span[text() = \\'Type:\\']/following-sibling::node()[self::text()]');\n        }\n\n        $type = strtolower(Strings::removeSpaces($type));\n\n        $typeUnknown = $this->media === Media::Manga ? MangaMediaType::Unknown : AnimeMediaType::Unknown;\n\n        $type = Strings::makeEnum($type, [\n            'tv' => AnimeMediaType::TV,\n            'ova' => AnimeMediaType::OVA,\n            'movie' => AnimeMediaType::Movie,\n            'special' => AnimeMediaType::Special,\n            'ona' => AnimeMediaType::ONA,\n            'music' => AnimeMediaType::Music,\n            'cm' => AnimeMediaType::CM,\n            'pv' => AnimeMediaType::PV,\n            'tv special' => AnimeMediaType::TV_Special,\n            'manga' => MangaMediaType::Manga,\n            'novel' => MangaMediaType::Novel,\n            'light novel' => MangaMediaType::LightNovel,\n            'one-shot' => MangaMediaType::Oneshot,\n            'doujinshi' => MangaMediaType::Doujinshi,\n            'manhwa' => MangaMediaType::Manhwa,\n            'manhua' => MangaMediaType::Manhua\n        ], $typeUnknown);\n\n        $image = self::getNodeValue($xpath, '//meta[@property = \\'og:image\\']', null, 'content');\n\n        $score = Strings::makeFloat(self::getNodeValue($xpath, '//span[@itemprop = \\'ratingValue\\']'));\n\n        if (!$score) {\n            $score = Strings::makeFloat(self::getNodeValue($xpath, '//span[text() = \\'Score:\\']/following-sibling::node()[self::text()]'));\n        }\n\n        $scoredByUsers = Strings::makeInteger(self::getNodeValue($xpath, '//span[@itemprop = \\'ratingCount\\']'));\n\n        if (!$scoredByUsers) {\n            $scoredByUsers = Strings::extractInteger(self::getNodeValue($xpath, '//small[starts-with(text(), \\'(scored by\\')]'));\n        }\n\n        $ranked = Strings::makeInteger(self::getNodeValue($xpath, '//span[text() = \\'Ranked:\\']/following-sibling::node()[self::text()]'));\n\n        $popularity = Strings::makeInteger(self::getNodeValue($xpath, '//span[text() = \\'Popularity:\\']/following-sibling::node()[self::text()]'));\n\n        $members = Strings::makeInteger(self::getNodeValue($xpath, '//span[text() = \\'Members:\\']/following-sibling::node()[self::text()]'));\n\n        $favorites = Strings::makeInteger(self::getNodeValue($xpath, '//span[text() = \\'Favorites:\\']/following-sibling::node()[self::text()]'));\n\n        $status = strtolower(Strings::removeSpaces(self::getNodeValue($xpath, '//span[text() = \\'Status:\\']/following-sibling::node()[self::text()]')));\n\n        $status = Strings::makeEnum($status, [\n            'not yet published' => MediaStatus::NotYetPublished,\n            'not yet aired' => MediaStatus::NotYetPublished,\n            'publishing' => MediaStatus::Publishing,\n            'currently airing' => MediaStatus::Publishing,\n            'on hiatus' => MediaStatus::Hiatus,\n            'discontinued' => MediaStatus::Discontinued,\n            'finished' => MediaStatus::Finished,\n            'finished airing' => MediaStatus::Finished\n        ], null);\n\n        if ($status === null) {\n            throw new BadProcessorDocumentException($document, 'unknown status: ' . $status);\n        }\n\n        $published = Strings::removeSpaces(self::getNodeValue($xpath, '//span[text() = \\'Aired:\\' or text() = \\'Published:\\']/following-sibling::node()[self::text()]'));\n\n        $position = strrpos($published, ' to ');\n\n        if ($position !== false) {\n            $publishedFrom = Strings::makeDate(substr($published, 0, $position));\n\n            $publishedTo = Strings::makeDate(substr($published, $position + 4));\n        } else {\n            $publishedFrom = Strings::makeDate($published);\n\n            $publishedTo = Strings::makeDate($published);\n        }\n\n        $media = &$context->media;\n\n        $media->media = $this->media;\n        $media->title = $title;\n        $media->sub_type = $type;\n        $media->picture_url = $image;\n        $media->average_score = $score;\n        $media->average_score_users = $scoredByUsers;\n        $media->publishing_status = $status;\n        $media->popularity = $popularity;\n        $media->members = $members;\n        $media->favorites = $favorites;\n        $media->ranking = $ranked;\n        $media->published_from = $publishedFrom;\n        $media->published_to = $publishedTo;\n        $media->processed = date('Y-m-d H:i:s');\n\n        R::store($media);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessorFranchises.php",
    "content": "<?php\nclass MediaSubProcessorFranchises extends MediaSubProcessor\n{\n\tprivate static function mediaToKey($mediaRow)\n\t{\n\t\t$mediaArray = (array) $mediaRow;\n\t\treturn $mediaRow['media'] . $mediaRow['mal_id'];\n\t}\n\n\tpublic function process(array $documents, &$context)\n\t{\n\t\t$franchiseIds = [];\n\t\t$franchiseIds []= self::mediaToKey($context->media);\n\t\tforeach ($context->relationData as $relation)\n\t\t{\n\t\t\tif ($relation['media'] != $context->media->media)\n\t\t\t\tcontinue;\n\t\t\tif ($relation['type'] == MediaRelation::Character || $relation['type'] == MediaRelation::Other)\n\t\t\t\tcontinue;\n\t\t\tif (BanHelper::isFranchiseCouplingBanned($relation['media'], $relation['mal_id'], $context->media->media, $context->media->mal_id))\n\t\t\t\tcontinue;\n\n\t\t\t$franchiseIds []= self::mediaToKey($relation);\n\t\t}\n\t\tforeach (R::findAll('media', 'media||mal_id IN (' . R::genSlots($franchiseIds) . ')', $franchiseIds) as $relatedMedia)\n\t\t{\n\t\t\t$franchiseIds []= $relatedMedia->franchise;\n\t\t}\n\n\t\t$franchiseId = reset($franchiseIds);\n\n\t\t$media = &$context->media;\n\t\t$media->franchise = $franchiseId;\n\t\tR::store($media);\n\n\t\t$query = 'UPDATE media SET franchise = ? WHERE franchise IN (' . R::genSlots($franchiseIds) . ')';\n\t\tR::exec($query, array_merge([$franchiseId], $franchiseIds));\n\t}\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessorGenres.php",
    "content": "<?php\nclass MediaSubProcessorGenres extends MediaSubProcessor\n{\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n\n        $dom = self::getDOM($document);\n\n        $xpath = new DOMXPath($dom);\n\n        Database::delete(\n            'mediagenre',\n            [\n                'media_id' => $context->media->id\n            ]\n        );\n\n        $data = [];\n\n        foreach (['Genre', 'Genres', 'Explicit Genre', 'Explicit Genres', 'Demographic', 'Demographics', 'Theme', 'Themes'] as $text)\n        {\n            foreach ($xpath->query('//span[text() = \\'' . $text . ':\\']/../a') as $node) {\n                if (!preg_match('#/genre/([0-9]+)/#', $node->getAttribute('href'), $matches)) {\n                    continue;\n                }\n\n                $genreIdMal = Strings::makeInteger($matches[1]);\n\n                $genreName = Strings::removeSpaces($node->textContent);\n\n                $data[] = [\n                    'media_id' => $context->media->id,\n                    'mal_id' => $genreIdMal,\n                    'name' => $genreName\n                ];\n            }\n        }\n\n        Database::insert('mediagenre', $data);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessorRecommendations.php",
    "content": "<?php\nclass MediaSubProcessorRecommendations extends MediaSubProcessor\n{\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_RECS];\n        \n        $dom = self::getDOM($document);\n        \n        $xpath = new DOMXPath($dom);\n        \n        Database::delete('mediarec', [\n            'media_id' => $context->media->id\n        ]);\n        \n        $data = [];\n        \n        foreach ($xpath->query('//div[@class = \\'borderClass\\']') as $node) {\n            preg_match('#/([0-9]+)/#', self::getNodeValue($xpath, './/strong/..', $node, 'href'), $matches);\n            \n            $idMal = Strings::makeInteger($matches[1]);\n            \n            $count = 1 + Strings::makeInteger(self::getNodeValue($xpath, './/div[@class = \\'spaceit\\']//strong', $node));\n            \n            $data[] = [\n                'media_id' => $context->media->id,\n                'mal_id' => $idMal,\n                'count' => $count\n            ];\n        }\n        \n        Database::insert('mediarec', $data);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/MediaSubProcessorRelations.php",
    "content": "<?php\nclass MediaSubProcessorRelations extends MediaSubProcessor\n{\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_MEDIA];\n\n        $dom = self::getDOM($document);\n\n        $xpath = new DOMXPath($dom);\n\n        Database::delete('mediarelation', [\n            'media_id' => $context->media->id\n        ]);\n\n        $data = [];\n\n        foreach ($xpath->query('//div[@class = \\'entries-tile\\']//div[@class = \\'content\\']') as $node) {\n            $typeMal = strtolower(Strings::removeSpaces(preg_replace('#\\(.+\\)#', '', $node->childNodes[1]->textContent)));\n\n            $type = Strings::makeEnum($typeMal, [\n                'adaptation' => MediaRelation::Adaptation,\n                'alternative setting' => MediaRelation::AlternativeSetting,\n                'alternative version' => MediaRelation::AlternativeVersion,\n                'character' => MediaRelation::Character,\n                'full story' => MediaRelation::FullStory,\n                'other' => MediaRelation::Other,\n                'parent story' => MediaRelation::ParentStory,\n                'prequel' => MediaRelation::Prequel,\n                'sequel' => MediaRelation::Sequel,\n                'side story' => MediaRelation::SideStory,\n                'spin-off' => MediaRelation::SpinOff,\n                'summary' => MediaRelation::Summary\n            ], null);\n\n            if ($type === null) {\n                throw new BadProcessorDocumentException($document, 'unknown relation type: ' . $typeMal);\n            }\n\n            $links = $node->getElementsByTagName('a');\n\n            foreach ($links as $link) {\n                $link = $link->getAttribute('href');\n\n                if (preg_match('#/(anime|manga)/([0-9]+)/#', $link, $matches)) {\n                    $idMal = Strings::makeInteger($matches[2]);\n\n                    if ($matches[1] === 'anime') {\n                        $media = Media::Anime;\n                    } elseif ($matches[1] === 'manga') {\n                        $media = Media::Manga;\n                    }\n\n                    $data[] = [\n                        'media_id' => $context->media->id,\n                        'mal_id' => $idMal,\n                        'media' => $media,\n                        'type' => $type\n                    ];\n                }\n            }\n        }\n\n        foreach ($xpath->query('//table[@class = \\'entries-table\\']/tr') as $node) {\n            $typeMal = strtolower(rtrim(Strings::removeSpaces($node->childNodes[1]->textContent), ':'));\n\n            $type = Strings::makeEnum($typeMal, [\n                'adaptation' => MediaRelation::Adaptation,\n                'alternative setting' => MediaRelation::AlternativeSetting,\n                'alternative version' => MediaRelation::AlternativeVersion,\n                'character' => MediaRelation::Character,\n                'full story' => MediaRelation::FullStory,\n                'other' => MediaRelation::Other,\n                'parent story' => MediaRelation::ParentStory,\n                'prequel' => MediaRelation::Prequel,\n                'sequel' => MediaRelation::Sequel,\n                'side story' => MediaRelation::SideStory,\n                'spin-off' => MediaRelation::SpinOff,\n                'summary' => MediaRelation::Summary\n            ], null);\n\n            if ($type === null) {\n                throw new BadProcessorDocumentException($document, 'unknown relation type: ' . $typeMal);\n            }\n\n            $links = $node->getElementsByTagName('a');\n\n            foreach ($links as $link) {\n                $link = $link->getAttribute('href');\n\n                if (preg_match('#/(anime|manga)/([0-9]+)/#', $link, $matches)) {\n                    $idMal = Strings::makeInteger($matches[2]);\n\n                    if ($matches[1] === 'anime') {\n                        $media = Media::Anime;\n                    } elseif ($matches[1] === 'manga') {\n                        $media = Media::Manga;\n                    }\n\n                    $data[] = [\n                        'media_id' => $context->media->id,\n                        'mal_id' => $idMal,\n                        'media' => $media,\n                        'type' => $type\n                    ];\n                }\n            }\n        }\n\n        Database::insert('mediarelation', $data);\n\n        $context->relationData = $data;\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserMediaSubProcessor.php",
    "content": "<?php\nabstract class UserMediaSubProcessor extends AbstractSubProcessor\n{\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserMediaSubProcessorBasic.php",
    "content": "<?php\nclass UserMediaSubProcessorBasic extends UserMediaSubProcessor\n{\n\tprivate $anime = 0;\n\n    private $animeArray = [];\n\n    private $manga = 0;\n\n    private $mangaArray = [];\n\n    public function setAnimeRange($max = 0)\n    {\n        $this->anime = intval((ceil($max / 300) ?: 1) * 300 - 300);\n    }\n\n    public function setMangaRange($max = 0)\n    {\n        $this->manga = intval((ceil($max / 300) ?: 1) * 300 - 300);\n    }\n\n\tpublic function getURLs($name)\n\t{\n        $i = 0;\n\n        foreach (range(0, $this->anime, 300) as $offset)\n        {\n            $this->animeArray[$i] = 'https://myanimelist.net/animelist/' . $name . '/load.json?status=7&offset=' . $offset;\n\n            $i++;\n        }\n\n        foreach (range(0, $this->manga, 300) as $offset)\n        {\n            $this->mangaArray[$i] = 'https://myanimelist.net/mangalist/' . $name . '/load.json?status=7&offset=' . $offset;\n\n            $i++;\n        }\n\n        return array_merge($this->animeArray, $this->mangaArray);\n\t}\n\n\tpublic function process(array $documents, &$context)\n\t{\n\t\tDatabase::delete('usermedia', ['user_id' => $context->user->id]);\n\n        $year = date('y', strtotime('+26 hour'));\n\n        foreach (Media::getConstList() as $media) {\n\t\t\t$data = [];\n\n            $range = $media === Media::Anime ? array_keys($this->animeArray) : array_keys($this->mangaArray);\n\n            foreach ($range as $offset)\n            {\n                $nodes = json_decode(str_replace('<?xml encoding=\"utf-8\"?>', '', $documents[$offset]->content), true);\n\n                if (!is_array($nodes))\n                {\n                    throw new BadProcessorDocumentException($documents[$offset], 'list is only partially downloaded');\n                }\n                elseif (isset($nodes['errors']))\n                {\n                    $data = [];\n\n                    break;\n                }\n\n\t\t\tforeach ($nodes as $root)\n\t\t\t{\n\t\t\t\t$mediaMalId = Strings::makeInteger($media === Media::Anime ? $root['anime_id'] : $root['manga_id']);\n\t\t\t\t$score      = Strings::makeInteger($root['score']);\n\n                $startDate = $root['start_date_string'] ?? '';\n\n                if (preg_match('#^\\d{2}-\\d{2}-\\d{2}$#', $startDate))\n                {\n                    [$m, $d, $y] = explode('-', $startDate);\n\n                    $startDate = sprintf('%4$s%3$s-%1$s-%2$s', $m, $d, $y, $y > $year ? '19' : '20');\n                }\n                else\n                {\n                    $startDate = '0000-00-00';\n                }\n\n                $finishDate = $root['finish_date_string'] ?? '';\n\n                if (preg_match('#^\\d{2}-\\d{2}-\\d{2}$#', $finishDate))\n                {\n                    [$m, $d, $y] = explode('-', $finishDate);\n\n                    $finishDate = sprintf('%4$s%3$s-%1$s-%2$s', $m, $d, $y, $y > $year ? '19' : '20');\n                }\n                else\n                {\n                    $finishDate = '0000-00-00';\n                }\n\n\t\t\t\t$status     = Strings::makeEnum($root['status'], [\n\t\t\t\t\t1 => UserListStatus::Completing,\n\t\t\t\t\t2 => UserListStatus::Finished,\n\t\t\t\t\t3 => UserListStatus::OnHold,\n\t\t\t\t\t4 => UserListStatus::Dropped,\n\t\t\t\t\t6 => UserListStatus::Planned\n\t\t\t\t], UserListStatus::Unknown);\n\n\t\t\t\t$finishedEpisodes = null;\n\t\t\t\t$finishedChapters = null;\n\t\t\t\t$finishedVolumes = null;\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime:\n                        $finishedEpisodes = Strings::makeInteger($root['num_watched_episodes']);\n                        \n                        if ($root['is_rewatching'])\n                        {\n                            $finishedEpisodes = Strings::makeInteger($root['anime_num_episodes']);\n                        }\n                        \n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Media::Manga:\n\t\t\t\t\t\t$finishedChapters = Strings::makeInteger($root['num_read_chapters']);\n\t\t\t\t\t\t$finishedVolumes  = Strings::makeInteger($root['num_read_volumes']);\n\n                        if ($root['is_rereading'])\n                        {\n                            $finishedChapters = Strings::makeInteger($root['manga_num_chapters']);\n                            $finishedVolumes  = Strings::makeInteger($root['manga_num_volumes']);\n                        }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new BadMediaException();\n\t\t\t\t}\n\n\t\t\t\t$data [] = [\n\t\t\t\t\t'user_id' => $context->user->id,\n\t\t\t\t\t'mal_id' => $mediaMalId,\n\t\t\t\t\t'media' => $media,\n\t\t\t\t\t'score' => $score,\n\t\t\t\t\t'start_date' => $startDate,\n\t\t\t\t\t'end_date' => $finishDate,\n\t\t\t\t\t'finished_episodes' => $finishedEpisodes,\n\t\t\t\t\t'finished_chapters' => $finishedChapters,\n\t\t\t\t\t'finished_volumes' => $finishedVolumes,\n\t\t\t\t\t'status' => $status,\n\t\t\t\t];\n\t\t\t}\n            }\n\n            $ydm = false;\n\n            foreach ($data as $entry)\n            {\n                [, $m, $d] = explode('-', $entry['start_date']);\n\n                if (intval($m) > 12)\n                {\n                    $ydm = true;\n\n                    break;\n                }\n\n                if (intval($d) > 12)\n                {\n                    break;\n                }\n\n                [, $m, $d] = explode('-', $entry['end_date']);\n\n                if (intval($m) > 12)\n                {\n                    $ydm = true;\n\n                    break;\n                }\n\n                if (intval($d) > 12)\n                {\n                    break;\n                }\n            }\n\n            if ($ydm)\n            {\n                foreach ($data as $key => $entry)\n                {\n                    $data[$key]['start_date'] = sprintf('%1$s-%3$s-%2$s', ...explode('-', $entry['start_date']));\n\n                    $data[$key]['end_date'] = sprintf('%1$s-%3$s-%2$s', ...explode('-', $entry['end_date']));\n                }\n            }\n\n\t\t\tDatabase::insert('usermedia', $data);\n\n\t\t\t$user = &$context->user;\n\n\t\t\tR::store($user);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserSubProcessor.php",
    "content": "<?php\nabstract class UserSubProcessor extends AbstractSubProcessor\n{\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserSubProcessorFriends.php",
    "content": "<?php\nclass UserSubProcessorFriends extends UserSubProcessor\n{\n\tconst URL_FRIENDS = 0;\n\n\tpublic function getURLs($userName)\n\t{\n\t\treturn\n\t\t[\n            self::URL_FRIENDS => 'https://myanimelist.net/profile/' . $userName . '/friends',\n\t\t];\n\t}\n\n\tpublic function process(array $documents, &$context)\n\t{\n        $doc = $documents[self::URL_FRIENDS];\n\t\t$dom = self::getDOM($doc);\n\t\t$xpath = new DOMXPath($dom);\n\t\tDatabase::delete('userfriend', ['user_id' => $context->user->id]);\n\t\t$data = [];\n\t\tforeach ($xpath->query('//a[contains(@href, \\'profile\\')]/strong') as $node)\n\t\t{\n\t\t\t$friendName = Strings::removeSpaces($node->nodeValue);\n\t\t\t$data []= [\n\t\t\t\t'user_id' => $context->user->id,\n\t\t\t\t'name' => $friendName\n\t\t\t];\n\t\t}\n\t\tDatabase::insert('userfriend', $data);\n\t}\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserSubProcessorHistory.php",
    "content": "<?php\nclass UserSubProcessorHistory extends UserSubProcessor\n{\n    const URL_ANIME_HISTORY = 0;\n    const URL_MANGA_HISTORY = 1;\n\n    public function getURLs($username)\n    {\n        return [\n            self::URL_ANIME_HISTORY => 'https://myanimelist.net/history/' . $username . '/anime',\n            self::URL_MANGA_HISTORY => 'https://myanimelist.net/history/' . $username . '/manga',\n        ];\n    }\n\n    public function process(array $documents, &$context)\n    {\n        Database::delete('userhistory', [\n            'user_id' => $context->user->id,\n        ]);\n\n        $data = [];\n\n        foreach ([self::URL_ANIME_HISTORY, self::URL_MANGA_HISTORY] as $k)\n        {\n            $document = $documents[$k];\n\n            $dom = self::getDOM($document);\n\n            $xpath = new DOMXPath($dom);\n\n            foreach ($xpath->query('//table//td[@class = \\'borderClass\\']/..') as $node)\n            {\n                $link = $node->childNodes->item(0)->childNodes->item(0)->getAttribute('href');\n\n                if (!preg_match('#([0-9]+)$#', $link, $matches))\n                {\n                    continue;\n                }\n\n                $media = strpos($link, 'manga') !== false ? Media::Manga : Media::Anime;\n\n                $idMal = intval($matches[0]);\n\n                $progress = Strings::makeInteger($node->childNodes->item(0)->getElementsByTagName('strong')->item(0)->nodeValue);\n\n                $time = time();\n\n                if (isset($document->headers['Date']))\n                {\n                    date_default_timezone_set('UTC');\n\n                    $time = strtotime($document->headers['Date']);\n                }\n\n                date_default_timezone_set('America/Los_Angeles');\n\n                $y = date('Y', $time);\n\n                $m = date('m', $time);\n\n                $d = date('d', $time);\n\n                $h = date('H', $time);\n\n                $i = date('i', $time);\n\n                $s = date('s', $time);\n\n                $date = $node->childNodes->item(1)->nodeValue;\n\n                if (preg_match('#([0-9]+) seconds? ago#i', $date, $matches))\n                {\n                    $s -= intval($matches[1]);\n                }\n                elseif (preg_match('#([0-9]+) minutes? ago#i', $date, $matches))\n                {\n                    $s -= intval($matches[1]) * 60;\n                }\n                elseif (preg_match('#([0-9]+) hours? ago#i', $date, $matches))\n                {\n                    $i -= intval($matches[1]) * 60;\n                }\n                elseif (preg_match('#Today, ([0-9]{1,2}):([0-9]{2}) (AM|PM)#i', $date, $matches))\n                {\n                    $h = intval($matches[1]);\n\n                    $i = intval($matches[2]);\n\n                    $h += $matches[3] === 'PM' && $h !== 12 ? 12 : 0;\n                }\n                elseif (preg_match('#Yesterday, ([0-9]{1,2}):([0-9]{2}) (AM|PM)#i', $date, $matches))\n                {\n                    $h = intval($matches[1]);\n\n                    $i = intval($matches[2]);\n\n                    $h += $matches[3] === 'PM' && $h !== 12 ? 12 : 0;\n\n                    $h -= 24;\n                }\n                elseif (preg_match('#([a-z]+) ([0-9]{1,2}), ([0-9]{1,2}):([0-9]{2}) (AM|PM)#i', $date, $matches))\n                {\n                    $m = date_parse($matches[1]);\n\n                    $m = intval($m['month']);\n\n                    $d = intval($matches[2]);\n\n                    $h = intval($matches[3]);\n\n                    $i = intval($matches[4]);\n\n                    $h += $matches[5] === 'PM' && $h !== 12 ? 12 : 0;\n                }\n                elseif (preg_match('#([a-z]+) ([0-9]{1,2}), ([0-9]{4}) ([0-9]{1,2}):([0-9]{2}) (AM|PM)#i', $date, $matches))\n                {\n                    $m = date_parse($matches[1]);\n\n                    $m = intval($m['month']);\n\n                    $d = intval($matches[2]);\n\n                    $y = intval($matches[3]);\n\n                    $h = intval($matches[4]);\n\n                    $i = intval($matches[5]);\n\n                    $h += $matches[6] === 'PM' && $h !== 12 ? 12 : 0;\n                }\n\n                $timestamp = mktime($h, $i, $s, $m, $d, $y);\n\n                date_default_timezone_set('UTC');\n\n                $data[] = [\n                    'user_id' => $context->user->id,\n                    'mal_id' => $idMal,\n                    'media' => $media,\n                    'progress' => $progress,\n                    'timestamp' => date('Y-m-d H:i:s', $timestamp),\n                ];\n            }\n        }\n\n        Database::insert('userhistory', $data);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserSubProcessorProfile.php",
    "content": "<?php\nclass UserSubProcessorProfile extends UserSubProcessor\n{\n    const URL_PROFILE = 0;\n\n    public function getURLs($name)\n    {\n        return [\n            self::URL_PROFILE => 'https://myanimelist.net/profile/' . $name\n        ];\n    }\n\n    public function process(array $documents, &$context)\n    {\n        $document = $documents[self::URL_PROFILE];\n\n        $dom = self::getDOM($document);\n\n        $xpath = new DOMXPath($dom);\n\n        if ($xpath->query('//div[@class = \\'error404\\']')->length >= 1) {\n            throw new BadProcessorKeyException($context->key);\n        }\n\n        $name = Strings::removeSpaces(self::getNodeValue($xpath, '//h1//span'));\n        $name = substr($name, 0, strpos($name, '\\'s Profile'));\n        $name = Strings::removeSpaces($name);\n\n        if (empty($name)) {\n            throw new BadProcessorDocumentException($document, 'Username missing');\n        }\n\n        $image = self::getNodeValue($xpath, '//div[contains(@class, \\'user-image\\')]//img', null, 'data-src');\n\n        $joinDate = Strings::makeDate(self::getNodeValue($xpath, '//span[text() = \\'Joined\\']/following-sibling::span'));\n\n        $anime = Strings::makeInteger(self::getNodeValue($xpath, '//div[contains(@class, \\'anime\\')]//span[text() = \\'Total Entries\\']/following-sibling::span'));\n\n        $manga = Strings::makeInteger(self::getNodeValue($xpath, '//div[contains(@class, \\'manga\\')]//span[text() = \\'Total Entries\\']/following-sibling::span'));\n\n        $animere = Strings::makeInteger(self::getNodeValue($xpath, '//div[contains(@class, \\'anime\\')]//span[text() = \\'Rewatched\\']/following-sibling::span'));\n\n        $mangare = Strings::makeInteger(self::getNodeValue($xpath, '//div[contains(@class, \\'manga\\')]//span[text() = \\'Reread\\']/following-sibling::span'));\n\n        $user = &$context->user;\n\n        $user->name = $name;\n\n        $user->picture_url = $image;\n\n        $user->join_date = $joinDate;\n\n        $user->anime_days_spent = $anime;\n\n        $user->manga_days_spent = $manga;\n\n        $user->anime_views = $animere;\n\n        $user->manga_views = $mangare;\n\n        $user->processed = date('Y-m-d H:i:s');\n\n        R::store($user);\n    }\n}\n"
  },
  {
    "path": "src/Processors/SubProcessors/UserSubProcessorUserMedia.php",
    "content": "<?php\nclass UserSubProcessorUserMedia extends UserSubProcessor\n{\n\tconst URL_ANIMELIST = 0;\n\tconst URL_MANGALIST = 1;\n\tconst URL_ANIMEINFO = 2;\n\tconst URL_MANGAINFO = 3;\n\n\tpublic function getURLs($userName)\n\t{\n\t\treturn\n\t\t[\n\t\t\tself::URL_ANIMELIST => 'https://myanimelist.net/animelist/' . $userName . '?status=8',\n\t\t\tself::URL_MANGALIST => 'https://myanimelist.net/mangalist/' . $userName . '?status=8',\n\t\t\tself::URL_ANIMEINFO => 'https://myanimelist.net/malappinfo.php?u=' . $userName . '&status=all&type=anime',\n\t\t\tself::URL_MANGAINFO => 'https://myanimelist.net/malappinfo.php?u=' . $userName . '&status=all&type=manga',\n\t\t];\n\t}\n\n\tpublic function process(array $documents, &$context)\n\t{\n\t\tDatabase::delete('usermedia', ['user_id' => $context->user->id]);\n\n\t\t$context->user->cool = false;\n\n        foreach (Media::getConstList() as $media) {\n            $key = $media === Media::Anime ? self::URL_ANIMELIST : self::URL_MANGALIST;\n\n            $isPrivate = $documents[$key]->content === '403';\n\n\t\t\t$key = $media == Media::Anime\n\t\t\t\t? self::URL_ANIMEINFO\n\t\t\t\t: self::URL_MANGAINFO;\n\t\t\t$doc = $documents[$key];\n\t\t\t$dom = self::getDOM($doc);\n\t\t\t$xpath = new DOMXPath($dom);\n\t\t\tif ($xpath->query('//myinfo')->length == 0)\n\t\t\t\tthrow new BadProcessorDocumentException($doc, 'myinfo block is missing');\n\t\t\tif (strpos($doc->content, '</myanimelist>') === false)\n\t\t\t\tthrow new BadProcessorDocumentException($doc, 'list is only partially downloaded');\n\n\t\t\t$nodes = $xpath->query('//anime | //manga');\n\t\t\t$data = [];\n\t\t\tforeach ($nodes as $root)\n\t\t\t{\n\t\t\t\t$mediaMalId = Strings::makeInteger(self::getNodeValue($xpath, 'series_animedb_id | series_mangadb_id', $root));\n\t\t\t\t$score      = Strings::makeInteger(self::getNodeValue($xpath, 'my_score', $root));\n\t\t\t\t$startDate  = Strings::makeDate(self::getNodeValue($xpath, 'my_start_date', $root));\n\t\t\t\t$finishDate = Strings::makeDate(self::getNodeValue($xpath, 'my_finish_date', $root));\n\t\t\t\t$status     = Strings::makeEnum(self::getNodeValue($xpath, 'my_status', $root), [\n\t\t\t\t\t1 => UserListStatus::Completing,\n\t\t\t\t\t2 => UserListStatus::Finished,\n\t\t\t\t\t3 => UserListStatus::OnHold,\n\t\t\t\t\t4 => UserListStatus::Dropped,\n\t\t\t\t\t6 => UserListStatus::Planned\n\t\t\t\t], UserListStatus::Unknown);\n\n\t\t\t\t$finishedEpisodes = null;\n\t\t\t\t$finishedChapters = null;\n\t\t\t\t$finishedVolumes = null;\n\t\t\t\tswitch ($media)\n\t\t\t\t{\n\t\t\t\t\tcase Media::Anime:\n\t\t\t\t\t\t$finishedEpisodes = Strings::makeInteger(self::getNodeValue($xpath, 'my_watched_episodes', $root));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Media::Manga:\n\t\t\t\t\t\t$finishedChapters = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_chapters', $root));\n\t\t\t\t\t\t$finishedVolumes  = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_volumes', $root));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new BadMediaException();\n\t\t\t\t}\n\n\t\t\t\t$data [] = [\n\t\t\t\t\t'user_id' => $context->user->id,\n\t\t\t\t\t'mal_id' => $mediaMalId,\n\t\t\t\t\t'media' => $media,\n\t\t\t\t\t'score' => $score,\n\t\t\t\t\t'start_date' => $startDate,\n\t\t\t\t\t'end_date' => $finishDate,\n\t\t\t\t\t'finished_episodes' => $finishedEpisodes,\n\t\t\t\t\t'finished_chapters' => $finishedChapters,\n\t\t\t\t\t'finished_volumes' => $finishedVolumes,\n\t\t\t\t\t'status' => $status,\n\t\t\t\t];\n\t\t\t}\n\t\t\tDatabase::insert('usermedia', $data);\n\n\t\t\t$dist = RatingDistribution::fromEntries(ReflectionHelper::arraysToClasses($data));\n\n\t\t\t$daysSpent = Strings::makeFloat(self::getNodeValue($xpath, '//user_days_spent_watching'));\n\t\t\t$user = &$context->user;\n\t\t\t$user->{Media::toString($media) . '_days_spent'} = $daysSpent;\n\t\t\t$user->{Media::toString($media) . '_private'} = $isPrivate;\n\t\t\t$user->cool |= ($dist->getRatedCount() >= 50 and $dist->getStandardDeviation() >= 1.5);\n\t\t\tR::store($user);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/Processors/UserMediaProcessor.php",
    "content": "<?php\nclass UserMediaProcessor extends AbstractProcessor\n{\n    public function beforeProcessing(&$context)\n\t{\n\t\tDatabase::selectUser($context->key);\n\n\t\t$user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$context->key]);\n\n\t\tif (empty($user))\n\t\t{\n\t\t\t$user = R::dispense('user');\n\n\t\t\t$user->name = $context->key;\n\n\t\t\tR::store($user);\n\t\t}\n\n\t\t$context->user = $user;\n\t}\n\n\tpublic function getSubProcessors($key)\n\t{\n\t\t$userMediaSubProcessorBasic = new UserMediaSubProcessorBasic();\n\n        Database::selectUser($key);\n\n\t\t$user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$key]);\n\n\t\tif (!empty($user))\n\t\t{\n            $userMediaSubProcessorBasic->setAnimeRange($user->anime_days_spent ? ceil($user->anime_days_spent) : 0);\n\n            $userMediaSubProcessorBasic->setMangaRange($user->manga_days_spent ? ceil($user->manga_days_spent) : 0);\n\t\t}\n\n\t\t$subProcessors[] = $userMediaSubProcessorBasic;\n\n\t\treturn $subProcessors;\n\t}\n\n\tpublic function onProcessingError(&$context)\n\t{\n\t\tif ($context->exception instanceof BadProcessorKeyException)\n\t\t{\n\t\t\tDatabase::delete('userfriend', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('userhistory', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('usermedia', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('user', ['id' => $context->user->id]);\n\t\t}\n\n\t\tthrow $context->exception;\n\t}\n}\n"
  },
  {
    "path": "src/Processors/UserProcessor.php",
    "content": "<?php\nclass UserProcessor extends AbstractProcessor\n{\n\tpublic function beforeProcessing(&$context)\n\t{\n\t\tDatabase::selectUser($context->key);\n\t\t$user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$context->key]);\n\t\tif (empty($user))\n\t\t{\n\t\t\t$user = R::dispense('user');\n\t\t\t$user->name = $context->key;\n\t\t\tR::store($user);\n\t\t}\n\t\t$context->user = $user;\n\t}\n\n\tpublic function getSubProcessors($key)\n\t{\n\t\t$subProcessors = [];\n\t\t$subProcessors []= new UserSubProcessorProfile();\n\t\t//$subProcessors []= new UserSubProcessorFriends();\n\t\t$subProcessors []= new UserSubProcessorHistory();\n\t\t//$subProcessors []= new UserSubProcessorUserMedia();\n\t\treturn $subProcessors;\n\t}\n\n\tpublic function onProcessingError(&$context)\n\t{\n\t\tif ($context->exception instanceof BadProcessorKeyException)\n\t\t{\n\t\t\tDatabase::delete('userfriend', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('userhistory', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('usermedia', ['user_id' => $context->user->id]);\n\t\t\tDatabase::delete('user', ['id' => $context->user->id]);\n\t\t}\n\t\tthrow $context->exception;\n\t}\n}\n"
  },
  {
    "path": "src/Queue.php",
    "content": "<?php\nclass Queue\n{\n\tprivate $file = null;\n\tprivate $handle = null;\n\n\tpublic function __construct($file)\n\t{\n\t\t$this->file = $file;\n\t}\n\n\tpublic function seek(QueueItem $item)\n\t{\n\t\t$this->open();\n\t\t$items = $this->readItems();\n\t\t$this->close();\n\t\tforeach ($items as $index => $otherItem)\n\t\t{\n\t\t\tif ($otherItem->item == $item->item)\n\t\t\t\treturn $index + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function peek()\n\t{\n\t\t$this->open();\n\t\t$items = $this->readItems();\n\t\tif (count($items) > 0)\n\t\t\t$item = array_shift($items);\n\t\telse\n\t\t\t$item = null;\n\t\t$this->close();\n\t\treturn $item;\n\t}\n\n\tpublic function dequeue()\n\t{\n\t\t$this->open();\n\t\t$items = $this->readItems();\n\t\tif (count($items) > 0)\n\t\t\t$item = array_shift($items);\n\t\telse\n\t\t\t$item = null;\n\t\t$this->writeItems($items);\n\t\t$this->close();\n\t\treturn $item;\n\t}\n\n\tpublic function enqueue(QueueItem $newItem, $enqueueAtStart = false)\n\t{\n\t\t$this->enqueueMultiple([$newItem], $enqueueAtStart);\n\t}\n\n\tpublic function enqueueMultiple(array $newItems, $enqueueAtStart = false)\n\t{\n\t\t$this->open();\n\t\t$items = $this->readItems();\n\n\t\t$oldItemKeys = array_flip(array_map(function($oldItem)\n\t\t{\n\t\t\treturn $oldItem->item;\n\t\t}, $items));\n\t\t$newItems = array_filter($newItems, function($newItem) use ($oldItemKeys)\n\t\t{\n\t\t\treturn !isset($oldItemKeys[$newItem->item]);\n\t\t});\n\n\t\tif ($enqueueAtStart)\n\t\t{\n\t\t\tarray_splice($items, 0, 0, $newItems);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tarray_splice($items, count($items), 0, $newItems);\n\t\t}\n\t\t$this->writeItems($items);\n\t\t$this->close();\n\t}\n\n\tpublic function size()\n\t{\n\t\t$this->open();\n\t\t$items = $this->readItems();\n\t\t$this->close();\n\t\treturn count($items);\n\t}\n\n\n\n\tprivate function open()\n\t{\n\t\t$this->handle = fopen($this->file, 'r+b');\n\t\tflock($this->handle, LOCK_EX);\n\t}\n\n\tprivate function itemFromLine($line)\n\t{\n\t\tif (strpos($line, \"\\t\") === false)\n\t\t{\n\t\t\t$item = $line;\n\t\t\t$attempts = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlist ($item, $attempts) = explode(\"\\t\", $line);\n\t\t\t$attempts = intval($attempts);\n\t\t}\n\t\treturn new QueueItem($item, $attempts);\n\t}\n\n\tprivate function lineFromItem(QueueItem $item)\n\t{\n\t\treturn $item->item . \"\\t\" . $item->attempts;\n\t}\n\n\tprivate function readItems()\n\t{\n\t\tassert($this->handle != null);\n\t\tfseek($this->handle, 0, SEEK_END);\n\t\t$size = ftell($this->handle);\n\t\tfseek($this->handle, 0, SEEK_SET);\n\t\t$data = $size > 0\n\t\t\t? fread($this->handle, $size)\n\t\t\t: null;\n\t\t$lines = isset($data) ? explode(\"\\n\", $data) : [];\n\t\t$lines = array_filter($lines);\n\t\treturn array_map([__CLASS__, 'itemFromLine'], $lines);\n\t}\n\n\tprivate function writeItems($items)\n\t{\n\t\t$lines = array_map([__CLASS__, 'lineFromItem'], $items);\n\t\t$data = join(\"\\n\", $lines);\n\t\tfseek($this->handle, 0, SEEK_SET);\n\t\tftruncate($this->handle, strlen($data));\n\t\tfwrite($this->handle, $data);\n\t}\n\n\tprivate function close()\n\t{\n\t\tfclose($this->handle);\n\t\t$this->handle = null;\n\t}\n\n}\n"
  },
  {
    "path": "src/QueueItem.php",
    "content": "<?php\nclass QueueItem\n{\n\tpublic $item;\n\tpublic $attempts;\n\n\tpublic function __construct($item, $attempts = 0)\n\t{\n\t\t$this->item = $item;\n\t\t$this->attempts = $attempts;\n\t}\n}\n"
  },
  {
    "path": "src/SingleInstance.php",
    "content": "<?php\nclass SingleInstance\n{\n\tprivate static $fileHandle = null;\n\n\tpublic static function run($scriptName)\n\t{\n\t\t$fileName = basename($scriptName) . '.lock';\n\t\t$lockFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;\n\t\tself::$fileHandle = fopen($lockFile, 'wb');\n\t\tif (!flock(self::$fileHandle, LOCK_EX | LOCK_NB))\n\t\t{\n\t\t\tthrow new InstanceAlreadyRunningException($scriptName);\n\t\t}\n\t}\n\n\tpublic static function destruct()\n\t{\n\t\tif (self::$fileHandle != null)\n\t\t{\n\t\t\tfclose(self::$fileHandle);\n\t\t}\n\t}\n}\n\nregister_shutdown_function(['SingleInstance', 'destruct']);\n"
  },
  {
    "path": "src/Singleton.php",
    "content": "<?php\ninterface ISingleton\n{\n\tstatic function doInit();\n}\n\nabstract class Singleton implements ISingleton\n{\n\tstatic $initialized = [];\n\n    private static function isInitialized()\n\t{\n\t\t$initialized = in_array(static::class, static::$initialized, true);\n\n        if (!$initialized)\n        {\n            static::$initialized[] = static::class;\n        }\n\n\t\treturn $initialized;\n\t}\n\n\tpublic static function init()\n\t{\n\t\tif (!static::isInitialized())\n\t\t{\n\t\t\tstatic::doInit();\n\t\t}\n\t}\n\n\tprivate function __construct()\n\t{\n\t}\n}\n"
  },
  {
    "path": "src/Strings.php",
    "content": "<?php\nclass Strings\n{\n\tpublic static function removeSpaces($subject)\n\t{\n\t\t$subject ??= '0';\n        $subject = trim($subject);\n\n\t\twhile (false !== ($x = strpos($subject, '  ')))\n\t\t{\n\t\t\t$subject = str_replace('  ', ' ', $subject);\n\t\t}\n\t\t$subject = trim($subject);\n\t\treturn $subject;\n\t}\n\n\tpublic static function makeInteger($subject)\n\t{\n\t\t$subject ??= '0';\n        return (int) trim(trim(str_replace([',', '.', ' '], '', $subject)), '#');\n\t}\n\n    public static function extractInteger($subject)\n    {\n        $subject ??= '0';\n        if (!preg_match('#[0-9]+#', $subject, $matches)) {\n            return 0;\n        }\n\n        return (int) $matches[0];\n    }\n\n\tpublic static function makeFloat($subject)\n\t{\n\t\t$subject ??= '0';\n        $subject = str_replace(' ', '', $subject);\n\t\t$subject = floatval($subject);\n\t\treturn $subject;\n\t}\n\n\tpublic static function makeDate($str)\n\t{\n\t\t$str ??= '';\n        $str = trim(trim(str_replace('  ', ' ', $str), ','));\n\t\t$monthNames = array_merge\n\t\t(\n\t\t\tarray_flip([1 => 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']),\n\t\t\tarray_flip([1 => 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'])\n\t\t);\n\n\t\t$day = null;\n\t\t$month = null;\n\t\t$year = null;\n\n\t\t$matches = null;\n\t\tif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $str, $matches))\n\t\t{\n\t\t\tlist(, $year, $month, $day) = $matches;\n\t\t}\n\t\telseif (preg_match('/^(\\w{3,}) (\\d{1,2})(\\w*,?) (\\d{4})$/', $str, $matches))\n\t\t{\n\t\t\tlist (, $month, $day, , $year) = $matches;\n\t\t}\n\t\telseif (preg_match('/^(\\d{1,2})(\\w*) (\\w{3,}),? (\\d{4})$/', $str, $matches))\n\t\t{\n\t\t\tlist (, $day, , $month, $year) = $matches;\n\t\t}\n\t\telseif (preg_match('/^(\\d{4}),? (\\w{3,}),? (\\d{1,2})(\\w*)$/', $str, $matches))\n\t\t{\n\t\t\tlist (, $year, $month, $day) = $matches;\n\t\t}\n\t\telseif (preg_match('/^(\\w{3,}),? (\\d{4})$/', $str, $matches))\n\t\t{\n\t\t\t$month = $matches[1];\n\t\t\t$year = $matches[2];\n\t\t}\n\t\telseif (preg_match('/^(\\d{4})$/', $str, $matches))\n\t\t{\n\t\t\t$year = $matches[1];\n\t\t}\n\n\t\tif (!($month >= 1 and $month <= 12))\n\t\t{\n\t\t\tif (isset($monthNames[strtolower($month ?? '')]))\n\t\t\t{\n\t\t\t\t$month = $monthNames[strtolower($month ?? '')];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$month = null;\n\t\t\t}\n\t\t}\n\t\t$year = intval($year);\n\t\t$day = intval($day);\n\n\t\t$year = $year ?: '????';\n\t\t$month = $month ?: '??';\n\t\t$day = $day ?: '??';\n\t\treturn sprintf('%04s-%02s-%02s', $year, $month, $day);\n\t}\n\n\tpublic static function parseURL($url)\n\t{\n\t\t$parts = parse_url($url);\n\t\tif (isset($parts['query']))\n\t\t{\n\t\t\tparse_str(urldecode($parts['query']), $parts['query']);\n\t\t}\n\t\treturn $parts;\n\t}\n\n\tpublic static function makeEnum($source, $table, $default = null)\n\t{\n\t\tforeach ($table as $key => $replacement)\n\t\t{\n\t\t\tif ($source == $key)\n\t\t\t{\n\t\t\t\treturn $replacement;\n\t\t\t}\n\t\t}\n\t\treturn $default;\n\t}\n}\n"
  },
  {
    "path": "src/Views/View.php",
    "content": "<?php\nclass View\n{\n\tprotected static $viewContext;\n\n\tpublic static function render($viewContext)\n\t{\n\t\tob_start();\n\t\t$ret = null;\n\t\ttry\n\t\t{\n\t\t\tself::$viewContext = $viewContext;\n\t\t\tself::renderFile($viewContext->layoutName, $viewContext);\n\t\t\t$ret = ob_get_contents();\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tob_end_clean();\n\t\t}\n\t\techo $ret;\n\t}\n\n\tpublic static function renderView()\n\t{\n\t\tassert(!empty(self::$viewContext->viewName));\n\t\tself::renderFile(self::$viewContext->viewName, self::$viewContext);\n\t}\n\n\tpublic static function renderFile($name, $viewContext)\n\t{\n\t\tif (empty($name))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t$path = __DIR__ . DIRECTORY_SEPARATOR . $name . '.phtml';\n\n\t\tob_start();\n\t\ttry\n\t\t{\n\t\t\tinclude $path;\n\t\t\t$output = ob_get_contents();\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tob_end_clean();\n\t\t}\n\n\t\tif (HttpHeadersHelper::getCurrentHeader('Content-Type') != 'text/html' && HttpHeadersHelper::getCurrentHeader('Content-Type') != 'text/html;charset=UTF-8')\n\t\t{\n\t\t\techo $output;\n\t\t\treturn;\n\t\t}\n\n\t\t$output = str_replace(' />', '/>', $output);\n\t\t$output = str_replace(' >', '>', $output);\n\t\t$output = preg_replace_callback('/<[^>]+>/', function($m)\n\t\t{\n\t\t\treturn str_replace(\"\\t\", ' ', $m[0]);\n\t\t}, $output);\n\t\t$output = str_replace([\"\\t\", \"\\r\", \"\\n\"], '', $output);\n\t\t$i = strpos($output, '  ');\n\t\twhile ($i !== false)\n\t\t{\n\t\t\t$output = substr_replace($output, '', $i, 1);\n\t\t\t$i = strpos($output, '  ', $i);\n\t\t}\n\t\techo $output;\n\t}\n}\n"
  },
  {
    "path": "src/Views/ViewContext.php",
    "content": "<?php\nclass ViewContext\n{\n    public $name;\n\n    public function __construct()\n    {\n        $this->layoutName = 'layout';\n        $this->viewName = null;\n        $this->renderStart = microtime(true);\n        $this->meta = new StdClass;\n        $this->meta->description = Config::$title . ' (MALgraph) is an extension of your myanimelist.net profile, showing you various information about your anime and manga.';\n        $this->meta->styles = [];\n        $this->meta->scripts = [];\n        WebMediaHelper::addBasic($this);\n    }\n}\n"
  },
  {
    "path": "src/Views/admin-index.phtml",
    "content": "<?php if (!empty($viewContext->message)): ?>\n\t<p class=\"alert <?php echo $viewContext->messageType ?>\"><?php echo $viewContext->message ?></p>\n<?php endif ?>\n\n<div class=\"right\">\n<a class=\"btn logout\" href=\"<?php echo AdminControllerLogoutModule::url() ?>\">Get me outta here</a>\n</div>\n<h1><a href=\"<?php echo AdminControllerIndexModule::url() ?>\">Admin panel!</a></h1>\n\n<p>Just don’t do stupid things. Useful links:</p>\n<ul>\n\t<li><a target=\"_blank\" href=\"https://myanimelist.net/forum/?topicid=140439\" rel=\"noreferrer\">Recent anime DB removals and merges</a></li>\n\t<li><a target=\"_blank\" href=\"https://myanimelist.net/forum/?topicid=60908\" rel=\"noreferrer\">Recent manga DB removals and merges</a></li>\n</ul>\n\n<form class=\"aligned\" action=\"<?php echo AdminControllerProcessorModule::url() ?>\" method=\"post\">\n\t<fieldset>\n\t\t<legend>Media refreshment center</legend>\n\t\t<input type=\"hidden\" name=\"sender\" value=\"media\"/>\n\n\t\t<div class=\"control-group\">\n\t\t\t<label class=\"aligned\">Media ID</label>\n\t\t\t<div>\n\t\t\t\t<input type=\"text\" name=\"model-ids\"/>\n\t\t\t\t<small>(commas and ranges are OK, example: <code>A1-A5,M7,M8</code>)</small>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"control-group\">\n\t\t\t<div>\n\t\t\t\t<label>You can also paste some plain text garbage below:</label><br>\n\t\t\t\t<textarea rows=\"5\" name=\"ids\"></textarea>\n\t\t\t\t<button class=\"btn\" id=\"btn-guess-links\">Guess links</button>\n\t\t\t\t<button class=\"btn\" id=\"btn-guess-anime\">Guess anime</button>\n\t\t\t\t<button class=\"btn\" id=\"btn-guess-manga\">Guess manga</button>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"control-group\">\n\t\t\t<div>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"refresh\">Refresh</button>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"reset-franchise\">Reset franchise</button>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"remove\">Remove from DB</button>\n\t\t\t</div>\n\t\t</div>\n\t</fieldset>\n</form>\n\n<form class=\"aligned\" action=\"<?php echo AdminControllerProcessorModule::url() ?>\" name=\"user-manip\" method=\"post\">\n\t<fieldset>\n\t\t<legend>User manipulation center</legend>\n\t\t<input type=\"hidden\" name=\"sender\" value=\"user\"/>\n\n\t\t<div class=\"control-group\">\n\t\t\t<label class=\"aligned\">Name</label>\n\t\t\t<div>\n\t\t\t\t<input type=\"text\" name=\"model-ids\"/>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"control-group\">\n\t\t\t<div>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"refresh\">Refresh</button>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"wipe-cache\">Wipe cache</button>\n\t\t\t\t<br/>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"unban\">Unban</button>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"soft-ban\">Ban for updating</button>\n\t\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"hard-ban\">Ban completely</button>\n\t\t\t</div>\n\t\t</div>\n\t</fieldset>\n</form>\n\n<form class=\"aligned\" action=\"<?php echo AdminControllerMiscModule::url() ?>\" method=\"post\">\n\t<div class=\"control-group\">\n\t\t<div>\n\t\t\t<button class=\"btn btn-success\" type=\"submit\" name=\"action\" value=\"wipe-cache\">Wipe cache</button>\n\t\t</div>\n\t</div>\n</form>\n\n<script type=\"text/javascript\">\n\tvar timeout = null;\n\t$('.btn-danger').click(function(e)\n\t{\n\t\tif (!confirm('Are you sure?'))\n\t\t{\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\n\t$('#btn-guess-links').click(function(e)\n\t{\n\t\te.preventDefault();\n\t\tvar text = $('textarea[name=\\'ids\\']').val();\n\t\tvar regex = /\\/(anime|manga)[.\\/].*?(\\d+)/g;\n\t\tvar ids = [];\n\t\twhile ((match = regex.exec(text)) != null)\n\t\t{\n\t\t\tvar model = match[1];\n\t\t\tvar id = match[2];\n\t\t\tvar symb = model == 'anime' ? 'A' : 'M';\n\t\t\tsymb += id;\n\t\t\tif (ids.lastIndexOf(symb) == -1)\n\t\t\t{\n\t\t\t\tids.push(symb);\n\t\t\t}\n\t\t}\n\t\t$(this).parents('fieldset').find('input[name=\\'model-ids\\']').val(ids.join(','));\n\t});\n\n\t$('#btn-guess-anime, #btn-guess-manga').click(function(e)\n\t{\n\t\te.preventDefault();\n\t\tvar text = $('textarea[name=\\'ids\\']').val();\n\t\tvar regex = /(\\d+)/g;\n\t\tvar ids = [];\n\t\twhile ((match = regex.exec(text)) != null)\n\t\t{\n\t\t\tvar id = match[1];\n\t\t\tvar symb = $(this).attr('id') == 'btn-guess-anime' ? 'A' : 'M';\n\t\t\tsymb += id;\n\t\t\tif (ids.lastIndexOf(symb) == -1)\n\t\t\t{\n\t\t\t\tids.push(symb);\n\t\t\t}\n\t\t}\n\t\t$(this).parents('fieldset').find('input[name=\\'model-ids\\']').val(ids.join(','));\n\t});\n</script>\n"
  },
  {
    "path": "src/Views/admin-login.phtml",
    "content": "<form action=\"<?php echo AdminControllerLoginModule::url() ?>\" method=\"post\">\n\t<input type=\"text\" name=\"user\" value=\"admin\" style=\"display: none\">\n\n\t<div class=\"control-group\">\n\t\t<label class=\"aligned\" for=\"password\">Password</label>\n\t\t<div>\n\t\t\t<div>\n\t\t\t\t<input type=\"password\" name=\"password\">\n\t\t\t</div>\n\n\t\t\t<?php if (!empty($viewContext->entered)): ?>\n\t\t\t\t<p class=\"alert error\">Wrong password.</p>\n\t\t\t<?php endif ?>\n\t\t</div>\n\t</div>\n\n\t<div class=\"control-group\">\n\t\t<div>\n\t\t\t<button class=\"btn\" type=\"submit\">Log in</button>\n\t\t</div>\n\t</div>\n</form>\n"
  },
  {
    "path": "src/Views/error-403.phtml",
    "content": "<h2>Error 403. Oops!</h2>\n<p>You can't access this resource.</p>\n"
  },
  {
    "path": "src/Views/error-404.phtml",
    "content": "<h2>Error 404. Oops!</h2>\n<p>This page does not exist. Check the URL and try again.</p>\n"
  },
  {
    "path": "src/Views/error-user-blocked.phtml",
    "content": "<div class=\"section\">\n\t<h2>User blocked.</h2>\n\t<div class=\"section-body\">\n\t\t<p><?php echo $viewContext->userName ?> requested to block their profile from being displayed here.</p>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/error-user-enqueued.phtml",
    "content": "<?php if ($viewContext->contentType == 'image/png'): ?>\n<?php readfile(join(DIRECTORY_SEPARATOR, [Config::$mediaDirectory, 'img', 'info-queued.png'])) ?>\n<?php return ?>\n<?php endif ?>\n\n<div class=\"section\">\n\t<h2>Okay!</h2>\n\t<div class=\"section-body\">\n\t\t<div style=\"text-align: center\">\n\t\t<p style=\"margin-bottom: 1.5em\">\n\t\t\tSuccessfully added <a href=\"//myanimelist.net/profile/<?= $viewContext->userName ?>\" target=\"_blank\" rel=\"noreferrer\"><?php echo $viewContext->userName ?></a> to the queue at position <?php echo $viewContext->queuePosition ?>.<br/>\n\t\t\t<small>Click on your username above to make sure you entered it correctly.</small>\n\t\t</p>\n\n\t\t<?php\n\t\t\t$totalMinutes = ceil($viewContext->queuePosition * Config::$cronInterval / max(1, Config::$usersPerCronRun));\n\t\t\t$totalMinutes = Config::$cronInterval * ceil($totalMinutes / Config::$cronInterval);\n\n\t\t\t$wait = TextHelper::getTimeText($totalMinutes * 60, TextHelper::TIME_MINUTES);\n\t\t?>\n\n\t\t<p>\n\t\t\tBased on the queue size, looks like it&rsquo;ll take about <?= $wait ?>.</p>\n\t\t\t<p>\n\t\t\tThis page will refresh automatically once your stats are ready.\n\t\t</p>\n\t\t</div>\n\n\t\t<script type=\"text/javascript\">\n\t\twindow.setTimeout(function()\n\t\t{\n\t\t\twindow.location.reload();\n\t\t}, <?php echo 60000 ?>);\n\t\t</script>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/error-user-invalid.phtml",
    "content": "<h1>Invalid user name</h1>\n\n<p>Your search was invalid:</p>\n\n<ul>\n<li>user name must be 2 to 16 characters long,</li>\n<li>user name can only contain letters, numbers, dashes, underscores.</li>\n</ul>\n"
  },
  {
    "path": "src/Views/error-user-not-found.phtml",
    "content": "<div class=\"section\">\n    <h2>\n        User not found\n    </h2>\n\n    <div class=\"section-body\">\n        <p>\n            This user has been removed because it hasn't been updated in over a month. Type <a href=\"https://myanimelist.net/profile/<?php echo $viewContext->userName; ?>\" target=\"_blank\" rel=\"noreferrer\"><?php echo $viewContext->userName; ?></a> in the search box above to see their stats.\n        </p>\n    </div>\n</div>\n"
  },
  {
    "path": "src/Views/error.phtml",
    "content": "<h1>Unhandled exception</h1>\n<p>Basically, this means trouble. You shouldn't see this.</p>\n\n<hr>\n<p><?php echo $viewContext->exception->getMessage() ?> at <?php echo $viewContext->exception->getFile() ?>:<?php echo $viewContext->exception->getLine() ?></p>\n<?php $backtrace = $viewContext->exception->getTrace() ?>\n<ul>\n\t<?php foreach ($backtrace as $k => $b): ?>\n\t\t<li><?php\n\t\t\tprintf\n\t\t\t(\n\t\t\t\t'#%d %s%s(%s) called at [%s:%d]',\n\t\t\t\t$k,\n\t\t\t\tempty($b['type']) ? '' : $b['class'] . $b['type'],\n\t\t\t\t$b['function'],\n\t\t\t\t'...', //join(', ', array_map(function($x) { return @json_encode($x); }, empty($b['args']) ? array() : $b['args'])),\n\t\t\t\tempty($b['file']) ? '[anonymous function]' : $b['file'],\n\t\t\t\tisset($b['line']) ? $b['line'] : null\n\t\t\t);\n\t\t?></li>\n\t<?php endforeach ?>\n</ul>\n"
  },
  {
    "path": "src/Views/index-about.phtml",
    "content": "<div class=\"section\">\n\t<h2>About</h2>\n\t<div class=\"section-body\">\n\t\t<p><strong><?php echo Config::$title; ?></strong> is an extension of your <a target=\"_blank\" href=\"https://myanimelist.net\" rel=\"noreferrer\">myanimelist.net</a> profile, showing you various information about your anime and manga.</p>\n\t</div>\n</div>\n\n<div class=\"section\">\n\t<h2>Privacy</h2>\n\t<div class=\"section-body\">\n\t\t<p><strong><?php echo Config::$title; ?></strong> downloads and stores publicly available data related to your myanimelist.net account, which are: profile information (username, join date, etc.), lists, activity history (episodes watched and chapters read) from the last month.</p>\n\n\t\t<p>The content of private lists will be hidden.</p>\n\t</div>\n</div>\n\n<div class=\"section\">\n\t<h2>Contact and external links</h2>\n\t<div class=\"section-body\">\n\t\t<p>You can find more info at:</p>\n\t\t<ul>\n\t\t\t<li><a target=\"_blank\" href=\"https://myanimelist.net/clubs.php?cid=67199\" rel=\"noreferrer\">Club</a></li>\n            <li><a target=\"_blank\" href=\"https://github.com/anime-plus/graph/blob/master/achievements.md\" rel=\"noreferrer\">List of achievements</a></li>\n            <li><a target=\"_blank\" href=\"https://github.com/anime-plus/graph\" rel=\"noreferrer\">Source code</a></li>\n\t\t</ul>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/index-globals.phtml",
    "content": "<div class=\"section\">\n\t<h2>Global stats</h2>\n\t<div class=\"section-body\">\n\n\t\t<div class=\"mini-section\">\n\t\t\t<div class=\"left\">\n\t\t\t\t<p class=\"big-number\">\n\t\t\t\t\t<span class=\"desc\">Anime entries:</span>\n\t\t\t\t\t<span class=\"value\"><?php echo $viewContext->mediaCount[Media::Anime] ?></span>\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t<div class=\"right\">\n\t\t\t\t<p class=\"big-number\">\n\t\t\t\t\t<span class=\"desc\">Manga entries:</span>\n\t\t\t\t\t<span class=\"value\"><?php echo $viewContext->mediaCount[Media::Manga] ?></span>\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"mini-section\">\n\t\t\t<div class=\"left\">\n\t\t\t\t<p class=\"big-number\">\n\t\t\t\t\t<span class=\"desc\">Active users:</span>\n\t\t\t\t\t<span class=\"value\"><?php echo $viewContext->userCount ?></span>\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t<div class=\"right\">\n\t\t\t\t<p class=\"big-number\">\n\t\t\t\t\t<span class=\"desc\">Queued users:</span>\n\t\t\t\t\t<span class=\"value\"><?php echo $viewContext->queuedUserCount ?></span>\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t<div class=\"clear\"></div>\n\t\t</div>\n\n\t\t<?php foreach (Media::getconstList() as $media): ?>\n\t\t\t<div class=\"section <?php echo Media::toString($media) ?>-rating-dist\">\n\t\t\t\t<h2><?php echo ucfirst(Media::toString($media)) ?> rating distribution</h2>\n\t\t\t\t<?php $ratingDistribution = $viewContext->ratingDistribution[$media] ?>\n\t\t\t\t<div class=\"section-body\">\n\t\t\t\t\t<ul class=\"infobox\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<div data-tooltip=\"Average count of rated titles per user\">\n\t\t\t\t\t\t\t\t\t<span class=\"prefix\">Rated per user</span>\n\t\t\t\t\t\t\t\t\t<span class=\"subject\"><?php printf('%d', floor($ratingDistribution->getRatedCount() / max(1, $viewContext->userCountAll))) ?></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span class=\"prefix\">Total unrated</span>\n\t\t\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $ratingDistribution->getUnratedCount() * 100.0 / max(1, $ratingDistribution->getRatedCount() + $ratingDistribution->getUnratedCount())) ?>%</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span class=\"prefix\">Mean rating</span>\n\t\t\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $ratingDistribution->getMeanScore()) ?></span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\n\t\t\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\tvar opt =\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchart:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trenderTo: $('.<?php echo Media::toString($media) ?>-rating-dist .target')[0],\n\t\t\t\t\t\t\t\ttype: 'bar',\n\t\t\t\t\t\t\t\tmarginRight: 35\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\txAxis:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcategories: <?php echo json_encode(array_values($ratingDistribution->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY))) ?>,\n\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'Rating'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\tyAxis:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'Count',\n\t\t\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\ttooltip:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\t\t\tif (this.x == '-')\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttext = 'Unrated titles: ';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttext = 'Titles rated with ' + this.x + ': ' + this.y;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvar percent = this.y * 100.0 / <?php echo max(1, $ratingDistribution->getRatedCount()) ?>;\n\t\t\t\t\t\t\t\t\ttext += ' (' + (Math.round(percent * 100.0) / 100.0) + '%)';\n\t\t\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\tseries:\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdata: <?php echo json_encode(array_values($ratingDistribution->getGroupsSizes(AbstractDistribution::IGNORE_NULL_KEY))) ?>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t\t\t</script>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t<?php endforeach ?>\n\n\t\t<div class=\"section queue-sizes\">\n\t\t\t<h2>Queue size through time</h2>\n\t\t\t<div class=\"section-body\">\n\t\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t</div>\n\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tvar queueSizes = <?php echo json_encode($viewContext->queueSizes) ?>;\n\n\t\t\t\t\tvar opt =\n\t\t\t\t\t{\n\t\t\t\t\t\tchart:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trenderTo: $('.queue-sizes .target')[0],\n\t\t\t\t\t\t\ttype: 'line',\n\t\t\t\t\t\t\tmarginTop: 10\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\txAxis:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext: 'Hours ago',\n\t\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttickInterval: 4 * (60 / 5),\n\t\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn Math.round((Object.keys(queueSizes).length - this.value) * 5 / 60);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tyAxis:\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'User queue size'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'Media queue size',\n\t\t\t\t\t\t\t\t\tstyle:\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolor: Highcharts.theme.colors[1]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstyle:\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolor: Highcharts.theme.colors[1]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tgridLineWidth: 0,\n\t\t\t\t\t\t\t\tminorGridLineWidth: 0,\n\t\t\t\t\t\t\t\topposite: true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\n\t\t\t\t\t\ttooltip:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshared: true,\n\t\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconsole.log(this);\n\t\t\t\t\t\t\t\tvar d = this.points[0].point.key;\n\t\t\t\t\t\t\t\tvar text = d.getFullYear() + '-' +\n\t\t\t\t\t\t\t\t\tlpad(d.getMonth() + 1, 2) + '-' +\n\t\t\t\t\t\t\t\t\tlpad(d.getDate(), 2) + ' ' +\n\t\t\t\t\t\t\t\t\tlpad(d.getHours(), 2) + ':' +\n\t\t\t\t\t\t\t\t\tlpad(d.getMinutes(), 2) + ':' +\n\t\t\t\t\t\t\t\t\tlpad(d.getSeconds(), 2);\n\t\t\t\t\t\t\t\treturn 'Queue size at ' + text + ': users - ' + this.points[0].y + ', media - ' + this.points[1].y;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\tseries:\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlineWidth: 1.25,\n\t\t\t\t\t\t\t\tyAxis: 0,\n\t\t\t\t\t\t\t\tname: 'User queue size',\n\t\t\t\t\t\t\t\tdata: $.map(queueSizes, function(a, b)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn {y: a[0], key: new Date(Date.parse(b))};\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tmarker:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlineWidth: 1.5,\n\t\t\t\t\t\t\t\tyAxis: 1,\n\t\t\t\t\t\t\t\tname: 'Media queue size',\n\t\t\t\t\t\t\t\tdata: $.map(queueSizes, function(a, b)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn {y: a[1], key: new Date(Date.parse(b))};\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tmarker:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t};\n\n\t\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t\t</script>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/index-index.phtml",
    "content": "<div id=\"showcase\">\n<nav>\n<ul>\n<li><a href=\"javascript:void(0);\"><i class=\"icon-mg\"></i><span>View numerous stats for <strong>anime and manga</strong></span></a></li>\n<li><a href=\"javascript:void(0);\"><i class=\"icon-suggestions\"></i><span>Get personalized <strong>recommendations</strong></span></a></li>\n<li><a href=\"javascript:void(0);\"><i class=\"icon-achievements\"></i><span>Earn <strong>achievements</strong> based on your list</span></a></li>\n<li><a href=\"javascript:void(0);\"><i class=\"icon-globals\"></i><span>Compare your data with <strong>global stats</strong></span></a></li>\n</ul>\n</nav>\n<div class=\"tab-wrapper\">\n<div class=\"tab\">\n<img src=\"<?php echo UrlHelper::absoluteUrl('/media/img/logo-huge.png'); ?>\" alt=\"<?php echo Config::$title; ?>\" class=\"screenshot\" />\n<p><strong><?php echo Config::$title; ?></strong> is an extension of your myanimelist.net profile, showing you various stats about your anime and manga.</p>\n</div>\n<div class=\"tab\">\n<img src=\"<?php echo UrlHelper::absoluteUrl('/media/img/showcase-2.png'); ?>\" alt=\"Recommendations\" class=\"screenshot\" />\n<p>Get recommendations based on your ratings and check related titles you might have missed.</p>\n</div>\n<div class=\"tab\">\n<img src=\"<?php echo UrlHelper::absoluteUrl('/media/img/showcase-3.png'); ?>\" alt=\"Achievements\" class=\"screenshot\" />\n<p>Doing something big, like watching 100 mecha anime, will earn you a badge. All your friends will envy you!</p>\n</div>\n<div class=\"tab\">\n<img src=\"<?php echo UrlHelper::absoluteUrl('/media/img/showcase-4.png'); ?>\" alt=\"Global statistics\" class=\"screenshot\" />\n<p>See how your mean score compares to other users', check how many more manga is there for you to read.</p>\n</div>\n</div>\n<div class=\"clear\"></div>\n</div>\n<div id=\"start\">\n<form action=\"<?php echo UrlHelper::absoluteUrl(IndexControllerSearchModule::url()); ?>\" method=\"post\" class=\"waitable search\">\n<div class=\"control-group\">\n<label for=\"mp-search\">Start here:</label>\n<input type=\"search\" name=\"user-name\" id=\"mp-search\" placeholder=\"Your MAL username\" />\n<span>or <a href=\"<?php echo UrlHelper::absoluteUrl(UserControllerProfileModule::url('Deividas')); ?>\">load an example profile</a>.</span>\n</div>\n</form>\n</div>\n<footer>\n<ul class=\"horizontal\">\n<li><a href=\"<?php echo UrlHelper::absoluteUrl(IndexControllerGlobalsModule::url()); ?>\" class=\"waitable\">Global stats</a></li>\n<li><a href=\"<?php echo UrlHelper::absoluteUrl(IndexControllerAboutModule::url()); ?>\" class=\"waitable\">About</a></li>\n</ul>\n</footer>\n"
  },
  {
    "path": "src/Views/layout-ajax.phtml",
    "content": "<?php echo self::renderView($viewContext) ?>\n"
  },
  {
    "path": "src/Views/layout-base.phtml",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"\" />\n<meta charset=\"utf-8\" />\n<?php\nif (isset($viewContext->meta->noIndex)) {\n?>\n<meta name=\"robots\" content=\"noindex,nofollow\" />\n<?php\n} else {\n?>\n<meta name=\"robots\" content=\"index,follow\" />\n<?php\n}\n?>\n<title><?php echo isset($viewContext->meta->title) ? $viewContext->meta->title : Config::$title . ' &#8212; An extension of your myanimelist.net profile'; ?></title>\n<meta property=\"og:url\" content=\"<?php echo UrlHelper::currentUrl(); ?>\" />\n<meta property=\"og:site_name\" content=\"<?php echo Config::$title; ?>\" />\n<meta property=\"og:title\" content=\"<?php echo Config::$title; ?>\" />\n<?php\nif (isset($viewContext->meta->description)) {\n?>\n<meta property=\"og:description\" content=\"<?php echo $viewContext->meta->description; ?>\" />\n<?php\n}\n?>\n<meta property=\"og:image\" content=\"/media/img/logo-fb.png\" />\n<?php\nif (isset($viewContext->meta->description)) {\n?>\n<meta name=\"description\" content=\"<?php echo $viewContext->meta->description ?>\" />\n<?php\n}\n?>\n<link type=\"image/png\" rel=\"shortcut icon\" href=\"/image/32.png\" />\n<?php\nif (isset($viewContext->meta->styles)) {\n    foreach ($viewContext->meta->styles as $style) {\n?>\n<link type=\"text/css\" rel=\"stylesheet\" href=\"<?php echo $style; ?>\" />\n<?php\n    }\n}\n\nif (isset($viewContext->meta->scripts)) {\n    foreach ($viewContext->meta->scripts as $script) {\n?>\n<script src=\"<?php echo $script; ?>\"></script>\n<?php\n    }\n}\n?>\n<?php\nif (Config::$googleAnalyticsEnabled) {\n?>\n<script src=\"https://www.googletagmanager.com/gtag/js?id=G-DN2ZKWNWVX\" async></script>\n<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','G-DN2ZKWNWVX');</script>\n<?php\n}\n?>\n</head>\n<body>\n<div id=\"notice-wrapper\">\n<div id=\"no-script\" class=\"notice\">JavaScript is disabled. Consider enabling it to get positive user experience.</div>\n<script>$('#no-script').hide();</script>\n<?php\nif (Config::$noticeMessage) {\n?>\n<div id=\"notice-message\" class=\"notice\"><?php echo Config::$noticeMessage; ?></div>\n<?php\n}\n?>\n<?php\nif (Config::$alertMessage) {\n?>\n<div id=\"notice-message\" class=\"notice\" style=\"background-color: #f00;\"><?php echo Config::$alertMessage; ?></div>\n<?php\n}\n?>\n</div>\n<?php\nif (!$viewContext->headerDisabled) {\n?>\n<div id=\"header\">\n<div class=\"main-wrapper\">\n<form action=\"<?php echo IndexControllerSearchModule::url(); ?>\" method=\"post\" class=\"waitable search\">\n<div id=\"logo\">\n<a href=\"<?php echo IndexControllerIndexModule::url(); ?>\"><span><?php echo Config::$title; ?></span></a>\n<div class=\"sep\"></div>\n</div>\n<?php\n    if (isset($viewContext->module)) {\n?>\n<input type=\"hidden\" name=\"module\" value=\"<?php echo $viewContext->module ?>\"/>\n<?php\n}\n\nif (isset($viewContext->media)) {\n?>\n<input type=\"hidden\" name=\"media\" value=\"<?php echo $viewContext->media ?>\" />\n<?php\n}\n?>\n<div class=\"control-group input-append\">\n<input type=\"search\" name=\"user-name\" placeholder=\"Your MAL username\">\n<button type=\"submit\" name=\"submit\" value=\"search\" class=\"btn\" data-tooltip=\"Search\"><i class=\"icon-search\"></i></button>\n</div>\n<div id=\"top-nav\">\n<a href=\"<?php echo IndexControllerGlobalsModule::url(); ?>\" class=\"waitable\">Global stats</a>\n<div class=\"sep\"></div>\n<a href=\"<?php echo IndexControllerAboutModule::url(); ?>\" class=\"waitable\">About</a>\n</div>\n<div class=\"clear\"></div>\n</form>\n</div>\n</div>\n<?php\n}\n?>\n<div class=\"main-wrapper\">\n<?php\nif (isset($viewContext->userMenu)) {\n?>\n<div id=\"menu-wrapper\">\n<div id=\"menu\">\n<?php\nself::renderFile('user-menu', $viewContext);\n?>\n</div>\n</div>\n<?php\n}\n?>\n<div id=\"main\">\n<?php\nself::renderView();\n?>\n</div>\n<div class=\"clear\"></div>\n</div>\n<div id=\"glider\">\n<div>\n<div class=\"target\"></div>\n<p>loading...</p>\n</div>\n</div>\n<span id=\"preloader\"></span>\n</body>\n</html>\n"
  },
  {
    "path": "src/Views/layout-headerless.phtml",
    "content": "<?php $viewContext->headerDisabled = true ?>\n<?php WebMediaHelper::addHeaderless($viewContext) ?>\n<?php include 'layout-base.phtml' ?>\n"
  },
  {
    "path": "src/Views/layout-json.phtml",
    "content": "<?php HttpHeadersHelper::setCurrentHeader('Content-Type', 'application/json') ?>\n<?php echo json_encode($viewContext->json) ?>\n"
  },
  {
    "path": "src/Views/layout-raw.phtml",
    "content": "<?php echo self::renderView($viewContext) ?>\n"
  },
  {
    "path": "src/Views/layout.phtml",
    "content": "<?php $viewContext->headerDisabled = false ?>\n<?php WebMediaHelper::addHeader($viewContext) ?>\n<?php include 'layout-base.phtml' ?>\n"
  },
  {
    "path": "src/Views/maintenance.phtml",
    "content": "<div style=\"text-align: center\">\n\t<img src=\"/media/img/logo-huge.png\" alt=\"<?php echo Config::$title; ?>\">\n\t<?php foreach ((array) Config::$maintenanceMessage as $message): ?>\n\t\t<p><?php echo $message ?></p>\n\t<?php endforeach ?>\n</div>\n"
  },
  {
    "path": "src/Views/user-achievements.phtml",
    "content": "<div class=\"section achi\">\n\t<h2>\n\t\tAchievements\n\t</h2>\n\t<?php if ($viewContext->hiddenCount > 0): ?>\n\t\t<p class=\"previous-msg\">There are <strong><?php echo $viewContext->hiddenCount ?></strong> achievements from previous levels. <a href=\"#\">Show them</a></p>\n\t<?php endif ?>\n\t<div class=\"section-body\">\n\t\t<?php if (empty($viewContext->achievements)): ?>\n\t\t\t<p>No achievements yet! Better get to <?php echo $viewContext->media == Media::Manga ? 'reading' : 'watching' ?>.</p>\n\t\t<?php else: ?>\n\t\t\t<?php foreach ($viewContext->achievements as $ach): ?>\n\t\t\t\t<div class=\"achi-entry<?php if ($ach->hidden) echo ' hidden' ?>\">\n\t\t\t\t\t<?php if (!empty($ach->path)): ?>\n\t\t\t\t\t\t<img class=\"achi<?php if (!empty($ach->entries)): ?> entries-trigger<?php endif ?>\" alt=\"<?php echo $ach->title ?>\" src=\"<?php echo '/image/achievement/' . $ach->path; ?>\">\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t<?php if (!empty($ach->level)): ?>\n\t\t\t\t\t\t<p class=\"level\"><?php echo $ach->level ?></p>\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t<h3>\n\t\t\t\t\t\t<?php echo $ach->title ?>\n\t\t\t\t\t</h3>\n\t\t\t\t\t<?php if (isset($ach->progress)): ?>\n\t\t\t\t\t\t<?php if (isset($ach->tooltip)): ?>\n\t\t\t\t\t\t\t<div class=\"progress-wrapper\" data-tooltip=\"<?php echo TextHelper::replaceTokens($ach->tooltip, (array) $ach) ?>\">\n\t\t\t\t\t\t<?php elseif ($ach->hidden and $ach->level): ?>\n\t\t\t\t\t\t\t<div class=\"progress-wrapper\" data-tooltip=\"Previous level\">\n\t\t\t\t\t\t<?php elseif (!empty($ach->next->thresholdLeft)): ?>\n\t\t\t\t\t\t\t<div class=\"progress-wrapper\" data-tooltip=\"Got <?php echo $ach->subject ?>, next level at <?php echo $ach->next->thresholdLeft ?>\">\n\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t<div class=\"progress-wrapper\" data-tooltip=\"Maximum level!\">\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t<div class=\"progress\">\n\t\t\t\t\t\t\t\t<div class=\"bar\" style=\"width: <?php echo $ach->progress ?>%\"></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<?php endif ?>\n\n\t\t\t\t\t<?php if (!empty($ach->desc)): ?>\n\t\t\t\t\t\t<p class=\"desc\"><?php echo $ach->desc ?></p>\n\t\t\t\t\t<?php endif ?>\n\n\t\t\t\t\t<div class=\"clear\"></div>\n\n\t\t\t\t\t<?php if (!empty($ach->entries)): ?>\n\t\t\t\t\t\t<div class=\"entries-wrapper singular\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t\t\t<?php if ($viewContext->private): ?>\n\t\t\t\t\t\t\t\t\tCan&rsquo;t show you titles from a private list.</p>\n\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\tAwarded for\n\t\t\t\t\t\t\t\t\t&nbsp;<?php echo $viewContext->media == Media::Manga ? 'reading' : 'watching' ?> these:\n\t\t\t\t\t\t\t\t\t&nbsp;(<?php echo count($ach->entries) ?>)\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<?php if (!$viewContext->private): ?>\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<?php foreach ($ach->entries as $e): ?>\n\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $e->mal_link ?>\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($e->title) ?>\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<?php endif ?>\n\n\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t</div>\n\t\t\t<?php endforeach ?>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-entries-creator.phtml",
    "content": "<p>\n    <a class=\"close\">\n        <i class=\"icon-close\"></i>\n    </a>\n    <?php echo ucfirst(Media::toString($viewContext->media)); ?> from <a href=\"<?php if ($viewContext->media == Media::Manga): ?><?php echo 'https://myanimelist.net/people/' . $viewContext->filterParam; ?><?php else: ?><?php echo 'https://myanimelist.net/anime/producer/' . $viewContext->filterParam; ?><?php endif; ?>\" target=\"_blank\" rel=\"noreferrer\">the <?php if ($viewContext->media == Media::Manga): ?>author<?php else: ?>studio<?php endif; ?></a><?php if (!empty($viewContext->entries)): ?> (<?php echo count($viewContext->entries); ?>, <?php if (!$viewContext->meanScore): ?>none rated<?php else: ?>mean score: <?php echo sprintf('%.02f', $viewContext->meanScore); ?><?php endif; ?>)<?php endif; ?>:\n</p>\n<?php if ($viewContext->isPrivate): ?>\n    <p>Can&#39;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n    <p>None!</p>\n<?php else: ?>\n    <ul>\n        <?php foreach ($viewContext->entries as $entry): ?>\n            <li>\n                <a href=\"<?php echo $entry->mal_link; ?>\" target=\"_blank\" rel=\"noreferrer\"><?php echo htmlspecialchars($entry->title); ?></a><span class=\"details\">(<?php if ($entry->score): ?>rated with <?php echo $entry->score; ?><?php else: ?>unrated<?php endif; ?>)</span>\n            </li>\n        <?php endforeach; ?>\n    </ul>\n<?php endif; ?>\n"
  },
  {
    "path": "src/Views/user-entries-decade.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php if ($viewContext->filterParam == '?'): ?>\n\t\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> from unknown decade\n\t<?php else: ?>\n\t\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> from <?php echo $viewContext->filterParam ?>s\n\t<?php endif ?>:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-franchises.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\tFranchises consisting of at least two titles:\n\n\t<?php if (!empty($viewContext->franchises)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->franchises) ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->franchises)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ol class=\"franchises\">\n\t\t<?php foreach ($viewContext->franchises as $franchise): ?>\n\t\t\t<li>\n\t\t\t\t<?php foreach ($franchise->ownEntries as $entry): ?>\n\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t</a>\n\t\t\t\t\t<span class=\"details\">&nbsp;\n\t\t\t\t\t\t(<?php echo TextHelper::getNumberedMediaUnitText($viewContext->media, $viewContext->media == Media::Anime\n\t\t\t\t\t\t\t? ($entry->episodes ?: $entry->finished_episodes . '+')\n\t\t\t\t\t\t\t: ($entry->chapters ?: $entry->finished_chapters . '+'), true) ?>,&nbsp;\n\t\t\t\t\t\t<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)\n\t\t\t\t\t</span><br>\n\t\t\t\t<?php endforeach ?>\n\t\t\t\t<span class=\"details\">(<?php echo count($franchise->ownEntries) ?> titles,&nbsp;\n\t\t\t\t\t<?php if ($franchise->meanScore): ?>\n\t\t\t\t\t\tmean score: <?php printf('%.02f', $franchise->meanScore) ?>\n\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\tnone rated\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ol>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-genre.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> from&nbsp;\n\t\t<a target=\"_blank\" href=\"https://myanimelist.net/<?php echo Media::toString($viewContext->media) ?>/genre/<?php echo $viewContext->filterParam ?>\" rel=\"noreferrer\">the genre</a>:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-length.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php if ($viewContext->filterParam == '?'): ?>\n\t\tTitles with unknown length\n\t<?php else: ?>\n\t\tTitles of length <?php echo $viewContext->filterParam ?>\n\t\t<?php if ($viewContext->media == Media::Anime and $viewContext->filterParam == 1): ?>\n\t\t\t&nbsp;(w/o movies)\n\t\t<?php endif ?>\n\t<?php endif ?>:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-mismatches.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\tTitles that have mismatching <?php echo TextHelper::getMediaUnitText($viewContext->media) ?> count:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;\n\t\t\t\t\t(<?php if ($entry->media == Media::Anime): ?>\n\t\t\t\t\t\ton your list: <?php echo $entry->finished_episodes ?>,&nbsp;\n\t\t\t\t\t\t<?php if ($entry->publishing_status == MediaStatus::Publishing): ?>\n\t\t\t\t\t\t\tbut it&rsquo;s still airing\n\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\tshould be <?php echo TextHelper::getNumberedMediaUnitText($viewContext->media, $entry->episodes) ?>\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t<?php elseif ($entry->media == Media::Manga): ?>\n\t\t\t\t\t\ton your list: <?php echo $entry->finished_chapters ?>,&nbsp;\n\t\t\t\t\t\t<?php if ($entry->publishing_status == MediaStatus::Publishing): ?>\n\t\t\t\t\t\t\tbut it&rsquo;s still publishing\n\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\tshould be <?php echo TextHelper::getNumberedMediaUnitText($viewContext->media, $entry->chapters) ?>\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t<?php endif ?>)\n\t\t\t\t</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-ratings.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php if ($viewContext->filterParam == 0): ?>\n\t\tUnrated titles\n\t<?php else: ?>\n\t\tTitles rated with <?php echo $viewContext->filterParam ?>\n\t<?php endif ?>:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<?php if ($viewContext->filterParam == 0): ?>\n\t\t<p>Horray! No unrated titles.</p>\n\t<?php else: ?>\n\t\t<p>None!</p>\n\t<?php endif ?>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->finished_duration ?> min.)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-source.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> of source &ldquo;<?php echo ucfirst(AnimeMediaSource::toString($viewContext->filterParam)) ?>&rdquo;:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-type.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> of type &ldquo;<?php echo ucfirst(MediaType::toString($viewContext->filterParam, $viewContext->media)) ?>&rdquo;:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-entries-year.phtml",
    "content": "<p>\n\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t<?php if ($viewContext->filterParam == '?'): ?>\n\t\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> from unknown year\n\t<?php else: ?>\n\t\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> from <?php echo $viewContext->filterParam ?>\n\t<?php endif ?>:\n\n\t<?php if (!empty($viewContext->entries)): ?>\n\t\t&nbsp;(<?php echo count($viewContext->entries) ?>\n\t\t<?php if (!$viewContext->meanScore): ?>\n\t\t\t, none rated\n\t\t<?php else: ?>\n\t\t\t, mean score: <?php echo sprintf('%.02f', $viewContext->meanScore) ?>\n\t\t<?php endif ?>)\n\t<?php endif ?>\n</p>\n\n<?php if ($viewContext->isPrivate): ?>\n\t<p>Can&rsquo;t show you titles from a private list.</p>\n<?php elseif (empty($viewContext->entries)): ?>\n\t<p>None!</p>\n<?php else: ?>\n\t<ul>\n\t\t<?php foreach ($viewContext->entries as $entry): ?>\n\t\t\t<li>\n\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t</a>\n\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t</li>\n\t\t<?php endforeach ?>\n\t</ul>\n<?php endif ?>\n"
  },
  {
    "path": "src/Views/user-favorites-creators.phtml",
    "content": "<div class=\"section creators\">\n\t<h2>\n\t\t<?php if ($viewContext->media == Media::Manga): ?>\n\t\t\tFavorite authors\n\t\t<?php elseif ($viewContext->media == Media::Anime): ?>\n\t\t\tFavorite studios\n\t\t<?php endif; ?>\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->favCreators->getLargestGroupSize() == 0): ?>\n\t\t\t<p>Looks like there are no known creators for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<div class=\"scrollable\">\n\t\t\t\t<table class=\"tablesorter\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class=\"ord\">#</th>\n\t\t\t\t\t\t\t<th class=\"title\">Name</th>\n\t\t\t\t\t\t\t<th class=\"count\" data-tooltip=\"Count of titles from given creator.\">C</th>\n\t\t\t\t\t\t\t<th class=\"mean\" data-tooltip=\"Mean score of given creator.\">M</th>\n\t\t\t\t\t\t\t<th class=\"value\" data-tooltip=\"Weighted score of given creator.\">W</th>\n\t\t\t\t\t\t\t<th class=\"time\">Time</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<?php $i = 1 ?>\n\t\t\t\t\t\t<?php foreach ($viewContext->favCreators->getGroupsKeys() as $creator): ?>\n\t\t\t\t\t\t\t<?php $entries = $viewContext->favCreators->getGroupEntries($creator) ?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"ord\"><?php echo $i ++ ?></td>\n\t\t\t\t\t\t\t\t<td class=\"title\">\n\t\t\t\t\t\t\t\t\t<a class=\"entries-trigger\" data-sender=\"creator\" data-id=\"<?php echo $creator->mal_id ?>\" href=\"#\">\n\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($creator->name) ?>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"count\"><?php printf('%d', count($entries)) ?></td>\n\t\t\t\t\t\t\t\t<td class=\"mean\">\n\t\t\t\t\t\t\t\t\t<?php if ($viewContext->creatorScores[$creator->mal_id] == 0): ?>\n\t\t\t\t\t\t\t\t\t\t-\n\t\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t\t<?php printf('%.02f', $viewContext->creatorScores[$creator->mal_id]) ?>\n\t\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"value\"><?php printf('%.02f', $viewContext->creatorValues[$creator->mal_id]) ?></td>\n\t\t\t\t\t\t\t\t<td class=\"time\"><?php printf('%.02f', $viewContext->creatorTimeSpent[$creator->mal_id] / 60.0) ?>h</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t<tr class=\"entries-wrapper-row\">\n\t\t\t\t\t\t\t<td colspan=\"6\">\n\t\t\t\t\t\t\t\t<div class=\"entries-wrapper\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-favorites-decades.phtml",
    "content": "<div class=\"section decades\">\n\t<h2>\n\t\tFavorite years\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->favYears->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any completion dates for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<p class=\"toggle-decades-msg\"><a href=\"#\" class=\"toggle-decades\">Toggle decades/years visibility</a> &#8226; <a href=\"#\" class=\"toggle-zoom\">Toggle zoom</a></p>\n\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.decades .target')[0],\n\t\t\t\t\t\ttype: 'spline',\n\t\t\t\t\t\tmarginTop: 8,\n\t\t\t\t\t\tevents: {\n\t\t\t\t\t\t\tload: function () {\n\t\t\t\t\t\t\t\tthis.yAxis[0].setExtremes(this.yAxis[0].getExtremes().dataMin, this.yAxis[0].getExtremes().dataMax);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tcategories: <?php echo json_encode(array_reverse($viewContext->favYears->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY))) ?>,\n\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Years and decades',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t},\n\t\t\t\t\t\t<?php $json = [];\n\t\t\t\t\t\t\t$i = 0;\n\t\t\t\t\t\t\tforeach ($viewContext->favDecades->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY) as $decade)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$band = [\n\t\t\t\t\t\t\t\t\t'from' => $decade - 0.5,\n\t\t\t\t\t\t\t\t\t'to' => $decade + 9.5,\n\t\t\t\t\t\t\t\t\t'label' => ['text' => $decade . 's'],\n\t\t\t\t\t\t\t\t\t'zIndex' => 3,\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\tif ($i ++ % 2 == 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$band['color'] = 'rgba(200, 230, 255, 0.2)';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$json []= $band;\n\t\t\t\t\t\t\t} ?>\n\t\t\t\t\t\tplotBands: <?php echo json_encode($json) ?>\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\tmax: 10,\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Mean score'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text = 'Mean score of titles from ';\n\t\t\t\t\t\t\tif (this.series.name == 'decades')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += Math.floor(this.x / 10) * 10;\n\t\t\t\t\t\t\t\ttext += 's';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += this.x;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttext += ': ';\n\t\t\t\t\t\t\tif (this.y == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += 'unrated!';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += Math.round(this.y * 100) / 100.0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'years',\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_reverse(array_map(function($year) use ($viewContext)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn [$year, $viewContext->yearScores[$year]];\n\t\t\t\t\t\t\t}, $viewContext->favYears->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY)))) ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.decades .entries-wrapper'), {'sender': 'year', 'filter-param': this.category});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'decades',\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_reverse(array_map(function($decade) use ($viewContext)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn [$decade + 4.5, $viewContext->decadeScores[$decade]];\n\t\t\t\t\t\t\t}, $viewContext->favDecades->getGroupsKeys(AbstractDistribution::IGNORE_NULL_KEY | AbstractDistribution::IGNORE_EMPTY_GROUPS)))) ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.decades .entries-wrapper'), {'sender': 'decade', 'filter-param': Math.floor(this.category / 10) * 10});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\n\t\t\t\t\tplotOptions:\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumn:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpointWidth: 17\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tvar decadesChart = new Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-favorites-genres.phtml",
    "content": "<div class=\"section genres\">\n\t<h2>\n\t\tFavorite genres\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->favGenres->getLargestGroupSize() == 0): ?>\n\t\t\t<p>Looks like there are no known genres for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<div class=\"scrollable\">\n\t\t\t\t<table class=\"tablesorter\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class=\"ord\">#</th>\n\t\t\t\t\t\t\t<th class=\"title\">Name</th>\n\t\t\t\t\t\t\t<th class=\"count\" data-tooltip=\"Count of titles from given genre.\">C</th>\n\t\t\t\t\t\t\t<th class=\"mean\" data-tooltip=\"Mean score of given genre.\">M</th>\n\t\t\t\t\t\t\t<th class=\"value\" data-tooltip=\"Weighted score of given genre.\">W</th>\n\t\t\t\t\t\t\t<th class=\"time\">Time</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<?php $i = 1 ?>\n\t\t\t\t\t\t<?php foreach ($viewContext->favGenres->getGroupsKeys() as $genre): ?>\n\t\t\t\t\t\t\t<?php $entries = $viewContext->favGenres->getGroupEntries($genre) ?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"ord\"><?php echo $i ++ ?></td>\n\t\t\t\t\t\t\t\t<td class=\"title\">\n\t\t\t\t\t\t\t\t\t<a class=\"entries-trigger\" data-sender=\"genre\" data-id=\"<?php echo $genre->mal_id ?>\" href=\"#\">\n\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars(ucfirst($genre->name)) ?>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"count\"><?php printf('%d', count($entries)) ?></td>\n\t\t\t\t\t\t\t\t<td class=\"mean\">\n\t\t\t\t\t\t\t\t\t<?php if ($viewContext->genreScores[$genre->mal_id] == 0): ?>\n\t\t\t\t\t\t\t\t\t\t-\n\t\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t\t<?php printf('%.02f', $viewContext->genreScores[$genre->mal_id]) ?>\n\t\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"value\"><?php printf('%.02f', $viewContext->genreValues[$genre->mal_id]) ?></td>\n\t\t\t\t\t\t\t\t<td class=\"time\"><?php printf('%.02f', $viewContext->genreTimeSpent[$genre->mal_id] / 60.0) ?>h</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t<tr class=\"entries-wrapper-row\">\n\t\t\t\t\t\t\t<td colspan=\"6\">\n\t\t\t\t\t\t\t\t<div class=\"entries-wrapper\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-favorites-sources.phtml",
    "content": "<?php if ($viewContext->media === Media::Anime): ?>\n<div class=\"section sources\">\n\t<h2>\n\t\tFavorite sources\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->favSources->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any media source for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.sources .target')[0],\n\t\t\t\t\t\ttype: 'pie',\n\t\t\t\t\t\tspacingTop: 0,\n\t\t\t\t\t\tspacingBottom: 0,\n\t\t\t\t\t\tpieChart: true\n\t\t\t\t\t},\n\n\t\t\t\t\tlegend:\n\t\t\t\t\t{\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tlayout: 'vertical',\n\t\t\t\t\t\talign: 'right',\n\t\t\t\t\t\tverticalAlign: 'middle',\n\t\t\t\t\t\tlabelFormatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar percentages = <?php echo json_encode($viewContext->sourcePercentages) ?>;\n\t\t\t\t\t\t\tvar text = this.name;\n\t\t\t\t\t\t\ttext += ' - ' + this.y.toString();\n\t\t\t\t\t\t\ttext += ' (' + percentages[this.source] + '%)';\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tx: -40,\n\t\t\t\t\t\tsymbolPadding: 8,\n\t\t\t\t\t\titemMarginTop: 4,\n\t\t\t\t\t\titemMarginBottom: 4,\n\t\t\t\t\t\tborderWidth: 0\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Sources',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Mean score'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\tif (this.key == '?')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Titles of unknown source: ';\n\t\t\t\t\t\t\t} else\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = this.key + ': ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (this.y > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += this.y;\n\t\t\t\t\t\t\t} else\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += 'none!';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'sources',\n\t\t\t\t\t\t\tdata: <?php $array = array_values(array_map(function($source) use ($viewContext)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t'name' => ucfirst(AnimeMediaSource::toString($source)),\n\t\t\t\t\t\t\t\t\t'y' => $viewContext->favSources->getGroupSize($source),\n\t\t\t\t\t\t\t\t\t'source' => $source\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t}, $viewContext->favSources->getGroupsKeys(AbstractDistribution::IGNORE_EMPTY_GROUPS)));\n\n                            usort($array, function($a, $b) {\n                                return $b['y'] - $a['y'];\n                            });\n\n                            echo json_encode($array); ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tconsole.log(this);\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.sources .entries-wrapper'), {'sender': 'source', 'filter-param': this.source});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\n\t\t\t\t\tplotOptions:\n\t\t\t\t\t{\n\t\t\t\t\t\tpie:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlegendItemClick: function()\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdataLabels:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tshowInLegend: true,\n\t\t\t\t\t\t\tsize: '100%',\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n<?php endif; ?>\n"
  },
  {
    "path": "src/Views/user-favorites-types.phtml",
    "content": "<div class=\"section types\">\n\t<h2>\n\t\tFavorite types\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->favTypes->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any media type for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.types .target')[0],\n\t\t\t\t\t\ttype: 'pie',\n\t\t\t\t\t\tspacingTop: 0,\n\t\t\t\t\t\tspacingBottom: 0,\n\t\t\t\t\t\tpieChart: true\n\t\t\t\t\t},\n\n\t\t\t\t\tlegend:\n\t\t\t\t\t{\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tlayout: 'vertical',\n\t\t\t\t\t\talign: 'right',\n\t\t\t\t\t\tverticalAlign: 'middle',\n\t\t\t\t\t\tlabelFormatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar percentages = <?php echo json_encode($viewContext->typePercentages) ?>;\n\t\t\t\t\t\t\tvar text = this.name;\n\t\t\t\t\t\t\ttext += ' - ' + this.y.toString();\n\t\t\t\t\t\t\ttext += ' (' + percentages[this.type] + '%)';\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tx: -40,\n\t\t\t\t\t\tsymbolPadding: 8,\n\t\t\t\t\t\titemMarginTop: 4,\n\t\t\t\t\t\titemMarginBottom: 4,\n\t\t\t\t\t\tborderWidth: 0\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Types',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Mean score'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\tif (this.key == '?')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Titles of unknown type: ';\n\t\t\t\t\t\t\t} else\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = this.key + ': ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (this.y > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += this.y;\n\t\t\t\t\t\t\t} else\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += 'none!';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'types',\n\t\t\t\t\t\t\tdata: <?php $array = array_values(array_map(function($type) use ($viewContext)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t'name' => ucfirst(MediaType::toString($type, $viewContext->media)),\n\t\t\t\t\t\t\t\t\t'y' => $viewContext->favTypes->getGroupSize($type),\n\t\t\t\t\t\t\t\t\t'type' => $type\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t}, $viewContext->favTypes->getGroupsKeys(AbstractDistribution::IGNORE_EMPTY_GROUPS)));\n\n                            usort($array, function($a, $b) {\n                                return $b['y'] - $a['y'];\n                            });\n\n                            echo json_encode($array); ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tconsole.log(this);\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.types .entries-wrapper'), {'sender': 'type', 'filter-param': this.type});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\n\t\t\t\t\tplotOptions:\n\t\t\t\t\t{\n\t\t\t\t\t\tpie:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlegendItemClick: function()\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdataLabels:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenabled: false\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tshowInLegend: true,\n\t\t\t\t\t\t\tsize: '100%',\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-favorites.phtml",
    "content": "<?php self::renderFile('user-favorites-decades', $viewContext) ?>\n<?php self::renderFile('user-favorites-types', $viewContext) ?>\n<?php self::renderFile('user-favorites-sources', $viewContext) ?>\n<?php self::renderFile('user-favorites-genres', $viewContext) ?>\n<?php self::renderFile('user-favorites-creators', $viewContext) ?>\n"
  },
  {
    "path": "src/Views/user-history-daily.phtml",
    "content": "<div class=\"section history-daily\">\n\t<h2>\n\t\tRecent history\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<ul class=\"infobox\">\n\t\t\t<li class=\"total-eps\">\n\t\t\t\t<div>\n\t\t\t\t\t<span class=\"prefix\">Last 3 weeks</span>\n\t\t\t\t\t<span class=\"subject\">?</span>\n\t\t\t\t\t<span class=\"suffix\">\n\t\t\t\t\t\t<?php echo TextHelper::getMediaUnitText($viewContext->media, true) ?>\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t\t<li class=\"different-titles\">\n\t\t\t\t<div>\n\t\t\t\t\t<span class=\"prefix\">Different titles</span>\n\t\t\t\t\t<span class=\"subject\">?</span>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<div class=\"target-wrapper\">\n\t\t\t<div class=\"target\"></div>\n\t\t\t<div class=\"clear\"></div>\n\t\t</div>\n\n\t\t<div class=\"entries-wrapper\">\n\t\t\t<?php foreach ($viewContext->dailyHistoryGroups as $date => $entries): ?>\n\t\t\t\t<div class=\"entries-sub-wrapper\" id=\"date-<?php echo $date ?>\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t<?php echo ucfirst(TextHelper::getMediaUnitText($viewContext->media, true)) ?> from <span class=\"days-ago\">?</span> days ago: (<?php echo count($entries) ?>)\n\t\t\t\t\t</p>\n\t\t\t\t\t<?php if ($viewContext->isPrivate): ?>\n\t\t\t\t\t\t<p>Can&rsquo;t show you titles from a private list.</p>\n\t\t\t\t\t<?php elseif (empty($entries)): ?>\n\t\t\t\t\t\t<p>None!</p>\n\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<?php foreach ($entries as $entry): ?>\n\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t<span class=\"details\">\n\t\t\t\t\t\t\t\t\t\t&nbsp;(<?php echo $entry->progress ?>\n\t\t\t\t\t\t\t\t\t\t&nbsp;&ndash; <?php echo date('M jS, H:i', strtotime($entry->timestamp)) ?>)\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t</div>\n\t\t\t<?php endforeach ?>\n\t\t</div>\n\n\t\t<script type=\"text/javascript\">\n\t\t\tvar dailyHistoryGroups = <?php echo json_encode($viewContext->dailyHistoryGroups) ?>;\n\n\t\t\t/* preprocess data */\n\t\t\tvar dayPeriods = {};\n\t\t\tvar oneDay = 1000 * 60 * 60 * 24;\n\t\t\tfor (var groupDate in dailyHistoryGroups)\n\t\t\t{\n\t\t\t\tvar date1 = new Date();\n\t\t\t\tvar tmp = groupDate.split(/[^0-9]/);\n\t\t\t\tvar date2 = new Date(tmp[0],tmp[1]-1,tmp[2]);\n\t\t\t\tvar key = Math.round((date1.getTime() - date2.getTime()) / oneDay);\n\t\t\t\tif (key > 21 || key < 1)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdayPeriods[key] =\n\t\t\t\t{\n\t\t\t\t\tkey: groupDate,\n\t\t\t\t\tentries: dailyHistoryGroups[groupDate]\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfor (var i = 1; i <= 21; i ++)\n\t\t\t{\n\t\t\t\tif (typeof dayPeriods[i] == 'undefined')\n\t\t\t\t{\n\t\t\t\t\tdayPeriods[i] =\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: null,\n\t\t\t\t\t\tentries: []\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar keys = Object.keys(dayPeriods);\n\t\t\tkeys.sort(function(a, b) { return b - a; });\n\t\t\tvar values = [];\n\t\t\tvar dates = [];\n\t\t\tfor (var i in keys)\n\t\t\t{\n\t\t\t\tvar key = keys[i];\n\t\t\t\tvar period = dayPeriods[key];\n\t\t\t\tdates.push(period.key);\n\t\t\t\tvalues.push(period.entries);\n\t\t\t}\n\n\n\t\t\t/* count different titles and total episodes */\n\t\t\tvar differentTitles = {};\n\t\t\tvar differentTitlesCount = 0;\n\t\t\tvar totalEpisodeCount = 0;\n\t\t\tfor (var i in values)\n\t\t\t{\n\t\t\t\tfor (var j in values[i])\n\t\t\t\t{\n\t\t\t\t\tvar key = values[i][j]['media'] + values[i][j]['mal_id'];\n\t\t\t\t\tif (!(key in differentTitles))\n\t\t\t\t\t{\n\t\t\t\t\t\tdifferentTitles[key] = true;\n\t\t\t\t\t\tdifferentTitlesCount ++;\n\t\t\t\t\t}\n\t\t\t\t\ttotalEpisodeCount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$('.different-titles .subject').text(differentTitlesCount);\n\t\t\t$('.total-eps .subject').text(totalEpisodeCount);\n\n\t\t\tvar missingDays = Math.floor((new Date() - getProcessedDate()) / oneDay);\n\n\n\t\t\tvar opt =\n\t\t\t{\n\t\t\t\tchart:\n\t\t\t\t{\n\t\t\t\t\trenderTo: $('.history-daily .target')[0],\n\t\t\t\t\ttype: 'column',\n\t\t\t\t\tmarginTop: 8\n\t\t\t\t},\n\n\t\t\t\txAxis:\n\t\t\t\t{\n\t\t\t\t\tcategories: keys,\n\t\t\t\t\ttitle:\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: 'Days ago',\n\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t},\n\t\t\t\t\tlabels:\n\t\t\t\t\t{\n\t\t\t\t\t\tstyle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfontSize: '10px !important'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tplotBands:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfrom: 6.5,\n\t\t\t\t\t\t\tto: 6.5 + 7,\n\t\t\t\t\t\t\tzIndex: 3,\n\t\t\t\t\t\t\tcolor: 'rgba(200, 230, 255, 0.2)'\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfrom: 21 - 0.5,\n\t\t\t\t\t\t\tto: 21 - 0.5 - missingDays,\n\t\t\t\t\t\t\tzIndex: 3,\n\t\t\t\t\t\t\tcolor: 'rgba(255, 200, 200, 0.2)'\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\n\t\t\t\tyAxis:\n\t\t\t\t{\n\t\t\t\t\ttitle:\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: '<?php echo ucfirst(TextHelper::getMediaUnitText($viewContext->media, false)) ?> count'\n\t\t\t\t\t},\n\t\t\t\t\tmin: 0,\n\t\t\t\t\tallowDecimals: false\n\t\t\t\t},\n\n\t\t\t\ttooltip:\n\t\t\t\t{\n\t\t\t\t\tformatter: function()\n\t\t\t\t\t{\n\t\t\t\t\t\tvar text = '<?php echo ucfirst(TextHelper::getMediaUnitText($viewContext->media, true)) ?> completed ';\n\t\t\t\t\t\tif (this.x == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext += 'today';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (this.x == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext += 'yesterday';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext += this.x + ' days ago';\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext += ': ' + this.y;\n\t\t\t\t\t\treturn text;\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tseries:\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: $.map(values, function(a, index)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar ret =\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: keys[index],\n\t\t\t\t\t\t\t\tgroupDate: dates[index],\n\t\t\t\t\t\t\t\ty: a.length\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar groupDate = this.groupDate;\n\t\t\t\t\t\t\t\t\tvar daysAgo = this.name;\n\t\t\t\t\t\t\t\t\ttoggleEntries($('.history-daily .entries-wrapper'), {'sender': 'daily-history', 'filter-param': groupDate}, false, function()\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$('.history-daily .entries-wrapper .entries-sub-wrapper').hide();\n\t\t\t\t\t\t\t\t\t\t$('.history-daily .entries-wrapper #date-' + groupDate).show();\n\t\t\t\t\t\t\t\t\t\t$('.history-daily .entries-wrapper #date-' + groupDate + ' .days-ago').text(daysAgo);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t],\n\n\t\t\t\tplotOptions:\n\t\t\t\t{\n\t\t\t\t\tcolumn:\n\t\t\t\t\t{\n\t\t\t\t\t\tpointWidth: 17\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnew Highcharts.Chart(opt);\n\t\t</script>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-history-monthly.phtml",
    "content": "<div class=\"section history-monthly\">\n\t<h2>\n\t\tCompletion by month\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if (empty($viewContext->monthlyHistoryGroups)): ?>\n\t\t\t<p>No <?php echo Media::toString($viewContext->media) ?> you've completed has its completion date specified.<br>\n\t\t\tThis graph won&rsquo;t work without this data.</p>\n\t\t<?php else: ?>\n\t\t\t<?php $shortMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] ?>\n\t\t\t<?php $longMonthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] ?>\n\t\t\t<table>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t\t<?php foreach ($shortMonthNames as $monthName): ?>\n\t\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t\t<?php echo $monthName ?>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t<?php foreach ($viewContext->monthlyHistoryGroups as $year => $months): ?>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class=\"entries-trigger\" data-key=\"<?php printf('year-%04d', $year) ?>\" data-tooltip=\"<?php printf('%s completed in %s (%s, %s)', ucfirst(Media::toString($viewContext->media)), $year, count($months, COUNT_RECURSIVE) - count($months), $viewContext->yearlyHistoryGroupsScores[$year] ? 'mean score: ' . $viewContext->yearlyHistoryGroupsScores[$year] : 'none rated') ?>\">\n\t\t\t\t\t\t\t\t<?php echo $year ?>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t<?php foreach (range(1, 12) as $month): ?>\n\t\t\t\t\t\t\t\t<?php $class = ($year == date('Y') && $month == date('m')) ? 'box-cell now' : 'box-cell' ?>\n\t\t\t\t\t\t\t\t<?php $entries = isset($months[$month]) ? $months[$month] : [] ?>\n\t\t\t\t\t\t\t\t<?php if (count($entries)): ?>\n\t\t\t\t\t\t\t\t\t<td class=\"<?php echo $class ?> entries-trigger\" data-key=\"<?php printf('month-%04d-%02d', $year, $month) ?>\" data-tooltip=\"<?php printf('%s completed in %s %s (%s, %s)', ucfirst(Media::toString($viewContext->media)), $shortMonthNames[$month - 1], $year, count($entries), $viewContext->monthlyHistoryGroupsScores[$year][$month] ? 'mean score: ' . $viewContext->monthlyHistoryGroupsScores[$year][$month] : 'none rated') ?>\">\n\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t<td class=\"<?php echo $class ?>\">\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\t\t<div class=\"box-wrapper\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"box\" style=\"opacity: <?php printf('%.02f', count($entries) / max(1, $viewContext->monthlyHistoryMax)) ?>\">\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\n\t\t\t<?php if (!empty($viewContext->monthlyHistoryUnknownEntries)): ?>\n\t\t\t\t<p class=\"unknown\">Also, there are <a class=\"entries-trigger\" href=\"#\" data-key=\"month-unknown\"><?php printf('%d %s', count($viewContext->monthlyHistoryUnknownEntries), count($viewContext->monthlyHistoryUnknownEntries) > 1 ? 'titles' : 'title') ?></a> with unknown completion date specified.</p>\n\t\t\t<?php endif ?>\n\t\t\t<div class=\"clear\"></div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t\t<?php foreach ($viewContext->monthlyHistoryGroups as $year => $months): ?>\n\t\t\t\t\t<div class=\"entries-sub-wrapper\" id=\"<?php printf('year-%04d', $year) ?>\">\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t\t<?php printf('%s completed in %s: (%s, %s)', ucfirst(Media::toString($viewContext->media)), $year, count($months, COUNT_RECURSIVE) - count($months), $viewContext->yearlyHistoryGroupsScores[$year] ? 'mean score: ' . $viewContext->yearlyHistoryGroupsScores[$year] : 'none rated') ?>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<?php if ($viewContext->isPrivate): ?>\n\t\t\t\t\t\t\t<p>Can&rsquo;t show you titles from a private list.</p>\n\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t<?php foreach ($months as $month => $entries): ?>\n\t\t\t\t\t\t\t\t\t<?php foreach ($entries as $entry): ?>\n\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<?php foreach ($months as $month => $entries): ?>\n\t\t\t\t\t\t<?php if ($month > 0): ?>\n\t\t\t\t\t\t\t<div class=\"entries-sub-wrapper\" id=\"<?php printf('month-%04d-%02d', $year, $month) ?>\">\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t\t\t\t<?php printf('%s completed in %s %s: (%s, %s)', ucfirst(Media::toString($viewContext->media)), $longMonthNames[$month - 1], $year, count($entries), $viewContext->monthlyHistoryGroupsScores[$year][$month] ? 'mean score: ' . $viewContext->monthlyHistoryGroupsScores[$year][$month] : 'none rated') ?>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<?php if ($viewContext->isPrivate): ?>\n\t\t\t\t\t\t\t\t\t<p>Can&rsquo;t show you titles from a private list.</p>\n\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t<?php foreach ($entries as $entry): ?>\n\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t<?php endforeach ?>\n\t\t\t\t<?php if (!empty($viewContext->monthlyHistoryUnknownEntries)): ?>\n\t\t\t\t\t<?php $entries = $viewContext->monthlyHistoryUnknownEntries ?>\n\t\t\t\t\t<div class=\"entries-sub-wrapper\" id=\"month-unknown\">\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t\t<?php printf('%s with unknown completion date: (%s, %s)', ucfirst(Media::toString($viewContext->media)), count($entries), $viewContext->monthlyHistoryUnknownEntriesScore ? 'mean score: ' . $viewContext->monthlyHistoryUnknownEntriesScore : 'none rated') ?>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<?php foreach ($entries as $entry): ?>\n\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t<span class=\"details\">&nbsp;(<?php echo $entry->score ? 'rated with ' . $entry->score : 'unrated' ?>)</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t<?php endif ?>\n\t\t\t</div>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-history.phtml",
    "content": "<?php self::renderFile('user-history-daily', $viewContext) ?>\n<?php self::renderFile('user-history-monthly', $viewContext) ?>\n"
  },
  {
    "path": "src/Views/user-list.phtml",
    "content": "<div class=\"section list\">\n\t<h2>\n\t\t<?php echo ucfirst(Media::toString($viewContext->media)) ?> list\n\t\t<span class=\"filter-hint\">&nbsp;(<span class=\"filter-hint-shown\"></span> of <span class=\"filter-hint-total\"></span>)</span>\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if (count($viewContext->list) == 0): ?>\n\t\t\t<p>Sadly, <?php echo $viewContext->user->name ?>&rsquo;s <?php echo Media::toString($viewContext->media) ?> list is empty.<br>\n\t\t\tIf this is your list, add (and rate) something and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.</p>\n\t\t<?php elseif ($viewContext->private): ?>\n\t\t\t<p>Sadly, <?php echo Media::toString($viewContext->media) ?> list of this user is private.</p>\n\t\t\t<p>If this is your list, you can <a target=\"_blank\" href=\"https://myanimelist.net/editprofile.php?go=listpreferences\" rel=\"noreferrer\">click here</a> and change your privacy settings to make it visible.</p>\n\t\t<?php else: ?>\n\n\t\t\t<form id=\"filter-form\">\n\t\t\t\t<label for=\"filter-title\">Filter:</label>\n\t\t\t\t<input type=\"text\" name=\"filter-title\" id=\"filter-title\" placeholder=\"Title&hellip;\"/>\n\t\t\t\t<select name=\"filter-status\" id=\"filter-status\">\n\t\t\t\t\t<option value=\"\">All</option>\n\t\t\t\t\t<option value=\"<?php echo UserListStatus::Completing ?>\"><?php echo $viewContext->media == Media::Anime ? 'Watching' : 'Reading' ?></option>\n\t\t\t\t\t<option value=\"<?php echo UserListStatus::Finished ?>\">Completed</option>\n\t\t\t\t\t<option value=\"<?php echo UserListStatus::OnHold ?>\">On-hold</option>\n\t\t\t\t\t<option value=\"<?php echo UserListStatus::Dropped ?>\">Dropped</option>\n\t\t\t\t\t<option value=\"<?php echo UserListStatus::Planned ?>\">Plan to <?php echo $viewContext->media == Media::Anime ? 'watch' : 'read' ?></option>\n\t\t\t\t</select>\n\t\t\t\t<button class=\"btn\" type=\"reset\" name=\"filter-clear\" id=\"filter-clear\">Reset</button>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</form>\n\n\t\t\t<table class=\"tablesorter\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th class=\"status\" data-tooltip=\"Status\">S</th>\n\t\t\t\t\t\t<th class=\"title\">Title</th>\n\t\t\t\t\t\t<th class=\"score\" data-tooltip=\"User&rsquo;s rating\">R</th>\n\t\t\t\t\t\t<th class=\"average-score\" data-tooltip=\"Avg. rating on MAL\">MAL</th>\n\t\t\t\t\t\t<th class=\"diff\" data-tooltip=\"Difference = User&rsquo;s rating - Avg. rating on MAL\">Diff.</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\n\t\t\t\t<tbody>\n\t\t\t\t\t<?php $k = 1 ?>\n\t\t\t\t\t<?php foreach ($viewContext->list as $mixedUserMedia): ?>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"status status-<?php echo $mixedUserMedia->status ?>\"></td>\n\n\t\t\t\t\t\t\t<td class=\"title\" data-sorter=\"<?php echo htmlspecialchars($mixedUserMedia->title) ?>\">\n\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $mixedUserMedia->mal_link ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($mixedUserMedia->title) ?>\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t<td class=\"score\" data-sorter=\"<?php echo $mixedUserMedia->score ?>\">\n\t\t\t\t\t\t\t\t<?php echo $mixedUserMedia->score ?: '-' ?>\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t<td class=\"average-score\" data-sorter=\"<?php echo $mixedUserMedia->average_score ?>\">\n\t\t\t\t\t\t\t\t<?php echo $mixedUserMedia->average_score > 0 ? number_format($mixedUserMedia->average_score, 2) : '-' ?>\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t<?php $diff = sprintf('%.02f', $mixedUserMedia->score - $mixedUserMedia->average_score) ?>\n\t\t\t\t\t\t\t<?php if (!$mixedUserMedia->score): ?>\n\t\t\t\t\t\t\t\t<?php $diff = '-' ?>\n\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t<?php if ($diff[0] != '-' and $diff != '0.00'): ?>\n\t\t\t\t\t\t\t\t<?php $diff = '+' . $diff ?>\n\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t<td class=\"diff\" data-sorter=\"<?php echo $diff == '-' ? '-10' : $diff ?>\">\n\t\t\t\t\t\t\t\t<?php if ($diff[0] == '-'): ?>\n\t\t\t\t\t\t\t\t\t<span class=\"lower\"><?php echo $diff ?></span>\n\t\t\t\t\t\t\t\t<?php elseif ($diff[0] == '+'): ?>\n\t\t\t\t\t\t\t\t\t<span class=\"higher\"><?php echo $diff ?></span>\n\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t<span class=\"equal\"><?php echo $diff ?></span>\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t<?php endif ?>\n\n\t</div>\n</div>\n\n\n\n<script type=\"text/javascript\">\n\t/* add some attributes to cells - we do it here to save output html size */\n\t<?php $icons = [\n\t\tUserListStatus::Planned => [4, 'status-planned'],\n\t\tUserListStatus::Dropped => [5, 'status-dropped'],\n\t\tUserListStatus::Completing => [1, 'status-completing'],\n\t\tUserListStatus::OnHold => [3, 'status-onhold'],\n\t\tUserListStatus::Finished => [2, 'status-finished']];\n\t?>\n\t<?php foreach ($icons as $status => $info): ?>\n\t\t$('.status-<?php echo $status ?>').attr({\n\t\t\t'data-tooltip': '<?php echo ucfirst(UserListStatus::toString($status)) ?>',\n\t\t\t'data-sorter': <?php echo $info[0] ?>}\n\t\t).append($('<i class=\"icon-<?php echo $info[1] ?>\"/>'));\n\t<?php endforeach ?>\n</script>\n"
  },
  {
    "path": "src/Views/user-menu.phtml",
    "content": "<nav>\n\t<ul>\n\t\t<?php if ($viewContext->module == 'UserControllerProfileModule'): ?>\n\t\t\t<li class=\"active\">\n\t\t<?php else: ?>\n\t\t\t<li>\n\t\t<?php endif ?>\n\t\t\t<a class=\"waitable\" href=\"<?php echo UserControllerProfileModule::url($viewContext->user->name) ?>\">\n\t\t\t\t<span><?php echo UserControllerProfileModule::getText($viewContext, null) ?></span>\n\t\t\t\t<i title=\"<?php echo UserControllerProfileModule::getText($viewContext, null) ?>\" class=\"icon-menu-profile\"></i>\n\t\t\t</a>\n\t\t</li>\n\t</ul>\n\t<div class=\"clear\"></div>\n</nav>\n\n<?php foreach (Media::getConstList() as $media): ?>\n\t<hr>\n\t<nav class=\"<?php echo Media::toString($media) ?>\">\n\t\t<ul>\n\t\t\t<?php foreach (UserController::getAvailableModules() as $module): ?>\n\t\t\t\t<?php if (in_array($media, $module::getMediaAvailability())): ?>\n\t\t\t\t\t<?php if ($viewContext->module == $module and $viewContext->media == $media): ?>\n\t\t\t\t\t\t<li class=\"active\">\n\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t<a class=\"waitable\" href=\"<?php echo $module::url($viewContext->user->name, $media) ?>\">\n\t\t\t\t\t\t\t<span><?php echo $module::getText($viewContext, $media) ?></span>\n\t\t\t\t\t\t\t<i title=\"<?php echo $module::getText($viewContext, $media) ?>\" class=\"icon-menu-<?php $x = explode(' ', strtolower($module::getText($viewContext, $media))); echo end($x) ?>\"></i>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t<?php endif ?>\n\t\t\t<?php endforeach ?>\n\t\t</ul>\n\t</nav>\n\t<div class=\"clear\"></div>\n<?php endforeach ?>\n\n<input type=\"hidden\" id=\"user-id\" value=\"<?php echo $viewContext->user->id ?>\">\n<input type=\"hidden\" id=\"user-name\" value=\"<?php echo $viewContext->user->name ?>\">\n<input type=\"hidden\" id=\"media\" value=\"<?php echo Media::toString($viewContext->media) ?>\">\n<input type=\"hidden\" id=\"processed\" value=\"<?php echo date('c', isset($viewContext->user->processed) ? strtotime($viewContext->user->processed) : 0) ?>\">\n"
  },
  {
    "path": "src/Views/user-profile-basic.phtml",
    "content": "<div class=\"section basic\">\n\t<div id=\"profile-details\"\n\t\tdata-date=\"<?php echo date('c', isset($viewContext->user->processed) ? strtotime($viewContext->user->processed) : 0) ?>\"\n\t\tdata-ban-state=\"<?php echo BanHelper::getUserBanState($viewContext->user->name) ?>\"\n\t\tdata-queue-min-wait=\"<?php echo Config::$userQueueMinWait ?>\"\n\t\tdata-queue-add-url=\"<?php echo UserControllerQueueAddModule::url($viewContext->user->name) ?>\"\n\t\tdata-queue-pos-url=\"<?php echo UserControllerQueuePositionModule::url($viewContext->user->name) ?>\">\n\t</div>\n\n\t<h2>\n\t\t<!-- use AJAXes because page gets cached and we want fresh info -->\n\t\t<span class=\"updated\" data-tooltip=\"Time of last data update\">\n\t\t\t<!--<?php echo date('M d, H:i', isset($viewContext->user->processed) ? strtotime($viewContext->user->processed) : 0) ?> UTC-->\n\t\t</span>\n\n\t\t<a target=\"_blank\" href=\"https://myanimelist.net/profile/<?php echo $viewContext->user->name ?>\" rel=\"noreferrer\">\n\t\t\t<?php echo $viewContext->user->name ?>\n\t\t</a>&rsquo;s profile\n\n\t\t<span class=\"queue-pos\" data-tooltip=\"Position in queue\">\n\t\t</span>\n\t\t<span class=\"clear\"></span><!-- fix for small pages -->\n\t</h2>\n\n\t<div class=\"section-body\">\n\t\t<div class=\"right user-pic\">\n\t\t\t<a target=\"_blank\" href=\"https://myanimelist.net/profile/<?php echo $viewContext->user->name ?>\" rel=\"noreferrer\">\n\t\t\t<?php if (empty($viewContext->user->picture_url)): ?>\n\t\t\t\t<img class=\"profile unavailable\" alt=\"No profile picture\" src=\"/media/img/pixel.gif\">\n\t\t\t<?php else: ?>\n\t\t\t\t<img class=\"profile\" alt=\"<?php echo $viewContext->user->name ?>&rsquo;s profile picture\" src=\"/media/img/pixel.gif\" style=\"background-image: url('<?php echo $viewContext->user->picture_url ?>')\">\n\t\t\t<?php endif ?>\n\t\t\t</a>\n\t\t</div>\n\n\t\t<div class=\"left\">\n\t\t\t<div class=\"mini-section\">\n\t\t\t\t<div class=\"years\">\n\t\t\t\t\t<p class=\"big-number\">\n\t\t\t\t\t\t<span class=\"desc\">Years on MAL:</span>\n\t\t\t\t\t\t<span class=\"value\">\n\t\t\t\t\t\t\t<?php if ($viewContext->yearsOnMal): ?>\n\t\t\t\t\t\t\t\t<?php echo TextHelper::floorDecimal($viewContext->yearsOnMal, 1) ?>\n\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\tunknown\n\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"mal-links\">\n\t\t\t\t\t<a target=\"_blank\" href=\"https://myanimelist.net/profile/<?php echo $viewContext->user->name ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\tVisit MAL profile\n\t\t\t\t\t</a>\n\t\t\t\t\t<br>\n\t\t\t\t\t<a target=\"_blank\" href=\"https://myanimelist.net/animelist/<?php echo $viewContext->user->name ?><?php if (Config::$sendReferrer) echo '&amp;sclick=1'; ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\tAnime list on MAL\n\t\t\t\t\t</a>\n\t\t\t\t\t<br>\n\t\t\t\t\t<a target=\"_blank\" href=\"https://myanimelist.net/mangalist/<?php echo $viewContext->user->name ?><?php if (Config::$sendReferrer) echo '&amp;sclick=1'; ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\tManga list on MAL\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"clear\"></div>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-profile-friends.phtml",
    "content": "<div class=\"section friends\">\n\t<h2>\n\t\tFriends (<?php echo count($viewContext->friends) < 100 ? count($viewContext->friends) : '100+' ?>)\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if (count($viewContext->friends) == 0): ?>\n\t\t\t<p>This user has no friends on MAL. :(</p>\n\t\t<?php else: ?>\n\t\t\t<ul>\n\t\t\t\t<?php foreach ($viewContext->friends as $friend): ?>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a class=\"mg waitable\" href=\"<?php echo UserControllerProfileModule::url($friend->name, $viewContext->name) ?>\">\n\t\t\t\t\t\t\t<span><?php echo $friend->name ?></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t<?php endforeach ?>\n\t\t\t</ul>\n\t\t\t<div class=\"clear\"></div>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-profile-media-summaries.phtml",
    "content": "<?php foreach (Media::getConstList() as $media): ?>\n<div class=\"section <?php echo Media::toString($media) ?>-summary\">\n\t<h2>\n\t\t<?php echo ucfirst(Media::toString($media)) ?> summary\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<div class=\"left mini-section\">\n\t\t\t<p class=\"big-number\">\n\t\t\t\t<span class=\"desc\">Completed:</span>\n\t\t\t\t<span class=\"value\"><?php echo $viewContext->finished[$media] ?></span>\n\t\t\t</p>\n\n\t\t\t<div class=\"bar\">\n\t\t\t\t<div class=\"filled\" style=\"width: <?php echo $viewContext->finished[$media] * 100.0 / max(1, Model_Media::getCount($media)) ?>%\"></div>\n\t\t\t</div>\n\n\t\t\t<?php printf('%.02f', $viewContext->finished[$media] * 100.0 / max(1, Model_Media::getCount($media))) ?>% of all <?php echo Media::toString($media) ?>\n\t\t</div>\n\n\t\t<div class=\"right mini-section\">\n\t\t\t<p class=\"big-number\">\n\t\t\t\t<span class=\"desc\">Mean score:</span>\n\t\t\t\t<span class=\"value\"><?php printf('%.02f', $viewContext->meanUserScore[$media]) ?></span>\n\t\t\t</p>\n\n\t\t\t<div class=\"bar\">\n\t\t\t\t<div class=\"filled\" style=\"width: <?php echo $viewContext->meanUserScore[$media] * 100.0 / 10.0 ?>%\"></div>\n\t\t\t\t<div class=\"tick\" style=\"left: <?php echo $viewContext->meanGlobalScore[$media] * 100.0 / 10.0 ?>%\"></div>\n\t\t\t</div>\n\n\t\t\t<?php printf('%.02f', abs($viewContext->meanUserScore[$media] - $viewContext->meanGlobalScore[$media])) ?>&nbsp;\n\t\t\t<?php echo $viewContext->meanUserScore[$media] > $viewContext->meanGlobalScore[$media] ? 'higher' : 'lower' ?>&nbsp;\n\t\t\tthan global mean\n\t\t</div>\n\n\t\t<div class=\"clear\"></div>\n\n\t\t<div class=\"left mini-section\">\n\t\t\t<p class=\"big-number\">\n\t\t\t\t<span class=\"desc\">Franchises:</span>\n\t\t\t\t<span class=\"value\"><?php echo $viewContext->franchiseCount[$media] ?></span>\n\t\t\t</p>\n\t\t\t<a href=\"javascript:toggleEntries($('.<?php echo Media::toString($media) ?>-summary .entries-wrapper'), {'sender': 'franchises', 'media': '<?php echo $media ?>'})\">\n\t\t\t\tClick to show full list\n\t\t\t</a>\n\t\t</div>\n\n\t\t<div class=\"right mini-section\">\n\t\t\t<p class=\"big-number\">\n\t\t\t\t<span class=\"desc\"><?php echo ucfirst(TextHelper::getMediaUnitText($media, true)) ?>:</span>\n\t\t\t\t<span class=\"value\">\n\t\t\t\t\t<?php if ($media == Media::Anime): ?>\n\t\t\t\t\t\t<?php echo $viewContext->episodes ?>\n\t\t\t\t\t<?php elseif ($media == Media::Manga): ?>\n\t\t\t\t\t\t<?php echo $viewContext->chapters ?>\n\t\t\t\t\t<?php endif ?>\n\t\t\t\t</span>\n\t\t\t</p>\n\t\t\t<?php if ($viewContext->mismatchedCount[$media]): ?>\n\t\t\t\t<a href=\"javascript:toggleEntries($('.<?php echo Media::toString($media) ?>-summary .entries-wrapper'), {'sender': 'mismatches', 'media': '<?php echo $media ?>'})\">\n\t\t\t\t\t<?php printf('Found %d %s', $viewContext->mismatchedCount[$media], $viewContext->mismatchedCount[$media] > 1 ? 'mismatches' : 'mismatch') ?>\n\t\t\t\t</a>\n\t\t\t<?php endif ?>\n\t\t</div>\n\n\t\t<div class=\"clear\"></div>\n\n\t\t<div class=\"entries-wrapper\">\n\t\t</div>\n\t</div>\n</div>\n<?php endforeach ?>\n"
  },
  {
    "path": "src/Views/user-profile.phtml",
    "content": "<?php self::renderFile('user-profile-basic', $viewContext) ?>\n<?php self::renderFile('user-profile-media-summaries', $viewContext) ?>\n<?php //self::renderFile('user-profile-friends', $viewContext) ?>\n"
  },
  {
    "path": "src/Views/user-ratings-dist.phtml",
    "content": "<div class=\"section rating-dist\">\n\t<h2>\n\t\tRating distribution\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->ratingDistribution->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any titles for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<ul class=\"infobox\">\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"prefix\">Total rated</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%d', $viewContext->ratingDistribution->getRatedCount()) ?></span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"prefix\">Mean score</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $viewContext->ratingDistribution->getMeanScore()) ?></span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"prefix\">Std dev.</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $viewContext->ratingDistribution->getStandardDeviation()) ?></span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<a class=\"btn export-trigger\" href=\"#\">Export</a>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t</ul>\n\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<div class=\"popup-wrapper\">\n\t\t\t\t<div class=\"export popup\">\n\t\t\t\t\t<div class=\"header\">\n\t\t\t\t\t\t<a class=\"close\"><i class=\"icon-close\"></i></a>\n\t\t\t\t\t\t<h2>Image export</h2>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"body\">\n\t\t\t\t\t\t<div class=\"custom-theme\">\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<?php $options = [\n\t\t\t\t\t\t\t\t\t1 => 'Bar gradient - left',\n\t\t\t\t\t\t\t\t\t2 => 'Bar gradient - right',\n\t\t\t\t\t\t\t\t\t3 => 'Line gradient - left',\n\t\t\t\t\t\t\t\t\t4 => 'Line gradient - right',\n\t\t\t\t\t\t\t\t\t5 => 'Background',\n\t\t\t\t\t\t\t\t\t6 => 'Text I - numbers',\n\t\t\t\t\t\t\t\t\t7 => 'Text II - labels and %',\n\t\t\t\t\t\t\t\t\t8 => 'Title',\n\t\t\t\t\t\t\t\t\t9 => 'Icon',\n\t\t\t\t\t\t\t\t]; ?>\n\t\t\t\t\t\t\t\t<p>Select element:</p>\n\t\t\t\t\t\t\t\t<select class=\"color\" name=\"color\">\n\t\t\t\t\t\t\t\t\t<?php foreach ($options as $key => $text): ?>\n\t\t\t\t\t\t\t\t\t\t<option value=\"<?php echo $key ?>\"><?php echo $text ?></option>\n\t\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t\t</select>\n                                <p>Enter color code or <i>transparent</i>:</p>\n                                <input class=\"hex\" type=\"text\" value=\"#a4c0f4\">\n\t\t\t\t\t\t\t\t<div class=\"colorpicker\"></div>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"body-wrapper\">\n\t\t\t\t\t\t\t<p>You can export your rating distribution as an image, which updates along with your profile. How about putting it on <a target=\"_blank\" href=\"https://myanimelist.net/editprofile.php\" rel=\"noreferrer\">your MAL profile</a>?</p><p>To bypass MAL cache, replace only the 10-digit number in the URL.</p>\n\t\t\t\t\t\t\t<div class=\"combo-wrapper\">\n\t\t\t\t\t\t\t\t<p>Layout:</p>\n\t\t\t\t\t\t\t\t<select class=\"type\" name=\"type\"></select>\n\t\t\t\t\t\t\t\t<p>Theme:</p>\n\t\t\t\t\t\t\t\t<select class=\"theme\" name=\"theme\"></select>\n\t\t\t\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<textarea readonly=\"readonly\" name=\"bbcode\"><?php\n\t\t\t\t\t\t\t\t?>[url=<?php echo UrlHelper::absoluteUrl(UserControllerProfileModule::url($viewContext->user->name, $viewContext->media)) ?>]<?php\n\t\t\t\t\t\t\t\t?>[img]<?php echo UserControllerExportModule::url($viewContext->user->name, $viewContext->media, '[1]') ?><?php\n\t\t\t\t\t\t\t\t?>[/img]<?php\n\t\t\t\t\t\t\t\t?>[/url]<?php\n\t\t\t\t\t\t\t?></textarea>\n\t\t\t\t\t\t\t<div class=\"preview\">\n\t\t\t\t\t\t\t\t<p>Preview (may be scaled):</p>\n\t\t\t\t\t\t\t\t<img alt=\"Preview\" src=\"/media/img/pixel.gif\">\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.rating-dist .target')[0],\n\t\t\t\t\t\ttype: 'bar',\n\t\t\t\t\t\tmarginRight: 35\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tcategories: <?php echo json_encode(array_map(function($x) { return $x == 0 ? '-' : $x; }, array_values($viewContext->ratingDistribution->getGroupsKeys()))) ?>,\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Rating'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Count',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\tif (this.x == '-')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Unrated titles: ' + this.y;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Titles rated with ' + this.x + ': ' + this.y;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar percent = this.y * 100.0 / <?php echo max(1, $viewContext->ratingDistribution->getTotalSize()) ?>;\n\t\t\t\t\t\t\ttext = text + ' (' + (Math.round(percent * 100.0) / 100.0) + '%)';\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_values($viewContext->ratingDistribution->getGroupsSizes())) ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.rating-dist .entries-wrapper'), {'sender': 'ratings', 'filter-param': this.category});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-ratings-length-dist.phtml",
    "content": "<div class=\"section rating-length-dist\">\n\t<h2>\n\t\tRatings vs. <?php echo TextHelper::getMediaUnitText($viewContext->media) ?> count\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->lengthDistribution->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any titles for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<ul class=\"infobox\">\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<?php $scores = array_map(function($entries) { return RatingDistribution::fromEntries($entries)->getMeanScore(); }, $viewContext->lengthDistribution->getGroupsEntries()) ?>\n\t\t\t\t\t\t<?php $key = array_search(max($scores), $scores) ?>\n\t\t\t\t\t\t<span class=\"prefix\">Highest mean</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.2f', $scores[$key]) ?></span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<?php $key = $viewContext->lengthDistribution->getLargestGroupKey() ?>\n\t\t\t\t\t\t<?php list($num, $txt) = explode(' ', TextHelper::getNumberedMediaUnitText($viewContext->media, $key)) ?>\n\t\t\t\t\t\t<span class=\"prefix\">Most common</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php echo $num ?></span>\n\t\t\t\t\t\t<span class=\"suffix\"><?php echo $txt ?></span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t</ul>\n\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.rating-length-dist .target')[0],\n\t\t\t\t\t\ttype: 'spline',\n\t\t\t\t\t\tmarginTop: 15\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tcategories: <?php echo json_encode(array_values($viewContext->lengthDistribution->getGroupsKeys())) ?>,\n\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trotation: -45,\n\t\t\t\t\t\t\talign: 'right'\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: '<?php echo ucfirst(TextHelper::getMediaUnitText($viewContext->media, false)) ?> count',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\tmax: 10,\n\t\t\t\t\t\t\topposite: true,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext: 'Mean score',\n\t\t\t\t\t\t\t\tmargin: 10,\n\t\t\t\t\t\t\t\tstyle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcolor: Highcharts.theme.colors[1]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabels:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstyle:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcolor: Highcharts.theme.colors[1]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext: 'Title count',\n\t\t\t\t\t\t\t\tmargin: 10,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgridLineWidth: 0,\n\t\t\t\t\t\t\tminorGridLineWidth: 0\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tshared: true,\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\tif (this.x == '?')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Mean score for titles of unknown length: ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Mean score for titles ' + this.x;\n\t\t\t\t\t\t\t\t<?php if ($viewContext->media == Media::Anime): ?>\n\t\t\t\t\t\t\t\t\ttext += ' ep. long';\n\t\t\t\t\t\t\t\t\tif (this.x == '1')\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttext += ' (w/o movies)';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\ttext += ' ch. long';\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\ttext += ': ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (this.points[1].y > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += this.points[1].y.toFixed(2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext += 'unrated!';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttext += ' (total: ' + this.points[0].y + ')';\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'column',\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_values($viewContext->lengthDistribution->getGroupsSizes())) ?>,\n\t\t\t\t\t\t\tyAxis: 1,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.rating-length-dist .entries-wrapper'), {'sender': 'length', 'filter-param': this.category});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_values($scores)) ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.rating-length-dist .entries-wrapper'), {'sender': 'length', 'filter-param': this.category});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-ratings-time-dist.phtml",
    "content": "<div class=\"section rating-time-dist\">\n\t<h2>\n\t\tRatings vs. time spent\n\t</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->ratingDistribution->getLargestGroupSize() == 0): ?>\n\t\t\t<p>There is no information about any titles for this user.</p>\n\t\t\t<p>Add a few titles and come back in <?php echo TextHelper::getTimeText($viewContext->updateWait, TextHelper::TIME_HOURS) ?>.<br>We'll be waiting for you.</p>\n\t\t<?php else: ?>\n\t\t\t<ul class=\"infobox\">\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"prefix\">Total time</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $viewContext->ratingTimeDistribution->getTotalTime() / 1440.) ?></span>\n\t\t\t\t\t\t<span class=\"suffix\">days</span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t\t<!--<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"prefix\">Mean score</span>\n\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $viewContext->ratingTimeDistribution->getMeanScore()) ?></span>\n\t\t\t\t\t\t<span class=\"suffix\">(weighted)</span>\n\t\t\t\t\t</div>\n\t\t\t\t</li>-->\n\t\t\t\t<li>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<?php if ($viewContext->earliestTimeKnown): ?>\n\t\t\t\t\t\t\t<div data-tooltip=\"Earliest time user started or finished|<?php echo $viewContext->media == Media::Manga ? 'reading' : 'watching' ?> something, or joined MAL,|was on <?php echo date('Y-m-d', $viewContext->earliestTimeKnown) ?>.\">\n\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t<span class=\"prefix\">Average time</span>\n\t\t\t\t\t\t\t\t<span class=\"subject\"><?php printf('%.02f', $viewContext->meanTime) ?></span>\n\t\t\t\t\t\t\t<span class=\"suffix\">min/day</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t</ul>\n\n\t\t\t<div class=\"target-wrapper\">\n\t\t\t\t<div class=\"target\"></div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\n\t\t\t<div class=\"entries-wrapper\">\n\t\t\t</div>\n\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar opt =\n\t\t\t\t{\n\t\t\t\t\tchart:\n\t\t\t\t\t{\n\t\t\t\t\t\trenderTo: $('.rating-time-dist .target')[0],\n\t\t\t\t\t\ttype: 'bar',\n\t\t\t\t\t\tmarginRight: 15\n\t\t\t\t\t},\n\n\t\t\t\t\txAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\tcategories: <?php echo json_encode(array_map(function($x) { return $x == 0 ? '-' : $x; }, array_values($viewContext->ratingDistribution->getGroupsKeys()))) ?>,\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Rating'\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tyAxis:\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Hours spent',\n\t\t\t\t\t\t\tmargin: 15\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\ttooltip:\n\t\t\t\t\t{\n\t\t\t\t\t\tformatter: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar text;\n\t\t\t\t\t\t\tif (this.x == '-')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Hours spent on unrated titles: ' + Math.round(this.y * 100) / 100.0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext = 'Hours spent on titles rated with ' + this.x + ': ' + Math.round(this.y * 100) / 100.0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar percent = this.y * 100.0 / <?php echo max(1, $viewContext->ratingTimeDistribution->getTotalSize() / 60.) ?>;\n\t\t\t\t\t\t\ttext = text + ' (' + (Math.round(percent * 100.0) / 100.0) + '%)';\n\t\t\t\t\t\t\treturn text;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\tseries:\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: <?php echo json_encode(array_map(function($x) { return $x / 60.; }, array_values($viewContext->ratingTimeDistribution->getGroupsSizes()))) ?>,\n\t\t\t\t\t\t\tpoint:\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tevents:\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclick: function(e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttoggleEntries($('.rating-time-dist .entries-wrapper'), {'sender': 'ratings', 'filter-param': this.category});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tnew Highcharts.Chart(opt);\n\t\t\t</script>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-ratings.phtml",
    "content": "<?php self::renderFile('user-ratings-dist', $viewContext) ?>\n<?php self::renderFile('user-ratings-time-dist', $viewContext) ?>\n<?php self::renderFile('user-ratings-length-dist', $viewContext) ?>\n"
  },
  {
    "path": "src/Views/user-recommendations-missing.phtml",
    "content": "<div class=\"section missing\">\n\t<h2>\n\t\tMissing titles (<?php echo $viewContext->missingTitlesCount; ?>)\n\t</h2>\n\t<p class=\"undelete-msg\">There are <strong>0</strong> hidden recommendations. <a href=\"#\" class=\"undelete-trigger\">Show them</a></p>\n\t<p class=\"center\">Hide relation type: <a href=\"#\" class=\"delete-trigger-alt-setting\">Alt. setting</a> &#8226; <a href=\"#\" class=\"delete-trigger-alt-version\">Alt. version</a> &#8226; <a href=\"#\" class=\"delete-trigger-spin-off\">Spin-off</a> &#8226; <a href=\"#\" class=\"delete-trigger-character\">Character</a> &#8226; <a href=\"#\" class=\"delete-trigger-summary\">Summary</a> &#8226; <a href=\"#\" class=\"delete-trigger-side-story\">Side story</a> &#8226; <a href=\"#\" class=\"delete-trigger-other\">Other</a></p>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->private): ?>\n\t\t\t<p>Same as above&hellip;</p>\n\t\t<?php elseif (empty($viewContext->missingTitles)): ?>\n\t\t\t<p>Yay! No missing relations!</p>\n\t\t<?php else: ?>\n\t\t\t<table>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th class=\"subject\">You've <?php echo $viewContext->media == Media::Anime ? 'watched' : 'read' ?> this&hellip;</th>\n\t\t\t\t\t\t<th class=\"proposed\">&hellip;so you might want to check this:</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<?php foreach ($viewContext->missingTitles as $entry): ?>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"subject\">\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" title=\"<?php echo htmlspecialchars($entry->title) ?>\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t\t<?php if ($entry->status == UserListStatus::Completing): ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<i data-tooltip=\"Completing\" class=\"left icon-status-completing\"></i>\n\t\t\t\t\t\t\t\t\t\t\t<?php elseif ($entry->publishing_status == MediaStatus::NotYetPublished): ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<i data-tooltip=\"Not yet <?php echo $viewContext->media == Media::Anime ? 'aired' : 'published' ?>\" class=\"left icon-not-yet-aired\"></i>\n\t\t\t\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"left icon-empty\"></i>\n\t\t\t\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"proposed\">\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<?php foreach ($entry->relations as $entry): ?>\n\t\t\t\t\t\t\t\t\t\t<li data-id=\"<?php echo Media::toString($entry->media) . $entry->mal_id ?>\">\n\t\t\t\t\t\t\t\t\t\t\t<?php if ($entry->publishing_status == MediaStatus::NotYetPublished): ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<i data-tooltip=\"Not yet <?php echo $viewContext->media == Media::Anime ? 'aired' : 'published' ?>\" class=\"left icon-not-yet-aired\"></i>\n\t\t\t\t\t\t\t\t\t\t\t<?php else: ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"left icon-empty\"></i>\n\t\t\t\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"delete-trigger\">\n\t\t\t\t\t\t\t\t\t\t\t\t<i data-tooltip=\"Hide\" class=\"right icon-small-close\"></i>\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t<a data-tooltip=\"<?php echo ucfirst(MediaRelation::toString($entry->relation_type)) ?>\" href=\"<?php echo $entry->mal_link ?>\" title=\"<?php echo htmlspecialchars($entry->title) ?>\" target=\"_blank\" rel=\"noreferrer\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t<?php endforeach ?>\n\t\t\t</table>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-recommendations-new.phtml",
    "content": "<div class=\"section original\">\n\t<h2>Recommendations</h2>\n\t<div class=\"section-body\">\n\t\t<?php if ($viewContext->private): ?>\n\t\t\t<p>Since <?php echo $viewContext->user->name ?>&rsquo;s <?php echo Media::toString($viewContext->media) ?> list is marked as private, we can&rsquo;t reveal its contents by showing recommendations. If this is your list, click <a target=\"_blank\" href=\"https://myanimelist.net/editprofile.php?go=listpreferences\" rel=\"noreferrer\">here</a> to change privacy settings.</p>\n\t\t<?php elseif (empty($viewContext->newRecommendations)): ?>\n\t\t\t<p>Sorry, no new recommendations. Hey, this shouldn&rsquo;t have happened!</p>\n\t\t<?php else: ?>\n\t\t\t<ul>\n\t\t\t\t<?php foreach ($viewContext->newRecommendations as $entry): ?>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" title=\"<?php echo htmlspecialchars($entry->title) ?>\">\n\t\t\t\t\t\t\t<img src=\"<?php echo $entry->picture_url ?>\" alt=\"<?php echo htmlspecialchars($entry->title) ?>\">\n\t\t\t\t\t\t</a>\n\n\t\t\t\t\t\t<div class=\"details-wrapper\">\n\t\t\t\t\t\t\t<div class=\"header\">\n\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"<?php echo $entry->mal_link ?>\" title=\"<?php echo htmlspecialchars($entry->title) ?>\">\n\t\t\t\t\t\t\t\t\t<?php echo htmlspecialchars($entry->title) ?>\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<?php $genres = implode(', ', array_map(function($x) { return $x->name; }, $entry->genres)) ?>\n\t\t\t\t\t\t\t<div class=\"genres details\" title=\"<?php echo $genres ?>\">\n\t\t\t\t\t\t\t\t<?php echo $genres ?>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"type details\">\n\t\t\t\t\t\t\t\t<?php $localSize = 0 ?>\n\t\t\t\t\t\t\t\t<?php if ($entry->media == Media::Anime): ?>\n\t\t\t\t\t\t\t\t\t<?php echo TextHelper::getNumberedMediaUnitText($viewContext->media, $localSize = $entry->episodes, true) ?>\n\t\t\t\t\t\t\t\t<?php elseif ($entry->media == Media::Manga): ?>\n\t\t\t\t\t\t\t\t\t<?php echo TextHelper::getNumberedMediaUnitText($viewContext->media, $localSize = $entry->chapters, true) ?>\n\t\t\t\t\t\t\t\t<?php endif ?>\n\n\t\t\t\t\t\t\t\t<?php if ($localSize > 0 && !empty($entry->franchiseSize) && $localSize != $entry->franchiseSize): ?>\n\t\t\t\t\t\t\t\t\t&nbsp;(<?php echo $entry->franchiseSize ?> in franchise)\n\t\t\t\t\t\t\t\t<?php endif ?>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"season details\">\n\t\t\t\t\t\t\t\t<?php echo ucfirst($entry->getSeason() ?? '') ?>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!--<?php printf('%.02f', $entry->hypothetical_score) ?>-->\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div class=\"clear\"></div>\n\t\t\t\t\t</li>\n\t\t\t\t<?php endforeach ?>\n\t\t\t</ul>\n\t\t<?php endif ?>\n\t</div>\n</div>\n"
  },
  {
    "path": "src/Views/user-recommendations.phtml",
    "content": "<?php self::renderFile('user-recommendations-new', $viewContext) ?>\n<?php self::renderFile('user-recommendations-missing', $viewContext) ?>\n"
  },
  {
    "path": "src/core.php",
    "content": "<?php\nclass AutoLoader\n{\n\tstatic $dirs;\n\n\tpublic static function init()\n\t{\n\t\t$directoryIterator = new RecursiveDirectoryIterator(__DIR__);\n\t\t$iterator = new RecursiveIteratorIterator($directoryIterator);\n\t\t$dirs = [];\n\t\tforeach ($iterator as $file)\n\t\t{\n\t\t\tif ($file->isDir())\n\t\t\t{\n\t\t\t\t$dirs []= $file->getRealPath();\n\t\t\t}\n\t\t}\n\t\t$dirs = array_unique($dirs);\n\t\tself::$dirs = $dirs;\n\t}\n\n\tpublic static function load($className)\n\t{\n\t\t$name = $className . '.php';\n\n\t\tforeach (self::$dirs as $dir)\n\t\t{\n\t\t\t$path = $dir . DIRECTORY_SEPARATOR . $name;\n\t\t\tif (file_exists($path))\n\t\t\t{\n\t\t\t\tinclude $path;\n\t\t\t}\n\t\t}\n\t}\n}\n\nAutoLoader::init();\nspl_autoload_register(['AutoLoader', 'load']);\n\ndate_default_timezone_set('UTC');\nini_set('memory_limit', '1024M');\nErrorHandler::init();\nDatabase::init();\nBenchmarkHelper::init();\n"
  }
]