From 640ebb99ed6c937a404a919102bab9dd02dce3b4 Mon Sep 17 00:00:00 2001 From: surrim Date: Fri, 31 Jan 2020 06:12:07 +0100 Subject: [PATCH] created geo plugins --- serendipity_event_geo_json/LICENSE | 674 ++++++++++++++++++ serendipity_event_head_geo/lang_en.inc.php | 5 + .../serendipity_event_head_geo.php | 108 +++ serendipity_event_osm/LICENSE | 674 ++++++++++++++++++ serendipity_event_osm/lang_en.inc.php | 14 + serendipity_event_osm/ol.css | 2 + serendipity_event_osm/ol.css.map | 1 + serendipity_event_osm/ol.js | 13 + serendipity_event_osm/ol.js.map | 1 + serendipity_event_osm/osm.css | 59 ++ serendipity_event_osm/osm.js | 135 ++++ .../serendipity_event_osm.php | 82 +++ serendipity_event_static_osm/LICENSE | 674 ++++++++++++++++++ 13 files changed, 2442 insertions(+) create mode 100644 serendipity_event_geo_json/LICENSE create mode 100644 serendipity_event_head_geo/lang_en.inc.php create mode 100644 serendipity_event_head_geo/serendipity_event_head_geo.php create mode 100644 serendipity_event_osm/LICENSE create mode 100644 serendipity_event_osm/lang_en.inc.php create mode 100644 serendipity_event_osm/ol.css create mode 100644 serendipity_event_osm/ol.css.map create mode 100644 serendipity_event_osm/ol.js create mode 100644 serendipity_event_osm/ol.js.map create mode 100644 serendipity_event_osm/osm.css create mode 100644 serendipity_event_osm/osm.js create mode 100644 serendipity_event_osm/serendipity_event_osm.php create mode 100644 serendipity_event_static_osm/LICENSE diff --git a/serendipity_event_geo_json/LICENSE b/serendipity_event_geo_json/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/serendipity_event_geo_json/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program 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, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU 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. But first, please read +. diff --git a/serendipity_event_head_geo/lang_en.inc.php b/serendipity_event_head_geo/lang_en.inc.php new file mode 100644 index 00000000..2ec6e32b --- /dev/null +++ b/serendipity_event_head_geo/lang_en.inc.php @@ -0,0 +1,5 @@ +add('name', HEAD_GEO_TITLE); + $propbag->add('description', HEAD_GEO_DESCRIPTION); + $propbag->add('copyright', 'GPL'); + $propbag->add('configuration', array('content')); + $propbag->add('event_hooks', array('frontend_header' => true)); + $propbag->add('author', 'Martin Sewelies'); + $propbag->add('version', '0.1'); + $propbag->add('requirements', array('serendipity' => '2.3')); + $propbag->add('stackable', true); + $propbag->add('groups', array('BACKEND_METAINFORMATION')); + } + + function generate_content(&$title) + { + $title = $this->title; + } + + function event_hook($event, &$bag, &$eventData, $addData = null) + { + global $serendipity; + if ($event == 'frontend_header') { + $tt = serendipity_db_query( + "SELECT e.title, p.permalink, e.timestamp, LENGTH(e.body) AS size, a.realname, e2.value AS lat, e1.value AS lng + FROM {$serendipity['dbPrefix']}entries e + JOIN {$serendipity['dbPrefix']}entryproperties e1 ON (e1.entryid = e.id AND e1.property='geo_long') + JOIN {$serendipity['dbPrefix']}entryproperties e2 ON (e2.entryid = e.id AND e2.property='geo_lat') + LEFT JOIN {$serendipity['dbPrefix']}permalinks p ON (p.entry_id = e.id AND p.type='entry') + LEFT JOIN {$serendipity['dbPrefix']}authors a ON (a.authorid = e.authorid) + WHERE e.isdraft = 'false' + ORDER BY p.permalink" + ); + + $entries = []; + if (is_array($tt)) { + foreach ($tt as $t) { + $entries[] = [ + 'title' => $t['title'], + 'url' => $serendipity['serendipityHTTPPath'].$t['permalink'], + 'date' => (int)$t['timestamp'], + 'size' => (int)$t['size'], + 'author' => $t['realname'], + 'pos' => [(double)$t['lat'], (double)$t['lng']] + ]; + } + } + + $tt = serendipity_db_query( + "SELECT i.realname, i.path, IFNULL(m.value, i.date) AS date, i.size + FROM {$serendipity['dbPrefix']}images i + LEFT JOIN {$serendipity['dbPrefix']}mediaproperties m ON ( + m.mediaid = i.id AND m.property='DATE' AND m.property_group = 'base_property' AND property_subgroup = '' + ) + WHERE i.extension = 'gpx' + ORDER BY i.path, i.realname" + ); + + $uploads = []; + if (is_array($tt)) { + foreach ($tt as $t) { + $uploads[] = [ + 'title' => $t['realname'], + 'url' => $serendipity['serendipityHTTPPath'].$serendipity['uploadPath'].$t['path'].$t['realname'], + 'date' => (int)$t['date'], + 'size' => (int)$t['size'] + ]; + } + } + + $object = [ + 'entries' => $entries, + 'uploads' => $uploads + ]; + echo " \n"; + //echo $this->get_config('content'); //TODO + } + } + + function introspect_config_item($name, &$propbag) + { + switch($name) { + case 'content': + $propbag->add('type', 'text'); + $propbag->add('name', CONTENT); + $propbag->add('description', THE_NUGGET); + $propbag->add('default', ''); + break; + default: + return false; + } + return true; + } +} + +?> diff --git a/serendipity_event_osm/LICENSE b/serendipity_event_osm/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/serendipity_event_osm/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program 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, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU 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. But first, please read +. diff --git a/serendipity_event_osm/lang_en.inc.php b/serendipity_event_osm/lang_en.inc.php new file mode 100644 index 00000000..35e229b6 --- /dev/null +++ b/serendipity_event_osm/lang_en.inc.php @@ -0,0 +1,14 @@ +i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(s-h)/s)*(u-s/2<0?-1:1);t(r,n,Math.max(i,Math.floor(n-u*h/s+c)),Math.min(o,Math.floor(n+(s-u)*h/s+c)),a)}var p=r[n],f=i,d=o;for(e(r,i,n),a(r[o],p)>0&&e(r,i,o);f0;)d--}0===a(r[i],p)?e(r,i,d):e(r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(t,n,i||0,o||t.length-1,a||r)}function e(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function r(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(e,r,n,i,o){for(var a=[r,n];a.length;)if(!((n=a.pop())-(r=a.pop())<=i)){var s=r+Math.ceil((n-r)/i/2)*i;t(e,s,r,n,o),a.push(r,s,s,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,r=[];if(!f(t,e))return r;for(var n=this.toBBox,i=[];e;){for(var o=0;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)},n.prototype._split=function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var a=this._chooseSplitIndex(r,i,n),s=d(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,o(r,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},n.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,r){for(var n,i,o,s,u,l,c,p=1/0,f=1/0,d=e;d<=r-e;d++){var _=a(t,0,d,this.toBBox),g=a(t,d,r,this.toBBox),y=(i=_,o=g,s=Math.max(i.minX,o.minX),u=Math.max(i.minY,o.minY),l=Math.min(i.maxX,o.maxX),c=Math.min(i.maxY,o.maxY),Math.max(0,l-s)*Math.max(0,c-u)),v=h(_)+h(g);y=e;f--){var d=t.children[f];s(u,t.leaf?i(d):d),l+=c(u)}return l},n.prototype._adjustParentBBoxes=function(t,e,r){for(var n=r;n>=0;n--)s(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,r=void 0;e>=0;e--)0===t[e].children.length?e>0?(r=t[e-1].children).splice(r.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},n}()},function(t,e,r){ +/*! + * PEP v0.5.3 | https://github.com/jquery/PEP + * Copyright jQuery Foundation and other contributors | http://jquery.org/license + */ +t.exports=function(){"use strict";var t=["bubbles","cancelable","view","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],e=[!1,!1,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0];function r(r,n){n=n||Object.create(null);var i=document.createEvent("Event");i.initEvent(r,n.bubbles||!1,n.cancelable||!1);for(var o,a=2;a0){var e=this.events;t.addEventListener("touchend",function(){t._scrollType=void 0,l.unlisten(t,e)})}else t._scrollType=void 0,l.unlisten(t,this.events);b(t).forEach(function(t){t._scrollType=void 0,l.unlisten(t,this.events)},this)},elementChanged:function(t,e){var r=t.getAttribute("touch-action"),n=this.touchActionToScrollType(r),i=this.touchActionToScrollType(e);"number"==typeof n&&"number"==typeof i?(t._scrollType=n,b(t).forEach(function(t){t._scrollType=n},this)):"number"==typeof i?this.elementRemoved(t):"number"==typeof n&&this.elementAdded(t)},scrollTypes:{UP:function(t){return t.includes("pan-y")||t.includes("pan-up")?1:0},DOWN:function(t){return t.includes("pan-y")||t.includes("pan-down")?2:0},LEFT:function(t){return t.includes("pan-x")||t.includes("pan-left")?4:0},RIGHT:function(t){return t.includes("pan-x")||t.includes("pan-right")?8:0}},touchActionToScrollType:function(t){if(t){if("auto"===t)return 15;if("none"===t)return 0;var e=t.split(" "),r=this.scrollTypes;return r.UP(e)|r.DOWN(e)|r.LEFT(e)|r.RIGHT(e)}},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===L.size||1===L.size&&L.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.scrolling=!1)},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null)},typeToButtons:function(t){var e=0;return"touchstart"!==t&&"touchmove"!==t&&"touchforcechange"!==t||(e=1),e},touchToPointer:function(t){var e=this.currentTouchEvent,r=l.cloneEvent(t),n=r.pointerId=t.identifier+2;if(r.target=P[n]||I(r),r.bubbles=!0,r.cancelable=!0,r.button=0,r.buttons=this.typeToButtons(e.type),r.width=2*(t.radiusX||t.webkitRadiusX||0),r.height=2*(t.radiusY||t.webkitRadiusY||0),r.pressure=void 0!==t.force?t.force:void 0!==t.webkitForce?t.webkitForce:void 0,r.isPrimary=this.isPrimaryTouch(t),t.altitudeAngle){var i=Math.tan(t.altitudeAngle),o=180/Math.PI;r.tiltX=Math.atan(Math.cos(t.azimuthAngle)/i)*o,r.tiltY=Math.atan(Math.sin(t.azimuthAngle)/i)*o}else r.tiltX=0,r.tiltY=0;"stylus"===t.touchType?r.pointerType="pen":r.pointerType=this.POINTER_TYPE,r.altKey=e.altKey,r.ctrlKey=e.ctrlKey,r.metaKey=e.metaKey,r.shiftKey=e.shiftKey;var a=this;return r.preventDefault=function(){a.scrolling=!1,a.firstXY=null,e.preventDefault()},r},processTouches:function(t,e){var r=t.changedTouches;this.currentTouchEvent=t;for(var n,i=0;io:h?e=s>o&&a>0:c&&(e=s>o&&a<0),e||(u&&l?e=s0:l&&(e=s=e.length){var r=[];L.forEach(function(t,n){if(1!==n&&!this.findTouch(e,n-2)){var i=t.out;r.push(i)}},this),r.forEach(this.cancelOut,this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||this.processTouches(t,this.overDown)},overDown:function(t){L.set(t.pointerId,{target:t.target,out:t,outTarget:t.target}),l.enterOver(t),l.down(t)},touchforcechange:function(t){this.touchmove(t)},touchmove:function(t){this.scrolling||(this.shouldScroll(t)?(this.scrolling=!0,this.touchcancel(t)):("touchforcechange"!==t.type&&t.preventDefault(),this.processTouches(t,this.moveOverOut)))},moveOverOut:function(t){var e=t,r=L.get(e.pointerId);if(r){var n=r.out,i=r.outTarget;l.move(e),n&&i!==e.target&&(n.relatedTarget=e.target,e.relatedTarget=i,n.target=i,e.target?(l.leaveOut(n),l.enterOver(e)):(e.target=i,e.relatedTarget=null,this.cancelOut(e))),r.out=e,r.outTarget=e.target}},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.upOut)},upOut:function(t){this.scrolling||(l.up(t),l.leaveOut(t)),this.cleanUpPointer(t)},touchcancel:function(t){this.processTouches(t,this.cancelOut)},cancelOut:function(t){l.cancel(t),l.leaveOut(t),this.cleanUpPointer(t)},cleanUpPointer:function(t){L.delete(t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(t){var e=C.lastTouches,r=t.changedTouches[0];if(this.isPrimaryTouch(r)){var n={x:r.clientX,y:r.clientY};e.push(n);var i=function(t,e){var r=t.indexOf(e);r>-1&&t.splice(r,1)}.bind(null,e,n);setTimeout(i,2500)}}};R=new y(M.elementAdded,M.elementRemoved,M.elementChanged,M);var F,A,N,D=l.pointermap,G=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,j={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(t){l.listen(t,this.events)},unregister:function(t){l.unlisten(t,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(t){var e=t;return G&&((e=l.cloneEvent(t)).pointerType=this.POINTER_TYPES[t.pointerType]),e},cleanup:function(t){D.delete(t)},MSPointerDown:function(t){D.set(t.pointerId,t);var e=this.prepareEvent(t);l.down(e)},MSPointerMove:function(t){var e=this.prepareEvent(t);l.move(e)},MSPointerUp:function(t){var e=this.prepareEvent(t);l.up(e),this.cleanup(t.pointerId)},MSPointerOut:function(t){var e=this.prepareEvent(t);l.leaveOut(e)},MSPointerOver:function(t){var e=this.prepareEvent(t);l.enterOver(e)},MSPointerCancel:function(t){var e=this.prepareEvent(t);l.cancel(e),this.cleanup(t.pointerId)},MSLostPointerCapture:function(t){var e=l.makeEvent("lostpointercapture",t);l.dispatchEvent(e)},MSGotPointerCapture:function(t){var e=l.makeEvent("gotpointercapture",t);l.dispatchEvent(e)}};function k(t){if(!l.pointermap.has(t)){var e=new Error("NotFoundError");throw e.name="NotFoundError",e}}function U(t){for(var e=t.parentNode;e&&e!==t.ownerDocument;)e=e.parentNode;if(!e){var r=new Error("InvalidStateError");throw r.name="InvalidStateError",r}}function B(t){return 0!==l.pointermap.get(t).buttons}return window.navigator.msPointerEnabled?(F=function(t){k(t),U(this),B(t)&&(l.setCapture(t,this,!0),this.msSetPointerCapture(t))},A=function(t){k(t),l.releaseCapture(t,!0),this.msReleasePointerCapture(t)}):(F=function(t){k(t),U(this),B(t)&&l.setCapture(t,this)},A=function(t){k(t),l.releaseCapture(t)}),N=function(t){return!!l.captureInfo[t]},function(){if(T){m.forEach(function(t){E+=t.selector+v(t.value)+"\n",S&&(E+=function(t){return"body /shadow-deep/ "+t}(t.selector)+v(t.value)+"\n")});var t=document.createElement("style");t.textContent=E,document.head.appendChild(t)}}(),function(){if(!window.PointerEvent){if(window.PointerEvent=r,window.navigator.msPointerEnabled){var t=window.navigator.msMaxTouchPoints;Object.defineProperty(window.navigator,"maxTouchPoints",{value:t,enumerable:!0}),l.registerSource("ms",j)}else Object.defineProperty(window.navigator,"maxTouchPoints",{value:0,enumerable:!0}),l.registerSource("mouse",C),void 0!==window.ontouchstart&&l.registerSource("touch",M);l.register(document)}}(),window.Element&&!Element.prototype.setPointerCapture&&Object.defineProperties(Element.prototype,{setPointerCapture:{value:F},releasePointerCapture:{value:A},hasPointerCapture:{value:N}}),{dispatcher:l,Installer:y,PointerEvent:r,PointerMap:n,targetFinding:h}}()},function(t,e,r){"use strict";t.exports=i;var n=r(4);function i(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(t){return t.type===i.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function l(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function E(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=E(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=v(this.buf,this.pos)+4294967296*v(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=v(this.buf,this.pos)+4294967296*E(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return s(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&o?function(t,e,r){return o.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){var n="",i=e;for(;i239?4:u>223?3:u>191?2:1;if(i+h>r)break;1===h?u<128&&(l=u):2===h?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===h?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=h}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==i.Bytes)return t.push(this.readVarint(e));var r=a(this);for(t=t||[];this.pos127;);else if(e===i.Bytes)this.pos=this.readVarint()+this.pos;else if(e===i.Fixed32)this.pos+=4;else{if(e!==i.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&u(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&u(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,i.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writeBytesField:function(t,e){this.writeTag(t,i.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,i.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,i.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,i.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,r){var n=r(5);e.Processor=n},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,p=r?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=p,h-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,l-=8);t[r+f-d]|=128*_}},function(t,e,r){var n=r(6).newImageData;function i(t){var e=!0;try{new ImageData(10,10)}catch(t){e=!1}function r(t,r,n){return e?new ImageData(t,r,n):{data:t,width:r,height:n}}return function(e){var n,i,o=e.buffers,a=e.meta,s=e.imageOps,u=e.width,l=e.height,h=o.length,c=o[0].byteLength;if(s){var p=new Array(h);for(i=0;ithis._maxQueueLength;)this._queue.shift().callback(null,null)},a.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._job=this._queue.shift(),e=t.inputs[0].width,r=t.inputs[0].height,n=t.inputs.map(function(t){return t.data.buffer}),i=this._workers.length;if(this._running=i,1===i)this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:r},n);else for(var o=t.inputs[0].data.length,a=4*Math.ceil(o/4/i),s=0;se?1:t=0}function S(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i>>0,i=0;i0},e.prototype.removeEventListener=function(t,e){var r=this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(t in this.pendingRemovals_?(r[n]=b,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(m),N={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",WHEEL:"wheel"},D=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var G=function(t){function e(){var e=t.call(this)||this;return e.revision_=0,e}return D(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(N.CHANGE)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var r=t.length,n=new Array(r),i=0;i0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;ei&&(u|=Q.RIGHT),so&&(u|=Q.ABOVE),u===Q.UNKNOWN&&(u=Q.INTERSECTING),u}function st(){return[1/0,1/0,-1/0,-1/0]}function ut(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function lt(t){return ut(1/0,1/0,-1/0,-1/0,t)}function ht(t,e){var r=t[0],n=t[1];return ut(r,n,r,n,e)}function ct(t,e,r,n,i){return gt(lt(i),t,e,r,n)}function pt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ft(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function dt(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function _t(t,e){for(var r=0,n=e.length;re[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Lt(t){return t[2]1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return Yt(t,e,r,n)}function Yt(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function zt(t){return 180*t/Math.PI}function Xt(t){return t*Math.PI/180}function Vt(t,e){var r=t%e;return r*e<0?r+e:r}function Wt(t,e,r){return t+r*(e-t)} +/** + * @license + * Latitude/longitude spherical geodesy formulae taken from + * http://www.movable-type.co.uk/scripts/latlong.html + * Licensed under CC-BY-3.0. + */var Zt=6371008.8;function Kt(t,e,r){var n=r||Zt,i=Xt(t[1]),o=Xt(e[1]),a=(o-i)/2,s=Xt(e[0]-t[0])/2,u=Math.sin(a)*Math.sin(a)+Math.sin(s)*Math.sin(s)*Math.cos(i)*Math.cos(o);return 2*n*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))}function Ht(t,e){for(var r=0,n=0,i=t.length;n1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=ie,s=0;sa?u=a:u<-a&&(u=-a),o[s+1]=u}return o}function he(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;a=2;--l)a[s+l]=e[s+l]}return a}}function Pe(t,e,r,n){var i=we(t),o=we(e);ye(i,o,Ce(r)),ye(o,i,Ce(n))}function Ie(t,e){if(t===e)return!0;var r=t.getUnits()===e.getUnits();return t.getCode()===e.getCode()?r:be(t,e)===Ee&&r}function be(t,e){var r=ve(t.getCode(),e.getCode());return r||(r=Te),r}function Le(t,e){return be(we(t),we(e))}function Me(t,e,r){return Le(e,r)(t,void 0,t.length)}function Fe(t,e,r){return Ft(t,Le(e,r))}var Ae,Ne,De,Ge=null;function je(){return Ge}function ke(t,e){return Ge?Me(t,e,Ge):t}function Ue(t,e){return Ge?Me(t,Ge,e):t}function Be(t,e){return Ge?Fe(t,e,Ge):t}function Ye(t,e){return Ge?Fe(t,Ge,e):t}Oe(ue),Oe(_e),Ae=ue,Ne=le,De=he,_e.forEach(function(t){Ae.forEach(function(e){ye(t,e,Ne),ye(e,t,De)})});var ze=new Array(6);function Xe(t){return We(t,1,0,0,1,0,0)}function Ve(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=e[0],l=e[1],h=e[2],c=e[3],p=e[4],f=e[5];return t[0]=r*u+i*l,t[1]=n*u+o*l,t[2]=r*h+i*c,t[3]=n*h+o*c,t[4]=r*p+i*f+a,t[5]=n*p+o*f+s,t}function We(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t}function Ze(t,e){var r=e[0],n=e[1];return e[0]=t[0]*r+t[2]*n+t[4],e[1]=t[1]*r+t[3]*n+t[5],e}function Ke(t,e,r){return Ve(t,We(ze,e,0,0,r,0,0))}function He(t,e,r,n,i,o,a,s){var u=Math.sin(o),l=Math.cos(o);return t[0]=n*l,t[1]=i*u,t[2]=-n*u,t[3]=i*l,t[4]=a*n*l-s*n*u+e,t[5]=a*i*u+s*i*l+r,t}function qe(t,e){var r,n=(r=e)[0]*r[3]-r[1]*r[2];K(0!==n,32);var i=e[0],o=e[1],a=e[2],s=e[3],u=e[4],l=e[5];return t[0]=s/n,t[1]=-o/n,t[2]=-a/n,t[3]=i/n,t[4]=(a*l-s*u)/n,t[5]=-(i*l-o*u)/n,t}function Je(t){return"matrix("+t.join(", ")+")"}var Qe=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$e=[1,0,0,1,0,0],tr=function(t){function e(){var e,r,n,i,o,a=t.call(this)||this;return a.extent_=[1/0,1/0,-1/0,-1/0],a.extentRevision_=-1,a.simplifiedGeometryMaxMinSquaredTolerance=0,a.simplifiedGeometryRevision=0,a.simplifyTransformedInternal=(e=function(t,e,r){if(!r)return this.getSimplifiedGeometry(e);var n=this.clone();return n.applyTransform(r),n.getSimplifiedGeometry(e)},o=!1,function(){var t=Array.prototype.slice.call(arguments);return o&&this===i&&R(t,n)||(o=!0,i=this,n=t,r=e.apply(this,arguments)),r}),a}return Qe(e,t),e.prototype.simplifyTransformed=function(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)},e.prototype.clone=function(){return n()},e.prototype.closestPointXY=function(t,e,r,i){return n()},e.prototype.containsXY=function(t,e){var r=this.getClosestPoint([t,e]);return r[0]===t&&r[1]===e},e.prototype.getClosestPoint=function(t,e){var r=e||[NaN,NaN];return this.closestPointXY(t[0],t[1],r,1/0),r},e.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},e.prototype.computeExtent=function(t){return n()},e.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)},e.prototype.rotate=function(t,e){n()},e.prototype.scale=function(t,e,r){n()},e.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},e.prototype.getSimplifiedGeometry=function(t){return n()},e.prototype.getType=function(){return n()},e.prototype.applyTransform=function(t){n()},e.prototype.intersectsExtent=function(t){return n()},e.prototype.translate=function(t,e){n()},e.prototype.transform=function(t,e){var r=we(t),n=r.getUnits()==te.TILE_PIXELS?function(t,n,i){var o=r.getExtent(),a=r.getWorldExtent(),s=Ot(a)/Ot(o);return He($e,a[0],a[3],s,-s,0,0,0),Dt(t,0,t.length,i,$e,n),Le(r,e)(t,n,i)}:Le(r,e);return this.applyTransform(n),this},e}(z),er=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function rr(t){var e;return t==At.XY?e=2:t==At.XYZ||t==At.XYM?e=3:t==At.XYZM&&(e=4),e}var nr=function(t){function e(){var e=t.call(this)||this;return e.layout=At.XY,e.stride=2,e.flatCoordinates=null,e}return er(e,t),e.prototype.computeExtent=function(t){return ct(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.getCoordinates=function(){return n()},e.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.getFlatCoordinates=function(){return this.flatCoordinates},e.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},e.prototype.getLayout=function(){return this.layout},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)s=r;else{if(p>0){for(var f=0;fi&&(i=l),o=s,a=u}return i}function ur(t,e,r,n,i){for(var o=0,a=r.length;o0;){for(var c=l.pop(),p=l.pop(),f=0,d=t[p],_=t[p+1],g=t[c],y=t[c+1],v=p+n;vf&&(h=v,f=m)}f>i&&(u[(h-e)/n]=1,p+n0&&_>f)&&(d<0&&g0&&g>d)?(s=c,u=p):(o[a++]=s,o[a++]=u,l=s,h=u,s=c,u=p)}}return o[a++]=s,o[a++]=u,a}function Tr(t,e,r,n,i,o,a,s){for(var u=0,l=r.length;uo&&(l-s)*(o-u)-(i-s)*(h-u)>0&&a++:h<=o&&(l-s)*(o-u)-(i-s)*(h-u)<0&&a--,s=l,u=h}return 0!==a}function Pr(t,e,r,n,i,o){if(0===r.length)return!1;if(!Cr(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;aT&&Pr(t,e,r,n,l=(h+c)/2,d)&&(m=l,T=S),h=c}return isNaN(m)&&(m=i[o]),a?(a.push(m,d,T),a):[m,d,T]}function br(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Lr(t,e,r,n,function(t,e){return function(t,e,r){var n=!1,i=at(t,e),o=at(t,r);if(i===Q.INTERSECTING||o===Q.INTERSECTING)n=!0;else{var a=t[0],s=t[1],u=t[2],l=t[3],h=e[0],c=e[1],p=r[0],f=r[1],d=(f-c)/(p-h),_=void 0,g=void 0;o&Q.ABOVE&&!(i&Q.ABOVE)&&(n=(_=p-(f-l)/d)>=a&&_<=u),n||!(o&Q.RIGHT)||i&Q.RIGHT||(n=(g=f-(p-u)*d)>=s&&g<=l),n||!(o&Q.BELOW)||i&Q.BELOW||(n=(_=p-(f-s)/d)>=a&&_<=u),n||!(o&Q.LEFT)||i&Q.LEFT||(n=(g=f-(p-a)*d)>=s&&g<=l)}return n}(i,t,e)}))))}function Fr(t,e,r,n,i){if(!function(t,e,r,n,i){return!!Mr(t,e,r,n,i)||(!!Cr(t,e,r,n,i[0],i[1])||(!!Cr(t,e,r,n,i[0],i[3])||(!!Cr(t,e,r,n,i[2],i[1])||!!Cr(t,e,r,n,i[2],i[3]))))}(t,e,r[0],n,i))return!1;if(1===r.length)return!0;for(var o=1,a=r.length;o0}function Dr(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),Jr=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.map=r,i.frameState=void 0!==n?n:null,i}return Jr(e,t),e}(M),$r=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,o)||this;return a.originalEvent=n,a.pixel_=null,a.coordinate_=null,a.dragging=void 0!==i&&i,a}return $r(e,t),Object.defineProperty(e.prototype,"pixel",{get:function(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_},set:function(t){this.pixel_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"coordinate",{get:function(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_},set:function(t){this.coordinate_=t},enumerable:!0,configurable:!0}),e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},e}(Qr),en=(r(1),"undefined"!=typeof navigator?navigator.userAgent.toLowerCase():""),rn=-1!==en.indexOf("firefox"),nn=(-1!==en.indexOf("safari")&&en.indexOf("chrom"),-1!==en.indexOf("webkit")&&-1==en.indexOf("edge")),on=-1!==en.indexOf("macintosh"),an=window.devicePixelRatio||1,sn="undefined"!=typeof Image&&Image.prototype.decode,un={SINGLECLICK:"singleclick",CLICK:N.CLICK,DBLCLICK:N.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ln=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,n,i,o)||this;return a.pointerEvent=n,a}return ln(e,t),e}(tn),cn={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},pn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fn=function(t){function e(e,r){var n=t.call(this,e)||this;n.map_=e,n.clickTimeoutId_,n.dragging_=!1,n.dragListenerKeys_=[],n.moveTolerance_=r?r*an:an,n.down_=null;var i=n.map_.getViewport();return n.activePointers_=0,n.trackedTouches_={},n.element_=i,n.pointerdownListenerKey_=g(i,cn.POINTERDOWN,n.handlePointerDown_,n),n.relayedListenerKey_=g(i,cn.POINTERMOVE,n.relayEvent_,n),n}return pn(e,t),e.prototype.emulateClick_=function(t){var e=new hn(un.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new hn(un.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;var e=new hn(un.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)},e.prototype.updateActivePointers_=function(t){var e=t;e.type==un.POINTERUP||e.type==un.POINTERCANCEL?delete this.trackedTouches_[e.pointerId]:e.type==un.POINTERDOWN&&(this.trackedTouches_[e.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},e.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new hn(un.POINTERUP,this.map_,t);this.dispatchEvent(e),e.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)},e.prototype.isMouseActionButton_=function(t){return 0===t.button},e.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new hn(un.POINTERDOWN,this.map_,t);this.dispatchEvent(e),this.down_=t,0===this.dragListenerKeys_.length&&this.dragListenerKeys_.push(g(document,un.POINTERMOVE,this.handlePointerMove_,this),g(document,un.POINTERUP,this.handlePointerUp_,this),g(this.element_,un.POINTERCANCEL,this.handlePointerUp_,this))},e.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var e=new hn(un.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}},e.prototype.relayEvent_=function(t){var e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new hn(t.type,this.map_,t,e))},e.prototype.isMoving_=function(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(v(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(v(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(A),dn="postrender",_n="movestart",gn="moveend",yn={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},vn="prerender",mn="postrender",En="precompose",Tn="postcompose",Sn="rendercomplete",wn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4,ABORT:5},xn=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,f(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){K(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),u=this.getRightChildIndex_(t),l=ut;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e0;)i=(n=this.dequeue()[0]).getKey(),(r=n.getState())===wn.ABORT?a=!0:r!==wn.IDLE||i in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[i]=!0,++this.tilesLoading_,++o,n.load());0===o&&a&&this.tileChangeCallback_()},e}(xn),Cn=42,Pn=256;function In(t,e,r){return function(n,i,o,a){if(n){var s=e?0:o[0]*i,u=e?0:o[1]*i,l=t[0]+s/2,h=t[2]-s/2,c=t[1]+u/2,p=t[3]-u/2;l>h&&(h=l=(h+l)/2),c>p&&(p=c=(p+c)/2);var f=kt(n[0],l,h),d=kt(n[1],c,p),_=30*i;return a&&r&&(f+=-_*Math.log(1+Math.max(0,l-n[0])/_)+_*Math.log(1+Math.max(0,n[0]-h)/_),d+=-_*Math.log(1+Math.max(0,c-n[1])/_)+_*Math.log(1+Math.max(0,n[1]-p)/_)),[f,d]}}}function bn(t){return t}function Ln(t,e,r){var n=It(e)/r[0],i=Ot(e)/r[1];return Math.min(t,Math.min(n,i))}function Mn(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),kt(n,r/2,2*e)}function Fn(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var u=n?Ln(t,n,a):t;return(void 0===r||r)&&s?Mn(i,u,e):kt(i,e,u)}}}function An(t){return void 0!==t?0:void 0}function Nn(t){return void 0!==t?t:void 0}var Dn=0,Gn=1,jn="center",kn="resolution",Un="rotation";function Bn(t,e,r){var n=void 0!==r?t.toFixed(r):""+t,i=n.indexOf(".");return(i=-1===i?n.length:i)>e?n:new Array(1+e-i).join("0")+n}function Yn(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;ia)return 1;if(a>o)return-1}return 0}function zn(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Xn(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],u=a[0],l=a[1],h=s[0],c=s[1],p=h-u,f=c-l,d=0===p&&0===f?0:(p*(i-u)+f*(o-l))/(p*p+f*f||0);return d<=0?(r=u,n=l):d>=1?(r=h,n=c):(r=u+d*p,n=l+d*f),[r,n]}function Vn(t,e,r){var n=Vt(e+180,360)-180,i=Math.abs(3600*n),o=r||0,a=Math.pow(10,o),s=Math.floor(i/3600),u=Math.floor((i-3600*s)/60),l=i-3600*s-60*u;return(l=Math.ceil(l*a)/a)>=60&&(l=0,u+=1),u>=60&&(u=0,s+=1),s+"° "+Bn(u,2)+"′ "+Bn(l,2,o)+"″"+(0==n?"":" "+t.charAt(n<0?1:0))}function Wn(t,e,r){return t?e.replace("{x}",t[0].toFixed(r)).replace("{y}",t[1].toFixed(r)):""}function Zn(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function Kn(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function Hn(t,e){return t[0]*=e,t[1]*=e,t}function qn(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function Jn(t,e){return Math.sqrt(qn(t,e))}function Qn(t,e){return qn(t,Xn(t,e))}function $n(t,e){return Wn(t,"{x}, {y}",e)}function ti(t){return Math.pow(t,3)}function ei(t){return 1-ti(1-t)}function ri(t){return 3*t*t-2*t*t*t}function ni(t){return t}var ii=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oi=0;function ai(t,e){setTimeout(function(){t(e)},0)}function si(t){return!(t.sourceCenter&&t.targetCenter&&!Zn(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var ui=function(t){function e(e){var r=t.call(this)||this,n=p({},e);return r.hints_=[0,0],r.animations_=[],r.updateAnimationKey_,r.projection_=Re(n.projection,"EPSG:3857"),r.targetCenter_=null,r.targetResolution_,r.targetRotation_,n.center&&(n.center=Ue(n.center,r.projection_)),n.extent&&(n.extent=Ye(n.extent,r.projection_)),r.applyOptions_(n),r}return ii(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,r,n,i=void 0!==t.minZoom?t.minZoom:oi,o=void 0!==t.maxZoom?t.maxZoom:28,a=void 0!==t.zoomFactor?t.zoomFactor:2,s=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,l=Re(t.projection,"EPSG:3857"),h=l.getExtent(),c=t.constrainOnlyCenter,p=t.extent;s||p||!l.isGlobal()||(c=!1,p=h);if(void 0!==t.resolutions){var f=t.resolutions;r=f[i],n=void 0!==f[o]?f[o]:f[f.length-1],e=t.constrainResolution?function(t,e,r){return function(n,i,o,a){if(void 0!==n){var s=t[0],u=t[t.length-1],l=r?Ln(s,r,o):s;if(a)return void 0===e||e?Mn(n,l,u):kt(n,u,l);var h=Math.min(l,n),c=Math.floor(S(t,h,i));return t[c]>l&&c1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&ai(e,!0))}for(var i=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,u=[],l=0;l0},e.prototype.getInteracting=function(){return this.hints_[Gn]>0},e.prototype.cancelAnimations=function(){this.setHint(Dn,-this.hints_[Dn]);for(var t=0,e=this.animations_.length;t=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o0?u/s.duration:1;l>=1?(s.complete=!0,l=1):i=!1;var h=s.easing(l);if(s.sourceCenter){var c=s.sourceCenter[0],p=s.sourceCenter[1],f=c+h*(s.targetCenter[0]-c),d=p+h*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var _=1===h?s.targetResolution:s.sourceResolution+h*(s.targetResolution-s.sourceResolution);if(s.anchor){var g=this.getSizeFromViewport_(this.getRotation()),y=this.constraints_.resolution(_,0,g,!0);this.targetCenter_=this.calculateCenterZoom(y,s.anchor)}this.targetResolution_=_,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===h?Vt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+h*(s.targetRotation-s.sourceRotation);if(s.anchor){var m=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(m,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(Dn,-1);var E=n[0].callback;E&&ai(E,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n=this.getCenterInternal();return void 0!==n&&(Kn(r=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),zn(r,e)),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getSizeFromViewport_=function(t){var e=[100,100],r='.ol-viewport[data-view="'+o(this)+'"]',n=document.querySelector(r);if(n){var i=getComputedStyle(n);e[0]=parseInt(i.width,10),e[1]=parseInt(i.height,10)}if(t){var a=e[0],s=e[1];e[0]=Math.abs(a*Math.cos(t))+Math.abs(s*Math.sin(t)),e[1]=Math.abs(a*Math.sin(t))+Math.abs(s*Math.cos(t))}return e},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?ke(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(jn)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return Be(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getSizeFromViewport_(),r=this.getCenterInternal();K(r,1);var n=this.getResolution();K(void 0!==n,2);var i=this.getRotation();return K(void 0!==i,3),xt(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(kn)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(Ye(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getSizeFromViewport_(),n=It(t)/r[0],i=Ot(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.maxResolution_,n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(Un)},e.prototype.getValueForResolutionFunction=function(t){var e=t||2,r=this.maxResolution_,n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return Math.log(r/t)/Math.log(e)/i}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),r=this.getResolution(),n=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:r,rotation:n,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=S(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=kt(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,kt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r,n=p({size:this.getSizeFromViewport_()},e||{});if(K(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))K(!Lt(t),25),r=zr(i=Ye(t,this.getProjection()));else if(t.getType()===Nt.CIRCLE){var i;(r=zr(i=Ye(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),St(i))}else{var o=je();r=o?r.clone().transform(o,this.getProjection()):t}this.fitInternal(r,n)},e.prototype.fitInternal=function(t,e){var r=e||{},n=r.size;n||(n=this.getSizeFromViewport_());var i,o=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0!==r.nearest&&r.nearest;i=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.getResolutionForZoom(r.maxZoom):0;for(var s=t.getFlatCoordinates(),u=this.getRotation(),l=Math.cos(-u),h=Math.sin(-u),c=1/0,p=1/0,f=-1/0,d=-1/0,_=t.getStride(),g=0,y=s.length;g=0;n--){var i=r[n];if(i.getActive())if(!i.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[Dn]||i[Gn]){var o=!sn&&Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()0&&t[1]>0}(e)&&r&&r.isDef()){var o=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=r.getState();i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:n?n.declutterItems:[],extent:xt(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{}}}if(this.frameState_=i,this.renderer_.renderFrame(i),i){if(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),n)(!this.previousExtent_||!Lt(this.previousExtent_)&&!pt(i.extent,this.previousExtent_))&&(this.dispatchEvent(new Qr(_n,this,n)),this.previousExtent_=lt(this.previousExtent_));this.previousExtent_&&!i.viewHints[Dn]&&!i.viewHints[Gn]&&!pt(i.extent,this.previousExtent_)&&(this.dispatchEvent(new Qr(gn,this,i)),et(i.extent,this.previousExtent_))}this.dispatchEvent(new Qr(dn,this,i)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(yn.LAYERGROUP,t)},e.prototype.setSize=function(t){this.set(yn.SIZE,t)},e.prototype.setTarget=function(t){this.set(yn.TARGET,t)},e.prototype.setView=function(t){this.set(yn.VIEW,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0)},e}(z),bi=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Li=function(t){function e(e){var r=t.call(this)||this;return r.element=e.element?e.element:null,r.target_=null,r.map_=null,r.listenerKeys=[],r.render=e.render?e.render:b,e.target&&r.setTarget(e.target),r}return bi(e,t),e.prototype.disposeInternal=function(){fi(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&fi(this.element);for(var e=0,r=this.listenerKeys.length;e=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Bi=function(t){function e(e){var r=this,n=p({},e);delete n.source,(r=t.call(this,n)||this).mapPrecomposeKey_=null,r.mapRenderKey_=null,r.sourceChangeKey_=null,r.renderer_=null,e.render&&(r.render=e.render),e.map&&r.setMap(e.map),r.addEventListener(Y(_i.SOURCE),r.handleSourcePropertyChange_);var i=e.source?e.source:null;return r.setSource(i),r}return ki(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(_i.SOURCE)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():vi.UNDEFINED},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(v(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=g(t,N.CHANGE,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var r=this.getRenderer();if(r.prepareFrame(t))return r.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(v(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(v(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=g(t,En,function(t){t.frameState.layerStatesArray.push(this.getLayerState(!1))},this),this.mapRenderKey_=g(this,N.CHANGE,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(_i.SOURCE,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(yi),Yi=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function zi(t){this.updateElement_(t.frameState)}var Xi=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||zi,target:n.target})||this).ulElement_=document.createElement("ul"),r.collapsed_=void 0===n.collapsed||n.collapsed,r.overrideCollapsible_=void 0!==n.collapsible,r.collapsible_=void 0===n.collapsible||n.collapsible,r.collapsible_||(r.collapsed_=!1);var i=void 0!==n.className?n.className:"ol-attribution",o=void 0!==n.tipLabel?n.tipLabel:"Attributions",a=void 0!==n.collapseLabel?n.collapseLabel:"»";"string"==typeof a?(r.collapseLabel_=document.createElement("span"),r.collapseLabel_.textContent=a):r.collapseLabel_=a;var s=void 0!==n.label?n.label:"i";"string"==typeof s?(r.label_=document.createElement("span"),r.label_.textContent=s):r.label_=s;var u=r.collapsible_&&!r.collapsed_?r.collapseLabel_:r.label_,l=document.createElement("button");l.setAttribute("type","button"),l.title=o,l.appendChild(u),l.addEventListener(N.CLICK,r.handleClick_.bind(r),!1);var h=i+" "+Ai+" "+Di+(r.collapsed_&&r.collapsible_?" "+Gi:"")+(r.collapsible_?"":" ol-uncollapsible"),c=r.element;return c.className=h,c.appendChild(r.ulElement_),c.appendChild(l),r.renderedAttributions_=[],r.renderedVisible_=!0,r}return Yi(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},r=[],n=t.layerStatesArray,i=0,o=n.length;i0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!R(e,this.renderedAttributions_)){di(this.ulElement_);for(var n=0,i=e.length;n0?t.animate({rotation:0,duration:this.duration_,easing:ei}):t.setRotation(0))},e}(Li),Ki=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hi=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInLabel?n.zoomInLabel:"+",s=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",u=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",l=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=i+"-in",h.setAttribute("type","button"),h.title=u,h.appendChild("string"==typeof a?document.createTextNode(a):a),h.addEventListener(N.CLICK,r.handleClick_.bind(r,o),!1);var c=document.createElement("button");c.className=i+"-out",c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(N.CLICK,r.handleClick_.bind(r,-o),!1);var p=i+" "+Ai+" "+Di,f=r.element;return f.className=p,f.appendChild(h),f.appendChild(c),r.duration_=void 0!==n.duration?n.duration:250,r}return Ki(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ei})):e.setZoom(n)}}},e}(Li);function qi(t){var e=t||{},r=new Z;return(void 0===e.zoom||e.zoom)&&r.push(new Hi(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&r.push(new Zi(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&r.push(new Xi(e.attributionOptions)),r}var Ji={ACTIVE:"active"},Qi=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function $i(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:ei})}}var to=function(t){function e(e){var r=t.call(this)||this;return e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return Qi(e,t),e.prototype.getActive=function(){return this.get(Ji.ACTIVE)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Ji.ACTIVE,t)},e.prototype.setMap=function(t){this.map_=t},e}(z),eo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ro(t){var e=!1;if(t.type==un.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;$i(n.getView(),o,i,this.duration_),t.preventDefault(),e=!0}return!e}var no=function(t){function e(e){var r=t.call(this,{handleEvent:ro})||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return eo(e,t),e}(to),io=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},oo=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ao=function(t){return t.target.getTargetElement()===document.activeElement},so=P,uo=function(t){var e=t.originalEvent;return 0==e.button&&!(nn&&on&&e.ctrlKey)},lo=I,ho=function(t){return t.type==un.SINGLECLICK},co=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},po=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},fo=function(t){var e=t.target.tagName;return"INPUT"!==e&&"SELECT"!==e&&"TEXTAREA"!==e},_o=function(t){var e=t.pointerEvent;return K(void 0!==e,56),"mouse"==e.pointerType},go=function(t){var e=t.pointerEvent;return K(void 0!==e,56),e.isPrimary&&0===e.button},yo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function vo(t){for(var e=t.length,r=0,n=0,i=0;i0}}else if(t.type==un.POINTERDOWN){var n=this.handleDownEvent(t);n&&t.preventDefault(),this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==un.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===un.POINTERDOWN||e===un.POINTERDRAG||e===un.POINTERUP}(t)){var e=t.pointerEvent,r=e.pointerId.toString();t.type==un.POINTERUP?delete this.trackedPointers_[r]:t.type==un.POINTERDOWN?this.trackedPointers_[r]=e:r in this.trackedPointers_&&(this.trackedPointers_[r]=e),this.targetPointers=d(this.trackedPointers_)}},e}(to),Eo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function To(t){return co(t)&&go(t)}var So=function(t){function e(e){var r=t.call(this,{stopDown:I})||this,n=e||{};return r.kinetic_=n.kinetic,r.lastCentroid=null,r.lastPointersCount_,r.panning_=!1,r.condition_=n.condition?n.condition:To,r.noKinetic_=!1,r}return Eo(e,t),e.prototype.handleDragEvent=function(t){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());var e=this.targetPointers,r=vo(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){var n=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],i=t.map.getView();Hn(n,i.getResolution()),Kn(n,i.getRotation()),i.adjustCenterInternal(n)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=e.length},e.prototype.handleUpEvent=function(t){var e=t.map,r=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var n=this.kinetic_.getDistance(),i=this.kinetic_.getAngle(),o=r.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),s=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(i),a[1]-n*Math.sin(i)]);r.animateInternal({center:r.getConstrainedCenter(s),duration:500,easing:ei})}return this.panning_&&(this.panning_=!1,r.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(mo),wo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xo=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:I})||this).condition_=n.condition?n.condition:oo,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return wo(e,t),e.prototype.handleDragEvent=function(t){if(_o(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==An){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!_o(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!_o(t)&&(!(!uo(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(mo),Oo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ro=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return Oo(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r=this.element_.style;r.left=Math.min(t[0],e[0])+"px",r.top=Math.min(t[1],e[1])+"px",r.width=Math.abs(e[0]-t[0])+"px",r.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Br([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(m),Co=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Po="boxstart",Io="boxdrag",bo="boxend",Lo=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return Co(e,t),e}(M),Mo=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.box_=new Ro(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,r.onBoxEnd_=n.onBoxEnd?n.onBoxEnd:b,r.startPixel_=null,r.condition_=n.condition?n.condition:so,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return Co(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){_o(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Lo(Io,t.coordinate,t)))},e.prototype.handleUpEvent=function(t){return!_o(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new Lo(bo,t.coordinate,t))),!1)},e.prototype.handleDownEvent=function(t){return!!_o(t)&&(!(!uo(t)||!this.condition_(t))&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Lo(Po,t.coordinate,t)),!0))},e}(mo),Fo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ao(){var t,e,r=this.getMap(),n=r.getView(),i=r.getSize(),o=this.getGeometry().getExtent();if(this.out_){var a=n.calculateExtentInternal(i),s=(t=[r.getPixelFromCoordinateInternal(Et(o)),r.getPixelFromCoordinateInternal(Pt(o))],_t(lt(e),t));Mt(a,1/n.getResolutionForExtentInternal(s,i)),o=a}var u=n.getConstrainedResolution(n.getResolutionForExtentInternal(o,i)),l=n.getConstrainedCenter(St(o),u);n.animateInternal({resolution:u,center:l,duration:this.duration_,easing:ei})}var No=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:po;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea,onBoxEnd:Ao})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return Fo(e,t),e}(Mo),Do={LEFT:37,UP:38,RIGHT:39,DOWN:40},Go=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function jo(t){var e=!1;if(t.type==N.KEYDOWN){var r=t.originalEvent.keyCode;if(this.condition_(t)&&(r==Do.DOWN||r==Do.LEFT||r==Do.RIGHT||r==Do.UP)){var n=t.map.getView(),i=n.getResolution()*this.pixelDelta_,o=0,a=0;r==Do.DOWN?a=-i:r==Do.LEFT?o=-i:r==Do.RIGHT?o=i:a=i;var s=[o,a];Kn(s,n.getRotation()),function(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:ni,center:t.getConstrainedCenter(i)})}}(n,s,this.duration_),t.preventDefault(),e=!0}}return!e}var ko=function(t){function e(e){var r=t.call(this,{handleEvent:jo})||this,n=e||{};return r.defaultCondition_=function(t){return co(t)&&fo(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Go(e,t),e}(to),Uo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Bo(t){var e=!1;if(t.type==N.KEYDOWN||t.type==N.KEYPRESS){var r=t.originalEvent.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var n=t.map,i=r=="+".charCodeAt(0)?this.delta_:-this.delta_;$i(n.getView(),i,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var Yo=function(t){function e(e){var r=t.call(this,{handleEvent:Bo})||this,n=e||{};return r.condition_=n.condition?n.condition:fo,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Uo(e,t),e}(to),zo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xo="trackpad",Vo="wheel",Wo=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.condition_=n.condition?n.condition:so,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.trackpadDeltaPerZoom_=300,r}return zo(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,Math.sign(this.lastDelta_),this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==N.WHEEL)return!0;t.preventDefault();var e,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==N.WHEEL&&(e=n.deltaY,rn&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=an),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();if(void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?Xo:Vo),this.mode_===Xo){var o=r.getView();return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):o.beginInteraction(),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.trackpadEventGap_),o.adjustZoom(-e/this.trackpadDeltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1}this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations(),$i(e,-kt(this.totalDelta_,-this.maxDelta_,this.maxDelta_),this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(to),Zo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ko=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=I),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Zo(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==An){var u=a.getViewport().getBoundingClientRect(),l=vo(this.targetPointers);l[0]-=u.left,l[1]-=u.top,this.anchor_=a.getCoordinateFromPixelInternal(l),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(mo),Ho=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),qo=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=I),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Ho(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,u=s.getView();1!=e&&(this.lastScaleDelta_=e);var l=s.getViewport().getBoundingClientRect(),h=vo(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=s.getCoordinateFromPixelInternal(h),s.render(),u.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(mo);function Jo(t){var e=t||{},r=new Z,n=new qr(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&r.push(new xo),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&r.push(new no({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&r.push(new So({condition:e.onFocusOnly?ao:void 0,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&r.push(new Ko),(void 0===e.pinchZoom||e.pinchZoom)&&r.push(new qo({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(r.push(new ko),r.push(new Yo({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&r.push(new Wo({condition:e.onFocusOnly?ao:void 0,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&r.push(new No({duration:e.zoomDuration})),r}var Qo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$o=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.inversePixelTransform=r,o.frameState=n,o.context=i,o}return Qo(e,t),e}(M),ta=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ea=/^([a-z]*)$|^hsla?\(.*\)$/i;function ra(t){return"string"==typeof t?t:sa(t)}function na(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var ia=function(){var t={},e=0;return function(r){var n;if(t.hasOwnProperty(r))n=t[r];else{if(e>=1024){var i=0;for(var o in t)0==(3&i++)&&(delete t[o],--e)}n=function(t){var e,r,n,i,o;ea.exec(t)&&(t=na(t));if(ta.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var u=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=u?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,u&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?aa(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),aa(o)):K(!1,14);return o}(r),t[r]=n,++e}return n}}();function oa(t){return Array.isArray(t)?t:ia(t)}function aa(t){return t[0]=kt(t[0]+.5|0,0,255),t[1]=kt(t[1]+.5|0,0,255),t[2]=kt(t[2]+.5|0,0,255),t[3]=kt(t[3],0,1),t}function sa(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:t[3])+")"}var ua=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=la(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=la(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function la(t,e,r){return e+":"+t+":"+(r?ra(r):"null")}var ha=new ua;function ca(t){return Array.isArray(t)?sa(t):t}var pa,fa=function(){function t(){}return t.prototype.drawCustom=function(t,e,r){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),da=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_a=function(t){function e(e){var r=t.call(this)||this;return r.highWaterMark=void 0!==e?e:2048,r.count_=0,r.entries_={},r.oldest_=null,r.newest_=null,r}return da(e,t),e.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},e.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null,this.dispatchEvent(N.CLEAR)},e.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},e.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},e.prototype.get=function(t,e){var r=this.entries_[t];return K(void 0!==r,15),r===this.newest_?r.value_:(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r,r.value_)},e.prototype.remove=function(t){var e=this.entries_[t];return K(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},e.prototype.getCount=function(){return this.count_},e.prototype.getKeys=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},e.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.value_;return e},e.prototype.peekLast=function(){return this.oldest_.value_},e.prototype.peekLastKey=function(){return this.oldest_.key_},e.prototype.peekFirstKey=function(){return this.newest_.key_},e.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},e.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},e.prototype.set=function(t,e){K(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},e.prototype.setSize=function(t){this.highWaterMark=t},e}(A),ga=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ya=function(t){function e(e){var r=t.call(this,e)||this;return r.consumers={},r}return ga(e,t),e.prototype.clear=function(){this.consumers={},t.prototype.clear.call(this)},e.prototype.get=function(e,r){var n=t.prototype.get.call(this,e),i=o(r);return i in this.consumers||(this.consumers[i]={}),this.consumers[i][e]=!0,n},e.prototype.prune=function(){t:for(;this.canExpireCache();){var t=this.peekLastKey();for(var e in this.consumers)if(t in this.consumers[e])break t;var r=this.pop();for(var e in r.width=0,r.height=0,this.consumers)delete this.consumers[e][t]}},e.prototype.release=function(t){delete this.consumers[o(t)]},e}(_a),va=[],ma=[0,0,0,0],Ea=new ya,Ta={},Sa=null,wa={},xa=function(){var t,e,r=100,n=Ta,i="32px ",o=["monospace","serif"],a=o.length,s="wmytzilWMYTZIL@#/&?$%10";function u(t,r,n){for(var u=Oa(),l=!0,h=0;h=0;--n)for(var i=r[n],o=i.items,a=0,s=o.length;ad[2])p=[g+_*Math.ceil((d[0]-g)/_),t[1]];n&&f.push([-_,0],[_,0])}var y,v=e.layerStatesArray,m=v.length;this.declutterTree_&&(y=this.declutterTree_.all().map(function(t){return t.value}));for(var E=[],T=0;T=0;--S){var w=v[S],x=w.layer;if(x.hasRenderer()&&Ui(w,l)&&a.call(s,x)){var O=x.getRenderer(),R=x.getSource();if(O&&R){var C=R.getWrapX()?p:t,P=h.bind(null,w.managed);E[0]=C[0]+f[T][0],E[1]=C[1]+f[T][1],u=O.forEachFeatureAtCoordinate(E,e,r,P,y)}if(u)return u}}},e.prototype.forEachLayerAtPixel=function(t,e,r,i,o){return n()},e.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,P,this,i,o)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){this.declutterTree_=Xa(t,this.declutterTree_)},e.prototype.scheduleExpireIconCache=function(t){ha.canExpireCache()&&t.postRenderFunctions.push(Wa)},e}(m),Ka=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ha=function(t){function e(e){var r=t.call(this,e)||this;r.labelCacheKey_=g(Ea,N.CLEAR,e.redrawText.bind(e)),r.element_=document.createElement("div");var n=r.element_.style;n.position="absolute",n.width="100%",n.height="100%",n.zIndex="0",r.element_.className=Ai+" ol-layers";var i=e.getViewport();return i.insertBefore(r.element_,i.firstChild||null),r.children_=[],r.renderedVisible_=!0,r}return Ka(e,t),e.prototype.dispatchRenderEvent=function(t,e){var r=this.getMap();if(r.hasListener(t)){var n=new $o(t,void 0,e);r.dispatchEvent(n)}},e.prototype.disposeInternal=function(){v(this.labelCacheKey_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(e){if(e){this.calculateMatrices2D(e),this.dispatchRenderEvent(En,e);var r=e.layerStatesArray.sort(function(t,e){return t.zIndex-e.zIndex}),n=e.viewState;this.children_.length=0;for(var i=null,o=0,a=r.length;o=0;--s){var u=a[s],l=u.layer;if(l.hasRenderer()&&Ui(u,o)&&i(l)){var h=l.getRenderer().getDataAtPixel(t,e,r);if(h){var c=n(l,h);if(c)return c}}}},e}(Za),qa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ja=function(t){function e(e){return(e=p({},e)).controls||(e.controls=qi()),e.interactions||(e.interactions=Jo()),t.call(this,e)||this}return qa(e,t),e.prototype.createRenderer=function(){return new Ha(this)},e}(Ii),Qa={BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right",CENTER_LEFT:"center-left",CENTER_CENTER:"center-center",CENTER_RIGHT:"center-right",TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right"},$a=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ts={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"},es=function(t){function e(e){var r=t.call(this)||this;return r.options=e,r.id=e.id,r.insertFirst=void 0===e.insertFirst||e.insertFirst,r.stopEvent=void 0===e.stopEvent||e.stopEvent,r.element=document.createElement("div"),r.element.className=void 0!==e.className?e.className:"ol-overlay-container "+Fi,r.element.style.position="absolute",r.autoPan=void 0!==e.autoPan&&e.autoPan,r.autoPanAnimation=e.autoPanAnimation||{},r.autoPanMargin=void 0!==e.autoPanMargin?e.autoPanMargin:20,r.rendered={bottom_:"",left_:"",right_:"",top_:"",visible:!0},r.mapPostrenderListenerKey=null,r.addEventListener(Y(ts.ELEMENT),r.handleElementChanged),r.addEventListener(Y(ts.MAP),r.handleMapChanged),r.addEventListener(Y(ts.OFFSET),r.handleOffsetChanged),r.addEventListener(Y(ts.POSITION),r.handlePositionChanged),r.addEventListener(Y(ts.POSITIONING),r.handlePositioningChanged),void 0!==e.element&&r.setElement(e.element),r.setOffset(void 0!==e.offset?e.offset:[0,0]),r.setPositioning(void 0!==e.positioning?e.positioning:Qa.TOP_LEFT),void 0!==e.position&&r.setPosition(e.position),r}return $a(e,t),e.prototype.getElement=function(){return this.get(ts.ELEMENT)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(ts.MAP)},e.prototype.getOffset=function(){return this.get(ts.OFFSET)},e.prototype.getPosition=function(){return this.get(ts.POSITION)},e.prototype.getPositioning=function(){return this.get(ts.POSITIONING)},e.prototype.handleElementChanged=function(){di(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&(fi(this.element),v(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=g(t,dn,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element)}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.get(ts.POSITION)&&this.autoPan&&this.panIntoView()},e.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(ts.ELEMENT,t)},e.prototype.setMap=function(t){this.set(ts.MAP,t)},e.prototype.setOffset=function(t){this.set(ts.OFFSET,t)},e.prototype.setPosition=function(t){this.set(ts.POSITION,t)},e.prototype.panIntoView=function(){var t=this.getMap();if(t&&t.getTargetElement()){var e=this.getRect(t.getTargetElement(),t.getSize()),r=this.getElement(),n=this.getRect(r,[hi(r),ci(r)]),i=this.autoPanMargin;if(!it(e,n)){var o=n[0]-e[0],a=e[2]-n[2],s=n[1]-e[1],u=e[3]-n[3],l=[0,0];if(o<0?l[0]=o-i:a<0&&(l[0]=Math.abs(a)+i),s<0?l[1]=s-i:u<0&&(l[1]=Math.abs(u)+i),0!==l[0]||0!==l[1]){var h=t.getView().getCenterInternal(),c=t.getPixelFromCoordinateInternal(h),p=[c[0]+l[0],c[1]+l[1]];t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(p),duration:this.autoPanAnimation.duration,easing:this.autoPanAnimation.easing})}}}},e.prototype.getRect=function(t,e){var r=t.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+e[0],i+e[1]]},e.prototype.setPositioning=function(t){this.set(ts.POSITIONING,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();if(t&&t.isRendered()&&e){var r=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(r,n)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);var o=n[0],a=n[1];if(i==Qa.BOTTOM_RIGHT||i==Qa.CENTER_RIGHT||i==Qa.TOP_RIGHT){""!==this.rendered.left_&&(this.rendered.left_="",r.left="");var s=Math.round(e[0]-t[0]-o)+"px";this.rendered.right_!=s&&(this.rendered.right_=s,r.right=s)}else{""!==this.rendered.right_&&(this.rendered.right_="",r.right=""),i!=Qa.BOTTOM_CENTER&&i!=Qa.CENTER_CENTER&&i!=Qa.TOP_CENTER||(o-=this.element.offsetWidth/2);var u=Math.round(t[0]+o)+"px";this.rendered.left_!=u&&(this.rendered.left_=u,r.left=u)}if(i==Qa.BOTTOM_LEFT||i==Qa.BOTTOM_CENTER||i==Qa.BOTTOM_RIGHT){""!==this.rendered.top_&&(this.rendered.top_="",r.top="");var l=Math.round(e[1]-t[1]-a)+"px";this.rendered.bottom_!=l&&(this.rendered.bottom_=l,r.bottom=l)}else{""!==this.rendered.bottom_&&(this.rendered.bottom_="",r.bottom=""),i!=Qa.CENTER_LEFT&&i!=Qa.CENTER_CENTER&&i!=Qa.CENTER_RIGHT||(a-=this.element.offsetHeight/2);var h=Math.round(t[1]+a)+"px";this.rendered.top_!=h&&(this.rendered.top_="top",r.top=h)}},e.prototype.getOptions=function(){return this.options},e}(z),rs={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"},ns=!1;function is(t,e,r,n){return function(i,o,a){var s=new XMLHttpRequest;s.open("GET","function"==typeof t?t(i,o,a):t,!0),e.getType()==rs.ARRAY_BUFFER&&(s.responseType="arraybuffer"),s.withCredentials=ns,s.onload=function(t){if(!s.status||s.status>=200&&s.status<300){var o=e.getType(),u=void 0;o==rs.JSON||o==rs.TEXT?u=s.responseText:o==rs.XML?(u=s.responseXML)||(u=(new DOMParser).parseFromString(s.responseText,"application/xml")):o==rs.ARRAY_BUFFER&&(u=s.response),u?r.call(this,e.readFeatures(u,{extent:i,featureProjection:a}),e.readProjection(u)):n.call(this)}else n.call(this)}.bind(this),s.onerror=function(){n.call(this)}.bind(this),s.send()}}function os(t,e){return is(t,e,function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)},b)}function as(t,e){return[[-1/0,-1/0,1/0,1/0]]}function ss(t,e){return[t]}var us=function(){function t(t,e,r,n){this.minX=t,this.maxX=e,this.minY=r,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function ls(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new us(t,e,r,n)}var hs=us;function cs(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function ps(t,e,r){return t+"/"+e+"/"+r}function fs(t){return ps(t[0],t[1],t[2])}function ds(t){return(t[1]<0||r&&0===o)})),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o=this.minZoom;){if(e(s,2===this.zoomFactor_?ls(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL(),n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return lu[0]=0,lu[1]=0,lu[2]=0,lu[3]=0,lu;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return lu[0]=this.data_[4*r],lu[1]=this.data_[4*r+1],lu[2]=this.data_[4*r+2],lu[3]=this.data_[4*r+3],lu},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),cu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pu=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return cu(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(gs),fu=pu;function du(t,e,r){var n=[],i=[],o=[],a=[],s=[],u=void 0!==r?r:[],l=t.SupportedCRS,h=we(l.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||we(l),c=h.getMetersPerUnit(),p="ne"==h.getAxisOrientation().substr(0,2);return t.TileMatrix.sort(function(t,e){return e.ScaleDenominator-t.ScaleDenominator}),t.TileMatrix.forEach(function(e){if(!(u.length>0)||O(u,function(r){return e.Identifier==r.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===r.TileMatrix})){i.push(e.Identifier);var r=28e-5*e.ScaleDenominator/c,l=e.TileWidth,h=e.TileHeight;p?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),n.push(r),a.push(l==h?l:[l,h]),s.push([e.MatrixWidth,e.MatrixHeight])}}),new pu({extent:e,origins:o,resolutions:n,matrixIds:i,tileSizes:a,sizes:s})}var _u=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale}return t.prototype.clone=function(){return new t({opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getAnchor=function(){return n()},t.prototype.getImage=function(t){return n()},t.prototype.getHitDetectionImage=function(t){return n()},t.prototype.getImageState=function(){return n()},t.prototype.getImageSize=function(){return n()},t.prototype.getHitDetectionImageSize=function(){return n()},t.prototype.getOrigin=function(){return n()},t.prototype.getSize=function(){return n()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.listenImageChange=function(t){n()},t.prototype.load=function(){n()},t.prototype.unlistenImageChange=function(t){n()},t}(),gu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yu=function(t){function e(e){var r=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(r=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:1})||this).canvas_=null,r.hitDetectionCanvas_=null,r.fill_=void 0!==e.fill?e.fill:null,r.origin_=[0,0],r.points_=e.points,r.radius_=void 0!==e.radius?e.radius:e.radius1,r.radius2_=e.radius2,r.angle_=void 0!==e.angle?e.angle:0,r.stroke_=void 0!==e.stroke?e.stroke:null,r.anchor_=null,r.size_=null,r.imageSize_=null,r.hitDetectionImageSize_=null,r.render(),r}return gu(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_},e.prototype.getImage=function(t){return this.canvas_},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return Da.LOADED},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.render=function(){var t,e="round",r="round",n=0,i=null,o=0,a=0;this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=ca(t),void 0===(a=this.stroke_.getWidth())&&(a=1),i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),void 0===(r=this.stroke_.getLineJoin())&&(r="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10));var s=2*(this.radius_+a)+1,u={strokeStyle:t,strokeWidth:a,size:s,lineCap:e,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n},l=li(s,s);this.canvas_=l.canvas;var h=s=this.canvas_.width;this.draw_(u,l,0,0),this.createHitDetectionCanvas_(u),this.anchor_=[s/2,s/2],this.size_=[s,s],this.imageSize_=[h,h]},e.prototype.draw_=function(t,e,r,n){var i,o,a;e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var s=this.points_;if(s===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var u=void 0!==this.radius2_?this.radius2_:this.radius_;for(u!==this.radius_&&(s*=2),i=0;i<=s;i++)o=2*i*Math.PI/s-Math.PI/2+this.angle_,a=i%2==0?this.radius_:u,e.lineTo(t.size/2+a*Math.cos(o),t.size/2+a*Math.sin(o))}if(this.fill_){var l=this.fill_.getColor();null===l&&(l="#000"),e.fillStyle=ca(l),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.hitDetectionCanvas_=this.canvas_,this.fill_){var e=this.fill_.getColor(),r=0;if("string"==typeof e&&(e=oa(e)),null===e?r=1:Array.isArray(e)&&(r=4===e.length?e[3]:1),0===r){var n=li(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,r,n){e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var i=this.points_;if(i===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o=void 0!==this.radius2_?this.radius2_:this.radius_;o!==this.radius_&&(i*=2);var a=void 0,s=void 0,u=void 0;for(a=0;a<=i;a++)u=2*a*Math.PI/i-Math.PI/2+this.angle_,s=a%2==0?this.radius_:o,e.lineTo(t.size/2+s*Math.cos(u),t.size/2+s*Math.sin(u))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(_u),vu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mu=function(t){function e(e){var r=e||{};return t.call(this,{points:1/0,fill:r.fill,radius:r.radius,stroke:r.stroke})||this}return vu(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(yu),Eu=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),Tu={FRACTION:"fraction",PIXELS:"pixels"},Su=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wu=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=r,o.state=i,o}return Su(e,t),e.prototype.changed=function(){this.dispatchEvent(N.CHANGE)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return n()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){n()},e}(A),xu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ou(t,e,r){var n=t;if(n.src&&sn){var i=n.decode(),o=!0;return i.then(function(){o&&e()}).catch(function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():r())}),function(){o=!1}}var a=[y(n,N.LOAD,e),y(n,N.ERROR,r)];return function(){a.forEach(v)}}var Ru=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,n,Da.IDLE)||this;return s.src_=i,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=Da.IDLE,s.imageLoadFunction_=a,s}return xu(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=Da.ERROR,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Ot(this.extent)/this.image_.height),this.state=Da.LOADED,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Da.IDLE&&this.state!=Da.ERROR||(this.state=Da.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=Ou(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(wu),Cu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pu=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_=a?document.createElement("canvas"):null,s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return Cu(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Da.LOADED){this.tainted_=!1;var t=li(1,1);try{t.drawImage(this.image_,0,0),t.getImageData(0,0,1,1)}catch(t){this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(N.CHANGE)},e.prototype.handleImageError_=function(){this.imageState_=Da.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Da.LOADED,this.size_&&(this.image_.width=this.size_[0],this.image_.height=this.size_[1]),this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.replaceColor_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_)if(this.isTainted_()){var e=this.size_[0],r=this.size_[1],n=li(e,r);n.fillRect(0,0,e,r),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Da.IDLE){this.imageState_=Da.LOADING;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Ou(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(){if(this.color_&&!this.isTainted_()){this.canvas_.width=this.image_.width,this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");t.drawImage(this.image_,0,0);for(var e=t.getImageData(0,0,this.image_.width,this.image_.height),r=e.data,n=this.color_[0]/255,i=this.color_[1]/255,o=this.color_[2]/255,a=0,s=r.length;a0,6);var p=void 0!==n.src?Da.IDLE:Da.LOADED;return r.color_=void 0!==n.color?oa(n.color):null,r.iconImage_=function(t,e,r,n,i,o){var a=ha.get(e,n,o);return a||(a=new Pu(t,e,r,n,i,o),ha.set(e,n,o,a)),a}(l,c,h,r.crossOrigin_,p,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:Iu.TOP_LEFT,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return bu(e,t),e.prototype.clone=function(){return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Tu.FRACTION||this.anchorYUnits_==Tu.FRACTION){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Tu.FRACTION&&(t[0]*=e[0]),this.anchorYUnits_==Tu.FRACTION&&(t[1]*=e[1])}if(this.anchorOrigin_!=Iu.TOP_LEFT){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Iu.TOP_RIGHT&&this.anchorOrigin_!=Iu.BOTTOM_RIGHT||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Iu.BOTTOM_LEFT&&this.anchorOrigin_!=Iu.BOTTOM_RIGHT||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=Iu.TOP_LEFT){var e=this.getSize(),r=this.iconImage_.getSize();if(!e||!r)return null;t=t.slice(),this.offsetOrigin_!=Iu.TOP_RIGHT&&this.offsetOrigin_!=Iu.BOTTOM_RIGHT||(t[0]=r[0]-e[0]-t[0]),this.offsetOrigin_!=Iu.BOTTOM_LEFT&&this.offsetOrigin_!=Iu.BOTTOM_RIGHT||(t[1]=r[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(N.CHANGE,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(N.CHANGE,t)},e}(_u),Mu=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),Fu=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Gu,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Gu,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var Au=null;function Nu(t,e){if(!Au){var r=new Eu({color:"rgba(255,255,255,0.4)"}),n=new Mu({color:"#3399CC",width:1.25});Au=[new Fu({image:new mu({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return Au}function Du(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[Nt.POLYGON]=[new Fu({fill:new Eu({color:[255,255,255,.5]})})],t[Nt.MULTI_POLYGON]=t[Nt.POLYGON],t[Nt.LINE_STRING]=[new Fu({stroke:new Mu({color:e,width:5})}),new Fu({stroke:new Mu({color:r,width:3})})],t[Nt.MULTI_LINE_STRING]=t[Nt.LINE_STRING],t[Nt.CIRCLE]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING]),t[Nt.POINT]=[new Fu({image:new mu({radius:6,fill:new Eu({color:r}),stroke:new Mu({color:e,width:1.5})}),zIndex:1/0})],t[Nt.MULTI_POINT]=t[Nt.POINT],t[Nt.GEOMETRY_COLLECTION]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING],t[Nt.POINT]),t}function Gu(t){return t.getGeometry()}var ju=Fu,ku={POINT:"point",LINE:"line"},Uu="#333",Bu=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new Eu({color:Uu}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:ku.POINT,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}();function Yu(t,e){var r=/\{z\}/g,n=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(a,s,u){return a?t.replace(r,a[0].toString()).replace(n,a[1].toString()).replace(i,a[2].toString()).replace(o,function(){var t=a[0],r=e.getFullTileRange(t);return K(r,55),(r.getHeight()-a[2]-1).toString()}):void 0}}function zu(t,e){for(var r=t.length,n=new Array(r),i=0;it)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){n()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:ti(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(A),Ju=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Qu(){var t=li(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var $u=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return Ju(e,t),e.prototype.disposeInternal=function(){this.state==wn.LOADING&&(this.unlistenImage_(),this.image_=Qu()),this.interimTile&&this.interimTile.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){this.state=wn.ERROR,this.unlistenImage_(),this.image_=Qu(),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=wn.LOADED:this.state=wn.EMPTY,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==wn.ERROR&&(this.state=wn.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==wn.IDLE&&(this.state=wn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Ou(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(qu),tl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),el=function(t){function e(e){return t.call(this,e)||this}return tl(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().dispose()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=function(t){return t.split("/").map(Number)}(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(fs(e.tileCoord)),e.dispose())}.bind(this))}},e}(_a);function rl(t,e,r,n){var i=Me(r,e,t),o=xe(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var u=t.getExtent();if(!u||nt(u,i)){var l=xe(t,o,i)/o;isFinite(l)&&l>0&&(o/=l)}return o}function nl(t,e,r,n){var i=r-t,o=n-e,a=Math.sqrt(i*i+o*o);return[Math.round(r+i/a),Math.round(n+o/a)]}function il(t,e,r,n,i,o,a,s,u,l,h){var c=li(Math.round(r*t),Math.round(r*e));if(0===u.length)return c.canvas;c.scale(r,r);var p=[1/0,1/0,-1/0,-1/0];u.forEach(function(t,e,r){ft(p,t.extent)});var f=It(p),d=Ot(p),_=li(Math.round(r*f/n),Math.round(r*d/n)),g=r/n;u.forEach(function(t,e,r){var n=t.extent[0]-p[0],i=-(t.extent[3]-p[3]),o=It(t.extent),a=Ot(t.extent);_.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,n*g,i*g,o*g,a*g)});var y=Ct(a);return s.getTriangles().forEach(function(t,e,i){var a=t.source,s=t.target,u=a[0][0],l=a[0][1],h=a[1][0],f=a[1][1],d=a[2][0],g=a[2][1],v=(s[0][0]-y[0])/o,m=-(s[0][1]-y[1])/o,E=(s[1][0]-y[0])/o,T=-(s[1][1]-y[1])/o,S=(s[2][0]-y[0])/o,w=-(s[2][1]-y[1])/o,x=u,O=l;u=0,l=0;var R=function(t){for(var e=t.length,r=0;ri&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var u=r+1;u=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[h-=x,f-=O,0,0,E-v],[d-=x,g-=O,0,0,S-v],[0,0,h,f,T-m],[0,0,d,g,w-m]]);if(R){c.save(),c.beginPath();var C=(v+E+S)/3,P=(m+T+w)/3,I=nl(C,P,v,m),b=nl(C,P,E,T),L=nl(C,P,S,w);c.moveTo(b[0],b[1]),c.lineTo(I[0],I[1]),c.lineTo(L[0],L[1]),c.clip(),c.transform(R[0],R[2],R[1],R[3],v,m),c.translate(p[0]-x,p[3]-O),c.scale(n/r,-n/r),c.drawImage(_.canvas,0,0),c.restore()}}),h&&(c.save(),c.strokeStyle="black",c.lineWidth=1,s.getTriangles().forEach(function(t,e,r){var n=t.target,i=(n[0][0]-y[0])/o,a=-(n[0][1]-y[1])/o,s=(n[1][0]-y[0])/o,u=-(n[1][1]-y[1])/o,l=(n[2][0]-y[0])/o,h=-(n[2][1]-y[1])/o;c.beginPath(),c.moveTo(s,u),c.lineTo(i,a),c.lineTo(l,h),c.closePath(),c.stroke()}),c.restore()),c.canvas}var ol=10,al=function(){function t(t,e,r,n,i){this.sourceProj_=t,this.targetProj_=e;var o={},a=Le(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&It(n)==It(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?It(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?It(this.targetProj_.getExtent()):null;var s=Ct(r),u=Pt(r),l=Tt(r),h=Et(r),c=this.transformInv_(s),p=this.transformInv_(u),f=this.transformInv_(l),d=this.transformInv_(h);if(this.addQuad_(s,u,l,h,c,p,f,d,ol),this.wrapsXInSource_){var _=1/0;this.triangles_.forEach(function(t,e,r){_=Math.min(_,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-_>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-_>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-_>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-_>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r.5&&h<1,f=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=It($([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&h&&(f=h>.25||f)}if(f||!this.maxSourceExtent_||bt(l,this.maxSourceExtent_)){if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1]))){if(!(u>0))return;f=!0}if(u>0){if(!f){var d=[(t[0]+r[0])/2,(t[1]+r[1])/2],_=this.transformInv_(d),g=void 0;if(p)g=(Vt(i[0],c)+Vt(a[0],c))/2-Vt(_[0],c);else g=(i[0]+a[0])/2-_[0];var y=(i[1]+a[1])/2-_[1];f=g*g+y*y>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var v=[(e[0]+r[0])/2,(e[1]+r[1])/2],m=this.transformInv_(v),E=[(n[0]+t[0])/2,(n[1]+t[1])/2],T=this.transformInv_(E);this.addQuad_(t,e,v,E,i,o,m,T,u-1),this.addQuad_(E,v,r,n,T,m,a,s,u-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],w=this.transformInv_(S),x=[(r[0]+n[0])/2,(r[1]+n[1])/2],O=this.transformInv_(x);this.addQuad_(t,S,x,n,i,w,O,s,u-1),this.addQuad_(S,e,r,x,w,o,a,O,u-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,r,n,i,a,s),this.addTriangle_(t,e,r,i,o,a)}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,r,n){var i=e.source;dt(t,i[0]),dt(t,i[1]),dt(t,i[2])}),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),sl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ul=function(t){function e(e,r,n,i,o,a,s,u,l,h,c){var p=t.call(this,o,wn.IDLE)||this;p.renderEdges_=void 0!==c&&c,p.pixelRatio_=s,p.gutter_=u,p.canvas_=null,p.sourceTileGrid_=r,p.targetTileGrid_=i,p.wrappedTileCoord_=a||o,p.sourceTiles_=[],p.sourcesListenerKeys_=null,p.sourceZ_=0;var f=i.getTileCoordExtent(p.wrappedTileCoord_),d=p.targetTileGrid_.getExtent(),_=p.sourceTileGrid_.getExtent(),g=d?Rt(f,d):f;if(0===mt(g))return p.state=wn.EMPTY,p;var y=e.getExtent();y&&(_=_?Rt(_,y):y);var v=i.getResolution(p.wrappedTileCoord_[0]),m=rl(e,n,St(g),v);if(!isFinite(m)||m<=0)return p.state=wn.EMPTY,p;var E=void 0!==h?h:Ku;if(p.triangulation_=new al(e,n,g,_,m*E),0===p.triangulation_.getTriangles().length)return p.state=wn.EMPTY,p;p.sourceZ_=r.getZForResolution(m);var T=p.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(T[1]=kt(T[1],_[1],_[3]),T[3]=kt(T[3],_[1],_[3])):T=Rt(T,_)),mt(T)){for(var S=r.getTileRangeForExtentAndZ(T,p.sourceZ_),w=S.minX;w<=S.maxX;w++)for(var x=S.minY;x<=S.maxY;x++){var O=l(p.sourceZ_,w,x,s);O&&p.sourceTiles_.push(O)}0===p.sourceTiles_.length&&(p.state=wn.EMPTY)}else p.state=wn.EMPTY;return p}return sl(e,t),e.prototype.disposeInternal=function(){this.state==wn.LOADING&&this.unlistenSources_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==wn.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=wn.ERROR;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=il(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=wn.LOADED}this.changed()},e.prototype.load=function(){if(this.state==wn.IDLE){this.state=wn.LOADING,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==wn.IDLE||i==wn.LOADING){t++;var o=g(e,N.CHANGE,function(r){var n=e.getState();n!=wn.LOADED&&n!=wn.ERROR&&n!=wn.EMPTY||(v(o),0===--t&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach(function(t,e,r){t.getState()==wn.IDLE&&t.load()}),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(v),this.sourcesListenerKeys_=null},e}(qu),ll=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function hl(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var cl=function(t){function e(e){var r=t.call(this)||this;return r.projection_=we(e.projection),r.attributions_=hl(e.attributions),r.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,r.loading=!1,r.state_=void 0!==e.state?e.state:vi.READY,r.wrapX_=void 0!==e.wrapX&&e.wrapX,r}return ll(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return n()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=hl(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(z),pl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fl=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX})||this;r.opaque_=void 0!==e.opaque&&e.opaque,r.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,r.tileGrid=void 0!==e.tileGrid?e.tileGrid:null;var n=e.cacheSize;if(void 0===n){var i=[256,256],o=e.tileGrid;o&&xi(o.getTileSize(o.getMinZoom()),i);var a="undefined"!=typeof screen,s=a?screen.availWidth||screen.width:1920,u=a?screen.availHeight||screen.height:1080;n=4*Math.ceil(s/i[0])*Math.ceil(u/i[1])}return r.tileCache=new el(n),r.tmpSize=[0,0],r.key_=e.key||"",r.tileOptions={transition:e.transition},r.zDirection=e.zDirection?e.zDirection:0,r}return pl(e,t),e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);r&&r.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,r,n){var i=this.getTileCacheForProjection(t);if(!i)return!1;for(var o,a,s,u=!0,l=r.minX;l<=r.maxX;++l)for(var h=r.minY;h<=r.maxY;++h)a=ps(e,l,h),s=!1,i.containsKey(a)&&(s=(o=i.get(a)).getState()===wn.LOADED)&&(s=!1!==n(o)),s||(u=!1);return u},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,r,i,o){return n()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:ys(t)},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();return e&&!Ie(e,t)?null:this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,r){var n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(e),o=xi(n.getTileSize(t),this.tmpSize);return 1==i?o:wi(o,i,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var r=void 0!==e?e:this.getProjection(),n=this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(t=function(t,e,r){var n=e[0],i=t.getTileCoordCenter(e),o=Ts(r);if(nt(o,i))return e;var a=It(o),s=Math.ceil((o[0]-i[0])/a);return i[0]+=a*s,t.getTileCoordForCoordAndZ(i,n)}(n,t,r)),function(t,e){var r=t[0],n=t[1],i=t[2];if(e.getMinZoom()>r||r>e.getMaxZoom())return!1;var o,a=e.getExtent();return!(o=a?e.getTileRangeForExtentAndZ(a,r):e.getFullTileRange(r))||o.containsXY(n,i)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.useTile=function(t,e,r,n){},e}(cl),dl=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return pl(e,t),e}(M),_l=fl,gl="tileloadstart",yl="tileloadend",vl="tileloaderror",ml=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),El=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.generateTileUrlFunction_=!e.tileUrlFunction,r.tileLoadFunction=e.tileLoadFunction,r.tileUrlFunction=e.tileUrlFunction?e.tileUrlFunction.bind(r):Vu,r.urls=null,e.urls?r.setUrls(e.urls):e.url&&r.setUrl(e.url),r.tileLoadingKeys_={},r}return ml(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,n=o(r),i=r.getState();i==wn.LOADING?(this.tileLoadingKeys_[n]=!0,e=gl):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==wn.ERROR?vl:i==wn.LOADED||i==wn.ABORT?yl:void 0),null!=e&&this.dispatchEvent(new dl(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=Wu(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(zu(t,this.tileGrid),e):this.setKey(e)},e.prototype.useTile=function(t,e,r){var n=ps(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(_l),Tl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Sl(t,e){t.getImage().src=e}var wl=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Sl,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:$u,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.renderReprojectionEdges_=!1,r}return Tl(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Ie(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Ie(e,t)){var r=o(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=ys(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Ie(e,t))return this.tileCache;var r=o(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new el(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=s?this.tileUrlFunction(s,n,i):void 0,l=new this.tileClass(a,void 0!==u?wn.IDLE:wn.EMPTY,void 0!==u?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,l.addEventListener(N.CHANGE,this.handleTileChange.bind(this)),l},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Ie(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],u=void 0,l=fs(s);a.containsKey(l)&&(u=a.get(l));var h=this.getKey();if(u&&u.key==h)return u;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new ul(o,c,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return d.key=h,u?(d.interimTile=u,d.refreshInterimChain(),a.replace(l,d)):a.set(l,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=ps(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var u=o;o=this.createTile_(t,e,r,n,i,s),u.getState()==wn.IDLE?o.interimTile=u.interimTile:o.interimTile=u,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=we(t);if(r){var n=o(r);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(El),xl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Ol=function(t){function e(e){var r=this,n=void 0!==e.hidpi&&e.hidpi;return(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:we("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:vi.LOADING,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:n?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=n,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,Zu("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return xl(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=Ts(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=vs({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,u=this.hidpi_;if(this.tileUrlFunction=Xu(e.imageUrlSubdomains.map(function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){cs(t[0],t[1],t[2],r);var o=n;return u&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,r,n=t[0],i=new Array(n),o=1<>=1;return i.join("")}(r))}}})),e.imageryProviders){var l=be(we("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map(function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o=u.zoomMin&&a<=u.zoomMax){var h=u.bbox;if(bt(Ft([h[1],h[0],h[3],h[2]],l),t.extent)){n=!0;break}}}n&&r.push(e.attribution)}),r.push('Terms of Use'),r}.bind(this))}this.setState(vi.READY)}else this.setState(vi.ERROR)},e}(wl),Rl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cl=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:vs({extent:Ts(n),maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return Rl(e,t),e}(wl),Pl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Il=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Pl(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){p(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(vi.ERROR)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(vi.READY)}else this.setState(vi.ERROR)},e.prototype.handleInitError_=function(t){this.setState(vi.ERROR)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(Cl),bl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"},Ll=r(0),Ml=r.n(Ll),Fl=function(){function t(t){this.rbush_=new Ml.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[o(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;n=0;--r){var n=this.geometryFunction(t[r]);n?zn(e,n.getCoordinates()):t.splice(r,1)}Hn(e,1/t.length);var i=new q(new Or(e));return i.set("features",t),i},e}(Dl),kl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ul={DEFAULT:"default",TRUNCATED:"truncated"},Bl=function(t){function e(e,r,n,i,o,a,s,u){var l=t.call(this,n,i,o,a,s,u)||this;return l.zoomifyImage_=null,l.tileSize_=xi(r.getTileSize(n[0])).map(function(t){return t*e}),l}return kl(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==wn.LOADED){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=li(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}($u),Yl=function(t){function e(e){var r=this,n=e||{},i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:Ul.DEFAULT,a=i[0],s=i[1],u=n.extent||[0,-i[1],i[0],0],l=[],h=n.tileSize||Pn,c=n.tilePixelRatio||1,p=h;switch(o){case Ul.DEFAULT:for(;a>p||s>p;)l.push([Math.ceil(a/p),Math.ceil(s/p)]),p+=p;break;case Ul.TRUNCATED:for(var f=a,d=s;f>p||d>p;)l.push([Math.ceil(f/p),Math.ceil(d/p)]),f>>=1,d>>=1;break;default:K(!1,53)}l.push([1,1]),l.reverse();for(var _=[1],g=[0],y=1,v=l.length;y1,n=r&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],i=r&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],o=r&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(info.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map(function(t){return[t.width,t.height]}),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map(function(t){return t.width})[0],t.imageInfo.tiles.map(function(t){return void 0===t.height?t.width:t.height})[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map(function(t){return t.scaleFactors})[0],supports:e.supports.concat(n),formats:e.formats.concat(i),qualities:e.qualities.concat(o)}},Kl[zl.VERSION3]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=void 0===t.imageInfo.extraFormats?e.formats:e.formats.concat(t.imageInfo.extraFormats),n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter(function(t){return["jpg","png","gif"].includes(t)}).reduce(function(t,e){return void 0===t&&r.includes(e)?e:t},void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map(function(t){return[t.width,t.height]}),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map(function(t){return t.width})[0],t.imageInfo.tiles.map(function(t){return t.height})[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map(function(t){return t.scaleFactors})[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:e.supports.concat(t.imageInfo.extraFeatures),formats:r,qualities:void 0===t.imageInfo.extraQualities?e.qualities:e.qualities.concat(t.imageInfo.extraQualities),preferredFormat:n}};var Hl=function(){function t(t){this.setImageInfo(t)}return t.prototype.setImageInfo=function(t){this.imageInfo="string"==typeof t?JSON.parse(t):t},t.prototype.getImageApiVersion=function(){if(void 0!==this.imageInfo){var t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(var e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&Wl.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}},t.prototype.getComplianceLevelFromProfile=function(t){var e=this.getComplianceLevelEntryFromProfile(t);if(void 0!==e){var r=e.match(/level[0-2](\.json)?$/g);return Array.isArray(r)?r[0].replace(".json",""):void 0}},t.prototype.getComplianceLevelSupportedFeatures=function(){if(void 0!==this.imageInfo){var t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Xl.none.none:Xl[t][e]}},t.prototype.getTileSourceOptions=function(t){var e=t||{},r=this.getImageApiVersion();if(void 0!==r){var n=void 0===r?void 0:Kl[r](this);if(void 0!==n)return{url:n.url,version:r,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort(function(t,e){return e-t}):void 0,tileSize:n.tileSize}}},t}(),ql=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Jl(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var Ql=function(t){function e(e){var r=this,n=e||{},i=n.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";var o=n.version||zl.VERSION2,a=n.sizes||[],s=n.size;K(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);var u,l,h,c=s[0],p=s[1],f=n.tileSize,d=n.tilePixelRatio||1,_=n.format||"jpg",g=n.quality||(n.version==zl.VERSION1?"native":"default"),y=n.resolutions||[],v=n.supports||[],m=n.extent||[0,-p,c,0],E=null!=a&&Array.isArray(a)&&a.length>0,T=null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0||Array.isArray(f)&&f.length>0),S=null!=v&&Array.isArray(v)&&(v.includes("regionByPx")||v.includes("regionByPct"))&&(v.includes("sizeByWh")||v.includes("sizeByH")||v.includes("sizeByW")||v.includes("sizeByPct"));if(y.sort(function(t,e){return e-t}),T||S)if(null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0?(u=f,l=f):Array.isArray(f)&&f.length>0&&((1==f.length||null==f[1]&&Number.isInteger(f[0]))&&(u=f[0],l=f[0]),2==f.length&&(Number.isInteger(f[0])&&Number.isInteger(f[1])?(u=f[0],l=f[1]):null==f[0]&&Number.isInteger(f[1])&&(u=f[1],l=f[1])))),void 0!==u&&void 0!==l||(u=Pn,l=Pn),0==y.length)for(var w=h=Math.max(Math.ceil(Math.log(c/u)/Math.LN2),Math.ceil(Math.log(p/l)/Math.LN2));w>=0;w--)y.push(Math.pow(2,w));else{var x=Math.max.apply(Math,y);h=Math.round(Math.log(x)/Math.LN2)}else if(u=c,l=p,y=[],E){a.sort(function(t,e){return t[0]-e[0]}),h=-1;var O=[];for(w=0;w0&&y[y.length-1]==R?O.push(w):(y.push(R),h++)}if(O.length>0)for(w=0;wh)){var d=t[1],m=t[2],w=y[f];if(!(void 0===d||void 0===m||void 0===w||d<0||Math.ceil(c/w/u)<=d||m<0||Math.ceil(p/w/l)<=m)){if(S||T){var x=d*u*w,O=m*l*w,R=u*w,C=l*w,P=u,I=l;if(x+R>c&&(R=c-x),O+C>p&&(C=p-O),x+u*w>c&&(P=Math.floor((c-x+w-1)/w)),O+l*w>p&&(I=Math.floor((p-O+w-1)/w)),0==x&&R==c&&0==O&&C==p)n="full";else if(!S||v.includes("regionByPx"))n=x+","+O+","+R+","+C;else if(v.includes("regionByPct")){n="pct:"+Jl(x/c*100)+","+Jl(O/p*100)+","+Jl(R/c*100)+","+Jl(C/p*100)}o!=zl.VERSION3||S&&!v.includes("sizeByWh")?!S||v.includes("sizeByW")?s=P+",":v.includes("sizeByH")?s=","+I:v.includes("sizeByWh")?s=P+","+I:v.includes("sizeByPct")&&(s="pct:"+Jl(100/w)):s=P+","+I}else if(n="full",E){var b=a[f][0],L=a[f][1];s=o==zl.VERSION3?b==c&&L==p?"max":b+","+L:b==c?"full":b+","}else s=o==zl.VERSION3?"max":"full";return i+n+"/"+s+"/0/"+g+"."+_}}},transition:n.transition})||this).zDirection=n.zDirection,r}return ql(e,t),e}(wl),$l=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),th=function(t){function e(e,r,n,i,o,a){var s=this,u=e.getExtent(),l=r.getExtent(),h=l?Rt(n,l):n,c=rl(e,r,St(h),i),p=new al(e,r,h,u,c*Ku),f=a(p.calculateSourceExtent(),c,o),d=f?Da.IDLE:Da.EMPTY,_=f?f.getPixelRatio():1;return(s=t.call(this,n,i,_,d)||this).targetProj_=r,s.maxSourceExtent_=u,s.triangulation_=p,s.targetResolution_=i,s.targetExtent_=n,s.sourceImage_=f,s.sourcePixelRatio_=_,s.canvas_=null,s.sourceListenerKey_=null,s}return $l(e,t),e.prototype.disposeInternal=function(){this.state==Da.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Da.LOADED){var e=It(this.targetExtent_)/this.targetResolution_,r=Ot(this.targetExtent_)/this.targetResolution_;this.canvas_=il(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Da.IDLE){this.state=Da.LOADING,this.changed();var t=this.sourceImage_.getState();t==Da.LOADED||t==Da.ERROR?this.reproject_():(this.sourceListenerKey_=g(this.sourceImage_,N.CHANGE,function(t){var e=this.sourceImage_.getState();e!=Da.LOADED&&e!=Da.ERROR||(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){v(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(wu),eh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rh="imageloadstart",nh="imageloadend",ih="imageloaderror",oh=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return eh(e,t),e}(M);function ah(t,e){t.getImage().src=e}var sh=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return eh(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=S(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Ie(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Ie(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&pt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new th(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this)),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Da.LOADING:this.loading=!0,this.dispatchEvent(new oh(rh,e));break;case Da.LOADED:this.loading=!1,this.dispatchEvent(new oh(nh,e));break;case Da.ERROR:this.loading=!1,this.dispatchEvent(new oh(ih,e))}},e}(cl);function uh(t,e){var r=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))});var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var lh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hh=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:ah,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return lh(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&it(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};p(o,this.params_);var a=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2;if(1!=this.ratio_){var u=this.ratio_*It(t)/2,l=this.ratio_*Ot(t)/2;t[0]=a-u,t[1]=s-l,t[2]=a+u,t[3]=s+l}var h=e/r,c=Math.ceil(It(t)/h),f=Math.ceil(Ot(t)/h);t[0]=a-h*c/2,t[2]=a+h*c/2,t[1]=s-h*f/2,t[3]=s+h*f/2,this.imageSize_[0]=c,this.imageSize_[1]=f;var d=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Ru(t,e,r,d,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(N.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(":").pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var a=this.url_,s=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return s==a&&K(!1,50),uh(s,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){p(this.params_,t),this.image_=null,this.changed()},e}(sh),ch=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ph=function(t){function e(e,r,n,i,o){var a=this,s=void 0!==o?Da.IDLE:Da.LOADED;return(a=t.call(this,e,r,n,s)||this).loader_=void 0!==o?o:null,a.canvas_=i,a.error_=null,a}return ch(e,t),e.prototype.getError=function(){return this.error_},e.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=Da.ERROR):this.state=Da.LOADED,this.changed()},e.prototype.load=function(){this.state==Da.IDLE&&(this.state=Da.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))},e.prototype.getImage=function(){return this.canvas_},e}(wu),fh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dh=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return fh(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&it(i.getExtent(),t))return i;Mt(t=t.slice(),this.ratio_);var o=[It(t)/e*r,Ot(t)/e*r],a=this.canvasFunction_.call(this,t,e,r,o,n);return a&&(i=new ph(t,e,r,a)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(sh),_h=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var gh=function(t){function e(e){var r=t.call(this,{projection:e.projection,resolutions:e.resolutions})||this;return r.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,r.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,r.params_=e.params||{},r.url_=e.url,r.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:ah,r.hidpi_=void 0===e.hidpi||e.hidpi,r.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,r.ratio_=void 0!==e.ratio?e.ratio:1,r.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,r.image_=null,r.renderedRevision_=0,r}return _h(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&it(i.getExtent(),t))return i;1!=this.ratio_&&Mt(t=t.slice(),this.ratio_);var o=[It(t)/e*r,Ot(t)/e*r];if(void 0!==this.url_){var a=this.getUrl(this.url_,this.params_,t,o,n);(i=new Ru(t,e,r,a,this.crossOrigin_,this.imageLoadFunction_)).addEventListener(N.CHANGE,this.handleImageChange.bind(this))}else i=null;return this.image_=i,this.renderedRevision_=this.getRevision(),i},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){p(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,r,n,i){var o=function(t,e,r,n){var i=It(t),o=Ot(t),a=e[0],s=e[1],u=.0254/n;return s*i>a*o?i*r/(a*u):o*r/(s*u)}(r,n,this.metersPerUnit_,this.displayDpi_),a=St(r),s={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return p(s,e),uh(t,s)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(sh),yh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vh=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:ah;return(r=t.call(this,{attributions:e.attributions,projection:we(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Ru(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(N.CHANGE,r.handleImageChange.bind(r)),r}return yh(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return bt(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==Da.LOADED){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var a=Ot(r)/o,s=Math.ceil(It(r)/a);if(s!=i){var u=li(s,o),l=u.canvas;u.drawImage(n,0,0,i,o,0,0,l.width,l.height),this.image_.setImage(l)}}t.prototype.handleImageChange.call(this,e)},e}(sh),mh="1.3.0",Eh="carmentaserver",Th="geoserver",Sh="mapserver",wh="qgis",xh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Oh=[101,101],Rh=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:ah,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return xh(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=we(r),o=this.getProjection();o&&o!==i&&(e=rl(o,i,t,e),t=Me(t,i,o));var a=xt(t,e,0,Oh),s={SERVICE:"WMS",VERSION:mh,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};p(s,this.params_,n);var u=Math.floor((t[0]-a[0])/e),l=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=u,s[this.v13_?"J":"Y"]=l,this.getRequestUrl_(a,Oh,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:mh,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return p(r,e),uh(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=St(t),a=xt(o,i,0,[Math.ceil(It(t)/i),Math.ceil(Ot(t)/i)]),s=xt(o,i,0,[Math.ceil(this.ratio_*It(t)/i),Math.ceil(this.ratio_*Ot(t)/i)]),u=this.image_;if(u&&this.renderedRevision_==this.getRevision()&&u.getResolution()==e&&u.getPixelRatio()==r&&it(u.getExtent(),a))return u;var l={SERVICE:"WMS",VERSION:mh,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};p(l,this.params_),this.imageSize_[0]=Math.round(It(s)/i),this.imageSize_[1]=Math.round(Ot(s)/i);var h=this.getRequestUrl_(s,this.imageSize_,r,n,l);return this.image_=new Ru(s,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(N.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(K(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case Th:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case Sh:i.MAP_RESOLUTION=90*r;break;case Eh:case wh:i.DPI=90*r;break;default:K(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),uh(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){p(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||mh;this.v13_=Yn(t,"1.3")>=0},e}(sh),Ch=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ph='© OpenStreetMap contributors.',Ih=function(t){function e(e){var r,n=e||{};r=void 0!==n.attributions?n.attributions:[Ph];var i=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,cacheSize:n.cacheSize,crossOrigin:i,opaque:void 0===n.opaque||n.opaque,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,url:o,wrapX:n.wrapX,attributionsCollapsible:!1})||this}return Ch(e,t),e}(Cl),bh=r(3),Lh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mh=function(t){function e(e){var r=e||{};return t.call(this,r)||this}return Lh(e,t),e}(Bi),Fh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ah=function(t){function e(e){var r=t.call(this)||this;return r.boundHandleImageChange_=r.handleImageChange_.bind(r),r.layer_=e,r}return Fh(e,t),e.prototype.getFeatures=function(t){return n()},e.prototype.prepareFrame=function(t){return n()},e.prototype.renderFrame=function(t,e){return n()},e.prototype.loadedTileCallback=function(t,e,r){t[e]||(t[e]={}),t[e][r.tileCoord.toString()]=r},e.prototype.createLoadedTileFinder=function(t,e,r){return function(n,i){var o=this.loadedTileCallback.bind(this,r,n);return t.forEachLoadedTile(e,n,i,o)}.bind(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){},e.prototype.getDataAtPixel=function(t,e,r){return n()},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleFontsChanged=function(){},e.prototype.handleImageChange_=function(t){t.target.getState()===Da.LOADED&&this.renderIfReadyAndVisible()},e.prototype.loadImage=function(t){var e=t.getState();return e!=Da.LOADED&&e!=Da.ERROR&&t.addEventListener(N.CHANGE,this.boundHandleImageChange_),e==Da.IDLE&&(t.load(),e=t.getState()),e==Da.LOADED},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==vi.READY&&t.changed()},e}(G),Nh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dh=function(t){function e(e){var r=t.call(this,e)||this;return r.container=null,r.renderedResolution,r.tempTransform_=[1,0,0,1,0,0],r.pixelTransform=[1,0,0,1,0,0],r.inversePixelTransform=[1,0,0,1,0,0],r.context=null,r.containerReused=!1,r.createTransformStringCanvas_=li(1,1).canvas,r}return Nh(e,t),e.prototype.useContainer=function(t,e,r){var n,i,o=this.getLayer().getClassName();t&&""===t.style.opacity&&t.className===o&&((s=t.firstElementChild)instanceof HTMLCanvasElement&&(i=s.getContext("2d")));if(i&&i.canvas.style.transform===e?(this.container=t,this.context=i,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){(n=document.createElement("div")).className=o;var a=n.style;a.position="absolute",a.width="100%",a.height="100%";var s=(i=li()).canvas;n.appendChild(s),(a=s.style).position="absolute",a.left="0",a.transformOrigin="top left",this.container=n,this.context=i}},e.prototype.clip=function(t,e,r){var n=e.pixelRatio,i=e.size[0]*n/2,o=e.size[1]*n/2,a=e.viewState.rotation,s=Ct(r),u=Pt(r),l=Tt(r),h=Et(r);Ze(e.coordinateToPixelTransform,s),Ze(e.coordinateToPixelTransform,u),Ze(e.coordinateToPixelTransform,l),Ze(e.coordinateToPixelTransform,h),t.save(),La(t,-a,i,o),t.beginPath(),t.moveTo(s[0]*n,s[1]*n),t.lineTo(u[0]*n,u[1]*n),t.lineTo(l[0]*n,l[1]*n),t.lineTo(h[0]*n,h[1]*n),t.clip(),La(t,a,i,o)},e.prototype.clipUnrotated=function(t,e,r){var n=Ct(r),i=Pt(r),o=Tt(r),a=Et(r);Ze(e.coordinateToPixelTransform,n),Ze(e.coordinateToPixelTransform,i),Ze(e.coordinateToPixelTransform,o),Ze(e.coordinateToPixelTransform,a);var s=this.inversePixelTransform;Ze(s,n),Ze(s,i),Ze(s,o),Ze(s,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,r){var n=this.getLayer();if(n.hasListener(t)){var i=new $o(t,this.inversePixelTransform,r,e);n.dispatchEvent(i)}},e.prototype.preRender=function(t,e){this.dispatchRenderEvent_(vn,t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_(mn,t,e)},e.prototype.getRenderTransform=function(t,e,r,n,i,o,a){var s=i/2,u=o/2,l=n/e,h=-l,c=-t[0]+a,p=-t[1];return He(this.tempTransform_,s,u,l,h,-r,c,p)},e.prototype.getDataAtPixel=function(t,e,r){var n,i=Ze(this.inversePixelTransform,t.slice()),o=this.context;try{n=o.getImageData(Math.round(i[0]),Math.round(i[1]),1,1).data}catch(t){return"SecurityError"===t.name?new Uint8Array:n}return 0===n[3]?null:n},e.prototype.createTransformString=function(t){return this.createTransformStringCanvas_.style.transform=Je(t),this.createTransformStringCanvas_.style.transform},e}(Ah),Gh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jh=function(t){function e(e){var r=t.call(this,e)||this;return r.image_=null,r}return Gh(e,t),e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},e.prototype.prepareFrame=function(t){var e=t.layerStatesArray[t.layerIndex],r=t.pixelRatio,n=t.viewState,i=n.resolution,o=this.getLayer().getSource(),a=t.viewHints,s=t.extent;if(void 0!==e.extent&&(s=Rt(s,Ye(e.extent,n.projection))),!a[Dn]&&!a[Gn]&&!Lt(s)){var u=n.projection,l=o.getImage(s,i,r,u);l&&this.loadImage(l)&&(this.image_=l)}return!!this.image_},e.prototype.renderFrame=function(t,e){var r=this.image_,n=r.getExtent(),i=r.getResolution(),o=r.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],s=t.pixelRatio,u=t.viewState,l=u.center,h=u.resolution,c=t.size,p=s*i/(h*o),f=Math.round(c[0]*s),d=Math.round(c[1]*s),_=u.rotation;if(_){var g=Math.round(Math.sqrt(f*f+d*d));f=g,d=g}He(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,_,-f/2,-d/2),qe(this.inversePixelTransform,this.pixelTransform);var y=this.createTransformString(this.pixelTransform);this.useContainer(e,y,a.opacity);var v=this.context,m=v.canvas;m.width!=f||m.height!=d?(m.width=f,m.height=d):this.containerReused||v.clearRect(0,0,f,d);var E=!1;if(a.extent){var T=Ye(a.extent,u.projection);(E=!it(T,t.extent)&&bt(T,t.extent))&&this.clipUnrotated(v,t,T)}var S=r.getImage(),w=He(this.tempTransform_,f/2,d/2,p,p,0,o*(n[0]-l[0])/i,o*(l[1]-n[3])/i);this.renderedResolution=i*s/o;var x=w[4],O=w[5],R=S.width*w[0],C=S.height*w[3];if(this.preRender(v,t),R>=.5&&C>=.5){var P=a.opacity,I=void 0;1!==P&&(I=this.context.globalAlpha,this.context.globalAlpha=P),this.context.drawImage(S,0,0,+S.width,+S.height,Math.round(x),Math.round(O),Math.round(R),Math.round(C)),1!==P&&(this.context.globalAlpha=I)}return this.postRender(v,t),E&&v.restore(),y!==m.style.transform&&(m.style.transform=y),this.container},e}(Dh),kh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Uh=function(t){function e(e){return t.call(this,e)||this}return kh(e,t),e.prototype.createRenderer=function(){return new jh(this)},e}(Mh),Bh="preload",Yh="useInterimTilesOnError",zh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xh=function(t){function e(e){var r=this,n=e||{},i=p({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return zh(e,t),e.prototype.getPreload=function(){return this.get(Bh)},e.prototype.setPreload=function(t){this.set(Bh,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(Yh)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Yh,t)},e}(Bi),Vh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wh=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new hs(0,0,0,0),r}return Vh(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==wn.LOADED||r==wn.EMPTY||r==wn.ERROR&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==wn.ERROR&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(wn.LOADED)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],n=t.viewState,i=n.projection,a=n.resolution,s=n.center,u=n.rotation,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),p=c.getRevision(),f=c.getTileGridForProjection(i),d=f.getZForResolution(a,c.zDirection),_=f.getResolution(d),g=t.extent,y=r.extent&&Ye(r.extent,i);y&&(g=Rt(g,Ye(r.extent,i)));var v=c.getTilePixelRatio(l),m=Math.round(t.size[0]*v),T=Math.round(t.size[1]*v);if(u){var S=Math.round(Math.sqrt(m*m+T*T));m=S,T=S}var w=_*m/2/v,x=_*T/2/v,O=[s[0]-w,s[1]-x,s[0]+w,s[1]+x],R=f.getTileRangeForExtentAndZ(g,d),C={};C[d]={};var P=this.createLoadedTileFinder(c,i,C),I=this.tmpExtent,b=this.tmpTileRange_;this.newTiles_=!1;for(var L=R.minX;L<=R.maxX;++L)for(var M=R.minY;M<=R.maxY;++M){var F=this.getTile(d,L,M,t);if(this.isDrawableTile(F)){var A=o(this);if(F.getState()==wn.LOADED){C[d][F.tileCoord.toString()]=F;var N=F.inTransition(A);this.newTiles_||!N&&-1!==this.renderedTiles.indexOf(F)||(this.newTiles_=!0)}if(1===F.getAlpha(A,t.time))continue}var D=f.getTileCoordChildTileRange(F.tileCoord,b,I),G=!1;D&&(G=P(d+1,D)),G||f.forEachTileCoordParentTileRange(F.tileCoord,P,b,I)}var j=_/a;He(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/v,1/v,u,-m/2,-T/2);var k=this.createTransformString(this.pixelTransform);this.useContainer(e,k,r.opacity);var U=this.context,B=U.canvas;qe(this.inversePixelTransform,this.pixelTransform),He(this.tempTransform_,m/2,T/2,j,j,0,-m/2,-T/2),B.width!=m||B.height!=T?(B.width=m,B.height=T):this.containerReused||U.clearRect(0,0,m,T),y&&this.clipUnrotated(U,t,y),this.preRender(U,t),this.renderedTiles.length=0;var Y,z,X,V=Object.keys(C).map(Number);V.sort(E),1!==r.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(Y=[],z=[]):V=V.reverse();for(var W=V.length-1;W>=0;--W){var Z=V[W],K=c.getTilePixelSize(Z,l,i),H=f.getResolution(Z)/_,q=K[0]*H*j,J=K[1]*H*j,Q=f.getTileCoordForCoordAndZ(Ct(O),Z),$=f.getTileCoordExtent(Q),tt=Ze(this.tempTransform_,[v*($[0]-O[0])/_,v*(O[3]-$[3])/_]),et=v*c.getGutterForProjection(i),rt=C[Z];for(var nt in rt){var it=(F=rt[nt]).tileCoord,ot=tt[0]-(Q[1]-it[1])*q,at=Math.round(ot+q),st=tt[1]-(Q[2]-it[2])*J,ut=Math.round(st+J),lt=at-(L=Math.round(ot)),ht=ut-(M=Math.round(st)),ct=d===Z;if(!(N=ct&&1!==F.getAlpha(o(this),t.time)))if(Y){U.save(),X=[L,M,L+lt,M,L+lt,M+ht,L,M+ht];for(var ft=0,dt=Y.length;ftStamen Design, under CC BY 3.0.',Ph],uc={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},lc={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}},hc=function(t){function e(e){var r=e.layer.indexOf("-"),n=-1==r?e.layer:e.layer.slice(0,r),i=lc[n],o=uc[e.layer],a=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;return t.call(this,{attributions:sc,cacheSize:e.cacheSize,crossOrigin:"anonymous",maxZoom:null!=e.maxZoom?e.maxZoom:i.maxZoom,minZoom:null!=e.minZoom?e.minZoom:i.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:a,wrapX:e.wrapX})||this}return ac(e,t),e}(Cl),cc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function pc(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_||(e=1);var i=n.getTileCoordExtent(t,this.tmpExtent_),o=xi(n.getTileSize(t[0]),this.tmpSize);1!=e&&(o=wi(o,e,this.tmpSize));var a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return p(a,this.params_),this.getRequestUrl_(t,o,i,e,r,a)}}var fc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:pc,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).params_=n.params||{},r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.setKey(r.getKeyForParams_()),r}return cc(e,t),e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){var s,u=i.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=r.join(","),o.BBOXSR=u,o.IMAGESR=u,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),1==a.length)s=a[0];else s=a[Vt(ds(t),a.length)];return uh(s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_?t:1},e.prototype.updateParams=function(t){p(this.params_,t),this.setKey(this.getKeyForParams_())},e}(wl),dc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_c=function(t){function e(e,r,n){var i=t.call(this,e,wn.LOADED)||this;return i.tileSize_=r,i.text_=n,i.canvas_=null,i}return dc(e,t),e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=li(t[0],t[1]);return e.strokeStyle="grey",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="grey",e.strokeStyle="white",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.lineWidth=4,e.strokeText(this.text_,t[0]/2,t[1]/2,t[0]),e.fillText(this.text_,t[0]/2,t[1]/2,t[0]),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(qu),gc=function(t){function e(e){var r=e||{};return t.call(this,{opaque:!1,projection:r.projection,tileGrid:r.tileGrid,wrapX:void 0===r.wrapX||r.wrapX,zDirection:r.zDirection})||this}return dc(e,t),e.prototype.getTile=function(t,e,r){var n=ps(t,e,r);if(this.tileCache.containsKey(n))return this.tileCache.get(n);var i=xi(this.tileGrid.getTileSize(t)),o=[t,e,r],a=this.getTileCoordForTileUrlFunction(o),s=void 0;s=a?"z:"+a[0]+" x:"+a[1]+" y:"+a[2]:"none";var u=new _c(o,i,s);return this.tileCache.set(n,u),u},e}(Cl),yc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vc=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:we("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:vi.LOADING,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this;if(r.tileJSON_=null,r.tileSize_=e.tileSize,e.url)if(e.jsonp)Zu(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):K(!1,51);return r}return yc(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,r=we("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=be(r,n);e=Ft(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=vs({extent:Ts(n),maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=zu(t.tiles,s),void 0!==t.attribution&&!this.getAttributions()){var u=void 0!==e?e:r.getExtent();this.setAttributions(function(e){return bt(u,e.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState(vi.READY)},e.prototype.handleTileJSONError=function(){this.setState(vi.ERROR)},e}(wl),mc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ec(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=xi(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=Si(a,s,this.tmpSize),o=tt(o,i*s,o)),1!=e&&(a=wi(a,e,this.tmpSize));var u={SERVICE:"WMS",VERSION:mh,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return p(u,this.params_),this.getRequestUrl_(t,a,o,e,r,u)}}var Tc=function(t){function e(e){var r=this,n=e||{},i=n.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:Ec,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=i,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return mc(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=we(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),u=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=u[0])){var l=a.getResolution(u[0]),h=a.getTileCoordExtent(u,this.tmpExtent_),c=xi(a.getTileSize(u[0]),this.tmpSize),f=this.gutter_;0!==f&&(c=Si(c,f,this.tmpSize),h=tt(h,l*f,h)),o&&o!==i&&(l=rl(o,i,t,l),h=Fe(h,i,o),t=Me(t,i,o));var d={SERVICE:"WMS",VERSION:mh,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};p(d,this.params_,n);var _=Math.floor((t[0]-h[0])/l),g=Math.floor((h[3]-t[1])/l);return d[this.v13_?"I":"X"]=_,d[this.v13_?"J":"Y"]=g,this.getRequestUrl_(u,c,h,1,o||i,d)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:mh,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return p(r,e),uh(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case Th:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case Sh:o.MAP_RESOLUTION=90*n;break;case Eh:case wh:o.DPI=90*n;break;default:K(!1,52)}var u,l=i.getAxisOrientation(),h=r;if(this.v13_&&"ne"==l.substr(0,2)){var c=void 0;c=r[0],h[0]=r[1],h[1]=c,c=r[2],h[2]=r[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)u=a[0];else u=a[Vt(ds(t),a.length)];return uh(u,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){p(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||mh;this.v13_=Yn(t,"1.3")>=0},e}(wl),Sc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wc=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r)||this;return s.src_=n,s.extent_=i,s.preemptive_=o,s.grid_=null,s.keys_=null,s.data_=null,s.jsonp_=a,s}return Sc(e,t),e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),r=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-r)*this.grid_.length)];if("string"!=typeof n)return null;var i=n.charCodeAt(Math.floor(e*n.length));i>=93&&i--,i>=35&&i--;var o=null;if((i-=32)in this.keys_){var a=this.keys_[i];o=this.data_&&a in this.data_?this.data_[a]:a}return o},e.prototype.forDataAtCoordinate=function(t,e,r){this.state==wn.IDLE&&!0===r?(y(this,N.CHANGE,function(r){e(this.getData(t))},this),this.loadInternal_()):!0===r?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=wn.ERROR,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=wn.EMPTY,this.changed()},e.prototype.loadInternal_=function(){if(this.state==wn.IDLE)if(this.state=wn.LOADING,this.jsonp_)Zu(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(r)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_&&this.loadInternal_()},e}(qu),xc=function(t){function e(e){var r=t.call(this,{projection:we("EPSG:3857"),state:vi.LOADING})||this;if(r.preemptive_=void 0===e.preemptive||e.preemptive,r.tileUrlFunction_=Vu,r.template_=void 0,r.jsonp_=e.jsonp||!1,e.url)if(r.jsonp_)Zu(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):K(!1,51);return r}return Sc(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,r,n){if(this.tileGrid){var i=this.tileGrid.getZForResolution(e,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(t,i);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(t,r,n)}else!0===n?setTimeout(function(){r(null)},0):r(null)},e.prototype.handleTileJSONError=function(){this.setState(vi.ERROR)},e.prototype.handleTileJSONResponse=function(t){var e,r=we("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=be(r,n);e=Ft(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=vs({extent:Ts(n),maxZoom:a,minZoom:o});this.tileGrid=s,this.template_=t.template;var u=t.grids;if(u){if(this.tileUrlFunction_=zu(u,s),void 0!==t.attribution){var l=void 0!==e?e:r.getExtent();this.setAttributions(function(e){return bt(l,e.extent)?[t.attribution]:null})}this.setState(vi.READY)}else this.setState(vi.ERROR)},e.prototype.getTile=function(t,e,r,n,i){var o=ps(t,e,r);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=this.tileUrlFunction_(s,n,i),l=new wc(a,void 0!==u?wn.IDLE:wn.EMPTY,void 0!==u?u:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},e.prototype.useTile=function(t,e,r){var n=ps(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(_l),Oc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Rc=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,{transition:0})||this;return s.context_={},s.executorGroups={},s.loadingSourceTiles=0,s.errorSourceTileKeys={},s.hitDetectionImageData=null,s.replayState_={},s.wantedResolution,s.getSourceTiles=o.bind(s,s),s.removeSourceTiles_=a,s.sourceTileGrid_=i,s.sourceTileListenerKeys=[],s.sourceZ=-1,s.hifi=!1,s.wrappedTileCoord=n,s}return Oc(e,t),e.prototype.disposeInternal=function(){for(var e in this.sourceTileListenerKeys.forEach(v),this.sourceTileListenerKeys.length=0,this.removeSourceTiles_(this),this.context_){var r=this.context_[e].canvas;r.width=0,r.height=0}for(var e in this.executorGroups)for(var n=this.executorGroups[e],i=0,o=n.length;i0&&_[0].tileCoord[0]===f)h=_,c=!0,p=f;else{h=[],p=f+1;do{--p,c=!0,u.forEachTileCoord(o,p,function(n){var i,o=fs(n);if(o in this.sourceTileByCoordKey_){var a=(i=this.sourceTileByCoordKey_[o]).getState();if(a===wn.LOADED||a===wn.ERROR||a===wn.EMPTY)return void h.push(i)}else if(p===f){var s=this.tileUrlFunction(n,t,e);void 0!==s&&((i=new this.tileClass(n,wn.IDLE,s,this.format_,this.tileLoadFunction)).extent=u.getTileCoordExtent(n),i.projection=e,i.resolution=u.getResolution(n[0]),this.sourceTileByCoordKey_[o]=i,i.addEventListener(N.CHANGE,this.handleTileChange.bind(this)),i.load())}if(c=!1,i&&i.getState()!==wn.EMPTY&&r.getState()===wn.IDLE){r.loadingSourceTiles++;var l=g(i,N.CHANGE,function(){var t,e,n,o=i.getState(),a=i.getKey();if(o===wn.LOADED||o===wn.ERROR){o===wn.LOADED?(t=r.sourceTileListenerKeys,e=l,n=t.indexOf(e),n>-1&&t.splice(n,1),v(l),r.loadingSourceTiles--,delete r.errorSourceTileKeys[a]):o===wn.ERROR&&(r.errorSourceTileKeys[a]=!0);var s=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-s==0&&(r.hifi=0===s,r.sourceZ=f,r.setState(wn.LOADED))}});r.sourceTileListenerKeys.push(l)}}.bind(this)),c||(h.length=0)}while(!c&&p>d)}return r.getState()===wn.IDLE&&r.setState(wn.LOADING),c&&(r.hifi=f===p,r.sourceZ=p,r.getState()0&&(r.tileUrlFunction=Xu(o.map(Nc.bind(r)))),r}return Fc(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(Xu(t.map(Nc.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){p(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e}(wl);function Nc(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==Mc.KVP&&p(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==Mc.KVP?uh(t,r):t.replace(/\{(\w+?)\}/g,function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t});var n=this.tileGrid,i=this.dimensions_;return function(r,o,a){if(r){var s={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};p(s,i);var u=t;return u=e==Mc.KVP?uh(u,s):u.replace(/\{(\w+?)\}/g,function(t,e){return s[e]})}}}var Dc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gc={GENERATE_BUFFERS:"GENERATE_BUFFERS"},jc=function(t){function e(e,r){var n=t.call(this,e)||this,i=r||{};return n.helper=new uu({postProcesses:i.postProcesses,uniforms:i.uniforms}),n}return Dc(e,t),e.prototype.disposeInternal=function(){this.helper.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getShaderCompileErrors=function(){return this.helper.getShaderCompileErrors()},e}(Ah);var kc=jc,Uc=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;rthis.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[Qc.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Qc.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,u=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!R(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=u)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=u)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Qc.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=et(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;tt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(fa),ep=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rp=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_=null,o.hitDetectionImage_=null,o.image_=null,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o}return ep(e,t),e.prototype.drawCoordinates_=function(t,e,r,n){return this.appendFlatCoordinates(t,e,r,n,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([Qc.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([Qc.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([Qc.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([Qc.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(1),o=t.getImage(1),a=t.getOrigin();this.anchorX_=r[0],this.anchorY_=r[1],this.declutterGroups_=e,this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.width_=n[0]},e}(tp),np=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ip=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return np(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatCoordinates(t,e,r,n,!1,!1),a=[Qc.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Qc.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],qc);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Hc),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Qc.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],qc);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),u=0,l=0,h=o.length;lt&&(y>g&&(g=y,d=v,_=o),y=0,v=o-i)),a=s,h=p,c=f),u=m,l=E}return(y+=s)>g?[v,o]:[d,_]}var up=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lp={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},hp={Circle:ap,Default:tp,Image:rp,LineString:ip,Polygon:ap,Text:function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_,o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",Ea.prune(),o}return up(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o,a,s=this.coordinates.length,u=t.getType(),l=null,h=2,c=2;if(i.placement===ku.LINE){if(!bt(this.getBufferedMaxExtent(),t.getExtent()))return;var p=void 0;if(l=t.getFlatCoordinates(),c=t.getStride(),u==Nt.LINE_STRING)p=[l.length];else if(u==Nt.MULTI_LINE_STRING)p=t.getEnds();else if(u==Nt.POLYGON)p=t.getEnds().slice(0,1);else if(u==Nt.MULTI_POLYGON){var f=t.getEndss();for(p=[],o=0,a=f.length;ot[r-n],_=i.length,g=t[e],y=t[e+1],v=t[e+=n],m=t[e+1],E=0,T=Math.sqrt(Math.pow(v-g,2)+Math.pow(m-y,2)),S=!1,w=0;w<_;++w){for(var x=i[c=d?_-w-1:w],O=s*u(l,x,h),R=o+O/2;e0?-Math.PI:Math.PI),void 0!==p){var I=P-p;if(S=S||0!==I,I+=I>Math.PI?-2*Math.PI:I<-Math.PI?2*Math.PI:0,Math.abs(I)>a)return null}p=P;var b=C/T,L=Wt(g,v,b),M=Wt(y,m,b);f[c]=[L,M,O/2,P,x],o+=O}return S?f:[[f[0][0],f[0][1],f[0][2],f[0][3],i]]}var dp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_p=[1/0,1/0,-1/0,-1/0],gp=[1,0,0,1,0,0],yp=[],vp=[],mp=[],Ep=[],Tp=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.overlaps=n,o.pixelRatio=r,o.resolution=e,o.alignFill_,o.declutterItems=[],o.instructions=i.instructions,o.coordinates=i.coordinates,o.coordinateCache_={},o.renderedTransform_=[1,0,0,1,0,0],o.hitDetectionInstructions=i.hitDetectionInstructions,o.pixelCoordinates_=null,o.viewRotation_=0,o.fillStates=i.fillStates||{},o.strokeStates=i.strokeStates||{},o.textStates=i.textStates||{},o.widths_={},o}return dp(e,t),e.prototype.disposeInternal=function(){Ea.release(this),t.prototype.disposeInternal.call(this)},e.prototype.getTextImage=function(t,e,r,n){var i,o=n+e+t+r+this.pixelRatio;if(!Ea.containsKey(o)){var a=n?this.strokeStates[n]:null,s=r?this.fillStates[r]:null,u=this.textStates[e],l=this.pixelRatio,h=u.scale*l,c=lp[u.textAlign||"center"],p=n&&a.lineWidth?a.lineWidth:0,f=t.split("\n"),d=f.length,_=[],g=function(t,e,r){for(var n=e.length,i=0,o=0;on.width?n.width-l:d,E=s+h>n.height?n.height-h:s,T=_[3]+m*p+_[1],S=_[0]+E*p+_[2],w=e-_[3],x=r-_[0];(v||0!==c)&&(yp[0]=w,Ep[0]=w,yp[1]=x,vp[1]=x,vp[0]=w+T,mp[0]=vp[0],mp[1]=x+S,Ep[1]=mp[1]);var O=null;if(0!==c){var R=e+i,C=r+o;O=He(gp,R,C,1,1,c,-R,-C),Ze(gp,yp),Ze(gp,vp),Ze(gp,mp),Ze(gp,Ep),ut(Math.min(yp[0],vp[0],mp[0],Ep[0]),Math.min(yp[1],vp[1],mp[1],Ep[1]),Math.max(yp[0],vp[0],mp[0],Ep[0]),Math.max(yp[1],vp[1],mp[1],Ep[1]),_p)}else ut(w,x,w+T,x+S,_p);var P=t.canvas,I=y?y[2]*p/2:0,b=_p[0]-I<=P.width&&_p[2]+I>=0&&_p[1]-I<=P.height&&_p[3]+I>=0;if(f&&(e=Math.round(e),r=Math.round(r)),a){if(!b&&1==a[4])return;ft(a,_p);var L=b?[t,O?O.slice(0):null,u,n,l,h,m,E,e,r,p]:null;L&&(v&&L.push(g,y,yp,vp,mp,Ep),a.push(L))}else b&&(v&&this.replayTextBackground_(t,yp,vp,mp,Ep,g,y),Fa(t,O,u,n,l,h,m,E,e,r,p))},e.prototype.fill_=function(t){if(this.alignFill_){var e=Ze(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},e.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},e.prototype.renderDeclutter=function(t,e,r,n){if(t&&t.length>5){var i=t[4];if(1==i||i==t.length-5){var o={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(n||(n=new Ml.a(9)),!n.collides(o)){n.insert(o);for(var a=5,s=t.length;a11&&this.replayTextBackground_(u[0],u[13],u[14],u[15],u[16],u[11],u[12]),Fa.apply(void 0,u),h!==r&&(l.globalAlpha=h)}}t.length=5,lt(t)}}return n},e.prototype.drawTextImageWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.getTextImage(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,u=lp[i.textAlign||"center"],l=lp[i.textBaseline||"middle"],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:u*(o.width/s-2*i.scale)+2*(.5-u)*h,anchorY:l*o.height/s+2*(.5-l)*h}},e.prototype.execute_=function(t,e,r,n,i,o){var a,s,u;this.declutterItems.length=0,this.pixelCoordinates_&&R(e,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=Dt(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),s=this.renderedTransform_,u=e,s[0]=u[0],s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5]);for(var l,h,c,p,f,d,_,g,y,v,m,E,T,S,w,x,O,C=0,P=r.length,I=0,b=0,L=0,M=null,F=null,A=this.coordinateCache_,N=this.viewRotation_,D=Math.round(1e12*Math.atan2(-e[1],e[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},j=this.instructions!=r||this.overlaps?0:200;Cj&&(this.fill_(t),b=0),L>j&&(t.stroke(),L=0),b||L||(t.beginPath(),p=NaN,f=NaN),++C;break;case Qc.CIRCLE:var U=a[I=k[1]],B=a[I+1],Y=a[I+2]-U,z=a[I+3]-B,X=Math.sqrt(Y*Y+z*z);t.moveTo(U+X,B),t.arc(U,B,X,0,2*Math.PI,!0),++C;break;case Qc.CLOSE_PATH:t.closePath(),++C;break;case Qc.CUSTOM:I=k[1],l=k[2];var V=k[3],W=k[4],Z=6==k.length?k[5]:void 0;G.geometry=V,G.feature=w,C in A||(A[C]=[]);var K=A[C];Z?Z(a,I,l,2,K):(K[0]=a[I],K[1]=a[I+1],K.length=2),W(K,G),++C;break;case Qc.DRAW_IMAGE:I=k[1],l=k[2],v=k[3],h=k[4],c=k[5],y=i?null:k[6];var H=k[7],q=k[8],J=k[9],Q=k[10],$=k[11],tt=k[12],et=k[13],rt=k[14];if(!v&&k.length>=19){m=k[18],E=k[19],T=k[20],S=k[21];var nt=this.drawTextImageWithPointPlacement_(m,E,T,S);v=nt.label,k[3]=v;var it=k[22];h=(nt.anchorX-it)*this.pixelRatio,k[4]=h;var ot=k[23];c=(nt.anchorY-ot)*this.pixelRatio,k[5]=c,H=v.height,k[7]=H,rt=v.width,k[14]=rt}var at=void 0;k.length>24&&(at=k[24]);var st=void 0,ut=void 0,lt=void 0;k.length>16?(st=k[15],ut=k[16],lt=k[17]):(st=ma,ut=!1,lt=!1),$&&D?tt+=N:$||D||(tt-=N);for(var ht=0,ct=0;I=o;)Rp(r,t+i,t+o),Rp(r,t+o,t+i),Rp(r,t-o,t+i),Rp(r,t-i,t+o),Rp(r,t-i,t-o),Rp(r,t-o,t-i),Rp(r,t+o,t-i),Rp(r,t+i,t-o),2*((a+=1+2*++o)-i)+1>0&&(a+=1-2*(i-=1));return Op[t]=r,r}(n);function p(t){for(var e=l.getImageData(0,0,a,a).data,r=0;r0){var s=void 0;return(!o||h!=Ga.IMAGE&&h!=Ga.TEXT||-1!==o.indexOf(t))&&(s=i(t)),s||void l.clearRect(0,0,a,a)}}var f,d,_,g,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(E),f=v.length-1;f>=0;--f){var m=v[f].toString();for(_=this.executorsByZIndex_[m],d=wp.length-1;d>=0;--d)if(void 0!==(g=_[h=wp[d]])&&(y=g.executeHitDetection(l,s,r,p,u)))return y}},e.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return Dt(a,0,8,2,t,a),a},e.prototype.isEmpty=function(){return _(this.executorsByZIndex_)},e.prototype.execute=function(t,e,r,n,i,o){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(E),this.maxExtent_&&(t.save(),this.clip(t,e));var s,u,l,h,c,p,f=i||wp;for(s=0,u=a.length;s=i)for(n=i;n0&&(a.width=0),this.container;var u=Math.round(t.size[0]*r),l=Math.round(t.size[1]*r);a.width!=u||a.height!=l?(a.width=u,a.height=l,a.style.transform!==i&&(a.style.transform=i)):this.containerReused||o.clearRect(0,0,u,l),this.preRender(o,t);var h=t.extent,c=t.viewState,p=c.center,f=c.resolution,d=c.projection,_=c.rotation,g=d.getExtent(),y=this.getLayer().getSource(),v=!1;if(n.extent){var m=Ye(n.extent,d);(v=!it(m,t.extent)&&bt(m,t.extent))&&this.clip(o,t,m)}var E=t.viewHints,T=!(E[Dn]||E[Gn]),S=this.getRenderTransform(p,f,_,r,u,l,0),w=this.getLayer().getDeclutter()?{}:null;if(s.execute(o,S,_,T,void 0,w),y.getWrapX()&&d.canWrapX()&&!it(g,h)){for(var x=h[0],O=It(g),R=0,C=void 0;xg[2];){C=O*++R;var I=this.getRenderTransform(p,f,_,r,u,l,C);s.execute(o,I,_,T,void 0,w),x-=O}}if(w){var b=t.viewHints;Cp(w,o,_,1,!(b[Dn]||b[Gn]),t.declutterItems)}v&&o.restore(),this.postRender(o,t);var L=n.opacity,M=this.container;return L!==parseFloat(M.style.opacity)&&(M.style.opacity=1===L?"":L),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,r){this.hitDetectionImageData_||this.animatingOrInteracting_?e(bp(t,this.renderedFeatures_,this.hitDetectionImageData_)):requestAnimationFrame(function(){var r=[this.context.canvas.width,this.context.canvas.height];Ze(this.pixelTransform,r);var n=this.renderedCenter_,i=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,s=this.renderedExtent_,u=this.getLayer(),l=[],h=r[0]/2,c=r[1]/2;l.push(this.getRenderTransform(n,i,o,.5,h,c,0).slice());var p=u.getSource(),f=a.getExtent();if(p.getWrapX()&&a.canWrapX()&&!it(f,s)){for(var d=s[0],_=It(f),g=0,y=void 0;df[2];)y=_*++g,l.push(this.getRenderTransform(n,i,o,.5,h,c,y).slice()),d-=_}this.hitDetectionImageData_=Ip(r,l,this.renderedFeatures_,u.getStyleFunction(),s,i,o),e(bp(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){if(this.replayGroup_){var a=e.viewState.resolution,s=e.viewState.rotation,u=this.getLayer(),l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,a,s,r,function(t){var e=o(t);if(!(e in l))return l[e]=!0,n(t,u)},u.getDeclutter()?i:null)}},e.prototype.handleFontsChanged=function(){var t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource(),n=t.viewHints[Dn],i=t.viewHints[Gn],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(!this.dirty_&&!o&&n||!a&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var s=t.extent,u=t.viewState,l=u.projection,h=u.resolution,c=t.pixelRatio,p=e.getRevision(),f=e.getRenderBuffer(),d=e.getRenderOrder();void 0===d&&(d=Ua);var _=u.center.slice(),g=tt(s,f*h),y=u.projection.getExtent();if(r.getWrapX()&&u.projection.canWrapX()&&!it(y,t.extent)){var v=It(y),m=Math.max(It(g)/2,v);g[0]=y[0]-m,g[2]=y[2]+m;var E=Math.floor((_[0]-y[0])/v);_[0]-=E*v}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&it(this.renderedExtent_,g))return this.replayGroupChanged=!1,!0;this.replayGroup_&&this.replayGroup_.dispose(),this.replayGroup_=null,this.dirty_=!1;var T,S=new cp(Ya(h,c),g,h,c,e.getDeclutter()),w=je();w?(r.loadFeatures(Be(g,l),h,w),T=be(w,l)):r.loadFeatures(g,h,l);var x=Ba(h,c),O=function(t){var r,n=t.getStyleFunction()||e.getStyleFunction();if(n&&(r=n(t,h)),r){var i=this.renderFeature(t,x,r,S,T);this.dirty_=this.dirty_||i}}.bind(this),R=Be(g,l),C=r.getFeaturesInExtent(R);d&&C.sort(d);for(var P=0,I=C.length;P=0;--R){var C=S[R];if(C.getState()!=wn.ABORT)for(var P=C.tileCoord,I=w.getTileCoordExtent(C.wrappedTileCoord),b=w.getTileCoordExtent(P,this.tmpExtent)[0]-I[0],L=Ve(Ke(this.inversePixelTransform.slice(),1/d,1/d),this.getRenderTransform(g,y,v,d,E,T,b)),M=C.executorGroups[o(a)],F=!1,A=0,N=M.length;A8){e.animate=!0;break}var n=this.renderTileImageQueue_[r];delete this.renderTileImageQueue_[r],this.renderTileImage_(n,e)}},e.prototype.renderFeature=function(t,e,r,n){if(!r)return!1;var i=!1;if(Array.isArray(r))for(var o=0,a=r.length;o>1)],e))<0?a=n+1:(s=n,u=!i);return u?a:~a}(p,g);if(y<0){var v=(g-p[-y-2])/(p[-y-1]-p[-y-2]),m=e+(-y-2)*n;a=Wt(t[m],t[m+n],v),s=Wt(t[m+1],t[m+n+1],v)}else a=t[e+y*n],s=t[e+y*n+1]}return o?(o[0]=a,o[1]=s,o):[a,s]}function zp(t,e,r,n,i,o){if(r==e)return null;var a;if(i>1;i0&&g.length>0;)o=g.pop(),h=d.pop(),p=_.pop(),(u=o.toString())in y||(l.push(p[0],p[1]),y[u]=!0),a=g.pop(),c=d.pop(),f=_.pop(),Bt((i=e(n=t(s=(o+a)/2)))[0],i[1],p[0],p[1],f[0],f[1])this.featurePool_.length;)s=new q,this.featurePool_.push(s);var l=n.getFeaturesCollection();l.clear();var h,c,p,f=0;for(h=0,c=this.meridians_.length;h0)break}this.source_&&(this.source_.clear(),this.source_.addFeatures(a)),this.dispatchEvent(new uf(sf,t,a,i))},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[g(e,N.DROP,lf,this),g(e,N.DRAGENTER,hf,this),g(e,N.DRAGOVER,hf,this),g(e,N.DROP,hf,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(v),this.dropListenKeys_=null)},e}(to),pf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ff=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).condition_=n.condition?n.condition:po,r.lastAngle_=void 0,r.lastMagnitude_=void 0,r.lastScaleDelta_=0,r.duration_=void 0!==n.duration?n.duration:400,r}return pf(e,t),e.prototype.handleDragEvent=function(t){if(_o(t)){var e=t.map,r=e.getSize(),n=t.pixel,i=n[0]-r[0]/2,o=r[1]/2-n[1],a=Math.atan2(o,i),s=Math.sqrt(i*i+o*o),u=e.getView();if(void 0!==this.lastAngle_){var l=this.lastAngle_-a;u.adjustRotationInternal(l)}this.lastAngle_=a,void 0!==this.lastMagnitude_&&u.adjustResolutionInternal(this.lastMagnitude_/s),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/s),this.lastMagnitude_=s}},e.prototype.handleUpEvent=function(t){if(!_o(t))return!0;var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!_o(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(mo),df=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_f=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return df(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||vt(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===un.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e),n=!1):this.freehand_&&e.type===un.POINTERDOWN?n=!1:r?(n=e.type===un.POINTERMOVE)&&this.freehand_?n=this.handlePointerMove_(e):("mouse"==e.pointerEvent.pointerType||e.type===un.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===un.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new hn(un.POINTERMOVE,t.map,t.pointerEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var r=this.mode_===Of.CIRCLE;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||r?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t):(this.startDrawing_(t),this.mode_===Of.POINT&&this.finishDrawing()),e=!1):this.freehand_&&(this.finishCoordinate_=null,this.abortDrawing_()),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_];if(this.mode_===Of.LINE_STRING)r=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===Of.POLYGON){var i=this.sketchCoords_;r=i[0].length>this.minPoints_,n=[i[0][0],i[0][i[0].length-2]]}if(r)for(var o=t.map,a=0,s=n.length;a=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(n.slice()),this.geometryFunction_(r,i)):this.mode_===Of.POLYGON&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(n.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry();this.mode_===Of.LINE_STRING?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Of.POLYGON&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e)),0===t.length&&(this.finishCoordinate_=null),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry();this.mode_===Of.LINE_STRING?(e.pop(),this.geometryFunction_(e,r)):this.mode_===Of.POLYGON&&(e[0].pop(),this.geometryFunction_(e,r),e=r.getCoordinates()),this.type_===Nt.MULTI_POINT?t.setGeometry(new Ef([e])):this.type_===Nt.MULTI_LINE_STRING?t.setGeometry(new vf([e])):this.type_===Nt.MULTI_POLYGON&&t.setGeometry(new wf([e])),this.dispatchEvent(new Pf(Cf,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return t&&(this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0)),t},e.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var r=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=r.slice(),this.sketchCoords_.push(r.slice()),this.updateSketchFeatures_(),this.dispatchEvent(new Pf(Rf,this.sketchFeature_))},e.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},e.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing_(),this.overlay_.setMap(e?t:null)},e}(mo),bf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lf={EXTENTCHANGED:"extentchanged"},Mf=function(t){function e(e){var r=t.call(this,Lf.EXTENTCHANGED)||this;return r.extent=e,r}return bf(e,t),e}(M);function Ff(){var t=Du();return function(e,r){return t[Nt.POLYGON]}}function Af(){var t=Du();return function(e,r){return t[Nt.POINT]}}function Nf(t){return function(e){return $([t,e])}}function Df(t,e){return t[0]==e[0]?function(r){return $([t,[r[0],e[1]]])}:t[1]==e[1]?function(r){return $([t,[e[0],r[1]]])}:null}var Gf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).extent_=null,r.pointerHandler_=null,r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.snappedToVertex_=!1,r.extentFeature_=null,r.vertexFeature_=null,e||(e={}),r.extentOverlay_=new Bp({source:new Dl({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:Ff(),updateWhileAnimating:!0,updateWhileInteracting:!0}),r.vertexOverlay_=new Bp({source:new Dl({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:Af(),updateWhileAnimating:!0,updateWhileInteracting:!0}),e.extent&&r.setExtent(e.extent),r}return bf(e,t),e.prototype.snapToVertex_=function(t,e){var r=e.getCoordinateFromPixelInternal(t),n=this.getExtentInternal();if(n){var i=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(n);i.sort(function(t,e){return Qn(r,t)-Qn(r,e)});var o=i[0],a=Xn(r,o),s=e.getPixelFromCoordinateInternal(a);if(Jn(t,s)<=this.pixelTolerance_){var u=e.getPixelFromCoordinateInternal(o[0]),l=e.getPixelFromCoordinateInternal(o[1]),h=qn(s,u),c=qn(s,l),p=Math.sqrt(Math.min(h,c));return this.snappedToVertex_=p<=this.pixelTolerance_,this.snappedToVertex_&&(a=h>c?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(zr(t)):e.setGeometry(void 0):(e=new q(t?zr(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new q(new Or(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(e.type!=un.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=Nf(o(i)):null!==a?this.pointerHandler_=Df(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=Df(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=Nf(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}return!0},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==mt(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return Be(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new Mf(this.extent_))},e}(mo),jf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kf=1,Uf=[0,0,0,0],Bf=[],Yf="modifystart",zf="modifyend",Xf=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return jf(e,t),e}(M);function Vf(t,e){return t.index-e.index}function Wf(t,e,r){var n=e.geometry;if(n.getType()===Nt.CIRCLE){var i=n;if(e.index===kf){var o=qn(i.getCenter(),t),a=Math.sqrt(o)-i.getRadius();return a*a}}var s=Ue(t,r);return Bf[0]=Ue(e.segment[0],r),Bf[1]=Ue(e.segment[1],r),Qn(s,Bf)}function Zf(t,e,r){var n=e.geometry;if(n.getType()===Nt.CIRCLE&&e.index===kf)return n.getClosestPoint(t);var i=Ue(t,r);return Bf[0]=Ue(e.segment[0],r),Bf[1]=Ue(e.segment[1],r),ke(Xn(i,Bf),r)}function Kf(){var t=Du();return function(e,r){return t[Nt.POINT]}}var Hf=function(t){function e(e){var r,n=t.call(this,e)||this;if(n.boundHandleFeatureChange_=n.handleFeatureChange_.bind(n),n.condition_=e.condition?e.condition:go,n.defaultDeleteCondition_=function(t){return io(t)&&ho(t)},n.deleteCondition_=e.deleteCondition?e.deleteCondition:n.defaultDeleteCondition_,n.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:so,n.vertexFeature_=null,n.vertexSegments_=null,n.lastPixel_=[0,0],n.ignoreNextSingleClick_=!1,n.modified_=!1,n.rBush_=new Fl,n.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,n.snappedToVertex_=!1,n.changingFeature_=!1,n.dragSegments_=[],n.overlay_=new Bp({source:new Dl({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:Kf(),updateWhileAnimating:!0,updateWhileInteracting:!0}),n.SEGMENT_WRITERS_={Point:n.writePointGeometry_.bind(n),LineString:n.writeLineStringGeometry_.bind(n),LinearRing:n.writeLineStringGeometry_.bind(n),Polygon:n.writePolygonGeometry_.bind(n),MultiPoint:n.writeMultiPointGeometry_.bind(n),MultiLineString:n.writeMultiLineStringGeometry_.bind(n),MultiPolygon:n.writeMultiPolygonGeometry_.bind(n),Circle:n.writeCircleGeometry_.bind(n),GeometryCollection:n.writeGeometryCollectionGeometry_.bind(n)},n.source_=null,e.source?(n.source_=e.source,r=new Z(n.source_.getFeatures()),n.source_.addEventListener(bl.ADDFEATURE,n.handleSourceAdd_.bind(n)),n.source_.addEventListener(bl.REMOVEFEATURE,n.handleSourceRemove_.bind(n))):r=e.features,!r)throw new Error("The modify interaction requires features or a source");return n.features_=r,n.features_.forEach(n.addFeature_.bind(n)),n.features_.addEventListener(h.ADD,n.handleFeatureAdd_.bind(n)),n.features_.addEventListener(h.REMOVE,n.handleFeatureRemove_.bind(n)),n.lastPointerEvent_=null,n}return jf(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(N.CHANGE,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Xf(Yf,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(N.CHANGE,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,r=[];e.forEach(function(e){t===e.feature&&r.push(e)});for(var n=r.length-1;n>=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n=0;--g)this.insertVertex_.apply(this,i[g])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===Nt.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(ht(i),o),this.rBush_.update(n.getExtent(),a)}else this.rBush_.update($(r.segment),r)}return this.modified_&&(this.dispatchEvent(new Xf(zf,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map)},e.prototype.handlePointerAtPixel_=function(t,e){var r=e.getCoordinateFromPixel(t),n=e.getView().getProjection(),i=Be(tt(Ye(ht(r,Uf),n),e.getView().getResolution()*this.pixelTolerance_,Uf),n),a=this.rBush_.getInExtent(i);if(a.length>0){a.sort(function(t,e){return Wf(r,t,n)-Wf(r,e,n)});var s=a[0],u=s.segment,l=Zf(r,s,n),h=e.getPixelFromCoordinate(l),c=Jn(t,h);if(c<=this.pixelTolerance_){var p={};if(s.geometry.getType()===Nt.CIRCLE&&s.index===kf)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(l);else{var f=e.getPixelFromCoordinate(u[0]),d=e.getPixelFromCoordinate(u[1]),_=qn(h,f),g=qn(h,d);c=Math.sqrt(Math.min(_,g)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(l=_>g?u[1]:u[0]),this.createOrUpdateVertexFeature_(l);for(var y=1,v=a.length;y=0;--i)c=o((h=(r=p[i])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in f||(f[c]={}),0===r[1]?(f[c].right=h,f[c].index=h.index):1==r[1]&&(f[c].left=h,f[c].index=h.index+1);for(c in f){switch(l=f[c].right,s=f[c].left,(u=(a=f[c].index)-1)<0&&(u=0),t=e=(n=(h=void 0!==s?s:l).geometry).getCoordinates(),d=!1,n.getType()){case Nt.MULTI_LINE_STRING:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(a,1),d=!0);break;case Nt.LINE_STRING:e.length>2&&(e.splice(a,1),d=!0);break;case Nt.MULTI_POLYGON:t=t[h.depth[1]];case Nt.POLYGON:(t=t[h.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),u=t.length-1))}if(d){this.setGeometryCoordinates_(n,e);var _=[];if(void 0!==s&&(this.rBush_.remove(s),_.push(s.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==s&&void 0!==l){var g={depth:h.depth,feature:h.feature,geometry:h.geometry,index:u,segment:_};this.rBush_.insert($(g.segment),g)}this.updateSegmentIndices_(n,a,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),function(i){i.geometry===t&&(void 0===r||void 0===i.depth||R(i.depth,r))&&i.index>e&&(i.index+=n)})},e}(mo),qf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jf={SELECT:"select"},Qf=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return qf(e,t),e}(M);function $f(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],u=[];if(i){f(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return u.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=a.getLength()-1;l>=0;--l){var h=a.item(l),c=u.indexOf(h);c>-1?u.splice(c,1):(a.remove(h),s.push(h))}0!==u.length&&a.extend(u)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||T(a.getArray(),t)?(r||n)&&T(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(u.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(u)}return(u.length>0||s.length>0)&&this.dispatchEvent(new Qf(Jf.SELECT,u,s,t)),!0}var td=function(t){function e(e){var r,n,i=t.call(this,{handleEvent:$f})||this,o=e||{};if(i.condition_=o.condition?o.condition:ho,i.addCondition_=o.addCondition?o.addCondition:lo,i.removeCondition_=o.removeCondition?o.removeCondition:lo,i.toggleCondition_=o.toggleCondition?o.toggleCondition:po,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:P,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(x((r=Du())[Nt.POLYGON],r[Nt.LINE_STRING]),x(r[Nt.GEOMETRY_COLLECTION],r[Nt.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.featureStyleAssociation_={},i.features_=o.features||new Z,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return T(a,t)}}else n=P;i.layerFilter_=n,i.featureLayerAssociation_={};var s=i.getFeatures();return s.addEventListener(h.ADD,i.addFeature_.bind(i)),s.addEventListener(h.REMOVE,i.removeFeature_.bind(i)),i}return qf(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.removeSelectedStyle_.bind(this)),t.prototype.setMap.call(this,e),e&&this.style_&&this.features_.forEach(this.giveSelectedStyle_.bind(this))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.giveSelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.removeSelectedStyle_(e)},e.prototype.giveSelectedStyle_=function(t){var e=o(t);this.featureStyleAssociation_[e]=t.getStyle(),t.setStyle(this.style_)},e.prototype.removeSelectedStyle_=function(t){var e=o(t);t.setStyle(this.featureStyleAssociation_[e]),delete this.featureStyleAssociation_[e]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e}(to),ed=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function rd(t){return t.feature?t.feature:t.element?t.element:void 0}var nd=[],id=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=P),i.stopDown||(i.stopDown=I),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new Fl,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return ed(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=o(t),i=t.getGeometry();if(i){var a=this.SEGMENT_WRITERS_[i.getType()];a&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),a(t,i))}r&&(this.featureChangeListenerKeys_[n]=g(t,N.CHANGE,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=rd(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=rd(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=o(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=d(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=o(t),i=this.indexedFeaturesExtents_[n];if(i){var a=this.rBush_,s=[];a.forEachInExtent(i,function(e){t===e.feature&&s.push(e)});for(var u=s.length-1;u>=0;--u)a.remove(s[u])}r&&(v(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(v),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(g(this.features_,h.ADD,this.handleFeatureAdd_,this),g(this.features_,h.REMOVE,this.handleFeatureRemove_,this)):this.source_&&n.push(g(this.source_,bl.ADDFEATURE,this.handleFeatureAdd_,this),g(this.source_,bl.REMOVEFEATURE,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=$([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter(function(t){return t.feature.getGeometry().getType()!==Nt.CIRCLE}));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var u,l=r.getView().getProjection(),h=Ue(e,l),c=1/0,p=0;pm?_[1]:_[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var E=u.feature.getGeometry().getType()===Nt.CIRCLE;if(E?a=function(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var u=Math.sqrt(a*a+s*s);return[i+r*a/u,o+r*s/u]}(e,u.feature.getGeometry()):(nd[0]=Ue(_[0],l),nd[1]=Ue(_[1],l),a=ke(Xn(h,nd),l)),Jn(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!E)){g=r.getPixelFromCoordinate(_[0]),y=r.getPixelFromCoordinate(_[1]),v=qn(s,g),m=qn(s,y);Math.sqrt(Math.min(v,m))<=this.pixelTolerance_&&(a=v>m?_[1]:_[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){for(var r=Xr(e).getCoordinates()[0],n=0,i=r.length-1;n=0;r--){var l=o[r][0];if(it(new wr(l).getExtent(),new wr(s).getExtent())){o[r].push(s),u=!0;break}}u||o.push([s.reverse()])}return o}(o.rings,a);1===s.length?(i=Nt.POLYGON,t=Object.assign({},t,((r={}).rings=s[0],r))):(i=Nt.MULTI_POLYGON,t=Object.assign({},t,((n={}).rings=s,n)))}return _d((0,Td[i])(t),!1,e)}function xd(t){var e=At.XY;return!0===t.hasZ&&!0===t.hasM?e=At.XYZM:!0===t.hasZ?e=At.XYZ:!0===t.hasM&&(e=At.XYM),e}function Od(t){var e=t.getLayout();return{hasZ:e===At.XYZ||e===At.XYZM,hasM:e===At.XYM||e===At.XYZM}}function Rd(t,e){return(0,Sd[t.getType()])(_d(t,!0,e),e)}Sd[Nt.POINT]=function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();i===At.XYZ?r={x:n[0],y:n[1],z:n[2]}:i===At.XYM?r={x:n[0],y:n[1],m:n[2]}:i===At.XYZM?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===At.XY?r={x:n[0],y:n[1]}:K(!1,34);return r},Sd[Nt.LINE_STRING]=function(t,e){var r=Od(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},Sd[Nt.POLYGON]=function(t,e){var r=Od(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},Sd[Nt.MULTI_POINT]=function(t,e){var r=Od(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},Sd[Nt.MULTI_LINE_STRING]=function(t,e){var r=Od(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},Sd[Nt.MULTI_POLYGON]=function(t,e){for(var r=Od(t),n=t.getCoordinates(!1),i=[],o=0;o=0;a--)i.push(n[o][a]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}};var Cd=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return Ed(e,t),e.prototype.readFeatureFromObject=function(t,e){var r=t,n=wd(r.geometry,e),i=new q;return this.geometryName_&&i.setGeometryName(this.geometryName_),i.setGeometry(n),e&&e.idField&&r.attributes[e.idField]&&i.setId(r.attributes[e.idField]),r.attributes&&i.setProperties(r.attributes,!0),i},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){var n=[],i=t.features;r.idField=t.objectIdFieldName;for(var o=0,a=i.length;o0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Fs(t);return this.readFeaturesFromDocument(r,e)}return Ms(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&x(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Fs(t);return this.readGeometryFromDocument(r,e)}return Ms(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Fs(t);return this.readProjectionFromDocument(e)}return Ms(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(dd),bd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ld="http://www.opengis.net/gml",Md=/^[\s\xa0]*$/,Fd=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:Ns(r.readFeaturesInternal),featureMembers:Ds(r.readFeaturesInternal)},r}return bd(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Ws([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,u=t.childNodes.length;s0){i[s]={_content_:i[s]};for(var l=0;l1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=mg[r.namespaceURI],s=zs(o,a);return Ks(i,Eg,Ys,s,[e],a,this),r},e}(Id);function bg(t,e){var r=null,n=[0,0],i="start";if(t.getImage()){var o=t.getImage().getImageSize();if(null===o&&(o=tg),2==o.length){var a=t.getImage().getScale();n[0]=a*o[0]/2,n[1]=-a*o[1]/2,i="left"}}if(null!==t.getText()){var s=t.getText();(r=s.clone()).setFont(s.getFont()||Rg.getFont()),r.setScale(s.getScale()||Rg.getScale()),r.setFill(s.getFill()||Rg.getFill()),r.setStroke(s.getStroke()||xg)}else r=Rg.clone();return r.setText(e),r.setOffsetX(n[0]),r.setOffsetY(n[1]),r.setTextAlign(i),new ju({text:r})}function Lg(t){var e=Ls(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function Mg(t){for(var e,r=Ls(t,!1),n=[],i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=i.exec(r);){var o=parseFloat(e[1]),a=parseFloat(e[2]),s=e[3]?parseFloat(e[3]):0;n.push(o,a,s),r=r.substr(e[0].length)}if(""===r)return n}function Fg(t){var e=Ls(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Ag(t){return jd(t)}var Ng=Xs(fg,{Pair:function(t,e){var r=Ws({},hy,t,e);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function Dg(t,e){return Ws(void 0,Ng,t,e)}var Gg=Xs(fg,{Icon:js(function(t,e){var r=Ws({},Wg,t,e);return r||null}),heading:js(jd),hotSpot:js(function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?Iu.BOTTOM_LEFT:Iu.TOP_LEFT:"insetPixels"!==n?Iu.BOTTOM_RIGHT:Iu.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:dg[r],y:parseFloat(t.getAttribute("y")),yunits:dg[n],origin:e}}),scale:js(Ag)});var jg=Xs(fg,{color:js(Lg),scale:js(Ag)});var kg=Xs(fg,{color:js(Lg),width:js(jd)});var Ug=Xs(fg,{color:js(Lg),fill:js(Nd),outline:js(Nd)});var Bg=Xs(fg,{coordinates:Ds(Mg)});function Yg(t,e){return Ws(null,Bg,t,e)}var zg=Xs(pg,{Track:Ns(Vg)});var Xg=Xs(fg,{when:function(t,e){var r=e[e.length-1].whens,n=Ls(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},Xs(pg,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=Ls(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function Vg(t,e){var r=Ws({flatCoordinates:[],whens:[]},Xg,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o0,h=u.href;h?n=h:l&&(n=eg);var c,p=Iu.BOTTOM_LEFT,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===eg?(i=J_,o=Q_,a=$_):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=Tu.FRACTION,a=Tu.FRACTION);var d,_=u.x,g=u.y;void 0!==_&&void 0!==g&&(c=[_,g]);var y,v=u.w,m=u.h;void 0!==v&&void 0!==m&&(d=[v,m]);var E=r.heading;void 0!==E&&(y=Xt(E));var T=r.scale;if(l){n==eg&&(d=tg,void 0===T&&(T=rg));var S=new Lu({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:"anonymous",offset:c,offsetOrigin:Iu.BOTTOM_LEFT,rotation:y,scale:T,size:d,src:n});s.imageStyle=S}else s.imageStyle=Sg}},LabelStyle:function(t,e){var r=Ws({},jg,t,e);if(r){var n=e[e.length-1],i=new Bu({fill:new Eu({color:"color"in r?r.color:q_}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Ws({},kg,t,e);if(r){var n=e[e.length-1],i=new Mu({color:"color"in r?r.color:q_,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Ws({},Ug,t,e);if(r){var n=e[e.length-1],i=new Eu({color:"color"in r?r.color:q_});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function iy(t,e){var r=Ws({},ny,t,e);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:Tg,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=Sg&&(n=r.imageStyle):n=wg;var a="textStyle"in r?r.textStyle:Rg,s="strokeStyle"in r?r.strokeStyle:Og,u=r.outline;return void 0===u||u||(s=null),[new ju({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]}function oy(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),u=new Array(e.length);r=!1,n=!1,i=!1;for(var l=0;l0){var d=zs(i,a);Ks(n,Uy,Yy,[{names:a,values:d}],r)}var _=r[0],g=e.getGeometry();g&&(g=_d(g,!0,_)),Ks(n,Uy,Ly,[g],r)}var Xy=Xs(fg,["extrude","tessellate","altitudeMode","coordinates"]),Vy=Xs(fg,{extrude:ks(zd),tessellate:ks(zd),altitudeMode:ks(Wd),coordinates:ks(function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==At.XY||o==At.XYM?n=2:o==At.XYZ||o==At.XYZM?n=3:K(!1,34);var s=e.length,u="";if(s>0){u+=e[0];for(var l=1;l>3)?r.readString():2===t?r.readFloat():3===t?r.readDouble():4===t?r.readVarint64():5===t?r.readVarint():6===t?r.readSVarint():7===t?r.readBoolean():null;e.values.push(n)}}function cv(t,e,r){if(1==t)e.id=r.readVarint();else if(2==t)for(var n=r.readVarint()+r.pos;r.pos>3}a--,1===o||2===o?(s+=t.readSVarint(),u+=t.readSVarint(),1===o&&l>h&&(n.push(l),h=l),r.push(s,u),l+=2):7===o?l>h&&(r.push(r[h],r[h+1]),l+=2):K(!1,59)}l>h&&(n.push(l),h=l)},e.prototype.createFeature_=function(t,e,r){var n,i=e.type;if(0===i)return null;var o,a=e.properties;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=e.id,a[this.layerName_]=e.layer.name;var s=[],u=[];this.readRawGeometry_(t,e,s,u);var l=function(t,e){var r;1===t?r=1===e?Nt.POINT:Nt.MULTI_POINT:2===t?r=1===e?Nt.LINE_STRING:Nt.MULTI_LINE_STRING:3===t&&(r=Nt.POLYGON);return r}(i,u.length);if(this.featureClass_===sv)(n=new this.featureClass_(l,s,u,a,o)).transform(r.dataProjection,r.featureProjection);else{var h=void 0;if(l==Nt.POLYGON){for(var c=[],p=0,f=0,d=0,_=u.length;d<_;++d){var g=u[d];Nr(s,p,g,2)||(c.push(u.slice(f,d)),f=d),p=g}h=c.length>1?new wf(s,At.XY,c):new Br(s,At.XY,u)}else h=l===Nt.POINT?new Or(s,At.XY):l===Nt.LINE_STRING?new Vp(s,At.XY):l===Nt.POLYGON?new Br(s,At.XY,u):l===Nt.MULTI_POINT?new Ef(s,At.XY):l===Nt.MULTI_LINE_STRING?new vf(s,At.XY,u):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var y=_d(h,!1,r);n.setGeometry(y),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return rs.ARRAY_BUFFER},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=we(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new iv.a(t),a=o.readFields(lv,{}),s=[];for(var u in a)if(!r||-1!=r.indexOf(u)){var l=a[u],h=l?[0,0,l.extent,l.extent]:null;i.setExtent(h);for(var c=0,p=l.length;c>1):i>>1}return e}(t),i=0,o=n.length;i=32;)e=63+(32|31&t),r+=String.fromCharCode(e),t>>=5;return e=t+63,r+=String.fromCharCode(e)}var Iv=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.dataProjection=we("EPSG:4326"),r.factor_=n.factor?n.factor:1e5,r.geometryLayout_=n.geometryLayout?n.geometryLayout:At.XY,r}return wv(e,t),e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);return new q(r)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var r=rr(this.geometryLayout_),n=Ov(t,r,this.factor_);Sv(n,0,n.length,r,n);var i=dr(n,0,n.length,r);return _d(new Vp(i,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):(K(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var r=(t=_d(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return Sv(r,0,r.length,n,r),xv(r,n,this.factor_)},e}(ng),bv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lv=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.layerName_=n.layerName,r.layers_=n.layers?n.layers:null,r.dataProjection=we(n.dataProjection?n.dataProjection:"EPSG:4326"),r}return bv(e,t),e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var r=t,n=void 0,i=null,o=null;r.transform&&(i=(n=r.transform).scale,o=n.translate);var a=r.arcs;n&&function(t,e,r){for(var n=0,i=t.length;n0&&i.pop(),n=r>=0?e[r]:e[~r].slice().reverse(),i.push.apply(i,n);for(var s=0,u=i.length;s=2,57),n}return Uv(e,t),e}(kv),Yv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zv=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return Yv(e,t),e}(Bv),Xv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vv=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return Xv(e,t),e}(kv),Wv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zv=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return Wv(e,t),e}(kv),Kv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hv=function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}return Kv(e,t),e}(Zv),qv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jv=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return qv(e,t),e}(kv),Qv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$v=function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}return Qv(e,t),e}(Jv),tm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),em=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return tm(e,t),e}(Jv),rm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nm=function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}return rm(e,t),e}(em),im=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),om=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}return im(e,t),e}(em),am=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sm=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}return am(e,t),e}(em),um=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lm=function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}return um(e,t),e}(Zv),hm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cm=function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}return hm(e,t),e}(Jv),pm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fm=function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}return pm(e,t),e}(Jv),dm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_m=function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}return dm(e,t),e}(Jv),gm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ym=function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}return gm(e,t),e}(em),vm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mm=function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}return vm(e,t),e}(em),Em=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tm=function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}return Em(e,t),e}(kv),Sm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wm=function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}return Sm(e,t),e}(em),xm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Om=function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}return xm(e,t),e}(Bv),Rm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cm=function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}return Rm(e,t),e}(Zv);function Pm(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(zv,e))}function Im(t,e,r){return new Vv(t,e,r)}var bm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lm={"http://www.opengis.net/gml":{boundedBy:js(Ad.prototype.readGeometryElement,"bounds")}},Mm={"http://www.opengis.net/wfs":{totalInserted:js(Ud),totalUpdated:js(Ud),totalDeleted:js(Ud)}},Fm={"http://www.opengis.net/wfs":{TransactionSummary:js(function(t,e){return Ws({},Mm,t,e)},"transactionSummary"),InsertResults:js(function(t,e){return Ws([],Vm,t,e)},"insertIds")}},Am={"http://www.opengis.net/wfs":{PropertyName:ks(Wd)}},Nm={"http://www.opengis.net/wfs":{Insert:ks(function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=bs(o,i);t.appendChild(s),2===a?i_.prototype.writeFeatureElement(s,e,r):Jd.prototype.writeFeatureElement(s,e,r)}),Update:ks(function(t,e,r){var n=r[r.length-1];K(void 0!==e.getId(),27);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=Zm(o,i),u=e.getGeometryName();t.setAttribute("typeName",s),t.setAttributeNS(Gm,"xmlns:"+o,a);var l=e.getId();if(void 0!==l){for(var h=e.getKeys(),c=[],p=0,f=h.length;p="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=lE;else if(","==e)t=pE;else if(")"==e)t=hE;else if(this.isNumeric_(e)||"-"==e)t=cE,n=this.readNumber_();else if(this.isAlpha_(e))t=uE,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=fE}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),yE=function(){function t(t){this.lexer_=t,this.token_,this.layout_=At.XY}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=At.XY,e=this.token_;if(this.isTokenType(uE)){var r=e.value;r===aE?t=At.XYZ:r===sE?t=At.XYM:"ZM"===r&&(t=At.XYZM),t!==At.XY&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(lE)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(pE));if(this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(lE)){var t=this.parsePoint_();if(this.match(hE))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(lE)){var t=this.parsePointList_();if(this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(lE)){var t=this.parseLineStringTextList_();if(this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(lE)){var t=void 0;if(t=this.token_.type==lE?this.parsePointTextList_():this.parsePointList_(),this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(lE)){var t=this.parseLineStringTextList_();if(this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(lE)){var t=this.parsePolygonTextList_();if(this.match(hE))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r0&&(e+=" "+n)}return 0===r.length?e+" "+oE:e+"("+r+")"}var xE=vE,OE="http://www.w3.org/1999/xlink";function RE(t){return t.getAttributeNS(OE,"href")}var CE=function(){function t(){}return t.prototype.read=function(t){if(t){if("string"==typeof t){var e=Fs(t);return this.readFromDocument(e)}return Ms(t)?this.readFromDocument(t):this.readFromNode(t)}return null},t.prototype.readFromDocument=function(t){},t.prototype.readFromNode=function(t){},t}(),PE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),IE=[null,"http://www.opengis.net/wms"],bE=Xs(IE,{Service:js(function(t,e){return Ws({},FE,t,e)}),Capability:js(function(t,e){return Ws({},LE,t,e)})}),LE=Xs(IE,{Request:js(function(t,e){return Ws({},BE,t,e)}),Exception:js(function(t,e){return Ws([],GE,t,e)}),Layer:js(function(t,e){return Ws({},jE,t,e)})}),ME=function(t){function e(){var e=t.call(this)||this;return e.version=void 0,e}return PE(e,t),e.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=Ws({version:this.version},bE,t,[]);return e||null},e}(CE),FE=Xs(IE,{Name:js(Yd),Title:js(Yd),Abstract:js(Yd),KeywordList:js(JE),OnlineResource:js(RE),ContactInformation:js(function(t,e){return Ws({},AE,t,e)}),Fees:js(Yd),AccessConstraints:js(Yd),LayerLimit:js(Ud),MaxWidth:js(Ud),MaxHeight:js(Ud)}),AE=Xs(IE,{ContactPersonPrimary:js(function(t,e){return Ws({},NE,t,e)}),ContactPosition:js(Yd),ContactAddress:js(function(t,e){return Ws({},DE,t,e)}),ContactVoiceTelephone:js(Yd),ContactFacsimileTelephone:js(Yd),ContactElectronicMailAddress:js(Yd)}),NE=Xs(IE,{ContactPerson:js(Yd),ContactOrganization:js(Yd)}),DE=Xs(IE,{AddressType:js(Yd),Address:js(Yd),City:js(Yd),StateOrProvince:js(Yd),PostCode:js(Yd),Country:js(Yd)}),GE=Xs(IE,{Format:Ns(Yd)}),jE=Xs(IE,{Name:js(Yd),Title:js(Yd),Abstract:js(Yd),KeywordList:js(JE),CRS:Gs(Yd),EX_GeographicBoundingBox:js(function(t,e){var r=Ws({},UE,t,e);if(!r)return;var n=r.westBoundLongitude,i=r.southBoundLatitude,o=r.eastBoundLongitude,a=r.northBoundLatitude;if(void 0===n||void 0===i||void 0===o||void 0===a)return;return[n,i,o,a]}),BoundingBox:Gs(function(t,e){var r=[kd(t.getAttribute("minx")),kd(t.getAttribute("miny")),kd(t.getAttribute("maxx")),kd(t.getAttribute("maxy"))],n=[kd(t.getAttribute("resx")),kd(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:r,res:n}}),Dimension:Gs(function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:Dd(t.getAttribute("multipleValues")),nearestValue:Dd(t.getAttribute("nearestValue")),current:Dd(t.getAttribute("current")),values:Yd(t)}}),Attribution:js(function(t,e){return Ws({},kE,t,e)}),AuthorityURL:Gs(function(t,e){var r=KE(t,e);if(r)return r.name=t.getAttribute("name"),r;return}),Identifier:Gs(Yd),MetadataURL:Gs(function(t,e){var r=KE(t,e);if(r)return r.type=t.getAttribute("type"),r;return}),DataURL:Gs(KE),FeatureListURL:Gs(KE),Style:Gs(function(t,e){return Ws({},VE,t,e)}),MinScaleDenominator:js(jd),MaxScaleDenominator:js(jd),Layer:Gs(function(t,e){var r=e[e.length-1],n=Ws({},jE,t,e);if(!n)return;var i=Dd(t.getAttribute("queryable"));void 0===i&&(i=r.queryable);n.queryable=void 0!==i&&i;var o=Bd(t.getAttribute("cascaded"));void 0===o&&(o=r.cascaded);n.cascaded=o;var a=Dd(t.getAttribute("opaque"));void 0===a&&(a=r.opaque);n.opaque=void 0!==a&&a;var s=Dd(t.getAttribute("noSubsets"));void 0===s&&(s=r.noSubsets);n.noSubsets=void 0!==s&&s;var u=kd(t.getAttribute("fixedWidth"));u||(u=r.fixedWidth);n.fixedWidth=u;var l=kd(t.getAttribute("fixedHeight"));l||(l=r.fixedHeight);n.fixedHeight=l,["Style","CRS","AuthorityURL"].forEach(function(t){if(t in r){var e=n[t]||[];n[t]=e.concat(r[t])}});return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach(function(t){if(!(t in n)){var e=r[t];n[t]=e}}),n})}),kE=Xs(IE,{Title:js(Yd),OnlineResource:js(RE),LogoURL:js(qE)}),UE=Xs(IE,{westBoundLongitude:js(jd),eastBoundLongitude:js(jd),southBoundLatitude:js(jd),northBoundLatitude:js(jd)}),BE=Xs(IE,{GetCapabilities:js(HE),GetMap:js(HE),GetFeatureInfo:js(HE)}),YE=Xs(IE,{Format:Gs(Yd),DCPType:Gs(function(t,e){return Ws({},zE,t,e)})}),zE=Xs(IE,{HTTP:js(function(t,e){return Ws({},XE,t,e)})}),XE=Xs(IE,{Get:js(KE),Post:js(KE)}),VE=Xs(IE,{Name:js(Yd),Title:js(Yd),Abstract:js(Yd),LegendURL:Gs(qE),StyleSheetURL:js(KE),StyleURL:js(KE)}),WE=Xs(IE,{Format:js(Yd),OnlineResource:js(RE)}),ZE=Xs(IE,{Keyword:Ns(Yd)});function KE(t,e){return Ws({},WE,t,e)}function HE(t,e){return Ws({},YE,t,e)}function qE(t,e){var r=KE(t,e);if(r){var n=[Bd(t.getAttribute("width")),Bd(t.getAttribute("height"))];return r.size=n,r}}function JE(t,e){return Ws([],ZE,t,e)}var QE=ME,$E=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tT=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureNS_="http://mapserver.gis.umn.edu/mapserver",r.gmlFormat_=new i_,r.layers_=n.layers?n.layers:null,r}return $E(e,t),e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var r=t.localName,n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==r)for(var i=0,o=t.childNodes.length;i.75*h||l>.75*c?this.resetExtent_():it(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;Mt(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(zr(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),u=n.getCenterInternal(),l=n.getResolution(),h=i.getResolution(),c=r[0]*l/h,p=r[1]*l/h;if(a.setPosition(u),s){s.style.width=c+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle(Gi),this.collapsed_?pi(this.collapseLabel_,this.label_):pi(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),y(t,dn,function(t){this.updateBox_()},this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e}(Li),qT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),JT="units",QT={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",US:"us"},$T=[1,2,5];function tS(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var eS=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render||tS,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" "+Ai,r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(Y(JT),r.handleUnitsChanged_),r.setUnits(n.units||QT.METRIC),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r}return qT(e,t),e.prototype.getUnits=function(){return this.get(JT)},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set(JT,t)},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==QT.DEGREES?te.DEGREES:te.METERS,o=xe(r,t.resolution,e,i),a=this.minWidth_*o,s="";if(n==QT.DEGREES){var u=$t[te.DEGREES];(a*=u)=this.minWidth_)break;++f}p=this.scaleBar_?this.createScaleBar(h,l,s):l.toFixed(c<0?-c:0)+" "+s,this.renderedHTML_!=p&&(this.innerElement_.innerHTML=p,this.renderedHTML_=p),this.renderedWidth_!=h&&(this.innerElement_.style.width=h+"px",this.renderedWidth_=h),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s
'+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+""),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+n+"
":"")+i.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'
'+o+"
"},e.prototype.getScaleForResolution=function(){var t=this.getMap().getView().getResolution(),e=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*e*39.37*(25.4/.28)},e}(Li),rS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nS={VERTICAL:0,HORIZONTAL:1};function iS(t){if(t.frameState){this.sliderInitialized_||this.initSlider_();var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}var oS=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||iS})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=nS.VERTICAL,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb "+Ai;var a=r.element;return a.setAttribute("touch-action","none"),a.className=i+" "+Ai+" "+Di,a.appendChild(o),a.addEventListener(cn.POINTERDOWN,r.handleDraggerStart_.bind(r),!1),a.addEventListener(cn.POINTERMOVE,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(cn.POINTERUP,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(N.CLICK,r.handleContainerClick_.bind(r),!1),o.addEventListener(N.CLICK,L,!1),r}return rS(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight,n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);this.thumbSize_=[o,a],e>r?(this.direction_=nS.HORIZONTAL,this.widthLimit_=e-o):(this.direction_=nS.VERTICAL,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:ei})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_;this.dragListenerKeys_.push(g(document,cn.POINTERMOVE,r,this),g(document,cn.POINTERUP,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==nS.HORIZONTAL?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return kt(this.direction_===nS.HORIZONTAL?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return kt(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e}(Li),aS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sS=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(N.CLICK,r.handleClick_.bind(r),!1);var u=i+" "+Ai+" "+Di,l=r.element;return l.className=u,l.appendChild(s),r}return aS(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(zr(e))},e}(Li),uS={array:{},color:{},colorlike:{},control:{},coordinate:{},easing:{},events:{}};uS.events.condition={},uS.extent={},uS.featureloader={},uS.format={},uS.format.filter={},uS.geom={},uS.has={},uS.interaction={},uS.layer={},uS.loadingstrategy={},uS.proj={},uS.proj.Units={},uS.proj.proj4={},uS.render={},uS.render.canvas={},uS.renderer={},uS.renderer.canvas={},uS.renderer.webgl={},uS.size={},uS.source={},uS.sphere={},uS.style={},uS.style.IconImageCache={},uS.tilegrid={},uS.util={},uS.webgl={},uS.xml={},uS.Collection=Z,uS.Feature=q,uS.Geolocation=Hr,uS.Kinetic=qr,uS.Map=Ja,uS.Object=z,uS.Observable=G,uS.Observable.unByKey=function(t){if(Array.isArray(t))for(var e=0,r=t.length;e180)&&(r[0]=Vt(n+180,360)-180),r},uS.proj.transform=Me,uS.proj.transformExtent=Fe,uS.render.VectorContext=fa,uS.render.canvas.labelCache=Ea,uS.render.getRenderPixel=function(t,e){var r=e.slice(0);return Ze(t.inversePixelTransform.slice(),r),r},uS.render.getVectorContext=function(t){var e,r=t.frameState,n=Ve(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),i=Ba(r.viewState.resolution,r.pixelRatio),o=je();return o&&(e=be(o,r.viewState.projection)),new Na(t.context,r.pixelRatio,r.extent,n,r.viewState.rotation,i,e)},uS.render.toContext=function(t,e){var r=t.canvas,n=e||{},i=n.pixelRatio||an,o=n.size;o&&(r.width=o[0]*i,r.height=o[1]*i,r.style.width=o[0]+"px",r.style.height=o[1]+"px");var a=[0,0,r.width,r.height],s=Ke([1,0,0,1,0,0],i,i);return new Na(t,i,a,s,0)},uS.renderer.Composite=Ha,uS.renderer.canvas.ImageLayer=jh,uS.renderer.canvas.TileLayer=Zh,uS.renderer.canvas.VectorImageLayer=Ap,uS.renderer.canvas.VectorLayer=Mp,uS.renderer.canvas.VectorTileLayer=kp,uS.renderer.webgl.PointsLayer=Wc,uS.size.toSize=xi,uS.source.BingMaps=Ol,uS.source.CartoDB=Il,uS.source.Cluster=jl,uS.source.IIIF=Ql,uS.source.Image=sh,uS.source.ImageArcGISRest=hh,uS.source.ImageCanvas=dh,uS.source.ImageMapGuide=gh,uS.source.ImageStatic=vh,uS.source.ImageWMS=Rh,uS.source.OSM=Ih,uS.source.OSM.ATTRIBUTION=Ph,uS.source.Raster=oc,uS.source.Source=cl,uS.source.Stamen=hc,uS.source.Tile=_l,uS.source.TileArcGISRest=fc,uS.source.TileDebug=gc,uS.source.TileImage=wl,uS.source.TileJSON=vc,uS.source.TileWMS=Tc,uS.source.UTFGrid=xc,uS.source.Vector=Dl,uS.source.VectorTile=bc,uS.source.WMTS=Ac,uS.source.WMTS.optionsFromCapabilities=function(t,e){var r=O(t.Contents.Layer,function(t,r,n){return t.Identifier==e.layer});if(null===r)return null;var n,i=t.Contents.TileMatrixSet;(n=r.TileMatrixSetLink.length>1?C(r.TileMatrixSetLink,"projection"in e?function(t,r,n){var o=O(i,function(e){return e.Identifier==t.TileMatrixSet}).SupportedCRS,a=we(o.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||we(o),s=we(e.projection);return a&&s?Ie(a,s):o==e.projection}:function(t,r,n){return t.TileMatrixSet==e.matrixSet}):0)<0&&(n=0);var o=r.TileMatrixSetLink[n].TileMatrixSet,a=r.TileMatrixSetLink[n].TileMatrixSetLimits,s=r.Format[0];"format"in e&&(s=e.format),(n=C(r.Style,function(t,r,n){return"style"in e?t.Title==e.style:t.isDefault}))<0&&(n=0);var u=r.Style[n].Identifier,l={};"Dimension"in r&&r.Dimension.forEach(function(t,e,r){var n=t.Identifier,i=t.Default;void 0===i&&(i=t.Value[0]),l[n]=i});var h,c=O(t.Contents.TileMatrixSet,function(t,e,r){return t.Identifier==o}),p=c.SupportedCRS;if(p&&(h=we(p.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||we(p)),"projection"in e){var f=we(e.projection);f&&(h&&!Ie(f,h)||(h=f))}var d,_,g=r.WGS84BoundingBox;if(void 0!==g){var y=we("EPSG:4326").getExtent();_=g[0]==y[0]&&g[2]==y[2],d=Fe(g,"EPSG:4326",h);var v=h.getExtent();v&&(it(v,d)||(d=void 0))}var m=du(c,d,a),E=[],S=e.requestEncoding;if(S=void 0!==S?S:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var w=t.OperationsMetadata.GetTile.DCP.HTTP.Get,x=0,R=w.length;xe;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});\n","/*!\n * PEP v0.5.3 | https://github.com/jquery/PEP\n * Copyright jQuery Foundation and other contributors | http://jquery.org/license\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.PointerEventsPolyfill = factory());\n}(this, function () { 'use strict';\n\n /**\n * This is the constructor for new PointerEvents.\n *\n * New Pointer Events must be given a type, and an optional dictionary of\n * initialization properties.\n *\n * Due to certain platform requirements, events returned from the constructor\n * identify as MouseEvents.\n *\n * @constructor\n * @param {String} inType The type of the event to create.\n * @param {Object} [inDict] An optional dictionary of initial event properties.\n * @return {Event} A new PointerEvent of type `inType`, initialized with properties from `inDict`.\n */\n var MOUSE_PROPS = [\n 'bubbles',\n 'cancelable',\n 'view',\n 'screenX',\n 'screenY',\n 'clientX',\n 'clientY',\n 'ctrlKey',\n 'altKey',\n 'shiftKey',\n 'metaKey',\n 'button',\n 'relatedTarget',\n 'pageX',\n 'pageY'\n ];\n\n var MOUSE_DEFAULTS = [\n false,\n false,\n null,\n 0,\n 0,\n 0,\n 0,\n false,\n false,\n false,\n false,\n 0,\n null,\n 0,\n 0\n ];\n\n function PointerEvent(inType, inDict) {\n inDict = inDict || Object.create(null);\n\n var e = document.createEvent('Event');\n e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);\n\n // define inherited MouseEvent properties\n // skip bubbles and cancelable since they're set above in initEvent()\n for (var i = 2, p; i < MOUSE_PROPS.length; i++) {\n p = MOUSE_PROPS[i];\n e[p] = inDict[p] || MOUSE_DEFAULTS[i];\n }\n e.buttons = inDict.buttons || 0;\n\n // Spec requires that pointers without pressure specified use 0.5 for down\n // state and 0 for up state.\n var pressure = 0;\n\n if (inDict.pressure !== undefined && e.buttons) {\n pressure = inDict.pressure;\n } else {\n pressure = e.buttons ? 0.5 : 0;\n }\n\n // add x/y properties aliased to clientX/Y\n e.x = e.clientX;\n e.y = e.clientY;\n\n // define the properties of the PointerEvent interface\n e.pointerId = inDict.pointerId || 0;\n e.width = inDict.width || 1;\n e.height = inDict.height || 1;\n e.pressure = pressure;\n e.tiltX = inDict.tiltX || 0;\n e.tiltY = inDict.tiltY || 0;\n e.twist = inDict.twist || 0;\n e.tangentialPressure = inDict.tangentialPressure || 0;\n e.pointerType = inDict.pointerType || '';\n e.hwTimestamp = inDict.hwTimestamp || 0;\n e.isPrimary = inDict.isPrimary || false;\n e.detail = 0;\n return e;\n }\n\n /**\n * This module implements a map of pointer states\n */\n var USE_MAP = window.Map && window.Map.prototype.forEach;\n var PointerMap = USE_MAP ? Map : SparseArrayMap;\n\n function SparseArrayMap() {\n this.array = [];\n this.size = 0;\n }\n\n SparseArrayMap.prototype = {\n set: function(k, v) {\n if (v === undefined) {\n return this.delete(k);\n }\n if (!this.has(k)) {\n this.size++;\n }\n this.array[k] = v;\n },\n has: function(k) {\n return this.array[k] !== undefined;\n },\n delete: function(k) {\n if (this.has(k)) {\n delete this.array[k];\n this.size--;\n }\n },\n get: function(k) {\n return this.array[k];\n },\n clear: function() {\n this.array.length = 0;\n this.size = 0;\n },\n\n // return value, key, map\n forEach: function(callback, thisArg) {\n return this.array.forEach(function(v, k) {\n callback.call(thisArg, v, k, this);\n }, this);\n }\n };\n\n var CLONE_PROPS = [\n\n // MouseEvent\n 'bubbles',\n 'cancelable',\n 'view',\n 'detail',\n 'screenX',\n 'screenY',\n 'clientX',\n 'clientY',\n 'ctrlKey',\n 'altKey',\n 'shiftKey',\n 'metaKey',\n 'button',\n 'relatedTarget',\n\n // DOM Level 3\n 'buttons',\n\n // PointerEvent\n 'pointerId',\n 'width',\n 'height',\n 'pressure',\n 'tiltX',\n 'tiltY',\n 'pointerType',\n 'hwTimestamp',\n 'isPrimary',\n\n // event instance\n 'type',\n 'target',\n 'currentTarget',\n 'which',\n 'pageX',\n 'pageY',\n 'timeStamp'\n ];\n\n var CLONE_DEFAULTS = [\n\n // MouseEvent\n false,\n false,\n null,\n null,\n 0,\n 0,\n 0,\n 0,\n false,\n false,\n false,\n false,\n 0,\n null,\n\n // DOM Level 3\n 0,\n\n // PointerEvent\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n '',\n 0,\n false,\n\n // event instance\n '',\n null,\n null,\n 0,\n 0,\n 0,\n 0\n ];\n\n var BOUNDARY_EVENTS = {\n 'pointerover': 1,\n 'pointerout': 1,\n 'pointerenter': 1,\n 'pointerleave': 1\n };\n\n var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');\n\n /**\n * This module is for normalizing events. Mouse and Touch events will be\n * collected here, and fire PointerEvents that have the same semantics, no\n * matter the source.\n * Events fired:\n * - pointerdown: a pointing is added\n * - pointerup: a pointer is removed\n * - pointermove: a pointer is moved\n * - pointerover: a pointer crosses into an element\n * - pointerout: a pointer leaves an element\n * - pointercancel: a pointer will no longer generate events\n */\n var dispatcher = {\n pointermap: new PointerMap(),\n eventMap: Object.create(null),\n captureInfo: Object.create(null),\n\n // Scope objects for native events.\n // This exists for ease of testing.\n eventSources: Object.create(null),\n eventSourceList: [],\n /**\n * Add a new event source that will generate pointer events.\n *\n * `inSource` must contain an array of event names named `events`, and\n * functions with the names specified in the `events` array.\n * @param {string} name A name for the event source\n * @param {Object} source A new source of platform events.\n */\n registerSource: function(name, source) {\n var s = source;\n var newEvents = s.events;\n if (newEvents) {\n newEvents.forEach(function(e) {\n if (s[e]) {\n this.eventMap[e] = s[e].bind(s);\n }\n }, this);\n this.eventSources[name] = s;\n this.eventSourceList.push(s);\n }\n },\n register: function(element) {\n var l = this.eventSourceList.length;\n for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {\n\n // call eventsource register\n es.register.call(es, element);\n }\n },\n unregister: function(element) {\n var l = this.eventSourceList.length;\n for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {\n\n // call eventsource register\n es.unregister.call(es, element);\n }\n },\n contains: /*scope.external.contains || */function(container, contained) {\n try {\n return container.contains(contained);\n } catch (ex) {\n\n // most likely: https://bugzilla.mozilla.org/show_bug.cgi?id=208427\n return false;\n }\n },\n\n // EVENTS\n down: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointerdown', inEvent);\n },\n move: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointermove', inEvent);\n },\n up: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointerup', inEvent);\n },\n enter: function(inEvent) {\n inEvent.bubbles = false;\n this.fireEvent('pointerenter', inEvent);\n },\n leave: function(inEvent) {\n inEvent.bubbles = false;\n this.fireEvent('pointerleave', inEvent);\n },\n over: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointerover', inEvent);\n },\n out: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointerout', inEvent);\n },\n cancel: function(inEvent) {\n inEvent.bubbles = true;\n this.fireEvent('pointercancel', inEvent);\n },\n leaveOut: function(event) {\n this.out(event);\n this.propagate(event, this.leave, false);\n },\n enterOver: function(event) {\n this.over(event);\n this.propagate(event, this.enter, true);\n },\n\n // LISTENER LOGIC\n eventHandler: function(inEvent) {\n\n // This is used to prevent multiple dispatch of pointerevents from\n // platform events. This can happen when two elements in different scopes\n // are set up to create pointer events, which is relevant to Shadow DOM.\n if (inEvent._handledByPE) {\n return;\n }\n var type = inEvent.type;\n var fn = this.eventMap && this.eventMap[type];\n if (fn) {\n fn(inEvent);\n }\n inEvent._handledByPE = true;\n },\n\n // set up event listeners\n listen: function(target, events) {\n events.forEach(function(e) {\n this.addEvent(target, e);\n }, this);\n },\n\n // remove event listeners\n unlisten: function(target, events) {\n events.forEach(function(e) {\n this.removeEvent(target, e);\n }, this);\n },\n addEvent: /*scope.external.addEvent || */function(target, eventName) {\n target.addEventListener(eventName, this.boundHandler);\n },\n removeEvent: /*scope.external.removeEvent || */function(target, eventName) {\n target.removeEventListener(eventName, this.boundHandler);\n },\n\n // EVENT CREATION AND TRACKING\n /**\n * Creates a new Event of type `inType`, based on the information in\n * `inEvent`.\n *\n * @param {string} inType A string representing the type of event to create\n * @param {Event} inEvent A platform event with a target\n * @return {Event} A PointerEvent of type `inType`\n */\n makeEvent: function(inType, inEvent) {\n\n // relatedTarget must be null if pointer is captured\n if (this.captureInfo[inEvent.pointerId]) {\n inEvent.relatedTarget = null;\n }\n var e = new PointerEvent(inType, inEvent);\n if (inEvent.preventDefault) {\n e.preventDefault = inEvent.preventDefault;\n }\n e._target = e._target || inEvent.target;\n return e;\n },\n\n // make and dispatch an event in one call\n fireEvent: function(inType, inEvent) {\n var e = this.makeEvent(inType, inEvent);\n return this.dispatchEvent(e);\n },\n /**\n * Returns a snapshot of inEvent, with writable properties.\n *\n * @param {Event} inEvent An event that contains properties to copy.\n * @return {Object} An object containing shallow copies of `inEvent`'s\n * properties.\n */\n cloneEvent: function(inEvent) {\n var eventCopy = Object.create(null);\n var p;\n for (var i = 0; i < CLONE_PROPS.length; i++) {\n p = CLONE_PROPS[i];\n eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];\n\n // Work around SVGInstanceElement shadow tree\n // Return the element that is represented by the instance for Safari, Chrome, IE.\n // This is the behavior implemented by Firefox.\n if (HAS_SVG_INSTANCE && (p === 'target' || p === 'relatedTarget')) {\n if (eventCopy[p] instanceof SVGElementInstance) {\n eventCopy[p] = eventCopy[p].correspondingUseElement;\n }\n }\n }\n\n // keep the semantics of preventDefault\n if (inEvent.preventDefault) {\n eventCopy.preventDefault = function() {\n inEvent.preventDefault();\n };\n }\n return eventCopy;\n },\n getTarget: function(inEvent) {\n var capture = this.captureInfo[inEvent.pointerId];\n if (!capture) {\n return inEvent._target;\n }\n if (inEvent._target === capture || !(inEvent.type in BOUNDARY_EVENTS)) {\n return capture;\n }\n },\n propagate: function(event, fn, propagateDown) {\n var target = event.target;\n var targets = [];\n\n // Order of conditions due to document.contains() missing in IE.\n while (target != null && target !== document && !target.contains(event.relatedTarget)) {\n targets.push(target);\n target = target.parentNode;\n\n // Touch: Do not propagate if node is detached.\n if (!target) {\n return;\n }\n }\n if (propagateDown) {\n targets.reverse();\n }\n targets.forEach(function(target) {\n event.target = target;\n fn.call(this, event);\n }, this);\n },\n setCapture: function(inPointerId, inTarget, skipDispatch) {\n if (this.captureInfo[inPointerId]) {\n this.releaseCapture(inPointerId, skipDispatch);\n }\n\n this.captureInfo[inPointerId] = inTarget;\n this.implicitRelease = this.releaseCapture.bind(this, inPointerId, skipDispatch);\n document.addEventListener('pointerup', this.implicitRelease);\n document.addEventListener('pointercancel', this.implicitRelease);\n\n var e = new PointerEvent('gotpointercapture', { bubbles: true });\n e.pointerId = inPointerId;\n e._target = inTarget;\n\n if (!skipDispatch) {\n this.asyncDispatchEvent(e);\n }\n },\n releaseCapture: function(inPointerId, skipDispatch) {\n var t = this.captureInfo[inPointerId];\n if (!t) {\n return;\n }\n\n this.captureInfo[inPointerId] = undefined;\n document.removeEventListener('pointerup', this.implicitRelease);\n document.removeEventListener('pointercancel', this.implicitRelease);\n\n var e = new PointerEvent('lostpointercapture', { bubbles: true });\n e.pointerId = inPointerId;\n e._target = t;\n\n if (!skipDispatch) {\n this.asyncDispatchEvent(e);\n }\n },\n /**\n * Dispatches the event to its target.\n *\n * @param {Event} inEvent The event to be dispatched.\n * @return {Boolean} True if an event handler returns true, false otherwise.\n */\n dispatchEvent: /*scope.external.dispatchEvent || */function(inEvent) {\n var t = this.getTarget(inEvent);\n if (t) {\n return t.dispatchEvent(inEvent);\n }\n },\n asyncDispatchEvent: function(inEvent) {\n requestAnimationFrame(this.dispatchEvent.bind(this, inEvent));\n }\n };\n dispatcher.boundHandler = dispatcher.eventHandler.bind(dispatcher);\n\n var targeting = {\n shadow: function(inEl) {\n if (inEl) {\n return inEl.shadowRoot || inEl.webkitShadowRoot;\n }\n },\n canTarget: function(shadow) {\n return shadow && Boolean(shadow.elementFromPoint);\n },\n targetingShadow: function(inEl) {\n var s = this.shadow(inEl);\n if (this.canTarget(s)) {\n return s;\n }\n },\n olderShadow: function(shadow) {\n var os = shadow.olderShadowRoot;\n if (!os) {\n var se = shadow.querySelector('shadow');\n if (se) {\n os = se.olderShadowRoot;\n }\n }\n return os;\n },\n allShadows: function(element) {\n var shadows = [];\n var s = this.shadow(element);\n while (s) {\n shadows.push(s);\n s = this.olderShadow(s);\n }\n return shadows;\n },\n searchRoot: function(inRoot, x, y) {\n if (inRoot) {\n var t = inRoot.elementFromPoint(x, y);\n var st, sr;\n\n // is element a shadow host?\n sr = this.targetingShadow(t);\n while (sr) {\n\n // find the the element inside the shadow root\n st = sr.elementFromPoint(x, y);\n if (!st) {\n\n // check for older shadows\n sr = this.olderShadow(sr);\n } else {\n\n // shadowed element may contain a shadow root\n var ssr = this.targetingShadow(st);\n return this.searchRoot(ssr, x, y) || st;\n }\n }\n\n // light dom element is the target\n return t;\n }\n },\n owner: function(element) {\n var s = element;\n\n // walk up until you hit the shadow root or document\n while (s.parentNode) {\n s = s.parentNode;\n }\n\n // the owner element is expected to be a Document or ShadowRoot\n if (s.nodeType !== Node.DOCUMENT_NODE && s.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {\n s = document;\n }\n return s;\n },\n findTarget: function(inEvent) {\n var x = inEvent.clientX;\n var y = inEvent.clientY;\n\n // if the listener is in the shadow root, it is much faster to start there\n var s = this.owner(inEvent.target);\n\n // if x, y is not in this root, fall back to document search\n if (!s.elementFromPoint(x, y)) {\n s = document;\n }\n return this.searchRoot(s, x, y);\n }\n };\n\n var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);\n var map = Array.prototype.map.call.bind(Array.prototype.map);\n var toArray = Array.prototype.slice.call.bind(Array.prototype.slice);\n var filter = Array.prototype.filter.call.bind(Array.prototype.filter);\n var MO = window.MutationObserver || window.WebKitMutationObserver;\n var SELECTOR = '[touch-action]';\n var OBSERVER_INIT = {\n subtree: true,\n childList: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: ['touch-action']\n };\n\n function Installer(add, remove, changed, binder) {\n this.addCallback = add.bind(binder);\n this.removeCallback = remove.bind(binder);\n this.changedCallback = changed.bind(binder);\n if (MO) {\n this.observer = new MO(this.mutationWatcher.bind(this));\n }\n }\n\n Installer.prototype = {\n watchSubtree: function(target) {\n\n // Only watch scopes that can target find, as these are top-level.\n // Otherwise we can see duplicate additions and removals that add noise.\n //\n // TODO(dfreedman): For some instances with ShadowDOMPolyfill, we can see\n // a removal without an insertion when a node is redistributed among\n // shadows. Since it all ends up correct in the document, watching only\n // the document will yield the correct mutations to watch.\n if (this.observer && targeting.canTarget(target)) {\n this.observer.observe(target, OBSERVER_INIT);\n }\n },\n enableOnSubtree: function(target) {\n this.watchSubtree(target);\n if (target === document && document.readyState !== 'complete') {\n this.installOnLoad();\n } else {\n this.installNewSubtree(target);\n }\n },\n installNewSubtree: function(target) {\n forEach(this.findElements(target), this.addElement, this);\n },\n findElements: function(target) {\n if (target.querySelectorAll) {\n return target.querySelectorAll(SELECTOR);\n }\n return [];\n },\n removeElement: function(el) {\n this.removeCallback(el);\n },\n addElement: function(el) {\n this.addCallback(el);\n },\n elementChanged: function(el, oldValue) {\n this.changedCallback(el, oldValue);\n },\n concatLists: function(accum, list) {\n return accum.concat(toArray(list));\n },\n\n // register all touch-action = none nodes on document load\n installOnLoad: function() {\n document.addEventListener('readystatechange', function() {\n if (document.readyState === 'complete') {\n this.installNewSubtree(document);\n }\n }.bind(this));\n },\n isElement: function(n) {\n return n.nodeType === Node.ELEMENT_NODE;\n },\n flattenMutationTree: function(inNodes) {\n\n // find children with touch-action\n var tree = map(inNodes, this.findElements, this);\n\n // make sure the added nodes are accounted for\n tree.push(filter(inNodes, this.isElement));\n\n // flatten the list\n return tree.reduce(this.concatLists, []);\n },\n mutationWatcher: function(mutations) {\n mutations.forEach(this.mutationHandler, this);\n },\n mutationHandler: function(m) {\n if (m.type === 'childList') {\n var added = this.flattenMutationTree(m.addedNodes);\n added.forEach(this.addElement, this);\n var removed = this.flattenMutationTree(m.removedNodes);\n removed.forEach(this.removeElement, this);\n } else if (m.type === 'attributes') {\n this.elementChanged(m.target, m.oldValue);\n }\n }\n };\n\n function shadowSelector(s) {\n return 'body /shadow-deep/ ' + s;\n }\n function rule(v) {\n return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + '; }';\n }\n var attrib2css = [\n { selector: '[touch-action=\"none\"]', value: 'none' },\n { selector: '[touch-action=\"auto\"]', value: 'auto' },\n { selector: '[touch-action~=\"pan-x\"]', value: 'pan-x' },\n { selector: '[touch-action~=\"pan-y\"]', value: 'pan-y' },\n { selector: '[touch-action~=\"pan-up\"]', value: 'pan-up' },\n { selector: '[touch-action~=\"pan-down\"]', value: 'pan-down' },\n { selector: '[touch-action~=\"pan-left\"]', value: 'pan-left' },\n { selector: '[touch-action~=\"pan-right\"]', value: 'pan-right' }\n ];\n var styles = '';\n\n // only install stylesheet if the browser has touch action support\n var hasNativePE = window.PointerEvent || window.MSPointerEvent;\n\n // only add shadow selectors if shadowdom is supported\n var hasShadowRoot = !window.ShadowDOMPolyfill && document.head.createShadowRoot;\n\n function applyAttributeStyles() {\n if (hasNativePE) {\n attrib2css.forEach(function(r) {\n styles += r.selector + rule(r.value) + '\\n';\n if (hasShadowRoot) {\n styles += shadowSelector(r.selector) + rule(r.value) + '\\n';\n }\n });\n\n var el = document.createElement('style');\n el.textContent = styles;\n document.head.appendChild(el);\n }\n }\n\n var pointermap = dispatcher.pointermap;\n\n // radius around touchend that swallows mouse events\n var DEDUP_DIST = 25;\n\n // left, middle, right, back, forward\n var BUTTON_TO_BUTTONS = [1, 4, 2, 8, 16];\n\n var HAS_BUTTONS = false;\n try {\n HAS_BUTTONS = new MouseEvent('test', { buttons: 1 }).buttons === 1;\n } catch (e) {}\n\n // handler block for native mouse events\n var mouseEvents = {\n POINTER_ID: 1,\n POINTER_TYPE: 'mouse',\n events: [\n 'mousedown',\n 'webkitmouseforcechanged',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout'\n ],\n register: function(target) {\n dispatcher.listen(target, this.events);\n },\n unregister: function(target) {\n dispatcher.unlisten(target, this.events);\n },\n lastTouches: [],\n\n // collide with the global mouse listener\n isEventSimulatedFromTouch: function(inEvent) {\n var lts = this.lastTouches;\n var x = inEvent.clientX;\n var y = inEvent.clientY;\n for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {\n\n // simulated mouse events will be swallowed near a primary touchend\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {\n return true;\n }\n }\n },\n prepareEvent: function(inEvent) {\n var e = dispatcher.cloneEvent(inEvent);\n\n // forward mouse preventDefault\n var pd = e.preventDefault;\n e.preventDefault = function() {\n inEvent.preventDefault();\n pd();\n };\n e.pointerId = this.POINTER_ID;\n e.isPrimary = true;\n e.pointerType = this.POINTER_TYPE;\n if ('webkitForce' in inEvent) {\n e.pressure = inEvent.webkitForce - MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN;\n }\n return e;\n },\n prepareButtonsForMove: function(e, inEvent) {\n var p = pointermap.get(this.POINTER_ID);\n\n // Update buttons state after possible out-of-document mouseup.\n if (inEvent.which === 0 || !p) {\n e.buttons = 0;\n } else {\n e.buttons = p.buttons;\n }\n inEvent.buttons = e.buttons;\n },\n mousedown: function(inEvent) {\n if (!this.isEventSimulatedFromTouch(inEvent)) {\n var p = pointermap.get(this.POINTER_ID);\n var e = this.prepareEvent(inEvent);\n if (!HAS_BUTTONS) {\n e.buttons = BUTTON_TO_BUTTONS[e.button];\n if (p) { e.buttons |= p.buttons; }\n inEvent.buttons = e.buttons;\n }\n pointermap.set(this.POINTER_ID, inEvent);\n if (!p || p.buttons === 0) {\n dispatcher.down(e);\n } else {\n dispatcher.move(e);\n }\n }\n },\n\n // This is called when the user force presses without moving x/y\n webkitmouseforcechanged: function(inEvent) {\n this.mousemove(inEvent);\n },\n mousemove: function(inEvent) {\n if (!this.isEventSimulatedFromTouch(inEvent)) {\n var e = this.prepareEvent(inEvent);\n if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }\n e.button = -1;\n pointermap.set(this.POINTER_ID, inEvent);\n dispatcher.move(e);\n }\n },\n mouseup: function(inEvent) {\n if (!this.isEventSimulatedFromTouch(inEvent)) {\n var p = pointermap.get(this.POINTER_ID);\n var e = this.prepareEvent(inEvent);\n if (!HAS_BUTTONS) {\n var up = BUTTON_TO_BUTTONS[e.button];\n\n // Produces wrong state of buttons in Browsers without `buttons` support\n // when a mouse button that was pressed outside the document is released\n // inside and other buttons are still pressed down.\n e.buttons = p ? p.buttons & ~up : 0;\n inEvent.buttons = e.buttons;\n }\n pointermap.set(this.POINTER_ID, inEvent);\n\n // Support: Firefox <=44 only\n // FF Ubuntu includes the lifted button in the `buttons` property on\n // mouseup.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1223366\n e.buttons &= ~BUTTON_TO_BUTTONS[e.button];\n if (e.buttons === 0) {\n dispatcher.up(e);\n } else {\n dispatcher.move(e);\n }\n }\n },\n mouseover: function(inEvent) {\n if (!this.isEventSimulatedFromTouch(inEvent)) {\n var e = this.prepareEvent(inEvent);\n if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }\n e.button = -1;\n pointermap.set(this.POINTER_ID, inEvent);\n dispatcher.enterOver(e);\n }\n },\n mouseout: function(inEvent) {\n if (!this.isEventSimulatedFromTouch(inEvent)) {\n var e = this.prepareEvent(inEvent);\n if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }\n e.button = -1;\n dispatcher.leaveOut(e);\n }\n },\n cancel: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.cancel(e);\n this.deactivateMouse();\n },\n deactivateMouse: function() {\n pointermap.delete(this.POINTER_ID);\n }\n };\n\n var captureInfo = dispatcher.captureInfo;\n var findTarget = targeting.findTarget.bind(targeting);\n var allShadows = targeting.allShadows.bind(targeting);\n var pointermap$1 = dispatcher.pointermap;\n\n // this should be long enough to ignore compat mouse events made by touch\n var DEDUP_TIMEOUT = 2500;\n var ATTRIB = 'touch-action';\n var INSTALLER;\n\n // bitmask for _scrollType\n var UP = 1;\n var DOWN = 2;\n var LEFT = 4;\n var RIGHT = 8;\n var AUTO = UP | DOWN | LEFT | RIGHT;\n\n // handler block for native touch events\n var touchEvents = {\n events: [\n 'touchstart',\n 'touchmove',\n 'touchforcechange',\n 'touchend',\n 'touchcancel'\n ],\n register: function(target) {\n INSTALLER.enableOnSubtree(target);\n },\n unregister: function() {\n\n // TODO(dfreedman): is it worth it to disconnect the MO?\n },\n elementAdded: function(el) {\n var a = el.getAttribute(ATTRIB);\n var st = this.touchActionToScrollType(a);\n if (typeof st === \"number\") {\n el._scrollType = st;\n dispatcher.listen(el, this.events);\n\n // set touch-action on shadows as well\n allShadows(el).forEach(function(s) {\n s._scrollType = st;\n dispatcher.listen(s, this.events);\n }, this);\n }\n },\n elementRemoved: function(el) {\n\n // In some cases, an element is removed before a touchend.\n // When this is the case, we should wait for the touchend before unlistening,\n // because we still want pointer events to bubble up after removing from DOM.\n if (pointermap$1.size > 0) {\n var evts = this.events;\n el.addEventListener('touchend', function() {\n el._scrollType = undefined;\n dispatcher.unlisten(el, evts);\n });\n } else {\n el._scrollType = undefined;\n dispatcher.unlisten(el, this.events);\n }\n\n // remove touch-action from shadow\n allShadows(el).forEach(function(s) {\n s._scrollType = undefined;\n dispatcher.unlisten(s, this.events);\n }, this);\n },\n elementChanged: function(el, oldValue) {\n var a = el.getAttribute(ATTRIB);\n var st = this.touchActionToScrollType(a);\n var oldSt = this.touchActionToScrollType(oldValue);\n\n // simply update scrollType if listeners are already established\n if (typeof st === \"number\" && typeof oldSt === \"number\") {\n el._scrollType = st;\n allShadows(el).forEach(function(s) {\n s._scrollType = st;\n }, this);\n } else if (typeof oldSt === \"number\") {\n this.elementRemoved(el);\n } else if (typeof st === \"number\") {\n this.elementAdded(el);\n }\n },\n scrollTypes: {\n UP: function(s) {\n return s.includes('pan-y') || s.includes('pan-up') ? UP : 0;\n },\n DOWN: function(s) {\n return s.includes('pan-y') || s.includes('pan-down') ? DOWN : 0;\n },\n LEFT: function(s) {\n return s.includes('pan-x') || s.includes('pan-left') ? LEFT : 0;\n },\n RIGHT: function(s) {\n return s.includes('pan-x') || s.includes('pan-right') ? RIGHT : 0;\n }\n },\n touchActionToScrollType: function(touchAction) {\n if (!touchAction) {\n return;\n }\n\n if (touchAction === \"auto\") {\n return AUTO;\n }\n\n if (touchAction === \"none\") {\n return 0;\n }\n\n var s = touchAction.split(' ');\n var st = this.scrollTypes;\n\n // construct a bitmask of allowed scroll directions\n return st.UP(s) | st.DOWN(s) | st.LEFT(s) | st.RIGHT(s);\n },\n POINTER_TYPE: 'touch',\n firstTouch: null,\n isPrimaryTouch: function(inTouch) {\n return this.firstTouch === inTouch.identifier;\n },\n setPrimaryTouch: function(inTouch) {\n\n // set primary touch if there no pointers, or the only pointer is the mouse\n if (pointermap$1.size === 0 || (pointermap$1.size === 1 && pointermap$1.has(1))) {\n this.firstTouch = inTouch.identifier;\n this.firstXY = { X: inTouch.clientX, Y: inTouch.clientY };\n this.scrolling = false;\n }\n },\n removePrimaryPointer: function(inPointer) {\n if (inPointer.isPrimary) {\n this.firstTouch = null;\n this.firstXY = null;\n }\n },\n typeToButtons: function(type) {\n var ret = 0;\n if (type === 'touchstart' || type === 'touchmove' || type === 'touchforcechange') {\n ret = 1;\n }\n return ret;\n },\n touchToPointer: function(inTouch) {\n var cte = this.currentTouchEvent;\n var e = dispatcher.cloneEvent(inTouch);\n\n // We reserve pointerId 1 for Mouse.\n // Touch identifiers can start at 0.\n // Add 2 to the touch identifier for compatibility.\n var id = e.pointerId = inTouch.identifier + 2;\n e.target = captureInfo[id] || findTarget(e);\n e.bubbles = true;\n e.cancelable = true;\n e.button = 0;\n e.buttons = this.typeToButtons(cte.type);\n e.width = (inTouch.radiusX || inTouch.webkitRadiusX || 0) * 2;\n e.height = (inTouch.radiusY || inTouch.webkitRadiusY || 0) * 2;\n e.pressure = inTouch.force !== undefined ?\n inTouch.force :\n inTouch.webkitForce !== undefined ?\n inTouch.webkitForce : undefined;\n e.isPrimary = this.isPrimaryTouch(inTouch);\n if (inTouch.altitudeAngle) {\n var tan = Math.tan(inTouch.altitudeAngle);\n var radToDeg = 180 / Math.PI;\n e.tiltX = Math.atan(Math.cos(inTouch.azimuthAngle) / tan) * radToDeg;\n e.tiltY = Math.atan(Math.sin(inTouch.azimuthAngle) / tan) * radToDeg;\n } else {\n e.tiltX = 0;\n e.tiltY = 0;\n }\n if (inTouch.touchType === 'stylus') {\n e.pointerType = 'pen';\n } else {\n e.pointerType = this.POINTER_TYPE;\n }\n\n // forward modifier keys\n e.altKey = cte.altKey;\n e.ctrlKey = cte.ctrlKey;\n e.metaKey = cte.metaKey;\n e.shiftKey = cte.shiftKey;\n\n // forward touch preventDefaults\n var self = this;\n e.preventDefault = function() {\n self.scrolling = false;\n self.firstXY = null;\n cte.preventDefault();\n };\n return e;\n },\n processTouches: function(inEvent, inFunction) {\n var tl = inEvent.changedTouches;\n this.currentTouchEvent = inEvent;\n for (var i = 0, t; i < tl.length; i++) {\n t = tl[i];\n inFunction.call(this, this.touchToPointer(t));\n }\n },\n\n // For single axis scrollers, determines whether the element should emit\n // pointer events or behave as a scroller\n shouldScroll: function(inEvent) {\n if (this.firstXY) {\n var ret;\n var st = inEvent.currentTarget._scrollType;\n if (st === 0) {\n\n // this element is a `touch-action: none`, should never scroll\n ret = false;\n } else if (st === AUTO) {\n\n // this element is a `touch-action: auto`, should always scroll\n ret = true;\n } else {\n var t = inEvent.changedTouches[0];\n\n var dy = t.clientY - this.firstXY.Y;\n var dya = Math.abs(dy);\n var dx = t.clientX - this.firstXY.X;\n var dxa = Math.abs(dx);\n\n var up = st & UP;\n var down = st & DOWN;\n var left = st & LEFT;\n var right = st & RIGHT;\n\n if (left && right) {\n\n // should scroll on the x axis\n ret = dxa > dya;\n } else if (left) {\n\n // should scroll left\n ret = dxa > dya && dx > 0;\n } else if (right) {\n\n // should scroll right\n ret = dxa > dya && dx < 0;\n }\n\n if (!ret) {\n if (up && down) {\n\n // should scroll on the y axis\n ret = dxa < dya;\n } else if (up) {\n\n // should scroll up\n ret = dxa < dya && dy > 0;\n } else if (down) {\n\n // should scroll down\n ret = dxa < dya && dy < 0;\n }\n }\n\n }\n this.firstXY = null;\n return ret;\n }\n },\n findTouch: function(inTL, inId) {\n for (var i = 0, l = inTL.length, t; i < l && (t = inTL[i]); i++) {\n if (t.identifier === inId) {\n return true;\n }\n }\n },\n\n // In some instances, a touchstart can happen without a touchend. This\n // leaves the pointermap in a broken state.\n // Therefore, on every touchstart, we remove the touches that did not fire a\n // touchend event.\n // To keep state globally consistent, we fire a\n // pointercancel for this \"abandoned\" touch\n vacuumTouches: function(inEvent) {\n var tl = inEvent.touches;\n\n // pointermap.size should be < tl.length here, as the touchstart has not\n // been processed yet.\n if (pointermap$1.size >= tl.length) {\n var d = [];\n pointermap$1.forEach(function(value, key) {\n\n // Never remove pointerId == 1, which is mouse.\n // Touch identifiers are 2 smaller than their pointerId, which is the\n // index in pointermap.\n if (key !== 1 && !this.findTouch(tl, key - 2)) {\n var p = value.out;\n d.push(p);\n }\n }, this);\n d.forEach(this.cancelOut, this);\n }\n },\n touchstart: function(inEvent) {\n this.vacuumTouches(inEvent);\n this.setPrimaryTouch(inEvent.changedTouches[0]);\n this.dedupSynthMouse(inEvent);\n if (!this.scrolling) {\n this.processTouches(inEvent, this.overDown);\n }\n },\n overDown: function(inPointer) {\n pointermap$1.set(inPointer.pointerId, {\n target: inPointer.target,\n out: inPointer,\n outTarget: inPointer.target\n });\n dispatcher.enterOver(inPointer);\n dispatcher.down(inPointer);\n },\n\n // Called when pressure or tilt changes without the x/y changing\n touchforcechange: function(inEvent) {\n this.touchmove(inEvent);\n },\n touchmove: function(inEvent) {\n if (!this.scrolling) {\n if (this.shouldScroll(inEvent)) {\n this.scrolling = true;\n this.touchcancel(inEvent);\n } else {\n if (inEvent.type !== 'touchforcechange') {\n inEvent.preventDefault();\n }\n this.processTouches(inEvent, this.moveOverOut);\n }\n }\n },\n moveOverOut: function(inPointer) {\n var event = inPointer;\n var pointer = pointermap$1.get(event.pointerId);\n\n // a finger drifted off the screen, ignore it\n if (!pointer) {\n return;\n }\n var outEvent = pointer.out;\n var outTarget = pointer.outTarget;\n dispatcher.move(event);\n if (outEvent && outTarget !== event.target) {\n outEvent.relatedTarget = event.target;\n event.relatedTarget = outTarget;\n\n // recover from retargeting by shadow\n outEvent.target = outTarget;\n if (event.target) {\n dispatcher.leaveOut(outEvent);\n dispatcher.enterOver(event);\n } else {\n\n // clean up case when finger leaves the screen\n event.target = outTarget;\n event.relatedTarget = null;\n this.cancelOut(event);\n }\n }\n pointer.out = event;\n pointer.outTarget = event.target;\n },\n touchend: function(inEvent) {\n this.dedupSynthMouse(inEvent);\n this.processTouches(inEvent, this.upOut);\n },\n upOut: function(inPointer) {\n if (!this.scrolling) {\n dispatcher.up(inPointer);\n dispatcher.leaveOut(inPointer);\n }\n this.cleanUpPointer(inPointer);\n },\n touchcancel: function(inEvent) {\n this.processTouches(inEvent, this.cancelOut);\n },\n cancelOut: function(inPointer) {\n dispatcher.cancel(inPointer);\n dispatcher.leaveOut(inPointer);\n this.cleanUpPointer(inPointer);\n },\n cleanUpPointer: function(inPointer) {\n pointermap$1.delete(inPointer.pointerId);\n this.removePrimaryPointer(inPointer);\n },\n\n // prevent synth mouse events from creating pointer events\n dedupSynthMouse: function(inEvent) {\n var lts = mouseEvents.lastTouches;\n var t = inEvent.changedTouches[0];\n\n // only the primary finger will synth mouse events\n if (this.isPrimaryTouch(t)) {\n\n // remember x/y of last touch\n var lt = { x: t.clientX, y: t.clientY };\n lts.push(lt);\n var fn = (function(lts, lt) {\n var i = lts.indexOf(lt);\n if (i > -1) {\n lts.splice(i, 1);\n }\n }).bind(null, lts, lt);\n setTimeout(fn, DEDUP_TIMEOUT);\n }\n }\n };\n\n INSTALLER = new Installer(touchEvents.elementAdded, touchEvents.elementRemoved,\n touchEvents.elementChanged, touchEvents);\n\n var pointermap$2 = dispatcher.pointermap;\n var HAS_BITMAP_TYPE = window.MSPointerEvent &&\n typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE === 'number';\n var msEvents = {\n events: [\n 'MSPointerDown',\n 'MSPointerMove',\n 'MSPointerUp',\n 'MSPointerOut',\n 'MSPointerOver',\n 'MSPointerCancel',\n 'MSGotPointerCapture',\n 'MSLostPointerCapture'\n ],\n register: function(target) {\n dispatcher.listen(target, this.events);\n },\n unregister: function(target) {\n dispatcher.unlisten(target, this.events);\n },\n POINTER_TYPES: [\n '',\n 'unavailable',\n 'touch',\n 'pen',\n 'mouse'\n ],\n prepareEvent: function(inEvent) {\n var e = inEvent;\n if (HAS_BITMAP_TYPE) {\n e = dispatcher.cloneEvent(inEvent);\n e.pointerType = this.POINTER_TYPES[inEvent.pointerType];\n }\n return e;\n },\n cleanup: function(id) {\n pointermap$2.delete(id);\n },\n MSPointerDown: function(inEvent) {\n pointermap$2.set(inEvent.pointerId, inEvent);\n var e = this.prepareEvent(inEvent);\n dispatcher.down(e);\n },\n MSPointerMove: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.move(e);\n },\n MSPointerUp: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.up(e);\n this.cleanup(inEvent.pointerId);\n },\n MSPointerOut: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.leaveOut(e);\n },\n MSPointerOver: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.enterOver(e);\n },\n MSPointerCancel: function(inEvent) {\n var e = this.prepareEvent(inEvent);\n dispatcher.cancel(e);\n this.cleanup(inEvent.pointerId);\n },\n MSLostPointerCapture: function(inEvent) {\n var e = dispatcher.makeEvent('lostpointercapture', inEvent);\n dispatcher.dispatchEvent(e);\n },\n MSGotPointerCapture: function(inEvent) {\n var e = dispatcher.makeEvent('gotpointercapture', inEvent);\n dispatcher.dispatchEvent(e);\n }\n };\n\n function applyPolyfill() {\n\n // only activate if this platform does not have pointer events\n if (!window.PointerEvent) {\n window.PointerEvent = PointerEvent;\n\n if (window.navigator.msPointerEnabled) {\n var tp = window.navigator.msMaxTouchPoints;\n Object.defineProperty(window.navigator, 'maxTouchPoints', {\n value: tp,\n enumerable: true\n });\n dispatcher.registerSource('ms', msEvents);\n } else {\n Object.defineProperty(window.navigator, 'maxTouchPoints', {\n value: 0,\n enumerable: true\n });\n dispatcher.registerSource('mouse', mouseEvents);\n if (window.ontouchstart !== undefined) {\n dispatcher.registerSource('touch', touchEvents);\n }\n }\n\n dispatcher.register(document);\n }\n }\n\n var n = window.navigator;\n var s;\n var r;\n var h;\n function assertActive(id) {\n if (!dispatcher.pointermap.has(id)) {\n var error = new Error('NotFoundError');\n error.name = 'NotFoundError';\n throw error;\n }\n }\n function assertConnected(elem) {\n var parent = elem.parentNode;\n while (parent && parent !== elem.ownerDocument) {\n parent = parent.parentNode;\n }\n if (!parent) {\n var error = new Error('InvalidStateError');\n error.name = 'InvalidStateError';\n throw error;\n }\n }\n function inActiveButtonState(id) {\n var p = dispatcher.pointermap.get(id);\n return p.buttons !== 0;\n }\n if (n.msPointerEnabled) {\n s = function(pointerId) {\n assertActive(pointerId);\n assertConnected(this);\n if (inActiveButtonState(pointerId)) {\n dispatcher.setCapture(pointerId, this, true);\n this.msSetPointerCapture(pointerId);\n }\n };\n r = function(pointerId) {\n assertActive(pointerId);\n dispatcher.releaseCapture(pointerId, true);\n this.msReleasePointerCapture(pointerId);\n };\n } else {\n s = function setPointerCapture(pointerId) {\n assertActive(pointerId);\n assertConnected(this);\n if (inActiveButtonState(pointerId)) {\n dispatcher.setCapture(pointerId, this);\n }\n };\n r = function releasePointerCapture(pointerId) {\n assertActive(pointerId);\n dispatcher.releaseCapture(pointerId);\n };\n }\n h = function hasPointerCapture(pointerId) {\n return !!dispatcher.captureInfo[pointerId];\n };\n\n function applyPolyfill$1() {\n if (window.Element && !Element.prototype.setPointerCapture) {\n Object.defineProperties(Element.prototype, {\n 'setPointerCapture': {\n value: s\n },\n 'releasePointerCapture': {\n value: r\n },\n 'hasPointerCapture': {\n value: h\n }\n });\n }\n }\n\n applyAttributeStyles();\n applyPolyfill();\n applyPolyfill$1();\n\n var pointerevents = {\n dispatcher: dispatcher,\n Installer: Installer,\n PointerEvent: PointerEvent,\n PointerMap: PointerMap,\n targetFinding: targeting\n };\n\n return pointerevents;\n\n}));","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","var Processor = require('./processor');\n\nexports.Processor = Processor;\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var newImageData = require('./util').newImageData;\n\n/**\n * Create a function for running operations. This function is serialized for\n * use in a worker.\n * @param {function(Array, Object):*} operation The operation.\n * @return {function(Object):ArrayBuffer} A function that takes an object with\n * buffers, meta, imageOps, width, and height properties and returns an array\n * buffer.\n */\nfunction createMinion(operation) {\n var workerHasImageData = true;\n try {\n new ImageData(10, 10);\n } catch (_) {\n workerHasImageData = false;\n }\n\n function newWorkerImageData(data, width, height) {\n if (workerHasImageData) {\n return new ImageData(data, width, height);\n } else {\n return {data: data, width: width, height: height};\n }\n }\n\n return function(data) {\n // bracket notation for minification support\n var buffers = data['buffers'];\n var meta = data['meta'];\n var imageOps = data['imageOps'];\n var width = data['width'];\n var height = data['height'];\n\n var numBuffers = buffers.length;\n var numBytes = buffers[0].byteLength;\n var output, b;\n\n if (imageOps) {\n var images = new Array(numBuffers);\n for (b = 0; b < numBuffers; ++b) {\n images[b] = newWorkerImageData(\n new Uint8ClampedArray(buffers[b]), width, height);\n }\n output = operation(images, meta).data;\n } else {\n output = new Uint8ClampedArray(numBytes);\n var arrays = new Array(numBuffers);\n var pixels = new Array(numBuffers);\n for (b = 0; b < numBuffers; ++b) {\n arrays[b] = new Uint8ClampedArray(buffers[b]);\n pixels[b] = [0, 0, 0, 0];\n }\n for (var i = 0; i < numBytes; i += 4) {\n for (var j = 0; j < numBuffers; ++j) {\n var array = arrays[j];\n pixels[j][0] = array[i];\n pixels[j][1] = array[i + 1];\n pixels[j][2] = array[i + 2];\n pixels[j][3] = array[i + 3];\n }\n var pixel = operation(pixels, meta);\n output[i] = pixel[0];\n output[i + 1] = pixel[1];\n output[i + 2] = pixel[2];\n output[i + 3] = pixel[3];\n }\n }\n return output.buffer;\n };\n}\n\n/**\n * Create a worker for running operations.\n * @param {Object} config Configuration.\n * @param {function(MessageEvent)} onMessage Called with a message event.\n * @return {Worker} The worker.\n */\nfunction createWorker(config, onMessage) {\n var lib = Object.keys(config.lib || {}).map(function(name) {\n return 'var ' + name + ' = ' + config.lib[name].toString() + ';';\n });\n\n var lines = lib.concat([\n 'var __minion__ = (' + createMinion.toString() + ')(', config.operation.toString(), ');',\n 'self.addEventListener(\"message\", function(event) {',\n ' var buffer = __minion__(event.data);',\n ' self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);',\n '});'\n ]);\n\n var blob = new Blob(lines, {type: 'text/javascript'});\n var source = URL.createObjectURL(blob);\n var worker = new Worker(source);\n worker.addEventListener('message', onMessage);\n return worker;\n}\n\n/**\n * Create a faux worker for running operations.\n * @param {Object} config Configuration.\n * @param {function(MessageEvent)} onMessage Called with a message event.\n * @return {Object} The faux worker.\n */\nfunction createFauxWorker(config, onMessage) {\n var minion = createMinion(config.operation);\n return {\n postMessage: function(data) {\n setTimeout(function() {\n onMessage({'data': {'buffer': minion(data), 'meta': data['meta']}});\n }, 0);\n }\n };\n}\n\n/**\n * A processor runs pixel or image operations in workers.\n * @param {Object} config Configuration.\n */\nfunction Processor(config) {\n this._imageOps = !!config.imageOps;\n var threads;\n if (config.threads === 0) {\n threads = 0;\n } else if (this._imageOps) {\n threads = 1;\n } else {\n threads = config.threads || 1;\n }\n var workers = [];\n if (threads) {\n for (var i = 0; i < threads; ++i) {\n workers[i] = createWorker(config, this._onWorkerMessage.bind(this, i));\n }\n } else {\n workers[0] = createFauxWorker(config, this._onWorkerMessage.bind(this, 0));\n }\n this._workers = workers;\n this._queue = [];\n this._maxQueueLength = config.queue || Infinity;\n this._running = 0;\n this._dataLookup = {};\n this._job = null;\n}\n\n/**\n * Run operation on input data.\n * @param {Array.} inputs Array of pixels or image data\n * (depending on the operation type).\n * @param {Object} meta A user data object. This is passed to all operations\n * and must be serializable.\n * @param {function(Error, ImageData, Object)} callback Called when work\n * completes. The first argument is any error. The second is the ImageData\n * generated by operations. The third is the user data object.\n */\nProcessor.prototype.process = function(inputs, meta, callback) {\n this._enqueue({\n inputs: inputs,\n meta: meta,\n callback: callback\n });\n this._dispatch();\n};\n\n/**\n * Stop responding to any completed work and destroy the processor.\n */\nProcessor.prototype.destroy = function() {\n for (var key in this) {\n this[key] = null;\n }\n this._destroyed = true;\n};\n\n/**\n * Add a job to the queue.\n * @param {Object} job The job.\n */\nProcessor.prototype._enqueue = function(job) {\n this._queue.push(job);\n while (this._queue.length > this._maxQueueLength) {\n this._queue.shift().callback(null, null);\n }\n};\n\n/**\n * Dispatch a job.\n */\nProcessor.prototype._dispatch = function() {\n if (this._running === 0 && this._queue.length > 0) {\n var job = this._job = this._queue.shift();\n var width = job.inputs[0].width;\n var height = job.inputs[0].height;\n var buffers = job.inputs.map(function(input) {\n return input.data.buffer;\n });\n var threads = this._workers.length;\n this._running = threads;\n if (threads === 1) {\n this._workers[0].postMessage({\n 'buffers': buffers,\n 'meta': job.meta,\n 'imageOps': this._imageOps,\n 'width': width,\n 'height': height\n }, buffers);\n } else {\n var length = job.inputs[0].data.length;\n var segmentLength = 4 * Math.ceil(length / 4 / threads);\n for (var i = 0; i < threads; ++i) {\n var offset = i * segmentLength;\n var slices = [];\n for (var j = 0, jj = buffers.length; j < jj; ++j) {\n slices.push(buffers[i].slice(offset, offset + segmentLength));\n }\n this._workers[i].postMessage({\n 'buffers': slices,\n 'meta': job.meta,\n 'imageOps': this._imageOps,\n 'width': width,\n 'height': height\n }, slices);\n }\n }\n }\n};\n\n/**\n * Handle messages from the worker.\n * @param {number} index The worker index.\n * @param {MessageEvent} event The message event.\n */\nProcessor.prototype._onWorkerMessage = function(index, event) {\n if (this._destroyed) {\n return;\n }\n this._dataLookup[index] = event.data;\n --this._running;\n if (this._running === 0) {\n this._resolveJob();\n }\n};\n\n/**\n * Resolve a job. If there are no more worker threads, the processor callback\n * will be called.\n */\nProcessor.prototype._resolveJob = function() {\n var job = this._job;\n var threads = this._workers.length;\n var data, meta;\n if (threads === 1) {\n data = new Uint8ClampedArray(this._dataLookup[0]['buffer']);\n meta = this._dataLookup[0]['meta'];\n } else {\n var length = job.inputs[0].data.length;\n data = new Uint8ClampedArray(length);\n meta = new Array(length);\n var segmentLength = 4 * Math.ceil(length / 4 / threads);\n for (var i = 0; i < threads; ++i) {\n var buffer = this._dataLookup[i]['buffer'];\n var offset = i * segmentLength;\n data.set(new Uint8ClampedArray(buffer), offset);\n meta[i] = this._dataLookup[i]['meta'];\n }\n }\n this._job = null;\n this._dataLookup = {};\n job.callback(null,\n newImageData(data, job.inputs[0].width, job.inputs[0].height), meta);\n this._dispatch();\n};\n\nmodule.exports = Processor;\n","var hasImageData = true;\ntry {\n new ImageData(10, 10);\n} catch (_) {\n hasImageData = false;\n}\n\nvar context = document.createElement('canvas').getContext('2d');\n\nfunction newImageData(data, width, height) {\n if (hasImageData) {\n return new ImageData(data, width, height);\n } else {\n var imageData = context.createImageData(width, height);\n imageData.data.set(data);\n return imageData;\n }\n}\n\nexports.newImageData = newImageData;\n","/**\n * @module ol/util\n */\n/**\n * @return {?} Any return.\n */\nexport function abstract() {\n return /** @type {?} */ ((function () {\n throw new Error('Unimplemented abstract method.');\n })());\n}\n/**\n * Counter for getUid.\n * @type {number}\n * @private\n */\nvar uidCounter_ = 0;\n/**\n * Gets a unique ID for an object. This mutates the object so that further calls\n * with the same object as a parameter returns the same value. Unique IDs are generated\n * as a strictly increasing sequence. Adapted from goog.getUid.\n *\n * @param {Object} obj The object to get the unique ID for.\n * @return {string} The unique ID for the object.\n * @api\n */\nexport function getUid(obj) {\n return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));\n}\n/**\n * OpenLayers version.\n * @type {string}\n */\nexport var VERSION = '6.1.1';\n//# sourceMappingURL=util.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/AssertionError\n */\nimport { VERSION } from './util.js';\n/**\n * Error object thrown when an assertion failed. This is an ECMA-262 Error,\n * extended with a `code` property.\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error.\n */\nvar AssertionError = /** @class */ (function (_super) {\n __extends(AssertionError, _super);\n /**\n * @param {number} code Error code.\n */\n function AssertionError(code) {\n var _this = this;\n var path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0];\n var message = 'Assertion failed. See https://openlayers.org/en/' + path +\n '/doc/errors/#' + code + ' for details.';\n _this = _super.call(this, message) || this;\n /**\n * Error code. The meaning of the code can be found on\n * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with\n * the version found in the OpenLayers script's header comment if a version\n * other than the latest is used).\n * @type {number}\n * @api\n */\n _this.code = code;\n /**\n * @type {string}\n */\n _this.name = 'AssertionError';\n // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40\n _this.message = message;\n return _this;\n }\n return AssertionError;\n}(Error));\nexport default AssertionError;\n//# sourceMappingURL=AssertionError.js.map","/**\n * @module ol/CollectionEventType\n */\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when an item is added to the collection.\n * @event module:ol/Collection.CollectionEvent#add\n * @api\n */\n ADD: 'add',\n /**\n * Triggered when an item is removed from the collection.\n * @event module:ol/Collection.CollectionEvent#remove\n * @api\n */\n REMOVE: 'remove'\n};\n//# sourceMappingURL=CollectionEventType.js.map","/**\n * @module ol/ObjectEventType\n */\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a property is changed.\n * @event module:ol/Object.ObjectEvent#propertychange\n * @api\n */\n PROPERTYCHANGE: 'propertychange'\n};\n//# sourceMappingURL=ObjectEventType.js.map","/**\n * @module ol/obj\n */\n/**\n * Polyfill for Object.assign(). Assigns enumerable and own properties from\n * one or more source objects to a target object.\n * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign.\n *\n * @param {!Object} target The target object.\n * @param {...Object} var_sources The source object(s).\n * @return {!Object} The modified target object.\n */\nexport var assign = (typeof Object.assign === 'function') ? Object.assign : function (target, var_sources) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var output = Object(target);\n for (var i = 1, ii = arguments.length; i < ii; ++i) {\n var source = arguments[i];\n if (source !== undefined && source !== null) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n output[key] = source[key];\n }\n }\n }\n }\n return output;\n};\n/**\n * Removes all properties from an object.\n * @param {Object} object The object to clear.\n */\nexport function clear(object) {\n for (var property in object) {\n delete object[property];\n }\n}\n/**\n * Polyfill for Object.values(). Get an array of property values from an object.\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values\n *\n * @param {!Object} object The object from which to get the values.\n * @return {!Array} The property values.\n * @template K,V\n */\nexport var getValues = (typeof Object.values === 'function') ? Object.values : function (object) {\n var values = [];\n for (var property in object) {\n values.push(object[property]);\n }\n return values;\n};\n/**\n * Determine if an object has any properties.\n * @param {Object} object The object to check.\n * @return {boolean} The object is empty.\n */\nexport function isEmpty(object) {\n var property;\n for (property in object) {\n return false;\n }\n return !property;\n}\n//# sourceMappingURL=obj.js.map","/**\n * @module ol/events\n */\nimport { clear } from './obj.js';\n/**\n * Key to use with {@link module:ol/Observable~Observable#unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener\n * @property {import(\"./events/Target.js\").EventTargetLike} target\n * @property {string} type\n * @api\n */\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events~unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object=} opt_this Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean=} opt_once If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, opt_this, opt_once) {\n if (opt_this && opt_this !== target) {\n listener = listener.bind(opt_this);\n }\n if (opt_once) {\n var originalListener_1 = listener;\n listener = function () {\n target.removeEventListener(type, listener);\n originalListener_1.apply(this, arguments);\n };\n }\n var eventsKey = {\n target: target,\n type: type,\n listener: listener\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events~unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events~listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object=} opt_this Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, opt_this) {\n return listen(target, type, listener, opt_this, true);\n}\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events~listen} or {@link module:ol/events~listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n//# sourceMappingURL=events.js.map","/**\n * @module ol/Disposable\n */\n/**\n * @classdesc\n * Objects that need to clean up after themselves.\n */\nvar Disposable = /** @class */ (function () {\n function Disposable() {\n /**\n * The object has already been disposed.\n * @type {boolean}\n * @private\n */\n this.disposed_ = false;\n }\n /**\n * Clean up.\n */\n Disposable.prototype.dispose = function () {\n if (!this.disposed_) {\n this.disposed_ = true;\n this.disposeInternal();\n }\n };\n /**\n * Extension point for disposable objects.\n * @protected\n */\n Disposable.prototype.disposeInternal = function () { };\n return Disposable;\n}());\nexport default Disposable;\n//# sourceMappingURL=Disposable.js.map","/**\n * @module ol/array\n */\n/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n * https://github.com/darkskyapp/binary-search\n *\n * @param {Array<*>} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function=} opt_comparator Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, opt_comparator) {\n var mid, cmp;\n var comparator = opt_comparator || numberSafeCompareFunction;\n var low = 0;\n var high = haystack.length;\n var found = false;\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + (high - low >> 1);\n cmp = +comparator(haystack[mid], needle);\n if (cmp < 0.0) { /* Too low. */\n low = mid + 1;\n }\n else { /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n /* Key not found. */\n return found ? low : ~low;\n}\n/**\n * Compare function for array sort that is safe for numbers.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function numberSafeCompareFunction(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n/**\n * Whether the array contains the given object.\n * @param {Array<*>} arr The array to test for the presence of the element.\n * @param {*} obj The object for which to test.\n * @return {boolean} The object is in the array.\n */\nexport function includes(arr, obj) {\n return arr.indexOf(obj) >= 0;\n}\n/**\n * @param {Array} arr Array.\n * @param {number} target Target.\n * @param {number} direction 0 means return the nearest, > 0\n * means return the largest nearest, < 0 means return the\n * smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n var n = arr.length;\n if (arr[0] <= target) {\n return 0;\n }\n else if (target <= arr[n - 1]) {\n return n - 1;\n }\n else {\n var i = void 0;\n if (direction > 0) {\n for (i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n }\n else if (direction < 0) {\n for (i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n }\n else {\n for (i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n }\n else if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n }\n else {\n return i;\n }\n }\n }\n }\n return n - 1;\n }\n}\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n var tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n/**\n * @param {Array} arr The array to modify.\n * @param {!Array|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n var extension = Array.isArray(data) ? data : [data];\n var length = extension.length;\n for (var i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n/**\n * @param {Array} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n var i = arr.indexOf(obj);\n var found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n/**\n * @param {Array} arr The array to search in.\n * @param {function(VALUE, number, ?) : boolean} func The function to compare.\n * @template VALUE\n * @return {VALUE|null} The element found or null.\n */\nexport function find(arr, func) {\n var length = arr.length >>> 0;\n var value;\n for (var i = 0; i < length; i++) {\n value = arr[i];\n if (func(value, i, arr)) {\n return value;\n }\n }\n return null;\n}\n/**\n * @param {Array|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n var len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (var i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Sort the passed array such that the relative order of equal elements is preverved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n */\nexport function stableSort(arr, compareFnc) {\n var length = arr.length;\n var tmp = Array(arr.length);\n var i;\n for (i = 0; i < length; i++) {\n tmp[i] = { index: i, value: arr[i] };\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n/**\n * @param {Array<*>} arr The array to search in.\n * @param {Function} func Comparison function.\n * @return {number} Return index.\n */\nexport function findIndex(arr, func) {\n var index;\n var found = !arr.every(function (el, idx) {\n index = idx;\n return !func(el, idx, arr);\n });\n return found ? index : -1;\n}\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function=} opt_func Comparison function.\n * @param {boolean=} opt_strict Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, opt_func, opt_strict) {\n var compare = opt_func || numberSafeCompareFunction;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n var res = compare(arr[index - 1], currentVal);\n return !(res > 0 || opt_strict && res === 0);\n });\n}\n//# sourceMappingURL=array.js.map","/**\n * @module ol/functions\n */\nimport { equals as arrayEquals } from './array.js';\n/**\n * Always returns true.\n * @returns {boolean} true.\n */\nexport function TRUE() {\n return true;\n}\n/**\n * Always returns false.\n * @returns {boolean} false.\n */\nexport function FALSE() {\n return false;\n}\n/**\n * A reusable function, used e.g. as a default for callbacks.\n *\n * @return {void} Nothing.\n */\nexport function VOID() { }\n/**\n * Wrap a function in another function that remembers the last return. If the\n * returned function is called twice in a row with the same arguments and the same\n * this object, it will return the value from the first call in the second call.\n *\n * @param {function(...any): ReturnType} fn The function to memoize.\n * @return {function(...any): ReturnType} The memoized function.\n * @template ReturnType\n */\nexport function memoizeOne(fn) {\n var called = false;\n /** @type {ReturnType} */\n var lastResult;\n /** @type {Array} */\n var lastArgs;\n var lastThis;\n return function () {\n var nextArgs = Array.prototype.slice.call(arguments);\n if (!called || this !== lastThis || !arrayEquals(nextArgs, lastArgs)) {\n called = true;\n lastThis = this;\n lastArgs = nextArgs;\n lastResult = fn.apply(this, arguments);\n }\n return lastResult;\n };\n}\n//# sourceMappingURL=functions.js.map","/**\n * @module ol/events/Event\n */\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nvar BaseEvent = /** @class */ (function () {\n /**\n * @param {string} type Type.\n */\n function BaseEvent(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n /**\n * Stop event propagation.\n * @api\n */\n BaseEvent.prototype.preventDefault = function () {\n this.propagationStopped = true;\n };\n /**\n * Stop event propagation.\n * @api\n */\n BaseEvent.prototype.stopPropagation = function () {\n this.propagationStopped = true;\n };\n return BaseEvent;\n}());\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\nexport default BaseEvent;\n//# sourceMappingURL=Event.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport { VOID } from '../functions.js';\nimport Event from './Event.js';\nimport { clear } from '../obj.js';\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nvar Target = /** @class */ (function (_super) {\n __extends(Target, _super);\n /**\n * @param {*=} opt_target Default event target for dispatched events.\n */\n function Target(opt_target) {\n var _this = _super.call(this) || this;\n /**\n * @private\n * @type {*}\n */\n _this.eventTarget_ = opt_target;\n /**\n * @private\n * @type {!Object}\n */\n _this.pendingRemovals_ = {};\n /**\n * @private\n * @type {!Object}\n */\n _this.dispatching_ = {};\n /**\n * @private\n * @type {!Object>}\n */\n _this.listeners_ = {};\n return _this;\n }\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").ListenerFunction} listener Listener.\n */\n Target.prototype.addEventListener = function (type, listener) {\n if (!type || !listener) {\n return;\n }\n var listeners = this.listeners_[type];\n if (!listeners) {\n listeners = [];\n this.listeners_[type] = listeners;\n }\n if (listeners.indexOf(listener) === -1) {\n listeners.push(listener);\n }\n };\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {{type: string,\n * target: (EventTargetLike|undefined),\n * propagationStopped: (boolean|undefined)}|\n * import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n Target.prototype.dispatchEvent = function (event) {\n var evt = typeof event === 'string' ? new Event(event) : event;\n var type = evt.type;\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n var listeners = this.listeners_[type];\n var propagate;\n if (listeners) {\n if (!(type in this.dispatching_)) {\n this.dispatching_[type] = 0;\n this.pendingRemovals_[type] = 0;\n }\n ++this.dispatching_[type];\n for (var i = 0, ii = listeners.length; i < ii; ++i) {\n if (listeners[i].call(this, evt) === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n --this.dispatching_[type];\n if (this.dispatching_[type] === 0) {\n var pendingRemovals = this.pendingRemovals_[type];\n delete this.pendingRemovals_[type];\n while (pendingRemovals--) {\n this.removeEventListener(type, VOID);\n }\n delete this.dispatching_[type];\n }\n return propagate;\n }\n };\n /**\n * @inheritDoc\n */\n Target.prototype.disposeInternal = function () {\n clear(this.listeners_);\n };\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array} Listeners.\n */\n Target.prototype.getListeners = function (type) {\n return this.listeners_[type];\n };\n /**\n * @param {string=} opt_type Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n Target.prototype.hasListener = function (opt_type) {\n return opt_type ?\n opt_type in this.listeners_ :\n Object.keys(this.listeners_).length > 0;\n };\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").ListenerFunction} listener Listener.\n */\n Target.prototype.removeEventListener = function (type, listener) {\n var listeners = this.listeners_[type];\n if (listeners) {\n var index = listeners.indexOf(listener);\n if (index !== -1) {\n if (type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n }\n else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n };\n return Target;\n}(Disposable));\nexport default Target;\n//# sourceMappingURL=Target.js.map","/**\n * @module ol/events/EventType\n */\n/**\n * @enum {string}\n * @const\n */\nexport default {\n /**\n * Generic change event. Triggered when the revision counter is increased.\n * @event module:ol/events/Event~BaseEvent#change\n * @api\n */\n CHANGE: 'change',\n /**\n * Generic error event. Triggered when an error occurs.\n * @event module:ol/events/Event~BaseEvent#error\n * @api\n */\n ERROR: 'error',\n BLUR: 'blur',\n CLEAR: 'clear',\n CONTEXTMENU: 'contextmenu',\n CLICK: 'click',\n DBLCLICK: 'dblclick',\n DRAGENTER: 'dragenter',\n DRAGOVER: 'dragover',\n DROP: 'drop',\n FOCUS: 'focus',\n KEYDOWN: 'keydown',\n KEYPRESS: 'keypress',\n LOAD: 'load',\n RESIZE: 'resize',\n WHEEL: 'wheel'\n};\n//# sourceMappingURL=EventType.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Observable\n */\nimport { listen, unlistenByKey, listenOnce } from './events.js';\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nvar Observable = /** @class */ (function (_super) {\n __extends(Observable, _super);\n function Observable() {\n var _this = _super.call(this) || this;\n /**\n * @private\n * @type {number}\n */\n _this.revision_ = 0;\n return _this;\n }\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n Observable.prototype.changed = function () {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n };\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n Observable.prototype.getRevision = function () {\n return this.revision_;\n };\n /**\n * Listen for a certain type of event.\n * @param {string|Array} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\n Observable.prototype.on = function (type, listener) {\n if (Array.isArray(type)) {\n var len = type.length;\n var keys = new Array(len);\n for (var i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n }\n else {\n return listen(this, /** @type {string} */ (type), listener);\n }\n };\n /**\n * Listen once for a certain type of event.\n * @param {string|Array} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\n Observable.prototype.once = function (type, listener) {\n if (Array.isArray(type)) {\n var len = type.length;\n var keys = new Array(len);\n for (var i = 0; i < len; ++i) {\n keys[i] = listenOnce(this, type[i], listener);\n }\n return keys;\n }\n else {\n return listenOnce(this, /** @type {string} */ (type), listener);\n }\n };\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @api\n */\n Observable.prototype.un = function (type, listener) {\n if (Array.isArray(type)) {\n for (var i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n }\n else {\n this.removeEventListener(type, listener);\n }\n };\n return Observable;\n}(EventTarget));\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (var i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n }\n else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\nexport default Observable;\n//# sourceMappingURL=Observable.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Object\n */\nimport { getUid } from './util.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport Event from './events/Event.js';\nimport { assign } from './obj.js';\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nvar ObjectEvent = /** @class */ (function (_super) {\n __extends(ObjectEvent, _super);\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n function ObjectEvent(type, key, oldValue) {\n var _this = _super.call(this, type) || this;\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n _this.key = key;\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n _this.oldValue = oldValue;\n return _this;\n }\n return ObjectEvent;\n}(Event));\nexport { ObjectEvent };\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @api\n */\nvar BaseObject = /** @class */ (function (_super) {\n __extends(BaseObject, _super);\n /**\n * @param {Object=} opt_values An object with key-value pairs.\n */\n function BaseObject(opt_values) {\n var _this = _super.call(this) || this;\n // Call {@link module:ol/util~getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(_this);\n /**\n * @private\n * @type {!Object}\n */\n _this.values_ = {};\n if (opt_values !== undefined) {\n _this.setProperties(opt_values);\n }\n return _this;\n }\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n BaseObject.prototype.get = function (key) {\n var value;\n if (this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n };\n /**\n * Get a list of object property names.\n * @return {Array} List of property names.\n * @api\n */\n BaseObject.prototype.getKeys = function () {\n return Object.keys(this.values_);\n };\n /**\n * Get an object of all property names and values.\n * @return {Object} Object.\n * @api\n */\n BaseObject.prototype.getProperties = function () {\n return assign({}, this.values_);\n };\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n BaseObject.prototype.notify = function (key, oldValue) {\n var eventType;\n eventType = getChangeEventType(key);\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n eventType = ObjectEventType.PROPERTYCHANGE;\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n };\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean=} opt_silent Update without triggering an event.\n * @api\n */\n BaseObject.prototype.set = function (key, value, opt_silent) {\n if (opt_silent) {\n this.values_[key] = value;\n }\n else {\n var oldValue = this.values_[key];\n this.values_[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n };\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Object} values Values.\n * @param {boolean=} opt_silent Update without triggering an event.\n * @api\n */\n BaseObject.prototype.setProperties = function (values, opt_silent) {\n for (var key in values) {\n this.set(key, values[key], opt_silent);\n }\n };\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean=} opt_silent Unset without triggering an event.\n * @api\n */\n BaseObject.prototype.unset = function (key, opt_silent) {\n if (key in this.values_) {\n var oldValue = this.values_[key];\n delete this.values_[key];\n if (!opt_silent) {\n this.notify(key, oldValue);\n }\n }\n };\n return BaseObject;\n}(Observable));\n/**\n * @type {Object}\n */\nvar changeEventTypeCache = {};\n/**\n * @param {string} key Key name.\n * @return {string} Change name.\n */\nexport function getChangeEventType(key) {\n return changeEventTypeCache.hasOwnProperty(key) ?\n changeEventTypeCache[key] :\n (changeEventTypeCache[key] = 'change:' + key);\n}\nexport default BaseObject;\n//# sourceMappingURL=Object.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Collection\n */\nimport AssertionError from './AssertionError.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport BaseObject from './Object.js';\nimport Event from './events/Event.js';\n/**\n * @enum {string}\n * @private\n */\nvar Property = {\n LENGTH: 'length'\n};\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n */\nvar CollectionEvent = /** @class */ (function (_super) {\n __extends(CollectionEvent, _super);\n /**\n * @param {CollectionEventType} type Type.\n * @param {*=} opt_element Element.\n * @param {number} opt_index The index of the added or removed element.\n */\n function CollectionEvent(type, opt_element, opt_index) {\n var _this = _super.call(this, type) || this;\n /**\n * The element that is added to or removed from the collection.\n * @type {*}\n * @api\n */\n _this.element = opt_element;\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n _this.index = opt_index;\n return _this;\n }\n return CollectionEvent;\n}(Event));\nexport { CollectionEvent };\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nvar Collection = /** @class */ (function (_super) {\n __extends(Collection, _super);\n /**\n * @param {Array=} opt_array Array.\n * @param {Options=} opt_options Collection options.\n */\n function Collection(opt_array, opt_options) {\n var _this = _super.call(this) || this;\n var options = opt_options || {};\n /**\n * @private\n * @type {boolean}\n */\n _this.unique_ = !!options.unique;\n /**\n * @private\n * @type {!Array}\n */\n _this.array_ = opt_array ? opt_array : [];\n if (_this.unique_) {\n for (var i = 0, ii = _this.array_.length; i < ii; ++i) {\n _this.assertUnique_(_this.array_[i], i);\n }\n }\n _this.updateLength_();\n return _this;\n }\n /**\n * Remove all elements from the collection.\n * @api\n */\n Collection.prototype.clear = function () {\n while (this.getLength() > 0) {\n this.pop();\n }\n };\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array} arr Array.\n * @return {Collection} This collection.\n * @api\n */\n Collection.prototype.extend = function (arr) {\n for (var i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n };\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n Collection.prototype.forEach = function (f) {\n var array = this.array_;\n for (var i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n };\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array} Array.\n * @api\n */\n Collection.prototype.getArray = function () {\n return this.array_;\n };\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n Collection.prototype.item = function (index) {\n return this.array_[index];\n };\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n Collection.prototype.getLength = function () {\n return this.get(Property.LENGTH);\n };\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n Collection.prototype.insertAt = function (index, elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD, elem, index));\n };\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n Collection.prototype.pop = function () {\n return this.removeAt(this.getLength() - 1);\n };\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n Collection.prototype.push = function (elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n var n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n };\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n Collection.prototype.remove = function (elem) {\n var arr = this.array_;\n for (var i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n };\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n Collection.prototype.removeAt = function (index) {\n var prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE, prev, index));\n return prev;\n };\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n Collection.prototype.setAt = function (index, elem) {\n var n = this.getLength();\n if (index < n) {\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n var prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE, prev, index));\n this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD, elem, index));\n }\n else {\n for (var j = n; j < index; ++j) {\n this.insertAt(j, undefined);\n }\n this.insertAt(index, elem);\n }\n };\n /**\n * @private\n */\n Collection.prototype.updateLength_ = function () {\n this.set(Property.LENGTH, this.array_.length);\n };\n /**\n * @private\n * @param {T} elem Element.\n * @param {number=} opt_except Optional index to ignore.\n */\n Collection.prototype.assertUnique_ = function (elem, opt_except) {\n for (var i = 0, ii = this.array_.length; i < ii; ++i) {\n if (this.array_[i] === elem && i !== opt_except) {\n throw new AssertionError(58);\n }\n }\n };\n return Collection;\n}(BaseObject));\nexport default Collection;\n//# sourceMappingURL=Collection.js.map","/**\n * @module ol/asserts\n */\nimport AssertionError from './AssertionError.js';\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {number} errorCode Error code.\n */\nexport function assert(assertion, errorCode) {\n if (!assertion) {\n throw new AssertionError(errorCode);\n }\n}\n//# sourceMappingURL=asserts.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Feature\n */\nimport { assert } from './asserts.js';\nimport { listen, unlistenByKey } from './events.js';\nimport EventType from './events/EventType.js';\nimport BaseObject, { getChangeEventType } from './Object.js';\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature';\n * import Polygon from 'ol/geom/Polygon';\n * import Point from 'ol/geom/Point';\n *\n * var feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon'\n * });\n *\n * // get the polygon geometry\n * var poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * var point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} Geometry\n */\nvar Feature = /** @class */ (function (_super) {\n __extends(Feature, _super);\n /**\n * @param {Geometry|Object=} opt_geometryOrProperties\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n function Feature(opt_geometryOrProperties) {\n var _this = _super.call(this) || this;\n /**\n * @private\n * @type {number|string|undefined}\n */\n _this.id_ = undefined;\n /**\n * @type {string}\n * @private\n */\n _this.geometryName_ = 'geometry';\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n _this.style_ = null;\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n _this.styleFunction_ = undefined;\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n _this.geometryChangeKey_ = null;\n _this.addEventListener(getChangeEventType(_this.geometryName_), _this.handleGeometryChanged_);\n if (opt_geometryOrProperties) {\n if (typeof /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry === 'function') {\n var geometry = /** @type {Geometry} */ (opt_geometryOrProperties);\n _this.setGeometry(geometry);\n }\n else {\n /** @type {Object} */\n var properties = opt_geometryOrProperties;\n _this.setProperties(properties);\n }\n }\n return _this;\n }\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature} The clone.\n * @api\n */\n Feature.prototype.clone = function () {\n var clone = new Feature(this.getProperties());\n clone.setGeometryName(this.getGeometryName());\n var geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(geometry.clone());\n }\n var style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n };\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n Feature.prototype.getGeometry = function () {\n return (\n /** @type {Geometry|undefined} */ (this.get(this.geometryName_)));\n };\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n Feature.prototype.getId = function () {\n return this.id_;\n };\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n Feature.prototype.getGeometryName = function () {\n return this.geometryName_;\n };\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike} The feature style.\n * @api\n */\n Feature.prototype.getStyle = function () {\n return this.style_;\n };\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n Feature.prototype.getStyleFunction = function () {\n return this.styleFunction_;\n };\n /**\n * @private\n */\n Feature.prototype.handleGeometryChange_ = function () {\n this.changed();\n };\n /**\n * @private\n */\n Feature.prototype.handleGeometryChanged_ = function () {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n var geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(geometry, EventType.CHANGE, this.handleGeometryChange_, this);\n }\n this.changed();\n };\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n Feature.prototype.setGeometry = function (geometry) {\n this.set(this.geometryName_, geometry);\n };\n /**\n * Set the style for the feature. This can be a single style object, an array\n * of styles, or a function that takes a resolution and returns an array of\n * styles. If it is `null` the feature has no style (a `null` style).\n * @param {import(\"./style/Style.js\").StyleLike} style Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n Feature.prototype.setStyle = function (style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n };\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n Feature.prototype.setId = function (id) {\n this.id_ = id;\n this.changed();\n };\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n Feature.prototype.setGeometryName = function (name) {\n this.removeEventListener(getChangeEventType(this.geometryName_), this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addEventListener(getChangeEventType(this.geometryName_), this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n };\n return Feature;\n}(BaseObject));\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n else {\n /**\n * @type {Array}\n */\n var styles_1;\n if (Array.isArray(obj)) {\n styles_1 = obj;\n }\n else {\n assert(typeof /** @type {?} */ (obj).getZIndex === 'function', 41); // Expected an `import(\"./style/Style.js\").Style` or an array of `import(\"./style/Style.js\").Style`\n var style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles_1 = [style];\n }\n return function () {\n return styles_1;\n };\n }\n}\nexport default Feature;\n//# sourceMappingURL=Feature.js.map","/**\n * @module ol/extent/Corner\n */\n/**\n * Extent corner.\n * @enum {string}\n */\nexport default {\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right'\n};\n//# sourceMappingURL=Corner.js.map","/**\n * @module ol/extent/Relationship\n */\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16\n};\n//# sourceMappingURL=Relationship.js.map","/**\n * @module ol/extent\n */\nimport { assert } from './asserts.js';\nimport Corner from './extent/Corner.js';\nimport Relationship from './extent/Relationship.js';\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array} Extent\n * @api\n */\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n var extent = createEmpty();\n for (var i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n/**\n * @param {Array} xs Xs.\n * @param {Array} ys Ys.\n * @param {Extent=} opt_extent Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, opt_extent) {\n var minX = Math.min.apply(null, xs);\n var minY = Math.min.apply(null, ys);\n var maxX = Math.max.apply(null, xs);\n var maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, opt_extent);\n}\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0] - value;\n opt_extent[1] = extent[1] - value;\n opt_extent[2] = extent[2] + value;\n opt_extent[3] = extent[3] + value;\n return opt_extent;\n }\n else {\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value\n ];\n }\n}\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0];\n opt_extent[1] = extent[1];\n opt_extent[2] = extent[2];\n opt_extent[3] = extent[3];\n return opt_extent;\n }\n else {\n return extent.slice();\n }\n}\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n var dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n }\n else if (extent[2] < x) {\n dx = x - extent[2];\n }\n else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n }\n else if (extent[3] < y) {\n dy = y - extent[3];\n }\n else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] && extent2[3] <= extent1[3];\n}\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {Relationship} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n var minX = extent[0];\n var minY = extent[1];\n var maxX = extent[2];\n var maxY = extent[3];\n var x = coordinate[0];\n var y = coordinate[1];\n var relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n }\n else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n }\n else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent=} opt_extent Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = minX;\n opt_extent[1] = minY;\n opt_extent[2] = maxX;\n opt_extent[3] = maxY;\n return opt_extent;\n }\n else {\n return [minX, minY, maxX, maxY];\n }\n}\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(opt_extent) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);\n}\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, opt_extent) {\n var x = coordinate[0];\n var y = coordinate[1];\n return createOrUpdate(x, y, x, y, opt_extent);\n}\n/**\n * @param {Array} coordinates Coordinates.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, opt_extent) {\n var extent = createOrUpdateEmpty(opt_extent);\n return extendCoordinates(extent, coordinates);\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) {\n var extent = createOrUpdateEmpty(opt_extent);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n/**\n * @param {Array>} rings Rings.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, opt_extent) {\n var extent = createOrUpdateEmpty(opt_extent);\n return extendRings(extent, rings);\n}\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return extent1[0] == extent2[0] && extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] && extent1[3] == extent2[3];\n}\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n/**\n * @param {Extent} extent Extent.\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (var i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n/**\n * @param {Extent} extent Extent.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n/**\n * @param {Extent} extent Extent.\n * @param {Array>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (var i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n var val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n var area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {Corner} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n var coordinate;\n if (corner === Corner.BOTTOM_LEFT) {\n coordinate = getBottomLeft(extent);\n }\n else if (corner === Corner.BOTTOM_RIGHT) {\n coordinate = getBottomRight(extent);\n }\n else if (corner === Corner.TOP_LEFT) {\n coordinate = getTopLeft(extent);\n }\n else if (corner === Corner.TOP_RIGHT) {\n coordinate = getTopRight(extent);\n }\n else {\n assert(false, 13); // Invalid corner\n }\n return coordinate;\n}\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n var minX = Math.min(extent1[0], extent2[0]);\n var minY = Math.min(extent1[1], extent2[1]);\n var maxX = Math.max(extent1[2], extent2[2]);\n var maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent=} opt_extent Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(center, resolution, rotation, size, opt_extent) {\n var dx = resolution * size[0] / 2;\n var dy = resolution * size[1] / 2;\n var cosRotation = Math.cos(rotation);\n var sinRotation = Math.sin(rotation);\n var xCos = dx * cosRotation;\n var xSin = dx * sinRotation;\n var yCos = dy * cosRotation;\n var ySin = dy * sinRotation;\n var x = center[0];\n var y = center[1];\n var x0 = x - xCos + ySin;\n var x1 = x - xCos - ySin;\n var x2 = x + xCos - ySin;\n var x3 = x + xCos + ySin;\n var y0 = y - xSin - yCos;\n var y1 = y - xSin + yCos;\n var y2 = y + xSin + yCos;\n var y3 = y + xSin - yCos;\n return createOrUpdate(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3), opt_extent);\n}\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n var intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent=} opt_extent Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, opt_extent) {\n var intersection = opt_extent ? opt_extent : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n }\n else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n }\n else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n }\n else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n }\n else {\n intersection[3] = extent2[3];\n }\n }\n else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1];\n}\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n/**\n * @param {Extent} extent Extent.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0];\n opt_extent[1] = extent[1];\n opt_extent[2] = extent[2];\n opt_extent[3] = extent[3];\n return opt_extent;\n }\n else {\n return extent;\n }\n}\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n var intersects = false;\n var startRel = coordinateRelationship(extent, start);\n var endRel = coordinateRelationship(extent, end);\n if (startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING) {\n intersects = true;\n }\n else {\n var minX = extent[0];\n var minY = extent[1];\n var maxX = extent[2];\n var maxY = extent[3];\n var startX = start[0];\n var startY = start[1];\n var endX = end[0];\n var endY = end[1];\n var slope = (endY - startY) / (endX - startX);\n var x = void 0, y = void 0;\n if (!!(endRel & Relationship.ABOVE) &&\n !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - ((endY - maxY) / slope);\n intersects = x >= minX && x <= maxX;\n }\n if (!intersects && !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)) {\n // potentially intersects right\n y = endY - ((endX - maxX) * slope);\n intersects = y >= minY && y <= maxY;\n }\n if (!intersects && !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)) {\n // potentially intersects bottom\n x = endX - ((endY - minY) / slope);\n intersects = x >= minX && x <= maxX;\n }\n if (!intersects && !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)) {\n // potentially intersects left\n y = endY - ((endX - minX) * slope);\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent=} opt_extent Destination extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, opt_extent) {\n var coordinates = [\n extent[0], extent[1],\n extent[0], extent[3],\n extent[2], extent[1],\n extent[2], extent[3]\n ];\n transformFn(coordinates, coordinates, 2);\n var xs = [coordinates[0], coordinates[2], coordinates[4], coordinates[6]];\n var ys = [coordinates[1], coordinates[3], coordinates[5], coordinates[7]];\n return _boundingExtentXYs(xs, ys, opt_extent);\n}\n//# sourceMappingURL=extent.js.map","/**\n * @module ol/geom/GeometryLayout\n */\n/**\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available. Supported values are `'XY'`,\n * `'XYZ'`, `'XYM'`, `'XYZM'`.\n * @enum {string}\n */\nexport default {\n XY: 'XY',\n XYZ: 'XYZ',\n XYM: 'XYM',\n XYZM: 'XYZM'\n};\n//# sourceMappingURL=GeometryLayout.js.map","/**\n * @module ol/geom/GeometryType\n */\n/**\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, `'Circle'`.\n * @enum {string}\n */\nexport default {\n POINT: 'Point',\n LINE_STRING: 'LineString',\n LINEAR_RING: 'LinearRing',\n POLYGON: 'Polygon',\n MULTI_POINT: 'MultiPoint',\n MULTI_LINE_STRING: 'MultiLineString',\n MULTI_POLYGON: 'MultiPolygon',\n GEOMETRY_COLLECTION: 'GeometryCollection',\n CIRCLE: 'Circle'\n};\n//# sourceMappingURL=GeometryType.js.map","/**\n * @module ol/geom/flat/transform\n */\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function transform2D(flatCoordinates, offset, end, stride, transform, opt_dest) {\n var dest = opt_dest ? opt_dest : [];\n var i = 0;\n for (var j = offset; j < end; j += stride) {\n var x = flatCoordinates[j];\n var y = flatCoordinates[j + 1];\n dest[i++] = transform[0] * x + transform[2] * y + transform[4];\n dest[i++] = transform[1] * x + transform[3] * y + transform[5];\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} angle Angle.\n * @param {Array} anchor Rotation anchor point.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function rotate(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {\n var dest = opt_dest ? opt_dest : [];\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var anchorX = anchor[0];\n var anchorY = anchor[1];\n var i = 0;\n for (var j = offset; j < end; j += stride) {\n var deltaX = flatCoordinates[j] - anchorX;\n var deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + deltaX * cos - deltaY * sin;\n dest[i++] = anchorY + deltaX * sin + deltaY * cos;\n for (var k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n/**\n * Scale the coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} sx Scale factor in the x-direction.\n * @param {number} sy Scale factor in the y-direction.\n * @param {Array} anchor Scale anchor point.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function scale(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {\n var dest = opt_dest ? opt_dest : [];\n var anchorX = anchor[0];\n var anchorY = anchor[1];\n var i = 0;\n for (var j = offset; j < end; j += stride) {\n var deltaX = flatCoordinates[j] - anchorX;\n var deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + sx * deltaX;\n dest[i++] = anchorY + sy * deltaY;\n for (var k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function translate(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {\n var dest = opt_dest ? opt_dest : [];\n var i = 0;\n for (var j = offset; j < end; j += stride) {\n dest[i++] = flatCoordinates[j] + deltaX;\n dest[i++] = flatCoordinates[j + 1] + deltaY;\n for (var k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n//# sourceMappingURL=transform.js.map","/**\n * @module ol/math\n */\n/**\n * Takes a number and clamps it to within the provided bounds.\n * @param {number} value The input number.\n * @param {number} min The minimum value to return.\n * @param {number} max The maximum value to return.\n * @return {number} The input number if it is within bounds, or the nearest\n * number within the bounds.\n */\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n/**\n * Return the hyperbolic cosine of a given number. The method will use the\n * native `Math.cosh` function if it is available, otherwise the hyperbolic\n * cosine will be calculated via the reference implementation of the Mozilla\n * developer network.\n *\n * @param {number} x X.\n * @return {number} Hyperbolic cosine of x.\n */\nexport var cosh = (function () {\n // Wrapped in a iife, to save the overhead of checking for the native\n // implementation on every invocation.\n var cosh;\n if ('cosh' in Math) {\n // The environment supports the native Math.cosh function, use it…\n cosh = Math.cosh;\n }\n else {\n // … else, use the reference implementation of MDN:\n cosh = function (x) {\n var y = /** @type {Math} */ (Math).exp(x);\n return (y + 1 / y) / 2;\n };\n }\n return cosh;\n}());\n/**\n * Returns the square of the closest distance between the point (x, y) and the\n * line segment (x1, y1) to (x2, y2).\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredSegmentDistance(x, y, x1, y1, x2, y2) {\n var dx = x2 - x1;\n var dy = y2 - y1;\n if (dx !== 0 || dy !== 0) {\n var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x1 = x2;\n y1 = y2;\n }\n else if (t > 0) {\n x1 += dx * t;\n y1 += dy * t;\n }\n }\n return squaredDistance(x, y, x1, y1);\n}\n/**\n * Returns the square of the distance between the points (x1, y1) and (x2, y2).\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredDistance(x1, y1, x2, y2) {\n var dx = x2 - x1;\n var dy = y2 - y1;\n return dx * dx + dy * dy;\n}\n/**\n * Solves system of linear equations using Gaussian elimination method.\n *\n * @param {Array>} mat Augmented matrix (n x n + 1 column)\n * in row-major order.\n * @return {Array} The resulting vector.\n */\nexport function solveLinearSystem(mat) {\n var n = mat.length;\n for (var i = 0; i < n; i++) {\n // Find max in the i-th column (ignoring i - 1 first rows)\n var maxRow = i;\n var maxEl = Math.abs(mat[i][i]);\n for (var r = i + 1; r < n; r++) {\n var absValue = Math.abs(mat[r][i]);\n if (absValue > maxEl) {\n maxEl = absValue;\n maxRow = r;\n }\n }\n if (maxEl === 0) {\n return null; // matrix is singular\n }\n // Swap max row with i-th (current) row\n var tmp = mat[maxRow];\n mat[maxRow] = mat[i];\n mat[i] = tmp;\n // Subtract the i-th row to make all the remaining rows 0 in the i-th column\n for (var j = i + 1; j < n; j++) {\n var coef = -mat[j][i] / mat[i][i];\n for (var k = i; k < n + 1; k++) {\n if (i == k) {\n mat[j][k] = 0;\n }\n else {\n mat[j][k] += coef * mat[i][k];\n }\n }\n }\n }\n // Solve Ax=b for upper triangular matrix A (mat)\n var x = new Array(n);\n for (var l = n - 1; l >= 0; l--) {\n x[l] = mat[l][n] / mat[l][l];\n for (var m = l - 1; m >= 0; m--) {\n mat[m][n] -= mat[m][l] * x[l];\n }\n }\n return x;\n}\n/**\n * Converts radians to to degrees.\n *\n * @param {number} angleInRadians Angle in radians.\n * @return {number} Angle in degrees.\n */\nexport function toDegrees(angleInRadians) {\n return angleInRadians * 180 / Math.PI;\n}\n/**\n * Converts degrees to radians.\n *\n * @param {number} angleInDegrees Angle in degrees.\n * @return {number} Angle in radians.\n */\nexport function toRadians(angleInDegrees) {\n return angleInDegrees * Math.PI / 180;\n}\n/**\n * Returns the modulo of a / b, depending on the sign of b.\n *\n * @param {number} a Dividend.\n * @param {number} b Divisor.\n * @return {number} Modulo.\n */\nexport function modulo(a, b) {\n var r = a % b;\n return r * b < 0 ? r + b : r;\n}\n/**\n * Calculates the linearly interpolated value of x between a and b.\n *\n * @param {number} a Number\n * @param {number} b Number\n * @param {number} x Value to be interpolated.\n * @return {number} Interpolated value.\n */\nexport function lerp(a, b, x) {\n return a + x * (b - a);\n}\n//# sourceMappingURL=math.js.map","/**\n * @license\n * Latitude/longitude spherical geodesy formulae taken from\n * http://www.movable-type.co.uk/scripts/latlong.html\n * Licensed under CC-BY-3.0.\n */\n/**\n * @module ol/sphere\n */\nimport { toRadians, toDegrees } from './math.js';\nimport GeometryType from './geom/GeometryType.js';\n/**\n * Object literal with options for the {@link getLength} or {@link getArea}\n * functions.\n * @typedef {Object} SphereMetricOptions\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857']\n * Projection of the geometry. By default, the geometry is assumed to be in\n * Web Mercator.\n * @property {number} [radius=6371008.8] Sphere radius. By default, the\n * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)\n * for the WGS84 ellipsoid is used.\n */\n/**\n * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.\n * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius\n * @type {number}\n */\nexport var DEFAULT_RADIUS = 6371008.8;\n/**\n * Get the great circle distance (in meters) between two geographic coordinates.\n * @param {Array} c1 Starting coordinate.\n * @param {Array} c2 Ending coordinate.\n * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {number} The great circle distance between the points (in meters).\n * @api\n */\nexport function getDistance(c1, c2, opt_radius) {\n var radius = opt_radius || DEFAULT_RADIUS;\n var lat1 = toRadians(c1[1]);\n var lat2 = toRadians(c2[1]);\n var deltaLatBy2 = (lat2 - lat1) / 2;\n var deltaLonBy2 = toRadians(c2[0] - c1[0]) / 2;\n var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +\n Math.sin(deltaLonBy2) * Math.sin(deltaLonBy2) *\n Math.cos(lat1) * Math.cos(lat2);\n return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n}\n/**\n * Get the cumulative great circle length of linestring coordinates (geographic).\n * @param {Array} coordinates Linestring coordinates.\n * @param {number} radius The sphere radius to use.\n * @return {number} The length (in meters).\n */\nfunction getLengthInternal(coordinates, radius) {\n var length = 0;\n for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) {\n length += getDistance(coordinates[i], coordinates[i + 1], radius);\n }\n return length;\n}\n/**\n * Get the spherical length of a geometry. This length is the sum of the\n * great circle distances between coordinates. For polygons, the length is\n * the sum of all rings. For points, the length is zero. For multi-part\n * geometries, the length is the sum of the length of each part.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions=} opt_options Options for the\n * length calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical length (in meters).\n * @api\n */\nexport function getLength(geometry, opt_options) {\n var options = opt_options || {};\n var radius = options.radius || DEFAULT_RADIUS;\n var projection = options.projection || 'EPSG:3857';\n var type = geometry.getType();\n if (type !== GeometryType.GEOMETRY_COLLECTION) {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n var length = 0;\n var coordinates, coords, i, ii, j, jj;\n switch (type) {\n case GeometryType.POINT:\n case GeometryType.MULTI_POINT: {\n break;\n }\n case GeometryType.LINE_STRING:\n case GeometryType.LINEAR_RING: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n length = getLengthInternal(coordinates, radius);\n break;\n }\n case GeometryType.MULTI_LINE_STRING:\n case GeometryType.POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n length += getLengthInternal(coordinates[i], radius);\n }\n break;\n }\n case GeometryType.MULTI_POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n for (j = 0, jj = coords.length; j < jj; ++j) {\n length += getLengthInternal(coords[j], radius);\n }\n }\n break;\n }\n case GeometryType.GEOMETRY_COLLECTION: {\n var geometries = /** @type {import(\"./geom/GeometryCollection.js\").default} */ (geometry).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n length += getLength(geometries[i], opt_options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return length;\n}\n/**\n * Returns the spherical area for a list of coordinates.\n *\n * [Reference](https://trs-new.jpl.nasa.gov/handle/2014/40409)\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007\n *\n * @param {Array} coordinates List of coordinates of a linear\n * ring. If the ring is oriented clockwise, the area will be positive,\n * otherwise it will be negative.\n * @param {number} radius The sphere radius.\n * @return {number} Area (in square meters).\n */\nfunction getAreaInternal(coordinates, radius) {\n var area = 0;\n var len = coordinates.length;\n var x1 = coordinates[len - 1][0];\n var y1 = coordinates[len - 1][1];\n for (var i = 0; i < len; i++) {\n var x2 = coordinates[i][0];\n var y2 = coordinates[i][1];\n area += toRadians(x2 - x1) *\n (2 + Math.sin(toRadians(y1)) +\n Math.sin(toRadians(y2)));\n x1 = x2;\n y1 = y2;\n }\n return area * radius * radius / 2.0;\n}\n/**\n * Get the spherical area of a geometry. This is the area (in meters) assuming\n * that polygon edges are segments of great circles on a sphere.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions=} opt_options Options for the area\n * calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical area (in square meters).\n * @api\n */\nexport function getArea(geometry, opt_options) {\n var options = opt_options || {};\n var radius = options.radius || DEFAULT_RADIUS;\n var projection = options.projection || 'EPSG:3857';\n var type = geometry.getType();\n if (type !== GeometryType.GEOMETRY_COLLECTION) {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n var area = 0;\n var coordinates, coords, i, ii, j, jj;\n switch (type) {\n case GeometryType.POINT:\n case GeometryType.MULTI_POINT:\n case GeometryType.LINE_STRING:\n case GeometryType.MULTI_LINE_STRING:\n case GeometryType.LINEAR_RING: {\n break;\n }\n case GeometryType.POLYGON: {\n coordinates = /** @type {import(\"./geom/Polygon.js\").default} */ (geometry).getCoordinates();\n area = Math.abs(getAreaInternal(coordinates[0], radius));\n for (i = 1, ii = coordinates.length; i < ii; ++i) {\n area -= Math.abs(getAreaInternal(coordinates[i], radius));\n }\n break;\n }\n case GeometryType.MULTI_POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n area += Math.abs(getAreaInternal(coords[0], radius));\n for (j = 1, jj = coords.length; j < jj; ++j) {\n area -= Math.abs(getAreaInternal(coords[j], radius));\n }\n }\n break;\n }\n case GeometryType.GEOMETRY_COLLECTION: {\n var geometries = /** @type {import(\"./geom/GeometryCollection.js\").default} */ (geometry).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n area += getArea(geometries[i], opt_options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return area;\n}\n/**\n * Returns the coordinate at the given distance and bearing from `c1`.\n *\n * @param {import(\"./coordinate.js\").Coordinate} c1 The origin point (`[lon, lat]` in degrees).\n * @param {number} distance The great-circle distance between the origin\n * point and the target point.\n * @param {number} bearing The bearing (in radians).\n * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {import(\"./coordinate.js\").Coordinate} The target point.\n */\nexport function offset(c1, distance, bearing, opt_radius) {\n var radius = opt_radius || DEFAULT_RADIUS;\n var lat1 = toRadians(c1[1]);\n var lon1 = toRadians(c1[0]);\n var dByR = distance / radius;\n var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) +\n Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing));\n var lon = lon1 + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));\n return [toDegrees(lon), toDegrees(lat)];\n}\n//# sourceMappingURL=sphere.js.map","/**\n * @module ol/proj/Units\n */\n/**\n * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or\n * `'us-ft'`.\n * @enum {string}\n */\nvar Units = {\n DEGREES: 'degrees',\n FEET: 'ft',\n METERS: 'm',\n PIXELS: 'pixels',\n TILE_PIXELS: 'tile-pixels',\n USFEET: 'us-ft'\n};\n/**\n * Meters per unit lookup table.\n * @const\n * @type {Object}\n * @api\n */\nexport var METERS_PER_UNIT = {};\n// use the radius of the Normal sphere\nMETERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;\nMETERS_PER_UNIT[Units.FEET] = 0.3048;\nMETERS_PER_UNIT[Units.METERS] = 1;\nMETERS_PER_UNIT[Units.USFEET] = 1200 / 3937;\nexport default Units;\n//# sourceMappingURL=Units.js.map","/**\n * @module ol/proj/Projection\n */\nimport { METERS_PER_UNIT } from './Units.js';\n/**\n * @typedef {Object} Options\n * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.\n * @property {import(\"./Units.js\").default|string} [units] Units. Required unless a\n * proj4 projection is defined for `code`.\n * @property {import(\"../extent.js\").Extent} [extent] The validity extent for the SRS.\n * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.\n * @property {boolean} [global=false] Whether the projection is valid for the whole globe.\n * @property {number} [metersPerUnit] The meters per unit for the SRS.\n * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}\n * lookup table.\n * @property {import(\"../extent.js\").Extent} [worldExtent] The world extent for the SRS.\n * @property {function(number, import(\"../coordinate.js\").Coordinate):number} [getPointResolution]\n * Function to determine resolution at a point. The function is called with a\n * `{number}` view resolution and an `{import(\"../coordinate.js\").Coordinate}` as arguments, and returns\n * the `{number}` resolution in projection units at the passed coordinate. If this is `undefined`,\n * the default {@link module:ol/proj#getPointResolution} function will be used.\n */\n/**\n * @classdesc\n * Projection definition class. One of these is created for each projection\n * supported in the application and stored in the {@link module:ol/proj} namespace.\n * You can use these in applications, but this is not required, as API params\n * and options use {@link module:ol/proj~ProjectionLike} which means the simple string\n * code will suffice.\n *\n * You can use {@link module:ol/proj~get} to retrieve the object for a particular\n * projection.\n *\n * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together\n * with the following aliases:\n * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326,\n * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84,\n * http://www.opengis.net/gml/srs/epsg.xml#4326,\n * urn:x-ogc:def:crs:EPSG:4326\n * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913,\n * urn:ogc:def:crs:EPSG:6.18:3:3857,\n * http://www.opengis.net/gml/srs/epsg.xml#3857\n *\n * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can\n * be added using `proj4.defs()`. After all required projection definitions are\n * added, call the {@link module:ol/proj/proj4~register} function.\n *\n * @api\n */\nvar Projection = /** @class */ (function () {\n /**\n * @param {Options} options Projection options.\n */\n function Projection(options) {\n /**\n * @private\n * @type {string}\n */\n this.code_ = options.code;\n /**\n * Units of projected coordinates. When set to `TILE_PIXELS`, a\n * `this.extent_` and `this.worldExtent_` must be configured properly for each\n * tile.\n * @private\n * @type {import(\"./Units.js\").default}\n */\n this.units_ = /** @type {import(\"./Units.js\").default} */ (options.units);\n /**\n * Validity extent of the projection in projected coordinates. For projections\n * with `TILE_PIXELS` units, this is the extent of the tile in\n * tile pixel space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = options.extent !== undefined ? options.extent : null;\n /**\n * Extent of the world in EPSG:4326. For projections with\n * `TILE_PIXELS` units, this is the extent of the tile in\n * projected coordinate space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.worldExtent_ = options.worldExtent !== undefined ?\n options.worldExtent : null;\n /**\n * @private\n * @type {string}\n */\n this.axisOrientation_ = options.axisOrientation !== undefined ?\n options.axisOrientation : 'enu';\n /**\n * @private\n * @type {boolean}\n */\n this.global_ = options.global !== undefined ? options.global : false;\n /**\n * @private\n * @type {boolean}\n */\n this.canWrapX_ = !!(this.global_ && this.extent_);\n /**\n * @private\n * @type {function(number, import(\"../coordinate.js\").Coordinate):number|undefined}\n */\n this.getPointResolutionFunc_ = options.getPointResolution;\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.defaultTileGrid_ = null;\n /**\n * @private\n * @type {number|undefined}\n */\n this.metersPerUnit_ = options.metersPerUnit;\n }\n /**\n * @return {boolean} The projection is suitable for wrapping the x-axis\n */\n Projection.prototype.canWrapX = function () {\n return this.canWrapX_;\n };\n /**\n * Get the code for this projection, e.g. 'EPSG:4326'.\n * @return {string} Code.\n * @api\n */\n Projection.prototype.getCode = function () {\n return this.code_;\n };\n /**\n * Get the validity extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n Projection.prototype.getExtent = function () {\n return this.extent_;\n };\n /**\n * Get the units of this projection.\n * @return {import(\"./Units.js\").default} Units.\n * @api\n */\n Projection.prototype.getUnits = function () {\n return this.units_;\n };\n /**\n * Get the amount of meters per unit of this projection. If the projection is\n * not configured with `metersPerUnit` or a units identifier, the return is\n * `undefined`.\n * @return {number|undefined} Meters.\n * @api\n */\n Projection.prototype.getMetersPerUnit = function () {\n return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];\n };\n /**\n * Get the world extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n Projection.prototype.getWorldExtent = function () {\n return this.worldExtent_;\n };\n /**\n * Get the axis orientation of this projection.\n * Example values are:\n * enu - the default easting, northing, elevation.\n * neu - northing, easting, up - useful for \"lat/long\" geographic coordinates,\n * or south orientated transverse mercator.\n * wnu - westing, northing, up - some planetary coordinate systems have\n * \"west positive\" coordinate systems\n * @return {string} Axis orientation.\n * @api\n */\n Projection.prototype.getAxisOrientation = function () {\n return this.axisOrientation_;\n };\n /**\n * Is this projection a global projection which spans the whole world?\n * @return {boolean} Whether the projection is global.\n * @api\n */\n Projection.prototype.isGlobal = function () {\n return this.global_;\n };\n /**\n * Set if the projection is a global projection which spans the whole world\n * @param {boolean} global Whether the projection is global.\n * @api\n */\n Projection.prototype.setGlobal = function (global) {\n this.global_ = global;\n this.canWrapX_ = !!(global && this.extent_);\n };\n /**\n * @return {import(\"../tilegrid/TileGrid.js\").default} The default tile grid.\n */\n Projection.prototype.getDefaultTileGrid = function () {\n return this.defaultTileGrid_;\n };\n /**\n * @param {import(\"../tilegrid/TileGrid.js\").default} tileGrid The default tile grid.\n */\n Projection.prototype.setDefaultTileGrid = function (tileGrid) {\n this.defaultTileGrid_ = tileGrid;\n };\n /**\n * Set the validity extent for this projection.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n Projection.prototype.setExtent = function (extent) {\n this.extent_ = extent;\n this.canWrapX_ = !!(this.global_ && extent);\n };\n /**\n * Set the world extent for this projection.\n * @param {import(\"../extent.js\").Extent} worldExtent World extent\n * [minlon, minlat, maxlon, maxlat].\n * @api\n */\n Projection.prototype.setWorldExtent = function (worldExtent) {\n this.worldExtent_ = worldExtent;\n };\n /**\n * Set the getPointResolution function (see {@link module:ol/proj~getPointResolution}\n * for this projection.\n * @param {function(number, import(\"../coordinate.js\").Coordinate):number} func Function\n * @api\n */\n Projection.prototype.setGetPointResolution = function (func) {\n this.getPointResolutionFunc_ = func;\n };\n /**\n * Get the custom point resolution function for this projection (if set).\n * @return {function(number, import(\"../coordinate.js\").Coordinate):number|undefined} The custom point\n * resolution function (if set).\n */\n Projection.prototype.getPointResolutionFunc = function () {\n return this.getPointResolutionFunc_;\n };\n return Projection;\n}());\nexport default Projection;\n//# sourceMappingURL=Projection.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/proj/epsg3857\n */\nimport { cosh } from '../math.js';\nimport Projection from './Projection.js';\nimport Units from './Units.js';\n/**\n * Radius of WGS84 sphere\n *\n * @const\n * @type {number}\n */\nexport var RADIUS = 6378137;\n/**\n * @const\n * @type {number}\n */\nexport var HALF_SIZE = Math.PI * RADIUS;\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport var EXTENT = [\n -HALF_SIZE, -HALF_SIZE,\n HALF_SIZE, HALF_SIZE\n];\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport var WORLD_EXTENT = [-180, -85, 180, 85];\n/**\n * @classdesc\n * Projection object for web/spherical Mercator (EPSG:3857).\n */\nvar EPSG3857Projection = /** @class */ (function (_super) {\n __extends(EPSG3857Projection, _super);\n /**\n * @param {string} code Code.\n */\n function EPSG3857Projection(code) {\n return _super.call(this, {\n code: code,\n units: Units.METERS,\n extent: EXTENT,\n global: true,\n worldExtent: WORLD_EXTENT,\n getPointResolution: function (resolution, point) {\n return resolution / cosh(point[1] / RADIUS);\n }\n }) || this;\n }\n return EPSG3857Projection;\n}(Projection));\n/**\n * Projections equal to EPSG:3857.\n *\n * @const\n * @type {Array}\n */\nexport var PROJECTIONS = [\n new EPSG3857Projection('EPSG:3857'),\n new EPSG3857Projection('EPSG:102100'),\n new EPSG3857Projection('EPSG:102113'),\n new EPSG3857Projection('EPSG:900913'),\n new EPSG3857Projection('urn:ogc:def:crs:EPSG:6.18:3:3857'),\n new EPSG3857Projection('urn:ogc:def:crs:EPSG::3857'),\n new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857')\n];\n/**\n * Transformation from EPSG:4326 to EPSG:3857.\n *\n * @param {Array} input Input array of coordinate values.\n * @param {Array=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension (default is `2`).\n * @return {Array} Output array of coordinate values.\n */\nexport function fromEPSG4326(input, opt_output, opt_dimension) {\n var length = input.length;\n var dimension = opt_dimension > 1 ? opt_dimension : 2;\n var output = opt_output;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n }\n else {\n output = new Array(length);\n }\n }\n var halfSize = HALF_SIZE;\n for (var i = 0; i < length; i += dimension) {\n output[i] = halfSize * input[i] / 180;\n var y = RADIUS *\n Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360));\n if (y > halfSize) {\n y = halfSize;\n }\n else if (y < -halfSize) {\n y = -halfSize;\n }\n output[i + 1] = y;\n }\n return output;\n}\n/**\n * Transformation from EPSG:3857 to EPSG:4326.\n *\n * @param {Array} input Input array of coordinate values.\n * @param {Array=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension (default is `2`).\n * @return {Array} Output array of coordinate values.\n */\nexport function toEPSG4326(input, opt_output, opt_dimension) {\n var length = input.length;\n var dimension = opt_dimension > 1 ? opt_dimension : 2;\n var output = opt_output;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n }\n else {\n output = new Array(length);\n }\n }\n for (var i = 0; i < length; i += dimension) {\n output[i] = 180 * input[i] / HALF_SIZE;\n output[i + 1] = 360 * Math.atan(Math.exp(input[i + 1] / RADIUS)) / Math.PI - 90;\n }\n return output;\n}\n//# sourceMappingURL=epsg3857.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/proj/epsg4326\n */\nimport Projection from './Projection.js';\nimport Units from './Units.js';\n/**\n * Semi-major radius of the WGS84 ellipsoid.\n *\n * @const\n * @type {number}\n */\nexport var RADIUS = 6378137;\n/**\n * Extent of the EPSG:4326 projection which is the whole world.\n *\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport var EXTENT = [-180, -90, 180, 90];\n/**\n * @const\n * @type {number}\n */\nexport var METERS_PER_UNIT = Math.PI * RADIUS / 180;\n/**\n * @classdesc\n * Projection object for WGS84 geographic coordinates (EPSG:4326).\n *\n * Note that OpenLayers does not strictly comply with the EPSG definition.\n * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).\n * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.\n */\nvar EPSG4326Projection = /** @class */ (function (_super) {\n __extends(EPSG4326Projection, _super);\n /**\n * @param {string} code Code.\n * @param {string=} opt_axisOrientation Axis orientation.\n */\n function EPSG4326Projection(code, opt_axisOrientation) {\n return _super.call(this, {\n code: code,\n units: Units.DEGREES,\n extent: EXTENT,\n axisOrientation: opt_axisOrientation,\n global: true,\n metersPerUnit: METERS_PER_UNIT,\n worldExtent: EXTENT\n }) || this;\n }\n return EPSG4326Projection;\n}(Projection));\n/**\n * Projections equal to EPSG:4326.\n *\n * @const\n * @type {Array}\n */\nexport var PROJECTIONS = [\n new EPSG4326Projection('CRS:84'),\n new EPSG4326Projection('EPSG:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),\n new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),\n new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu')\n];\n//# sourceMappingURL=epsg4326.js.map","/**\n * @module ol/proj/transforms\n */\nimport { isEmpty } from '../obj.js';\n/**\n * @private\n * @type {!Object>}\n */\nvar transforms = {};\n/**\n * Clear the transform cache.\n */\nexport function clear() {\n transforms = {};\n}\n/**\n * Registers a conversion function to convert coordinates from the source\n * projection to the destination projection.\n *\n * @param {import(\"./Projection.js\").default} source Source.\n * @param {import(\"./Projection.js\").default} destination Destination.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform.\n */\nexport function add(source, destination, transformFn) {\n var sourceCode = source.getCode();\n var destinationCode = destination.getCode();\n if (!(sourceCode in transforms)) {\n transforms[sourceCode] = {};\n }\n transforms[sourceCode][destinationCode] = transformFn;\n}\n/**\n * Unregisters the conversion function to convert coordinates from the source\n * projection to the destination projection. This method is used to clean up\n * cached transforms during testing.\n *\n * @param {import(\"./Projection.js\").default} source Source projection.\n * @param {import(\"./Projection.js\").default} destination Destination projection.\n * @return {import(\"../proj.js\").TransformFunction} transformFn The unregistered transform.\n */\nexport function remove(source, destination) {\n var sourceCode = source.getCode();\n var destinationCode = destination.getCode();\n var transform = transforms[sourceCode][destinationCode];\n delete transforms[sourceCode][destinationCode];\n if (isEmpty(transforms[sourceCode])) {\n delete transforms[sourceCode];\n }\n return transform;\n}\n/**\n * Get a transform given a source code and a destination code.\n * @param {string} sourceCode The code for the source projection.\n * @param {string} destinationCode The code for the destination projection.\n * @return {import(\"../proj.js\").TransformFunction|undefined} The transform function (if found).\n */\nexport function get(sourceCode, destinationCode) {\n var transform;\n if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {\n transform = transforms[sourceCode][destinationCode];\n }\n return transform;\n}\n//# sourceMappingURL=transforms.js.map","/**\n * @module ol/proj/projections\n */\n/**\n * @type {Object}\n */\nvar cache = {};\n/**\n * Clear the projections cache.\n */\nexport function clear() {\n cache = {};\n}\n/**\n * Get a cached projection by code.\n * @param {string} code The code for the projection.\n * @return {import(\"./Projection.js\").default} The projection (if cached).\n */\nexport function get(code) {\n return cache[code] || null;\n}\n/**\n * Add a projection to the cache.\n * @param {string} code The projection code.\n * @param {import(\"./Projection.js\").default} projection The projection to cache.\n */\nexport function add(code, projection) {\n cache[code] = projection;\n}\n//# sourceMappingURL=projections.js.map","/**\n * @module ol/proj\n */\n/**\n * The ol/proj module stores:\n * * a list of {@link module:ol/proj/Projection}\n * objects, one for each projection supported by the application\n * * a list of transform functions needed to convert coordinates in one projection\n * into another.\n *\n * The static functions are the methods used to maintain these.\n * Each transform function can handle not only simple coordinate pairs, but also\n * large arrays of coordinates such as vector geometries.\n *\n * When loaded, the library adds projection objects for EPSG:4326 (WGS84\n * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used\n * for example by Bing Maps or OpenStreetMap), together with the relevant\n * transform functions.\n *\n * Additional transforms may be added by using the http://proj4js.org/\n * library (version 2.2 or later). You can use the full build supplied by\n * Proj4js, or create a custom build to support those projections you need; see\n * the Proj4js website for how to do this. You also need the Proj4js definitions\n * for the required projections. These definitions can be obtained from\n * https://epsg.io/, and are a JS function, so can be loaded in a script\n * tag (as in the examples) or pasted into your application.\n *\n * After all required projection definitions are added to proj4's registry (by\n * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`\n * package. Existing transforms are not changed by this function. See\n * examples/wms-image-custom-proj for an example of this.\n *\n * Additional projection definitions can be registered with `proj4.defs()` any\n * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't\n * know in advance what projections are needed, you can initially load minimal\n * support and then load whichever are requested.\n *\n * Note that Proj4js does not support projection extents. If you want to add\n * one for creating default tile grids, you can add it after the Projection\n * object has been created with `setExtent`, for example,\n * `get('EPSG:1234').setExtent(extent)`.\n *\n * In addition to Proj4js support, any transform functions can be added with\n * {@link module:ol/proj~addCoordinateTransforms}. To use this, you must first create\n * a {@link module:ol/proj/Projection} object for the new projection and add it with\n * {@link module:ol/proj~addProjection}. You can then add the forward and inverse\n * functions with {@link module:ol/proj~addCoordinateTransforms}. See\n * examples/wms-custom-proj for an example of this.\n *\n * Note that if no transforms are needed and you only need to define the\n * projection, just add a {@link module:ol/proj/Projection} with\n * {@link module:ol/proj~addProjection}. See examples/wms-no-proj for an example of\n * this.\n */\nimport { getDistance } from './sphere.js';\nimport { applyTransform } from './extent.js';\nimport { modulo } from './math.js';\nimport { toEPSG4326, fromEPSG4326, PROJECTIONS as EPSG3857_PROJECTIONS } from './proj/epsg3857.js';\nimport { PROJECTIONS as EPSG4326_PROJECTIONS } from './proj/epsg4326.js';\nimport Projection from './proj/Projection.js';\nimport Units, { METERS_PER_UNIT } from './proj/Units.js';\nimport { add as addTransformFunc, clear as clearTransformFuncs, get as getTransformFunc } from './proj/transforms.js';\nimport { add as addProj, clear as clearProj, get as getProj } from './proj/projections.js';\n/**\n * A projection as {@link module:ol/proj/Projection}, SRS identifier\n * string or undefined.\n * @typedef {Projection|string|undefined} ProjectionLike\n * @api\n */\n/**\n * A transform function accepts an array of input coordinate values, an optional\n * output array, and an optional dimension (default should be 2). The function\n * transforms the input coordinate values, populates the output array, and\n * returns the output array.\n *\n * @typedef {function(Array, Array=, number=): Array} TransformFunction\n * @api\n */\nexport { METERS_PER_UNIT };\nexport { Projection };\n/**\n * @param {Array} input Input coordinate array.\n * @param {Array=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension.\n * @return {Array} Output coordinate array (new array, same coordinate\n * values).\n */\nexport function cloneTransform(input, opt_output, opt_dimension) {\n var output;\n if (opt_output !== undefined) {\n for (var i = 0, ii = input.length; i < ii; ++i) {\n opt_output[i] = input[i];\n }\n output = opt_output;\n }\n else {\n output = input.slice();\n }\n return output;\n}\n/**\n * @param {Array} input Input coordinate array.\n * @param {Array=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension.\n * @return {Array} Input coordinate array (same array as input).\n */\nexport function identityTransform(input, opt_output, opt_dimension) {\n if (opt_output !== undefined && input !== opt_output) {\n for (var i = 0, ii = input.length; i < ii; ++i) {\n opt_output[i] = input[i];\n }\n input = opt_output;\n }\n return input;\n}\n/**\n * Add a Projection object to the list of supported projections that can be\n * looked up by their code.\n *\n * @param {Projection} projection Projection instance.\n * @api\n */\nexport function addProjection(projection) {\n addProj(projection.getCode(), projection);\n addTransformFunc(projection, projection, cloneTransform);\n}\n/**\n * @param {Array} projections Projections.\n */\nexport function addProjections(projections) {\n projections.forEach(addProjection);\n}\n/**\n * Fetches a Projection object for the code specified.\n *\n * @param {ProjectionLike} projectionLike Either a code string which is\n * a combination of authority and identifier such as \"EPSG:4326\", or an\n * existing projection object, or undefined.\n * @return {Projection} Projection object, or null if not in list.\n * @api\n */\nexport function get(projectionLike) {\n return typeof projectionLike === 'string' ?\n getProj(/** @type {string} */ (projectionLike)) :\n ( /** @type {Projection} */(projectionLike) || null);\n}\n/**\n * Get the resolution of the point in degrees or distance units.\n * For projections with degrees as the unit this will simply return the\n * provided resolution. For other projections the point resolution is\n * by default estimated by transforming the 'point' pixel to EPSG:4326,\n * measuring its width and height on the normal sphere,\n * and taking the average of the width and height.\n * A custom function can be provided for a specific projection, either\n * by setting the `getPointResolution` option in the\n * {@link module:ol/proj/Projection~Projection} constructor or by using\n * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing\n * projection object.\n * @param {ProjectionLike} projection The projection.\n * @param {number} resolution Nominal resolution in projection units.\n * @param {import(\"./coordinate.js\").Coordinate} point Point to find adjusted resolution at.\n * @param {Units=} opt_units Units to get the point resolution in.\n * Default is the projection's units.\n * @return {number} Point resolution.\n * @api\n */\nexport function getPointResolution(projection, resolution, point, opt_units) {\n projection = get(projection);\n var pointResolution;\n var getter = projection.getPointResolutionFunc();\n if (getter) {\n pointResolution = getter(resolution, point);\n if (opt_units && opt_units !== projection.getUnits()) {\n var metersPerUnit = projection.getMetersPerUnit();\n if (metersPerUnit) {\n pointResolution = pointResolution * metersPerUnit / METERS_PER_UNIT[opt_units];\n }\n }\n }\n else {\n var units = projection.getUnits();\n if (units == Units.DEGREES && !opt_units || opt_units == Units.DEGREES) {\n pointResolution = resolution;\n }\n else {\n // Estimate point resolution by transforming the center pixel to EPSG:4326,\n // measuring its width and height on the normal sphere, and taking the\n // average of the width and height.\n var toEPSG4326_1 = getTransformFromProjections(projection, get('EPSG:4326'));\n var vertices = [\n point[0] - resolution / 2, point[1],\n point[0] + resolution / 2, point[1],\n point[0], point[1] - resolution / 2,\n point[0], point[1] + resolution / 2\n ];\n vertices = toEPSG4326_1(vertices, vertices, 2);\n var width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));\n var height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));\n pointResolution = (width + height) / 2;\n var metersPerUnit = opt_units ?\n METERS_PER_UNIT[opt_units] :\n projection.getMetersPerUnit();\n if (metersPerUnit !== undefined) {\n pointResolution /= metersPerUnit;\n }\n }\n }\n return pointResolution;\n}\n/**\n * Registers transformation functions that don't alter coordinates. Those allow\n * to transform between projections with equal meaning.\n *\n * @param {Array} projections Projections.\n * @api\n */\nexport function addEquivalentProjections(projections) {\n addProjections(projections);\n projections.forEach(function (source) {\n projections.forEach(function (destination) {\n if (source !== destination) {\n addTransformFunc(source, destination, cloneTransform);\n }\n });\n });\n}\n/**\n * Registers transformation functions to convert coordinates in any projection\n * in projection1 to any projection in projection2.\n *\n * @param {Array} projections1 Projections with equal\n * meaning.\n * @param {Array} projections2 Projections with equal\n * meaning.\n * @param {TransformFunction} forwardTransform Transformation from any\n * projection in projection1 to any projection in projection2.\n * @param {TransformFunction} inverseTransform Transform from any projection\n * in projection2 to any projection in projection1..\n */\nexport function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {\n projections1.forEach(function (projection1) {\n projections2.forEach(function (projection2) {\n addTransformFunc(projection1, projection2, forwardTransform);\n addTransformFunc(projection2, projection1, inverseTransform);\n });\n });\n}\n/**\n * Clear all cached projections and transforms.\n */\nexport function clearAllProjections() {\n clearProj();\n clearTransformFuncs();\n}\n/**\n * @param {Projection|string|undefined} projection Projection.\n * @param {string} defaultCode Default code.\n * @return {Projection} Projection.\n */\nexport function createProjection(projection, defaultCode) {\n if (!projection) {\n return get(defaultCode);\n }\n else if (typeof projection === 'string') {\n return get(projection);\n }\n else {\n return (\n /** @type {Projection} */ (projection));\n }\n}\n/**\n * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform\n * function.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} coordTransform Coordinate\n * transform.\n * @return {TransformFunction} Transform function.\n */\nexport function createTransformFromCoordinateTransform(coordTransform) {\n return (\n /**\n * @param {Array} input Input.\n * @param {Array=} opt_output Output.\n * @param {number=} opt_dimension Dimension.\n * @return {Array} Output.\n */\n function (input, opt_output, opt_dimension) {\n var length = input.length;\n var dimension = opt_dimension !== undefined ? opt_dimension : 2;\n var output = opt_output !== undefined ? opt_output : new Array(length);\n for (var i = 0; i < length; i += dimension) {\n var point = coordTransform([input[i], input[i + 1]]);\n output[i] = point[0];\n output[i + 1] = point[1];\n for (var j = dimension - 1; j >= 2; --j) {\n output[i + j] = input[i + j];\n }\n }\n return output;\n });\n}\n/**\n * Registers coordinate transform functions to convert coordinates between the\n * source projection and the destination projection.\n * The forward and inverse functions convert coordinate pairs; this function\n * converts these into the functions used internally which also handle\n * extents and coordinate arrays.\n *\n * @param {ProjectionLike} source Source projection.\n * @param {ProjectionLike} destination Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} forward The forward transform\n * function (that is, from the source projection to the destination\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} inverse The inverse transform\n * function (that is, from the destination projection to the source\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @api\n */\nexport function addCoordinateTransforms(source, destination, forward, inverse) {\n var sourceProj = get(source);\n var destProj = get(destination);\n addTransformFunc(sourceProj, destProj, createTransformFromCoordinateTransform(forward));\n addTransformFunc(destProj, sourceProj, createTransformFromCoordinateTransform(inverse));\n}\n/**\n * Transforms a coordinate from longitude/latitude to a different projection.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate as longitude and latitude, i.e.\n * an array with longitude as 1st and latitude as 2nd element.\n * @param {ProjectionLike=} opt_projection Target projection. The\n * default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate projected to the target projection.\n * @api\n */\nexport function fromLonLat(coordinate, opt_projection) {\n return transform(coordinate, 'EPSG:4326', opt_projection !== undefined ? opt_projection : 'EPSG:3857');\n}\n/**\n * Transforms a coordinate to longitude/latitude.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Projected coordinate.\n * @param {ProjectionLike=} opt_projection Projection of the coordinate.\n * The default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate as longitude and latitude, i.e. an array\n * with longitude as 1st and latitude as 2nd element.\n * @api\n */\nexport function toLonLat(coordinate, opt_projection) {\n var lonLat = transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326');\n var lon = lonLat[0];\n if (lon < -180 || lon > 180) {\n lonLat[0] = modulo(lon + 180, 360) - 180;\n }\n return lonLat;\n}\n/**\n * Checks if two projections are the same, that is every coordinate in one\n * projection does represent the same geographic point as the same coordinate in\n * the other projection.\n *\n * @param {Projection} projection1 Projection 1.\n * @param {Projection} projection2 Projection 2.\n * @return {boolean} Equivalent.\n * @api\n */\nexport function equivalent(projection1, projection2) {\n if (projection1 === projection2) {\n return true;\n }\n var equalUnits = projection1.getUnits() === projection2.getUnits();\n if (projection1.getCode() === projection2.getCode()) {\n return equalUnits;\n }\n else {\n var transformFunc = getTransformFromProjections(projection1, projection2);\n return transformFunc === cloneTransform && equalUnits;\n }\n}\n/**\n * Searches in the list of transform functions for the function for converting\n * coordinates from the source projection to the destination projection.\n *\n * @param {Projection} sourceProjection Source Projection object.\n * @param {Projection} destinationProjection Destination Projection\n * object.\n * @return {TransformFunction} Transform function.\n */\nexport function getTransformFromProjections(sourceProjection, destinationProjection) {\n var sourceCode = sourceProjection.getCode();\n var destinationCode = destinationProjection.getCode();\n var transformFunc = getTransformFunc(sourceCode, destinationCode);\n if (!transformFunc) {\n transformFunc = identityTransform;\n }\n return transformFunc;\n}\n/**\n * Given the projection-like objects, searches for a transformation\n * function to convert a coordinates array from the source projection to the\n * destination projection.\n *\n * @param {ProjectionLike} source Source.\n * @param {ProjectionLike} destination Destination.\n * @return {TransformFunction} Transform function.\n * @api\n */\nexport function getTransform(source, destination) {\n var sourceProjection = get(source);\n var destinationProjection = get(destination);\n return getTransformFromProjections(sourceProjection, destinationProjection);\n}\n/**\n * Transforms a coordinate from source projection to destination projection.\n * This returns a new coordinate (and does not modify the original).\n *\n * See {@link module:ol/proj~transformExtent} for extent transformation.\n * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its\n * subclasses for geometry transforms.\n *\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\nexport function transform(coordinate, source, destination) {\n var transformFunc = getTransform(source, destination);\n return transformFunc(coordinate, undefined, coordinate.length);\n}\n/**\n * Transforms an extent from source projection to destination projection. This\n * returns a new extent (and does not modify the original).\n *\n * @param {import(\"./extent.js\").Extent} extent The extent to transform.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @return {import(\"./extent.js\").Extent} The transformed extent.\n * @api\n */\nexport function transformExtent(extent, source, destination) {\n var transformFunc = getTransform(source, destination);\n return applyTransform(extent, transformFunc);\n}\n/**\n * Transforms the given point to the destination projection.\n *\n * @param {import(\"./coordinate.js\").Coordinate} point Point.\n * @param {Projection} sourceProjection Source projection.\n * @param {Projection} destinationProjection Destination projection.\n * @return {import(\"./coordinate.js\").Coordinate} Point.\n */\nexport function transformWithProjections(point, sourceProjection, destinationProjection) {\n var transformFunc = getTransformFromProjections(sourceProjection, destinationProjection);\n return transformFunc(point);\n}\n/**\n * @type {?Projection}\n */\nvar userProjection = null;\n/**\n * Set the projection for coordinates supplied from and returned by API methods.\n * Note that this method is not yet a part of the stable API. Support for user\n * projections is not yet complete and should be considered experimental.\n * @param {ProjectionLike} projection The user projection.\n */\nexport function setUserProjection(projection) {\n userProjection = get(projection);\n}\n/**\n * Clear the user projection if set. Note that this method is not yet a part of\n * the stable API. Support for user projections is not yet complete and should\n * be considered experimental.\n */\nexport function clearUserProjection() {\n userProjection = null;\n}\n/**\n * Get the projection for coordinates supplied from and returned by API methods.\n * Note that this method is not yet a part of the stable API. Support for user\n * projections is not yet complete and should be considered experimental.\n * @returns {?Projection} The user projection (or null if not set).\n */\nexport function getUserProjection() {\n return userProjection;\n}\n/**\n * Use geographic coordinates (WGS-84 datum) in API methods. Note that this\n * method is not yet a part of the stable API. Support for user projections is\n * not yet complete and should be considered experimental.\n */\nexport function useGeographic() {\n setUserProjection('EPSG:4326');\n}\n/**\n * Return a coordinate transformed into the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array} coordinate Input coordinate.\n * @param {ProjectionLike} sourceProjection The input coordinate projection.\n * @returns {Array} The input coordinate in the user projection.\n */\nexport function toUserCoordinate(coordinate, sourceProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, sourceProjection, userProjection);\n}\n/**\n * Return a coordinate transformed from the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array} coordinate Input coordinate.\n * @param {ProjectionLike} destProjection The destination projection.\n * @returns {Array} The input coordinate transformed.\n */\nexport function fromUserCoordinate(coordinate, destProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, userProjection, destProjection);\n}\n/**\n * Return an extent transformed into the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} sourceProjection The input extent projection.\n * @returns {import(\"./extent.js\").Extent} The input extent in the user projection.\n */\nexport function toUserExtent(extent, sourceProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, sourceProjection, userProjection);\n}\n/**\n * Return an extent transformed from the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} destProjection The destination projection.\n * @returns {import(\"./extent.js\").Extent} The input extent transformed.\n */\nexport function fromUserExtent(extent, destProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, userProjection, destProjection);\n}\n/**\n * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called\n * by when this module is executed and should only need to be called again after\n * `clearAllProjections()` is called (e.g. in tests).\n */\nexport function addCommon() {\n // Add transformations that don't alter coordinates to convert within set of\n // projections with equal meaning.\n addEquivalentProjections(EPSG3857_PROJECTIONS);\n addEquivalentProjections(EPSG4326_PROJECTIONS);\n // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like\n // coordinates and back.\n addEquivalentTransforms(EPSG4326_PROJECTIONS, EPSG3857_PROJECTIONS, fromEPSG4326, toEPSG4326);\n}\naddCommon();\n//# sourceMappingURL=proj.js.map","/**\n * @module ol/transform\n */\nimport { assert } from './asserts.js';\n/**\n * An array representing an affine 2d transformation for use with\n * {@link module:ol/transform} functions. The array has 6 elements.\n * @typedef {!Array} Transform\n */\n/**\n * Collection of affine 2d transformation functions. The functions work on an\n * array of 6 elements. The element order is compatible with the [SVGMatrix\n * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is\n * a subset (elements a to f) of a 3×3 matrix:\n * ```\n * [ a c e ]\n * [ b d f ]\n * [ 0 0 1 ]\n * ```\n */\n/**\n * @private\n * @type {Transform}\n */\nvar tmp_ = new Array(6);\n/**\n * Create an identity transform.\n * @return {!Transform} Identity transform.\n */\nexport function create() {\n return [1, 0, 0, 1, 0, 0];\n}\n/**\n * Resets the given transform to an identity transform.\n * @param {!Transform} transform Transform.\n * @return {!Transform} Transform.\n */\nexport function reset(transform) {\n return set(transform, 1, 0, 0, 1, 0, 0);\n}\n/**\n * Multiply the underlying matrices of two transforms and return the result in\n * the first transform.\n * @param {!Transform} transform1 Transform parameters of matrix 1.\n * @param {!Transform} transform2 Transform parameters of matrix 2.\n * @return {!Transform} transform1 multiplied with transform2.\n */\nexport function multiply(transform1, transform2) {\n var a1 = transform1[0];\n var b1 = transform1[1];\n var c1 = transform1[2];\n var d1 = transform1[3];\n var e1 = transform1[4];\n var f1 = transform1[5];\n var a2 = transform2[0];\n var b2 = transform2[1];\n var c2 = transform2[2];\n var d2 = transform2[3];\n var e2 = transform2[4];\n var f2 = transform2[5];\n transform1[0] = a1 * a2 + c1 * b2;\n transform1[1] = b1 * a2 + d1 * b2;\n transform1[2] = a1 * c2 + c1 * d2;\n transform1[3] = b1 * c2 + d1 * d2;\n transform1[4] = a1 * e2 + c1 * f2 + e1;\n transform1[5] = b1 * e2 + d1 * f2 + f1;\n return transform1;\n}\n/**\n * Set the transform components a-f on a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} a The a component of the transform.\n * @param {number} b The b component of the transform.\n * @param {number} c The c component of the transform.\n * @param {number} d The d component of the transform.\n * @param {number} e The e component of the transform.\n * @param {number} f The f component of the transform.\n * @return {!Transform} Matrix with transform applied.\n */\nexport function set(transform, a, b, c, d, e, f) {\n transform[0] = a;\n transform[1] = b;\n transform[2] = c;\n transform[3] = d;\n transform[4] = e;\n transform[5] = f;\n return transform;\n}\n/**\n * Set transform on one matrix from another matrix.\n * @param {!Transform} transform1 Matrix to set transform to.\n * @param {!Transform} transform2 Matrix to set transform from.\n * @return {!Transform} transform1 with transform from transform2 applied.\n */\nexport function setFromArray(transform1, transform2) {\n transform1[0] = transform2[0];\n transform1[1] = transform2[1];\n transform1[2] = transform2[2];\n transform1[3] = transform2[3];\n transform1[4] = transform2[4];\n transform1[5] = transform2[5];\n return transform1;\n}\n/**\n * Transforms the given coordinate with the given transform returning the\n * resulting, transformed coordinate. The coordinate will be modified in-place.\n *\n * @param {Transform} transform The transformation.\n * @param {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} coordinate The coordinate to transform.\n * @return {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} return coordinate so that operations can be\n * chained together.\n */\nexport function apply(transform, coordinate) {\n var x = coordinate[0];\n var y = coordinate[1];\n coordinate[0] = transform[0] * x + transform[2] * y + transform[4];\n coordinate[1] = transform[1] * x + transform[3] * y + transform[5];\n return coordinate;\n}\n/**\n * Applies rotation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} angle Angle in radians.\n * @return {!Transform} The rotated transform.\n */\nexport function rotate(transform, angle) {\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));\n}\n/**\n * Applies scale to a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scaled transform.\n */\nexport function scale(transform, x, y) {\n return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));\n}\n/**\n * Creates a scale transform.\n * @param {!Transform} target Transform to overwrite.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scale transform.\n */\nexport function makeScale(target, x, y) {\n return set(target, x, 0, 0, y, 0, 0);\n}\n/**\n * Applies translation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} dx Translation x.\n * @param {number} dy Translation y.\n * @return {!Transform} The translated transform.\n */\nexport function translate(transform, dx, dy) {\n return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));\n}\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative).\n * @param {!Transform} transform The transform (will be modified in place).\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {!Transform} The composite transform.\n */\nexport function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {\n var sin = Math.sin(angle);\n var cos = Math.cos(angle);\n transform[0] = sx * cos;\n transform[1] = sy * sin;\n transform[2] = -sx * sin;\n transform[3] = sy * cos;\n transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;\n transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;\n return transform;\n}\n/**\n * Invert the given transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (source) transform.\n */\nexport function invert(source) {\n return makeInverse(source, source);\n}\n/**\n * Invert the given transform.\n * @param {!Transform} target Transform to be set as the inverse of\n * the source transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (target) transform.\n */\nexport function makeInverse(target, source) {\n var det = determinant(source);\n assert(det !== 0, 32); // Transformation matrix cannot be inverted\n var a = source[0];\n var b = source[1];\n var c = source[2];\n var d = source[3];\n var e = source[4];\n var f = source[5];\n target[0] = d / det;\n target[1] = -b / det;\n target[2] = -c / det;\n target[3] = a / det;\n target[4] = (c * f - d * e) / det;\n target[5] = -(a * f - b * e) / det;\n return target;\n}\n/**\n * Returns the determinant of the given matrix.\n * @param {!Transform} mat Matrix.\n * @return {number} Determinant.\n */\nexport function determinant(mat) {\n return mat[0] * mat[3] - mat[1] * mat[2];\n}\n/**\n * A string version of the transform. This can be used\n * for CSS transforms.\n * @param {!Transform} mat Matrix.\n * @return {string} The transform as a string.\n */\nexport function toString(mat) {\n return 'matrix(' + mat.join(', ') + ')';\n}\n//# sourceMappingURL=transform.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/geom/Geometry\n */\nimport { abstract } from '../util.js';\nimport BaseObject from '../Object.js';\nimport { createEmpty, getHeight, returnOrUpdate } from '../extent.js';\nimport { transform2D } from './flat/transform.js';\nimport { get as getProjection, getTransform } from '../proj.js';\nimport Units from '../proj/Units.js';\nimport { create as createTransform, compose as composeTransform } from '../transform.js';\nimport { memoizeOne } from '../functions.js';\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nvar tmpTransform = createTransform();\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for vector geometries.\n *\n * To get notified of changes to the geometry, register a listener for the\n * generic `change` event on your geometry instance.\n *\n * @abstract\n * @api\n */\nvar Geometry = /** @class */ (function (_super) {\n __extends(Geometry, _super);\n function Geometry() {\n var _this = _super.call(this) || this;\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n _this.extent_ = createEmpty();\n /**\n * @private\n * @type {number}\n */\n _this.extentRevision_ = -1;\n /**\n * @protected\n * @type {number}\n */\n _this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n /**\n * @protected\n * @type {number}\n */\n _this.simplifiedGeometryRevision = 0;\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} revision The geometry revision.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n _this.simplifyTransformedInternal = memoizeOne(function (revision, squaredTolerance, opt_transform) {\n if (!opt_transform) {\n return this.getSimplifiedGeometry(squaredTolerance);\n }\n var clone = this.clone();\n clone.applyTransform(opt_transform);\n return clone.getSimplifiedGeometry(squaredTolerance);\n });\n return _this;\n }\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n Geometry.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) {\n return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform);\n };\n /**\n * Make a complete copy of the geometry.\n * @abstract\n * @return {!Geometry} Clone.\n */\n Geometry.prototype.clone = function () {\n return abstract();\n };\n /**\n * @abstract\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n Geometry.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {\n return abstract();\n };\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n Geometry.prototype.containsXY = function (x, y) {\n var coord = this.getClosestPoint([x, y]);\n return coord[0] === x && coord[1] === y;\n };\n /**\n * Return the closest point of the geometry to the passed point as\n * {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} point Point.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_closestPoint Closest point.\n * @return {import(\"../coordinate.js\").Coordinate} Closest point.\n * @api\n */\n Geometry.prototype.getClosestPoint = function (point, opt_closestPoint) {\n var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];\n this.closestPointXY(point[0], point[1], closestPoint, Infinity);\n return closestPoint;\n };\n /**\n * Returns true if this geometry includes the specified coordinate. If the\n * coordinate is on the boundary of the geometry, returns false.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains coordinate.\n * @api\n */\n Geometry.prototype.intersectsCoordinate = function (coordinate) {\n return this.containsXY(coordinate[0], coordinate[1]);\n };\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n Geometry.prototype.computeExtent = function (extent) {\n return abstract();\n };\n /**\n * Get the extent of the geometry.\n * @param {import(\"../extent.js\").Extent=} opt_extent Extent.\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n Geometry.prototype.getExtent = function (opt_extent) {\n if (this.extentRevision_ != this.getRevision()) {\n this.extent_ = this.computeExtent(this.extent_);\n this.extentRevision_ = this.getRevision();\n }\n return returnOrUpdate(this.extent_, opt_extent);\n };\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n Geometry.prototype.rotate = function (angle, anchor) {\n abstract();\n };\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number=} opt_sy The scaling factor in the y-direction (defaults to\n * sx).\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n Geometry.prototype.scale = function (sx, opt_sy, opt_anchor) {\n abstract();\n };\n /**\n * Create a simplified version of this geometry. For linestrings, this uses\n * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)\n * algorithm. For polygons, a quantization-based\n * simplification is used to preserve topology.\n * @param {number} tolerance The tolerance distance for simplification.\n * @return {Geometry} A new, simplified version of the original geometry.\n * @api\n */\n Geometry.prototype.simplify = function (tolerance) {\n return this.getSimplifiedGeometry(tolerance * tolerance);\n };\n /**\n * Create a simplified version of this geometry using the Douglas Peucker\n * algorithm.\n * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Geometry} Simplified geometry.\n */\n Geometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {\n return abstract();\n };\n /**\n * Get the type of this geometry.\n * @abstract\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n */\n Geometry.prototype.getType = function () {\n return abstract();\n };\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @abstract\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n */\n Geometry.prototype.applyTransform = function (transformFn) {\n abstract();\n };\n /**\n * Test if the geometry and the passed extent intersect.\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n */\n Geometry.prototype.intersectsExtent = function (extent) {\n return abstract();\n };\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @abstract\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n Geometry.prototype.translate = function (deltaX, deltaY) {\n abstract();\n };\n /**\n * Transform each coordinate of the geometry from one coordinate reference\n * system to another. The geometry is modified in place.\n * For example, a line will be transformed to a line and a circle to a circle.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {Geometry} This geometry. Note that original geometry is\n * modified in place.\n * @api\n */\n Geometry.prototype.transform = function (source, destination) {\n /** @type {import(\"../proj/Projection.js\").default} */\n var sourceProj = getProjection(source);\n var transformFn = sourceProj.getUnits() == Units.TILE_PIXELS ?\n function (inCoordinates, outCoordinates, stride) {\n var pixelExtent = sourceProj.getExtent();\n var projectedExtent = sourceProj.getWorldExtent();\n var scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0);\n transform2D(inCoordinates, 0, inCoordinates.length, stride, tmpTransform, outCoordinates);\n return getTransform(sourceProj, destination)(inCoordinates, outCoordinates, stride);\n } :\n getTransform(sourceProj, destination);\n this.applyTransform(transformFn);\n return this;\n };\n return Geometry;\n}(BaseObject));\nexport default Geometry;\n//# sourceMappingURL=Geometry.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/geom/SimpleGeometry\n */\nimport { abstract } from '../util.js';\nimport { createOrUpdateFromFlatCoordinates, getCenter } from '../extent.js';\nimport Geometry from './Geometry.js';\nimport GeometryLayout from './GeometryLayout.js';\nimport { rotate, scale, translate, transform2D } from './flat/transform.js';\n/**\n * @classdesc\n * Abstract base class; only used for creating subclasses; do not instantiate\n * in apps, as cannot be rendered.\n *\n * @abstract\n * @api\n */\nvar SimpleGeometry = /** @class */ (function (_super) {\n __extends(SimpleGeometry, _super);\n function SimpleGeometry() {\n var _this = _super.call(this) || this;\n /**\n * @protected\n * @type {GeometryLayout}\n */\n _this.layout = GeometryLayout.XY;\n /**\n * @protected\n * @type {number}\n */\n _this.stride = 2;\n /**\n * @protected\n * @type {Array}\n */\n _this.flatCoordinates = null;\n return _this;\n }\n /**\n * @inheritDoc\n */\n SimpleGeometry.prototype.computeExtent = function (extent) {\n return createOrUpdateFromFlatCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent);\n };\n /**\n * @abstract\n * @return {Array<*>} Coordinates.\n */\n SimpleGeometry.prototype.getCoordinates = function () {\n return abstract();\n };\n /**\n * Return the first coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} First coordinate.\n * @api\n */\n SimpleGeometry.prototype.getFirstCoordinate = function () {\n return this.flatCoordinates.slice(0, this.stride);\n };\n /**\n * @return {Array} Flat coordinates.\n */\n SimpleGeometry.prototype.getFlatCoordinates = function () {\n return this.flatCoordinates;\n };\n /**\n * Return the last coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} Last point.\n * @api\n */\n SimpleGeometry.prototype.getLastCoordinate = function () {\n return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);\n };\n /**\n * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry.\n * @return {GeometryLayout} Layout.\n * @api\n */\n SimpleGeometry.prototype.getLayout = function () {\n return this.layout;\n };\n /**\n * @inheritDoc\n */\n SimpleGeometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n // If squaredTolerance is negative or if we know that simplification will not\n // have any effect then just return this.\n if (squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)) {\n return this;\n }\n var simplifiedGeometry = this.getSimplifiedGeometryInternal(squaredTolerance);\n var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();\n if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {\n return simplifiedGeometry;\n }\n else {\n // Simplification did not actually remove any coordinates. We now know\n // that any calls to getSimplifiedGeometry with a squaredTolerance less\n // than or equal to the current squaredTolerance will also not have any\n // effect. This allows us to short circuit simplification (saving CPU\n // cycles) and prevents the cache of simplified geometries from filling\n // up with useless identical copies of this geometry (saving memory).\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n };\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @protected\n */\n SimpleGeometry.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {\n return this;\n };\n /**\n * @return {number} Stride.\n */\n SimpleGeometry.prototype.getStride = function () {\n return this.stride;\n };\n /**\n * @param {GeometryLayout} layout Layout.\n * @param {Array} flatCoordinates Flat coordinates.\n */\n SimpleGeometry.prototype.setFlatCoordinates = function (layout, flatCoordinates) {\n this.stride = getStrideForLayout(layout);\n this.layout = layout;\n this.flatCoordinates = flatCoordinates;\n };\n /**\n * @abstract\n * @param {!Array<*>} coordinates Coordinates.\n * @param {GeometryLayout=} opt_layout Layout.\n */\n SimpleGeometry.prototype.setCoordinates = function (coordinates, opt_layout) {\n abstract();\n };\n /**\n * @param {GeometryLayout|undefined} layout Layout.\n * @param {Array<*>} coordinates Coordinates.\n * @param {number} nesting Nesting.\n * @protected\n */\n SimpleGeometry.prototype.setLayout = function (layout, coordinates, nesting) {\n /** @type {number} */\n var stride;\n if (layout) {\n stride = getStrideForLayout(layout);\n }\n else {\n for (var i = 0; i < nesting; ++i) {\n if (coordinates.length === 0) {\n this.layout = GeometryLayout.XY;\n this.stride = 2;\n return;\n }\n else {\n coordinates = /** @type {Array} */ (coordinates[0]);\n }\n }\n stride = coordinates.length;\n layout = getLayoutForStride(stride);\n }\n this.layout = layout;\n this.stride = stride;\n };\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n */\n SimpleGeometry.prototype.applyTransform = function (transformFn) {\n if (this.flatCoordinates) {\n transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);\n this.changed();\n }\n };\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n SimpleGeometry.prototype.rotate = function (angle, anchor) {\n var flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n var stride = this.getStride();\n rotate(flatCoordinates, 0, flatCoordinates.length, stride, angle, anchor, flatCoordinates);\n this.changed();\n }\n };\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number=} opt_sy The scaling factor in the y-direction (defaults to\n * sx).\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n SimpleGeometry.prototype.scale = function (sx, opt_sy, opt_anchor) {\n var sy = opt_sy;\n if (sy === undefined) {\n sy = sx;\n }\n var anchor = opt_anchor;\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n var flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n var stride = this.getStride();\n scale(flatCoordinates, 0, flatCoordinates.length, stride, sx, sy, anchor, flatCoordinates);\n this.changed();\n }\n };\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n SimpleGeometry.prototype.translate = function (deltaX, deltaY) {\n var flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n var stride = this.getStride();\n translate(flatCoordinates, 0, flatCoordinates.length, stride, deltaX, deltaY, flatCoordinates);\n this.changed();\n }\n };\n return SimpleGeometry;\n}(Geometry));\n/**\n * @param {number} stride Stride.\n * @return {GeometryLayout} layout Layout.\n */\nfunction getLayoutForStride(stride) {\n var layout;\n if (stride == 2) {\n layout = GeometryLayout.XY;\n }\n else if (stride == 3) {\n layout = GeometryLayout.XYZ;\n }\n else if (stride == 4) {\n layout = GeometryLayout.XYZM;\n }\n return (\n /** @type {GeometryLayout} */ (layout));\n}\n/**\n * @param {GeometryLayout} layout Layout.\n * @return {number} Stride.\n */\nexport function getStrideForLayout(layout) {\n var stride;\n if (layout == GeometryLayout.XY) {\n stride = 2;\n }\n else if (layout == GeometryLayout.XYZ || layout == GeometryLayout.XYM) {\n stride = 3;\n }\n else if (layout == GeometryLayout.XYZM) {\n stride = 4;\n }\n return /** @type {number} */ (stride);\n}\n/**\n * @param {SimpleGeometry} simpleGeometry Simple geometry.\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Transformed flat coordinates.\n */\nexport function transformGeom2D(simpleGeometry, transform, opt_dest) {\n var flatCoordinates = simpleGeometry.getFlatCoordinates();\n if (!flatCoordinates) {\n return null;\n }\n else {\n var stride = simpleGeometry.getStride();\n return transform2D(flatCoordinates, 0, flatCoordinates.length, stride, transform, opt_dest);\n }\n}\nexport default SimpleGeometry;\n//# sourceMappingURL=SimpleGeometry.js.map","/**\n * @module ol/geom/flat/area\n */\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRing(flatCoordinates, offset, end, stride) {\n var twiceArea = 0;\n var x1 = flatCoordinates[end - stride];\n var y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n var x2 = flatCoordinates[offset];\n var y2 = flatCoordinates[offset + 1];\n twiceArea += y1 * x2 - x1 * y2;\n x1 = x2;\n y1 = y2;\n }\n return twiceArea / 2;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRings(flatCoordinates, offset, ends, stride) {\n var area = 0;\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n area += linearRing(flatCoordinates, offset, end, stride);\n offset = end;\n }\n return area;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n var area = 0;\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n area += linearRings(flatCoordinates, offset, ends, stride);\n offset = ends[ends.length - 1];\n }\n return area;\n}\n//# sourceMappingURL=area.js.map","/**\n * @module ol/geom/flat/closest\n */\nimport { lerp, squaredDistance as squaredDx } from '../../math.js';\n/**\n * Returns the point on the 2D line segment flatCoordinates[offset1] to\n * flatCoordinates[offset2] that is closest to the point (x, y). Extra\n * dimensions are linearly interpolated.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset1 Offset 1.\n * @param {number} offset2 Offset 2.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n */\nfunction assignClosest(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {\n var x1 = flatCoordinates[offset1];\n var y1 = flatCoordinates[offset1 + 1];\n var dx = flatCoordinates[offset2] - x1;\n var dy = flatCoordinates[offset2 + 1] - y1;\n var offset;\n if (dx === 0 && dy === 0) {\n offset = offset1;\n }\n else {\n var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n offset = offset2;\n }\n else if (t > 0) {\n for (var i = 0; i < stride; ++i) {\n closestPoint[i] = lerp(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t);\n }\n closestPoint.length = stride;\n return;\n }\n else {\n offset = offset1;\n }\n }\n for (var i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n}\n/**\n * Return the squared of the largest distance between any pair of consecutive\n * coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {\n var x1 = flatCoordinates[offset];\n var y1 = flatCoordinates[offset + 1];\n for (offset += stride; offset < end; offset += stride) {\n var x2 = flatCoordinates[offset];\n var y2 = flatCoordinates[offset + 1];\n var squaredDelta = squaredDx(x1, y1, x2, y2);\n if (squaredDelta > max) {\n max = squaredDelta;\n }\n x1 = x2;\n y1 = y2;\n }\n return max;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max) {\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);\n offset = end;\n }\n return max;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function multiArrayMaxSquaredDelta(flatCoordinates, offset, endss, stride, max) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);\n offset = ends[ends.length - 1];\n }\n return max;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {\n if (offset == end) {\n return minSquaredDistance;\n }\n var i, squaredDistance;\n if (maxDelta === 0) {\n // All points are identical, so just test the first point.\n squaredDistance = squaredDx(x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);\n if (squaredDistance < minSquaredDistance) {\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n else {\n return minSquaredDistance;\n }\n }\n var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n var index = offset + stride;\n while (index < end) {\n assignClosest(flatCoordinates, index - stride, index, stride, x, y, tmpPoint);\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n index += stride;\n }\n else {\n // Skip ahead multiple points, because we know that all the skipped\n // points cannot be any closer than the closest point we have found so\n // far. We know this because we know how close the current point is, how\n // close the closest point we have found so far is, and the maximum\n // distance between consecutive points. For example, if we're currently\n // at distance 10, the best we've found so far is 3, and that the maximum\n // distance between consecutive points is 2, then we'll need to skip at\n // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of\n // finding a closer point. We use Math.max(..., 1) to ensure that we\n // always advance at least one point, to avoid an infinite loop.\n index += stride * Math.max(((Math.sqrt(squaredDistance) -\n Math.sqrt(minSquaredDistance)) / maxDelta) | 0, 1);\n }\n }\n if (isRing) {\n // Check the closing segment.\n assignClosest(flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {\n var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n minSquaredDistance = assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);\n offset = end;\n }\n return minSquaredDistance;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestMultiArrayPoint(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {\n var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n minSquaredDistance = assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);\n offset = ends[ends.length - 1];\n }\n return minSquaredDistance;\n}\n//# sourceMappingURL=closest.js.map","/**\n * @module ol/geom/flat/deflate\n */\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {\n for (var i = 0, ii = coordinate.length; i < ii; ++i) {\n flatCoordinates[offset++] = coordinate[i];\n }\n return offset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} coordinates Coordinates.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinates(flatCoordinates, offset, coordinates, stride) {\n for (var i = 0, ii = coordinates.length; i < ii; ++i) {\n var coordinate = coordinates[i];\n for (var j = 0; j < stride; ++j) {\n flatCoordinates[offset++] = coordinate[j];\n }\n }\n return offset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} coordinatess Coordinatess.\n * @param {number} stride Stride.\n * @param {Array=} opt_ends Ends.\n * @return {Array} Ends.\n */\nexport function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, stride, opt_ends) {\n var ends = opt_ends ? opt_ends : [];\n var i = 0;\n for (var j = 0, jj = coordinatess.length; j < jj; ++j) {\n var end = deflateCoordinates(flatCoordinates, offset, coordinatess[j], stride);\n ends[i++] = end;\n offset = end;\n }\n ends.length = i;\n return ends;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>>} coordinatesss Coordinatesss.\n * @param {number} stride Stride.\n * @param {Array>=} opt_endss Endss.\n * @return {Array>} Endss.\n */\nexport function deflateMultiCoordinatesArray(flatCoordinates, offset, coordinatesss, stride, opt_endss) {\n var endss = opt_endss ? opt_endss : [];\n var i = 0;\n for (var j = 0, jj = coordinatesss.length; j < jj; ++j) {\n var ends = deflateCoordinatesArray(flatCoordinates, offset, coordinatesss[j], stride, endss[i]);\n endss[i++] = ends;\n offset = ends[ends.length - 1];\n }\n endss.length = i;\n return endss;\n}\n//# sourceMappingURL=deflate.js.map","/**\n * @module ol/geom/flat/inflate\n */\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array=} opt_coordinates Coordinates.\n * @return {Array} Coordinates.\n */\nexport function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) {\n var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];\n var i = 0;\n for (var j = offset; j < end; j += stride) {\n coordinates[i++] = flatCoordinates.slice(j, j + stride);\n }\n coordinates.length = i;\n return coordinates;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array>=} opt_coordinatess Coordinatess.\n * @return {Array>} Coordinatess.\n */\nexport function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) {\n var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];\n var i = 0;\n for (var j = 0, jj = ends.length; j < jj; ++j) {\n var end = ends[j];\n coordinatess[i++] = inflateCoordinates(flatCoordinates, offset, end, stride, coordinatess[i]);\n offset = end;\n }\n coordinatess.length = i;\n return coordinatess;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array>>=} opt_coordinatesss\n * Coordinatesss.\n * @return {Array>>} Coordinatesss.\n */\nexport function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) {\n var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];\n var i = 0;\n for (var j = 0, jj = endss.length; j < jj; ++j) {\n var ends = endss[j];\n coordinatesss[i++] = inflateCoordinatesArray(flatCoordinates, offset, ends, stride, coordinatesss[i]);\n offset = ends[ends.length - 1];\n }\n coordinatesss.length = i;\n return coordinatesss;\n}\n//# sourceMappingURL=inflate.js.map","/**\n * @module ol/geom/flat/simplify\n */\n// Based on simplify-js https://github.com/mourner/simplify-js\n// Copyright (c) 2012, Vladimir Agafonkin\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\nimport { squaredSegmentDistance, squaredDistance } from '../../math.js';\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {boolean} highQuality Highest quality.\n * @param {Array=} opt_simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @return {Array} Simplified line string.\n */\nexport function simplifyLineString(flatCoordinates, offset, end, stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {\n var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?\n opt_simplifiedFlatCoordinates : [];\n if (!highQuality) {\n end = radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);\n flatCoordinates = simplifiedFlatCoordinates;\n offset = 0;\n stride = 2;\n }\n simplifiedFlatCoordinates.length = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);\n return simplifiedFlatCoordinates;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {\n var n = (end - offset) / stride;\n if (n < 3) {\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n /** @type {Array} */\n var markers = new Array(n);\n markers[0] = 1;\n markers[n - 1] = 1;\n /** @type {Array} */\n var stack = [offset, end - stride];\n var index = 0;\n while (stack.length > 0) {\n var last = stack.pop();\n var first = stack.pop();\n var maxSquaredDistance = 0;\n var x1 = flatCoordinates[first];\n var y1 = flatCoordinates[first + 1];\n var x2 = flatCoordinates[last];\n var y2 = flatCoordinates[last + 1];\n for (var i = first + stride; i < last; i += stride) {\n var x = flatCoordinates[i];\n var y = flatCoordinates[i + 1];\n var squaredDistance_1 = squaredSegmentDistance(x, y, x1, y1, x2, y2);\n if (squaredDistance_1 > maxSquaredDistance) {\n index = i;\n maxSquaredDistance = squaredDistance_1;\n }\n }\n if (maxSquaredDistance > squaredTolerance) {\n markers[(index - offset) / stride] = 1;\n if (first + stride < index) {\n stack.push(first, index);\n }\n if (index + stride < last) {\n stack.push(index, last);\n }\n }\n }\n for (var i = 0; i < n; ++i) {\n if (markers[i]) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride + 1];\n }\n }\n return simplifiedOffset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n simplifiedOffset = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset);\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerMultiArray(flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n var simplifiedEnds = [];\n simplifiedOffset = douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {\n if (end <= offset + stride) {\n // zero or one point, no simplification possible, so copy and return\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n var x1 = flatCoordinates[offset];\n var y1 = flatCoordinates[offset + 1];\n // copy first point\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n var x2 = x1;\n var y2 = y1;\n for (offset += stride; offset < end; offset += stride) {\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {\n // copy point at offset\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n }\n }\n if (x2 != x1 || y2 != y1) {\n // copy last point\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n }\n return simplifiedOffset;\n}\n/**\n * @param {number} value Value.\n * @param {number} tolerance Tolerance.\n * @return {number} Rounded value.\n */\nexport function snap(value, tolerance) {\n return tolerance * Math.round(value / tolerance);\n}\n/**\n * Simplifies a line string using an algorithm designed by Tim Schaub.\n * Coordinates are snapped to the nearest value in a virtual grid and\n * consecutive duplicate coordinates are discarded. This effectively preserves\n * topology as the simplification of any subsection of a line string is\n * independent of the rest of the line string. This means that, for examples,\n * the common edge between two polygons will be simplified to the same line\n * string independently in both polygons. This implementation uses a single\n * pass over the coordinates and eliminates intermediate collinear points.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset) {\n // do nothing if the line is empty\n if (offset == end) {\n return simplifiedOffset;\n }\n // snap the first coordinate (P1)\n var x1 = snap(flatCoordinates[offset], tolerance);\n var y1 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // add the first coordinate to the output\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n // find the next coordinate that does not snap to the same value as the first\n // coordinate (P2)\n var x2, y2;\n do {\n x2 = snap(flatCoordinates[offset], tolerance);\n y2 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n if (offset == end) {\n // all coordinates snap to the same value, the line collapses to a point\n // push the last snapped value anyway to ensure that the output contains\n // at least two points\n // FIXME should we really return at least two points anyway?\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n }\n } while (x2 == x1 && y2 == y1);\n while (offset < end) {\n // snap the next coordinate (P3)\n var x3 = snap(flatCoordinates[offset], tolerance);\n var y3 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // skip P3 if it is equal to P2\n if (x3 == x2 && y3 == y2) {\n continue;\n }\n // calculate the delta between P1 and P2\n var dx1 = x2 - x1;\n var dy1 = y2 - y1;\n // calculate the delta between P3 and P1\n var dx2 = x3 - x1;\n var dy2 = y3 - y1;\n // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from\n // P1 in the same direction then P2 is on the straight line between P1 and\n // P3\n if ((dx1 * dy2 == dy1 * dx2) &&\n ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&\n ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) {\n // discard P2 and set P2 = P3\n x2 = x3;\n y2 = y3;\n continue;\n }\n // either P1, P2, and P3 are not colinear, or they are colinear but P3 is\n // between P3 and P1 or on the opposite half of the line to P2. add P2,\n // and continue with P1 = P2 and P2 = P3\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n x2 = x3;\n y2 = y3;\n }\n // add the last point (P2)\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n simplifiedOffset = quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset);\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function quantizeMultiArray(flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n var simplifiedEnds = [];\n simplifiedOffset = quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n//# sourceMappingURL=simplify.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/geom/LinearRing\n */\nimport { closestSquaredDistanceXY } from '../extent.js';\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport { linearRing as linearRingArea } from './flat/area.js';\nimport { assignClosestPoint, maxSquaredDelta } from './flat/closest.js';\nimport { deflateCoordinates } from './flat/deflate.js';\nimport { inflateCoordinates } from './flat/inflate.js';\nimport { douglasPeucker } from './flat/simplify.js';\n/**\n * @classdesc\n * Linear ring geometry. Only used as part of polygon; cannot be rendered\n * on its own.\n *\n * @api\n */\nvar LinearRing = /** @class */ (function (_super) {\n __extends(LinearRing, _super);\n /**\n * @param {Array|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `opt_layout` are also accepted.\n * @param {GeometryLayout=} opt_layout Layout.\n */\n function LinearRing(coordinates, opt_layout) {\n var _this = _super.call(this) || this;\n /**\n * @private\n * @type {number}\n */\n _this.maxDelta_ = -1;\n /**\n * @private\n * @type {number}\n */\n _this.maxDeltaRevision_ = -1;\n if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {\n _this.setFlatCoordinates(opt_layout, /** @type {Array} */ (coordinates));\n }\n else {\n _this.setCoordinates(/** @type {Array} */ (coordinates), opt_layout);\n }\n return _this;\n }\n /**\n * Make a complete copy of the geometry.\n * @return {!LinearRing} Clone.\n * @override\n * @api\n */\n LinearRing.prototype.clone = function () {\n return new LinearRing(this.flatCoordinates.slice(), this.layout);\n };\n /**\n * @inheritDoc\n */\n LinearRing.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(maxSquaredDelta(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);\n };\n /**\n * Return the area of the linear ring on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n LinearRing.prototype.getArea = function () {\n return linearRingArea(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);\n };\n /**\n * Return the coordinates of the linear ring.\n * @return {Array} Coordinates.\n * @override\n * @api\n */\n LinearRing.prototype.getCoordinates = function () {\n return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);\n };\n /**\n * @inheritDoc\n */\n LinearRing.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {\n var simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0);\n return new LinearRing(simplifiedFlatCoordinates, GeometryLayout.XY);\n };\n /**\n * @inheritDoc\n * @api\n */\n LinearRing.prototype.getType = function () {\n return GeometryType.LINEAR_RING;\n };\n /**\n * @inheritDoc\n */\n LinearRing.prototype.intersectsExtent = function (extent) {\n return false;\n };\n /**\n * Set the coordinates of the linear ring.\n * @param {!Array} coordinates Coordinates.\n * @param {GeometryLayout=} opt_layout Layout.\n * @override\n * @api\n */\n LinearRing.prototype.setCoordinates = function (coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride);\n this.changed();\n };\n return LinearRing;\n}(SimpleGeometry));\nexport default LinearRing;\n//# sourceMappingURL=LinearRing.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/geom/Point\n */\nimport { createOrUpdateFromCoordinate, containsXY } from '../extent.js';\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport { deflateCoordinate } from './flat/deflate.js';\nimport { squaredDistance as squaredDx } from '../math.js';\n/**\n * @classdesc\n * Point geometry.\n *\n * @api\n */\nvar Point = /** @class */ (function (_super) {\n __extends(Point, _super);\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n function Point(coordinates, opt_layout) {\n var _this = _super.call(this) || this;\n _this.setCoordinates(coordinates, opt_layout);\n return _this;\n }\n /**\n * Make a complete copy of the geometry.\n * @return {!Point} Clone.\n * @override\n * @api\n */\n Point.prototype.clone = function () {\n var point = new Point(this.flatCoordinates.slice(), this.layout);\n return point;\n };\n /**\n * @inheritDoc\n */\n Point.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {\n var flatCoordinates = this.flatCoordinates;\n var squaredDistance = squaredDx(x, y, flatCoordinates[0], flatCoordinates[1]);\n if (squaredDistance < minSquaredDistance) {\n var stride = this.stride;\n for (var i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n else {\n return minSquaredDistance;\n }\n };\n /**\n * Return the coordinate of the point.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinates.\n * @override\n * @api\n */\n Point.prototype.getCoordinates = function () {\n return !this.flatCoordinates ? [] : this.flatCoordinates.slice();\n };\n /**\n * @inheritDoc\n */\n Point.prototype.computeExtent = function (extent) {\n return createOrUpdateFromCoordinate(this.flatCoordinates, extent);\n };\n /**\n * @inheritDoc\n * @api\n */\n Point.prototype.getType = function () {\n return GeometryType.POINT;\n };\n /**\n * @inheritDoc\n * @api\n */\n Point.prototype.intersectsExtent = function (extent) {\n return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);\n };\n /**\n * @inheritDoc\n * @api\n */\n Point.prototype.setCoordinates = function (coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinate(this.flatCoordinates, 0, coordinates, this.stride);\n this.changed();\n };\n return Point;\n}(SimpleGeometry));\nexport default Point;\n//# sourceMappingURL=Point.js.map","/**\n * @module ol/geom/flat/contains\n */\nimport { forEachCorner } from '../../extent.js';\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} Contains extent.\n */\nexport function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) {\n var outside = forEachCorner(extent, \n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains (x, y).\n */\n function (coordinate) {\n return !linearRingContainsXY(flatCoordinates, offset, end, stride, coordinate[0], coordinate[1]);\n });\n return !outside;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingContainsXY(flatCoordinates, offset, end, stride, x, y) {\n // http://geomalgorithms.com/a03-_inclusion.html\n // Copyright 2000 softSurfer, 2012 Dan Sunday\n // This code may be freely used and modified for any purpose\n // providing that this copyright notice is included with it.\n // SoftSurfer makes no warranty for this code, and cannot be held\n // liable for any real or imagined damage resulting from its use.\n // Users of this code must verify correctness for their application.\n var wn = 0;\n var x1 = flatCoordinates[end - stride];\n var y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n var x2 = flatCoordinates[offset];\n var y2 = flatCoordinates[offset + 1];\n if (y1 <= y) {\n if (y2 > y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) > 0) {\n wn++;\n }\n }\n else if (y2 <= y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) < 0) {\n wn--;\n }\n x1 = x2;\n y1 = y2;\n }\n return wn !== 0;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y) {\n if (ends.length === 0) {\n return false;\n }\n if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {\n return false;\n }\n for (var i = 1, ii = ends.length; i < ii; ++i) {\n if (linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)) {\n return false;\n }\n }\n return true;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingssContainsXY(flatCoordinates, offset, endss, stride, x, y) {\n if (endss.length === 0) {\n return false;\n }\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n//# sourceMappingURL=contains.js.map","/**\n * @module ol/geom/flat/interiorpoint\n */\nimport { numberSafeCompareFunction } from '../../array.js';\nimport { linearRingsContainsXY } from './contains.js';\n/**\n * Calculates a point that is likely to lie in the interior of the linear rings.\n * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @param {number} flatCentersOffset Flat center offset.\n * @param {Array=} opt_dest Destination.\n * @return {Array} Destination point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, flatCentersOffset, opt_dest) {\n var i, ii, x, x1, x2, y1, y2;\n var y = flatCenters[flatCentersOffset + 1];\n /** @type {Array} */\n var intersections = [];\n // Calculate intersections with the horizontal line\n for (var r = 0, rr = ends.length; r < rr; ++r) {\n var end = ends[r];\n x1 = flatCoordinates[end - stride];\n y1 = flatCoordinates[end - stride + 1];\n for (i = offset; i < end; i += stride) {\n x2 = flatCoordinates[i];\n y2 = flatCoordinates[i + 1];\n if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {\n x = (y - y1) / (y2 - y1) * (x2 - x1) + x1;\n intersections.push(x);\n }\n x1 = x2;\n y1 = y2;\n }\n }\n // Find the longest segment of the horizontal line that has its center point\n // inside the linear ring.\n var pointX = NaN;\n var maxSegmentLength = -Infinity;\n intersections.sort(numberSafeCompareFunction);\n x1 = intersections[0];\n for (i = 1, ii = intersections.length; i < ii; ++i) {\n x2 = intersections[i];\n var segmentLength = Math.abs(x2 - x1);\n if (segmentLength > maxSegmentLength) {\n x = (x1 + x2) / 2;\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n pointX = x;\n maxSegmentLength = segmentLength;\n }\n }\n x1 = x2;\n }\n if (isNaN(pointX)) {\n // There is no horizontal line that has its center point inside the linear\n // ring. Use the center of the the linear ring's extent.\n pointX = flatCenters[flatCentersOffset];\n }\n if (opt_dest) {\n opt_dest.push(pointX, y, maxSegmentLength);\n return opt_dest;\n }\n else {\n return [pointX, y, maxSegmentLength];\n }\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @return {Array} Interior points as XYM coordinates, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) {\n var interiorPoints = [];\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n interiorPoints = getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints);\n offset = ends[ends.length - 1];\n }\n return interiorPoints;\n}\n//# sourceMappingURL=interiorpoint.js.map","/**\n * @module ol/geom/flat/segments\n */\n/**\n * This function calls `callback` for each segment of the flat coordinates\n * array. If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {function(import(\"../../coordinate.js\").Coordinate, import(\"../../coordinate.js\").Coordinate): T} callback Function\n * called for each segment.\n * @return {T|boolean} Value.\n * @template T\n */\nexport function forEach(flatCoordinates, offset, end, stride, callback) {\n var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];\n var point2 = [];\n var ret;\n for (; (offset + stride) < end; offset += stride) {\n point2[0] = flatCoordinates[offset + stride];\n point2[1] = flatCoordinates[offset + stride + 1];\n ret = callback(point1, point2);\n if (ret) {\n return ret;\n }\n point1[0] = point2[0];\n point1[1] = point2[1];\n }\n return false;\n}\n//# sourceMappingURL=segments.js.map","/**\n * @module ol/geom/flat/intersectsextent\n */\nimport { containsExtent, createEmpty, extendFlatCoordinates, intersects, intersectsSegment } from '../../extent.js';\nimport { linearRingContainsXY, linearRingContainsExtent } from './contains.js';\nimport { forEach as forEachSegment } from './segments.js';\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineString(flatCoordinates, offset, end, stride, extent) {\n var coordinatesExtent = extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride);\n if (!intersects(extent, coordinatesExtent)) {\n return false;\n }\n if (containsExtent(extent, coordinatesExtent)) {\n return true;\n }\n if (coordinatesExtent[0] >= extent[0] &&\n coordinatesExtent[2] <= extent[2]) {\n return true;\n }\n if (coordinatesExtent[1] >= extent[1] &&\n coordinatesExtent[3] <= extent[3]) {\n return true;\n }\n return forEachSegment(flatCoordinates, offset, end, stride, \n /**\n * @param {import(\"../../coordinate.js\").Coordinate} point1 Start point.\n * @param {import(\"../../coordinate.js\").Coordinate} point2 End point.\n * @return {boolean} `true` if the segment and the extent intersect,\n * `false` otherwise.\n */\n function (point1, point2) {\n return intersectsSegment(extent, point1, point2);\n });\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) {\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n if (intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)) {\n return true;\n }\n offset = ends[i];\n }\n return false;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) {\n if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {\n return true;\n }\n if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[1])) {\n return true;\n }\n if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[3])) {\n return true;\n }\n if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[1])) {\n return true;\n }\n if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[3])) {\n return true;\n }\n return false;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) {\n if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {\n return false;\n }\n if (ends.length === 1) {\n return true;\n }\n for (var i = 1, ii = ends.length; i < ii; ++i) {\n if (linearRingContainsExtent(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {\n if (!intersectsLineString(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {\n return false;\n }\n }\n }\n return true;\n}\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n if (intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n//# sourceMappingURL=intersectsextent.js.map","/**\n * @module ol/geom/flat/reverse\n */\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n */\nexport function coordinates(flatCoordinates, offset, end, stride) {\n while (offset < end - stride) {\n for (var i = 0; i < stride; ++i) {\n var tmp = flatCoordinates[offset + i];\n flatCoordinates[offset + i] = flatCoordinates[end - stride + i];\n flatCoordinates[end - stride + i] = tmp;\n }\n offset += stride;\n end -= stride;\n }\n}\n//# sourceMappingURL=reverse.js.map","/**\n * @module ol/geom/flat/orient\n */\nimport { coordinates as reverseCoordinates } from './reverse.js';\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean} Is clockwise.\n */\nexport function linearRingIsClockwise(flatCoordinates, offset, end, stride) {\n // http://tinyurl.com/clockwise-method\n // https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp\n var edge = 0;\n var x1 = flatCoordinates[end - stride];\n var y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n var x2 = flatCoordinates[offset];\n var y2 = flatCoordinates[offset + 1];\n edge += (x2 - x1) * (y2 + y1);\n x1 = x2;\n y1 = y2;\n }\n return edge > 0;\n}\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `opt_right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) {\n var right = opt_right !== undefined ? opt_right : false;\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);\n if (i === 0) {\n if ((right && isClockwise) || (!right && !isClockwise)) {\n return false;\n }\n }\n else {\n if ((right && !isClockwise) || (!right && isClockwise)) {\n return false;\n }\n }\n offset = end;\n }\n return true;\n}\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `opt_right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n var ends = endss[i];\n if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)) {\n return false;\n }\n if (ends.length) {\n offset = ends[ends.length - 1];\n }\n }\n return true;\n}\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `opt_right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRings(flatCoordinates, offset, ends, stride, opt_right) {\n var right = opt_right !== undefined ? opt_right : false;\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);\n var reverse = i === 0 ?\n (right && isClockwise) || (!right && !isClockwise) :\n (right && !isClockwise) || (!right && isClockwise);\n if (reverse) {\n reverseCoordinates(flatCoordinates, offset, end, stride);\n }\n offset = end;\n }\n return offset;\n}\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `opt_right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRingsArray(flatCoordinates, offset, endss, stride, opt_right) {\n for (var i = 0, ii = endss.length; i < ii; ++i) {\n offset = orientLinearRings(flatCoordinates, offset, endss[i], stride, opt_right);\n }\n return offset;\n}\n//# sourceMappingURL=orient.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/geom/Polygon\n */\nimport { extend } from '../array.js';\nimport { closestSquaredDistanceXY, getCenter } from '../extent.js';\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport LinearRing from './LinearRing.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport { offset as sphereOffset } from '../sphere.js';\nimport { linearRings as linearRingsArea } from './flat/area.js';\nimport { assignClosestArrayPoint, arrayMaxSquaredDelta } from './flat/closest.js';\nimport { linearRingsContainsXY } from './flat/contains.js';\nimport { deflateCoordinatesArray } from './flat/deflate.js';\nimport { inflateCoordinatesArray } from './flat/inflate.js';\nimport { getInteriorPointOfArray } from './flat/interiorpoint.js';\nimport { intersectsLinearRingArray } from './flat/intersectsextent.js';\nimport { linearRingsAreOriented, orientLinearRings } from './flat/orient.js';\nimport { quantizeArray } from './flat/simplify.js';\nimport { modulo } from '../math.js';\n/**\n * @classdesc\n * Polygon geometry.\n *\n * @api\n */\nvar Polygon = /** @class */ (function (_super) {\n __extends(Polygon, _super);\n /**\n * @param {!Array>|!Array} coordinates\n * Array of linear rings that define the polygon. The first linear ring of the\n * array defines the outer-boundary or surface of the polygon. Each subsequent\n * linear ring defines a hole in the surface of the polygon. A linear ring is\n * an array of vertices' coordinates where the first coordinate and the last are\n * equivalent. (For internal use, flat coordinates in combination with\n * `opt_layout` and `opt_ends` are also accepted.)\n * @param {GeometryLayout=} opt_layout Layout.\n * @param {Array=} opt_ends Ends (for internal use with flat coordinates).\n */\n function Polygon(coordinates, opt_layout, opt_ends) {\n var _this = _super.call(this) || this;\n /**\n * @type {Array}\n * @private\n */\n _this.ends_ = [];\n /**\n * @private\n * @type {number}\n */\n _this.flatInteriorPointRevision_ = -1;\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n _this.flatInteriorPoint_ = null;\n /**\n * @private\n * @type {number}\n */\n _this.maxDelta_ = -1;\n /**\n * @private\n * @type {number}\n */\n _this.maxDeltaRevision_ = -1;\n /**\n * @private\n * @type {number}\n */\n _this.orientedRevision_ = -1;\n /**\n * @private\n * @type {Array}\n */\n _this.orientedFlatCoordinates_ = null;\n if (opt_layout !== undefined && opt_ends) {\n _this.setFlatCoordinates(opt_layout, /** @type {Array} */ (coordinates));\n _this.ends_ = opt_ends;\n }\n else {\n _this.setCoordinates(/** @type {Array>} */ (coordinates), opt_layout);\n }\n return _this;\n }\n /**\n * Append the passed linear ring to this polygon.\n * @param {LinearRing} linearRing Linear ring.\n * @api\n */\n Polygon.prototype.appendLinearRing = function (linearRing) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = linearRing.getFlatCoordinates().slice();\n }\n else {\n extend(this.flatCoordinates, linearRing.getFlatCoordinates());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n };\n /**\n * Make a complete copy of the geometry.\n * @return {!Polygon} Clone.\n * @override\n * @api\n */\n Polygon.prototype.clone = function () {\n return new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice());\n };\n /**\n * @inheritDoc\n */\n Polygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates, 0, this.ends_, this.stride, 0));\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);\n };\n /**\n * @inheritDoc\n */\n Polygon.prototype.containsXY = function (x, y) {\n return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);\n };\n /**\n * Return the area of the polygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n Polygon.prototype.getArea = function () {\n return linearRingsArea(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);\n };\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for polygons.\n *\n * @param {boolean=} opt_right Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array>} Coordinates.\n * @override\n * @api\n */\n Polygon.prototype.getCoordinates = function (opt_right) {\n var flatCoordinates;\n if (opt_right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, opt_right);\n }\n else {\n flatCoordinates = this.flatCoordinates;\n }\n return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);\n };\n /**\n * @return {Array} Ends.\n */\n Polygon.prototype.getEnds = function () {\n return this.ends_;\n };\n /**\n * @return {Array} Interior point.\n */\n Polygon.prototype.getFlatInteriorPoint = function () {\n if (this.flatInteriorPointRevision_ != this.getRevision()) {\n var flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoint_ = getInteriorPointOfArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, flatCenter, 0);\n this.flatInteriorPointRevision_ = this.getRevision();\n }\n return this.flatInteriorPoint_;\n };\n /**\n * Return an interior point of the polygon.\n * @return {Point} Interior point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n * @api\n */\n Polygon.prototype.getInteriorPoint = function () {\n return new Point(this.getFlatInteriorPoint(), GeometryLayout.XYM);\n };\n /**\n * Return the number of rings of the polygon, this includes the exterior\n * ring and any interior rings.\n *\n * @return {number} Number of rings.\n * @api\n */\n Polygon.prototype.getLinearRingCount = function () {\n return this.ends_.length;\n };\n /**\n * Return the Nth linear ring of the polygon geometry. Return `null` if the\n * given index is out of range.\n * The exterior linear ring is available at index `0` and the interior rings\n * at index `1` and beyond.\n *\n * @param {number} index Index.\n * @return {LinearRing} Linear ring.\n * @api\n */\n Polygon.prototype.getLinearRing = function (index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LinearRing(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout);\n };\n /**\n * Return the linear rings of the polygon.\n * @return {Array} Linear rings.\n * @api\n */\n Polygon.prototype.getLinearRings = function () {\n var layout = this.layout;\n var flatCoordinates = this.flatCoordinates;\n var ends = this.ends_;\n var linearRings = [];\n var offset = 0;\n for (var i = 0, ii = ends.length; i < ii; ++i) {\n var end = ends[i];\n var linearRing = new LinearRing(flatCoordinates.slice(offset, end), layout);\n linearRings.push(linearRing);\n offset = end;\n }\n return linearRings;\n };\n /**\n * @return {Array} Oriented flat coordinates.\n */\n Polygon.prototype.getOrientedFlatCoordinates = function () {\n if (this.orientedRevision_ != this.getRevision()) {\n var flatCoordinates = this.flatCoordinates;\n if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n }\n else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length =\n orientLinearRings(this.orientedFlatCoordinates_, 0, this.ends_, this.stride);\n }\n this.orientedRevision_ = this.getRevision();\n }\n return this.orientedFlatCoordinates_;\n };\n /**\n * @inheritDoc\n */\n Polygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {\n var simplifiedFlatCoordinates = [];\n var simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEnds);\n return new Polygon(simplifiedFlatCoordinates, GeometryLayout.XY, simplifiedEnds);\n };\n /**\n * @inheritDoc\n * @api\n */\n Polygon.prototype.getType = function () {\n return GeometryType.POLYGON;\n };\n /**\n * @inheritDoc\n * @api\n */\n Polygon.prototype.intersectsExtent = function (extent) {\n return intersectsLinearRingArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);\n };\n /**\n * Set the coordinates of the polygon.\n * @param {!Array>} coordinates Coordinates.\n * @param {GeometryLayout=} opt_layout Layout.\n * @override\n * @api\n */\n Polygon.prototype.setCoordinates = function (coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n var ends = deflateCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.ends_);\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n };\n return Polygon;\n}(SimpleGeometry));\nexport default Polygon;\n/**\n * Create an approximation of a circle on the surface of a sphere.\n * @param {import(\"../coordinate.js\").Coordinate} center Center (`[lon, lat]` in degrees).\n * @param {number} radius The great-circle distance from the center to\n * the polygon vertices.\n * @param {number=} opt_n Optional number of vertices for the resulting\n * polygon. Default is `32`.\n * @param {number=} opt_sphereRadius Optional radius for the sphere (defaults to\n * the Earth's mean radius using the WGS84 ellipsoid).\n * @return {Polygon} The \"circular\" polygon.\n * @api\n */\nexport function circular(center, radius, opt_n, opt_sphereRadius) {\n var n = opt_n ? opt_n : 32;\n /** @type {Array} */\n var flatCoordinates = [];\n for (var i = 0; i < n; ++i) {\n extend(flatCoordinates, sphereOffset(center, radius, 2 * Math.PI * i / n, opt_sphereRadius));\n }\n flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);\n return new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);\n}\n/**\n * Create a polygon from an extent. The layout used is `XY`.\n * @param {import(\"../extent.js\").Extent} extent The extent.\n * @return {Polygon} The polygon.\n * @api\n */\nexport function fromExtent(extent) {\n var minX = extent[0];\n var minY = extent[1];\n var maxX = extent[2];\n var maxY = extent[3];\n var flatCoordinates = [minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];\n return new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);\n}\n/**\n * Create a regular polygon from a circle.\n * @param {import(\"./Circle.js\").default} circle Circle geometry.\n * @param {number=} opt_sides Number of sides of the polygon. Default is 32.\n * @param {number=} opt_angle Start angle for the first vertex of the polygon in\n * radians. Default is 0.\n * @return {Polygon} Polygon geometry.\n * @api\n */\nexport function fromCircle(circle, opt_sides, opt_angle) {\n var sides = opt_sides ? opt_sides : 32;\n var stride = circle.getStride();\n var layout = circle.getLayout();\n var center = circle.getCenter();\n var arrayLength = stride * (sides + 1);\n var flatCoordinates = new Array(arrayLength);\n for (var i = 0; i < arrayLength; i += stride) {\n flatCoordinates[i] = 0;\n flatCoordinates[i + 1] = 0;\n for (var j = 2; j < stride; j++) {\n flatCoordinates[i + j] = center[j];\n }\n }\n var ends = [flatCoordinates.length];\n var polygon = new Polygon(flatCoordinates, layout, ends);\n makeRegular(polygon, center, circle.getRadius(), opt_angle);\n return polygon;\n}\n/**\n * Modify the coordinates of a polygon to make it a regular polygon.\n * @param {Polygon} polygon Polygon geometry.\n * @param {import(\"../coordinate.js\").Coordinate} center Center of the regular polygon.\n * @param {number} radius Radius of the regular polygon.\n * @param {number=} opt_angle Start angle for the first vertex of the polygon in\n * radians. Default is 0.\n */\nexport function makeRegular(polygon, center, radius, opt_angle) {\n var flatCoordinates = polygon.getFlatCoordinates();\n var stride = polygon.getStride();\n var sides = flatCoordinates.length / stride - 1;\n var startAngle = opt_angle ? opt_angle : 0;\n for (var i = 0; i <= sides; ++i) {\n var offset = i * stride;\n var angle = startAngle + (modulo(i, sides) * 2 * Math.PI / sides);\n flatCoordinates[offset] = center[0] + (radius * Math.cos(angle));\n flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle));\n }\n polygon.changed();\n}\n//# sourceMappingURL=Polygon.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Geolocation\n */\nimport BaseObject, { getChangeEventType } from './Object.js';\nimport BaseEvent from './events/Event.js';\nimport EventType from './events/EventType.js';\nimport { circular as circularPolygon } from './geom/Polygon.js';\nimport { toRadians } from './math.js';\nimport { get as getProjection, getTransformFromProjections, identityTransform } from './proj.js';\n/**\n * @enum {string}\n */\nvar Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions'\n};\n/**\n * @classdesc\n * Events emitted on Geolocation error.\n */\nvar GeolocationError = /** @class */ (function (_super) {\n __extends(GeolocationError, _super);\n /**\n * @param {PositionError} error error object.\n */\n function GeolocationError(error) {\n var _this = _super.call(this, EventType.ERROR) || this;\n /**\n * @type {number}\n */\n _this.code = error.code;\n /**\n * @type {string}\n */\n _this.message = error.message;\n return _this;\n }\n return GeolocationError;\n}(BaseEvent));\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](http://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes, register a listener for the generic\n * `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * var geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * window.console.log(geolocation.getPosition());\n * });\n *\n * @fires module:ol/events/Event~BaseEvent#event:error\n * @api\n */\nvar Geolocation = /** @class */ (function (_super) {\n __extends(Geolocation, _super);\n /**\n * @param {Options=} opt_options Options.\n */\n function Geolocation(opt_options) {\n var _this = _super.call(this) || this;\n var options = opt_options || {};\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n _this.position_ = null;\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n _this.transform_ = identityTransform;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.watchId_ = undefined;\n _this.addEventListener(getChangeEventType(Property.PROJECTION), _this.handleProjectionChanged_);\n _this.addEventListener(getChangeEventType(Property.TRACKING), _this.handleTrackingChanged_);\n if (options.projection !== undefined) {\n _this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n _this.setTrackingOptions(options.trackingOptions);\n }\n _this.setTracking(options.tracking !== undefined ? options.tracking : false);\n return _this;\n }\n /**\n * @inheritDoc\n */\n Geolocation.prototype.disposeInternal = function () {\n this.setTracking(false);\n _super.prototype.disposeInternal.call(this);\n };\n /**\n * @private\n */\n Geolocation.prototype.handleProjectionChanged_ = function () {\n var projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(getProjection('EPSG:4326'), projection);\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n };\n /**\n * @private\n */\n Geolocation.prototype.handleTrackingChanged_ = function () {\n if ('geolocation' in navigator) {\n var tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(this.positionChange_.bind(this), this.positionError_.bind(this), this.getTrackingOptions());\n }\n else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n };\n /**\n * @private\n * @param {Position} position position event.\n */\n Geolocation.prototype.positionChange_ = function (position) {\n var coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(Property.ALTITUDE, coords.altitude === null ? undefined : coords.altitude);\n this.set(Property.ALTITUDE_ACCURACY, coords.altitudeAccuracy === null ?\n undefined : coords.altitudeAccuracy);\n this.set(Property.HEADING, coords.heading === null ?\n undefined : toRadians(coords.heading));\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n }\n else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n var projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition);\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n var geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n };\n /**\n * @private\n * @param {PositionError} error error object.\n */\n Geolocation.prototype.positionError_ = function (error) {\n this.setTracking(false);\n this.dispatchEvent(new GeolocationError(error));\n };\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n Geolocation.prototype.getAccuracy = function () {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n };\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n Geolocation.prototype.getAccuracyGeometry = function () {\n return (\n /** @type {?import(\"./geom/Polygon.js\").default} */ (this.get(Property.ACCURACY_GEOMETRY) || null));\n };\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n Geolocation.prototype.getAltitude = function () {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n };\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n Geolocation.prototype.getAltitudeAccuracy = function () {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE_ACCURACY));\n };\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n Geolocation.prototype.getHeading = function () {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n };\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n Geolocation.prototype.getPosition = function () {\n return (\n /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(Property.POSITION)));\n };\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n Geolocation.prototype.getProjection = function () {\n return (\n /** @type {import(\"./proj/Projection.js\").default|undefined} */ (this.get(Property.PROJECTION)));\n };\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n Geolocation.prototype.getSpeed = function () {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n };\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n Geolocation.prototype.getTracking = function () {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n };\n /**\n * Get the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n Geolocation.prototype.getTrackingOptions = function () {\n return /** @type {PositionOptions|undefined} */ (this.get(Property.TRACKING_OPTIONS));\n };\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n Geolocation.prototype.setProjection = function (projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n };\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n Geolocation.prototype.setTracking = function (tracking) {\n this.set(Property.TRACKING, tracking);\n };\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n Geolocation.prototype.setTrackingOptions = function (options) {\n this.set(Property.TRACKING_OPTIONS, options);\n };\n return Geolocation;\n}(BaseObject));\nexport default Geolocation;\n//# sourceMappingURL=Geolocation.js.map","/**\n * @module ol/Kinetic\n */\n/**\n * @classdesc\n * Implementation of inertial deceleration for map movement.\n *\n * @api\n */\nvar Kinetic = /** @class */ (function () {\n /**\n * @param {number} decay Rate of decay (must be negative).\n * @param {number} minVelocity Minimum velocity (pixels/millisecond).\n * @param {number} delay Delay to consider to calculate the kinetic\n * initial values (milliseconds).\n */\n function Kinetic(decay, minVelocity, delay) {\n /**\n * @private\n * @type {number}\n */\n this.decay_ = decay;\n /**\n * @private\n * @type {number}\n */\n this.minVelocity_ = minVelocity;\n /**\n * @private\n * @type {number}\n */\n this.delay_ = delay;\n /**\n * @private\n * @type {Array}\n */\n this.points_ = [];\n /**\n * @private\n * @type {number}\n */\n this.angle_ = 0;\n /**\n * @private\n * @type {number}\n */\n this.initialVelocity_ = 0;\n }\n /**\n * FIXME empty description for jsdoc\n */\n Kinetic.prototype.begin = function () {\n this.points_.length = 0;\n this.angle_ = 0;\n this.initialVelocity_ = 0;\n };\n /**\n * @param {number} x X.\n * @param {number} y Y.\n */\n Kinetic.prototype.update = function (x, y) {\n this.points_.push(x, y, Date.now());\n };\n /**\n * @return {boolean} Whether we should do kinetic animation.\n */\n Kinetic.prototype.end = function () {\n if (this.points_.length < 6) {\n // at least 2 points are required (i.e. there must be at least 6 elements\n // in the array)\n return false;\n }\n var delay = Date.now() - this.delay_;\n var lastIndex = this.points_.length - 3;\n if (this.points_[lastIndex + 2] < delay) {\n // the last tracked point is too old, which means that the user stopped\n // panning before releasing the map\n return false;\n }\n // get the first point which still falls into the delay time\n var firstIndex = lastIndex - 3;\n while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {\n firstIndex -= 3;\n }\n var duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];\n // we don't want a duration of 0 (divide by zero)\n // we also make sure the user panned for a duration of at least one frame\n // (1/60s) to compute sane displacement values\n if (duration < 1000 / 60) {\n return false;\n }\n var dx = this.points_[lastIndex] - this.points_[firstIndex];\n var dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];\n this.angle_ = Math.atan2(dy, dx);\n this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;\n return this.initialVelocity_ > this.minVelocity_;\n };\n /**\n * @return {number} Total distance travelled (pixels).\n */\n Kinetic.prototype.getDistance = function () {\n return (this.minVelocity_ - this.initialVelocity_) / this.decay_;\n };\n /**\n * @return {number} Angle of the kinetic panning animation (radians).\n */\n Kinetic.prototype.getAngle = function () {\n return this.angle_;\n };\n return Kinetic;\n}());\nexport default Kinetic;\n//# sourceMappingURL=Kinetic.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event.\n */\nvar MapEvent = /** @class */ (function (_super) {\n __extends(MapEvent, _super);\n /**\n * @param {string} type Event type.\n * @param {import(\"./PluggableMap.js\").default} map Map.\n * @param {?import(\"./PluggableMap.js\").FrameState=} opt_frameState Frame state.\n */\n function MapEvent(type, map, opt_frameState) {\n var _this = _super.call(this, type) || this;\n /**\n * The map where the event occurred.\n * @type {import(\"./PluggableMap.js\").default}\n * @api\n */\n _this.map = map;\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./PluggableMap.js\").FrameState}\n * @api\n */\n _this.frameState = opt_frameState !== undefined ? opt_frameState : null;\n return _this;\n }\n return MapEvent;\n}(Event));\nexport default MapEvent;\n//# sourceMappingURL=MapEvent.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event.\n */\nvar MapBrowserEvent = /** @class */ (function (_super) {\n __extends(MapBrowserEvent, _super);\n /**\n * @param {string} type Event type.\n * @param {import(\"./PluggableMap.js\").default} map Map.\n * @param {Event} browserEvent Browser event.\n * @param {boolean=} opt_dragging Is the map currently being dragged?\n * @param {?import(\"./PluggableMap.js\").FrameState=} opt_frameState Frame state.\n */\n function MapBrowserEvent(type, map, browserEvent, opt_dragging, opt_frameState) {\n var _this = _super.call(this, type, map, opt_frameState) || this;\n /**\n * The original browser event.\n * @const\n * @type {Event}\n * @api\n */\n _this.originalEvent = browserEvent;\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n */\n _this.pixel_ = null;\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n _this.coordinate_ = null;\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n _this.dragging = opt_dragging !== undefined ? opt_dragging : false;\n return _this;\n }\n Object.defineProperty(MapBrowserEvent.prototype, \"pixel\", {\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get: function () {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n },\n set: function (pixel) {\n this.pixel_ = pixel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapBrowserEvent.prototype, \"coordinate\", {\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get: function () {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n },\n set: function (coordinate) {\n this.coordinate_ = coordinate;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @override\n * @api\n */\n MapBrowserEvent.prototype.preventDefault = function () {\n _super.prototype.preventDefault.call(this);\n this.originalEvent.preventDefault();\n };\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @override\n * @api\n */\n MapBrowserEvent.prototype.stopPropagation = function () {\n _super.prototype.stopPropagation.call(this);\n this.originalEvent.stopPropagation();\n };\n return MapBrowserEvent;\n}(MapEvent));\nexport default MapBrowserEvent;\n//# sourceMappingURL=MapBrowserEvent.js.map","/**\n * @module ol/has\n */\nvar ua = typeof navigator !== 'undefined' ?\n navigator.userAgent.toLowerCase() : '';\n/**\n * User agent string says we are dealing with Firefox as browser.\n * @type {boolean}\n */\nexport var FIREFOX = ua.indexOf('firefox') !== -1;\n/**\n * User agent string says we are dealing with Safari as browser.\n * @type {boolean}\n */\nexport var SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1;\n/**\n * User agent string says we are dealing with a WebKit engine.\n * @type {boolean}\n */\nexport var WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1;\n/**\n * User agent string says we are dealing with a Mac as platform.\n * @type {boolean}\n */\nexport var MAC = ua.indexOf('macintosh') !== -1;\n/**\n * The ratio between physical pixels and device-independent pixels\n * (dips) on the device (`window.devicePixelRatio`).\n * @const\n * @type {number}\n * @api\n */\nexport var DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1;\n/**\n * Image.prototype.decode() is supported.\n * @type {boolean}\n */\nexport var IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode;\n//# sourceMappingURL=has.js.map","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel'\n};\n//# sourceMappingURL=MapBrowserEventType.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/MapBrowserPointerEvent\n */\nimport MapBrowserEvent from './MapBrowserEvent.js';\nvar MapBrowserPointerEvent = /** @class */ (function (_super) {\n __extends(MapBrowserPointerEvent, _super);\n /**\n * @param {string} type Event type.\n * @param {import(\"./PluggableMap.js\").default} map Map.\n * @param {PointerEvent} pointerEvent Pointer event.\n * @param {boolean=} opt_dragging Is the map currently being dragged?\n * @param {?import(\"./PluggableMap.js\").FrameState=} opt_frameState Frame state.\n */\n function MapBrowserPointerEvent(type, map, pointerEvent, opt_dragging, opt_frameState) {\n var _this = _super.call(this, type, map, pointerEvent, opt_dragging, opt_frameState) || this;\n /**\n * @const\n * @type {PointerEvent}\n */\n _this.pointerEvent = pointerEvent;\n return _this;\n }\n return MapBrowserPointerEvent;\n}(MapBrowserEvent));\nexport default MapBrowserPointerEvent;\n//# sourceMappingURL=MapBrowserPointerEvent.js.map","/**\n * @module ol/pointer/EventType\n */\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n POINTERMOVE: 'pointermove',\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel'\n};\n//# sourceMappingURL=EventType.js.map","/**\n * @module ol/MapBrowserEventHandler\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport '@openlayers/pepjs';\nimport { DEVICE_PIXEL_RATIO } from './has.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapBrowserPointerEvent from './MapBrowserPointerEvent.js';\nimport { listen, unlistenByKey } from './events.js';\nimport EventTarget from './events/Target.js';\nimport PointerEventType from './pointer/EventType.js';\nvar MapBrowserEventHandler = /** @class */ (function (_super) {\n __extends(MapBrowserEventHandler, _super);\n /**\n * @param {import(\"./PluggableMap.js\").default} map The map with the viewport to listen to events on.\n * @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move.\n */\n function MapBrowserEventHandler(map, moveTolerance) {\n var _this = _super.call(this, map) || this;\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./PluggableMap.js\").default}\n * @private\n */\n _this.map_ = map;\n /**\n * @type {any}\n * @private\n */\n _this.clickTimeoutId_;\n /**\n * @type {boolean}\n * @private\n */\n _this.dragging_ = false;\n /**\n * @type {!Array}\n * @private\n */\n _this.dragListenerKeys_ = [];\n /**\n * @type {number}\n * @private\n */\n _this.moveTolerance_ = moveTolerance ?\n moveTolerance * DEVICE_PIXEL_RATIO : DEVICE_PIXEL_RATIO;\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent}\n * @private\n */\n _this.down_ = null;\n var element = _this.map_.getViewport();\n /**\n * @type {number}\n * @private\n */\n _this.activePointers_ = 0;\n /**\n * @type {!Object}\n * @private\n */\n _this.trackedTouches_ = {};\n _this.element_ = element;\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n _this.pointerdownListenerKey_ = listen(element, PointerEventType.POINTERDOWN, _this.handlePointerDown_, _this);\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n _this.relayedListenerKey_ = listen(element, PointerEventType.POINTERMOVE, _this.relayEvent_, _this);\n return _this;\n }\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.emulateClick_ = function (pointerEvent) {\n var newEvent = new MapBrowserPointerEvent(MapBrowserEventType.CLICK, this.map_, pointerEvent);\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserPointerEvent(MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);\n this.dispatchEvent(newEvent);\n }\n else {\n // click\n this.clickTimeoutId_ = setTimeout(function () {\n this.clickTimeoutId_ = undefined;\n var newEvent = new MapBrowserPointerEvent(MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);\n this.dispatchEvent(newEvent);\n }.bind(this), 250);\n }\n };\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.updateActivePointers_ = function (pointerEvent) {\n var event = pointerEvent;\n if (event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL) {\n delete this.trackedTouches_[event.pointerId];\n }\n else if (event.type == MapBrowserEventType.POINTERDOWN) {\n this.trackedTouches_[event.pointerId] = true;\n }\n this.activePointers_ = Object.keys(this.trackedTouches_).length;\n };\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.handlePointerUp_ = function (pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n var newEvent = new MapBrowserPointerEvent(MapBrowserEventType.POINTERUP, this.map_, pointerEvent);\n this.dispatchEvent(newEvent);\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.stopPropagation() or event.preventDefault().\n if (!newEvent.propagationStopped && !this.dragging_ && this.isMouseActionButton_(pointerEvent)) {\n this.emulateClick_(this.down_);\n }\n if (this.activePointers_ === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n };\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n MapBrowserEventHandler.prototype.isMouseActionButton_ = function (pointerEvent) {\n return pointerEvent.button === 0;\n };\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.handlePointerDown_ = function (pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n var newEvent = new MapBrowserPointerEvent(MapBrowserEventType.POINTERDOWN, this.map_, pointerEvent);\n this.dispatchEvent(newEvent);\n this.down_ = pointerEvent;\n if (this.dragListenerKeys_.length === 0) {\n this.dragListenerKeys_.push(listen(document, MapBrowserEventType.POINTERMOVE, this.handlePointerMove_, this), listen(document, MapBrowserEventType.POINTERUP, this.handlePointerUp_, this), \n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(this.element_, MapBrowserEventType.POINTERCANCEL, this.handlePointerUp_, this));\n }\n };\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.handlePointerMove_ = function (pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.dragging_ = true;\n var newEvent = new MapBrowserPointerEvent(MapBrowserEventType.POINTERDRAG, this.map_, pointerEvent, this.dragging_);\n this.dispatchEvent(newEvent);\n }\n };\n /**\n * Wrap and relay a pointer event. Note that this requires that the type\n * string for the MapBrowserPointerEvent matches the PointerEvent type.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n MapBrowserEventHandler.prototype.relayEvent_ = function (pointerEvent) {\n var dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(new MapBrowserPointerEvent(pointerEvent.type, this.map_, pointerEvent, dragging));\n };\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n MapBrowserEventHandler.prototype.isMoving_ = function (pointerEvent) {\n return this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_;\n };\n /**\n * @inheritDoc\n */\n MapBrowserEventHandler.prototype.disposeInternal = function () {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.element_ = null;\n _super.prototype.disposeInternal.call(this);\n };\n return MapBrowserEventHandler;\n}(EventTarget));\nexport default MapBrowserEventHandler;\n//# sourceMappingURL=MapBrowserEventHandler.js.map","/**\n * @module ol/MapEventType\n */\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend'\n};\n//# sourceMappingURL=MapEventType.js.map","/**\n * @module ol/MapProperty\n */\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view'\n};\n//# sourceMappingURL=MapProperty.js.map","/**\n * @module ol/render/EventType\n */\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered before a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#prerender\n * @api\n */\n PRERENDER: 'prerender',\n /**\n * Triggered after a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n /**\n * Triggered before layers are rendered.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#precompose\n * @api\n */\n PRECOMPOSE: 'precompose',\n /**\n * Triggered after all layers are rendered.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#postcompose\n * @api\n */\n POSTCOMPOSE: 'postcompose',\n /**\n * Triggered when rendering is complete, i.e. all sources and tiles have\n * finished loading for the current viewport, and all tiles are faded in.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#rendercomplete\n * @api\n */\n RENDERCOMPLETE: 'rendercomplete'\n};\n//# sourceMappingURL=EventType.js.map","/**\n * @module ol/TileState\n */\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n ABORT: 5\n};\n//# sourceMappingURL=TileState.js.map","/**\n * @module ol/structs/PriorityQueue\n */\nimport { assert } from '../asserts.js';\nimport { clear } from '../obj.js';\n/**\n * @type {number}\n */\nexport var DROP = Infinity;\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html\n * and http://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nvar PriorityQueue = /** @class */ (function () {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n function PriorityQueue(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n /**\n * @type {Array}\n * @private\n */\n this.elements_ = [];\n /**\n * @type {Array}\n * @private\n */\n this.priorities_ = [];\n /**\n * @type {!Object}\n * @private\n */\n this.queuedElements_ = {};\n }\n /**\n * FIXME empty description for jsdoc\n */\n PriorityQueue.prototype.clear = function () {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n };\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n PriorityQueue.prototype.dequeue = function () {\n var elements = this.elements_;\n var priorities = this.priorities_;\n var element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n }\n else {\n elements[0] = elements.pop();\n priorities[0] = priorities.pop();\n this.siftUp_(0);\n }\n var elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n };\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n PriorityQueue.prototype.enqueue = function (element) {\n assert(!(this.keyFunction_(element) in this.queuedElements_), 31); // Tried to enqueue an `element` that was already added to the queue\n var priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n };\n /**\n * @return {number} Count.\n */\n PriorityQueue.prototype.getCount = function () {\n return this.elements_.length;\n };\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n PriorityQueue.prototype.getLeftChildIndex_ = function (index) {\n return index * 2 + 1;\n };\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n PriorityQueue.prototype.getRightChildIndex_ = function (index) {\n return index * 2 + 2;\n };\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n PriorityQueue.prototype.getParentIndex_ = function (index) {\n return (index - 1) >> 1;\n };\n /**\n * Make this a heap. O(N).\n * @private\n */\n PriorityQueue.prototype.heapify_ = function () {\n var i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n };\n /**\n * @return {boolean} Is empty.\n */\n PriorityQueue.prototype.isEmpty = function () {\n return this.elements_.length === 0;\n };\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n PriorityQueue.prototype.isKeyQueued = function (key) {\n return key in this.queuedElements_;\n };\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n PriorityQueue.prototype.isQueued = function (element) {\n return this.isKeyQueued(this.keyFunction_(element));\n };\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n PriorityQueue.prototype.siftUp_ = function (index) {\n var elements = this.elements_;\n var priorities = this.priorities_;\n var count = elements.length;\n var element = elements[index];\n var priority = priorities[index];\n var startIndex = index;\n while (index < (count >> 1)) {\n var lIndex = this.getLeftChildIndex_(index);\n var rIndex = this.getRightChildIndex_(index);\n var smallerChildIndex = rIndex < count &&\n priorities[rIndex] < priorities[lIndex] ?\n rIndex : lIndex;\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n };\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n PriorityQueue.prototype.siftDown_ = function (startIndex, index) {\n var elements = this.elements_;\n var priorities = this.priorities_;\n var element = elements[index];\n var priority = priorities[index];\n while (index > startIndex) {\n var parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n }\n else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n };\n /**\n * FIXME empty description for jsdoc\n */\n PriorityQueue.prototype.reprioritize = function () {\n var priorityFunction = this.priorityFunction_;\n var elements = this.elements_;\n var priorities = this.priorities_;\n var index = 0;\n var n = elements.length;\n var element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n }\n else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n };\n return PriorityQueue;\n}());\nexport default PriorityQueue;\n//# sourceMappingURL=PriorityQueue.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/TileQueue\n */\nimport TileState from './TileState.js';\nimport EventType from './events/EventType.js';\nimport PriorityQueue from './structs/PriorityQueue.js';\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import(\"./coordinate.js\").Coordinate, number): number} PriorityFunction\n */\nvar TileQueue = /** @class */ (function (_super) {\n __extends(TileQueue, _super);\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n function TileQueue(tilePriorityFunction, tileChangeCallback) {\n var _this = _super.call(this, \n /**\n * @param {Array} element Element.\n * @return {number} Priority.\n */\n function (element) {\n return tilePriorityFunction.apply(null, element);\n }, \n /**\n * @param {Array} element Element.\n * @return {string} Key.\n */\n function (element) {\n return ( /** @type {import(\"./Tile.js\").default} */(element[0]).getKey());\n }) || this;\n /** @private */\n _this.boundHandleTileChange_ = _this.handleTileChange.bind(_this);\n /**\n * @private\n * @type {function(): ?}\n */\n _this.tileChangeCallback_ = tileChangeCallback;\n /**\n * @private\n * @type {number}\n */\n _this.tilesLoading_ = 0;\n /**\n * @private\n * @type {!Object}\n */\n _this.tilesLoadingKeys_ = {};\n return _this;\n }\n /**\n * @inheritDoc\n */\n TileQueue.prototype.enqueue = function (element) {\n var added = _super.prototype.enqueue.call(this, element);\n if (added) {\n var tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n };\n /**\n * @return {number} Number of tiles loading.\n */\n TileQueue.prototype.getTilesLoading = function () {\n return this.tilesLoading_;\n };\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n TileQueue.prototype.handleTileChange = function (event) {\n var tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n var state = tile.getState();\n if (tile.hifi && state === TileState.LOADED || state === TileState.ERROR ||\n state === TileState.EMPTY || state === TileState.ABORT) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n var tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n };\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n TileQueue.prototype.loadMoreTiles = function (maxTotalLoading, maxNewLoads) {\n var newLoads = 0;\n var abortedTiles = false;\n var state, tile, tileKey;\n while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads &&\n this.getCount() > 0) {\n tile = /** @type {import(\"./Tile.js\").default} */ (this.dequeue()[0]);\n tileKey = tile.getKey();\n state = tile.getState();\n if (state === TileState.ABORT) {\n abortedTiles = true;\n }\n else if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n if (newLoads === 0 && abortedTiles) {\n // Do not stop the render loop when all wanted tiles were aborted due to\n // a small, saturated tile cache.\n this.tileChangeCallback_();\n }\n };\n return TileQueue;\n}(PriorityQueue));\nexport default TileQueue;\n//# sourceMappingURL=TileQueue.js.map","/**\n * @module ol/tilegrid/common\n */\n/**\n * Default maximum zoom for default tile grids.\n * @type {number}\n */\nexport var DEFAULT_MAX_ZOOM = 42;\n/**\n * Default tile size.\n * @type {number}\n */\nexport var DEFAULT_TILE_SIZE = 256;\n//# sourceMappingURL=common.js.map","/**\n * @module ol/centerconstraint\n */\nimport { clamp } from './math.js';\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, opt_isMoving) {\n if (center) {\n var viewWidth = onlyCenter ? 0 : size[0] * resolution;\n var viewHeight = onlyCenter ? 0 : size[1] * resolution;\n var minX = extent[0] + viewWidth / 2;\n var maxX = extent[2] - viewWidth / 2;\n var minY = extent[1] + viewHeight / 2;\n var maxY = extent[3] - viewHeight / 2;\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n var x = clamp(center[0], minX, maxX);\n var y = clamp(center[1], minY, maxY);\n var ratio = 30 * resolution;\n // during an interaction, allow some overscroll\n if (opt_isMoving && smooth) {\n x += -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y += -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n return [x, y];\n }\n else {\n return undefined;\n }\n });\n}\n/**\n * @param {import(\"./coordinate.js\").Coordinate=} center Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n//# sourceMappingURL=centerconstraint.js.map","/**\n * @module ol/resolutionconstraint\n */\nimport { linearFindNearest } from './array.js';\nimport { getHeight, getWidth } from './extent.js';\nimport { clamp } from './math.js';\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n/**\n * Returns a modified resolution taking into acocunt the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent=} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(resolution, maxExtent, viewportSize) {\n var xResolution = getWidth(maxExtent) / viewportSize[0];\n var yResolution = getHeight(maxExtent) / viewportSize[1];\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n var result = Math.min(resolution, maxResolution);\n var ratio = 50;\n result *= Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio + 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /= Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) / ratio + 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n/**\n * @param {Array} resolutions Resolutions.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(resolutions, opt_smooth, opt_maxExtent) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n var maxResolution = resolutions[0];\n var minResolution = resolutions[resolutions.length - 1];\n var cappedMaxRes = opt_maxExtent ?\n getViewportClampedResolution(maxResolution, opt_maxExtent, size) :\n maxResolution;\n // during interacting or animating, allow intermediary values\n if (opt_isMoving) {\n var smooth = opt_smooth !== undefined ? opt_smooth : true;\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);\n }\n var capped = Math.min(cappedMaxRes, resolution);\n var z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n }\n else {\n return undefined;\n }\n });\n}\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number=} opt_minResolution Minimum resolution.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(power, maxResolution, opt_minResolution, opt_smooth, opt_maxExtent) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n var cappedMaxRes = opt_maxExtent ?\n getViewportClampedResolution(maxResolution, opt_maxExtent, size) :\n maxResolution;\n var minResolution = opt_minResolution !== undefined ? opt_minResolution : 0;\n // during interacting or animating, allow intermediary values\n if (opt_isMoving) {\n var smooth = opt_smooth !== undefined ? opt_smooth : true;\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);\n }\n var tolerance = 1e-9;\n var minZoomLevel = Math.ceil(Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance);\n var offset = -direction * (0.5 - tolerance) + 0.5;\n var capped = Math.min(cappedMaxRes, resolution);\n var cappedZoomLevel = Math.floor(Math.log(maxResolution / capped) / Math.log(power) + offset);\n var zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n var newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n }\n else {\n return undefined;\n }\n });\n}\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(maxResolution, minResolution, opt_smooth, opt_maxExtent) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n var cappedMaxRes = opt_maxExtent ?\n getViewportClampedResolution(maxResolution, opt_maxExtent, size) :\n maxResolution;\n var smooth = opt_smooth !== undefined ? opt_smooth : true;\n if (!smooth || !opt_isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);\n }\n else {\n return undefined;\n }\n });\n}\n//# sourceMappingURL=resolutionconstraint.js.map","/**\n * @module ol/rotationconstraint\n */\nimport { toRadians } from './math.js';\n/**\n * @typedef {function((number|undefined), boolean=): (number|undefined)} Type\n */\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function disable(rotation) {\n if (rotation !== undefined) {\n return 0;\n }\n else {\n return undefined;\n }\n}\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function none(rotation) {\n if (rotation !== undefined) {\n return rotation;\n }\n else {\n return undefined;\n }\n}\n/**\n * @param {number} n N.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToN(n) {\n var theta = 2 * Math.PI / n;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, opt_isMoving) {\n if (opt_isMoving) {\n return rotation;\n }\n if (rotation !== undefined) {\n rotation = Math.floor(rotation / theta + 0.5) * theta;\n return rotation;\n }\n else {\n return undefined;\n }\n });\n}\n/**\n * @param {number=} opt_tolerance Tolerance.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToZero(opt_tolerance) {\n var tolerance = opt_tolerance || toRadians(5);\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, opt_isMoving) {\n if (opt_isMoving) {\n return rotation;\n }\n if (rotation !== undefined) {\n if (Math.abs(rotation) <= tolerance) {\n return 0;\n }\n else {\n return rotation;\n }\n }\n else {\n return undefined;\n }\n });\n}\n//# sourceMappingURL=rotationconstraint.js.map","/**\n * @module ol/ViewHint\n */\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1\n};\n//# sourceMappingURL=ViewHint.js.map","/**\n * @module ol/ViewProperty\n */\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation'\n};\n//# sourceMappingURL=ViewProperty.js.map","/**\n * @module ol/string\n */\n/**\n * @param {number} number Number to be formatted\n * @param {number} width The desired width\n * @param {number=} opt_precision Precision of the output string (i.e. number of decimal places)\n * @returns {string} Formatted string\n */\nexport function padNumber(number, width, opt_precision) {\n var numberString = opt_precision !== undefined ? number.toFixed(opt_precision) : '' + number;\n var decimal = numberString.indexOf('.');\n decimal = decimal === -1 ? numberString.length : decimal;\n return decimal > width ? numberString : new Array(1 + width - decimal).join('0') + numberString;\n}\n/**\n * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js\n * @param {string|number} v1 First version\n * @param {string|number} v2 Second version\n * @returns {number} Value\n */\nexport function compareVersions(v1, v2) {\n var s1 = ('' + v1).split('.');\n var s2 = ('' + v2).split('.');\n for (var i = 0; i < Math.max(s1.length, s2.length); i++) {\n var n1 = parseInt(s1[i] || '0', 10);\n var n2 = parseInt(s2[i] || '0', 10);\n if (n1 > n2) {\n return 1;\n }\n if (n2 > n1) {\n return -1;\n }\n }\n return 0;\n}\n//# sourceMappingURL=string.js.map","/**\n * @module ol/coordinate\n */\nimport { modulo } from './math.js';\nimport { padNumber } from './string.js';\n/**\n * An array of numbers representing an xy coordinate. Example: `[16, 48]`.\n * @typedef {Array} Coordinate\n * @api\n */\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n var r = circle.getRadius();\n var center = circle.getCenter();\n var x0 = center[0];\n var y0 = center[1];\n var x1 = coordinate[0];\n var y1 = coordinate[1];\n var dx = x1 - x0;\n var dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n var d = Math.sqrt(dx * dx + dy * dy);\n var x = x0 + r * dx / d;\n var y = y0 + r * dy / d;\n return [x, y];\n}\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n var x0 = coordinate[0];\n var y0 = coordinate[1];\n var start = segment[0];\n var end = segment[1];\n var x1 = start[0];\n var y1 = start[1];\n var x2 = end[0];\n var y2 = end[1];\n var dx = x2 - x1;\n var dy = y2 - y1;\n var along = (dx === 0 && dy === 0) ? 0 :\n ((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);\n var x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n }\n else if (along >= 1) {\n x = x2;\n y = y2;\n }\n else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var stringifyFunc = createStringXY();\n * var out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var stringifyFunc = createStringXY(2);\n * var out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(opt_fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, opt_fractionDigits);\n });\n}\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {\n var normalizedDegrees = modulo(degrees + 180, 360) - 180;\n var x = Math.abs(3600 * normalizedDegrees);\n var dflPrecision = opt_fractionDigits || 0;\n var precision = Math.pow(10, dflPrecision);\n var deg = Math.floor(x / 3600);\n var min = Math.floor((x - deg * 3600) / 60);\n var sec = x - (deg * 3600) - (min * 60);\n sec = Math.ceil(sec * precision) / precision;\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n return deg + '\\u00b0 ' + padNumber(min, 2) + '\\u2032 ' +\n padNumber(sec, 2, dflPrecision) + '\\u2033' +\n (normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));\n}\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var template = 'Coordinate is ({x}|{y}).';\n * var out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var template = 'Coordinate is ({x}|{y}).';\n * var out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, opt_fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(opt_fractionDigits))\n .replace('{y}', coordinate[1].toFixed(opt_fractionDigits));\n }\n else {\n return '';\n }\n}\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n var equals = true;\n for (var i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n var cosAngle = Math.cos(angle);\n var sinAngle = Math.sin(angle);\n var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n var dx = coord1[0] - coord2[0];\n var dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, opt_fractionDigits) {\n if (coordinate) {\n return degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +\n degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);\n }\n else {\n return '';\n }\n}\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, opt_fractionDigits) {\n return format(coordinate, '{x}, {y}', opt_fractionDigits);\n}\n//# sourceMappingURL=coordinate.js.map","/**\n * @module ol/easing\n */\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing~inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n }\n else {\n return 1 - inAndOut(2 * (t - 0.5));\n }\n}\n//# sourceMappingURL=easing.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/View\n */\nimport { DEFAULT_TILE_SIZE } from './tilegrid/common.js';\nimport { getUid } from './util.js';\nimport { VOID } from './functions.js';\nimport { createExtent, none as centerNone } from './centerconstraint.js';\nimport BaseObject from './Object.js';\nimport { createSnapToResolutions, createSnapToPower } from './resolutionconstraint.js';\nimport { createSnapToZero, createSnapToN, none as rotationNone, disable } from './rotationconstraint.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport { linearFindNearest } from './array.js';\nimport { assert } from './asserts.js';\nimport { add as addCoordinate, rotate as rotateCoordinate, equals as coordinatesEqual } from './coordinate.js';\nimport { inAndOut } from './easing.js';\nimport { getForViewAndSize, getCenter, getHeight, getWidth, isEmpty } from './extent.js';\nimport GeometryType from './geom/GeometryType.js';\nimport { fromExtent as polygonFromExtent } from './geom/Polygon.js';\nimport { clamp, modulo } from './math.js';\nimport { assign } from './obj.js';\nimport { createProjection, METERS_PER_UNIT, toUserCoordinate, toUserExtent, fromUserCoordinate, fromUserExtent, getUserProjection } from './proj.js';\nimport Units from './proj/Units.js';\nimport { equals } from './coordinate.js';\nimport { easeOut } from './easing.js';\nimport { createMinMaxResolution } from './resolutionconstraint.js';\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter]\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter]\n * @property {number} [sourceResolution]\n * @property {number} [targetResolution]\n * @property {number} [sourceRotation]\n * @property {number} [targetRotation]\n * @property {import(\"./coordinate.js\").Coordinate} [anchor]\n * @property {number} start\n * @property {number} duration\n * @property {boolean} complete\n * @property {function(number):number} easing\n * @property {function(boolean)} callback\n */\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center\n * @property {import(\"./resolutionconstraint.js\").Type} resolution\n * @property {import(\"./rotationconstraint.js\").Type} rotation\n */\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to fit\n * the extent into. Default is the current size of the first map in the DOM that\n * uses this view, or `[100, 100]` if no such map is found.\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing~inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean)} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array} [resolutions] Resolutions to determine the\n * resolution constraint. If set the `maxResolution`, `minResolution`,\n * `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n */\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing~inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center\n * @property {import(\"./proj/Projection.js\").default} projection\n * @property {number} resolution\n * @property {number} rotation\n * @property {number} zoom\n */\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nvar DEFAULT_MIN_ZOOM = 0;\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Spherical Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `opt_anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n */\nvar View = /** @class */ (function (_super) {\n __extends(View, _super);\n /**\n * @param {ViewOptions=} opt_options View options.\n */\n function View(opt_options) {\n var _this = _super.call(this) || this;\n var options = assign({}, opt_options);\n /**\n * @private\n * @type {Array}\n */\n _this.hints_ = [0, 0];\n /**\n * @private\n * @type {Array>}\n */\n _this.animations_ = [];\n /**\n * @private\n * @type {number|undefined}\n */\n _this.updateAnimationKey_;\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n _this.projection_ = createProjection(options.projection, 'EPSG:3857');\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n _this.targetCenter_ = null;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.targetResolution_;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.targetRotation_;\n if (options.center) {\n options.center = fromUserCoordinate(options.center, _this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, _this.projection_);\n }\n _this.applyOptions_(options);\n return _this;\n }\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n View.prototype.applyOptions_ = function (options) {\n /**\n * @type {Object}\n */\n var properties = {};\n var resolutionConstraintInfo = createResolutionConstraint(options);\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n /**\n * @private\n * @type {Array|undefined}\n */\n this.resolutions_ = options.resolutions;\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n var centerConstraint = createCenterConstraint(options);\n var resolutionConstraint = resolutionConstraintInfo.constraint;\n var rotationConstraint = createRotationConstraint(options);\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint\n };\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(options.center !== undefined ? options.center : null);\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n }\n else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n this.resolveConstraints(0);\n this.setProperties(properties);\n /**\n * @private\n * @type {ViewOptions}\n */\n this.options_ = options;\n };\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n View.prototype.getUpdatedOptions_ = function (newOptions) {\n var options = assign({}, this.options_);\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n }\n else {\n options.zoom = this.getZoom();\n }\n // preserve center\n options.center = this.getCenterInternal();\n // preserve rotation\n options.rotation = this.getRotation();\n return assign({}, options, newOptions);\n };\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n View.prototype.animate = function (var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n var options = arguments[i];\n if (options.center) {\n options = assign({}, options);\n options.center = fromUserCoordinate(options.center, this.getProjection());\n }\n if (options.anchor) {\n options = assign({}, options);\n options.anchor = fromUserCoordinate(options.anchor, this.getProjection());\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n };\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n View.prototype.animateInternal = function (var_args) {\n var animationCount = arguments.length;\n var callback;\n if (animationCount > 1 && typeof arguments[animationCount - 1] === 'function') {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n if (!this.isDef()) {\n // if view properties are not yet set, shortcut to the final state\n var state = arguments[animationCount - 1];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n var start = Date.now();\n var center = this.targetCenter_.slice();\n var resolution = this.targetResolution_;\n var rotation = this.targetRotation_;\n var series = [];\n for (var i = 0; i < animationCount; ++i) {\n var options = /** @type {AnimationOptions} */ (arguments[i]);\n var animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback\n };\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n }\n else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n var delta = modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n }\n else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n };\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n View.prototype.getAnimating = function () {\n return this.hints_[ViewHint.ANIMATING] > 0;\n };\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n View.prototype.getInteracting = function () {\n return this.hints_[ViewHint.INTERACTING] > 0;\n };\n /**\n * Cancel any ongoing animations.\n * @api\n */\n View.prototype.cancelAnimations = function () {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n for (var i = 0, ii = this.animations_.length; i < ii; ++i) {\n var series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n }\n this.animations_.length = 0;\n };\n /**\n * Update all animations.\n */\n View.prototype.updateAnimations_ = function () {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n var now = Date.now();\n var more = false;\n for (var i = this.animations_.length - 1; i >= 0; --i) {\n var series = this.animations_[i];\n var seriesComplete = true;\n for (var j = 0, jj = series.length; j < jj; ++j) {\n var animation = series[j];\n if (animation.complete) {\n continue;\n }\n var elapsed = now - animation.start;\n var fraction = animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n }\n else {\n seriesComplete = false;\n }\n var progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n var x0 = animation.sourceCenter[0];\n var y0 = animation.sourceCenter[1];\n var x1 = animation.targetCenter[0];\n var y1 = animation.targetCenter[1];\n var x = x0 + progress * (x1 - x0);\n var y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n var resolution = progress === 1 ?\n animation.targetResolution :\n animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n var size = this.getSizeFromViewport_(this.getRotation());\n var constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);\n this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);\n }\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) {\n var rotation = progress === 1 ?\n modulo(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI :\n animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n var constrainedRotation = this.constraints_.rotation(rotation, true);\n this.targetCenter_ = this.calculateCenterRotate(constrainedRotation, animation.anchor);\n }\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n var callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(this.updateAnimations_.bind(this));\n }\n };\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n View.prototype.calculateCenterRotate = function (rotation, anchor) {\n var center;\n var currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n };\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n View.prototype.calculateCenterZoom = function (resolution, anchor) {\n var center;\n var currentCenter = this.getCenterInternal();\n var currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n var x = anchor[0] - resolution * (anchor[0] - currentCenter[0]) / currentResolution;\n var y = anchor[1] - resolution * (anchor[1] - currentCenter[1]) / currentResolution;\n center = [x, y];\n }\n return center;\n };\n /**\n * @private\n * @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n View.prototype.getSizeFromViewport_ = function (opt_rotation) {\n var size = [100, 100];\n var selector = '.ol-viewport[data-view=\"' + getUid(this) + '\"]';\n var element = document.querySelector(selector);\n if (element) {\n var metrics = getComputedStyle(element);\n size[0] = parseInt(metrics.width, 10);\n size[1] = parseInt(metrics.height, 10);\n }\n if (opt_rotation) {\n var w = size[0];\n var h = size[1];\n size[0] = Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation));\n size[1] = Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation));\n }\n return size;\n };\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n View.prototype.getCenter = function () {\n var center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n };\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n View.prototype.getCenterInternal = function () {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(ViewProperty.CENTER));\n };\n /**\n * @return {Constraints} Constraints.\n */\n View.prototype.getConstraints = function () {\n return this.constraints_;\n };\n /**\n * @param {Array=} opt_hints Destination array.\n * @return {Array} Hint.\n */\n View.prototype.getHints = function (opt_hints) {\n if (opt_hints !== undefined) {\n opt_hints[0] = this.hints_[0];\n opt_hints[1] = this.hints_[1];\n return opt_hints;\n }\n else {\n return this.hints_.slice();\n }\n };\n /**\n * Calculate the extent for the current view state and the passed size.\n * The size is the pixel dimensions of the box into which the calculated extent\n * should fit. In most cases you want to get the extent of the entire map,\n * that is `map.getSize()`.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size. If not provided, the size of the\n * first map that uses this view will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n View.prototype.calculateExtent = function (opt_size) {\n var extent = this.calculateExtentInternal(opt_size);\n return toUserExtent(extent, this.getProjection());\n };\n /**\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size. If not provided, the size of the\n * first map that uses this view will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n View.prototype.calculateExtentInternal = function (opt_size) {\n var size = opt_size || this.getSizeFromViewport_();\n var center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (this.getCenterInternal());\n assert(center, 1); // The view center is not defined\n var resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 2); // The view resolution is not defined\n var rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 3); // The view rotation is not defined\n return getForViewAndSize(center, resolution, rotation, size);\n };\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n View.prototype.getMaxResolution = function () {\n return this.maxResolution_;\n };\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n View.prototype.getMinResolution = function () {\n return this.minResolution_;\n };\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n View.prototype.getMaxZoom = function () {\n return /** @type {number} */ (this.getZoomForResolution(this.minResolution_));\n };\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n View.prototype.setMaxZoom = function (zoom) {\n this.applyOptions_(this.getUpdatedOptions_({ maxZoom: zoom }));\n };\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n View.prototype.getMinZoom = function () {\n return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_));\n };\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n View.prototype.setMinZoom = function (zoom) {\n this.applyOptions_(this.getUpdatedOptions_({ minZoom: zoom }));\n };\n /**\n * Set whether the view shoud allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n View.prototype.setConstrainResolution = function (enabled) {\n this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: enabled }));\n };\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n View.prototype.getProjection = function () {\n return this.projection_;\n };\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n View.prototype.getResolution = function () {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n };\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array|undefined} The resolutions of the view.\n * @api\n */\n View.prototype.getResolutions = function () {\n return this.resolutions_;\n };\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n View.prototype.getResolutionForExtent = function (extent, opt_size) {\n return this.getResolutionForExtentInternal(fromUserExtent(extent, this.getProjection()), opt_size);\n };\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n View.prototype.getResolutionForExtentInternal = function (extent, opt_size) {\n var size = opt_size || this.getSizeFromViewport_();\n var xResolution = getWidth(extent) / size[0];\n var yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n };\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number=} opt_power Power.\n * @return {function(number): number} Resolution for value function.\n */\n View.prototype.getResolutionForValueFunction = function (opt_power) {\n var power = opt_power || 2;\n var maxResolution = this.maxResolution_;\n var minResolution = this.minResolution_;\n var max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n var resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n });\n };\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n View.prototype.getRotation = function () {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n };\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number=} opt_power Power.\n * @return {function(number): number} Value for resolution function.\n */\n View.prototype.getValueForResolutionFunction = function (opt_power) {\n var power = opt_power || 2;\n var maxResolution = this.maxResolution_;\n var minResolution = this.minResolution_;\n var max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n var value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;\n return value;\n });\n };\n /**\n * @return {State} View state.\n */\n View.prototype.getState = function () {\n var center = /** @type {import(\"./coordinate.js\").Coordinate} */ (this.getCenterInternal());\n var projection = this.getProjection();\n var resolution = /** @type {number} */ (this.getResolution());\n var rotation = this.getRotation();\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n rotation: rotation,\n zoom: this.getZoom()\n };\n };\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n View.prototype.getZoom = function () {\n var zoom;\n var resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n };\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n View.prototype.getZoomForResolution = function (resolution) {\n var offset = this.minZoom_ || 0;\n var max, zoomFactor;\n if (this.resolutions_) {\n var nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n }\n else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n }\n else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n };\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n View.prototype.getResolutionForZoom = function (zoom) {\n if (this.resolutions_) {\n if (this.resolutions_.length <= 1) {\n return 0;\n }\n var baseLevel = clamp(Math.floor(zoom), 0, this.resolutions_.length - 2);\n var zoomFactor = this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return this.resolutions_[baseLevel] / Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1));\n }\n else {\n return this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_);\n }\n };\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions=} opt_options Options.\n * @api\n */\n View.prototype.fit = function (geometryOrExtent, opt_options) {\n var options = assign({ size: this.getSizeFromViewport_() }, opt_options || {});\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n var geometry;\n assert(Array.isArray(geometryOrExtent) || typeof /** @type {?} */ (geometryOrExtent).getSimplifiedGeometry === 'function', 24); // Invalid extent or geometry provided as `geometry`\n if (Array.isArray(geometryOrExtent)) {\n assert(!isEmpty(geometryOrExtent), 25); // Cannot fit empty extent provided as `geometry`\n var extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n }\n else if (geometryOrExtent.getType() === GeometryType.CIRCLE) {\n var extent = fromUserExtent(geometryOrExtent.getExtent(), this.getProjection());\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n }\n else {\n var userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry.clone().transform(userProjection, this.getProjection()));\n }\n else {\n geometry = geometryOrExtent;\n }\n }\n this.fitInternal(geometry, options);\n };\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions=} opt_options Options.\n */\n View.prototype.fitInternal = function (geometry, opt_options) {\n var options = opt_options || {};\n var size = options.size;\n if (!size) {\n size = this.getSizeFromViewport_();\n }\n var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n var nearest = options.nearest !== undefined ? options.nearest : false;\n var minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n }\n else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n }\n else {\n minResolution = 0;\n }\n var coords = geometry.getFlatCoordinates();\n // calculate rotated extent\n var rotation = this.getRotation();\n var cosAngle = Math.cos(-rotation);\n var sinAngle = Math.sin(-rotation);\n var minRotX = +Infinity;\n var minRotY = +Infinity;\n var maxRotX = -Infinity;\n var maxRotY = -Infinity;\n var stride = geometry.getStride();\n for (var i = 0, ii = coords.length; i < ii; i += stride) {\n var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n // calculate resolution\n var resolution = this.getResolutionForExtentInternal([minRotX, minRotY, maxRotX, maxRotY], [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]);\n resolution = isNaN(resolution) ? minResolution :\n Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n // calculate center\n sinAngle = -sinAngle; // go back to original rotation\n var centerRotX = (minRotX + maxRotX) / 2;\n var centerRotY = (minRotY + maxRotY) / 2;\n centerRotX += (padding[1] - padding[3]) / 2 * resolution;\n centerRotY += (padding[0] - padding[2]) / 2 * resolution;\n var centerX = centerRotX * cosAngle - centerRotY * sinAngle;\n var centerY = centerRotY * cosAngle + centerRotX * sinAngle;\n var center = [centerX, centerY];\n var callback = options.callback ? options.callback : VOID;\n if (options.duration !== undefined) {\n this.animateInternal({\n resolution: resolution,\n center: this.getConstrainedCenter(center, resolution),\n duration: options.duration,\n easing: options.easing\n }, callback);\n }\n else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n };\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n View.prototype.centerOn = function (coordinate, size, position) {\n this.centerOnInternal(fromUserCoordinate(coordinate, this.getProjection()), size, position);\n };\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n View.prototype.centerOnInternal = function (coordinate, size, position) {\n // calculate rotated position\n var rotation = this.getRotation();\n var cosAngle = Math.cos(-rotation);\n var sinAngle = Math.sin(-rotation);\n var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n var resolution = this.getResolution();\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n var centerX = rotX * cosAngle - rotY * sinAngle;\n var centerY = rotY * cosAngle + rotX * sinAngle;\n this.setCenterInternal([centerX, centerY]);\n };\n /**\n * @return {boolean} Is defined.\n */\n View.prototype.isDef = function () {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n };\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n View.prototype.adjustCenter = function (deltaCoordinates) {\n var center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]);\n };\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n View.prototype.adjustCenterInternal = function (deltaCoordinates) {\n var center = this.targetCenter_;\n this.setCenterInternal([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]);\n };\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n View.prototype.adjustResolution = function (ratio, opt_anchor) {\n var anchor = opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n };\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n View.prototype.adjustResolutionInternal = function (ratio, opt_anchor) {\n var isMoving = this.getAnimating() || this.getInteracting();\n var size = this.getSizeFromViewport_(this.getRotation());\n var newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);\n if (opt_anchor !== undefined) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);\n }\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n };\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n View.prototype.adjustZoom = function (delta, opt_anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), opt_anchor);\n };\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The rotation center.\n * @api\n */\n View.prototype.adjustRotation = function (delta, opt_anchor) {\n if (opt_anchor) {\n opt_anchor = fromUserCoordinate(opt_anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, opt_anchor);\n };\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The rotation center.\n */\n View.prototype.adjustRotationInternal = function (delta, opt_anchor) {\n var isMoving = this.getAnimating() || this.getInteracting();\n var newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);\n if (opt_anchor !== undefined) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n };\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n View.prototype.setCenter = function (center) {\n this.setCenterInternal(fromUserCoordinate(center, this.getProjection()));\n };\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n View.prototype.setCenterInternal = function (center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n };\n /**\n * @param {ViewHint} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n View.prototype.setHint = function (hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n };\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n View.prototype.setResolution = function (resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n };\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n View.prototype.setRotation = function (rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n };\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n View.prototype.setZoom = function (zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n };\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean=} opt_doNotCancelAnims Do not cancel animations.\n * @param {boolean=} opt_forceMoving Apply constraints as if the view is moving.\n * @private\n */\n View.prototype.applyTargetState_ = function (opt_doNotCancelAnims, opt_forceMoving) {\n var isMoving = this.getAnimating() || this.getInteracting() || opt_forceMoving;\n // compute rotation\n var newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);\n var size = this.getSizeFromViewport_(newRotation);\n var newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);\n var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving);\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n }\n if (!this.get(ViewProperty.CENTER) || !equals(this.get(ViewProperty.CENTER), newCenter)) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n if (this.getAnimating() && !opt_doNotCancelAnims) {\n this.cancelAnimations();\n }\n };\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number=} opt_duration The animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n View.prototype.resolveConstraints = function (opt_duration, opt_resolutionDirection, opt_anchor) {\n var duration = opt_duration !== undefined ? opt_duration : 200;\n var direction = opt_resolutionDirection || 0;\n var newRotation = this.constraints_.rotation(this.targetRotation_);\n var size = this.getSizeFromViewport_(newRotation);\n var newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);\n var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size);\n if (duration === 0) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n if (this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: opt_anchor\n });\n }\n };\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n View.prototype.beginInteraction = function () {\n this.resolveConstraints(0);\n this.setHint(ViewHint.INTERACTING, 1);\n };\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number=} opt_duration Animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n View.prototype.endInteraction = function (opt_duration, opt_resolutionDirection, opt_anchor) {\n var anchor = opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());\n this.endInteractionInternal(opt_duration, opt_resolutionDirection, anchor);\n };\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number=} opt_duration Animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n View.prototype.endInteractionInternal = function (opt_duration, opt_resolutionDirection, opt_anchor) {\n this.setHint(ViewHint.INTERACTING, -1);\n this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor);\n };\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number=} opt_targetResolution Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n View.prototype.getConstrainedCenter = function (targetCenter, opt_targetResolution) {\n var size = this.getSizeFromViewport_(this.getRotation());\n return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);\n };\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number=} [opt_direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n View.prototype.getConstrainedZoom = function (targetZoom, opt_direction) {\n var targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(this.getConstrainedResolution(targetRes, opt_direction));\n };\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number=} [opt_direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n View.prototype.getConstrainedResolution = function (targetResolution, opt_direction) {\n var direction = opt_direction || 0;\n var size = this.getSizeFromViewport_(this.getRotation());\n return this.constraints_.resolution(targetResolution, direction, size);\n };\n return View;\n}(BaseObject));\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n var smooth = options.smoothExtentConstraint !== undefined ? options.smoothExtentConstraint : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n var projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n var extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n return centerNone;\n}\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n var resolutionConstraint;\n var maxResolution;\n var minResolution;\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n var defaultMaxZoom = 28;\n var defaultZoomFactor = 2;\n var minZoom = options.minZoom !== undefined ?\n options.minZoom : DEFAULT_MIN_ZOOM;\n var maxZoom = options.maxZoom !== undefined ?\n options.maxZoom : defaultMaxZoom;\n var zoomFactor = options.zoomFactor !== undefined ?\n options.zoomFactor : defaultZoomFactor;\n var multiWorld = options.multiWorld !== undefined ?\n options.multiWorld : false;\n var smooth = options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;\n var projection = createProjection(options.projection, 'EPSG:3857');\n var projExtent = projection.getExtent();\n var constrainOnlyCenter = options.constrainOnlyCenter;\n var extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n if (options.resolutions !== undefined) {\n var resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution = resolutions[maxZoom] !== undefined ?\n resolutions[maxZoom] : resolutions[resolutions.length - 1];\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(resolutions, smooth, !constrainOnlyCenter && extent);\n }\n else {\n resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);\n }\n }\n else {\n // calculate the default min and max resolution\n var size = !projExtent ?\n // use an extent that can fit the whole world if need be\n 360 * METERS_PER_UNIT[Units.DEGREES] /\n projection.getMetersPerUnit() :\n Math.max(getWidth(projExtent), getHeight(projExtent));\n var defaultMaxResolution = size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n var defaultMinResolution = defaultMaxResolution / Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n }\n else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n }\n else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n }\n else {\n minResolution = defaultMinResolution;\n }\n }\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom = minZoom + Math.floor(Math.log(maxResolution / minResolution) / Math.log(zoomFactor));\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);\n }\n else {\n resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent);\n }\n }\n return { constraint: resolutionConstraint, maxResolution: maxResolution,\n minResolution: minResolution, minZoom: minZoom, zoomFactor: zoomFactor };\n}\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n var enableRotation = options.enableRotation !== undefined ?\n options.enableRotation : true;\n if (enableRotation) {\n var constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n }\n else if (constrainRotation === false) {\n return rotationNone;\n }\n else if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n }\n else {\n return rotationNone;\n }\n }\n else {\n return disable;\n }\n}\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\nexport default View;\n//# sourceMappingURL=View.js.map","/**\n * @module ol/dom\n */\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number=} opt_width Canvas width.\n * @param {number=} opt_height Canvas height.\n * @return {CanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(opt_width, opt_height) {\n var canvas = document.createElement('canvas');\n if (opt_width) {\n canvas.width = opt_width;\n }\n if (opt_height) {\n canvas.height = opt_height;\n }\n return canvas.getContext('2d');\n}\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n var width = element.offsetWidth;\n var style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n return width;\n}\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n var height = element.offsetHeight;\n var style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n return height;\n}\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n var parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n/**\n * @param {Node} node The node to remove.\n * @returns {Node} The node that was removed or null.\n */\nexport function removeNode(node) {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n}\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n}\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array} children The desired children.\n */\nexport function replaceChildren(node, children) {\n var oldChildren = node.childNodes;\n for (var i = 0; true; ++i) {\n var oldChild = oldChildren[i];\n var newChild = children[i];\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n//# sourceMappingURL=dom.js.map","/**\n * @module ol/layer/Property\n */\n/**\n * @enum {string}\n */\nexport default {\n OPACITY: 'opacity',\n VISIBLE: 'visible',\n EXTENT: 'extent',\n Z_INDEX: 'zIndex',\n MAX_RESOLUTION: 'maxResolution',\n MIN_RESOLUTION: 'minResolution',\n MAX_ZOOM: 'maxZoom',\n MIN_ZOOM: 'minZoom',\n SOURCE: 'source'\n};\n//# sourceMappingURL=Property.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/layer/Base\n */\nimport { abstract } from '../util.js';\nimport BaseObject from '../Object.js';\nimport LayerProperty from './Property.js';\nimport { clamp } from '../math.js';\nimport { assign } from '../obj.js';\nimport { assert } from '../asserts.js';\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n */\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in\n * the options is set as a {@link module:ol/Object} property on the layer object, so\n * is observable, and has get/set accessors.\n *\n * @api\n */\nvar BaseLayer = /** @class */ (function (_super) {\n __extends(BaseLayer, _super);\n /**\n * @param {Options} options Layer options.\n */\n function BaseLayer(options) {\n var _this = _super.call(this) || this;\n /**\n * @type {Object}\n */\n var properties = assign({}, options);\n properties[LayerProperty.OPACITY] =\n options.opacity !== undefined ? options.opacity : 1;\n assert(typeof properties[LayerProperty.OPACITY] === 'number', 64); // Layer opacity must be a number\n properties[LayerProperty.VISIBLE] =\n options.visible !== undefined ? options.visible : true;\n properties[LayerProperty.Z_INDEX] = options.zIndex;\n properties[LayerProperty.MAX_RESOLUTION] =\n options.maxResolution !== undefined ? options.maxResolution : Infinity;\n properties[LayerProperty.MIN_RESOLUTION] =\n options.minResolution !== undefined ? options.minResolution : 0;\n properties[LayerProperty.MIN_ZOOM] =\n options.minZoom !== undefined ? options.minZoom : -Infinity;\n properties[LayerProperty.MAX_ZOOM] =\n options.maxZoom !== undefined ? options.maxZoom : Infinity;\n /**\n * @type {string}\n * @private\n */\n _this.className_ = properties.className !== undefined ? options.className : 'ol-layer';\n delete properties.className;\n _this.setProperties(properties);\n /**\n * @type {import(\"./Layer.js\").State}\n * @private\n */\n _this.state_ = null;\n return _this;\n }\n /**\n * @return {string} CSS class name.\n */\n BaseLayer.prototype.getClassName = function () {\n return this.className_;\n };\n /**\n * This method is not meant to be called by layers or layer renderers because the state\n * is incorrect if the layer is included in a layer group.\n *\n * @param {boolean=} opt_managed Layer is managed.\n * @return {import(\"./Layer.js\").State} Layer state.\n */\n BaseLayer.prototype.getLayerState = function (opt_managed) {\n /** @type {import(\"./Layer.js\").State} */\n var state = this.state_ || /** @type {?} */ ({\n layer: this,\n managed: opt_managed === undefined ? true : opt_managed\n });\n var zIndex = this.getZIndex();\n state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);\n state.sourceState = this.getSourceState();\n state.visible = this.getVisible();\n state.extent = this.getExtent();\n state.zIndex = zIndex !== undefined ? zIndex : (state.managed === false ? Infinity : 0);\n state.maxResolution = this.getMaxResolution();\n state.minResolution = Math.max(this.getMinResolution(), 0);\n state.minZoom = this.getMinZoom();\n state.maxZoom = this.getMaxZoom();\n this.state_ = state;\n return state;\n };\n /**\n * @abstract\n * @param {Array=} opt_array Array of layers (to be\n * modified in place).\n * @return {Array} Array of layers.\n */\n BaseLayer.prototype.getLayersArray = function (opt_array) {\n return abstract();\n };\n /**\n * @abstract\n * @param {Array=} opt_states Optional list of layer\n * states (to be modified in place).\n * @return {Array} List of layer states.\n */\n BaseLayer.prototype.getLayerStatesArray = function (opt_states) {\n return abstract();\n };\n /**\n * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it\n * will be visible regardless of extent.\n * @return {import(\"../extent.js\").Extent|undefined} The layer extent.\n * @observable\n * @api\n */\n BaseLayer.prototype.getExtent = function () {\n return (\n /** @type {import(\"../extent.js\").Extent|undefined} */ (this.get(LayerProperty.EXTENT)));\n };\n /**\n * Return the maximum resolution of the layer.\n * @return {number} The maximum resolution of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getMaxResolution = function () {\n return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));\n };\n /**\n * Return the minimum resolution of the layer.\n * @return {number} The minimum resolution of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getMinResolution = function () {\n return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));\n };\n /**\n * Return the minimum zoom level of the layer.\n * @return {number} The minimum zoom level of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getMinZoom = function () {\n return /** @type {number} */ (this.get(LayerProperty.MIN_ZOOM));\n };\n /**\n * Return the maximum zoom level of the layer.\n * @return {number} The maximum zoom level of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getMaxZoom = function () {\n return /** @type {number} */ (this.get(LayerProperty.MAX_ZOOM));\n };\n /**\n * Return the opacity of the layer (between 0 and 1).\n * @return {number} The opacity of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getOpacity = function () {\n return /** @type {number} */ (this.get(LayerProperty.OPACITY));\n };\n /**\n * @abstract\n * @return {import(\"../source/State.js\").default} Source state.\n */\n BaseLayer.prototype.getSourceState = function () {\n return abstract();\n };\n /**\n * Return the visibility of the layer (`true` or `false`).\n * @return {boolean} The visibility of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getVisible = function () {\n return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));\n };\n /**\n * Return the Z-index of the layer, which is used to order layers before\n * rendering. The default Z-index is 0.\n * @return {number} The Z-index of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.getZIndex = function () {\n return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));\n };\n /**\n * Set the extent at which the layer is visible. If `undefined`, the layer\n * will be visible at all extents.\n * @param {import(\"../extent.js\").Extent|undefined} extent The extent of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setExtent = function (extent) {\n this.set(LayerProperty.EXTENT, extent);\n };\n /**\n * Set the maximum resolution at which the layer is visible.\n * @param {number} maxResolution The maximum resolution of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setMaxResolution = function (maxResolution) {\n this.set(LayerProperty.MAX_RESOLUTION, maxResolution);\n };\n /**\n * Set the minimum resolution at which the layer is visible.\n * @param {number} minResolution The minimum resolution of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setMinResolution = function (minResolution) {\n this.set(LayerProperty.MIN_RESOLUTION, minResolution);\n };\n /**\n * Set the maximum zoom (exclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} maxZoom The maximum zoom of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setMaxZoom = function (maxZoom) {\n this.set(LayerProperty.MAX_ZOOM, maxZoom);\n };\n /**\n * Set the minimum zoom (inclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} minZoom The minimum zoom of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setMinZoom = function (minZoom) {\n this.set(LayerProperty.MIN_ZOOM, minZoom);\n };\n /**\n * Set the opacity of the layer, allowed values range from 0 to 1.\n * @param {number} opacity The opacity of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setOpacity = function (opacity) {\n assert(typeof opacity === 'number', 64); // Layer opacity must be a number\n this.set(LayerProperty.OPACITY, opacity);\n };\n /**\n * Set the visibility of the layer (`true` or `false`).\n * @param {boolean} visible The visibility of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setVisible = function (visible) {\n this.set(LayerProperty.VISIBLE, visible);\n };\n /**\n * Set Z-index of the layer, which is used to order layers before rendering.\n * The default Z-index is 0.\n * @param {number} zindex The z-index of the layer.\n * @observable\n * @api\n */\n BaseLayer.prototype.setZIndex = function (zindex) {\n this.set(LayerProperty.Z_INDEX, zindex);\n };\n /**\n * @inheritDoc\n */\n BaseLayer.prototype.disposeInternal = function () {\n if (this.state_) {\n this.state_.layer = null;\n this.state_ = null;\n }\n _super.prototype.disposeInternal.call(this);\n };\n return BaseLayer;\n}(BaseObject));\nexport default BaseLayer;\n//# sourceMappingURL=Base.js.map","/**\n * @module ol/source/State\n */\n/**\n * @enum {string}\n * State of the source, one of 'undefined', 'loading', 'ready' or 'error'.\n */\nexport default {\n UNDEFINED: 'undefined',\n LOADING: 'loading',\n READY: 'ready',\n ERROR: 'error'\n};\n//# sourceMappingURL=State.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/layer/Group\n */\nimport { getUid } from '../util.js';\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport { getChangeEventType } from '../Object.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport { assert } from '../asserts.js';\nimport { listen, unlistenByKey } from '../events.js';\nimport EventType from '../events/EventType.js';\nimport { getIntersection } from '../extent.js';\nimport BaseLayer from './Base.js';\nimport { assign, clear } from '../obj.js';\nimport SourceState from '../source/State.js';\n/**\n * @typedef {Object} Options\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {Array|import(\"../Collection.js\").default} [layers] Child layers.\n */\n/**\n * @enum {string}\n * @private\n */\nvar Property = {\n LAYERS: 'layers'\n};\n/**\n * @classdesc\n * A {@link module:ol/Collection~Collection} of layers that are handled together.\n *\n * A generic `change` event is triggered when the group/Collection changes.\n *\n * @api\n */\nvar LayerGroup = /** @class */ (function (_super) {\n __extends(LayerGroup, _super);\n /**\n * @param {Options=} opt_options Layer options.\n */\n function LayerGroup(opt_options) {\n var _this = this;\n var options = opt_options || {};\n var baseOptions = /** @type {Options} */ (assign({}, options));\n delete baseOptions.layers;\n var layers = options.layers;\n _this = _super.call(this, baseOptions) || this;\n /**\n * @private\n * @type {Array}\n */\n _this.layersListenerKeys_ = [];\n /**\n * @private\n * @type {Object>}\n */\n _this.listenerKeys_ = {};\n _this.addEventListener(getChangeEventType(Property.LAYERS), _this.handleLayersChanged_);\n if (layers) {\n if (Array.isArray(layers)) {\n layers = new Collection(layers.slice(), { unique: true });\n }\n else {\n assert(typeof /** @type {?} */ (layers).getArray === 'function', 43); // Expected `layers` to be an array or a `Collection`\n }\n }\n else {\n layers = new Collection(undefined, { unique: true });\n }\n _this.setLayers(layers);\n return _this;\n }\n /**\n * @private\n */\n LayerGroup.prototype.handleLayerChange_ = function () {\n this.changed();\n };\n /**\n * @private\n */\n LayerGroup.prototype.handleLayersChanged_ = function () {\n this.layersListenerKeys_.forEach(unlistenByKey);\n this.layersListenerKeys_.length = 0;\n var layers = this.getLayers();\n this.layersListenerKeys_.push(listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this), listen(layers, CollectionEventType.REMOVE, this.handleLayersRemove_, this));\n for (var id in this.listenerKeys_) {\n this.listenerKeys_[id].forEach(unlistenByKey);\n }\n clear(this.listenerKeys_);\n var layersArray = layers.getArray();\n for (var i = 0, ii = layersArray.length; i < ii; i++) {\n var layer = layersArray[i];\n this.listenerKeys_[getUid(layer)] = [\n listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this)\n ];\n }\n this.changed();\n };\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n LayerGroup.prototype.handleLayersAdd_ = function (collectionEvent) {\n var layer = /** @type {import(\"./Base.js\").default} */ (collectionEvent.element);\n this.listenerKeys_[getUid(layer)] = [\n listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this)\n ];\n this.changed();\n };\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n LayerGroup.prototype.handleLayersRemove_ = function (collectionEvent) {\n var layer = /** @type {import(\"./Base.js\").default} */ (collectionEvent.element);\n var key = getUid(layer);\n this.listenerKeys_[key].forEach(unlistenByKey);\n delete this.listenerKeys_[key];\n this.changed();\n };\n /**\n * Returns the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @return {!import(\"../Collection.js\").default} Collection of\n * {@link module:ol/layer/Base layers} that are part of this group.\n * @observable\n * @api\n */\n LayerGroup.prototype.getLayers = function () {\n return (\n /** @type {!import(\"../Collection.js\").default} */ (this.get(Property.LAYERS)));\n };\n /**\n * Set the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @param {!import(\"../Collection.js\").default} layers Collection of\n * {@link module:ol/layer/Base layers} that are part of this group.\n * @observable\n * @api\n */\n LayerGroup.prototype.setLayers = function (layers) {\n this.set(Property.LAYERS, layers);\n };\n /**\n * @inheritDoc\n */\n LayerGroup.prototype.getLayersArray = function (opt_array) {\n var array = opt_array !== undefined ? opt_array : [];\n this.getLayers().forEach(function (layer) {\n layer.getLayersArray(array);\n });\n return array;\n };\n /**\n * @inheritDoc\n */\n LayerGroup.prototype.getLayerStatesArray = function (opt_states) {\n var states = opt_states !== undefined ? opt_states : [];\n var pos = states.length;\n this.getLayers().forEach(function (layer) {\n layer.getLayerStatesArray(states);\n });\n var ownLayerState = this.getLayerState();\n for (var i = pos, ii = states.length; i < ii; i++) {\n var layerState = states[i];\n layerState.opacity *= ownLayerState.opacity;\n layerState.visible = layerState.visible && ownLayerState.visible;\n layerState.maxResolution = Math.min(layerState.maxResolution, ownLayerState.maxResolution);\n layerState.minResolution = Math.max(layerState.minResolution, ownLayerState.minResolution);\n layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);\n layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);\n if (ownLayerState.extent !== undefined) {\n if (layerState.extent !== undefined) {\n layerState.extent = getIntersection(layerState.extent, ownLayerState.extent);\n }\n else {\n layerState.extent = ownLayerState.extent;\n }\n }\n }\n return states;\n };\n /**\n * @inheritDoc\n */\n LayerGroup.prototype.getSourceState = function () {\n return SourceState.READY;\n };\n return LayerGroup;\n}(BaseLayer));\nexport default LayerGroup;\n//# sourceMappingURL=Group.js.map","/**\n * @module ol/size\n */\n/**\n * An array of numbers representing a size: `[width, height]`.\n * @typedef {Array} Size\n * @api\n */\n/**\n * Returns a buffered size.\n * @param {Size} size Size.\n * @param {number} num The amount by which to buffer.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} The buffered size.\n */\nexport function buffer(size, num, opt_size) {\n if (opt_size === undefined) {\n opt_size = [0, 0];\n }\n opt_size[0] = size[0] + 2 * num;\n opt_size[1] = size[1] + 2 * num;\n return opt_size;\n}\n/**\n * Determines if a size has a positive area.\n * @param {Size} size The size to test.\n * @return {boolean} The size has a positive area.\n */\nexport function hasArea(size) {\n return size[0] > 0 && size[1] > 0;\n}\n/**\n * Returns a size scaled by a ratio. The result will be an array of integers.\n * @param {Size} size Size.\n * @param {number} ratio Ratio.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} The scaled size.\n */\nexport function scale(size, ratio, opt_size) {\n if (opt_size === undefined) {\n opt_size = [0, 0];\n }\n opt_size[0] = (size[0] * ratio + 0.5) | 0;\n opt_size[1] = (size[1] * ratio + 0.5) | 0;\n return opt_size;\n}\n/**\n * Returns an `Size` array for the passed in number (meaning: square) or\n * `Size` array.\n * (meaning: non-square),\n * @param {number|Size} size Width and height.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} Size.\n * @api\n */\nexport function toSize(size, opt_size) {\n if (Array.isArray(size)) {\n return size;\n }\n else {\n if (opt_size === undefined) {\n opt_size = [size, size];\n }\n else {\n opt_size[0] = size;\n opt_size[1] = size;\n }\n return opt_size;\n }\n}\n//# sourceMappingURL=size.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/PluggableMap\n */\nimport { getUid } from './util.js';\nimport Collection from './Collection.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventHandler from './MapBrowserEventHandler.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapEvent from './MapEvent.js';\nimport MapEventType from './MapEventType.js';\nimport MapProperty from './MapProperty.js';\nimport RenderEventType from './render/EventType.js';\nimport BaseObject, { getChangeEventType } from './Object.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport TileQueue from './TileQueue.js';\nimport View from './View.js';\nimport ViewHint from './ViewHint.js';\nimport { assert } from './asserts.js';\nimport { removeNode } from './dom.js';\nimport { listen, unlistenByKey } from './events.js';\nimport EventType from './events/EventType.js';\nimport { clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty } from './extent.js';\nimport { TRUE } from './functions.js';\nimport { DEVICE_PIXEL_RATIO, IMAGE_DECODE } from './has.js';\nimport LayerGroup from './layer/Group.js';\nimport { hasArea } from './size.js';\nimport { DROP } from './structs/PriorityQueue.js';\nimport { create as createTransform, apply as applyTransform } from './transform.js';\nimport { toUserCoordinate, fromUserCoordinate } from './proj.js';\n/**\n * State of the current frame. Only `pixelRatio`, `time` and `viewState` should\n * be used in applications.\n * @typedef {Object} FrameState\n * @property {number} pixelRatio The pixel ratio of the frame.\n * @property {number} time The time when rendering of the frame was requested.\n * @property {import(\"./View.js\").State} viewState The state of the current view.\n * @property {boolean} animate\n * @property {import(\"./transform.js\").Transform} coordinateToPixelTransform\n * @property {null|import(\"./extent.js\").Extent} extent\n * @property {Array} declutterItems\n * @property {number} index\n * @property {Array} layerStatesArray\n * @property {number} layerIndex\n * @property {import(\"./transform.js\").Transform} pixelToCoordinateTransform\n * @property {Array} postRenderFunctions\n * @property {import(\"./size.js\").Size} size\n * @property {TileQueue} tileQueue\n * @property {!Object>} usedTiles\n * @property {Array} viewHints\n * @property {!Object>} wantedTiles\n */\n/**\n * @typedef {Object} DeclutterItems\n * @property {Array<*>} items Declutter items of an executor.\n * @property {number} opacity Layer opacity.\n */\n/**\n * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction\n */\n/**\n * @typedef {Object} AtPixelOptions\n * @property {undefined|function(import(\"./layer/Layer.js\").default): boolean} [layerFilter] Layer filter\n * function. The filter function will receive one argument, the\n * {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value.\n * Only layers which are visible and for which this function returns `true`\n * will be tested for features. By default, all visible layers will be tested.\n * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels\n * inside the radius around the given position will be checked for features.\n * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for for wrapped geometries inside the range of\n * +/- 1 world width. Works only if a projection is used that can be wrapped.\n */\n/**\n * @typedef {Object} MapOptionsInternal\n * @property {Collection} [controls]\n * @property {Collection} [interactions]\n * @property {HTMLElement|Document} keyboardEventTarget\n * @property {Collection} overlays\n * @property {Object} values\n */\n/**\n * Object literal with config options for the map.\n * @typedef {Object} MapOptions\n * @property {Collection|Array} [controls]\n * Controls initially added to the map. If not specified,\n * {@link module:ol/control~defaults} is used.\n * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between\n * physical pixels and device-independent pixels (dips) on the device.\n * @property {Collection|Array} [interactions]\n * Interactions that are initially added to the map. If not specified,\n * {@link module:ol/interaction~defaults} is used.\n * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to\n * listen to keyboard events on. This determines when the `KeyboardPan` and\n * `KeyboardZoom` interactions trigger. For example, if this option is set to\n * `document` the keyboard interactions will always trigger. If this option is\n * not specified, the element the library listens to keyboard events on is the\n * map target (i.e. the user-provided div for the map). If this is not\n * `document`, the target element needs to be focused for key events to be\n * emitted, requiring that the target element has a `tabindex` attribute.\n * @property {Array|Collection|LayerGroup} [layers]\n * Layers. If this is not defined, a map with no layers will be rendered. Note\n * that layers are rendered in the order supplied, so if you want, for example,\n * a vector layer to appear on top of a tile layer, it must come after the tile\n * layer.\n * @property {number} [maxTilesLoading=16] Maximum number tiles to load\n * simultaneously.\n * @property {number} [moveTolerance=1] The minimum distance in pixels the\n * cursor must move to be detected as a map move event instead of a click.\n * Increasing this value can make it easier to click on the map.\n * @property {Collection|Array} [overlays]\n * Overlays initially added to the map. By default, no overlays are added.\n * @property {HTMLElement|string} [target] The container for the map, either the\n * element itself or the `id` of the element. If not specified at construction\n * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be\n * rendered.\n * @property {View} [view] The map's view. No layer sources will be\n * fetched unless this is specified at construction time or through\n * {@link module:ol/Map~Map#setView}.\n */\n/**\n * @param {HTMLElement} element Element.\n * @param {string} touchAction Value for `touch-action'.\n */\nfunction setTouchAction(element, touchAction) {\n element.style.msTouchAction = touchAction;\n element.style.touchAction = touchAction;\n element.setAttribute('touch-action', touchAction);\n}\n/**\n * @fires import(\"./MapBrowserEvent.js\").MapBrowserEvent\n * @fires import(\"./MapEvent.js\").MapEvent\n * @fires import(\"./render/Event.js\").default#precompose\n * @fires import(\"./render/Event.js\").default#postcompose\n * @fires import(\"./render/Event.js\").default#rendercomplete\n * @api\n */\nvar PluggableMap = /** @class */ (function (_super) {\n __extends(PluggableMap, _super);\n /**\n * @param {MapOptions} options Map options.\n */\n function PluggableMap(options) {\n var _this = _super.call(this) || this;\n var optionsInternal = createOptionsInternal(options);\n /** @private */\n _this.boundHandleBrowserEvent_ = _this.handleBrowserEvent.bind(_this);\n /**\n * @type {number}\n * @private\n */\n _this.maxTilesLoading_ = options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;\n /**\n * @private\n * @type {number}\n */\n _this.pixelRatio_ = options.pixelRatio !== undefined ?\n options.pixelRatio : DEVICE_PIXEL_RATIO;\n /**\n * @private\n * @type {*}\n */\n _this.postRenderTimeoutHandle_;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.animationDelayKey_;\n /**\n * @private\n */\n _this.animationDelay_ = function () {\n this.animationDelayKey_ = undefined;\n this.renderFrame_(Date.now());\n }.bind(_this);\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n _this.coordinateToPixelTransform_ = createTransform();\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n _this.pixelToCoordinateTransform_ = createTransform();\n /**\n * @private\n * @type {number}\n */\n _this.frameIndex_ = 0;\n /**\n * @private\n * @type {?FrameState}\n */\n _this.frameState_ = null;\n /**\n * The extent at the previous 'moveend' event.\n * @private\n * @type {import(\"./extent.js\").Extent}\n */\n _this.previousExtent_ = null;\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n _this.viewPropertyListenerKey_ = null;\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n _this.viewChangeListenerKey_ = null;\n /**\n * @private\n * @type {?Array}\n */\n _this.layerGroupPropertyListenerKeys_ = null;\n /**\n * @private\n * @type {!HTMLElement}\n */\n _this.viewport_ = document.createElement('div');\n _this.viewport_.className = 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');\n _this.viewport_.style.position = 'relative';\n _this.viewport_.style.overflow = 'hidden';\n _this.viewport_.style.width = '100%';\n _this.viewport_.style.height = '100%';\n /**\n * @private\n * @type {!HTMLElement}\n */\n _this.overlayContainer_ = document.createElement('div');\n _this.overlayContainer_.style.position = 'absolute';\n _this.overlayContainer_.style.zIndex = '0';\n _this.overlayContainer_.style.width = '100%';\n _this.overlayContainer_.style.height = '100%';\n _this.overlayContainer_.className = 'ol-overlaycontainer';\n _this.viewport_.appendChild(_this.overlayContainer_);\n /**\n * @private\n * @type {!HTMLElement}\n */\n _this.overlayContainerStopEvent_ = document.createElement('div');\n _this.overlayContainerStopEvent_.style.position = 'absolute';\n _this.overlayContainerStopEvent_.style.zIndex = '0';\n _this.overlayContainerStopEvent_.style.width = '100%';\n _this.overlayContainerStopEvent_.style.height = '100%';\n _this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';\n _this.viewport_.appendChild(_this.overlayContainerStopEvent_);\n /**\n * @private\n * @type {MapBrowserEventHandler}\n */\n _this.mapBrowserEventHandler_ = new MapBrowserEventHandler(_this, options.moveTolerance);\n var handleMapBrowserEvent = _this.handleMapBrowserEvent.bind(_this);\n for (var key in MapBrowserEventType) {\n _this.mapBrowserEventHandler_.addEventListener(MapBrowserEventType[key], handleMapBrowserEvent);\n }\n /**\n * @private\n * @type {HTMLElement|Document}\n */\n _this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;\n /**\n * @private\n * @type {?Array}\n */\n _this.keyHandlerKeys_ = null;\n /**\n * @private\n * @type {?Array}\n */\n _this.focusHandlerKeys_ = null;\n var handleBrowserEvent = _this.handleBrowserEvent.bind(_this);\n _this.viewport_.addEventListener(EventType.CONTEXTMENU, handleBrowserEvent, false);\n _this.viewport_.addEventListener(EventType.WHEEL, handleBrowserEvent, false);\n /**\n * @type {Collection}\n * @protected\n */\n _this.controls = optionsInternal.controls || new Collection();\n /**\n * @type {Collection}\n * @protected\n */\n _this.interactions = optionsInternal.interactions || new Collection();\n /**\n * @type {Collection}\n * @private\n */\n _this.overlays_ = optionsInternal.overlays;\n /**\n * A lookup of overlays by id.\n * @private\n * @type {Object}\n */\n _this.overlayIdIndex_ = {};\n /**\n * @type {import(\"./renderer/Map.js\").default}\n * @private\n */\n _this.renderer_ = null;\n /**\n * @type {undefined|function(Event): void}\n * @private\n */\n _this.handleResize_;\n /**\n * @private\n * @type {!Array}\n */\n _this.postRenderFunctions_ = [];\n /**\n * @private\n * @type {TileQueue}\n */\n _this.tileQueue_ = new TileQueue(_this.getTilePriority.bind(_this), _this.handleTileChange_.bind(_this));\n _this.addEventListener(getChangeEventType(MapProperty.LAYERGROUP), _this.handleLayerGroupChanged_);\n _this.addEventListener(getChangeEventType(MapProperty.VIEW), _this.handleViewChanged_);\n _this.addEventListener(getChangeEventType(MapProperty.SIZE), _this.handleSizeChanged_);\n _this.addEventListener(getChangeEventType(MapProperty.TARGET), _this.handleTargetChanged_);\n // setProperties will trigger the rendering of the map if the map\n // is \"defined\" already.\n _this.setProperties(optionsInternal.values);\n _this.controls.forEach(\n /**\n * @param {import(\"./control/Control.js\").default} control Control.\n * @this {PluggableMap}\n */\n function (control) {\n control.setMap(this);\n }.bind(_this));\n _this.controls.addEventListener(CollectionEventType.ADD, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(this);\n }.bind(_this));\n _this.controls.addEventListener(CollectionEventType.REMOVE, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(null);\n }.bind(_this));\n _this.interactions.forEach(\n /**\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction.\n * @this {PluggableMap}\n */\n function (interaction) {\n interaction.setMap(this);\n }.bind(_this));\n _this.interactions.addEventListener(CollectionEventType.ADD, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(this);\n }.bind(_this));\n _this.interactions.addEventListener(CollectionEventType.REMOVE, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(null);\n }.bind(_this));\n _this.overlays_.forEach(_this.addOverlayInternal_.bind(_this));\n _this.overlays_.addEventListener(CollectionEventType.ADD, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n this.addOverlayInternal_(/** @type {import(\"./Overlay.js\").default} */ (event.element));\n }.bind(_this));\n _this.overlays_.addEventListener(CollectionEventType.REMOVE, \n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n var overlay = /** @type {import(\"./Overlay.js\").default} */ (event.element);\n var id = overlay.getId();\n if (id !== undefined) {\n delete this.overlayIdIndex_[id.toString()];\n }\n event.element.setMap(null);\n }.bind(_this));\n return _this;\n }\n /**\n * @abstract\n * @return {import(\"./renderer/Map.js\").default} The map renderer\n */\n PluggableMap.prototype.createRenderer = function () {\n throw new Error('Use a map type that has a createRenderer method');\n };\n /**\n * Add the given control to the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @api\n */\n PluggableMap.prototype.addControl = function (control) {\n this.getControls().push(control);\n };\n /**\n * Add the given interaction to the map. If you want to add an interaction\n * at another point of the collection use `getInteraction()` and the methods\n * available on {@link module:ol/Collection~Collection}. This can be used to\n * stop the event propagation from the handleEvent function. The interactions\n * get to handle the events in the reverse order of this collection.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to add.\n * @api\n */\n PluggableMap.prototype.addInteraction = function (interaction) {\n this.getInteractions().push(interaction);\n };\n /**\n * Adds the given layer to the top of this map. If you want to add a layer\n * elsewhere in the stack, use `getLayers()` and the methods available on\n * {@link module:ol/Collection~Collection}.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @api\n */\n PluggableMap.prototype.addLayer = function (layer) {\n var layers = this.getLayerGroup().getLayers();\n layers.push(layer);\n };\n /**\n * Add the given overlay to the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @api\n */\n PluggableMap.prototype.addOverlay = function (overlay) {\n this.getOverlays().push(overlay);\n };\n /**\n * This deals with map's overlay collection changes.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @private\n */\n PluggableMap.prototype.addOverlayInternal_ = function (overlay) {\n var id = overlay.getId();\n if (id !== undefined) {\n this.overlayIdIndex_[id.toString()] = overlay;\n }\n overlay.setMap(this);\n };\n /**\n *\n * @inheritDoc\n */\n PluggableMap.prototype.disposeInternal = function () {\n this.mapBrowserEventHandler_.dispose();\n this.viewport_.removeEventListener(EventType.CONTEXTMENU, this.boundHandleBrowserEvent_);\n this.viewport_.removeEventListener(EventType.WHEEL, this.boundHandleBrowserEvent_);\n if (this.handleResize_ !== undefined) {\n removeEventListener(EventType.RESIZE, this.handleResize_, false);\n this.handleResize_ = undefined;\n }\n this.setTarget(null);\n _super.prototype.disposeInternal.call(this);\n };\n /**\n * Detect features that intersect a pixel on the viewport, and execute a\n * callback with each intersecting feature. Layers included in the detection can\n * be configured through the `layerFilter` option in `opt_options`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(this: S, import(\"./Feature.js\").FeatureLike,\n * import(\"./layer/Layer.js\").default): T} callback Feature callback. The callback will be\n * called with two arguments. The first argument is one\n * {@link module:ol/Feature feature} or\n * {@link module:ol/render/Feature render feature} at the pixel, the second is\n * the {@link module:ol/layer/Layer layer} of the feature and will be null for\n * unmanaged layers. To stop detection, callback functions can return a\n * truthy value.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template S,T\n * @api\n */\n PluggableMap.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options) {\n if (!this.frameState_) {\n return;\n }\n var coordinate = this.getCoordinateFromPixelInternal(pixel);\n opt_options = opt_options !== undefined ? opt_options : {};\n var hitTolerance = opt_options.hitTolerance !== undefined ?\n opt_options.hitTolerance * this.frameState_.pixelRatio : 0;\n var layerFilter = opt_options.layerFilter !== undefined ?\n opt_options.layerFilter : TRUE;\n var checkWrapped = opt_options.checkWrapped !== false;\n return this.renderer_.forEachFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, callback, null, layerFilter, null);\n };\n /**\n * Get all features that intersect a pixel on the viewport.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {Array} The detected features or\n * an empty array if none were found.\n * @api\n */\n PluggableMap.prototype.getFeaturesAtPixel = function (pixel, opt_options) {\n var features = [];\n this.forEachFeatureAtPixel(pixel, function (feature) {\n features.push(feature);\n }, opt_options);\n return features;\n };\n /**\n * Detect layers that have a color value at a pixel on the viewport, and\n * execute a callback with each matching layer. Layers included in the\n * detection can be configured through `opt_layerFilter`.\n *\n * Note: this may give false positives unless the map layers have had different `className`\n * properties assigned to them.\n *\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(this: S, import(\"./layer/Layer.js\").default, (Uint8ClampedArray|Uint8Array)): T} callback\n * Layer callback. This callback will receive two arguments: first is the\n * {@link module:ol/layer/Layer layer}, second argument is an array representing\n * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types\n * that do not currently support this argument. To stop detection, callback\n * functions can return a truthy value.\n * @param {AtPixelOptions=} opt_options Configuration options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template S,T\n * @api\n */\n PluggableMap.prototype.forEachLayerAtPixel = function (pixel, callback, opt_options) {\n if (!this.frameState_) {\n return;\n }\n var options = opt_options || {};\n var hitTolerance = options.hitTolerance !== undefined ?\n options.hitTolerance * this.frameState_.pixelRatio : 0;\n var layerFilter = options.layerFilter || TRUE;\n return this.renderer_.forEachLayerAtPixel(pixel, this.frameState_, hitTolerance, callback, layerFilter);\n };\n /**\n * Detect if features intersect a pixel on the viewport. Layers included in the\n * detection can be configured through `opt_layerFilter`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {boolean} Is there a feature at the given pixel?\n * @api\n */\n PluggableMap.prototype.hasFeatureAtPixel = function (pixel, opt_options) {\n if (!this.frameState_) {\n return false;\n }\n var coordinate = this.getCoordinateFromPixelInternal(pixel);\n opt_options = opt_options !== undefined ? opt_options : {};\n var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;\n var hitTolerance = opt_options.hitTolerance !== undefined ?\n opt_options.hitTolerance * this.frameState_.pixelRatio : 0;\n var checkWrapped = opt_options.checkWrapped !== false;\n return this.renderer_.hasFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, layerFilter, null);\n };\n /**\n * Returns the coordinate in user projection for a browser event.\n * @param {Event} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n PluggableMap.prototype.getEventCoordinate = function (event) {\n return this.getCoordinateFromPixel(this.getEventPixel(event));\n };\n /**\n * Returns the coordinate in view projection for a browser event.\n * @param {Event} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n */\n PluggableMap.prototype.getEventCoordinateInternal = function (event) {\n return this.getCoordinateFromPixelInternal(this.getEventPixel(event));\n };\n /**\n * Returns the map pixel position for a browser event relative to the viewport.\n * @param {Event|TouchEvent} event Event.\n * @return {import(\"./pixel.js\").Pixel} Pixel.\n * @api\n */\n PluggableMap.prototype.getEventPixel = function (event) {\n var viewportPosition = this.viewport_.getBoundingClientRect();\n var eventPosition = 'changedTouches' in event ?\n /** @type {TouchEvent} */ (event).changedTouches[0] :\n /** @type {MouseEvent} */ (event);\n return [\n eventPosition.clientX - viewportPosition.left,\n eventPosition.clientY - viewportPosition.top\n ];\n };\n /**\n * Get the target in which this map is rendered.\n * Note that this returns what is entered as an option or in setTarget:\n * if that was an element, it returns an element; if a string, it returns that.\n * @return {HTMLElement|string|undefined} The Element or id of the Element that the\n * map is rendered in.\n * @observable\n * @api\n */\n PluggableMap.prototype.getTarget = function () {\n return /** @type {HTMLElement|string|undefined} */ (this.get(MapProperty.TARGET));\n };\n /**\n * Get the DOM element into which this map is rendered. In contrast to\n * `getTarget` this method always return an `Element`, or `null` if the\n * map has no target.\n * @return {HTMLElement} The element that the map is rendered in.\n * @api\n */\n PluggableMap.prototype.getTargetElement = function () {\n var target = this.getTarget();\n if (target !== undefined) {\n return typeof target === 'string' ? document.getElementById(target) : target;\n }\n else {\n return null;\n }\n };\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * user projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n * @api\n */\n PluggableMap.prototype.getCoordinateFromPixel = function (pixel) {\n return toUserCoordinate(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection());\n };\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * map view projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n */\n PluggableMap.prototype.getCoordinateFromPixelInternal = function (pixel) {\n var frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n else {\n return applyTransform(frameState.pixelToCoordinateTransform, pixel.slice());\n }\n };\n /**\n * Get the map controls. Modifying this collection changes the controls\n * associated with the map.\n * @return {Collection} Controls.\n * @api\n */\n PluggableMap.prototype.getControls = function () {\n return this.controls;\n };\n /**\n * Get the map overlays. Modifying this collection changes the overlays\n * associated with the map.\n * @return {Collection} Overlays.\n * @api\n */\n PluggableMap.prototype.getOverlays = function () {\n return this.overlays_;\n };\n /**\n * Get an overlay by its identifier (the value returned by overlay.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.\n * @param {string|number} id Overlay identifier.\n * @return {import(\"./Overlay.js\").default} Overlay.\n * @api\n */\n PluggableMap.prototype.getOverlayById = function (id) {\n var overlay = this.overlayIdIndex_[id.toString()];\n return overlay !== undefined ? overlay : null;\n };\n /**\n * Get the map interactions. Modifying this collection changes the interactions\n * associated with the map.\n *\n * Interactions are used for e.g. pan, zoom and rotate.\n * @return {Collection} Interactions.\n * @api\n */\n PluggableMap.prototype.getInteractions = function () {\n return this.interactions;\n };\n /**\n * Get the layergroup associated with this map.\n * @return {LayerGroup} A layer group containing the layers in this map.\n * @observable\n * @api\n */\n PluggableMap.prototype.getLayerGroup = function () {\n return (\n /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP)));\n };\n /**\n * Get the collection of layers associated with this map.\n * @return {!Collection} Layers.\n * @api\n */\n PluggableMap.prototype.getLayers = function () {\n var layers = this.getLayerGroup().getLayers();\n return layers;\n };\n /**\n * @return {boolean} Layers have sources that are still loading.\n */\n PluggableMap.prototype.getLoading = function () {\n var layerStatesArray = this.getLayerGroup().getLayerStatesArray();\n for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n var layer = layerStatesArray[i].layer;\n var source = /** @type {import(\"./layer/Layer.js\").default} */ (layer).getSource();\n if (source && source.loading) {\n return true;\n }\n }\n return false;\n };\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the user\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n * @api\n */\n PluggableMap.prototype.getPixelFromCoordinate = function (coordinate) {\n var viewCoordinate = fromUserCoordinate(coordinate, this.getView().getProjection());\n return this.getPixelFromCoordinateInternal(viewCoordinate);\n };\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the map view\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n */\n PluggableMap.prototype.getPixelFromCoordinateInternal = function (coordinate) {\n var frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n else {\n return applyTransform(frameState.coordinateToPixelTransform, coordinate.slice(0, 2));\n }\n };\n /**\n * Get the map renderer.\n * @return {import(\"./renderer/Map.js\").default} Renderer\n */\n PluggableMap.prototype.getRenderer = function () {\n return this.renderer_;\n };\n /**\n * Get the size of this map.\n * @return {import(\"./size.js\").Size|undefined} The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n PluggableMap.prototype.getSize = function () {\n return (\n /** @type {import(\"./size.js\").Size|undefined} */ (this.get(MapProperty.SIZE)));\n };\n /**\n * Get the view associated with this map. A view manages properties such as\n * center and resolution.\n * @return {View} The view that controls this map.\n * @observable\n * @api\n */\n PluggableMap.prototype.getView = function () {\n return (\n /** @type {View} */ (this.get(MapProperty.VIEW)));\n };\n /**\n * Get the element that serves as the map viewport.\n * @return {HTMLElement} Viewport.\n * @api\n */\n PluggableMap.prototype.getViewport = function () {\n return this.viewport_;\n };\n /**\n * Get the element that serves as the container for overlays. Elements added to\n * this container will let mousedown and touchstart events through to the map,\n * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}\n * events.\n * @return {!HTMLElement} The map's overlay container.\n */\n PluggableMap.prototype.getOverlayContainer = function () {\n return this.overlayContainer_;\n };\n /**\n * Get the element that serves as a container for overlays that don't allow\n * event propagation. Elements added to this container won't let mousedown and\n * touchstart events through to the map, so clicks and gestures on an overlay\n * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @return {!HTMLElement} The map's overlay container that stops events.\n */\n PluggableMap.prototype.getOverlayContainerStopEvent = function () {\n return this.overlayContainerStopEvent_;\n };\n /**\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\n PluggableMap.prototype.getTilePriority = function (tile, tileSourceKey, tileCenter, tileResolution) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n var frameState = this.frameState_;\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n var center = frameState.viewState.center;\n var deltaX = tileCenter[0] - center[0];\n var deltaY = tileCenter[1] - center[1];\n return 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;\n };\n /**\n * @param {Event} browserEvent Browser event.\n * @param {string=} opt_type Type.\n */\n PluggableMap.prototype.handleBrowserEvent = function (browserEvent, opt_type) {\n var type = opt_type || browserEvent.type;\n var mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent);\n this.handleMapBrowserEvent(mapBrowserEvent);\n };\n /**\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\n */\n PluggableMap.prototype.handleMapBrowserEvent = function (mapBrowserEvent) {\n if (!this.frameState_) {\n // With no view defined, we cannot translate pixels into geographical\n // coordinates so interactions cannot be used.\n return;\n }\n var target = mapBrowserEvent.originalEvent.target;\n while (target instanceof HTMLElement) {\n if (target.parentElement === this.overlayContainerStopEvent_) {\n return;\n }\n target = target.parentElement;\n }\n mapBrowserEvent.frameState = this.frameState_;\n var interactionsArray = this.getInteractions().getArray();\n if (this.dispatchEvent(mapBrowserEvent) !== false) {\n for (var i = interactionsArray.length - 1; i >= 0; i--) {\n var interaction = interactionsArray[i];\n if (!interaction.getActive()) {\n continue;\n }\n var cont = interaction.handleEvent(mapBrowserEvent);\n if (!cont) {\n break;\n }\n }\n }\n };\n /**\n * @protected\n */\n PluggableMap.prototype.handlePostRender = function () {\n var frameState = this.frameState_;\n // Manage the tile queue\n // Image loads are expensive and a limited resource, so try to use them\n // efficiently:\n // * When the view is static we allow a large number of parallel tile loads\n // to complete the frame as quickly as possible.\n // * When animating or interacting, image loads can cause janks, so we reduce\n // the maximum number of loads per frame and limit the number of parallel\n // tile loads to remain reactive to view changes and to reduce the chance of\n // loading tiles that will quickly disappear from view.\n var tileQueue = this.tileQueue_;\n if (!tileQueue.isEmpty()) {\n var maxTotalLoading = this.maxTilesLoading_;\n var maxNewLoads = maxTotalLoading;\n if (frameState) {\n var hints = frameState.viewHints;\n if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {\n var lowOnFrameBudget = !IMAGE_DECODE && Date.now() - frameState.time > 8;\n maxTotalLoading = lowOnFrameBudget ? 0 : 8;\n maxNewLoads = lowOnFrameBudget ? 0 : 2;\n }\n }\n if (tileQueue.getTilesLoading() < maxTotalLoading) {\n tileQueue.reprioritize(); // FIXME only call if view has changed\n tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);\n }\n }\n if (frameState && this.hasListener(RenderEventType.RENDERCOMPLETE) && !frameState.animate &&\n !this.tileQueue_.getTilesLoading() && !this.getLoading()) {\n this.renderer_.dispatchRenderEvent(RenderEventType.RENDERCOMPLETE, frameState);\n }\n var postRenderFunctions = this.postRenderFunctions_;\n for (var i = 0, ii = postRenderFunctions.length; i < ii; ++i) {\n postRenderFunctions[i](this, frameState);\n }\n postRenderFunctions.length = 0;\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleSizeChanged_ = function () {\n if (this.getView()) {\n this.getView().resolveConstraints(0);\n }\n this.render();\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleTargetChanged_ = function () {\n // target may be undefined, null, a string or an Element.\n // If it's a string we convert it to an Element before proceeding.\n // If it's not now an Element we remove the viewport from the DOM.\n // If it's an Element we append the viewport element to it.\n var targetElement;\n if (this.getTarget()) {\n targetElement = this.getTargetElement();\n }\n if (this.focusHandlerKeys_) {\n for (var i = 0, ii = this.focusHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.focusHandlerKeys_[i]);\n }\n this.focusHandlerKeys_ = null;\n }\n if (this.keyHandlerKeys_) {\n for (var i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.keyHandlerKeys_[i]);\n }\n this.keyHandlerKeys_ = null;\n }\n if (!targetElement) {\n if (this.renderer_) {\n clearTimeout(this.postRenderTimeoutHandle_);\n this.postRenderFunctions_.length = 0;\n this.renderer_.dispose();\n this.renderer_ = null;\n }\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n this.animationDelayKey_ = undefined;\n }\n removeNode(this.viewport_);\n if (this.handleResize_ !== undefined) {\n removeEventListener(EventType.RESIZE, this.handleResize_, false);\n this.handleResize_ = undefined;\n }\n }\n else {\n targetElement.appendChild(this.viewport_);\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n var hasFocus = true;\n if (targetElement.hasAttribute('tabindex')) {\n hasFocus = document.activeElement === targetElement;\n this.focusHandlerKeys_ = [\n listen(targetElement, EventType.FOCUS, setTouchAction.bind(this, this.viewport_, 'none')),\n listen(targetElement, EventType.BLUR, setTouchAction.bind(this, this.viewport_, 'auto'))\n ];\n }\n setTouchAction(this.viewport_, hasFocus ? 'none' : 'auto');\n var keyboardEventTarget = !this.keyboardEventTarget_ ?\n targetElement : this.keyboardEventTarget_;\n this.keyHandlerKeys_ = [\n listen(keyboardEventTarget, EventType.KEYDOWN, this.handleBrowserEvent, this),\n listen(keyboardEventTarget, EventType.KEYPRESS, this.handleBrowserEvent, this)\n ];\n if (!this.handleResize_) {\n this.handleResize_ = this.updateSize.bind(this);\n window.addEventListener(EventType.RESIZE, this.handleResize_, false);\n }\n }\n this.updateSize();\n // updateSize calls setSize, so no need to call this.render\n // ourselves here.\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleTileChange_ = function () {\n this.render();\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleViewPropertyChanged_ = function () {\n this.render();\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleViewChanged_ = function () {\n if (this.viewPropertyListenerKey_) {\n unlistenByKey(this.viewPropertyListenerKey_);\n this.viewPropertyListenerKey_ = null;\n }\n if (this.viewChangeListenerKey_) {\n unlistenByKey(this.viewChangeListenerKey_);\n this.viewChangeListenerKey_ = null;\n }\n var view = this.getView();\n if (view) {\n this.viewport_.setAttribute('data-view', getUid(view));\n this.viewPropertyListenerKey_ = listen(view, ObjectEventType.PROPERTYCHANGE, this.handleViewPropertyChanged_, this);\n this.viewChangeListenerKey_ = listen(view, EventType.CHANGE, this.handleViewPropertyChanged_, this);\n view.resolveConstraints(0);\n }\n this.render();\n };\n /**\n * @private\n */\n PluggableMap.prototype.handleLayerGroupChanged_ = function () {\n if (this.layerGroupPropertyListenerKeys_) {\n this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);\n this.layerGroupPropertyListenerKeys_ = null;\n }\n var layerGroup = this.getLayerGroup();\n if (layerGroup) {\n this.layerGroupPropertyListenerKeys_ = [\n listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),\n listen(layerGroup, EventType.CHANGE, this.render, this)\n ];\n }\n this.render();\n };\n /**\n * @return {boolean} Is rendered.\n */\n PluggableMap.prototype.isRendered = function () {\n return !!this.frameState_;\n };\n /**\n * Requests an immediate render in a synchronous manner.\n * @api\n */\n PluggableMap.prototype.renderSync = function () {\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n }\n this.animationDelay_();\n };\n /**\n * Redraws all text after new fonts have loaded\n */\n PluggableMap.prototype.redrawText = function () {\n var layerStates = this.getLayerGroup().getLayerStatesArray();\n for (var i = 0, ii = layerStates.length; i < ii; ++i) {\n var layer = layerStates[i].layer;\n if (layer.hasRenderer()) {\n layer.getRenderer().handleFontsChanged();\n }\n }\n };\n /**\n * Request a map rendering (at the next animation frame).\n * @api\n */\n PluggableMap.prototype.render = function () {\n if (this.renderer_ && this.animationDelayKey_ === undefined) {\n this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);\n }\n };\n /**\n * Remove the given control from the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @return {import(\"./control/Control.js\").default|undefined} The removed control (or undefined\n * if the control was not found).\n * @api\n */\n PluggableMap.prototype.removeControl = function (control) {\n return this.getControls().remove(control);\n };\n /**\n * Remove the given interaction from the map.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to remove.\n * @return {import(\"./interaction/Interaction.js\").default|undefined} The removed interaction (or\n * undefined if the interaction was not found).\n * @api\n */\n PluggableMap.prototype.removeInteraction = function (interaction) {\n return this.getInteractions().remove(interaction);\n };\n /**\n * Removes the given layer from the map.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @return {import(\"./layer/Base.js\").default|undefined} The removed layer (or undefined if the\n * layer was not found).\n * @api\n */\n PluggableMap.prototype.removeLayer = function (layer) {\n var layers = this.getLayerGroup().getLayers();\n return layers.remove(layer);\n };\n /**\n * Remove the given overlay from the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @return {import(\"./Overlay.js\").default|undefined} The removed overlay (or undefined\n * if the overlay was not found).\n * @api\n */\n PluggableMap.prototype.removeOverlay = function (overlay) {\n return this.getOverlays().remove(overlay);\n };\n /**\n * @param {number} time Time.\n * @private\n */\n PluggableMap.prototype.renderFrame_ = function (time) {\n var size = this.getSize();\n var view = this.getView();\n var previousFrameState = this.frameState_;\n /** @type {?FrameState} */\n var frameState = null;\n if (size !== undefined && hasArea(size) && view && view.isDef()) {\n var viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined);\n var viewState = view.getState();\n frameState = {\n animate: false,\n coordinateToPixelTransform: this.coordinateToPixelTransform_,\n declutterItems: previousFrameState ? previousFrameState.declutterItems : [],\n extent: getForViewAndSize(viewState.center, viewState.resolution, viewState.rotation, size),\n index: this.frameIndex_++,\n layerIndex: 0,\n layerStatesArray: this.getLayerGroup().getLayerStatesArray(),\n pixelRatio: this.pixelRatio_,\n pixelToCoordinateTransform: this.pixelToCoordinateTransform_,\n postRenderFunctions: [],\n size: size,\n tileQueue: this.tileQueue_,\n time: time,\n usedTiles: {},\n viewState: viewState,\n viewHints: viewHints,\n wantedTiles: {}\n };\n }\n this.frameState_ = frameState;\n this.renderer_.renderFrame(frameState);\n if (frameState) {\n if (frameState.animate) {\n this.render();\n }\n Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions);\n if (previousFrameState) {\n var moveStart = !this.previousExtent_ ||\n (!isEmpty(this.previousExtent_) &&\n !equals(frameState.extent, this.previousExtent_));\n if (moveStart) {\n this.dispatchEvent(new MapEvent(MapEventType.MOVESTART, this, previousFrameState));\n this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);\n }\n }\n var idle = this.previousExtent_ &&\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING] &&\n !equals(frameState.extent, this.previousExtent_);\n if (idle) {\n this.dispatchEvent(new MapEvent(MapEventType.MOVEEND, this, frameState));\n clone(frameState.extent, this.previousExtent_);\n }\n }\n this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));\n this.postRenderTimeoutHandle_ = setTimeout(this.handlePostRender.bind(this), 0);\n };\n /**\n * Sets the layergroup of this map.\n * @param {LayerGroup} layerGroup A layer group containing the layers in this map.\n * @observable\n * @api\n */\n PluggableMap.prototype.setLayerGroup = function (layerGroup) {\n this.set(MapProperty.LAYERGROUP, layerGroup);\n };\n /**\n * Set the size of this map.\n * @param {import(\"./size.js\").Size|undefined} size The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n PluggableMap.prototype.setSize = function (size) {\n this.set(MapProperty.SIZE, size);\n };\n /**\n * Set the target element to render this map into.\n * @param {HTMLElement|string|undefined} target The Element or id of the Element\n * that the map is rendered in.\n * @observable\n * @api\n */\n PluggableMap.prototype.setTarget = function (target) {\n this.set(MapProperty.TARGET, target);\n };\n /**\n * Set the view for this map.\n * @param {View} view The view that controls this map.\n * @observable\n * @api\n */\n PluggableMap.prototype.setView = function (view) {\n this.set(MapProperty.VIEW, view);\n };\n /**\n * Force a recalculation of the map viewport size. This should be called when\n * third-party code changes the size of the map viewport.\n * @api\n */\n PluggableMap.prototype.updateSize = function () {\n var targetElement = this.getTargetElement();\n if (!targetElement) {\n this.setSize(undefined);\n }\n else {\n var computedStyle = getComputedStyle(targetElement);\n this.setSize([\n targetElement.offsetWidth -\n parseFloat(computedStyle['borderLeftWidth']) -\n parseFloat(computedStyle['paddingLeft']) -\n parseFloat(computedStyle['paddingRight']) -\n parseFloat(computedStyle['borderRightWidth']),\n targetElement.offsetHeight -\n parseFloat(computedStyle['borderTopWidth']) -\n parseFloat(computedStyle['paddingTop']) -\n parseFloat(computedStyle['paddingBottom']) -\n parseFloat(computedStyle['borderBottomWidth'])\n ]);\n }\n };\n return PluggableMap;\n}(BaseObject));\n/**\n * @param {MapOptions} options Map options.\n * @return {MapOptionsInternal} Internal map options.\n */\nfunction createOptionsInternal(options) {\n /**\n * @type {HTMLElement|Document}\n */\n var keyboardEventTarget = null;\n if (options.keyboardEventTarget !== undefined) {\n keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ?\n document.getElementById(options.keyboardEventTarget) :\n options.keyboardEventTarget;\n }\n /**\n * @type {Object}\n */\n var values = {};\n var layerGroup = options.layers && typeof /** @type {?} */ (options.layers).getLayers === 'function' ?\n /** @type {LayerGroup} */ (options.layers) : new LayerGroup({ layers: /** @type {Collection} */ (options.layers) });\n values[MapProperty.LAYERGROUP] = layerGroup;\n values[MapProperty.TARGET] = options.target;\n values[MapProperty.VIEW] = options.view !== undefined ?\n options.view : new View();\n var controls;\n if (options.controls !== undefined) {\n if (Array.isArray(options.controls)) {\n controls = new Collection(options.controls.slice());\n }\n else {\n assert(typeof /** @type {?} */ (options.controls).getArray === 'function', 47); // Expected `controls` to be an array or an `import(\"./Collection.js\").Collection`\n controls = /** @type {Collection} */ (options.controls);\n }\n }\n var interactions;\n if (options.interactions !== undefined) {\n if (Array.isArray(options.interactions)) {\n interactions = new Collection(options.interactions.slice());\n }\n else {\n assert(typeof /** @type {?} */ (options.interactions).getArray === 'function', 48); // Expected `interactions` to be an array or an `import(\"./Collection.js\").Collection`\n interactions = /** @type {Collection} */ (options.interactions);\n }\n }\n var overlays;\n if (options.overlays !== undefined) {\n if (Array.isArray(options.overlays)) {\n overlays = new Collection(options.overlays.slice());\n }\n else {\n assert(typeof /** @type {?} */ (options.overlays).getArray === 'function', 49); // Expected `overlays` to be an array or an `import(\"./Collection.js\").Collection`\n overlays = options.overlays;\n }\n }\n else {\n overlays = new Collection();\n }\n return {\n controls: controls,\n interactions: interactions,\n keyboardEventTarget: keyboardEventTarget,\n overlays: overlays,\n values: values\n };\n}\nexport default PluggableMap;\n//# sourceMappingURL=PluggableMap.js.map","/**\n * @module ol/css\n */\n/**\n * @typedef {Object} FontParameters\n * @property {Array} families\n * @property {string} style\n * @property {string} weight\n */\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_HIDDEN = 'ol-hidden';\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_SELECTABLE = 'ol-selectable';\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_UNSELECTABLE = 'ol-unselectable';\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_UNSUPPORTED = 'ol-unsupported';\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_CONTROL = 'ol-control';\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport var CLASS_COLLAPSED = 'ol-collapsed';\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} The CSS font property.\n * @return {FontParameters} The font families (or null if the input spec is invalid).\n */\nexport var getFontParameters = (function () {\n /**\n * @type {CSSStyleDeclaration}\n */\n var style;\n /**\n * @type {Object}\n */\n var cache = {};\n return function (font) {\n if (!style) {\n style = document.createElement('div').style;\n }\n if (!(font in cache)) {\n style.font = font;\n var family = style.fontFamily;\n var fontWeight = style.fontWeight;\n var fontStyle = style.fontStyle;\n style.font = '';\n if (!family) {\n return null;\n }\n var families = family.split(/,\\s?/);\n cache[font] = {\n families: families,\n weight: fontWeight,\n style: fontStyle\n };\n }\n return cache[font];\n };\n})();\n//# sourceMappingURL=css.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/control/Control\n */\nimport { VOID } from '../functions.js';\nimport MapEventType from '../MapEventType.js';\nimport BaseObject from '../Object.js';\nimport { removeNode } from '../dom.js';\nimport { listen, unlistenByKey } from '../events.js';\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default)} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * var myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nvar Control = /** @class */ (function (_super) {\n __extends(Control, _super);\n /**\n * @param {Options} options Control options.\n */\n function Control(options) {\n var _this = _super.call(this) || this;\n /**\n * @protected\n * @type {HTMLElement}\n */\n _this.element = options.element ? options.element : null;\n /**\n * @private\n * @type {HTMLElement}\n */\n _this.target_ = null;\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n _this.map_ = null;\n /**\n * @protected\n * @type {!Array}\n */\n _this.listenerKeys = [];\n /**\n * @type {function(import(\"../MapEvent.js\").default): void}\n */\n _this.render = options.render ? options.render : VOID;\n if (options.target) {\n _this.setTarget(options.target);\n }\n return _this;\n }\n /**\n * @inheritDoc\n */\n Control.prototype.disposeInternal = function () {\n removeNode(this.element);\n _super.prototype.disposeInternal.call(this);\n };\n /**\n * Get the map associated with this control.\n * @return {import(\"../PluggableMap.js\").default} Map.\n * @api\n */\n Control.prototype.getMap = function () {\n return this.map_;\n };\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n Control.prototype.setMap = function (map) {\n if (this.map_) {\n removeNode(this.element);\n }\n for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (this.map_) {\n var target = this.target_ ?\n this.target_ : map.getOverlayContainerStopEvent();\n target.appendChild(this.element);\n if (this.render !== VOID) {\n this.listenerKeys.push(listen(map, MapEventType.POSTRENDER, this.render, this));\n }\n map.render();\n }\n };\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n Control.prototype.setTarget = function (target) {\n this.target_ = typeof target === 'string' ?\n document.getElementById(target) :\n target;\n };\n return Control;\n}(BaseObject));\nexport default Control;\n//# sourceMappingURL=Control.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/layer/Layer\n */\nimport { listen, unlistenByKey } from '../events.js';\nimport EventType from '../events/EventType.js';\nimport { getChangeEventType } from '../Object.js';\nimport BaseLayer from './Base.js';\nimport LayerProperty from './Property.js';\nimport { assign } from '../obj.js';\nimport RenderEventType from '../render/EventType.js';\nimport SourceState from '../source/State.js';\n/**\n * @typedef {function(import(\"../PluggableMap.js\").FrameState):HTMLElement} RenderFunction\n */\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {import(\"../source/Source.js\").default} [source] Source for this layer. If not provided to the constructor,\n * the source can be set by calling {@link module:ol/layer/Layer#setSource layer.setSource(source)} after\n * construction.\n * @property {import(\"../PluggableMap.js\").default} [map] Map.\n * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an\n * HTML element. Will overwrite the default rendering for the layer.\n */\n/**\n * @typedef {Object} State\n * @property {import(\"./Base.js\").default} layer\n * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.\n * @property {SourceState} sourceState\n * @property {boolean} visible\n * @property {boolean} managed\n * @property {import(\"../extent.js\").Extent} [extent]\n * @property {number} zIndex\n * @property {number} maxResolution\n * @property {number} minResolution\n * @property {number} minZoom\n * @property {number} maxZoom\n */\n/**\n * @classdesc\n * Base class from which all layer types are derived. This should only be instantiated\n * in the case where a custom layer is be added to the map with a custom `render` function.\n * Such a function can be specified in the `options` object, and is expected to return an HTML element.\n *\n * A visual representation of raster or vector map data.\n * Layers group together those properties that pertain to how the data is to be\n * displayed, irrespective of the source of that data.\n *\n * Layers are usually added to a map with {@link module:ol/Map#addLayer}. Components\n * like {@link module:ol/interaction/Select~Select} use unmanaged layers\n * internally. These unmanaged layers are associated with the map using\n * {@link module:ol/layer/Layer~Layer#setMap} instead.\n *\n * A generic `change` event is fired when the state of the source changes.\n *\n * Please note that for performance reasons several layers might get rendered to\n * the same HTML element, which will cause {@link module:ol/Map~Map#forEachLayerAtPixel} to\n * give false positives. To avoid this, apply different `className` properties to the\n * layers at creation time.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n *\n * @template {import(\"../source/Source.js\").default} SourceType\n * @api\n */\nvar Layer = /** @class */ (function (_super) {\n __extends(Layer, _super);\n /**\n * @param {Options} options Layer options.\n */\n function Layer(options) {\n var _this = this;\n var baseOptions = assign({}, options);\n delete baseOptions.source;\n _this = _super.call(this, baseOptions) || this;\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n _this.mapPrecomposeKey_ = null;\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n _this.mapRenderKey_ = null;\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n _this.sourceChangeKey_ = null;\n /**\n * @private\n * @type {import(\"../renderer/Layer.js\").default}\n */\n _this.renderer_ = null;\n // Overwrite default render method with a custom one\n if (options.render) {\n _this.render = options.render;\n }\n if (options.map) {\n _this.setMap(options.map);\n }\n _this.addEventListener(getChangeEventType(LayerProperty.SOURCE), _this.handleSourcePropertyChange_);\n var source = options.source ? /** @type {SourceType} */ (options.source) : null;\n _this.setSource(source);\n return _this;\n }\n /**\n * @inheritDoc\n */\n Layer.prototype.getLayersArray = function (opt_array) {\n var array = opt_array ? opt_array : [];\n array.push(this);\n return array;\n };\n /**\n * @inheritDoc\n */\n Layer.prototype.getLayerStatesArray = function (opt_states) {\n var states = opt_states ? opt_states : [];\n states.push(this.getLayerState());\n return states;\n };\n /**\n * Get the layer source.\n * @return {SourceType} The layer source (or `null` if not yet set).\n * @observable\n * @api\n */\n Layer.prototype.getSource = function () {\n return /** @type {SourceType} */ (this.get(LayerProperty.SOURCE)) || null;\n };\n /**\n * @inheritDoc\n */\n Layer.prototype.getSourceState = function () {\n var source = this.getSource();\n return !source ? SourceState.UNDEFINED : source.getState();\n };\n /**\n * @private\n */\n Layer.prototype.handleSourceChange_ = function () {\n this.changed();\n };\n /**\n * @private\n */\n Layer.prototype.handleSourcePropertyChange_ = function () {\n if (this.sourceChangeKey_) {\n unlistenByKey(this.sourceChangeKey_);\n this.sourceChangeKey_ = null;\n }\n var source = this.getSource();\n if (source) {\n this.sourceChangeKey_ = listen(source, EventType.CHANGE, this.handleSourceChange_, this);\n }\n this.changed();\n };\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Promise>} Promise that resolves with\n * an array of features.\n */\n Layer.prototype.getFeatures = function (pixel) {\n return this.renderer_.getFeatures(pixel);\n };\n /**\n * In charge to manage the rendering of the layer. One layer type is\n * bounded with one layer renderer.\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target which the renderer may (but need not) use\n * for rendering its content.\n * @return {HTMLElement} The rendered element.\n */\n Layer.prototype.render = function (frameState, target) {\n var layerRenderer = this.getRenderer();\n if (layerRenderer.prepareFrame(frameState)) {\n return layerRenderer.renderFrame(frameState, target);\n }\n };\n /**\n * Sets the layer to be rendered on top of other layers on a map. The map will\n * not manage this layer in its layers collection, and the callback in\n * {@link module:ol/Map#forEachLayerAtPixel} will receive `null` as layer. This\n * is useful for temporary layers. To remove an unmanaged layer from the map,\n * use `#setMap(null)`.\n *\n * To add the layer to a map and have it managed by the map, use\n * {@link module:ol/Map#addLayer} instead.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n Layer.prototype.setMap = function (map) {\n if (this.mapPrecomposeKey_) {\n unlistenByKey(this.mapPrecomposeKey_);\n this.mapPrecomposeKey_ = null;\n }\n if (!map) {\n this.changed();\n }\n if (this.mapRenderKey_) {\n unlistenByKey(this.mapRenderKey_);\n this.mapRenderKey_ = null;\n }\n if (map) {\n this.mapPrecomposeKey_ = listen(map, RenderEventType.PRECOMPOSE, function (evt) {\n var renderEvent = /** @type {import(\"../render/Event.js\").default} */ (evt);\n renderEvent.frameState.layerStatesArray.push(this.getLayerState(false));\n }, this);\n this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);\n this.changed();\n }\n };\n /**\n * Set the layer source.\n * @param {SourceType} source The layer source.\n * @observable\n * @api\n */\n Layer.prototype.setSource = function (source) {\n this.set(LayerProperty.SOURCE, source);\n };\n /**\n * Get the renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} The layer renderer.\n */\n Layer.prototype.getRenderer = function () {\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n return this.renderer_;\n };\n /**\n * @return {boolean} The layer has a renderer.\n */\n Layer.prototype.hasRenderer = function () {\n return !!this.renderer_;\n };\n /**\n * Create a renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} A layer renderer.\n * @protected\n */\n Layer.prototype.createRenderer = function () {\n return null;\n };\n /**\n * @inheritDoc\n */\n Layer.prototype.disposeInternal = function () {\n this.setSource(null);\n _super.prototype.disposeInternal.call(this);\n };\n return Layer;\n}(BaseLayer));\n/**\n * Return `true` if the layer is visible and if the provided view state\n * has resolution and zoom levels that are in range of the layer's min/max.\n * @param {State} layerState Layer state.\n * @param {import(\"../View.js\").State} viewState View state.\n * @return {boolean} The layer is visible at the given view state.\n */\nexport function inView(layerState, viewState) {\n if (!layerState.visible) {\n return false;\n }\n var resolution = viewState.resolution;\n if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {\n return false;\n }\n var zoom = viewState.zoom;\n return zoom > layerState.minZoom && zoom <= layerState.maxZoom;\n}\nexport default Layer;\n//# sourceMappingURL=Layer.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/control/Attribution\n */\nimport { equals } from '../array.js';\nimport Control from './Control.js';\nimport { CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_COLLAPSED } from '../css.js';\nimport { removeChildren, replaceNode } from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport { inView } from '../layer/Layer.js';\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [collapseLabel='»'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {function(import(\"../MapEvent.js\").default)} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n */\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nvar Attribution = /** @class */ (function (_super) {\n __extends(Attribution, _super);\n /**\n * @param {Options=} opt_options Attribution options.\n */\n function Attribution(opt_options) {\n var _this = this;\n var options = opt_options ? opt_options : {};\n _this = _super.call(this, {\n element: document.createElement('div'),\n render: options.render || render,\n target: options.target\n }) || this;\n /**\n * @private\n * @type {HTMLElement}\n */\n _this.ulElement_ = document.createElement('ul');\n /**\n * @private\n * @type {boolean}\n */\n _this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true;\n /**\n * @private\n * @type {boolean}\n */\n _this.overrideCollapsible_ = options.collapsible !== undefined;\n /**\n * @private\n * @type {boolean}\n */\n _this.collapsible_ = options.collapsible !== undefined ?\n options.collapsible : true;\n if (!_this.collapsible_) {\n _this.collapsed_ = false;\n }\n var className = options.className !== undefined ? options.className : 'ol-attribution';\n var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\\u00BB';\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n _this.collapseLabel_ = document.createElement('span');\n _this.collapseLabel_.textContent = collapseLabel;\n }\n else {\n _this.collapseLabel_ = collapseLabel;\n }\n var label = options.label !== undefined ? options.label : 'i';\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n _this.label_ = document.createElement('span');\n _this.label_.textContent = label;\n }\n else {\n _this.label_ = label;\n }\n var activeLabel = (_this.collapsible_ && !_this.collapsed_) ?\n _this.collapseLabel_ : _this.label_;\n var button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);\n var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL +\n (_this.collapsed_ && _this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (_this.collapsible_ ? '' : ' ol-uncollapsible');\n var element = _this.element;\n element.className = cssClasses;\n element.appendChild(_this.ulElement_);\n element.appendChild(button);\n /**\n * A list of currently rendered resolutions.\n * @type {Array}\n * @private\n */\n _this.renderedAttributions_ = [];\n /**\n * @private\n * @type {boolean}\n */\n _this.renderedVisible_ = true;\n return _this;\n }\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {Array} Attributions.\n * @private\n */\n Attribution.prototype.collectSourceAttributions_ = function (frameState) {\n /**\n * Used to determine if an attribution already exists.\n * @type {!Object}\n */\n var lookup = {};\n /**\n * A list of visible attributions.\n * @type {Array}\n */\n var visibleAttributions = [];\n var layerStatesArray = frameState.layerStatesArray;\n for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n var layerState = layerStatesArray[i];\n if (!inView(layerState, frameState.viewState)) {\n continue;\n }\n var source = /** @type {import(\"../layer/Layer.js\").default} */ (layerState.layer).getSource();\n if (!source) {\n continue;\n }\n var attributionGetter = source.getAttributions();\n if (!attributionGetter) {\n continue;\n }\n var attributions = attributionGetter(frameState);\n if (!attributions) {\n continue;\n }\n if (!this.overrideCollapsible_ && source.getAttributionsCollapsible() === false) {\n this.setCollapsible(false);\n }\n if (Array.isArray(attributions)) {\n for (var j = 0, jj = attributions.length; j < jj; ++j) {\n if (!(attributions[j] in lookup)) {\n visibleAttributions.push(attributions[j]);\n lookup[attributions[j]] = true;\n }\n }\n }\n else {\n if (!(attributions in lookup)) {\n visibleAttributions.push(attributions);\n lookup[attributions] = true;\n }\n }\n }\n return visibleAttributions;\n };\n /**\n * @private\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n Attribution.prototype.updateElement_ = function (frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n var attributions = this.collectSourceAttributions_(frameState);\n var visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n removeChildren(this.ulElement_);\n // append the attributions\n for (var i = 0, ii = attributions.length; i < ii; ++i) {\n var element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n this.renderedAttributions_ = attributions;\n };\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n Attribution.prototype.handleClick_ = function (event) {\n event.preventDefault();\n this.handleToggle_();\n };\n /**\n * @private\n */\n Attribution.prototype.handleToggle_ = function () {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n }\n else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n };\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n Attribution.prototype.getCollapsible = function () {\n return this.collapsible_;\n };\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n Attribution.prototype.setCollapsible = function (collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n };\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n Attribution.prototype.setCollapsed = function (collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n };\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n Attribution.prototype.getCollapsed = function () {\n return this.collapsed_;\n };\n return Attribution;\n}(Control));\n/**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @this {Attribution}\n * @api\n */\nexport function render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n}\nexport default Attribution;\n//# sourceMappingURL=Attribution.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/control/Rotate\n */\nimport Control from './Control.js';\nimport { CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE } from '../css.js';\nimport { easeOut } from '../easing.js';\nimport EventType from '../events/EventType.js';\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default)} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function()} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nvar Rotate = /** @class */ (function (_super) {\n __extends(Rotate, _super);\n /**\n * @param {Options=} opt_options Rotate options.\n */\n function Rotate(opt_options) {\n var _this = this;\n var options = opt_options ? opt_options : {};\n _this = _super.call(this, {\n element: document.createElement('div'),\n render: options.render || render,\n target: options.target\n }) || this;\n var className = options.className !== undefined ? options.className : 'ol-rotate';\n var label = options.label !== undefined ? options.label : '\\u21E7';\n /**\n * @type {HTMLElement}\n * @private\n */\n _this.label_ = null;\n if (typeof label === 'string') {\n _this.label_ = document.createElement('span');\n _this.label_.className = 'ol-compass';\n _this.label_.textContent = label;\n }\n else {\n _this.label_ = label;\n _this.label_.classList.add('ol-compass');\n }\n var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n var button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(_this.label_);\n button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);\n var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n var element = _this.element;\n element.className = cssClasses;\n element.appendChild(button);\n _this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n /**\n * @type {number}\n * @private\n */\n _this.duration_ = options.duration !== undefined ? options.duration : 250;\n /**\n * @type {boolean}\n * @private\n */\n _this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.rotation_ = undefined;\n if (_this.autoHide_) {\n _this.element.classList.add(CLASS_HIDDEN);\n }\n return _this;\n }\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n Rotate.prototype.handleClick_ = function (event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n }\n else {\n this.resetNorth_();\n }\n };\n /**\n * @private\n */\n Rotate.prototype.resetNorth_ = function () {\n var map = this.getMap();\n var view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n if (view.getRotation() !== undefined) {\n if (this.duration_ > 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut\n });\n }\n else {\n view.setRotation(0);\n }\n }\n };\n return Rotate;\n}(Control));\n/**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @this {Rotate}\n * @api\n */\nexport function render(mapEvent) {\n var frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n var rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n var transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n var contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n}\nexport default Rotate;\n//# sourceMappingURL=Rotate.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/control/Zoom\n */\nimport EventType from '../events/EventType.js';\nimport Control from './Control.js';\nimport { CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';\nimport { easeOut } from '../easing.js';\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='-'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nvar Zoom = /** @class */ (function (_super) {\n __extends(Zoom, _super);\n /**\n * @param {Options=} opt_options Zoom options.\n */\n function Zoom(opt_options) {\n var _this = this;\n var options = opt_options ? opt_options : {};\n _this = _super.call(this, {\n element: document.createElement('div'),\n target: options.target\n }) || this;\n var className = options.className !== undefined ? options.className : 'ol-zoom';\n var delta = options.delta !== undefined ? options.delta : 1;\n var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2212';\n var zoomInTipLabel = options.zoomInTipLabel !== undefined ?\n options.zoomInTipLabel : 'Zoom in';\n var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?\n options.zoomOutTipLabel : 'Zoom out';\n var inElement = document.createElement('button');\n inElement.className = className + '-in';\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel);\n inElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, delta), false);\n var outElement = document.createElement('button');\n outElement.className = className + '-out';\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel);\n outElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, -delta), false);\n var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n var element = _this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n /**\n * @type {number}\n * @private\n */\n _this.duration_ = options.duration !== undefined ? options.duration : 250;\n return _this;\n }\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n Zoom.prototype.handleClick_ = function (delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n };\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n Zoom.prototype.zoomByDelta_ = function (delta) {\n var map = this.getMap();\n var view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n var currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n var newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut\n });\n }\n else {\n view.setZoom(newZoom);\n }\n }\n };\n return Zoom;\n}(Control));\nexport default Zoom;\n//# sourceMappingURL=Zoom.js.map","/**\n * @module ol/control\n */\nimport Collection from './Collection.js';\nimport Attribution from './control/Attribution.js';\nimport Rotate from './control/Rotate.js';\nimport Zoom from './control/Zoom.js';\nexport { default as Attribution } from './control/Attribution.js';\nexport { default as Control } from './control/Control.js';\nexport { default as FullScreen } from './control/FullScreen.js';\nexport { default as MousePosition } from './control/MousePosition.js';\nexport { default as OverviewMap } from './control/OverviewMap.js';\nexport { default as Rotate } from './control/Rotate.js';\nexport { default as ScaleLine } from './control/ScaleLine.js';\nexport { default as Zoom } from './control/Zoom.js';\nexport { default as ZoomSlider } from './control/ZoomSlider.js';\nexport { default as ZoomToExtent } from './control/ZoomToExtent.js';\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./control/Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./control/Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./control/Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n * @api\n */\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * * {@link module:ol/control/Zoom~Zoom}\n * * {@link module:ol/control/Rotate~Rotate}\n * * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions=} opt_options\n * Defaults options.\n * @return {Collection}\n * Controls.\n * @api\n */\nexport function defaults(opt_options) {\n var options = opt_options ? opt_options : {};\n var controls = new Collection();\n var zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n var rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n var attributionControl = options.attribution !== undefined ?\n options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n return controls;\n}\n//# sourceMappingURL=control.js.map","/**\n * @module ol/interaction/Property\n */\n/**\n * @enum {string}\n */\nexport default {\n ACTIVE: 'active'\n};\n//# sourceMappingURL=Property.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/interaction/Interaction\n */\nimport BaseObject from '../Object.js';\nimport { easeOut, linear } from '../easing.js';\nimport InteractionProperty from './Property.js';\n/**\n * Object literal with config options for interactions.\n * @typedef {Object} InteractionOptions\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} handleEvent\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. If the function returns a falsy value, propagation of\n * the event to other interactions in the map's interactions chain will be\n * prevented (this includes functions with no explicit return). The interactions\n * are traversed in reverse order of the interactions collection of the map.\n */\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * User actions that change the state of the map. Some are similar to controls,\n * but are not associated with a DOM element.\n * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is\n * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered\n * by a keyboard event not a button element event.\n * Although interactions do not have a DOM element, some of them do render\n * vectors and so are visible on the screen.\n * @api\n */\nvar Interaction = /** @class */ (function (_super) {\n __extends(Interaction, _super);\n /**\n * @param {InteractionOptions} options Options.\n */\n function Interaction(options) {\n var _this = _super.call(this) || this;\n if (options.handleEvent) {\n _this.handleEvent = options.handleEvent;\n }\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n _this.map_ = null;\n _this.setActive(true);\n return _this;\n }\n /**\n * Return whether the interaction is currently active.\n * @return {boolean} `true` if the interaction is active, `false` otherwise.\n * @observable\n * @api\n */\n Interaction.prototype.getActive = function () {\n return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));\n };\n /**\n * Get the map associated with this interaction.\n * @return {import(\"../PluggableMap.js\").default} Map.\n * @api\n */\n Interaction.prototype.getMap = function () {\n return this.map_;\n };\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event}.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n Interaction.prototype.handleEvent = function (mapBrowserEvent) {\n return true;\n };\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n Interaction.prototype.setActive = function (active) {\n this.set(InteractionProperty.ACTIVE, active);\n };\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n Interaction.prototype.setMap = function (map) {\n this.map_ = map;\n };\n return Interaction;\n}(BaseObject));\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {import(\"../coordinate.js\").Coordinate} delta Delta.\n * @param {number=} opt_duration Duration.\n */\nexport function pan(view, delta, opt_duration) {\n var currentCenter = view.getCenterInternal();\n if (currentCenter) {\n var center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];\n view.animateInternal({\n duration: opt_duration !== undefined ? opt_duration : 250,\n easing: linear,\n center: view.getConstrainedCenter(center)\n });\n }\n}\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {number} delta Delta from previous zoom level.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor Anchor coordinate in the user projection.\n * @param {number=} opt_duration Duration.\n */\nexport function zoomByDelta(view, delta, opt_anchor, opt_duration) {\n var currentZoom = view.getZoom();\n if (currentZoom === undefined) {\n return;\n }\n var newZoom = view.getConstrainedZoom(currentZoom + delta);\n var newResolution = view.getResolutionForZoom(newZoom);\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n resolution: newResolution,\n anchor: opt_anchor,\n duration: opt_duration !== undefined ? opt_duration : 250,\n easing: easeOut\n });\n}\nexport default Interaction;\n//# sourceMappingURL=Interaction.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/interaction/DoubleClickZoom\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction, { zoomByDelta } from './Interaction.js';\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [delta=1] The zoom delta applied on each double click.\n */\n/**\n * @classdesc\n * Allows the user to zoom by double-clicking on the map.\n * @api\n */\nvar DoubleClickZoom = /** @class */ (function (_super) {\n __extends(DoubleClickZoom, _super);\n /**\n * @param {Options=} opt_options Options.\n */\n function DoubleClickZoom(opt_options) {\n var _this = _super.call(this, {\n handleEvent: handleEvent\n }) || this;\n var options = opt_options ? opt_options : {};\n /**\n * @private\n * @type {number}\n */\n _this.delta_ = options.delta ? options.delta : 1;\n /**\n * @private\n * @type {number}\n */\n _this.duration_ = options.duration !== undefined ? options.duration : 250;\n return _this;\n }\n return DoubleClickZoom;\n}(Interaction));\n/**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a\n * doubleclick) and eventually zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @this {DoubleClickZoom}\n */\nfunction handleEvent(mapBrowserEvent) {\n var stopEvent = false;\n if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {\n var browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);\n var map = mapBrowserEvent.map;\n var anchor = mapBrowserEvent.coordinate;\n var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;\n var view = map.getView();\n zoomByDelta(view, delta, anchor, this.duration_);\n mapBrowserEvent.preventDefault();\n stopEvent = true;\n }\n return !stopEvent;\n}\nexport default DoubleClickZoom;\n//# sourceMappingURL=DoubleClickZoom.js.map","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport { assert } from '../asserts.js';\nimport { TRUE, FALSE } from '../functions.js';\nimport { WEBKIT, MAC } from '../has.js';\n/**\n * A function that takes an {@link module:ol/MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport var altKeyOnly = function (mapBrowserEvent) {\n var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey);\n};\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport var altShiftKeysOnly = function (mapBrowserEvent) {\n var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey);\n};\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `
`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport var focus = function (event) {\n return event.target.getTargetElement() === document.activeElement;\n};\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport var always = TRUE;\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport var click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport var mouseActionButton = function (mapBrowserEvent) {\n var originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);\n return originalEvent.button == 0 &&\n !(WEBKIT && MAC && originalEvent.ctrlKey);\n};\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport var never = FALSE;\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport var pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport var singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport var doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport var noModifierKeys = function (mapBrowserEvent) {\n var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (!originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey);\n};\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport var platformModifierKeyOnly = function (mapBrowserEvent) {\n var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey;\n};\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport var shiftKeyOnly = function (mapBrowserEvent) {\n var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (!originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey);\n};\n/**\n * Return `true` if the target element is not editable, i.e. not a ``-,\n * `