From 27053180bd18cfa1d9f577fa716076f393f7ea28 Mon Sep 17 00:00:00 2001 From: Tamara Steinwender <tamara.steinwender@tugraz.at> Date: Tue, 29 Sep 2020 13:22:14 +0200 Subject: [PATCH] Add webcomponent qr-code-scanner --- packages/qr-code-scanner/.cert/server.cert | 13 + packages/qr-code-scanner/.cert/server.key | 15 + packages/qr-code-scanner/.gitignore | 5 + packages/qr-code-scanner/.gitmodules | 3 + packages/qr-code-scanner/LICENSE | 502 ++++++++++++++++++ packages/qr-code-scanner/README.md | 56 ++ packages/qr-code-scanner/assets/favicon.ico | Bin 0 -> 2550 bytes packages/qr-code-scanner/assets/index.html | 13 + .../qr-code-scanner/i18next-scanner.config.js | 15 + packages/qr-code-scanner/karma.conf.js | 23 + packages/qr-code-scanner/package.json | 48 ++ packages/qr-code-scanner/qr-code-dummy.png | Bin 0 -> 3949 bytes packages/qr-code-scanner/rollup.config.js | 81 +++ .../src/dbp-qr-code-scanner-demo.js | 61 +++ .../src/dbp-qr-code-scanner.js | 3 + packages/qr-code-scanner/src/i18n.js | 6 + .../src/i18n/de/translation.json | 2 + .../src/i18n/en/translation.json | 2 + packages/qr-code-scanner/src/index.js | 3 + .../qr-code-scanner/src/qr-code-scanner.js | 64 +++ .../src/qr-scanner-worker.min.js | 87 +++ packages/qr-code-scanner/test/unit.js | 19 + 22 files changed, 1021 insertions(+) create mode 100644 packages/qr-code-scanner/.cert/server.cert create mode 100644 packages/qr-code-scanner/.cert/server.key create mode 100644 packages/qr-code-scanner/.gitignore create mode 100644 packages/qr-code-scanner/.gitmodules create mode 100644 packages/qr-code-scanner/LICENSE create mode 100644 packages/qr-code-scanner/README.md create mode 100644 packages/qr-code-scanner/assets/favicon.ico create mode 100644 packages/qr-code-scanner/assets/index.html create mode 100644 packages/qr-code-scanner/i18next-scanner.config.js create mode 100644 packages/qr-code-scanner/karma.conf.js create mode 100644 packages/qr-code-scanner/package.json create mode 100644 packages/qr-code-scanner/qr-code-dummy.png create mode 100644 packages/qr-code-scanner/rollup.config.js create mode 100644 packages/qr-code-scanner/src/dbp-qr-code-scanner-demo.js create mode 100644 packages/qr-code-scanner/src/dbp-qr-code-scanner.js create mode 100644 packages/qr-code-scanner/src/i18n.js create mode 100644 packages/qr-code-scanner/src/i18n/de/translation.json create mode 100644 packages/qr-code-scanner/src/i18n/en/translation.json create mode 100644 packages/qr-code-scanner/src/index.js create mode 100644 packages/qr-code-scanner/src/qr-code-scanner.js create mode 100644 packages/qr-code-scanner/src/qr-scanner-worker.min.js create mode 100644 packages/qr-code-scanner/test/unit.js diff --git a/packages/qr-code-scanner/.cert/server.cert b/packages/qr-code-scanner/.cert/server.cert new file mode 100644 index 00000000..628d8c1a --- /dev/null +++ b/packages/qr-code-scanner/.cert/server.cert @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB+zCCAWSgAwIBAgIJdpM6qGYddQBkMA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV +BAMTEWRicC1kZXYubG9jYWxob3N0MB4XDTIwMDkyOTA4NTM1NFoXDTQ4MDIxNDA5 +NTM1NFowHDEaMBgGA1UEAxMRZGJwLWRldi5sb2NhbGhvc3QwgZ8wDQYJKoZIhvcN +AQEBBQADgY0AMIGJAoGBAK0gJFcxEE6DqThq1/ewpHBm0h7l8I0UjcYpeO0syvUS +gXVo0yv3XUqQCMMFXJHBHbyqSF3VBjzvCzLsnqcXvoldY9bIz+flz9Ek6/1zIhww +uLjmS4C9r56+1pyZv4tK5w6UqciXoxeJPz+L1DhSfPqFGc65NB/iVKSqhWUPKqPf +AgMBAAGjRTBDMAwGA1UdEwQFMAMBAf8wCwYDVR0PBAQDAgL0MCYGA1UdEQQfMB2G +G2h0dHA6Ly9leGFtcGxlLm9yZy93ZWJpZCNtZTANBgkqhkiG9w0BAQsFAAOBgQB+ +34EFsWF1Uw7GHUYD9ZFp1MxvvY0Sz5DJ1o+7Pf73d0/+bu1xDZmpI5cWtx/meVBO +2+8R8CzzI4X5CpRT1Dd6kKJHnhFmjqrgw4Vgp4rjbikW83G9ccpjPniimiXsR+ep +W+ekyndqxMssoCTMaC7WqOSLrHU3PzFaTeTJeimELg== +-----END CERTIFICATE----- diff --git a/packages/qr-code-scanner/.cert/server.key b/packages/qr-code-scanner/.cert/server.key new file mode 100644 index 00000000..3351be4f --- /dev/null +++ b/packages/qr-code-scanner/.cert/server.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCtICRXMRBOg6k4atf3sKRwZtIe5fCNFI3GKXjtLMr1EoF1aNMr +911KkAjDBVyRwR28qkhd1QY87wsy7J6nF76JXWPWyM/n5c/RJOv9cyIcMLi45kuA +va+evtacmb+LSucOlKnIl6MXiT8/i9Q4Unz6hRnOuTQf4lSkqoVlDyqj3wIDAQAB +AoGBAISeWZg9Kmuqqcdg+T1xIBZGfXFT3RiFhTEmdc7hgDuJyIfDG/jTDbDfcwbJ +paa1k20B2Fugop2s1BxXbBU9uCNI0lyRQk0oo3nrEg2lcpqkF2w5q7LnF+MhsqOL +9GPgCH9dk5gogLMcm4kdhmSvil6pBA42vA9JLrc1wMTsvBqBAkEA3nsQ8t9x9Gka +/u5D3WD7Xx/j8XVetsv+Pk2x+Uw0maOuHUHSjGFvcNEZKv5RN9Q16ypKcZlL3inT +0t2EC/UIQQJBAMc1esK8a5Yr6zwBQpxYtZ4mXce+Zyi9R3M4w7dSOtKXHY2WlyaR +q/GfDwXu0mqoH9s6fEPCLziX1jWmtn31pB8CQQCFm0hhYnivu5L/t5y/zKcIyED+ +V2rqwfTL+6K+wNnxzk8YuNe1gCoJiTjhDds+eM1sjXgpYlMiduIDhw3ulFdBAkBB +c9vi8f+zdriynYNiVW9PCDIV+ARzCUXZoNQFfrofCVHHfKwrGv/Qwr8v5tkx/A2D +fYLozHuxb4oNVLpvRm9nAkA7rin1POovAdwPLcuuRavxU+oOgAnZ/H3r1aEqI2Lm +jIah8AQQorfHKAqBbkv93lej0LcP0ubW8meO4G41Hhig +-----END RSA PRIVATE KEY----- diff --git a/packages/qr-code-scanner/.gitignore b/packages/qr-code-scanner/.gitignore new file mode 100644 index 00000000..e62f92aa --- /dev/null +++ b/packages/qr-code-scanner/.gitignore @@ -0,0 +1,5 @@ +dist +node_modules +.idea +npm-debug.log +package-lock.json diff --git a/packages/qr-code-scanner/.gitmodules b/packages/qr-code-scanner/.gitmodules new file mode 100644 index 00000000..506f9e33 --- /dev/null +++ b/packages/qr-code-scanner/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/common"] + path = vendor/common + url = git@gitlab.tugraz.at:dbp/web-components/Common.git diff --git a/packages/qr-code-scanner/LICENSE b/packages/qr-code-scanner/LICENSE new file mode 100644 index 00000000..4362b491 --- /dev/null +++ b/packages/qr-code-scanner/LICENSE @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; 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. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/packages/qr-code-scanner/README.md b/packages/qr-code-scanner/README.md new file mode 100644 index 00000000..d2e5ee42 --- /dev/null +++ b/packages/qr-code-scanner/README.md @@ -0,0 +1,56 @@ +# Qr Code Scanner Web Component + +[GitLab Repository](https://gitlab.tugraz.at/dbp/web-components/qr-code-scanner) + +## Requirements +- Https + +## Usage + +```html +<dbp-qr-code-scanner></dbp-qr-code-scanner> +``` + +## Attributes + +- `lang` (optional, default: `de`): set to `de` or `en` for German or English + - example `<dbp-qr-code-scanner lang="de" client-id="my-client-id"></dbp-notification>` + + +## Local development + +```bash +# get the source +git clone git@gitlab.tugraz.at:dbp/web-components/qr-code-scanner.git +cd qr-code-scanner +git submodule update --init + +# install dependencies (make sure you have npm version 4+ installed, so symlinks to the git submodules are created automatically) +yarn install + +# constantly build dist/bundle.js and run a local web-server on port 8002 +yarn run watch-local + +# run tests +yarn test +``` + +Jump to <http://localhost:8002> and you should get a demo page. + +## Camera for local development + +You can use your desktop as a camera, to test the qr code reader + +```bash +#install the virtual cam +sudo apt install ffmpeg v4l2loopback-dkms; sudo modprobe v4l2loopback + +#start virtual cam - Dummy video device (0x0000) +ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 +``` + +Then you can place a QR Code in the left corner of your desktop. +You can try the webcomponent with this example QR Code. + + + diff --git a/packages/qr-code-scanner/assets/favicon.ico b/packages/qr-code-scanner/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..f6cf22d1afc22f071d2b64c7779bc5214c3adae5 GIT binary patch literal 2550 zcmZQzU}Ruo5D);-91Iz(3=C=v3{buTLk0^2Lmw*xg9b>9fq_AR0iuq9fq}t+5kx{U z68r!E{|pQa{~0DTTx0nE<_yEJYwsDZJ%7$HVdYu|hX2M43=C-u3=A_F7#PklFo3wm z#taO`X$%a;GZ`3+L1O<QO45uO7}C-h7}91kFr=MfU`YE9(KgeVfnjDE1H;Uj3=A{R zFfh#g4>pS7j4=blnKTB5Gcy?&&YWRjIP;%@;eQ$f!~dBK4FAtC7=ySB#tg;`X$-~; zGZ~B-&M+7={0BS9*w~oC*f@>B*mx#`vGExOW8?o2C#4xP7^kH%7^lr-FitzeV4U_J z;>?-G48}9l7>sAmWH6q2hQWB|e~8o17&923Nn<cRGn2vi%ozsbGyfTk{~I$H|4(Bu z{y&q!80?P!;1B@0B8>qAXELNQoMA{~_|E|LvavBknsFLKn(<7AG~+W2X~zE{!H{Om zkd~Ilkd`)+Aua6;Bv@t|Go;N-V@R7hlOb&;NbEl(sLmKOq@9_`kap$_L)w}D;Gj$U zZ_JSPe<nlP|1%6{K>lVp0|`RonG6tk1{^ChjX|N4#xT<u#QzTo>NI19nZ{`hGt*`= z%uGAOFw^)y!_1k+3^Qk@G0dDflVRpekXipB(E+wQjbY}QnG7?}oMD)G=07-!X8t#3 zn0Y3RVdnpt3^V_qVVL><KPUx2V*(TcGZ{cG14Zu{V`GLh#%T;^jAt^OF+Rg^#`r%Z zYC-NuOJg{bHk08D$Q^0_A<;e4nBmOKG=?)XXEL0bd4}Q4%>R%iaK@P7%$YQXGiPQp zoH=ub;mn!;;AC+I<d*+w3}^n&WH<u~53pN6sR0xVAUi=x)tKSGaT>#a<CzTqjn6Rr zH~tSvPHDyrXVTIb{-@1k_@8!$;Y`|pND`ZA%<z9^8pHpYGa3HRJj3vR=6_JKWB7l@ znBo7KG=~3YW-|OgbB5vnng0y`{~I%$`Jcw{|Nl&e|NqZ0q@{u4D2*ZQKgbS{*&sD( z42ld(8RFyP8OqDc8QR*~7^Y2|#&G)dX@*UkHZfekex2d&-Mb8rA3tVz_39PF$B!Qw ze*E~s@ZtA=h9wIYFf=qYfb$^(I6MA_P@s4R<%9qK8RlI}XAod61>+Q628P?~wlQq0 zO=L(CPiHu~?l8mTy^|Ss)%G&jvhy<B<Xg=UC0oa^rAUM!%<3M)xjF9`YL9+lc&VSx za9-d%gYn~S45u}ZKnnwkC?+N*CS(Ip`5+z`Gk{12FbQHYfmskfm<bUCGr<Iu4>cLY zgEGMsIv*@Z1_3JiknzL+3=AOLpvb@g!Yzyp3?TfUpMe34!EwRB0Mmn7&Vou?1_lQf zG8{6Zw7^0SMw9A!m_8UytbUk!d^E@`ba{{%2&0Q*<6~0?5(8m$_1MJF)qwaQbs!94 zBV%l0$nr2YNF5;zQwyUBsYjQG>4VYe@*|rM3l$g*Dq}zxRK|cXsEh$&a2W$CYtYIW E03q~Dvj6}9 literal 0 HcmV?d00001 diff --git a/packages/qr-code-scanner/assets/index.html b/packages/qr-code-scanner/assets/index.html new file mode 100644 index 00000000..704f42f9 --- /dev/null +++ b/packages/qr-code-scanner/assets/index.html @@ -0,0 +1,13 @@ +<!doctype html> +<html> +<head> + <meta charset="UTF-8"> + <script type="module" src="dbp-qr-code-scanner-demo.js"></script> +</head> + +<body> + +<dbp-qr-code-scanner-demo lang="de"></dbp-qr-code-scanner-demo> + +</body> +</html> diff --git a/packages/qr-code-scanner/i18next-scanner.config.js b/packages/qr-code-scanner/i18next-scanner.config.js new file mode 100644 index 00000000..8c277798 --- /dev/null +++ b/packages/qr-code-scanner/i18next-scanner.config.js @@ -0,0 +1,15 @@ +module.exports = { + input: [ + 'src/*.js', + ], + output: './', + options: { + debug: false, + removeUnusedKeys: true, + lngs: ['en','de'], + resource: { + loadPath: 'src/i18n/{{lng}}/{{ns}}.json', + savePath: 'src/i18n/{{lng}}/{{ns}}.json' + }, + }, +} diff --git a/packages/qr-code-scanner/karma.conf.js b/packages/qr-code-scanner/karma.conf.js new file mode 100644 index 00000000..6a646f5e --- /dev/null +++ b/packages/qr-code-scanner/karma.conf.js @@ -0,0 +1,23 @@ +// Trick to use the auto-downloaded puppeteer chrome binary +process.env.CHROME_BIN = require('puppeteer').executablePath(); + +module.exports = function(config) { + config.set({ + basePath: 'dist', + frameworks: ['mocha', 'chai'], + files: [ + {pattern: './*.js', included: true, watched: true, served: true, type: 'module'}, + {pattern: './**/*', included: false, watched: true, served: true}, + ], + autoWatch: true, + browsers: ['ChromeHeadlessNoSandbox'], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'] + } + }, + singleRun: false, + logLevel: config.LOG_ERROR + }); +} diff --git a/packages/qr-code-scanner/package.json b/packages/qr-code-scanner/package.json new file mode 100644 index 00000000..17ae32f0 --- /dev/null +++ b/packages/qr-code-scanner/package.json @@ -0,0 +1,48 @@ +{ + "name": "dbp-qr-code-scanner", + "version": "1.0.0", + "main": "src/index.js", + "license": "LGPL-2.1-or-later", + "private": true, + "devDependencies": { + "@rollup/plugin-commonjs": "^14.0.0", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-node-resolve": "^8.4.0", + "@rollup/plugin-url": "^5.0.1", + "chai": "^4.2.0", + "file-loader": "^6.1.0", + "i18next-scanner": "^2.10.2", + "karma": "^5.1.0", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.1", + "mocha": "^8.0.1", + "puppeteer": "^2.1.1", + "rollup": "^2.19.0", + "rollup-plugin-consts": "^1.0.1", + "rollup-plugin-copy": "^3.1.0", + "rollup-plugin-delete": "^2.0.0", + "rollup-plugin-serve": "^1.0.1", + "rollup-plugin-terser": "^6.1.0" + }, + "dependencies": { + "@open-wc/scoped-elements": "^1.1.1", + "dbp-common": "^1.0.0", + "lit-element": "^2.3.1", + "qr-scanner": "^1.2.0" + }, + "scripts": { + "clean": "rm dist/*", + "build": "npm run build-local", + "build-local": "rollup -c", + "build-dev": "rollup -c --environment BUILD:development", + "build-prod": "rollup -c --environment BUILD:production", + "build-demo": "rollup -c --environment BUILD:demo", + "build-test": "rollup -c --environment BUILD:test", + "i18next": "i18next-scanner", + "watch": "npm run watch-local", + "watch-local": "rollup -c --watch", + "watch-dev": "rollup -c --watch --environment BUILD:development", + "test": "npm run build-test && karma start --singleRun" + } +} diff --git a/packages/qr-code-scanner/qr-code-dummy.png b/packages/qr-code-scanner/qr-code-dummy.png new file mode 100644 index 0000000000000000000000000000000000000000..d0fef9490d006a593496139431719410960bf8e7 GIT binary patch literal 3949 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 literal 0 HcmV?d00001 diff --git a/packages/qr-code-scanner/rollup.config.js b/packages/qr-code-scanner/rollup.config.js new file mode 100644 index 00000000..a7825593 --- /dev/null +++ b/packages/qr-code-scanner/rollup.config.js @@ -0,0 +1,81 @@ +import glob from 'glob'; +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import copy from 'rollup-plugin-copy'; +import {terser} from "rollup-plugin-terser"; +import json from '@rollup/plugin-json'; +import serve from 'rollup-plugin-serve'; +import url from "@rollup/plugin-url"; +import consts from 'rollup-plugin-consts'; +import del from 'rollup-plugin-delete'; +import fs from "fs"; +import selfsigned from "selfsigned"; +import {getPackagePath} from "../../rollup.utils"; + +const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local'; +console.log("build: " + build); + +const USE_HTTPS = true; + +function generateTLSConfig() { + fs.mkdirSync('.cert', {recursive: true}); + + if (!fs.existsSync('.cert/server.key') || !fs.existsSync('.cert/server.cert')) { + const attrs = [{name: 'commonName', value: 'dbp-dev.localhost'}]; + const pems = selfsigned.generate(attrs, {algorithm: 'sha256', days: 9999}); + fs.writeFileSync('.cert/server.key', pems.private); + fs.writeFileSync('.cert/server.cert', pems.cert); + } + + return { + key: fs.readFileSync('.cert/server.key'), + cert: fs.readFileSync('.cert/server.cert') + } +} + + +export default (async () => { + return { + input: (build != 'test') ? ['src/dbp-qr-code-scanner.js', 'src/dbp-qr-code-scanner-demo.js'] : glob.sync('test/**/*.js'), + output: { + dir: 'dist', + entryFileNames: '[name].js', + chunkFileNames: 'shared/[name].[hash].[format].js', + format: 'esm', + sourcemap: true + }, + plugins: [ + del({ + targets: 'dist/*' + }), + consts({ + environment: build, + }), + resolve(), + commonjs(), + json(), + url({ + limit: 0, + emitFiles: true, + fileName: 'shared/[name].[hash][extname]' + }), + (build !== 'local' && build !== 'test') ? terser() : false, + copy({ + targets: [ + {src: 'assets/index.html', dest: 'dist'}, + {src: 'assets/favicon.ico', dest: 'dist'}, + { + src: await getPackagePath('qr-scanner', 'qr-scanner-worker.min.js'), + dest: 'dist/local/dbp-qr-scanner' + }, + ] + }), + (process.env.ROLLUP_WATCH === 'true') ? serve({ + contentBase: 'dist', + host: '127.0.0.1', + port: 8002, + https: USE_HTTPS ? generateTLSConfig() : false + }) : false + ] + } +}); diff --git a/packages/qr-code-scanner/src/dbp-qr-code-scanner-demo.js b/packages/qr-code-scanner/src/dbp-qr-code-scanner-demo.js new file mode 100644 index 00000000..d3130a9e --- /dev/null +++ b/packages/qr-code-scanner/src/dbp-qr-code-scanner-demo.js @@ -0,0 +1,61 @@ +import {i18n} from './i18n'; +import {css, html, LitElement} from 'lit-element'; +import {ScopedElementsMixin} from '@open-wc/scoped-elements'; +import * as commonUtils from 'dbp-common/utils'; +import * as commonStyles from "dbp-common/styles"; +import {QrCodeScanner} from './qr-code-scanner.js'; + +class QrCodeScannerDemo extends ScopedElementsMixin(LitElement) { + constructor() { + super(); + this.lang = 'de'; + } + + static get scopedElements() { + return { + 'dbp-qr-code-scanner': QrCodeScanner, + }; + } + + static get properties() { + return { + lang: { type: String }, + }; + } + + connectedCallback() { + super.connectedCallback(); + i18n.changeLanguage(this.lang); + + this.updateComplete.then(()=>{ + }); + } + + static get styles() { + // language=css + return css` + ${commonStyles.getThemeCSS()} + ${commonStyles.getGeneralCSS()} + ${commonStyles.getButtonCSS()} + `; + } + + render() { + return html` + <section class="section"> + <div class="container"> + <h1 class="title">QR-Code-Scanner-Demo</h1> + </div> + <div class="container"> + <div class="columns is-centered"> + <div class="column"> + <dbp-qr-code-scanner lang="${this.lang}"></dbp-qr-code-scanner> + </div> + </div> + </div> + </section> + `; + } +} + +commonUtils.defineCustomElement('dbp-qr-code-scanner-demo', QrCodeScannerDemo); diff --git a/packages/qr-code-scanner/src/dbp-qr-code-scanner.js b/packages/qr-code-scanner/src/dbp-qr-code-scanner.js new file mode 100644 index 00000000..ed081689 --- /dev/null +++ b/packages/qr-code-scanner/src/dbp-qr-code-scanner.js @@ -0,0 +1,3 @@ +import * as commonUtils from 'dbp-common/utils'; + +commonUtils.defineCustomElement('dbp-qr-code-scanner', QrCodeScanner); diff --git a/packages/qr-code-scanner/src/i18n.js b/packages/qr-code-scanner/src/i18n.js new file mode 100644 index 00000000..3fb3a1af --- /dev/null +++ b/packages/qr-code-scanner/src/i18n.js @@ -0,0 +1,6 @@ +import {createInstance} from 'dbp-common/i18next.js'; + +import de from './i18n/de/translation.json'; +import en from './i18n/en/translation.json'; + +export const i18n = createInstance({en: en, de: de}, 'de', 'en'); \ No newline at end of file diff --git a/packages/qr-code-scanner/src/i18n/de/translation.json b/packages/qr-code-scanner/src/i18n/de/translation.json new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/packages/qr-code-scanner/src/i18n/de/translation.json @@ -0,0 +1,2 @@ +{ +} diff --git a/packages/qr-code-scanner/src/i18n/en/translation.json b/packages/qr-code-scanner/src/i18n/en/translation.json new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/packages/qr-code-scanner/src/i18n/en/translation.json @@ -0,0 +1,2 @@ +{ +} diff --git a/packages/qr-code-scanner/src/index.js b/packages/qr-code-scanner/src/index.js new file mode 100644 index 00000000..11bdb409 --- /dev/null +++ b/packages/qr-code-scanner/src/index.js @@ -0,0 +1,3 @@ +import {QrCodeScanner} from './qr-code-scanner.js'; + +export {QrCodeScanner}; \ No newline at end of file diff --git a/packages/qr-code-scanner/src/qr-code-scanner.js b/packages/qr-code-scanner/src/qr-code-scanner.js new file mode 100644 index 00000000..6d97c1cd --- /dev/null +++ b/packages/qr-code-scanner/src/qr-code-scanner.js @@ -0,0 +1,64 @@ +import {i18n} from './i18n'; +import {css, html} from 'lit-element'; +import DBPLitElement from 'dbp-common/dbp-lit-element'; +import * as commonStyles from 'dbp-common/styles'; +import {Icon, MiniSpinner} from 'dbp-common'; +import {classMap} from 'lit-html/directives/class-map.js'; +import QrScanner from 'qr-scanner'; +import * as commonUtils from "dbp-common/utils"; + +/** + * Notification web component + */ +export class QrCodeScanner extends DBPLitElement { + constructor() { + super(); + this.lang = 'de'; + } + + /** + * See: https://lit-element.polymer-project.org/guide/properties#initialize + */ + static get properties() { + return { + lang: { type: String }, + }; + } + + connectedCallback() { + super.connectedCallback(); + i18n.changeLanguage(this.lang); + const that = this; + + this.updateComplete.then(()=>{ + QrScanner.WORKER_PATH = commonUtils.getAssetURL('dbp-qr-scanner', 'qr-scanner-worker.min.js'); + const qrScanner = new QrScanner(this._('#reader'), result => console.log('decoded qr code:', result), undefined, undefined, 'user'); + qrScanner.start(); + }); + } + + static get styles() { + // language=css + return css` + ${commonStyles.getThemeCSS()} + ${commonStyles.getGeneralCSS()} + `; + } + + //todo check for cam: QrScanner.hasCamera(); + //start stop button + //doku + //demo + //quadrat + + render() { + return html` + <div class="columns"> + <div class="column" id="qr"> + <button class="start">start scanning</button> + <video id="reader"></video> + </div> + </div> + `; + } +} \ No newline at end of file diff --git a/packages/qr-code-scanner/src/qr-scanner-worker.min.js b/packages/qr-code-scanner/src/qr-scanner-worker.min.js new file mode 100644 index 00000000..db03438f --- /dev/null +++ b/packages/qr-code-scanner/src/qr-scanner-worker.min.js @@ -0,0 +1,87 @@ +'use strict';(function(){function T(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let d=0;d<b;d++){let b=a.readBits(8);c.push(b)}try{d+=decodeURIComponent(c.map(a=>`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);b=9>=b?0:26>=b?1:2;let c={text:"",bytes:[],chunks:[]};for(;4<=a.available();){var d=a.readBits(4);if(d===y.Terminator)return c;if(d===y.ECI)0===a.readBits(1)?c.chunks.push({type:t.ECI,assignmentNumber:a.readBits(7)}):0===a.readBits(1)? +c.chunks.push({type:t.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?c.chunks.push({type:t.ECI,assignmentNumber:a.readBits(21)}):c.chunks.push({type:t.ECI,assignmentNumber:-1});else if(d===y.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][b]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),l=Math.floor(h/10)%10;h%=10;d.push(48+k,48+l,48+h);f+=k.toString()+l.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);if(100<= +g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};c.text+=d.text;c.bytes.push(...d.bytes);c.chunks.push({type:t.Numeric,text:d.text})}else if(d===y.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][b]);2<=g;)l=e.readBits(11),k=Math.floor(l/45),l%=45,d.push(B[k].charCodeAt(0),B[l].charCodeAt(0)), +f+=B[k]+B[l],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};c.text+=d.text;c.bytes.push(...d.bytes);c.chunks.push({type:t.Alphanumeric,text:d.text})}else if(d===y.Byte)d=T(a,b),c.text+=d.text,c.bytes.push(...d.bytes),c.chunks.push({type:t.Byte,bytes:d.bytes,text:d.text});else if(d===y.Kanji){f=a;d=[];e=f.readBits([8,10,12][b]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d)); +d={bytes:d,text:f};c.text+=d.text;c.bytes.push(...d.bytes);c.chunks.push({type:t.Kanji,bytes:d.bytes,text:d.text})}}if(0===a.available()||0===a.readBits(a.available()))return c}function J(a,b){return a^b}function W(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null;c=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()), +g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285,256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c; +d=new w(a,e);d=W(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;d=d[1];e=b.length;f=Array(e);for(g=0;g<e;g++){h=a.inverse(b[g]);let c=1;for(let d=0;d<e;d++)g!==d&&(c=a.multiply(c,J(1,a.multiply(b[d],h))));f[g]=a.multiply(d.evaluateAt(h),a.inverse(c));0!==a.generatorBase&&(f[g]=a.multiply(f[g],h))}d=f;for(e=0;e<b.length;e++){f= +c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===g&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9, +6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=f;g=[];e=h=0;f=!0;for(let k=d-1;0<k;k-=2){6===k&&k--;for(let l=0;l<d;l++){let q=f?d-1-l:l;for(let d=0;2>d;d++){let f=k-d;if(!b.get(f,q)){e++;let b=a.get(f,q);c({y:q,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c-1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>= +b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b<a&&(f=e,a=b);b=E(d,e.infoBits);b<a&&(f=e,a=b)}if(3>=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e<d;e++)c=C(a.get(e,8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of da){if(f===b||f===c)return g;e=E(b,f);e<a&&(d=g,a=e); +b!==c&&(e=E(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;b<a.numBlocks;b++)e.push({numDataCodewords:a.dataCodewordsPerBlock,codewords:[]}),f+=a.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());if(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c< +b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let b of e)b.codewords.push(a.shift());return e}function L(a){let b=ba(a);if(!b)return null;var c=ca(a);if(!c)return null;a=Z(a,b,c);var d=ea(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((a,b)=>a+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e=0;e<b.numDataCodewords;e++)c[a++]=d[e]}try{return U(c,b.versionNumber)}catch(e){return null}} +function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};{let h=b.x-c.x;var g=d.x-c.x;let k=b.y-c.y,l=d.y-c.y;c=h*l-g*k;g=(e*l-g*f)/c;e=(h*f-e*k)/c;return{a11:b.x-a.x+g*b.x,a12:b.y-a.y+g*b.y,a13:g,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}}function fa(a,b,c,d){a=M(a,b,c,d);return{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22, +a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}function ha(a,b){var c=fa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+d.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31* +c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,l=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,q=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,p=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,m=d.a13*c.a31+d.a23*c.a32+d.a33*c.a33;c=A.createEmpty(b.dimension,b.dimension);d=(a,b)=>{const c=g*a+l*b+m;return{x:(e*a+h*b+q)/c,y:(f*a+k*b+p)/c}};for(let e=0;e<b.dimension;e++)for(let f=0;f<b.dimension;f++){let b=d(f+.5,e+.5);c.set(f,e,a.get(Math.floor(b.x),Math.floor(b.y)))}return{matrix:c,mappingFunction:d}}function u(a){return a.reduce((a, +c)=>a+c)}function ia(a,b,c){let d=x(a,b),e=x(b,c),f=x(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(u(z(a,c,d,5))/7+u(z(a,b,d,5))/7+u(z(c,a,d,5))/7+u(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(x(a,b)/d);a=Math.round(x(a,c)/d);a=Math.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}} +function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),l=Math.abs(b-h),q=Math.floor(-k/2),p=g<a?1:-1,m=h<b?1:-1,r=!0;for(let n=g,v=h;n!==a+p;n+=p){g=f?v:n;h=f?n:v;if(c.get(g,h)!==r&&(r=!r,e.push({x:g,y:h}),e.length===d+1))break;q+=l;if(0<q){if(v===b)break;v+=m;q-=k}}c= +[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(x(e[f],e[f+1])):c.push(0);return c}function z(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=N(a,b,c,Math.ceil(d/2));a=N(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function F(a,b){let c=u(a)/u(b),d=0;b.forEach((b,f)=>{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length),e=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length), +g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),l=F(f,b),q=F(g,b),p=(h.averageSize+k.averageSize+l.averageSize+q.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+l.error*l.error+q.error*q.error)+(Math.pow(h.averageSize-p,2)+Math.pow(k.averageSize-p,2)+Math.pow(l.averageSize-p,2)+Math.pow(q.averageSize-p,2))/p}catch(d){return Infinity}}function H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d, +Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[],d=[],e=[];for(let m=0;m<=a.height;m++){var f=0;let l=!1,n=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var g=a.get(b,m);if(g===l)f++;else{n=[n[1],n[2],n[3],n[4],f];f=1;l=g;var h=u(n)/7;h=Math.abs(n[0]-h)<h&&Math.abs(n[1]-h)<h&&Math.abs(n[2]-3*h)<3*h&&Math.abs(n[3]-h)<h&&Math.abs(n[4]-h)<h&&!g;var k=u(n.slice(-3))/3;g=Math.abs(n[2]- +k)<k&&Math.abs(n[3]-k)<k&&Math.abs(n[4]-k)<k&&g;if(h){let a=b-n[3]-n[4],d=a-n[2];h={startX:d,endX:a,y:m};k=c.filter(b=>d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>n[2]/(b.bottom.endX-b.bottom.startX)&&.5<n[2]/(b.bottom.endX-b.bottom.startX));0<k.length?k[0].bottom=h:c.push({top:h,bottom:h})}if(g){let a=b-n[4],c=a-n[3];g={startX:c,y:m,endX:a};h=e.filter(b=>c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX|| +c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>n[2]/(b.bottom.endX-b.bottom.startX)&&.5<n[2]/(b.bottom.endX-b.bottom.startX));0<h.length?h[0].bottom=g:e.push({top:g,bottom:g})}}}b.push(...c.filter(a=>a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e);b=b.filter(a=>2<=a.bottom.y-a.top.y).map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/ +4,d=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.round(c),Math.round(d)))return b=[b.top.endX-b.top.startX,b.bottom.endX-b.bottom.startX,b.bottom.y-b.top.y+1],b=u(b)/b.length,{score:O({x:Math.round(c),y:Math.round(d)},[1,1,3,1,1],a),x:c,y:d,size:b}}).filter(a=>!!a).sort((a,b)=>a.score-b.score).map((a,b,c)=>{if(4<b)return null;c=c.filter((a,c)=>b!==c).map(b=>({x:b.x,y:b.y,score:b.score+Math.pow(b.size-a.size,2)/a.size,size:b.size})).sort((a,b)=>a.score-b.score);if(2>c.length)return null;const d=a.score+ +c[0].score+c[1].score;return{points:[a].concat(c.slice(0,2)),score:d}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);if(0===b.length)return null;let {topRight:l,topLeft:q,bottomLeft:p}=ia(b[0].points[0],b[0].points[1],b[0].points[2]);c=P(a,d,l,q,p);b=[];c&&b.push({alignmentPattern:{x:c.alignmentPattern.x,y:c.alignmentPattern.y},bottomLeft:{x:p.x,y:p.y},dimension:c.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:l.x,y:l.y}});c=H(a,l);e=H(a,q);f=H(a,p);(d=P(a,d,c,e,f))&&b.push({alignmentPattern:{x:d.alignmentPattern.x, +y:d.alignmentPattern.y},bottomLeft:{x:f.x,y:f.y},topLeft:{x:e.x,y:e.y},topRight:{x:c.x,y:c.y},dimension:d.dimension});return 0===b.length?null:b}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(q){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(x(d,e)+x(d,c))/2/g;e=1-3/c;let l={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4,d=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(d)))return u([b.top.endX- +b.top.startX,b.bottom.endX-b.bottom.startX,b.bottom.y-b.top.y+1]),b=O({x:Math.floor(c),y:Math.floor(d)},[1,1,1],a)+x({x:c,y:d},l),{x:c,y:d,score:b}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:l,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let a=d+1;a<c.height;a++)c.get(d,a)!==c.get(a,d)&&(c.set(d,a,!c.get(d,a)),c.set(a,d,!c.get(a, +d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,location:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}function R(a,b){Object.keys(b).forEach(c=>{a[c]= +b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d);d="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var l=0;if(h){var q=new Uint8ClampedArray(a.buffer,l,k);l+=k}q=new S(b,c,q);if(g.useIntegerApproximation)for(var p=0;p<c;p++)for(var m=0;m<b;m++){var r=4*(p*b+m);q.set(m,p,g.red*a[r]+g.green* +a[r+1]+g.blue*a[r+2]+128>>8)}else for(p=0;p<c;p++)for(m=0;m<b;m++)r=4*(p*b+m),q.set(m,p,g.red*a[r]+g.green*a[r+1]+g.blue*a[r+2]);g=Math.ceil(b/8);p=Math.ceil(c/8);m=g*p;if(h){var n=new Uint8ClampedArray(a.buffer,l,m);l+=m}n=new S(g,p,n);for(m=0;m<p;m++)for(r=0;r<g;r++){var v=Infinity,t=0;for(var u=0;8>u;u++)for(let a=0;8>a;a++){let b=q.get(8*r+a,8*m+u);v=Math.min(v,b);t=Math.max(t,b)}u=(v+t)/2;u=Math.min(255,1.1*u);24>=t-v&&(u=v/2,0<m&&0<r&&(t=(n.get(r,m-1)+2*n.get(r-1,m)+n.get(r-1,m-1))/4,v<t&&(u= +t)));n.set(r,m,u)}h?(m=new Uint8ClampedArray(a.buffer,l,k),l+=k,m=new A(m,b)):m=A.createEmpty(b,c);r=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,l,k),r=new A(a,b)):r=A.createEmpty(b,c));for(b=0;b<p;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=p-3;h=2>b?2:b>h?h:b;k=0;for(l=-2;2>=l;l++)for(v=-2;2>=v;v++)k+=n.get(c+l,h+v);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)l=8*a+h,v=8*b+k,t=q.get(l,v),m.set(l,v,t<=c),f&&r.set(l,v,!(t<=c))}f=f?{binarized:m,inverted:r}:{binarized:m};let {binarized:w,inverted:x}=f; +(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let b=a;b<a+c;b++)this.set(b,f,!!e)}}class S{constructor(a,b,c){this.width= +a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}class V{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset= +0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var t;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci"})(t||(t={}));var y;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte= +4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI"})(y||(y={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length- +1}isZero(){return 0===this.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new w(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length, +c=new Uint8ClampedArray(b);for(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new w(this.field,c)}multiplyPoly(a){if(this.isZero()||a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let h=0;h<c;h++){let c=b[h];for(let b=0;b<d;b++){var f=h+b,g=this.field.multiply(c,a[b]);e[f]=e[h+b]^g}}return new w(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0=== +b)return this.field.zero;let c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new w(this.field,a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(a=>{b^=a}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=J(this.field.multiply(a,b),this.coefficients[d]);return b}}class Y{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase= +c;this.expTable=Array(this.size);this.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new w(this,Uint8ClampedArray.from([0]));this.one=new w(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===a)throw Error("Can't invert 0");return this.expTable[this.size- +this.logTable[a]-1]}buildMonomial(a,b){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can't take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}, +{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1, +dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20, +ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]}, +{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4, +dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4, +dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4, +dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4, +dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]}, +{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20}, +{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20}, +{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20, +ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5, +dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7, +dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120}, +{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28, +ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34, +62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683, +versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]}, +{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23, +alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]}, +{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16}, +{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6, +dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8, +dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]}, +{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45}, +{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28, +ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115}, +{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6, +34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]}, +{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22, +dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]}, +{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49, +dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]}, +{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40, +dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1, +dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877, +formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3, +dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2, +dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],x=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126, +green:.7152,blue:.0722,useIntegerApproximation:!1},canOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G= +"dontInvert";break;case "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})() +//# sourceMappingURL=qr-scanner-worker.min.js.map diff --git a/packages/qr-code-scanner/test/unit.js b/packages/qr-code-scanner/test/unit.js new file mode 100644 index 00000000..78bd50cb --- /dev/null +++ b/packages/qr-code-scanner/test/unit.js @@ -0,0 +1,19 @@ +import '../src/dbp-qr-code-scanner'; + +describe('dbp-qr-code-scanner basics', () => { + let node; + + beforeEach(async () => { + node = document.createElement('dbp-qr-code-scanner'); + document.body.appendChild(node); + await node.updateComplete; + }); + + afterEach(() => { + node.remove(); + }); + + it('should render', () => { + expect(node).to.have.property('shadowRoot'); + }); +}); -- GitLab