diff --git a/.gitignore b/.gitignore
index 224a966..ba7dc66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,4 +63,5 @@ test
*.cia
*.tmd
*.tik
-*.app
\ No newline at end of file
+*.app
+.DS_Store
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0ad25db
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/README.md b/README.md
index 93b99e9..20c17ee 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ Some classes support encoding the data back into a buffer. This is done through
- [x] Ticket. Does not decrypt title key
- [ ] Encrypted title parts (`.app` files)
- [ ] Title hashes (`.h3` files)
-- [ ] Mii data
+- [x] Mii data
- [x] MSBT. Parses:
- [x] LBL1
- [x] ATR1
@@ -76,7 +76,7 @@ Some classes support encoding the data back into a buffer. This is done through
- [x] Ticket. Does not decrypt title key
- [ ] Encrypted title parts (`.app` files)
- [ ] Title hashes (`.h3` files)
-- [ ] Mii data
+- [x] Mii data
- [ ] MSBT
- [ ] BYML/BYAML
- [ ] SARC
diff --git a/package-lock.json b/package-lock.json
index d2a1a2c..15e6dd1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,25 +1,28 @@
{
"name": "@pretendonetwork/nintendo-files",
- "version": "1.0.0",
+ "version": "1.0.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@pretendonetwork/nintendo-files",
- "version": "1.0.0",
+ "version": "1.0.2",
"license": "ISC",
"dependencies": {
+ "bit-buffer": "^0.2.5",
"image-encode": "^1.3.1",
"node-rsa": "^1.1.1"
},
"devDependencies": {
- "@types/node": "^20.5.0",
+ "@types/node": "^24.5.2",
"@types/node-rsa": "^1.1.1",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "^7.32.0",
"rimraf": "^5.0.1",
- "tsc-alias": "^1.8.7"
+ "tsc-alias": "^1.8.7",
+ "tsup": "^8.5.0",
+ "typescript": "^5.9.2"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@@ -135,6 +138,448 @@
"node": ">=4"
}
},
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.10.tgz",
+ "integrity": "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.10.tgz",
+ "integrity": "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.10.tgz",
+ "integrity": "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.10.tgz",
+ "integrity": "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.10.tgz",
+ "integrity": "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.10.tgz",
+ "integrity": "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.10.tgz",
+ "integrity": "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.10.tgz",
+ "integrity": "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.10.tgz",
+ "integrity": "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.10.tgz",
+ "integrity": "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.10.tgz",
+ "integrity": "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.10.tgz",
+ "integrity": "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.10.tgz",
+ "integrity": "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.10.tgz",
+ "integrity": "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.10.tgz",
+ "integrity": "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.10.tgz",
+ "integrity": "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.10.tgz",
+ "integrity": "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.10.tgz",
+ "integrity": "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.10.tgz",
+ "integrity": "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.10.tgz",
+ "integrity": "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.10.tgz",
+ "integrity": "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.10.tgz",
+ "integrity": "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.10.tgz",
+ "integrity": "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.10.tgz",
+ "integrity": "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.10.tgz",
+ "integrity": "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.10.tgz",
+ "integrity": "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -213,6 +658,7 @@
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
"dev": true,
+ "license": "ISC",
"dependencies": {
"string-width": "^5.1.2",
"string-width-cjs": "npm:string-width@^4.2.0",
@@ -226,10 +672,11 @@
}
},
"node_modules/@isaacs/cliui/node_modules/ansi-regex": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
- "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=12"
},
@@ -241,13 +688,15 @@
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/@isaacs/cliui/node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"eastasianwidth": "^0.2.0",
"emoji-regex": "^9.2.2",
@@ -260,65 +709,421 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/@isaacs/cliui/node_modules/strip-ansi": {
- "version": "7.1.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
- "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
+ "node_modules/@isaacs/cliui/node_modules/strip-ansi": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
+ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dev": true,
+ "dependencies": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "dev": true,
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "dev": true,
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@pkgjs/parseargs": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
+ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.2.tgz",
+ "integrity": "sha512-o3pcKzJgSGt4d74lSZ+OCnHwkKBeAbFDmbEm5gg70eA8VkyCuC/zV9TwBnmw6VjDlRdF4Pshfb+WE9E6XY1PoQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.2.tgz",
+ "integrity": "sha512-cqFSWO5tX2vhC9hJTK8WAiPIm4Q8q/cU8j2HQA0L3E1uXvBYbOZMhE2oFL8n2pKB5sOCHY6bBuHaRwG7TkfJyw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.2.tgz",
+ "integrity": "sha512-vngduywkkv8Fkh3wIZf5nFPXzWsNsVu1kvtLETWxTFf/5opZmflgVSeLgdHR56RQh71xhPhWoOkEBvbehwTlVA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.2.tgz",
+ "integrity": "sha512-h11KikYrUCYTrDj6h939hhMNlqU2fo/X4NB0OZcys3fya49o1hmFaczAiJWVAFgrM1NCP6RrO7lQKeVYSKBPSQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.2.tgz",
+ "integrity": "sha512-/eg4CI61ZUkLXxMHyVlmlGrSQZ34xqWlZNW43IAU4RmdzWEx0mQJ2mN/Cx4IHLVZFL6UBGAh+/GXhgvGb+nVxw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.2.tgz",
+ "integrity": "sha512-QOWgFH5X9+p+S1NAfOqc0z8qEpJIoUHf7OWjNUGOeW18Mx22lAUOiA9b6r2/vpzLdfxi/f+VWsYjUOMCcYh0Ng==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.2.tgz",
+ "integrity": "sha512-kDWSPafToDd8LcBYd1t5jw7bD5Ojcu12S3uT372e5HKPzQt532vW+rGFFOaiR0opxePyUkHrwz8iWYEyH1IIQA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.2.tgz",
+ "integrity": "sha512-gKm7Mk9wCv6/rkzwCiUC4KnevYhlf8ztBrDRT9g/u//1fZLapSRc+eDZj2Eu2wpJ+0RzUKgtNijnVIB4ZxyL+w==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.2.tgz",
+ "integrity": "sha512-66lA8vnj5mB/rtDNwPgrrKUOtCLVQypkyDa2gMfOefXK6rcZAxKLO9Fy3GkW8VkPnENv9hBkNOFfGLf6rNKGUg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.2.tgz",
+ "integrity": "sha512-s+OPucLNdJHvuZHuIz2WwncJ+SfWHFEmlC5nKMUgAelUeBUnlB4wt7rXWiyG4Zn07uY2Dd+SGyVa9oyLkVGOjA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.2.tgz",
+ "integrity": "sha512-8wTRM3+gVMDLLDdaT6tKmOE3lJyRy9NpJUS/ZRWmLCmOPIJhVyXwjBo+XbrrwtV33Em1/eCTd5TuGJm4+DmYjw==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.2.tgz",
+ "integrity": "sha512-6yqEfgJ1anIeuP2P/zhtfBlDpXUb80t8DpbYwXQ3bQd95JMvUaqiX+fKqYqUwZXqdJDd8xdilNtsHM2N0cFm6A==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.2.tgz",
+ "integrity": "sha512-sshYUiYVSEI2B6dp4jMncwxbrUqRdNApF2c3bhtLAU0qA8Lrri0p0NauOsTWh3yCCCDyBOjESHMExonp7Nzc0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.2.tgz",
+ "integrity": "sha512-duBLgd+3pqC4MMwBrKkFxaZerUxZcYApQVC5SdbF5/e/589GwVvlRUnyqMFbM8iUSb1BaoX/3fRL7hB9m2Pj8Q==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.2.tgz",
+ "integrity": "sha512-tzhYJJidDUVGMgVyE+PmxENPHlvvqm1KILjjZhB8/xHYqAGeizh3GBGf9u6WdJpZrz1aCpIIHG0LgJgH9rVjHQ==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.2.tgz",
+ "integrity": "sha512-opH8GSUuVcCSSyHHcl5hELrmnk4waZoVpgn/4FDao9iyE4WpQhyWJ5ryl5M3ocp4qkRuHfyXnGqg8M9oKCEKRA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.2.tgz",
+ "integrity": "sha512-LSeBHnGli1pPKVJ79ZVJgeZWWZXkEe/5o8kcn23M8eMKCUANejchJbF/JqzM4RRjOJfNRhKJk8FuqL1GKjF5oQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.2.tgz",
+ "integrity": "sha512-uPj7MQ6/s+/GOpolavm6BPo+6CbhbKYyZHUDvZ/SmJM7pfDBgdGisFX3bY/CBDMg2ZO4utfhlApkSfZ92yXw7Q==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "dependencies": {
- "ansi-regex": "^6.0.1"
- },
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/strip-ansi?sponsor=1"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
},
- "node_modules/@nodelib/fs.scandir": {
- "version": "2.1.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
- "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.2.tgz",
+ "integrity": "sha512-Z9MUCrSgIaUeeHAiNkm3cQyst2UhzjPraR3gYYfOjAuZI7tcFRTOD+4cHLPoS/3qinchth+V56vtqz1Tv+6KPA==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "dependencies": {
- "@nodelib/fs.stat": "2.0.5",
- "run-parallel": "^1.1.9"
- },
- "engines": {
- "node": ">= 8"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
},
- "node_modules/@nodelib/fs.stat": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
- "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.2.tgz",
+ "integrity": "sha512-+GnYBmpjldD3XQd+HMejo+0gJGwYIOfFeoBQv32xF/RUIvccUz20/V6Otdv+57NE70D5pa8W/jVGDoGq0oON4A==",
+ "cpu": [
+ "ia32"
+ ],
"dev": true,
- "engines": {
- "node": ">= 8"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
},
- "node_modules/@nodelib/fs.walk": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
- "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.2.tgz",
+ "integrity": "sha512-ApXFKluSB6kDQkAqZOKXBjiaqdF1BlKi+/eqnYe9Ee7U2K3pUDKsIyr8EYm/QDHTJIM+4X+lI0gJc3TTRhd+dA==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
- "dependencies": {
- "@nodelib/fs.scandir": "2.1.5",
- "fastq": "^1.6.0"
- },
- "engines": {
- "node": ">= 8"
- }
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
},
- "node_modules/@pkgjs/parseargs": {
- "version": "0.11.0",
- "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
- "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.2.tgz",
+ "integrity": "sha512-ARz+Bs8kY6FtitYM96PqPEVvPXqEZmPZsSkXvyX19YzDqkCaIlhCieLLMI5hxO9SRZ2XtCtm8wxhy0iJ2jxNfw==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
+ "license": "MIT",
"optional": true,
- "engines": {
- "node": ">=14"
- }
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
+ "dev": true,
+ "license": "MIT"
},
"node_modules/@types/json-schema": {
"version": "7.0.13",
@@ -327,10 +1132,14 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "20.6.2",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
- "integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==",
- "dev": true
+ "version": "24.5.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz",
+ "integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.12.0"
+ }
},
"node_modules/@types/node-rsa": {
"version": "1.1.1",
@@ -606,6 +1415,13 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
+ "node_modules/any-promise": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
@@ -682,16 +1498,23 @@
"node": ">=8"
}
},
+ "node_modules/bit-buffer": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/bit-buffer/-/bit-buffer-0.2.5.tgz",
+ "integrity": "sha512-x1yGnmXvFg6e3DiyRztElbcn1bsCTFSoM/ncAzY62uE0JdTl5xlKJd0ooqLYoPbhdsnpehSIQrdIvclcZJYwiA==",
+ "license": "MIT"
+ },
"node_modules/bmp-js": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw=="
},
"node_modules/brace-expansion": {
- "version": "1.1.11",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
- "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
+ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -709,6 +1532,32 @@
"node": ">=8"
}
},
+ "node_modules/bundle-require": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz",
+ "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "load-tsconfig": "^0.2.3"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "esbuild": ">=0.18"
+ }
+ },
+ "node_modules/cac": {
+ "version": "6.7.14",
+ "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -819,6 +1668,23 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/consola": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
+ "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.18.0 || >=16.10.0"
+ }
+ },
"node_modules/const-max-uint32": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/const-max-uint32/-/const-max-uint32-1.0.2.tgz",
@@ -830,10 +1696,11 @@
"integrity": "sha512-wfs+V4HdSN7C3CWJWR7hVa24yTPn3mDJthwhRIObZBh6UjTjkUMUrCP3UrNGozB/HjTpcScnGXtQUNa+yjsIJQ=="
},
"node_modules/cross-spawn": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
- "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
@@ -844,12 +1711,13 @@
}
},
"node_modules/debug": {
- "version": "4.3.4",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
- "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "ms": "2.1.2"
+ "ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
@@ -902,7 +1770,8 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/emoji-regex": {
"version": "8.0.0",
@@ -923,6 +1792,48 @@
"node": ">=8.6"
}
},
+ "node_modules/esbuild": {
+ "version": "0.25.10",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.10.tgz",
+ "integrity": "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.10",
+ "@esbuild/android-arm": "0.25.10",
+ "@esbuild/android-arm64": "0.25.10",
+ "@esbuild/android-x64": "0.25.10",
+ "@esbuild/darwin-arm64": "0.25.10",
+ "@esbuild/darwin-x64": "0.25.10",
+ "@esbuild/freebsd-arm64": "0.25.10",
+ "@esbuild/freebsd-x64": "0.25.10",
+ "@esbuild/linux-arm": "0.25.10",
+ "@esbuild/linux-arm64": "0.25.10",
+ "@esbuild/linux-ia32": "0.25.10",
+ "@esbuild/linux-loong64": "0.25.10",
+ "@esbuild/linux-mips64el": "0.25.10",
+ "@esbuild/linux-ppc64": "0.25.10",
+ "@esbuild/linux-riscv64": "0.25.10",
+ "@esbuild/linux-s390x": "0.25.10",
+ "@esbuild/linux-x64": "0.25.10",
+ "@esbuild/netbsd-arm64": "0.25.10",
+ "@esbuild/netbsd-x64": "0.25.10",
+ "@esbuild/openbsd-arm64": "0.25.10",
+ "@esbuild/openbsd-x64": "0.25.10",
+ "@esbuild/openharmony-arm64": "0.25.10",
+ "@esbuild/sunos-x64": "0.25.10",
+ "@esbuild/win32-arm64": "0.25.10",
+ "@esbuild/win32-ia32": "0.25.10",
+ "@esbuild/win32-x64": "0.25.10"
+ }
+ },
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
@@ -1230,6 +2141,18 @@
"node": ">=8"
}
},
+ "node_modules/fix-dts-default-cjs-exports": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz",
+ "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "magic-string": "^0.30.17",
+ "mlly": "^1.7.4",
+ "rollup": "^4.34.8"
+ }
+ },
"node_modules/flat-cache": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz",
@@ -1299,12 +2222,13 @@
"integrity": "sha512-oXbJGbjDnfJRWPC7Va38EFhd+A8JWE5/hCiKcK8qjCdbLj9DTpsq6MEudwpRTH+V4qq+Jw7d3pUgQdSr3x3mTA=="
},
"node_modules/foreground-child": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
- "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==",
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
+ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
"dev": true,
+ "license": "ISC",
"dependencies": {
- "cross-spawn": "^7.0.0",
+ "cross-spawn": "^7.0.6",
"signal-exit": "^4.0.1"
},
"engines": {
@@ -1340,28 +2264,6 @@
"integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==",
"dev": true
},
- "node_modules/glob": {
- "version": "10.3.4",
- "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.4.tgz",
- "integrity": "sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==",
- "dev": true,
- "dependencies": {
- "foreground-child": "^3.1.0",
- "jackspeak": "^2.0.3",
- "minimatch": "^9.0.1",
- "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
- "path-scurry": "^1.10.1"
- },
- "bin": {
- "glob": "dist/cjs/src/bin.js"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@@ -1374,30 +2276,6 @@
"node": ">= 6"
}
},
- "node_modules/glob/node_modules/brace-expansion": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
- "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
- "dev": true,
- "dependencies": {
- "balanced-match": "^1.0.0"
- }
- },
- "node_modules/glob/node_modules/minimatch": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
- "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
- "dev": true,
- "dependencies": {
- "brace-expansion": "^2.0.1"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/globals": {
"version": "13.21.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz",
@@ -1659,22 +2537,14 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
- "node_modules/jackspeak": {
- "version": "2.3.3",
- "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz",
- "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==",
+ "node_modules/joycon": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
+ "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==",
"dev": true,
- "dependencies": {
- "@isaacs/cliui": "^8.0.2"
- },
+ "license": "MIT",
"engines": {
- "node": ">=14"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- },
- "optionalDependencies": {
- "@pkgjs/parseargs": "^0.11.0"
+ "node": ">=10"
}
},
"node_modules/jpeg-js": {
@@ -1741,12 +2611,49 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/lilconfig": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antonk52"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/load-tsconfig": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz",
+ "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ }
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
+ "node_modules/lodash.sortby": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
+ "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -1765,6 +2672,16 @@
"node": ">=10"
}
},
+ "node_modules/magic-string": {
+ "version": "0.30.19",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.19.tgz",
+ "integrity": "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.5"
+ }
+ },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -1775,12 +2692,13 @@
}
},
"node_modules/micromatch": {
- "version": "4.0.5",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
- "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "braces": "^3.0.2",
+ "braces": "^3.0.3",
"picomatch": "^2.3.1"
},
"engines": {
@@ -1800,19 +2718,47 @@
}
},
"node_modules/minipass": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
- "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==",
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
+ "license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
+ "node_modules/mlly": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz",
+ "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^8.15.0",
+ "pathe": "^2.0.3",
+ "pkg-types": "^1.3.1",
+ "ufo": "^1.6.1"
+ }
+ },
+ "node_modules/mlly/node_modules/acorn": {
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
},
"node_modules/mylas": {
"version": "2.1.13",
@@ -1827,6 +2773,18 @@
"url": "https://github.com/sponsors/raouldeheer"
}
},
+ "node_modules/mz": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "thenify-all": "^1.0.0"
+ }
+ },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -1902,6 +2860,13 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/package-json-from-dist": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
+ "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0"
+ },
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
@@ -1937,31 +2902,6 @@
"node": ">=8"
}
},
- "node_modules/path-scurry": {
- "version": "1.10.1",
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz",
- "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==",
- "dev": true,
- "dependencies": {
- "lru-cache": "^9.1.1 || ^10.0.0",
- "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/path-scurry/node_modules/lru-cache": {
- "version": "10.0.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz",
- "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==",
- "dev": true,
- "engines": {
- "node": "14 || >=16.14"
- }
- },
"node_modules/path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
@@ -1971,11 +2911,19 @@
"node": ">=8"
}
},
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/picocolors": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
- "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
- "dev": true
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
},
"node_modules/picomatch": {
"version": "2.3.1",
@@ -1989,6 +2937,28 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/pirates": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
+ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
"node_modules/plimit-lit": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.5.0.tgz",
@@ -1998,6 +2968,49 @@
"queue-lit": "^1.5.0"
}
},
+ "node_modules/postcss-load-config": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz",
+ "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "lilconfig": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "jiti": ">=1.21.0",
+ "postcss": ">=8.0.9",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -2147,6 +3160,135 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/rimraf/node_modules/brace-expansion": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
+ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/rimraf/node_modules/glob": {
+ "version": "10.4.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "foreground-child": "^3.1.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^1.11.1"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/rimraf/node_modules/jackspeak": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
+ }
+ },
+ "node_modules/rimraf/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/rimraf/node_modules/minimatch": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/rimraf/node_modules/path-scurry": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "4.52.2",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.2.tgz",
+ "integrity": "sha512-I25/2QgoROE1vYV+NQ1En9T9UFB9Cmfm2CJ83zZOlaDpvz29wGQSZXWKw7MiNXau7wYgB/T9fVIdIuEQ+KbiiA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.8"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.52.2",
+ "@rollup/rollup-android-arm64": "4.52.2",
+ "@rollup/rollup-darwin-arm64": "4.52.2",
+ "@rollup/rollup-darwin-x64": "4.52.2",
+ "@rollup/rollup-freebsd-arm64": "4.52.2",
+ "@rollup/rollup-freebsd-x64": "4.52.2",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.52.2",
+ "@rollup/rollup-linux-arm-musleabihf": "4.52.2",
+ "@rollup/rollup-linux-arm64-gnu": "4.52.2",
+ "@rollup/rollup-linux-arm64-musl": "4.52.2",
+ "@rollup/rollup-linux-loong64-gnu": "4.52.2",
+ "@rollup/rollup-linux-ppc64-gnu": "4.52.2",
+ "@rollup/rollup-linux-riscv64-gnu": "4.52.2",
+ "@rollup/rollup-linux-riscv64-musl": "4.52.2",
+ "@rollup/rollup-linux-s390x-gnu": "4.52.2",
+ "@rollup/rollup-linux-x64-gnu": "4.52.2",
+ "@rollup/rollup-linux-x64-musl": "4.52.2",
+ "@rollup/rollup-openharmony-arm64": "4.52.2",
+ "@rollup/rollup-win32-arm64-msvc": "4.52.2",
+ "@rollup/rollup-win32-ia32-msvc": "4.52.2",
+ "@rollup/rollup-win32-x64-gnu": "4.52.2",
+ "@rollup/rollup-win32-x64-msvc": "4.52.2",
+ "fsevents": "~2.3.2"
+ }
+ },
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -2216,6 +3358,7 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
+ "license": "ISC",
"engines": {
"node": ">=14"
},
@@ -2249,6 +3392,20 @@
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
}
},
+ "node_modules/source-map": {
+ "version": "0.8.0-beta.0",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz",
+ "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==",
+ "deprecated": "The work that was done in this beta branch won't be included in future versions",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "whatwg-url": "^7.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -2284,6 +3441,7 @@
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
@@ -2311,6 +3469,7 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
@@ -2330,6 +3489,126 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/sucrase": {
+ "version": "3.35.0",
+ "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz",
+ "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.2",
+ "commander": "^4.0.0",
+ "glob": "^10.3.10",
+ "lines-and-columns": "^1.1.6",
+ "mz": "^2.7.0",
+ "pirates": "^4.0.1",
+ "ts-interface-checker": "^0.1.9"
+ },
+ "bin": {
+ "sucrase": "bin/sucrase",
+ "sucrase-node": "bin/sucrase-node"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/sucrase/node_modules/brace-expansion": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
+ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/sucrase/node_modules/commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/sucrase/node_modules/glob": {
+ "version": "10.4.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "foreground-child": "^3.1.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^1.11.1"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/sucrase/node_modules/jackspeak": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
+ }
+ },
+ "node_modules/sucrase/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/sucrase/node_modules/minimatch": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/sucrase/node_modules/path-scurry": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -2386,6 +3665,84 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
+ "node_modules/thenify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0"
+ }
+ },
+ "node_modules/thenify-all": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "thenify": ">= 3.1.0 < 4"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/tinyexec": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.15",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/tinyglobby/node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tinyglobby/node_modules/picomatch": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
"node_modules/to-array-buffer": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/to-array-buffer/-/to-array-buffer-3.2.0.tgz",
@@ -2420,6 +3777,26 @@
"to-array-buffer": "^3.0.0"
}
},
+ "node_modules/tr46": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
+ "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/tree-kill": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
+ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "tree-kill": "cli.js"
+ }
+ },
"node_modules/ts-api-utils": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz",
@@ -2432,6 +3809,13 @@
"typescript": ">=4.2.0"
}
},
+ "node_modules/ts-interface-checker": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
+ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
"node_modules/tsc-alias": {
"version": "1.8.7",
"resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.7.tgz",
@@ -2449,6 +3833,99 @@
"tsc-alias": "dist/bin/index.js"
}
},
+ "node_modules/tsup": {
+ "version": "8.5.0",
+ "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.0.tgz",
+ "integrity": "sha512-VmBp77lWNQq6PfuMqCHD3xWl22vEoWsKajkF8t+yMBawlUS8JzEI+vOVMeuNZIuMML8qXRizFKi9oD5glKQVcQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "bundle-require": "^5.1.0",
+ "cac": "^6.7.14",
+ "chokidar": "^4.0.3",
+ "consola": "^3.4.0",
+ "debug": "^4.4.0",
+ "esbuild": "^0.25.0",
+ "fix-dts-default-cjs-exports": "^1.0.0",
+ "joycon": "^3.1.1",
+ "picocolors": "^1.1.1",
+ "postcss-load-config": "^6.0.1",
+ "resolve-from": "^5.0.0",
+ "rollup": "^4.34.8",
+ "source-map": "0.8.0-beta.0",
+ "sucrase": "^3.35.0",
+ "tinyexec": "^0.3.2",
+ "tinyglobby": "^0.2.11",
+ "tree-kill": "^1.2.2"
+ },
+ "bin": {
+ "tsup": "dist/cli-default.js",
+ "tsup-node": "dist/cli-node.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@microsoft/api-extractor": "^7.36.0",
+ "@swc/core": "^1",
+ "postcss": "^8.4.12",
+ "typescript": ">=4.5.0"
+ },
+ "peerDependenciesMeta": {
+ "@microsoft/api-extractor": {
+ "optional": true
+ },
+ "@swc/core": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tsup/node_modules/chokidar": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
+ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/tsup/node_modules/readdirp": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
+ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.18.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/tsup/node_modules/resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -2479,11 +3956,11 @@
"integrity": "sha512-kkgkuqR/jKdKO5oh/I2SMu2dGbLXoJq0zkdgbxaqYK+hr9S9edwVVGf+tMUFTx2gH9TN2+Zu9JZ/Njonb3cjhA=="
},
"node_modules/typescript": {
- "version": "5.2.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
- "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
+ "version": "5.9.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
+ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"dev": true,
- "peer": true,
+ "license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -2492,6 +3969,20 @@
"node": ">=14.17"
}
},
+ "node_modules/ufo": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz",
+ "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/undici-types": {
+ "version": "7.12.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz",
+ "integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@@ -2634,6 +4125,25 @@
"resolved": "https://registry.npmjs.org/validate.io-string-primitive/-/validate.io-string-primitive-1.0.1.tgz",
"integrity": "sha512-TORbkLMdOFkEbPtfdx76FSVQGSAzyUEMxI+pBq5pfFm1ZzIesP+XiGc6eIK75aKu7RA7a8EcqUv5OrY5wfog5w=="
},
+ "node_modules/webidl-conversions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
+ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
+ "dev": true,
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/whatwg-url": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz",
+ "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -2654,6 +4164,7 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^6.1.0",
"string-width": "^5.0.1",
@@ -2672,6 +4183,7 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@@ -2685,10 +4197,11 @@
}
},
"node_modules/wrap-ansi/node_modules/ansi-regex": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
- "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=12"
},
@@ -2697,10 +4210,11 @@
}
},
"node_modules/wrap-ansi/node_modules/ansi-styles": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
- "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=12"
},
@@ -2712,13 +4226,15 @@
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
- "dev": true
+ "dev": true,
+ "license": "MIT"
},
"node_modules/wrap-ansi/node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"eastasianwidth": "^0.2.0",
"emoji-regex": "^9.2.2",
@@ -2732,10 +4248,11 @@
}
},
"node_modules/wrap-ansi/node_modules/strip-ansi": {
- "version": "7.1.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
- "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
+ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"ansi-regex": "^6.0.1"
},
diff --git a/package.json b/package.json
index b359a1c..a67bd92 100644
--- a/package.json
+++ b/package.json
@@ -5,21 +5,25 @@
"scripts": {
"lint": "npx eslint .",
"clean": "npx rimraf ./dist",
- "build": "npm run lint && npm run clean && npx tsc && npx tsc-alias"
+ "build": "tsup && tsc --emitDeclarationOnly"
},
+ "type": "module",
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
- "@types/node": "^20.5.0",
+ "@types/node": "^24.5.2",
"@types/node-rsa": "^1.1.1",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "^7.32.0",
"rimraf": "^5.0.1",
- "tsc-alias": "^1.8.7"
+ "tsc-alias": "^1.8.7",
+ "tsup": "^8.5.0",
+ "typescript": "^5.9.2"
},
"dependencies": {
+ "bit-buffer": "^0.2.5",
"image-encode": "^1.3.1",
"node-rsa": "^1.1.1"
},
@@ -29,47 +33,72 @@
"exports": {
".": {
"import": "./dist/index.js",
- "require": "./dist/index.js",
+ "require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"./byaml": {
"import": "./dist/byaml.js",
- "require": "./dist/byaml.js",
+ "require": "./dist/byaml.cjs",
"types": "./dist/byaml.d.ts"
},
"./byml": {
"import": "./dist/byaml.js",
- "require": "./dist/byaml.js",
+ "require": "./dist/byaml.cjs",
"types": "./dist/byaml.d.ts"
},
"./certificate": {
"import": "./dist/certificate.js",
- "require": "./dist/certificate.js",
+ "require": "./dist/certificate.cjs",
"types": "./dist/certificate.d.ts"
},
"./cia": {
"import": "./dist/cia.js",
- "require": "./dist/cia.js",
+ "require": "./dist/cia.cjs",
"types": "./dist/cia.d.ts"
},
+ "./mii": {
+ "import": "./dist/mii/index.js",
+ "require": "./dist/mii/index.cjs",
+ "types": "./dist/mii/index.d.ts"
+ },
+ "./mii/ffl-store-data": {
+ "import": "./dist/mii/ffl-store-data.js",
+ "require": "./dist/mii/ffl-store-data.cjs",
+ "types": "./dist/mii/ffl-store-data.d.ts"
+ },
+ "./mii/ffl-imii-data-official": {
+ "import": "./dist/mii/ffl-imii-data-official.js",
+ "require": "./dist/mii/ffl-imii-data-official.cjs",
+ "types": "./dist/mii/ffl-imii-data-official.d.ts"
+ },
+ "./mii/ffl-imii-data-core": {
+ "import": "./dist/mii/ffl-imii-data-core.js",
+ "require": "./dist/mii/ffl-imii-data-core.cjs",
+ "types": "./dist/mii/ffl-imii-data-core.d.ts"
+ },
+ "./mii/mii-studio-encoder": {
+ "import": "./dist/mii/mii-studio-encoder.js",
+ "require": "./dist/mii/mii-studio-encoder.cjs",
+ "types": "./dist/mii/mii-studio-encoder.d.ts"
+ },
"./msbt": {
"import": "./dist/msbt.js",
- "require": "./dist/msbt.js",
+ "require": "./dist/msbt.cjs",
"types": "./dist/msbt.d.ts"
},
"./smdh": {
"import": "./dist/smdh.js",
- "require": "./dist/smdh.js",
+ "require": "./dist/smdh.cjs",
"types": "./dist/smdh.d.ts"
},
"./ticket": {
"import": "./dist/ticket.js",
- "require": "./dist/ticket.js",
+ "require": "./dist/ticket.cjs",
"types": "./dist/ticket.d.ts"
},
"./tmd": {
"import": "./dist/tmd.js",
- "require": "./dist/tmd.js",
+ "require": "./dist/tmd.cjs",
"types": "./dist/tmd.d.ts"
}
}
diff --git a/src/binary-parser.ts b/src/binary-parser.ts
new file mode 100644
index 0000000..8c14082
--- /dev/null
+++ b/src/binary-parser.ts
@@ -0,0 +1,1203 @@
+import { Buffer } from 'node:buffer';
+import { BitStream } from 'bit-buffer';
+
+// * This exists solely because I really like the API of binary-parser, however it has 2 major issues:
+// *
+// * 1. It does not natively support encoding. There is a PR for this https://github.com/keichi/binary-parser/pull/243
+// * however it has had no activity in 2 years and shows no signs of being merged.
+// *
+// * 2. It, and some other binary parsing libraries I tried like struct-fu, seem to have weird issues where they can't
+// * handle some Mii data? I genuinely have no idea why. I found that bit-buffer can handle it fine though, so I decided
+// * to just build a binary-parser style API around it. See https://gist.github.com/jonbarrow/aa4f448cc2a3fa4f1f49721ad3c93f1c
+// * for an example of this issue.
+// *
+// * Plus this adds in many helpful additions like bit skipping, more type safety, a Zod-like interface, etc.
+
+// TODO - Remove all the "unknown"/"any" usage? Seems kinda smelly
+// TODO - Support nested structures? We don't need it right now but might be nice to have
+
+// * This will "prettify" the types generated by the BinaryParser method chaining.
+// * In an example like:
+// *
+// * const parser = new BinaryParser()
+// * .int32le('little')
+// * .int32be('big');
+// *
+// * const parsed = parser.parse(Buffer.from([ 0x4e, 0x61, 0xbc, 0x00, 0x00, 0xbc, 0x61, 0x4e ]));
+// *
+// * "parsed" will be typed as:
+// *
+// * const parsed: Record & {
+// * little: number;
+// * } & {
+// * big: number;
+// * }
+// *
+// * "Prettify" turns this into:
+// *
+// * const parsed: {
+// * little: number;
+// * big: number;
+// * }
+type Prettify = {
+ [K in keyof T]: T[K];
+} & {}; // eslint-disable-line @typescript-eslint/ban-types
+
+type CommandType =
+ | { type: 'set_endianness'; endianness: 'big' | 'little'; }
+ | { type: 'check_min'; value: number; }
+ | { type: 'check_max'; value: number; }
+ | { type: 'check_range'; min: number; max: number; }
+ | { type: 'custom_validate'; callback: (parsed: any) => void; } // eslint-disable-line @typescript-eslint/no-explicit-any
+ | { type: 'skip'; bits: number; }
+ | BitsFieldCommand
+ | BooleanBitFieldCommand
+ | IntFieldCommand
+ | BufferFieldCommand
+ | StringFieldCommand;
+
+type NumberFieldOptions = {
+ min?: number;
+ max?: number;
+};
+
+type BufferFieldOptions = {
+ length: number;
+};
+
+type StringFieldOptions = {
+ length: number;
+ encoding: BufferEncoding;
+};
+
+class BitsFieldCommand {
+ public readonly type = 'bits';
+ public name: string;
+ public options?: NumberFieldOptions;
+ public bits: number;
+
+ constructor(settings: { name: string; options?: NumberFieldOptions, bits: number; }) {
+ this.name = settings.name;
+ this.options = settings.options;
+ this.bits = settings.bits;
+ }
+
+ parse(stream: BitStream): number {
+ return stream.readBits(this.bits);
+ }
+
+ encode(stream: BitStream, parsed: Record): void {
+ stream.writeBits(parsed[this.name] as number, this.bits);
+ }
+}
+
+class BooleanBitFieldCommand {
+ public readonly type = 'boolean_bit';
+ public readonly bits = 1;
+ public name: string;
+
+ constructor(settings: { name: string; }) {
+ this.name = settings.name;
+ }
+
+ parse(stream: BitStream): boolean {
+ return !!stream.readBits(1);
+ }
+
+ encode(stream: BitStream, parsed: Record): void {
+ stream.writeBits(parsed[this.name] ? 1 : 0, 1);
+ }
+}
+
+class IntFieldCommand {
+ public readonly type = 'int';
+ public name: string;
+ public signed: boolean;
+ public endianness: 'current' | 'big' | 'little';
+ public options?: NumberFieldOptions;
+ public bits: 8 | 16 | 32;
+
+ constructor(settings: { name: string; signed: boolean; endianness?: 'current' | 'big' | 'little'; options?: NumberFieldOptions; bits: 8 | 16 | 32; }) {
+ this.name = settings.name;
+ this.signed = settings.signed;
+ this.endianness = settings.endianness || 'current'; // * Only not set for 8 bit numbers, so this doesn't matter
+ this.options = settings.options;
+ this.bits = settings.bits;
+ }
+
+ parse(stream: BitStream): number {
+ const currentEndianness = stream.bigEndian;
+ let value: number;
+
+ if (this.bits !== 8 && this.endianness !== 'current') {
+ stream.bigEndian = this.endianness === 'big' ? true : false;
+ }
+
+ if (this.signed) {
+ value = this.bits === 8 ? stream.readInt8() : this.bits === 16 ? stream.readInt16() : stream.readInt32();
+ } else {
+ value = this.bits === 8 ? stream.readUint8() : this.bits === 16 ? stream.readUint16() : stream.readUint32();
+ }
+
+ stream.bigEndian = currentEndianness;
+
+ return value;
+ }
+
+ encode(stream: BitStream, parsed: Record): void {
+ const currentEndianness = stream.bigEndian;
+
+ if (this.bits !== 8 && this.endianness !== 'current') {
+ stream.bigEndian = this.endianness === 'big' ? true : false;
+ }
+
+ const value = parsed[this.name] as number;
+
+ if (this.signed) {
+ this.bits === 8 ? stream.writeInt8(value) : this.bits === 16 ? stream.writeInt16(value) : stream.writeInt32(value);
+ } else {
+ this.bits === 8 ? stream.writeUint8(value) : this.bits === 16 ? stream.writeUint16(value) : stream.writeUint32(value);
+ }
+
+ stream.bigEndian = currentEndianness;
+ }
+}
+
+class BufferFieldCommand {
+ public readonly type = 'buffer';
+ public name: string;
+ public options: BufferFieldOptions;
+ public bits: number;
+
+ constructor(settings: { name: string; options: BufferFieldOptions; bits: number; }) {
+ this.name = settings.name;
+ this.options = settings.options;
+ this.bits = settings.bits;
+ }
+
+ parse(stream: BitStream): Buffer {
+ return Buffer.from(stream.readArrayBuffer(this.options.length));
+ }
+
+ encode(stream: BitStream, parsed: Record): void {
+ (parsed[this.name] as Buffer).forEach(byte => stream.writeUint8(byte));
+ }
+}
+
+class StringFieldCommand {
+ public readonly type = 'string';
+ public name: string;
+ public options: StringFieldOptions;
+ public bits: number;
+
+ constructor(settings: { name: string; options: StringFieldOptions; bits: number; }) {
+ this.name = settings.name;
+ this.options = settings.options;
+ this.bits = settings.bits;
+ }
+
+ parse(stream: BitStream): string {
+ return Buffer.from(stream.readArrayBuffer(this.options.length)).toString(this.options.encoding);
+ }
+
+ encode(stream: BitStream, parsed: Record): void {
+ const stringBuffer = Buffer.from(parsed[this.name] as string, this.options.encoding);
+ const terminatedBuffer = Buffer.alloc(this.options.length);
+
+ terminatedBuffer.set(stringBuffer);
+ terminatedBuffer.forEach(byte => stream.writeUint8(byte));
+ }
+}
+
+/**
+ * Custom structure parser with an API aimed at matching `binary-parser`, with additions. Uses `bit-buffer` under the hood
+ */
+export default class BinaryParser> { // eslint-disable-line @typescript-eslint/no-explicit-any
+ private commands: CommandType[] = [];
+
+ /**
+ * Zod-like `z.infer` method, Do not call at runtime. Use `ReturnType>`
+ */
+ static infer>(_parser: TParser): TParser extends BinaryParser ? Prettify : never { // eslint-disable-line @typescript-eslint/no-explicit-any
+ throw new Error('This method is only for type inference and should never be called at runtime.');
+ }
+
+ /**
+ * Sets the endianness for all values moving forward. Parser is big-endian by default
+ *
+ * @param endianness - The new endianness
+ * @returns The current `BinaryParser` instance
+ */
+ public endianness(endianness: 'big' | 'little'): this {
+ this.commands.push({
+ type: 'set_endianness',
+ endianness: endianness
+ });
+
+ return this;
+ }
+
+ /**
+ * Alias of `bitN`
+ *
+ * @param name - The name of the decoded field
+ * @param bits - The number of bits to read
+ * @returns The current `BinaryParser` instance
+ */
+ public bits(name: K, bits: number, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, bits, options);
+ }
+
+ /**
+ * Reads `bits` number of bits
+ *
+ * @param name - The name of the decoded field
+ * @param bits - The number of bits to read
+ * @returns The current `BinaryParser` instance
+ */
+ public bitN(name: K, bits: number, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new BitsFieldCommand({
+ name: name,
+ ...(options && { options }),
+ bits: bits
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a single bit, interpreted as a boolean
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public booleanBit(name: K): BinaryParser {
+ this.commands.push(new BooleanBitFieldCommand({
+ name: name
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Alias of `bit1`
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit(name: K): BinaryParser {
+ return this.bit1(name);
+ }
+
+ /**
+ * Reads a single bit
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit1(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 1, options);
+ }
+
+ /**
+ * Reads 2 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit2(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 2, options);
+ }
+
+ /**
+ * Reads 3 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit3(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 3, options);
+ }
+
+ /**
+ * Reads 4 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit4(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 4, options);
+ }
+
+ /**
+ * Reads 5 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit5(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 5, options);
+ }
+
+ /**
+ * Reads 6 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit6(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 6, options);
+ }
+
+ /**
+ * Reads 7 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit7(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 7, options);
+ }
+
+ /**
+ * Reads 8 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit8(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 8, options);
+ }
+
+ /**
+ * Reads 9 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit9(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 9, options);
+ }
+
+ /**
+ * Reads 10 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit10(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 10, options);
+ }
+
+ /**
+ * Reads 11 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit11(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 11, options);
+ }
+
+ /**
+ * Reads 12 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit12(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 12, options);
+ }
+
+ /**
+ * Reads 13 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit13(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 13, options);
+ }
+
+ /**
+ * Reads 14 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit14(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 14, options);
+ }
+
+ /**
+ * Reads 15 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit15(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 15, options);
+ }
+
+ /**
+ * Reads 16 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit16(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 16, options);
+ }
+
+ /**
+ * Reads 17 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit17(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 17, options);
+ }
+
+ /**
+ * Reads 18 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit18(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 18, options);
+ }
+
+ /**
+ * Reads 19 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit19(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 19, options);
+ }
+
+ /**
+ * Reads 20 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit20(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 20, options);
+ }
+
+ /**
+ * Reads 21 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit21(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 21, options);
+ }
+
+ /**
+ * Reads 22 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit22(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 22, options);
+ }
+
+ /**
+ * Reads 23 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit23(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 23, options);
+ }
+
+ /**
+ * Reads 24 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit24(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 24, options);
+ }
+
+ /**
+ * Reads 25 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit25(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 25, options);
+ }
+
+ /**
+ * Reads 26 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit26(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 26, options);
+ }
+
+ /**
+ * Reads 27 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit27(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 27, options);
+ }
+
+ /**
+ * Reads 28 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit28(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 28, options);
+ }
+
+ /**
+ * Reads 29 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit29(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 29, options);
+ }
+
+ /**
+ * Reads 30 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit30(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 30, options);
+ }
+
+ /**
+ * Reads 31 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit31(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 31, options);
+ }
+
+ /**
+ * Reads 32 bits
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public bit32(name: K, options?: NumberFieldOptions): BinaryParser {
+ return this.bitN(name, 32, options);
+ }
+
+ /**
+ * Reads an unsigned 8-bit integer
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint8(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ ...(options && { options }),
+ bits: 8
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 8-bit integer
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int8(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ ...(options && { options }),
+ bits: 8
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 16-bit integer using the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint16(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'current',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 16-bit integer in little-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint16le(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'little',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 16-bit integer in big-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint16be(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'big',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 16-bit integer using the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int16(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'current',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 16-bit integer in little-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int16le(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'little',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 16-bit integer in big-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int16be(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'big',
+ ...(options && { options }),
+ bits: 16
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 32-bit integer using the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint32(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'current',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 32-bit integer in little-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint32le(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'little',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads an unsigned 32-bit integer in big-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public uint32be(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: false,
+ endianness: 'big',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 32-bit integer using the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int32(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'current',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 32-bit integer in little-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int32le(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'little',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a signed 32-bit integer in big-endian mode, regardless of the currently set endianness
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public int32be(name: K, options?: NumberFieldOptions): BinaryParser {
+ this.commands.push(new IntFieldCommand({
+ name: name,
+ signed: true,
+ endianness: 'big',
+ ...(options && { options }),
+ bits: 32
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Skips `length` bytes. When encoding, skipped bytes are set to null
+ *
+ * @param length - The number of bytes to skip
+ * @returns The current `BinaryParser` instance
+ */
+ public skip(length: number): this {
+ return this.skipBits(length * 8);
+ }
+
+ /**
+ * Skips `length` bits. When encoding, skipped bits are set to 0
+ *
+ * @param length - The number of bits to skip
+ * @returns The current `BinaryParser` instance
+ */
+ public skipBits(length: number): this {
+ this.commands.push({
+ type: 'skip',
+ bits: length
+ });
+
+ return this;
+ }
+
+ /**
+ * Reads a `Buffer` of data of size `options.length`
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public buffer(name: K, options: BufferFieldOptions): BinaryParser {
+ this.commands.push(new BufferFieldCommand({
+ name: name,
+ options: options,
+ bits: options.length * 8
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Reads a string of data of size `options.length` in `options.encoding` encoding
+ *
+ * @param name - The name of the decoded field
+ * @returns The current `BinaryParser` instance
+ */
+ public string(name: K, options: StringFieldOptions): BinaryParser {
+ this.commands.push(new StringFieldCommand({
+ name: name,
+ options: options,
+ bits: options.length * 8
+ }));
+
+ return this as unknown as BinaryParser;
+ }
+
+ /**
+ * Ensures the parsed value is greater than, or equal to, the provided value. Can also be set using `options.min`
+ * when parsing a number
+ *
+ * @param value - Minimum value
+ * @returns The current `BinaryParser` instance
+ */
+ public min(value: number): this {
+ this.commands.push({
+ type: 'check_min',
+ value: value
+ });
+
+ return this;
+ }
+
+ /**
+ * Ensures the parsed value is less than, or equal to, the provided value. Can also be set using `options.max`
+ * when parsing a number
+ *
+ * @param value - Maximum value
+ * @returns The current `BinaryParser` instance
+ */
+ public max(value: number): this {
+ this.commands.push({
+ type: 'check_max',
+ value: value
+ });
+
+ return this;
+ }
+
+ /**
+ * Ensures the parsed value is the given range, inclusive. Can also be set using both `options.min` and
+ * `options.max` when parsing a number
+ *
+ * @param min - Minimum value
+ * @param max - Maximum value
+ * @returns The current `BinaryParser` instance
+ */
+ public range(min: number, max: number): this {
+ this.commands.push({
+ type: 'check_range',
+ min: min,
+ max: max
+ });
+
+ return this;
+ }
+
+ /**
+ * Defines a custom validation function. Can be used for complex checks across multiple fields. Expected
+ * to throw errors when found
+ *
+ * @param callback - Custom validation function
+ * @returns The current `BinaryParser` instance
+ */
+ public validate(callback: (parsed: T) => void): this {
+ this.commands.push({
+ type: 'custom_validate',
+ callback: callback
+ });
+
+ return this;
+ }
+
+ /**
+ * Uses the current structure to parse `data`. Will throw any errors that occur
+ *
+ * @param data - Raw binary data to parse with the current structure
+ * @returns Object of parsed data
+ */
+ public parse(data: Buffer): Prettify {
+ const stream = new BitStream(data.buffer as ArrayBuffer, data.byteOffset, data.byteLength); // TODO - Can this "as" be removed?
+ const result: Record = {};
+ let latestField: {
+ name: string;
+ value: unknown;
+ } | undefined = undefined;
+
+ stream.bigEndian = true; // * Make this match binary-parser, BE by default
+
+ for (const command of this.commands) {
+ if (command.type === 'set_endianness') {
+ stream.bigEndian = command.endianness === 'big' ? true : false;
+ }
+
+ if (command.type === 'skip') {
+ stream.index += command.bits;
+ continue;
+ }
+
+ if (command.type === 'custom_validate') {
+ command.callback(result as T);
+ continue;
+ }
+
+ if (command.type === 'check_min' && latestField) {
+ if (latestField.value as number < command.value) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is less than ${command.value}`);
+ }
+
+ continue;
+ }
+
+ if (command.type === 'check_max' && latestField) {
+ if (latestField.value as number > command.value) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is greater than ${command.value}`);
+ }
+
+ continue;
+ }
+
+ if (command.type === 'check_range' && latestField) {
+ if (latestField.value as number < command.min) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is less than ${command.min}`);
+ }
+
+ if (latestField.value as number > command.max) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is greater than ${command.max}`);
+ }
+
+ continue;
+ }
+
+ if ('name' in command) {
+ const value = command.parse(stream);
+
+ if ('options' in command && command.options && 'min' in command.options) {
+ if (value as number < command.options.min!) {
+ throw new Error(`Field '${command.name}' is invalid. Value ${value} is less than ${command.options.min!}`);
+ }
+ }
+
+ if ('options' in command && command.options && 'max' in command.options) {
+ if (value as number > command.options.max!) {
+ throw new Error(`Field '${command.name}' is invalid. Value ${value} is greater than ${command.options.max!}`);
+ }
+ }
+
+ result[command.name] = value;
+ latestField = {
+ name: command.name,
+ value: value
+ };
+ }
+ }
+
+ return result as T;
+ }
+
+ /**
+ * Zod-like safe parsing. If `success` is true, `data` contains the parsed data. Otherwise `error` contains any parsing errors
+ *
+ * @param data - Raw binary data to parse with the current structure
+ * @returns An object containing either `success: true` and `data`, or `success: false` and `error`
+ */
+ public safeParse(data: Buffer): { success: true; data: Prettify } | { success: false; error: unknown } {
+ try {
+ return {
+ success: true,
+ data: this.parse(data)
+ };
+ } catch (error: unknown) {
+ return {
+ success: false,
+ error: error
+ };
+ }
+ }
+
+ /**
+ * Uses the current structure to encode `parsed`. Will throw any errors that occur
+ *
+ * @param data - Object of parsed data to be coded
+ * @returns Encoded data
+ */
+ public encode(parsed: Prettify): Buffer {
+ const out = Buffer.alloc(this.size());
+ const stream = new BitStream(out, out.byteOffset, out.byteLength);
+ const parsedKeys = Object.keys(parsed);
+ let latestField: {
+ name: string;
+ value: unknown;
+ } | undefined = undefined;
+
+ stream.bigEndian = true; // * Make this match binary-parser, BE by default
+
+ for (const command of this.commands) {
+ if ('name' in command && !parsedKeys.includes(command.name)) {
+ throw new Error(`Failed to find data for field ${command.name}`);
+ }
+
+ if (command.type === 'set_endianness') {
+ stream.bigEndian = command.endianness === 'big' ? true : false;
+ }
+
+ if (command.type === 'skip') {
+ stream.index += command.bits;
+ continue;
+ }
+
+ if (command.type === 'custom_validate') {
+ command.callback(parsed);
+ continue;
+ }
+
+ if (command.type === 'check_min' && latestField) {
+ if (latestField.value as number < command.value) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is less than ${command.value}`);
+ }
+
+ continue;
+ }
+
+ if (command.type === 'check_max' && latestField) {
+ if (latestField.value as number > command.value) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is greater than ${command.value}`);
+ }
+
+ continue;
+ }
+
+ if (command.type === 'check_range' && latestField) {
+ if (latestField.value as number < command.min) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is less than ${command.min}`);
+ }
+
+ if (latestField.value as number > command.max) {
+ throw new Error(`Field '${latestField.name}' is invalid. Value ${latestField.value} is greater than ${command.max}`);
+ }
+
+ continue;
+ }
+
+ if ('name' in command) {
+ command.encode(stream, parsed);
+
+ latestField = {
+ name: command.name,
+ value: (parsed as Record)[command.name]
+ };
+ }
+ }
+
+ return out;
+ }
+
+ /**
+ * Zod-like safe encoding. If `success` is true, `data` contains the parsed data. Otherwise `error` contains any encoding errors
+ *
+ * @param parsed - Object of parsed data to be coded
+ * @returns An object containing either `success: true` and `data`, or `success: false` and `error`
+ */
+ public safeEncode(parsed: Prettify): { success: true; data: Buffer } | { success: false; error: unknown } {
+ try {
+ return {
+ success: true,
+ data: this.encode(parsed)
+ };
+ } catch (error) {
+ return {
+ success: false,
+ error: error
+ };
+ }
+ }
+
+ /**
+ * Calculates the byte size based on the given structure
+ *
+ * @returns The number of bytes the structure requires
+ */
+ public size(): number {
+ let bits = 0;
+
+ for (const command of this.commands) {
+ if ('bits' in command) {
+ bits += command.bits;
+ }
+ }
+
+ return Math.ceil(bits / 8);
+ }
+}
\ No newline at end of file
diff --git a/src/file-stream.ts b/src/file-stream.ts
index 8a7ebfe..768fffe 100644
--- a/src/file-stream.ts
+++ b/src/file-stream.ts
@@ -1,23 +1,31 @@
-import fs from 'node:fs';
+import * as fsModule from 'node:fs'; // * This SHOULD get tree-shaken away during building?
+import { Buffer } from 'buffer';
import Stream from '@/stream';
+const isBrowser = typeof window !== 'undefined';
+const fs = isBrowser ? null : fsModule;
+
export default class FileStream extends Stream {
private fd?: number;
private fileSize?: number;
constructor(fdOrPathOrBufferOrStream: number | string | Buffer | Stream) {
+ if ((typeof fdOrPathOrBufferOrStream === 'number' || typeof fdOrPathOrBufferOrStream === 'string') && isBrowser) {
+ throw new Error('File operations not supported in browser environment');
+ }
+
if (typeof fdOrPathOrBufferOrStream === 'number') {
super(Buffer.alloc(0));
this.fd = fdOrPathOrBufferOrStream;
} else if (typeof fdOrPathOrBufferOrStream === 'string') {
super(Buffer.alloc(0));
- this.fd = fs.openSync(fdOrPathOrBufferOrStream, 'r');
+ this.fd = fs!.openSync(fdOrPathOrBufferOrStream, 'r');
} else {
super(fdOrPathOrBufferOrStream);
}
if (this.fd) {
- const stat = fs.fstatSync(this.fd);
+ const stat = fs!.fstatSync(this.fd);
this.fileSize = stat.size;
}
}
@@ -46,7 +54,7 @@ export default class FileStream extends Stream {
if (this.fd) {
read = Buffer.alloc(length);
- fs.readSync(this.fd!, read, 0, length, this.offset);
+ fs!.readSync(this.fd!, read, 0, length, this.offset);
} else {
read = this.buffer.subarray(this.offset, this.offset + length);
}
@@ -65,8 +73,8 @@ export default class FileStream extends Stream {
if (this.fd && this.fileSize) {
this.buffer = Buffer.alloc(this.fileSize);
- fs.readSync(this.fd, this.buffer, 0, this.fileSize, 0);
- fs.closeSync(this.fd);
+ fs!.readSync(this.fd, this.buffer, 0, this.fileSize, 0);
+ fs!.closeSync(this.fd);
this.fd = undefined;
}
diff --git a/src/index.ts b/src/index.ts
index 27e6fb4..79f5300 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,6 +9,9 @@ export * from '@/certificate';
export { default as CIA } from '@/cia';
export * from '@/cia';
+// TODO - Implement other Mii versions
+export * from '@/mii';
+
export { default as MSBT } from '@/msbt';
export * from '@/msbt';
diff --git a/src/mii/ffl-imii-data-core.ts b/src/mii/ffl-imii-data-core.ts
new file mode 100644
index 0000000..0118bd6
--- /dev/null
+++ b/src/mii/ffl-imii-data-core.ts
@@ -0,0 +1,820 @@
+import { Buffer } from 'node:buffer';
+import BinaryParser from '@/binary-parser';
+import FileStream from '@/file-stream';
+
+/**
+ * Indicates what region a Mii is locked to. A region locked
+ * Mii cannot be shared outside of its region
+ */
+export enum LOCKED_REGION {
+ NONE,
+ JPN,
+ USA,
+ EUR
+}
+
+/**
+ * Indicates what character set (font) should be used for rendering
+ * Mii text, such as the creator name and Mii nickname
+ */
+export enum CHARACTER_SET {
+ JPN_USA_EUR,
+ CHN,
+ KOR,
+ TWN
+}
+
+/**
+ * Unknown use
+ */
+type AUTHOR_TYPE = number; // TODO - What are these?
+
+// * Uses the codenames because 3DS doesn't play nice here
+
+/**
+ * Indicates what device the Mii was created on. Uses device codenames
+ * since "3DS" cannot be used as a key
+ */
+export enum DEVICE_ORIGIN {
+ /**
+ * Mii was made on the Wii
+ */
+ RVL,
+
+ /**
+ * Mii was made on the DS/DSi
+ */
+ NTR,
+
+ /**
+ * Mii was made on the 3DS
+ */
+ CTR,
+
+ /**
+ * Mii was made on the Wii U.
+ * This value is shared with the Switch
+ */
+ WUP,
+
+ /**
+ * Mii was made on the Switch.
+ * This value is shared with the Wii U
+ */
+ NX = WUP
+}
+
+/**
+ * Indicates what gender the Mii is. Functionally
+ * all this does is change between shirt and dress styles
+ */
+export enum GENDER {
+ MALE,
+ FEMALE
+}
+
+/**
+ * Indicates what shirt color the Mii has
+ */
+export enum FAVORITE_COLOR {
+ RED,
+ ORANGE,
+ YELLOW,
+ LIGHT_GREEN,
+ GREEN,
+ BLUE,
+ LIGHT_BLUE,
+ PINK,
+ PURPLE,
+ BROWN,
+ WHITE,
+ BLACK
+}
+
+// TODO - All the other color/type enums
+
+/**
+ * Indicates whether or not the mole feature is active
+ */
+export enum MOLE_TYPE {
+ DISABLED,
+ ENABLED
+}
+
+// * Names are taken straight from https://github.com/PretendoNetwork/mii-js
+const coreParser = new BinaryParser()
+ .endianness('little')
+ .uint8('version')
+ .booleanBit('allowCopying')
+ .booleanBit('profanityFlag')
+ .bit2('regionLock')
+ .bit2('characterSet')
+ .skipBits(2)
+ .bit4('pageIndex')
+ .bit4('slotIndex')
+ .bit4('unknown1')
+ .bit3('deviceOrigin')
+ .skipBits(1)
+ .buffer('systemId', { length: 8 })
+ .endianness('big')
+ .booleanBit('normalMii')
+ .booleanBit('dsMii')
+ .booleanBit('nonUserMii')
+ .booleanBit('isValid')
+ .bit28('creationTime')
+ .endianness('little')
+ .buffer('consoleMAC', { length: 6 })
+ .skip(2)
+ .bit1('gender')
+ .bit4('birthMonth')
+ .bit5('birthDay')
+ .bit4('favoriteColor')
+ .booleanBit('favorite')
+ .skipBits(1)
+ .string('miiName', { length: 20, encoding: 'utf16le' })
+ .uint8('height')
+ .uint8('build')
+ .booleanBit('disableSharing')
+ .bit4('faceType')
+ .bit3('skinColor')
+ .bit4('wrinklesType')
+ .bit4('makeupType')
+ .uint8('hairType')
+ .bit3('hairColor')
+ .booleanBit('flipHair')
+ .skipBits(4)
+ .bit6('eyeType')
+ .bit3('eyeColor')
+ .bit4('eyeScale')
+ .bit3('eyeVerticalStretch')
+ .bit5('eyeRotation')
+ .bit4('eyeSpacing')
+ .bit5('eyeYPosition')
+ .skipBits(2)
+ .bit5('eyebrowType')
+ .bit3('eyebrowColor')
+ .bit4('eyebrowScale')
+ .bit3('eyebrowVerticalStretch')
+ .skipBits(1)
+ .bit4('eyebrowRotation')
+ .skipBits(1)
+ .bit4('eyebrowSpacing')
+ .bit5('eyebrowYPosition')
+ .skipBits(2)
+ .bit5('noseType')
+ .bit4('noseScale')
+ .bit5('noseYPosition')
+ .skipBits(2)
+ .bit6('mouthType')
+ .bit3('mouthColor')
+ .bit4('mouthScale')
+ .bit3('mouthHorizontalStretch')
+ .bit5('mouthYPosition')
+ .bit3('mustacheType')
+ .uint8('unknown2')
+ .bit3('beardType')
+ .bit3('facialHairColor')
+ .bit4('mustacheScale')
+ .bit5('mustacheYPosition')
+ .skipBits(1)
+ .bit4('glassesType')
+ .bit3('glassesColor')
+ .bit4('glassesScale')
+ .bit5('glassesYPosition')
+ .bit1('moleEnabled')
+ .bit4('moleScale')
+ .bit5('moleXPosition')
+ .bit5('moleYPosition');
+
+const createIDParser = new BinaryParser()
+ .booleanBit('normalMii')
+ .booleanBit('dsMii')
+ .booleanBit('nonUserMii')
+ .booleanBit('isValid')
+ .bit28('creationTime')
+ .endianness('little')
+ .buffer('consoleMAC', { length: 6 });
+
+// * Decorator for automatically creating getters and setters for the parsed data
+function mapToDecoded(decodedPath: string) {
+ return function(_target: unknown, context: ClassFieldDecoratorContext): void {
+ const propertyKey = context.name as string;
+ const pathParts = decodedPath.split('.');
+
+ context.addInitializer(function() {
+ Object.defineProperty(this, propertyKey, {
+ get() {
+ let value = (this as Record).decoded;
+ for (const part of pathParts) {
+ value = (value as Record)?.[part];
+ }
+ return value;
+ },
+ set(newValue) {
+ let current = (this as Record).decoded as Record;
+ for (let i = 0; i < pathParts.length - 1; i++) {
+ const part = pathParts[i];
+ if (!(part in current)) {
+ current[part] = {};
+ }
+ current = current[part] as Record;
+ }
+ const finalKey = pathParts[pathParts.length - 1];
+ current[finalKey] = newValue;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ });
+ };
+}
+
+// TODO - Hook this up to something like Arian's WASM port of FFL?
+
+/**
+ * Handles Mii data in the `FFLiMiiDataCore` format. This is the raw data of
+ * the Mii, as used by the 3DS and Wii U
+ */
+export default class FFLiMiiDataCore {
+ private stream: FileStream;
+ private decoded!: ReturnType>;
+
+ /**
+ * The Mii data version. Always 3, unless the Mii was made
+ * with the Wii U GamePad camera, in which case 0.
+ */
+ @mapToDecoded('version')
+ public miiVersion: number;
+
+ /**
+ * If set, the Mii can be copied.
+ */
+ @mapToDecoded('allowCopying')
+ public copyable: boolean;
+
+ /**
+ * If set, this means the Mii contains profanity in either
+ * the Mii name or creator name. If set, both the Mii name
+ * and creator name are replaced with "???".
+ */
+ @mapToDecoded('profanityFlag')
+ public ngWord: boolean;
+
+ /**
+ * If set, this locks the Mii to a specific region.
+ */
+ @mapToDecoded('regionLock')
+ public regionMove: LOCKED_REGION;
+
+ /**
+ * Denotes the font type that should be used for strings.
+ */
+ @mapToDecoded('characterSet')
+ public fontRegion: CHARACTER_SET;
+
+ /**
+ * The room ID the Mii is in when using Mii Maker.
+ */
+ @mapToDecoded('pageIndex')
+ public roomIndex: number;
+
+ /**
+ * The slot ID the Mii is in when using Mii Maker.
+ */
+ @mapToDecoded('slotIndex')
+ public positionInRoom: number;
+
+ /**
+ * Unknown.
+ */
+ @mapToDecoded('unknown1')
+ public authorType: AUTHOR_TYPE;
+
+ /**
+ * Denotes the platform the Mii was created on.
+ */
+ @mapToDecoded('deviceOrigin')
+ public birthPlatform: DEVICE_ORIGIN;
+
+ /**
+ * Identifies the owner of the Mii, editing restrictions and blue pants.
+ * In older Mii formats, this was tied to the console MAC. This is no
+ * longer the case.
+ */
+ @mapToDecoded('systemId')
+ public authorID: Buffer;
+
+ /**
+ * In the original implementation, this contains additional flags and metadata.
+ * In more recent implementations, this is random data.
+ */
+ public get createID(): Buffer {
+ return createIDParser.encode({
+ creationTime: this.creationDate,
+ isValid: this.isValid,
+ nonUserMii: this.isNonUserMii,
+ dsMii: this.isDSi,
+ normalMii: this.isNormalMii,
+ consoleMAC: this.creatorMAC
+ });
+ }
+
+ public set createID(createID: Buffer) {
+ const decoded = createIDParser.parse(createID);
+
+ this.creationDate = decoded.creationTime;
+ this.isValid = decoded.isValid;
+ this.isNonUserMii = decoded.nonUserMii;
+ this.isDSi = decoded.dsMii;
+ this.isNormalMii = decoded.normalMii;
+ this.creatorMAC = decoded.consoleMAC;
+ }
+
+ /**
+ * The date the Mii was created, in seconds divided by 2, since 01/01/2010 00:00:00.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('creationTime')
+ public creationDate: number;
+
+ /**
+ * If set, the Mii is considered valid. If not, the Mii is considered invalid.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('isValid')
+ public isValid: boolean;
+
+ /**
+ * If set, this Mii is either a temporary Mii made by an application (such as an NPC),
+ * or this is a developer Mii made on a dev unit.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('nonUserMii')
+ public isNonUserMii: boolean;
+
+ /**
+ * If set, this Mii was created on a DSi.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('dsMii')
+ public isDSi: boolean;
+
+ /**
+ * If set, this Mii will NOT have the "special Mii" gold pants.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('normalMii')
+ public isNormalMii: boolean;
+
+ /**
+ * The MAC address of the console the Mii was made on.
+ * This is part of the "createID" in the original implementation, and
+ * should not be relied on since more recent implementations of "createID"
+ * set this to random data.
+ */
+ @mapToDecoded('consoleMAC')
+ public creatorMAC: Buffer;
+
+ /**
+ * Denotes the Miis gender.
+ */
+ @mapToDecoded('gender')
+ public gender: GENDER;
+
+ /**
+ * Denotes the Miis birth month.
+ */
+ @mapToDecoded('birthMonth')
+ public birthMonth: number;
+
+ /**
+ * Denotes the Miis birth day.
+ */
+ @mapToDecoded('birthDay')
+ public birthDay: number;
+
+ /**
+ * Denotes the Miis shirt color.
+ */
+ @mapToDecoded('favoriteColor')
+ public favoriteColor: FAVORITE_COLOR;
+
+ /**
+ * If set, this Mii is considered a users "favorite".
+ */
+ @mapToDecoded('favorite')
+ public favorite: boolean;
+
+ /**
+ * Mii name. UTF-16 encoded, up to 10 characters with "0000" padding
+ */
+ @mapToDecoded('miiName')
+ public name: string;
+
+ /**
+ * Height of the Mii
+ */
+ @mapToDecoded('height')
+ public height: number;
+
+ /**
+ * Thickness of the Mii
+ */
+ @mapToDecoded('build')
+ public build: number;
+
+ /**
+ * If set, the Mii cannot be shared via StreetPass. If the Mii has "isNormalMii",
+ * it MUST have this flag set. Special Miis are not permitted to be shared.
+ */
+ @mapToDecoded('disableSharing')
+ public localOnly: boolean;
+
+ /**
+ * Mii head shape ID.
+ */
+ @mapToDecoded('faceType')
+ public faceType: number;
+
+ /**
+ * Mii skin color ID.
+ */
+ @mapToDecoded('skinColor')
+ public faceColor: number;
+
+ /**
+ * Mii wrinkles type ID.
+ */
+ @mapToDecoded('wrinklesType')
+ public faceTex: number;
+
+ /**
+ * Mii makeup type ID.
+ */
+ @mapToDecoded('makeupType')
+ public faceMake: number;
+
+ /**
+ * Mii hair type ID.
+ */
+ @mapToDecoded('hairType')
+ public hairType: number;
+
+ /**
+ * Mii hair color ID.
+ */
+ @mapToDecoded('hairColor')
+ public hairColor: number;
+
+ /**
+ * If set, mirror the Miis hair.
+ */
+ @mapToDecoded('flipHair')
+ public hairFlip: boolean;
+
+ /**
+ * Mii eye type ID.
+ */
+ @mapToDecoded('eyeType')
+ public eyeType: number;
+
+ /**
+ * Mii eye color ID.
+ */
+ @mapToDecoded('eyeColor')
+ public eyeColor: number;
+
+ /**
+ * Mii eye scale.
+ */
+ @mapToDecoded('eyeScale')
+ public eyeScale: number;
+
+ /**
+ * Mii eye height.
+ */
+ @mapToDecoded('eyeVerticalStretch')
+ public eyeAspect: number;
+
+ /**
+ * Mii eye rotation amount.
+ */
+ @mapToDecoded('eyeRotation')
+ public eyeRotate: number;
+
+ /**
+ * Mii eye X position.
+ */
+ @mapToDecoded('eyeSpacing')
+ public eyeX: number;
+
+ /**
+ * Mii eye Y position.
+ */
+ @mapToDecoded('eyeYPosition')
+ public eyeY: number;
+
+ /**
+ * Mii eyebrow type ID.
+ */
+ @mapToDecoded('eyebrowType')
+ public eyebrowType: number;
+
+ /**
+ * Mii eyebrow color ID.
+ */
+ @mapToDecoded('eyebrowColor')
+ public eyebrowColor: number;
+
+ /**
+ * Mii eyebrow scale.
+ */
+ @mapToDecoded('eyebrowScale')
+ public eyebrowScale: number;
+
+ /**
+ * Mii eyebrow height.
+ */
+ @mapToDecoded('eyebrowVerticalStretch')
+ public eyebrowAspect: number;
+
+ /**
+ * Mii eyebrow rotation amount.
+ */
+ @mapToDecoded('eyebrowRotation')
+ public eyebrowRotate: number;
+
+ /**
+ * Mii eyebrow X position.
+ */
+ @mapToDecoded('eyebrowSpacing')
+ public eyebrowX: number;
+
+ /**
+ * Mii eyebrow Y position.
+ */
+ @mapToDecoded('eyebrowYPosition')
+ public eyebrowY: number;
+
+ /**
+ * Mii nose type ID.
+ */
+ @mapToDecoded('noseType')
+ public noseType: number;
+
+ /**
+ * Mii nose scale.
+ */
+ @mapToDecoded('noseScale')
+ public noseScale: number;
+
+ /**
+ * Mii nose Y position.
+ */
+ @mapToDecoded('noseYPosition')
+ public noseY: number;
+
+ /**
+ * Mii mouth type ID.
+ */
+ @mapToDecoded('mouthType')
+ public mouthType: number;
+
+ /**
+ * Mii mouth color ID.
+ */
+ @mapToDecoded('mouthColor')
+ public mouthColor: number;
+
+ /**
+ * Mii mouth scale.
+ */
+ @mapToDecoded('mouthScale')
+ public mouthScale: number;
+
+ /**
+ * Mii mouth height.
+ */
+ @mapToDecoded('mouthHorizontalStretch')
+ public mouthAspect: number;
+
+ /**
+ * Mii mouth Y position.
+ */
+ @mapToDecoded('mouthYPosition')
+ public mouthY: number;
+
+ /**
+ * Mii mustache type ID.
+ */
+ @mapToDecoded('mustacheType')
+ public mustacheType: number;
+
+ /**
+ * Mii beard type ID.
+ */
+ @mapToDecoded('beardType')
+ public beardType: number;
+
+ /**
+ * Mii facial hair color ID. Affects both beard and mustache.
+ */
+ @mapToDecoded('facialHairColor')
+ public beardColor: number;
+
+ /**
+ * Mii mustache scale. Despite the name, this does not affect the beard in any way.
+ */
+ @mapToDecoded('mustacheScale')
+ public beardScale: number;
+
+ /**
+ * Mii mustache Y position. Despite the name, this does not affect the beard in any way.
+ */
+ @mapToDecoded('mustacheYPosition')
+ public beardY: number;
+
+ /**
+ * Mii glasses type ID.
+ */
+ @mapToDecoded('glassesType')
+ public glassType: number;
+
+ /**
+ * Mii glasses color ID.
+ */
+ @mapToDecoded('glassesColor')
+ public glassColor: number;
+
+ /**
+ * Mii glasses scale.
+ */
+ @mapToDecoded('glassesScale')
+ public glassScale: number;
+
+ /**
+ * Mii glasses Y position.
+ */
+ @mapToDecoded('glassesYPosition')
+ public glassY: number;
+
+ /**
+ * If set, the Miis mole is visible.
+ */
+ @mapToDecoded('moleEnabled')
+ public moleType: MOLE_TYPE;
+
+ /**
+ * Mii mole scale.
+ */
+ @mapToDecoded('moleScale')
+ public moleScale: number;
+
+ /**
+ * Mii mole X position.
+ */
+ @mapToDecoded('moleXPosition')
+ public moleX: number;
+
+ /**
+ * Mii mole Y position.
+ */
+ @mapToDecoded('moleYPosition')
+ public moleY: number;
+
+ /**
+ * Parses the FFLiMiiDataCore from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public parseFromFile(fdOrPath: number | string): void {
+ this.stream = new FileStream(fdOrPath);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLiMiiDataCore from the provided `buffer`
+ *
+ * @param buffer - FFLiMiiDataCore data buffer
+ */
+ public parseFromBuffer(buffer: Buffer): void {
+ this.stream = new FileStream(buffer);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLiMiiDataCore from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLiMiiDataCore data
+ */
+ public parseFromString(base64: string): void {
+ this.parseFromBuffer(Buffer.from(base64, 'base64'));
+ }
+
+ /**
+ * Parses the FFLiMiiDataCore from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public parseFromFileStream(stream: FileStream): void {
+ this.stream = stream;
+ this.parse();
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataCore` and
+ * parses the FFLiMiiDataCore from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public static fromFile(fdOrPath: number | string): FFLiMiiDataCore {
+ const ffliMiiDataCore = new FFLiMiiDataCore();
+ ffliMiiDataCore.parseFromFile(fdOrPath);
+
+ return ffliMiiDataCore;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataCore` and
+ * parses the FFLiMiiDataCore from the provided `buffer`
+ *
+ * @param buffer - FFLiMiiDataCore data buffer
+ */
+ public static fromBuffer(buffer: Buffer): FFLiMiiDataCore {
+ const ffliMiiDataCore = new FFLiMiiDataCore();
+ ffliMiiDataCore.parseFromBuffer(buffer);
+
+ return ffliMiiDataCore;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataCore` and
+ * parses the FFLiMiiDataCore from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLiMiiDataCore data
+ */
+ public static fromString(base64: string): FFLiMiiDataCore {
+ const ffliMiiDataCore = new FFLiMiiDataCore();
+ ffliMiiDataCore.parseFromString(base64);
+
+ return ffliMiiDataCore;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataCore` and
+ * parses the FFLiMiiDataCore from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public static fromFileStream(stream: FileStream): FFLiMiiDataCore {
+ const ffliMiiDataCore = new FFLiMiiDataCore();
+ ffliMiiDataCore.parseFromFileStream(stream);
+
+ return ffliMiiDataCore;
+ }
+
+ /**
+ * Encodes the FFLiMiiDataCore data into a Buffer
+ *
+ * @returns encoded FFLiMiiDataCore
+ */
+ public bytes(): Buffer {
+ return coreParser.encode(this.decoded);
+ }
+
+ private parse(): void {
+ const size = this.stream.remaining();
+
+ if (size !== 0x48) {
+ throw new Error(`Invalid ${this.constructor.name} size. Expected 72 bytes, got ${size}`);
+ }
+
+ this.decoded = coreParser.parse(this.stream.readBytes(0x48));
+ }
+}
+
+// * Aliases. No functionality differences, just purely for different visual contexts
+
+/**
+ * Alias of `FFLiMiiDataCore`. No functionality differences, just purely for different visual contexts
+ */
+export class CFLiPackedMiiDataCore extends FFLiMiiDataCore {}
+
+/**
+ * Alias of `FFLiMiiDataCore`. No functionality differences, just purely for different visual contexts
+ */
+export class CFLiRFLMiiDataCore extends FFLiMiiDataCore {}
\ No newline at end of file
diff --git a/src/mii/ffl-imii-data-official.ts b/src/mii/ffl-imii-data-official.ts
new file mode 100644
index 0000000..c51b6de
--- /dev/null
+++ b/src/mii/ffl-imii-data-official.ts
@@ -0,0 +1,155 @@
+import { Buffer } from 'node:buffer';
+import FileStream from '@/file-stream';
+import FFLiMiiDataCore from '@/mii/ffl-imii-data-core';
+
+/**
+ * Handles Mii data in the `FFLiMiiDataOfficial` format. Acts as a container for
+ * `FFLiMiiDataCore` with an added creator name. Raw Mii data can be found in
+ * `FFLiMiiDataCore.core`. This is the Mii format used by the 3DS and Wii U
+ */
+export default class FFLiMiiDataOfficial {
+ private stream: FileStream;
+
+ /**
+ * Internal Mii data
+ */
+ public core = new FFLiMiiDataCore();
+
+ /**
+ * UTF-16 creator name
+ */
+ public creatorName: string;
+
+ /**
+ * Parses the FFLiMiiDataOfficial from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public parseFromFile(fdOrPath: number | string): void {
+ this.stream = new FileStream(fdOrPath);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLiMiiDataOfficial from the provided `buffer`
+ *
+ * @param buffer - FFLiMiiDataOfficial data buffer
+ */
+ public parseFromBuffer(buffer: Buffer): void {
+ this.stream = new FileStream(buffer);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLiMiiDataOfficial from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLiMiiDataOfficial data
+ */
+ public parseFromString(base64: string): void {
+ this.parseFromBuffer(Buffer.from(base64, 'base64'));
+ }
+
+ /**
+ * Parses the FFLiMiiDataOfficial from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public parseFromFileStream(stream: FileStream): void {
+ this.stream = stream;
+ this.parse();
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataOfficial` and
+ * parses the FFLiMiiDataOfficial from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public static fromFile(fdOrPath: number | string): FFLiMiiDataOfficial {
+ const ffliMiiDataOfficial = new FFLiMiiDataOfficial();
+ ffliMiiDataOfficial.parseFromFile(fdOrPath);
+
+ return ffliMiiDataOfficial;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataOfficial` and
+ * parses the FFLiMiiDataOfficial from the provided `buffer`
+ *
+ * @param buffer - FFLiMiiDataOfficial data buffer
+ */
+ public static fromBuffer(buffer: Buffer): FFLiMiiDataOfficial {
+ const ffliMiiDataOfficial = new FFLiMiiDataOfficial();
+ ffliMiiDataOfficial.parseFromBuffer(buffer);
+
+ return ffliMiiDataOfficial;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataOfficial` and
+ * parses the FFLiMiiDataOfficial from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLiMiiDataOfficial data
+ */
+ public static fromString(base64: string): FFLiMiiDataOfficial {
+ const ffliMiiDataOfficial = new FFLiMiiDataOfficial();
+ ffliMiiDataOfficial.parseFromString(base64);
+
+ return ffliMiiDataOfficial;
+ }
+
+ /**
+ * Creates a new instance of `FFLiMiiDataOfficial` and
+ * parses the FFLiMiiDataOfficial from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public static fromFileStream(stream: FileStream): FFLiMiiDataOfficial {
+ const ffliMiiDataOfficial = new FFLiMiiDataOfficial();
+ ffliMiiDataOfficial.parseFromFileStream(stream);
+
+ return ffliMiiDataOfficial;
+ }
+
+ /**
+ * Encodes the FFLiMiiDataOfficial data into a Buffer
+ *
+ * @returns encoded FFLiMiiDataOfficial
+ */
+ public bytes(): Buffer {
+ return Buffer.concat([
+ this.core.bytes(),
+ Buffer.from(this.creatorName.padEnd(10, '\x00'), 'utf16le')
+ ]);
+ }
+
+ private parse(): void {
+ const size = this.stream.remaining();
+
+ if (size !== 0x5C) {
+ throw new Error(`Invalid ${this.constructor.name} size. Expected 92 bytes, got ${size}`);
+ }
+
+ const ffliMiiDataCore = this.stream.readBytes(0x48);
+ const creatorName = this.stream.readBytes(0x14).toString('utf16le');
+
+ this.core.parseFromBuffer(ffliMiiDataCore);
+ this.creatorName = creatorName.replace(/\0.*$/, ''); // TODO - This is kinda ugly?
+ }
+}
+
+// * Aliases. No functionality differences, just purely for different visual contexts
+
+/**
+ * Alias of `FFLiMiiDataOfficial`. No functionality differences, just purely for different visual contexts
+ */
+export class CFLiPackedMiiDataOfficial extends FFLiMiiDataOfficial {}
+
+/**
+ * Alias of `FFLiMiiDataOfficial`. No functionality differences, just purely for different visual contexts
+ */
+export class Ver3StoreDataRaw extends FFLiMiiDataOfficial {}
\ No newline at end of file
diff --git a/src/mii/ffl-store-data.ts b/src/mii/ffl-store-data.ts
new file mode 100644
index 0000000..d758c86
--- /dev/null
+++ b/src/mii/ffl-store-data.ts
@@ -0,0 +1,206 @@
+import { Buffer } from 'node:buffer';
+import FileStream from '@/file-stream';
+import FFLiMiiDataOfficial from '@/mii/ffl-imii-data-official';
+
+/**
+ * Handles Mii data in the `FFLStoreData` format. Acts as a container for
+ * `FFLiMiiDataOfficial` with an added checksum. Raw Mii data can be found
+ * in `FFLStoreData.official.core`. This is the Mii format used by the 3DS
+ * and Wii U
+ */
+export default class FFLStoreData {
+ private stream: FileStream;
+
+ /**
+ * Internal Mii data and creator name
+ */
+ public official = new FFLiMiiDataOfficial();
+
+ /**
+ * Unknown. Presumed padding
+ */
+ public padding: Buffer;
+
+ /**
+ * Checksum
+ */
+ public crc: number;
+
+ /**
+ * Parses the FFLStoreData from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public parseFromFile(fdOrPath: number | string): void {
+ this.stream = new FileStream(fdOrPath);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLStoreData from the provided `buffer`
+ *
+ * @param buffer - FFLStoreData data buffer
+ */
+ public parseFromBuffer(buffer: Buffer): void {
+ this.stream = new FileStream(buffer);
+ this.parse();
+ }
+
+ /**
+ * Parses the FFLStoreData from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLStoreData data
+ */
+ public parseFromString(base64: string): void {
+ this.parseFromBuffer(Buffer.from(base64, 'base64'));
+ }
+
+ /**
+ * Parses the FFLStoreData from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public parseFromFileStream(stream: FileStream): void {
+ this.stream = stream;
+ this.parse();
+ }
+
+ /**
+ * Creates a new instance of `FFLStoreData` and
+ * parses the FFLStoreData from the provided `fdOrPath`
+ *
+ * @param fdOrPath - Either an open `fd` or a path to a file on disk
+ */
+ public static fromFile(fdOrPath: number | string): FFLStoreData {
+ const fflStoreData = new FFLStoreData();
+ fflStoreData.parseFromFile(fdOrPath);
+
+ return fflStoreData;
+ }
+
+ /**
+ * Creates a new instance of `FFLStoreData` and
+ * parses the FFLStoreData from the provided `buffer`
+ *
+ * @param buffer - FFLStoreData data buffer
+ */
+ public static fromBuffer(buffer: Buffer): FFLStoreData {
+ const fflStoreData = new FFLStoreData();
+ fflStoreData.parseFromBuffer(buffer);
+
+ return fflStoreData;
+ }
+
+ /**
+ * Creates a new instance of `FFLStoreData` and
+ * parses the FFLStoreData from the provided string
+ *
+ * Calls `parseFromBuffer` internally
+ *
+ * @param base64 - Base64 encoded FFLStoreData data
+ */
+ public static fromString(base64: string): FFLStoreData {
+ const fflStoreData = new FFLStoreData();
+ fflStoreData.parseFromString(base64);
+
+ return fflStoreData;
+ }
+
+ /**
+ * Creates a new instance of `FFLStoreData` and
+ * parses the FFLStoreData from an existing file stream
+ *
+ * @param stream - An existing file stream
+ */
+ public static fromFileStream(stream: FileStream): FFLStoreData {
+ const fflStoreData = new FFLStoreData();
+ fflStoreData.parseFromFileStream(stream);
+
+ return fflStoreData;
+ }
+
+ /**
+ * Encodes the FFLStoreData data into a Buffer
+ *
+ * @returns encoded FFLStoreData
+ */
+ public bytes(): Buffer {
+ const ffliMiiDataOfficial = this.official.bytes();
+ const crcData = Buffer.concat([
+ ffliMiiDataOfficial,
+ this.padding ? this.padding : Buffer.alloc(2)
+ ]);
+ const crc = Buffer.alloc(2);
+
+ crc.writeUInt16BE(this.calculateCRC(crcData));
+
+ return Buffer.concat([
+ crcData,
+ crc
+ ]);
+ }
+
+ private parse(): void {
+ const size = this.stream.remaining();
+
+ if (size !== 0x60) {
+ throw new Error(`Invalid ${this.constructor.name} size. Expected 96 bytes, got ${size}`);
+ }
+
+ const ffliMiiDataOfficial = this.stream.readBytes(0x5C);
+ const padding = this.stream.readBytes(2);
+ const expectedCRC = this.stream.readUInt16BE();
+
+ const crcData = Buffer.concat([
+ ffliMiiDataOfficial,
+ padding
+ ]);
+ const calculatedCRC = this.calculateCRC(crcData);
+
+ if (expectedCRC !== calculatedCRC) {
+ throw new Error(`Invalid ${this.constructor.name} CRC16. Expected ${expectedCRC}, got ${calculatedCRC}`);
+ }
+
+ this.official.parseFromBuffer(ffliMiiDataOfficial);
+ this.padding = padding;
+ this.crc = expectedCRC;
+ }
+
+ private calculateCRC(data: Buffer): number {
+ // * Credit to https://3dbrew.org/wiki/Mii#Checksum
+ let crc = 0x0000;
+
+ for (const byte of data) {
+ for (let bit = 7; bit >= 0; bit--) {
+ const flag = (crc & 0x8000) != 0;
+ crc = ((crc << 1) | ((byte >> bit) & 0x1)) ^ (flag ? 0x1021 : 0);
+ }
+ }
+
+ for (let i = 16; i > 0; i--) {
+ const flag = (crc & 0x8000) != 0;
+ crc = (crc << 1) ^ (flag ? 0x1021 : 0);
+ }
+
+ return crc & 0xFFFF;
+ }
+}
+
+// * Aliases. No functionality differences, just purely for different visual contexts
+
+/**
+ * Alias of `FFLStoreData`. No functionality differences, just purely for different visual contexts
+ */
+export class CFLStoreData extends FFLStoreData {}
+
+/**
+ * Alias of `FFLStoreData`. No functionality differences, just purely for different visual contexts
+ */
+export class CFLiMiiDataPacket extends FFLStoreData {}
+
+/**
+ * Alias of `FFLStoreData`. No functionality differences, just purely for different visual contexts
+ */
+export class Ver3StoreData extends FFLStoreData {}
\ No newline at end of file
diff --git a/src/mii/index.ts b/src/mii/index.ts
new file mode 100644
index 0000000..85555b3
--- /dev/null
+++ b/src/mii/index.ts
@@ -0,0 +1,13 @@
+// * Wii U/3DS Miis
+export { default as FFLStoreData } from '@/mii/ffl-store-data';
+export * from '@/mii/ffl-store-data';
+
+export { default as FFLiMiiDataOfficial } from '@/mii/ffl-imii-data-official';
+export * from '@/mii/ffl-imii-data-official';
+
+export { default as FFLiMiiDataCore } from '@/mii/ffl-imii-data-core';
+export *from '@/mii/ffl-imii-data-core';
+
+// * Mii Studio
+export { default as MiiStudioEncoder } from '@/mii/mii-studio-encoder';
+export * from '@/mii/mii-studio-encoder';
\ No newline at end of file
diff --git a/src/mii/mii-studio-encoder.ts b/src/mii/mii-studio-encoder.ts
new file mode 100644
index 0000000..65d4789
--- /dev/null
+++ b/src/mii/mii-studio-encoder.ts
@@ -0,0 +1,512 @@
+import crypto from 'node:crypto';
+import FFLStoreData from '@/mii/ffl-store-data';
+import FFLiMiiDataOfficial from '@/mii/ffl-imii-data-official';
+import FFLiMiiDataCore from '@/mii/ffl-imii-data-core';
+
+// * Basically just a straight port of https://github.com/PretendoNetwork/mii-js with minor changes
+
+type MiiStudioMiiData = {
+ facialHairColor: number;
+ beardType: number;
+ build: number;
+ eyeVerticalStretch: number;
+ eyeColor: number;
+ eyeRotation: number;
+ eyeScale: number;
+ eyeType: number;
+ eyeSpacing: number;
+ eyeYPosition: number;
+ eyebrowVerticalStretch: number;
+ eyebrowColor: number;
+ eyebrowRotation: number;
+ eyebrowScale: number;
+ eyebrowType: number;
+ eyebrowSpacing: number;
+ eyebrowYPosition: number;
+ skinColor: number;
+ makeupType: number;
+ faceType: number;
+ wrinklesType: number;
+ favoriteColor: number;
+ gender: number;
+ glassesColor: number;
+ glassesScale: number;
+ glassesType: number;
+ glassesYPosition: number;
+ hairColor: number;
+ flipHair: boolean;
+ hairType: number;
+ height: number;
+ moleScale: number;
+ moleType: number;
+ moleXPosition: number;
+ moleYPosition: number;
+ mouthHorizontalStretch: number;
+ mouthColor: number;
+ mouthScale: number;
+ mouthType: number;
+ mouthYPosition: number;
+ mustacheScale: number;
+ mustacheType: number;
+ mustacheYPosition: number;
+ noseScale: number;
+ noseType: number;
+ noseYPosition: number;
+}
+
+type MiiStudioRenderParams = {
+ type?: string;
+ expression?: string;
+ width?: number;
+ bgColor?: string;
+ clothesColor?: string;
+ cameraXRotate?: number;
+ cameraYRotate?: number;
+ cameraZRotate?: number;
+ characterXRotate?: number;
+ characterYRotate?: number;
+ characterZRotate?: number;
+ lightXDirection?: number;
+ lightYDirection?: number;
+ lightZDirection?: number;
+ lightDirectionMode?: string;
+ instanceCount?: number;
+ instanceRotationMode?: string;
+ splitMode?: string;
+ data?: string;
+}
+
+const STUDIO_RENDER_URL_BASE = 'https://studio.mii.nintendo.com/miis/image.png';
+const STUDIO_ASSET_URL_BASE = 'https://mii-studio.akamaized.net/editor/1';
+const STUDIO_ASSET_FILE_TYPE = 'webp';
+
+const STUDIO_RENDER_DEFAULTS = {
+ type: 'face',
+ expression: 'normal',
+ width: 96,
+ bgColor: 'FFFFFF00',
+ clothesColor: 'default',
+ cameraXRotate: 0,
+ cameraYRotate: 0,
+ cameraZRotate: 0,
+ characterXRotate: 0,
+ characterYRotate: 0,
+ characterZRotate: 0,
+ lightXDirection: 0,
+ lightYDirection: 0,
+ lightZDirection: 0,
+ lightDirectionMode: 'none',
+ splitMode: 'none',
+ instanceCount: 1,
+ instanceRotationMode: 'model'
+};
+
+const STUDIO_RENDER_TYPES = [
+ 'face',
+ 'face_only',
+ 'all_body'
+];
+
+const STUDIO_RENDER_EXPRESSIONS = [
+ 'normal',
+ 'smile',
+ 'anger',
+ 'sorrow',
+ 'surprise',
+ 'blink',
+ 'normal_open_mouth',
+ 'smile_open_mouth',
+ 'anger_open_mouth',
+ 'surprise_open_mouth',
+ 'sorrow_open_mouth',
+ 'blink_open_mouth',
+ 'wink_left',
+ 'wink_right',
+ 'wink_left_open_mouth',
+ 'wink_right_open_mouth',
+ 'like_wink_left',
+ 'like_wink_right',
+ 'frustrated'
+];
+
+const STUDIO_RENDER_CLOTHES_COLORS = [
+ 'default',
+ 'red',
+ 'orange',
+ 'yellow',
+ 'yellowgreen',
+ 'green',
+ 'blue',
+ 'skyblue',
+ 'pink',
+ 'purple',
+ 'brown',
+ 'white',
+ 'black'
+];
+
+const STUDIO_RENDER_LIGHT_DIRECTION_MODES = [
+ 'none',
+ 'zerox',
+ 'flipx',
+ 'camera',
+ 'offset',
+ 'set'
+];
+
+const STUDIO_SPLIT_MODES = [
+ 'none', // * Not actually valid, returns 400
+ 'front',
+ 'back',
+ 'both'
+];
+
+const STUDIO_RENDER_INSTANCE_ROTATION_MODES = [
+ 'model',
+ 'camera',
+ 'both'
+];
+
+const STUDIO_BG_COLOR_REGEX = /^[0-9A-F]{8}$/; // * Mii Studio does not allow lowercase
+
+/**
+ * Helper class to convert raw Mii data into the format used by Mii Studio,
+ * as well as for creating URLs for rendering whole Miis or specific Mii parts.
+*/
+export default class MiiStudioEncoder {
+ private data?: MiiStudioMiiData;
+
+ constructor(data?: MiiStudioMiiData) {
+ if (data) {
+ this.data = data;
+ }
+ }
+
+ public createURLFromFFL(ffl: FFLStoreData | FFLiMiiDataOfficial | FFLiMiiDataCore, renderParams?: MiiStudioRenderParams): string {
+ const coreData = ffl instanceof FFLStoreData ? ffl.official.core : ffl instanceof FFLiMiiDataOfficial ? ffl.core : ffl;
+ const miiStudioData = {
+ facialHairColor: coreData.beardColor === 0 ? 8 : coreData.beardColor,
+ beardType: coreData.beardType,
+ build: coreData.build,
+ eyeVerticalStretch: coreData.eyeAspect,
+ eyeColor: coreData.eyeColor + 8,
+ eyeRotation: coreData.eyeRotate,
+ eyeScale: coreData.eyeScale,
+ eyeType: coreData.eyeType,
+ eyeSpacing: coreData.eyeX,
+ eyeYPosition: coreData.eyeY,
+ eyebrowVerticalStretch: coreData.eyebrowAspect,
+ eyebrowColor: coreData.eyebrowColor === 0 ? 8 : coreData.eyebrowColor,
+ eyebrowRotation: coreData.eyebrowRotate,
+ eyebrowScale: coreData.eyebrowScale,
+ eyebrowType: coreData.eyebrowType,
+ eyebrowSpacing: coreData.eyebrowX,
+ eyebrowYPosition: coreData.eyebrowY,
+ skinColor: coreData.faceColor,
+ makeupType: coreData.faceMake,
+ faceType: coreData.faceType,
+ wrinklesType: coreData.faceTex,
+ favoriteColor: coreData.favoriteColor,
+ gender: coreData.gender,
+ glassesColor: coreData.glassColor === 0 ? 8 : coreData.glassColor < 6 ? coreData.glassColor + 13 : 0,
+ glassesScale: coreData.glassScale,
+ glassesType: coreData.glassType,
+ glassesYPosition: coreData.glassY,
+ hairColor: coreData.hairColor === 0 ? 8 : coreData.hairColor,
+ flipHair: coreData.hairFlip,
+ hairType: coreData.hairType,
+ height: coreData.height,
+ moleScale: coreData.moleScale,
+ moleType: coreData.moleType,
+ moleXPosition: coreData.moleX,
+ moleYPosition: coreData.moleY,
+ mouthHorizontalStretch: coreData.mouthAspect,
+ mouthColor: coreData.mouthColor < 4 ? coreData.mouthColor + 19 : 0,
+ mouthScale: coreData.mouthScale,
+ mouthType: coreData.mouthType,
+ mouthYPosition: coreData.mouthY,
+ mustacheScale: coreData.beardScale,
+ mustacheType: coreData.mustacheType,
+ mustacheYPosition: coreData.beardY,
+ noseScale: coreData.noseScale,
+ noseType: coreData.noseType,
+ noseYPosition: coreData.noseY
+ };
+
+ return this.createURL({
+ ...renderParams || STUDIO_RENDER_DEFAULTS,
+ data: this.encodeData(miiStudioData).toString('hex')
+ });
+ }
+
+ public createURL(renderParams: MiiStudioRenderParams): string {
+ const params = {
+ ...STUDIO_RENDER_DEFAULTS,
+ ...renderParams
+ };
+
+ // TODO - Assert and error out instead of setting defaults?
+
+ params.type = STUDIO_RENDER_TYPES.includes(params.type as string) ? params.type : STUDIO_RENDER_DEFAULTS.type;
+ params.expression = STUDIO_RENDER_EXPRESSIONS.includes(params.expression as string) ? params.expression : STUDIO_RENDER_DEFAULTS.expression;
+ params.width = Math.min(params.width, 512);
+ params.bgColor = STUDIO_BG_COLOR_REGEX.test(params.bgColor as string) ? params.bgColor : STUDIO_RENDER_DEFAULTS.bgColor;
+ params.clothesColor = STUDIO_RENDER_CLOTHES_COLORS.includes(params.clothesColor) ? params.clothesColor : STUDIO_RENDER_DEFAULTS.clothesColor;
+ params.cameraXRotate = Math.min(params.cameraXRotate, 359);
+ params.cameraYRotate = Math.min(params.cameraYRotate, 359);
+ params.cameraZRotate = Math.min(params.cameraZRotate, 359);
+ params.characterXRotate = Math.min(params.characterXRotate, 359);
+ params.characterYRotate = Math.min(params.characterYRotate, 359);
+ params.characterZRotate = Math.min(params.characterZRotate, 359);
+ params.lightXDirection = Math.min(params.lightXDirection, 359);
+ params.lightYDirection = Math.min(params.lightYDirection, 359);
+ params.lightZDirection = Math.min(params.lightZDirection, 359);
+ params.lightDirectionMode = STUDIO_RENDER_LIGHT_DIRECTION_MODES.includes(params.lightDirectionMode) ? params.lightDirectionMode : STUDIO_RENDER_DEFAULTS.lightDirectionMode;
+ params.splitMode = STUDIO_SPLIT_MODES.includes(params.splitMode) ? params.splitMode : STUDIO_RENDER_DEFAULTS.splitMode;
+ params.instanceCount = Math.min(params.instanceCount, 1, 16);
+ params.instanceRotationMode = STUDIO_RENDER_INSTANCE_ROTATION_MODES.includes(params.instanceRotationMode) ? params.instanceRotationMode : STUDIO_RENDER_DEFAULTS.instanceRotationMode;
+
+ // * Converts non-string params to strings
+ const query = new URLSearchParams(Object.fromEntries(Object.entries(params).map(([key, value]) => [key, value.toString()])));
+
+ if (params.lightDirectionMode === 'none') {
+ query.delete('lightDirectionMode');
+ query.delete('lightXDirection');
+ query.delete('lightYDirection');
+ query.delete('lightZDirection');
+ }
+
+ if (params.splitMode === 'none') {
+ query.delete('splitMode');
+ }
+
+ return `${STUDIO_RENDER_URL_BASE}?${query.toString()}`;
+ }
+
+ public studioAssetURLBody(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ return this.studioAssetURL(`body/${this.data.gender}/${this.data.favoriteColor}`);
+ }
+
+ public studioAssetURLHead(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ return this.studioAssetURL(
+ `face/${this.data.faceType}/${this.data.wrinklesType}/${this.data.makeupType}/${this.data.skinColor}`
+ );
+ }
+
+ public studioAssetURLFace(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ // * Alias
+ return this.studioAssetURLHead();
+ }
+
+ public studioAssetURLEye(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ return this.studioAssetURL(`eye/${this.data.eyeType}/${this.data.eyeColor + 8}`);
+ }
+
+ public studioAssetURLEyebrow(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let eyebrowColor = this.data.eyebrowColor;
+
+ if (this.data.eyebrowColor === 0) {
+ eyebrowColor = 8;
+ }
+
+ return this.studioAssetURL(`eyebrow/${this.data.eyebrowType}/${eyebrowColor}`);
+ }
+
+ public studioAssetURLNose(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ return this.studioAssetURL(`nose/${this.data.noseType}/${this.data.skinColor}`);
+ }
+
+ public studioAssetURLMouth(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let mouthColor = 0;
+
+ if (this.data.mouthColor < 4) {
+ mouthColor = this.data.mouthColor + 19;
+ }
+
+ return this.studioAssetURL(`mouth/${this.data.mouthType}/${mouthColor}`);
+ }
+
+ public studioAssetURLHair(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let assetPath;
+ let hairColor = this.data.hairColor;
+
+ if (this.data.hairColor == 0) {
+ hairColor = 8;
+ }
+
+ if (this.data.hairType === 34 || this.data.hairType === 57) {
+ // * Types 34 and 57 are hats
+ // * No flip and they use clothes color not hair color
+ assetPath = `hair/${this.data.hairType}/${this.data.faceType}/${this.data.favoriteColor}`;
+ } else {
+ // * Regular hair types
+ assetPath = `${this.data.flipHair ? 'hairflip' : 'hair'}/${this.data.hairType}/${this.data.faceType}/${hairColor}`;
+ }
+
+ return this.studioAssetURL(assetPath);
+ }
+
+ public studioAssetURLBeard(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let facialHairColor = this.data.facialHairColor;
+
+ if (this.data.facialHairColor === 0) {
+ facialHairColor = 8;
+ }
+
+ return this.studioAssetURL(`beard/${this.data.beardType}/${this.data.faceType}/${facialHairColor}`);
+ }
+
+ public studioAssetURLMustache(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let facialHairColor = this.data.facialHairColor;
+
+ if (this.data.facialHairColor === 0) {
+ facialHairColor = 8;
+ }
+
+ return this.studioAssetURL(`mustache/${this.data.mustacheType}/${facialHairColor}`);
+ }
+
+ public studioAssetURLGlasses(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ let glassesColor = 0;
+
+ if (this.data.glassesColor == 0) {
+ glassesColor = 8;
+ } else if (this.data.glassesColor < 6) {
+ glassesColor = this.data.glassesColor + 13;
+ }
+
+ return this.studioAssetURL(`glass/${this.data.glassesType}/${glassesColor}`);
+ }
+
+ public studioAssetURLMole(): string {
+ if (!this.data) {
+ return '';
+ }
+
+ return this.studioAssetURL(`mole/${this.data.moleType}`);
+ }
+
+ public studioAssetURL(assetPath: string): string {
+ if (!this.data) {
+ return '';
+ }
+
+ const assetPathHash = crypto.createHash('md5').update(assetPath).digest('hex');
+ const char0 = assetPathHash[0];
+ const char1 = assetPathHash[1];
+ const char2 = assetPathHash[2];
+ const fileName = assetPathHash.substring(3, 12);
+
+ return `${STUDIO_ASSET_URL_BASE}/${STUDIO_ASSET_FILE_TYPE}/1024/${char0}/${char1}/${char2}/${fileName}.${STUDIO_ASSET_FILE_TYPE}`;
+ }
+
+ private encodeData(data: MiiStudioMiiData): Buffer {
+ const miiStudioData = Buffer.alloc(0x2f);
+ const randomizer = Math.floor(256 * Math.random());
+ let next = randomizer;
+ let pos = 1;
+
+ function encodeMiiPart(partValue: number): void {
+ const encoded = (7 + (partValue ^ next)) % 256;
+ next = encoded;
+
+ miiStudioData.writeUInt8(encoded, pos);
+ pos++;
+ }
+
+ miiStudioData.writeUInt8(randomizer);
+
+ encodeMiiPart(data.facialHairColor);
+ encodeMiiPart(data.beardType);
+ encodeMiiPart(data.build);
+ encodeMiiPart(data.eyeVerticalStretch);
+ encodeMiiPart(data.eyeColor);
+ encodeMiiPart(data.eyeRotation);
+ encodeMiiPart(data.eyeScale);
+ encodeMiiPart(data.eyeType);
+ encodeMiiPart(data.eyeSpacing);
+ encodeMiiPart(data.eyeYPosition);
+ encodeMiiPart(data.eyebrowVerticalStretch);
+ encodeMiiPart(data.eyebrowColor);
+ encodeMiiPart(data.eyebrowRotation);
+ encodeMiiPart(data.eyebrowScale);
+ encodeMiiPart(data.eyebrowType);
+ encodeMiiPart(data.eyebrowSpacing);
+ encodeMiiPart(data.eyebrowYPosition);
+ encodeMiiPart(data.skinColor);
+ encodeMiiPart(data.makeupType);
+ encodeMiiPart(data.faceType);
+ encodeMiiPart(data.wrinklesType);
+ encodeMiiPart(data.favoriteColor);
+ encodeMiiPart(data.gender);
+ encodeMiiPart(data.glassesColor);
+ encodeMiiPart(data.glassesScale);
+ encodeMiiPart(data.glassesType);
+ encodeMiiPart(data.glassesYPosition);
+ encodeMiiPart(data.hairColor);
+ encodeMiiPart(data.flipHair ? 1 : 0);
+ encodeMiiPart(data.hairType);
+ encodeMiiPart(data.height);
+ encodeMiiPart(data.moleScale);
+ encodeMiiPart(data.moleType);
+ encodeMiiPart(data.moleXPosition);
+ encodeMiiPart(data.moleYPosition);
+ encodeMiiPart(data.mouthHorizontalStretch);
+ encodeMiiPart(data.mouthColor);
+ encodeMiiPart(data.mouthScale);
+ encodeMiiPart(data.mouthType);
+ encodeMiiPart(data.mouthYPosition);
+ encodeMiiPart(data.mustacheScale);
+ encodeMiiPart(data.mustacheType);
+ encodeMiiPart(data.mustacheYPosition);
+ encodeMiiPart(data.noseScale);
+ encodeMiiPart(data.noseType);
+ encodeMiiPart(data.noseYPosition);
+
+ return miiStudioData;
+ }
+}
\ No newline at end of file
diff --git a/src/stream.ts b/src/stream.ts
index 0ddf425..d6f47fb 100644
--- a/src/stream.ts
+++ b/src/stream.ts
@@ -1,3 +1,5 @@
+import { Buffer } from 'node:buffer';
+
export default class Stream {
protected buffer: Buffer;
protected offset = 0;
@@ -15,7 +17,7 @@ export default class Stream {
// TODO - This is a hack to support FileStream in the MSBT parser
if (bufferOrStream instanceof Buffer) {
this.buffer = bufferOrStream;
- } else {
+ } else if (bufferOrStream instanceof Stream) {
this.buffer = bufferOrStream.buffer;
}
}
diff --git a/tsconfig.json b/tsconfig.json
index 6594d90..64a0e02 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,6 +2,7 @@
"compilerOptions": {
"strict": true,
"strictPropertyInitialization": false,
+ "skipLibCheck": true,
"sourceMap": true,
"declaration": true,
"resolveJsonModule": true,
diff --git a/tsup.config.ts b/tsup.config.ts
new file mode 100644
index 0000000..e49774c
--- /dev/null
+++ b/tsup.config.ts
@@ -0,0 +1,9 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: ['src/**/*.ts', '!src/types/**'],
+ platform: 'node',
+ clean: true,
+ dts: false,
+ format: ['esm', 'cjs']
+});
\ No newline at end of file