diff --git a/.prettierignore b/.prettierignore index 9d47c6235..8f4f0234b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,6 +5,7 @@ node_modules/ external/bcmaps/ external/builder/fixtures/ external/builder/fixtures_babel/ +external/hellbox/ external/openjpeg/ external/qcms/ external/quickjs/ diff --git a/AGENTS.md b/AGENTS.md index acd7e480f..a1133d030 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -142,7 +142,7 @@ PDF.js uses a Web Worker architecture: Located in `external/`: - **bcmaps**: Binary CMaps for CJK fonts -- **standard_fonts**: Core 14 PDF fonts metrics +- **hellbox**: Font generator for the non-embedded standard fonts (WASM) and its glyph data - **cmapscompress**: Tools for compressing CMaps - **openjpeg**: JPEG2000 decoder (WASM) - **quickjs**: JavaScript engine for sandboxed execution diff --git a/eslint.config.mjs b/eslint.config.mjs index 2b5d17d8d..1ddcc4fb4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -38,6 +38,7 @@ export default [ "external/brotli/", "external/builder/fixtures/", "external/builder/fixtures_babel/", + "external/hellbox/", "external/openjpeg/", "external/qcms/", "external/jbig2/", diff --git a/examples/node/pdf2png/pdf2png.mjs b/examples/node/pdf2png/pdf2png.mjs index ed01834b0..e250f7b1e 100644 --- a/examples/node/pdf2png/pdf2png.mjs +++ b/examples/node/pdf2png/pdf2png.mjs @@ -24,6 +24,9 @@ const CMAP_PACKED = true; const STANDARD_FONT_DATA_URL = "../../../node_modules/pdfjs-dist/standard_fonts/"; +// WASM modules and their JavaScript fallbacks. +const WASM_URL = "../../../node_modules/pdfjs-dist/wasm/"; + // Loading file from file system into typed array. const pdfPath = process.argv[2] || "../../../web/compressed.tracemonkey-pldi-09.pdf"; @@ -35,6 +38,7 @@ const loadingTask = getDocument({ cMapUrl: CMAP_URL, cMapPacked: CMAP_PACKED, standardFontDataUrl: STANDARD_FONT_DATA_URL, + wasmUrl: WASM_URL, }); try { diff --git a/external/hellbox/LICENSE_ARIMO b/external/hellbox/LICENSE_ARIMO new file mode 100644 index 000000000..d2963d749 --- /dev/null +++ b/external/hellbox/LICENSE_ARIMO @@ -0,0 +1,93 @@ +Copyright 2026 The Arimo Project Authors (https://github.com/googlefonts/Arimo) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/external/hellbox/LICENSE_HELLBOX b/external/hellbox/LICENSE_HELLBOX new file mode 100644 index 000000000..a612ad981 --- /dev/null +++ b/external/hellbox/LICENSE_HELLBOX @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/external/hellbox/LICENSE_LIBERATION b/external/hellbox/LICENSE_LIBERATION new file mode 100644 index 000000000..aba73e8a4 --- /dev/null +++ b/external/hellbox/LICENSE_LIBERATION @@ -0,0 +1,102 @@ +Digitized data copyright (c) 2010 Google Corporation + with Reserved Font Arimo, Tinos and Cousine. +Copyright (c) 2012 Red Hat, Inc. + with Reserved Font Name Liberation. + +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + +PREAMBLE The goals of the Open Font License (OFL) are to stimulate +worldwide development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to provide +a free and open framework in which fonts may be shared and improved in +partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. +The fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + + + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. +This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components +as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting ? in part or in whole ? +any of the components of the Original Version, by changing formats or +by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer +or other person who contributed to the Font Software. + + +PERMISSION & CONDITIONS + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components,in + Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, + redistributed and/or sold with any software, provided that each copy + contains the above copyright notice and this license. These can be + included either as stand-alone text files, human-readable headers or + in the appropriate machine-readable metadata fields within text or + binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font + Name(s) unless explicit written permission is granted by the + corresponding Copyright Holder. This restriction only applies to the + primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + Software shall not be used to promote, endorse or advertise any + Modified Version, except to acknowledge the contribution(s) of the + Copyright Holder(s) and the Author(s) or with their explicit written + permission. + +5) The Font Software, modified or unmodified, in part or in whole, must + be distributed entirely under this license, and must not be distributed + under any other license. The requirement for fonts to remain under + this license does not apply to any document created using the Font + Software. + + + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + + + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + diff --git a/external/hellbox/LICENSE_NOTO b/external/hellbox/LICENSE_NOTO new file mode 100644 index 000000000..6718da5d3 --- /dev/null +++ b/external/hellbox/LICENSE_NOTO @@ -0,0 +1,95 @@ +Copyright 2022 Google LLC. All Rights Reserved. +Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic) +Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/external/hellbox/LICENSE_TINOS b/external/hellbox/LICENSE_TINOS new file mode 100644 index 000000000..e91137c77 --- /dev/null +++ b/external/hellbox/LICENSE_TINOS @@ -0,0 +1,93 @@ +Copyright 2026 The Tinos Project Authors (https://github.com/googlefonts/tinos) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/external/hellbox/LICENSE_UNICODE b/external/hellbox/LICENSE_UNICODE new file mode 100644 index 000000000..56da58912 --- /dev/null +++ b/external/hellbox/LICENSE_UNICODE @@ -0,0 +1,39 @@ +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2026 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. diff --git a/external/hellbox/Mono-Bold.hbgd b/external/hellbox/Mono-Bold.hbgd new file mode 100644 index 000000000..1652faa78 Binary files /dev/null and b/external/hellbox/Mono-Bold.hbgd differ diff --git a/external/hellbox/Mono-Regular.hbgd b/external/hellbox/Mono-Regular.hbgd new file mode 100644 index 000000000..666d785fd Binary files /dev/null and b/external/hellbox/Mono-Regular.hbgd differ diff --git a/external/hellbox/NotoSymbols.hbgd b/external/hellbox/NotoSymbols.hbgd new file mode 100644 index 000000000..7e6e7d211 Binary files /dev/null and b/external/hellbox/NotoSymbols.hbgd differ diff --git a/external/hellbox/README.md b/external/hellbox/README.md new file mode 100644 index 000000000..dbf72279f --- /dev/null +++ b/external/hellbox/README.md @@ -0,0 +1,29 @@ +## Build + +Requires Docker. In a [Hellbox](https://github.com/mozilla/hellbox/) checkout, run: + +```bash +node build.js -C +node build.js -co /pdf.js/external/hellbox/ --no-embedded-data --js-fallback +``` + +Copy `rust/data/LICENSE_*` here. Omit `Wingdings.hbgd`, which PDF.js doesn't use. + +## Usage + +`src/core/hellbox.js` generates TrueType substitutes for non-embedded standard +and XFA fonts. Viewer builds put `hellbox_bg.wasm` and +`hellbox_nowasm_fallback.js` in `wasm/`, and glyph data in `standard_fonts/` +(`standardFontDataUrl`). + +Glyph data comes from [Arimo](https://github.com/googlefonts/arimo), +[Tinos](https://github.com/googlefonts/tinos), +[Liberation Mono](https://github.com/liberationfonts/liberation-fonts), +and [Noto](https://notofonts.github.io/) fonts. + +## Licensing + +- Hellbox: MPL-2.0 (`LICENSE_HELLBOX`). +- Font data: SIL Open Font License 1.1 (`LICENSE_ARIMO`, `LICENSE_TINOS`, + `LICENSE_LIBERATION`, `LICENSE_NOTO`). +- `unicode.bin`: Unicode License v3 (`LICENSE_UNICODE`). diff --git a/external/hellbox/Sans-Bold.hbgd b/external/hellbox/Sans-Bold.hbgd new file mode 100644 index 000000000..d3f8dab7f Binary files /dev/null and b/external/hellbox/Sans-Bold.hbgd differ diff --git a/external/hellbox/Sans-Regular.hbgd b/external/hellbox/Sans-Regular.hbgd new file mode 100644 index 000000000..306ca9bbd Binary files /dev/null and b/external/hellbox/Sans-Regular.hbgd differ diff --git a/external/hellbox/Serif-Bold.hbgd b/external/hellbox/Serif-Bold.hbgd new file mode 100644 index 000000000..c33231016 Binary files /dev/null and b/external/hellbox/Serif-Bold.hbgd differ diff --git a/external/hellbox/Serif-BoldItalic.hbgd b/external/hellbox/Serif-BoldItalic.hbgd new file mode 100644 index 000000000..4178a0a13 Binary files /dev/null and b/external/hellbox/Serif-BoldItalic.hbgd differ diff --git a/external/hellbox/Serif-Italic.hbgd b/external/hellbox/Serif-Italic.hbgd new file mode 100644 index 000000000..f7c27dde3 Binary files /dev/null and b/external/hellbox/Serif-Italic.hbgd differ diff --git a/external/hellbox/Serif-Regular.hbgd b/external/hellbox/Serif-Regular.hbgd new file mode 100644 index 000000000..2723882a0 Binary files /dev/null and b/external/hellbox/Serif-Regular.hbgd differ diff --git a/external/hellbox/Symbol.hbgd b/external/hellbox/Symbol.hbgd new file mode 100644 index 000000000..d1eb1da7c Binary files /dev/null and b/external/hellbox/Symbol.hbgd differ diff --git a/external/hellbox/ZapfDingbats.hbgd b/external/hellbox/ZapfDingbats.hbgd new file mode 100644 index 000000000..8ba47bc05 Binary files /dev/null and b/external/hellbox/ZapfDingbats.hbgd differ diff --git a/external/hellbox/hellbox.js b/external/hellbox/hellbox.js new file mode 100644 index 000000000..cea6ed1b8 --- /dev/null +++ b/external/hellbox/hellbox.js @@ -0,0 +1,597 @@ +/* THIS FILE IS GENERATED - DO NOT EDIT */ +/** + * Data files needed for the family and style passed to `generate_font`. + * @param {number} family + * @param {boolean} bold + * @param {boolean} italic + * @param {number} weight + * @param {number} stem_v + * @param {number} italic_angle + * @returns {string[]} + */ +export function font_data_files(family, bold, italic, weight, stem_v, italic_angle) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.font_data_files(retptr, family, bold, italic, weight, stem_v, italic_angle); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v1 = getArrayJsValueFromWasm0(r0, r1); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v1; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * Generates a TrueType font from the requested glyphs (glyph id i + 1 for + * request i). Requests after the first 65534 are ignored. + * + * - `codepoints`: the codepoints of the texts of all the glyphs, one after + * the other (a text is usually a single codepoint, but it can be e.g. a + * ligature "ffi" or a letter followed by combining marks), + * - `lengths`: the number of codepoints of each glyph, + * - `widths`: the advance width of each glyph, in 1/1000 em (PDF glyph space + * units); NaN for the natural width. Can be empty (natural widths). + * - `char_codes`: the code mapped to each glyph in the cmap, 0xFFFFFFFF for + * the first codepoint of its text. Can be empty. + * - `family`: 0 for sans-serif, 1 for serif, 2 for monospace. + * - `bold`, `italic`: the style. + * - `weight` (positive values override `bold`, clamped to 1..=1000), `stem_v` (the + * expected vertical stem width, it has precedence over `weight`), + * `italic_angle` (degrees, negative for a font leaning to the right, -16.33 + * for any negative angle with the serif family, which has an italic style), + * `cap_height` (the glyphs are vertically scaled to match it): 0 or NaN + * when unknown. + * - `ascent` (optional): the ascent as a fraction of the em (between 0 and + * 1), the descent being the rest, without line gap (e.g. for a text layer, + * whose lines are an em high). + * - `kerning` (optional): the kerning of some pairs of glyphs, as triples + * (index of the left glyph, index of the right one, adjustment of the + * advance of the left one in 1/1000 em): at most 10920 pairs, the first + * ones in the order of the glyphs. + * @param {Uint32Array} codepoints + * @param {Uint32Array} lengths + * @param {Float64Array} widths + * @param {Uint32Array} char_codes + * @param {number} family + * @param {boolean} bold + * @param {boolean} italic + * @param {number} weight + * @param {number} stem_v + * @param {number} italic_angle + * @param {number} cap_height + * @param {number | null} [ascent] + * @param {Float64Array | null} [kerning] + * @returns {Uint8Array} + */ +export function generate_font(codepoints, lengths, widths, char_codes, family, bold, italic, weight, stem_v, italic_angle, cap_height, ascent, kerning) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passArray32ToWasm0(codepoints, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArray32ToWasm0(lengths, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + const ptr2 = passArrayF64ToWasm0(widths, wasm.__wbindgen_malloc); + const len2 = WASM_VECTOR_LEN; + const ptr3 = passArray32ToWasm0(char_codes, wasm.__wbindgen_malloc); + const len3 = WASM_VECTOR_LEN; + var ptr4 = isLikeNone(kerning) ? 0 : passArrayF64ToWasm0(kerning, wasm.__wbindgen_malloc); + var len4 = WASM_VECTOR_LEN; + wasm.generate_font(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, family, bold, italic, weight, stem_v, italic_angle, cap_height, !isLikeNone(ascent), isLikeNone(ascent) ? 0 : ascent, ptr4, len4); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v6 = getArrayU8FromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 1, 1); + return v6; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * Generates a standard font of PDF (e.g. "Helvetica-Bold", see + * `StandardFont`) from the requested glyphs (the glyph id of the + * i-th one is i + 1): the arguments are the ones + * of `generate_font`, without the style (it's the one of the standard font). + * @param {Uint32Array} codepoints + * @param {Uint32Array} lengths + * @param {Float64Array} widths + * @param {Uint32Array} char_codes + * @param {string} name + * @param {number | null} [ascent] + * @param {Float64Array | null} [kerning] + * @returns {Uint8Array} + */ +export function generate_standard_font(codepoints, lengths, widths, char_codes, name, ascent, kerning) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passArray32ToWasm0(codepoints, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArray32ToWasm0(lengths, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + const ptr2 = passArrayF64ToWasm0(widths, wasm.__wbindgen_malloc); + const len2 = WASM_VECTOR_LEN; + const ptr3 = passArray32ToWasm0(char_codes, wasm.__wbindgen_malloc); + const len3 = WASM_VECTOR_LEN; + const ptr4 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len4 = WASM_VECTOR_LEN; + var ptr5 = isLikeNone(kerning) ? 0 : passArrayF64ToWasm0(kerning, wasm.__wbindgen_malloc); + var len5 = WASM_VECTOR_LEN; + wasm.generate_standard_font(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(ascent), isLikeNone(ascent) ? 0 : ascent, ptr5, len5); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v7 = getArrayU8FromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 1, 1); + return v7; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * Whether a named data file is embedded or registered. + * @param {string} name + * @returns {boolean} + */ +export function has_data(name) { + const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.has_data(ptr0, len0); + return ret !== 0; +} + +/** + * The indices of the glyphs (same `codepoints` and `lengths` as for + * `generate_font`) which can't be rendered with a family. + * @param {Uint32Array} codepoints + * @param {Uint32Array} lengths + * @param {number} family + * @returns {Uint32Array} + */ +export function missing_glyphs(codepoints, lengths, family) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passArray32ToWasm0(codepoints, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArray32ToWasm0(lengths, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + wasm.missing_glyphs(retptr, ptr0, len0, ptr1, len1, family); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v3 = getArrayU32FromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v3; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * The indices of the glyphs (same `codepoints` and `lengths` as for + * `generate_font`) which can't be rendered with a standard font. + * @param {Uint32Array} codepoints + * @param {Uint32Array} lengths + * @param {string} name + * @returns {Uint32Array} + */ +export function missing_standard_glyphs(codepoints, lengths, name) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passArray32ToWasm0(codepoints, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArray32ToWasm0(lengths, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + const ptr2 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len2 = WASM_VECTOR_LEN; + wasm.missing_standard_glyphs(retptr, ptr0, len0, ptr1, len1, ptr2, len2); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v4 = getArrayU32FromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v4; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * Registers a data file for the module lifetime. Load the files listed by + * `standard_font_data_files` or `font_data_files` before generating a font. + * @param {string} name + * @param {Uint8Array} bytes + */ +export function set_data(name, bytes) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + wasm.set_data(retptr, ptr0, len0, ptr1, len1); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + if (r1) { + throw takeObject(r0); + } + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * The codepoints of the glyph data of a standard font (e.g. to generate a + * font with all its glyphs). + * @param {string} name + * @returns {Uint32Array} + */ +export function standard_font_codepoints(name) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + wasm.standard_font_codepoints(retptr, ptr0, len0); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v2 = getArrayU32FromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v2; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** + * The data files needed by a standard font (see `generate_standard_font`). + * @param {string} name + * @returns {string[]} + */ +export function standard_font_data_files(name) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + wasm.standard_font_data_files(retptr, ptr0, len0); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + if (r3) { + throw takeObject(r2); + } + var v2 = getArrayJsValueFromWasm0(r0, r1); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v2; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} +function __wbg_get_imports() { + const import0 = { + __proto__: null, + __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) { + const ret = Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }, + __wbindgen_generic_0000000000000001: function(arg0, arg1) { + // Cast intrinsic for `Ref(String) -> Externref`. + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }, + }; + return { + __proto__: null, + "./hellbox_bg.js": import0, + }; +} + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +function dropObject(idx) { + if (idx < 1028) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(takeObject(mem.getUint32(i, true))); + } + return result; +} + +function getArrayU32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} + +function getArrayU8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} + +let cachedDataViewMemory0 = null; +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer !== wasm.memory.buffer) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +let cachedFloat64ArrayMemory0 = null; +function getFloat64ArrayMemory0() { + if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.buffer !== wasm.memory.buffer) { + cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer); + } + return cachedFloat64ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + return decodeText(ptr >>> 0, len); +} + +let cachedUint32ArrayMemory0 = null; +function getUint32ArrayMemory0() { + if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.buffer !== wasm.memory.buffer) { + cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32ArrayMemory0; +} + +let cachedUint8ArrayMemory0 = null; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.buffer !== wasm.memory.buffer) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getObject(idx) { return heap[idx]; } + +let heap = new Array(1024).fill(undefined); +heap.push(undefined, null, true, false); + +let heap_next = heap.length; + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function passArray32ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 4, 4) >>> 0; + getUint32ArrayMemory0().set(arg, ptr / 4); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function passArrayF64ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 8, 8) >>> 0; + getFloat64ArrayMemory0().set(arg, ptr / 8); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = cachedTextEncoder.encodeInto(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); +cachedTextDecoder.decode(); +const MAX_SAFARI_DECODE_BYTES = 2146435072; +let numBytesDecoded = 0; +function decodeText(ptr, len) { + numBytesDecoded += len; + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + cachedTextDecoder.decode(); + numBytesDecoded = len; + } + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const cachedTextEncoder = new TextEncoder(); + +if (!('encodeInto' in cachedTextEncoder)) { + cachedTextEncoder.encodeInto = function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; + }; +} + +let WASM_VECTOR_LEN = 0; + +let wasmModule, wasmInstance, wasm; +function __wbg_finalize_init(instance, module) { + wasmInstance = instance; + wasm = instance.exports; + wasmModule = module; + cachedDataViewMemory0 = null; + cachedFloat64ArrayMemory0 = null; + cachedUint32ArrayMemory0 = null; + cachedUint8ArrayMemory0 = null; + return wasm; +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (!module.ok) { + throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`); + } + + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + } catch (e) { + const validResponse = expectedResponseType(module.type); + + if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { throw e; } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + } else { + return instance; + } + } + + function expectedResponseType(type) { + switch (type) { + case 'basic': case 'cors': case 'default': return true; + } + return false; + } +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (module !== undefined) { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + const instance = new WebAssembly.Instance(module, imports); + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (module_or_path !== undefined) { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync, __wbg_init as default }; + +/** + * Initializes the JS fallback using its default export as `instantiate`. + */ +function initJs(instantiate) { + if (wasm !== undefined) return wasm; + return __wbg_finalize_init({ exports: instantiate(__wbg_get_imports()) }, undefined); +} +export { initJs }; diff --git a/external/hellbox/hellbox_bg.wasm b/external/hellbox/hellbox_bg.wasm new file mode 100644 index 000000000..18781e8df Binary files /dev/null and b/external/hellbox/hellbox_bg.wasm differ diff --git a/external/hellbox/hellbox_nowasm_fallback.js b/external/hellbox/hellbox_nowasm_fallback.js new file mode 100644 index 000000000..97c6af5d6 --- /dev/null +++ b/external/hellbox/hellbox_nowasm_fallback.js @@ -0,0 +1,2 @@ +/* THIS FILE IS GENERATED - DO NOT EDIT */ +for(var A,r=new Uint8Array(123),f=25;f>=0;--f)r[48+f]=52+f,r[65+f]=f,r[97+f]=26+f;function i(A,f,i){for(var e,a,n=0,b=f,k=i.length,o=f+(3*k>>2)-("="==i[k-2])-("="==i[k-1]);n>4,b>2),b>2],m=Q[Y+80>>3],Q[s+88>>3]=m>0?m:1e3,Q[s+96>>3]=B[kA+172>>1],Z=B[kA+180>>1],d=B[kA+174>>1],nr=yr(HA=Q[i+8>>3]),OA=Q[Bi(qA=i+16|0,0,70896)+16>>3],n[s+112>>2]=77008,n[s+104>>2]=r,q=o>>>0>=65534?65534:o,n[s+108>>2]=f,e[s+116|0]=1,$A=+(0|(_=(Z||d)<<16>>16)),1!=(0|f)?(n[s+128>>2]=77008,n[s+124>>2]=1,n[s+120>>2]=r,d=0):d=2,e[s+132|0]=d,d=Hi(4,4),n[d>>2]=0,n[s+144>>2]=1,n[s+140>>2]=d,n[s+136>>2]=1,n[s+156>>2]=0,n[s+148>>2]=0,n[s+152>>2]=4,hr(s+80|0,q+1|0,4,28),n[s+168>>2]=0,d=n[s+84>>2],n[s+160>>2]=n[s+80>>2],n[s+164>>2]=d,n[s+772>>2]=0,n[s+752>>2]=0,z=Kr(.5*Q[s+96>>3]),d=(m=E(M(z,0),65535))<4294967295&m>=0?~~m>>>0:0,a[s+776>>1]=z==z?d:0,jr(s+160|0,j=s+752|0),n[s+180>>2]=0,n[s+172>>2]=0,n[s+176>>2]=1,n[s+192>>2]=0,n[s+184>>2]=0,n[s+188>>2]=8,n[s+204>>2]=0,n[s+196>>2]=0,n[s+200>>2]=4,n[s+248>>2]=4,n[s+252>>2]=0,n[s+240>>2]=0,n[s+244>>2]=0,n[s+232>>2]=0,n[s+236>>2]=1,n[s+224>>2]=8,n[s+228>>2]=0,n[s+216>>2]=0,n[s+220>>2]=0,n[s+208>>2]=0,n[s+212>>2]=8,n[s+272>>2]=8,n[s+276>>2]=0,n[s+264>>2]=0,n[s+268>>2]=0,n[s+256>>2]=0,n[s+260>>2]=8,n[s+312>>2]=0,n[s+304>>2]=0,n[s+308>>2]=1,n[s+296>>2]=1,n[s+300>>2]=0,n[s+288>>2]=0,n[s+292>>2]=0,n[s+280>>2]=0,n[s+284>>2]=1,n[s+324>>2]=0,n[s+316>>2]=0,n[s+320>>2]=8,n[s+752>>2]=k,W=g(q,40)+k|0,n[s+756>>2]=W,n[s+764>>2]=s+104,n[s+760>>2]=s+120,N=x=N-32|0,hr(x+8|0,(n[j+4>>2]-n[j>>2]>>>0)/40|0,4,12),n[x+28>>2]=0,d=n[x+12>>2],n[x+20>>2]=n[x+8>>2],n[x+24>>2]=d,N=L=N-16|0,Zi(d=x+20|0,(n[j+4>>2]-n[j>>2]>>>0)/40|0),I=n[d+4>>2],Z=n[d+8>>2],n[L+4>>2]=d+8,ur=L,Br=xe(I,Z),n[ur+8>>2]=Br,n[L+12>>2]=C,N=J=N-32|0,BA=n[(U=L+4|0)+4>>2],h=n[U>>2],(0|(F=n[j>>2]))!=(0|(Z=n[j+4>>2])))for(I=n[j+12>>2],j=n[j+8>>2],d=F+32|0,T=n[U+8>>2]+g(BA,12)|0,BA=(oA=(Z-F>>>0)/40|0)+BA|0;;){U=n[d-4>>2],F=n[d>>2];f:{if(2!=u[j+12|0]&&(V(J+16|0,j,U,F),-1!=n[J+16>>2])){if(Z=n[J+20>>2],n[J>>2]=n[J+16>>2],n[J+4>>2]=Z,Z=n[J+24>>2],n[J+8>>2]=Z,Z)break f}else n[J+8>>2]=0,n[J>>2]=0,n[J+4>>2]=4;V(J+16|0,I,U,F),We(J),n[J+8>>2]=n[J+24>>2],Z=n[J+20>>2],n[J>>2]=n[J+16>>2],n[J+4>>2]=Z}if(Z=n[J+8>>2],n[J+24>>2]=Z,F=n[J+4>>2],U=n[J>>2],n[J+16>>2]=U,n[J+20>>2]=F,n[T+8>>2]=Z,n[T>>2]=U,n[T+4>>2]=F,d=d+40|0,T=T+12|0,!(oA=oA-1|0))break}for(j=f<<2,n[h>>2]=BA,N=J+32|0,N=L+16|0,n[(Z=s+328|0)+8>>2]=n[x+28>>2],d=n[x+24>>2],n[Z>>2]=n[x+20>>2],n[Z+4>>2]=d,N=x+32|0,J=n[s+332>>2],x=n[s+336>>2],L=J+g(x,12)|0,er=s+304|0,ar=s+292|0,TA=s+268|0,xA=s+244|0,oA=s+232|0,YA=s+220|0,Z=0,d=0;(0|Z)!=(0|j);){if(n[s+340>>2]=d,n[s+772>>2]=0,n[s+764>>2]=0,n[s+760>>2]=L,n[s+756>>2]=J,n[s+752>>2]=s+340,gA=s+392|0,N=p=N+-64|0,QA(p+8|0,I=s+752|0),1!=n[p+8>>2])n[gA+8>>2]=0,n[gA>>2]=0,n[gA+4>>2]=4;else{for(U=n[p+12>>2],mr(T=p+32|0,I),hr(p,(h=(h=n[p+32>>2]+1|0)||-1)>>>0<=4?4:h,4,4),F=n[p>>2],h=n[p+4>>2],n[h>>2]=U,n[p+28>>2]=1,n[p+24>>2]=h,n[p+20>>2]=F,n[p+56>>2]=n[I+24>>2],h=n[I+20>>2],n[p+48>>2]=n[I+16>>2],n[p+52>>2]=h,h=n[I+12>>2],n[p+40>>2]=n[I+8>>2],n[p+44>>2]=h,h=n[I+4>>2],n[p+32>>2]=n[I>>2],n[p+36>>2]=h,U=p+20|0,N=eA=N-32|0;QA(eA+8|0,T),1==n[eA+8>>2];)h=n[eA+12>>2],(0|(F=n[U+8>>2]))==n[U>>2]&&(mr(eA+20|0,T),di(U,(I=n[eA+20>>2]+1|0)||-1)),n[n[U+4>>2]+(F<<2)>>2]=h,n[U+8>>2]=F+1;N=eA+32|0,n[gA+8>>2]=n[p+28>>2],I=n[p+24>>2],n[gA>>2]=n[p+20>>2],n[gA+4>>2]=I}N=p- -64|0,(I=n[s+400>>2])&&(ur=O(n[r+Z>>2],n[s+396>>2],I),Br=0,e[0|ur]=Br),d=d+1|0,Z=Z+4|0,ge(s+392|0)}if(!u[i+28|0]){sA=Q[Y+96>>3],DA=Q[Y+88>>3],rA=1;break A}j=n[i+24>>2],U=n[i+20>>2],d=B[kA+172>>1],n[s+760>>2]=0,n[s+752>>2]=0,n[s+756>>2]=8,F=x>>>0>>0?x:q,$=+(d>>>0),K=Q[s+88>>3],S=Q[s+96>>3];f:{for(;;){i:{e:{if((0|(d=y))!=(0|F)){if(y=d+1|0,I=g(d,40)+k|0,1!=n[I>>2]|n[I+4>>2])continue;if(!((rA=Q[I+8>>3])>0))continue;for(d=J+g(d,12)|0,h=(Z=n[d+4>>2])+(n[d+8>>2]<<3)|0,H=0,z=0;;){if((0|Z)==(0|h))break e;if((T=n[Z>>2])>>>0>=f>>>0)break i;if(I=Z+4|0,Z=Z+8|0,(m=$*+((65535&gf(d=n[(T<<2)+r>>2],n[I>>2]))>>>0)/+B[d+172>>1])>0){if(j>>>0<=T>>>0)break f;H+=m,z+=Q[U+(T<<5)>>3]}}}if(d=n[s+760>>2]){if(_A(n[s+756>>2],d),Z=(d=n[s+760>>2])>>>1|0,!d)break r;m=Q[n[s+756>>2]+(Z<<4)>>3]}else m=1;ye(s+752|0),DA=Q[Y+88>>3],z=m!=m?DA:m,m=DA!=DA?z:DA,sA=Q[Y+96>>3],z=(m=mz?z:m;break A}if(t(+(S*rA/K-z)/H),(1048575==(0|(d=(h=0|b(1))-!(I=0|b(0))|0))&-1==(0|(Z=I-1|0))|d>>>0>1048575)&((0|h)<0|(2147483647&h)-1048576>>>0>2145386495))continue;mf(s+752|0,I,h,0);continue}break}Ur(T,f,68660),c()}Ur(T,j,68676),c()}Ur(0,0,70880),c()}Ur(Z,0,68644),c()}d=n[s+328>>2],n[s+372>>2]=0,n[s+364>>2]=0,n[s+368>>2]=0,n[s+360>>2]=L,n[s+356>>2]=d,n[s+352>>2]=J,n[s+348>>2]=J,n[s+344>>2]=W,n[s+340>>2]=k,j=s+784|0,U=s+760|0,gA=s+396|0,G=s+348|0,eA=1&e[Y+130|0];A:for(;;){h=s+316|0;r:{f:{i:{if((0|(T=n[s+340>>2]))!=n[s+344>>2]&&(n[s+340>>2]=T+40,(0|(k=n[s+352>>2]))!=n[s+360>>2]&&(n[s+352>>2]=k+12,-1!=(0|(y=n[k>>2]))))){if(I=(F=n[s+372>>2])+1|0,n[s+372>>2]=I,Z=n[k+4>>2],(d=k=n[k+8>>2])||Kf(s+148|0,F),!n[T+16>>2])break i;d=T+20|0;break f}for(N=Z=N-16|0,n[Z+12>>2]=G,d=n[G+4>>2],k=(n[G+12>>2]-d>>>0)/12|0;k;)k=k-1|0,We(d),d=d+12|0;for($f(Z+12|0),N=Z+16|0,di(I=s+148|0,o>>>0>=(d=o-(k=q)|0)>>>0?d:0),o=k>>>0>>0?o:k,Z=n[I+8>>2],d=n[I+4>>2]+(Z<<2)|0;(0|k)!=(0|o);)n[d>>2]=k,d=d+4|0,Z=Z+1|0,k=k+1|0;n[I+8>>2]=Z,_A(n[s+320>>2],n[s+324>>2]),GA(s+316|0),n[s+760>>2]=n[s+316>>2],k=n[s+320>>2],n[s+756>>2]=k,n[s+752>>2]=k,n[s+764>>2]=k+(n[s+324>>2]<<4),Gr(s+464|0,s+752|0),jA(s+476|0,q),Z=n[s+472>>2]<<3,d=n[s+468>>2];e:{for(;Z;){if((I=(o=n[d+4>>2])-1|0)>>>0>=(k=n[s+484>>2])>>>0)break e;n[n[s+480>>2]+(I<<2)>>2]=o,Z=Z-8|0,d=d+8|0}if(Z=n[Y+120>>2],k=n[Y+124>>2],d=n[s+480>>2],o=n[s+484>>2],n[s+380>>2]=s+88,n[s+376>>2]=s+96,n[s+344>>2]=o,n[s+340>>2]=d,n[s+772>>2]=o,n[s+768>>2]=d,n[s+756>>2]=Z+(k<<4),n[s+752>>2]=Z,n[s+764>>2]=s+340,n[s+760>>2]=s+376,j=s+392|0,N=W=N-48|0,kr(y=W+24|0,U=s+752|0),!n[W+28>>2]&1==n[W+24>>2]){for(I=n[W+32>>2],Z=n[W+36>>2],d=n[W+40>>2],hr(W,4,8,16),o=n[W>>2],k=n[W+4>>2],n[k+8>>2]=d,n[k>>2]=I,n[k+4>>2]=Z,n[W+20>>2]=1,n[W+16>>2]=k,n[W+12>>2]=o,k=n[U+20>>2],n[W+40>>2]=n[U+16>>2],n[W+44>>2]=k,k=n[U+12>>2],n[W+32>>2]=n[U+8>>2],n[W+36>>2]=k,k=n[U+4>>2],n[W+24>>2]=n[U>>2],n[W+28>>2]=k,F=W+12|0,N=h=N-32|0;kr(h+8|0,y),!(1!=n[h+8>>2]|0!=n[h+12>>2]);)Z=n[h+24>>2],k=n[h+16>>2],d=n[h+20>>2],(0|(I=n[F+8>>2]))==n[F>>2]&&(0|(o=n[F+8>>2]))==n[F>>2]&&wf(F,o,1,8,16),o=n[F+4>>2]+(I<<4)|0,n[o+8>>2]=Z,n[o>>2]=k,n[o+4>>2]=d,n[F+8>>2]=I+1;N=h+32|0,n[j+8>>2]=n[W+20>>2],k=n[W+16>>2],n[j>>2]=n[W+12>>2],n[j+4>>2]=k}else n[j+8>>2]=0,n[j>>2]=0,n[j+4>>2]=8;N=W+48|0,_A(n[s+396>>2],n[s+400>>2]),GA(j),o=n[s+400>>2],n[s+760>>2]=n[s+392>>2],k=n[s+396>>2],n[s+756>>2]=k,n[s+752>>2]=k,n[s+764>>2]=k+((o>>>0>=10920?10920:o)<<4),Gr(s+488|0,U),!(1!=n[Y+64>>2]|n[Y+68>>2])&&(m=Q[Y+72>>3])>0&&m<1?(rA=Kr(m*(z=Q[s+96>>3])),m=E(M(rA,-32768),32767),k=w(m)<2147483647?~~m:-2147483648,CA=rA==rA?k:0,z=Kr(rA-z),m=E(M(z,-32768),32767),k=w(m)<2147483647?~~m:-2147483648,tA=z==z?k:0,F=0):(z=Kr(OA*+a[kA+176>>1]),m=E(M(z,-32768),32767),k=w(m)<2147483647?~~m:-2147483648,tA=z==z?k:0,z=Kr(OA*+a[kA+174>>1]),m=E(M(z,-32768),32767),k=w(m)<2147483647?~~m:-2147483648,CA=z==z?k:0,F=B[kA+178>>1]),x=u[kA+199|0],p=B[kA+186>>1],L=B[kA+184>>1],gA=B[kA+172>>1],U=a[kA+182>>1],S=Q[i>>3],n[s+764>>2]=f,n[s+760>>2]=r,r=n[s+140>>2],n[s+756>>2]=r+(n[s+144>>2]<<2),n[s+752>>2]=r,N=h=N-32|0,hr(h+8|0,n[(_=s+752|0)+4>>2]-n[_>>2]>>>2|0,4,4),n[h+28>>2]=0,r=n[h+12>>2],n[h+20>>2]=n[h+8>>2],n[h+24>>2]=r,N=y=N-16|0,di(r=h+20|0,n[_+4>>2]-n[_>>2]>>>2|0),i=n[r+4>>2],f=n[r+8>>2],n[y+4>>2]=r+8,ur=y,Br=xe(i,f),n[ur+8>>2]=Br,n[y+12>>2]=C,i=n[(d=y+4|0)+4>>2],k=n[d>>2];a:{n:{if((0|(o=n[_>>2]))!=(0|(f=n[_+4>>2])))for(Z=n[_+12>>2],r=n[_+8>>2],d=n[d+8>>2]+(i<<2)|0,I=f-o>>>2|0;;){if((f=n[o>>2])>>>0>=Z>>>0)break n;if(n[d>>2]=n[r+(f<<2)>>2],o=o+4|0,d=d+4|0,i=i+1|0,!(I=I-1|0))break}n[k>>2]=i;break a}Ur(f,Z,69264),c()}for(N=y+16|0,n[(f=s+500|0)+8>>2]=n[h+28>>2],r=n[h+24>>2],n[f>>2]=n[h+20>>2],n[f+4>>2]=r,N=h+32|0,n[s+760>>2]=255,r=(f=n[Y+112>>2])?n[Y+108>>2]:70912,n[s+752>>2]=r,n[s+756>>2]=r+(f||17),Gf(s+512|0,_),f=n[s+504>>2],r=n[s+508>>2],j=n[s+516>>2],h=n[s+520>>2],n[s+696>>2]=h,n[s+692>>2]=j,n[s+680>>2]=f,n[s+684>>2]=r,r=0!=HA,y=(eA=S>=600)?r?11:4:r?6:7,n[s+708>>2]=y,Z=eA?r?70997:70993:r?70987:70980,n[s+704>>2]=Z,n[s+764>>2]=1,n[s+756>>2]=1,d=s+704|0,n[s+760>>2]=d,Y=s+692|0,n[s+752>>2]=Y,si(P=s+392|0,65541,_),r=(f=n[s+396>>2])+n[s+400>>2]|0,N=T=N-16|0,n[T+12>>2]=0,n[T+4>>2]=0,n[T+8>>2]=1,N=q=N-16|0,Ui(o=T+4|0,0),n[q+12>>2]=r,n[q+8>>2]=f;-1!=(0|(W=zf(q+8|0)));)if(!(W-33>>>0>93)){for(r=0,i=g(255&W,16843009);-2139062144==((I=16843008-(f=n[(k=r+69280|0)>>2]^i)|f)&(16843008-(f=n[k+4>>2]^i)|f)&-2139062144)&&(r=r+8|0)>>>0<=2;);a:{if(10!=(0|r))for(i=255&W,I=1;;){if(u[r+69280|0]==(0|i)){i=r;break a}if(10==(0|(r=r+1|0)))break}I=0}n[q+4>>2]=i,n[q>>2]=I,1!=n[q>>2]&&Zr(o,W)}if(N=q+16|0,n[(I=s+716|0)+8>>2]=n[T+12>>2],r=n[T+8>>2],n[I>>2]=n[T+4>>2],n[I+4>>2]=r,N=T+16|0,le(P),n[s+668>>2]=s+680,yA(_,r=s+668|0,3),R(s+728|0,n[s+756>>2],n[s+760>>2],71008,1),We(_),yA(_,r,4),R(o=s+740|0,n[s+756>>2],n[s+760>>2],71009,2),rA=Kr(OA*$A),z=Kr(OA*+(0|U)),We(_),n[s+684>>2]){if(m=E(M(rA,-32768),32767),r=w(m)<2147483647?~~m:-2147483648,T=rA==rA?r:0,m=E(M(z,-32768),32767),r=w(m)<2147483647?~~m:-2147483648,J=z==z?r:0,r=(m=E(M(S,0),65535))<4294967295&m>=0?~~m>>>0:0,q=S==S?r:0,f=n[s+732>>2],r=n[s+728>>2],a[s+554>>1]=r,a[s+556>>1]=r>>>16,a[s+558>>1]=f,a[s+560>>1]=f>>>16,r=n[s+736>>2],a[s+562>>1]=r,a[s+564>>1]=r>>>16,i=n[n[s+680>>2]>>2],vr(_,j,h),r=n[s+760>>2],a[s+578>>1]=r,a[s+580>>1]=r>>>16,f=n[s+756>>2],r=n[s+752>>2],a[s+570>>1]=r,a[s+572>>1]=r>>>16,a[s+574>>1]=f,a[s+576>>1]=f>>>16,vr(_,Z,y),r=n[s+760>>2],a[s+594>>1]=r,a[s+596>>1]=r>>>16,f=n[s+756>>2],r=n[s+752>>2],a[s+586>>1]=r,a[s+588>>1]=r>>>16,a[s+590>>1]=f,a[s+592>>1]=f>>>16,n[s+764>>2]=2,n[s+756>>2]=2,n[s+760>>2]=o,n[s+752>>2]=I,si(P,65536,_),f=n[s+396>>2],r=n[s+392>>2],a[s+602>>1]=r,a[s+604>>1]=r>>>16,a[s+606>>1]=f,a[s+608>>1]=f>>>16,r=n[s+400>>2],a[s+610>>1]=r,a[s+612>>1]=r>>>16,n[s+764>>2]=1,n[s+756>>2]=1,n[s+760>>2]=d,n[s+752>>2]=Y,si(P,65948,_),f=n[s+396>>2],r=n[s+392>>2],a[s+618>>1]=r,a[s+620>>1]=r>>>16,a[s+622>>1]=f,a[s+624>>1]=f>>>16,r=n[s+400>>2],a[s+626>>1]=r,a[s+628>>1]=r>>>16,vr(_,71028,11),r=n[s+760>>2],a[s+642>>1]=r,a[s+644>>1]=r>>>16,f=n[s+756>>2],r=n[s+752>>2],a[s+634>>1]=r,a[s+636>>1]=r>>>16,a[s+638>>1]=f,a[s+640>>1]=f>>>16,n[s+760>>2]=63,r=n[s+720>>2],n[s+756>>2]=r+n[s+724>>2],n[s+752>>2]=r,Gf(P,_),f=n[s+396>>2],r=n[s+392>>2],a[s+650>>1]=r,a[s+652>>1]=r>>>16,a[s+654>>1]=f,a[s+656>>1]=f>>>16,r=n[s+400>>2],a[s+658>>1]=r,a[s+660>>1]=r>>>16,n[s+396>>2]=2,n[s+392>>2]=o,si(_,67239,P),f=n[s+756>>2],r=n[s+752>>2],a[s+378>>1]=r,a[s+380>>1]=r>>>16,a[s+382>>1]=f,a[s+384>>1]=f>>>16,r=n[s+760>>2],a[s+386>>1]=r,a[s+388>>1]=r>>>16,Ir(_,i+36|0),r=n[s+760>>2],a[s+350>>1]=r,a[s+352>>1]=r>>>16,f=n[s+756>>2],r=n[s+752>>2],a[s+342>>1]=r,a[s+344>>1]=r>>>16,a[s+346>>1]=f,a[s+348>>1]=f>>>16,Ir(_,i+48|0),r=n[s+760>>2],a[s+402>>1]=r,a[s+404>>1]=r>>>16,f=n[s+756>>2],r=n[s+752>>2],a[s+394>>1]=r,a[s+396>>1]=r>>>16,a[s+398>>1]=f,a[s+400>>1]=f>>>16,a[s+760>>1]=0,n[s+752>>2]=0,n[s+756>>2]=10,f=B[s+556>>1]|B[s+558>>1]<<16,r=B[s+552>>1]|B[s+554>>1]<<16,a[s+762>>1]=r,a[s+764>>1]=r>>>16,a[s+766>>1]=f,a[s+768>>1]=f>>>16,f=B[s+562>>1]|B[s+564>>1]<<16,r=B[s+558>>1]|B[s+560>>1]<<16,a[s+768>>1]=r,a[s+770>>1]=r>>>16,a[s+772>>1]=f,a[s+774>>1]=f>>>16,a[s+776>>1]=1,f=B[s+572>>1]|B[s+574>>1]<<16,r=B[s+568>>1]|B[s+570>>1]<<16,a[s+778>>1]=r,a[s+780>>1]=r>>>16,a[s+782>>1]=f,a[s+784>>1]=f>>>16,f=B[s+578>>1]|B[s+580>>1]<<16,r=B[s+574>>1]|B[s+576>>1]<<16,a[s+784>>1]=r,a[s+786>>1]=r>>>16,a[s+788>>1]=f,a[s+790>>1]=f>>>16,a[s+792>>1]=2,a[s+808>>1]=3,f=B[s+588>>1]|B[s+590>>1]<<16,r=B[s+584>>1]|B[s+586>>1]<<16,a[s+794>>1]=r,a[s+796>>1]=r>>>16,a[s+798>>1]=f,a[s+800>>1]=f>>>16,f=B[s+594>>1]|B[s+596>>1]<<16,r=B[s+590>>1]|B[s+592>>1]<<16,a[s+800>>1]=r,a[s+802>>1]=r>>>16,a[s+804>>1]=f,a[s+806>>1]=f>>>16,f=B[s+610>>1]|B[s+612>>1]<<16,r=B[s+606>>1]|B[s+608>>1]<<16,a[s+816>>1]=r,a[s+818>>1]=r>>>16,a[s+820>>1]=f,a[s+822>>1]=f>>>16,f=B[s+604>>1]|B[s+606>>1]<<16,r=B[s+600>>1]|B[s+602>>1]<<16,a[s+810>>1]=r,a[s+812>>1]=r>>>16,a[s+814>>1]=f,a[s+816>>1]=f>>>16,a[s+824>>1]=4,f=B[s+626>>1]|B[s+628>>1]<<16,r=B[s+622>>1]|B[s+624>>1]<<16,a[s+832>>1]=r,a[s+834>>1]=r>>>16,a[s+836>>1]=f,a[s+838>>1]=f>>>16,f=B[s+620>>1]|B[s+622>>1]<<16,r=B[s+616>>1]|B[s+618>>1]<<16,a[s+826>>1]=r,a[s+828>>1]=r>>>16,a[s+830>>1]=f,a[s+832>>1]=f>>>16,a[s+840>>1]=5,f=B[s+642>>1]|B[s+644>>1]<<16,r=B[s+638>>1]|B[s+640>>1]<<16,a[s+848>>1]=r,a[s+850>>1]=r>>>16,a[s+852>>1]=f,a[s+854>>1]=f>>>16,f=B[s+636>>1]|B[s+638>>1]<<16,r=B[s+632>>1]|B[s+634>>1]<<16,a[s+842>>1]=r,a[s+844>>1]=r>>>16,a[s+846>>1]=f,a[s+848>>1]=f>>>16,a[s+856>>1]=6,f=B[s+658>>1]|B[s+660>>1]<<16,r=B[s+654>>1]|B[s+656>>1]<<16,a[s+864>>1]=r,a[s+866>>1]=r>>>16,a[s+868>>1]=f,a[s+870>>1]=f>>>16,f=B[s+652>>1]|B[s+654>>1]<<16,r=B[s+648>>1]|B[s+650>>1]<<16,a[s+858>>1]=r,a[s+860>>1]=r>>>16,a[s+862>>1]=f,a[s+864>>1]=f>>>16,a[s+872>>1]=10,f=B[s+386>>1]|B[s+388>>1]<<16,r=B[s+382>>1]|B[s+384>>1]<<16,a[s+880>>1]=r,a[s+882>>1]=r>>>16,a[s+884>>1]=f,a[s+886>>1]=f>>>16,f=B[s+380>>1]|B[s+382>>1]<<16,r=B[s+376>>1]|B[s+378>>1]<<16,a[s+874>>1]=r,a[s+876>>1]=r>>>16,a[s+878>>1]=f,a[s+880>>1]=f>>>16,a[s+888>>1]=13,f=B[s+350>>1]|B[s+352>>1]<<16,r=B[s+346>>1]|B[s+348>>1]<<16,a[s+896>>1]=r,a[s+898>>1]=r>>>16,a[s+900>>1]=f,a[s+902>>1]=f>>>16,f=B[s+344>>1]|B[s+346>>1]<<16,r=B[s+340>>1]|B[s+342>>1]<<16,a[s+890>>1]=r,a[s+892>>1]=r>>>16,a[s+894>>1]=f,a[s+896>>1]=f>>>16,a[s+904>>1]=14,f=B[s+402>>1]|B[s+404>>1]<<16,r=B[s+398>>1]|B[s+400>>1]<<16,a[s+912>>1]=r,a[s+914>>1]=r>>>16,a[s+916>>1]=f,a[s+918>>1]=f>>>16,f=B[s+396>>1]|B[s+398>>1]<<16,r=B[s+392>>1]|B[s+394>>1]<<16,a[s+906>>1]=r,a[s+908>>1]=r>>>16,a[s+910>>1]=f,a[s+912>>1]=f>>>16,d=s+524|0,N=y=N-208|0,dA(y+24|0,_),-1==n[y+28>>2])n[d+8>>2]=0,n[d>>2]=0,n[d+4>>2]=4,qi(_);else{for(hr(y,4,4,16),i=n[y>>2],f=n[y+28>>2],r=n[y+4>>2],n[r>>2]=n[y+24>>2],n[r+4>>2]=f,f=n[y+36>>2],n[r+8>>2]=n[y+32>>2],n[r+12>>2]=f,n[y+20>>2]=1,n[y+16>>2]=r,n[y+12>>2]=i,Je(k=y+40|0,_,168),Y=y+12|0,N=Z=N-16|0;dA(Z,k),-1!=n[Z+4>>2];)(0|(i=n[Y+8>>2]))==n[Y>>2]&&Ni(Y,1),r=n[Z+12>>2],f=n[Y+4>>2]+(i<<4)|0,n[f+8>>2]=n[Z+8>>2],n[f+12>>2]=r,r=n[Z+4>>2],n[f>>2]=n[Z>>2],n[f+4>>2]=r,n[Y+8>>2]=i+1;qi(k),N=Z+16|0,n[d+8>>2]=n[y+20>>2],r=n[y+16>>2],n[d>>2]=n[y+12>>2],n[d+4>>2]=r}for(N=y+208|0,le(o),le(I),Z=n[s+164>>2],_=n[s+168>>2],n[s+544>>2]=n[s+180>>2],r=n[s+176>>2],n[s+536>>2]=n[s+172>>2],n[s+540>>2]=r,W=n[s+532>>2],i=n[s+528>>2],fA=n[s+496>>2],EA=n[s+492>>2],Y=n[s+472>>2],I=n[s+468>>2],n[s+676>>2]=0,n[s+668>>2]=0,n[s+672>>2]=1,n[s+688>>2]=0,n[s+680>>2]=0,n[s+684>>2]=1,j=g(_,28)+Z|0,ZA=32767,IA=32768,h=0,r=0,oA=0,MA=0,y=0,hA=32767,k=32768,d=32768,o=32767,P=32767;;){a:{if((0|Z)!=(0|j)){if(YA=B[Z+24>>1],Qf(s+668|0,n[Z+20>>2]),Rf(U=s+680|0,YA),y=(f=65535&y)>>>0>>0?YA:f,r=r+YA|0,h=!!(0|YA)+h|0,!n[Z>>2])break a;Rf(f=U,U=a[Z+12>>1]),hA=(0|(f=hA<<16>>16))>(0|U)?U:f,P=(0|(f=P<<16>>16))>(0|U)?U:f,oA=(f=n[Z+8>>2])>>>0>oA>>>0?f:oA,MA=(f=n[Z+4>>2])>>>0>MA>>>0?f:MA,IA=(0|(f=IA<<16>>16))<(0|(wA=a[Z+16>>1]))?wA:f,k=(0|(f=k<<16>>16))<(0|(U=a[Z+18>>1]))?U:f,d=(0|(f=d<<16>>16))<(0|wA)?wA:f,o=(0|(f=o<<16>>16))>(0|(U=a[Z+14>>1]))?U:f,ZA=(0|(f=ZA<<16>>16))>(0|(U=YA-wA<<16>>16))?U:f,Z=Z+28|0;continue}for(Qf(s+668|0,n[s+544>>2]),n[s+544>>2]||ae(s+536|0,1),P<<16>>16>d<<16>>16&&(IA=0,ZA=0,hA=0,d=0,o=0,P=0,k=0),z=+(gA>>>0),n[s+700>>2]=0,n[s+692>>2]=0,n[s+696>>2]=1,Rf(f=s+692|0,1),Rf(f,0),Qf(f,65536),Qf(f,0),Qf(f,1594834165),Rf(f,3),Rf(f,gA),Z=2;Z;)Qf(f=s+692|0,0),Qf(f,-508055296),Z=Z-1|0;for(Rf(Z=s+692|0,P),Rf(Z,o),Rf(Z,d),Rf(Z,k),H=0,Rf(Z,eA|((f=0!=HA)?2:0)),Rf(Z,8),Rf(Z,2),Rf(Z,1),Rf(Z,0),n[s+712>>2]=0,n[s+704>>2]=0,n[s+708>>2]=1,Rf(d=s+704|0,1),Rf(d,0),Rf(d,CA),Rf(d,tA),Rf(d,F),Rf(d,y),Rf(d,hA),Rf(d,ZA),Rf(d,IA),f?(Ji(s+704|0,z),H=nr*z):Rf(d,1),Ji(f=s+704|0,H),Z=0,Rf(f,0),ae(f,8),Rf(f,0),Rf(f,_),n[s+724>>2]=0,n[s+716>>2]=0,n[s+720>>2]=1,Qf(f=s+716|0,65536),Rf(f,_),Rf(f,MA),Rf(f,oA),Rf(f,0),Rf(f,0),Rf(f,2),ae(f,16),n[s+736>>2]=0,n[s+728>>2]=0,n[s+732>>2]=1,Rf(f=s+728|0,4),Ji(f,(0|h)<=0?0:+(r>>>0)/+(h>>>0)),Rf(f,q),Rf(f,5),Rf(f,0),n[s+816>>2]=1717986918,n[s+820>>2]=1071015526,n[s+808>>2]=0,n[s+812>>2]=0,n[s+800>>2]=858993459,n[s+804>>2]=1071854387,n[s+792>>2]=-858993459,n[s+796>>2]=1071959244,n[s+784>>2]=858993459,n[s+788>>2]=1068708659,n[s+776>>2]=0,n[s+780>>2]=0,n[s+768>>2]=858993459,n[s+772>>2]=1071854387,n[s+760>>2]=-858993459,n[s+764>>2]=1071959244,n[s+756>>2]=8,r=s+760|0;64!=(0|Z);)Ji(s+728|0,Q[r+Z>>3]*z),Z=Z+8|0;if(Ji(r=s+728|0,p?+(p<<16>>16):z/20),Ji(r,0!=(m=.5*+(J<<16>>16))?m:.25*z),Rf(r,0),ae(r,10),ae(r,16),Mf(r,71104,4),f=r,r=S>=600,Rf(f,0!=HA?r?161:129:r?160:192),Z=0,d=0,Y){if(Z=f=n[I>>2],h=r=I+8|0,(0|(d=U=(Y<<3)+I|0))!=(0|r))for(d=d-r>>>3|0;Z=Z>>>0<(y=n[h>>2])>>>0?Z:y,h=h+8|0,d=d-1|0;);if(d=Z>>>0>=65535?65535:Z,(0|r)!=(0|U))for(Z=U-r>>>3|0;f=f>>>0>(y=n[r>>2])>>>0?f:y,r=r+8|0,Z=Z-1|0;);Z=f>>>0>=65535?65535:f}if(Rf(y=s+728|0,d),Rf(y,Z),Rf(y,CA),Rf(y,tA),Rf(y,F),Rf(y,(0|(r=(0|(r=CA<<16>>16))<(0|(f=k<<16>>16))?f:r))>0?r:0),Rf(y,(0|(r=0-((0|(r=tA<<16>>16))>(0|(f=o<<16>>16))?f:r)|0))>0?r:0),Qf(y,1),Qf(y,0),Rf(y,J),Rf(y,T),Rf(y,0),Rf(y,32),Rf(y,0),n[s+748>>2]=0,n[s+740>>2]=0,n[s+744>>2]=1,Qf(r=s+740|0,196608),m=Kr(65536*HA),Qf(r,f=w(m)<2147483647?~~m:-2147483648),Rf(r,L),Rf(r,p),Qf(r,x),ae(r,16),n[s+560>>2]=n[s+736>>2],r=n[s+732>>2],n[s+552>>2]=n[s+728>>2],n[s+556>>2]=r,f=0,r=k=Y){for(;r>>>0>=2;)d=f,f=v[((f=(o=r>>>1|0)+f|0)<<3)+I>>2]>1114111?d:f,r=r-o|0;f=(v[(f<<3)+I>>2]<1114112)+f|0}if(r=f,f>>>0<=k>>>0)for(n[s+760>>2]=0,n[s+752>>2]=0,n[s+756>>2]=4,h=f<<3;;){n:{b:{if(h){if(Z=n[s+760>>2],d=g(Z,12),r=n[s+756>>2],Y=n[I+4>>2],y=n[I>>2],!Z)break b;if(!(k=(o=r+d|0)-12|0))break b;if((0|y)!=(n[(f=o-8|0)>>2]+1|0)|(0|Y)!=((y+n[o-4>>2]|0)-n[k>>2]|0))break b;n[f>>2]=y;break n}for(r=n[s+760>>2],n[s+656>>2]=r,f=n[s+756>>2],n[s+648>>2]=n[s+752>>2],n[s+652>>2]=f,o=0,n[s+384>>2]=0,n[s+376>>2]=0,n[s+380>>2]=8,F=(Z=n[s+652>>2])+(h=g(r,12))|0,y=8,I=0,d=Z;;){if(h&&!((j=n[d>>2])>>>0>=65535)){if(8188!=(0|I)){Y=(f=n[d+4>>2])>>>0>=65534?65534:f,f=(k=n[d+8>>2])-j|0,k=0-(k>>>0>>0)|0,n[s+376>>2]==(0|I)&&of(s+376|0),d=d+12|0,U=n[s+380>>2]+y|0,n[U>>2]=f,n[U+4>>2]=k,n[U-4>>2]=Y,n[U-8>>2]=j,I=I+1|0,n[s+384>>2]=I,h=h-12|0,y=y+16|0;continue}o=1}break}for(j=Hi(4,12),d=n[s+380>>2],U=n[s+384>>2],n[s+400>>2]=0,n[s+392>>2]=0,n[s+396>>2]=1,Rf(f=s+392|0,4),Rf(f,16+((Y=U+1|0)<<3)|0),Rf(f,0),Rf(f,k=Y<<1),n[s+752>>2]=0,n[s+756>>2]=3,f=15^l(((f=65535&Y)>>>0<=1?1:f)<<16),a[s+762>>1]=f,f=2<>1]=f,a[s+764>>1]=k-f;$r(s+32|0,s+752|0),1&a[s+32>>1];)Rf(s+392|0,B[s+34>>1]);for(I=U<<4,h=d;I;)Rf(s+392|0,n[h+4>>2]),I=I-16|0,h=h+16|0;for(Rf(s+392|0,65535),I=U<<4,y=0,h=d;;)if(Rf(s+392|0,y),I)I=I-16|0,y=n[h>>2],h=h+16|0;else{for(I=U<<4,h=65535;Rf(s+392|0,h),I;)I=I-16|0,h=B[d+8>>1],d=d+16|0;if(Rf(f=s+392|0,1),ae(f,Y<<1),f=n[s+400>>2],n[s+760>>2]=f,k=n[s+396>>2],Y=n[s+392>>2],n[s+752>>2]=Y,n[s+756>>2]=k,n[j+8>>2]=f,n[j>>2]=Y,n[j+4>>2]=k,n[s+348>>2]=1,n[s+344>>2]=j,n[s+340>>2]=1,!o&(!r|12==(0|F)|v[F-8>>2]<65535))bA(s+568|0,71056,2,j,1);else{for(I=0,n[s+760>>2]=0,n[s+752>>2]=0,n[s+756>>2]=1,Rf(f=s+752|0,12),Rf(f,0),h=(d=g(r,12))+16|0;Qf(f=s+752|0,h),Qf(f,I),Qf(f,r),d;)d=d-12|0,r=n[Z+8>>2],I=n[Z+4>>2],h=n[Z>>2],Z=Z+12|0;n[s+400>>2]=n[s+760>>2],r=n[s+756>>2],n[s+392>>2]=n[s+752>>2],n[s+396>>2]=r,Yf(s+340|0,s+392|0),bA(s+568|0,71072,4,n[s+344>>2],n[s+348>>2])}if(Ye(s+340|0),ye(s+376|0),se(s+648|0),n[s+592>>2]=n[s+544>>2],r=n[s+540>>2],n[s+584>>2]=n[s+536>>2],n[s+588>>2]=r,n[s+608>>2]=n[s+700>>2],r=n[s+696>>2],n[s+600>>2]=n[s+692>>2],n[s+604>>2]=r,n[s+624>>2]=n[s+712>>2],r=n[s+708>>2],n[s+616>>2]=n[s+704>>2],n[s+620>>2]=r,n[s+640>>2]=n[s+688>>2],r=n[s+684>>2],n[s+632>>2]=n[s+680>>2],n[s+636>>2]=r,h=0,r=0,y=1,k=0,fA){for(n[s+400>>2]=0,n[s+392>>2]=0,n[s+396>>2]=1,Rf(r=s+392|0,0),Rf(r,1),Rf(r,0),Rf(r,(f=g(fA,6))+14|0),Rf(r,1),Rf(r,fA),n[s+752>>2]=0,n[s+756>>2]=3,r=15^l(((r=65535&fA)>>>0<=1?1:r)<<16),a[s+762>>1]=r,r=6<>1]=r,a[s+764>>1]=f-r;$r(s+24|0,s+752|0),1&a[s+24>>1];)Rf(s+392|0,B[s+26>>1]);for(Z=fA<<3;Z;)f=n[EA+4>>2],Qf(r=s+392|0,n[EA>>2]),Rf(r,f),Z=Z-8|0,EA=EA+8|0;y=n[s+396>>2],k=n[s+400>>2],r=n[s+392>>2]}if(n[s+656>>2]=n[s+676>>2],f=n[s+672>>2],n[s+648>>2]=n[s+668>>2],n[s+652>>2]=f,n[s+384>>2]=n[s+724>>2],f=n[s+720>>2],n[s+376>>2]=n[s+716>>2],n[s+380>>2]=f,N=L=N-32|0,hr(L+8|0,(d=(W<<4)+i|0)-i>>>4|0,4,16),n[L+28>>2]=0,f=n[L+12>>2],n[L+20>>2]=n[L+8>>2],n[L+24>>2]=f,N=j=N-16|0,Ni(f=L+20|0,P=d-i>>>4|0),Y=n[f+4>>2],o=n[f+8>>2],n[j+4>>2]=f+8,ur=j,Br=xe(Y,o),n[ur+8>>2]=Br,n[j+12>>2]=C,N=x=N+-64|0,U=n[(f=j+4|0)+4>>2],Z=n[f>>2],(0|i)!=(0|d))for(T=n[f+8>>2]+(U<<4)|0,U=U+P|0,q=x+8|0;;){if(f=n[i+12>>2],o=n[i+8>>2],d=B[i>>1],a[x+60>>1]=0,n[x+56>>2]=f+o,n[x+52>>2]=o,n[x+36>>2]=0,n[x+20>>2]=0,N=J=N-80|0,vA(J+16|0,I=x+20|0),u[J+16|0]){for(Y=u[J+17|0],lA(F=J+36|0,I),hr(J+8|0,(f=(f=n[J+36>>2]+1|0)||-1)>>>0<=8?8:f,1,1),o=n[J+8>>2],f=n[J+12>>2],e[0|f]=Y,n[J+32>>2]=1,n[J+28>>2]=f,n[J+24>>2]=o,Je(F,I,44),I=J+24|0,N=W=N-16|0;vA(W,F),u[0|W];)o=u[W+1|0],(0|(Y=n[I+8>>2]))==n[I>>2]&&(lA(W+4|0,F),Ui(I,(f=n[W+4>>2]+1|0)||-1)),e[Y+n[I+4>>2]|0]=o,n[I+8>>2]=Y+1;N=W+16|0,n[q+8>>2]=n[J+32>>2],f=n[J+28>>2],n[q>>2]=n[J+24>>2],n[q+4>>2]=f}else n[q+8>>2]=0,n[q>>2]=0,n[q+4>>2]=1;if(N=J+80|0,f=n[x+16>>2],n[T+8>>2]=n[x+12>>2],n[T+12>>2]=f,a[x+4>>1]=d,f=n[x+8>>2],n[T>>2]=n[x+4>>2],n[T+4>>2]=f,i=i+16|0,T=T+16|0,!(P=P-1|0))break}for(n[Z>>2]=U,N=x- -64|0,N=j+16|0,n[(i=s+340|0)+8>>2]=n[L+28>>2],f=n[L+24>>2],n[i>>2]=n[L+20>>2],n[i+4>>2]=f,N=L+32|0,i=n[s+348>>2],n[s+400>>2]=0,n[s+392>>2]=0,n[s+396>>2]=1,Rf(f=s+392|0,0),Rf(f,i),Rf(f,g(i,12)+6|0),I=i<<4,Z=d=n[s+344>>2];;){if(I){Rf(f=s+392|0,3),Rf(f,1),Rf(f,1033),Rf(f,B[Z>>1]),Rf(f,n[Z+12>>2]),I=I-16|0,Rf(f,h),h=n[Z+12>>2]+h|0,Z=Z+16|0;continue}for(Z=i<<4;Z;)ke(s+392|0,n[d+8>>2],n[d+12>>2]),Z=Z-16|0,d=d+16|0;for(n[s+908>>2]=n[s+400>>2],f=n[s+396>>2],n[s+900>>2]=n[s+392>>2],n[s+904>>2]=f,pf(f=s+340|0),Ee(f),n[s+752>>2]=71108,n[s+768>>2]=71112,n[s+784>>2]=71116,f=n[s+744>>2],n[s+916>>2]=n[s+740>>2],n[s+920>>2]=f,n[s+924>>2]=n[s+748>>2],f=n[s+556>>2],n[s+756>>2]=n[s+552>>2],n[s+760>>2]=f,n[s+764>>2]=n[s+560>>2],f=n[s+572>>2],n[s+772>>2]=n[s+568>>2],n[s+776>>2]=f,n[s+780>>2]=n[s+576>>2],f=n[s+588>>2],n[s+788>>2]=n[s+584>>2],n[s+792>>2]=f,n[s+796>>2]=n[s+592>>2],n[s+800>>2]=71120,n[s+816>>2]=71124,n[s+832>>2]=71128,n[s+864>>2]=71136,n[s+860>>2]=k,n[s+856>>2]=y,n[s+852>>2]=r,n[s+848>>2]=71132,n[s+812>>2]=n[s+608>>2],r=n[s+604>>2],n[s+804>>2]=n[s+600>>2],n[s+808>>2]=r,n[s+828>>2]=n[s+624>>2],r=n[s+620>>2],n[s+820>>2]=n[s+616>>2],n[s+824>>2]=r,n[s+844>>2]=n[s+640>>2],r=n[s+636>>2],n[s+836>>2]=n[s+632>>2],n[s+840>>2]=r,n[s+876>>2]=n[s+656>>2],r=n[s+652>>2],n[s+868>>2]=n[s+648>>2],n[s+872>>2]=r,n[s+880>>2]=71140,n[s+892>>2]=n[s+384>>2],r=n[s+380>>2],n[s+884>>2]=n[s+376>>2],n[s+888>>2]=r,n[s+912>>2]=71148,n[s+896>>2]=71144,Z=12,d=0;d=(0!=n[(k=s+752|0)+Z>>2])+d|0,188!=(0|(Z=Z+16|0)););if(f=0,(0|(r=s+928|0))!=(0|k))for(i=k+12|0,r=r-k>>>4|0;f=(n[i>>2]+3&-4)+f|0,i=i+16|0,r=r-1|0;);for(Hf(r=s+340|0,f+(y=12|(i=d<<4))|0),Qf(r,65536),Rf(r,d),n[s+392>>2]=0,n[s+396>>2]=3,r=15^l(((r=65535&d)>>>0<=1?1:r)<<16),a[s+402>>1]=r,r=16<>1]=r,a[s+404>>1]=i-r;$r(s+16|0,s+392|0),1&a[s+16>>1];)Rf(s+340|0,B[s+18>>1]);for(Z=0,h=0;;){Z=Z-176|0;k:{for(;;){if(!Z){for(Z=0;176!=(0|Z);)(f=n[(i=(s+752|0)+Z|0)+12>>2])&&(ke(r=s+340|0,n[i+8>>2],f),Oi(r)),Z=Z+16|0;for(k=n[s+340>>2],i=XA(Y=n[s+344>>2],o=n[s+348>>2]),Vf(s+8|0,h+8|0,h+12|0,Y,o,71152),f=n[s+12>>2],r=n[s+8>>2],ur=s,Br=(-16711936&(Le(i=-1313820742-i|0,16)^i))>>>8^Le(i,8),n[ur+392>>2]=Br,Z=4,ai(r,f,s+392|0,4,71168);;){if(180==(0|Z))break k;le((s+752|0)+Z|0),Z=Z+16|0}}if(r=(f=s+752|0)+Z|0,Z=Z+16|0,n[r+188>>2])break}Mf(i=s+340|0,n[(r=(f=f+Z|0)+160|0)>>2],4),Qf(i,XA(k=n[f+168>>2],n[(f=f+172|0)>>2])),Qf(i,y),Qf(i,n[f>>2]),r=n[r>>2],h=1684104552==(u[0|r]|u[r+1|0]<<8|u[r+2|0]<<16|u[r+3|0]<<24)?y:h,Z=Z+176|0,y=(n[f>>2]+3&-4)+y|0;continue}break}for(n[A+20>>2]=n[s+156>>2],r=n[s+152>>2],n[A+12>>2]=n[s+148>>2],n[A+16>>2]=r,n[A+8>>2]=o,n[A+4>>2]=Y,n[A>>2]=k,pf(A=s+524|0),Ee(A),le(s+512|0),ge(s+500|0),We(s+488|0),ge(s+476|0),We(s+464|0),le(s+280|0),le(ar),le(er),we(s+256|0),we(TA),ji(s+208|0),f=n[(A=s+196|0)+8>>2],r=n[A+4>>2];f;)f=f-1|0,ji(r),r=r+48|0;for(Af(A,4,48),f=n[(A=s+184|0)+8>>2],r=n[A+4>>2];f;)f=f-1|0,ji(r),r=r+88|0;return Af(A,8,88),me(s+160|0),ge(s+136|0),void(N=s+928|0)}}}(0|Z)==n[s+752>>2]&&(kf(s+752|0),r=n[s+756>>2]),n[(r=r+d|0)+8>>2]=Y,n[r+4>>2]=y,n[r>>2]=y,n[s+760>>2]=Z+1}I=I+8|0,h=h-8|0}cA(0,r,Y,71040),c()}Rf(s+680|0,0),Z=Z+28|0}}Ur(0,0,71012),c()}Ur(I,k,70932),c()}if(!n[T+32>>2])break r;d=n[T+28>>2]}mf(h,n[d>>2],0,I)}for(n[s+384>>2]=y,n[s+380>>2]=Z,n[s+376>>2]=Z,d=(k<<3)+Z|0,n[s+388>>2]=d,z=0;;){r:{f:{i:{e:{if((0|Z)!=(0|d)){if(n[s+380>>2]=Z+8,I=n[Z+4>>2],h=n[Z>>2],n[s+648>>2]=h,mA(n[s+140>>2],n[s+144>>2],s+648|0)||Kf(s+136|0,h),f>>>0<=h>>>0)break e;if(W=n[(h<<2)+r>>2],!(k=n[s+204>>2]))break i;if(k=k-1|0,n[s+204>>2]=k,d=n[s+200>>2]+g(k,48)|0,Z=n[d>>2],Je(k=s+752|0,d+4|0,44),-1==(0|Z))break i;n[s+392>>2]=Z,Je(gA,k,44);break f}if(Wi(s+376|0),d=0,k=I=n[s+188>>2],y=n[s+192>>2],(0|k)!=(0|(W=k+g(y,88)|0)))for(Z=k+8|0,k=(W-k>>>0)/88|0;d=n[Z>>2]+d|0,Z=Z+88|0,k=k-1|0;);if(h=d>>>0<=65535,k=0,(0|I)!=(0|W))for(d=I+44|0,Z=(W-I>>>0)/88|0;k=n[d>>2]+k|0,d=d+88|0,Z=Z-1|0;);if(!(k>>>0<32768&h)){Kf(s+148|0,F),d=n[s+192>>2],n[s+192>>2]=0,n[s+768>>2]=0,n[s+764>>2]=d,k=n[s+188>>2],n[s+752>>2]=k,n[s+756>>2]=k+g(d,88),n[s+760>>2]=s+184,N=W=N-16|0,Z=n[(I=s+196|0)+8>>2],(d=(n[(k=s+752|0)+4>>2]-n[k>>2]>>>0)/88|0)>>>0>n[I>>2]-Z>>>0&&wf(I,Z,d,4,48),Z=n[I+4>>2],d=n[I+8>>2],n[W+4>>2]=I+8,ur=W,Br=xe(Z,d),n[ur+8>>2]=Br,n[W+12>>2]=C,N=L=N-112|0,Z=n[k+4>>2],d=n[k>>2],n[L+8>>2]=d,n[L+12>>2]=Z,n[L+24>>2]=n[k+16>>2],Z=n[k+12>>2],n[L+16>>2]=n[k+8>>2],n[L+20>>2]=Z,h=n[(k=W+4|0)+4>>2],I=n[k+8>>2]+g(h,48)|0,F=n[k>>2],y=n[L+12>>2];a:{for(;;){if((0|d)==(0|y))break a;if(-1==(0|(Z=n[d>>2])))break;Je(k=L+28|0,d+4|0,84),n[I>>2]=Z,Je(I+4|0,k,44),I=I+48|0,h=h+1|0,d=d+88|0}d=d+88|0}n[L+8>>2]=d,n[F>>2]=h,br(L+8|0),N=L+112|0,N=W+16|0,z=0,I=n[s+188>>2],y=n[s+192>>2]}y=g(y,88)+I|0;a:for(;;){if((0|(k=I))!=(0|y)){if(I=k+88|0,0==(m=Q[k+48>>3]))continue;for(d=n[k+8>>2]<<3,Z=n[k+4>>2];;){if(!d)continue a;Q[Z>>3]=m+Q[Z>>3],d=d-8|0,Z=Z+8|0}}break}for(y=n[s+192>>2],F=(Z=g(y,88))+(d=n[s+188>>2])|0,I=d;;){if(!Z){JA=1;break r}if(Z=Z-88|0,k=n[I+8>>2],I=I+88|0,k)break}if(JA=1,!eA)break r;for(H=0,K=Q[s+96>>3];;){a:{if((0|d)!=(0|F))for(y=d+12|0,k=(h=n[d+40>>2])+(n[d+44>>2]<<2)|0,Z=0;;){if((0|k)==(0|h))break a;for(I=n[h>>2],uA=Q[oi(d,I,68692)>>3],UA=Q[oi(y,I,68708)>>3],e[s+760|0]=0,n[s+756>>2]=I,n[s+752>>2]=Z;pr(s+72|0,s+752|0),1==n[s+72>>2];)Z=n[s+76>>2],S=(m=Q[oi(d,Z,68724)>>3]-uA)*m,m=Q[oi(y,Z,68740)>>3]-UA,H+=D(S+m*m),uA=Q[oi(d,Z,68756)>>3],UA=Q[oi(y,Z,68772)>>3];Z=I+1|0,h=h+4|0}m=.25*K,S=z!=z?m:z,m=-.04*(H/D(K*((m=m!=m?S:m).35?m:.35,1),y=n[s+192>>2],d=n[s+188>>2];break r}d=d+88|0}}Ur(h,f,70964),c()}n[s+432>>2]=4,n[s+436>>2]=0,n[s+424>>2]=0,n[s+428>>2]=0,n[s+416>>2]=0,n[s+420>>2]=1,n[s+408>>2]=8,n[s+412>>2]=0,n[s+400>>2]=0,n[s+404>>2]=0,n[s+392>>2]=0,n[s+396>>2]=8}N=k=N+-64|0,n[(y=s+392|0)+44>>2]=0,n[y+32>>2]=0,n[y+20>>2]=0,n[y+8>>2]=0,n[k+8>>2]=1024,n[k+12>>2]=I,Z=O(W,k+12|0,1),d=u[W+200|0],n[k+24>>2]=0,n[k+28>>2]=0,n[k+16>>2]=0,n[k+20>>2]=1072693248,n[k+32>>2]=0,n[k+36>>2]=0,n[k+48>>2]=0,n[k+52>>2]=0,n[k+40>>2]=0,n[k+44>>2]=1072693248,n[k+56>>2]=0,n[k+60>>2]=0,X(Z+4|0,+(d>>>0),I,k+16|0,y,0,k+8|0),e[0|Z]=0,N=k- -64|0,1!=(S=Q[s+96>>3]/+B[W+172>>1])&&(n[U>>2]=0,n[U+4>>2]=0,n[U+8>>2]=0,n[U+12>>2]=0,n[j>>2]=0,n[j+4>>2]=0,n[j+8>>2]=0,n[j+12>>2]=0,Q[s+752>>3]=S,Q[s+776>>3]=S,zA(y,s+752|0)),d=gf(W,I),y=n[s+192>>2],I=g(y,88),k=n[s+188>>2],m=z,0==(K=S*+((65535&d)>>>0))&&y&&(d=(Z=k+I|0)-88|0)&&(Nr(s+752|0,d),Nr(s+440|0,s+392|0),1!=n[s+440>>2]|n[s+444>>2]||n[s+752>>2]&&(m=Q[Z-40>>3]+.5*(Q[s+760>>3]+Q[s+768>>3]-Q[s+448>>3]-Q[s+456>>3]))),Je(s+752|0,s+392|0,48),H=S*+B[W+192>>1],S*=+B[W+190>>1],(0|y)==n[s+184>>2]&&(N=d=N-16|0,NA(d+8|0,k=s+184|0,n[k>>2],1,8,88),-1!=(0|(k=n[d+8>>2]))&&(_i(k,n[d+12>>2]),c()),N=d+16|0,k=n[s+188>>2]),Je(k=k+I|0,s+752|0,48),e[k+84|0]=K>0,n[k+80>>2]=h,n[k+72>>2]=0,n[k+76>>2]=0,Q[k+64>>3]=H,Q[k+56>>3]=S,Q[k+48>>3]=m,n[s+192>>2]=y+1,z+=K,Z=n[s+380>>2],d=n[s+388>>2];continue}break}if(Q[s+632>>3]=JA,n[s+760>>2]=qA,n[s+752>>2]=d,n[s+756>>2]=g(y,88)+d,y=s+632|0,n[s+764>>2]=y,H=-0,(0|(I=n[(F=s+752|0)>>2]))!=(0|(Z=n[F+4>>2])))for(k=n[F+8>>2],d=I+80|0,Z=(Z-I>>>0)/88|0,m=Q[n[F+12>>2]>>3];1==u[d+4|0]&&(H+=m*Q[Bi(k,n[d>>2],69248)>>3]),d=d+88|0,Z=Z-1|0;);if(S=H,d=n[s+188>>2],n[s+752>>2]=d,J=(I=g(n[s+192>>2],88))+d|0,n[s+756>>2]=J,n[s+760>>2]=y,H=-0,(0|(y=n[F>>2]))!=(0|(k=n[F+4>>2])))for(Z=y+56|0,h=(k-y>>>0)/88|0,m=Q[n[F+8>>2]>>3];H=1==u[Z+28|0]?H+m*Q[Z>>3]:H,Z=Z+88|0,h=h-1|0;);for(!n[T+4>>2]&1==n[T>>2]&&(m=Q[T+8>>3])>=0?(uA=m*Q[s+96>>3]/Q[s+88>>3],m=rA):(uA=z+S,m=1),Ar=(K=uA!=uA?16383:uA)<16383?K:16383,LA=1,z>0&&(K=Ar-S,K=(H=z>H?(K-H*m)/(z-H):K/z)!=H?DA:H,K=(H=(H=DA!=DA?K:DA)K?K:H),K=m-LA,H=0,Z=d;I;)RA=.4*(m=JA*Q[Z+56>>3]),VA=JA*Q[Z+64>>3]*-.25,$=(m*=K)!=m?VA:m,$=(m=(m=VA!=VA?$:VA)<$?$:m)!=m?RA:m,m=w(m=(m=RA!=RA?$:RA)>$?$:m)<.5?0:m,Q[Z+72>>3]=m,H=u[Z+84|0]?H+m:H,I=I-88|0,Z=Z+88|0;for(or=.5*(Ar-(S+z*LA+H)),pA=0,rr=0;;){r:{if((0|d)!=(0|J)){if(k=Bi(qA,n[d+80>>2],70948),cr=Q[k+24>>3],H=Q[k+8>>3],S=Q[k>>3],z=Q[k+16>>3],m=Q[d+72>>3],EA=u[d+84|0],n[U>>2]=0,n[U+4>>2]=0,n[U+8>>2]=0,n[U+12>>2]=0,n[j>>2]=0,n[j+4>>2]=0,n[j+8>>2]=0,n[j+12>>2]=0,Q[s+752>>3]=LA,Q[s+776>>3]=z,zA(d,s+752|0),SA=.5*(RA=JA*H),KA=.5*(VA=m+JA*S),!n[d+8>>2]|0==SA&0==KA)break r;for(WA=d+12|0,MA=(k=n[d+40>>2])+(n[d+44>>2]<<2)|0,uA=0,Z=0,h=k;(0|h)!=(0|MA);){for(I=n[h>>2],UA=Q[oi(d,I,71628)>>3],H=Q[oi(WA,I,71644)>>3],e[s+760|0]=0,n[s+756>>2]=I,n[s+752>>2]=Z;pr(s- -64|0,s+752|0),1==n[s+64>>2];)Z=n[s+68>>2],uA+=(Q[oi(WA,Z,71660)>>3]-H)*(UA+Q[oi(d,Z,71676)>>3]),UA=Q[oi(d,Z,71692)>>3],H=Q[oi(WA,Z,71708)>>3];Z=I+1|0,h=h+4|0}if(0==uA)break r;for(ue(s+256|0,d),ue(TA,WA),Z=0;;){if(n[s+584>>2]=Z,(0|k)==(0|MA))break r;for(L=1+((x=n[k>>2])-Z|0)|0,n[s+600>>2]=L,k=k+4|0,Z=0;;){if((0|Z)!=(0|L)){n[s+616>>2]=Z,tA=s+256|0,fA=n[s+584>>2]+Z|0,ur=s,Qr=Q[oi(tA,fA,71724)>>3],Q[ur+648>>3]=Qr,I=oi(TA,fA,71740),n[s+400>>2]=TA,Q[s+376>>3]=Q[I>>3],n[s+404>>2]=s+376,n[s+396>>2]=s+648,n[s+392>>2]=tA,T=n[s+600>>2],n[s+768>>2]=T,W=s+600|0,n[s+760>>2]=W,F=s+616|0,n[s+756>>2]=F,h=s+584|0,n[s+752>>2]=h,n[s+764>>2]=1,wA=s+56|0,N=iA=N-48|0,AA=s+752|0,n[iA+40>>2]=AA,BA=I=s+392|0,y=n[I+12>>2],n[iA+32>>2]=n[I+8>>2],n[iA+36>>2]=y,y=n[I+4>>2],n[iA+24>>2]=n[I>>2],n[iA+28>>2]=y,y=AA+12|0;f:{i:{e:{for(;;){if(Pf(iA+16|0,y),p=0,1!=n[iA+16>>2])break e;if(!(BA=n[n[AA+8>>2]>>2]))break i;if(Or(iA+8|0,iA+24|0,n[n[AA>>2]>>2]+((n[n[AA+4>>2]>>2]+(BA-n[iA+20>>2]|0)>>>0)%(BA>>>0)|0)|0),1==n[iA+8>>2])break}BA=n[iA+12>>2],p=1}n[wA+4>>2]=BA,n[wA>>2]=p,N=iA+48|0;break f}Qe(69376),c()}if(1&n[s+56>>2]){p=n[s+60>>2],n[s+768>>2]=T,n[s+760>>2]=W,n[s+756>>2]=F,n[s+752>>2]=h,n[s+764>>2]=1,F=s+48|0,N=W=N-48|0,n[W+40>>2]=AA,y=n[I+12>>2],n[W+32>>2]=n[I+8>>2],n[W+36>>2]=y,y=n[I+4>>2],n[W+24>>2]=n[I>>2],n[W+28>>2]=y,y=AA+12|0;f:{i:{e:{for(;;){if(Pf(W+16|0,y),h=0,1!=n[W+16>>2])break e;if(!(I=n[n[AA+8>>2]>>2]))break i;if(Or(W+8|0,W+24|0,n[n[AA>>2]>>2]+((n[n[AA+4>>2]>>2]+n[W+20>>2]>>>0)%(I>>>0)|0)|0),1==n[W+8>>2])break}I=n[W+12>>2],h=1}n[F+4>>2]=I,n[F>>2]=h,N=W+48|0;break f}Qe(69360),c()}h=n[s+52>>2],y=n[s+48>>2],z=Q[oi(tA,p,71756)>>3],m=Q[s+648>>3],I=oi(TA,p,71772),S=0,UA=0,m-=z,z=Q[s+376>>3]-Q[I>>3],fr=m/(aA=D(m*m+z*z)),H=m=Q[oi(tA,I=1&y?h:fA,71788)>>3]-Q[s+648>>3],$=m*m,m=Q[oi(TA,I,71804)>>3]-Q[s+376>>3],($=fr*(ir=H/(nA=D($+m*m)))+(FA=z/aA)*(m/=nA))>-.9375&&(H=-(K=fr+ir),z=-(S=FA+m),m=FA*ir-fr*m,FA=(I=uA<0)?-m:m,UA=(I?K:H)*((m=(aA=(aA=aA!=aA?nA:aA)<(nA=nA!=nA?aA:nA)?aA:nA)*(nA=$+1))>=SA*FA?SA/nA:aA/FA),S=(I?z:S)*($=KA*FA<=m?KA/nA:aA/FA)),m=Q[s+648>>3],ur=oi(d,fA,71820),Qr=S+(KA+m),Q[ur>>3]=Qr,m=Q[s+376>>3],ur=oi(WA,fA,71836),Qr=UA+(SA+m),Q[ur>>3]=Qr,Z=Z+1|0;continue}}break}Z=x+1|0}}for(n[s+252>>2]=0,n[s+240>>2]=0,n[s+228>>2]=0,n[s+216>>2]=0,k=n[s+192>>2],n[s+192>>2]=0,Z=n[s+188>>2],n[s+768>>2]=0,n[s+764>>2]=k,d=g(k,88)+Z|0,n[s+756>>2]=d,n[s+752>>2]=Z,n[s+760>>2]=s+184;(0|Z)!=(0|d)&&(n[s+752>>2]=Z+88,-1!=(0|(x=n[Z>>2])));){if(fA=n[Z+44>>2],WA=n[Z+40>>2],L=n[Z+36>>2],tA=n[Z+32>>2],EA=n[Z+28>>2],T=n[Z+24>>2],MA=n[Z+20>>2],wA=n[Z+16>>2],W=n[Z+12>>2],p=n[Z+8>>2],J=n[Z+4>>2],n[s+376>>2]=n[s+216>>2],fe(s+208|0,J,p),fe(YA,wA,MA),ke(oA,EA,tA),n[s+392>>2]=WA,n[s+396>>2]=WA+(fA<<2),n[s+400>>2]=s+376,N=AA=N-16|0,di(xA,n[(h=s+392|0)+4>>2]-n[h>>2]>>>2|0),d=n[xA+4>>2],k=n[xA+8>>2],n[AA+4>>2]=xA+8,ur=AA,Br=xe(d,k),n[ur+8>>2]=Br,n[AA+12>>2]=C,Z=n[(d=AA+4|0)+4>>2],F=n[d>>2],(0|(I=n[h>>2]))!=(0|(y=n[h+4>>2])))for(k=n[h+8>>2],d=n[d+8>>2]+(Z<<2)|0,Z=(h=y-I>>>2|0)+Z|0;n[d>>2]=n[I>>2]+n[k>>2],I=I+4|0,d=d+4|0,h=h-1|0;);n[F>>2]=Z,N=AA+16|0,(0|(d=n[s+204>>2]))==n[s+196>>2]&&(N=Z=N-16|0,NA(Z+8|0,k=s+196|0,n[k>>2],1,4,48),-1!=(0|(k=n[Z+8>>2]))&&(_i(k,n[Z+12>>2]),c()),N=Z+16|0),k=n[s+200>>2]+g(d,48)|0,n[k+44>>2]=fA,n[k+40>>2]=WA,n[k+36>>2]=L,n[k+32>>2]=tA,n[k+28>>2]=EA,n[k+24>>2]=T,n[k+20>>2]=MA,n[k+16>>2]=wA,n[k+12>>2]=W,n[k+8>>2]=p,n[k+4>>2]=J,n[k>>2]=x,n[s+204>>2]=d+1,d=n[s+756>>2],Z=n[s+752>>2]}br(s+752|0),L=n[s+180>>2];f:{if(W=n[s+216>>2]){Z=0,n[s+312>>2]=0,n[s+300>>2]=0,n[s+288>>2]=0,ZA=32767,hA=32768,y=0,d=0,IA=32768,PA=32767;i:for(;;){if((0|y)!=(0|W))for(I=u[0|Di(oA,y,71200)],m=Q[oi(s+208|0,y,71216)>>3],z=Q[oi(YA,y,71232)>>3],a[s+780>>1]=8196,n[s+772>>2]=er,a[s+768>>1]=4098,n[s+760>>2]=ar,m=Kr(m),m=E((m=m!=m?-16383:m)>-16383?m:-16383,16383),F=w(m)<2147483647?~~m:-2147483648,n[s+764>>2]=F-d,m=Kr(z),m=E((m=m!=m?-16383:m)>-16383?m:-16383,16383),h=w(m)<2147483647?~~m:-2147483648,n[s+776>>2]=h-Z,hA=(0|(k=hA<<16>>16))<(0|(d=h<<16>>16))?d:k,ZA=(0|(k=ZA<<16>>16))>(0|d)?d:k,IA=(0|(k=IA<<16>>16))<(0|(d=F<<16>>16))?d:k,PA=(0|(k=PA<<16>>16))>(0|d)?d:k,Z=0,k=!!(0|I),y=y+1|0;;){I=Z+1|0,d=(s+752|0)+g(Z,12)|0;e:{a:{for(;3!=(0|I)&&(x=n[d+8>>2]);){if(T=u[d+17|0],!(J=n[(Z=d+12|0)>>2]))break e;if((0|(P=((P=J>>31)^J)-P|0))<256)break a;a[s+392>>1]=J<<8|(65280&J)>>>8,Mf(x,s+392|0,2),I=I+1|0,d=Z}ri(s+280|0,k),Z=h,d=F;continue i}d=u[d+16|0],ri(x,P),T=((0|J)>0?T:0)|d}k|=T,Z=I}break}for(Rf(k=s+172|0,CA=n[s+252>>2]),Rf(k,PA),Rf(k,ZA),Rf(k,IA),Rf(k,hA),Z=CA<<2,d=n[s+248>>2];Z;)Rf(s+172|0,n[d>>2]),Z=Z-4|0,d=d+4|0;Rf(s+172|0,0),y=n[s+288>>2],I=n[s+284>>2];i:for(;;){if(y){h=y-1|0,Z=0,F=s+752|0,d=y;e:{for(;;){if((0|Z)==(0|h))break e;if(u[0|(k=Z+I|0)]!=u[k+1|0])break;Z=Z+1|0}y=Z+1|0}for(Jf(F,I,d,y,71940),y=n[s+764>>2],I=n[s+760>>2],d=n[s+752>>2],k=n[s+756>>2],n[s+760>>2]=256,n[s+752>>2]=d,n[s+756>>2]=k;;){if(tr(s+40|0,s+752|0),!(k=n[s+40>>2]))continue i;if(!(d=n[s+44>>2]))break f;k=u[0|k],1==(0|d)?(e[s+392|0]=k,Mf(s+172|0,s+392|0,1)):(e[s+393|0]=d-1,e[s+392|0]=8|k,Mf(s+172|0,s+392|0,2))}}break}ke(k=s+172|0,n[s+296>>2],n[s+300>>2]),ke(k,n[s+308>>2],n[s+312>>2]),Oi(k),P=W,k=1}else k=0;a[s+770>>1]=hA,a[s+768>>1]=IA,a[s+766>>1]=ZA,a[s+764>>1]=PA,n[s+760>>2]=CA,n[s+756>>2]=P,n[s+752>>2]=k,n[s+772>>2]=L,m=Kr(Ar),k=(m=E(M(z=(m=m!=m?0:m)>0?m:0,0),65535))<4294967295&m>=0?~~m>>>0:0,a[s+776>>1]=z==z?k:0,jr(s+160|0,s+752|0);continue A}Ur(0,0,71184),c()}rr=EA?pA:rr,pA=EA?pA+VA:pA,n[s+792>>2]=0,n[s+796>>2]=0,Q[s+776>>3]=(0|_)<=0?1:$A/(RA+$A),Q[s+768>>3]=cr,n[s+760>>2]=0,n[s+764>>2]=0,n[s+752>>2]=0,n[s+756>>2]=1072693248,Q[s+784>>3]=or+rr,zA(d,s+752|0),d=d+88|0}}}function z(A){var r,f=0,i=0,a=0,b=0,k=0,o=0,t=0,c=0,B=0,Q=0,g=0,w=0;N=r=N-16|0;A:{r:{if(!(A>>>0>=245)){f:{i:{e:{a:{n:{if(3&(f=(i=n[19239])>>>(A=(k=A>>>0<11?16:A+11&504)>>>3|0)|0)){if(b=(A=(o=A+(1&~f)|0)<<3)+76692|0,f=n[A+76700>>2],(0|b)==(0|(a=n[f+8>>2])))break n;n[a+12>>2]=b,n[b+8>>2]=a;break a}if(v[19241]>=k>>>0)break r;if(!f){if(!(A=n[19240]))break r;for(f=n[76548+(Xe(A)<<2)>>2],a=(-8&n[f+4>>2])-k|0,i=f;(A=n[f+16>>2])||(A=n[f+20>>2]);)a=(f=(b=(-8&n[A+4>>2])-k|0)>>>0>>0)?b:a,i=f?A:i,f=A;t=n[i+24>>2];b:{k:{if((0|i)==(0|(A=n[i+12>>2]))){if(A=n[i+20>>2],f=n[(A?20:16)+i>>2])break k;A=0;break b}f=n[i+8>>2],n[f+12>>2]=A,n[A+8>>2]=f;break b}for(b=A?i+20|0:i+16|0;o=b,b=(f=n[(A=f)+20>>2])?A+20|0:A+16|0,f=n[(f?20:16)+A>>2];);n[o>>2]=0}if(!t)break f;f=76548+(n[i+28>>2]<<2)|0;b:{if(n[f>>2]!=(0|i)){if(n[t+16>>2]!=(0|i)){if(n[t+20>>2]=A,A)break b;break f}if(n[t+16>>2]=A,A)break b;break f}if(n[f>>2]=A,!A)break i}if(n[A+24>>2]=t,(f=n[i+16>>2])&&(n[A+16>>2]=f,n[f+24>>2]=A),!(f=n[i+20>>2]))break f;n[A+20>>2]=f,n[f+24>>2]=A;break f}if(b=(f=(o=Xe((0-(b=2<>2],(0|b)==(0|(a=n[A+8>>2]))?(g=76956,w=Oe(o)&i,n[g>>2]=w):(n[a+12>>2]=b,n[b+8>>2]=a),n[A+4>>2]=3|k,o=f-k|0,n[A+f>>2]=o,n[(t=A+k|0)+4>>2]=1|o,!(i=n[19241]))break e;f=n[19243],(b=n[19239])&(a=1<<(i>>>3))?(b=(i&=-8)+76692|0,k=n[i+76700>>2]):(n[19239]=a|b,b=k=76692+(-8&i)|0),n[b+8>>2]=f,n[k+12>>2]=f,n[f+12>>2]=b,n[f+8>>2]=k;break e}g=76956,w=Oe(o)&i,n[g>>2]=w}a=f+8|0,n[f+4>>2]=3|A,n[(A=A+f|0)+4>>2]=1|n[A+4>>2];break A}a=A+8|0,n[19243]=t,n[19241]=o;break A}g=76960,w=n[19240]&Oe(n[i+28>>2]),n[g>>2]=w}if(a>>>0>=16?(n[i+4>>2]=3|k,n[(o=i+k|0)+4>>2]=1|a,n[a+o>>2]=a,(f=n[19241])&&(A=n[19243],(b=n[19239])&(t=1<<(f>>>3))?(f=(b=-8&f)+76692|0,b=n[b+76700>>2]):(n[19239]=b|t,f=b=76692+(-8&f)|0),n[f+8>>2]=A,n[b+12>>2]=A,n[A+12>>2]=f,n[A+8>>2]=b),n[19243]=o,n[19241]=a):(A=a+k|0,n[i+4>>2]=3|A,n[(A=A+i|0)+4>>2]=1|n[A+4>>2]),!(a=i+8|0))break r;break A}if(((f=(-48-n[19250]&-9)-3|0)>>>0>=4294967232?-64:f)>>>0<=A>>>0)break A;if(k=-8&(f=A+11|0),c=n[19240]){t=31,A>>>0>=16777205||(t=62^(k>>>38-(A=l(f>>>8|0))&1|A<<1)),a=0-k|0;f:{i:{if(i=n[76548+(t<<2)>>2])for(f=0,b=k<<(31!=(0|t)?25-(t>>>1|0)|0:0),A=0;;){if(!((o=-8&n[i+4>>2])>>>0>>0||(o=o-k|0)>>>0>=a>>>0||(f=i,a=o))){a=0,A=f;break i}if(o=n[i+20>>2],i=n[16+((b>>>29&4)+i|0)>>2],A=o&&(0|o)!=(0|i)?o:A,b<<=1,!i)break}else f=0,A=0;if(!(A|f)){if(f=0,!(A=c&(0-(A=2<>2]}if(!A)break f}for(;t=a>>>0>(b=(o=-8&n[A+4>>2])-k|0)>>>0?b:a,(i=n[A+16>>2])||(i=n[A+20>>2]),A=a>>>0<=b>>>0?f:A,a=(b=k>>>0>o>>>0)?a:t,f=b?f:A,A=i;);}if(f&&!((A=n[19241])>>>0>=k>>>0&A-k>>>0<=a>>>0)){t=n[f+24>>2];f:{i:{if((0|f)==(0|(A=n[f+12>>2]))){if(A=n[f+20>>2],i=n[(A?20:16)+f>>2])break i;A=0;break f}i=n[f+8>>2],n[i+12>>2]=A,n[A+8>>2]=i;break f}for(b=A?f+20|0:f+16|0;o=b,b=(i=n[(A=i)+20>>2])?A+20|0:A+16|0,i=n[(i?20:16)+A>>2];);n[o>>2]=0}f:if(t){i:{i=76548+(n[f+28>>2]<<2)|0;e:{if(n[i>>2]!=(0|f)){if(n[t+16>>2]!=(0|f)){if(n[t+20>>2]=A,A)break e;break f}if(n[t+16>>2]=A,A)break e;break f}if(n[i>>2]=A,!A)break i}if(n[A+24>>2]=t,(i=n[f+16>>2])&&(n[A+16>>2]=i,n[i+24>>2]=A),!(i=n[f+20>>2]))break f;n[A+20>>2]=i,n[i+24>>2]=A;break f}g=76960,w=n[19240]&Oe(n[f+28>>2]),n[g>>2]=w}f:if(a>>>0>=16){if(n[f+4>>2]=3|k,n[(A=f+k|0)+4>>2]=1|a,n[A+a>>2]=a,a>>>0>=256){oA(A,a);break f}(i=n[19239])&(b=1<<(a>>>3))?(i=(b=248&a)+76692|0,a=n[b+76700>>2]):(n[19239]=i|b,i=a=76692+(248&a)|0),n[i+8>>2]=A,n[a+12>>2]=A,n[A+12>>2]=i,n[A+8>>2]=a}else A=a+k|0,n[f+4>>2]=3|A,n[(A=A+f|0)+4>>2]=1|n[A+4>>2];if(a=f+8|0)break A}}}r:{f:{i:{e:{a:{n:{b:{if((f=n[19241])>>>0>>0){if((A=n[19242])>>>0<=k>>>0){if(a=0,A=r+4|0,!(f=47+((f=n[19250])+k|0)&0-f)||(b=u[77105],e[77105]=1,i=77120,f>>>0>53952|b)?(i=0,b=0,-1!=(0|(o=fa(0|(f=(f>>>16|0)+!!(65535&f)|0))))&&(b=(0|(i=o<<16))==(0-(f<<=16)|0)?f-16|0:f)):b=53952,n[A+8>>2]=0,n[A+4>>2]=b,n[A>>2]=i,!(f=n[r+4>>2]))break A;o=n[r+12>>2],A=(b=n[r+8>>2])+n[19245]|0,n[19245]=A,i=n[19246],n[19246]=A>>>0>i>>>0?A:i;k:{o:{if(i=n[19244]){for(A=76676;;){if((0|f)==((a=n[A>>2])+(t=n[A+4>>2])|0))break o;if(!(A=n[A+8>>2]))break}break k}if(!(A=n[19248])|A>>>0>f>>>0)break e;break f}if(!(i>>>0>>0|f>>>0<=i>>>0)&&(!(1&(a=n[A+12>>2]))&&(0|o)==(a>>>1|0)))break b}A=n[19248],n[19248]=A>>>0>>0?A:f,a=f+b|0,A=76676;k:{o:{t:{for(;;){if((0|(t=n[A>>2]))!=(0|a)){if(A=n[A+8>>2])continue;break t}break}if(!(1&(a=n[A+12>>2]))&&(0|o)==(a>>>1|0))break o}for(A=76676;;){if((a=n[A>>2])>>>0<=i>>>0&&(t=a+n[A+4>>2]|0)>>>0>i>>>0)break k;A=n[A+8>>2]}}if(n[A>>2]=f,n[A+4>>2]=b+n[A+4>>2],n[(i=(f+15&-8)-8|0)+4>>2]=3|k,a=(f=(t+15&-8)-8|0)-(A=i+k|0)|0,n[19244]==(0|f))break n;if(n[19243]==(0|f))break a;if(1==(3&(k=n[f+4>>2]))&&(iA(f,b=-8&k),k=n[(f=f+b|0)+4>>2],a=a+b|0),n[f+4>>2]=-2&k,n[A+4>>2]=1|a,n[A+a>>2]=a,a>>>0>=256){oA(A,a);break i}(f=n[19239])&(b=1<<(a>>>3))?(k=(f=248&a)+76692|0,a=n[f+76700>>2]):(n[19239]=f|b,k=a=76692+(248&a)|0),n[k+8>>2]=A,n[a+12>>2]=A,n[A+12>>2]=k,n[A+8>>2]=a;break i}for(a=(A=f+15&-8)-8|0,n[19244]=a,c=8+((B=f-A|0)+(A=b-40|0)|0)|0,n[19242]=c,n[a+4>>2]=1|c,n[4+(A+f|0)>>2]=40,n[19247]=2097152,n[(a=(A=(t-32&-8)-8|0)>>>0>>0?i:A)+4>>2]=27,c=n[19169],Q=n[19170],B=n[19172],n[(A=a+16|0)>>2]=n[19171],n[A+4>>2]=B,n[(A=a+8|0)>>2]=c,n[A+4>>2]=Q,n[19172]=o,n[19170]=b,n[19169]=f,n[19171]=A,A=a+28|0;n[A>>2]=7,t>>>0>(A=A+4|0)>>>0;);if((0|i)==(0|a))break r;if(n[a+4>>2]=-2&n[a+4>>2],A=a-i|0,n[i+4>>2]=1|A,n[a>>2]=A,A>>>0>=256){oA(i,A);break r}(f=n[19239])&(b=1<<(A>>>3))?(f=(A&=248)+76692|0,A=n[A+76700>>2]):(n[19239]=f|b,f=A=76692+(248&A)|0),n[f+8>>2]=i,n[A+12>>2]=i,n[i+12>>2]=f,n[i+8>>2]=A;break r}f=A-k|0,n[19242]=f,i=(A=n[19244])+k|0,n[19244]=i,n[i+4>>2]=1|f,n[A+4>>2]=3|k,a=A+8|0;break A}A=n[19243],(i=f-k|0)>>>0<=15?(n[19243]=0,n[19241]=0,n[A+4>>2]=3|f,n[(f=A+f|0)+4>>2]=1|n[f+4>>2]):(n[19241]=i,b=A+k|0,n[19243]=b,n[b+4>>2]=1|i,n[A+f>>2]=i,n[A+4>>2]=3|k),a=A+8|0;break A}n[A+4>>2]=b+t,i=(f=(A=n[19244])+15&-8)-8|0,n[19244]=i,b=8+((o=A-f|0)+(f=b+n[19242]|0)|0)|0,n[19242]=b,n[i+4>>2]=1|b,n[4+(A+f|0)>>2]=40,n[19247]=2097152;break r}n[19244]=A,f=n[19242]+a|0,n[19242]=f,n[A+4>>2]=1|f;break i}n[19243]=A,f=n[19241]+a|0,n[19241]=f,n[A+4>>2]=1|f,n[A+f>>2]=f;break i}n[19248]=f;break f}a=i+8|0;break A}n[19172]=o,n[19170]=b,n[19169]=f,n[19176]=76692,n[19178]=76700,n[19175]=76692,n[19180]=76708,n[19177]=76700,n[19182]=76716,n[19179]=76708,n[19184]=76724,n[19181]=76716,n[19186]=76732,n[19183]=76724,n[19188]=76740,n[19185]=76732,n[19190]=76748,n[19187]=76740,A=n[19251],n[19249]=A||-1,n[19192]=76756,n[19189]=76748,n[19191]=76756,n[19194]=76764,n[19193]=76764,n[19196]=76772,n[19195]=76772,n[19198]=76780,n[19197]=76780,n[19200]=76788,n[19199]=76788,n[19202]=76796,n[19201]=76796,n[19204]=76804,n[19206]=76812,n[19203]=76804,n[19205]=76812,n[19208]=76820,n[19210]=76828,n[19207]=76820,n[19209]=76828,n[19212]=76836,n[19211]=76836,n[19214]=76844,n[19213]=76844,n[19216]=76852,n[19215]=76852,n[19218]=76860,n[19217]=76860,n[19220]=76868,n[19219]=76868,n[19222]=76876,n[19221]=76876,n[19224]=76884,n[19223]=76884,n[19226]=76892,n[19228]=76900,n[19225]=76892,n[19230]=76908,n[19227]=76900,n[19232]=76916,n[19229]=76908,n[19234]=76924,n[19231]=76916,n[19236]=76932,n[19233]=76924,n[19238]=76940,n[19235]=76932,i=(A=f+15&-8)-8|0,n[19244]=i,n[19237]=76940,b=8+((o=f-A|0)+(A=b-40|0)|0)|0,n[19242]=b,n[i+4>>2]=1|b,n[4+(A+f|0)>>2]=40,n[19247]=2097152}a=0,(A=n[19242])>>>0<=k>>>0||(f=A-k|0,n[19242]=f,i=(A=n[19244])+k|0,n[19244]=i,n[i+4>>2]=1|f,n[A+4>>2]=3|k,a=A+8|0)}return N=r+16|0,a}function F(A,r,f,i){var b,k=0,o=0,t=0,Q=0,w=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,h=0,W=0,U=0,z=0,F=0,J=0,j=0,R=0,V=0,X=0,T=0,H=0,O=0,x=0,p=0,S=0,_=0,P=0,$=0,AA=0,rA=0,iA=0,eA=0,bA=0,kA=0,oA=0,tA=0,cA=0,uA=0,BA=0,vA=0,QA=0,gA=0,wA=0,lA=0,MA=0,YA=0,GA=0,DA=0,ZA=0,dA=0,IA=0,yA=0,WA=0,CA=0,zA=0,FA=0,VA=0,XA=0,HA=0,OA=0,xA=0,LA=0,pA=0,SA=0,_A=0,KA=0,PA=0,qA=0,$A=0,Ar=0,rr=0,fr=0,ir=0,er=0,ar=0,nr=0,br=0,kr=0,or=0,tr=0,cr=0,Br=0,vr=0,Qr=0,gr=0,Er=0,Mr=0,Yr=0,sr=0,Gr=0,Dr=0,Zr=0,dr=0,Ir=0,Nr=0,mr=0,yr=0,Wr=0,Cr=0,Fr=0,jr=0,Vr=0,Xr=0,Hr=0,Or=0,Sr=0;for(N=b=N-2528|0;o=Z,6!=(0|(M=M+1|0));)V<<=8,Z=1,f>>>0<=s>>>0||(V=u[r+s|0]|V,s=s+1|0,Z=o);for(e[b+36|0]=o,n[b+32>>2]=-1,n[b+28>>2]=V,n[b+24>>2]=s,n[b+20>>2]=f,n[b+16>>2]=r,fi(b+1344|0,7168),fi(b+1356|0,65536),V=0,Ei(j=b+1368|0,16),Ei(Y=b+1404|0,4),fi(b+1440|0,o=i?6:0),fi(b+1452|0,E=i?3:0),Jr(b+1488|0,E),Ti(b+40|0,E),n[b+1472>>2]=n[b+48>>2],r=n[b+44>>2],n[b+1464>>2]=n[b+40>>2],n[b+1468>>2]=r,r=n[b+56>>2],n[b+1476>>2]=n[b+52>>2],n[b+1480>>2]=r,n[b+1484>>2]=n[b+60>>2],oe(b- -64|0),fi(b+1524|0,H=i?64:0),fi(b+1536|0,o),Jr(M=b+1548|0,G=i?8:0),Ti(Z=b+1584|0,G),fi(b+1644|0,r=i?16:0),fi(b+1656|0,f=i?4:0),fi(b+1668|0,f),Ti(W=b+1680|0,E),Ti(s=b+1744|0,E),Ti(U=b+1808|0,o),fi(b+1868|0,G),fi(b+1880|0,r),fi(b+1892|0,G),fi(b+1904|0,G),Ti(O=b+1916|0,i?18:0),fi(b+1976|0,o),Ti(I=b+1988|0,i?9:0),Ti(D=b+2048|0,i?54:0),Ti(t=b+2112|0,i?108:0),fi(b+2172|0,G),fi(b+2184|0,r=i?96:0),fi(b+2196|0,r),fi(b+2208|0,r=i?216:0),fi(b+2220|0,r),li(w=b+2232|0,r=i?144:0),li(G=b+2268|0,r),Ti(E=b+2304|0,i?2:0),fi(b+2368|0,f),Ti(o=b+2380|0,f),Ti(f=b+2440|0,!!(0|i)),fi(b+2504|0,H),fi(b+2516|0,i?24:0),n[b+128>>2]=n[b+1352>>2],r=n[b+1348>>2],n[b+120>>2]=n[b+1344>>2],n[b+124>>2]=r,r=n[b+1360>>2],n[b+132>>2]=n[b+1356>>2],n[b+136>>2]=r,n[b+140>>2]=n[b+1364>>2],Je(H=b+144|0,j,36),Je(b+180|0,Y,36),n[b+224>>2]=n[b+1448>>2],r=n[b+1444>>2],n[b+216>>2]=n[b+1440>>2],n[b+220>>2]=r,r=n[b+1456>>2],n[b+228>>2]=n[b+1452>>2],n[b+232>>2]=r,n[b+236>>2]=n[b+1460>>2],Je(b+240|0,b+1464|0,60),n[b+308>>2]=n[b+1532>>2],r=n[b+1528>>2],n[b+300>>2]=n[b+1524>>2],n[b+304>>2]=r,r=n[b+1540>>2],n[b+312>>2]=n[b+1536>>2],n[b+316>>2]=r,n[b+320>>2]=n[b+1544>>2],Je(b+324|0,M,36),Je(b+360|0,Z,60),n[b+428>>2]=n[b+1652>>2],r=n[b+1648>>2],n[b+420>>2]=n[b+1644>>2],n[b+424>>2]=r,r=n[b+1660>>2],n[b+432>>2]=n[b+1656>>2],n[b+436>>2]=r,n[b+440>>2]=n[b+1664>>2],r=n[b+1672>>2],n[b+444>>2]=n[b+1668>>2],n[b+448>>2]=r,n[b+452>>2]=n[b+1676>>2],Je(b+456|0,W,60),Je(b+516|0,s,60),Je(b+576|0,U,60),n[b+644>>2]=n[b+1876>>2],r=n[b+1872>>2],n[b+636>>2]=n[b+1868>>2],n[b+640>>2]=r,r=n[b+1884>>2],n[b+648>>2]=n[b+1880>>2],n[b+652>>2]=r,n[b+656>>2]=n[b+1888>>2],r=n[b+1896>>2],n[b+660>>2]=n[b+1892>>2],n[b+664>>2]=r,n[b+668>>2]=n[b+1900>>2],r=n[b+1908>>2],n[b+672>>2]=n[b+1904>>2],n[b+676>>2]=r,n[b+680>>2]=n[b+1912>>2],Je(b+684|0,O,60),n[b+752>>2]=n[b+1984>>2],r=n[b+1980>>2],n[b+744>>2]=n[b+1976>>2],n[b+748>>2]=r,Je(b+756|0,I,60),Je(b+816|0,D,60),Je(b+876|0,t,60),n[b+944>>2]=n[b+2180>>2],r=n[b+2176>>2],n[b+936>>2]=n[b+2172>>2],n[b+940>>2]=r,r=n[b+2188>>2],n[b+948>>2]=n[b+2184>>2],n[b+952>>2]=r,n[b+956>>2]=n[b+2192>>2],r=n[b+2200>>2],n[b+960>>2]=n[b+2196>>2],n[b+964>>2]=r,n[b+968>>2]=n[b+2204>>2],r=n[b+2212>>2],n[b+972>>2]=n[b+2208>>2],n[b+976>>2]=r,n[b+980>>2]=n[b+2216>>2],n[b+992>>2]=n[b+2228>>2],r=n[b+2224>>2],n[b+984>>2]=n[b+2220>>2],n[b+988>>2]=r,Je(b+996|0,w,36),Je(b+1032|0,G,36),Je(b+1068|0,E,60),n[b+1136>>2]=n[b+2376>>2],r=n[b+2372>>2],n[b+1128>>2]=n[b+2368>>2],n[b+1132>>2]=r,Je(b+1140|0,o,60),Je(b+1200|0,f,60),n[b+104>>2]=0,n[b+108>>2]=0,n[b+1316>>2]=0,n[b+1308>>2]=0,n[b+1312>>2]=4,n[b+1300>>2]=4,n[b+1304>>2]=0,n[b+1292>>2]=0,n[b+1296>>2]=0,n[b+1284>>2]=0,n[b+1288>>2]=8,n[b+112>>2]=0,n[b+116>>2]=0,n[b+1320>>2]=0,n[b+1324>>2]=4,n[b+96>>2]=0,n[b+100>>2]=0,n[b+88>>2]=0,n[b+92>>2]=4,n[b+80>>2]=2,n[b+84>>2]=0,n[b+72>>2]=0,n[b+76>>2]=0,n[b+64>>2]=0,n[b+68>>2]=4,n[b+56>>2]=4,n[b+60>>2]=0,n[b+48>>2]=0,n[b+52>>2]=0,n[b+40>>2]=0,n[b+44>>2]=1,r=n[b+2508>>2],n[b+1260>>2]=n[b+2504>>2],n[b+1264>>2]=r,n[b+1268>>2]=n[b+2512>>2],r=n[b+2520>>2],n[b+1272>>2]=n[b+2516>>2],n[b+1276>>2]=r,n[b+1280>>2]=n[b+2524>>2],n[b+1336>>2]=0,n[b+1340>>2]=0,n[b+1328>>2]=0,n[b+1332>>2]=0,n[b+2328>>2]=0,n[b+2320>>2]=0,n[b+2324>>2]=0,n[b+2312>>2]=0,n[b+2316>>2]=0,n[b+2304>>2]=0,n[b+2308>>2]=0,o=b+88|0,G=b+132|0,f=b+120|0;28!=(0|V);)Or=(b+2304|0)+V|0,Sr=uf(f,b+16|0,V),e[0|Or]=Sr,V=V+1|0;r=K(H,b+16|0,0);A:{r:if(!(!(f=C)&r>>>0>2097152|f)){if(n[b+1340>>2]=r,FA=r>>>0>>0?r:i){if(Lr(D=b+2440|0),n[b+2448>>2]=0,(t=1<<((r=(r=32-l(r<<7)|0)>>>0<=14?14:r)>>>0>=21?21:r))>>>0<=(r=n[D+8>>2])>>>0)n[D+8>>2]=t;else{di(D,w=t-r|0),f=(E=w>>>0<=1?1:w)-1|0,r=n[D+8>>2],i=n[D+4>>2]+(r<<2)|0;f:{for(;;){if(!f){if(f=r+E|0,!w){f=f-1|0;break f}break}n[i>>2]=0,f=f-1|0,i=i+4|0}n[i>>2]=0}n[D+8>>2]=f}n[b+2056>>2]=n[b+2448>>2],r=n[b+2444>>2],n[b+2048>>2]=n[b+2440>>2],n[b+2052>>2]=r,ei(b+40|0),r=n[b+2052>>2],n[o>>2]=n[b+2048>>2],n[o+4>>2]=r,n[o+8>>2]=n[b+2056>>2],n[b+80>>2]=2,n[b+84>>2]=0,n[b+72>>2]=0,n[b+76>>2]=0,n[b+64>>2]=0,n[b+68>>2]=4,n[b+56>>2]=4,n[b+60>>2]=0,n[b+48>>2]=0,n[b+52>>2]=0,n[b+40>>2]=0,n[b+44>>2]=1,n[b+100>>2]=t-1}hr(b+8|0,5,4,12),n[b+1816>>2]=0,r=n[b+12>>2],n[b+1808>>2]=n[b+8>>2],n[b+1812>>2]=r,s=0;f:{i:{e:{for(;;){a:{n:{if(5!=(0|s)){if(r=K(H,b+16|0,1),!C&r>>>0<=1048576)break n;break i}if(oA=K(H,r=b+16|0,6),nr=f=C,!f&oA>>>0>2097152|f)break i;if(EA(b+2440|0,b+40|0,r,0),f=u[b+2444|0],-1==(0|(r=n[b+2440>>2]))){oA=255&f;break f}if(i=u[b+2448|0]|u[b+2449|0]<<8|u[b+2450|0]<<16|u[b+2451|0]<<24,e[b+1924|0]=i,e[b+1925|0]=i>>>8,e[b+1926|0]=i>>>16,e[b+1927|0]=i>>>24,i=u[b+2445|0]|u[b+2446|0]<<8|u[b+2447|0]<<16|u[b+2448|0]<<24,e[b+1921|0]=i,e[b+1922|0]=i>>>8,e[b+1923|0]=i>>>16,e[b+1924|0]=i>>>24,e[b+1920|0]=f,n[b+1916>>2]=r,EA(b+2440|0,b+40|0,b+16|0,2),f=u[b+2444|0],-1==(0|(r=n[b+2440>>2]))){oA=255&f;break e}for(i=u[b+2448|0]|u[b+2449|0]<<8|u[b+2450|0]<<16|u[b+2451|0]<<24,e[b+1996|0]=i,e[b+1997|0]=i>>>8,e[b+1998|0]=i>>>16,e[b+1999|0]=i>>>24,i=u[b+2445|0]|u[b+2446|0]<<8|u[b+2447|0]<<16|u[b+2448|0]<<24,e[b+1993|0]=i,e[b+1994|0]=i>>>8,e[b+1995|0]=i>>>16,e[b+1996|0]=i>>>24,e[b+1992|0]=f,n[b+1988>>2]=r,hr(b,FA,8,56),r=n[b+4>>2],n[b+2048>>2]=n[b>>2],n[b+2052>>2]=r,br=b+2440|5,M=0,V=0,Z=1;;){n[b+2056>>2]=M;b:{k:{o:{if((0|V)!=(0|FA)){if(u[b+36|0])break o;$=b+2440|0,kr=n[b+2052>>2],xA=M,f=0,M=0,h=0,o=0,w=0,d=0,s=0,E=0,I=0,R=0,F=0,D=0,j=0,AA=0,t=0,U=0,rA=0,O=0,X=0,H=0,_=0,LA=0,dA=0,N=k=N-880|0;t:{c:{if(aA(m=b+16|0,i=(Q=b+40|0)+176|0,r=Z<<1)){if(!aA(m,i,1|r)){r=K(VA=Q+104|0,m,3),y=C;u:if(!(!(y=(r=r+1|0)?y:y+1|0)&r>>>0>65535|y)){e[k+296|0]=0,je(k+216|0,64),or=f=n[Q+76>>2],f=(i=(pA=n[Q+72>>2])+1|0)?f:f+1|0,n[Q+72>>2]=i,n[Q+76>>2]=f,n[k+288>>2]=0,n[k+292>>2]=0,n[k+208>>2]=0,n[k+200>>2]=0,n[k+192>>2]=0,n[k+280>>2]=-1,n[k+284>>2]=-1,tr=r,Xf(k+308|0,r),Tf(k+320|0,r),n[k+340>>2]=0,n[k+332>>2]=0,n[k+336>>2]=1,n[k+352>>2]=0,n[k+344>>2]=0,n[k+348>>2]=4,n[k+364>>2]=0,n[k+356>>2]=0,n[k+360>>2]=4,SA=Q+1256|0,cr=Q+992|0,Br=Q+944|0,vr=Q+956|0,Qr=Q+932|0,gr=Q+920|0,Er=Q+908|0,Mr=Q+896|0,Yr=Q+1232|0,_A=Q+36|0,sr=Q+1220|0,IA=Q+24|0,GA=Q+12|0,tA=Q+1280|0,Gr=Q+836|0,Dr=Q+776|0,Zr=Q+608|0,KA=Q+716|0,dr=Q+704|0,PA=Q+644|0,Ir=Q+632|0,Nr=Q+620|0,mr=Q+596|0,qA=Q+320|0,$A=Q+416|0,yr=Q+404|0,Ar=Q+536|0,Wr=Q+380|0,rr=Q+476|0,Cr=Q+392|0,fr=Q+284|0,yA=Q+272|0,ir=Q+260|0,x=Q+1244|0,Fr=k+756|0,jr=k+708|0,Vr=k+752|0,er=k+516|0,gA=k+504|0,wA=k+492|0,DA=k+480|0,Xr=k+456|5,Hr=k+536|5,cA=k+565|0,J=k+699|0,uA=k+733|0,XA=k+844|0,HA=k+596|0,iA=k+572|0,WA=k+544|0,eA=k+584|0,CA=k+560|0,BA=k+760|0,OA=k+652|0;B:{v:{Q:for(;;){g:{w:{l:{E:{M:{if((0|rA)!=(0|tr)){if(u[m+20|0]){f=0;break B}if(rA?(f=0,r=0,dA&&(r=ki(x,AA,68868),M=n[r+4>>2],r=n[r>>2]),n[k+196>>2]=M,n[k+192>>2]=r,v[Q+1276>>2]>rA>>>0&&(d=n[n[Q+1272>>2]+(rA<<2)>>2],f=1),n[k+204>>2]=d,n[k+200>>2]=f,Y=0,dA&&(i=ki(x,AA,68884),R=n[i+12>>2],Y=n[i+8>>2])):(Y=0,f=0,n[Q+1276>>2]&&(d=n[n[Q+1272>>2]>>2],f=1),n[k+204>>2]=d,n[k+200>>2]=f,n[k+196>>2]=d,n[k+192>>2]=f,M=d,r=f),n[k+212>>2]=R,n[k+208>>2]=Y,n[k+292>>2]=rA,n[k+368>>2]=2,i=!rA|(255&s)<<1,r&&aA(m,ir,i))break M;if(aA(m,ir,8+(i<<1|r)|0))break E;if(r=K(VA,m,rA?5:4),f=C,!(f=(p=r+1|0)?f:f+1|0)&p>>>0>=65536|f)break g;if(JA(k+728|0,p),jA(k+800|0,p),jA(k+816|0,p),(I=f|p?1+(-1>>>l((p<<3)-1|0)|0)|0:1)>>>0>v[Q+1288>>2])if(n[k+752>>2]=0,n[k+756>>2]=0,n[k+744>>2]=0,n[k+748>>2]=0,i=k+744|0,(r=n[tA+8>>2])>>>0>=I>>>0)n[tA+8>>2]=I;else{Ni(tA,w=I-r|0),r=(G=w>>>0<=1?1:w)-1|0,E=n[tA+8>>2],f=n[tA+4>>2]+(E<<4)|0;Y:{for(;;){if(!r){if(r=E+G|0,!w){r=r-1|0;break Y}break}o=n[i+12>>2],n[f+8>>2]=n[i+8>>2],n[f+12>>2]=o,o=n[i+4>>2],n[f>>2]=n[i>>2],n[f+4>>2]=o,r=r-1|0,f=f+16|0}o=n[i+12>>2],n[f+8>>2]=n[i+8>>2],n[f+12>>2]=o,o=n[i+4>>2],n[f>>2]=n[i>>2],n[f+4>>2]=o}n[tA+8>>2]=r}if(n[Q+1292>>2]=I-1,-1!=(0|(i=n[Q+1296>>2])))break l;for(r=n[Q+1288>>2]<<4,i=n[Q+1284>>2];;){if(r){n[i+8>>2]=0,n[i+12>>2]=0,n[i>>2]=0,n[i+4>>2]=0,r=r-16|0,i=i+16|0;continue}i=0;break l}}if(n[k+376>>2]=n[k+316>>2],r=n[k+312>>2],n[k+368>>2]=n[k+308>>2],n[k+372>>2]=r,ge(Q+1268|0),n[Q+1276>>2]=n[k+376>>2],r=n[k+372>>2],n[Q+1268>>2]=n[k+368>>2],n[Q+1272>>2]=r,n[k+632>>2]=u[k+325|0]|u[k+326|0]<<8|u[k+327|0]<<16|u[k+328|0]<<24,r=u[k+328|0]|u[k+329|0]<<8|u[k+330|0]<<16|u[k+331|0]<<24,e[k+635|0]=r,e[k+636|0]=r>>>8,e[k+637|0]=r>>>16,e[k+638|0]=r>>>24,r=n[k+336>>2],n[k+616>>2]=n[k+332>>2],n[k+620>>2]=r,n[k+624>>2]=n[k+340>>2],f=u[k+324|0],G=n[k+344>>2],D=n[k+348>>2],t=n[k+352>>2],r=n[k+320>>2],n[k+168>>2]=n[k+364>>2],i=n[k+360>>2],n[k+160>>2]=n[k+356>>2],n[k+164>>2]=i,-1==(0|r))break u;if(n[k+184>>2]=n[k+168>>2],i=n[k+164>>2],n[k+176>>2]=n[k+160>>2],n[k+180>>2]=i,t){if(M=i=n[D>>2],(0|(w=D+(t<<2)|0))!=(0|(Z=h=D+4|0)))for(d=w-Z>>>2|0;M=(0|(o=n[Z>>2]))>(0|M)?M:o,Z=Z+4|0,d=d-1|0;);if(E=(0|M)>0?M:0,(0|w)!=(0|h))for(M=w-h>>>2|0;i=(0|i)>(0|(o=n[h>>2]))?i:o,h=h+4|0,M=M-1|0;);w=i>>31}else E=0,i=0,w=0;o=i,e[k+116|0]=f,n[k+112>>2]=r,f=n[k+632>>2],e[k+117|0]=f,e[k+118|0]=f>>>8,e[k+119|0]=f>>>16,e[k+120|0]=f>>>24,f=u[k+635|0]|u[k+636|0]<<8|u[k+637|0]<<16|u[k+638|0]<<24,e[k+120|0]=f,e[k+121|0]=f>>>8,e[k+122|0]=f>>>16,e[k+123|0]=f>>>24,f=n[k+620>>2],n[k+124>>2]=n[k+616>>2],n[k+128>>2]=f,n[k+132>>2]=n[k+624>>2],n[k+144>>2]=t,n[k+140>>2]=D,n[k+136>>2]=G,f=n[k+180>>2],n[k+148>>2]=n[k+176>>2],n[k+152>>2]=f,n[k+156>>2]=n[k+184>>2],i=1;break c}r=E,ur(t=k+744|0,Q,M,i=k+192|0,f=(E=Gi(Q,M,i))?r:0,I=E?I:0,r=E?o:0,D=E?w:0,E),G=n[k+752>>2],E=n[k+756>>2],o=n[k+744>>2],i=n[k+748>>2],w=ki(x,M,67528),n[BA>>2]=0,n[BA+4>>2]=0,n[BA+8>>2]=0,n[BA+12>>2]=0,n[BA+16>>2]=0,n[BA+20>>2]=0,n[BA+24>>2]=0,n[BA+28>>2]=0,n[k+792>>2]=0,n[k+796>>2]=w,n[k+752>>2]=r,n[k+756>>2]=D,n[k+744>>2]=f,n[k+748>>2]=I,sA(k+640|0,t,o,i,G,E),be(CA,w+40|0),n[eA+8>>2]=n[OA+8>>2],i=n[OA+4>>2],n[eA>>2]=n[OA>>2],n[eA+4>>2]=i,i=n[k+644>>2],n[iA>>2]=n[k+640>>2],n[iA+4>>2]=i,n[iA+8>>2]=n[k+648>>2],n[k+552>>2]=r,n[k+556>>2]=D,n[k+544>>2]=f,n[k+548>>2]=I,n[k+540>>2]=M,i=1,n[k+536>>2]=1,e[k+609|0]=2,e[k+608|0]=!(r|f|D|I),n[k+604>>2]=0,n[k+596>>2]=0,n[k+600>>2]=4;break w}i=0,n[k+736>>2]=0,n[k+728>>2]=0,n[k+732>>2]=0,n[k+776>>2]=R,n[k+772>>2]=Y,n[k+768>>2]=d,n[k+764>>2]=f,n[k+760>>2]=M,n[k+756>>2]=r,n[k+752>>2]=3,n[k+744>>2]=1,d=0;E:{M:{Y:{for(;;){r=(i<<3)+Vr|0;s:{for(;;){if(3==(0|i))break s;if(i=i+1|0,f=r+4|0,r=r+8|0,1==n[f>>2])break}if(f=n[r>>2],n[k+832>>2]=f,Yi(k+96|0,r=k+728|0,d,67960),mA(n[k+96>>2],n[k+100>>2],k+832|0))continue;if(d>>>0>2)break Y;n[r+(d<<2)>>2]=f,d=d+1|0;continue}break}Yi(k+88|0,k+728|0,d,67752),f=n[k+88>>2];s:{G:{D:{Z:{if(3!=(0|(i=n[k+92>>2]))){if(!i)break Z;r=i-!!(0|i)|0}else r=3;if(aA(m,yA,r))break D}if(h)break G;i=8;break M}D:switch(i-1|0){case 1:if(M=n[f+4>>2],aA(m,yA,2))break E;case 0:M=n[f>>2];break E;default:break D}if(M=n[f>>2],!aA(m,yA,4))break E;if(i>>>0<3)break s;if(M=n[f+8>>2],aA(m,yA,5))break E;M=n[f+4>>2];break E}if(h>>>0<=4){i=9;break M}if(h>>>0<9){i=10;break M}if(h>>>0<13){i=11;break M}if(h>>>0<17){i=12;break M}if(h>>>0<25){i=13;break M}i=h>>>0<41?14:15;break M}Ur(2,i,67768),c()}Ur(d,3,67976),c()}if(r=K(VA,m,i),f=C,r=K(fr,m,!(f=(i=(G=r+1|0)?f:f+1|0)>>>2|0)&(r=(3&i)<<30|G>>>2)>>>0>=3|f?3:r),t=C,i|G>>>0>=v[Q+1264>>2])break g;if(f=n[Q+1260>>2]+g(G,36)|0,!t&v[f+32>>2]<=r>>>0|t)break g;if(hA(k+80|0,f,r),1!=n[k+80>>2])break g;M=n[k+84>>2]}y=(r=(F=n[ki(x,M,67784)+48>>2])>>>2|0)>>>0>=3?3:r,z=Gi(Q,M,k+192|0);E:{M:{Y:{s:{if(F>>>0>=v[Q+1264>>2]||(G=g(F,36),(i=n[32+(G+n[Q+1260>>2]|0)>>2])>>>0<=1||!aA(m,Cr,y))){if(d=0,aA(m,Wr,y|(o|E|w|I?4:0)|(z?8:0)))break s;h=1,Z=1,R=0,D=0,j=0,w=0,G=0,W=0,o=0}else{if(r=K(fr,m,4|y),!(f=C)&r>>>0>=i>>>0|f)break g;if((f=n[Q+1264>>2])>>>0<=F>>>0)break Y;if(hA(k+72|0,G+n[Q+1260>>2]|0,r),1!=n[k+72>>2])break g;if((0|(s=n[k+76>>2]))==(0|M))break g;if(i=ki(x,s,67816),f=ki(x,M,67832),r=n[i+48>>2],n[f+48>>2]!=(0|r))break g;if(Tr(n[i+44>>2],n[f+44>>2],r))break g;w=0,d=0,h=1,Z=0,R=1,D=xr(rr,m,0),j=r=C,G=xr(rr,m,r|D?2:1),W=C,o=0}O=0,X=0,vA=0,P=0,p=0,T=0;break E}if(G=0,W=0,h=0,r=xr(Ar,m,t=z?3:0),Y=(i=C)+(z?I:0)|0,p=f=r+(E=z?E:0)|0,T=f>>>0>>0?Y+1|0:Y,d=1,f=z?o:0,r=xr(Ar,m,t+(r|i?2:1)|0)+f|0,U=C+(z?w:0)|0,vA=r,P=r>>>0>>0?U+1|0:U,aA(m,yr,y))break M;Z=1,R=0,D=0,j=0,o=0,w=0,O=0,X=0;break E}Ur(F,f,67800),c()}Z=1,O=xr($A,m,0),X=r=C,o=xr($A,m,r|O?2:1),w=C,R=0,D=0,j=0}ur(k+744|0,Q,M,k+192|0,p,T,vA,P,z),E=n[k+744>>2],Y=n[k+748>>2],t=n[k+752>>2],U=n[k+756>>2],r=xr(qA,m,i=z?2:0),I=f=C,z=t,t=r,r=xr(qA,m,i|0!=(f|r)|4),f=C+U|0,r=r>>>0>(i=z+r|0)>>>0?f+1|0:f,f=ki(x,M,67848),s=R?ki(x,s,68900):0,n[k+792>>2]=s,n[k+796>>2]=f,n[k+784>>2]=o,n[k+788>>2]=w,n[k+776>>2]=O,n[k+780>>2]=X,n[k+768>>2]=G,n[k+772>>2]=W,n[k+760>>2]=D,n[k+764>>2]=j,n[k+752>>2]=vA,n[k+756>>2]=P,n[k+744>>2]=p,n[k+748>>2]=T,f=Y+I|0,sA(w=k+832|0,G=k+744|0,o=t+E|0,f=o>>>0>>0?f+1|0:f,i,r),n[k+808>>2]=n[k+840>>2],r=n[k+836>>2],n[k+800>>2]=n[k+832>>2],n[k+804>>2]=r,n[k+824>>2]=n[XA+8>>2],r=n[XA+4>>2],n[k+816>>2]=n[XA>>2],n[k+820>>2]=r,be(k+856|0,ki(x,M,67864)+40|0);E:{M:{Y:{s:{G:{D:{if(!((z=aA(m,mr,r=y<<1|d))|F>>>0<3)){if(!aA(m,Nr,r))break D;for(W=n[k+824>>2],U=n[k+820>>2],s=n[k+808>>2],D=n[k+804>>2],t=n[k+860>>2],i=0,JA(f=k+868|0,Y=n[k+864>>2]),r=1,Or=Di(f,0,68328),Sr=1,e[0|Or]=Sr,E=Y-2|0,o=t+1|0,f=(d=Y>>>0<=1?1:Y)-1|0;;){if((0|f)==(0|i)){Z:{for(o=0,w=0,RA(k+712|0,Y),RA(k+832|0,Y),i=1,E=0,I=0;;){f=i>>>0>Y>>>0?i:Y;d:{for(;;){if((0|f)==(0|i))break d;if(r=Di(k+868|0,i,68456),i=i+1|0,u[0|r])break}o=xr(PA,m,lr(o,w)),w=f=C,r=oi(k+712|0,G=i-1|0,68472),n[r>>2]=o,n[r+4>>2]=f,E=xr(PA,m,6+(lr(E,I)<<1|0!=(o|f))|0),I=f=C,r=oi(k+832|0,G,68488),n[r>>2]=E,n[r+4>>2]=f;continue}break}for(f=n[k+872>>2],r=n[k+876>>2],L(D,s,n[k+716>>2],n[k+720>>2],f,r),L(U,W,n[k+836>>2],n[k+840>>2],f,r),f=0,i=1;;){if((0|i)!=(0|d)){r=0,u[0|Di(k+868|0,i,68408)]||(o=0,w=0,E=0,I=0,aA(m,dr,(G=f<<1)+u[i+t|0]|0)||(o=xr(KA,m,f),w=r=C,E=xr(KA,m,3+(G+(0!=(r|o))|0)|0),I=C),f=oi(k+712|0,i,68424),r=n[f>>2],y=w+n[f+4>>2]|0,y=(r=r+o|0)>>>0>>0?y+1|0:y,n[f>>2]=r,n[f+4>>2]=y,f=oi(k+832|0,i,68440),r=n[f>>2],Y=I+n[f+4>>2]|0,Y=(r=r+E|0)>>>0>>0?Y+1|0:Y,n[f>>2]=r,n[f+4>>2]=Y,r=o|E|w|I?2:1),i=i+1|0,f=r;continue}for(i=1,R=W>>>0<=1?1:W,o=s>>>0<=1?1:s,r=D+4|0,f=U+4|0;;){if((0|i)==(0|d))break Z;if((0|i)==(0|o))break G;if(Or=r,Sr=n[r>>2]+n[oi(k+712|0,i,68360)>>2]|0,n[Or>>2]=Sr,(0|i)==(0|R))break;Or=f,Sr=n[f>>2]+n[oi(k+832|0,i,68392)>>2]|0,n[Or>>2]=Sr,i=i+1|0,r=r+4|0,f=f+4|0}Ur(R,W,68376),c()}}break}r=aA(m,Ir,(u[i+o|0]<<1)+(1&r?4:0)|(0|i)==(0|E)),Or=Di(k+868|0,i=i+1|0,68504),Sr=r,e[0|Or]=Sr}we(k+832|0),we(k+712|0),le(k+868|0);break Y}if(z)break s}for(i=1,F=F>>>0<=1?1:F,d<<=2,O=n[ti(k+800|0,0,67880)>>2],X=0,H=n[ti(k+816|0,0,67896)>>2],_=0,G=0,W=0,r=1,D=0,j=0,o=0,w=0,E=0,I=0;;){if((0|i)==(0|F))break Y;nA(k+832|0,k+744|0,i),s=n[k+840>>2],Y=n[k+844>>2],t=n[k+832>>2],U=n[k+836>>2],(r=aA(m,Zr,u[0|Di(k+856|0,i,67912)]+(r<<1|d)<<1|0!=(o|E|w|I)))?(D=0,j=0,G=0,W=0):(G=xr(Dr,m,wr(t,U,G,W,E,I)),W=C,D=xr(Gr,m,wr(s,Y,D,j,o,w)<<1|0!=(G|W)),f=Y+(j=C)|0,Y=(Y=s)>>>0>(s=D+s|0)>>>0?f+1|0:f,y=W+U|0,U=(f=t)>>>0>(t=t+G|0)>>>0?y+1|0:y),f=ti(k+800|0,i,67928),U=U+X|0,X=(y=O)>>>0>(O=t+O|0)>>>0?U+1|0:U,n[f>>2]=O,f=ti(k+816|0,i,67944),Y=Y+_|0,_=(t=H)>>>0>(H=s+H|0)>>>0?Y+1|0:Y,n[f>>2]=H,i=i+1|0,f=w+j|0,w=(o=o+D|0)>>>0>>0?f+1|0:f,f=I+W|0,I=(s=E)>>>0>(E=E+G|0)>>>0?f+1|0:f}}Ur(o,s,68344),c()}if(!h)break M;break E}if(h&z)break E}Z=0}n[iA+8>>2]=n[k+808>>2],r=n[k+804>>2],n[iA>>2]=n[k+800>>2],n[iA+4>>2]=r,r=n[k+820>>2],n[eA>>2]=n[k+816>>2],n[eA+4>>2]=r,n[eA+8>>2]=n[k+824>>2],r=n[k+860>>2],n[CA>>2]=n[k+856>>2],n[CA+4>>2]=r,n[CA+8>>2]=n[k+864>>2],i=1,e[k+609|0]=1,e[k+608|0]=Z,n[k+604>>2]=0,n[k+596>>2]=0,n[k+600>>2]=4,n[k+552>>2]=vA,n[k+556>>2]=P,n[k+544>>2]=p,n[k+548>>2]=T,n[k+540>>2]=M,n[k+536>>2]=1;break w}M=1,n[Q+1296>>2]=i+1,hr(k- -64|0,p,4,16),Z=0,n[k+864>>2]=0,r=n[k+68>>2],n[k+856>>2]=n[k+64>>2],n[k+860>>2]=r,G=0,W=0,vA=-1,s=0,ZA=0,h=1,E=0,I=0;l:for(;;){E:{if((0|Z)==(0|p)){if(f=n[k+804>>2],r=n[k+800>>2],e[0|J]=r,e[J+1|0]=r>>>8,e[J+2|0]=r>>>16,e[J+3|0]=r>>>24,e[J+4|0]=f,e[J+5|0]=f>>>8,e[J+6|0]=f>>>16,e[J+7|0]=f>>>24,r=n[k+808>>2],e[J+8|0]=r,e[J+9|0]=r>>>8,e[J+10|0]=r>>>16,e[J+11|0]=r>>>24,r=n[k+820>>2],n[k+680>>2]=n[k+816>>2],n[k+684>>2]=r,n[k+688>>2]=n[k+824>>2],r=n[k+860>>2],n[k+664>>2]=n[k+856>>2],n[k+668>>2]=r,n[k+672>>2]=n[k+864>>2],n[k+692>>2]=u[0|uA]|u[uA+1|0]<<8|u[uA+2|0]<<16|u[uA+3|0]<<24,r=u[uA+3|0]|u[uA+4|0]<<8|u[uA+5|0]<<16|u[uA+6|0]<<24,e[k+695|0]=r,e[k+696|0]=r>>>8,e[k+697|0]=r>>>16,e[k+698|0]=r>>>24,f=u[k+732|0],-1==(0|(o=n[k+728>>2])))break v;n[eA+8>>2]=n[k+688>>2],r=n[k+684>>2],n[eA>>2]=n[k+680>>2],n[eA+4>>2]=r,r=n[k+668>>2],n[HA>>2]=n[k+664>>2],n[HA+4>>2]=r,n[HA+8>>2]=n[k+672>>2],r=u[k+695|0]|u[k+696|0]<<8|u[k+697|0]<<16|u[k+698|0]<<24,e[cA+3|0]=r,e[cA+4|0]=r>>>8,e[cA+5|0]=r>>>16,e[cA+6|0]=r>>>24,r=n[k+692>>2],e[0|cA]=r,e[cA+1|0]=r>>>8,e[cA+2|0]=r>>>16,e[cA+3|0]=r>>>24,r=u[J+4|0]|u[J+5|0]<<8|u[J+6|0]<<16|u[J+7|0]<<24,n[iA>>2]=u[0|J]|u[J+1|0]<<8|u[J+2|0]<<16|u[J+3|0]<<24,n[iA+4>>2]=r,n[iA+8>>2]=u[J+8|0]|u[J+9|0]<<8|u[J+10|0]<<16|u[J+11|0]<<24,n[WA>>2]=0,n[WA+4>>2]=0,n[WA+8>>2]=0,n[WA+12>>2]=0,i=0,n[k+536>>2]=0,a[k+608>>1]=0,e[k+564|0]=f,n[k+560>>2]=o,M=u[k+540|0];break w}for(o=(Y=(r=Z-!!(0|Z)|0)>>>0>=4?4:r)<<4,fA(k+712|0,lA=n[k+732>>2],S=n[k+736>>2],ar=n[k+804>>2],bA=n[k+808>>2],MA=n[k+820>>2],z=n[k+824>>2],Z),(0|(w=n[k+864>>2]))==n[k+856>>2]&&rf(k+856|0),i=(Y<<2)+jr|0,T=Z+1|0,r=n[k+716>>2],f=n[k+860>>2]+(w<<4)|0,n[f>>2]=n[k+712>>2],n[f+4>>2]=r,r=n[k+724>>2],n[f+8>>2]=n[k+720>>2],n[f+12>>2]=r,n[k+864>>2]=w+1,r=16-(o+((ZA>>>0>=7?7:ZA)<<1)|0)|0,f=Y;;){if(y=r,w=0,o=-1,P=f,!f)break E;if(TA(k+56|0,tA,f,d=n[i>>2]),F=n[k+60>>2],r=n[k+56>>2]){w=r;break E}if(f=P-1|0,i=i-4|0,r=y+16|0,o=Rr(Q,d),!((0|C)<0))break}}for(e[k+752|0]=0,n[k+748>>2]=Y,n[k+744>>2]=1,d=n[Q+1296>>2],R=n[Q+1284>>2],Y=n[Q+1288>>2],r=n[Q+1292>>2];;){pr(k+48|0,k+744|0);E:{M:{Y:{s:{G:{D:{Z:{if(1==n[k+48>>2]){if((f=(zA=n[k+52>>2])-1|0)>>>0>=4)break Z;for(i=(f=n[(k+712|0)+(f<<2)>>2])^g(zA,-1640531535);;){if((i&=r)>>>0>=Y>>>0)break D;if((0|d)!=n[(QA=(i<<4)+R|0)+8>>2]|(0|f)==n[QA>>2]&(0|zA)==n[QA+4>>2])break E;i=i+1|0}}if(!P)break G;if(1&w?(i=u[0|Di(k+728|0,F,68040)],o=F-1|0,r=n[ti(r=k+800|0,F,68056)>>2]-n[ti(r,o,68072)>>2]|0,o=n[ti(f=k+816|0,F,68088)>>2]-n[ti(f,o,68104)>>2]|0):(i=u[0|Di(Q,o,67992)],r=n[ti(GA,o,68008)>>2],o=n[ti(IA,o,68024)>>2]),Y=o>>31,w=r>>31,!aA(m,sr,h-y|0)){ZA=0,H=o,_=Y,LA=i,O=r,X=w;break G}ZA=ZA+1|0,f=68296,M=68280,d=68264,G=r,W=w,E=o,I=Y,r=s;break s}Ur(f,4,68312),c()}Ur(i,Y,70220),c()}n[k+844>>2]=z,n[k+840>>2]=MA,n[k+836>>2]=bA,n[k+832>>2]=ar;G:{D:if(!(Z>>>0<3)&&(UA(k+40|0,k+832|0,w=Z-1|0),n[k+40>>2]|n[k+44>>2])){for(i=0;;){if(16==(0|i)){Z:for(i=0,r=vA;;){if(16!=(0|i)){UA(k+32|0,k+832|0,r),f=n[k+36>>2],n[(o=(k+744|0)+i|0)>>2]=n[k+32>>2],n[o+4>>2]=f,i=i+8|0,r=r-1|0;continue}R=Z+lA|0,Y=Z-3|0,r=0,bA=0;d:{for(;;){if(F=r,36==(0|bA))break D;MA=n[bA+70480>>2],z=n[bA+70476>>2];I:{N:{m:{y:{if(1==(0|(d=u[bA+70484|0])))for(i=-1640531535,r=-3,f=Fr;;){if(!(o=r+1|0))break y;if((y=r+Z|0)>>>0>=S>>>0)break m;i=g(u[r+R|0]^g(g(g(z,n[f-4>>2])^i,-2048144789)^g(MA,n[f>>2]),-1028477387),668265263),f=f-8|0,r=o}e[k+876|0]=0,n[k+868>>2]=1,n[k+872>>2]=2,i=-1640531535;h:{W:{for(;pr(k+24|0,k+868|0),1==n[k+24>>2];){if((f=(r=n[k+28>>2])-1|0)>>>0>=2)break W;if((r=Z-r|0)>>>0>=S>>>0)break h;o=u[r+lA|0],i=g(o^g(g(g(z,n[(r=(k+744|0)+(f<<3)|0)>>2])^i,-2048144789)^g(MA,n[r+4>>2]),-1028477387),668265263)}if(S>>>0<=(f=Y)>>>0)break N;break I}Ur(f,2,70528),c()}Ur(r,S,70544),c()}if(S>>>0>(f=w)>>>0)break I;Ur(f,S,70560),c()}Ur(y,S,70720),c()}Ur(Y,S,70512),c()}r=F+1|0,bA=bA+12|0,f=g(u[f+lA|0]^g(2^i,-775183833),668265263),TA(k+16|0,tA,2,f^=f>>>15);I:{N:{m:{y:{if(1&n[k+16>>2]){if(i=n[k+20>>2],d)break y;if(i>>>0>>0)break m}if(f=Rr(Q,f),(0|C)<0)continue;if(d)break I;r=n[ti(GA,f,70608)>>2],Y=n[ti(IA,f,70624)>>2],R=F<<3|4,i=Di(Q,f,70640);break Z}if(i>>>0<4)break N;if(UA(k,k+832|0,i-3|0),(f=i-4|0)>>>0>=S>>>0)break d;Y=n[k+4>>2],r=n[k>>2],i=f+lA|0,R=F<<3;break Z}if(UA(k+8|0,k+832|0,i),i>>>0>>0){Y=n[k+12>>2],r=n[k+8>>2],i=i+lA|0,R=F<<3;break Z}Ur(i,S,70576),c()}if(f=Rr(Q,f),(0|C)<0)continue}if(!(B[ci(_A,f,70656)>>1]<=3))break}R=F<<3|4,r=n[ti(GA,i=f-3|0,70672)>>2],Y=n[ti(IA,i,70688)>>2],i=Di(Q,f-4|0,70704);break Z}Ur(f,S,70592),c()}break}n[(r=(k+744|0)+i|0)>>2]=0,n[r+4>>2]=0,i=i+8|0}if(y=(w=g(Y,MA))>>31,Y=(o=g(r,z))>>31,i=u[0|i],r=0,f=0,!P)break G;if(f=2,(0|o)!=(0|O)|(0|Y)!=(0|X)|(255&LA)!=(255&i)|(0|w)!=(0|H)|(0|y)!=(0|_))break G}r=s;break Y}if(!aA(m,Yr,f|R|s))break Y;f=68152,M=68136,d=68120,G=o,W=Y,E=w,I=y,r=1}Or=Di(k+728|0,Z,d),Sr=i,e[0|Or]=Sr,o=ti(k+800|0,Z,M),y=W+j|0,j=(w=D)>>>0>(D=D+G|0)>>>0?y+1|0:y,n[o>>2]=D,f=ti(k+816|0,Z,f),U=I+U|0,U=(o=t)>>>0>(t=t+E|0)>>>0?U+1|0:U,n[f>>2]=t,i&=255;break M}Di(f=k+728|0,Z,68168),i=aA(m,Mr,((Z?0:4)+M|0)+(h<<1)|0),Or=Di(f,Z,68184),Sr=i,e[0|Or]=Sr,z=(((M<<2)+(((f=Z>>>0<2)?Z:2)<<3)|0)+h|0)+(i<<1)|0,o=0,w=0,Y=0,s=0,f||(s=0,i||(o=G,w=W,Y=I,s=E,M&&(o=h?0:o,w=h?0:w,Y=h?0:Y,s=h?0:E))),ti(k+800|0,Z,68200),ti(k+816|0,Z,68216),M=aA(m,Er,(d=!(E|I))|((f=z<<1)|!(G|W))<<1),P=aA(m,gr,(f|M)<<1|d),M||(f=(0|W)>0,y=(0|W)>=0,d=aA(m,Qr,(M=g(g(z,3)+(f|y&!!G?2:f|y)|0,3))+((f=(0|I)>0)|(y=(0|I)>=0)&!!E?2:f|y)|0),M=-1^(G=K(vr,m,lr(G,W)+g(z,6)|0)),f=C,G=G+1|0,y=w+(d?-1^f:G?f:f+1|0)|0,w=(f=o)>>>0>(o=o+(d?M:G)|0)>>>0?y+1|0:y),P||(f=(0|I)>0,y=(0|I)>=0,W=aA(m,Br,(M=g(g(z,3)+(f|y&!!E?2:f|y)|0,3))+((f=(0|w)>0)|(y=(0|w)>=0)&!!o?2:f|y)|0),I=-1^(E=K(cr,m,lr(E,I)+g(z,6)|0)),f=C,E=E+1|0,Y=Y+(W?-1^f:E?f:f+1|0)|0,Y=(f=s)>>>0>(s=s+(W?I:E)|0)>>>0?Y+1|0:Y),E=ti(k+800|0,Z,68232),f=w+j|0,j=(I=D)>>>0>(D=o+D|0)>>>0?f+1|0:f,n[E>>2]=D,E=ti(k+816|0,Z,68248),f=Y+U|0,U=(I=t)>>>0>(t=t+s|0)>>>0?f+1|0:f,n[E>>2]=t,G=Z?o:0,W=Z?w:0,E=Z?s:0,I=Z?Y:0}vA=vA+1|0,Z=T,s=r,M=h,h=i;continue l}n[QA+12>>2]=Z,n[QA+8>>2]=d,n[QA+4>>2]=zA,n[QA>>2]=f}}}rA=rA+1|0,Je(Xr,Hr,75),e[k+460|0]=M,n[k+456>>2]=i,h=n[k+488>>2],t=n[k+484>>2],U=n[k+496>>2],I=n[k+500>>2],D=n[k+508>>2],F=n[k+512>>2],G=n[k+520>>2],E=n[k+524>>2],s=0;w:for(;;){l:{E:{M:{Y:{s:{if((0|s)!=(0|h)){if(w=n[Q+8>>2],_f(_A,s),ri(Q,u[t+s|0]),!s){i=0,Kf(GA,0);break l}if(s>>>0>=I>>>0)break s;if(r=s-1<<2,Kf(GA,n[(f=s<<2)+U>>2]-n[r+U>>2]|0),s>>>0>=F>>>0)break Y;i=n[f+D>>2]-n[r+D>>2]|0;break l}if(_f(k+320|0,h),ke(k+332|0,n[k+484>>2],n[k+488>>2]),Pi(k+344|0,n[k+496>>2],n[k+500>>2]),Pi(k+356|0,n[k+508>>2],n[k+512>>2]),u[k+529|0]&&1==n[k+456>>2]?(r=ki(x,f=n[k+460>>2],67544),G=n[r+32>>2],W=n[r+36>>2],r=ki(x,f,67560),o=n[r+16>>2],w=n[r+20>>2],f=ki(x,f,67576),r=n[f+24>>2],f=n[f+28>>2]):(w=(o=n[ti(wA,0,67592)>>2])>>31,G=-1,W=-1,f=(r=n[ti(gA,0,67608)>>2])>>31),E=r,!(Z=u[k+528|0]&0!=u[k+529|0])){i=n[Q+1252>>2],r=n[DA+4>>2],n[k+536>>2]=n[DA>>2],n[k+540>>2]=r,n[k+544>>2]=n[DA+8>>2],Wf(k+744|0,n[k+496>>2],n[k+500>>2]),Wf(k+832|0,n[k+508>>2],n[k+512>>2]),(0|(M=n[Q+1252>>2]))==n[Q+1244>>2]&&(N=t=N-16|0,NA(t+8|0,x,n[x>>2],1,8,80),-1!=(0|(r=n[t+8>>2]))&&(_i(r,n[t+12>>2]),c()),N=t+16|0),t=n[Q+1248>>2]+g(M,80)|0,n[(r=t)+16>>2]=0,n[r+20>>2]=0,n[r+8>>2]=0,n[r>>2]=0,n[r+24>>2]=0,n[r+28>>2]=0,n[r+32>>2]=-1,n[r+36>>2]=-1,r=n[k+540>>2],n[t+40>>2]=n[k+536>>2],n[t+44>>2]=r,n[t+48>>2]=n[k+544>>2],r=n[k+748>>2],n[t+52>>2]=n[k+744>>2],n[t+56>>2]=r,n[t+60>>2]=n[k+752>>2],r=n[k+836>>2],n[t+64>>2]=n[k+832>>2],n[t+68>>2]=r,n[t+72>>2]=n[k+840>>2],n[t+76>>2]=0,n[Q+1252>>2]=M+1,q(ff(SA,h),i,n[Q+1248>>2],n[Q+1252>>2]);break E}if(!n[k+456>>2]){le(DA),ge(wA),ge(gA),Ee(er);break g}if(i=n[k+460>>2],t=ff(SA,h),(M=n[Q+1252>>2])>>>0<=i>>>0)break M;d=n[Q+1248>>2],zr(t,r=n[76+(d+g(i,80)|0)>>2],-1),Or=oi(t,r,70252),Sr=0,n[Or>>2]=Sr,n[t+32>>2]=n[t+32>>2]-1,q(t,i,d,M);break E}Ur(s,I,70088),c()}Ur(s,F,70104),c()}Ur(i,M,70236),c()}r=ki(x,i,67624),t=n[ti(wA,0,67640)>>2],n[r+16>>2]=t,n[r+20>>2]=t>>31,t=n[ti(gA,0,67656)>>2],n[r+32>>2]=pA,n[r+36>>2]=or,n[r+24>>2]=t,n[r+28>>2]=t>>31,n[k+280>>2]=G,n[k+284>>2]=W,dA&&(r=ki(x,AA,67672),M=n[r+4>>2],d=n[r>>2],(0|i)==(0|M)&&d||(n[r+12>>2]=M,n[r+8>>2]=d,n[r+4>>2]=i,n[r>>2]=1)),Kf(k+308|0,i),j=(D=n[ti(wA,r=h-1|0,67688)>>2])>>31,n[k+216>>2]=D,n[k+220>>2]=j,U=(t=n[ti(gA,r,67704)>>2])>>31,n[k+224>>2]=t,n[k+228>>2]=U,r=n[ti(wA,0,67720)>>2],n[k+232>>2]=r,n[k+236>>2]=r>>31,r=ti(gA,0,67736),n[k+256>>2]=E,n[k+260>>2]=f,n[k+248>>2]=o,n[k+252>>2]=w,n[k+288>>2]=h,r=n[r>>2],n[k+240>>2]=r,n[k+244>>2]=r>>31,I=r=n[k+468>>2],E=n[k+464>>2],n[k+264>>2]=E,n[k+268>>2]=r,w=r=n[k+476>>2],o=n[k+472>>2],n[k+272>>2]=o,n[k+276>>2]=r,s=u[k+529|0],e[k+296|0]=s,Z&&le(DA),ge(wA),ge(gA),Ee(er),zi(k+368|0),dA=1,AA=i;continue Q}for(f=(r=s>>>0<=1?1:s)>>>0>=5?5:r,Kf(IA,i),E>>>0>s>>>0?(r=n[(i=G+(s<<4)|0)+12>>2],n[k+544>>2]=n[i+8>>2],n[k+548>>2]=r,r=n[i+4>>2],n[k+536>>2]=n[i>>2],n[k+540>>2]=r):fA(k+536|0,t,h,U,I,D,F,s),i=f-1|0,s=s+1|0,o=w+1|0,r=k+536|0,f=w>>>0<1048575;;){if(!i)continue w;f&&((R=n[Q+56>>2])>>>0>(w=(d=n[r>>2])&n[Q+60>>2])>>>0?n[n[Q+52>>2]+(w<<2)>>2]=o|-1048576&d:(Ur(w,R,70120),c())),i=i-1|0,r=r+4|0}}}break}f=0}zi(k+368|0)}ge(k+356|0),ge(k+344|0),le(k+332|0),Me(k+320|0),ge(k+308|0)}n[$>>2]=-1,e[$+4|0]=f;break t}i=0,r=K(Q+104|0,m,7),Y=C;u:{if(!((G=r+1|0)?Y:Y+1|0)&G>>>0<=65535){for(hr(k+104|0,G,8,40),n[k+544>>2]=0,r=n[k+108>>2],n[k+536>>2]=n[k+104>>2],n[k+540>>2]=r,Y=Q+1160|0,y=Q+1100|0,j=Q+1088|0,H=Q+1028|0,o=n[Q+64>>2],w=n[Q+68>>2];(0|i)!=(0|G);){for(n[k+744>>2]=0,r=xr(H,m,!!(0|i)),f=w+C|0,w=(w=o)>>>0>(o=r+o|0)>>>0?f+1|0:f,i||(n[Q+64>>2]=o,n[Q+68>>2]=w),D=(r=aA(m,j,0))<<1,t=aA(m,j,r+1|0),i?(E=xr(y,m,2),I=C,f=3):(E=xr(y,m,0),I=C,f=1),f=xr(y,m,f),M=C,W=t|D,n[k+208>>2]=u[W+72140|0],n[k+204>>2]=0,n[k+200>>2]=m,n[k+196>>2]=Y,n[k+192>>2]=k+744,N=T=N-32|0,hr(T+8|0,(r=(t=n[(X=k+192|0)+16>>2])-n[X+12>>2]|0)>>>0<=t>>>0?r:0,8,8),n[T+28>>2]=0,r=n[T+12>>2],n[T+20>>2]=n[T+8>>2],n[T+24>>2]=r,N=_=N-16|0,yi(r=T+20|0,(t=(D=n[X+16>>2])-n[X+12>>2]|0)>>>0<=D>>>0?t:0),D=n[r+4>>2],t=n[r+8>>2],n[_+4>>2]=r+8,Or=_,Sr=xe(D,t),n[Or+8>>2]=Sr,n[_+12>>2]=C,s=(r=n[X+16>>2])>>>0>(h=n[X+12>>2])>>>0?r:h,Z=n[(r=_+4|0)+4>>2],AA=n[r+8>>2]+(Z<<3)|0,U=n[X+8>>2],O=n[X+4>>2],D=n[X>>2],t=n[r>>2];(0|s)!=(0|h);)(r=n[D>>2])&&oi(r+28|0,h,68932),Or=AA,Sr=xr(O,U,0),n[Or>>2]=Sr,n[AA+4>>2]=C,h=h+1|0,AA=AA+8|0,Z=Z+1|0;n[t>>2]=Z,N=_+16|0,n[(t=k+368|0)+8>>2]=n[T+28>>2],r=n[T+24>>2],n[t>>2]=n[T+20>>2],n[t+4>>2]=r,N=T+32|0,(0|(t=n[k+544>>2]))==n[k+536>>2]&&(N=D=N-16|0,NA(D+8|0,r=k+536|0,n[r>>2],1,8,40),-1!=(0|(r=n[D+8>>2]))&&(_i(r,n[D+12>>2]),c()),N=D+16|0),r=n[k+540>>2]+g(t,40)|0,n[r+24>>2]=W,n[r+16>>2]=f,n[r+20>>2]=M,n[r+8>>2]=E,n[r+12>>2]=I,n[r>>2]=o,n[r+4>>2]=w,f=n[k+372>>2],n[r+28>>2]=n[k+368>>2],n[r+32>>2]=f,n[r+36>>2]=n[k+376>>2],n[k+544>>2]=t+1,i=i+1|0}if(n[k+456>>2]=u[k+541|0]|u[k+542|0]<<8|u[k+543|0]<<16|u[k+544|0]<<24,r=u[k+544|0]|u[k+545|0]<<8|u[k+546|0]<<16|u[k+547|0]<<24,e[k+459|0]=r,e[k+460|0]=r>>>8,e[k+461|0]=r>>>16,e[k+462|0]=r>>>24,i=u[k+540|0],-1!=(0|(r=n[k+536>>2])))break u}n[$>>2]=-1,e[$+4|0]=i;break t}f=u[k+459|0]|u[k+460|0]<<8|u[k+461|0]<<16|u[k+462|0]<<24,e[k+124|0]=f,e[k+125|0]=f>>>8,e[k+126|0]=f>>>16,e[k+127|0]=f>>>24,f=n[k+456>>2],e[k+121|0]=f,e[k+122|0]=f>>>8,e[k+123|0]=f>>>16,e[k+124|0]=f>>>24,e[k+120|0]=i,n[k+116>>2]=r,r=-2147483646,n[k+112>>2]=-2147483646,i=2}else r=-2147483648,n[k+112>>2]=-2147483648,i=0;o=0,w=0,E=0}if(!aA(m,Q+188|0,i)){c:{u:switch(((0|r)>=0?1:-2147483648^r)-1|0){case 0:f=w,YA=(kA=o+E|0)>>>0>>0?f+1|0:f;break c;case 1:break u;default:break c}if(n[k+124>>2]){f=n[k+120>>2],r=n[f>>2];u:{if((0|(f=n[f+4>>2]))>0|(0|f)>=0){if(r>>>0>>0)break u;break c}n[$>>2]=-1,e[$+4|0]=0,Pr(k+112|0);break t}if(r>>>0>>0){r=g(r,56)+kr|0,kA=n[r+48>>2],YA=n[r+52>>2];break c}Ur(r,xA,67512),c()}Ur(0,0,67496),c()}r=xr(Q+200|0,m,i),f=YA+C|0,YA=(i=kA)>>>0>(kA=r+kA|0)>>>0?f+1|0:f}Je($,k+112|0,48),n[$+48>>2]=kA,n[$+52>>2]=YA}if(N=k+880|0,i=u[b+2444|0],-1!=(0|(o=n[b+2440>>2])))break b;oA=255&i;break k}if(1!=u[b+36|0])break a}oA=0}Ze(b+2048|0),we(b+1988|0);break e}Je(b+2380|0,br,43),kA=n[b+2488>>2],YA=n[b+2492>>2],(0|(f=n[b+2056>>2]))==n[b+2048>>2]&&(N=E=N-16|0,NA(E+8|0,r=b+2048|0,n[r>>2],1,8,56),-1!=(0|(r=n[E+8>>2]))&&(_i(r,n[E+12>>2]),c()),N=E+16|0),Z=(0|o)>=0?1:-2147483648^o,r=n[b+2052>>2]+g(f,56)|0,e[r+4|0]=i,n[r>>2]=o,Je(r+5|0,b+2380|0,43),n[r+48>>2]=kA,n[r+52>>2]=YA,V=V+1|0,M=f+1|0}}for(s=s+1|0,V=r,Hf(b+2048|0,r),M=0;V;)ri(b+2048|0,M=uf(G,b+16|0,255&M)),V=V-1|0;n[b+2448>>2]=n[b+2056>>2],r=n[b+2052>>2],n[b+2440>>2]=n[b+2048>>2],n[b+2444>>2]=r,Yf(b+1808|0,b+2440|0);continue}break}if(n[b+2136>>2]=n[b+2328>>2],r=n[b+2324>>2],n[b+2128>>2]=n[b+2320>>2],n[b+2132>>2]=r,r=n[b+2316>>2],n[b+2120>>2]=n[b+2312>>2],n[b+2124>>2]=r,r=n[b+2308>>2],n[b+2112>>2]=n[b+2304>>2],n[b+2116>>2]=r,r=n[b+1920>>2],n[b+1744>>2]=n[b+1916>>2],n[b+1748>>2]=r,n[b+1752>>2]=n[b+1924>>2],r=n[b+1992>>2],n[b+1680>>2]=n[b+1988>>2],n[b+1684>>2]=r,n[b+1688>>2]=n[b+1996>>2],r=n[b+1812>>2],i=n[b+1816>>2],o=n[b+1808>>2],n[b+1592>>2]=n[b+2056>>2],f=n[b+2052>>2],n[b+1584>>2]=n[b+2048>>2],n[b+1588>>2]=f,-1==(0|o))break r;n[A+28>>2]=n[b+1752>>2],f=n[b+1748>>2],n[A+20>>2]=n[b+1744>>2],n[A+24>>2]=f,f=n[b+1684>>2],n[A+32>>2]=n[b+1680>>2],n[A+36>>2]=f,n[A+40>>2]=n[b+1688>>2],f=n[b+1588>>2],n[A+44>>2]=n[b+1584>>2],n[A+48>>2]=f,n[A+52>>2]=n[b+1592>>2],f=n[b+2116>>2],n[A+56>>2]=n[b+2112>>2],n[A+60>>2]=f,f=n[b+2124>>2],n[A+64>>2]=n[b+2120>>2],n[A+68>>2]=f,f=n[b+2132>>2],n[A+72>>2]=n[b+2128>>2],n[A+76>>2]=f,n[A+80>>2]=n[b+2136>>2],n[A+12>>2]=r,n[A+16>>2]=i,n[A+8>>2]=o,n[A>>2]=oA,n[A+4>>2]=nr,M=88,r=n[b+1340>>2];break A}we(b+1916|0);break f}oA=0}Ye(b+1808|0)}e[0|A]=oA,M=8,r=-1}for(n[A+M>>2]=r,he((i=b+40|0)+80|0),he(i+92|0),oe(i+104|0),oe(i+140|0),he(i+176|0),he(i+188|0),Si(i+200|0),he(i+260|0),he(i+272|0),oe(i+284|0),Si(i+320|0),he(i+380|0),he(i+392|0),he(i+404|0),Si(i+416|0),Si(i+476|0),Si(i+536|0),he(i+596|0),he(i+608|0),he(i+620|0),he(i+632|0),Si(i+644|0),he(i+704|0),Si(i+716|0),Si(i+776|0),Si(i+836|0),he(i+896|0),he(i+908|0),he(i+920|0),he(i+932|0),he(i+944|0),oe(i+956|0),oe(i+992|0),Si(i+1028|0),he(i+1088|0),Si(i+1100|0),Si(i+1160|0),he(i+1220|0),he(i+1232|0),r=n[(A=i+1244|0)+4>>2]- -64|0,f=n[A+8>>2];f;)le(r-24|0),ge(r-12|0),ge(r),f=f-1|0,r=r+80|0;for(Af(A,8,80),r=n[(A=i+1256|0)+8>>2],f=n[A+4>>2];r;)r=r-1|0,te(f),f=f+36|0;Af(A,4,36),ge(i+1268|0),ei(i),Ee(i+1280|0),N=b+2528|0}function J(A,r,f){var i,b=0,k=0,o=0,t=0,u=0,B=0,v=0,Q=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,h=0,W=0;for(N=i=N-304|0,k=n[r+4>>2],v=n[r+8>>2],B=k+g(v,56)|0,b=k;;){o=b-48|0;A:{r:{f:{for(;;){if((0|(b=o+48|0))!=(0|B))switch(o=o+56|0,((0|(b=n[b>>2]))>=0?1:-2147483648^b)-1|0){case 0:break r;case 1:break f;default:continue}break}for(hr(i+8|0,v,4,16),b=n[i+8>>2],o=n[i+12>>2],Tf(i+272|0,v),Tf(i+100|0,Q),Hf(i+288|0,t),Tf(i+116|0,t),Tf(v=i+168|0,t),hr(i,w,4,20),n[i+24>>2]=0,n[i+16>>2]=b,n[i+20>>2]=o,b=n[i+276>>2],n[i+28>>2]=n[i+272>>2],n[i+32>>2]=b,n[i+36>>2]=n[i+280>>2],b=n[i+104>>2],n[i+40>>2]=n[i+100>>2],n[i+44>>2]=b,n[i+48>>2]=n[i+108>>2],b=n[i+292>>2],n[i+52>>2]=n[i+288>>2],n[i+56>>2]=b,n[i+60>>2]=n[i+296>>2],n[i+72>>2]=n[i+124>>2],b=n[i+120>>2],n[i+64>>2]=n[i+116>>2],n[i+68>>2]=b,b=n[i>>2],o=n[i+4>>2],n[i+96>>2]=0,n[i+88>>2]=b,n[i+92>>2]=o,n[i+84>>2]=n[i+176>>2],b=n[i+172>>2],n[i+76>>2]=n[i+168>>2],n[i+80>>2]=b,r=n[r>>2],n[i+112>>2]=B,n[i+108>>2]=r,n[i+104>>2]=k,n[i+100>>2]=k,E=i+204|0,M=i+192|0,Y=i+180|0,Q=4|v,Z=i+88|0,I=i+76|0,m=i- -64|0,y=i+52|0,v=i+40|0,h=i+28|0;;){i:{e:{a:{n:{b:{k:{o:{t:{c:{u:{B:{if((0|k)!=(0|B)&&(n[i+104>>2]=k+56,b=n[k>>2],Je(r=i+116|0,k+4|0,52),-1!=(0|b))){if(n[i+168>>2]=b,Je(Q,r,52),r=n[i+216>>2],n[i+220>>2])break c;switch(_f(h,r),(d=(0|(r=n[i+168>>2]))>=0?1:-2147483648^r)-1|0){case 0:break B;case 1:break u;default:break i}}dr(i+100|0),Je(A,i+16|0,84);break A}if(n[i+232>>2]=n[i+176>>2],r=n[i+172>>2],n[i+224>>2]=n[i+168>>2],n[i+228>>2]=r,n[i+248>>2]=n[Y+8>>2],r=n[Y+4>>2],n[i+240>>2]=n[Y>>2],n[i+244>>2]=r,n[i+264>>2]=n[M+8>>2],r=n[M+4>>2],n[i+256>>2]=n[M>>2],n[i+260>>2]=r,n[i+280>>2]=n[E+8>>2],r=n[E+4>>2],n[i+272>>2]=n[E>>2],n[i+276>>2]=r,(0|(r=df(o=n[i+228>>2],o+((t=n[i+232>>2])<<1)|0)))==n[i+264>>2])break k;break b}r=n[Q+4>>2],n[i+288>>2]=n[Q>>2],n[i+292>>2]=r,r=n[Q+8>>2],n[i+296>>2]=r,G=(t=n[i+292>>2])+g(r,40)|0,k=w=n[i+96>>2];u:for(;;){if((0|t)==(0|G))break e;if(r=n[t>>2],!(n[t+4>>2]<0|r>>>0>=f>>>0))for(B=r,r=t+40|0,n[i+272>>2]=0,n[i+276>>2]=0,l=((b=n[t+36>>2])>>>0>=4?4:b)<<1,b=n[t+32>>2],o=0;;){B:{if((0|o)!=(0|l)){if(D=(u=n[b>>2])-32768|0,s=u<<16,!(1&(u=-1==(0|(u=n[b+4>>2]-(u>>>0<32768)|0))&D>>>0<4294901760|-1!=(0|u)?1:s)))break B;break t}if(o=(b=n[t+8>>2])-32768|0,u=b<<16,1&(o=-1==(0|(b=n[t+12>>2]-(b>>>0<32768)|0))&o>>>0<4294901760|-1!=(0|b)?1:u))break t;if(u=(b=n[t+16>>2])-32768|0,l=b<<16,1&(u=-1==(0|(b=n[t+20>>2]-(b>>>0<32768)|0))&u>>>0<4294901760|-1!=(0|b)?1:l))break t;l=n[t+24>>2],t=n[i+272>>2],D=n[i+276>>2],n[i+88>>2]==(0|k)&&(N=b=N-16|0,NA(b+8|0,Z,n[Z>>2],1,4,20),-1!=(0|(s=n[b+8>>2]))&&(_i(s,n[b+12>>2]),c()),N=b+16|0),b=n[i+92>>2]+g(k,20)|0,e[b+16|0]=l,a[b+14>>1]=u>>>16,a[b+12>>1]=o>>>16,n[b+8>>2]=B,n[b>>2]=t,n[b+4>>2]=D,k=k+1|0,n[i+96>>2]=k,t=r;continue u}a[(i+272|0)+o>>1]=u>>>16,o=o+2|0,b=b+8|0}break}break t}switch(n[A>>2]=-1,e[A+4|0]=0,((0|b)>=0?1:-2147483648^b)-1|0){case 0:break o;case 1:break n;default:break a}}if(n[A>>2]=-1,e[A+4|0]=0,Ie(i+288|0),n[i+168>>2]<0)break a}Me(i+168|0),le(Y),ge(M),ge(E);break a}if(!((0|r)!=n[i+280>>2]|(0|r)!=n[i+248>>2])){W=n[i+72>>2],w=n[i+48>>2],k=n[i+276>>2],n[i+296>>2]=k,b=n[i+260>>2],n[i+288>>2]=b,r<<=2,n[i+300>>2]=r+k,n[i+292>>2]=r+b;k:{if(r=n[(b=i+288|0)>>2]){B=n[b+4>>2];o:{for(;;){if((0|r)==(0|B))break o;if(k=r+4|0,n[b>>2]=k,u=n[r>>2],r=k,!(u-32768>>>0>=4294901760))break}B=1;break k}n[b>>2]=0}o:if(r=n[b+8>>2])for(u=n[b+12>>2];;){if(B=(0|r)!=(0|u),(0|r)==(0|u))break o;if(k=r+4|0,n[b+8>>2]=k,G=n[r>>2],r=k,!(G-32768>>>0>=4294901760))break}else B=0}if(!B){mi(v,B=(k=(b=o+(t<<1)|0)-o|0)>>>1|0),r=n[v+8>>2],(0|b)!=(0|o)&&(k&&Je(n[v+4>>2]+(r<<1)|0,o,k),r=n[v+8>>2]),n[v+8>>2]=r+B,ke(y,n[i+244>>2],n[i+248>>2]),Hr(m,r=n[i+260>>2],r+(n[i+264>>2]<<2)|0),Hr(I,r=n[i+276>>2],r+(n[i+280>>2]<<2)|0),ge(i+272|0),ge(i+256|0),le(i+240|0),Me(i+224|0);break i}}}if(n[A>>2]=-1,e[A+4|0]=0,ge(i+272|0),ge(i+256|0),le(i+240|0),Me(i+224|0),-2147483646!=n[i+168>>2])break a}Ie(Q)}dr(i+100|0),Cf(i+16|0);break A}t=n[i+296>>2],Ie(i+288|0)}(0|(k=n[i+24>>2]))==n[i+16>>2]&&rf(i+16|0),r=n[i+20>>2]+(k<<4)|0,n[r+12>>2]=W,n[r+8>>2]=t,n[r+4>>2]=w,n[r>>2]=d,n[i+24>>2]=k+1,k=n[i+104>>2],B=n[i+112>>2]}}b=o+48|0,w=n[o+4>>2]+w|0;continue}b=o+48|0,Q=n[o>>2]+Q|0,t=n[o+24>>2]+t|0;continue}break}N=i+304|0}function j(A,r,f){var i,a=0,b=0,k=0,o=0,t=0,c=0,B=0,v=0,Q=0,w=0,l=0;N=i=N-128|0,n[i+24>>2]=0,n[i+32>>2]=f,n[i+28>>2]=r,IA(i+80|0,r,f,i+24|0);A:if(1!=u[i+80|0]){hr(i+16|0,c=n[i+84>>2],4,12),k=n[i+20>>2],n[i+36>>2]=n[i+16>>2],n[i+40>>2]=k,b=8;r:{for(;;){f:{n[i+44>>2]=a;i:{if((0|a)!=(0|c)){if(IA(i+80|0,r,f,i+24|0),!u[i+80|0])break i;r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break r}if(IA(i+80|0,r,f,i+24|0),1==u[i+80|0]){r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break r}for(hr(i+8|0,t=n[i+84>>2],4,28),k=0,n[i+56>>2]=0,a=n[i+12>>2],n[i+48>>2]=n[i+8>>2],n[i+52>>2]=a,b=i+85|0,c=i+73|0;;){e:{if(t){if(IA(i+80|0,r,f,i+24|0),!u[i+80|0])break e;r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break f}if(IA(i+80|0,r,f,i+24|0),1==u[i+80|0]){r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break f}for(hr(i,k=n[i+84>>2],4,4),a=n[i+4>>2],n[i+68>>2]=n[i>>2],n[i+72>>2]=a,b=0,a=0,t=0;;){n[i+76>>2]=a;a:{if((0|a)!=(0|k)){if(IA(i+80|0,r,f,i+24|0),!u[i+80|0])break a;r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r,ge(i+68|0);break f}if(k=r=n[i+52>>2],N=f=N-32|0,hr(f+8|0,r=((o=r+g(n[i+56>>2],28)|0)-r>>>0)/28|0,4,4),n[f+28>>2]=0,a=n[f+12>>2],n[f+20>>2]=n[f+8>>2],n[f+24>>2]=a,N=t=N-16|0,di(a=f+20|0,r),b=n[a+8>>2],c=n[a+4>>2],n[t+4>>2]=a+8,w=t,l=xe(c,b),n[w+8>>2]=l,n[t+12>>2]=C,b=n[(c=t+4|0)+4>>2],B=n[c>>2],(0|k)!=(0|o))for(a=k+4|0,k=n[c+8>>2]+(b<<2)|0,b=r+b|0;n[k>>2]=n[a+4>>2]?n[n[a>>2]>>2]:-1,a=a+28|0,k=k+4|0,r=r-1|0;);n[B>>2]=b,N=t+16|0,n[(r=i+104|0)+8>>2]=n[f+28>>2],a=n[f+24>>2],n[r>>2]=n[f+20>>2],n[r+4>>2]=a,N=f+32|0,n[i+88>>2]=n[i+44>>2],r=n[i+40>>2],n[i+80>>2]=n[i+36>>2],n[i+84>>2]=r,r=n[i+52>>2],n[i+92>>2]=n[i+48>>2],n[i+96>>2]=r,n[i+100>>2]=n[i+56>>2],r=n[i+72>>2],n[i+116>>2]=n[i+68>>2],n[i+120>>2]=r,n[i+124>>2]=n[i+76>>2],Je(A,i+80|0,48);break A}t=n[i+84>>2]+t|0,n[i+68>>2]==(0|a)&&nf(i+68|0),n[n[i+72>>2]+b>>2]=t,b=b+4|0,a=a+1|0}}if(B=n[i+84>>2],$A(i+80|0,i+28|0,i+24|0),o=u[i+84|0],-1==(0|(v=n[i+80>>2]))){n[A>>2]=-1,e[A+4|0]=o;break f}if(a=u[b+3|0]|u[b+4|0]<<8|u[b+5|0]<<16|u[b+6|0]<<24,e[c+3|0]=a,e[c+4|0]=a>>>8,e[c+5|0]=a>>>16,e[c+6|0]=a>>>24,a=u[0|b]|u[b+1|0]<<8|u[b+2|0]<<16|u[b+3|0]<<24,e[0|c]=a,e[c+1|0]=a>>>8,e[c+2|0]=a>>>16,e[c+3|0]=a>>>24,e[i+72|0]=o,n[i+68>>2]=v,$A(i+80|0,i+28|0,i+24|0),o=u[i+84|0],-1==(0|(v=n[i+80>>2]))){n[A>>2]=-1,e[A+4|0]=o,ge(i+68|0);break f}k=k+B|0,a=u[b+3|0]|u[b+4|0]<<8|u[b+5|0]<<16|u[b+6|0]<<24,e[i+63|0]=a,e[i+64|0]=a>>>8,e[i+65|0]=a>>>16,e[i+66|0]=a>>>24,n[i+60>>2]=u[0|b]|u[b+1|0]<<8|u[b+2|0]<<16|u[b+3|0]<<24,(0|(B=n[i+56>>2]))==n[i+48>>2]&&bf(i+48|0),a=n[i+52>>2]+g(B,28)|0,n[a+8>>2]=n[i+76>>2],Q=n[i+72>>2],n[a>>2]=n[i+68>>2],n[a+4>>2]=Q,e[a+20|0]=o,n[a+16>>2]=v,n[a+12>>2]=k,o=n[i+60>>2],e[a+21|0]=o,e[a+22|0]=o>>>8,e[a+23|0]=o>>>16,e[a+24|0]=o>>>24,o=u[i+63|0]|u[i+64|0]<<8|u[i+65|0]<<16|u[i+66|0]<<24,e[a+24|0]=o,e[a+25|0]=o>>>8,e[a+26|0]=o>>>16,e[a+27|0]=o>>>24,n[i+56>>2]=B+1,t=t-1|0}}if(k=n[i+84>>2],IA(i+80|0,r,f,i+24|0),1==u[i+80|0]){r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break r}if(o=n[i+84>>2],IA(i+80|0,r,f,i+24|0),1==u[i+80|0]){r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;break r}t=k+t|0,B=n[i+84>>2],n[i+36>>2]==(0|a)&&kf(i+36|0),k=n[i+40>>2]+b|0,n[k>>2]=B,n[k-4>>2]=o,n[k-8>>2]=t,b=b+12|0,a=a+1|0;continue}break}Ne(i+48|0)}se(i+36|0)}else r=u[i+81|0],n[A>>2]=-1,e[A+4|0]=r;N=i+128|0}function R(A,r,f,i,e){var a,b=0,k=0,o=0,t=0,u=0,B=0;N=a=N-48|0;A:{r:{if(f){b=Te(e,0,(f=(f<<3)-8|0)>>>3|0,0);f:{if(!(C||(u=(o=n[r+4>>2])+b|0)>>>0>>0))for(t=n[r>>2],b=f,k=r=r+8|0;;){if(!b)break f;if(b=b-8|0,B=n[k+4>>2],k=k+8|0,!(B>>>0<=(u=u+B|0)>>>0))break}hf(68572,53,68628),c()}hr(a+8|0,u,1,1),n[a+28>>2]=0,b=n[a+12>>2],n[a+20>>2]=n[a+8>>2],n[a+24>>2]=b,ce(a+20|0,t,o+t|0),k=u-(b=n[a+28>>2])|0,b=b+n[a+24>>2]|0;f:switch(0|e){case 0:for(;;){if(!f)break r;o=n[r>>2],e=n[r+4>>2],ai(b,0,i,0,68556),Uf(a+32|0,b,k,e),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],o,e,68556),f=f-8|0,r=r+8|0}case 1:for(;;){if(!f)break r;o=n[r>>2],e=n[r+4>>2],Uf(t=a+32|0,b,k,1),b=n[a+44>>2],k=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],i,1,68556),Uf(t,k,b,e),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],o,e,68556),f=f-8|0,r=r+8|0}case 2:for(;;){if(!f)break r;o=n[r>>2],e=n[r+4>>2],Uf(t=a+32|0,b,k,2),b=n[a+44>>2],k=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],i,2,68556),Uf(t,k,b,e),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],o,e,68556),f=f-8|0,r=r+8|0}case 3:for(;;){if(!f)break r;o=n[r>>2],e=n[r+4>>2],Uf(t=a+32|0,b,k,3),b=n[a+44>>2],k=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],i,3,68556),Uf(t,k,b,e),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],o,e,68556),f=f-8|0,r=r+8|0}case 4:for(;;){if(!f)break r;o=n[r>>2],e=n[r+4>>2],Uf(t=a+32|0,b,k,4),b=n[a+44>>2],k=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],i,4,68556),Uf(t,k,b,e),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],o,e,68556),f=f-8|0,r=r+8|0}default:break f}for(;;){if(!f)break r;t=n[r>>2],o=n[r+4>>2],Uf(B=a+32|0,b,k,e),b=n[a+44>>2],k=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],i,e,68556),Uf(B,k,b,o),k=n[a+44>>2],b=n[a+40>>2],ai(n[a+32>>2],n[a+36>>2],t,o,68556),f=f-8|0,r=r+8|0}}n[A+8>>2]=0,n[A>>2]=0,n[A+4>>2]=1;break A}r=n[a+24>>2],n[A>>2]=n[a+20>>2],n[A+4>>2]=r,n[A+8>>2]=u-k}N=a+48|0}function V(A,r,f,i){var a,b=0,k=0,o=0,t=0,c=0,B=0,Q=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0;N=a=N-96|0;A:if(i>>>0<2||(tA(a+16|0,r,f,i),1!=n[a+16>>2]||(pA(a+80|0,r,n[a+20>>2]),!n[a+80>>2]))){n[a+32>>2]=0,n[a+24>>2]=0,n[a+28>>2]=4,Z=(i<<2)+f|0,s=u[r+12|0],l=n[r+8>>2];r:for(;;){f:{i:{if((0|f)!=(0|Z)){if(pA(a+80|0,r,b=n[f>>2]),f=f+4|0,1==n[a+80>>2]){If(a+24|0,n[a+84>>2],n[a+88>>2]);continue}e:if(i=n[l+8>>2])for(o=n[l+4>>2],k=0;;){if(!(i>>>0<=1)){E=k,k=b>>>0>>1|0)+k|0,12)>>2]?E:k,i=i-c|0;continue}if((0|b)!=n[o+g(k,12)>>2])break e;for(i=n[Mi(l,k,69060)+4>>2],k=Mi(l,k,69076),1&s?(n[a+56>>2]=n[k+8>>2],n[a+52>>2]=i,k=a+52|0,i=2):(n[a+52>>2]=i,k=a+52|0,i=1),i<<=2;;){if(!i)break e;if((o=n[k>>2])&&(pA(a+80|0,r,o),1==n[a+80>>2])){If(a+24|0,n[a+84>>2],n[a+88>>2]);continue r}k=k+4|0,i=i-4|0}}if(CA(a+36|0,l,b),k=n[a+36>>2])break i;break f}n[A+8>>2]=n[a+32>>2],r=n[a+28>>2],n[A>>2]=n[a+24>>2],n[A+4>>2]=r;break A}o=n[a+40>>2];i:{e:{if(1&s){if(B=n[a+44>>2],!(i=(c=n[a+48>>2])||o))break e;if(tA(a+8|0,r,c?B:k,i),!(1&n[a+8>>2]))break e;M=n[a+12>>2],n[a+52>>2]=M,t=n[l+40>>2],i=a+52|0;a:if(b=n[l+44>>2]){for(Q=n[i>>2],i=0;;){if(b>>>0<=1){if(b=0,(0|(t=n[t+(i<<2)>>2]))==(0|Q))break a;break}E=i,i=Q>>>0>>1|0)+i|0)<<2)>>2]?E:i,b=b-w|0}i=(t>>>0>>0)+i|0,b=1}else i=0,b=1;if(n[a+4>>2]=i,n[a>>2]=b,n[a>>2])break e;if(pA(a+80|0,r,M),2==(0|(i=n[a+80>>2]))|1!=(0|i))break e;If(a+24|0,n[a+84>>2],n[a+88>>2]);continue}n[a+56>>2]=o,n[a+52>>2]=k,b=1;break i}n[a+64>>2]=c,n[a+60>>2]=B,n[a+56>>2]=o,n[a+52>>2]=k,b=2}for(i=a+52|0,k=b<<3;;){if(!k)break f;if(!((o=n[i+4>>2])>>>0<=1)){if(b=n[i>>2],n[a+88>>2]=r,n[a+84>>2]=b+(o<<2),n[a+80>>2]=b,M=a+68|0,N=o=N-32|0,e[o+3|0]=0,Q=a+80|0,n[o+24>>2]=n[Q+8>>2],b=n[Q+4>>2],n[o+16>>2]=n[Q>>2],n[o+20>>2]=b,n[o+28>>2]=o+3,c=o+4|0,N=b=N-48|0,af(G=b+32|0,B=o+16|0),1!=n[b+32>>2])n[c+8>>2]=0,n[c>>2]=0,n[c+4>>2]=4;else{for(w=n[b+40>>2],E=n[b+36>>2],hr(b+8|0,4,4,8),Y=n[b+8>>2],t=n[b+12>>2],n[t>>2]=E,n[t+4>>2]=w,n[b+28>>2]=1,n[b+24>>2]=t,n[b+20>>2]=Y,t=n[B+12>>2],n[b+40>>2]=n[B+8>>2],n[b+44>>2]=t,t=n[B+4>>2],n[b+32>>2]=n[B>>2],n[b+36>>2]=t,B=b+20|0,N=t=N-16|0;af(t+4|0,G),1==n[t+4>>2];)E=n[t+12>>2],Y=n[t+8>>2],(0|(w=n[B+8>>2]))==n[B>>2]&&Ii(B,1),D=n[B+4>>2]+(w<<3)|0,n[D+4>>2]=E,n[D>>2]=Y,n[B+8>>2]=w+1;N=t+16|0,n[c+8>>2]=n[b+28>>2],B=n[b+24>>2],n[c>>2]=n[b+20>>2],n[c+4>>2]=B}if(N=b+48|0,1!=u[o+3|0]?(n[M+8>>2]=n[o+12>>2],b=n[o+8>>2],n[M>>2]=n[o+4>>2],n[M+4>>2]=b):(n[M>>2]=-1,We(c)),N=o+32|0,-1!=(0|(b=n[a+68>>2]))){k=n[a+76>>2],i=n[a+72>>2],n[a+88>>2]=b,n[a+80>>2]=i,n[a+84>>2]=i,n[a+92>>2]=i+(k<<3),N=k=N-16|0,Ii(i=a+24|0,t=(c=(B=n[Q+12>>2])-(o=n[Q+4>>2])|0)>>>3|0),b=n[i+8>>2],(0|o)!=(0|B)&&(c&&Je(n[i+4>>2]+(b<<3)|0,o,c),b=n[i+8>>2]),n[i+8>>2]=b+t,i=n[Q+8>>2],n[k+12>>2]=n[Q>>2],n[k+8>>2]=i,We(k+8|0),N=k+16|0;continue r}}i=i+8|0,k=k-8|0}}break}n[A+8>>2]=0,n[A>>2]=0,n[A+4>>2]=4,We(a+24|0)}else f=n[a+88>>2],i=n[a+84>>2],r=Hi(4,8),n[A+8>>2]=1,n[A+4>>2]=r,n[A>>2]=1,n[r>>2]=i,n[r+4>>2]=f;N=a+96|0}function X(A,r,f,i,e,b,k){var o,t=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,h=0,W=0,C=0,U=0,z=0;N=o=N+-64|0;A:if(!(b>>>0>8|f>>>0>=v[A+8>>2]||(m=Q[i+40>>3],y=Q[i+32>>3],E=Q[i+24>>3],M=Q[i+16>>3],Y=Q[i+8>>3],s=Q[i>>3],i=n[k>>2],n[k>>2]=i-1,(0|i)<=0))){r:{f:switch(f=wi(A,f,69636),n[f>>2]-1|0){case 0:break f;case 1:break r;default:break A}f:{i:{if((i=n[A+32>>2])>>>0>=(k=n[f+4>>2])>>>0){if((l=n[f+8>>2])>>>0>(i=i-k|0)>>>0)break i;for(b=n[f+12>>2],yi(e,i=df(k=n[A+28>>2]+(k<<1)|0,f=k+(l<<1)|0)),yi(G=e+12|0,i),Ui(D=e+24|0,i),di(Z=e+36|0,l),W=A+60|0,C=A+48|0,U=n[A+40>>2],l=n[A+44>>2];;){if((0|f)==(0|k))break A;for(z=(A=(h=B[k>>1])+b|0)>>>0>>0?b:A,i=b;(0|i)!=(0|z);)qf(e,y+(s*(t=r*+a[ci(C,i,69700)>>1])+M*(w=r*+a[ci(W,i,69716)>>1]))),qf(G,m+(Y*t+E*w)),i=i+1|0;if(A>>>0>>0|A>>>0>l>>>0)break f;ke(D,b+U|0,h),Kf(Z,n[e+8>>2]-1|0),k=k+2|0,b=A}}cA(k,i,i,69652),c()}cA(0,l,i,69668),c()}cA(b,A,l,69684),c()}if(i=n[f+8>>2],jf(o+8|0,A+72|0,n[f+4>>2],69732),(f=n[o+12>>2])>>>0>=i>>>0)for(l=n[o+8>>2],i=g(i,20),G=b+1|0,b=0;;){if((0|i)==(0|b))break A;d=0,t=1,I=0,w=1;r:{f:{i:{e:switch(u[(f=b+l|0)+16|0]-1|0){case 0:break e;case 1:break i;case 2:break f;default:break r}w=t=6103515625e-14*+a[f>>1];break r}t=6103515625e-14*+a[f>>1],w=6103515625e-14*+a[f+2>>1];break r}t=6103515625e-14*+a[f>>1],w=6103515625e-14*+a[f+6>>1],I=6103515625e-14*+a[f+4>>1],d=6103515625e-14*+a[f+2>>1]}D=n[f+8>>2],Z=a[f+12>>1],f=a[f+14>>1],Q[o+40>>3]=Y*I+E*w,Q[o+32>>3]=s*I+M*w,Q[o+24>>3]=Y*t+E*d,Q[o+16>>3]=s*t+M*d,t=r*+(0|Z),w=r*+(0|f),Q[o+56>>3]=m+(Y*t+E*w),Q[o+48>>3]=y+(s*t+M*w),X(A,r,D,o+16|0,e,G,k),b=b+20|0}cA(0,i,f,69748),c()}N=o- -64|0}function T(A,r,f,i){var e=0,a=0,b=0,k=0,o=0,t=0;A:{r:{f:{i:{e:{a:{n:{b:{if((e=-8&(o=n[(b=A-4|0)>>2]))>>>0>=((a=3&o)?4:8)+r>>>0){if((k=r+39|0)>>>0>>0&&a)break b;if(f>>>0>=9){if(!(f=rA(f,i)))return 0;if((i=r>>>0>i>>>0?i:r)&&Je(f,A,i),(i=-8&(b=n[b>>2]))>>>0<(e=r)+((r=3&b)?4:8)>>>0)break n;if(!r)break r;if(i>>>0>k>>>0)break a;break r}if(f=0,((r=(-48-(t=n[19250])&-9)-3|0)>>>0>=4294967232?-64:r)>>>0<=i>>>0)break A;r=i>>>0<11?16:i+11&-8,k=A-8|0;k:{o:{t:{c:{if(a){if(a=e+k|0,r>>>0<=e>>>0)break o;if((0|a)==n[19244])break k;if((0|a)==n[19243])break t;if(2&(o=n[a+4>>2]))break f;if((e=(o&=-8)+e|0)>>>0>>0)break f;if(iA(a,o),(a=e-r|0)>>>0<16)break c;n[b>>2]=r|1&n[b>>2]|2,n[(r=r+k|0)+4>>2]=3|a,n[(e=e+k|0)+4>>2]=1|n[e+4>>2],$(r,a);break i}if(r>>>0<256|r>>>0>=e>>>0|!k|e-r>>>0>t<<1>>>0)break f;return A}n[b>>2]=e|1&n[b>>2]|2,n[(r=e+k|0)+4>>2]=1|n[r+4>>2];break i}if((e=e+n[19241]|0)>>>0>>0)break f;(a=e-r|0)>>>0<=15?(n[b>>2]=e|1&o|2,n[(r=e+k|0)+4>>2]=1|n[r+4>>2],a=0,r=0):(n[b>>2]=r|1&o|2,n[(r=r+k|0)+4>>2]=1|a,n[(e=e+k|0)>>2]=a,n[e+4>>2]=-2&n[e+4>>2]),n[19243]=r,n[19241]=a;break i}if((e=e-r|0)>>>0<=15)break i;n[b>>2]=r|1&o|2,n[(r=r+k|0)+4>>2]=3|e,n[a+4>>2]=1|n[a+4>>2],$(r,e);break i}if((e=e+n[19242]|0)>>>0>r>>>0)break e;break f}Ki(72680,46,72728),c()}Ki(72744,46,72792),c()}Ki(72680,46,72728),c()}Ki(72744,46,72792),c()}n[b>>2]=r|1&o|2,a=r+k|0,r=e-r|0,n[a+4>>2]=1|r,n[19242]=r,n[19244]=a}if(k)return A}if(!(r=z(i)))break A;(f=(f=(3&(f=n[b>>2])?-4:-8)+(-8&f)|0)>>>0>i>>>0?i:f)?(Je(r,A,f),f=r):f=r}H(A)}return f}function H(A){var r=0,f=0,i=0,e=0;f=(r=A-8|0)+(A=-8&(i=n[A-4>>2]))|0;A:{r:if(!(1&i)){if(!(2&i))break A;if(A=(i=n[r>>2])+A|0,(0|(r=r-i|0))==n[19243]){if(3&~n[f+4>>2])break r;return n[19241]=A,n[f+4>>2]=-2&n[f+4>>2],n[r+4>>2]=1|A,void(n[f>>2]=A)}iA(r,i)}r:{f:{i:{e:{a:{n:{b:{if(!(2&(i=n[f+4>>2]))){if((0|f)==n[19244])break n;if((0|f)==n[19243])break i;if(iA(e=f,f=-8&i),A=A+f|0,n[r+4>>2]=1|A,n[A+r>>2]=A,n[19243]!=(0|r))break b;return void(n[19241]=A)}n[f+4>>2]=-2&i,n[r+4>>2]=1|A,n[A+r>>2]=A}if(A>>>0<256)break a;if(oA(r,A),r=0,A=n[19249]-1|0,n[19249]=A,!A)break e;break A}if(n[19244]=r,A=n[19242]+A|0,n[19242]=A,n[r+4>>2]=1|A,n[19243]==(0|r)&&(n[19241]=0,n[19243]=0),(f=n[19247])>>>0>=A>>>0)break A;if(3==(-48-(r=n[19250])&-9))break A;if(!(A=n[19244]))break A;if((i=n[19242])>>>0<41)break r;if(!r)break f;for(r=76676;;){if(A>>>0>=(e=n[r>>2])>>>0&A>>>0>2]+e>>>0)break r;r=n[r+8>>2]}}return(f=n[19239])&(i=1<<(A>>>3))?(f=(A&=248)+76692|0,A=n[A+76700>>2]):(n[19239]=f|i,f=A=76692+(248&A)|0),n[f+8>>2]=r,n[A+12>>2]=r,n[r+12>>2]=f,void(n[r+8>>2]=A)}if(A=n[19171])for(;r=r+1|0,A=n[A+8>>2];);return A=n[19251],void(n[19249]=A?A>>>0>r>>>0?A:r:-1)}return n[19243]=r,A=n[19241]+A|0,n[19241]=A,n[r+4>>2]=1|A,void(n[A+r>>2]=A)}ve(72808),c()}if(r=0,A=n[19171])for(;r=r+1|0,A=n[A+8>>2];);A=n[19251],n[19249]=A?A>>>0>r>>>0?A:r:-1,f>>>0>=i>>>0||(n[19247]=-1)}}function O(A,r,f){var i,a,b=0,k=0,o=0,t=0,B=0,v=0,Q=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,h=0,W=0,U=0,z=0;N=o=(N=i=N-304|0)-16|0,b=u[0|(k=A+76|0)],e[0|k]=1,e[o+15|0]=b,1==(0|b)&&(N=A=N-16|0,n[A+12>>2]=67347,n[A+8>>2]=o+15,N=r=N+-64|0,n[r+4>>2]=72552,n[r>>2]=A+8,n[r+12>>2]=72552,n[r+8>>2]=A+12,n[r+20>>2]=u[73772],n[r+16>>2]=n[18440],n[r+28>>2]=65,n[r+24>>2]=70156,n[r+56>>2]=r+8,n[r+60>>2]=37,n[r+48>>2]=r,n[r+52>>2]=37,n[r+40>>2]=r+24,n[r+44>>2]=38,n[r+32>>2]=r+16,n[r+36>>2]=39,yf(65808,r+32|0,70188),c()),n[(b=i+16|0)+4>>2]=k,n[b>>2]=0,N=o+16|0,a=n[i+20>>2];A:{r:{f:{i:if(G=n[A+164>>2])for(Z=a+76|0,l=a+4|0,d=(f<<2)+r|0,I=i+152|0,m=i+140|0,y=i+128|0,M=i+164|0,h=n[A+168>>2];;){D=n[a+12>>2],W=n[A+72>>2],n[i+32>>2]=0,n[i+24>>2]=0,n[i+28>>2]=4,f=r,t=0;e:for(;;){if((0|f)!=(0|d)){if(k=n[f>>2],f=f+4|0,k>>>0>=W>>>0)continue;if(t=(b=k+1|0)>>>0>t>>>0?b:t,k>>>0>=D>>>0)continue;if(2!=n[wi(l,k,69764)>>2])continue;for(If(i+24|0,k,0),Y=1023;;){if(!(b=n[i+32>>2]))continue e;if(b=b-1|0,n[i+32>>2]=b,b=n[i+28>>2]+(b<<3)|0,s=n[b>>2],b=n[b+4>>2],n[i+216>>2]=b,!(b>>>0>7|s>>>0>=D>>>0|(0|Y)<=0)&&(b=wi(l,s,69780),2==n[b>>2])){if(k=n[b+8>>2],jf(i+8|0,Z,n[b+4>>2],69796),(b=n[i+12>>2])>>>0>>0)break f;if(b=n[i+8>>2],n[i+120>>2]=b,n[i+124>>2]=b+g(k,20),n[i+128>>2]=i+216,N=w=N-16|0,Ii(o=i+24|0,(n[(B=i+120|0)+4>>2]-n[B>>2]>>>0)/20|0),k=n[o+8>>2],b=n[o+4>>2],n[w+4>>2]=o+8,U=w,z=xe(b,k),n[U+8>>2]=z,n[w+12>>2]=C,E=n[(v=w+4|0)+4>>2],o=n[v>>2],(0|(Q=n[B>>2]))!=(0|(b=n[B+4>>2])))for(k=n[B+8>>2],B=Q+8|0,v=n[v+8>>2]+(E<<3)|0,E=E+(Q=(b-Q>>>0)/20|0)|0;b=n[k>>2],n[v>>2]=n[B>>2],n[v+4>>2]=b+1,B=B+20|0,v=v+8|0,Q=Q-1|0;);n[o>>2]=E,N=w+16|0}t=(b=s+1|0)>>>0>t>>>0?b:t,Y=Y-1|0}}break}if(We(o=i+24|0),(f=n[a+12>>2])>>>0>=t>>>0)break i;if(F(k=i+120|0,G,h,(f=(f<<=1)>>>0>t>>>0?f:t)>>>0>(b=n[A+72>>2])>>>1>>>0?b:f),-1==n[i+128>>2])break r;if(Je(o,k,96),Je(k,o,88),n[i+224>>2]=n[M+8>>2],f=n[M+4>>2],n[i+216>>2]=n[M>>2],n[i+220>>2]=f,J(o,f=i+216|0,n[A+72>>2]),-1==n[i+24>>2])break A;Je(f,o,84),Cf(l),Je(l,f,84),Ye(y),we(m),we(I)}return N=i+304|0,a}cA(0,k,b,69812),c()}e[i+24|0]=u[i+120|0],gr(69124,27,i+24|0,69604,70768),c()}e[i+216|0]=u[i+28|0],gr(69124,27,i+216|0,69604,70784),c()}function x(A,r,f,i,a,b,k,o,t,u){var v,g,w=0,l=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0;N=v=N-16|0;A:{r:{if(f){if(D=n[r>>2],G=B[D+172>>1],ZA(v,D),s=Q[v+8>>3],l=Q[v>>3],Y=Q[k+8>>3],Z=E((Y=Y!=Y?-45:Y)>-45?Y:-45,45),Y=(d=+(G>>>0))/12,w=+((G=B[D+190>>1])>>>0),i|a||(m=yr(Z)),i&=1,w=G?w:Y,s/=l,I=+(0|(G=((a=B[D+180>>1])||B[D+174>>1])<<16>>16)),Y=1,!(t>0)|1!=(0|o))break A;if((0|G)>0)break r;break A}Ur(0,0,71612),c()}Y=E((t=(t/=I)!=t?.8:t)>.8?t:.8,1.25)}for(t=i?b:Z,i=Hi(8,32),g=1.2*w,b=-.4*w,Z=Q[k>>3],a=B[D+188>>1],w=E(g,b<(w=(w=l*(Z-(a?+(a>>>0):400)))!=w?b:w)?w:b),Q[i>>3]=w,Q[i+8>>3]=s*w,Q[i+24>>3]=m,Q[i+16>>3]=Y,n[v+4>>2]=i,n[v>>2]=1,n[v+8>>2]=1,w=s*(l=E(g,b<(l=(l*=Z+-400)!=l?b:l)?l:b)),k=r+4|0,a=(f<<2)-4|0,u&=(0|G)>0,f=56,r=1;;){if(!a)return n[A+24>>2]=n[v+8>>2],r=n[v+4>>2],n[A+16>>2]=n[v>>2],n[A+20>>2]=r,e[A+28|0]=1,Q[A+8>>3]=t,b=(b=Kr(Z))!=b?1:b,Q[A>>3]=E(b>1?b:1,1e3),void(N=v+16|0);(b=Y,i=n[k>>2],o=B[i+180>>1],u&(s=d/+B[i+172>>1]*+((o||B[i+174>>1])<<16>>16))>0)&&(b*=E(M(I/s,.8),1.25)),s=yr(t),n[v>>2]==(0|r)&&(N=i=N-16|0,NA(i+8|0,v,n[v>>2],1,8,32),-1!=(0|(o=n[i+8>>2]))&&(_i(o,n[i+12>>2]),c()),N=i+16|0),i=n[v+4>>2]+f|0,Q[i>>3]=s,Q[i-8>>3]=b,Q[i-16>>3]=w,Q[i-24>>3]=l,r=r+1|0,n[v+8>>2]=r,a=a-4|0,k=k+4|0,f=f+32|0}}function L(A,r,f,i,a,b){var k,o,t,B=0,v=0,Q=0,g=0,l=0,M=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,h=0,W=0,C=0,U=0,z=0,F=0,J=0,j=0,R=0,V=0,X=0,T=0,H=0,O=0,x=0,L=0;N=k=N-32|0,e[k+28|0]=0,n[k+24>>2]=r,n[k+20>>2]=1,o=A+4|0,t=f+8|0;A:{r:{f:{i:{e:for(;;){v=l;a:{n:{for(;;){if(pr(k+8|0,k+20|0),1!=n[k+8>>2])break n;if((l=n[k+12>>2])>>>0>=r>>>0)break a;if(b>>>0>l>>>0){if(!u[a+l|0])continue;break a}break}Ur(l,b,71564),c()}return void(N=k+32|0)}if(!(l-v>>>0<=1)){if(!r)break i;if(r>>>0<=v>>>0)break f;if(i>>>0<=v>>>0)break r;a:{n:{if((Q=(l>>>0)%(r>>>0)|0)>>>0>>0){if(m=(M=R=n[(Q<<2)+A>>2])>>31,h=(B=V=n[(y=v<<2)+A>>2])>>31,G=n[(d=(Z=v<<3)+f|0)>>2],I=n[d+4>>2],W=n[(Q=(Q<<3)+f|0)>>2],D=n[Q+4>>2],(0|B)>(0|M))break n;Q=G,d=I,C=M,U=m,M=B,m=h,h=D,B=W;break a}Ur(Q,i,71516),c()}Q=W,d=D,C=B,U=h,h=I,B=G}for(z=B,F=((B=v+1|0)>>>0>>0?l:B)+(v^=-1)|0,J=(X=r>>>0>>0?B:r)+v|0,j=(T=i>>>0>>0?B:i)+v|0,W=(B=(0|G)==(0|W)&(0|I)==(0|D))?Q:0,v=B?d:0,y=y+o|0,I=Z+t|0,O=+(C-M>>>0)+4294967296*+(U-((M>>>0>C>>>0)+m|0)|0),x=+(z-Q>>>0)+4294967296*+(h-((Q>>>0>z>>>0)+d|0)|0),L=+(Q>>>0)+4294967296*+(0|d);;){if(!F)continue e;if(!J)break A;if(G=v,B=W,(0|R)!=(0|V)&&(G=d,B=Q,(0|m)>=(0|(Z=(D=n[y>>2])>>31))&M>>>0>=D>>>0|(0|m)>(0|Z)||(G=h,B=z,(0|Z)>=(0|U)&D>>>0>=C>>>0|(0|Z)>(0|U)||(g=Y(H=x*(+(D-M>>>0)+4294967296*+(Z-((M>>>0>D>>>0)+m|0)|0))/O+L),w(g=H-g>=.5?g+1:g)<0x8000000000000000?(G=w(g)>=1?~~(g>0?E(Y(2.3283064365386963e-10*g),4294967295):s(2.3283064365386963e-10*(g-+(~~g>>>0>>>0))))>>>0:0,B=~~g>>>0):(G=-2147483648,B=0)))),!j)break;n[I>>2]=B,n[I+4>>2]=G,F=F-1|0,J=J-1|0,j=j-1|0,y=y+4|0,I=I+8|0}break}}Ur(T,i,71548),c()}Qe(71580),c()}Ur(v,r,71484),c()}Ur(v,i,71500),c()}Ur(X,r,71532),c()}function p(A,r,f){var i=0,a=0,b=0,k=0,o=0,t=0,c=0,u=0,v=0,Q=0;A:{if(402653184&(u=n[A+8>>2])){r:{f:{i:{e:{if(268435456&u){if(i=B[A+14>>1])break e;f=0;break i}if(f>>>0>=16){a:{n:if((c=(i=r+3&-4)-r|0)>>>0>f>>>0||!(t=(v=f-c|0)>>>2|0)){if(i=0,!f)break a;if(k=3&f,i=0,f>>>0>=4){for(b=-4&f;o=((((e[0|(a=r+i|0)]>-65)+o|0)+(e[a+1|0]>-65)|0)+(e[a+2|0]>-65)|0)+(e[a+3|0]>-65)|0,(0|b)!=(0|(i=i+4|0)););if(!k)break n}for(b=r+i|0;o=(e[0|b]>-65)+o|0,b=b+1|0,k=k-1|0;);}else{if((0|r)!=(0|i)){if((i=r-i|0)>>>0<=4294967292)for(;b=(((b+(e[0|(b=r+o|0)]>-65)|0)+(e[b+1|0]>-65)|0)+(e[b+2|0]>-65)|0)+(e[b+3|0]>-65)|0,o=o+4|0;);for(k=r+o|0;b=(e[0|k]>-65)+b|0,k=k+1|0,i=i+1|0;);}for(i=r+c|0,(o=3&v)&&(a=e[0|(k=(2147483644&v)+i|0)]>-65,1!=(0|o)&&(a=(e[k+1|0]>-65)+a|0,2!=(0|o)&&(a=(e[k+2|0]>-65)+a|0))),o=a+b|0;;){if(a=i,!t)break n;if(v=3&(c=t>>>0>=192?192:t),b=1008&(i=c<<2))for(Q=a+b|0,k=0,b=a;k=(((k+(16843009&((-1^(k=n[b>>2]))>>>7|k>>>6))|0)+(16843009&((-1^(k=n[b+4>>2]))>>>7|k>>>6))|0)+(16843009&((-1^(k=n[b+8>>2]))>>>7|k>>>6))|0)+(16843009&((-1^(k=n[b+12>>2]))>>>7|k>>>6))|0,(0|Q)!=(0|(b=b+16|0)););else k=0;if(t=t-c|0,i=a+i|0,o=(g((k>>>8&16711935)+(16711935&k)|0,65537)>>>16|0)+o|0,v)break}a=16843009&((-1^(a=n[(i=a+((252&c)<<2)|0)>>2]))>>>7|a>>>6),1!=(0|v)&&(a=a+(16843009&((-1^(b=n[i+4>>2]))>>>7|b>>>6))|0,2!=(0|v)&&(a=a+(16843009&((-1^(i=n[i+8>>2]))>>>7|i>>>6))|0)),o=(g((a>>>8&459007)+(16711935&a)|0,65537)>>>16|0)+o|0}i=o}break r}if(!f)break r;if(b=3&f,f>>>0>=4){for(o=12&f;i=(((i+(e[0|(i=r+a|0)]>-65)|0)+(e[i+1|0]>-65)|0)+(e[i+2|0]>-65)|0)+(e[i+3|0]>-65)|0,(0|o)!=(0|(a=a+4|0)););if(!b)break r}for(a=r+a|0;i=(e[0|a]>-65)+i|0,a=a+1|0,b=b-1|0;);break r}for(t=r+f|0,f=0,a=r,b=i;;){if((0|a)==(0|t))break f;if(o=a,a=a+1|0,(0|(k=e[0|o]))>=0||(a=o+2|0,k>>>0<4294967264||(a=(k>>>0>4294967279?4:3)+o|0)),f=(a-o|0)+f|0,!(b=b-1|0))break}}b=0}i=i-b|0}if(!((a=B[A+12>>1])>>>0<=i>>>0)){b=a-i|0,a=0;r:{f:switch((u>>>29&3)-1|0){case 0:a=b;break r;case 1:break f;default:break r}a=(65534&b)>>>1|0}if(t=2097151&u,o=n[A+4>>2],k=n[A>>2],u=65535&a)for(c=n[o+16>>2],i=0,A=1;;){if(0|Aa[0|c](k,t))break A;if(!(u>>>0>(65535&(i=i+1|0))>>>0))break}if(0|Aa[n[o+12>>2]](k,r,f))return 1;if((65535&b)==(65535&a))return 0;for(r=n[o+16>>2],i=0,f=b-a&65535;;){if(A=0|Aa[0|r](k,t))break A;if(!(f>>>0>(65535&(i=i+1|0))>>>0))break}break A}}A=0|Aa[n[n[A+4>>2]+12>>2]](n[A>>2],r,f)}return A}function S(A,r,f,i){var e,b=0,k=0,o=0,t=0,c=0,v=0,Q=0;N=e=N-16|0;A:{r:{if(!(1&i)){if(k=u[0|f])break r;b=0;break A}b=0|Aa[n[r+12>>2]](A,f,i>>>1|0);break A}for(v=n[r+12>>2];;){b=f+1|0;r:{f:{i:{e:{if(k<<24>>24<0){if(128==(0|k))break e;if(192!=(0|k))break f;if(n[e+4>>2]=r,n[e>>2]=A,n[e+8>>2]=1610612768,n[e+12>>2]=0,!(0|Aa[n[(f=(t<<3)+i|0)+4>>2]](n[f>>2],e)))break i;b=1;break A}if(!(0|Aa[0|v](A,b,k))){f=b+k|0;break r}b=1;break A}if(b=f+3|0,f=u[f+1|0]|u[f+2|0]<<8,!(0|Aa[0|v](A,b,f))){f=f+b|0;break r}b=1;break A}t=t+1|0,f=b;break r}if(Q=1610612768,1&k&&(Q=u[f+1|0]|u[f+2|0]<<8|u[f+3|0]<<16|u[f+4|0]<<24,b=f+5|0),o=0,2&k?(c=u[0|b]|u[b+1|0]<<8,f=b+2|0):(c=0,f=b),4&k&&(o=u[0|f]|u[f+1|0]<<8,f=f+2|0),8&k&&(t=u[0|f]|u[f+1|0]<<8,f=f+2|0),c=16&k?B[4+((c<<3)+i|0)>>1]:c,32&k&&(o=B[4+((o<<3)+i|0)>>1]),a[e+14>>1]=o,a[e+12>>1]=c,n[e+8>>2]=Q,n[e+4>>2]=r,n[e>>2]=A,b=1,0|Aa[n[(o=(t<<3)+i|0)+4>>2]](n[o>>2],e))break A;t=t+1|0}if(!(k=u[0|f]))break}b=0}return N=e+16|0,b}function _(A,r,f){var i,e=0,a=0,b=0,k=0;if(N=i=N-96|0,PA(a=i+8|0,f),e=Hi(4,12),vf(i+48|0,r,a),n[e>>2]=n[i+48>>2],b=255&r,n[e+4>>2]=g(u[b+72144|0],228)+74480,n[e+8>>2]=74232,a=3,n[i+24>>2]=3,n[i+28>>2]=e,n[i+32>>2]=3,r=3,!(1!=n[f+16>>2]|n[f+20>>2])&&(r=3,Q[f+24>>3]>0)){e=1,f=74480;A:{r:switch(b-1|0){case 0:e=(r=Q[i+16>>3]<0)?5:3,f=r?75392:74936;break A;case 1:break r;default:break A}e=7,f=75848}for(n[i+56>>2]=f,n[i+48>>2]=0,n[i+52>>2]=2,n[i+60>>2]=g(e,228)+74480,di(f=i+24|0,(k=n[(e=i+48|0)+4>>2])-(r=n[e>>2])|0),e=8+(e+(r<<2)|0)|0,a=n[f+8>>2],b=n[f+4>>2]+(a<<2)|0;(0|r)!=(0|k);)n[b>>2]=n[e>>2],e=e+4|0,b=b+4|0,a=a+1|0,r=r+1|0;n[f+8>>2]=a,a=n[i+32>>2],e=n[i+28>>2],r=n[i+24>>2]}for(n[i+36>>2]=0,n[i+40>>2]=4,n[i+44>>2]=0,f=n[18616],b=n[18615],n[i+80>>2]=(a<<2)+e,n[i+76>>2]=r,n[i+72>>2]=e,n[i+68>>2]=e,n[i+60>>2]=b,n[i+64>>2]=f,n[i+56>>2]=1,n[i+48>>2]=1,n[i+52>>2]=0,f=i+68|0;;){A:{r:{if(e){if((0|(r=n[i+72>>2]))!=n[i+80>>2])break r;ee(f),n[i+68>>2]=0}if(!(n[i+56>>2]==n[i+52>>2]|1!=n[i+48>>2])){n[i+52>>2]=1,e=n[i+64>>2],r=n[i+60>>2];break A}return ee(f),n[A+8>>2]=n[i+44>>2],r=n[i+40>>2],n[A>>2]=n[i+36>>2],n[A+4>>2]=r,void(N=i+96|0)}n[i+72>>2]=r+4,r=n[r>>2],e=n[r+4>>2],r=n[r>>2]}n[i+92>>2]=e,n[i+88>>2]=r,Dr(i+88|0,n[i+40>>2],n[i+44>>2])||If(i+36|0,r,e),e=n[i+68>>2]}}function K(A,r,f){var i,e,a=0,b=0,k=0,o=0,t=0,B=0;k=f<<5,b=1;A:{if(1==u[A+32|0]){for(b=-4,a=1;b;)a=aA(r,A,a+k|0)|a<<1,b=b+1|0;if(b=16,16!=(0|(a=a-15|0)))break A}for(;;){if(a=32,32==(0|b))break A;if(!aA(r,A,b+k|0)){o=b;break}b=b+1|0}a=o}o=(k=n[A+24>>2])>>>0<(t=a-1|0)>>>0?k:t,e=(i=g(n[A+28>>2],g(f,21)+(a>>>0>=20?20:a)|0))+8|0,A=A+12|0,a=a-2|0,b=0,k=1,f=0;A:{for(;;){r:{f:{i:{if((0|b)!=(0|o)){if(b>>>0<3)break i;B=e+(a>>>0>=15?15:a)|0;break f}for(A=t-o|0;;){if(!A)break r;if(t=A>>>0>=16?16:A,b=n[r+16>>2]>>>t|0,n[r+16>>2]=b,!b)break A;for(A=A-t|0,o=k,a=31&t,(63&t)>>>0>=32?(f=k<>>32-a|f<>2])-g(b,k=(a>>>0)/(b>>>0)|0)|0;n[r+12>>2]=a,b>>>0<=16777215;)n[r+16>>2]=b<<8,a=Sf(r)|a<<8,b=n[r+16>>2];k=k&~(-1<>>31,k=aA(r,A,B)|k<<1,b=b+1|0,a=a-1|0;continue}break}return C=f-!k|0,k-1|0}ve(70800),c()}function P(A,r){var f,i=0,a=0,b=0,k=0,o=0,t=0;if(f=n[r+4>>2]){for(b=n[r>>2];;){A:{i=a+1|0;r:if(!((0|(t=(o=u[a+b|0])<<24>>24))>=0)){f:{i:{e:{a:{n:{b:{k:{o:{t:switch(u[o+73410|0]-2|0){case 0:if(e[0|(i>>>0>=f>>>0?67347:i+b)]>=-64)break A;i=a+2|0;break r;case 1:if(k=e[0|(i>>>0>=f>>>0?67347:i+b)],!(o=o-224|0))break o;if(13==(0|o))break k;break b;case 2:break t;default:break A}switch(k=e[0|(i>>>0>=f>>>0?67347:i+b)],o-240|0){case 4:break e;case 0:break a;default:break n}}if(-96!=(-32&k))break A;break f}if((0|k)>-97)break A;break f}if((t+31&255)>>>0>=12){if(-18!=(-2&t)|(0|k)>=-64)break A;break f}if((0|k)>=-64)break A;break f}if((t+15&255)>>>0>2|(0|k)>=-64)break A;break i}if((k+112&255)>>>0>=48)break A;break i}if((0|k)>-113)break A}if(e[0|((i=a+2|0)>>>0>=f>>>0?67347:b+i)]>-65)break A;if(e[0|((i=a+3|0)>>>0>=f>>>0?67347:b+i)]>-65)break A;i=a+4|0;break r}if(e[0|((i=a+2|0)>>>0>=f>>>0?67347:b+i)]>=-64)break A;i=a+3|0}if(a=i,f>>>0>i>>>0)continue}break}return n[A+4>>2]=a,n[A>>2]=b,n[r+4>>2]=f-i,n[r>>2]=i+b,n[A+12>>2]=i-a,void(n[A+8>>2]=a+b)}n[A>>2]=0}function q(A,r,f,i){var e,a=0,b=0,k=0,o=0,t=0,u=0,B=0,v=0,Q=0;if(N=e=N-48|0,n[A+28>>2]==n[A+24>>2]){if(a=n[A+8>>2],k=n[A+4>>2],n[e+40>>2]=k,n[e+32>>2]=0,n[e+24>>2]=0,n[e+44>>2]=k+(a<<3),o=e+12|0,N=a=N+-64|0,Br(a+16|0,k=e+24|0),1!=n[a+16>>2])n[o+8>>2]=0,n[o>>2]=0,n[o+4>>2]=4;else{for(b=n[a+20>>2],hr(a+8|0,4,4,4),t=n[a+8>>2],u=n[a+12>>2],n[u>>2]=b,n[a+36>>2]=1,n[a+32>>2]=u,n[a+28>>2]=t,b=n[k+20>>2],n[a+56>>2]=n[k+16>>2],n[a+60>>2]=b,b=n[k+12>>2],n[a+48>>2]=n[k+8>>2],n[a+52>>2]=b,b=n[k+4>>2],n[a+40>>2]=n[k>>2],n[a+44>>2]=b,b=a+28|0,v=a+40|0,N=t=N-16|0;Br(t+8|0,v),1==n[t+8>>2];)Q=n[t+12>>2],(0|(u=n[b+8>>2]))==n[b>>2]&&di(b,1),n[n[b+4>>2]+(u<<2)>>2]=Q,n[b+8>>2]=u+1;N=t+16|0,n[o+8>>2]=n[a+36>>2],b=n[a+32>>2],n[o>>2]=n[a+28>>2],n[o+4>>2]=b}N=a- -64|0,b=n[e+20>>2],a=(a=1<<1-l(b))>>>0<=16?16:a,n[A+24>>2]=a,jA(k,a+1|0),ge(A+12|0),n[A+20>>2]=n[e+32>>2],a=n[e+28>>2],n[A+12>>2]=n[e+24>>2],n[A+16>>2]=a,N=a=N-32|0,FA(a+20|0,t=n[A+24>>2],1,4,8),o=n[a+24>>2],1==n[a+20>>2]?(_i(o,n[a+28>>2]),c()):(u=n[a+28>>2],n[k+8>>2]=t,n[k+4>>2]=u,n[k>>2]=o,N=a+32|0),We(A),n[A+8>>2]=n[e+32>>2],a=n[e+28>>2],n[A>>2]=n[e+24>>2],n[A+4>>2]=a,n[A+28>>2]=0,k=n[e+12>>2],a=n[e+16>>2],o=b<<2,n[e+36>>2]=a+o,n[e+32>>2]=k,n[e+28>>2]=a,n[e+24>>2]=a;A:{for(;;){if(!o)break A;if(k=a+4|0,n[e+28>>2]=k,!((a=n[a>>2])>>>0>>0))break;n[76+(g(a,80)+f|0)>>2]=B,b=oi(A,B,70364),n[b+4>>2]=a,n[b>>2]=1,zr(A,n[A+28>>2],1),B=n[A+28>>2]+1|0,n[A+28>>2]=B,o=o-4|0,a=k}Ur(a,i,70348),c()}hi(e+24|0)}if(r>>>0>>0)return i=g(r,80)+f|0,f=n[A+28>>2],n[i+76>>2]=f,f=oi(A,f,70332),n[f+4>>2]=r,n[f>>2]=1,zr(A,n[A+28>>2],1),n[A+28>>2]=n[A+28>>2]+1,n[A+32>>2]=n[A+32>>2]+1,void(N=e+48|0);Ur(r,i,70316),c()}function $(A,r){var f=0,i=0;f=A+r|0;A:{r:{f:if(!(1&(i=n[A+4>>2]))){if(!(2&i))break r;if(r=(i=n[A>>2])+r|0,(0|(A=A-i|0))==n[19243]){if(3&~n[f+4>>2])break f;return n[19241]=r,n[f+4>>2]=-2&n[f+4>>2],n[A+4>>2]=1|r,void(n[f>>2]=r)}iA(A,i)}f:{i:{if(!(2&(i=n[f+4>>2]))){if((0|f)==n[19244])break f;if((0|f)==n[19243])break A;if(iA(f,f=-8&i),r=r+f|0,n[A+4>>2]=1|r,n[A+r>>2]=r,n[19243]!=(0|A))break i;return void(n[19241]=r)}n[f+4>>2]=-2&i,n[A+4>>2]=1|r,n[A+r>>2]=r}return r>>>0>=256?void oA(A,r):((f=n[19239])&(i=1<<(r>>>3))?(f=(r&=248)+76692|0,r=n[r+76700>>2]):(n[19239]=f|i,f=r=76692+(248&r)|0),n[f+8>>2]=A,n[r+12>>2]=A,n[A+12>>2]=f,void(n[A+8>>2]=r))}n[19244]=A,r=n[19242]+r|0,n[19242]=r,n[A+4>>2]=1|r,n[19243]==(0|A)&&(n[19241]=0,n[19243]=0)}return}n[19243]=A,r=n[19241]+r|0,n[19241]=r,n[A+4>>2]=1|r,n[A+r>>2]=r}function AA(A,r,f){var i,e=0,a=0,k=0,o=0,c=0,u=0,B=0;N=i=N+-64|0,n[i+28>>2]=f;A:{if(-1!=n[r>>2]){if(f=n[r+8>>2],n[i+40>>2]=f,a=n[r+4>>2],n[i+32>>2]=n[r>>2],n[i+36>>2]=a,(f>>>0)%3|0){r=0|d(71316,16),n[A>>2]=-1,n[A+4>>2]=r;break A}}else f=0,n[i+40>>2]=0,n[i+32>>2]=0,n[i+36>>2]=8;for(r=n[i+36>>2],n[i+48>>2]=i+28,hr(i+16|0,f=(f>>>0)/3|0,8,16),n[i+60>>2]=0,a=n[i+20>>2],n[i+52>>2]=n[i+16>>2],n[i+56>>2]=a,f=g(f,24),a=12;;){r:{if(f){if(c=Q[r+16>>3],Bf(i+8|0,e=i+48|0,Q[r>>3]),u=n[i+12>>2],Bf(i,e,Q[r+8>>3]),B=1!=n[i+8>>2],t(+c),1&!(B|-2097152==(0|(e=(e=0|b(1))<<1|(k=0|b(0))>>>31))|e>>>0>4292870144)&n[i>>2])break r;r=0|d(71316,16),n[A>>2]=-1,n[A+4>>2]=r,ye(i+52|0);break A}n[A+8>>2]=n[i+60>>2],r=n[i+56>>2],n[A>>2]=n[i+52>>2],n[A+4>>2]=r;break A}k=n[i+4>>2],n[i+52>>2]==(0|o)&&of(i+52|0),r=r+24|0,e=n[i+56>>2]+a|0,n[e>>2]=k,n[e-4>>2]=u,Q[e-12>>3]=c,o=o+1|0,n[i+60>>2]=o,f=f-24|0,a=a+16|0}}we(i+32|0),N=i- -64|0}function rA(A,r){var f=0,i=0,e=0,a=0,b=0,k=0;return((e=(-48-n[19250]&-9)-3|0)>>>0>=4294967232?-64:e)-(A=A>>>0<=16?16:A)>>>0<=r>>>0||(f=z(12+((e=r>>>0<11?16:r+11&-8)+A|0)|0))&&(r=f-8|0,(i=A-1|0)&f?(k=A,i=(-8&(b=n[(a=f-4|0)>>2]))-(f=(A=((A=(f+i&0-A)-8|0)-r>>>0<=16?k:0)+A|0)-r|0)|0,3&b?(n[A+4>>2]=i|1&n[A+4>>2]|2,n[(i=A+i|0)+4>>2]=1|n[i+4>>2],n[a>>2]=f|1&n[a>>2]|2,n[(i=r+f|0)+4>>2]=1|n[i+4>>2],$(r,f)):(r=n[r>>2],n[A+4>>2]=i,n[A>>2]=r+f)):A=r,3&(r=n[A+4>>2])&&((f=-8&r)>>>0<=e+16>>>0||(n[A+4>>2]=e|1&r|2,r=A+e|0,e=f-e|0,n[r+4>>2]=3|e,n[(f=A+f|0)+4>>2]=1|n[f+4>>2],$(r,e))),i=A+8|0),i}function fA(A,r,f,i,a,b,k,o){var t,B=0,v=0,Q=0,w=0,l=0,E=0,M=0;N=t=N-32|0,n[A+8>>2]=0,n[A+12>>2]=0,n[A>>2]=0,n[A+4>>2]=0,n[t+20>>2]=1,e[t+28|0]=0,B=o-!!(0|o)|0,n[t+24>>2]=B>>>0>=4?4:B,Q=-1640531535;A:{r:{f:{i:{e:{a:{n:{for(;;){if(pr(t+8|0,t+20|0),1!=n[t+8>>2])break n;if((B=o-(w=n[t+12>>2])|0)>>>0>=a>>>0)break a;if((v=B-1|0)>>>0>=a>>>0)break e;if(k>>>0<=B>>>0)break i;if(k>>>0<=v>>>0)break f;if(f>>>0<=B>>>0)break r;if(f>>>0<=v>>>0)break A;if(!((l=w-1|0)>>>0<4))break;E=u[r+v|0],M=u[r+B|0],v<<=2,Q=g(M^g(n[(B<<=2)+b>>2]-n[v+b>>2]^g(n[i+B>>2]-n[i+v>>2]^Q,-2048144789),-1028477387),668265263),B=g(E^g(w^Q,-775183833),668265263),n[(l<<2)+A>>2]=B>>>15^B}Ur(l,4,71468),c()}return void(N=t+32|0)}Ur(B,a,71372),c()}Ur(v,a,71388),c()}Ur(B,k,71404),c()}Ur(v,k,71420),c()}Ur(B,f,71436),c()}Ur(v,f,71452),c()}function iA(A,r){var f=0,i=0,e=0,a=0,b=0,k=0;f=n[A+12>>2];A:{r:{f:{if(r>>>0>=256){i=n[A+24>>2];i:{e:{if((0|A)==(0|f)){if(f=n[A+20>>2],r=n[(f?20:16)+A>>2])break e;f=0;break i}r=n[A+8>>2],n[r+12>>2]=f,n[f+8>>2]=r;break i}for(e=f?A+20|0:A+16|0;a=e,e=(r=n[(f=r)+20>>2])?f+20|0:f+16|0,r=n[(r?20:16)+f>>2];);n[a>>2]=0}if(!i)break r;i:{if(r=76548+(n[A+28>>2]<<2)|0,n[r>>2]!=(0|A)){if(n[i+16>>2]==(0|A))break i;if(n[i+20>>2]=f,f)break f;break r}if(n[r>>2]=f,!f)break A;break f}if(n[i+16>>2]=f,f)break f;break r}return(0|(A=n[A+8>>2]))!=(0|f)?(n[A+12>>2]=f,void(n[f+8>>2]=A)):(b=76956,k=n[19239]&Oe(r>>>3|0),void(n[b>>2]=k))}if(n[f+24>>2]=i,(r=n[A+16>>2])&&(n[f+16>>2]=r,n[r+24>>2]=f),A=n[A+20>>2])return n[f+20>>2]=A,void(n[A+24>>2]=f)}return}b=76960,k=n[19240]&Oe(n[A+28>>2]),n[b>>2]=k}function eA(A,r,f,i){var e,a=0,b=0,k=0,o=0,t=0,u=0,B=0,v=0,Q=0,g=0,w=0,l=0;N=e=N-16|0;A:if(!(r>>>0<2))for(Df(e,a=A,r,A=r>>>1|0,70816),B=n[e+12>>2],v=n[e+8>>2],k=n[e+4>>2],Q=n[e>>2],Df(e,f,i,A,70832),A=n[e+12>>2],r=n[e+8>>2],eA(n[e>>2],n[e+4>>2],Q,k),eA(r,A,v,B),w=(i<<4)+f|0,i=0;;){g=(i<<4)+Q|0,t=(u<<4)+v|0,r=0;r:{f:{for(;;){if((0|w)==(0|(a=r+f|0)))break A;if(u>>>0>>0){if((0|i)==(0|k)){A=n[t>>2],o=n[t+4>>2];break r}if(i>>>0>=k>>>0)break f;if(l=n[(b=r+g|0)>>2],(0|(o=n[t+4>>2]))==(0|(b=n[b+4>>2]))&l>>>0>(A=n[t>>2])>>>0|o>>>0>>0)break r}if(!(i>>>0>>0))break;o=n[(A=r+g|0)>>2],b=n[A+4>>2],n[a+8>>2]=n[A+8>>2],n[a>>2]=o,n[a+4>>2]=b,r=r+16|0,i=i+1|0}Ur(i,k,70864),c()}Ur(i,k,70848),c()}n[a+8>>2]=n[t+8>>2],n[a>>2]=A,n[a+4>>2]=o,u=u+1|0,f=a+16|0}N=e+16|0}function aA(A,r,f){var i=0,b=0,k=0,o=0,t=0,v=0,Q=0,w=0;A:{r:{if((i=n[r+8>>2])>>>0>f>>>0){if(v=1,k=n[A+16>>2],r=n[r+4>>2]+g(f,6)|0,i=32768^B[r+2>>1],b=32768^B[r>>1],(Q=(f=g(k>>>12|0,(f=i+b>>>5|0)>>>0<=1?1:f))>>>0>(o=n[A+12>>2])>>>0)||(o=o-f|0,n[A+12>>2]=o,v=0,f=k-f|0),n[A+16>>2]=f,t=u[r+4|0],w=(k=31^l(t+2|0))>>>0<4,255!=(0|t))break r;break A}Ur(f,i,69620),c()}e[r+4|0]=t+1}for(t=w?k:4,Q?(b=b+(65536-b>>>t|0)|0,i=(65536-i>>>k|0)+i|0):(b=b-(b>>>t|0)|0,i=i-(i>>>k|0)|0),a[r+2>>1]=32768^i,a[r>>1]=32768^b;f>>>0<=16777215;)n[A+16>>2]=f<<8,o=Sf(A)|o<<8,n[A+12>>2]=o,f=n[A+16>>2];return v}function nA(A,r,f){var i,e=0,a=0,b=0,k=0,o=0,t=0,c=0,u=0,B=0;c=n[r+52>>2],o=(b=n[ti(c+52|0,f,70380)>>2])>>31,i=(t=n[ti(c- -64|0,f,70396)>>2])>>31,c=A,(u=n[r+48>>2])?(A=Te((A=n[ti(u+52|0,f,70412)>>2])-b|0,(A>>31)-((A>>>0>>0)+o|0)|0,n[r+16>>2],n[r+20>>2]),a=(e=C)+1|0,k=e,A=Re(e=A+16|0,a=e>>>0<16?a:k,32),o=o+(B=C)|0,A=(a=a-((B<<5|A>>>27)+(A<<5>>>0>e>>>0)|0)>>31)+(A>>>0>(b=b+A|0)>>>0?o+1|0:o)|0,a=(e=a+b|0)>>>0>>0?A+1|0:A,A=Te((A=n[ti(u- -64|0,f,70428)>>2])-t|0,(A>>31)-((A>>>0>>0)+i|0)|0,n[r+24>>2],n[r+28>>2]),k=(r=C)+1|0,f=r,b=(A=Re(r=A+16|0,f=r>>>0<16?k:f,32))+t|0,t=(o=C)+i|0,A=(f=f-((o<<5|A>>>27)+(A<<5>>>0>r>>>0)|0)>>31)+(A>>>0>b>>>0?t+1|0:t)|0,A=(r=f+b|0)>>>0>>0?A+1|0:A):(A=n[r>>2],f=n[r+4>>2],(e=n[r+32>>2])|(u=n[r+40>>2])|(a=n[r+36>>2])|(B=n[r+44>>2])?(e=Te(t,i,e,a),a=C,A=(f=Te(A- -64|0,f-((A>>>0<4294967232)-1|0)|0,b,o))+e|0,e=C+a|0,k=(f=A>>>0>>0?e+1|0:e)+1|0,e=f,A=Re(f=A+32|0,e=f>>>0<32?k:e,64),a=(e=(f=(k=e)-(((e=C)<<6|A>>>26)+(f>>>0>>0)|0)>>31)+e|0)+1|0,k=e,a=A>>>0>(e=A+f|0)>>>0?a:k,A=Te(b,o,u,B),f=C,r=Te((b=n[r+8>>2])- -64|0,n[r+12>>2]-((b>>>0<4294967232)-1|0)|0,t,i),f=C+f|0,k=(r=(A=A+r|0)>>>0>>0?f+1|0:f)+1|0,f=r,A=Re(r=A+32|0,f=r>>>0<32?k:f,64),f=(r=(k=f)-(((f=C)<<6|A>>>26)+(A<<6>>>0>r>>>0)|0)>>31)+f|0,A=(r=A+r|0)>>>0>>0?f+1|0:f):(e=Of(b,o,A,f),a=C,r=Of(t,i,n[r+8>>2],n[r+12>>2]),A=C)),n[c+8>>2]=r,n[c+12>>2]=A,n[c>>2]=e,n[c+4>>2]=a}function bA(A,r,f,i,e){var a,b=0,k=0,o=0;for(N=a=N-32|0,Xf(a+8|0,e),o=g(e,12),k=f<<3|4,b=i;o;)o=o-12|0,Kf(a+8|0,k),k=n[b+8>>2]+k|0,b=b+12|0;n[a+28>>2]=0,n[a+20>>2]=0,n[a+24>>2]=1,Rf(b=a+20|0,0),Rf(b,f),o=f<<3;A:{for(;;){r:{if(!o)for(r=g(e,12);;){if(!r)break r;ke(a+20|0,n[i+4>>2],n[i+8>>2]),r=r-12|0,i=i+12|0}if(f=n[r+4>>2],k=B[r+2>>1],Rf(b=a+20|0,B[r>>1]),Rf(b,k),(k=n[a+16>>2])>>>0<=f>>>0)break A;Qf(b,n[n[a+12>>2]+(f<<2)>>2]),o=o-8|0,r=r+8|0;continue}break}return n[A+8>>2]=n[a+28>>2],r=n[a+24>>2],n[A>>2]=n[a+20>>2],n[A+4>>2]=r,ge(a+8|0),void(N=a+32|0)}Ur(f,k,71248),c()}function kA(A,r){var f,i,e,a=0,b=0,k=0,o=0,t=0,c=0;for(N=f=N-48|0,SA(f,r),a=n[f>>2],n[f+36>>2]=0,n[f+28>>2]=0,n[f+32>>2]=4,o=(r=r-12&255)>>>0>=3?-1:!r,i=n[18616],e=n[18615],b=1;;){A:{r:{f:{i:{e:switch(0|b){default:if(k=0,a)break f;a=0;break;case 0:break e;case 2:break i}e:{a:{n:switch(0|(r=255&o)){case 0:break a;case 1:break n;default:break e}r=2}o=255,k=a,a=g(r,228)+74480|0,b=0;break r}if(o=254,!t){k=a,t=1,a=74232,b=0;break r}}if(!c){c=1,b=2,r=i,k=a,a=e;break A}return n[A+8>>2]=n[f+36>>2],r=n[f+32>>2],n[A>>2]=n[f+28>>2],n[A+4>>2]=r,void(N=f+48|0)}b=1}r=n[a+4>>2],a=n[a>>2]}n[f+44>>2]=r,n[f+40>>2]=a,Dr(f+40|0,n[f+32>>2],n[f+36>>2])||If(f+28|0,a,r),a=k}}function oA(A,r){var f,i=0,e=0,a=0;if(n[A+16>>2]=0,n[A+20>>2]=0,f=A,A=0,(i=r>>>8|0)&&(A=31,r>>>0>=16777216||(A=62^(r>>>38-(A=l(i))&1|A<<1))),n[f+28>>2]=A,i=76548+(A<<2)|0,!((e=1<>2]=f,n[f+24>>2]=i,n[f+12>>2]=f,n[f+8>>2]=f,void(n[19240]=e|n[19240]);A:{if(i=n[i>>2],(-8&n[i+4>>2])!=(0|r))for(e=r<<(31!=(0|A)?25-(A>>>1|0)|0:0);;){if(!(A=n[(a=(e>>>29&4)+i|0)+16>>2]))break A;if(e<<=1,i=A,(-8&n[A+4>>2])==(0|r))break}else A=i;return r=n[A+8>>2],n[r+12>>2]=f,n[A+8>>2]=f,n[f+24>>2]=0,n[f+12>>2]=A,void(n[f+8>>2]=r)}n[a+16>>2]=f,n[f+24>>2]=i,n[f+12>>2]=f,n[f+8>>2]=f}function tA(A,r,f,i){var e,a=0,b=0,k=0,o=0,t=0,c=0,u=0,B=0,v=0,Q=0,g=0,w=0,l=0;N=e=N-48|0,n[e+24>>2]=i,n[e+20>>2]=f;A:if(i){for(B=n[f>>2],a=n[r+8>>2],f=n[a+40>>2],n[e+28>>2]=f,n[e+32>>2]=f+(n[a+44>>2]<<2),n[e+44>>2]=r,n[e+36>>2]=a,n[e+40>>2]=e+20,o=e+8|0,N=f=N-16|0,i=n[(k=e+28|0)+4>>2]-4|0,v=n[(b=e+36|0)+8>>2],u=n[b+4>>2],Q=n[b>>2],g=n[k>>2];;){r:{f:{if((i+4|0)==(0|g))i=0;else{if(n[k+4>>2]=i,CA(f,Q,t=n[i>>2]),!(b=n[f>>2]))break f;if(w=b,!Ci((b=n[f+12>>2])?n[f+8>>2]:w,b||n[f+4>>2],n[u>>2],n[u+4>>2]))break f;if(pA(f,v,t),!n[f>>2])break f;i=1}n[o+4>>2]=t,n[o>>2]=i,N=f+16|0;break r}i=i-4|0;continue}break}r:if(1&n[e+8>>2])c=n[e+12>>2];else for(o=n[e+24>>2],k=n[e+20>>2],f=(f=n[a+20>>2])>>>0<(i=n[a+32>>2])>>>0?f:i,i=n[a+16>>2]+12|0,a=n[a+28>>2];;){if(!f)break A;if(n[a>>2]==(0|B)&&Ci(n[i-8>>2],n[i-4>>2],k,o)&&(pA(e+36|0,r,c=n[i>>2]),n[e+36>>2]))break r;f=f-1|0,i=i+28|0,a=a+4|0}l=1}n[A+4>>2]=c,n[A>>2]=l,N=e+48|0}function cA(A,r,f,i){var e;N=e=N-32|0;A:{if(A>>>0<=f>>>0){if(A>>>0<=r>>>0|r>>>0>f>>>0)break A;n[e+8>>2]=A,n[e+12>>2]=r,n[e+24>>2]=e+12,n[e+28>>2]=40,n[e+16>>2]=e+8,n[e+20>>2]=40,yf(65546,e+16|0,i),c()}n[e+8>>2]=A,n[e+12>>2]=f,n[e+24>>2]=e+12,n[e+28>>2]=40,n[e+16>>2]=e+8,n[e+20>>2]=40,yf(65641,e+16|0,i),c()}n[e+8>>2]=r,n[e+12>>2]=f,n[e+24>>2]=e+12,n[e+28>>2]=40,n[e+16>>2]=e+8,n[e+20>>2]=40,yf(65698,e+16|0,i),c()}function uA(A,r,f,i,e){var a,b=0,k=0,o=0,t=0,c=0,u=0;N=a=N-32|0,hr(a+8|0,e,4,8),n[a+28>>2]=0,b=n[a+12>>2],n[a+20>>2]=n[a+8>>2],n[a+24>>2]=b,e<<=2,o=4;A:{for(;;){r:{f:{if(e){if((b=(c=n[i>>2])+k|0)>>>0>>0)break r;if(f>>>0>=b>>>0)break f;break r}if((0|f)!=(0|k))break r;n[A+8>>2]=n[a+28>>2],r=n[a+24>>2],n[A>>2]=n[a+20>>2],n[A+4>>2]=r;break A}n[a+20>>2]==(0|t)&&tf(a+20|0),i=i+4|0,u=n[a+24>>2]+o|0,n[u>>2]=c,n[u-4>>2]=(k<<2)+r,t=t+1|0,n[a+28>>2]=t,e=e-4|0,o=o+8|0,k=b;continue}break}r=0|d(69290,16),n[A>>2]=-1,n[A+4>>2]=r,We(a+20|0)}N=a+32|0}function BA(A,r,f,i,a,k){var o,c=0;N=o=N-144|0,Mr(o+8|0),e[A+128|0]=r,e[A+129|0]=f,Q[A+24>>3]=a,Q[A+8>>3]=i,Q[A+40>>3]=k,Q[A+80>>3]=Q[o+88>>3],Q[A+56>>3]=Q[o+64>>3],r=n[o+60>>2],n[A+48>>2]=n[o+56>>2],n[A+52>>2]=r,Q[A+88>>3]=Q[o+96>>3],Q[A+96>>3]=Q[o+104>>3],t(+a),r=0|b(1),c=(f=0|b(0))-1|0,f=(r&=2147483647)-!f|0,n[A+16>>2]=1048575==(0|f)&-1!=(0|c)|f>>>0<1048575|r+-1048576>>>0<2145386496,n[A+20>>2]=0,t(+i),r=0|b(1),c=(f=0|b(0))-1|0,f=(r&=2147483647)-!f|0,n[A>>2]=1048575==(0|f)&-1!=(0|c)|f>>>0<1048575|r+-1048576>>>0<2145386496,n[A+4>>2]=0,t(+k),r=0|b(1),c=(f=0|b(0))-1|0,f=(r&=2147483647)-!f|0,n[A+32>>2]=1048575==(0|f)&-1!=(0|c)|f>>>0<1048575|r+-1048576>>>0<2145386496,n[A+36>>2]=0,e[A+130|0]=u[o+138|0],r=n[o+116>>2],n[A+104>>2]=n[o+112>>2],n[A+108>>2]=r,n[A+112>>2]=n[o+120>>2],r=n[o+76>>2],n[A+64>>2]=n[o+72>>2],n[A+68>>2]=r,Q[A+72>>3]=Q[o+80>>3],r=n[o+128>>2],n[A+116>>2]=n[o+124>>2],n[A+120>>2]=r,n[A+124>>2]=n[o+132>>2],N=o+144|0}function vA(A,r){var f,i,b=0,k=0;for(N=f=N-32|0,i=r+32|0,k=1;;){Yr(f+24|0,r);A:{r:{if(u[f+24|0])r=u[f+25|0];else{if(n[i>>2]){if(b=B[r+40>>1])break r;if(MA(f+16|0,i),1&n[f+16>>2]){if((b=n[f+20>>2])>>>0<=65535)break A;a[r+40>>1]=1023&b|56320,b=16320+(b>>>10|0)|-10240;break A}}Yr(f+8|0,r+16|0),k=u[f+8|0],r=u[f+9|0]}return e[A+1|0]=r,e[0|A]=1&k,void(N=f+32|0)}a[r+40>>1]=0}n[r+8>>2]=2,n[r>>2]=1,n[r+4>>2]=0,a[r+12>>1]=b<<8|(65280&b)>>>8}}function QA(A,r){var f,i,e=0,a=0,b=0,k=0;N=f=N-16|0,n[f+12>>2]=r,i=r+12|0;A:{r:if(!n[r+12>>2]||!(e=Fr(f+12|0,i))){f:if(a=n[r+4>>2]){for(k=n[r+8>>2];;){if((0|a)==(0|k))break f;if(b=a+12|0,n[r+4>>2]=b,e=n[a+4>>2],n[r+12>>2]=e,n[r+16>>2]=e+(n[a+8>>2]<<3),a=b,e=Fr(f+12|0,i))break}break r}if(a=0,n[r+12>>2]=0,b=r+20|0,!n[r+20>>2]||!(e=Fr(f+12|0,b))){n[b>>2]=0;break A}}r=n[e+4>>2],a=1}n[A+4>>2]=r,n[A>>2]=a,N=f+16|0}function gA(A,r,f,i,e,a,k,o,c){var u,B=0,v=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,I=0,m=0,y=0,h=0,W=0;if(N=u=N-48|0,uA(u+20|0,r,f,i,e),r=n[u+24>>2],-1!=(0|(i=n[u+20>>2])))if(f=n[u+28>>2],n[u+16>>2]=f,n[u+12>>2]=r,n[u+8>>2]=i,!((0|f)!=(0|k)&&k)&(!c|(0|f)==(0|c))){if(n[u+44>>2]=c,n[u+40>>2]=o,n[u+36>>2]=k,n[u+32>>2]=a,n[u+28>>2]=0,n[u+20>>2]=r,n[u+24>>2]=r+(f<<3),N=k=N-32|0,hr(k+8|0,n[(r=u+20|0)+4>>2]-n[r>>2]>>>3|0,8,40),n[k+28>>2]=0,f=n[k+12>>2],n[k+20>>2]=n[k+8>>2],n[k+24>>2]=f,N=o=N-16|0,i=n[(f=k+20|0)+8>>2],(e=n[r+4>>2]-n[r>>2]>>>3|0)>>>0>n[f>>2]-i>>>0&&wf(f,i,e,8,40),i=n[f+4>>2],e=n[f+8>>2],n[o+4>>2]=f+8,h=o,W=xe(i,e),n[h+8>>2]=W,n[o+12>>2]=C,N=v=N-16|0,c=n[(f=o+4|0)+4>>2],Z=n[f>>2],(0|(a=n[r>>2]))!=(0|(i=n[r+4>>2])))for(Y=n[r+24>>2],I=n[r+16>>2],f=n[f+8>>2]+g(c,40)|0,c=(w=i-a>>>3|0)+c|0,e=n[r+8>>2],E=n[r+12>>2]+(e<<3)|0,M=n[r+20>>2]+(e<<2)|0;r=n[a>>2],hr(v+8|0,l=n[a+4>>2],4,4),s=n[v+12>>2],m=n[v+8>>2],l&&(i=l<<2)&&Je(s,r,i),i=0,e>>>0>>0&&(t(+(G=Q[E>>3])),i=0|b(1),y=(B=0|b(0))-1|0,i=!((D=2147483647&i)|B)|1048575==(0|(B=i-!B|0))&-1!=(0|y)|B>>>0<1048575|((0|i)>0|(0|i)>=0)&D+-1048576>>>0<2145386496),r=e>>>0>>0?n[M>>2]:r,n[f>>2]=i,n[f+4>>2]=0,n[f+32>>2]=l,n[f+28>>2]=s,n[f+24>>2]=m,n[f+20>>2]=r,Q[f+8>>3]=G,n[f+16>>2]=-1!=(0|r)&e>>>0>>0,a=a+8|0,E=E+8|0,M=M+4|0,f=f+40|0,e=e+1|0,w=w-1|0;);n[Z>>2]=c,N=v+16|0,N=o+16|0,n[A+8>>2]=n[k+28>>2],r=n[k+24>>2],n[A>>2]=n[k+20>>2],n[A+4>>2]=r,N=k+32|0,We(u+8|0)}else r=0|d(71332,39),n[A>>2]=-1,n[A+4>>2]=r,We(u+8|0);else n[A>>2]=-1,n[A+4>>2]=r;N=u+48|0}function wA(A,r,f,i,a){var b,k=0,o=0;N=b=N-32|0,o=n[19275],n[19275]=o+1;A:{r:{f:{i:{e:{a:{n:{b:switch(k=0,(0|o)<0||(k=1,u[77080]||(e[77080]=1,n[19269]=n[19269]+1,k=2)),0|k){case 0:break i;case 2:break b;default:break n}if((0|(k=n[19272]))<0)break i;if((0|k)>(0|(o=k+1|0)))break f;if(n[19272]=o,n[19273])break a;n[19272]=o-1;break e}Aa[n[r+24>>2]](b,A),c()}if(Aa[n[r+20>>2]](b+8|0,A),e[b+29|0]=a,e[b+28|0]=i,n[b+24>>2]=f,A=n[b+12>>2],n[b+16>>2]=n[b+8>>2],n[b+20>>2]=A,Aa[n[n[19274]+20>>2]](n[19273],b+16|0),A=n[19272],n[19272]=A-1,(0|A)<=0)break r}if(e[77080]=0,i)break A}c()}hf(72824,28,72852),c()}yf(72912,77,72952),c()}c()}function lA(A,r){var f,i=0,e=0,a=0,b=0,k=0;f=n[r+16>>2]?n[r+24>>2]-n[r+20>>2]|0:0,i=(i=n[r>>2]?n[r+8>>2]-n[r+4>>2]|0:0)>>>0>(a=f+i|0)>>>0?-1:a,(b=n[r+32>>2])&&(k=i,i=(i=((i=((e=n[r+36>>2]-b|0)>>>0)/3|0)+(r=0!=B[r+40>>1])|0)+((0|e)!=(0|g(i,3)))<<1)>>>0>(b=k+i|0)>>>0?-1:b,e=r+e|0),!((0|e)<0|a>>>0>>0)&&(r=1,(a=(e<<=1)+a|0)>>>0>=e>>>0)||(r=0),n[A+8>>2]=a,n[A+4>>2]=r,n[A>>2]=i}function EA(A,r,f,i){var a,b=0,k=0,o=0,t=0,c=0,u=0;if(N=a=N-32|0,b=K(r+104|0,f,2),!(k=C)&b>>>0>=1114113|k)n[A>>2]=-1,e[A+4|0]=0;else{for(hr(a+8|0,t=b<<1,8,8),b=n[a+12>>2],n[a+20>>2]=n[a+8>>2],n[a+24>>2]=b,u=r+140|0,r=0;n[a+28>>2]=o,(0|r)!=(0|t);)b=K(u,f,(1&r)+i|0),o=C,(0|(k=n[a+28>>2]))==n[a+20>>2]&&ef(a+20|0),c=n[a+24>>2]+(k<<3)|0,n[c>>2]=b,n[c+4>>2]=o,r=r+1|0,o=k+1|0;n[A+8>>2]=n[a+28>>2],r=n[a+24>>2],n[A>>2]=n[a+20>>2],n[A+4>>2]=r}N=a+32|0}function MA(A,r){var f,i=0,e=0,a=0,b=0;(0|(f=n[r>>2]))!=n[r+4>>2]&&(b=1,n[r>>2]=f+1,(i=u[0|f])<<24>>24>=0||(n[r>>2]=f+2,e=63&u[f+1|0],a=31&i,i>>>0<=223?i=e|a<<6:(n[r>>2]=f+3,e=63&u[f+2|0]|e<<6,i>>>0<240?i=e|a<<12:(n[r>>2]=f+4,i=a<<18&1835008|63&u[f+3|0]|e<<6)))),n[A+4>>2]=i,n[A>>2]=b}function YA(A,r,f){var i,b=0,k=0,o=0,t=0,B=0,v=0,Q=0,g=0,w=0,l=0,E=0,M=0,Y=0,s=0,G=0,D=0,Z=0,d=0,I=0,m=0,y=0,U=0,z=0,j=0,R=0,V=0,X=0,T=0,H=0,O=0,x=0,L=0,p=0,S=0,_=0,K=0,P=0,q=0;if(N=i=N-208|0,k=i+16|0,b=1,1145520712!=(u[0|r]|u[r+1|0]<<8|u[r+2|0]<<16|u[r+3|0]<<24)|f>>>0<6|1!=u[r+4|0]||(v=1,2==u[r+5|0]&&(6==(0|f)|1!=u[r+6|0]||(v=2,b=0))),e[k+1|0]=v,e[0|k]=b,u[i+16|0])r=u[i+17|0],n[A>>2]=-1,e[A+4|0]=r;else if(k=i+8|0,f>>>0>=7?(n[k+4>>2]=f-7,n[k>>2]=r+7):(cA(7,f,f,70736),c()),F(i+24|0,I=n[i+8>>2],m=n[i+12>>2],0),f=u[i+24|0],-1!=(0|(k=n[i+32>>2]))){r=u[i+28|0]|u[i+29|0]<<8|u[i+30|0]<<16|u[i+31|0]<<24,e[i+124|0]=r,e[i+125|0]=r>>>8,e[i+126|0]=r>>>16,e[i+127|0]=r>>>24,r=u[i+25|0]|u[i+26|0]<<8|u[i+27|0]<<16|u[i+28|0]<<24,e[i+121|0]=r,e[i+122|0]=r>>>8,e[i+123|0]=r>>>16,e[i+124|0]=r>>>24,Je(i+132|0,i+36|0,76),n[i+128>>2]=k,e[i+120|0]=f,Y=n[i+112>>2],N=b=N-320|0,s=(o=i+120|0)+8|0,n[b>>2]=s,sr(b+4|0,b,0),sr(b+304|0,b,1),sr(b+148|0,b,2),sr(b+76|0,b,3),sr(b+220|0,b,4),n[b+24>>2]=n[b+312>>2],r=n[b+308>>2],n[b+16>>2]=n[b+304>>2],n[b+20>>2]=r,r=n[b+152>>2],n[b+28>>2]=n[b+148>>2],n[b+32>>2]=r,n[b+36>>2]=n[b+156>>2],r=n[b+80>>2],n[b+40>>2]=n[b+76>>2],n[b+44>>2]=r,n[b+48>>2]=n[b+84>>2],r=n[b+224>>2],n[b+52>>2]=n[b+220>>2],n[b+56>>2]=r,n[b+60>>2]=n[b+228>>2],n[b+72>>2]=0,n[b+64>>2]=0,n[b+68>>2]=8,y=o+20|0,l=(r=n[o+24>>2])+(n[o+28>>2]<<3&-16)|0,f=n[o>>2],v=n[o+4>>2];A:{r:{for(;;){f:{i:{if((0|r)!=(0|l)){if(!(Q=n[r+4>>2])&(k=n[r>>2])>>>0<=1114111)break i;break r}for(Q=o+32|0,r=n[o+40>>2]<<3&-16,k=n[o+36>>2],t=0,B=0;r;){if(f=B+n[k+4>>2]|0,!(B=(w=t)>>>0>(t=t+n[k>>2]|0)>>>0?f+1|0:f)&t>>>0>1114111|B)break r;mf(b- -64|0,t,B,n[k+8>>2]),r=r-16|0,k=k+16|0}Df(r=b+220|0,t=n[b+68>>2],f=(v=n[b+72>>2])>>>1|0,f,68788),B=n[b+224>>2],k=n[b+220>>2],Df(w=r,(t+(v<<4)|0)-(r=f<<4)|0,f,f,68804),r=(r+n[b+220>>2]|0)-16|0,l=(g=n[b+224>>2])>>>0>f-1>>>0;e:{for(;;){if(!(t=f+E|0))break e;if(!(B+E|0))break f;if(!l)break;G=n[k>>2],D=n[k+4>>2],t=n[r+4>>2],n[k>>2]=n[r>>2],n[k+4>>2]=t,Z=n[(t=k+8|0)>>2],d=n[(v=r+8|0)+4>>2],n[t>>2]=n[v>>2],n[t+4>>2]=d,n[r>>2]=G,n[r+4>>2]=D,n[v>>2]=Z,k=k+16|0,r=r-16|0,E=E-1|0}Ur(t-1|0,g,68836),c()}for(_A(n[b+68>>2],n[b+72>>2]),GA(b- -64|0),B=(k=n[b+72>>2]<<4)+(f=n[b+68>>2])|0,r=f;;){if(k){if(k=k-16|0,t=n[r+8>>2],r=r+16|0,t>>>0>>0)continue;break r}break}n[b+232>>2]=B,n[b+228>>2]=n[b+64>>2],n[b+224>>2]=f,n[b+220>>2]=f,Gr(f=b+208|0,k=b+220|0),B=u[o+83|0],t=u[o+82|0],v=u[o+81|0],g=u[o+80|0],E=u[o+79|0],l=u[o+78|0],G=u[o+77|0],D=u[o+76|0],Z=u[o+75|0],d=u[o+74|0],U=u[o+73|0],z=u[o+72|0],j=u[o+71|0],R=u[o+70|0],V=u[o+69|0],X=u[o+68|0],T=u[o+67|0],H=u[o+66|0],O=u[o+65|0],x=u[o+64|0],L=u[o+63|0],p=u[o+62|0],S=u[o+61|0],_=u[o+60|0],r=u[o+59|0],K=u[o+58|0],P=u[o+57|0],q=u[o+56|0],Je(M=b+148|0,b+4|0,60),n[b+312>>2]=n[o+52>>2],w=n[o+48>>2],n[b+304>>2]=n[o+44>>2],n[b+308>>2]=w,J(k,b+304|0,Y),-1!=(0|(k=n[b+220>>2]))?(f=u[b+224|0],Je(A+85|0,b+225|0,79),Je(o=b+76|0,b+4|0,60),n[b+144>>2]=n[b+216>>2],M=n[b+212>>2],n[b+136>>2]=n[b+208>>2],n[b+140>>2]=M,Je(A,o,72),e[A+200|0]=K,e[A+199|0]=r>>>1&1,e[A+198|0]=1&r,a[A+196>>1]=B|t<<8,a[A+194>>1]=v|g<<8,a[A+192>>1]=E|l<<8,a[A+190>>1]=D<<8|G,a[A+188>>1]=d<<8|Z,a[A+186>>1]=z<<8|U,a[A+184>>1]=R<<8|j,a[A+182>>1]=X<<8|V,a[A+180>>1]=H<<8|T,a[A+178>>1]=x<<8|O,a[A+176>>1]=p<<8|L,a[A+174>>1]=_<<8|S,a[A+172>>1]=q<<8|P,n[A+168>>2]=m,n[A+164>>2]=I,e[A+84|0]=f,n[A+80>>2]=k,e[A+76|0]=0,n[A+72>>2]=Y):(r=u[b+224|0],n[A>>2]=-1,e[A+4|0]=r,We(f),ui(M)),Ye(s),we(y),we(Q);break A}if(B=B+Q|0,w=k,Ve(k=k+t|0,B=w>>>0>k>>>0?B+1|0:B,1114112,0),C=W,g=(t=h)+(k=n[r+8>>2])|0,Q=(B=C)+n[r+12>>2]|0,!(Q=k>>>0>g>>>0?Q+1|0:Q)&g>>>0>1114111|Q)break r;for(r=r+16|0,k=f;(0|B)==(0|Q)&t>>>0<=g>>>0|B>>>0>>0;)mf(b- -64|0,t,B,k),k=k+1|0,v=(f=f+1|0)?v:v+1|0,B=(t=t+1|0)?B:B+1|0;B=(t=g+1|0)?Q:Q+1|0;continue}break}Ur(B,B,68820),c()}n[A>>2]=-1,e[A+4|0]=0,ye(b- -64|0),ui(b+4|0),Ye(s),we(y),we(o+32|0),Ze(o+44|0)}N=b+320|0}else n[A>>2]=-1,e[A+4|0]=f;N=i+208|0}function sA(A,r,f,i,e,a){var b,k=0,o=0,t=0,c=0,u=0;for(N=b=N-48|0,Xf(k=b+8|0,o=n[n[r+52>>2]+48>>2]),Xf(t=b+20|0,o),Kf(k,f),Kf(t,e),t=o>>>0<=1?1:o,k=1;(0|k)!=(0|t);)nA(b+32|0,r,k),o=n[b+40>>2],u=n[b+44>>2],c=b+8|0,i=i+n[b+36>>2]|0,i=f>>>0>(f=n[b+32>>2]+f|0)>>>0?i+1|0:i,Kf(c,f),a=a+u|0,a=(e=e+o|0)>>>0>>0?a+1|0:a,Kf(c=b+20|0,e),k=k+1|0;n[A+8>>2]=n[b+16>>2],r=n[b+12>>2],n[A>>2]=n[b+8>>2],n[A+4>>2]=r,r=n[b+24>>2],n[A+12>>2]=n[b+20>>2],n[A+16>>2]=r,n[A+20>>2]=n[b+28>>2],N=b+48|0}function GA(A){var r=0,f=0,i=0,e=0,a=0,b=0,k=0;A:if(!((b=n[A+8>>2])>>>0<2)){for(r=k=n[A+4>>2],f=1;;){if((0|f)==(0|b))break A;if(n[(i=r+16|0)>>2]==n[r>>2]&n[i+4>>2]==n[r+4>>2]){i=f;break}f=f+1|0,r=i}for(;;){r=(i<<4)+k|0,e=(a=(f<<4)+k|0)-16|0;r:{for(;;){if(b>>>0>(i=i+1|0)>>>0){if(n[(r=r+16|0)>>2]==n[e>>2]&n[r+4>>2]==n[e+4>>2])continue;break r}break}n[A+8>>2]=f;break A}e=n[r+12>>2],n[a+8>>2]=n[r+8>>2],n[a+12>>2]=e,e=n[r+4>>2],n[a>>2]=n[r>>2],n[a+4>>2]=e,f=f+1|0}}}function DA(A,r){var f,i,e,a,b,k,o,t=0,c=0,u=0,B=0,v=0;for(N=f=N-48|0,t=n[r+8>>2],c=n[r+4>>2],n[f+40>>2]=n[r>>2],n[f+36>>2]=c,n[f+32>>2]=c,n[f+44>>2]=(t<<3)+c,N=e=N-16|0,k=n[(i=f+32|0)+8>>2],b=e+8|0,u=a=n[i>>2],r=n[i+4>>2],o=n[i+12>>2];(0|r)!=(0|o);)t=r+8|0,n[i+4>>2]=t,v=r+4|0,B=n[r>>2],r=t,rr(B,t=n[v>>2])||(n[u+4>>2]=t,n[u>>2]=B,u=u+8|0);n[b+4>>2]=u,n[b>>2]=a,t=n[e+12>>2],N=r=N-16|0,n[i+8>>2]=0,n[i>>2]=4,n[r+8>>2]=0,n[r+12>>2]=4,We(r+8|0),n[i+12>>2]=4,n[i+4>>2]=4,N=r+16|0,n[f+4>>2]=a,n[f>>2]=k,n[f+8>>2]=t-a>>>3,Wi(i),N=e+16|0,(r=n[f+8>>2])?(R(i,n[f+4>>2],r,71009,2),n[f+28>>2]=2,n[f+24>>2]=i,si(r=f+12|0,67214,f+24|0),le(i),c=0|d(n[f+16>>2],n[f+20>>2]),le(r),r=1):r=0,We(f),n[A+4>>2]=c,n[A>>2]=r,N=f+48|0}function ZA(A,r){var f=0,i=0,e=0,a=0;f=(i=B[r+190>>1])&&(a=B[r+194>>1])&&(e=(+(a>>>0)-+(i>>>0))/(f=((e=(i=B[r+188>>1])?+(i>>>0):400)<600?700:400)-e))>0?(i=B[r+192>>1])&&(r=B[r+196>>1])?(f=(f=(+(r>>>0)-+(i>>>0))/f)!=f?0:f)>0?f:0:.75*e:.75*(e=+B[r+172>>1]/24/300),Q[A+8>>3]=f,Q[A>>3]=e}function dA(A,r){var f,i,e,a=0,b=0,k=0,o=0,t=0,c=0;N=f=N-16|0,t=(a=n[r>>2])<<4,i=f+4|0,e=n[r+4>>2];A:{r:{for(;;){if((0|a)==(0|e))break r;a=a+1|0,n[r>>2]=a,k=n[(o=(b=r+t|0)+16|0)+4>>2],n[f+8>>2]=n[o>>2],n[f+12>>2]=k,c=n[(k=b+8|0)+4>>2],n[f>>2]=n[k>>2],n[f+4>>2]=c;f:{if(n[f+12>>2]){if(-1!=(0|(b=n[b+12>>2])))break f}else le(i);t=t+16|0;continue}break}r=n[k>>2],a=n[o+4>>2],n[A+8>>2]=n[o>>2],n[A+12>>2]=a,n[A+4>>2]=b,n[A>>2]=r;break A}n[A+4>>2]=-1}N=f+16|0}function IA(A,r,f,i){var a,b,k=0,o=0,t=0,c=0,u=0,B=0;b=f>>>0<(k=n[i>>2])>>>0?k:f,f=0,a=A;A:{r:{for(;;){f:{if((0|(f=f+u|0))<=34){if((0|k)!=(0|b))break f;break r}break r}if(u=f+1|0,o=k+1|0,n[i>>2]=o,A=127&(t=e[r+k|0]),k=31&f,(63&f)>>>0>=32?(f=A<>>32-k,A<<=k),c|=A,B=A=f|B,f=6,k=o,!((0|t)<0))break}if(!(1==(0|A)|A>>>0>1)){n[a+4>>2]=c,A=0;break A}}e[a+1|0]=0,A=1}e[0|a]=A}function NA(A,r,f,i,e,a){var b,k=0,o=0,t=0,c=0,u=0,B=0;if(N=b=N-16|0,a&&!((f=f+i|0)>>>0>>0)){o=b+4|0,N=k=N-32|0,u=1,c=4,f=Te(a,0,B=(f=f>>>0>(i=n[r>>2]<<1)>>>0?f:i)>>>0>(t=1==(0|a)?8:a>>>0<1025?4:1)>>>0?f:t,0);A:if(C|-2147483648-e>>>0>>0)f=0;else{cf(k+20|0,r,e,a);r:if(n[k+24>>2]){if(!(i=n[k+28>>2])){Ai(k+8|0,e,f,0),a=n[k+8>>2],i=n[k+12>>2];break r}a=T(n[k+20>>2],i,e,f),i=f}else Ai(k,e,f,0),a=n[k>>2],i=n[k+4>>2];if(!a){n[o+4>>2]=e,c=8;break A}n[o+4>>2]=a,u=0,c=8,f=i}n[o+c>>2]=f,n[o>>2]=u,N=k+32|0,1!=n[b+4>>2]?(f=n[b+8>>2],n[r>>2]=B,n[r+4>>2]=f,k=-1):(t=n[b+12>>2],k=n[b+8>>2])}n[A+4>>2]=t,n[A>>2]=k,N=b+16|0}function mA(A,r,f){var i,e,a=0,b=0,k=0;e=15&r,b=((a=536870896&r)<<2)+A|0,i=n[f>>2];A:{for(;;){if(a){for(f=0,r=0;f=n[A+r>>2]==(0|i)|f,64!=(0|(r=r+4|0)););if(a=a-16|0,A=A- -64|0,k=1,!(1&f))continue;break A}break}for(r=e<<2;;){if(k=!!(0|r),!r)break A;if(r=r-4|0,A=n[b>>2],b=b+4|0,(0|A)==(0|i))break}}return k}function yA(A,r,f){var i,e=0,a=0,b=0;for(N=i=N-32|0,n[i+20>>2]=0,n[i+12>>2]=0,n[i+16>>2]=4,e=n[r>>2],r=n[e+4>>2]<<2,e=n[e>>2];;){if(!r)return n[A+8>>2]=n[i+20>>2],r=n[i+16>>2],n[A>>2]=n[i+12>>2],n[A+4>>2]=r,void(N=i+32|0);(a=0|Aa[0|f](n[e>>2]),b=n[a+4>>2],a=n[a+8>>2],n[i+28>>2]=a,n[i+24>>2]=b,a)&&(Dr(i+24|0,n[i+16>>2],n[i+20>>2])||If(i+12|0,b,a)),e=e+4|0,r=r-4|0}}function hA(A,r,f){var i,e,a=0,b=0,k=0;for(i=r+12|0,b=n[r+32>>2]-f|0,f=e=n[r+24>>2];;){if(!f){f=2,v[r+8>>2]>k>>>0&&(r=n[r+4>>2]+(k<<3)|0,a=n[r+4>>2],f=n[r>>2]),n[A+4>>2]=a,n[A>>2]=2!=(0|f)?f:0;break}e>>>0<(a=f+k|0)>>>0||n[ti(i,a,70268)>>2]>=(0|b)||(b=b-n[ti(i,a,70284)>>2]|0,k=a),f=f>>>1|0}}function WA(A,r){var f,i=0,e=0,a=0,b=0,k=0,o=0;N=f=N-16|0,i=n[r>>2];A:{r:{f:{if(254!=(0|(e=u[r+16|0]))){if(i)break f;e=255!=(0|e);break r}if(e=0,!i)break r;e=n[r+8>>2]-n[r+4>>2]|0;break r}if((e=(i=n[r+8>>2]-n[r+4>>2]|0)+(255!=(0|e))|0)>>>0>>0)break A}if(di(A,e),e=n[A+4>>2],i=n[A+8>>2],n[f+4>>2]=A+8,k=f,o=xe(e,i),n[k+8>>2]=o,n[f+12>>2]=C,N=e=N-16|0,A=f+4|0,n[e+8>>2]=n[A+8>>2],i=n[A+4>>2],n[e>>2]=n[A>>2],n[e+4>>2]=i,N=A=N-32|0,254!=(0|(i=u[r+16|0])))for(;;){r:{f:{i:switch(0|i){case 1:i=2;break f;case 0:break f;case 2:break i;default:break r}i=6}vi(e,g(i,228)+74480|0),i=255;continue}break}if(1!=n[r>>2])n[n[e>>2]>>2]=n[e+4>>2];else{for(n[A+8>>2]=n[r+12>>2],i=n[r+8>>2],r=n[r+4>>2],n[A>>2]=r,n[A+4>>2]=i,n[A+16>>2]=1,n[A+12>>2]=A+8,n[A+28>>2]=n[e+8>>2],i=n[e+4>>2],n[A+20>>2]=n[e>>2],n[A+24>>2]=i,i=r<<2,a=A+20|0,b=n[A+4>>2];(0|r)!=(0|b);)vi(a,n[n[A+12>>2]+i>>2]),i=i+4|0,r=r+1|0;n[n[A+20>>2]>>2]=n[A+24>>2]}return N=A+32|0,N=e+16|0,void(N=f+16|0)}yf(68520,35,68540),c()}function CA(A,r,f){var i=0,e=0,a=0,b=0,k=0;A:{r:if(i=n[r+20>>2])for(e=r+12|0,a=n[r+16>>2],r=0;;){if(i>>>0<=1){if(n[12+(g(r,28)+a|0)>>2]!=(0|f))break r;f=gi(e,r,69028),i=n[f+4>>2],f=n[f+8>>2],r=gi(e,r,69044),n[A+4>>2]=f,f=n[r+24>>2],n[A+8>>2]=n[r+20>>2],n[A+12>>2]=f;break A}k=r,r=v[12+(g(r=(b=i>>>1|0)+r|0,28)+a|0)>>2]>f>>>0?k:r,i=i-b|0;continue}i=0}n[A>>2]=i}function UA(A,r,f){var i=0,e=0;A:{r:{f:{if((i=n[r+4>>2])>>>0>f>>>0){if((e=f-1|0)>>>0>=i>>>0)break f;if((i=n[r+12>>2])>>>0<=f>>>0)break r;if(i>>>0>e>>>0)break A;Ur(e,i,69216),c()}Ur(f,i,69168),c()}Ur(e,i,69184),c()}Ur(f,i,69200),c()}i=n[r>>2],f<<=2,e<<=2,n[A>>2]=n[i+f>>2]-n[e+i>>2],i=A,A=n[r+8>>2],n[i+4>>2]=n[A+f>>2]-n[A+e>>2]}function zA(A,r){var f,i,e,a,b,k,o=0,t=0,c=0,u=0;for(t=(o=n[A+20>>2])>>>0<(t=n[A+8>>2])>>>0?o:t,o=n[A+16>>2],A=n[A+4>>2],f=Q[r+40>>3],i=Q[r+32>>3],e=Q[r+24>>3],a=Q[r+16>>3],b=Q[r+8>>3],k=Q[r>>3];t;)c=Q[A>>3],u=Q[o>>3],Q[A>>3]=i+(k*c+a*u),Q[o>>3]=f+(b*c+e*u),t=t-1|0,o=o+8|0,A=A+8|0}function FA(A,r,f,i,e){var a,b;N=b=N-16|0,a=A,A=Te(e,0,r,0);A:{r:{f:{if(!(C|A>>>0>-2147483648-i>>>0)){if(A)break f;n[a+8>>2]=i,n[a+4>>2]=0,A=0;break A}n[a+4>>2]=0;break r}if(Ai(b+8|0,i,A,f),f=n[b+8>>2]){n[a+8>>2]=f,n[a+4>>2]=r,A=0;break A}n[a+8>>2]=A,n[a+4>>2]=i}A=1}n[a>>2]=A,N=b+16|0}function JA(A,r){var f,i,e;N=f=N-32|0,FA(f+20|0,r,1,1,1),i=n[f+24>>2],n[f+20>>2]&&(_i(i,n[f+28>>2]),c()),e=n[f+28>>2],n[A+8>>2]=r,n[A+4>>2]=e,n[A>>2]=i,N=f+32|0}function jA(A,r){$e(A,r,4)}function RA(A,r){$e(A,r,8)}function VA(A,r){var f,i,e=0,a=0,b=0,k=0,o=0;N=f=N-16|0,n[f+4>>2]=r+8,n[f>>2]=r+12,e=n[r>>2],i=n[r+4>>2];A:{for(;;){if(a=0,(0|e)==(0|i))break A;if(a=e+8|0,n[r>>2]=a,k=n[r+8>>2],n[f+12>>2]=e,n[f+8>>2]=k,N=e=N-16|0,o=e+4|0,b=n[4+(f+8|0)>>2],V(o,n[n[f>>2]>>2],n[b>>2],n[b+4>>2]),b=n[e+12>>2],We(o),N=e+16|0,n[r+8>>2]=n[r+8>>2]+1,e=a,!b)break}a=8!=(0|e)}n[A+4>>2]=k,n[A>>2]=a,N=f+16|0}function XA(A,r){var f,i=0;for(N=f=N-32|0,n[f+24>>2]=4,n[f+20>>2]=r,n[f+16>>2]=A,A=0;tr(f+8|0,f+16|0),i=n[f+8>>2];)r=n[f+12>>2],n[f+28>>2]=0,Vf(f,0,r,f+28|0,4,71264),ai(n[f>>2],n[f+4>>2],i,r,71280),A=(r=A)+((-16711936&(Le(A=n[f+28>>2],16)^A))>>>8^Le(A,8))|0;return N=f+32|0,A}function TA(A,r,f,i){var e,a,b,k,o=0,t=0;o=(e=n[r+12>>2])&(g(f,-1640531535)^i),b=n[r+16>>2],k=n[r+4>>2],a=n[r+8>>2];A:{r:{for(;;){if(o>>>0>=a>>>0)break A;if(t=0,n[(r=(o<<4)+k|0)+8>>2]!=(0|b))break r;if(n[r>>2]==(0|i)&n[r+4>>2]==(0|f))break;o=o+1&e}r=n[r+12>>2],t=1}return f=t,n[A+4>>2]=r,void(n[A>>2]=f)}Ur(o,a,70204),c()}function HA(A,r){var f,i=0,e=0,a=0,b=0;if(N=f=N-48|0,VA(f+8|0,r),1!=n[f+8>>2])n[A+8>>2]=0,n[A>>2]=0,n[A+4>>2]=4;else{for(i=n[f+12>>2],hr(f,4,4,4),e=n[f>>2],a=n[f+4>>2],n[a>>2]=i,n[f+28>>2]=1,n[f+24>>2]=a,n[f+20>>2]=e,i=n[r+12>>2],n[f+40>>2]=n[r+8>>2],n[f+44>>2]=i,i=n[r+4>>2],n[f+32>>2]=n[r>>2],n[f+36>>2]=i,r=f+20|0,a=f+32|0,N=i=N-16|0;VA(i+8|0,a),1==n[i+8>>2];)b=n[i+12>>2],(0|(e=n[r+8>>2]))==n[r>>2]&&di(r,1),n[n[r+4>>2]+(e<<2)>>2]=b,n[r+8>>2]=e+1;N=i+16|0,n[A+8>>2]=n[f+28>>2],r=n[f+24>>2],n[A>>2]=n[f+20>>2],n[A+4>>2]=r}N=f+48|0}function OA(A,r,f){var i,e,a,b,k=0,o=0;if(N=i=N-16|0,(k=f)>>>0>(f=r+f|0)>>>0&&(_i(0,0),c()),e=i+4|0,b=n[A+4>>2],o=1,r=4,(f=k=(f=f>>>0>(k=(a=n[A>>2])<<1)>>>0?f:k)>>>0<=8?8:f)>>>0>2147483647)f=0;else{A:{r:{if(a)r=T(b,a,1,f);else{if(!f){r=1;break r}r=pi(f,1)}if(!r){n[e+4>>2]=1;break A}}n[e+4>>2]=r,o=0}r=8}n[r+e>>2]=f,n[e>>2]=o,1==n[i+4>>2]&&(_i(n[i+8>>2],n[i+12>>2]),c()),r=n[i+8>>2],n[A>>2]=k,n[A+4>>2]=r,N=i+16|0}function xA(A,r){var f=0,i=0;i=n[r+8>>2];A:{if(2!=(0|(f=n[r>>2]))){if(!i)break A;return i=n[r+12>>2],r=f+((r=n[r+16>>2])>>>0<=i>>>0?1+(i-r|0)|0:0)|0,n[A+8>>2]=r,n[A+4>>2]=r>>>0>=f>>>0,void(n[A>>2]=r>>>0>>0?-1:r)}return i?(n[A+4>>2]=1,f=n[(r=r+8|0)+4>>2],r=(r=n[r+8>>2])>>>0<=f>>>0?1+(f-r|0)|0:0,n[A+8>>2]=r,void(n[A>>2]=r)):(n[A+8>>2]=0,n[A>>2]=0,void(n[A+4>>2]=1))}n[A+8>>2]=f,n[A+4>>2]=1,n[A>>2]=f}function LA(A,r,f){var i,e;N=i=N-16|0,(r=r+f|0)>>>0>>0&&(_i(0,0),c()),r=(r=r>>>0>(e=(f=n[A>>2])<<1)>>>0?r:e)>>>0<=8?8:r,qA(i+4|0,f,n[A+4>>2],r),1==n[i+4>>2]&&(_i(n[i+8>>2],n[i+12>>2]),c()),f=n[i+8>>2],n[A>>2]=r,n[A+4>>2]=f,N=i+16|0}function pA(A,r,f){var i,e=0,a=0,b=0,k=0,o=0,t=0,c=0,u=0,B=0;N=i=N-16|0,k=n[r+4>>2]<<2,r=n[r>>2];A:{for(;;){if(!k)break A;o=i+8|0;r:{f:if(e=n[r>>2],a=n[e+68>>2])for(t=n[e+64>>2],e=0;;){if(a>>>0<=1){if(n[(a=(e<<3)+t|0)>>2]!=(0|f))break f;e=n[a+4>>2],b=1;break r}b=e,e=v[((e=(c=a>>>1|0)+e|0)<<3)+t>>2]>f>>>0?b:e,a=a-c|0;continue}b=0}if(a=b,n[o+4>>2]=e,n[o>>2]=a,1&n[i+8>>2])break;k=k-4|0,u=u+1|0,r=r+4|0}r=n[i+12>>2],n[A+4>>2]=u,n[A+8>>2]=r,B=1}n[A>>2]=B,N=i+16|0}function SA(A,r){var f,i;N=f=N-48|0,Qi(f+8|0,r);A:if(255==(0|(i=u[f+8|0]))){r:switch((255&r)-12|0){case 1:n[A+8>>2]=0,n[A+12>>2]=0,n[A>>2]=73776;break A;default:n[A+8>>2]=0,n[A+12>>2]=0,n[A>>2]=76304;break A;case 0:break r}n[A+8>>2]=0,n[A+12>>2]=0,n[A>>2]=74004}else Q[f+40>>3]=Q[f+24>>3],Q[f+32>>3]=Q[f+16>>3],vf(A,i,f+32|0);N=f+48|0}function _A(A,r){var f,i,e,a=0,b=0,k=0,o=0,t=0,c=0,u=0,B=0;if(N=i=(N=f=N-32|0)-16|0,a=(e=r<<4)+A|0,n[i+4>>2]=a,N=i+16|0,(0|A)==(0|a))b=1;else{for(n[i>>2]=A+16,a=n[A+4>>2],n[i+8>>2]=n[A>>2],n[i+12>>2]=a,a=n[(b=t=i+8|0)>>2],c=n[b+4>>2],k=n[i>>2],u=n[i+4>>2];!((0|k)==(0|u)||(B=k+16|0,n[i>>2]=B,(0|(o=n[k+4>>2]))==(0|c)&a>>>0>(b=n[k>>2])>>>0|c>>>0>o>>>0));)n[t>>2]=b,n[t+4>>2]=o,a=b,c=o,k=B;b=(0|k)==(0|u)}b||(hr(f+8|0,r,8,16),n[f+28>>2]=0,a=n[f+12>>2],n[f+24>>2]=a,n[f+20>>2]=n[f+8>>2],r&&(e&&Je(a,A,e),n[f+28>>2]=r),eA(a,r,A,r),ye(f+20|0)),N=f+32|0}function KA(A){var r,f=0,i=0,e=0;if(N=r=N-32|0,n[r>>2]=1,n[r+12>>2]=n[A+8>>2],f=n[A+4>>2],n[r+4>>2]=n[A>>2],n[r+8>>2]=f,A=0|Aa[n[17534]](r))return 1==n[r>>2]&&(n[r+24>>2]=n[A+8>>2],f=n[A+4>>2],n[r+16>>2]=n[A>>2],n[r+20>>2]=f,i=n[(f=r+4|0)+8>>2],e=n[f+4>>2],n[A>>2]=n[f>>2],n[A+4>>2]=e,n[A+8>>2]=i,ge(r+16|0)),void(N=r+32|0);ii(67464),c()}function PA(A,r){var f,i,a=0;t(+(a=Q[r+40>>3])),i=(b(1)<<1|b(0)>>>31)>>>0<4292870144?a:0,a=n[r+32>>2]?i:0,Q[A+8>>3]=0==a&&1&e[r+129|0]?-12:a,a=Q[r+8>>3],f=u[r+128|0]?700:400,a=(a=n[r>>2]&&a>0?a:f)!=a?1:a,Q[A>>3]=E(a>1?a:1,1e3)}function qA(A,r,f,i){if((0|i)<0)r=1,i=0,f=4;else{A:{r:{if(r)r=T(f,r,1,i);else{if(!i){r=1;break r}r=pi(i,1)}if(!r){n[A+4>>2]=1,r=1;break A}}n[A+4>>2]=r,r=0}f=8}n[f+A>>2]=i,n[A>>2]=r}function $A(A,r,f){var i,a=0,b=0,k=0,o=0,t=0,c=0;if(N=i=N-32|0,IA(i+12|0,b=n[r>>2],r=n[r+4>>2],f),1!=u[i+12|0]){if(n[i+28>>2]=n[i+16>>2],n[i+24>>2]=0,n[i+20>>2]=f,n[i+16>>2]=r,n[i+12>>2]=b,N=f=N-48|0,e[f+11|0]=255,r=i+12|0,n[f+40>>2]=n[r+16>>2],b=n[r+12>>2],n[f+32>>2]=n[r+8>>2],n[f+36>>2]=b,b=n[r+4>>2],n[f+24>>2]=n[r>>2],n[f+28>>2]=b,n[f+44>>2]=f+11,b=f+12|0,N=r=N+-64|0,Lf(r+16|0,a=f+24|0),1!=n[r+16>>2])n[b+8>>2]=0,n[b>>2]=0,n[b+4>>2]=4;else{for(k=n[r+20>>2],hr(r+8|0,4,4,4),o=n[r+8>>2],t=n[r+12>>2],n[t>>2]=k,n[r+36>>2]=1,n[r+32>>2]=t,n[r+28>>2]=o,k=n[a+20>>2],n[r+56>>2]=n[a+16>>2],n[r+60>>2]=k,k=n[a+12>>2],n[r+48>>2]=n[a+8>>2],n[r+52>>2]=k,k=n[a+4>>2],n[r+40>>2]=n[a>>2],n[r+44>>2]=k,a=r+28|0,t=r+40|0,N=k=N-16|0;Lf(k+8|0,t),1==n[k+8>>2];)c=n[k+12>>2],(0|(o=n[a+8>>2]))==n[a>>2]&&di(a,1),n[n[a+4>>2]+(o<<2)>>2]=c,n[a+8>>2]=o+1;N=k+16|0,n[b+8>>2]=n[r+36>>2],a=n[r+32>>2],n[b>>2]=n[r+28>>2],n[b+4>>2]=a}N=r- -64|0,255==(0|(r=u[f+11|0]))?(n[A+8>>2]=n[f+20>>2],r=n[f+16>>2],n[A>>2]=n[f+12>>2],n[A+4>>2]=r):(n[A>>2]=-1,e[A+4|0]=r,ge(b)),N=f+48|0}else r=u[i+13|0],n[A>>2]=-1,e[A+4|0]=r;N=i+32|0}function Ar(A,r){var f,i,e=0,a=0,b=0,k=0,o=0,t=0,u=0,B=0,Q=0,w=0,l=0,E=0,M=0,Y=0;if(N=f=N-32|0,A,i=A,-1!=n[r>>2]){n[f+24>>2]=n[r+8>>2],A=n[r+4>>2],n[f+16>>2]=n[r>>2],n[f+20>>2]=A,N=r=N-16|0,a=f+8|0;A:{r:{if((A=n[(e=f+16|0)+8>>2])>>>0>2]){if(Cr(r+8|0,e,A,4,12),-1!=(0|(A=n[r+8>>2])))break r;A=n[e+8>>2]}n[a+4>>2]=A,n[a>>2]=n[e+4>>2],N=r+16|0;break A}_i(A,n[r+12>>2]),c()}for(A=n[f+12>>2],N=k=(N=u=N-16|0)-32|0,r=n[f+8>>2],n[k+20>>2]=r,n[k+16>>2]=r,n[k+24>>2]=A,n[k+28>>2]=r+g(A,12),N=b=N-48|0,r=n[(A=k+16|0)+12>>2],n[b+40>>2]=n[A+8>>2],n[b+44>>2]=r,r=n[A+4>>2],n[b+32>>2]=n[A>>2],n[b+36>>2]=r,t=b+20|0,N=Q=N-16|0,E=n[(a=b+32|0)+8>>2],N=B=N-16|0,l=B+8|0,o=w=n[a>>2],N=r=N-16|0,A=n[a+4>>2],M=n[a+12>>2];(0|A)!=(0|M);)e=A+12|0,n[a+4>>2]=e,Y=n[A+4>>2],n[r>>2]=n[A>>2],n[r+4>>2]=Y,A=n[A+8>>2],n[r+8>>2]=A,A=0|I(n[r+4>>2],0|A),le(r),n[o>>2]=A,o=o+4|0,A=e;for(n[l+4>>2]=o,n[l>>2]=w,N=r+16|0,A=n[B+12>>2],n[(r=Q+8|0)>>2]=n[B+8>>2],n[r+4>>2]=A,N=B+16|0,e=n[Q+12>>2],N=r=N-16|0,n[a+8>>2]=0,o=n[a+12>>2],A=n[a+4>>2],n[a>>2]=4,n[r+8>>2]=0,n[r+12>>2]=4,se(r+8|0),n[a+12>>2]=4,n[a+4>>2]=4,o=(o-A>>>0)/12|0;o;)o=o-1|0,le(A),A=A+12|0;for(N=r+16|0,n[t+4>>2]=w,n[t>>2]=g(E,3),n[t+8>>2]=e-w>>>2,N=e=N-16|0,n[e+12>>2]=a,r=n[a+4>>2],A=(n[a+12>>2]-r>>>0)/12|0;A;)A=A-1|0,le(r),r=r+12|0;$f(e+12|0),N=e+16|0,N=r=(N=Q+16|0)-16|0,e=b+8|0;A:{r:{if((A=n[t+8>>2])>>>0>2]){if(Cr(r+8|0,t,A,4,4),-1!=(0|(A=n[r+8>>2])))break r;A=n[t+8>>2]}n[e+4>>2]=A,n[e>>2]=n[t+4>>2],N=r+16|0;break A}_i(A,n[r+12>>2]),c()}r=n[b+12>>2],n[(A=k+8|0)>>2]=n[b+8>>2],n[A+4>>2]=r,N=b+48|0,r=n[k+12>>2],n[(A=u+8|0)>>2]=n[k+8>>2],n[A+4>>2]=r,N=k+32|0,A=n[u+12>>2],n[f>>2]=n[u+8>>2],n[f+4>>2]=A,N=u+16|0,r=n[f>>2],n[i+8>>2]=n[f+4>>2],A=0}else r=n[r+4>>2],A=1;n[i>>2]=A,n[i+4>>2]=r,N=f+32|0}function rr(A,r){var f,i,e,a=0,b=0,k=0,o=0,t=0;N=f=N+-64|0,n[f+8>>2]=r,n[f+4>>2]=A,n[f+60>>2]=76304,n[f+56>>2]=74480,n[f+52>>2]=76304,n[f+48>>2]=73776,n[f+44>>2]=74004,n[f+40>>2]=74232,n[f+36>>2]=4,n[f+28>>2]=1,n[f+32>>2]=0,n[f+24>>2]=74460,n[f+20>>2]=1,n[f+12>>2]=1,n[f+16>>2]=0,N=i=N-16|0,k=f+4|0,n[i>>2]=k;A:{if(2!=n[(e=f+12|0)+16>>2]){r:{if(A=n[(a=e+16|0)+28>>2]){o=n[a+32>>2];f:{for(;;){if((0|A)==(0|o))break f;if(r=A+228|0,n[a+28>>2]=r,b=Fi(i,A),A=r,b)break}b=1;break r}n[a+28>>2]=0}f:if(n[a>>2])for(r=12+(a+((A=n[a+4>>2])<<2)|0)|0,t=n[a+8>>2];;){if(b=(0|A)!=(0|t),(0|A)==(0|t))break f;if(A=A+1|0,n[a+4>>2]=A,o=n[r>>2],r=r+4|0,Fi(i,o))break}else b=0}if(A=1,b)break A;n[a>>2]=2}if(A=0,n[e>>2]){for(n[i+12>>2]=k,n[i+8>>2]=1,n[i+4>>2]=e+12,o=n[e+12>>2],k=n[e+8>>2],A=n[e+4>>2],b=i+12|0;r=A,(0|k)!=(0|A)&&(A=1,n[e+4>>2]=1,!Fi(b,o)););A=(0|r)!=(0|k)}}return N=i+16|0,N=f- -64|0,A}function fr(A,r){var f,i,e=0,a=0,b=0,k=0;for(N=f=N-16|0,b=n[A>>2],i=n[A+4>>2];;){if((0|i)!=(0|(e=b))){if(b=e+40|0,n[A>>2]=b,!(a=n[e+32>>2]))continue;if(V(k=f+4|0,r,n[e+28>>2],a),a=n[f+12>>2],We(k),a)continue}break}return N=f+16|0,(0|e)!=(0|i)}function ir(A,r){var f,i,e=0,a=0,b=0,k=0;for(N=f=N-16|0,b=n[A>>2],i=n[A+4>>2];;){if((0|i)!=(0|(e=b))){if(b=e+8|0,n[A>>2]=b,!(a=n[e+4>>2]))continue;if(V(k=f+4|0,r,n[e>>2],a),a=n[f+12>>2],We(k),a)continue}break}return N=f+16|0,(0|e)!=(0|i)}function er(A,r){var f,i,e,a,b=0,k=0;for(f=n[r>>2],a=n[r+8>>2],i=n[r+4>>2],b=e=n[r+12>>2]-i>>>2|0;b;)n[k+f>>2]=n[k+i>>2],b=b-1|0,k=k+4|0;N=b=N-16|0,n[r+8>>2]=0,n[r>>2]=4,n[b+8>>2]=0,n[b+12>>2]=4,ge(b+8|0),n[r+12>>2]=4,n[r+4>>2]=4,N=b+16|0,n[A+8>>2]=e,n[A+4>>2]=f,n[A>>2]=a,hi(r)}function ar(A,r){var f,i=0;N=f=N-32|0,-1!=n[r>>2]?(n[f+24>>2]=n[r+8>>2],i=n[r+4>>2],n[f+16>>2]=n[r>>2],n[f+20>>2]=i,cr(f+8|0,f+16|0),r=n[f+8>>2],n[A+8>>2]=n[f+12>>2],i=0):(r=n[r+4>>2],i=1),n[A>>2]=i,n[A+4>>2]=r,N=f+32|0}function nr(A,r){var f,i=0;N=f=N-32|0,-1!=n[r>>2]?(n[f+24>>2]=n[r+8>>2],i=n[r+4>>2],n[f+16>>2]=n[r>>2],n[f+20>>2]=i,or(f+8|0,f+16|0),r=n[f+8>>2],n[A+8>>2]=n[f+12>>2],i=0):(r=n[r+4>>2],i=1),n[A>>2]=i,n[A+4>>2]=r,N=f+32|0}function br(A){var r,f=0,i=0,e=0,a=0,b=0;N=r=N-16|0,i=n[A+4>>2],f=n[A>>2],n[A>>2]=8,n[A+4>>2]=8,n[r+12>>2]=A,A=(i-f>>>0)/88|0;A:if((0|f)!=(0|i))for(;;){if(!A)break A;A=A-1|0,ji(f),f=f+88|0}A=n[r+12>>2],(f=n[A+16>>2])&&(i=n[A+8>>2],(0|(e=n[i+8>>2]))!=(0|(a=n[A+12>>2]))&&((f=g(f,88))&&Je((b=n[i+4>>2])+g(e,88)|0,g(a,88)+b|0,f),f=n[A+16>>2]),n[i+8>>2]=f+e),N=r+16|0}function kr(A,r){var f,i,e=0,a=0,b=0,k=0,o=0,t=0,u=0,B=0,v=0,g=0,l=0;N=f=N-16|0,n[f+12>>2]=r+8,e=n[r>>2],i=n[r+4>>2];A:{for(;;){if((0|e)!=(0|i)){B=e+16|0,n[r>>2]=B,k=0;r:{f:{i:{if(b=n[f+12>>2],o=n[b>>2],u=Kr(Q[e>>3]*Q[n[o>>2]>>3]/Q[n[o+4>>2]>>3]),v=E(M(u,-32768),32767),a=w(v)<2147483647?~~v:-2147483648,(g=u==u?a:0)&&(o=n[e+8>>2],a=n[b+4>>2],!(o>>>0>=(t=n[a+4>>2])>>>0)&&(a=n[a>>2],n[a+(l=o<<2)>>2]&&!((e=n[e+12>>2])>>>0>=t>>>0)&&n[(t=a)+(a=e<<2)>>2]))){if((k=n[b+12>>2])>>>0<=o>>>0)break i;if(e>>>0>=k>>>0)break f;b=n[b+8>>2],n[A+16>>2]=65535&g,a=n[b+a>>2],b=(e=n[b+l>>2])>>>16|0,n[A+8>>2]=a|e<<16,n[A+12>>2]=b,k=1}n[A>>2]=k,n[A+4>>2]=0;break r}Ur(o,k,68948),c()}Ur(e,k,68964),c()}if(e=B,!n[A>>2])continue;break A}break}n[A>>2]=0,n[A+4>>2]=0}N=f+16|0}function or(A,r){var f,i=0;N=f=N-16|0;A:{if((i=n[r+8>>2])>>>0>2]){if(Wr(f+8|0,r,i,4,4),-1!=(0|(i=n[f+8>>2])))break A;i=n[r+8>>2]}return n[A+4>>2]=i,n[A>>2]=n[r+4>>2],void(N=f+16|0)}_i(i,n[f+12>>2]),c()}function tr(A,r){var f,i=0,e=0,a=0;N=f=N-16|0,(i=n[r+4>>2])?(e=n[r+8>>2],Jf(f,n[r>>2],i,i>>>0>e>>>0?e:i,71924),e=n[f+4>>2],i=n[f>>2],a=n[f+12>>2],n[r>>2]=n[f+8>>2],n[r+4>>2]=a):i=0,n[A+4>>2]=e,n[A>>2]=i,N=f+16|0}function cr(A,r){var f,i=0;N=f=N-16|0;A:{if((i=n[r+8>>2])>>>0>2]){if(Cr(f+8|0,r,i,1,1),-1!=(0|(i=n[f+8>>2])))break A;i=n[r+8>>2]}return n[A+4>>2]=i,n[A>>2]=n[r+4>>2],void(N=f+16|0)}_i(i,n[f+12>>2]),c()}function ur(A,r,f,i,e,a,b,k,o){r=ki(r+1244|0,f,70460),f=A,o?(e=(e=Of((A=n[r+16>>2])-(o=n[i+56>>2])|0,n[r+20>>2]-(n[i+60>>2]+(A>>>0>>0)|0)|0,e,a))+(A=n[i+40>>2])|0,a=C+n[i+44>>2]|0,a=A>>>0>e>>>0?a+1|0:a,A=(A=Of((A=n[r+24>>2])-(o=n[i+64>>2])|0,n[r+28>>2]-(n[i+68>>2]+(A>>>0>>0)|0)|0,b,k))+(b=n[i+48>>2])|0,r=C+n[i+52>>2]|0,r=A>>>0>>0?r+1|0:r):(e=n[r+16>>2],a=n[r+20>>2],A=n[r+24>>2],r=n[r+28>>2]),n[f+8>>2]=A,n[f+12>>2]=r,n[f>>2]=e,n[f+4>>2]=a}function Br(A,r){var f,i=0,e=0,a=0;i=n[r+16>>2],f=n[r+20>>2];A:{for(;;){if(e=0,!i|(0|i)==(0|f))break A;if(e=i+8|0,n[r+16>>2]=e,a=n[i>>2],i=e,1==(0|a))break}a=n[i-4>>2],e=1}n[A+4>>2]=a,n[A>>2]=e}function vr(A,r,f){var i,e,a;N=i=N-16|0,hr(i+8|0,f,1,1),a=n[i+8>>2],e=n[i+12>>2],n[A+8>>2]=0,n[A+4>>2]=e,n[A>>2]=a,f&&(f&&Je(e,r,f),n[A+8>>2]=f),N=i+16|0}function Qr(A,r){var f=0,i=0;A:{if((i=-8&(f=n[A-4>>2]))>>>0>=((f&=3)?4:8)+r>>>0){if(r+39>>>0>>0&&f)break A;return void H(A)}Ki(72680,46,72728),c()}Ki(72744,46,72792),c()}function gr(A,r,f,i,e){var a;N=a=N-32|0,n[a+4>>2]=r,n[a>>2]=A,n[a+12>>2]=i,n[a+8>>2]=f,n[a+24>>2]=a+8,n[a+28>>2]=37,n[a+16>>2]=a,n[a+20>>2]=39,yf(65942,a+16|0,e),c()}function wr(A,r,f,i,e,a){var n=0,b=0;return f|i?(b=i,n=f,f=(n^=f=i>>31)-(i=f)>>>0<3&(0|(f=(f^b)-(f+(f>>>0>n>>>0)|0)|0))<=0|(0|f)<0?1:2):f=0,g(f+g(lr(A,r),3)|0,3)+(e|a?(!!e&(0|a)>=0|(0|a)>0)^(0|r)<0?1:2:0)|0}function lr(A,r){var f,i=0;return A|r?(f=r,i=A,A=(i^=r=A=r>>31)-r|0,!(r=(r^f)-(r+(r>>>0>i>>>0)|0)|0)&A>>>0<3?1:!r&A>>>0<9?2:!r&A>>>0<33?3:!r&A>>>0<129?4:5):0}function Er(A,r){var f,i,e,a,b,k,o=0,t=0,c=0,u=0,B=0;for(N=f=N-32|0,hr(f+8|0,n[r+12>>2]-n[r+4>>2]>>>3|0,4,12),n[f+28>>2]=0,o=n[f+12>>2],n[f+20>>2]=n[f+8>>2],n[f+24>>2]=o,N=i=N-16|0,Zi(o=f+20|0,n[r+12>>2]-n[r+4>>2]>>>3|0),t=n[o+8>>2],c=n[o+4>>2],n[i+4>>2]=o+8,b=i,k=xe(c,t),n[b+8>>2]=k,n[i+12>>2]=C,N=o=N-16|0,u=n[(e=i+4|0)+4>>2],t=n[e+8>>2]+g(u,12)|0,c=n[r+4>>2],a=n[r+12>>2];(0|c)!=(0|a);)vr(o+4|0,n[c>>2],n[c+4>>2]),n[t+8>>2]=n[o+12>>2],B=n[o+8>>2],n[t>>2]=n[o+4>>2],n[t+4>>2]=B,c=c+8|0,t=t+12|0,u=u+1|0;t=n[r+8>>2],n[o+8>>2]=n[r>>2],n[o+4>>2]=t,We(o+4|0),n[n[e>>2]>>2]=u,N=o+16|0,N=i+16|0,n[A+8>>2]=n[f+28>>2],r=n[f+24>>2],n[A>>2]=n[f+20>>2],n[A+4>>2]=r,N=f+32|0}function Mr(A){vr(A+104|0,70912,17),e[A+128|0]=0,n[A+80>>2]=0,n[A+84>>2]=1083129856,n[A+16>>2]=0,n[A+20>>2]=0,n[A>>2]=0,n[A+4>>2]=0,e[A+129|0]=0,e[A+130|0]=1,n[A+96>>2]=0,n[A+100>>2]=1072955392,n[A+88>>2]=0,n[A+92>>2]=1071644672,n[A+48>>2]=0,n[A+52>>2]=0,n[A+32>>2]=0,n[A+36>>2]=0,n[A+124>>2]=0,n[A+116>>2]=0,n[A+120>>2]=8,n[A+64>>2]=0,n[A+68>>2]=0}function Yr(A,r){var f=0;f=0,1==n[r>>2]&&((0|(f=n[r+4>>2]))==n[r+8>>2]?(n[r>>2]=0,f=0):(n[r+4>>2]=f+1,r=u[12+(r+f|0)|0],f=1)),e[A+1|0]=r,e[0|A]=f}function sr(A,r,f){var i,a=0,b=0,k=0,o=0,t=0,B=0;N=i=N-16|0,r=n[r>>2],(b=n[r+8>>2])>>>0<=f>>>0&&(Ur(f,b,69232),c()),f=n[r+4>>2]+g(f,12)|0,b=n[f+4>>2],N=r=N-48|0,f=n[f+8>>2],n[r+8>>2]=f,n[r+4>>2]=b,P(r+20|0,r+4|0);A:{r:{b=i+4|0;f:{if(o=n[r+20>>2]){if(a=n[r+24>>2],!n[r+32>>2])break f;if(f){if(!(k=pi(f,1)))break r}else k=1;n[r+44>>2]=0,n[r+40>>2]=k,n[r+36>>2]=f;i:{if(f>>>0>>0)LA(r+36|0,0,a),f=n[r+36>>2],k=n[r+40>>2],t=n[r+44>>2];else if(!a)break i;a&&Je(k+t|0,o,a)}if(a=a+t|0,n[r+44>>2]=a,f-a>>>0<=2&&(LA(r+36|0,a,3),a=n[r+44>>2],k=n[r+40>>2]),f=a+k|0,t=u[72970],e[f+2|0]=t,o=u[72968]|u[72969]<<8,e[0|f]=o,e[f+1|0]=o>>>8,f=a+3|0,n[r+44>>2]=f,k=n[r+8>>2],n[r+12>>2]=n[r+4>>2],n[r+16>>2]=k,P(r+20|0,r+12|0),k=n[r+20>>2])for(;;){B=n[r+32>>2];i:{if((a=n[r+24>>2])>>>0>n[r+36>>2]-f>>>0)LA(r+36|0,f,a),f=n[r+44>>2];else if(!a)break i;a&&Je(n[r+40>>2]+f|0,k,a)}if(f=f+a|0,n[r+44>>2]=f,B&&(n[r+36>>2]-f>>>0<=2&&(LA(r+36|0,f,3),f=n[r+44>>2]),k=n[r+40>>2]+f|0,e[0|k]=o,e[k+1|0]=o>>>8,e[k+2|0]=t,f=f+3|0,n[r+44>>2]=f),P(r+20|0,r+12|0),!(k=n[r+20>>2]))break}n[b+8>>2]=n[r+44>>2],f=n[r+40>>2],n[b>>2]=n[r+36>>2],n[b+4>>2]=f;break A}o=1,a=0}n[b+8>>2]=a,n[b+4>>2]=o,n[b>>2]=-1;break A}_i(1,f),c()}N=r+48|0,-1==n[b>>2]?(a=n[b+4>>2],N=r=(N=f=N-16|0)-16|0,FA(r+4|0,b=n[b+8>>2],0,1,1),k=n[r+8>>2],1==n[r+4>>2]&&(_i(k,n[r+12>>2]),c()),n[(o=f+8|0)+4>>2]=n[r+12>>2],n[o>>2]=k,N=r+16|0,k=n[f+8>>2],r=n[f+12>>2],n[A+8>>2]=0,n[A+4>>2]=r,n[A>>2]=k,b&&(b&&Je(r,a,b),n[A+8>>2]=b),N=f+16|0):(n[A+8>>2]=n[b+8>>2],r=n[b+4>>2],n[A>>2]=n[b>>2],n[A+4>>2]=r),N=i+16|0}function Gr(A,r){var f,i,e,a,b,k=0,o=0,t=0,c=0,u=0,B=0;for(N=f=N-32|0,hr(f+8|0,n[r+12>>2]-n[r+4>>2]>>>4|0,4,8),n[f+28>>2]=0,o=n[f+12>>2],n[f+20>>2]=n[f+8>>2],n[f+24>>2]=o,N=o=N-16|0,Ii(k=f+20|0,n[r+12>>2]-n[r+4>>2]>>>4|0),t=n[k+8>>2],c=n[k+4>>2],n[o+4>>2]=k+8,a=o,b=xe(c,t),n[a+8>>2]=b,n[o+12>>2]=C,N=t=N-16|0,c=n[(i=o+4|0)+4>>2],u=n[i+8>>2]+(c<<3)|0,k=n[r+4>>2],e=n[r+12>>2];(0|k)!=(0|e);)B=n[k>>2],n[u+4>>2]=n[k+8>>2],n[u>>2]=B,k=k+16|0,u=u+8|0,c=c+1|0;k=n[r+8>>2],n[t+12>>2]=n[r>>2],n[t+8>>2]=k,ye(t+8|0),n[n[i>>2]>>2]=c,N=t+16|0,N=o+16|0,n[A+8>>2]=n[f+28>>2],r=n[f+24>>2],n[A>>2]=n[f+20>>2],n[A+4>>2]=r,N=f+32|0}function Dr(A,r,f){var i;for(f<<=3,i=n[A>>2],A=n[A+4>>2];f&&((0|A)!=n[r+4>>2]||Tr(n[r>>2],i,A));)r=r+8|0,f=f-8|0;return!!(0|f)}function Zr(A,r){var f,i,a,b=0,k=0,o=0;a=n[A+8>>2],i=A,A=1,r>>>0<128||(A=2,r>>>0<2048||(A=r>>>0<65536?3:4)),Ui(i,A),f=n[i+4>>2]+a|0;A:if(r>>>0>=128){if(k=63&r|-128,b=r>>>6|0,r>>>0<2048){e[f+1|0]=k,e[0|f]=192|b;break A}if(o=r>>>12|0,b=63&b|-128,r>>>0<=65535){e[f+2|0]=k,e[f+1|0]=b,e[0|f]=224|o;break A}e[f+3|0]=k,e[f+2|0]=b,e[f+1|0]=63&o|-128,e[0|f]=r>>>18|-16}else e[0|f]=r;n[i+8>>2]=A+a}function dr(A){var r,f=0;for(N=r=N-16|0,n[r+12>>2]=A,f=n[A+4>>2],A=(n[A+12>>2]-f>>>0)/56|0;A;)A=A-1|0,Pr(f),f=f+56|0;N=A=N-16|0,f=n[r+12>>2],n[A+12>>2]=n[f>>2],n[A+8>>2]=n[f+8>>2],de(A+8|0),N=A+16|0,N=r+16|0}function Ir(A,r){var f=0,i=0;A:{if(f=n[r+8>>2]){if(i=n[r+4>>2],!(r=pi(f,1)))break A;f&&Je(r,i,f)}else r=1;return n[A+8>>2]=f,n[A+4>>2]=r,void(n[A>>2]=f)}_i(1,f),c()}function Nr(A,r){var f=0,i=0,e=0,a=0,b=0,k=0;if(k=n[r+8>>2]){if(b=r=(a=n[r+4>>2])+8|0,e=i=Q[a>>3],(0|(a=a+(k<<3)|0))!=(0|r))for(k=a-r>>>3|0;f=Q[b>>3],e=e!=e?f:e,e=(f=f!=f?e:f)>e?e:f,b=b+8|0,k=k-1|0;);if((0|r)!=(0|a))for(b=a-r>>>3|0;f=Q[r>>3],i=i!=i?f:i,i=(f=f!=f?i:f)>3]=i,Q[A+8>>3]=e,r=1}else r=0;n[A>>2]=r,n[A+4>>2]=0}function mr(A,r){var f,i=0;n[A>>2]=0,i=n[r+4>>2],n[A+4>>2]=!i|n[r+8>>2]==(0|i),i=A,f=(A=n[r+20>>2])?n[r+24>>2]-A>>>3|0:0,A=n[r+12>>2],n[i+8>>2]=f+(A?n[r+16>>2]-A>>>3|0:0)}function yr(A){var r,f,i=0;for(f=(r=-3.141592653589793*A/180)*r,A=17,i=15;-1!=(0|i);)A=+(i>>>0)-f/A,i=i-2|0;return 152587890625e-16*Kr(r/A*65536)}function hr(A,r,f,i){var e;N=e=N-16|0,FA(e+4|0,r,0,f,i),r=n[e+8>>2],1==n[e+4>>2]&&(_i(r,n[e+12>>2]),c()),n[A+4>>2]=n[e+12>>2],n[A>>2]=r,N=e+16|0}function Wr(A,r,f,i,e){pe(A,r,f,i,e,70072,70033)}function Cr(A,r,f,i,e){pe(A,r,f,i,e,72536,72500)}function Ur(A,r,f){var i;N=i=N-32|0,n[i+12>>2]=r,n[i+8>>2]=A,n[i+24>>2]=i+8,n[i+28>>2]=40,n[i+16>>2]=i+12,n[i+20>>2]=40,yf(65586,i+16|0,f),c()}function zr(A,r,f){var i,e=0;for(i=A+12|0,r=r+1|0,A=n[A+24>>2];A>>>0>=r>>>0;)e=ti(i,r,70300),n[e>>2]=n[e>>2]+f,r=(0-r&r)+r|0}function Fr(A,r){var f,i,e=0,a=0;for(f=n[A>>2],A=n[r>>2],i=n[r+4>>2];;){if((0|A)==(0|i))return 0;if(e=A+8|0,n[r>>2]=e,a=n[A>>2],A=e,n[n[f>>2]>>2]==(0|a))break}return A-8|0}function Jr(A,r){var f;N=f=N-48|0,Ei(f+12|0,r),e[A+32|0]=1,n[A+8>>2]=n[f+20>>2],r=n[f+16>>2],n[A>>2]=n[f+12>>2],n[A+4>>2]=r,r=n[f+28>>2],n[A+12>>2]=n[f+24>>2],n[A+16>>2]=r,n[A+20>>2]=n[f+32>>2],r=n[f+40>>2],n[A+24>>2]=n[f+36>>2],n[A+28>>2]=r,N=f+48|0}function jr(A,r){var f,i,e=0;(0|(i=n[A+8>>2]))==n[A>>2]&&bf(A),f=n[A+4>>2]+g(i,28)|0,n[f+24>>2]=n[r+24>>2],e=n[r+20>>2],n[f+16>>2]=n[r+16>>2],n[f+20>>2]=e,e=n[r+12>>2],n[f+8>>2]=n[r+8>>2],n[f+12>>2]=e,e=n[r+4>>2],n[f>>2]=n[r>>2],n[f+4>>2]=e,n[A+8>>2]=i+1}function Rr(A,r){var f,i=0;return(i=n[A+60>>2]&r)>>>0>=(f=n[A+56>>2])>>>0&&(Ur(i,f,70140),c()),A=1048575&(i=n[n[A+52>>2]+(i<<2)>>2]),C=(r=(r^i)>>>0>=1048576)?-1:0-!A|0,i=r?-1:A-1|0}function Vr(A,r){var f=0,i=0;A:{r:{f:switch(255&r){default:f=A,i=0|d(71296,20),n[f+4>>2]=i,r=1;break A;case 0:e[A+1|0]=0,r=0;break A;case 1:e[A+1|0]=1;break r;case 2:break f}e[A+1|0]=2}r=0}e[0|A]=r}function Xr(A,r,f){var i;N=i=N-16|0,r?(Ef(i+8|0,r,f),f=n[i+8>>2],r=n[i+12>>2],n[A+8>>2]=r,n[A+4>>2]=f):r=-1,n[A>>2]=r,N=i+16|0}function Tr(A,r,f){var i=0,e=0,a=0;A:if(f){for(;;){if((0|(i=u[0|A]))==(0|(e=u[0|r]))){if(A=A+1|0,r=r+1|0,f=f-1|0)continue;break A}break}a=i-e|0}return a}function Hr(A,r,f){var i,e,b,k,o=0,t=0;if(N=i=N-16|0,mi(A,e=f-r>>>2|0),o=n[A+8>>2],t=n[A+4>>2],n[i+4>>2]=A+8,b=i,k=xe(t,o),n[b+8>>2]=k,n[i+12>>2]=C,A=n[(o=i+4|0)+4>>2],t=n[o>>2],(0|r)!=(0|f))for(o=n[o+8>>2]+(A<<1)|0,A=(f=e)+A|0;a[o>>1]=n[r>>2],r=r+4|0,o=o+2|0,f=f-1|0;);n[t>>2]=A,N=i+16|0}function Or(A,r,f){r=Q[oi(n[r>>2],f,69328)>>3]!=Q[n[r+4>>2]>>3]||Q[oi(n[r+8>>2],f,69344)>>3]!=Q[n[r+12>>2]>>3]?1:0,n[A+4>>2]=f,n[A>>2]=r}function xr(A,r,f){var i=0;if(aA(r,A,f))A=0,r=0;else{if(i=aA(r,A+12|0,f),r=K(A+24|0,r,f),f=A=C,!i)return C=(r=r+1|0)?A:A+1|0,r;A=-1^r,r=-1^f}return C=r,A}function Lr(A){var r=0,f=0,i=0,e=0;(r=0|Aa[n[17534]](0))&&(i=n[r+4>>2],e=n[r+8>>2],n[r+8>>2]=0,f=n[r>>2],n[r>>2]=0,n[r+4>>2]=4,-1!=(0|f))||(ii(67480),c()),n[A+4>>2]=i,n[A+8>>2]=e,n[A>>2]=f}function pr(A,r){var f=0,i=0,a=0;u[r+8|0]||(f=n[r>>2])>>>0>v[r+4>>2]||(a=1,i=f+1|0,n[r>>2]=i,e[r+8|0]=!i),n[A+4>>2]=f,n[A>>2]=a}function Sr(A,r){var f,i,e,a=0,b=0,k=0,o=0;for(N=f=N-16|0,di(A,n[r+4>>2]-n[r>>2]|0),b=n[A+8>>2],a=n[A+4>>2],n[f+4>>2]=A+8,k=f,o=xe(a,b),n[k+8>>2]=o,n[f+12>>2]=C,A=n[(a=f+4|0)+4>>2],b=n[a+8>>2]+(A<<2)|0,a=n[a>>2],i=n[r+8>>2],e=n[r+4>>2],r=n[r>>2];(0|r)!=(0|e);)k=b,o=Ri(i),n[k>>2]=o,b=b+4|0,r=1,A=A+1|0;n[a>>2]=A,N=f+16|0}function _r(A,r,f){var i=0,e=0;yi(A,f),i=n[A+8>>2],f&&((e=f<<3)&&Je(n[A+4>>2]+(i<<3)|0,r,e),i=n[A+8>>2]),n[A+8>>2]=f+i}function Kr(A){var r,f=0,i=0,e=0,a=0,n=0;return t(.49999999999999994),a=0|b(1),f=0|b(0),t(+A),i=0|b(1),b(0),k(0,0|f),k(1,2147483647&a|-2147483648&i),t(+(A+=+o())),a=0|b(1),r=0|b(0),(i=a>>>20&2047)>>>0<=1074&&(f=31&(e=i-1023|0),(63&e)>>>0>=32?(e=-1,n=-1048576>>f):(e=-1048576>>f,n=((1<>>0<1023)?0:n)),k(1,a&(f?-2147483648:e)),A=+o()),A}function Pr(A){var r=0;A:{r:{f:switch(0|((0|(r=n[A>>2]))>=0?1:-2147483648^r)){case 0:break r;case 1:break A;default:break f}Ie(A+4|0)}return}Me(A),le(A+12|0),ge(A+24|0),ge(A+36|0)}function qr(A,r){var f,i;N=f=N-16|0,3!=u[r+16|0]&&(n[f+12>>2]=1,n[f+8>>2]=r,yf(67180,f+8|0,69108),c()),i=n[r+12>>2],n[A>>2]=n[r+8>>2],n[A+4>>2]=i,N=f+16|0}function $r(A,r){var f=0;(0|(f=n[r>>2]))==n[r+4>>2]?f=0:(n[r>>2]=f+1,r=B[8+((f<<1)+r|0)>>1],f=1),a[A+2>>1]=r,a[A>>1]=f}function Af(A,r,f){var i;N=i=N-16|0,cf(i+4|0,A,r,f),n[i+8>>2]&&(A=n[i+12>>2])&&Qr(n[i+4>>2],A),N=i+16|0}function rf(A){Se(A,16,4)}function ff(A,r){var f=0,i=0,e=0,a=0;if((f=n[A+8>>2])>>>0<=r>>>0){A:{if((f=r+1|0)>>>0<=(i=n[A+8>>2])>>>0){if((i=n[A+8>>2])>>>0>>0)break A;for(n[A+8>>2]=f,i=i-f|0,f=n[A+4>>2]+g(f,36)|0;;){if(!i)break A;i=i-1|0,te(f),f=f+36|0}}if(i=f-i|0,f=n[A+8>>2],i>>>0>n[A>>2]-f>>>0&&wf(A,f,i,4,36),i){for(a=n[A+8>>2],f=n[A+4>>2]+g(a,36)|0;n[f>>2]=0,n[f+4>>2]=4,n[(e=f+20|0)>>2]=0,n[e+4>>2]=0,n[f+16>>2]=4,n[(e=f+8|0)>>2]=0,n[e+4>>2]=0,n[(e=f+28|0)>>2]=0,n[e+4>>2]=0,f=f+36|0,a=a+1|0,i=i-1|0;);n[A+8>>2]=a}}f=n[A+8>>2]}return r>>>0>=f>>>0&&(Ur(r,f,71596),c()),n[A+4>>2]+g(r,36)|0}function ef(A){Se(A,8,8)}function af(A,r){var f,i,a,b,k,o,t=0,c=0,u=0;b=(i=N-16|0)+4|0,N=f=(N=i)-16|0,k=f+4|0,o=n[r+12>>2],N=a=N-16|0;A:{r:{f:{if((0|(t=n[r>>2]))!=n[r+4>>2]){if(n[r>>2]=t+4,pA(a+4|0,n[r+8>>2],n[t>>2]),r=1,!(1&n[a+4>>2]))break f;c=n[a+8>>2],u=n[a+12>>2];break r}n[k>>2]=2;break A}e[0|o]=1,r=0}n[k+4>>2]=c,n[k+8>>2]=u,n[k>>2]=r}N=a+16|0,2==n[f+4>>2]?n[b>>2]=0:(n[b+8>>2]=n[f+12>>2],r=n[f+8>>2],n[b>>2]=n[f+4>>2],n[b+4>>2]=r),N=f+16|0,1==n[i+4>>2]?(r=n[i+12>>2],n[A+4>>2]=n[i+8>>2],n[A+8>>2]=r,r=1):r=0,n[A>>2]=r,N=i+16|0}function nf(A){Se(A,4,4)}function bf(A){Se(A,28,4)}function kf(A){Se(A,12,4)}function of(A){Se(A,16,8)}function tf(A){Se(A,8,4)}function cf(A,r,f,i){var e=0,a=0,b=0;e=4,i&&(a=n[r>>2])&&(n[A+4>>2]=f,n[A>>2]=n[r+4>>2],b=g(i,a),e=8),n[A+e>>2]=b}function uf(A,r,f){var i,e=0;for(i=f<<8,f=-8,e=1;f;)e=aA(r,A,e+i|0)|e<<1,f=f+1|0;return e}function Bf(A,r,f){n[A>>2]=!(!(f>=0)|!(+v[n[r>>2]>>2]>f))&f-G(f)==0,n[A+4>>2]=f<4294967295&f>=0?~~f>>>0:0}function vf(A,r,f){var i,e,a,b;i=Q[f+8>>3],e=Q[f>>3],n[A+16>>2]=-515396076,n[A+20>>2]=-1070574470,f=1==(255&r)&i<0,n[A+8>>2]=f,n[A+12>>2]=0,a=A,b=Nf(r,e>=550,f),n[a>>2]=b}function Qf(A,r){var f,i,e;N=f=N-16|0,i=f,e=(-16711936&(Le(r,16)^r))>>>8^Le(r,8),n[i+12>>2]=e,Mf(A,f+12|0,4),N=f+16|0}function gf(A,r){var f;return N=f=N-16|0,n[f+12>>2]=r,A=O(A,f+12|0,1),r=B[ci(A+16|0,r,70752)>>1],e[0|A]=0,N=f+16|0,r}function wf(A,r,f,i,e){var a;N=a=N-16|0,NA(a+8|0,A,r,f,i,e),-1!=(0|(A=n[a+8>>2]))&&(_i(A,n[a+12>>2]),c()),N=a+16|0}function lf(A,r,f){var i;N=i=N-32|0,n[i+28>>2]=f,n[i+24>>2]=r,n[i+20>>2]=f,or(i+8|0,i+20|0),r=n[i+12>>2],n[A>>2]=n[i+8>>2],n[A+4>>2]=r,N=i+32|0}function Ef(A,r,f){var i,e,a;N=i=N-32|0,n[i+28>>2]=f,n[i+24>>2]=r,n[i+20>>2]=f,N=f=N-16|0,a=i+8|0;A:{r:{if((r=n[(e=i+20|0)+8>>2])>>>0>2]){if(Wr(f+8|0,e,r,8,8),-1!=(0|(r=n[f+8>>2])))break r;r=n[e+8>>2]}n[a+4>>2]=r,n[a>>2]=n[e+4>>2],N=f+16|0;break A}_i(r,n[f+12>>2]),c()}r=n[i+12>>2],n[A>>2]=n[i+8>>2],n[A+4>>2]=r,N=i+32|0}function Mf(A,r,f){var i=0;Ui(A,f),i=n[A+8>>2],f&&(f&&Je(n[A+4>>2]+i|0,r,f),i=n[A+8>>2]),n[A+8>>2]=f+i}function Yf(A,r){var f,i,e;(0|(f=n[A+8>>2]))==n[A>>2]&&kf(A),i=n[A+4>>2]+g(f,12)|0,n[i+8>>2]=n[r+8>>2],e=n[r+4>>2],n[i>>2]=n[r>>2],n[i+4>>2]=e,n[A+8>>2]=f+1}function sf(A,r,f){var i;N=i=N-32|0,n[i+28>>2]=f,n[i+24>>2]=r,n[i+20>>2]=f,cr(i+8|0,i+20|0),r=n[i+12>>2],n[A>>2]=n[i+8>>2],n[A+4>>2]=r,N=i+32|0}function Gf(A,r){var f,i,e,a=0,b=0,k=0;N=f=N-16|0,n[f+12>>2]=0,n[f+4>>2]=0,n[f+8>>2]=1,e=f+4|0,N=i=N-16|0;A:if(a=n[r+8>>2])for(Ui(e,a>>>0<(b=((b=(k=n[r+4>>2])-(r=n[r>>2])|0)>>>2|0)+!!(3&b)|0)>>>0?a:b),n[i+12>>2]=a,n[i+8>>2]=k,n[i+4>>2]=r;;){if(-1==(0|(r=zf(i+4|0))))break A;if(Zr(e,r),!(a=a-1|0))break}else Ui(e,0);N=i+16|0,n[A+8>>2]=n[f+12>>2],r=n[f+8>>2],n[A>>2]=n[f+4>>2],n[A+4>>2]=r,N=f+16|0}function Df(A,r,f,i,e){f>>>0>>0&&(yf(69594,19,e),c()),n[A+4>>2]=i,n[A>>2]=r,n[A+12>>2]=f-i,n[A+8>>2]=(i<<4)+r}function Zf(A,r,f){var i,a=0,b=0,k=0;for(N=i=N-48|0,n[i+12>>2]=f,n[i+8>>2]=r,r=0,f=u[70029]|u[70030]<<8|u[70031]<<16|u[70032]<<24,a=u[70025]|u[70026]<<8|u[70027]<<16|u[70028]<<24,e[i+31|0]=a,e[i+32|0]=a>>>8,e[i+33|0]=a>>>16,e[i+34|0]=a>>>24,e[i+35|0]=f,e[i+36|0]=f>>>8,e[i+37|0]=f>>>16,e[i+38|0]=f>>>24,f=u[70022]|u[70023]<<8|u[70024]<<16|u[70025]<<24,n[i+24>>2]=u[70018]|u[70019]<<8|u[70020]<<16|u[70021]<<24,n[i+28>>2]=f,a=i+24|0;;){if(15!=(0|r)){if(f=u[r+a|0],n[i+44>>2]=u[f+72408|0],n[i+40>>2]=n[72424+(f<<2)>>2],r=r+1|0,!bi(i+40|0,i+8|0))continue}else f=255;break}N=i+48|0,255==(0|f)?(b=A,k=0|d(69306,22),n[b+4>>2]=k,r=1):(e[A+1|0]=f,r=0),e[0|A]=r}function df(A,r){var f=0;if((0|A)!=(0|r))for(r=r-A>>>1|0;f=B[A>>1]+f|0,A=A+2|0,r=r-1|0;);return f}function If(A,r,f){var i,e;(0|(i=n[A+8>>2]))==n[A>>2]&&tf(A),e=n[A+4>>2]+(i<<3)|0,n[e+4>>2]=f,n[e>>2]=r,n[A+8>>2]=i+1}function Nf(A,r,f){A:{r:switch((255&A)-1|0){case 0:r=(r?3:2)+(f?2:0)|0;break A;case 1:break r;default:break A}r|=6}return g(r,228)+74480|0}function mf(A,r,f,i){var e,a;(0|(e=n[A+8>>2]))==n[A>>2]&&of(A),a=n[A+4>>2]+(e<<4)|0,n[a+8>>2]=i,n[a>>2]=r,n[a+4>>2]=f,n[A+8>>2]=e+1}function yf(A,r,f){var i=0;N=i=N-32|0,n[i+16>>2]=r,n[i+12>>2]=A,a[i+28>>1]=1,n[i+24>>2]=f,n[i+20>>2]=i+12,N=r=N-16|0,f=n[(A=i+20|0)>>2],i=n[A+4>>2],n[r+12>>2]=A,n[r+4>>2]=f,n[r+8>>2]=i,N=A=N-16|0,f=n[(r=r+4|0)>>2],1&(i=n[f+4>>2])&&(f=n[f>>2],n[A+4>>2]=i>>>1,n[A>>2]=f,f=A,A=n[r+8>>2],wA(f,72592,n[r+4>>2],u[A+8|0],u[A+9|0]),c()),n[A>>2]=-1,n[A+12>>2]=r,f=A,A=n[r+8>>2],wA(f,72620,n[r+4>>2],u[A+8|0],u[A+9|0]),c()}function hf(A,r,f){var i;N=i=N-16|0,n[i+4>>2]=r,n[i>>2]=A,n[i+8>>2]=i,n[i+12>>2]=39,yf(65951,i+8|0,f),c()}function Wf(A,r,f){var i,e,a=0,b=0,k=0,o=0,t=0,u=0,B=0,v=0,Q=0;if(N=e=N-32|0,n[e+28>>2]=2,n[e+24>>2]=f,n[e+20>>2]=r,n[e+12>>2]=1,n[e+16>>2]=0,f=A,N=i=N-32|0,xA(i+20|0,r=e+12|0),1!=n[i+24>>2])yf(68520,35,72124),c();else{if(hr(i,n[i+28>>2],4,4),n[i+16>>2]=0,A=n[i+4>>2],n[i+8>>2]=n[i>>2],n[i+12>>2]=A,a=i+8|0,N=b=N-16|0,xA(A=b+4|0,r),1!=n[b+8>>2])yf(68520,35,68540),c();else{if(di(a,n[b+12>>2]),v=b,Q=xe(n[a+4>>2],n[a+8>>2]),n[v+8>>2]=Q,n[b+12>>2]=C,n[b+4>>2]=a+8,2==(0|(a=n[r>>2]))|1!=(0|a)||(a=n[r+4>>2],k=n[A+4>>2],n[A+4>>2]=k+1,n[n[A+8>>2]+(k<<2)>>2]=a),n[r+8>>2]){a=n[A+4>>2],k=n[A+8>>2]+(a<<2)|0,u=n[A>>2],o=n[(r=r+8|0)+4>>2],A=n[r>>2],B=(t=n[r+8>>2])>>>0>1;A:{r:{for(;o>>>0>=t>>>0;){if(!B)break r;r=A+4|0,n[k>>2]=n[r>>2]-n[A>>2],k=k+4|0,a=a+1|0,o=o-1|0,A=r}n[u>>2]=a;break A}Ur(1,1,68916),c()}}else n[n[A>>2]>>2]=n[A+4>>2];N=b+16|0}n[f+8>>2]=n[i+16>>2],A=n[i+12>>2],n[f>>2]=n[i+8>>2],n[f+4>>2]=A,N=i+32|0}N=e+32|0}function Cf(A){Ee(A),Me(A+12|0),Me(A+24|0),le(A+36|0),Me(A+48|0),Me(A+60|0),Af(A+72|0,4,20)}function Uf(A,r,f,i){f>>>0>>0&&(yf(69594,19,68556),c()),n[A+4>>2]=i,n[A>>2]=r,n[A+12>>2]=f-i,n[A+8>>2]=r+i}function zf(A){var r;return N=r=N-16|0,MA(r+8|0,A),N=r+16|0,1&n[r+8>>2]?n[r+12>>2]:-1}function Ff(A,r,f){var i,a=0,b=0;if(N=i=N-16|0,n[i+12>>2]=f,n[i+8>>2]=r,f=3!=u[A+8|0]){if(a=i+8|0,N=r=N-32|0,f){n[r+16>>2]=A,n[r+12>>2]=a,n[r+20>>2]=r+31,n[r+24>>2]=r+12,a=r+24|0;A:{r:{f:{i:switch(u[0|(f=A+8|0)]-2|0){case 0:break f;case 1:break A;default:break i}if(e[0|f]=2,a=n[a>>2],A=n[a>>2],n[a>>2]=0,A){if(a=n[a+4>>2],b=n[A>>2],n[A>>2]=0,b)break r;Be(69092),c()}Be(68852),c()}yf(67406,113,67348),c()}n[a+4>>2]=n[A+4>>2],n[a>>2]=b,e[0|f]=3}}N=r+32|0}N=i+16|0}function Jf(A,r,f,i,e){f>>>0>>0&&(yf(69594,19,e),c()),n[A+4>>2]=i,n[A>>2]=r,n[A+12>>2]=f-i,n[A+8>>2]=r+i}function jf(A,r,f,i){var e;(e=n[r+8>>2])>>>0>>0&&(cA(f,e,e,i),c()),n[A+4>>2]=e-f,n[A>>2]=n[r+4>>2]+g(f,20)}function Rf(A,r){var f;N=f=N-16|0,a[f+14>>1]=r<<8|(65280&r)>>>8,Mf(A,f+14|0,2),N=f+16|0}function Vf(A,r,f,i,e,a){if(!(r>>>0>f>>>0|f>>>0>e>>>0))return n[A+4>>2]=f-r,void(n[A>>2]=r+i);cA(r,f,e,a),c()}function Xf(A,r){_e(A,r,4)}function Tf(A,r){_e(A,r,2)}function Hf(A,r){_e(A,r,1)}function Of(A,r,f,i){return f|i&&(A=Te(f- -64|0,i-((f>>>0<4294967232)-1|0)|0,A,r),r=C,A=(r=Re(A=A+32|0,f=A>>>0<32?r+1|0:r,64))+(f=f-(((i=C)<<6|r>>>26)+(A>>>0>>0)|0)>>31)|0,f=f+i|0,r=A>>>0>>0?f+1|0:f),C=r,A}function xf(A,r,f,i){return-1!=(0|f)&&0|Aa[n[r+16>>2]](A,f)?1:i?0|Aa[n[r+12>>2]](A,i,0):0}function Lf(A,r){var f,i,a,b,k,o,t=0;N=i=(N=f=N-16|0)-16|0,b=i+8|0,o=n[r+20>>2],N=a=N-16|0,(k=n[(t=r+12|0)>>2])>>>0>2]?(n[t>>2]=k+1,t=1):t=0,t?(IA(a+8|0,n[r>>2],n[r+4>>2],n[r+8>>2]),t=n[a+8>>2],r=n[a+12>>2],1&t?(e[0|o]=(255&r)<<24|t>>>8,t=0):t=1):t=2,n[b+4>>2]=r,n[b>>2]=t,N=a+16|0,r=n[i+8>>2],n[(t=f+8|0)+4>>2]=n[i+12>>2],n[t>>2]=2!=(0|r)?r:0,N=i+16|0,r=n[f+12>>2],n[A>>2]=n[f+8>>2],n[A+4>>2]=r,N=f+16|0}function pf(A){var r=0;for(r=n[A+4>>2]+4|0,A=n[A+8>>2];A;)A=A-1|0,le(r),r=r+16|0}function Sf(A){var r;return(r=n[A+8>>2])>>>0>2]?(n[A+8>>2]=r+1,u[n[A>>2]+r|0]):(e[A+20|0]=1,0)}function _f(A,r){var f,i=0,e=0;(0|(f=n[A+8>>2]))==n[A>>2]&&(N=i=N-16|0,NA(i+8|0,A,n[A>>2],1,2,2),-1!=(0|(e=n[i+8>>2]))&&(_i(e,n[i+12>>2]),c()),N=i+16|0),a[n[A+4>>2]+(f<<1)>>1]=r,n[A+8>>2]=f+1}function Kf(A,r){var f;(0|(f=n[A+8>>2]))==n[A>>2]&&nf(A),n[n[A+4>>2]+(f<<2)>>2]=r,n[A+8>>2]=f+1}function Pf(A,r){var f,i=0;(f=n[r>>2])>>>0>2]&&(n[r>>2]=f+1,i=1),n[A+4>>2]=f,n[A>>2]=i}function qf(A,r){var f;(0|(f=n[A+8>>2]))==n[A>>2]&&ef(A),Q[n[A+4>>2]+(f<<3)>>3]=r,n[A+8>>2]=f+1}function $f(A){var r;N=r=N-16|0,A=n[A>>2],n[r+12>>2]=n[A>>2],n[r+8>>2]=n[A+8>>2],se(r+8|0),N=r+16|0}function Ai(A,r,f,i){f&&(i?!(r=r>>>0>=9?rA(r,f):z(f))|!(3&u[r-4|0])|!f||je(r,f):r=pi(f,r)),n[A+4>>2]=f,n[A>>2]=r}function ri(A,r){var f,i=0,a=0,b=0;(0|(f=n[A+8>>2]))==n[A>>2]&&(N=i=N-16|0,a=(a=(b=n[A>>2])<<1)>>>0<=8?8:a,qA(i+4|0,b,n[A+4>>2],a),1==n[i+4>>2]&&(_i(n[i+8>>2],n[i+12>>2]),c()),b=n[i+8>>2],n[A>>2]=a,n[A+4>>2]=b,N=i+16|0),e[n[A+4>>2]+f|0]=r,n[A+8>>2]=f+1}function fi(A,r){var f,i,b=0,k=0,o=0,t=0,v=0,Q=0,w=0,l=0,E=0;N=i=N-16|0,e[i+14|0]=0,a[i+10>>1]=0,a[i+12>>1]=0,N=f=N-32|0;A:{r:{if(B[(k=i+10|0)>>1]|B[k+2>>1]|u[k+4|0]){hr(f+8|0,r,2,6),n[f+28>>2]=0,b=n[f+12>>2],n[f+20>>2]=n[f+8>>2],n[f+24>>2]=b,o=n[(b=t=f+20|0)+8>>2],n[b>>2]-o>>>0>>0&&wf(b,o,r,2,6),o=(v=r>>>0<=1?1:r)-1|0,Q=n[t+8>>2],b=n[t+4>>2]+g(Q,6)|0,w=u[k+4|0],l=B[k+2>>1],E=B[k>>1];f:{for(;;){if(!o){if(o=v+Q|0,!r){o=o-1|0;break f}break}a[b>>1]=E,e[b+4|0]=w,a[b+2>>1]=l,o=o-1|0,b=b+6|0}a[b+4>>1]=B[k+4>>1],r=B[k>>1]|B[k+2>>1]<<16,a[b>>1]=r,a[b+2>>1]=r>>>16}n[t+8>>2]=o,n[A+8>>2]=n[f+28>>2],r=n[f+24>>2],n[A>>2]=n[f+20>>2],n[A+4>>2]=r}else{if(FA(f+20|0,r,1,2,6),k=n[f+24>>2],1==n[f+20>>2])break r;b=n[f+28>>2],n[A+8>>2]=r,n[A+4>>2]=b,n[A>>2]=k}N=f+32|0;break A}_i(k,n[f+28>>2]),c()}N=i+16|0}function ii(A){var r;N=r=N-16|0,n[r>>2]=r+15,n[r+4>>2]=15,yf(65867,r,A),c()}function ei(A){var r,f,i,e=0;N=r=N-32|0,e=n[A+56>>2],n[A+56>>2]=0,f=n[A+48>>2],i=n[A+52>>2],n[A+48>>2]=0,n[A+52>>2]=4,n[r+16>>2]=e,n[r+8>>2]=f,n[r+12>>2]=i,Lr(e=r+20|0),v[r+8>>2]>2]?(KA(e),ge(r+8|0)):(KA(r+8|0),ge(r+20|0)),N=r+32|0,le(A),ge(A+12|0),ge(A+24|0),Me(A+36|0),ge(A+48|0)}function ai(A,r,f,i,e){(0|r)!=(0|i)?(N=A=N-32|0,n[A+8>>2]=i,n[A+12>>2]=r,n[A+24>>2]=A+12,n[A+28>>2]=40,n[A+16>>2]=A+8,n[A+20>>2]=40,yf(67260,A+16|0,e),c()):r&&Je(A,f,r)}function ni(A){var r;return N=r=N-32|0,SA(r+8|0,A),A=Ri(n[r+8>>2]),N=r+32|0,A}function bi(A,r){var f;return!(A=(0|(f=n[A+4>>2]))==n[r+4>>2]?Tr(n[A>>2],n[r>>2],f):1)}function ki(A,r,f){return Ke(A,r,f,80)}function oi(A,r,f){return Pe(A,r,f,3)}function ti(A,r,f){return Pe(A,r,f,2)}function ci(A,r,f){return Pe(A,r,f,1)}function ui(A){le(A),le(A+12|0),le(A+24|0),le(A+36|0),le(A+48|0)}function Bi(A,r,f){return Pe(A,r,f,5)}function vi(A,r){var f;r=Ri(r),f=n[A+4>>2],n[A+4>>2]=f+1,n[n[A+8>>2]+(f<<2)>>2]=r}function Qi(A,r){r&=255,e[0|A]=u[r+72147|0],r<<=3,Q[A+16>>3]=Q[r+72288>>3],Q[A+8>>3]=Q[r+72168>>3]}function gi(A,r,f){return Ke(A,r,f,28)}function wi(A,r,f){return Pe(A,r,f,4)}function li(A,r){fi(A,r<<5),fi(A+12|0,g(r,42)),n[A+24>>2]=1,n[A+28>>2]=2,e[A+32|0]=1}function Ei(A,r){fi(A,r<<5),fi(A+12|0,g(r,504)),n[A+24>>2]=32,n[A+28>>2]=24,e[A+32|0]=0}function Mi(A,r,f){return Ke(A,r,f,12)}function Yi(A,r,f,i){f>>>0>=4&&(cA(0,f,3,i),c()),n[A+4>>2]=f,n[A>>2]=r}function si(A,r,f){var i,e=0,a=0,b=0,k=0;if(1&f)vr(A,r,f>>>1|0);else{N=i=N-16|0;A:{r:{f:{i:{e:{if(1&f)e=f>>>1|0;else{if(!(e=u[0|r]))break e;for(a=r;;){a=a+1|0;a:if(e<<24>>24<0){if(128==(255&e)){b=(e=u[0|a]|u[a+1|0]<<8)+b|0,a=2+(e+a|0)|0;break a}a=((a+(((a=Le(3&e,8))<<5&1073741824|a<<7)>>>29|0)|0)+(e>>>1&2)|0)+(e>>>2&2)|0,k|=!b}else a=(e&=255)+a|0,b=e+b|0;if(!(e=u[0|a]))break}if(e=0,!(b>>>0<16&k)&&(k=0,(0|(e=b<<1))<0))break r}if(e)break i}a=1,e=0;break f}if(k=1,!(a=pi(e,1)))break r}if(n[i+8>>2]=0,n[i+4>>2]=a,n[i>>2]=e,!S(i,73004,r,f))break A;gr(73044,86,i+15|0,73028,73132),c()}_i(k,e),c()}n[A+8>>2]=n[i+8>>2],r=n[i+4>>2],n[A>>2]=n[i>>2],n[A+4>>2]=r,N=i+16|0}}function Gi(A,r,f){return u[f+104|0]?(A=ki(A+1244|0,r,70444),(0|(r=n[A+32>>2]))==n[f+88>>2]&n[A+36>>2]==n[f+92>>2]):0}function Di(A,r,f){var i;return(i=n[A+8>>2])>>>0<=r>>>0&&(Ur(r,i,f),c()),n[A+4>>2]+r|0}function Zi(A,r){qe(A,r,12,4)}function di(A,r){qe(A,r,4,4)}function Ii(A,r){qe(A,r,8,4)}function Ni(A,r){qe(A,r,16,4)}function mi(A,r){qe(A,r,2,2)}function yi(A,r){qe(A,r,8,8)}function hi(A){var r,f;N=r=N-16|0,n[r+12>>2]=A,N=A=N-16|0,f=n[r+12>>2],n[A+12>>2]=n[f>>2],n[A+8>>2]=n[f+8>>2],ge(A+8|0),N=A+16|0,N=r+16|0}function Wi(A){var r,f;N=r=N-16|0,n[r+12>>2]=A,N=A=N-16|0,f=n[r+12>>2],n[A+12>>2]=n[f>>2],n[A+8>>2]=n[f+8>>2],We(A+8|0),N=A+16|0,N=r+16|0}function Ci(A,r,f,i){return!(A=(0|r)==(0|i)?Tr(A,f,r<<2):1)}function Ui(A,r){qe(A,r,1,1)}function zi(A){2==n[A>>2]|-1==n[A+64>>2]||le(A- -64|0)}function Fi(A,r){return A=bi(r,n[A>>2])?3==u[r+16|0]:0}function Ji(A,r){var f,i=0;r=Kr(r),f=E(M(r,-32768),32767),i=w(f)<2147483647?~~f:-2147483648,Rf(A,r==r?i:0)}function ji(A){we(A),we(A+12|0),le(A+24|0),ge(A+36|0)}function Ri(A){var r,f=0,i=0,a=0,b=0;if(r=A+20|0,3!=u[A+224|0]){if(N=f=N-32|0,3!=u[r+204|0]){n[f+16>>2]=r,n[f+12>>2]=A,n[f+20>>2]=f+31,n[f+24>>2]=f+12,i=f+24|0,N=A=N-416|0;A:{r:{f:{i:switch(u[0|(b=r+204|0)]-2|0){case 0:break f;case 1:break A;default:break i}if(e[0|b]=2,i=n[i>>2],a=n[i>>2],n[i>>2]=0,a){if(i=n[i+4>>2],qr(A,a),YA(A+212|0,n[A>>2],n[A+4>>2]),-1!=n[A+212>>2])break r;e[A+8|0]=u[A+216|0],gr(69124,27,A+8|0,69604,69152),c()}Be(68852),c()}yf(67406,113,67348),c()}Je(a=A+8|0,A+212|0,204),Je(i,a,204),e[0|b]=3}N=A+416|0}N=f+32|0}return r}function Vi(A){var r;(r=n[A+4>>2])&&Qr(n[A>>2],r<<3)}function Xi(A){var r;(r=n[A+4>>2])&&Qr(n[A>>2],r<<2)}function Ti(A,r){fi(A,r),fi(A+12|0,r),Ei(A+24|0,r)}function Hi(A,r){var f;return(f=pi(r,A))||(ze(A,r),c()),f}function Oi(A){for(;3&u[A+8|0];)ri(A,0)}function xi(A){c()}function Li(A){var r;(r=n[A+4>>2])&&Qr(n[A>>2],r)}function pi(A,r){return r>>>0>=9?rA(r,A):z(A)}function Si(A){he(A),he(A+12|0),oe(A+24|0)}function _i(A,r){A&&(ze(A,r),c()),yf(72971,35,72988),c()}function Ki(A,r,f){yf(A,r<<1|1,f),c()}function Pi(A,r,f){var i,e,a;di(A,a=(i=(e=(f<<2)+r|0)-r|0)>>>2|0),f=n[A+8>>2],(0|r)!=(0|e)&&(i&&Je(n[A+4>>2]+(f<<2)|0,r,i),f=n[A+8>>2]),n[A+8>>2]=f+a}function qi(A){var r,f=0;r=A+8|0;A:if((0|(f=n[A>>2]))!=(0|(A=n[A+4>>2])))for(A=A-f|0,f=4+((f<<4)+r|0)|0;;){if(!A)break A;A=A-1|0,le(f),f=f+16|0}}function $i(A){-1!=n[A>>2]&&we(A)}function Ae(A){le(A+104|0),ye(A+116|0)}function re(){var A=0,r=0,f=0,i=0;if(A=3!=u[77056]){if(N=r=N-16|0,A){n[r>>2]=77008,n[r+4>>2]=r+15,n[r+8>>2]=r,i=r+8|0,N=A=N-112|0;A:{r:{f:switch(u[77056]-2|0){default:if(e[77056]=2,f=n[i>>2],i=n[f>>2],n[f>>2]=0,i){if(qr(A+8|0,74460),j(A- -64|0,n[A+8>>2],n[A+12>>2]),-1!=n[A+64>>2])break r;e[A+16|0]=u[A+68|0],gr(68980,31,A+16|0,69604,69012),c()}Be(68852),c();case 0:break f;case 1:break A}yf(67406,113,67348),c()}Je(f=A+16|0,A- -64|0,48),Je(i,f,48),e[77056]=3}N=A+112|0}N=r+16|0}}function fe(A,r,f){_r(A,r,((f<<3)+r|0)-r>>>3|0)}function ie(A,r,f){return 0|Aa[n[n[A+4>>2]+12>>2]](n[A>>2],r,f)}function ee(A){n[A>>2]&&hi(A)}function ae(A,r){var f=0,i=0,a=0,b=0;if(!((r=n[A+8>>2]+r|0)>>>0<=(f=n[A+8>>2])>>>0)){Ui(A,i=r-f|0),r=(a=i>>>0<=1?1:i)-1|0,f=(b=n[A+8>>2])+n[A+4>>2]|0;A:{for(;;){if(!r){if(r=a+b|0,!i){r=r-1|0;break A}break}e[0|f]=0,r=r-1|0,f=f+1|0}e[0|f]=0}}n[A+8>>2]=r}function ne(A,r,f){return S(n[A>>2],n[A+4>>2],r,f)}function be(A,r){vr(A,n[r+4>>2],n[r+8>>2])}function ke(A,r,f){ce(A,r,r+f|0)}function oe(A){he(A),he(A+12|0)}function te(A){We(A),ge(A+12|0)}function ce(A,r,f){Mf(A,r,f-r|0)}function ue(A,r){var f;f=n[r+4>>2],r=n[r+8>>2],n[A+8>>2]=0,_r(A,f,r)}function Be(A){Ki(73156,43,A),c()}function ve(A){yf(73666,51,A),c()}function Qe(A){yf(73691,115,A),c()}function ge(A){Af(A,4,4)}function we(A){Af(A,8,8)}function le(A){Af(A,1,1)}function Ee(A){Af(A,4,16)}function Me(A){Af(A,2,2)}function Ye(A){var r=0,f=0;for(r=n[A+8>>2],f=n[A+4>>2];r;)r=r-1|0,le(f),f=f+12|0;se(A)}function se(A){Af(A,4,12)}function Ge(A){var r=0,f=0;for(r=n[A+4>>2]+24|0,f=n[A+8>>2];f;)f=f-1|0,ge(r),r=r+40|0;De(A)}function De(A){Af(A,8,40)}function Ze(A){var r=0,f=0;for(r=n[A+8>>2],f=n[A+4>>2];r;)r=r-1|0,Pr(f),f=f+56|0;de(A)}function de(A){Af(A,8,56)}function Ie(A){var r=0,f=0;for(r=n[A+4>>2]+28|0,f=n[A+8>>2];f;)f=f-1|0,we(r),r=r+40|0;De(A)}function Ne(A){var r=0,f=0;for(f=n[A+8>>2],r=n[A+4>>2];f;)ge(r),ge(r+16|0),f=f-1|0,r=r+28|0;me(A)}function me(A){Af(A,4,28)}function ye(A){Af(A,8,16)}function he(A){Af(A,2,6)}function We(A){Af(A,4,8)}function Ce(A){return Ri(Nf(A,0,0))}function Ue(A){Af(A,8,32)}function ze(A,r){var f=0;N=f=N-16|0,n[f+12>>2]=r,n[f+8>>2]=A,r=n[(A=f+8|0)>>2],f=n[A+4>>2],A=n[19271],Aa[0|(A||14)](r,f),c()}function Fe(A,r,f){return p(f,A,r)}function Je(A,r,f){var i=0,a=0;for((i=ra()<<16)>>>0>>0|i>>>0>>0&&c(),A>>>0>r>>>0?(i=f-1|0,f=-1,a=-1):(i=0,a=1);(0|f)!=(0|i);)e[A+i|0]=u[r+i|0],i=i+a|0}function je(A,r){for(A+r>>>0>ra()<<16>>>0&&c();r;)e[(r=r-1|0)+A|0]=0}function Re(A,r,f){var i;return A=(i=r>>31)^Ve((A^=i)-i|0,(r^i)-((A>>>0>>0)+i|0)|0,f,0),C=(i^C)-((A>>>0>>0)+i|0)|0,r=A-i|0}function Ve(A,r,f,i){var e=0,a=0,n=0,b=0,k=0,o=0,t=0,c=0,u=0,B=0;A:{r:{f:{i:{e:{a:{n:{b:{k:{o:{if(r){if(t=f,!f)break o;if(!i)break k;if((f=l(i)-l(r)|0)>>>0<=31)break b;break r}if(1==(0|i)|i>>>0>1)break r;return h=A-g(r=(A>>>0)/(f>>>0)|0,f)|0,W=0,C=0,r}if(!A)break n;if(!i)break a;if((f=i-1|0)&i)break a;return h=A,W=r&f,A=r>>>Xe(i)|0,C=0,A}if(!((f=t-1|0)&t))break e;e=0-(o=(l(t)+33|0)-l(r)|0)|0;break f}o=f+1|0,e=63-f|0;break f}return h=0,W=r-g(A=(r>>>0)/(i>>>0)|0,i)|0,C=0,A}if((f=l(i)-l(r)|0)>>>0<31)break i;break r}if(h=A&f,W=0,1==(0|t))break A;return i=31&(f=Xe(t)),(63&f)>>>0>=32?(f=0,A=r>>>i|0):(f=r>>>i|0,A=((1<>>i),C=f,A}o=f+1|0,e=63-f|0}if(a=A,n=31&(f=63&o),(63&f)>>>0>=32?(f=0,a=r>>>n|0):(f=r>>>n|0,a=((1<>>n),n=63&e,e=A,b=31&n,(63&n)>>>0>=32?(k=A<>>32-b|r<>>31,b=e-(f+(n>>>0<(a=a<<1|r>>>31)>>>0)|0)|0,a=(f=a)-(b=t&(k=u=b>>31))|0,f=c-((i&k)+(f>>>0>>0)|0)|0,k=r<<1|A>>>31,A=B|A<<1,r=k,B=c=1&u,o=o-1|0;);return h=a,W=f,C=k=r<<1|A>>>31,A=c|A<<1}h=A,W=r,A=0,r=0}return C=r,A}function Xe(A){return A?31-l(A-1^A)|0:32}function Te(A,r,f,i){var e,a,n,b,k=0,o=0;return b=g(k=f>>>16|0,o=A>>>16|0),k=(65535&(o=((n=g(e=65535&f,a=65535&A))>>>16|0)+g(o,e)|0))+g(k,a)|0,C=(g(r,f)+b|0)+g(A,i)+(o>>>16)+(k>>>16)|0,65535&n|k<<16}function He(A){for(var r=0;A;)A&=A-1,r=r+1|0;return r}function Oe(A){var r;return(-1>>>(r=31&A)&-2)<>>A}function xe(A,r){return C=A,r}function Le(A,r){var f=0;return(-1<<(f=31&r)&A)>>>f|0|((f=A)&-1>>>(A=0-r&31))<>2]>>0&&(yf(b,73,a),c()),function(A,r,f,i,e){var a,b=0,k=0,o=0,t=0;N=a=N-16|0,o=a+12|0,e&&(k=n[r>>2])&&(n[a+12>>2]=i,b=g(e,k),k=n[r+4>>2],o=a+8|0),n[o>>2]=b;A:{if(b=n[a+12>>2]){if(t=n[a+8>>2],f){if(o=g(f,e),e?i=T(k,t,b,o):(t&&Qr(k,t),i=b),!i)break A}else t&&Qr(k,t);n[r+4>>2]=i,n[r>>2]=f}b=-1}n[A+4>>2]=o,n[A>>2]=b,N=a+16|0}(k+8|0,r,f,i,e),r=n[k+12>>2],n[A>>2]=n[k+8>>2],n[A+4>>2]=r,N=k+16|0}function Se(A,r,f){var i;N=i=N-16|0,NA(i+8|0,A,n[A>>2],1,f,r),-1!=(0|(A=n[i+8>>2]))&&(_i(A,n[i+12>>2]),c()),N=i+16|0}function _e(A,r,f){var i;N=i=N-16|0,hr(i+8|0,r,f,f),r=n[i+12>>2],f=n[i+8>>2],n[A+8>>2]=0,n[A>>2]=f,n[A+4>>2]=r,N=i+16|0}function Ke(A,r,f,i){var e;return(e=n[A+8>>2])>>>0<=r>>>0&&(Ur(r,e,f),c()),n[A+4>>2]+g(r,i)|0}function Pe(A,r,f,i){var e;return(e=n[A+8>>2])>>>0<=r>>>0&&(Ur(r,e,f),c()),n[A+4>>2]+(r<>2],n[A>>2]-e>>>0>>0&&wf(A,e,r,i,f)}function $e(A,r,f){var i,e=0;if(N=i=N-32|0,FA(i+20|0,r,1,f,f),f=n[i+24>>2],1!=n[i+20>>2])return e=n[i+28>>2],n[A+8>>2]=r,n[A+4>>2]=e,n[A>>2]=f,void(N=i+32|0);_i(f,n[i+28>>2]),c()}i(A=u,65536,"wAE7wADAAS3AABZzbGljZSBpbmRleCBzdGFydHMgYXQgwA0gYnV0IGVuZHMgYXQgwAAgaW5kZXggb3V0IG9mIGJvdW5kczogdGhlIGxlbiBpcyDAEiBidXQgdGhlIGluZGV4IGlzIMAAEnJhbmdlIHN0YXJ0IGluZGV4IMAiIG91dCBvZiByYW5nZSBmb3Igc2xpY2Ugb2YgbGVuZ3RoIMAAEHJhbmdlIGVuZCBpbmRleCDAIiBvdXQgb2YgcmFuZ2UgZm9yIHNsaWNlIG9mIGxlbmd0aCDAABBhc3NlcnRpb24gYGxlZnQgwBcgcmlnaHRgIGZhaWxlZAogIGxlZnQ6IMAJCiByaWdodDogwAAQYXNzZXJ0aW9uIGBsZWZ0IMAQIHJpZ2h0YCBmYWlsZWQ6IMAJCiAgbGVmdDogwAkKIHJpZ2h0OiDAAEhjYW5ub3QgYWNjZXNzIGEgVGhyZWFkIExvY2FsIFN0b3JhZ2UgdmFsdWUgZHVyaW5nIG9yIGFmdGVyIGRlc3RydWN0aW9uOiDAAMACOiDAAMABIMAAL3J1c3RjLzU4Y2Y4ZjljMzViMzU1MTk5NzI3NjI3ZDA3YWUzNGE0ZTI4NDZkNjcvbGlicmFyeS9hbGxvYy9zcmMvZm10LnJzAC9ydXN0Yy81OGNmOGY5YzM1YjM1NTE5OTcyNzYyN2QwN2FlMzRhNGUyODQ2ZDY3L2xpYnJhcnkvc3RkL3NyYy9zeXMvc3luYy9tdXRleC9ub190aHJlYWRzLnJzAC9ydXN0Yy81OGNmOGY5YzM1YjM1NTE5OTcyNzYyN2QwN2FlMzRhNGUyODQ2ZDY3L2xpYnJhcnkvc3RkL3NyYy9zeXMvc3luYy9yd2xvY2svbm9fdGhyZWFkcy5ycwAvcnVzdGMvNThjZjhmOWMzNWIzNTUxOTk3Mjc2MjdkMDdhZTM0YTRlMjg0NmQ2Ny9saWJyYXJ5L2FsbG9jL3NyYy9zdHIucnMAL3J1c3RjLzU4Y2Y4ZjljMzViMzU1MTk5NzI3NjI3ZDA3YWUzNGE0ZTI4NDZkNjcvbGlicmFyeS9jb3JlL3NyYy9zbGljZS9pdGVyLnJzAHNyYy9yYW5nZV9kZWNvZGVyLnJzAHNyYy9mb250X2J1aWxkZXIucnMAc3JjL21vZGVsLnJzAC9ydXN0Yy81OGNmOGY5YzM1YjM1NTE5OTcyNzYyN2QwN2FlMzRhNGUyODQ2ZDY3L2xpYnJhcnkvc3RkL3NyYy90aHJlYWQvbG9jYWwucnMAL3J1c3RjLzU4Y2Y4ZjljMzViMzU1MTk5NzI3NjI3ZDA3YWUzNGE0ZTI4NDZkNjcvbGlicmFyeS9zdGQvc3JjL3N5bmMvb25jZV9sb2NrLnJzAC9ydXN0Yy81OGNmOGY5YzM1YjM1NTE5OTcyNzYyN2QwN2FlMzRhNGUyODQ2ZDY3L2xpYnJhcnkvYWxsb2Mvc3JjL3N0cmluZy5ycwBzcmMvb3V0bGluZS5ycwBzcmMvc3R5bGUucnMAc3JjL3VuaWNvZGUucnMAL3J1c3RjLzU4Y2Y4ZjljMzViMzU1MTk5NzI3NjI3ZDA3YWUzNGE0ZTI4NDZkNjcvbGlicmFyeS9zdGQvc3JjL3N5bmMvb25jZS5ycwAvcnVzdGMvNThjZjhmOWMzNWIzNTUxOTk3Mjc2MjdkMDdhZTM0YTRlMjg0NmQ2Ny9saWJyYXJ5L2NvcmUvc3JjL3NsaWNlL21vZC5ycwAvcnVzdGMvNThjZjhmOWMzNWIzNTUxOTk3Mjc2MjdkMDdhZTM0YTRlMjg0NmQ2Ny9saWJyYXJ5L2FsbG9jL3NyYy9yYXdfdmVjL21vZC5ycwAvcnVzdGMvNThjZjhmOWMzNWIzNTUxOTk3Mjc2MjdkMDdhZTM0YTRlMjg0NmQ2Ny9saWJyYXJ5L2FsbG9jL3NyYy92ZWMvbW9kLnJzAC9ydXN0Yy81OGNmOGY5YzM1YjM1NTE5OTcyNzYyN2QwN2FlMzRhNGUyODQ2ZDY3L2xpYnJhcnkvYWxsb2Mvc3JjL3ZlYy9zcGVjX2Zyb21faXRlcl9uZXN0ZWQucnMAL3J1c3QvZGVwcy9kbG1hbGxvYy0wLjIuMTQvc3JjL2RsbWFsbG9jLnJzAHNyYy9saWIucnMAc3JjL2dseXBoX2RhdGEucnMADlRoZSBkYXRhIGZpbGUgwBAgaXNuJ3QgcHJvdmlkZWQuABRNaXNzaW5nIGRhdGEgZmlsZXM6IMABLgAQR2VuZXJhdGVkIGZyb206IMABLgAmY29weV9mcm9tX3NsaWNlOiBzb3VyY2Ugc2xpY2UgbGVuZ3RoICjAKykgZG9lcyBub3QgbWF0Y2ggZGVzdGluYXRpb24gc2xpY2UgbGVuZ3RoICjAASkAjAQBAEwAAADiAAAAFAAAAE9uY2UgaW5zdGFuY2UgaGFzIHByZXZpb3VzbHkgYmVlbiBwb2lzb25lZG9uZS10aW1lIGluaXRpYWxpemF0aW9uIG1heSBub3QgYmUgcGVyZm9ybWVkIHJlY3Vyc2l2ZWx5AABzAwEATwAAAOcBAAAZAAAAcwMBAE8AAACtAQAAGQAAAGYDAQAMAAAAGgUAACoAAABmAwEADAAAAB8FAAAlAAAAZgMBAAwAAAD3BQAAJgAAAGYDAQAMAAAAdAUAACEAAABmAwEADAAAAHUFAAAhAAAAZgMBAAwAAAB2BQAAIQAAAGYDAQAMAAAAeAUAACQAAABmAwEADAAAAHgFAAA5AAAAZgMBAAwAAACWBQAALgAAAGYDAQAMAAAAlwUAACoAAABmAwEADAAAAJgFAAAqAAAAZgMBAAwAAACdBQAAKgAAAGYDAQAMAAAApQUAACEAAABmAwEADAAAAKYFAAAhAAAAZgMBAAwAAACnBQAAKQAAAGYDAQAMAAAAqAUAACkAAABmAwEADAAAADcGAAAlAAAAZgMBAAwAAABeBgAANwAAAGYDAQAMAAAAfQYAAB0AAABmAwEADAAAAJcGAAAfAAAAZgMBAAwAAACYBgAAKgAAAGYDAQAMAAAAmAYAAEAAAABmAwEADAAAAMgGAAAhAAAAZgMBAAwAAADSBgAAHgAAAGYDAQAMAAAA5QYAABsAAABmAwEADAAAAOYGAAAbAAAAZgMBAAwAAADvBgAANwAAAGYDAQAMAAAABQcAABIAAABmAwEADAAAAAYHAAASAAAAZgMBAAwAAAAyBgAAGgAAAGYDAQAMAAAAMwYAABEAAABmAwEADAAAANsHAAAsAAAAZgMBAAwAAADcBwAALAAAAGYDAQAMAAAA3QcAACwAAABmAwEADAAAANQHAAAbAAAAZgMBAAwAAADVBwAAGgAAAGYDAQAMAAAA1QcAAC0AAABmAwEADAAAANYHAAAaAAAAZgMBAAwAAADWBwAALQAAAGYDAQAMAAAADAgAABcAAABmAwEADAAAAA8IAAAWAAAAZgMBAAwAAAAQCAAAFgAAAGYDAQAMAAAAHAgAABMAAABmAwEADAAAAB4IAAAPAAAAZgMBAAwAAAAoCAAAFwAAAGYDAQAMAAAAKQgAABcAAABmAwEADAAAAFwIAAAOAAAAZgMBAAwAAABdCAAADgAAAGYDAQAMAAAA7AcAABcAAABmAwEADAAAAO8HAAAWAAAAZgMBAAwAAADwBwAAFgAAAGYDAQAMAAAAzwcAACYAAABmAwEADAAAAGwHAAAQAAAAZgMBAAwAAACWBwAAFQAAAGYDAQAMAAAAlgcAADcAAABmAwEADAAAAJcHAAAVAAAAZgMBAAwAAACXBwAANwAAAGYDAQAMAAAAhgcAABcAAABmAwEADAAAAJEHAAAVAAAAZgMBAAwAAACSBwAAFQAAAGYDAQAMAAAAeAcAABcAAABmAwEADAAAAH0HAAAVAAAAZgMBAAwAAACABwAAFQAAAGYDAQAMAAAAcQcAABQAAABjYXBhY2l0eSBvdmVyZmxvdwAAAHgFAQBMAAAAMhAAAA0AAAClAgEASAAAAMgAAAAWAAAAYXR0ZW1wdCB0byBqb2luIGludG8gY29sbGVjdGlvbiB3aXRoIGxlbiA+IHVzaXplOjpNQVgAAAClAgEASAAAAK8AAAAKAAAAUgMBABMAAABXAQAAGgAAAFIDAQATAAAARwEAABgAAABSAwEAEwAAAEsBAAAdAAAAUgMBABMAAADiAAAAJAAAAFIDAQATAAAA4wAAACQAAABSAwEAEwAAAOUAAAAkAAAAUgMBABMAAADmAAAAJAAAAFIDAQATAAAA6AAAACAAAABSAwEAEwAAAOkAAAAgAAAA2QQBAE0AAADxAwAAHAAAANkEAQBNAAAA8gMAABwAAADZBAEATQAAAPYDAAAgAAAA2QQBAE0AAAD2AwAAKwAAAIwEAQBMAAAA4gAAADEAAABmAwEADAAAAF4FAAA1AAAAZgMBAAwAAABkBQAANQAAAGYDAQAMAAAAyQYAADMAAABmAwEADAAAAH0FAAA1AAAAZgMBAAwAAADVCAAAPQAAAFIDAQATAAAAogIAABcAAABSAwEAEwAAAKICAABAAAAASW52YWxpZCBlbWJlZGRlZCBVbmljb2RlIHRhYmxlcwBPBgEACgAAAIIBAAA3AAAAfQQBAA4AAABiAAAAKwAAAH0EAQAOAAAAYgAAAEoAAAB9BAEADgAAAFsAAAAmAAAAfQQBAA4AAABbAAAAPAAAAMMDAQBRAAAANQEAADQAAABPBgEACgAAAHQAAAAgAAAASW52YWxpZCBlbWJlZGRlZCBnbHlwaCBkYXRhAE8GAQAKAAAAgQAAADEAAABmAwEADAAAAHIIAAAdAAAAZgMBAAwAAAByCAAALwAAAGYDAQAMAAAAcggAADoAAABmAwEADAAAAHIIAABMAAAAWgYBABEAAADrAAAASQAAAFIDAQATAAAABgIAACIAAABSAwEAEwAAAIYCAAA+AAAAW10oKXt9PD4vJUludmFsaWQgbGVuZ3Rocy5JbnZhbGlkIHN0YW5kYXJkIGZvbnQuYQQBAA4AAABLAAAALAAAAGEEAQAOAAAASwAAADoAAABhBAEADgAAAFAAAAAiAAAAYQQBAA4AAABMAAAANQAAAFphcGZEaW5nYmF0cy5oYmdkU3ltYm9sLmhiZ2ROb3RvU3ltYm9scy5oYmdkdW5pY29kZS5iaW5TYW5zLVJlZ3VsYXIuaGJnZFNhbnMtQm9sZC5oYmdkU2VyaWYtUmVndWxhci5oYmdkU2VyaWYtQm9sZC5oYmdkU2VyaWYtSXRhbGljLmhiZ2RTZXJpZi1Cb2xkSXRhbGljLmhiZ2RNb25vLVJlZ3VsYXIuaGJnZE1vbm8tQm9sZC5oYmdkV2luZ2RpbmdzLmhiZ2RtaWQgPiBsZW4AAAAAAAEAAAABAAAABQAAAD0DAQAUAAAAKAAAACoAAABaBgEAEQAAAA8CAAAaAAAAWgYBABEAAAAWAgAAMAAAAFoGAQARAAAAFgIAAEUAAABaBgEAEQAAACUCAAA/AAAAWgYBABEAAAAgAgAAKQAAAFoGAQARAAAAIQIAACkAAABaBgEAEQAAACsCAAAyAAAAWgYBABEAAAArAgAARAAAAFoGAQARAAAA6QEAADcAAABaBgEAEQAAAPQBAABHAAAAWgYBABEAAAD1AQAANgAAAFoGAQARAAAA9QEAAEgAAABDb3VyaWVyQ291cmllci1Cb2xkQ291cmllci1PYmxpcXVlQ291cmllci1Cb2xkT2JsaXF1ZUhlbHZldGljYUhlbHZldGljYS1Cb2xkSGVsdmV0aWNhLU9ibGlxdWVIZWx2ZXRpY2EtQm9sZE9ibGlxdWVUaW1lcy1Sb21hblRpbWVzLUJvbGRUaW1lcy1JdGFsaWNUaW1lcy1Cb2xkSXRhbGljU3ltYm9sWmFwZkRpbmdiYXRzV2luZ2RpbmdzAAECAwQFBgcICQoLDA0OVHJpZWQgdG8gc2hyaW5rIHRvIGEgbGFyZ2VyIGNhcGFjaXR5AAAAJwUBAFAAAAArAwAACQAAAGYDAQAMAAAAYgIAABEAAABmAwEADAAAAGcCAAARAAAAZgMBAAwAAABzAgAAHwAAAAYAAABmAwEADAAAAFECAAAeAAAAY2Fubm90IHJlY3Vyc2l2ZWx5IGFjcXVpcmUgbXV0ZXjqAQEAXAAAABYAAAAJAAAAZgMBAAwAAAClAgAAIwAAAGYDAQAMAAAAswIAACcAAABmAwEADAAAABMDAAAUAAAAZgMBAAwAAAAVAwAAEwAAAGYDAQAMAAAAJQMAADgAAABmAwEADAAAACcDAAAfAAAAZgMBAAwAAADmAgAAFgAAAGYDAQAMAAAACwMAAAkAAABmAwEADAAAAAwDAAATAAAAZgMBAAwAAAAAAwAADQAAAGYDAQAMAAAAAQMAABcAAABmAwEADAAAAHQDAAAfAAAAZgMBAAwAAAB1AwAAHwAAAGYDAQAMAAAAeAMAACUAAABmAwEADAAAAHkDAAAlAAAAZgMBAAwAAAC2BQAANAAAAGYDAQAMAAAAxAUAAB4AAAD//////////wAAAAABAAAA/////wEAAAD/////AQAAAAEAAABmAwEADAAAAJEIAAAnAAAAZgMBAAwAAACOCAAAJAAAAGYDAQAMAAAAjwgAAC0AAABmAwEADAAAAIsIAAAnAAAAZgMBAAwAAACdCAAAKAAAAGYDAQAMAAAAmQgAACgAAABmAwEADAAAAKgIAAAxAAAAZgMBAAwAAACoCAAAQAAAAGYDAQAMAAAAqQgAADYAAABmAwEADAAAAKMIAAAtAAAAZgMBAAwAAACkCAAAMQAAAGYDAQAMAAAApAgAAEcAAABmAwEADAAAAKUIAAA2AAAAZgMBAAwAAACJCAAALQAAAFoGAQARAAAAyQAAACMAAABaBgEAEQAAAGoBAAAmAAAAWgYBABEAAABjAQAANAAAAFoGAQARAAAAZQEAAD4AAAA9AwEAFAAAAIUAAAAVAAAAWgYBABEAAAAgAAAAHQAAAFoGAQARAAAAIQAAACUAAABaBgEAEQAAACgAAABAAAAAWgYBABEAAAAsAAAAFgAAAFIDAQATAAAAeQEAABMAAABSAwEAEwAAAIIBAAAcAAAASGVsbGJveFN1YnN0aXR1dGUAAABSAwEAEwAAAGcCAAAVAAAAUgMBABMAAAA4AgAAJgAAAFIDAQATAAAA0gEAABgAAABSZWd1bGFySXRhbGljQm9sZEJvbGQgSXRhbGljCiwgAFIDAQATAAAAyQIAABIAAABWZXJzaW9uIDEuMABSAwEAEwAAAJEDAAAjAAAAAAADAAAAAAADAAEAAAAAAAAAAwAAAAAAAAAEAAEAAAADAAEAAAAAAAMACgABAAAAUERGSk9TLzJjbWFwZ2x5ZmhlYWRoaGVhaG10eGtlcm5sb2NhbWF4cG5hbWVwb3N0UgMBABMAAADaBAAACQAAAFIDAQATAAAA2gQAAC0AAABSAwEAEwAAACgDAAAYAAAAUgMBABMAAAAAAwAALwAAAFIDAQATAAAAAQMAACkAAABSAwEAEwAAAAIDAAApAAAAUgMBABMAAACHAwAAFgAAAFIDAQATAAAA0AMAAA0AAABSAwEAEwAAANADAAAdAAAASW52YWxpZCBmb250IGZhbWlseS5JbnZhbGlkIGtlcm5pbmcuSW52YWxpZCBudW1iZXIgb2Ygd2lkdGhzIG9yIGNoYXIgY29kZXMuAGYDAQAMAAAA9AEAABYAAABmAwEADAAAAPQBAAAoAAAAZgMBAAwAAAD0AQAAMwAAAGYDAQAMAAAA9AEAAEUAAABmAwEADAAAAPUBAAAtAAAAZgMBAAwAAAD2AQAAMwAAAGYDAQAMAAAA9gEAAAkAAABmAwEADAAAANYDAAASAAAAZgMBAAwAAADYAwAAEgAAAGYDAQAMAAAA2QMAABIAAABmAwEADAAAAN8DAAARAAAAZgMBAAwAAADgAwAACQAAAGYDAQAMAAAA/QMAABUAAABmAwEADAAAAAEEAAA1AAAAZgMBAAwAAAA0AwAADwAAAHAEAQAMAAAAUwAAABAAAABhBAEADgAAAB0AAAAYAAAAYQQBAA4AAAAeAAAAGAAAAGEEAQAOAAAAIAAAABgAAABhBAEADgAAACAAAAAnAAAAYQQBAA4AAAAhAAAAFAAAAGEEAQAOAAAAIgAAABQAAABhBAEADgAAAEgAAAAXAAAAYQQBAA4AAABJAAAAFwAAAGEEAQAOAAAAUwAAACIAAABhBAEADgAAAFQAAAAiAAAAYQQBAA4AAABYAAAAHwAAAGEEAQAOAAAAWQAAAB8AAABhBAEADgAAAHMAAAAXAAAAYQQBAA4AAAB0AAAAFwAAAGludmFsaWQgZ2x5cGggZGF0YXVuc3VwcG9ydGVkIGdseXBoIGRhdGEgY29tcHJlc3Npb251bmtub3duIGRhdGEgZmlsZQAAAO4CAQBOAAAA5AUAACUAAADuAgEATgAAAOILAAArAAAASW52YWxpZERhdGFVbnN1cHBvcnRlZENvbXByZXNzaW9uVW5rbm93bkRhdGFGaWxlBwAAAAwAAAAEAAAACAAAAAkAAAAK"),i(A,72036,"AQAAAAsAAABhIERpc3BsYXkgaW1wbGVtZW50YXRpb24gcmV0dXJuZWQgYW4gZXJyb3IgdW5leHBlY3RlZGx5ABUEAQBLAAAAiQsAAA4AAABFcnJvcgAAAMUFAQBeAAAAOQAAABIAAAAAAQIEAAIGAgICAgAAAAABAQEB////"),i(A,72174,"eUAAAAAAAOCFQAAAAAAAAHlAAAAAAADghUAAAAAAAAB5QAAAAAAA4IVAAAAAAAAAeUAAAAAAAOCFQAAAAAAAAHlAAAAAAADghUAAAAAAAAB5QAAAAAAA4IVAAAAAAAAAeUAAAAAAAAB5QAAAAAAAAHlA"),i(A,72310,"KMAAAAAAAAAowA=="),i(A,72342,"KMAAAAAAAAAowA=="),i(A,72368,"FK5H4XpUMMAUrkfhelQwwA=="),i(A,72408,"BwwPEwkOERULCgwQBgwJAMQQAQDLEAEA1xABAOYQAQD5EAEAAhEBABARAQAhEQEANhEBAEERAQBLEQEAVxEBAGcRAQBtEQEAeREBAAsWDwAUGQEAHxkBADUZAQBUcmllZCB0byBzaHJpbmsgdG8gYSBsYXJnZXIgY2FwYWNpdHknBQEAUAAAACsDAAAJAAAAAAAAAAQAAAAEAAAAEAAAABEAAAAMAAAABAAAABIAAAATAAAAFAAAAAAAAAAIAAAABAAAABUAAAAWAAAAFwAAABgAAAAZAAAAEAAAAAQAAAAaAAAAGwAAABwAAAAdAAAAXPbpX9wC9rnxwXBs8mHBJDs3TUqCEEUJw6Vh0T8gOo9hc3NlcnRpb24gZmFpbGVkOiBwc2l6ZSA+PSBzaXplICsgbWluX292ZXJoZWFkAAAkBgEAKgAAAOkEAAAJAAAAYXNzZXJ0aW9uIGZhaWxlZDogcHNpemUgPD0gc2l6ZSArIG1heF9vdmVyaGVhZAAAJAYBACoAAADvBAAADQAAACQGAQAqAAAATQUAAB4AAAByd2xvY2sgb3ZlcmZsb3dlZCByZWFkIGxvY2tzRwIBAF0AAAAYAAAALAAAAAAAAAAIAAAABAAAAB4AAABBY2Nlc3NFcnJvcgARAAAADAAAAAQAAAAfAAAAcndsb2NrIGhhcyBub3QgYmVlbiBsb2NrZWQgZm9yIHJlYWRpbmcAAEcCAQBdAAAAQQAAAAkAAADvv71jYXBhY2l0eSBvdmVyZmxvdycFAQBQAAAAHAAAAAUAAAAgAAAADAAAAAQAAAAhAAAAIgAAACM="),i(A,73036,"AQAAACQAAABhIGZvcm1hdHRpbmcgdHJhaXQgaW1wbGVtZW50YXRpb24gcmV0dXJuZWQgYW4gZXJyb3Igd2hlbiB0aGUgdW5kZXJseWluZyBzdHJlYW0gZGlkIG5vdAAAoQEBAEgAAACRAgAADgAAAEVycm9yfSB9Y2FsbGVkIGBPcHRpb246OnVud3JhcCgpYCBvbiBhIGBOb25lYCB2YWx1ZT09IT1tYXRjaGVzMDAwMTAyMDMwNDA1MDYwNzA4MDkxMDExMTIxMzE0MTUxNjE3MTgxOTIwMjEyMjIzMjQyNTI2MjcyODI5MzAzMTMyMzMzNDM1MzYzNzM4Mzk0MDQxNDI0MzQ0NDU0NjQ3NDg0OTUwNTE1MjUzNTQ1NTU2NTc1ODU5NjA2MTYyNjM2NDY1NjY2NzY4Njk3MDcxNzI3Mzc0NzU3Njc3Nzg3OTgwODE4MjgzODQ4NTg2ODc4ODg5OTA5MTkyOTM5NDk1OTY5Nzk4OTkBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ=="),i(A,73604,"AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwMDAwMDAwMDAwMDAwMDAwQEBAQE"),i(A,73666,"YXR0ZW1wdCB0byBkaXZpZGUgYnkgemVyb2F0dGVtcHQgdG8gY2FsY3VsYXRlIHRoZSByZW1haW5kZXIgd2l0aCBhIGRpdmlzb3Igb2YgemVyb2ZhbHNldHJ1ZQAAAO8dAQDxHQEA8x0BAAICBw=="),i(A,73776,"EA8BABE="),i(A,74004,"IQ8BAAs="),i(A,74232,"LA8BABA="),i(A,74460,"PA8BAAs="),i(A,74480,"Rw8BABE="),i(A,74708,"WA8BAA4="),i(A,74936,"Zg8BABI="),i(A,75164,"eA8BAA8="),i(A,75392,"hw8BABE="),i(A,75620,"mA8BABU="),i(A,75848,"rQ8BABE="),i(A,76076,"vg8BAA4="),i(A,76304,"zA8BAA4="),i(A,76536,"BAAAAAAAAAAN"),i(A,77002,"AQD/Dw==");var Aa=[null,function(A,r){return r|=0,0|Fe(n[(A|=0)>>2],n[A+4>>2],r)},function(A,r){return r|=0,0|Fe(n[(A|=0)+4>>2],n[A+8>>2],r)},function(A){return(A|=0)+24|0},function(A){return 0|(A|=0)},function(A,r){return r|=0,A=u[0|(A|=0)],0|ie(r,n[72488+(A<<2)>>2],u[A+72484|0])},function(A){return 76532},xi,function(A,r,f){return Mf(A|=0,r|=0,f|=0),0},function(A,r){return Zr(A|=0,r|=0),0},function(A,r,f){return 0|S(A|=0,72004,r|=0,f|=0)},function(A,r){return 0|ie(r|=0,72116,5)},I,function(){c()},function(A,r){e[77104]=1},function(A,r){A|=0;var f,i=0;return N=A=N-16|0,i=0|Aa[n[n[(r|=0)+4>>2]+12>>2]](n[r>>2],72884,11),e[(f=A+8|0)+5|0]=0,e[f+4|0]=i,n[f>>2]=r,r=u[f+4|0],u[f+5|0]&&(i=1,1&r||(r=n[f>>2],i=128&u[r+10|0]?0|Aa[n[n[r+4>>2]+12>>2]](n[r>>2],73153,1):0|Aa[n[n[r+4>>2]+12>>2]](n[r>>2],73154,2)),r=i,e[f+4|0]=r),N=A+16|0,1&r},function(A,r){return r|=0,0|(A=u[n[(A|=0)>>2]]?p(r,73753,4):p(r,73748,5))},xi,function(A,r,f){r|=0,f|=0;var i=0;i=n[(A|=0)+8>>2];A:{if(n[A>>2]-i>>>0>>0)OA(A,i,f),i=n[A+8>>2];else if(!f)break A;f&&Je(n[A+4>>2]+i|0,r,f)}return n[A+8>>2]=f+i,0},function(A,r){r|=0;var f,i,a=0,b=0,k=0,o=0;i=n[(A|=0)+8>>2],a=1,r>>>0<128||(a=2,r>>>0<2048||(a=r>>>0<65536?3:4)),a>>>0>n[A>>2]-i>>>0&&OA(A,i,a),f=n[A+4>>2]+i|0;A:if(r>>>0>=128){if(k=63&r|-128,b=r>>>6|0,r>>>0<2048){e[f+1|0]=k,e[0|f]=192|b;break A}if(o=r>>>12|0,b=63&b|-128,r>>>0<=65535){e[f+2|0]=k,e[f+1|0]=b,e[0|f]=224|o;break A}e[f+3|0]=k,e[f+2|0]=b,e[f+1|0]=63&o|-128,e[0|f]=r>>>18|-16}else e[0|f]=r;return n[A+8>>2]=i+a,0},function(A,r,f){return 0|S(A|=0,72568,r|=0,f|=0)},function(A,r){return 0|ie(r|=0,n[(A|=0)>>2],n[A+4>>2])},function(A,r){var f,i;A|=0,f=n[(r|=0)+4>>2],i=n[r>>2],(r=pi(8,4))||(ze(4,8),c()),n[r+4>>2]=f,n[r>>2]=i,n[A+4>>2]=72868,n[A>>2]=r},function(A,r){r|=0,n[(A|=0)+4>>2]=72868,n[A>>2]=r},function(A,r){var f;A|=0,f=n[(r|=0)+4>>2],n[A>>2]=n[r>>2],n[A+4>>2]=f},xi,function(A,r){return r|=0,-1!=n[(A|=0)>>2]?0|ie(r,n[A+4>>2],n[A+8>>2]):(A=n[n[A+12>>2]>>2],0|S(n[r>>2],n[r+4>>2],n[A>>2],n[A+4>>2]))},function(A,r){A|=0;var f,i=0,e=0,a=0;N=f=N-32|0,-1==n[(r|=0)>>2]&&(i=n[r+12>>2],n[f+24>>2]=0,n[f+16>>2]=0,n[f+20>>2]=1,i=n[i>>2],S(f+16|0,72568,n[i>>2],n[i+4>>2]),e=n[f+24>>2],n[f+8>>2]=e,a=n[f+20>>2],i=n[f+16>>2],n[f>>2]=i,n[f+4>>2]=a,n[r+8>>2]=e,n[r>>2]=i,n[r+4>>2]=a),i=n[r+8>>2],n[r+8>>2]=0,a=n[r>>2],e=n[r+4>>2],n[r>>2]=0,n[r+4>>2]=1,n[f+24>>2]=i,n[f+16>>2]=a,n[f+20>>2]=e,(r=pi(12,4))||(ze(4,12),c()),n[r+8>>2]=n[f+24>>2],i=n[f+20>>2],n[r>>2]=n[f+16>>2],n[r+4>>2]=i,n[A+4>>2]=72896,n[A>>2]=r,N=f+32|0},function(A,r){A|=0;var f,i=0,e=0,a=0;N=f=N-32|0,-1==n[(r|=0)>>2]&&(i=n[r+12>>2],n[f+28>>2]=0,n[f+20>>2]=0,n[f+24>>2]=1,i=n[i>>2],S(f+20|0,72568,n[i>>2],n[i+4>>2]),e=n[f+28>>2],n[f+16>>2]=e,i=n[f+24>>2],a=n[f+20>>2],n[f+8>>2]=a,n[f+12>>2]=i,n[r+8>>2]=e,n[r>>2]=a,n[r+4>>2]=i),n[A+4>>2]=72896,n[A>>2]=r,N=f+32|0},function(A,r){n[(A|=0)>>2]=0},function(A,r){A|=0,r|=0,r=n[18165],n[A+8>>2]=n[18164],n[A+12>>2]=r,r=n[18163],n[A>>2]=n[18162],n[A+4>>2]=r},function(A,r){A|=0,r|=0,r=n[18169],n[A+8>>2]=n[18168],n[A+12>>2]=r,r=n[18167],n[A>>2]=n[18166],n[A+4>>2]=r},xi,function(A,r,f){r|=0,f|=0;var i=0;i=n[(A|=0)+8>>2];A:{if(n[A>>2]-i>>>0>>0)LA(A,i,f),i=n[A+8>>2];else if(!f)break A;f&&Je(n[A+4>>2]+i|0,r,f)}return n[A+8>>2]=f+i,0},function(A,r){r|=0;var f,i,a=0,b=0,k=0,o=0;i=n[(A|=0)+8>>2],a=1,r>>>0<128||(a=2,r>>>0<2048||(a=r>>>0<65536?3:4)),a>>>0>n[A>>2]-i>>>0&&LA(A,i,a),f=n[A+4>>2]+i|0;A:if(r>>>0>=128){if(k=63&r|-128,b=r>>>6|0,r>>>0<2048){e[f+1|0]=k,e[0|f]=192|b;break A}if(o=r>>>12|0,b=63&b|-128,r>>>0<=65535){e[f+2|0]=k,e[f+1|0]=b,e[0|f]=224|o;break A}e[f+3|0]=k,e[f+2|0]=b,e[f+1|0]=63&o|-128,e[0|f]=r>>>18|-16}else e[0|f]=r;return n[A+8>>2]=i+a,0},function(A,r,f){return 0|S(A|=0,73004,r|=0,f|=0)},function(A,r){return 0|ie(r|=0,73148,5)},function(A,r){return r|=0,0|Aa[n[n[(A|=0)+4>>2]+12>>2]](n[A>>2],r)},function(A,r){return A|=0,0|S(n[(r|=0)>>2],n[r+4>>2],n[A>>2],n[A+4>>2])},function(A,r){return 0|p(r|=0,n[(A|=0)>>2],n[A+4>>2])},function(A,r){r|=0;var f,i,a,b,k,o=0,t=0,c=0,v=0,Q=0,w=0,l=0,E=0;if(N=f=N-16|0,c=10,(A=l=n[(A|=0)>>2])>>>0>=1e3)for(;w=(v=(f+6|0)+c|0)-4|0,Q=(t=A)-g(A=(A>>>0)/1e4|0,1e4)|0,o=u[(o=(E=((65535&Q)>>>0)/100|0)<<1)+73210|0]|u[o+73211|0]<<8,e[0|w]=o,e[w+1|0]=o>>>8,w=v-2|0,o=(Q-g(E,100)&65535)<<1,o=u[o+73210|0]|u[o+73211|0]<<8,e[0|w]=o,e[w+1|0]=o>>>8,c=c-4|0,t>>>0>9999999;);A>>>0>9&&(o=(c=c-2|0)+(f+6|0)|0,t=((t=A)-g(A=((65535&A)>>>0)/100|0,100)&65535)<<1,t=u[t+73210|0]|u[t+73211|0]<<8,e[0|o]=t,e[o+1|0]=t>>>8),!A&&l||(e[(c=c-1|0)+(f+6|0)|0]=u[73211+(A<<1)|0]),a=(f+6|0)+c|0,i=10-c|0,c=0,b=(A=2097152&(o=n[r+8>>2]))?43:-1,k=!!(8388608&o);A:{r:{f:{i:{e:{a:{n:{b:{k:{if((l=i+(A>>>21|0)|0)>>>0<(t=B[r+12>>1])>>>0){if(16777216&o)break a;switch(t=t-l|0,A=0,(o>>>29&3)-1|0){case 0:case 2:break k;case 1:break b;default:break n}}if(!xf(t=n[r>>2],A=n[r+4>>2],b,k))break r;o=1;break A}A=t;break n}A=(65534&t)>>>1|0}if(E=2097151&o,v=n[r+4>>2],Q=n[r>>2],!(w=65535&A))break e;for(r=n[v+16>>2],o=1;;){if(0|Aa[0|r](Q,E))break A;if(!((65535&(c=c+1|0))>>>0>>0))break}break e}if(E=n[r+12>>2],A=n[r+8>>2],n[r+8>>2]=-1612709888&A|536870960,o=1,xf(v=n[r>>2],Q=n[r+4>>2],b,k))break A;if((0|t)==(65535&l))break f;w=n[Q+16>>2],t=t-l&65535;break i}if(o=1,xf(Q,v,b,k))break A;if(0|Aa[n[v+12>>2]](Q,a,i))break A;if(o=0,(65535&t)==(65535&A))break A;for(r=n[v+16>>2],c=0,A=t-A&65535;;){if(o=0|Aa[0|r](Q,E))break A;if(!(A>>>0>(65535&(c=c+1|0))>>>0))break}break A}for(;;){if(!(0|Aa[0|w](v,48))){if(t>>>0>(65535&(c=c+1|0))>>>0)continue;break f}break}break A}if(0|Aa[n[Q+12>>2]](v,a,i))break A;n[r+8>>2]=A,n[r+12>>2]=E,o=0;break A}o=0|Aa[n[A+12>>2]](t,a,i)}return N=f+16|0,0|o}];function ra(){return f.byteLength>>16}function fa(r){r|=0;var i=0|ra(),b=i+r|0;if(i>2]=f,n[k+12>>2]=r,n[k+20>>2]=i,Q[k+24>>3]=e,Q[k+32>>3]=a,Q[k+40>>3]=b,r=k+159|0,n[k+152>>2]=r,n[k+148>>2]=r,n[k+144>>2]=r,n[k+140>>2]=k+40,n[k+136>>2]=r,n[k+132>>2]=r,n[k+128>>2]=r,n[k+124>>2]=k+32,n[k+120>>2]=r,n[k+116>>2]=r,n[k+112>>2]=r,n[k+108>>2]=k+24,n[k+104>>2]=r,n[k+100>>2]=r,n[k+96>>2]=r,n[k+92>>2]=k+20,n[k+88>>2]=r,n[k+84>>2]=r,n[k+80>>2]=r,n[k+76>>2]=k+16,n[k+72>>2]=r,n[k+68>>2]=r,n[k+64>>2]=r,n[k+60>>2]=k+12,i=k+48|0,N=r=N-176|0,o=n[n[(f=k+60|0)>>2]>>2],BA(r+8|0,0!=n[n[f+16>>2]>>2],0!=n[n[f+32>>2]>>2],Q[n[f+48>>2]>>3],Q[n[f+64>>2]>>3],Q[n[f+80>>2]>>3]),Vr(r+160|0,o),1!=u[r+160|0]?(_(r+148|0,u[r+161|0],r+8|0),n[r+168>>2]=n[r+148>>2],o=n[r+152>>2],n[r+164>>2]=o,n[r+160>>2]=o,n[r+172>>2]=o+(n[r+156>>2]<<3),Er(i,r+160|0)):(o=n[r+164>>2],n[i>>2]=-1,n[i+4>>2]=o),Ae(r+8|0),N=r+176|0,Ar(f,i),f=n[k+64>>2],n[k+60>>2]?(i=0,o=1,r=0):(i=f,f=0,o=0,r=n[k+68>>2]),n[A+12>>2]=o,n[A+8>>2]=f,n[A+4>>2]=r,n[A>>2]=i,N=k+160|0},generate_font:function(A,r,f,i,k,o,c,v,w,l,M,Y,s,G,D,Z,d,I,m,y){A|=0,r|=0,f|=0,i|=0,k|=0,o|=0,c|=0,v|=0,w|=0,l|=0,M|=0,Y|=0,s=+s,G=+G,D=+D,Z=+Z,d|=0,I=+I,m|=0,y|=0;var h,W,C,z=0;N=h=N-336|0,n[h+16>>2]=f,n[h+12>>2]=r,n[h+20>>2]=i,n[h+24>>2]=k,n[h+28>>2]=o,n[h+32>>2]=c,n[h+36>>2]=v,n[h+40>>2]=w,n[h+44>>2]=l,n[h+48>>2]=M,n[h+52>>2]=Y,Q[h+56>>3]=s,Q[h+64>>3]=G,Q[h+72>>3]=D,Q[h+80>>3]=Z,n[h+92>>2]=d,Q[h+96>>3]=I,n[h+104>>2]=m,n[h+108>>2]=y,r=h+335|0,n[h+328>>2]=r,n[h+324>>2]=r,n[h+320>>2]=h+108,n[h+316>>2]=h+104,n[h+312>>2]=r,n[h+308>>2]=r,n[h+304>>2]=h+96,n[h+300>>2]=h+92,n[h+296>>2]=r,n[h+292>>2]=r,n[h+288>>2]=r,n[h+284>>2]=h+80,n[h+280>>2]=r,n[h+276>>2]=r,n[h+272>>2]=r,n[h+268>>2]=h+72,n[h+264>>2]=r,n[h+260>>2]=r,n[h+256>>2]=r,n[h+252>>2]=h- -64,n[h+248>>2]=r,n[h+244>>2]=r,n[h+240>>2]=r,n[h+236>>2]=h+56,n[h+232>>2]=r,n[h+228>>2]=r,n[h+224>>2]=r,n[h+220>>2]=h+52,n[h+216>>2]=r,n[h+212>>2]=r,n[h+208>>2]=r,n[h+204>>2]=h+48,n[h+200>>2]=r,n[h+196>>2]=r,n[h+192>>2]=r,n[h+188>>2]=h+44,n[h+184>>2]=r,n[h+180>>2]=r,n[h+176>>2]=h+40,n[h+172>>2]=h+36,n[h+168>>2]=r,n[h+164>>2]=r,n[h+160>>2]=h+32,n[h+156>>2]=h+28,n[h+152>>2]=r,n[h+148>>2]=r,n[h+144>>2]=h+24,n[h+140>>2]=h+20,n[h+136>>2]=r,n[h+132>>2]=r,n[h+128>>2]=h+16,n[h+124>>2]=h+12,o=h+112|0,N=i=N-368|0,lf(i+32|0,n[n[(k=h+124|0)>>2]>>2],n[n[k+4>>2]>>2]),r=n[i+36>>2],n[i+44>>2]=r,f=n[i+32>>2],n[i+40>>2]=f,lf(i+24|0,n[n[k+16>>2]>>2],n[n[k+20>>2]>>2]),c=n[i+28>>2],n[i+52>>2]=c,v=n[i+24>>2],n[i+48>>2]=v,Ef(i+16|0,n[n[k+32>>2]>>2],n[n[k+36>>2]>>2]),w=n[i+20>>2],n[i+60>>2]=w,l=n[i+16>>2],n[i+56>>2]=l,lf(i+8|0,n[n[k+48>>2]>>2],n[n[k+52>>2]>>2]),M=n[i+12>>2],n[i+68>>2]=M,Y=n[i+8>>2],n[i+64>>2]=Y,d=n[n[k+64>>2]>>2],m=n[n[k+80>>2]>>2],y=n[n[k+96>>2]>>2],G=Q[n[k+112>>2]>>3],D=Q[n[k+128>>2]>>3],Z=Q[n[k+144>>2]>>3],s=Q[n[k+160>>2]>>3],I=Q[n[k+180>>2]>>3],C=n[n[k+176>>2]>>2],Xr(W=i+72|0,n[n[k+192>>2]>>2],n[n[k+196>>2]>>2]),gA(i+232|0,f,r,v,c,l,w,Y,M),r=n[i+236>>2];A:if(-1!=(0|(f=n[i+232>>2]))){c=n[i+240>>2],n[i+92>>2]=c,n[i+88>>2]=r,n[i+84>>2]=f,AA(i+232|0,i+72|0,c),r=n[i+236>>2];r:{if(-1!=(0|(f=n[i+232>>2]))){if(c=n[i+240>>2],BA(v=i+232|0,!!(0|m),!!(0|y),G,D,Z),Q[i+176>>3]=Q[i+312>>3],Q[i+104>>3]=Q[i+240>>3],w=n[i+236>>2],n[i+96>>2]=n[i+232>>2],n[i+100>>2]=w,Q[i+120>>3]=Q[i+256>>3],w=n[i+252>>2],n[i+112>>2]=n[i+248>>2],n[i+116>>2]=w,a[i+224>>1]=B[i+360>>1],Q[i+136>>3]=Q[i+272>>3],w=n[i+268>>2],n[i+128>>2]=n[i+264>>2],n[i+132>>2]=w,Q[i+152>>3]=s,t(+s),w=0|b(1),M=(l=0|b(0))-1|0,l=(w&=2147483647)-!l|0,n[i+144>>2]=1048575==(0|l)&-1!=(0|M)|l>>>0<1048575|w+-1048576>>>0<2145386496,n[i+148>>2]=0,n[i+160>>2]=!!(0|C),n[i+164>>2]=0,Q[i+168>>3]=I,n[i+212>>2]=f,n[i+216>>2]=r,n[i+220>>2]=c,Q[i+184>>3]=Q[i+320>>3],Q[i+192>>3]=Q[i+328>>3],e[i+226|0]=u[i+362|0],r=n[i+340>>2],n[i+200>>2]=n[i+336>>2],n[i+204>>2]=r,n[i+208>>2]=n[i+344>>2],ye(i+348|0),Vr(v,d),1==u[i+232|0])r=n[i+236>>2];else{if(_(r=i+232|0,f=u[i+233|0],i+96|0),DA(i,r),1!=n[i>>2])break r;r=n[i+4>>2]}n[o>>2]=-1,n[o+4>>2]=r,Ae(i+96|0)}else n[o>>2]=-1,n[o+4>>2]=r;Ge(i+84|0);break A}w=n[i+88>>2],l=n[i+92>>2],N=r=N-112|0,PA(r+8|0,c=i+96|0),D=Q[c+24>>3],(Y=n[c+16>>2]&D>0)&&(v=Ce(f),(M=B[v+190>>1])&&(d=B[v+172>>1],s=Q[c+80>>3],ZA(r+24|0,v),D=(D*+(d>>>0)/(s>0?s:1e3)-+(M>>>0))/Q[r+24>>3]+400),D=(s=M?D:Q[r+8>>3])!=s?1:s,Q[r+8>>3]=E(D>1?D:1,1e3)),vf(d=r+24|0,f,r+8|0),s=Q[r+40>>3],f=n[r+32>>2],m=n[r+36>>2],M=Ri(n[r+24>>2]),v=Hi(4,4),n[v>>2]=M,n[r+92>>2]=1,n[r+88>>2]=v,n[r+84>>2]=1,re(),e[r+36|0]=0,n[r+32>>2]=77008,n[r+28>>2]=1,n[r+24>>2]=v,n[r+96>>2]=w,n[r+100>>2]=w+g(l,40),fr(v=r+96|0,d)&&(n[r+104>>2]=74232,n[r+96>>2]=0,n[r+100>>2]=1,Sr(r+84|0,v)),v=i+232|0,n[r+104>>2]=n[r+92>>2],d=n[r+88>>2],n[r+96>>2]=n[r+84>>2],n[r+100>>2]=d,1!=n[c+48>>2]|n[c+52>>2]||(G=Q[c+56>>3])>0&&(D=G*+B[M+172>>1],D/=(G=Q[c+80>>3])>0?G:1e3,z=1),x(M=r+24|0,d=n[r+100>>2],y=n[r+104>>2],f,m,s,r+8|0,z,D,1),e[r+52|0]=!Y,re(),U(r+60|0,d,y,M,w,l,c),n[v+8>>2]=n[r+68>>2],f=n[r+64>>2],n[v>>2]=n[r+60>>2],n[v+4>>2]=f,f=n[r+76>>2],n[v+12>>2]=n[r+72>>2],n[v+16>>2]=f,n[v+20>>2]=n[r+80>>2],Ue(r+40|0),ge(r+96|0),N=r+112|0,n[o+8>>2]=n[i+240>>2],r=n[i+236>>2],n[o>>2]=n[i+232>>2],n[o+4>>2]=r,Ae(c),Ge(i+84|0),ge(i+244|0)}else n[o>>2]=-1,n[o+4>>2]=r,$i(W);Xi(i- -64|0),Vi(i+56|0),Xi(i+48|0),Xi(i+40|0),N=i+368|0,ar(k,o),f=n[h+128>>2],n[h+124>>2]?(i=0,k=0,r=1):(k=n[h+132>>2],i=f,f=0,r=0),n[A+12>>2]=r,n[A+8>>2]=f,n[A+4>>2]=k,n[A>>2]=i,N=h+336|0},generate_standard_font:function(A,r,f,i,b,k,o,t,c,v,w,l,E,M,Y){var s,G,D;A|=0,r|=0,f|=0,i|=0,b|=0,k|=0,o|=0,t|=0,c|=0,v|=0,w|=0,l|=0,E=+E,M|=0,Y|=0,N=s=N-192|0,n[s+8>>2]=f,n[s+4>>2]=r,n[s+12>>2]=i,n[s+16>>2]=b,n[s+20>>2]=k,n[s+24>>2]=o,n[s+28>>2]=t,n[s+32>>2]=c,n[s+36>>2]=v,n[s+40>>2]=w,n[s+44>>2]=l,Q[s+48>>3]=E,n[s+56>>2]=M,n[s+60>>2]=Y,r=s+191|0,n[s+184>>2]=r,n[s+180>>2]=r,n[s+176>>2]=s+60,n[s+172>>2]=s+56,n[s+168>>2]=r,n[s+164>>2]=r,n[s+160>>2]=s+48,n[s+156>>2]=s+44,n[s+152>>2]=r,n[s+148>>2]=r,n[s+144>>2]=s+40,n[s+140>>2]=s+36,n[s+136>>2]=r,n[s+132>>2]=r,n[s+128>>2]=s+32,n[s+124>>2]=s+28,n[s+120>>2]=r,n[s+116>>2]=r,n[s+112>>2]=s+24,n[s+108>>2]=s+20,n[s+104>>2]=r,n[s+100>>2]=r,n[s+96>>2]=s+16,n[s+92>>2]=s+12,n[s+88>>2]=r,n[s+84>>2]=r,n[s+80>>2]=s+8,n[s+76>>2]=s+4,b=s- -64|0,N=i=N-384|0,lf(i+40|0,n[n[(r=w=s+76|0)>>2]>>2],n[n[r+4>>2]>>2]),f=n[i+44>>2],n[i+52>>2]=f,k=n[i+40>>2],n[i+48>>2]=k,lf(i+32|0,n[n[r+16>>2]>>2],n[n[r+20>>2]>>2]),t=n[i+36>>2],n[i+60>>2]=t,c=n[i+32>>2],n[i+56>>2]=c,Ef(i+24|0,n[n[r+32>>2]>>2],n[n[r+36>>2]>>2]),v=n[i+28>>2],n[i+68>>2]=v,l=n[i+24>>2],n[i+64>>2]=l,lf(i+16|0,n[n[r+48>>2]>>2],n[n[r+52>>2]>>2]),M=n[i+20>>2],n[i+76>>2]=M,Y=n[i+16>>2],n[i+72>>2]=Y,sf(i+8|0,n[n[r+64>>2]>>2],n[n[r+68>>2]>>2]),o=n[i+12>>2],n[i+84>>2]=o,G=n[i+8>>2],n[i+80>>2]=G,E=Q[n[r+84>>2]>>3],D=n[n[r+80>>2]>>2],Xr(i+88|0,n[n[r+96>>2]>>2],n[n[r+100>>2]>>2]),Zf(i+248|0,G,o);A:{r:{if(1!=u[i+248|0])if(kA(r=i+248|0,o=u[i+249|0]),DA(i,r),1!=n[i>>2]){if(gA(i+248|0,k,f,c,t,l,v,Y,M),f=n[i+252>>2],-1!=(0|(r=n[i+248>>2])))break r}else f=n[i+4>>2];else f=n[i+252>>2];n[b>>2]=-1,n[b+4>>2]=f,$i(i+88|0);break A}k=n[i+256>>2],n[i+108>>2]=k,n[i+104>>2]=f,n[i+100>>2]=r,AA(i+248|0,i+88|0,k),r=n[i+252>>2],-1!=(0|(f=n[i+248>>2]))?(t=n[i+256>>2],Mr(k=i+248|0),Q[i+192>>3]=Q[i+328>>3],Q[i+120>>3]=Q[i+256>>3],c=n[i+252>>2],n[i+112>>2]=n[i+248>>2],n[i+116>>2]=c,Q[i+136>>3]=Q[i+272>>3],c=n[i+268>>2],n[i+128>>2]=n[i+264>>2],n[i+132>>2]=c,a[i+240>>1]=B[i+376>>1],Q[i+152>>3]=Q[i+288>>3],c=n[i+284>>2],n[i+144>>2]=n[i+280>>2],n[i+148>>2]=c,c=n[i+296>>2],v=n[i+300>>2],Q[i+168>>3]=Q[i+304>>3],n[i+160>>2]=c,n[i+164>>2]=v,n[i+176>>2]=!!(0|D),n[i+180>>2]=0,Q[i+184>>3]=E,n[i+228>>2]=f,n[i+232>>2]=r,n[i+236>>2]=t,Q[i+200>>3]=Q[i+336>>3],Q[i+208>>3]=Q[i+344>>3],e[i+242|0]=u[i+378|0],r=n[i+356>>2],n[i+216>>2]=n[i+352>>2],n[i+220>>2]=r,n[i+224>>2]=n[i+360>>2],ye(i+364|0),t=n[i+104>>2],c=n[i+108>>2],N=f=N-128|0,Qi(v=f+40|0,o),l=u[f+40|0],Q[f+16>>3]=Q[f+56>>3],Q[f+8>>3]=Q[f+48>>3],SA(v,o),E=Q[f+56>>3],r=n[f+48>>2],M=n[f+52>>2],Y=Ri(n[f+40>>2]),n[f+52>>2]=74232,n[f+48>>2]=1,n[f+40>>2]=1,n[f+44>>2]=0,o=o-12&255,e[f+56|0]=o>>>0>=3?-1:!o,o=Hi(4,4),n[o>>2]=Y,n[f+108>>2]=1,n[f+104>>2]=o,n[f+100>>2]=1,re(),e[f+124|0]=0,n[f+120>>2]=77008,n[f+116>>2]=1,n[f+112>>2]=o,n[f+28>>2]=t+g(c,40),n[f+24>>2]=t,fr(f+24|0,f+112|0)&&WA(f+100|0,v),o=n[f+108>>2],n[f+32>>2]=o,v=n[f+104>>2],n[f+24>>2]=n[f+100>>2],n[f+28>>2]=v,x(v=f+40|0,Y=n[f+28>>2],o,r,M,E,f+8|0,0,E,255!=(0|l)),re(),U(f+76|0,Y,o,v,t,c,r=i+112|0),n[k+8>>2]=n[f+84>>2],o=n[f+80>>2],n[k>>2]=n[f+76>>2],n[k+4>>2]=o,o=n[f+92>>2],n[k+12>>2]=n[f+88>>2],n[k+16>>2]=o,n[k+20>>2]=n[f+96>>2],Ue(f+56|0),ge(f+24|0),N=f+128|0,n[b+8>>2]=n[i+256>>2],f=n[i+252>>2],n[b>>2]=n[i+248>>2],n[b+4>>2]=f,Ae(r),Ge(i+100|0),ge(i+260|0)):(n[b>>2]=-1,n[b+4>>2]=r,Ge(i+100|0))}Li(i+80|0),Xi(i+72|0),Vi(i- -64|0),Xi(i+56|0),Xi(i+48|0),N=i+384|0,ar(w,b),f=n[s+80>>2],n[s+76>>2]?(i=0,b=0,r=1):(b=n[s+84>>2],i=f,f=0,r=0),n[A+12>>2]=r,n[A+8>>2]=f,n[A+4>>2]=b,n[A>>2]=i,N=s+192|0},has_data:function(A,r){var f,i;return A|=0,r|=0,N=f=N-32|0,n[f+8>>2]=r,n[f+4>>2]=A,A=f+31|0,n[f+24>>2]=A,n[f+20>>2]=A,n[f+16>>2]=f+8,n[f+12>>2]=f+4,N=A=N-16|0,sf(A,n[n[(r=f+12|0)>>2]>>2],n[n[r+4>>2]>>2]),r=n[A+4>>2],n[A+12>>2]=r,i=n[A>>2],n[A+8>>2]=i,r=rr(i,r),Li(A+8|0),N=A+16|0,N=f+32|0,0|r},missing_glyphs:function(A,r,f,i,a,b){A|=0,r|=0,f|=0,i|=0,a|=0,b|=0;var k,o,t=0,c=0,B=0;N=k=N-96|0,n[k+16>>2]=f,n[k+12>>2]=r,n[k+20>>2]=i,n[k+24>>2]=a,n[k+28>>2]=b,r=k+95|0,n[k+88>>2]=r,n[k+84>>2]=r,n[k+80>>2]=r,n[k+76>>2]=k+28,n[k+72>>2]=r,n[k+68>>2]=r,n[k+64>>2]=k+24,n[k+60>>2]=k+20,n[k+56>>2]=r,n[k+52>>2]=r,n[k+48>>2]=k+16,n[k+44>>2]=k+12,i=k+32|0,N=r=N-208|0,lf(r+24|0,n[n[(f=o=k+44|0)>>2]>>2],n[n[f+4>>2]>>2]),a=n[r+28>>2],n[r+36>>2]=a,b=n[r+24>>2],n[r+32>>2]=b,lf(r+16|0,n[n[f+16>>2]>>2],n[n[f+20>>2]>>2]),c=n[r+20>>2],n[r+44>>2]=c,t=n[r+16>>2],n[r+40>>2]=t,B=n[n[f+32>>2]>>2],uA(r+72|0,b,a,t,c),f=n[r+76>>2];A:if(-1!=(0|(a=n[r+72>>2]))){n[r+56>>2]=n[r+80>>2],n[r+52>>2]=f,n[r+48>>2]=a,Vr(r+72|0,B);r:{if(1!=u[r+72|0]){if(b=u[r+73|0],Mr(f=r+72|0),_(a=r+60|0,b,f),DA(r+8|0,a),1!=n[r+8>>2])break r;a=n[r+12>>2],n[i>>2]=-1,n[i+4>>2]=a,Ae(f)}else f=n[r+76>>2],n[i>>2]=-1,n[i+4>>2]=f;We(r+48|0);break A}Ae(c=r+72|0),a=n[r+52>>2],t=n[r+56>>2],N=f=N+-64|0,B=Ce(b),b=Hi(4,4),n[b>>2]=B,n[f+44>>2]=1,n[f+40>>2]=b,n[f+36>>2]=1,re(),e[f+60|0]=0,n[f+56>>2]=77008,n[f+52>>2]=1,n[f+48>>2]=b,b=a+(t<<3)|0,n[f+24>>2]=b,n[f+20>>2]=a,ir(t=f+20|0,f+48|0)&&(n[f+28>>2]=74232,n[f+20>>2]=0,n[f+24>>2]=1,Sr(f+36|0,t)),n[f+16>>2]=n[f+44>>2],t=n[f+40>>2],n[f+8>>2]=n[f+36>>2],n[f+12>>2]=t,t=n[f+16>>2],B=n[f+12>>2],re(),e[f+32|0]=1,n[f+28>>2]=77008,n[f+20>>2]=B,n[f+24>>2]=t,n[f+56>>2]=0,n[f+52>>2]=b,n[f+48>>2]=a,n[f+60>>2]=f+20,HA(c,f+48|0),ge(f+8|0),N=f- -64|0,a=n[r+72>>2],f=n[r+76>>2],n[r+84>>2]=f+(n[r+80>>2]<<2),n[r+80>>2]=a,n[r+76>>2]=f,n[r+72>>2]=f,er(i,c),We(r+48|0)}else n[i>>2]=-1,n[i+4>>2]=f;Xi(r+40|0),Xi(r+32|0),N=r+208|0,nr(o,i),f=n[k+48>>2],n[k+44>>2]?(i=0,a=0,r=1):(a=n[k+52>>2],i=f,f=0,r=0),n[A+12>>2]=r,n[A+8>>2]=f,n[A+4>>2]=a,n[A>>2]=i,N=k+96|0},missing_standard_glyphs:function(A,r,f,i,a,b,k){A|=0,r|=0,f|=0,i|=0,a|=0,b|=0,k|=0;var o,t,c=0,B=0;N=o=N-96|0,n[o+12>>2]=f,n[o+8>>2]=r,n[o+16>>2]=i,n[o+20>>2]=a,n[o+24>>2]=b,n[o+28>>2]=k,r=o+95|0,n[o+88>>2]=r,n[o+84>>2]=r,n[o+80>>2]=o+28,n[o+76>>2]=o+24,n[o+72>>2]=r,n[o+68>>2]=r,n[o+64>>2]=o+20,n[o+60>>2]=o+16,n[o+56>>2]=r,n[o+52>>2]=r,n[o+48>>2]=o+12,n[o+44>>2]=o+8,i=o+32|0,N=r=N-96|0,lf(r+32|0,n[n[(f=k=o+44|0)>>2]>>2],n[n[f+4>>2]>>2]),a=n[r+36>>2],n[r+48>>2]=a,c=n[r+32>>2],n[r+44>>2]=c,lf(r+24|0,n[n[f+16>>2]>>2],n[n[f+20>>2]>>2]),B=n[r+28>>2],n[r+56>>2]=B,t=n[r+24>>2],n[r+52>>2]=t,sf(r+16|0,n[n[f+32>>2]>>2],n[n[f+36>>2]>>2]),f=n[r+20>>2],n[r+64>>2]=f,b=n[r+16>>2],n[r+60>>2]=b,Zf(r+80|0,b,f),1!=u[r+80|0]?(kA(f=r+80|0,b=u[r+81|0]),DA(r+8|0,f),1!=n[r+8>>2]?(uA(r+80|0,c,a,t,B),a=n[r+84>>2],-1!=(0|(f=n[r+80>>2]))?(c=n[r+88>>2],n[r+76>>2]=c,n[r+72>>2]=a,n[r+68>>2]=f,N=f=N-80|0,B=ni(b),n[f+24>>2]=74232,n[f+20>>2]=1,n[f+12>>2]=1,n[f+16>>2]=0,b=b-12&255,e[f+28|0]=b>>>0>=3?-1:!b,b=Hi(4,4),n[b>>2]=B,n[f+56>>2]=1,n[f+52>>2]=b,n[f+48>>2]=1,re(),e[f+76|0]=0,n[f+72>>2]=77008,n[f+68>>2]=1,n[f+64>>2]=b,b=a+(c<<3)|0,n[f+36>>2]=b,n[f+32>>2]=a,ir(f+32|0,f- -64|0)&&WA(f+48|0,f+12|0),n[f+40>>2]=n[f+56>>2],c=n[f+52>>2],n[f+32>>2]=n[f+48>>2],n[f+36>>2]=c,c=n[f+40>>2],B=n[f+36>>2],re(),e[f+60|0]=1,n[f+56>>2]=77008,n[f+48>>2]=B,n[f+52>>2]=c,n[f+72>>2]=0,n[f+68>>2]=b,n[f+64>>2]=a,n[f+76>>2]=f+48,HA(a=r+80|0,f- -64|0),ge(f+32|0),N=f+80|0,b=n[r+80>>2],f=n[r+84>>2],n[r+92>>2]=f+(n[r+88>>2]<<2),n[r+88>>2]=b,n[r+84>>2]=f,n[r+80>>2]=f,er(i,a),We(r+68|0)):(n[i>>2]=-1,n[i+4>>2]=a)):(f=n[r+12>>2],n[i>>2]=-1,n[i+4>>2]=f)):(f=n[r+84>>2],n[i>>2]=-1,n[i+4>>2]=f),Li(r+60|0),Xi(r+52|0),Xi(r+44|0),N=r+96|0,nr(k,i),f=n[o+48>>2],n[o+44>>2]?(i=0,a=0,r=1):(a=n[o+52>>2],i=f,f=0,r=0),n[A+12>>2]=r,n[A+8>>2]=f,n[A+4>>2]=a,n[A>>2]=i,N=o+96|0},set_data:function(A,r,f,i,a){A|=0,r|=0,f|=0,i|=0,a|=0;var b,k,o,t=0,B=0,v=0,Q=0,g=0,w=0,l=0;N=o=N+-64|0,n[o+16>>2]=f,n[o+12>>2]=r,n[o+20>>2]=i,n[o+24>>2]=a,r=o+63|0,n[o+56>>2]=r,n[o+52>>2]=r,n[o+48>>2]=o+24,n[o+44>>2]=o+20,n[o+40>>2]=r,n[o+36>>2]=r,n[o+32>>2]=o+16,n[o+28>>2]=o+12,N=k=N-96|0,sf(k+16|0,n[n[(r=o+28|0)>>2]>>2],n[n[r+4>>2]>>2]),i=n[k+20>>2],n[k+28>>2]=i,f=n[k+16>>2],n[k+24>>2]=f,sf(k+8|0,n[n[r+16>>2]>>2],n[n[r+20>>2]>>2]),r=n[k+8>>2],t=k+32|0,a=n[k+12>>2],n[t+8>>2]=a,n[t+4>>2]=r,n[t>>2]=a,N=b=N-640|0,n[b+20>>2]=i,n[b+16>>2]=f;A:{r:{f:{i:{if(!bi(b+16|0,74460)){n[b+456>>2]=76304,n[b+452>>2]=73776,n[b+448>>2]=74004,n[b+444>>2]=74232,n[b+464>>2]=76304,r=-228;e:{a:{for(;;){if(1596==(0|r))break a;if(f=r+74708|0,r=r+228|0,bi(f,b+16|0))break}a=r+74480|0;break e}for(n[b+460>>2]=0,r=12;;){if(32==(0|(f=r+4|0)))break i;if(a=(b+432|0)+r|0,r=f,bi(a=n[a>>2],b+16|0))break}}if(3==u[a+16|0]){le(t);break r}if(n[b+440>>2]=n[t+8>>2],r=n[t+4>>2],n[b+432>>2]=n[t>>2],n[b+436>>2]=r,cr(b+8|0,t=b+432|0),YA(b+228|0,v=n[b+8>>2],Q=n[b+12>>2]),r=u[b+232|0],-1==(0|(f=n[b+228>>2])))break A;l=a+8|0,Je(b+437|0,b+233|0,199),e[b+436|0]=r,n[b+432>>2]=f;e:{if(3!=u[a+224|0]){if(N=r=N-32|0,3!=u[(f=a+20|0)+204|0]){n[r+16>>2]=f,n[r+12>>2]=t,n[r+20>>2]=r+31,n[r+24>>2]=r+12,B=r+24|0,N=a=N-208|0;a:{n:{b:{k:switch(u[0|(t=f+204|0)]-2|0){case 0:break b;case 1:break a;default:break k}if(e[0|t]=2,B=n[B>>2],f=n[B>>2],n[B>>2]=0,f){if(B=n[B+4>>2],g=n[f>>2],n[f>>2]=-1,-1!=(0|g))break n;Be(69092),c()}Be(68852),c()}yf(67406,113,67348),c()}Je(w=a+8|0,f+4|0,200),n[B>>2]=g,Je(B+4|0,w,200),e[0|t]=3}N=a+208|0}if(N=r+32|0,-1==n[b+432>>2])break e}Je(r=b+24|0,b+432|0,204),-1!=n[b+24>>2]&&(ui(r),We(b+84|0),Cf(b+104|0))}Ff(l,v,Q);break r}if(r=255,3==u[74476])break f;if(n[b+440>>2]=n[t+8>>2],r=n[t+4>>2],n[b+432>>2]=n[t>>2],n[b+436>>2]=r,cr(b,f=b+432|0),j(b+228|0,g=n[b>>2],v=n[b+4>>2]),r=u[b+232|0],-1==(0|(a=n[b+228>>2])))break A;Je(b+437|0,b+233|0,43),e[b+436|0]=r,n[b+432>>2]=a;e:{if(a=3!=u[77056]){if(N=r=N-32|0,a){n[r+16>>2]=77008,n[r+12>>2]=f,n[r+20>>2]=r+31,n[r+24>>2]=r+12,f=r+24|0,N=a=N-48|0;a:{n:{b:switch(u[77056]-2|0){default:if(e[77056]=2,t=n[f>>2],f=n[t>>2],n[t>>2]=0,f){if(t=n[t+4>>2],B=n[f>>2],n[f>>2]=-1,-1!=(0|B))break n;Be(69092),c()}Be(68852),c();case 0:break b;case 1:break a}yf(67406,113,67348),c()}Je(Q=a+4|0,f+4|0,44),n[t>>2]=B,Je(t+4|0,Q,44),e[77056]=3}N=a+48|0}if(N=r+32|0,-1==n[b+432>>2])break e}Je(r=b+228|0,b+432|0,48),-1!=n[b+228>>2]&&(se(r),Ne(b+240|0),ge(b+252|0),ge(b+264|0))}Ff(74468,g,v);break r}r=2}le(t);break A}r=255}N=b+640|0;A:{r:{if(255&~r){e[k+47|0]=r,n[k+72>>2]=0,n[k+64>>2]=0,n[k+68>>2]=1,n[k+80>>2]=72004,n[k+84>>2]=1610612768,n[k+88>>2]=0,n[k+76>>2]=k- -64,r=k+76|0;f:{i:switch(u[k+47|0]-1|0){default:r=ne(r,71852,37);break f;case 0:r=ne(r,71870,69);break f;case 1:break i}r=ne(r,71904,35)}if(r)break r;r=n[k+72>>2],n[k+56>>2]=r,f=n[k+68>>2],n[k+48>>2]=n[k+64>>2],n[k+52>>2]=f,i=0|d(n[k+52>>2],0|r),le(k+48|0),r=1}else r=0;Li(k+24|0),n[o+4>>2]=i,n[o>>2]=r,N=k+96|0;break A}gr(72044,55,k+95|0,72028,72100),c()}r=n[o+4>>2],f=n[o>>2],n[A+4>>2]=f,n[A>>2]=1&f?r:0,N=o- -64|0},standard_font_codepoints:function(A,r,f){A|=0,r|=0,f|=0;var i,e,a=0,b=0,k=0,o=0,t=0,c=0,B=0,v=0,Q=0,g=0,w=0;if(N=i=N-48|0,n[i+12>>2]=f,n[i+8>>2]=r,r=i+47|0,n[i+40>>2]=r,n[i+36>>2]=r,n[i+32>>2]=i+12,n[i+28>>2]=i+8,e=i+16|0,N=r=N-48|0,sf(r+16|0,n[n[(f=c=i+28|0)>>2]>>2],n[n[f+4>>2]>>2]),f=n[r+20>>2],n[r+32>>2]=f,a=n[r+16>>2],n[r+28>>2]=a,Zf(r+36|0,a,f),1!=u[r+36|0])if(kA(f=r+36|0,a=u[r+37|0]),DA(r+8|0,f),1!=n[r+8>>2]){if(f=ni(a),o=(a=n[f+64>>2])+(n[f+68>>2]<<3)|0,N=f=N-32|0,hr(f+8|0,t=o-a>>>3|0,4,4),n[f+28>>2]=0,k=n[f+12>>2],n[f+20>>2]=n[f+8>>2],n[f+24>>2]=k,N=k=N-16|0,di(b=f+20|0,t),B=n[b+8>>2],v=n[b+4>>2],n[k+4>>2]=b+8,g=k,w=xe(v,B),n[g+8>>2]=w,n[k+12>>2]=C,b=n[(B=k+4|0)+4>>2],v=n[B>>2],(0|a)!=(0|o))for(o=n[B+8>>2]+(b<<2)|0,b=b+t|0;n[o>>2]=n[a>>2],a=a+8|0,o=o+4|0,t=t-1|0;);n[v>>2]=b,N=k+16|0,n[e+8>>2]=n[f+28>>2],a=n[f+24>>2],n[e>>2]=n[f+20>>2],n[e+4>>2]=a,N=f+32|0}else f=n[r+12>>2],n[e>>2]=-1,n[e+4>>2]=f;else f=n[r+40>>2],n[e>>2]=-1,n[e+4>>2]=f;Li(r+28|0),N=r+48|0,nr(c,e),f=n[i+32>>2],n[i+28>>2]?(r=0,c=1):(Q=n[i+36>>2],r=f,f=0,c=0),n[A+12>>2]=c,n[A+8>>2]=f,n[A+4>>2]=Q,n[A>>2]=r,N=i+48|0},standard_font_data_files:function(A,r,f){A|=0,r|=0,f|=0;var i,e,a,b=0,k=0;N=i=N-48|0,n[i+12>>2]=f,n[i+8>>2]=r,r=i+47|0,n[i+40>>2]=r,n[i+36>>2]=r,n[i+32>>2]=i+12,n[i+28>>2]=i+8,f=i+16|0,N=r=N-48|0,sf(r,n[n[(b=e=i+28|0)>>2]>>2],n[n[b+4>>2]>>2]),b=n[r+4>>2],n[r+16>>2]=b,a=n[r>>2],n[r+12>>2]=a,Zf(r+32|0,a,b),1!=u[r+32|0]?(kA(r+20|0,u[r+33|0]),n[r+40>>2]=n[r+20>>2],b=n[r+24>>2],n[r+36>>2]=b,n[r+32>>2]=b,n[r+44>>2]=b+(n[r+28>>2]<<3),Er(f,r+32|0)):(b=n[r+36>>2],n[f>>2]=-1,n[f+4>>2]=b),Li(r+12|0),N=r+48|0,Ar(e,f),f=n[i+32>>2],n[i+28>>2]?(r=0,b=1):(k=n[i+36>>2],r=f,f=0,b=0),n[A+12>>2]=b,n[A+8>>2]=f,n[A+4>>2]=k,n[A>>2]=r,N=i+48|0},__abort_handler:{get value(){return m},set value(A){m=A}},__instance_terminated:{get value(){return y},set value(A){y=A}},__wbindgen_add_to_stack_pointer:function(A){return 0|(N=N+(A|=0)|0)},__wbindgen_free:function(A,r,f){A|=0,(r|=0)&&Qr(A,r)},__wbindgen_malloc:function(A,r){if(A|=0,!(1!=(0|He(r|=0))|-2147483648-r>>>0>>0)&&(!A||(r=pi(A,r))))return 0|r;c()},__wbindgen_realloc:function(A,r,f,i){if(A|=0,r|=0,f|=0,!(1!=(0|He(i|=0))|-2147483648-i>>>0>>0)&&(A=T(A,r,i,f)))return 0|A;c()}}}export default function B(A){return u(A)} \ No newline at end of file diff --git a/external/hellbox/unicode.bin b/external/hellbox/unicode.bin new file mode 100644 index 000000000..62f08634d Binary files /dev/null and b/external/hellbox/unicode.bin differ diff --git a/external/standard_fonts/FoxitDingbats.pfb b/external/standard_fonts/FoxitDingbats.pfb deleted file mode 100644 index 30d52963e..000000000 Binary files a/external/standard_fonts/FoxitDingbats.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitFixed.pfb b/external/standard_fonts/FoxitFixed.pfb deleted file mode 100644 index f12dcbce5..000000000 Binary files a/external/standard_fonts/FoxitFixed.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitFixedBold.pfb b/external/standard_fonts/FoxitFixedBold.pfb deleted file mode 100644 index cf8e24aee..000000000 Binary files a/external/standard_fonts/FoxitFixedBold.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitFixedBoldItalic.pfb b/external/standard_fonts/FoxitFixedBoldItalic.pfb deleted file mode 100644 index d2880017c..000000000 Binary files a/external/standard_fonts/FoxitFixedBoldItalic.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitFixedItalic.pfb b/external/standard_fonts/FoxitFixedItalic.pfb deleted file mode 100644 index d71697d4b..000000000 Binary files a/external/standard_fonts/FoxitFixedItalic.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitSerif.pfb b/external/standard_fonts/FoxitSerif.pfb deleted file mode 100644 index 3fa682efb..000000000 Binary files a/external/standard_fonts/FoxitSerif.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitSerifBold.pfb b/external/standard_fonts/FoxitSerifBold.pfb deleted file mode 100644 index ff7c6ddec..000000000 Binary files a/external/standard_fonts/FoxitSerifBold.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitSerifBoldItalic.pfb b/external/standard_fonts/FoxitSerifBoldItalic.pfb deleted file mode 100644 index 460231fb8..000000000 Binary files a/external/standard_fonts/FoxitSerifBoldItalic.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitSerifItalic.pfb b/external/standard_fonts/FoxitSerifItalic.pfb deleted file mode 100644 index d03a7c781..000000000 Binary files a/external/standard_fonts/FoxitSerifItalic.pfb and /dev/null differ diff --git a/external/standard_fonts/FoxitSymbol.pfb b/external/standard_fonts/FoxitSymbol.pfb deleted file mode 100644 index c8f9bca78..000000000 Binary files a/external/standard_fonts/FoxitSymbol.pfb and /dev/null differ diff --git a/external/standard_fonts/LICENSE_FOXIT b/external/standard_fonts/LICENSE_FOXIT deleted file mode 100644 index 8b4ed6ddd..000000000 --- a/external/standard_fonts/LICENSE_FOXIT +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/external/standard_fonts/LICENSE_LIBERATION b/external/standard_fonts/LICENSE_LIBERATION deleted file mode 100644 index 213c18265..000000000 --- a/external/standard_fonts/LICENSE_LIBERATION +++ /dev/null @@ -1,363 +0,0 @@ -LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY -LIBERATION FONT SOFTWARE - -This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement. - - 1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions: - - (a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. - - (b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it. - - 2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software. - - 3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation. - - 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages. - - 5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply. -Copyright © 2007-2011 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc. - ------------------------------------------------------------------------------- - -The text of the GNU General Public License, version 2, referenced above: - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - 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 -this service 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. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE 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. - - 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 -convey 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 General Public License as published by - the Free Software Foundation; either version 2 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/external/standard_fonts/LiberationSans-Bold.ttf b/external/standard_fonts/LiberationSans-Bold.ttf deleted file mode 100644 index ee2371540..000000000 Binary files a/external/standard_fonts/LiberationSans-Bold.ttf and /dev/null differ diff --git a/external/standard_fonts/LiberationSans-BoldItalic.ttf b/external/standard_fonts/LiberationSans-BoldItalic.ttf deleted file mode 100644 index 42b5717dd..000000000 Binary files a/external/standard_fonts/LiberationSans-BoldItalic.ttf and /dev/null differ diff --git a/external/standard_fonts/LiberationSans-Italic.ttf b/external/standard_fonts/LiberationSans-Italic.ttf deleted file mode 100644 index 0cf612634..000000000 Binary files a/external/standard_fonts/LiberationSans-Italic.ttf and /dev/null differ diff --git a/external/standard_fonts/LiberationSans-Regular.ttf b/external/standard_fonts/LiberationSans-Regular.ttf deleted file mode 100644 index 366d1489c..000000000 Binary files a/external/standard_fonts/LiberationSans-Regular.ttf and /dev/null differ diff --git a/external/standard_fonts/README.md b/external/standard_fonts/README.md deleted file mode 100644 index 7ee4ce37d..000000000 --- a/external/standard_fonts/README.md +++ /dev/null @@ -1,31 +0,0 @@ -## Foxit fonts - -The pfb files in this directory were extracted from Pdfium - -Original copyright notice: - -``` -Copyright 2014 PDFium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. - -Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -``` - -See `LICENSE_FOXIT`. - -## Liberation fonts - -The `LiberationSans-*.ttf` files are the unmodified upstream release of -Liberation Sans **1.07.4**, which is licensed under the GNU General Public -License v2 with the Liberation font exception (see `LICENSE_LIBERATION`, a copy -of the `License.txt` and `COPYING` files shipped with that release): -https://fedoraproject.org/wiki/Licensing:LiberationFontLicense - -Note that Liberation 2.0 and later are licensed under the SIL Open Font License -1.1 instead, so `LICENSE_LIBERATION` must be updated as well whenever these font -files are replaced. - -The glyph order of these files is baked into `src/core/liberationsans_widths.js` -and into the per-glyph scale factors in `src/core/*_factors.js`, so those files -need to be regenerated when the fonts are updated. diff --git a/gulpfile.mjs b/gulpfile.mjs index bf47227db..466de538b 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -747,12 +747,13 @@ function createICCBundle() { function createStandardFontBundle() { return gulp.src( [ - "external/standard_fonts/*.pfb", - "external/standard_fonts/*.ttf", - "external/standard_fonts/LICENSE_*", + "external/hellbox/*.hbgd", + "external/hellbox/unicode.bin", + "external/hellbox/LICENSE_*", + "!external/hellbox/LICENSE_HELLBOX", ], { - base: "external/standard_fonts", + base: "external/hellbox", encoding: false, } ); @@ -762,6 +763,7 @@ function createWasmBundle({ includeQuickJS = true } = {}) { const modules = [ ["openjpeg", ["*.wasm", "openjpeg_nowasm_fallback.js", "LICENSE_*"]], ["qcms", ["*.wasm", "LICENSE_*"]], + ["hellbox", ["*.wasm", "hellbox_nowasm_fallback.js", "LICENSE_HELLBOX"]], ["jbig2", ["*.wasm", "jbig2_nowasm_fallback.js", "LICENSE_*"]], ]; if (includeQuickJS) { @@ -1781,12 +1783,13 @@ async function buildMozcentral(changedFiles = null) { create: createICCBundle, }, { - files: /^external\/standard_fonts\//, + files: + /^external\/hellbox\/(?:.*\.hbgd|unicode\.bin|LICENSE_(?!HELLBOX))/, dest: MOZCENTRAL_WEB_DIR + "/standard_fonts", create: createStandardFontBundle, }, { - files: /^external\/(jbig2|openjpeg|qcms)\//, + files: /^external\/(hellbox|jbig2|openjpeg|qcms)\//, dest: MOZCENTRAL_WEB_DIR + "/wasm", create: () => createWasmBundle({ includeQuickJS: false }), }, @@ -2079,11 +2082,11 @@ function watchMozcentral(done) { "!web/wasm/**", // Generated by the `dev-wasm` task. "l10n/en-US/*.ftl", "external/bcmaps/*", + "external/hellbox/*", "external/iccs/*", "external/jbig2/*", "external/openjpeg/*", "external/qcms/*", - "external/standard_fonts/*", "LICENSE", ]; @@ -2402,7 +2405,7 @@ function buildLib(defines, dir) { encoding: false, sourcemaps: enableSourceMaps, }), - ...["openjpeg", "qcms", "jbig2", "brotli"].map(name => + ...["openjpeg", "qcms", "hellbox", "jbig2", "brotli"].map(name => gulp.src(`external/${name}/*.js`, { base: `${name}/`, encoding: false, @@ -3168,6 +3171,7 @@ gulp.task( function watchWasm() { gulp.watch( [ + "external/hellbox/*", "external/openjpeg/*", "external/qcms/*", "external/jbig2/*", diff --git a/src/core/catalog.js b/src/core/catalog.js index 4b64c9bb0..0fee02369 100644 --- a/src/core/catalog.js +++ b/src/core/catalog.js @@ -144,8 +144,6 @@ class Catalog { pageKidsCountCache = new RefMap(); - standardFontDataCache = new Map(); - systemFontCache = new Map(); constructor(pdfManager, xref) { @@ -1290,7 +1288,6 @@ class Catalog { } this.fontCache.clear(); this.builtInCMapCache.clear(); - this.standardFontDataCache.clear(); this.systemFontCache.clear(); } diff --git a/src/core/cff_font.js b/src/core/cff_font.js index fc4854d04..fec4fa113 100644 --- a/src/core/cff_font.js +++ b/src/core/cff_font.js @@ -102,10 +102,7 @@ class CFFFont { return charCodeToGlyphId; } - let encoding = cff.encoding ? cff.encoding.encoding : null; - if (properties.isInternalFont) { - encoding = properties.defaultEncoding; - } + const encoding = cff.encoding ? cff.encoding.encoding : null; return type1FontGlyphMapping(properties, encoding, charsets); } diff --git a/src/core/document.js b/src/core/document.js index 79fb31c47..3a6e412d6 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -95,7 +95,6 @@ class Page { globalIdFactory, fontCache, builtInCMapCache, - standardFontDataCache, globalColorSpaceCache, globalImageCache, systemFontCache, @@ -109,7 +108,6 @@ class Page { this.ref = ref; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; - this.standardFontDataCache = standardFontDataCache; this.globalColorSpaceCache = globalColorSpaceCache; this.globalImageCache = globalImageCache; this.systemFontCache = systemFontCache; @@ -146,7 +144,6 @@ class Page { idFactory: this._localIdFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, - standardFontDataCache: this.standardFontDataCache, globalColorSpaceCache: this.globalColorSpaceCache, globalImageCache: this.globalImageCache, systemFontCache: this.systemFontCache, @@ -1076,7 +1073,6 @@ class PDFDocument { globalIdFactory: this._globalIdFactory, fontCache: catalog.fontCache, builtInCMapCache: catalog.builtInCMapCache, - standardFontDataCache: catalog.standardFontDataCache, globalColorSpaceCache: catalog.globalColorSpaceCache, globalImageCache: catalog.globalImageCache, systemFontCache: catalog.systemFontCache, @@ -1390,7 +1386,7 @@ class PDFDocument { this.pdfManager.evaluatorOptions, { useSystemFonts: false } ); - const { builtInCMapCache, fontCache, standardFontDataCache } = this.catalog; + const { builtInCMapCache, fontCache } = this.catalog; const partialEvaluator = new PartialEvaluator({ xref: this.xref, @@ -1399,7 +1395,6 @@ class PDFDocument { idFactory: this._globalIdFactory, fontCache, builtInCMapCache, - standardFontDataCache, options, }); const operatorList = new OperatorList(); diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 27522fdae..177952f0a 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -57,7 +57,6 @@ import { ZapfDingbatsEncoding, } from "./encodings.js"; import { - getFontNameToFileMap, getSerifFonts, getStandardFontName, getStdFontMap, @@ -87,6 +86,7 @@ import { getFontSubstitution } from "./font_substitutions.js"; import { getGlyphsUnicode } from "./glyphlist.js"; import { getMetrics } from "./metrics.js"; import { getUnicodeForGlyph } from "./unicode.js"; +import { Hellbox } from "./hellbox.js"; import { MurmurHash3_64 } from "../shared/murmurhash3.js"; import { PDFImage } from "./image.js"; import { Stream } from "./stream.js"; @@ -233,7 +233,6 @@ class PartialEvaluator { idFactory, fontCache, builtInCMapCache, - standardFontDataCache, globalColorSpaceCache, globalImageCache, systemFontCache, @@ -246,7 +245,6 @@ class PartialEvaluator { this.idFactory = idFactory; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; - this.standardFontDataCache = standardFontDataCache; this.globalColorSpaceCache = globalColorSpaceCache; this.globalImageCache = globalImageCache; this.systemFontCache = systemFontCache; @@ -427,52 +425,6 @@ class PartialEvaluator { return data; } - async fetchStandardFontData(name) { - const cachedData = this.standardFontDataCache.get(name); - if (cachedData) { - return new Stream(cachedData); - } - - // The symbol fonts are not consistent across platforms, always load the - // standard font data for them. - if ( - this.options.useSystemFonts && - name !== "Symbol" && - name !== "ZapfDingbats" - ) { - return null; - } - - const standardFontNameToFileName = getFontNameToFileMap(), - filename = standardFontNameToFileName[name]; - let data; - - try { - if (this.options.useWorkerFetch) { - data = await fetchBinaryData( - `${this.options.standardFontDataUrl}${filename}` - ); - } else { - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - throw new Error("Only worker-thread fetching supported."); - } - // Get the data on the main-thread instead. - data = await this.handler.sendWithPromise("FetchBinaryData", { - kind: "standardFontDataUrl", - filename, - }); - } - } catch (ex) { - warn(ex); - return null; - } - // Cache the "raw" standard font data, to avoid fetching it repeatedly - // (see e.g. issue 11399). - this.standardFontDataCache.set(name, data); - - return new Stream(data); - } - async buildFormXObject( resources, xobj, @@ -1093,7 +1045,7 @@ class PartialEvaluator { const font = state.font; const glyphs = font.charsToGlyphs(chars); - if (font.data) { + if (font.data && !font.missingFile) { const isAddToPathSet = !!( state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG ); @@ -3736,7 +3688,7 @@ class PartialEvaluator { } } - const nonEmbeddedFont = !properties.file || properties.isInternalFont, + const nonEmbeddedFont = !properties.file, isSymbolsFontName = getSymbolsFonts()[properties.name]; // Ignore an incorrectly specified named encoding for non-embedded // symbol fonts (fixes issue16464.pdf). @@ -4558,19 +4510,12 @@ class PartialEvaluator { }; const widths = dict.get("Widths"); - const standardFontName = getStandardFontName(baseFontName); - let file = null; - if (standardFontName) { - file = await this.fetchStandardFontData(standardFontName); - properties.isInternalFont = !!file; - } - if (!properties.isInternalFont && this.options.useSystemFonts) { + if (this.options.useSystemFonts) { properties.systemFontInfo = getFontSubstitution( this.systemFontCache, this.idFactory, - this.options.standardFontDataUrl, baseFontName, - standardFontName, + getStandardFontName(baseFontName), type ); } @@ -4596,7 +4541,9 @@ class PartialEvaluator { newProperties ); } - return new Font(baseFontName, file, newProperties, this.options); + const font = new Font(baseFontName, null, newProperties, this.options); + await Hellbox.generate(this, font); + return font; } } @@ -4681,8 +4628,6 @@ class PartialEvaluator { warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`); fontFile = null; } - let isInternalFont = false; - let glyphScaleFactors = null; let systemFontInfo = null; if (fontFile) { if (fontFile.dict) { @@ -4696,37 +4641,29 @@ class PartialEvaluator { } } else if (cssFontInfo) { // We've a missing XFA font. - const standardFontName = getXfaFontName(fontName.name); - if (standardFontName) { + const xfaFont = getXfaFontName(fontName.name); + if (xfaFont) { cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; - cssFontInfo.metrics = standardFontName.metrics || null; - glyphScaleFactors = standardFontName.factors || null; - fontFile = await this.fetchStandardFontData(standardFontName.name); - isInternalFont = !!fontFile; - - // We're using a substitution font but for example widths (if any) - // are related to the glyph positions in the font. - // So we overwrite everything here to be sure that widths are - // correct. + cssFontInfo.metrics = xfaFont.metrics || null; baseDict = dict = getXfaFontDict(fontName.name); composite = true; - } - } else if (!isType3Font) { - const standardFontName = getStandardFontName(fontName.name); - if (standardFontName) { - fontFile = await this.fetchStandardFontData(standardFontName); - isInternalFont = !!fontFile; - } - if (!isInternalFont && this.options.useSystemFonts) { - systemFontInfo = getFontSubstitution( - this.systemFontCache, - this.idFactory, - this.options.standardFontDataUrl, - fontName.name, - standardFontName, - type + const data = await Hellbox.generateXfaFont( + this, + xfaFont.name, + dict.get("W") ); + if (data) { + fontFile = new Stream(data); + } } + } else if (!isType3Font && this.options.useSystemFonts) { + systemFontInfo = getFontSubstitution( + this.systemFontCache, + this.idFactory, + fontName.name, + getStandardFontName(fontName.name), + type + ); } const fontMatrix = lookupMatrix( @@ -4771,7 +4708,6 @@ class PartialEvaluator { length1, length2, length3, - isInternalFont, loadedName: baseDict.loadedName, composite, fixedPitch: false, @@ -4788,7 +4724,6 @@ class PartialEvaluator { italicAngle, isType3Font, cssFontInfo, - scaleFactors: glyphScaleFactors, systemFontInfo, }; @@ -4824,7 +4759,6 @@ class PartialEvaluator { const substitution = getFontSubstitution( this.systemFontCache, this.idFactory, - this.options.standardFontDataUrl, fontName.name, standardFontName, type @@ -4837,6 +4771,7 @@ class PartialEvaluator { font.systemFontInfo = substitution; } } + await Hellbox.generate(this, font); return font; } @@ -4911,7 +4846,7 @@ class TranslatedFont { } fallback(handler, evaluatorOptions) { - if (!this.font.data) { + if (!this.font.data || this.font.missingFile) { return; } // When font loading failed, fall back to the built-in font renderer. diff --git a/src/core/font_substitutions.js b/src/core/font_substitutions.js index e95606a56..768ca1b1a 100644 --- a/src/core/font_substitutions.js +++ b/src/core/font_substitutions.js @@ -111,7 +111,6 @@ const substitutionMap = new Map([ "Apple Symbols", "Cantarell", ], - path: "LiberationSans-Regular.ttf", style: NORMAL, ultimate: "sans-serif", }, @@ -120,7 +119,6 @@ const substitutionMap = new Map([ "Helvetica-Bold", { alias: "Helvetica", - path: "LiberationSans-Bold.ttf", style: BOLD, ultimate: "sans-serif", }, @@ -129,7 +127,6 @@ const substitutionMap = new Map([ "Helvetica-Oblique", { alias: "Helvetica", - path: "LiberationSans-Italic.ttf", style: ITALIC, ultimate: "sans-serif", }, @@ -138,7 +135,6 @@ const substitutionMap = new Map([ "Helvetica-BoldOblique", { alias: "Helvetica", - path: "LiberationSans-BoldItalic.ttf", style: BOLDITALIC, ultimate: "sans-serif", }, @@ -627,25 +623,19 @@ function getFamilyName(str) { * @param {string} [substitution.alias] - Key of another substitution to * inherit the src values from. * @param {Array} [substitution.local] - Local font names. - * @param {string} [substitution.path] - Font file name, relative to - * `localFontPath`. * @param {string} [substitution.fallback] - Key of the substitution to take * the ultimate font from. * @param {object} [substitution.style] - CSS `font-style` and `font-weight`. * @param {string} [substitution.ultimate] - Ultimate (generic) font family. - * @param {Array} src - Contains src values (local(...) or url(...)). - * @param {string} localFontPath - Path to local fonts. + * @param {Array} src - Local font sources. * @param {boolean} useFallback - Whether to use fallback font. - * @param {boolean} usePath - Whether to use path to font. * @param {string} append - Style (Bold, Italic, ...) to append to font name. * @returns {object} The resolved `style` and `ultimate` values. */ function generateFont( - { alias, local, path, fallback, style, ultimate }, + { alias, local, fallback, style, ultimate }, src, - localFontPath, useFallback = true, - usePath = true, append = "" ) { const result = { @@ -666,9 +656,7 @@ function generateFont( generateFont( substitution, src, - localFontPath, /* useFallback = */ useFallback && !fallback, - /* usePath = */ usePath && !path, aliasAppend ) ); @@ -684,16 +672,11 @@ function generateFont( const { ultimate: fallbackUltimate } = generateFont( fallbackInfo, src, - localFontPath, useFallback, - /* usePath = */ usePath && !path, append ); result.ultimate ||= fallbackUltimate; } - if (usePath && path && localFontPath) { - src.push(`url(${localFontPath}${path})`); - } return result; } @@ -704,15 +687,13 @@ function generateFont( * rule like this: * { * font-family: 'Times'; - * src: local('Times New Roman'), local('Subst1'), local('Subst2'), - * url(.../TimesNewRoman.ttf) + * src: local('Times New Roman'), local('Subst1'), local('Subst2'); * font-weight: normal; * font-style: normal; * } * or use the FontFace API. * @param {Map} systemFontCache The cache of local fonts. * @param {object} idFactory The ids factory. - * @param {string} localFontPath Path to the fonts directory. * @param {string} baseFontName The font name to be substituted. * @param {string | undefined} standardFontName The standard font name to use * if the base font is not available. @@ -723,7 +704,6 @@ function generateFont( function getFontSubstitution( systemFontCache, idFactory, - localFontPath, baseFontName, standardFontName, type @@ -805,7 +785,7 @@ function getFontSubstitution( if (mustAddBaseFont && validateFontName(baseFontName)) { src.push(`local(${baseFontName})`); } - const { style, ultimate } = generateFont(substitution, src, localFontPath); + const { style, ultimate } = generateFont(substitution, src); const guessFallback = ultimate === null; const fallback = guessFallback ? "" : `,${ultimate}`; diff --git a/src/core/fonts.js b/src/core/fonts.js index 8f3f327ac..0f4d69b8b 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -58,7 +58,6 @@ import { getSupplementalGlyphMapForCalibri, getSupplementalGlyphMapForTrebuchetMS, } from "./standard_fonts.js"; -import { GlyfTable, pruneCompositeGlyphCycles } from "./glyf.js"; import { IdentityToUnicodeMap, ToUnicodeMap } from "./to_unicode_map.js"; import { CFFFont } from "./cff_font.js"; import { CharCodeMap } from "./char_code_map.js"; @@ -69,6 +68,7 @@ import { getFontBasicMetrics } from "./metrics.js"; import { getLookupTableFactory } from "./core_utils.js"; import { MathClamp } from "../shared/math_clamp.js"; import { OpenTypeFileBuilder } from "./opentype_file_builder.js"; +import { pruneCompositeGlyphCycles } from "./glyf.js"; import { Stream } from "./stream.js"; import { Type1Font } from "./type1_font.js"; @@ -93,6 +93,7 @@ const EXPORT_DATA_PROPERTIES = [ "fallbackName", "fontExtraProperties", "fontMatrix", + "generatedFontName", "isInvalidPDFjsFont", "isType3Font", "italic", @@ -140,9 +141,6 @@ function adjustWidths(properties) { } function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) { - if (properties.isInternalFont) { - return; - } if (properties.hasIncludedToUnicodeMap) { return; // The font dictionary has a `ToUnicode` entry. } @@ -187,9 +185,6 @@ function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) { } function adjustType1ToUnicode(properties, builtInEncoding) { - if (properties.isInternalFont) { - return; - } if (properties.hasIncludedToUnicodeMap) { return; // The font dictionary has a `ToUnicode` entry. } @@ -1051,8 +1046,17 @@ class Font { #glyphCache = new Map(); + #generatedCodePoints = null; + + #id = null; + + // Unlike `missingFile`, still set when a generated font replaces this one. + #withoutFile = false; + charProcOperatorList; + standardFontName = null; + toFontChar = new Map(); constructor(name, file, properties, evaluatorOptions) { @@ -1061,7 +1065,7 @@ class Font { this.disableFontFace = evaluatorOptions.disableFontFace; this.fontExtraProperties = evaluatorOptions.fontExtraProperties; - this.loadedName = properties.loadedName; + this.loadedName = this.#id = properties.loadedName; this.isType3Font = properties.isType3Font; this.missingFile = false; this.cssFontInfo = properties.cssFontInfo; @@ -1247,7 +1251,7 @@ class Font { } fallbackToSystemFont(properties) { - this.missingFile = true; + this.missingFile = this.#withoutFile = true; // The file data is not specified. Trying to fix the font name // to be used with the canvas.font. const { name, type } = this; @@ -1260,6 +1264,9 @@ class Font { ); fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; + if (isStandardFont || isMappedToStandardFont) { + this.standardFontName = stdFontMap[fontName]; + } const fontBasicMetricsMap = getFontBasicMetrics(); const metrics = fontBasicMetricsMap[fontName]; @@ -1418,6 +1425,89 @@ class Font { this.loadedName = fontName.split("-", 1)[0]; } + /** + * @param {boolean} distinctWidths - Keep widths, or mark conflicts as NaN. + * @returns {Array<{codePoint: number, width: number, + * charCodes: Array}>} + */ + getMissingFileGlyphs(distinctWidths) { + const charCodes = new Set(this.toFontChar.keys()); + const isIdentity = + this.composite && this.cidEncoding.startsWith("Identity-"); + if (!this.composite || isIdentity) { + for (const charCode of Object.keys(this.widths || {})) { + charCodes.add(+charCode); + } + } + if (isIdentity) { + const glyphsUnicode = getGlyphsUnicode(); + for (const encoding of [ + StandardEncoding, + WinAnsiEncoding, + MacRomanEncoding, + ]) { + for (const glyphName of encoding) { + const codePoint = glyphsUnicode[glyphName]; + if (codePoint !== undefined) { + // Added last, after the font's own char codes. + charCodes.add(codePoint); + } + } + } + } + const glyphs = new Map(); + for (const charCode of charCodes) { + const { fontChar, width } = this._charToGlyph(charCode); + const codePoint = fontChar.codePointAt(0); + if (codePoint === undefined) { + continue; + } + const key = distinctWidths ? `${codePoint}_${width}` : codePoint; + let glyph = glyphs.get(key); + if (!glyph) { + glyph = { codePoint, width, charCodes: [] }; + glyphs.set(key, glyph); + } else if (!distinctWidths && !Object.is(glyph.width, width)) { + glyph.width = NaN; + } + glyph.charCodes.push(charCode); + } + return Array.from(glyphs.values()); + } + + /** + * @param {object} generated + * @param {Uint8Array} generated.data + * @param {Uint32Array} generated.codePoints - Cmap code points. + * @param {Map} generated.toFontChar - PDF character codes + * mapped to private-use code points. + * @param {boolean} replacesFont - Use as the primary font, or as a fallback. + */ + setGeneratedFont({ data, codePoints, toFontChar }, replacesFont) { + const name = `${this.#id}_generated`; + this.data = data; + this.generatedFontName = name; + this.#generatedCodePoints = new Set(codePoints); + for (const [charCode, fontCharCode] of toFontChar) { + this.toFontChar.set(charCode, fontCharCode); + } + this.#glyphCache.clear(); + if (replacesFont) { + this.systemFontInfo = null; + this.loadedName = name; + this.missingFile = false; + this.remeasure = false; + return; + } + // Copy the shared substitution info; insert before the generic families. + const families = this.systemFontInfo.css.split(","); + families.splice(2, 0, `"${name}"`); + this.systemFontInfo = { + ...this.systemFontInfo, + css: families.join(","), + }; + } + checkAndRepair(name, font, properties) { const VALID_TABLES = [ "OS/2", @@ -2849,7 +2939,7 @@ class Font { writeUint32(tables.maxp.data, 0, version); } - let isGlyphLocationsLong = int16( + const isGlyphLocationsLong = int16( tables.head.data[50], tables.head.data[51] ); @@ -2877,41 +2967,6 @@ class Font { } } - if (properties.scaleFactors?.length === numGlyphs && isTrueType) { - const { scaleFactors } = properties; - const glyphs = new GlyfTable({ - glyfTable: tables.glyf.data, - isGlyphLocationsLong, - locaTable: tables.loca.data, - numGlyphs, - }); - glyphs.scale(scaleFactors); - - const { glyf, loca, isLocationLong } = glyphs.write(); - tables.glyf.data = glyf; - tables.loca.data = loca; - - if (isLocationLong !== !!isGlyphLocationsLong) { - tables.head.data[50] = 0; - isGlyphLocationsLong = tables.head.data[51] = isLocationLong ? 1 : 0; - } - - const metrics = tables.hmtx.data; - - for (let i = 0; i < numGlyphs; i++) { - const j = 4 * i; - const advanceWidth = Math.round( - scaleFactors[i] * int16(metrics[j], metrics[j + 1]) - ); - metrics[j] = (advanceWidth >> 8) & 0xff; - metrics[j + 1] = advanceWidth & 0xff; - const lsb = Math.round( - scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]) - ); - writeSignedInt16(metrics, j + 2, lsb); - } - } - // Glyph 0 is duplicated and appended. let numGlyphsOut = numGlyphs + 1; let dupFirstEntry = true; @@ -3214,14 +3269,8 @@ class Font { // in a symbol font) and the page content draws it with the char code 0, // so map it explicitly when it would otherwise be left unmapped, but // only when the glyph is non-empty to avoid displaying a ".notdef" box - // for fonts that don't (issue 17333). This is restricted to embedded - // fonts since the ".notdef" glyph of a standard substitution font must - // never be rendered. - if ( - !properties.isInternalFont && - !charCodeToGlyphId.has(0) && - hasGlyph(0) - ) { + // for fonts that don't (issue 17333). + if (!charCodeToGlyphId.has(0) && hasGlyph(0)) { charCodeToGlyphId.set(0, 0); } } @@ -3610,7 +3659,7 @@ class Font { // First try the toFontChar map, if it's not there then try falling // back to the char code. fontCharCode = this.toFontChar.get(charcode) || charcode; - if (this.missingFile) { + if (this.#withoutFile) { const glyphName = this.differences.get(charcode) || this.defaultEncoding[charcode]; if ( @@ -3657,10 +3706,13 @@ class Font { warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); } } + if (this.#generatedCodePoints?.has(fontChar.codePointAt(0))) { + isInFont = true; + } let isRotated = false; if ( - this.missingFile && + this.#withoutFile && this.vertical && fontChar.length === 1 && this.#hasVerticalVariant(charcode) diff --git a/src/core/fonts_utils.js b/src/core/fonts_utils.js index 6824fa752..64ca75601 100644 --- a/src/core/fonts_utils.js +++ b/src/core/fonts_utils.js @@ -121,9 +121,7 @@ function buildMapping(baseEncoding, glyphNames) { function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { let charCodeToGlyphId, glyphsUnicodeMap; - if (properties.isInternalFont) { - charCodeToGlyphId = buildMapping(builtInEncoding, glyphNames); - } else if (properties.baseEncodingName) { + if (properties.baseEncodingName) { // If a valid base encoding name was used, the mapping is initialized with // that. charCodeToGlyphId = buildMapping( diff --git a/src/core/glyf.js b/src/core/glyf.js index 98add9ef8..5d9687023 100644 --- a/src/core/glyf.js +++ b/src/core/glyf.js @@ -15,16 +15,8 @@ import { makeSet } from "../shared/util.js"; -const ON_CURVE_POINT = 1 << 0; -const X_SHORT_VECTOR = 1 << 1; -const Y_SHORT_VECTOR = 1 << 2; -const REPEAT_FLAG = 1 << 3; -const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; -const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; -const OVERLAP_SIMPLE = 1 << 6; - const ARG_1_AND_2_ARE_WORDS = 1 << 0; -const ARGS_ARE_XY_VALUES = 1 << 1; +// const ARGS_ARE_XY_VALUES = 1 << 1; // const ROUND_XY_TO_GRID = 1 << 2; const WE_HAVE_A_SCALE = 1 << 3; const MORE_COMPONENTS = 1 << 5; @@ -38,660 +30,6 @@ const WE_HAVE_INSTRUCTIONS = 1 << 8; const GLYPH_HEADER_SIZE = 10; -/** - * GlyfTable object represents a glyf table containing glyph information: - * - glyph header (xMin, yMin, xMax, yMax); - * - contours if any; - * - components if the glyph is a composite. - * - * It's possible to re-scale each glyph in order to have a new font which - * exactly fits an other one: the goal is to be able to build some substitution - * font for well-known fonts (Myriad, Arial, ...). - * - * A full description of glyf table can be found here - * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html - */ -class GlyfTable { - constructor({ glyfTable, isGlyphLocationsLong, locaTable, numGlyphs }) { - this.glyphs = []; - const loca = new DataView( - locaTable.buffer, - locaTable.byteOffset, - locaTable.byteLength - ); - const glyf = new DataView( - glyfTable.buffer, - glyfTable.byteOffset, - glyfTable.byteLength - ); - const offsetSize = isGlyphLocationsLong ? 4 : 2; - let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); - let pos = 0; - for (let i = 0; i < numGlyphs; i++) { - pos += offsetSize; - const next = isGlyphLocationsLong - ? loca.getUint32(pos) - : 2 * loca.getUint16(pos); - if (next === prev) { - this.glyphs.push(new Glyph({})); - continue; - } - - const glyph = Glyph.parse(prev, glyf); - this.glyphs.push(glyph); - - prev = next; - } - } - - getSize() { - return Math.sumPrecise( - // Round to next multiple of 4 if needed. - this.glyphs.map(g => (g.getSize() + 3) & ~3) - ); - } - - write() { - const totalSize = this.getSize(); - const glyfTable = new DataView(new ArrayBuffer(totalSize)); - const isLocationLong = totalSize > /* 0xffff * 2 */ 0x1fffe; - const offsetSize = isLocationLong ? 4 : 2; - const locaTable = new DataView( - new ArrayBuffer((this.glyphs.length + 1) * offsetSize) - ); - - if (isLocationLong) { - locaTable.setUint32(0, 0); - } else { - locaTable.setUint16(0, 0); - } - - let pos = 0; - let locaIndex = 0; - for (const glyph of this.glyphs) { - pos += glyph.write(pos, glyfTable); - // Round to next multiple of 4 if needed. - pos = (pos + 3) & ~3; - - locaIndex += offsetSize; - if (isLocationLong) { - locaTable.setUint32(locaIndex, pos); - } else { - locaTable.setUint16(locaIndex, pos >> 1); - } - } - - return { - isLocationLong, - loca: new Uint8Array(locaTable.buffer), - glyf: new Uint8Array(glyfTable.buffer), - }; - } - - scale(factors) { - for (let i = 0, ii = this.glyphs.length; i < ii; i++) { - this.glyphs[i].scale(factors[i]); - } - } -} - -class Glyph { - constructor({ header = null, simple = null, composites = null }) { - this.header = header; - this.simple = simple; - this.composites = composites; - } - - static parse(pos, glyf) { - const [read, header] = GlyphHeader.parse(pos, glyf); - pos += read; - - if (header.numberOfContours < 0) { - // Composite glyph. - const composites = []; - while (true) { - const [n, composite] = CompositeGlyph.parse(pos, glyf); - pos += n; - composites.push(composite); - if (!(composite.flags & MORE_COMPONENTS)) { - break; - } - } - - return new Glyph({ header, composites }); - } - - const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); - - return new Glyph({ header, simple }); - } - - getSize() { - if (!this.header) { - return 0; - } - const size = this.simple - ? this.simple.getSize() - : Math.sumPrecise(this.composites.map(c => c.getSize())); - return this.header.getSize() + size; - } - - write(pos, buf) { - if (!this.header) { - return 0; - } - - const spos = pos; - pos += this.header.write(pos, buf); - if (this.simple) { - pos += this.simple.write(pos, buf); - } else { - for (const composite of this.composites) { - pos += composite.write(pos, buf); - } - } - - return pos - spos; - } - - scale(factor) { - if (!this.header) { - return; - } - - const xMiddle = (this.header.xMin + this.header.xMax) / 2; - this.header.scale(xMiddle, factor); - if (this.simple) { - this.simple.scale(xMiddle, factor); - } else { - for (const composite of this.composites) { - composite.scale(xMiddle, factor); - } - } - } -} - -class GlyphHeader { - constructor({ numberOfContours, xMin, yMin, xMax, yMax }) { - this.numberOfContours = numberOfContours; - this.xMin = xMin; - this.yMin = yMin; - this.xMax = xMax; - this.yMax = yMax; - } - - static parse(pos, glyf) { - return [ - GLYPH_HEADER_SIZE, - new GlyphHeader({ - numberOfContours: glyf.getInt16(pos), - xMin: glyf.getInt16(pos + 2), - yMin: glyf.getInt16(pos + 4), - xMax: glyf.getInt16(pos + 6), - yMax: glyf.getInt16(pos + 8), - }), - ]; - } - - getSize() { - return GLYPH_HEADER_SIZE; - } - - write(pos, buf) { - buf.setInt16(pos, this.numberOfContours); - buf.setInt16(pos + 2, this.xMin); - buf.setInt16(pos + 4, this.yMin); - buf.setInt16(pos + 6, this.xMax); - buf.setInt16(pos + 8, this.yMax); - - return GLYPH_HEADER_SIZE; - } - - scale(x, factor) { - this.xMin = Math.round(x + (this.xMin - x) * factor); - this.xMax = Math.round(x + (this.xMax - x) * factor); - } -} - -class Contour { - constructor({ flags, xCoordinates, yCoordinates }) { - this.xCoordinates = xCoordinates; - this.yCoordinates = yCoordinates; - this.flags = flags; - } -} - -class SimpleGlyph { - constructor({ contours, instructions }) { - this.contours = contours; - this.instructions = instructions; - } - - static parse(pos, glyf, numberOfContours) { - const endPtsOfContours = []; - for (let i = 0; i < numberOfContours; i++) { - const endPt = glyf.getUint16(pos); - pos += 2; - endPtsOfContours.push(endPt); - } - const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; - const instructionLength = glyf.getUint16(pos); - pos += 2; - const instructions = new Uint8Array(glyf).slice( - pos, - pos + instructionLength - ); - pos += instructionLength; - - const flags = []; - for (let i = 0; i < numberOfPt; pos++, i++) { - let flag = glyf.getUint8(pos); - flags.push(flag); - if (flag & REPEAT_FLAG) { - const count = glyf.getUint8(++pos); - flag ^= REPEAT_FLAG; - for (let m = 0; m < count; m++) { - flags.push(flag); - } - i += count; - } - } - - const allXCoordinates = []; - let xCoordinates = []; - let yCoordinates = []; - let pointFlags = []; - const contours = []; - let endPtsOfContoursIndex = 0; - let lastCoordinate = 0; - - // Get x coordinates. - for (let i = 0; i < numberOfPt; i++) { - const flag = flags[i]; - if (flag & X_SHORT_VECTOR) { - // 8-bits unsigned value. - const x = glyf.getUint8(pos++); - lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; - xCoordinates.push(lastCoordinate); - } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { - // IS_SAME. - xCoordinates.push(lastCoordinate); - } else { - lastCoordinate += glyf.getInt16(pos); - pos += 2; - xCoordinates.push(lastCoordinate); - } - - if (endPtsOfContours[endPtsOfContoursIndex] === i) { - // Next entry is the first one of a new contour. - endPtsOfContoursIndex++; - allXCoordinates.push(xCoordinates); - xCoordinates = []; - } - } - - lastCoordinate = 0; - endPtsOfContoursIndex = 0; - for (let i = 0; i < numberOfPt; i++) { - const flag = flags[i]; - if (flag & Y_SHORT_VECTOR) { - // 8-bits unsigned value. - const y = glyf.getUint8(pos++); - lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; - yCoordinates.push(lastCoordinate); - } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { - // IS_SAME. - yCoordinates.push(lastCoordinate); - } else { - lastCoordinate += glyf.getInt16(pos); - pos += 2; - yCoordinates.push(lastCoordinate); - } - - pointFlags.push((flag & ON_CURVE_POINT) | (flag & OVERLAP_SIMPLE)); - - if (endPtsOfContours[endPtsOfContoursIndex] === i) { - // Next entry is the first one of a new contour. - xCoordinates = allXCoordinates[endPtsOfContoursIndex]; - endPtsOfContoursIndex++; - contours.push( - new Contour({ - flags: pointFlags, - xCoordinates, - yCoordinates, - }) - ); - yCoordinates = []; - pointFlags = []; - } - } - - return new SimpleGlyph({ - contours, - instructions, - }); - } - - getSize() { - let size = this.contours.length * 2 + 2 + this.instructions.length; - let lastX = 0; - let lastY = 0; - for (const contour of this.contours) { - size += contour.flags.length; - for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { - const x = contour.xCoordinates[i]; - const y = contour.yCoordinates[i]; - let abs = Math.abs(x - lastX); - if (abs > 255) { - size += 2; - } else if (abs > 0) { - size += 1; - } - lastX = x; - - abs = Math.abs(y - lastY); - if (abs > 255) { - size += 2; - } else if (abs > 0) { - size += 1; - } - lastY = y; - } - } - return size; - } - - write(pos, buf) { - const spos = pos; - const xCoordinates = []; - const yCoordinates = []; - const flags = []; - let lastX = 0; - let lastY = 0; - - for (const contour of this.contours) { - for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { - let flag = contour.flags[i]; - const x = contour.xCoordinates[i]; - let delta = x - lastX; - if (delta === 0) { - flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; - xCoordinates.push(0); - } else { - const abs = Math.abs(delta); - if (abs <= 255) { - flag |= - delta >= 0 - ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR - : X_SHORT_VECTOR; - xCoordinates.push(abs); - } else { - xCoordinates.push(delta); - } - } - lastX = x; - - const y = contour.yCoordinates[i]; - delta = y - lastY; - if (delta === 0) { - flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; - yCoordinates.push(0); - } else { - const abs = Math.abs(delta); - if (abs <= 255) { - flag |= - delta >= 0 - ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR - : Y_SHORT_VECTOR; - yCoordinates.push(abs); - } else { - yCoordinates.push(delta); - } - } - lastY = y; - - flags.push(flag); - } - - // Write endPtsOfContours entry. - buf.setUint16(pos, xCoordinates.length - 1); - pos += 2; - } - - // Write instructionLength. - buf.setUint16(pos, this.instructions.length); - pos += 2; - if (this.instructions.length) { - // Write instructions. - new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set( - this.instructions, - pos - ); - pos += this.instructions.length; - } - - // Write flags. - for (const flag of flags) { - buf.setUint8(pos++, flag); - } - - // Write xCoordinates. - for (let i = 0, ii = xCoordinates.length; i < ii; i++) { - const x = xCoordinates[i]; - const flag = flags[i]; - if (flag & X_SHORT_VECTOR) { - buf.setUint8(pos++, x); - } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { - buf.setInt16(pos, x); - pos += 2; - } - } - - // Write yCoordinates. - for (let i = 0, ii = yCoordinates.length; i < ii; i++) { - const y = yCoordinates[i]; - const flag = flags[i]; - if (flag & Y_SHORT_VECTOR) { - buf.setUint8(pos++, y); - } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { - buf.setInt16(pos, y); - pos += 2; - } - } - - return pos - spos; - } - - scale(x, factor) { - for (const contour of this.contours) { - if (contour.xCoordinates.length === 0) { - continue; - } - - for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { - contour.xCoordinates[i] = Math.round( - x + (contour.xCoordinates[i] - x) * factor - ); - } - } - } -} - -class CompositeGlyph { - constructor({ - flags, - glyphIndex, - argument1, - argument2, - transf, - instructions, - }) { - this.flags = flags; - this.glyphIndex = glyphIndex; - this.argument1 = argument1; - this.argument2 = argument2; - this.transf = transf; - this.instructions = instructions; - } - - static parse(pos, glyf) { - const spos = pos; - const transf = []; - let flags = glyf.getUint16(pos); - const glyphIndex = glyf.getUint16(pos + 2); - pos += 4; - - let argument1, argument2; - if (flags & ARG_1_AND_2_ARE_WORDS) { - if (flags & ARGS_ARE_XY_VALUES) { - argument1 = glyf.getInt16(pos); - argument2 = glyf.getInt16(pos + 2); - } else { - argument1 = glyf.getUint16(pos); - argument2 = glyf.getUint16(pos + 2); - } - pos += 4; - flags ^= ARG_1_AND_2_ARE_WORDS; - } else { - if (flags & ARGS_ARE_XY_VALUES) { - argument1 = glyf.getInt8(pos); - argument2 = glyf.getInt8(pos + 1); - } else { - argument1 = glyf.getUint8(pos); - argument2 = glyf.getUint8(pos + 1); - } - pos += 2; - } - - if (flags & WE_HAVE_A_SCALE) { - // Single F2.14. - transf.push(glyf.getUint16(pos)); - pos += 2; - } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { - // Two F2.14. - transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); - pos += 4; - } else if (flags & WE_HAVE_A_TWO_BY_TWO) { - // Four F2.14. - transf.push( - glyf.getUint16(pos), - glyf.getUint16(pos + 2), - glyf.getUint16(pos + 4), - glyf.getUint16(pos + 6) - ); - pos += 8; - } - - let instructions = null; - if (flags & WE_HAVE_INSTRUCTIONS) { - const instructionLength = glyf.getUint16(pos); - pos += 2; - instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); - pos += instructionLength; - } - - return [ - pos - spos, - new CompositeGlyph({ - flags, - glyphIndex, - argument1, - argument2, - transf, - instructions, - }), - ]; - } - - getSize() { - let size = 2 + 2 + this.transf.length * 2; - if (this.flags & WE_HAVE_INSTRUCTIONS) { - size += 2 + this.instructions.length; - } - - size += 2; - if (this.flags & 2) { - // Arguments are signed. - if (!( - this.argument1 >= -128 && - this.argument1 <= 127 && - this.argument2 >= -128 && - this.argument2 <= 127 - )) { - size += 2; - } - } else if (!( - this.argument1 >= 0 && - this.argument1 <= 255 && - this.argument2 >= 0 && - this.argument2 <= 255 - )) { - size += 2; - } - - return size; - } - - write(pos, buf) { - const spos = pos; - - if (this.flags & ARGS_ARE_XY_VALUES) { - // Arguments are signed. - if (!( - this.argument1 >= -128 && - this.argument1 <= 127 && - this.argument2 >= -128 && - this.argument2 <= 127 - )) { - this.flags |= ARG_1_AND_2_ARE_WORDS; - } - } else if (!( - this.argument1 >= 0 && - this.argument1 <= 255 && - this.argument2 >= 0 && - this.argument2 <= 255 - )) { - this.flags |= ARG_1_AND_2_ARE_WORDS; - } - - buf.setUint16(pos, this.flags); - buf.setUint16(pos + 2, this.glyphIndex); - pos += 4; - - if (this.flags & ARG_1_AND_2_ARE_WORDS) { - if (this.flags & ARGS_ARE_XY_VALUES) { - buf.setInt16(pos, this.argument1); - buf.setInt16(pos + 2, this.argument2); - } else { - buf.setUint16(pos, this.argument1); - buf.setUint16(pos + 2, this.argument2); - } - pos += 4; - } else { - buf.setUint8(pos, this.argument1); - buf.setUint8(pos + 1, this.argument2); - pos += 2; - } - - if (this.flags & WE_HAVE_INSTRUCTIONS) { - buf.setUint16(pos, this.instructions.length); - pos += 2; - // Write instructions. - if (this.instructions.length) { - new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set( - this.instructions, - pos - ); - pos += this.instructions.length; - } - } - - return pos - spos; - } - - scale(x, factor) {} -} - function pruneCompositeGlyphCycles(glyfTable, locaEntries, numGlyphs) { const glyf = new DataView( glyfTable.buffer, @@ -798,4 +136,4 @@ function pruneCompositeGlyphCycles(glyfTable, locaEntries, numGlyphs) { return droppedGlyphs; } -export { GlyfTable, pruneCompositeGlyphCycles }; +export { pruneCompositeGlyphCycles }; diff --git a/src/core/hellbox.js b/src/core/hellbox.js new file mode 100644 index 000000000..4f2b5303b --- /dev/null +++ b/src/core/hellbox.js @@ -0,0 +1,223 @@ +/* Copyright 2026 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + font_data_files as fontDataFiles, + generate_font as generateFont, + generate_standard_font as generateStandardFont, + has_data as hasData, + initJs, + missing_glyphs as missingGlyphs, + missing_standard_glyphs as missingStandardGlyphs, + set_data as setData, + standard_font_codepoints as standardFontCodePoints, + standard_font_data_files as standardFontDataFiles, +} from "../../external/hellbox/hellbox.js"; +import { makeMap, warn } from "../shared/util.js"; +import { WasmLoader } from "./wasm_loader.js"; + +const FAMILIES = new Map([ + ["Courier", 2], + ["Helvetica", 0], + ["Times", 1], +]); + +// Hellbox's request limit; it also keeps the PUA codes in plane 15. +const MAX_GLYPHS = 65534; + +const PRIVATE_USE_START = 0xf0000; + +/** + * Generates substitutes for non-embedded standard and XFA fonts. + */ +class Hellbox { + static #isLoaded = false; + + static #loadPromises = new WeakMap(); + + static #pendingData = new WeakMap(); + + /** + * @param {object} context - Document handler and evaluator options. + * @returns {Promise} Whether the generator is available. + */ + static async #load(context) { + const { standardFontDataUrl, useWorkerFetch, wasmUrl } = context.options; + if (useWorkerFetch && (!wasmUrl || !standardFontDataUrl)) { + return false; + } + return ( + this.#isLoaded || + this.#loadPromises.getOrInsertComputed(context.handler, () => + WasmLoader.load( + context, + "hellbox_bg.wasm", + "hellbox_nowasm_fallback.js", + instantiate => { + initJs(instantiate); + this.#isLoaded = true; + } + ) + ) + ); + } + + /** + * Load missing glyph data. + * @param {object} context + * @param {Array} files + */ + static #loadData(context, files) { + const pending = this.#pendingData.getOrInsertComputed( + context.handler, + makeMap + ); + return Promise.all( + files.map(file => { + if (hasData(file)) { + return null; + } + return pending.getOrInsertComputed(file, () => + WasmLoader.fetch(context, "standardFontDataUrl", file) + .then(data => { + if (!hasData(file)) { + setData(file, data); + } + }) + .finally(() => pending.delete(file)) + ); + }) + ); + } + + /** + * Generate a replacement or fallback for a non-embedded standard font. + * @param {object} context - Document handler and evaluator options. + * @param {Font} font + */ + static async generate(context, font) { + const { standardFontName } = font; + if (!standardFontName || font.vertical || font.cssFontInfo) { + return; + } + const replacesFont = + !font.systemFontInfo || + standardFontName === "Symbol" || + standardFontName === "ZapfDingbats"; + if (context.options.disableFontFace && !replacesFont) { + return; + } + if (!(await this.#load(context))) { + return; + } + const weight = font.black ? 900 : 0; + const family = weight + ? FAMILIES.get(standardFontName.split("-", 1)[0]) + : undefined; + const italic = /Oblique|Italic/.test(standardFontName); + const glyphs = font.getMissingFileGlyphs(replacesFont); + const codePoints = Uint32Array.from(glyphs, glyph => glyph.codePoint); + const lengths = new Uint32Array(codePoints.length).fill(1); + try { + const files = + family === undefined + ? standardFontDataFiles(standardFontName) + : [ + ...fontDataFiles(family, false, false, 0, 0, 0), + ...fontDataFiles(family, false, italic, weight, 0, 0), + ]; + await this.#loadData(context, files); + const missing = new Set( + family === undefined + ? missingStandardGlyphs(codePoints, lengths, standardFontName) + : missingGlyphs(codePoints, lengths, family) + ); + const available = glyphs + .filter((_, i) => !missing.has(i)) + .slice(0, MAX_GLYPHS); + if (available.length === 0) { + return; + } + const toFontChar = new Map(); + const mappedCodePoints = new Set(); + let privateUseCode = PRIVATE_USE_START; + const fontCharCodes = Uint32Array.from( + available, + ({ codePoint, charCodes }) => { + if (!mappedCodePoints.has(codePoint)) { + mappedCodePoints.add(codePoint); + return codePoint; + } + for (const charCode of charCodes) { + toFontChar.set(charCode, privateUseCode); + } + return privateUseCode++; + } + ); + const args = [ + Uint32Array.from(available, glyph => glyph.codePoint), + lengths.subarray(0, available.length), + Float64Array.from(available, glyph => glyph.width ?? NaN), + fontCharCodes, + ]; + const data = + family === undefined + ? generateStandardFont(...args, standardFontName) + : generateFont(...args, family, false, italic, weight, 0, 0, 0); + font.setGeneratedFont( + { data, codePoints: fontCharCodes, toFontChar }, + replacesFont + ); + } catch (ex) { + warn(`Hellbox.generate - "${font.name}": "${ex}".`); + } + } + + /** + * Generate an XFA substitute with Unicode-based widths. + * @param {object} context - Document handler and evaluator options. + * @param {string} standardFontName + * @param {Array} widths - Unicode-based PDF `W` array. + * @returns {Promise} + */ + static async generateXfaFont(context, standardFontName, widths) { + if (!(await this.#load(context))) { + return null; + } + try { + await this.#loadData(context, standardFontDataFiles(standardFontName)); + const widthByCodePoint = new Map(); + for (let i = 0, ii = widths.length - 1; i < ii; i += 2) { + const start = widths[i]; + for (const [j, width] of widths[i + 1].entries()) { + widthByCodePoint.set(start + j, width); + } + } + const codePoints = standardFontCodePoints(standardFontName); + return generateStandardFont( + codePoints, + new Uint32Array(codePoints.length).fill(1), + Float64Array.from(codePoints, cp => widthByCodePoint.get(cp) ?? NaN), + new Uint32Array(0), + standardFontName + ); + } catch (ex) { + warn(`Hellbox.generateXfaFont - "${standardFontName}": "${ex}".`); + return null; + } + } +} + +export { Hellbox }; diff --git a/src/core/standard_fonts.js b/src/core/standard_fonts.js index 5bfed7464..62617e7ed 100644 --- a/src/core/standard_fonts.js +++ b/src/core/standard_fonts.js @@ -99,28 +99,6 @@ const getStdFontMap = getLookupTableFactory(function (t) { t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; }); -// Contains mapping for standard fonts and xfa fonts. -const getFontNameToFileMap = getLookupTableFactory(function (t) { - t.Courier = "FoxitFixed.pfb"; - t["Courier-Bold"] = "FoxitFixedBold.pfb"; - t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; - t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; - t.Helvetica = "LiberationSans-Regular.ttf"; - t["Helvetica-Bold"] = "LiberationSans-Bold.ttf"; - t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf"; - t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf"; - t["Times-Roman"] = "FoxitSerif.pfb"; - t["Times-Bold"] = "FoxitSerifBold.pfb"; - t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; - t["Times-Italic"] = "FoxitSerifItalic.pfb"; - t.Symbol = "FoxitSymbol.pfb"; - t.ZapfDingbats = "FoxitDingbats.pfb"; - t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; - t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; - t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; - t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; -}); - /** * Holds the map of the non-standard fonts that might be included as * a standard fonts without glyph data. @@ -1077,7 +1055,6 @@ function isKnownFontName(name) { } export { - getFontNameToFileMap, getGlyphMapForMacOrderedFonts, getGlyphMapForStandardFonts, getNonStdFontMap, diff --git a/src/core/unicode.js b/src/core/unicode.js index 325af83e0..bee57f81f 100644 --- a/src/core/unicode.js +++ b/src/core/unicode.js @@ -25,8 +25,10 @@ const getSpecialPUASymbols = getLookupTableFactory(function (t) { t[63194] = 0x00ae; // registerserif (0xF6DA) => registered t[63722] = 0x2122; // trademarksans (0xF8EA) => trademark t[63195] = 0x2122; // trademarkserif (0xF6DB) => trademark + t[63717] = 0x203e; // radicalex (0xF8E5) => overline t[63718] = 0x23d0; // arrowvertex (0xF8E6) t[63719] = 0x23af; // arrowhorizex (0xF8E7) + t[63732] = 0x23aa; // braceex (0xF8F4) t[63733] = 0x23ae; // integralex (0xF8F5) t[63729] = 0x23a7; // bracelefttp (0xF8F1) t[63730] = 0x23a8; // braceleftmid (0xF8F2) diff --git a/src/core/xfa_fonts.js b/src/core/xfa_fonts.js index 7f58a99f7..05aaf358d 100644 --- a/src/core/xfa_fonts.js +++ b/src/core/xfa_fonts.js @@ -69,14 +69,14 @@ import { normalizeFontName } from "./fonts_utils.js"; const getXFAFontMap = getLookupTableFactory(function (t) { t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { - name: "LiberationSans-Regular", + name: "Helvetica", factors: MyriadProRegularFactors, baseWidths: LiberationSansRegularWidths, baseMapping: LiberationSansRegularMapping, metrics: MyriadProRegularMetrics, }; t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { - name: "LiberationSans-Bold", + name: "Helvetica-Bold", factors: MyriadProBoldFactors, baseWidths: LiberationSansBoldWidths, baseMapping: LiberationSansBoldMapping, @@ -86,7 +86,7 @@ const getXFAFontMap = getLookupTableFactory(function (t) { t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { - name: "LiberationSans-Italic", + name: "Helvetica-Oblique", factors: MyriadProItalicFactors, baseWidths: LiberationSansItalicWidths, baseMapping: LiberationSansItalicMapping, @@ -96,7 +96,7 @@ const getXFAFontMap = getLookupTableFactory(function (t) { t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { - name: "LiberationSans-BoldItalic", + name: "Helvetica-BoldOblique", factors: MyriadProBoldItalicFactors, baseWidths: LiberationSansBoldItalicWidths, baseMapping: LiberationSansBoldItalicMapping, @@ -106,104 +106,104 @@ const getXFAFontMap = getLookupTableFactory(function (t) { t.Arial = t["Arial-Regular"] = { - name: "LiberationSans-Regular", + name: "Helvetica", baseWidths: LiberationSansRegularWidths, baseMapping: LiberationSansRegularMapping, }; t["Arial-BoldMT"] = t["Arial-Bold"] = { - name: "LiberationSans-Bold", + name: "Helvetica-Bold", baseWidths: LiberationSansBoldWidths, baseMapping: LiberationSansBoldMapping, }; t["Arial-ItalicMT"] = t["Arial-Italic"] = { - name: "LiberationSans-Italic", + name: "Helvetica-Oblique", baseWidths: LiberationSansItalicWidths, baseMapping: LiberationSansItalicMapping, }; t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { - name: "LiberationSans-BoldItalic", + name: "Helvetica-BoldOblique", baseWidths: LiberationSansBoldItalicWidths, baseMapping: LiberationSansBoldItalicMapping, }; t["Calibri-Regular"] = { - name: "LiberationSans-Regular", + name: "Helvetica", factors: CalibriRegularFactors, baseWidths: LiberationSansRegularWidths, baseMapping: LiberationSansRegularMapping, metrics: CalibriRegularMetrics, }; t["Calibri-Bold"] = { - name: "LiberationSans-Bold", + name: "Helvetica-Bold", factors: CalibriBoldFactors, baseWidths: LiberationSansBoldWidths, baseMapping: LiberationSansBoldMapping, metrics: CalibriBoldMetrics, }; t["Calibri-Italic"] = { - name: "LiberationSans-Italic", + name: "Helvetica-Oblique", factors: CalibriItalicFactors, baseWidths: LiberationSansItalicWidths, baseMapping: LiberationSansItalicMapping, metrics: CalibriItalicMetrics, }; t["Calibri-BoldItalic"] = { - name: "LiberationSans-BoldItalic", + name: "Helvetica-BoldOblique", factors: CalibriBoldItalicFactors, baseWidths: LiberationSansBoldItalicWidths, baseMapping: LiberationSansBoldItalicMapping, metrics: CalibriBoldItalicMetrics, }; t["Segoeui-Regular"] = { - name: "LiberationSans-Regular", + name: "Helvetica", factors: SegoeuiRegularFactors, baseWidths: LiberationSansRegularWidths, baseMapping: LiberationSansRegularMapping, metrics: SegoeuiRegularMetrics, }; t["Segoeui-Bold"] = { - name: "LiberationSans-Bold", + name: "Helvetica-Bold", factors: SegoeuiBoldFactors, baseWidths: LiberationSansBoldWidths, baseMapping: LiberationSansBoldMapping, metrics: SegoeuiBoldMetrics, }; t["Segoeui-Italic"] = { - name: "LiberationSans-Italic", + name: "Helvetica-Oblique", factors: SegoeuiItalicFactors, baseWidths: LiberationSansItalicWidths, baseMapping: LiberationSansItalicMapping, metrics: SegoeuiItalicMetrics, }; t["Segoeui-BoldItalic"] = { - name: "LiberationSans-BoldItalic", + name: "Helvetica-BoldOblique", factors: SegoeuiBoldItalicFactors, baseWidths: LiberationSansBoldItalicWidths, baseMapping: LiberationSansBoldItalicMapping, metrics: SegoeuiBoldItalicMetrics, }; t["Helvetica-Regular"] = t.Helvetica = { - name: "LiberationSans-Regular", + name: "Helvetica", factors: HelveticaRegularFactors, baseWidths: LiberationSansRegularWidths, baseMapping: LiberationSansRegularMapping, metrics: HelveticaRegularMetrics, }; t["Helvetica-Bold"] = { - name: "LiberationSans-Bold", + name: "Helvetica-Bold", factors: HelveticaBoldFactors, baseWidths: LiberationSansBoldWidths, baseMapping: LiberationSansBoldMapping, metrics: HelveticaBoldMetrics, }; t["Helvetica-Italic"] = { - name: "LiberationSans-Italic", + name: "Helvetica-Oblique", factors: HelveticaItalicFactors, baseWidths: LiberationSansItalicWidths, baseMapping: LiberationSansItalicMapping, metrics: HelveticaItalicMetrics, }; t["Helvetica-BoldItalic"] = { - name: "LiberationSans-BoldItalic", + name: "Helvetica-BoldOblique", factors: HelveticaBoldItalicFactors, baseWidths: LiberationSansBoldItalicWidths, baseMapping: LiberationSansBoldItalicMapping, diff --git a/src/display/font_loader.js b/src/display/font_loader.js index bd29eab02..794702e86 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -163,32 +163,46 @@ class FontLoader { ); } + async #loadFontFace(font) { + if (!this.isFontLoadingAPISupported) { + return; + } + const fontFace = font.createNativeFontFace(); + if (!fontFace) { + return; + } + this.addNativeFontFace(fontFace); + try { + await fontFace.loaded; + } catch (ex) { + warn(`Failed to load font '${fontFace.family}': '${ex}'.`); + this.removeNativeFontFace(fontFace); + if (!font.missingFile) { + // Use paths when an embedded or replacement font fails to load. + font.disableFontFace = true; + throw ex; + } + } + } + async bind(font) { // Add the font to the DOM only once; skip if the font is already loaded. - if (font.attached || (font.missingFile && !font.systemFontInfo)) { + if ( + font.attached || + (font.missingFile && !font.systemFontInfo && !font.generatedFontName) + ) { return; } font.attached = true; if (font.systemFontInfo) { - await this.loadSystemFont(font); + // A generated font can be the fallback of the system font. + await Promise.all([this.loadSystemFont(font), this.#loadFontFace(font)]); return; } if (this.isFontLoadingAPISupported) { - const nativeFontFace = font.createNativeFontFace(); - if (nativeFontFace) { - this.addNativeFontFace(nativeFontFace); - try { - await nativeFontFace.loaded; - } catch (ex) { - warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`); - - // When font loading failed, fall back to the built-in font renderer. - font.disableFontFace = true; - throw ex; - } - } + await this.#loadFontFace(font); return; // The font was, asynchronously, loaded. } @@ -422,29 +436,41 @@ class FontFaceObject { } } + #getFontFaceProperties() { + const { generatedFontName } = this; + let family = generatedFontName || this.loadedName; + const css = Object.create(null); + if (generatedFontName) { + // Match CanvasGraphics.setFont; these outlines already include the style. + css.style = this.italic ? "italic" : "normal"; + css.weight = "normal"; + if (this.black) { + css.weight = "900"; + } else if (this.bold) { + css.weight = "bold"; + } + } else if (this.cssFontInfo) { + family = serializeFontFamily(this.cssFontInfo.fontFamily); + css.weight = this.cssFontInfo.fontWeight; + if (this.cssFontInfo.italicAngle) { + css.style = `oblique ${this.cssFontInfo.italicAngle}deg`; + } + } + + return { family, css }; + } + createNativeFontFace() { const { data } = this; // Get `data` just once, since it's not shadowed. if (!data || this.disableFontFace) { return null; } - let nativeFontFace; - if (!this.cssFontInfo) { - nativeFontFace = new FontFace(this.loadedName, data, {}); - } else { - const css = { - weight: this.cssFontInfo.fontWeight, - }; - if (this.cssFontInfo.italicAngle) { - css.style = `oblique ${this.cssFontInfo.italicAngle}deg`; - } - nativeFontFace = new FontFace( - serializeFontFamily(this.cssFontInfo.fontFamily), - data, - css - ); - } + const { family, css } = this.#getFontFaceProperties(); + const nativeFontFace = new FontFace(family, data, css); - this._inspectFont?.(this); + if (!this.generatedFontName) { + this._inspectFont?.(this); + } return nativeFontFace; } @@ -459,21 +485,18 @@ class FontFaceObject { } // Add the @font-face rule to the document. const url = `url(data:${this.mimetype};base64,${data.toBase64()});`; - let rule; - if (!this.cssFontInfo) { - rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`; - } else { - let css = `font-weight: ${this.cssFontInfo.fontWeight};`; - if (this.cssFontInfo.italicAngle) { - css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`; - } - // The font family originates from the PDF document, hence it must be - // serialized as a to prevent arbitrary rule injection. - const fontFamily = serializeFontFamily(this.cssFontInfo.fontFamily); - rule = `@font-face {font-family:${fontFamily};${css}src:${url}}`; + const { family, css } = this.#getFontFaceProperties(); + // The font family can originate from the PDF document, hence it must be + // serialized as a to prevent arbitrary rule injection. + let rule = `@font-face {font-family:${serializeFontFamily(family)};`; + for (const [property, value] of Object.entries(css)) { + rule += `font-${property}: ${value};`; } + rule += `src:${url}}`; - this._inspectFont?.(this, url); + if (!this.generatedFontName) { + this._inspectFont?.(this, url); + } return rule; } @@ -556,6 +579,10 @@ class FontFaceObject { return this.#fontData.fallbackName; } + get generatedFontName() { + return this.#fontData.generatedFontName; + } + get loadedName() { return this.#fontData.loadedName; } diff --git a/src/display/obj_bin_transform_display.js b/src/display/obj_bin_transform_display.js index 781ba38b6..b6cb24233 100644 --- a/src/display/obj_bin_transform_display.js +++ b/src/display/obj_bin_transform_display.js @@ -217,8 +217,12 @@ class FontInfo { return shadow(this, "fallbackName", this.#readString(0)); } + get generatedFontName() { + return shadow(this, "generatedFontName", this.#readString(1)); + } + get loadedName() { - return shadow(this, "loadedName", this.#readString(1)); + return shadow(this, "loadedName", this.#readString(2)); } #getBufferOffset(index) { diff --git a/src/shared/obj_bin_transform_utils.js b/src/shared/obj_bin_transform_utils.js index a3081c2f3..4dccc4fa4 100644 --- a/src/shared/obj_bin_transform_utils.js +++ b/src/shared/obj_bin_transform_utils.js @@ -37,7 +37,7 @@ class FONT_INFO { "vertical", ]; - static strings = ["fallbackName", "loadedName"]; + static strings = ["fallbackName", "generatedFontName", "loadedName"]; static OFFSET_BBOX = Math.ceil((this.bools.length * 2) / 8); diff --git a/test/benchmarks/bench_utils.js b/test/benchmarks/bench_utils.js index b67ee6061..dda19d401 100644 --- a/test/benchmarks/bench_utils.js +++ b/test/benchmarks/bench_utils.js @@ -34,17 +34,19 @@ const ROOT_URL = new URL("../../", import.meta.url); const CMAP_URL = new URL("external/bcmaps/", ROOT_URL).pathname; const ICC_URL = new URL("external/iccs/", ROOT_URL).pathname; -const STANDARD_FONT_DATA_URL = new URL("external/standard_fonts/", ROOT_URL) - .pathname; +const STANDARD_FONT_DATA_URL = new URL("external/hellbox/", ROOT_URL).pathname; const WASM_URL = new URL("wasm/", ROOT_URL).pathname; const WASM_PATHS = new Map( - ["jbig2/jbig2.wasm", "openjpeg/openjpeg.wasm", "qcms/qcms_bg.wasm"].map( - path => [ - `${WASM_URL}${path.split("/")[1]}`, - new URL(`external/${path}`, ROOT_URL).pathname, - ] - ) + [ + "hellbox/hellbox_bg.wasm", + "jbig2/jbig2.wasm", + "openjpeg/openjpeg.wasm", + "qcms/qcms_bg.wasm", + ].map(path => [ + `${WASM_URL}${path.split("/")[1]}`, + new URL(`external/${path}`, ROOT_URL).pathname, + ]) ); function readFile(relativePath) { diff --git a/test/benchmarks/font_utils.js b/test/benchmarks/font_utils.js index 6f15e1542..58f4e8de3 100644 --- a/test/benchmarks/font_utils.js +++ b/test/benchmarks/font_utils.js @@ -119,7 +119,7 @@ async function captureFonts(filename, filter, options) { "extractWidths", () => processPdf(filename, options), (evaluator, [, , properties]) => - properties.file && !properties.isInternalFont && filter(properties) + properties.file && filter(properties) ? new FontInput(properties, evaluator.options) : undefined ); diff --git a/test/unit/annotation_spec.js b/test/unit/annotation_spec.js index f2a3e3211..350a0e72d 100644 --- a/test/unit/annotation_spec.js +++ b/test/unit/annotation_spec.js @@ -136,7 +136,6 @@ describe("annotation", function () { idFactory: createIdFactory(/* pageIndex = */ 0), fontCache: new RefMap(), builtInCMapCache, - standardFontDataCache: new Map(), systemFontCache: new Map(), }); }); diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index 42accb8a1..c145f290f 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -35,10 +35,13 @@ import { import { buildGetDocumentParams, CMAP_URL, + DefaultBinaryDataFactory, DefaultFileReaderFactory, getCrossOriginHostname, + STANDARD_FONT_DATA_URL, TEST_PDFS_PATH, TestPdfsServer, + WASM_URL, } from "./test_utils.js"; import { getDocument, @@ -54,6 +57,7 @@ import { Lexer, Parser } from "../../src/core/parser.js"; import { AutoPrintRegExp } from "../../web/ui_utils.js"; import { CipherTransformFactory } from "../../src/core/crypto.js"; import { fetchData as fetchDataDOM } from "../../src/display/dom_utils.js"; +import { FontRendererFactory } from "../../src/core/font_renderer.js"; import { GlobalImageCache } from "../../src/core/image_utils.js"; import { GlobalWorkerOptions } from "../../src/display/worker_options.js"; import { MessageHandler } from "../../src/shared/message_handler.js"; @@ -5060,10 +5064,8 @@ page 1 / 3`); }); expect(styles[fontName]).toEqual({ fontFamily: "serif", - // `useSystemFonts` has a different value in web environments - // and in Node.js. - ascent: isNodeJS ? NaN : 0.683, - descent: isNodeJS ? NaN : -0.217, + ascent: 0.683, + descent: -0.217, vertical: false, }); @@ -8141,6 +8143,342 @@ have written that much by now. So, here’s to squashing bugs.`); }); }); + describe("Generated fonts", function () { + const loadingTasks = new Set(); + let worker = null; + + afterEach(async function () { + await Promise.all(Array.from(loadingTasks, task => task.destroy())); + loadingTasks.clear(); + worker?.destroy(); + worker = null; + }); + + function loadDocument(params) { + const loadingTask = getDocument({ + standardFontDataUrl: STANDARD_FONT_DATA_URL, + wasmUrl: WASM_URL, + useSystemFonts: false, + fontExtraProperties: true, + ...params, + }); + loadingTasks.add(loadingTask); + return loadingTask; + } + + function buildFontPdf(fonts, content = "BT /F1 60 Tf 10 50 Td (A) Tj ET") { + return assemblePdf([ + "1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n", + "2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n", + "3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 200] " + + "/Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>\n" + + "endobj\n", + `4 0 obj\n<< /Length ${content.length} >>\nstream\n${content}\n` + + "endstream\nendobj\n", + ...fonts.map((font, i) => `${i + 5} 0 obj\n${font}\nendobj\n`), + ]); + } + + async function getFonts(pdfPage, { fnArray, argsArray }) { + const ids = new Set( + argsArray.filter((_, i) => fnArray[i] === OPS.setFont).map(([id]) => id) + ); + return new Map( + await Promise.all( + Array.from( + ids, + id => + new Promise(resolve => { + pdfPage.commonObjs.get(id, font => resolve([id, font])); + }) + ) + ) + ); + } + + async function getGeneratedFonts(pdfPage, opList) { + const fonts = await getFonts(pdfPage, opList); + return fonts + .values() + .filter(font => font?.generatedFontName) + .toArray(); + } + + function readFontTables(data) { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + const tables = new Map(); + for (let i = 0, ii = view.getUint16(4); i < ii; i++) { + const tag = String.fromCharCode( + ...data.subarray(12 + 16 * i, 16 + 16 * i) + ); + tables.set(tag, view.getUint32(20 + 16 * i)); + } + return { view, tables }; + } + + function getGeneratedAdvance(data, codePoint) { + const { view, tables } = readFontTables(data); + const { cmap } = FontRendererFactory.create({ data }); + const range = cmap.find( + ({ start, end }) => codePoint >= start && codePoint <= end + ); + const glyphId = + ((range.ids?.[codePoint - range.start] ?? codePoint) + range.idDelta) & + 0xffff; + const numberOfHMetrics = view.getUint16(tables.get("hhea") + 34); + const index = Math.min(glyphId, numberOfHMetrics - 1); + const advance = view.getUint16(tables.get("hmtx") + 4 * index); + return (advance * 1000) / view.getUint16(tables.get("head") + 18); + } + + it("draws the char code fallbacks of a generated standard font (issue 11915)", async function () { + const loadingTask = loadDocument( + buildGetDocumentParams("issue11915.pdf") + ); + const pdfPage = await (await loadingTask.promise).getPage(1); + const { fnArray, argsArray } = await pdfPage.getOperatorList(); + const fonts = await getFonts(pdfPage, { fnArray, argsArray }); + + const texts = new Map(); + let font = null; + for (let i = 0, ii = fnArray.length; i < ii; i++) { + if (fnArray[i] === OPS.setFont) { + font = fonts.get(argsArray[i][0]); + } else if (fnArray[i] === OPS.showText && font.generatedFontName) { + expect(font.missingFile).toBeFalse(); + expect(font.remeasure).toBeFalse(); + const glyphs = argsArray[i][0].filter(g => g?.unicode); + expect(glyphs.every(g => g.isInFont)) + .withContext(font.generatedFontName) + .toBeTrue(); + texts.set( + font.generatedFontName, + glyphs.map(g => g.unicode).join("") + ); + } + } + expect([...texts.values()]).toEqual( + jasmine.arrayContaining([ + "Arial", + "Courier New", + "Times New Roman", + "Calibri", + "Arial Italic", + ]) + ); + }); + + it("synthesizes the weight of a non-embedded black font", async function () { + const loadingTask = loadDocument({ + data: buildFontPdf( + [ + "<< /Type /Font /Subtype /TrueType /BaseFont /ArialBlack /Encoding /WinAnsiEncoding >>", + ], + "BT /F1 24 Tf 20 100 Td (lHI) Tj ET" + ), + }); + const pdfPage = await (await loadingTask.promise).getPage(1); + const [font] = await getGeneratedFonts( + pdfPage, + await pdfPage.getOperatorList() + ); + const { view, tables } = readFontTables(font.data); + expect(view.getUint16(tables.get("OS/2") + 4)).toEqual(900); + }); + + const buildWidthsPdf = () => + buildFontPdf([ + "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica " + + "/FirstChar 64 /LastChar 65 /Widths [100 500] /Encoding << /Differences [64 /A] >> >>", + ]); + + it("generates a glyph for each width of a character", async function () { + const loadingTask = loadDocument({ + data: buildWidthsPdf(), + }); + const pdfPage = await (await loadingTask.promise).getPage(1); + const { fnArray, argsArray } = await pdfPage.getOperatorList(); + + const [glyph] = argsArray[fnArray.indexOf(OPS.showText)][0]; + expect(glyph.unicode).toEqual("A"); + expect(glyph.width).toEqual(500); + expect(glyph.isInFont).toBeTrue(); + const [font] = await getGeneratedFonts(pdfPage, { fnArray, argsArray }); + expect( + getGeneratedAdvance(font.data, glyph.fontChar.codePointAt(0)) + ).toBeCloseTo(glyph.width, 0); + }); + + it("generates the natural width of a character with several widths, after the system fonts", async function () { + const loadingTask = loadDocument({ + data: buildWidthsPdf(), + useSystemFonts: true, + disableFontFace: false, + }); + const pdfPage = await (await loadingTask.promise).getPage(1); + const [font] = await getGeneratedFonts( + pdfPage, + await pdfPage.getOperatorList() + ); + expect(font.missingFile).toBeTrue(); + expect(font.systemFontInfo.css).toContain( + `,"${font.generatedFontName}",sans-serif` + ); + expect(getGeneratedAdvance(font.data, 0x41)).toBeCloseTo(667, 0); + }); + + it("generates a glyph for each width of the fallbacks of an Identity font", async function () { + const loadingTask = loadDocument({ + data: buildFontPdf( + [ + "<< /Type /Font /Subtype /Type0 /BaseFont /Arial /Encoding /Identity-H /DescendantFonts [6 0 R] >>", + "<< /Type /Font /Subtype /CIDFontType2 /BaseFont /Arial " + + "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) " + + "/Supplement 0 >> /DW 1000 /W [200 [600]] >>", + ], + "BT /F1 60 Tf 10 50 Td <00C800C1> Tj ET" + ), + }); + const pdfPage = await (await loadingTask.promise).getPage(1); + const { fnArray, argsArray } = await pdfPage.getOperatorList(); + + const [glyph200, glyph193] = argsArray[fnArray.indexOf(OPS.showText)][0]; + expect([glyph200.width, glyph193.width]).toEqual([600, 1000]); + // The font's char code keeps U+00C1, the encoding fallback doesn't. + expect(glyph200.fontChar).toEqual("Á"); + expect(glyph193.fontChar).not.toEqual(glyph200.fontChar); + expect(glyph193.isInFont).toBeTrue(); + const [font] = await getGeneratedFonts(pdfPage, { fnArray, argsArray }); + for (const glyph of [glyph200, glyph193]) { + expect( + getGeneratedAdvance(font.data, glyph.fontChar.codePointAt(0)) + ).toBeCloseTo(glyph.width, 0); + } + }); + + it("generates the fonts with the resources of their document", async function () { + if (isNodeJS) { + pending("Fake workers share the Hellbox state of earlier documents."); + } + worker = new PDFWorker({ name: "GeneratedFonts" }); + const loadingTask1 = loadDocument( + buildGetDocumentParams("tracemonkey.pdf", { + worker, + useWorkerFetch: false, + standardFontDataUrl: null, + wasmUrl: null, + }) + ); + await loadingTask1.promise; + const loadingTask2 = loadDocument( + buildGetDocumentParams("issue11915.pdf", { + worker, + useWorkerFetch: false, + }) + ); + const pdfPage = await (await loadingTask2.promise).getPage(1); + const fonts = await getGeneratedFonts( + pdfPage, + await pdfPage.getOperatorList() + ); + expect(fonts.length).toEqual(5); + }); + + it("generates the fonts despite the failures of other documents", async function () { + if (isNodeJS) { + pending("Fake workers share the Hellbox state of earlier documents."); + } + worker = new PDFWorker({ name: "GeneratedFontsFailures" }); + const tasks = [ + { wasmUrl: "./nonexistent/" }, + { standardFontDataUrl: "./nonexistent/" }, + {}, + ].map(urls => + loadDocument( + buildGetDocumentParams("issue11915.pdf", { + worker, + useWorkerFetch: false, + ...urls, + }) + ) + ); + const pdfPages = await Promise.all( + tasks.map(async task => (await task.promise).getPage(1)) + ); + const opLists = await Promise.all( + pdfPages.map(pdfPage => pdfPage.getOperatorList()) + ); + + const fonts = await getGeneratedFonts(pdfPages[2], opLists[2]); + expect(fonts.length).toEqual(5); + }); + + it("generates the fonts despite the pending fetches of a closed document", async function () { + if (isNodeJS) { + pending("Fake workers share the Hellbox state of earlier documents."); + } + class PendingFactory extends DefaultBinaryDataFactory { + async fetch({ kind, filename }) { + if (kind !== "standardFontDataUrl") { + return super.fetch({ kind, filename }); + } + if (filename === "unicode.bin") { + return new Promise(() => {}); + } + throw new Error(`Cannot fetch ${filename}.`); + } + } + worker = new PDFWorker({ name: "GeneratedFontsPending" }); + const params = { worker, useWorkerFetch: false }; + + const closedTask = loadDocument( + buildGetDocumentParams("issue11915.pdf", { + ...params, + BinaryDataFactory: PendingFactory, + }) + ); + const closedPage = await (await closedTask.promise).getPage(1); + await closedPage.getOperatorList(); + await closedTask.destroy(); + loadingTasks.delete(closedTask); + + const loadingTask = loadDocument( + buildGetDocumentParams("issue11915.pdf", params) + ); + const pdfPage = await (await loadingTask.promise).getPage(1); + const fonts = await getGeneratedFonts( + pdfPage, + await pdfPage.getOperatorList() + ); + expect(fonts.length).toEqual(5); + }); + + it("generates the fonts with the resources of a custom factory", async function () { + class ResourceFactory extends DefaultBinaryDataFactory { + constructor() { + super({ + standardFontDataUrl: STANDARD_FONT_DATA_URL, + wasmUrl: WASM_URL, + }); + } + } + const loadingTask = loadDocument( + buildGetDocumentParams("issue11915.pdf", { + BinaryDataFactory: ResourceFactory, + standardFontDataUrl: null, + wasmUrl: null, + useWorkerFetch: false, + }) + ); + const pdfPage = await (await loadingTask.promise).getPage(1); + const fonts = await getGeneratedFonts( + pdfPage, + await pdfPage.getOperatorList() + ); + expect(fonts.length).toEqual(5); + }); + }); + describe("Annotations", function () { it("should extract the text under some annotations", async function () { const loadingTask = getDocument(buildGetDocumentParams("bug1885505.pdf")); diff --git a/test/unit/font_loader_spec.js b/test/unit/font_loader_spec.js index 86cb4f1d9..5db3b5b68 100644 --- a/test/unit/font_loader_spec.js +++ b/test/unit/font_loader_spec.js @@ -13,19 +13,87 @@ * limitations under the License. */ -import { FontFaceObject } from "../../src/display/font_loader.js"; +import { FontFaceObject, FontLoader } from "../../src/display/font_loader.js"; import { isNodeJS } from "../../src/shared/util.js"; describe("font_loader", function () { + let nativeFontFace; + + beforeEach(function () { + nativeFontFace = globalThis.FontFace; + }); + + afterEach(function () { + globalThis.FontFace = nativeFontFace; + }); + + function createFont(properties) { + return new FontFaceObject({ + data: new Uint8Array([0x00]), + disableFontFace: false, + fontExtraProperties: false, + loadedName: "g_d0_f1", + ...properties, + }); + } + + it("loads generated fonts through CSS without the Font Loading API", async function () { + const loader = new FontLoader({ ownerDocument: {} }); + spyOnProperty(loader, "isSyncFontLoadingSupported", "get").and.returnValue( + true + ); + const insertRule = spyOn(loader, "insertRule"); + + for (const [loadedName, missingFile] of [ + ["g_d0_f1_generated", false], + ["g_d0_f1", true], + ]) { + const font = createFont({ + generatedFontName: "g_d0_f1_generated", + loadedName, + missingFile, + }); + await loader.bind(font); + await loader.bind(font); + + expect(insertRule).toHaveBeenCalledOnceWith( + jasmine.stringContaining('font-family:"g_d0_f1_generated";') + ); + insertRule.calls.reset(); + } + }); + + it("falls back to paths only when a replacement font fails to load", async function () { + globalThis.FontFace = class { + constructor(family) { + this.family = family; + this.loaded = Promise.reject(new Error("Invalid font")); + } + }; + for (const missingFile of [false, true]) { + const ownerDocument = { fonts: new Set() }; + const loader = new FontLoader({ ownerDocument }); + const font = createFont({ + generatedFontName: "g_d0_f1_generated", + missingFile, + }); + if (missingFile) { + await expectAsync(loader.bind(font)).toBeResolved(); + } else { + await expectAsync(loader.bind(font)).toBeRejectedWithError( + "Invalid font" + ); + } + expect(font.disableFontFace).toBe(!missingFile); + expect(ownerDocument.fonts.size).toEqual(0); + loader.clear(); + } + }); + describe("FontFaceObject", function () { function createFontFaceObject(fontFamily) { - return new FontFaceObject({ + return createFont({ cssFontInfo: { fontFamily, fontWeight: "400", italicAngle: "0" }, - data: new Uint8Array([0x00]), - disableFontFace: false, - fontExtraProperties: false, - loadedName: "g_d0_f1", - mimetype: "font/opentype", }); } @@ -95,20 +163,46 @@ describe("font_loader", function () { }); it("uses the same font family in both font loading paths", function () { - const NativeFontFace = globalThis.FontFace; globalThis.FontFace = function MockFontFace(family) { this.family = family; }; - try { - for (const fontFamily of [`"Foo Bar"`, "Foo-Bar", "serif"]) { - const font = createFontFaceObject(fontFamily); + for (const fontFamily of [`"Foo Bar"`, "Foo-Bar", "serif"]) { + const font = createFontFaceObject(fontFamily); - expect(font.createNativeFontFace().family).toEqual( - getFontFamily(font.createFontFaceRule()) - ); + expect(font.createNativeFontFace().family).toEqual( + getFontFamily(font.createFontFaceRule()) + ); + } + }); + + it("matches the generated font family and canvas style in both loading paths", function () { + globalThis.FontFace = class { + constructor(family, data, descriptors) { + Object.assign(this, { family, descriptors }); + } + }; + for (const italic of [false, true]) { + for (const [bold, black, weight] of [ + [false, false, "normal"], + [true, false, "bold"], + [true, true, "900"], + ]) { + const font = createFont({ + generatedFontName: "g_d0_f1_generated", + italic, + bold, + black, + }); + const face = font.createNativeFontFace(); + const style = italic ? "italic" : "normal"; + expect(face.family).toEqual("g_d0_f1_generated"); + expect(face.descriptors).toEqual({ style, weight }); + + const rule = font.createFontFaceRule(); + expect(rule).toContain('font-family:"g_d0_f1_generated";'); + expect(rule).toContain(`font-style: ${style};`); + expect(rule).toContain(`font-weight: ${weight};`); } - } finally { - globalThis.FontFace = NativeFontFace; } }); diff --git a/test/unit/font_substitutions_spec.js b/test/unit/font_substitutions_spec.js index ae20c570d..214c952ce 100644 --- a/test/unit/font_substitutions_spec.js +++ b/test/unit/font_substitutions_spec.js @@ -18,14 +18,12 @@ import { getFontSubstitution } from "../../src/core/font_substitutions.js"; describe("getFontSubstitution", function () { const idFactory = createIdFactory(0); - const localFontPath = "/tmp/"; it("should substitute an unknown font", () => { const fontName = "Foo"; const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -49,7 +47,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -73,7 +70,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -97,7 +93,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -121,7 +116,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -145,7 +139,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Helvetica", "TrueType" @@ -161,8 +154,7 @@ describe("getFontSubstitution", function () { "local(A030),local(TeX Gyre Heros),local(FreeSans)," + "local(DejaVu Sans),local(Albany),local(Bitstream Vera Sans)," + "local(Arial Unicode MS),local(Microsoft Sans Serif)," + - "local(Apple Symbols),local(Cantarell)," + - "url(/tmp/LiberationSans-Regular.ttf)", + "local(Apple Symbols),local(Cantarell)", style: { style: "normal", weight: "normal", @@ -177,7 +169,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Helvetica-Oblique", "TrueType" @@ -196,7 +187,7 @@ describe("getFontSubstitution", function () { "local(DejaVu Sans Italic),local(Albany Italic)," + "local(Bitstream Vera Sans Italic),local(Arial Unicode MS Italic)," + "local(Microsoft Sans Serif Italic),local(Apple Symbols Italic)," + - "local(Cantarell Italic),url(/tmp/LiberationSans-Italic.ttf)", + "local(Cantarell Italic)", style: { style: "italic", weight: "normal", @@ -211,7 +202,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Helvetica-Bold", "TrueType" @@ -229,7 +219,7 @@ describe("getFontSubstitution", function () { "local(DejaVu Sans Bold),local(Albany Bold)," + "local(Bitstream Vera Sans Bold),local(Arial Unicode MS Bold)," + "local(Microsoft Sans Serif Bold),local(Apple Symbols Bold)," + - "local(Cantarell Bold),url(/tmp/LiberationSans-Bold.ttf)", + "local(Cantarell Bold)", style: { style: "normal", weight: "bold", @@ -244,7 +234,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Helvetica-BoldOblique", "TrueType" @@ -264,8 +253,7 @@ describe("getFontSubstitution", function () { "local(Bitstream Vera Sans Bold Italic)," + "local(Arial Unicode MS Bold Italic)," + "local(Microsoft Sans Serif Bold Italic)," + - "local(Apple Symbols Bold Italic),local(Cantarell Bold Italic)," + - "url(/tmp/LiberationSans-BoldItalic.ttf)", + "local(Apple Symbols Bold Italic),local(Cantarell Bold Italic)", style: { style: "italic", weight: "bold", @@ -280,7 +268,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Times-Roman", "TrueType" @@ -311,7 +298,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Times-Italic", "TrueType" @@ -344,7 +330,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Times-Bold", "TrueType" @@ -377,7 +362,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, "Times-BoldItalic", "TrueType" @@ -410,7 +394,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -427,7 +410,7 @@ describe("getFontSubstitution", function () { "local(FreeSans),local(DejaVu Sans),local(Albany)," + "local(Bitstream Vera Sans),local(Arial Unicode MS)," + "local(Microsoft Sans Serif),local(Apple Symbols)," + - "local(Cantarell),url(/tmp/LiberationSans-Regular.ttf)", + "local(Cantarell)", style: { style: "normal", weight: "normal", @@ -444,7 +427,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -463,7 +445,7 @@ describe("getFontSubstitution", function () { "local(DejaVu Sans Bold),local(Albany Bold)," + "local(Bitstream Vera Sans Bold),local(Arial Unicode MS Bold)," + "local(Microsoft Sans Serif Bold),local(Apple Symbols Bold)," + - "local(Cantarell Bold),url(/tmp/LiberationSans-Bold.ttf)", + "local(Cantarell Bold)", style: { style: "normal", weight: "bold", @@ -480,7 +462,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -499,7 +480,7 @@ describe("getFontSubstitution", function () { "local(DejaVu Sans Bold),local(Albany Bold)," + "local(Bitstream Vera Sans Bold),local(Arial Unicode MS Bold)," + "local(Microsoft Sans Serif Bold),local(Apple Symbols Bold)," + - "local(Cantarell Bold),url(/tmp/LiberationSans-Bold.ttf)", + "local(Cantarell Bold)", style: { style: "normal", weight: "900", @@ -516,7 +497,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "TrueType" @@ -535,7 +515,7 @@ describe("getFontSubstitution", function () { "local(DejaVu Sans Bold),local(Albany Bold)," + "local(Bitstream Vera Sans Bold),local(Arial Unicode MS Bold)," + "local(Microsoft Sans Serif Bold),local(Apple Symbols Bold)," + - "local(Cantarell Bold),url(/tmp/LiberationSans-Bold.ttf)", + "local(Cantarell Bold)", style: { style: "normal", weight: "900", @@ -552,7 +532,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "CIDFontType2" @@ -583,7 +562,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "CIDFontType0" @@ -614,7 +592,6 @@ describe("getFontSubstitution", function () { const fontSubstitution = getFontSubstitution( new Map(), idFactory, - localFontPath, fontName, undefined, "CIDFontType2" diff --git a/test/unit/obj_bin_transform_spec.js b/test/unit/obj_bin_transform_spec.js index 134541bc0..a737e9bd8 100644 --- a/test/unit/obj_bin_transform_spec.js +++ b/test/unit/obj_bin_transform_spec.js @@ -67,6 +67,7 @@ describe("obj_bin_transform", function () { bbox: [1, 1, 1, 1], fontMatrix: [1, 1, 1, 1, 1, 1], fallbackName: "string", + generatedFontName: "string", loadedName: "string", data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), uselessProp: "something", @@ -120,9 +121,9 @@ describe("obj_bin_transform", function () { describe("FontInfo", function () { it("must roundtrip correctly for FontInfo", function () { - let sizeEstimate = 41; // fixed offset until the strings + let sizeEstimate = 61; // fixed offset until the strings const { encoder } = InfoUtils; - sizeEstimate += 4 + 4 * (4 + encoder.encode("string").length); + sizeEstimate += 4 + 3 * (4 + encoder.encode("string").length); sizeEstimate += 4 + 4; // cssFontInfo and systemFontInfo sizeEstimate += 4 + fontInfo.data.length; const buffer = compileFontInfo(fontInfo); @@ -141,6 +142,7 @@ describe("obj_bin_transform", function () { expect(deserialized.bbox).toEqual([1, 1, 1, 1]); expect(deserialized.fontMatrix).toEqual([1, 1, 1, 1, 1, 1]); expect(deserialized.fallbackName).toEqual("string"); + expect(deserialized.generatedFontName).toEqual("string"); expect(deserialized.loadedName).toEqual("string"); expect(Array.from(deserialized.data)).toEqual([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, diff --git a/test/unit/test_utils.js b/test/unit/test_utils.js index 952514a3c..a7916b9c9 100644 --- a/test/unit/test_utils.js +++ b/test/unit/test_utils.js @@ -29,8 +29,8 @@ const TEST_PDFS_PATH = isNodeJS ? "./test/pdfs/" : "../pdfs/"; const CMAP_URL = isNodeJS ? "./external/bcmaps/" : "../../external/bcmaps/"; const STANDARD_FONT_DATA_URL = isNodeJS - ? "./external/standard_fonts/" - : "../../external/standard_fonts/"; + ? "./external/hellbox/" + : "../../external/hellbox/"; const WASM_URL = isNodeJS ? "./build/generic-legacy/web/wasm/" diff --git a/test/unit/unicode_spec.js b/test/unit/unicode_spec.js index f951cc116..3c76abe04 100644 --- a/test/unit/unicode_spec.js +++ b/test/unit/unicode_spec.js @@ -36,6 +36,8 @@ describe("unicode", function () { it("should re-map special Unicode values", function () { // copyrightsans => copyright expect(mapSpecialUnicodeValues(0xf8e9)).toEqual(0x00a9); + // braceex => curly bracket extension + expect(mapSpecialUnicodeValues(0xf8f4)).toEqual(0x23aa); // Private Use Area characters expect(mapSpecialUnicodeValues(0xffff)).toEqual(0); }); diff --git a/web/app_options.js b/web/app_options.js index 9e582083a..71ef08c9b 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -887,7 +887,7 @@ const defaultOptions = new Map([ value: // eslint-disable-next-line no-nested-ternary typeof PDFJSDev === "undefined" - ? "../external/standard_fonts/" + ? "../external/hellbox/" : PDFJSDev.test("MOZCENTRAL") ? "resource://pdf.js/web/standard_fonts/" : "../web/standard_fonts/", diff --git a/web/internal/debugger.js b/web/internal/debugger.js index 6330fd492..e885c399f 100644 --- a/web/internal/debugger.js +++ b/web/internal/debugger.js @@ -107,7 +107,7 @@ async function openDocument(source, name) { typeof PDFJSDev === "undefined" ? "../external/iccs/" : "../web/iccs/", standardFontDataUrl: typeof PDFJSDev === "undefined" - ? "../external/standard_fonts/" + ? "../external/hellbox/" : "../web/standard_fonts/", wasmUrl: "../web/wasm/", useWorkerFetch: true,