[
  {
    "path": ".eslintrc",
    "content": "{\n  \"rules\": {\n    \"react-hooks/exhaustive-deps\": false\n  }\n}\n"
  },
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"semi\": true,\n  \"singleQuote\": true,\n  \"trailingComma\": \"all\"\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The 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 to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When 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\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For 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\n  Developers 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\n  For 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\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, 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 to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The 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 of\nworks, 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\n  To \"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 an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"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\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the 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\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"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\n  The \"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\n  The \"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\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All 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\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No 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\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You 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\n  You 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\n  You 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 conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\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\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\n  A 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\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\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\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\n    Corresponding Source from a network server at no charge.\n\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\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\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A 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\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If 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\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding 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\n  When 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\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat 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\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\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All 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\n  If 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\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You 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\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, 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\n  Termination 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\n  You are not required to accept this License in order to receive or\nrun a 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\n  Each 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\n  An \"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\n  You 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\n  A \"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\n  A contributor's \"essential patent claims\" are all patent claims\nowned or 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\n  Each 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\n  In 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\n  If 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\n  If, 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\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing 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\n  If 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 this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding 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\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later 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\n  THERE 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 WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If 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\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If 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 terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"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 mail.\n\n  If 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 appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n\n<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n  <!-- <a href=\"https://github.com/genesy/karabiner-complex-rules-generator/\">\n    <img src=\"./logo.png\" alt=\"Logo\" width=\"80\" height=\"80\">\n  </a> -->\n\n  <h3 align=\"center\">Karabiner Complex Rules Generator</h3>\n\n  <p align=\"center\">\n    <a href=\"https://genesy.github.io/karabiner-complex-rules-generator/\">View Demo</a>\n    ·\n    <a href=\"https://github.com/genesy/karabiner-complex-rules-generator/issues\">Report Bug</a>\n    ·\n    <a href=\"https://github.com/genesy/karabiner-complex-rules-generator/issues\">Request Feature</a>\n    ·\n    <a href=\"https://github.com/genesy/karabiner-complex-rules-generator/pulls\">Send a Pull Request</a>\n  </p>\n</p>\n\n<!-- TABLE OF CONTENTS -->\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [About The Project](#about-the-project)\n  - [Built With](#built-with)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n- [Roadmap](#roadmap)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n- [Acknowledgements](#acknowledgements)\n\n<!-- ABOUT THE PROJECT -->\n\n## About The Project\n\n![Product Name Screen Shot](https://i.imgur.com/fCHYLzi.gif)\n\nAn open-source web app to help make and configure karabiner complex modification files!\n\n### Built With\n\n- ReactJS\n- Material UI\n\n<!-- GETTING STARTED -->\n\n## Getting Started\n\n### Prerequisites\n\n- yarn\n\n```sh\nnpm install yarn -g\n```\n\n### Installation\n\n1. Clone the project\n\n```sh\ngit clone https://github.com/genesy/karabiner-complex-rules-generator.git\n```\n\n2. Install NPM packages\n\n```sh\nyarn install\n```\n\n<!-- USAGE EXAMPLES -->\n\n<!-- ## Usage -->\n\n<!-- Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.\n\n_For more examples, please refer to the [Documentation](https://example.com)_ -->\n\n<!-- ROADMAP -->\n\n## Roadmap\n\nSee the [open issues](https://github.com/genesy/karabiner-complex-rules-generator/issues) for a list of proposed features (and known issues).\n\n<!-- CONTRIBUTING -->\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **extremely appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n<!-- LICENSE -->\n\n## License\n\nDistributed under the GNUv3 License. See `LICENSE` for more information.\n\n<!-- CONTACT -->\n\n## Contact\n\nGene Sy - [@GeneSy](https://twitter.com/GeneSy) - gnsyftw@gmail.com\n\nProject Link: [https://github.com/genesy/karabiner-complex-rules-generator/](https://github.com/genesy/karabiner-complex-rules-generator/)\n\n<!-- ACKNOWLEDGEMENTS -->\n\n## Acknowledgements\n\n- [Img Shields](https://shields.io)\n- [GitHub Pages](https://pages.github.com)\n- [Karabiner Elements](https://pqrs.org/osx/karabiner/)\n\n<!-- MARKDOWN LINKS & IMAGES -->\n<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->\n\n[forks-shield]: https://img.shields.io/github/forks/genesy/karabiner-complex-rules-generator?style=for-the-badge\n[forks-url]: https://github.com/genesy/karabiner-complex-rules-generator/network/members\n[stars-shield]: https://img.shields.io/github/stars/genesy/karabiner-complex-rules-generator?style=for-the-badge\n[stars-url]: https://github.com/genesy/karabiner-complex-rules-generator/stargazers\n[issues-shield]: https://img.shields.io/github/issues/genesy/karabiner-complex-rules-generator?style=for-the-badge\n[issues-url]: https://github.com/genesy/karabiner-complex-rules-generator/issues\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555\n[linkedin-url]: https://linkedin.com/in/roshan-lamichhane\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"karabiner-complex-rules-generator\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"@material-ui/core\": \"^4.9.3\",\n    \"@material-ui/icons\": \"^4.9.1\",\n    \"@material-ui/lab\": \"^4.0.0-alpha.43\",\n    \"@testing-library/jest-dom\": \"^4.2.4\",\n    \"@testing-library/react\": \"^9.3.2\",\n    \"@testing-library/user-event\": \"^7.1.2\",\n    \"@types/jest\": \"^24.9.1\",\n    \"@types/lodash\": \"^4.14.149\",\n    \"@types/node\": \"^12.12.28\",\n    \"@types/react\": \"^16.9.22\",\n    \"@types/react-dom\": \"^16.9.5\",\n    \"@types/react-redux\": \"^7.1.7\",\n    \"immer\": \"^5.3.6\",\n    \"lodash\": \"^4.17.15\",\n    \"react\": \"^16.12.0\",\n    \"react-dom\": \"^16.12.0\",\n    \"react-redux\": \"^7.2.0\",\n    \"react-scripts\": \"3.4.0\",\n    \"redux\": \"^4.0.5\",\n    \"typeface-roboto\": \"^0.0.75\",\n    \"typescript\": \"^3.7.5\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test\",\n    \"eject\": \"react-scripts eject\",\n    \"predeploy\": \"npm run build\",\n    \"deploy\": \"gh-pages -b master -d build\"\n  },\n  \"eslintConfig\": {\n    \"extends\": \"react-app\"\n  },\n  \"homepage\": \"https://genesy.github.io/karabiner-complex-rules-generator\",\n  \"browserslist\": {\n    \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n    \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n    ]\n  },\n  \"devDependencies\": {\n    \"@types/material-ui\": \"^0.21.7\",\n    \"gh-pages\": \"^2.2.0\"\n  }\n}\n"
  },
  {
    "path": "public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <link rel=\"icon\" href=\"%PUBLIC_URL%/favicon.ico\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"Web site created using create-react-app\"\n    />\n    <link rel=\"apple-touch-icon\" href=\"%PUBLIC_URL%/logo192.png\" />\n    <!--\n      manifest.json provides metadata used when your web app is installed on a\n      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" />\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>Karabiner Complex Rules Generator</title>\n    <!-- Global site tag (gtag.js) - Google Analytics -->\n    <script\n      async\n      src=\"https://www.googletagmanager.com/gtag/js?id=UA-159092454-1\"\n    ></script>\n    <script>\n      window.dataLayer = window.dataLayer || [];\n      function gtag() {\n        dataLayer.push(arguments);\n      }\n      gtag('js', new Date());\n\n      gtag('config', 'UA-159092454-1');\n    </script>\n    <script async defer src=\"https://buttons.github.io/buttons.js\"></script>\n  </head>\n  <body>\n    <noscript>You need to enable JavaScript to run this app.</noscript>\n    <div id=\"root\"></div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "src/App.css",
    "content": "html,\nbody,\n#root,\n.App {\n  height: 100%;\n}\n\ntextarea {\n  /* height: 80%; */\n  width: 100%;\n  font-size: 12px;\n  background: #ddd;\n  font-family: 'Courier New', Courier, monospace;\n  /* min-height: 400px; */\n}\n.generated-code {\n  height: 300px;\n  white-space: pre;\n  overflow-wrap: normal;\n  overflow-x: scroll;\n}\n\n.MuiExpansionPanel-root {\n  background-color: rgba(0, 0, 0, 0.05) !important;\n}\n\n.MuiExpansionPanel-root:hover {\n  background-color: rgba(0, 0, 0, 0.08) !important;\n}\n\n.form-wrapper {\n  max-height: calc(100vh - 57px);\n  overflow: auto;\n  position: relative;\n}\n"
  },
  {
    "path": "src/App.test.tsx",
    "content": "import React from 'react';\nimport { render } from '@testing-library/react';\nimport App from './App';\n\ntest('renders learn react link', () => {\n  const { getByText } = render(<App />);\n  const linkElement = getByText(/learn react/i);\n  expect(linkElement).toBeInTheDocument();\n});\n"
  },
  {
    "path": "src/App.tsx",
    "content": "import React from 'react';\nimport './App.css';\nimport '@material-ui/core';\nimport 'typeface-roboto';\nimport AppLayout from './AppLayout';\nimport { formStateReducer } from './ducks/formState';\nimport { createStore } from 'redux';\nimport { Provider } from 'react-redux';\n\nconst store = createStore(formStateReducer);\n\nfunction App() {\n  return (\n    <Provider store={store}>\n      <div className=\"App\">\n        <AppLayout />\n      </div>\n    </Provider>\n  );\n}\n\nexport default App;\n"
  },
  {
    "path": "src/AppLayout.tsx",
    "content": "import React from 'react';\nimport {\n  Container,\n  AppBar,\n  Typography,\n  Toolbar,\n  Grid,\n  Box,\n} from '@material-ui/core';\n\nimport MainForm from './components/MainForm';\n\ninterface Props {}\n\nconst AppLayout: React.FC<Props> = () => {\n  return (\n    <>\n      <AppBar position=\"static\">\n        <Container>\n          <Toolbar variant=\"dense\">\n            <Grid xs item>\n              <Typography>\n                Karabiner Complex Modification | Still a work in progress\n              </Typography>\n            </Grid>\n            <Grid xs={3} item container justify=\"flex-end\">\n              <a\n                className=\"github-button\"\n                href=\"https://github.com/genesy/karabiner-complex-rules-generator\"\n                data-icon=\"octicon-star\"\n                data-size=\"large\"\n                data-show-count=\"true\"\n                aria-label=\"Star genesy/karabiner-complex-rules-generator on GitHub\"\n              >\n                Star\n              </a>\n            </Grid>\n          </Toolbar>\n        </Container>\n      </AppBar>\n      <Box marginTop={1}>\n        <MainForm />\n      </Box>\n    </>\n  );\n};\n\nexport default AppLayout;\n"
  },
  {
    "path": "src/components/MainForm.tsx",
    "content": "import React, { useMemo, useEffect } from 'react';\nimport RuleForm from './forms/RuleForm';\nimport {\n  Grid,\n  Button,\n  TextField,\n  Box,\n  Container,\n  ButtonGroup,\n  Typography,\n} from '@material-ui/core';\nimport AddIcon from '@material-ui/icons/Add';\nimport _ from 'lodash';\nimport IRule from '../types/IRule';\nimport IManipulator from '../types/IManipulator';\nimport IFromEventDefinition from '../types/IFromEventDefinition';\nimport IToEventDefinition from '../types/IToEventDefinition';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { addRule, setTitle, setWholeState } from '../ducks/formState';\nimport IFormState from '../types/IFormState';\nimport { ALL_KEYS } from '../constants';\n\ninterface Props {}\ninterface FormState {\n  title: string;\n  rules: any[];\n}\n// TODO: move to separate file\nconst toFields: string[] = [\n  'to',\n  'to_if_alone',\n  'to_if_held_down',\n  'to_after_key_up',\n];\n\nconst parseJSONfirst = (text: any) => {\n  let parsedJSON;\n  if (typeof text === 'string') {\n    parsedJSON = JSON.parse(text);\n  } else if (typeof text === 'object') {\n    parsedJSON = { ...text };\n  }\n  parsedJSON.rules = parsedJSON.rules.map((rule: any) => {\n    rule.description = rule.description || '';\n    rule.manipulators = rule.manipulators || [];\n    rule.manipulators = rule.manipulators.map((manipulator: any) => {\n      manipulator.type = manipulator.type || 'basic';\n      manipulator.from = manipulator.from || {\n        modifiers: {\n          mandatory: [],\n          optional: [],\n        },\n        simultaneous: [],\n        simultaneous_options: {\n          detect_key_down_uninterruptedly: false,\n          to_after_key_up: [],\n        },\n      };\n      if (typeof manipulator.from.key_code === 'string') {\n        const kc = manipulator.from.key_code;\n        manipulator.from.key_code = _.find(ALL_KEYS, { value: kc }) || {\n          label: kc,\n          value: kc,\n        };\n      }\n      manipulator.conditions = manipulator.conditions || [];\n      manipulator.to = manipulator.to || [];\n      manipulator.to_after_key_up = manipulator.to_after_key_up || [];\n      manipulator.to_if_alone = manipulator.to_if_alone || [];\n      manipulator.to_if_held_down = manipulator.to_if_held_down || [];\n      manipulator.to_delayed_action = manipulator.to_delayed_action || {\n        to_if_invoked: [],\n        to_if_canceled: [],\n      };\n      return manipulator;\n    });\n    return rule;\n  });\n\n  return parsedJSON;\n};\nconst parseKey = (key: any) =>\n  typeof key === 'string' ? key : key.value || '';\n\nconst parseKeys = (modifiers: any[]) => {\n  return modifiers.map(parseKey);\n};\n\nconst parseFromObject = (fromObject: IFromEventDefinition): any => {\n  const _from = { ...fromObject };\n  if (_.isEmpty(_from)) {\n    return;\n  }\n\n  if (typeof _from.key_code === 'object') {\n    _from.key_code = parseKey(_from.key_code);\n  }\n  if (_from.modifiers) {\n    if (_from.modifiers.mandatory) {\n      if (_from.modifiers.mandatory?.length === 0) {\n        delete _from.modifiers.mandatory;\n      } else {\n        if (typeof _from.modifiers.mandatory === 'string') {\n          _from.modifiers.mandatory = [_from.modifiers.mandatory];\n        }\n        _from.modifiers.mandatory = parseKeys(_from.modifiers.mandatory);\n      }\n    }\n    if (_from.modifiers.optional) {\n      if (_from.modifiers.optional.length === 0) {\n        delete _from.modifiers.optional;\n      } else {\n        if (typeof _from.modifiers.optional === 'string') {\n          _from.modifiers.optional = [_from.modifiers.optional];\n        }\n        _from.modifiers.optional = parseKeys(_from.modifiers.optional);\n      }\n    }\n  }\n\n  if (_from?.simultaneous_options?.to_after_key_up?.length === 0) {\n    delete _from.simultaneous_options.to_after_key_up;\n  }\n  if (_from?.simultaneous?.length === 0) {\n    delete _from.simultaneous;\n  }\n  if (_from?.simultaneous?.length) {\n    _from.simultaneous = _from.simultaneous.map(sim => {\n      if (sim.key_code) {\n        sim.key_code = parseKey(sim.key_code);\n      }\n      return sim;\n    });\n  }\n\n  if (\n    _.isEqual(_from.simultaneous_options, {\n      detect_key_down_uninterruptedly: false,\n    })\n  ) {\n    delete _from.simultaneous_options;\n  }\n  if (!_from.pointing_button || _from.pointing_button === 'disabled') {\n    delete _from.pointing_button;\n  }\n  if (_.isEmpty(_from.modifiers)) {\n    delete _from.modifiers;\n  }\n  return _from;\n};\n\nconst parseToObject = (toObject: IToEventDefinition): any => {\n  const _to = { ...toObject };\n  if (typeof _to.key_code === 'object') {\n    _to.key_code = parseKey(toObject.key_code);\n  }\n  if (_to.modifiers?.length) {\n    _to.modifiers = parseKeys(_to.modifiers);\n  }\n  return _to;\n};\n\nconst parseRuleObject = (rule: IRule): any => {\n  const _rule = { ...rule };\n  if (!rule?.description?.length) {\n    delete rule.description;\n  }\n  rule.manipulators = rule.manipulators.map((manipulator: IManipulator) => {\n    manipulator.from = parseFromObject(manipulator.from);\n    toFields.forEach(toField => {\n      if (!manipulator[toField]) return;\n      if (manipulator[toField]?.length === 0) {\n        delete manipulator[toField];\n        return;\n      }\n      manipulator[toField] = manipulator[toField].map(\n        (toObject: IToEventDefinition) => {\n          return parseToObject(toObject);\n        },\n      );\n    });\n\n    if (manipulator?.to_delayed_action?.to_if_invoked?.length === 0) {\n      delete manipulator.to_delayed_action.to_if_invoked;\n    }\n    if (manipulator?.to_delayed_action?.to_if_canceled?.length === 0) {\n      delete manipulator.to_delayed_action.to_if_canceled;\n    }\n    if (_.isEmpty(manipulator?.to_delayed_action)) {\n      delete manipulator.to_delayed_action;\n    }\n\n    if (manipulator?.conditions?.length === 0) {\n      delete manipulator.conditions;\n    }\n    return manipulator;\n  });\n  return _rule;\n};\n\nconst parseStateToMinimumJSON = (state: any) => {\n  const parsedState = _.cloneDeep(state);\n  parsedState.rules = parsedState.rules.map((rule: IRule) => {\n    return parseRuleObject(rule);\n  });\n  return parsedState;\n};\n\nconst MainForm: React.FC<Props> = () => {\n  const formState = useSelector((state: IFormState) => state);\n\n  const dispatch = useDispatch();\n\n  useEffect(() => {\n    try {\n      const state = JSON.parse(\n        window.atob(\n          window.location.href.slice(window.location.href.indexOf('#') + 1),\n        ),\n      );\n      dispatch(setWholeState(parseJSONfirst(state)));\n    } catch (e) {}\n  }, []);\n\n  const parsedState = parseStateToMinimumJSON(formState);\n\n  const install = () => {\n    const base64string = window.btoa(JSON.stringify(parsedState));\n    let url = `karabiner://karabiner/assets/complex_modifications/import?url=data:application/json;charset=utf-8;base64,${base64string}`;\n    window.location.href = url;\n  };\n  const generateUrl = () => {\n    const base64string = window.btoa(JSON.stringify(parsedState));\n    window.history.replaceState(undefined, '', '#' + base64string);\n    alert('copy the url in your addess bar to share');\n  };\n\n  const titleForm = useMemo(() => {\n    return (\n      <Box m={1}>\n        <TextField\n          fullWidth\n          onChange={e => dispatch(setTitle(e.target.value))}\n          value={formState.title}\n          variant=\"outlined\"\n          label=\"Modification Title\"\n        />\n      </Box>\n    );\n  }, [formState.title]);\n  return (\n    <Container className=\"app-container\">\n      <Grid container direction=\"row\" justify=\"space-between\">\n        <Grid item xs={8} className=\"form-wrapper\">\n          {titleForm}\n          <Box p={1}>\n            {formState.rules.map((rule, index) => (\n              <RuleForm index={index} key={index} rule={rule} />\n            ))}\n            <Box mt={2}>\n              <Button\n                onClick={() => dispatch(addRule())}\n                fullWidth\n                color=\"primary\"\n                variant=\"contained\"\n                startIcon={<AddIcon />}\n              >\n                Rule\n              </Button>\n            </Box>\n          </Box>\n        </Grid>\n\n        <Grid container xs={4} item direction=\"column\">\n          <Box p={2}>\n            <Typography>Your Modification</Typography>\n            <textarea\n              className=\"generated-code\"\n              // value={JSON.stringify(formState, null, 2)}\n              readOnly\n              value={JSON.stringify(parsedState, null, 2)}\n            />\n\n            <Box mt={1} mb={1}>\n              <ButtonGroup fullWidth>\n                <Button onClick={install} color=\"primary\" variant=\"contained\">\n                  Install!\n                </Button>\n                <Button\n                  onClick={generateUrl}\n                  color=\"primary\"\n                  variant=\"contained\"\n                >\n                  Share!\n                </Button>\n              </ButtonGroup>\n            </Box>\n            <textarea\n              placeholder=\"Paste existing modification here to edit\"\n              className=\"paste-code\"\n              onBlur={e => {\n                try {\n                  if (e.target.value)\n                    dispatch(setWholeState(parseJSONfirst(e.target.value)));\n                } catch (e) {\n                  console.log({ e });\n                }\n              }}\n            />\n          </Box>\n        </Grid>\n      </Grid>\n    </Container>\n  );\n};\nexport default MainForm;\n"
  },
  {
    "path": "src/components/forms/AddConditionForm.tsx",
    "content": "import React, { useState, useEffect } from 'react';\nimport {\n  Box,\n  TextField,\n  FormControl,\n  InputLabel,\n  Select,\n  MenuItem,\n  Button,\n  ButtonGroup,\n} from '@material-ui/core';\nimport { titleCase, withSuffix } from '../../helpers';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport IManipulator from '../../types/IManipulator';\nimport FrontmostConditionForm from './FrontmostConditionForm';\nimport DeviceIfConditionForm from './DeviceIfConditionForm';\nimport KeyboardTypeConditionForm from './KeyboardTypeConditionForm';\nimport VariableConditionForm from './VariableConditionForm';\nimport InputSourceConditionForm from './InputSourceConditionForm';\nimport EventChangedConditionForm from './EventChangedConditionForm';\n\ninterface Props {\n  condition: any;\n  index: number;\n  setManipulator: (arg0: IManipulator) => void;\n  manipulator: IManipulator;\n}\nconst conditionTypes: string[] = [\n  'frontmost_application_if',\n  'frontmost_application_unless',\n  'device_if',\n  'device_unless',\n  'keyboard_type_if',\n  'keyboard_type_unless',\n  'input_source_if',\n  'input_source_unless',\n  'variable_if',\n  'variable_unless',\n  'event_changed_if',\n  'event_changed_unless',\n];\n\nconst AddConditionForm: React.FC<Props> = ({\n  condition,\n  index,\n  setManipulator,\n  manipulator,\n}) => {\n  const setConditionState = (condition: any) => {\n    const newManipulator = { ...manipulator };\n    const newConditions = [...manipulator.conditions];\n    newConditions[index] = condition;\n    newManipulator.conditions = newConditions;\n    setManipulator(newManipulator);\n  };\n\n  return (\n    <AppExpansionPanel\n      panelProps={{ defaultExpanded: index === 0 }}\n      title={`${withSuffix(index + 1)} Condition`}\n    >\n      <FormControl fullWidth variant=\"filled\">\n        <InputLabel id=\"condition_type\">Condition Type</InputLabel>\n        <Select\n          labelId=\"condition_type\"\n          value={condition.type}\n          onChange={e => {\n            setConditionState({ ...condition, type: e.target.value });\n          }}\n        >\n          {conditionTypes.map(item => (\n            <MenuItem value={item} key={item}>\n              {titleCase(item)}\n            </MenuItem>\n          ))}\n        </Select>\n      </FormControl>\n\n      <TextField\n        fullWidth\n        variant=\"filled\"\n        label={`Condition Description (optional)`}\n        value={condition.description}\n        onChange={e => {\n          setConditionState({ ...condition, description: e.target.value });\n        }}\n      />\n\n      {condition.type.indexOf('frontmost') === 0 && (\n        <FrontmostConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n      {condition.type.indexOf('device') === 0 && (\n        <DeviceIfConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n      {condition.type.indexOf('keyboard') === 0 && (\n        <KeyboardTypeConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n      {condition.type.indexOf('input_source') === 0 && (\n        <InputSourceConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n      {condition.type.indexOf('variable') === 0 && (\n        <VariableConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n      {condition.type.indexOf('event_changed') === 0 && (\n        <EventChangedConditionForm\n          condition={condition}\n          setConditionState={setConditionState}\n        />\n      )}\n    </AppExpansionPanel>\n  );\n};\n\nexport default AddConditionForm;\n"
  },
  {
    "path": "src/components/forms/DeviceIfConditionForm.tsx",
    "content": "import React from 'react';\nimport {\n  Box,\n  TextField,\n  ButtonGroup,\n  Button,\n  Checkbox,\n  FormControlLabel,\n} from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { withSuffix, titleCase } from '../../helpers';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst DeviceIfConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  const addDeviceIdentifier = () => {\n    const newCondition: any = { ...condition };\n    newCondition.identifiers = newCondition.identifiers || [];\n    const deviceIdentifiers = [...newCondition.identifiers];\n    deviceIdentifiers.push('');\n    newCondition.identifiers = deviceIdentifiers;\n    setConditionState(newCondition);\n  };\n\n  const setIdentifier = (identifier: any, index: number) => {\n    const newCondition = { ...condition };\n    const newIdentifiers = [...newCondition.identifiers];\n    newIdentifiers[index] = identifier;\n    newCondition.identifiers = newIdentifiers;\n    setConditionState(newCondition);\n  };\n\n  return (\n    <Box>\n      <Box>\n        {!!condition?.identifiers?.length && (\n          <AppExpansionPanel\n            panelProps={{ defaultExpanded: true }}\n            title=\"Device Identifiers\"\n          >\n            {condition.identifiers.map((identifier, index: number) => (\n              <AppExpansionPanel\n                title={`${withSuffix(index + 1)} Device Identifier`}\n                key={index}\n              >\n                {['vendor_id', 'product_id', 'location_id'].map(key => {\n                  return (\n                    <TextField\n                      key={key}\n                      fullWidth\n                      label={titleCase(key) + ' (Optional)'}\n                      variant=\"filled\"\n                      value={identifier[key]}\n                      onChange={e => {\n                        setIdentifier(\n                          { ...identifier, [key]: e.target.value },\n                          index,\n                        );\n                      }}\n                    />\n                  );\n                })}\n\n                <FormControlLabel\n                  control={\n                    <Checkbox\n                      checked={!!identifier.is_keyboard}\n                      onChange={e => {\n                        setIdentifier(\n                          { ...identifier, is_keyboard: e.target.checked },\n                          index,\n                        );\n                      }}\n                    />\n                  }\n                  label=\"Is Keyboard?\"\n                />\n                <FormControlLabel\n                  control={\n                    <Checkbox\n                      checked={!!identifier.is_pointing_device}\n                      onChange={e => {\n                        setIdentifier(\n                          {\n                            ...identifier,\n                            is_pointing_device: e.target.checked,\n                          },\n                          index,\n                        );\n                      }}\n                    />\n                  }\n                  label=\"Is Pointing Device?\"\n                />\n              </AppExpansionPanel>\n            ))}\n          </AppExpansionPanel>\n        )}\n      </Box>\n      <Box mt={2}>\n        <ButtonGroup>\n          <Button\n            variant=\"contained\"\n            color=\"primary\"\n            onClick={addDeviceIdentifier}\n          >\n            Add Device Identifiers\n          </Button>\n        </ButtonGroup>\n      </Box>\n    </Box>\n  );\n};\n\nexport default DeviceIfConditionForm;\n"
  },
  {
    "path": "src/components/forms/EventChangedConditionForm.tsx",
    "content": "import React from 'react';\nimport {\n  Box,\n  TextField,\n  FormLabel,\n  FormControl,\n  RadioGroup,\n  FormControlLabel,\n  Radio,\n} from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst EventChangedConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  return (\n    <Box mt={2}>\n      <FormControl component=\"fieldset\">\n        <FormLabel component=\"legend\">Value</FormLabel>\n        <RadioGroup\n          defaultValue=\"true\"\n          onChange={e => {\n            setConditionState({ ...condition, value: e.target.value });\n          }}\n        >\n          <FormControlLabel label=\"true\" value=\"true\" control={<Radio />} />\n          <FormControlLabel label=\"false\" value=\"false\" control={<Radio />} />\n        </RadioGroup>\n      </FormControl>\n    </Box>\n  );\n};\n\nexport default EventChangedConditionForm;\n"
  },
  {
    "path": "src/components/forms/FromEventForm.tsx",
    "content": "import React, { useMemo } from 'react';\nimport {\n  Box,\n  Button,\n  FormControlLabel,\n  Checkbox,\n  FormControl,\n  InputLabel,\n  Select,\n  MenuItem,\n} from '@material-ui/core';\n\nimport IFromEventDefinition from '../../types/IFromEventDefinition';\nimport KeyInput from '../shared/KeyInput';\nimport KeyCodeAndPointingButtonInput from '../shared/KeyCodeAndPointingButtonInput';\nimport _ from 'lodash';\nimport { titleCase, withSuffix } from '../../helpers';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { useDispatch } from 'react-redux';\nimport { setFromObject } from '../../ducks/formState';\nimport ISimultaneous from '../../types/ISimultaneous';\nimport ToEventForm from './ToEventForm';\nimport IToEventDefinition from '../../types/IToEventDefinition';\n\nconst optionalBoolean: string[] = ['none', 'true', 'false'];\nconst keyOrder: string[] = ['none', 'insensitive', 'strict', 'strict_inverse'];\nconst keyUpWhen: string[] = ['none', 'any', 'all'];\n\ninterface Props {\n  fromObject: IFromEventDefinition;\n  ruleIndex: number;\n  manipulatorIndex: number;\n}\n\nconst FromEventForm: React.FC<Props> = ({\n  fromObject,\n  ruleIndex,\n  manipulatorIndex,\n}) => {\n  const dispatch = useDispatch();\n  const _setFromObject = (fromObject: IFromEventDefinition) => {\n    dispatch(setFromObject({ ruleIndex, manipulatorIndex, fromObject }));\n  };\n  const handleModifierChange = (event: any, value: any, type: string) => {\n    _setFromObject({\n      ...fromObject,\n      modifiers: {\n        ...fromObject.modifiers,\n        [type]: value.map((v: any) =>\n          typeof v === 'string' ? { label: v, value: v } : v,\n        ),\n      },\n    });\n  };\n\n  const addSimultaneous = () => {\n    const newFromObject = { ...fromObject };\n    newFromObject.simultaneous = newFromObject.simultaneous || [];\n    newFromObject.simultaneous = [...newFromObject.simultaneous, {}];\n    _setFromObject(newFromObject);\n  };\n\n  return useMemo(\n    () => (\n      <Box className=\"form-container\">\n        <KeyCodeAndPointingButtonInput\n          setEventObject={_setFromObject}\n          eventObject={fromObject}\n        />\n        <div>\n          <div>\n            <KeyInput\n              modifiers\n              value={fromObject.modifiers?.mandatory || []}\n              label=\"Mandatory Modifiers (optional)\"\n              onChange={(event: any, value: any) =>\n                handleModifierChange(event, value, 'mandatory')\n              }\n            />\n          </div>\n          <div>\n            <KeyInput\n              modifiers\n              keyCodes\n              value={fromObject.modifiers?.optional || []}\n              label=\"Optional Modifiers (optional)\"\n              onChange={(event: any, value: any) =>\n                handleModifierChange(event, value, 'optional')\n              }\n            />\n          </div>\n        </div>\n        <Box>\n          {fromObject.simultaneous?.map((simultaneous: any, index: number) => {\n            const setSimultaneous = (newSimultaneousObject: any) => {\n              const newFromObject = { ...fromObject };\n              if (newFromObject?.simultaneous?.length) {\n                const newSim = [...newFromObject.simultaneous];\n                newSim[index] = newSimultaneousObject;\n                newFromObject.simultaneous = newSim;\n                _setFromObject(newFromObject);\n              }\n            };\n            return (\n              <AppExpansionPanel\n                key={index}\n                panelProps={{ defaultExpanded: index === 0 }}\n                title={`${withSuffix(index + 1)} Simultaneous Event`}\n              >\n                <KeyCodeAndPointingButtonInput\n                  eventObject={simultaneous}\n                  setEventObject={setSimultaneous}\n                />\n                <Button\n                  variant=\"contained\"\n                  color=\"secondary\"\n                  onClick={() => {\n                    const newFromObject = { ...fromObject };\n                    if (newFromObject?.simultaneous?.length) {\n                      const simultaneous = [...newFromObject.simultaneous];\n                      simultaneous.splice(index, 1);\n                      newFromObject.simultaneous = simultaneous;\n                      _setFromObject(newFromObject);\n                    }\n                  }}\n                >\n                  Remove Simultaneous\n                </Button>\n              </AppExpansionPanel>\n            );\n          })}\n          <Box mt={1} mb={1}>\n            <Button\n              variant=\"contained\"\n              color=\"default\"\n              fullWidth\n              onClick={() => addSimultaneous()}\n            >\n              Add Simultaneous Event\n            </Button>\n          </Box>\n        </Box>\n        <Box>\n          <AppExpansionPanel title=\"Simultaneous Options\">\n            <FormControlLabel\n              control={\n                <Checkbox\n                  checked={\n                    !!fromObject?.simultaneous_options\n                      ?.detect_key_down_uninterruptedly\n                  }\n                  onChange={e => {\n                    _setFromObject({\n                      ...fromObject,\n                      simultaneous_options: {\n                        ...fromObject.simultaneous_options,\n                        detect_key_down_uninterruptedly: e.target.checked,\n                      },\n                    });\n                  }}\n                />\n              }\n              label=\"Detect Key Down Uninterruptedly\"\n            />\n            <FormControl fullWidth variant=\"filled\">\n              <InputLabel id=\"key_down_order\">Key Down Order</InputLabel>\n              <Select\n                labelId=\"key_down_order\"\n                value={fromObject.simultaneous_options?.key_down_order}\n                onChange={e => {\n                  _setFromObject({\n                    ...fromObject,\n                    simultaneous_options: {\n                      ...fromObject.simultaneous_options,\n                      key_down_order: e.target.value,\n                    },\n                  });\n                }}\n              >\n                {keyOrder.map(item => (\n                  <MenuItem value={item} key={item}>\n                    {titleCase(item)}\n                  </MenuItem>\n                ))}\n              </Select>\n            </FormControl>\n            <FormControl fullWidth variant=\"filled\">\n              <InputLabel id=\"key_up_order\">Key Up Order</InputLabel>\n              <Select\n                labelId=\"key_up_order\"\n                value={fromObject.simultaneous_options?.key_up_order}\n                onChange={e => {\n                  _setFromObject({\n                    ...fromObject,\n                    simultaneous_options: {\n                      ...fromObject.simultaneous_options,\n                      key_up_order: e.target.value,\n                    },\n                  });\n                }}\n              >\n                {keyOrder.map(item => (\n                  <MenuItem value={item} key={item}>\n                    {titleCase(item)}\n                  </MenuItem>\n                ))}\n              </Select>\n            </FormControl>\n            <FormControl fullWidth variant=\"filled\">\n              <InputLabel id=\"key_up_when\">Key Up When</InputLabel>\n              <Select\n                labelId=\"key_up_when\"\n                value={fromObject.simultaneous_options?.key_up_when}\n                onChange={e => {\n                  _setFromObject({\n                    ...fromObject,\n                    simultaneous_options: {\n                      ...fromObject.simultaneous_options,\n                      key_up_when: e.target.value,\n                    },\n                  });\n                }}\n              >\n                {keyUpWhen.map(item => (\n                  <MenuItem value={item} key={item}>\n                    {titleCase(item)}\n                  </MenuItem>\n                ))}\n              </Select>\n            </FormControl>\n\n            <Box mt={1}>\n              {fromObject.simultaneous_options?.to_after_key_up?.map(\n                (toEvent: IToEventDefinition, index: number) => {\n                  return (\n                    <ToEventForm\n                      toObject={toEvent}\n                      setToObject={(toObject: IToEventDefinition) => {\n                        const newFromObject = { ...fromObject };\n                        const currentToField = [\n                          ...newFromObject.simultaneous_options.to_after_key_up,\n                        ];\n                        currentToField[index] = toObject;\n                        newFromObject.simultaneous_options = {\n                          to_after_key_up: currentToField,\n                        };\n                        _setFromObject(newFromObject);\n                      }}\n                      removeToObject={() => {}}\n                      index={index}\n                      toField=\"to_after_key_up\"\n                      key={index}\n                    />\n                  );\n                },\n              )}\n              <Button\n                color=\"default\"\n                variant=\"contained\"\n                fullWidth\n                onClick={() => {\n                  const newFromObject: IFromEventDefinition = { ...fromObject };\n                  const simOpts: any = {\n                    ...newFromObject.simultaneous_options,\n                  };\n                  const toAfterKeyUp = simOpts.to_after_key_up\n                    ? [...simOpts.to_after_key_up]\n                    : [];\n                  toAfterKeyUp.push({});\n                  simOpts.to_after_key_up = toAfterKeyUp;\n                  newFromObject.simultaneous_options = simOpts;\n                  _setFromObject(newFromObject);\n                }}\n              >\n                Add to_after_key_up event\n              </Button>\n            </Box>\n          </AppExpansionPanel>\n        </Box>\n      </Box>\n    ),\n    [fromObject],\n  );\n};\n\nexport default FromEventForm;\n"
  },
  {
    "path": "src/components/forms/FrontmostConditionForm.tsx",
    "content": "import React from 'react';\nimport { Box, TextField, ButtonGroup, Button } from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst FrontmostConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  const setFilePath = (bundleIndex: number, value: string) => {\n    const newCondition: any = { ...condition };\n    const filePaths = [...newCondition.file_paths];\n    filePaths[bundleIndex] = value;\n    newCondition.file_paths = filePaths;\n    setConditionState(newCondition);\n  };\n  const setBundleIdentifier = (bundleIndex: number, value: string) => {\n    const newCondition: any = { ...condition };\n    const bundleIdentifiers = [...newCondition.bundle_identifiers];\n    bundleIdentifiers[bundleIndex] = value;\n    newCondition.bundle_identifiers = bundleIdentifiers;\n    setConditionState(newCondition);\n  };\n  const addBundleIdentifier = () => {\n    const newCondition: any = { ...condition };\n    newCondition.bundle_identifiers = newCondition.bundle_identifiers || [];\n    const bundleIdentifiers = [...newCondition.bundle_identifiers];\n    bundleIdentifiers.push('');\n    newCondition.bundle_identifiers = bundleIdentifiers;\n    setConditionState(newCondition);\n  };\n\n  const addFilePath = () => {\n    const newCondition: any = { ...condition };\n    newCondition.file_paths = newCondition.file_paths || [];\n    const filePaths = [...newCondition.file_paths];\n    filePaths.push('');\n    newCondition.file_paths = filePaths;\n    setConditionState(newCondition);\n  };\n\n  return (\n    <Box>\n      <Box>\n        {!!condition?.bundle_identifiers?.length && (\n          <AppExpansionPanel\n            panelProps={{ defaultExpanded: true }}\n            title=\"Bundle Identifiers\"\n          >\n            {condition.bundle_identifiers.map(\n              (identifier: string, bundleIndex: number) => (\n                <TextField\n                  key={bundleIndex}\n                  value={identifier}\n                  fullWidth\n                  variant=\"filled\"\n                  label={`Regex Bundle Identifier ${bundleIndex + 1}`}\n                  onChange={e => {\n                    setBundleIdentifier(bundleIndex, e.target.value);\n                  }}\n                />\n              ),\n            )}\n          </AppExpansionPanel>\n        )}\n        {!!condition?.file_paths?.length && (\n          <AppExpansionPanel\n            panelProps={{ defaultExpanded: true }}\n            title=\"File Paths\"\n          >\n            {condition.file_paths.map(\n              (filePath: string, filePathIndex: number) => (\n                <TextField\n                  key={filePathIndex}\n                  value={filePath}\n                  fullWidth\n                  variant=\"filled\"\n                  label={`Regex File Path ${filePathIndex + 1}`}\n                  onChange={e => {\n                    setFilePath(filePathIndex, e.target.value);\n                  }}\n                />\n              ),\n            )}\n          </AppExpansionPanel>\n        )}\n      </Box>\n      <Box mt={2}>\n        <ButtonGroup>\n          <Button\n            variant=\"contained\"\n            color=\"primary\"\n            onClick={addBundleIdentifier}\n          >\n            Add Bundle Identifier\n          </Button>\n          <Button variant=\"contained\" color=\"primary\" onClick={addFilePath}>\n            Add File Path\n          </Button>\n        </ButtonGroup>\n      </Box>\n    </Box>\n  );\n};\n\nexport default FrontmostConditionForm;\n"
  },
  {
    "path": "src/components/forms/InputSourceConditionForm.tsx",
    "content": "import React from 'react';\nimport { Box, TextField } from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst InputSourceConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  return <Box>Unknown</Box>;\n};\n\nexport default InputSourceConditionForm;\n"
  },
  {
    "path": "src/components/forms/KeyboardTypeConditionForm.tsx",
    "content": "import React from 'react';\nimport {\n  Box,\n  TextField,\n  ButtonGroup,\n  Button,\n  Checkbox,\n  FormControlLabel,\n} from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { withSuffix, titleCase } from '../../helpers';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst KeyboardTypeConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  return (\n    <Box>\n      <Box>\n        <Autocomplete\n          options={['ansi', 'iso', 'jis']}\n          multiple\n          freeSolo\n          value={condition.keyboard_types}\n          onChange={(_e, value) => {\n            setConditionState({ ...condition, keyboard_types: value });\n          }}\n          autoHighlight={true}\n          renderInput={params => (\n            <TextField\n              {...params}\n              variant=\"filled\"\n              fullWidth\n              label=\"Keyboard Type\"\n            />\n          )}\n        />\n      </Box>\n    </Box>\n  );\n};\n\nexport default KeyboardTypeConditionForm;\n"
  },
  {
    "path": "src/components/forms/ManipulatorForm.tsx",
    "content": "import React, { useMemo } from 'react';\nimport {\n  Select,\n  Box,\n  ButtonGroup,\n  FormControl,\n  InputLabel,\n  MenuItem,\n  Button,\n  Typography,\n} from '@material-ui/core';\n\nimport { titleCase, withSuffix } from '../../helpers';\nimport AddConditionForm from './AddConditionForm';\nimport IManipulator from '../../types/IManipulator';\nimport ICondition from '../../types/ICondition';\nimport FromEventForm from './FromEventForm';\nimport IFromEventDefinition from '../../types/IFromEventDefinition';\nimport ToEventFormsContainer from './ToEventFormsContainer';\nimport _ from 'lodash';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport AppSelect from '../shared/AppSelect';\nimport { useDispatch } from 'react-redux';\nimport { setManipulator, addToObject } from '../../ducks/formState';\n\nconst toFields: string[] = [\n  'to',\n  'to_if_alone',\n  'to_if_held_down',\n  'to_after_key_up',\n];\nconst types: string[] = [\n  'basic',\n  'frontmost_application_if',\n  'frontmost_application_unless',\n  'device_if',\n  'device_unless',\n  'keyboard_type_if',\n  'keyboard_type_unless',\n  'input_source_if',\n  'input_source_unless',\n  'variable_if',\n  'variable_unless',\n  'event_changed_if',\n  'event_changed_unless',\n];\n\ninterface Props {\n  manipulator: IManipulator;\n  index: number;\n  ruleIndex: number;\n}\n\nconst ManipulatorForm: React.FC<Props> = ({\n  manipulator,\n  ruleIndex,\n  index,\n}) => {\n  const dispatch = useDispatch();\n  const addToEventForm = (toField: string) => {\n    dispatch(addToObject({ manipulatorIndex: index, ruleIndex, toField }));\n  };\n\n  const _setManipulator = (newManipulator: IManipulator) => {\n    dispatch(\n      setManipulator({\n        ruleIndex,\n        index,\n        manipulator: newManipulator,\n      }),\n    );\n  };\n\n  const addConditionToRule = () => {\n    const newManipulator = { ...manipulator };\n    newManipulator.conditions = newManipulator.conditions || [];\n    const newConditions = [...newManipulator.conditions];\n    newConditions.push({ type: 'frontmost_application_if' });\n    newManipulator.conditions = newConditions;\n    _setManipulator(newManipulator);\n  };\n\n  return useMemo(\n    () => (\n      <AppExpansionPanel\n        panelProps={{ defaultExpanded: true }}\n        title={`${withSuffix(index + 1)} Manipulator`}\n      >\n        <AppSelect\n          label=\"Type\"\n          value={manipulator.type}\n          options={types}\n          onChange={(e: any) => {\n            dispatch(\n              setManipulator({\n                manipulator: { ...manipulator, type: e.target.value },\n                index,\n                ruleIndex,\n              }),\n            );\n          }}\n        />\n        <AppExpansionPanel\n          panelProps={{ defaultExpanded: true }}\n          title={`\"From\" Event`}\n        >\n          <FromEventForm\n            fromObject={manipulator.from}\n            manipulatorIndex={index}\n            ruleIndex={ruleIndex}\n          />\n        </AppExpansionPanel>\n\n        <ToEventFormsContainer\n          manipulator={manipulator}\n          ruleIndex={ruleIndex}\n          manipulatorIndex={index}\n        />\n\n        {!!manipulator.conditions?.length && (\n          <AppExpansionPanel\n            panelProps={{ defaultExpanded: true }}\n            title=\"Rule Conditions\"\n          >\n            {manipulator.conditions.map(\n              (condition: ICondition, index: number) => {\n                return (\n                  <AddConditionForm\n                    key={index}\n                    index={index}\n                    condition={condition}\n                    setManipulator={_setManipulator}\n                    manipulator={manipulator}\n                  />\n                );\n              },\n            )}\n          </AppExpansionPanel>\n        )}\n\n        <Box marginTop={1}>\n          <Button\n            color=\"primary\"\n            variant=\"contained\"\n            fullWidth\n            onClick={() => {\n              addConditionToRule();\n            }}\n          >\n            Add Condition\n          </Button>\n        </Box>\n      </AppExpansionPanel>\n    ),\n    [manipulator],\n  );\n};\n\nexport default ManipulatorForm;\n"
  },
  {
    "path": "src/components/forms/RuleForm.tsx",
    "content": "import React, { useMemo } from 'react';\nimport { Typography, Box, TextField, Button } from '@material-ui/core';\n\nimport ManipulatorForm from './ManipulatorForm';\nimport IManipulator from '../../types/IManipulator';\nimport IRule from '../../types/IRule';\nimport _ from 'lodash';\nimport { withSuffix } from '../../helpers';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { useDispatch } from 'react-redux';\nimport { removeRule, setRule, addManipulator } from '../../ducks/formState';\n\ninterface Props {\n  rule: IRule;\n  index: number;\n}\n\nconst RuleForm: React.FC<Props> = ({ rule, index }) => {\n  const dispatch = useDispatch();\n  return useMemo(\n    () => (\n      <AppExpansionPanel\n        title={\n          <TextField\n            label={`${withSuffix(index + 1)} Rule Description`}\n            value={rule.description}\n            onClick={event => event.stopPropagation()}\n            onFocus={event => event.stopPropagation()}\n            onChange={e =>\n              dispatch(setRule(index, { ...rule, description: e.target.value }))\n            }\n            multiline\n            fullWidth\n          />\n        }\n        panelProps={{ defaultExpanded: index === 0 }}\n      >\n        <Box justifyContent=\"flex-end\">\n          <Button\n            variant=\"text\"\n            size=\"small\"\n            color=\"secondary\"\n            onClick={() => dispatch(removeRule(index))}\n          >\n            Delete Rule!\n          </Button>\n        </Box>\n        <Box mt={2}>\n          {rule.manipulators.map(\n            (manipulator: IManipulator, manipulatorIndex: number) => {\n              return (\n                <ManipulatorForm\n                  manipulator={manipulator}\n                  key={manipulatorIndex}\n                  index={manipulatorIndex}\n                  ruleIndex={index}\n                />\n              );\n            },\n          )}\n        </Box>\n\n        <Box mt={2}>\n          <Button\n            fullWidth\n            variant=\"contained\"\n            color=\"primary\"\n            onClick={() => dispatch(addManipulator(index))}\n          >\n            Add Manipulator\n          </Button>\n        </Box>\n      </AppExpansionPanel>\n    ),\n    [rule],\n  );\n};\n\nexport default RuleForm;\n"
  },
  {
    "path": "src/components/forms/ToEventForm.tsx",
    "content": "import React, { useState, useEffect, useMemo } from 'react';\nimport KeyCodeAndPointingButtonInput from '../shared/KeyCodeAndPointingButtonInput';\nimport IToEventDefinition from '../../types/IToEventDefinition';\nimport Modifier from '../../types/Modifier';\nimport {\n  FormControl,\n  FormLabel,\n  FormControlLabel,\n  Checkbox,\n  Button,\n  Box,\n} from '@material-ui/core';\nimport KeyInput from '../shared/KeyInput';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport IManipulator from '../../types/IManipulator';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { suffix, titleCase } from '../../helpers';\n\ninterface Props {\n  toObject: IToEventDefinition;\n  setToObject: (arg0: IToEventDefinition) => void;\n  removeToObject: () => void;\n  index: number;\n  toField: string;\n}\n\nconst ToEventForm: React.FC<Props> = ({\n  toObject,\n  setToObject,\n  removeToObject,\n  index,\n  toField,\n}) => {\n  const [showOptional, setShowOptional] = useState({\n    keyCode: false,\n    consumerKeyCode: false,\n    pointingButton: false,\n    simultaneous: false,\n    simultaneousOptions: false,\n  });\n\n  useEffect(() => {\n    const newToObject: any = { ...toObject };\n    if (newToObject.pointing_button === 'disabled') {\n      delete newToObject.pointing_button;\n    }\n    if (!showOptional.keyCode && !!newToObject.key_code) {\n      delete newToObject.key_code;\n    } else {\n      newToObject.key_code = newToObject.key_code?.value;\n    }\n    if (!showOptional.consumerKeyCode && !!newToObject.consumer_key_code) {\n      delete newToObject.consumer_key_code;\n    }\n    if (!newToObject.modifiers?.length) {\n      delete newToObject.modifiers;\n    } else {\n      if (typeof newToObject.modifiers === 'string') {\n        newToObject.modifiers = [newToObject.modifiers];\n      }\n      newToObject.modifiers = newToObject.modifiers.map(\n        (m: Modifier) => m.value,\n      );\n    }\n    if (newToObject.lazy === false) {\n      delete newToObject.lazy;\n    }\n    if (newToObject.repeat === true) {\n      delete newToObject.repeat;\n    }\n    if (newToObject.halt === false) {\n      delete newToObject.halt;\n    }\n    // const toArray = [...ruleState[type]];\n    // toArray[index] = { ...newToObject };\n\n    // setRuleState({\n    //   ...ruleState,\n    //   [type]: toArray,\n    // });\n  }, [toObject, showOptional]);\n  return (\n    <AppExpansionPanel\n      title={`${index + 1}${suffix(index + 1)} \"${titleCase(toField)}\" Event`}\n    >\n      <Box className=\"form-container\">\n        <KeyCodeAndPointingButtonInput\n          setEventObject={setToObject}\n          eventObject={toObject}\n        />\n        <KeyInput\n          freeSolo={false}\n          modifiers\n          value={toObject.modifiers}\n          label=\"Modifiers\"\n          onChange={(_e: any, value: any) => {\n            setToObject({\n              ...toObject,\n              modifiers: value.map((v: any) =>\n                typeof v === 'string' ? { label: v, value: v } : v,\n              ),\n            });\n          }}\n        />\n        <FormControl fullWidth>\n          <FormLabel>Additional Options</FormLabel>\n          <FormControlLabel\n            label=\"Lazy\"\n            control={\n              <Checkbox\n                checked={!!toObject.lazy}\n                onChange={e => {\n                  setToObject({ ...toObject, lazy: e.target.checked });\n                }}\n              />\n            }\n          />\n          <FormControlLabel\n            label=\"Repeat\"\n            control={\n              <Checkbox\n                checked={!!toObject.repeat}\n                onChange={e => {\n                  setToObject({ ...toObject, repeat: e.target.checked });\n                }}\n              />\n            }\n          />\n          <FormControlLabel\n            label=\"Halt\"\n            control={\n              <Checkbox\n                checked={!!toObject.halt}\n                onChange={e => {\n                  setToObject({ ...toObject, halt: e.target.checked });\n                }}\n              />\n            }\n          />\n        </FormControl>\n\n        <Button\n          color=\"secondary\"\n          variant=\"contained\"\n          onClick={() => removeToObject()}\n          startIcon={<DeleteIcon />}\n        >\n          Remove\n        </Button>\n      </Box>\n    </AppExpansionPanel>\n  );\n};\n\nexport default ToEventForm;\n"
  },
  {
    "path": "src/components/forms/ToEventFormsContainer.tsx",
    "content": "import React from 'react';\nimport { Box, Button, ButtonGroup } from '@material-ui/core';\n\nimport { titleCase, suffix } from '../../helpers';\nimport ToEventForm from './ToEventForm';\nimport IManipulator from '../../types/IManipulator';\nimport IToEventDefinition from '../../types/IToEventDefinition';\nimport AppExpansionPanel from '../shared/AppExpansionPanel';\nimport { useDispatch } from 'react-redux';\nimport { setManipulator, addToObject } from '../../ducks/formState';\n\nconst toFields: string[] = [\n  'to',\n  'to_if_alone',\n  'to_if_held_down',\n  'to_after_key_up',\n];\n\nconst toDelayedAction: string[] = ['to_if_invoked', 'to_if_canceled'];\n\ninterface Props {\n  manipulator: IManipulator;\n  manipulatorIndex: number;\n  ruleIndex: number;\n}\n\nconst TheForm = ({\n  to,\n  index,\n  toField,\n  manipulator,\n  ruleIndex,\n  manipulatorIndex,\n}: {\n  to: IToEventDefinition;\n  index: number;\n  toField: string;\n  manipulator: IManipulator;\n  ruleIndex: number;\n  manipulatorIndex: number;\n}) => {\n  const toObject = { ...to };\n  const dispatch = useDispatch();\n\n  const _setManipulator = (newManipulator: IManipulator) =>\n    dispatch(\n      setManipulator({\n        manipulator: newManipulator,\n        ruleIndex,\n        index: manipulatorIndex,\n      }),\n    );\n  const setToObject = (newToObject: IToEventDefinition) => {\n    const newManipulator = { ...manipulator };\n    if (toDelayedAction.includes(toField)) {\n      const _toDelayedAction = { ...newManipulator.to_delayed_action };\n      _toDelayedAction[toField] = [..._toDelayedAction[toField]];\n      _toDelayedAction[toField][index] = newToObject;\n      newManipulator.to_delayed_action = _toDelayedAction;\n    } else {\n      const _toField = [...newManipulator[toField]];\n      _toField[index] = newToObject;\n      newManipulator[toField] = _toField;\n    }\n    _setManipulator(newManipulator);\n  };\n  const removeToObject = () => {\n    const newManipulator = { ...manipulator };\n    if (toDelayedAction.includes(toField)) {\n      const _toDelayedAction = { ...newManipulator.to_delayed_action };\n      _toDelayedAction[toField] = [..._toDelayedAction[toField]];\n      _toDelayedAction[toField].splice(index, 1);\n      newManipulator.to_delayed_action = _toDelayedAction;\n    } else {\n      const _toField = [...newManipulator[toField]];\n      _toField.splice(index, 1);\n      newManipulator[toField] = _toField;\n    }\n    _setManipulator(newManipulator);\n  };\n\n  const toEventFormProps = {\n    toObject,\n    setToObject,\n    removeToObject,\n    index,\n    toField,\n  };\n  return <ToEventForm {...toEventFormProps} key={index} />;\n};\nconst ToEventFormsContainer: React.FC<Props> = ({\n  manipulator,\n  ruleIndex,\n  manipulatorIndex,\n}) => {\n  const dispatch = useDispatch();\n  const addToEventForm = (toField: string) => {\n    dispatch(addToObject({ manipulatorIndex, ruleIndex, toField }));\n  };\n  const totalDelayedAction =\n    (manipulator?.to_delayed_action?.to_if_canceled?.length || 0) +\n    (manipulator?.to_delayed_action?.to_if_invoked?.length || 0);\n  return (\n    <Box>\n      {toFields.map((toField: string, toFieldsIndex: number) => {\n        return (\n          <Box mb={2} key={toField}>\n            {manipulator[toField]?.length ? (\n              <AppExpansionPanel\n                key={toFieldsIndex}\n                title={`${manipulator[toField].length} \"${titleCase(\n                  toField,\n                )}\" Events`}\n              >\n                {manipulator[toField].map(\n                  (to: IToEventDefinition, index: number) => {\n                    return (\n                      <TheForm\n                        to={to}\n                        index={index}\n                        toField={toField}\n                        key={index}\n                        ruleIndex={ruleIndex}\n                        manipulatorIndex={manipulatorIndex}\n                        manipulator={manipulator}\n                      />\n                    );\n                  },\n                )}\n                <Box mt={2}>\n                  <Button\n                    variant=\"contained\"\n                    color=\"primary\"\n                    onClick={() => {\n                      addToEventForm(toField);\n                    }}\n                    fullWidth\n                  >\n                    add {toField} event\n                  </Button>\n                </Box>\n              </AppExpansionPanel>\n            ) : (\n              <Box mt={2}>\n                <Button\n                  variant=\"contained\"\n                  color=\"primary\"\n                  onClick={() => {\n                    addToEventForm(toField);\n                  }}\n                  fullWidth\n                >\n                  add {toField} event\n                </Button>\n              </Box>\n            )}\n          </Box>\n        );\n      })}\n\n      <AppExpansionPanel\n        title={`${totalDelayedAction} \"To Delayed Action\" Events`}\n      >\n        {toDelayedAction.map((toField: string) => {\n          return (\n            <Box key={toField}>\n              {manipulator?.to_delayed_action?.[toField]?.length ? (\n                <AppExpansionPanel\n                  key={toField}\n                  title={`${\n                    manipulator.to_delayed_action[toField].length\n                  } \"${titleCase(toField)}\" Events`}\n                >\n                  {manipulator.to_delayed_action[toField].map(\n                    (to: IToEventDefinition, index: number) => {\n                      return (\n                        <TheForm\n                          to={to}\n                          index={index}\n                          toField={toField}\n                          key={index}\n                          ruleIndex={ruleIndex}\n                          manipulatorIndex={manipulatorIndex}\n                          manipulator={manipulator}\n                        />\n                      );\n                    },\n                  )}\n                  <Box mt={2}>\n                    <Button\n                      variant=\"contained\"\n                      color=\"primary\"\n                      size=\"small\"\n                      onClick={() => {\n                        addToEventForm(toField);\n                      }}\n                    >\n                      Add {toField} Event\n                    </Button>\n                  </Box>\n                </AppExpansionPanel>\n              ) : (\n                <Box mb={2}>\n                  <Button\n                    variant=\"contained\"\n                    color=\"primary\"\n                    fullWidth\n                    onClick={() => {\n                      addToEventForm(toField);\n                    }}\n                  >\n                    Add {toField} Event\n                  </Button>\n                </Box>\n              )}\n            </Box>\n          );\n        })}\n      </AppExpansionPanel>\n    </Box>\n  );\n};\n\nexport default ToEventFormsContainer;\n"
  },
  {
    "path": "src/components/forms/VariableConditionForm.tsx",
    "content": "import React from 'react';\nimport { Box, TextField } from '@material-ui/core';\nimport ICondition from '../../types/ICondition';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\n\ninterface Props {\n  condition: ICondition;\n  setConditionState: (arg0: ICondition) => void;\n}\n\nconst VariableConditionForm: React.FC<Props> = ({\n  condition,\n  setConditionState,\n}) => {\n  return (\n    <Box>\n      <TextField\n        fullWidth\n        label=\"Variable Name\"\n        variant=\"filled\"\n        value={condition.name}\n        onChange={e => {\n          setConditionState({ ...condition, name: e.target.value });\n        }}\n      />\n      <TextField\n        fullWidth\n        label=\"Variable Value\"\n        variant=\"filled\"\n        value={condition.value}\n        onChange={e => {\n          setConditionState({ ...condition, value: e.target.value });\n        }}\n      />\n    </Box>\n  );\n};\n\nexport default VariableConditionForm;\n"
  },
  {
    "path": "src/components/shared/AppExpansionPanel.tsx",
    "content": "import React, { ReactChild } from 'react';\nimport {\n  Typography,\n  ExpansionPanelSummary,\n  ExpansionPanel,\n  Box,\n  TextField,\n  Button,\n} from '@material-ui/core';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\ninterface Props {\n  title: any;\n  children: any;\n  panelProps?: any;\n}\n\nconst AppExpansionPanel: React.FC<Props> = ({\n  title,\n  children,\n  panelProps = {},\n}) => {\n  return (\n    <ExpansionPanel\n      {...panelProps}\n      aria-label=\"Expand\"\n      aria-controls=\"additional-actions3-content\"\n    >\n      <ExpansionPanelSummary expandIcon={<ExpandMoreIcon />}>\n        {title}\n      </ExpansionPanelSummary>\n      <Box p={2}>{children}</Box>\n    </ExpansionPanel>\n  );\n};\n\nexport default AppExpansionPanel;\n"
  },
  {
    "path": "src/components/shared/AppSelect.tsx",
    "content": "import React, { useMemo } from 'react';\nimport { Select, FormControl, InputLabel, MenuItem } from '@material-ui/core';\nimport { titleCase } from '../../helpers';\n\ninterface Props {\n  label: string;\n  value: string;\n  options: any[];\n  onChange: any; //TODO: event function\n}\n\nconst AppSelect: React.FC<Props> = ({\n  label,\n  value,\n  options,\n  onChange = () => {},\n}) => {\n  return useMemo(\n    () => (\n      <FormControl variant=\"filled\" fullWidth>\n        <InputLabel id=\"type\">{label}</InputLabel>\n        <Select labelId=\"type\" value={value} onChange={onChange}>\n          {options.map(option => (\n            <MenuItem value={option} key={option}>\n              {titleCase(option)}\n            </MenuItem>\n          ))}\n        </Select>\n      </FormControl>\n    ),\n    [label, value, options],\n  );\n};\n\nexport default AppSelect;\n"
  },
  {
    "path": "src/components/shared/KeyCodeAndPointingButtonInput.tsx",
    "content": "import React, { useEffect, useState, useMemo } from 'react';\nimport {\n  InputLabel,\n  Select,\n  MenuItem,\n  TextField,\n  ButtonGroup,\n  Button,\n  Typography,\n  FormControl,\n  Box,\n} from '@material-ui/core';\nimport KeyInput from './KeyInput';\nconst pointingButtons: any[] = [\n  {\n    label: 'None',\n    value: '',\n  },\n  {\n    label: 'Left Click',\n    value: 'button1',\n  },\n  {\n    label: 'Right Click',\n    value: 'button2',\n  },\n  {\n    label: 'Middle Click',\n    value: 'button3',\n  },\n  {\n    label: 'Mouse 4',\n    value: 'button4',\n  },\n  {\n    label: 'Mouse 5',\n    value: 'button5',\n  },\n];\n\ninterface Props {\n  eventObject: any;\n  setEventObject: (obj: any) => void;\n}\n\nconst KeyCodeAndPointingButtonInput: React.FC<Props> = ({\n  eventObject = {},\n  setEventObject = obj => {},\n}) => {\n  const [showOptional, setShowOptional] = useState({\n    keyCode: false,\n    consumerKeyCode: false,\n  });\n\n  useEffect(() => {\n    const newOptional = {\n      keyCode: !!eventObject.key_code,\n      consumerKeyCode: !!eventObject.consumer_key_code,\n    };\n    console.log(eventObject.key_code);\n    setShowOptional(newOptional);\n  }, [eventObject.consumer_key_code, eventObject.key_code]);\n\n  return useMemo(\n    () => (\n      <Box marginBottom={2}>\n        <ButtonGroup>\n          <Button\n            disabled={showOptional.keyCode}\n            variant=\"contained\"\n            onClick={() => {\n              setShowOptional({\n                ...showOptional,\n                keyCode: true,\n                consumerKeyCode: false,\n              });\n            }}\n          >\n            Key Code\n          </Button>\n          <Button\n            disabled={showOptional.consumerKeyCode}\n            variant=\"contained\"\n            onClick={() => {\n              setShowOptional({\n                ...showOptional,\n                keyCode: false,\n                consumerKeyCode: true,\n              });\n            }}\n          >\n            Consumer Key Code\n          </Button>\n          <Button\n            variant=\"contained\"\n            onClick={() => {\n              setShowOptional({\n                ...showOptional,\n                keyCode: false,\n                consumerKeyCode: false,\n              });\n            }}\n            disabled={!(showOptional.keyCode || showOptional.consumerKeyCode)}\n            color=\"secondary\"\n          >\n            Disable\n          </Button>\n        </ButtonGroup>\n        <Box marginBottom={1}>\n          {showOptional.keyCode && (\n            <Box marginTop={2} marginBottom={3}>\n              <KeyInput\n                keyCodes\n                modifiers\n                multiple={false}\n                value={eventObject.key_code}\n                autoHighlight={false}\n                label=\"Key Code (optional)\"\n                onChange={(_e: any, v: any) => {\n                  setEventObject({\n                    ...eventObject,\n                    key_code:\n                      typeof v === 'string' ? { label: v, value: v } : v,\n                  });\n                }}\n              />\n            </Box>\n          )}\n          {showOptional.consumerKeyCode && (\n            <TextField\n              placeholder=\"\"\n              margin=\"normal\"\n              variant=\"filled\"\n              label=\"Consumer Key Code (optional)\"\n              fullWidth\n              value={eventObject.consumer_key_code || ''}\n              onChange={e => {\n                setEventObject({\n                  ...eventObject,\n                  consumer_key_code: e.currentTarget.value,\n                });\n              }}\n            />\n          )}\n        </Box>\n\n        <Box mt={2} mb={3}>\n          <FormControl variant=\"filled\" fullWidth>\n            <InputLabel id=\"type\">Pointing Button (optional)</InputLabel>\n            <Select\n              labelId=\"type\"\n              value={eventObject.pointing_button || ''}\n              onChange={(event: any) => {\n                setEventObject({\n                  ...eventObject,\n                  pointing_button: event.target.value || '',\n                });\n              }}\n            >\n              {pointingButtons.map(({ label, value }) => (\n                <MenuItem value={value} key={value}>\n                  {label}\n                </MenuItem>\n              ))}\n            </Select>\n          </FormControl>\n        </Box>\n      </Box>\n    ),\n    [showOptional, eventObject],\n  );\n};\n\nexport default KeyCodeAndPointingButtonInput;\n"
  },
  {
    "path": "src/components/shared/KeyInput.tsx",
    "content": "import React from 'react';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { MODIFIERS, KEY_CODES } from '../../constants';\nimport { TextField } from '@material-ui/core';\nimport Modifier from '../../types/Modifier';\n\ninterface Props {\n  // value: Modifier[];\n  value: any;\n  onChange: (e: any, value: any) => void;\n  modifiers?: boolean;\n  keyCodes?: boolean;\n  multiple?: any;\n  autoHighlight?: boolean;\n  freeSolo?: boolean;\n  label?: string;\n}\n\nconst KeyInput: React.FC<Props> = ({\n  value = [],\n  onChange = e => {},\n  modifiers = false,\n  keyCodes = false,\n  multiple = true,\n  autoHighlight = false,\n  freeSolo = true,\n  label = 'keys',\n}) => {\n  let options: Modifier[] = [];\n  let placeholderText: string[] = [];\n  if (keyCodes) {\n    options = [...options, ...KEY_CODES];\n    placeholderText.push('Key Codes');\n  }\n  if (modifiers) {\n    options = [...options, ...MODIFIERS];\n    placeholderText.push('Modifiers');\n  }\n  return (\n    <Autocomplete\n      multiple={multiple}\n      freeSolo={freeSolo}\n      options={options}\n      getOptionLabel={(o: any) => (typeof o === 'object' ? o.label : o) || ''}\n      value={typeof value === 'string' ? [value] : value}\n      onChange={onChange}\n      autoHighlight={autoHighlight}\n      renderInput={params => (\n        <TextField\n          {...params}\n          variant=\"filled\"\n          label={label}\n          placeholder={placeholderText.join(', ')}\n          fullWidth\n        />\n      )}\n    />\n  );\n};\n\nexport default KeyInput;\n"
  },
  {
    "path": "src/constants.ts",
    "content": "export const MODIFIERS = [\n  {\n    label: 'Function key',\n    value: 'fn',\n  },\n  {\n    label: 'Left Command',\n    value: 'left_gui',\n  },\n  {\n    label: 'Right Command',\n    value: 'right_gui',\n  },\n  {\n    label: 'Left Control',\n    value: 'left_control',\n  },\n  {\n    label: 'Right Control',\n    value: 'right_control',\n  },\n  {\n    label: 'Left Alt / Option',\n    value: 'left_alt',\n  },\n  {\n    label: 'Right Alt / Option',\n    value: 'right_alt',\n  },\n  {\n    label: 'Left Shift',\n    value: 'left_shift',\n  },\n  {\n    label: 'Right Shift',\n    value: 'right_shift',\n  },\n];\nexport const KEY_CODES = [\n  {\n    label: '1',\n    value: '1',\n  },\n  {\n    label: '2',\n    value: '2',\n  },\n  {\n    label: '3',\n    value: '3',\n  },\n  {\n    label: '4',\n    value: '4',\n  },\n  {\n    label: '5',\n    value: '5',\n  },\n  {\n    label: '6',\n    value: '6',\n  },\n  {\n    label: '7',\n    value: '7',\n  },\n  {\n    label: '8',\n    value: '8',\n  },\n  {\n    label: '9',\n    value: '9',\n  },\n  {\n    label: '0',\n    value: '0',\n  },\n  {\n    label: 'A',\n    value: 'a',\n  },\n  {\n    label: 'B',\n    value: 'b',\n  },\n  {\n    label: 'C',\n    value: 'c',\n  },\n  {\n    label: 'D',\n    value: 'd',\n  },\n  {\n    label: 'E',\n    value: 'e',\n  },\n  {\n    label: 'F',\n    value: 'f',\n  },\n  {\n    label: 'G',\n    value: 'g',\n  },\n  {\n    label: 'H',\n    value: 'h',\n  },\n  {\n    label: 'I',\n    value: 'i',\n  },\n  {\n    label: 'J',\n    value: 'j',\n  },\n  {\n    label: 'K',\n    value: 'k',\n  },\n  {\n    label: 'L',\n    value: 'l',\n  },\n  {\n    label: 'M',\n    value: 'm',\n  },\n  {\n    label: 'N',\n    value: 'n',\n  },\n  {\n    label: 'O',\n    value: 'o',\n  },\n  {\n    label: 'P',\n    value: 'p',\n  },\n  {\n    label: 'Q',\n    value: 'q',\n  },\n  {\n    label: 'R',\n    value: 'r',\n  },\n  {\n    label: 'S',\n    value: 's',\n  },\n  {\n    label: 'T',\n    value: 't',\n  },\n  {\n    label: 'U',\n    value: 'u',\n  },\n  {\n    label: 'V',\n    value: 'v',\n  },\n  {\n    label: 'W',\n    value: 'w',\n  },\n  {\n    label: 'X',\n    value: 'x',\n  },\n  {\n    label: 'Y',\n    value: 'y',\n  },\n  {\n    label: 'Z',\n    value: 'z',\n  },\n  {\n    label: 'F1',\n    value: 'f1',\n  },\n  {\n    label: 'F2',\n    value: 'f2',\n  },\n  {\n    label: 'F3',\n    value: 'f3',\n  },\n  {\n    label: 'F4',\n    value: 'f4',\n  },\n  {\n    label: 'F5',\n    value: 'f5',\n  },\n  {\n    label: 'F6',\n    value: 'f6',\n  },\n  {\n    label: 'F7',\n    value: 'f7',\n  },\n  {\n    label: 'F8',\n    value: 'f8',\n  },\n  {\n    label: 'F9',\n    value: 'f9',\n  },\n  {\n    label: 'F10',\n    value: 'f10',\n  },\n  {\n    label: 'F11',\n    value: 'f11',\n  },\n  {\n    label: 'F12',\n    value: 'f12',\n  },\n  {\n    label: 'F12',\n    value: 'f12',\n  },\n  {\n    label: 'F12',\n    value: 'f12',\n  },\n  {\n    label: 'F13',\n    value: 'f13',\n  },\n  {\n    label: 'F14',\n    value: 'f14',\n  },\n  {\n    label: 'F15',\n    value: 'f15',\n  },\n  {\n    label: 'F16',\n    value: 'f16',\n  },\n  {\n    label: 'F17',\n    value: 'f17',\n  },\n  {\n    label: 'F18',\n    value: 'f18',\n  },\n  {\n    label: 'F19',\n    value: 'f19',\n  },\n  {\n    label: 'Escape',\n    value: 'escape',\n  },\n  {\n    label: '` Grave Accent, Tilde',\n    value: 'grave_accent_and_tilde',\n  },\n  {\n    label: 'Tab key',\n    value: 'tab',\n  },\n  {\n    label: 'Caps Lock',\n    value: 'caps_lock',\n  },\n  {\n    label: 'Spacebar',\n    value: 'spacebar',\n  },\n  {\n    label: 'Up Arrow',\n    value: 'up_arrow',\n  },\n  {\n    label: 'Left Arrow',\n    value: 'left_arrow',\n  },\n  {\n    label: 'Down Arrow',\n    value: 'down_arrow',\n  },\n  {\n    label: 'Right Arrow',\n    value: 'right_arrow',\n  },\n  {\n    label: 'Enter',\n    value: 'return_or_enter',\n  },\n  {\n    label: ' (Backslash)',\n    value: 'backslash',\n  },\n  {\n    label: '[ (Open Bracket)',\n    value: 'open_bracket',\n  },\n  {\n    label: '] (Close Bracket)',\n    value: 'close_bracket',\n  },\n  {\n    label: '; (Semicolon)',\n    value: 'semicolon',\n  },\n  {\n    label: \"' (Quote)\",\n    value: 'quote',\n  },\n  {\n    label: ', (Comma)',\n    value: 'comma',\n  },\n  {\n    label: '. (Period)',\n    value: 'period',\n  },\n  {\n    label: '/ (Slash)',\n    value: 'slash',\n  },\n  {\n    label: '- (Dash or Hyphen)',\n    value: 'hyphen',\n  },\n  {\n    label: '= (Equal)',\n    value: 'equal_sign',\n  },\n  {\n    label: 'Delete or Backspace',\n    value: 'delete_or_backspace',\n  },\n  {\n    label: 'Decrease Screen Brightness',\n    value: 'display_brightness_decrement',\n  },\n  {\n    label: 'Increase Screen Brightness',\n    value: 'display_brightness_increment',\n  },\n  {\n    label: 'Mission Control',\n    value: 'mission_control',\n  },\n  {\n    label: 'Launchpad',\n    value: 'launchpad',\n  },\n  {\n    label: 'Keyboard Brightness Decrease',\n    value: 'illumination_decrement',\n  },\n  {\n    label: 'Keyboard Brightness Increase',\n    value: 'illumination_increment',\n  },\n  {\n    label: 'Rewind / Previous',\n    value: 'rewind',\n  },\n  {\n    label: 'Play or Pause',\n    value: 'play_or_pause',\n  },\n  {\n    label: 'Fastforward / Next',\n    value: 'fastforward',\n  },\n  {\n    label: 'Mute',\n    value: 'mute',\n  },\n  {\n    label: 'Volume Down',\n    value: 'volume_decrement',\n  },\n  {\n    label: 'Volume Up',\n    value: 'volume_increment',\n  },\n];\n\nexport const ALL_KEYS = [...MODIFIERS, ...KEY_CODES];\n"
  },
  {
    "path": "src/ducks/formState.ts",
    "content": "import IRule from '../types/IRule';\nimport IManipulator from '../types/IManipulator';\nimport _ from 'lodash';\nimport IFormState from '../types/IFormState';\nimport produce from 'immer';\nimport IFromEventDefinition from '../types/IFromEventDefinition';\nimport IToEventDefinition from '../types/IToEventDefinition';\n\nexport const initialManipulator: IManipulator = {\n  type: 'basic',\n  from: {\n    modifiers: {\n      mandatory: [],\n      optional: [],\n    },\n    simultaneous: [],\n    simultaneous_options: {\n      detect_key_down_uninterruptedly: false,\n      to_after_key_up: [],\n    },\n  },\n  conditions: [],\n  to: [],\n  to_after_key_up: [],\n  to_if_alone: [],\n  to_if_held_down: [],\n  to_delayed_action: {\n    to_if_invoked: [],\n    to_if_canceled: [],\n  },\n};\n\nconst getInitialRule = (): IRule => {\n  return {\n    description: '',\n    manipulators: [initialManipulator],\n  };\n};\nconst initialFormState: IFormState = {\n  title: '',\n  rules: [getInitialRule()],\n};\n\nconst SET_TITLE = 'SET_TITLE';\nconst ADD_RULE = 'ADD_RULE';\nconst REMOVE_RULE = 'REMOVE_RULE';\nconst SET_RULE = 'SET_RULE';\nconst ADD_MANIPULATOR = 'ADD_MANIPULATOR';\nconst SET_MANIPULATOR = 'SET_MANIPULATOR';\nconst SET_FROM_OBJECT = 'SET_FROM_OBJECT';\nconst ADD_TO_OBJECT = 'ADD_TO_OBJECT';\nconst SET_TO_OBJECT = 'SET_TO_OBJECT';\nconst SET_WHOLE_STATE = 'SET_WHOLE_STATE';\n\nexport const formStateReducer = (state = initialFormState, action: any) => {\n  return produce(state, draft => {\n    switch (action.type) {\n      case SET_WHOLE_STATE:\n        draft.title = action.payload.state.title;\n        draft.rules = action.payload.state.rules;\n        break;\n      case REMOVE_RULE:\n        draft.rules.splice(action.payload.index, 1);\n        break;\n      case SET_TITLE:\n        draft.title = action.payload.title;\n        break;\n\n      case ADD_RULE:\n        draft.rules.push(getInitialRule());\n        break;\n      case SET_RULE:\n        if (action.payload) {\n          const { rule, index } = action.payload;\n          draft.rules[index] = rule;\n        }\n        break;\n      case ADD_MANIPULATOR:\n        if (action.payload) {\n          const { ruleIndex } = action.payload;\n          draft.rules[ruleIndex].manipulators.push(initialManipulator);\n        }\n        break;\n      case SET_MANIPULATOR:\n        if (action.payload) {\n          const { ruleIndex, index, manipulator } = action.payload;\n          draft.rules[ruleIndex].manipulators[index] = manipulator;\n        }\n        break;\n      case SET_FROM_OBJECT:\n        if (action.payload) {\n          const { ruleIndex, manipulatorIndex, fromObject } = action.payload;\n          draft.rules[ruleIndex].manipulators[\n            manipulatorIndex\n          ].from = fromObject;\n        }\n        break;\n      case ADD_TO_OBJECT:\n        if (action.payload) {\n          const { toField, ruleIndex, manipulatorIndex } = action.payload;\n          const initToObj = {\n            repeat: true,\n          };\n          const manip = draft.rules[ruleIndex].manipulators[manipulatorIndex];\n          if (toField === 'to_if_canceled' || toField === 'to_if_invoked') {\n            if (toField === 'to_if_canceled') {\n              manip.to_delayed_action.to_if_canceled.push(initToObj);\n            } else {\n              manip.to_delayed_action.to_if_invoked.push(initToObj);\n            }\n          } else {\n            manip[toField].push(initToObj);\n          }\n        }\n        break;\n      case SET_TO_OBJECT:\n        if (action.payload) {\n          const {\n            toField,\n            ruleIndex,\n            manipulatorIndex,\n            toIndex,\n            toObject,\n          } = action.payload;\n\n          // TODO: wtf is this can i fix this someday pls\n          draft.rules[ruleIndex].manipulators[manipulatorIndex][toField][\n            toIndex\n          ] = toObject;\n        }\n        break;\n      default:\n        break;\n    }\n  });\n};\n\nexport const setWholeState = (state: any) => {\n  return {\n    type: SET_WHOLE_STATE,\n    payload: { state },\n  };\n};\n\nexport const setTitle = (title: string) => {\n  return {\n    type: SET_TITLE,\n    payload: {\n      title,\n    },\n  };\n};\n\nexport const addRule = () => {\n  return {\n    type: ADD_RULE,\n  };\n};\n\nexport const removeRule = (index?: number) => {\n  return {\n    type: REMOVE_RULE,\n    payload: {\n      index,\n    },\n  };\n};\n\nexport const setRule = (index: number, rule: IRule) => {\n  return {\n    type: SET_RULE,\n    payload: {\n      index,\n      rule,\n    },\n  };\n};\n\nexport const addManipulator = (ruleIndex: number) => {\n  return {\n    type: ADD_MANIPULATOR,\n    payload: {\n      ruleIndex,\n    },\n  };\n};\n\nexport const setManipulator = ({\n  ruleIndex,\n  index,\n  manipulator,\n}: {\n  ruleIndex: number;\n  index: number;\n  manipulator: IManipulator;\n}) => {\n  return {\n    type: SET_MANIPULATOR,\n    payload: {\n      ruleIndex,\n      index,\n      manipulator,\n    },\n  };\n};\n\nexport const setFromObject = ({\n  ruleIndex,\n  manipulatorIndex,\n  fromObject,\n}: {\n  ruleIndex: number;\n  manipulatorIndex: number;\n  fromObject: IFromEventDefinition;\n}) => {\n  return {\n    type: SET_FROM_OBJECT,\n    payload: {\n      ruleIndex,\n      manipulatorIndex,\n      fromObject,\n    },\n  };\n};\n\nexport const addToObject = ({\n  ruleIndex,\n  manipulatorIndex,\n  toField,\n}: {\n  ruleIndex: number;\n  manipulatorIndex: number;\n  toField: string;\n}) => {\n  return {\n    type: ADD_TO_OBJECT,\n    payload: {\n      ruleIndex,\n      manipulatorIndex,\n      toField,\n    },\n  };\n};\n\nexport const setToObject = ({\n  ruleIndex,\n  manipulatorIndex,\n  toField,\n  toIndex,\n  toObject,\n}: {\n  ruleIndex: number;\n  manipulatorIndex: number;\n  toField: string;\n  toIndex: number;\n  toObject: IToEventDefinition;\n}) => {\n  return {\n    type: SET_TO_OBJECT,\n    payload: {\n      ruleIndex,\n      manipulatorIndex,\n      toField,\n      toIndex,\n      toObject,\n    },\n  };\n};\n"
  },
  {
    "path": "src/helpers.ts",
    "content": "export const suffix = (n: number) => {\n  var s = ['th', 'st', 'nd', 'rd'];\n  var d = (n | 0) % 100;\n  return d > 3 && d < 21 ? 'th' : s[d % 10] || 'th';\n};\n\nexport const withSuffix = (n: number) => {\n  return `${n}${suffix(n)}`;\n};\n\nexport const titleCase = (string: string) => {\n  var sentence = string.toLowerCase().split('_');\n  for (var i = 0; i < sentence.length; i++) {\n    sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);\n  }\n  return sentence.join(' ');\n};\n"
  },
  {
    "path": "src/index.css",
    "content": "body {\n  margin: 0;\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n    sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n    monospace;\n}\n"
  },
  {
    "path": "src/index.tsx",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(<App />, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"
  },
  {
    "path": "src/react-app-env.d.ts",
    "content": "/// <reference types=\"react-scripts\" />\n"
  },
  {
    "path": "src/serviceWorker.ts",
    "content": "// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n  window.location.hostname === 'localhost' ||\n    // [::1] is the IPv6 localhost address.\n    window.location.hostname === '[::1]' ||\n    // 127.0.0.0/8 are considered localhost for IPv4.\n    window.location.hostname.match(\n      /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n    )\n);\n\ntype Config = {\n  onSuccess?: (registration: ServiceWorkerRegistration) => void;\n  onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n    // The URL constructor is available in all browsers that support SW.\n    const publicUrl = new URL(\n      process.env.PUBLIC_URL,\n      window.location.href\n    );\n    if (publicUrl.origin !== window.location.origin) {\n      // Our service worker won't work if PUBLIC_URL is on a different origin\n      // from what our page is served on. This might happen if a CDN is used to\n      // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n      return;\n    }\n\n    window.addEventListener('load', () => {\n      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n      if (isLocalhost) {\n        // This is running on localhost. Let's check if a service worker still exists or not.\n        checkValidServiceWorker(swUrl, config);\n\n        // Add some additional logging to localhost, pointing developers to the\n        // service worker/PWA documentation.\n        navigator.serviceWorker.ready.then(() => {\n          console.log(\n            'This web app is being served cache-first by a service ' +\n              'worker. To learn more, visit https://bit.ly/CRA-PWA'\n          );\n        });\n      } else {\n        // Is not localhost. Just register service worker\n        registerValidSW(swUrl, config);\n      }\n    });\n  }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n  navigator.serviceWorker\n    .register(swUrl)\n    .then(registration => {\n      registration.onupdatefound = () => {\n        const installingWorker = registration.installing;\n        if (installingWorker == null) {\n          return;\n        }\n        installingWorker.onstatechange = () => {\n          if (installingWorker.state === 'installed') {\n            if (navigator.serviceWorker.controller) {\n              // At this point, the updated precached content has been fetched,\n              // but the previous service worker will still serve the older\n              // content until all client tabs are closed.\n              console.log(\n                'New content is available and will be used when all ' +\n                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n              );\n\n              // Execute callback\n              if (config && config.onUpdate) {\n                config.onUpdate(registration);\n              }\n            } else {\n              // At this point, everything has been precached.\n              // It's the perfect time to display a\n              // \"Content is cached for offline use.\" message.\n              console.log('Content is cached for offline use.');\n\n              // Execute callback\n              if (config && config.onSuccess) {\n                config.onSuccess(registration);\n              }\n            }\n          }\n        };\n      };\n    })\n    .catch(error => {\n      console.error('Error during service worker registration:', error);\n    });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n  // Check if the service worker can be found. If it can't reload the page.\n  fetch(swUrl, {\n    headers: { 'Service-Worker': 'script' }\n  })\n    .then(response => {\n      // Ensure service worker exists, and that we really are getting a JS file.\n      const contentType = response.headers.get('content-type');\n      if (\n        response.status === 404 ||\n        (contentType != null && contentType.indexOf('javascript') === -1)\n      ) {\n        // No service worker found. Probably a different app. Reload the page.\n        navigator.serviceWorker.ready.then(registration => {\n          registration.unregister().then(() => {\n            window.location.reload();\n          });\n        });\n      } else {\n        // Service worker found. Proceed as normal.\n        registerValidSW(swUrl, config);\n      }\n    })\n    .catch(() => {\n      console.log(\n        'No internet connection found. App is running in offline mode.'\n      );\n    });\n}\n\nexport function unregister() {\n  if ('serviceWorker' in navigator) {\n    navigator.serviceWorker.ready\n      .then(registration => {\n        registration.unregister();\n      })\n      .catch(error => {\n        console.error(error.message);\n      });\n  }\n}\n"
  },
  {
    "path": "src/setupTests.ts",
    "content": "// jest-dom adds custom jest matchers for asserting on DOM nodes.\n// allows you to do things like:\n// expect(element).toHaveTextContent(/react/i)\n// learn more: https://github.com/testing-library/jest-dom\nimport '@testing-library/jest-dom/extend-expect';\n"
  },
  {
    "path": "src/types/ICondition.ts",
    "content": "interface IIdentifier {\n  [key: string]: any;\n  vendor_id?: number;\n  product_id?: number;\n  description?: string;\n  is_keyboard?: boolean;\n  is_pointing_device?: boolean;\n}\nexport default interface ICondition {\n  type: string;\n  bundle_identifiers?: string[];\n  file_paths?: string[];\n  identifiers?: IIdentifier[];\n  keyboard_types?: string[];\n  input_sources?: string[];\n  name?: string;\n  value?: string;\n  description?: string;\n}\n"
  },
  {
    "path": "src/types/IFormState.ts",
    "content": "import IRule from './IRule';\n\nexport default interface IFormState {\n  title: string;\n  rules: IRule[];\n}\n"
  },
  {
    "path": "src/types/IFromEventDefinition.ts",
    "content": "import ISimultaneous from './ISimultaneous';\nimport KeyOrder from './KeyOrder';\nimport KeyUpWhen from './KeyUpWhen';\nimport PointingButton from './PointingButton';\nimport IToEventDefinition from './IToEventDefinition';\nimport Modifier from './Modifier';\n\ninterface ISimultaneousOptions {\n  detect_key_down_uninterruptedly?: Boolean;\n  key_down_order?: KeyOrder | unknown;\n  key_up_order?: KeyOrder | unknown;\n  key_up_when?: KeyUpWhen | unknown;\n  to_after_key_up: IToEventDefinition[];\n}\nexport default interface IFromEventDefinition {\n  key_code?: string;\n  consumer_key_code?: string;\n  pointing_button?: PointingButton;\n  modifiers?: {\n    mandatory?: any[];\n    optional?: any[];\n  };\n  simultaneous: ISimultaneous[];\n  simultaneous_options: ISimultaneousOptions;\n}\n"
  },
  {
    "path": "src/types/IManipulator.ts",
    "content": "import IFromEventDefinition from './IFromEventDefinition';\nimport IToEventDefinition from './IToEventDefinition';\nimport ICondition from './ICondition';\n\ninterface IToDelayedAction {\n  to_if_invoked: IToEventDefinition[];\n  to_if_canceled: IToEventDefinition[];\n}\nexport default interface IManipulator {\n  [key: string]: any;\n  type: string;\n  from: IFromEventDefinition;\n  description?: string;\n  to: IToEventDefinition[];\n  to_if_alone: IToEventDefinition[];\n  to_if_held_down: IToEventDefinition[];\n  to_after_key_up: IToEventDefinition[];\n  to_delayed_action: IToDelayedAction | any;\n  conditions: ICondition[];\n  parameters?: any;\n  _id?: string;\n}\n"
  },
  {
    "path": "src/types/IMouseKey.ts",
    "content": "export default interface IMouseKEy {\n  x?: Number;\n  y?: Number;\n  vertical_wheel?: Number;\n  horizontal_wheel?: Number;\n  speed_multiplier?: Number;\n}\n"
  },
  {
    "path": "src/types/IRule.ts",
    "content": "import IFromEventDefinition from './IFromEventDefinition';\nimport IToEventDefinition from './IToEventDefinition';\nimport IManipulator from './IManipulator';\n\nexport default interface IRule {\n  description: string;\n  manipulators: IManipulator[];\n  _id?: string;\n}\n"
  },
  {
    "path": "src/types/ISimultaneous.ts",
    "content": "export default interface ISimultaneous {\n  // TODO: add keycode label value type\n  key_code?: string | any;\n  consumer_code?: string | any;\n  pointing_button?: string;\n  _id?: string;\n}\n"
  },
  {
    "path": "src/types/IToEventDefinition.ts",
    "content": "import IMouseKEy from './IMouseKey';\n\nexport default interface IToEventDefinition {\n  key_code?: string;\n  consumer_key_code?: string;\n  pointing_button?: string;\n  shell_command?: string;\n  select_input_source?: string; // TODO: figure this out\n  set_variable?: string;\n  mouse_key?: IMouseKEy;\n  modifiers?: string[];\n  lazy?: Boolean;\n  repeat?: Boolean;\n  halt?: Boolean;\n  hold_down_milliseconds?: Number;\n  _id?: string;\n}\n"
  },
  {
    "path": "src/types/KeyOrder.ts",
    "content": "declare type KeyOrder = 'insensitive' | 'strict' | 'strict_inverse';\nexport default KeyOrder;\n"
  },
  {
    "path": "src/types/KeyUpWhen.ts",
    "content": "declare type KeyUpWhen = 'any' | 'all';\nexport default KeyUpWhen;\n"
  },
  {
    "path": "src/types/Modifier.ts",
    "content": "declare type Modifier = {\n  label: string;\n  value: string;\n};\n\nexport default Modifier;\n"
  },
  {
    "path": "src/types/PointingButton.ts",
    "content": "declare type PointingButton =\n  | 'disabled'\n  | 'button1'\n  | 'button2'\n  | 'button3'\n  | 'button4'\n  | 'button5';\nexport default PointingButton;\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"downlevelIteration\": true,\n    \"target\": \"es5\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"esModuleInterop\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"strict\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"declaration\": true,\n    \"jsx\": \"react\"\n  },\n  \"include\": [\"src\"]\n}\n"
  }
]