@oiz/stzh-components 2.2.0-beta → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{animation-utils-cfa35ce7.js → animation-utils-54d784c2.js} +3 -0
- package/dist/cjs/{app-globals-f4ad4e99.js → app-globals-b6d82414.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-accordion-item.cjs.entry.js +5 -2
- package/dist/cjs/stzh-badge_3.cjs.entry.js +2 -2
- package/dist/cjs/stzh-calendar.cjs.entry.js +1 -1
- package/dist/cjs/stzh-card_3.cjs.entry.js +40 -10
- package/dist/cjs/stzh-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/stzh-checkboxgroup.cjs.entry.js +1 -1
- package/dist/cjs/stzh-chip.cjs.entry.js +6 -5
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datalist_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-datamessagelist-item.cjs.entry.js +3 -2
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js +2 -2
- package/dist/cjs/stzh-details.cjs.entry.js +4 -1
- package/dist/cjs/stzh-dialog.cjs.entry.js +4 -4
- package/dist/cjs/stzh-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/stzh-flyingfocus.cjs.entry.js +1 -1
- package/dist/cjs/stzh-ghettobox_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-input.cjs.entry.js +1 -1
- package/dist/cjs/stzh-link.cjs.entry.js +1 -1
- package/dist/cjs/stzh-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-message.cjs.entry.js +1 -1
- package/dist/cjs/stzh-microsite-teaserlist.cjs.entry.js +1 -1
- package/dist/cjs/stzh-olmap.cjs.entry.js +1 -1
- package/dist/cjs/stzh-popover.cjs.entry.js +19 -5
- package/dist/cjs/stzh-progressbar-item.cjs.entry.js +1 -1
- package/dist/cjs/stzh-textandimage.cjs.entry.js +3 -1
- package/dist/cjs/stzh-toggle.cjs.entry.js +1 -1
- package/dist/cjs/stzh-tooltip.cjs.entry.js +28 -7
- package/dist/cjs/stzh-upload.cjs.entry.js +1 -1
- package/dist/cjs/stzh-vbz-linechip.cjs.entry.js +2 -1
- package/dist/collection/assets/i18n/de.json +9 -6
- package/dist/collection/assets/i18n/en.json +10 -7
- package/dist/collection/components/stzh-accordion/stzh-accordion.stories.js +12 -1
- package/dist/collection/components/stzh-accordion-item/stzh-accordion-item.css +1 -0
- package/dist/collection/components/stzh-accordion-item/stzh-accordion-item.js +3 -0
- package/dist/collection/components/stzh-button/stzh-button.css +1 -0
- package/dist/collection/components/stzh-button/stzh-button.stories.js +12 -12
- package/dist/collection/components/stzh-calendar/stzh-calendar.css +1 -0
- package/dist/collection/components/stzh-card/stzh-card.css +36 -0
- package/dist/collection/components/stzh-card/stzh-card.js +26 -4
- package/dist/collection/components/stzh-checkbox/stzh-checkbox.css +1 -0
- package/dist/collection/components/stzh-checkboxgroup/stzh-checkboxgroup.css +1 -0
- package/dist/collection/components/stzh-chip/stzh-chip.css +52 -4
- package/dist/collection/components/stzh-chip/stzh-chip.js +23 -5
- package/dist/collection/components/stzh-chip-select/stzh-chip-select.css +2 -0
- package/dist/collection/components/stzh-chip-select/stzh-chip-select.js +31 -4
- package/dist/collection/components/stzh-datalist-item/stzh-datalist-item.css +1 -0
- package/dist/collection/components/stzh-datamessagelist-item/stzh-datamessagelist-item.css +11 -0
- package/dist/collection/components/stzh-datamessagelist-item/stzh-datamessagelist-item.js +3 -2
- package/dist/collection/components/stzh-details/stzh-details.js +3 -0
- package/dist/collection/components/stzh-dialog/stzh-dialog.css +1 -0
- package/dist/collection/components/stzh-dialog/stzh-dialog.js +3 -3
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +3 -0
- package/dist/collection/components/stzh-ghettobox/stzh-ghettobox.css +1 -0
- package/dist/collection/components/stzh-header/stzh-header.stories.js +1 -1
- package/dist/collection/components/stzh-icon/stzh-icon.js +1 -1
- package/dist/collection/components/stzh-input/stzh-input.css +1 -0
- package/dist/collection/components/stzh-link/stzh-link.css +1 -0
- package/dist/collection/components/stzh-menu-item/stzh-menu-item.css +1 -0
- package/dist/collection/components/stzh-message/stzh-message.css +1 -0
- package/dist/collection/components/stzh-microsite-teaserlist/stzh-microsite-teaserlist.js +1 -1
- package/dist/collection/components/stzh-olmap/stzh-olmap.js +1 -1
- package/dist/collection/components/stzh-pagebottom/stzh-pagebottom.stories.js +1 -1
- package/dist/collection/components/stzh-popover/stzh-popover.css +2 -0
- package/dist/collection/components/stzh-popover/stzh-popover.js +18 -4
- package/dist/collection/components/stzh-progressbar-item/stzh-progressbar-item.css +107 -6
- package/dist/collection/components/stzh-radio/stzh-radio.css +1 -0
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.css +1 -0
- package/dist/collection/components/stzh-textandimage/stzh-textandimage.css +38 -2
- package/dist/collection/components/stzh-textandimage/stzh-textandimage.js +20 -0
- package/dist/collection/components/stzh-toggle/stzh-toggle.css +1 -0
- package/dist/collection/components/stzh-tooltip/stzh-tooltip.css +1 -0
- package/dist/collection/components/stzh-tooltip/stzh-tooltip.js +27 -6
- package/dist/collection/components/stzh-upload/stzh-upload.css +1 -0
- package/dist/collection/components/stzh-vbz-linechip/stzh-vbz-linechip.js +2 -1
- package/dist/collection/pages/egov.stories.js +9 -9
- package/dist/collection/pages/example.stories.js +1 -1
- package/dist/collection/pages/meinkonto.stories.js +3 -3
- package/dist/collection/patterns/contact.stories.js +56 -30
- package/dist/collection/patterns/subpages.stories.js +5 -5
- package/dist/collection/utils/animation-utils.js +3 -0
- package/dist/components/animation-utils.js +3 -0
- package/dist/components/index.js +1 -1
- package/dist/components/stzh-accordion-item.js +4 -1
- package/dist/components/stzh-button2.js +1 -1
- package/dist/components/stzh-calendar2.js +1 -1
- package/dist/components/stzh-card2.js +9 -5
- package/dist/components/stzh-checkbox.js +1 -1
- package/dist/components/stzh-checkboxgroup.js +1 -1
- package/dist/components/stzh-chip-select2.js +32 -5
- package/dist/components/stzh-chip2.js +7 -5
- package/dist/components/stzh-datalist-item2.js +1 -1
- package/dist/components/stzh-datamessagelist-item.js +3 -2
- package/dist/components/stzh-details.js +3 -0
- package/dist/components/stzh-dialog.js +4 -4
- package/dist/components/stzh-dropdown2.js +1 -1
- package/dist/components/stzh-ghettobox2.js +1 -1
- package/dist/components/stzh-icon2.js +1 -1
- package/dist/components/stzh-input2.js +1 -1
- package/dist/components/stzh-link2.js +1 -1
- package/dist/components/stzh-menu-item2.js +1 -1
- package/dist/components/stzh-message.js +1 -1
- package/dist/components/stzh-microsite-teaserlist.js +1 -1
- package/dist/components/stzh-olmap.js +1 -1
- package/dist/components/stzh-popover2.js +18 -4
- package/dist/components/stzh-progressbar-item2.js +1 -1
- package/dist/components/stzh-radio2.js +1 -1
- package/dist/components/stzh-radiogroup2.js +1 -1
- package/dist/components/stzh-textandimage.js +4 -1
- package/dist/components/stzh-toggle.js +1 -1
- package/dist/components/stzh-tooltip2.js +27 -6
- package/dist/components/stzh-upload.js +1 -1
- package/dist/components/stzh-vbz-linechip2.js +2 -1
- package/dist/esm/{animation-utils-25c74e5b.js → animation-utils-e234a5f8.js} +3 -0
- package/dist/esm/{app-globals-17c2ba8d.js → app-globals-ff581b69.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-accordion-item.entry.js +5 -2
- package/dist/esm/stzh-badge_3.entry.js +2 -2
- package/dist/esm/stzh-calendar.entry.js +1 -1
- package/dist/esm/stzh-card_3.entry.js +40 -10
- package/dist/esm/stzh-checkbox.entry.js +1 -1
- package/dist/esm/stzh-checkboxgroup.entry.js +1 -1
- package/dist/esm/stzh-chip.entry.js +6 -5
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datalist_2.entry.js +1 -1
- package/dist/esm/stzh-datamessagelist-item.entry.js +3 -2
- package/dist/esm/stzh-datepicker_3.entry.js +2 -2
- package/dist/esm/stzh-details.entry.js +4 -1
- package/dist/esm/stzh-dialog.entry.js +4 -4
- package/dist/esm/stzh-dropdown.entry.js +1 -1
- package/dist/esm/stzh-flyingfocus.entry.js +1 -1
- package/dist/esm/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm/stzh-input.entry.js +1 -1
- package/dist/esm/stzh-link.entry.js +1 -1
- package/dist/esm/stzh-menu_2.entry.js +1 -1
- package/dist/esm/stzh-message.entry.js +1 -1
- package/dist/esm/stzh-microsite-teaserlist.entry.js +1 -1
- package/dist/esm/stzh-olmap.entry.js +1 -1
- package/dist/esm/stzh-popover.entry.js +19 -5
- package/dist/esm/stzh-progressbar-item.entry.js +1 -1
- package/dist/esm/stzh-textandimage.entry.js +3 -1
- package/dist/esm/stzh-toggle.entry.js +1 -1
- package/dist/esm/stzh-tooltip.entry.js +28 -7
- package/dist/esm/stzh-upload.entry.js +1 -1
- package/dist/esm/stzh-vbz-linechip.entry.js +2 -1
- package/dist/esm-es5/animation-utils-e234a5f8.js +1 -0
- package/dist/esm-es5/app-globals-ff581b69.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/stzh-accordion-item.entry.js +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
- package/dist/esm-es5/stzh-calendar.entry.js +1 -1
- package/dist/esm-es5/stzh-card_3.entry.js +1 -1
- package/dist/esm-es5/stzh-checkbox.entry.js +1 -1
- package/dist/esm-es5/stzh-checkboxgroup.entry.js +1 -1
- package/dist/esm-es5/stzh-chip.entry.js +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-datalist_2.entry.js +1 -1
- package/dist/esm-es5/stzh-datamessagelist-item.entry.js +1 -1
- package/dist/esm-es5/stzh-datepicker_3.entry.js +1 -1
- package/dist/esm-es5/stzh-details.entry.js +1 -1
- package/dist/esm-es5/stzh-dialog.entry.js +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +1 -1
- package/dist/esm-es5/stzh-flyingfocus.entry.js +1 -1
- package/dist/esm-es5/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm-es5/stzh-input.entry.js +1 -1
- package/dist/esm-es5/stzh-link.entry.js +1 -1
- package/dist/esm-es5/stzh-menu_2.entry.js +1 -1
- package/dist/esm-es5/stzh-message.entry.js +1 -1
- package/dist/esm-es5/stzh-microsite-teaserlist.entry.js +1 -1
- package/dist/esm-es5/stzh-olmap.entry.js +1 -1
- package/dist/esm-es5/stzh-popover.entry.js +1 -1
- package/dist/esm-es5/stzh-progressbar-item.entry.js +1 -1
- package/dist/esm-es5/stzh-textandimage.entry.js +1 -1
- package/dist/esm-es5/stzh-toggle.entry.js +1 -1
- package/dist/esm-es5/stzh-tooltip.entry.js +1 -1
- package/dist/esm-es5/stzh-upload.entry.js +1 -1
- package/dist/stzh-components/assets/i18n/de.json +9 -6
- package/dist/stzh-components/assets/i18n/en.json +10 -7
- package/dist/stzh-components/p-06d9b884.system.entry.js +1 -0
- package/dist/stzh-components/{p-1da26ca1.entry.js → p-0743d7fa.entry.js} +1 -1
- package/dist/stzh-components/p-0850a2e1.system.entry.js +1 -0
- package/dist/stzh-components/{p-2b5b1e4a.system.entry.js → p-0cc8bbd7.system.entry.js} +1 -1
- package/dist/stzh-components/p-12a2afe9.entry.js +1 -0
- package/dist/stzh-components/p-17645237.entry.js +1 -0
- package/dist/stzh-components/p-18cb06e2.entry.js +1 -0
- package/dist/stzh-components/p-1ae4d600.system.entry.js +1 -0
- package/dist/stzh-components/{p-037357fc.system.entry.js → p-21cad060.system.entry.js} +1 -1
- package/dist/stzh-components/{p-171c5795.system.entry.js → p-23829f75.system.entry.js} +1 -1
- package/dist/stzh-components/p-2bec3c77.entry.js +1 -0
- package/dist/stzh-components/p-2d340222.system.entry.js +1 -0
- package/dist/stzh-components/{p-2862cdd8.system.entry.js → p-3200f52a.system.entry.js} +1 -1
- package/dist/stzh-components/p-385dda6c.system.entry.js +1 -0
- package/dist/stzh-components/p-3ad67331.entry.js +1 -0
- package/dist/stzh-components/p-3e850dce.entry.js +1 -0
- package/dist/stzh-components/p-4704588f.system.entry.js +1 -0
- package/dist/stzh-components/{p-c26aec94.entry.js → p-4b369bac.entry.js} +1 -1
- package/dist/stzh-components/p-5011f10c.js +1 -0
- package/dist/stzh-components/{p-6267a327.system.js → p-5494f37d.system.js} +1 -1
- package/dist/stzh-components/p-557f07b5.system.entry.js +1 -0
- package/dist/stzh-components/p-5790eb4f.system.entry.js +1 -0
- package/dist/stzh-components/p-57a0f895.entry.js +1 -0
- package/dist/stzh-components/p-57f8596f.system.entry.js +1 -0
- package/dist/stzh-components/p-586a8b3f.entry.js +1 -0
- package/dist/stzh-components/p-63d94a57.system.entry.js +1 -0
- package/dist/stzh-components/{p-f37be5d7.entry.js → p-67c6f0f2.entry.js} +1 -1
- package/dist/stzh-components/{p-f59b3545.system.entry.js → p-6d009f56.system.entry.js} +1 -1
- package/dist/stzh-components/{p-213959b7.entry.js → p-76165227.entry.js} +1 -1
- package/dist/stzh-components/{p-3145cd2f.entry.js → p-7704b10b.entry.js} +1 -1
- package/dist/stzh-components/p-7941cf38.js +1 -0
- package/dist/stzh-components/{p-af63f1a4.entry.js → p-7b86c022.entry.js} +1 -1
- package/dist/stzh-components/p-7c26f80f.system.entry.js +1 -0
- package/dist/stzh-components/p-84b9f66f.system.entry.js +1 -0
- package/dist/stzh-components/p-853a1f92.entry.js +1 -0
- package/dist/stzh-components/p-8991d3bc.entry.js +1 -0
- package/dist/stzh-components/p-8fa2fb95.system.entry.js +1 -0
- package/dist/stzh-components/p-9072a490.system.entry.js +1 -0
- package/dist/stzh-components/p-912706bb.entry.js +1 -0
- package/dist/stzh-components/{p-68400ee7.entry.js → p-aae4655f.entry.js} +1 -1
- package/dist/stzh-components/p-ac1a6085.system.entry.js +1 -0
- package/dist/stzh-components/{p-a17754c7.system.entry.js → p-afedafa6.system.entry.js} +1 -1
- package/dist/stzh-components/{p-5c3c9ad4.entry.js → p-b3dc4913.entry.js} +1 -1
- package/dist/stzh-components/p-b937ae70.system.js +1 -0
- package/dist/stzh-components/p-c63aecaa.system.entry.js +1 -0
- package/dist/stzh-components/p-c87e12de.system.entry.js +1 -0
- package/dist/stzh-components/p-cfd22a5e.system.entry.js +1 -0
- package/dist/stzh-components/p-d240494d.entry.js +1 -0
- package/dist/stzh-components/p-d6ec20c8.system.entry.js +1 -0
- package/dist/stzh-components/{p-af0ab448.system.entry.js → p-d9bf09b1.system.entry.js} +1 -1
- package/dist/stzh-components/p-e016ceb9.entry.js +1 -0
- package/dist/stzh-components/{p-4c7e52aa.entry.js → p-e0f063ac.entry.js} +1 -1
- package/dist/stzh-components/{p-0b9dc96d.system.js → p-e32bc982.system.js} +1 -1
- package/dist/stzh-components/p-ea9ca52b.entry.js +1 -0
- package/dist/stzh-components/{p-34b45788.entry.js → p-ec7b6ce8.entry.js} +1 -1
- package/dist/stzh-components/p-ef3da23b.entry.js +1 -0
- package/dist/stzh-components/{p-3848d8ee.entry.js → p-f133eba2.entry.js} +1 -1
- package/dist/stzh-components/p-fdb906b9.system.entry.js +1 -0
- package/dist/stzh-components/{p-f5db6234.entry.js → p-fee6a938.entry.js} +1 -1
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components/stzh-datamessagelist-item/stzh-datamessagelist-item.localization.d.ts +1 -0
- package/dist/types/components/stzh-popover/stzh-popover.localization.d.ts +1 -0
- package/dist/types/components/stzh-tooltip/stzh-tooltip.localization.d.ts +1 -0
- package/dist/types/components.d.ts +26 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/vscode-data.json +13 -1
- package/package.json +1 -1
- package/dist/esm-es5/animation-utils-25c74e5b.js +0 -1
- package/dist/esm-es5/app-globals-17c2ba8d.js +0 -1
- package/dist/stzh-components/p-02fd7470.entry.js +0 -1
- package/dist/stzh-components/p-04a45622.system.entry.js +0 -1
- package/dist/stzh-components/p-0b264a7a.entry.js +0 -1
- package/dist/stzh-components/p-1ca12032.system.entry.js +0 -1
- package/dist/stzh-components/p-1fe1169e.entry.js +0 -1
- package/dist/stzh-components/p-231e6e6a.system.entry.js +0 -1
- package/dist/stzh-components/p-2a5855f8.js +0 -1
- package/dist/stzh-components/p-31029226.entry.js +0 -1
- package/dist/stzh-components/p-311813bc.system.entry.js +0 -1
- package/dist/stzh-components/p-38f9cbf3.system.entry.js +0 -1
- package/dist/stzh-components/p-3905ca20.entry.js +0 -1
- package/dist/stzh-components/p-4228cd58.system.entry.js +0 -1
- package/dist/stzh-components/p-4bd7dafb.system.entry.js +0 -1
- package/dist/stzh-components/p-4cd9f5c7.system.entry.js +0 -1
- package/dist/stzh-components/p-55f6fa41.system.entry.js +0 -1
- package/dist/stzh-components/p-5b379647.system.entry.js +0 -1
- package/dist/stzh-components/p-65675e11.entry.js +0 -1
- package/dist/stzh-components/p-7684506e.system.entry.js +0 -1
- package/dist/stzh-components/p-7da446d5.js +0 -1
- package/dist/stzh-components/p-83830baa.system.entry.js +0 -1
- package/dist/stzh-components/p-84c86e4c.system.entry.js +0 -1
- package/dist/stzh-components/p-88cbd2c0.entry.js +0 -1
- package/dist/stzh-components/p-99f92c6d.system.entry.js +0 -1
- package/dist/stzh-components/p-a795868f.entry.js +0 -1
- package/dist/stzh-components/p-ab28e094.system.entry.js +0 -1
- package/dist/stzh-components/p-addc48e5.entry.js +0 -1
- package/dist/stzh-components/p-b0fe9349.entry.js +0 -1
- package/dist/stzh-components/p-c065387a.entry.js +0 -1
- package/dist/stzh-components/p-c42435be.entry.js +0 -1
- package/dist/stzh-components/p-cfc0bc2e.system.entry.js +0 -1
- package/dist/stzh-components/p-d1d5825d.entry.js +0 -1
- package/dist/stzh-components/p-d4405931.system.entry.js +0 -1
- package/dist/stzh-components/p-dce19efd.entry.js +0 -1
- package/dist/stzh-components/p-e2e54f09.system.js +0 -1
- package/dist/stzh-components/p-e71cd5cd.system.entry.js +0 -1
- package/dist/stzh-components/p-e72ca013.system.entry.js +0 -1
- package/dist/stzh-components/p-e812d35e.system.entry.js +0 -1
- package/dist/stzh-components/p-f792fc8f.entry.js +0 -1
|
@@ -4,4 +4,4 @@ import{r as t,c as i,h as s,a as h,g as n}from"./p-9a5ebb1f.js";import{f as r}fr
|
|
|
4
4
|
* Latitude/longitude spherical geodesy formulae taken from
|
|
5
5
|
* http://www.movable-type.co.uk/scripts/latlong.html
|
|
6
6
|
* Licensed under CC-BY-3.0.
|
|
7
|
-
*/wi.prototype.geodesicArea=function(t){return wi.getArea_(t,this.radius)},wi.prototype.haversineDistance=function(t,i){return wi.getDistance_(t,i,this.radius)},wi.prototype.offset=function(t,i,s){var h=_i.toRadians(t[1]),n=_i.toRadians(t[0]),r=i/this.radius,e=Math.asin(Math.sin(h)*Math.cos(r)+Math.cos(h)*Math.sin(r)*Math.cos(s)),o=n+Math.atan2(Math.sin(s)*Math.sin(r)*Math.cos(h),Math.cos(r)-Math.sin(h)*Math.sin(e));return[_i.toDegrees(o),_i.toDegrees(e)]},wi.DEFAULT_RADIUS=6371008.8,wi.getLength=function(t,i){var s,h,n,r,e,o,a=i||{},u=a.radius||wi.DEFAULT_RADIUS,f=a.projection||"EPSG:3857",c=(t=t.clone().transform(f,"EPSG:4326")).getType(),l=0;switch(c){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":s=t.getCoordinates(),l=wi.getLength_(s,u);break;case"MultiLineString":case"Polygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)l+=wi.getLength_(s[n],u);break;case"MultiPolygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)for(e=0,o=(h=s[n]).length;e<o;++e)l+=wi.getLength_(h[e],u);break;case"GeometryCollection":var v=t.getGeometries();for(n=0,r=v.length;n<r;++n)l+=wi.getLength(v[n],i);break;default:throw new Error("Unsupported geometry type: "+c)}return l},wi.getLength_=function(t,i){for(var s=0,h=0,n=t.length;h<n-1;++h)s+=wi.getDistance_(t[h],t[h+1],i);return s},wi.getDistance_=function(t,i,s){var h=_i.toRadians(t[1]),n=_i.toRadians(i[1]),r=(n-h)/2,e=_i.toRadians(i[0]-t[0])/2,o=Math.sin(r)*Math.sin(r)+Math.sin(e)*Math.sin(e)*Math.cos(h)*Math.cos(n);return 2*s*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))},wi.getArea=function(t,i){var s,h,n,r,e,o,a=i||{},u=a.radius||wi.DEFAULT_RADIUS,f=a.projection||"EPSG:3857",c=(t=t.clone().transform(f,"EPSG:4326")).getType(),l=0;switch(c){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(s=t.getCoordinates(),l=Math.abs(wi.getArea_(s[0],u)),n=1,r=s.length;n<r;++n)l-=Math.abs(wi.getArea_(s[n],u));break;case"MultiPolygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)for(h=s[n],l+=Math.abs(wi.getArea_(h[0],u)),e=1,o=h.length;e<o;++e)l-=Math.abs(wi.getArea_(h[e],u));break;case"GeometryCollection":var v=t.getGeometries();for(n=0,r=v.length;n<r;++n)l+=wi.getArea(v[n],i);break;default:throw new Error("Unsupported geometry type: "+c)}return l},wi.getArea_=function(t,i){for(var s=0,h=t.length,n=t[h-1][0],r=t[h-1][1],e=0;e<h;e++){var o=t[e][0],a=t[e][1];s+=_i.toRadians(o-n)*(2+Math.sin(_i.toRadians(r))+Math.sin(_i.toRadians(a))),n=o,r=a}return s*i*i/2};var yi={binarySearch:function(t,i,s){for(var h,n,r=s||yi.numberSafeCompareFunction,e=0,o=t.length,a=!1;e<o;)(n=+r(t[h=e+(o-e>>1)],i))<0?e=h+1:(o=h,a=!n);return a?e:~e},numberSafeCompareFunction:function(t,i){return t>i?1:t<i?-1:0},includes:function(t,i){return t.indexOf(i)>=0},linearFindNearest:function(t,i,s){var h,n=t.length;if(t[0]<=i)return 0;if(i<=t[n-1])return n-1;if(s>0){for(h=1;h<n;++h)if(t[h]<i)return h-1}else if(s<0){for(h=1;h<n;++h)if(t[h]<=i)return h}else for(h=1;h<n;++h){if(t[h]==i)return h;if(t[h]<i)return t[h-1]-i<i-t[h]?h-1:h}return n-1},reverseSubArray:function(t,i,s){for(;i<s;){var h=t[i];t[i]=t[s],t[s]=h,++i,--s}},extend:function(t,i){var s,h=Array.isArray(i)?i:[i],n=h.length;for(s=0;s<n;s++)t[t.length]=h[s]},remove:function(t,i){var s=t.indexOf(i),h=s>-1;return h&&t.splice(s,1),h},find:function(t,i){for(var s,h=t.length>>>0,n=0;n<h;n++)if(i(s=t[n],n,t))return s;return null},equals:function(t,i){var s=t.length;if(s!==i.length)return!1;for(var h=0;h<s;h++)if(t[h]!==i[h])return!1;return!0},stableSort:function(t,i){var s,h=t.length,n=Array(t.length);for(s=0;s<h;s++)n[s]={index:s,value:t[s]};for(n.sort((function(t,s){return i(t.value,s.value)||t.index-s.index})),s=0;s<t.length;s++)t[s]=n[s].value},findIndex:function(t,i){var s;return t.every((function(h,n){return s=n,!i(h,n,t)}))?-1:s},isSorted:function(t,i,s){var h=i||yi.numberSafeCompareFunction;return t.every((function(i,n){if(0===n)return!0;var r=h(t[n-1],i);return!(r>0||s&&0===r)}))}},bi={boundingExtent:function(t){for(var i=bi.createEmpty(),s=0,h=t.length;s<h;++s)bi.extendCoordinate(i,t[s]);return i},boundingExtentXYs_:function(t,i,s){var h=Math.min.apply(null,t),n=Math.min.apply(null,i),r=Math.max.apply(null,t),e=Math.max.apply(null,i);return bi.createOrUpdate(h,n,r,e,s)},buffer:function(t,i,s){return s?(s[0]=t[0]-i,s[1]=t[1]-i,s[2]=t[2]+i,s[3]=t[3]+i,s):[t[0]-i,t[1]-i,t[2]+i,t[3]+i]},clone:function(t,i){return i?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i):t.slice()},closestSquaredDistanceXY:function(t,i,s){var h,n;return(h=i<t[0]?t[0]-i:t[2]<i?i-t[2]:0)*h+(n=s<t[1]?t[1]-s:t[3]<s?s-t[3]:0)*n},containsCoordinate:function(t,i){return bi.containsXY(t,i[0],i[1])},containsExtent:function(t,i){return t[0]<=i[0]&&i[2]<=t[2]&&t[1]<=i[1]&&i[3]<=t[3]},containsXY:function(t,i,s){return t[0]<=i&&i<=t[2]&&t[1]<=s&&s<=t[3]},coordinateRelationship:function(t,i){var s=i[0],h=i[1],n=0;return s<t[0]?n|=16:s>t[2]&&(n|=4),h<t[1]?n|=8:h>t[3]&&(n|=2),0===n&&(n=1),n},createEmpty:function(){return[1/0,1/0,-1/0,-1/0]},createOrUpdate:function(t,i,s,h,n){return n?(n[0]=t,n[1]=i,n[2]=s,n[3]=h,n):[t,i,s,h]},createOrUpdateEmpty:function(t){return bi.createOrUpdate(1/0,1/0,-1/0,-1/0,t)},createOrUpdateFromCoordinate:function(t,i){var s=t[0],h=t[1];return bi.createOrUpdate(s,h,s,h,i)},createOrUpdateFromCoordinates:function(t,i){var s=bi.createOrUpdateEmpty(i);return bi.extendCoordinates(s,t)},createOrUpdateFromFlatCoordinates:function(t,i,s,h,n){var r=bi.createOrUpdateEmpty(n);return bi.extendFlatCoordinates(r,t,i,s,h)},createOrUpdateFromRings:function(t,i){var s=bi.createOrUpdateEmpty(i);return bi.extendRings(s,t)},equals:function(t,i){return t[0]==i[0]&&t[2]==i[2]&&t[1]==i[1]&&t[3]==i[3]},extend:function(t,i){return i[0]<t[0]&&(t[0]=i[0]),i[2]>t[2]&&(t[2]=i[2]),i[1]<t[1]&&(t[1]=i[1]),i[3]>t[3]&&(t[3]=i[3]),t},extendCoordinate:function(t,i){i[0]<t[0]&&(t[0]=i[0]),i[0]>t[2]&&(t[2]=i[0]),i[1]<t[1]&&(t[1]=i[1]),i[1]>t[3]&&(t[3]=i[1])},extendCoordinates:function(t,i){var s,h;for(s=0,h=i.length;s<h;++s)bi.extendCoordinate(t,i[s]);return t},extendFlatCoordinates:function(t,i,s,h,n){for(;s<h;s+=n)bi.extendXY(t,i[s],i[s+1]);return t},extendRings:function(t,i){var s,h;for(s=0,h=i.length;s<h;++s)bi.extendCoordinates(t,i[s]);return t},extendXY:function(t,i,s){t[0]=Math.min(t[0],i),t[1]=Math.min(t[1],s),t[2]=Math.max(t[2],i),t[3]=Math.max(t[3],s)},forEachCorner:function(t,i,s){var h;return(h=i.call(s,bi.getBottomLeft(t)))||(h=i.call(s,bi.getBottomRight(t)))||(h=i.call(s,bi.getTopRight(t)))?h:(h=i.call(s,bi.getTopLeft(t)))||!1},getArea:function(t){var i=0;return bi.isEmpty(t)||(i=bi.getWidth(t)*bi.getHeight(t)),i},getBottomLeft:function(t){return[t[0],t[1]]},getBottomRight:function(t){return[t[2],t[1]]},getCenter:function(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]},getCorner:function(t,i){var s;return"bottom-left"===i?s=bi.getBottomLeft(t):"bottom-right"===i?s=bi.getBottomRight(t):"top-left"===i?s=bi.getTopLeft(t):"top-right"===i?s=bi.getTopRight(t):gi(!1,13),s},getEnlargedArea:function(t,i){var s=Math.min(t[0],i[0]),h=Math.min(t[1],i[1]);return(Math.max(t[2],i[2])-s)*(Math.max(t[3],i[3])-h)},getForViewAndSize:function(t,i,s,h,n){var r=i*h[0]/2,e=i*h[1]/2,o=Math.cos(s),a=Math.sin(s),u=r*o,f=r*a,c=e*o,l=e*a,v=t[0],d=t[1],M=v-u+l,m=v-u-l,p=v+u-l,g=v+u+l,_=d-f-c,w=d-f+c,y=d+f+c,b=d+f-c;return bi.createOrUpdate(Math.min(M,m,p,g),Math.min(_,w,y,b),Math.max(M,m,p,g),Math.max(_,w,y,b),n)},getHeight:function(t){return t[3]-t[1]},getIntersectionArea:function(t,i){var s=bi.getIntersection(t,i);return bi.getArea(s)},getIntersection:function(t,i,s){var h=s||bi.createEmpty();return bi.intersects(t,i)&&(h[0]=t[0]>i[0]?t[0]:i[0],h[1]=t[1]>i[1]?t[1]:i[1],h[2]=t[2]<i[2]?t[2]:i[2],h[3]=t[3]<i[3]?t[3]:i[3]),h},getMargin:function(t){return bi.getWidth(t)+bi.getHeight(t)},getSize:function(t){return[t[2]-t[0],t[3]-t[1]]},getTopLeft:function(t){return[t[0],t[3]]},getTopRight:function(t){return[t[2],t[3]]},getWidth:function(t){return t[2]-t[0]},intersects:function(t,i){return t[0]<=i[2]&&t[2]>=i[0]&&t[1]<=i[3]&&t[3]>=i[1]},isEmpty:function(t){return t[2]<t[0]||t[3]<t[1]},returnOrUpdate:function(t,i){return i?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i):t},scaleFromCenter:function(t,i){var s=(t[2]-t[0])/2*(i-1),h=(t[3]-t[1])/2*(i-1);t[0]-=s,t[2]+=s,t[1]-=h,t[3]+=h},intersectsSegment:function(t,i,s){var h=!1,n=bi.coordinateRelationship(t,i),r=bi.coordinateRelationship(t,s);if(1===n||1===r)h=!0;else{var e,o,a=t[0],u=t[1],f=t[2],c=t[3],l=s[0],v=s[1],d=(v-i[1])/(l-i[0]);2&r&&!(2&n)&&(h=(e=l-(v-c)/d)>=a&&e<=f),h||!(4&r)||4&n||(h=(o=v-(l-f)*d)>=u&&o<=c),h||!(8&r)||8&n||(h=(e=l-(v-u)/d)>=a&&e<=f),h||!(16&r)||16&n||(h=(o=v-(l-a)*d)>=u&&o<=c)}return h},applyTransform:function(t,i,s){var h=[t[0],t[1],t[0],t[3],t[2],t[1],t[2],t[3]];return i(h,h,2),bi.boundingExtentXYs_([h[0],h[2],h[4],h[6]],[h[1],h[3],h[5],h[7]],s)}},xi={TRUE:function(){return!0},FALSE:function(){return!1}},Ei=function(t,i,s,h,n,r){var e,o=r||[],a=0;for(e=i;e<s;e+=h){var u=t[e],f=t[e+1];o[a++]=n[0]*u+n[2]*f+n[4],o[a++]=n[1]*u+n[3]*f+n[5]}return r&&o.length!=a&&(o.length=a),o},Si=function(t,i,s,h,n,r,e){for(var o=e||[],a=Math.cos(n),u=Math.sin(n),f=r[0],c=r[1],l=0,v=i;v<s;v+=h){var d=t[v]-f,M=t[v+1]-c;o[l++]=f+d*a-M*u,o[l++]=c+d*u+M*a;for(var m=v+2;m<v+h;++m)o[l++]=t[m]}return e&&o.length!=l&&(o.length=l),o},Ci=function(t,i,s,h,n,r,e,o){for(var a=o||[],u=e[0],f=e[1],c=0,l=i;l<s;l+=h){var v=t[l+1]-f;a[c++]=u+n*(t[l]-u),a[c++]=f+r*v;for(var d=l+2;d<l+h;++d)a[c++]=t[d]}return o&&a.length!=c&&(a.length=c),a},Ai=function(t,i,s,h,n,r,e){var o,a,u=e||[],f=0;for(o=i;o<s;o+=h)for(u[f++]=t[o]+n,u[f++]=t[o+1]+r,a=o+2;a<o+h;++a)u[f++]=t[a];return e&&u.length!=f&&(u.length=f),u},Pi={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft",METERS_PER_UNIT:{}};Pi.METERS_PER_UNIT[Pi.DEGREES]=2*Math.PI*6370997/360,Pi.METERS_PER_UNIT[Pi.FEET]=.3048,Pi.METERS_PER_UNIT[Pi.METERS]=1,Pi.METERS_PER_UNIT[Pi.USFEET]=1200/3937;var Ri={cache_:null,set:function(t){Ri.cache_=t},get:function(){return Ri.cache_||window.proj4}},Ni=function(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit;var i=t.code;if(ui.ENABLE_PROJ4JS){var s=Ri.get();if("function"==typeof s){var h=s.defs(i);void 0!==h&&(void 0!==h.axis&&void 0===t.axisOrientation&&(this.axisOrientation_=h.axis),void 0===t.metersPerUnit&&(this.metersPerUnit_=h.to_meter),void 0===t.units&&(this.units_=h.units))}}};Ni.prototype.canWrapX=function(){return this.canWrapX_},Ni.prototype.getCode=function(){return this.code_},Ni.prototype.getExtent=function(){return this.extent_},Ni.prototype.getUnits=function(){return this.units_},Ni.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||Pi.METERS_PER_UNIT[this.units_]},Ni.prototype.getWorldExtent=function(){return this.worldExtent_},Ni.prototype.getAxisOrientation=function(){return this.axisOrientation_},Ni.prototype.isGlobal=function(){return this.global_},Ni.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},Ni.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},Ni.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},Ni.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},Ni.prototype.setWorldExtent=function(t){this.worldExtent_=t},Ni.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},Ni.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_};var zi={Projection_:function(t){Ni.call(this,{code:t,units:Pi.METERS,extent:zi.EXTENT,global:!0,worldExtent:zi.WORLD_EXTENT,getPointResolution:function(t,i){return t/_i.cosh(i[1]/zi.RADIUS)}})}};ui.inherits(zi.Projection_,Ni),zi.RADIUS=6378137,zi.HALF_SIZE=Math.PI*zi.RADIUS,zi.EXTENT=[-zi.HALF_SIZE,-zi.HALF_SIZE,zi.HALF_SIZE,zi.HALF_SIZE],zi.WORLD_EXTENT=[-180,-85,180,85],zi.PROJECTIONS=[new zi.Projection_("EPSG:3857"),new zi.Projection_("EPSG:102100"),new zi.Projection_("EPSG:102113"),new zi.Projection_("EPSG:900913"),new zi.Projection_("urn:ogc:def:crs:EPSG:6.18:3:3857"),new zi.Projection_("urn:ogc:def:crs:EPSG::3857"),new zi.Projection_("http://www.opengis.net/gml/srs/epsg.xml#3857")],zi.fromEPSG4326=function(t,i,s){var h=t.length,n=s>1?s:2,r=i;void 0===r&&(r=n>2?t.slice():new Array(h));for(var e=zi.HALF_SIZE,o=0;o<h;o+=n){r[o]=e*t[o]/180;var a=zi.RADIUS*Math.log(Math.tan(Math.PI*(t[o+1]+90)/360));a>e?a=e:a<-e&&(a=-e),r[o+1]=a}return r},zi.toEPSG4326=function(t,i,s){var h=t.length,n=s>1?s:2,r=i;void 0===r&&(r=n>2?t.slice():new Array(h));for(var e=0;e<h;e+=n)r[e]=180*t[e]/zi.HALF_SIZE,r[e+1]=360*Math.atan(Math.exp(t[e+1]/zi.RADIUS))/Math.PI-90;return r};var ki={Projection_:function(t,i){Ni.call(this,{code:t,units:Pi.DEGREES,extent:ki.EXTENT,axisOrientation:i,global:!0,metersPerUnit:ki.METERS_PER_UNIT,worldExtent:ki.EXTENT})}};ui.inherits(ki.Projection_,Ni),ki.RADIUS=6378137,ki.EXTENT=[-180,-90,180,90],ki.METERS_PER_UNIT=Math.PI*ki.RADIUS/180,ki.PROJECTIONS=[new ki.Projection_("CRS:84"),new ki.Projection_("EPSG:4326","neu"),new ki.Projection_("urn:ogc:def:crs:EPSG::4326","neu"),new ki.Projection_("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new ki.Projection_("urn:ogc:def:crs:OGC:1.3:CRS84"),new ki.Projection_("urn:ogc:def:crs:OGC:2:84"),new ki.Projection_("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ki.Projection_("urn:x-ogc:def:crs:EPSG:4326","neu")];var Ti={cache_:{},clear:function(){Ti.cache_={}},get:function(t){return Ti.cache_[t]||null},add:function(t,i){Ti.cache_[t]=i}},Oi={cache_:{},clear:function(){Oi.cache_={}},add:function(t,i,s){var h=t.getCode(),n=i.getCode(),r=Oi.cache_;h in r||(r[h]={}),r[h][n]=s},remove:function(t,i){var s=t.getCode(),h=i.getCode(),n=Oi.cache_,r=n[s][h];return delete n[s][h],fi.isEmpty(n[s])&&delete n[s],r},get:function(t,i){var s,h=Oi.cache_;return t in h&&i in h[t]&&(s=h[t][i]),s}},Li={};Li.METERS_PER_UNIT=Pi.METERS_PER_UNIT,Li.SPHERE_=new wi(wi.DEFAULT_RADIUS),ui.ENABLE_PROJ4JS&&(Li.setProj4=function(t){Ri.set(t)}),Li.getPointResolution=function(t,i,s,h){var n,r=(t=Li.get(t)).getPointResolutionFunc();if(r)n=r(i,s);else if(t.getUnits()==Pi.DEGREES&&!h||h==Pi.DEGREES)n=i;else{var e=Li.getTransformFromProjections(t,Li.get("EPSG:4326")),o=[s[0]-i/2,s[1],s[0]+i/2,s[1],s[0],s[1]-i/2,s[0],s[1]+i/2];o=e(o,o,2),n=(Li.SPHERE_.haversineDistance(o.slice(0,2),o.slice(2,4))+Li.SPHERE_.haversineDistance(o.slice(4,6),o.slice(6,8)))/2;var a=h?Pi.METERS_PER_UNIT[h]:t.getMetersPerUnit();void 0!==a&&(n/=a)}return n},Li.addEquivalentProjections=function(t){Li.addProjections(t),t.forEach((function(i){t.forEach((function(t){i!==t&&Oi.add(i,t,Li.cloneTransform)}))}))},Li.addEquivalentTransforms=function(t,i,s,h){t.forEach((function(t){i.forEach((function(i){Oi.add(t,i,s),Oi.add(i,t,h)}))}))},Li.addProjection=function(t){Ti.add(t.getCode(),t),Oi.add(t,t,Li.cloneTransform)},Li.addProjections=function(t){t.forEach(Li.addProjection)},Li.clearAllProjections=function(){Ti.clear(),Oi.clear()},Li.createProjection=function(t,i){return t?"string"==typeof t?Li.get(t):t:Li.get(i)},Li.addCoordinateTransforms=function(t,i,s,h){var n=Li.get(t),r=Li.get(i);Oi.add(n,r,Li.createTransformFromCoordinateTransform(s)),Oi.add(r,n,Li.createTransformFromCoordinateTransform(h))},Li.createTransformFromCoordinateTransform=function(t){return function(i,s,h){var n,r,e,o=i.length,a=void 0!==h?h:2,u=void 0!==s?s:new Array(o);for(r=0;r<o;r+=a)for(n=t([i[r],i[r+1]]),u[r]=n[0],u[r+1]=n[1],e=a-1;e>=2;--e)u[r+e]=i[r+e];return u}},Li.fromLonLat=function(t,i){return Li.transform(t,"EPSG:4326",void 0!==i?i:"EPSG:3857")},Li.toLonLat=function(t,i){var s=Li.transform(t,void 0!==i?i:"EPSG:3857","EPSG:4326"),h=s[0];return(h<-180||h>180)&&(s[0]=_i.modulo(h+180,360)-180),s},Li.get=function(t){var i=null;if(t instanceof Ni)i=t;else if("string"==typeof t){var s=t;if(i=Ti.get(s),ui.ENABLE_PROJ4JS&&!i){var h=Ri.get();"function"==typeof h&&void 0!==h.defs(s)&&(i=new Ni({code:s}),Li.addProjection(i))}}return i},Li.equivalent=function(t,i){if(t===i)return!0;var s=t.getUnits()===i.getUnits();return(t.getCode()===i.getCode()||Li.getTransformFromProjections(t,i)===Li.cloneTransform)&&s},Li.getTransform=function(t,i){var s=Li.get(t),h=Li.get(i);return Li.getTransformFromProjections(s,h)},Li.getTransformFromProjections=function(t,i){var s=t.getCode(),h=i.getCode(),n=Oi.get(s,h);if(ui.ENABLE_PROJ4JS&&!n){var r=Ri.get();if("function"==typeof r){var e=r.defs(s),o=r.defs(h);if(void 0!==e&&void 0!==o){if(e===o)Li.addEquivalentProjections([i,t]);else{var a=r(h,s);Li.addCoordinateTransforms(i,t,a.forward,a.inverse)}n=Oi.get(s,h)}}}return n||(n=Li.identityTransform),n},Li.identityTransform=function(t,i){if(void 0!==i&&t!==i){for(var s=0,h=t.length;s<h;++s)i[s]=t[s];t=i}return t},Li.cloneTransform=function(t,i){var s;if(void 0!==i){for(var h=0,n=t.length;h<n;++h)i[h]=t[h];s=i}else s=t.slice();return s},Li.transform=function(t,i,s){return Li.getTransform(i,s)(t,void 0,t.length)},Li.transformExtent=function(t,i,s){var h=Li.getTransform(i,s);return bi.applyTransform(t,h)},Li.transformWithProjections=function(t,i,s){return Li.getTransformFromProjections(i,s)(t)},Li.addCommon=function(){Li.addEquivalentProjections(zi.PROJECTIONS),Li.addEquivalentProjections(ki.PROJECTIONS),Li.addEquivalentTransforms(ki.PROJECTIONS,zi.PROJECTIONS,zi.fromEPSG4326,zi.toEPSG4326)},Li.addCommon();var Ii={};Ii.tmp_=new Array(6),Ii.create=function(){return[1,0,0,1,0,0]},Ii.reset=function(t){return Ii.set(t,1,0,0,1,0,0)},Ii.multiply=function(t,i){var s=t[0],h=t[1],n=t[2],r=t[3],e=t[4],o=t[5],a=i[0],u=i[1],f=i[2],c=i[3],l=i[4],v=i[5];return t[0]=s*a+n*u,t[1]=h*a+r*u,t[2]=s*f+n*c,t[3]=h*f+r*c,t[4]=s*l+n*v+e,t[5]=h*l+r*v+o,t},Ii.set=function(t,i,s,h,n,r,e){return t[0]=i,t[1]=s,t[2]=h,t[3]=n,t[4]=r,t[5]=e,t},Ii.setFromArray=function(t,i){return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t},Ii.apply=function(t,i){var s=i[0],h=i[1];return i[0]=t[0]*s+t[2]*h+t[4],i[1]=t[1]*s+t[3]*h+t[5],i},Ii.rotate=function(t,i){var s=Math.cos(i),h=Math.sin(i);return Ii.multiply(t,Ii.set(Ii.tmp_,s,h,-h,s,0,0))},Ii.scale=function(t,i,s){return Ii.multiply(t,Ii.set(Ii.tmp_,i,0,0,s,0,0))},Ii.translate=function(t,i,s){return Ii.multiply(t,Ii.set(Ii.tmp_,1,0,0,1,i,s))},Ii.compose=function(t,i,s,h,n,r,e,o){var a=Math.sin(r),u=Math.cos(r);return t[0]=h*u,t[1]=n*a,t[2]=-h*a,t[3]=n*u,t[4]=e*h*u-o*h*a+i,t[5]=e*n*a+o*n*u+s,t},Ii.invert=function(t){var i=Ii.determinant(t);gi(0!==i,32);var s=t[0],h=t[1],n=t[2],r=t[3],e=t[4],o=t[5];return t[0]=r/i,t[1]=-h/i,t[2]=-n/i,t[3]=s/i,t[4]=(n*o-r*e)/i,t[5]=-(s*o-h*e)/i,t},Ii.determinant=function(t){return t[0]*t[3]-t[1]*t[2]};var Fi=function(){mi.call(this),this.extent_=bi.createEmpty(),this.extentRevision_=-1,this.simplifiedGeometryCache={},this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.tmpTransform_=Ii.create()};ui.inherits(Fi,mi),Fi.prototype.clone=function(){},Fi.prototype.closestPointXY=function(){},Fi.prototype.getClosestPoint=function(t,i){var s=i||[NaN,NaN];return this.closestPointXY(t[0],t[1],s,1/0),s},Fi.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},Fi.prototype.computeExtent=function(){},Fi.prototype.containsXY=xi.FALSE,Fi.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),bi.returnOrUpdate(this.extent_,t)},Fi.prototype.rotate=function(){},Fi.prototype.scale=function(){},Fi.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},Fi.prototype.getSimplifiedGeometry=function(){},Fi.prototype.getType=function(){},Fi.prototype.applyTransform=function(){},Fi.prototype.intersectsExtent=function(){},Fi.prototype.translate=function(){},Fi.prototype.transform=function(t,i){var s=this.tmpTransform_,h=(t=Li.get(t)).getUnits()==Pi.TILE_PIXELS?function(h,n,r){var e=t.getExtent(),o=t.getWorldExtent(),a=bi.getHeight(o)/bi.getHeight(e);return Ii.compose(s,o[0],o[3],a,-a,0,0,0),Ei(h,0,h.length,r,s,n),Li.getTransform(t,i)(h,n,r)}:Li.getTransform(t,i);return this.applyTransform(h),this};var Di=function(){Fi.call(this),this.layout="XY",this.stride=2,this.flatCoordinates=null};ui.inherits(Di,Fi),Di.getLayoutForStride_=function(t){var i;return 2==t?i="XY":3==t?i="XYZ":4==t&&(i="XYZM"),i},Di.getStrideForLayout=function(t){var i;return"XY"==t?i=2:"XYZ"==t||"XYM"==t?i=3:"XYZM"==t&&(i=4),i},Di.prototype.containsXY=xi.FALSE,Di.prototype.computeExtent=function(t){return bi.createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},Di.prototype.getCoordinates=function(){},Di.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},Di.prototype.getFlatCoordinates=function(){return this.flatCoordinates},Di.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},Di.prototype.getLayout=function(){return this.layout},Di.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()&&(fi.clear(this.simplifiedGeometryCache),this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var i=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(i))return this.simplifiedGeometryCache[i];var s=this.getSimplifiedGeometryInternal(t);return s.getFlatCoordinates().length<this.flatCoordinates.length?(this.simplifiedGeometryCache[i]=s,s):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)},Di.prototype.getSimplifiedGeometryInternal=function(){return this},Di.prototype.getStride=function(){return this.stride},Di.prototype.setFlatCoordinatesInternal=function(t,i){this.stride=Di.getStrideForLayout(t),this.layout=t,this.flatCoordinates=i},Di.prototype.setCoordinates=function(){},Di.prototype.setLayout=function(t,i,s){var h;if(t)h=Di.getStrideForLayout(t);else{var n;for(n=0;n<s;++n){if(0===i.length)return this.layout="XY",void(this.stride=2);i=i[0]}t=Di.getLayoutForStride_(h=i.length)}this.layout=t,this.stride=h},Di.prototype.applyTransform=function(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},Di.prototype.rotate=function(t,i){var s=this.getFlatCoordinates();if(s){var h=this.getStride();Si(s,0,s.length,h,t,i,s),this.changed()}},Di.prototype.scale=function(t,i,s){var h=i;void 0===h&&(h=t);var n=s;n||(n=bi.getCenter(this.getExtent()));var r=this.getFlatCoordinates();if(r){var e=this.getStride();Ci(r,0,r.length,e,t,h,n,r),this.changed()}},Di.prototype.translate=function(t,i){var s=this.getFlatCoordinates();if(s){var h=this.getStride();Ai(s,0,s.length,h,t,i,s),this.changed()}},Di.transform2D=function(t,i,s){var h=t.getFlatCoordinates();if(h){var n=t.getStride();return Ei(h,0,h.length,n,i,s)}return null};var Gi={linearRing:function(t,i,s,h){for(var n=0,r=t[s-h],e=t[s-h+1];i<s;i+=h){var o=t[i],a=t[i+1];n+=e*o-r*a,r=o,e=a}return n/2},linearRings:function(t,i,s,h){var n,r,e=0;for(n=0,r=s.length;n<r;++n){var o=s[n];e+=Gi.linearRing(t,i,o,h),i=o}return e},linearRingss:function(t,i,s,h){var n,r,e=0;for(n=0,r=s.length;n<r;++n){var o=s[n];e+=Gi.linearRings(t,i,o,h),i=o[o.length-1]}return e}},Wi={point:function(t,i,s,h,n,r,e){var o,a,u=t[i],f=t[i+1],c=t[s]-u,l=t[s+1]-f;if(0===c&&0===l)a=i;else{var v=((n-u)*c+(r-f)*l)/(c*c+l*l);if(v>1)a=s;else{if(v>0){for(o=0;o<h;++o)e[o]=_i.lerp(t[i+o],t[s+o],v);return void(e.length=h)}a=i}}for(o=0;o<h;++o)e[o]=t[a+o];e.length=h},getMaxSquaredDelta:function(t,i,s,h,n){var r=t[i],e=t[i+1];for(i+=h;i<s;i+=h){var o=t[i],a=t[i+1],u=_i.squaredDistance(r,e,o,a);u>n&&(n=u),r=o,e=a}return n},getsMaxSquaredDelta:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];n=Wi.getMaxSquaredDelta(t,i,o,h,n),i=o}return n},getssMaxSquaredDelta:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];n=Wi.getsMaxSquaredDelta(t,i,o,h,n),i=o[o.length-1]}return n},getClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){if(i==s)return u;var c,l;if(0===n){if((l=_i.squaredDistance(e,o,t[i],t[i+1]))<u){for(c=0;c<h;++c)a[c]=t[i+c];return a.length=h,l}return u}for(var v=f||[NaN,NaN],d=i+h;d<s;)if(Wi.point(t,d-h,d,h,e,o,v),(l=_i.squaredDistance(e,o,v[0],v[1]))<u){for(u=l,c=0;c<h;++c)a[c]=v[c];a.length=h,d+=h}else d+=h*Math.max((Math.sqrt(l)-Math.sqrt(u))/n|0,1);if(r&&(Wi.point(t,s-h,i,h,e,o,v),(l=_i.squaredDistance(e,o,v[0],v[1]))<u)){for(u=l,c=0;c<h;++c)a[c]=v[c];a.length=h}return u},getsClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v=f||[NaN,NaN];for(c=0,l=s.length;c<l;++c){var d=s[c];u=Wi.getClosestPoint(t,i,d,h,n,r,e,o,a,u,v),i=d}return u},getssClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v=f||[NaN,NaN];for(c=0,l=s.length;c<l;++c){var d=s[c];u=Wi.getsClosestPoint(t,i,d,h,n,r,e,o,a,u,v),i=d[d.length-1]}return u}},Vi={coordinate:function(t,i,s){var h,n;for(h=0,n=s.length;h<n;++h)t[i++]=s[h];return i},coordinates:function(t,i,s,h){var n,r;for(n=0,r=s.length;n<r;++n){var e,o=s[n];for(e=0;e<h;++e)t[i++]=o[e]}return i},coordinatess:function(t,i,s,h,n){var r,e,o=n||[],a=0;for(r=0,e=s.length;r<e;++r){var u=Vi.coordinates(t,i,s[r],h);o[a++]=u,i=u}return o.length=a,o},coordinatesss:function(t,i,s,h,n){var r,e,o=n||[],a=0;for(r=0,e=s.length;r<e;++r){var u=Vi.coordinatess(t,i,s[r],h,o[a]);o[a++]=u,i=u[u.length-1]}return o.length=a,o}},ji={coordinates:function(t,i,s,h,n){var r,e=void 0!==n?n:[],o=0;for(r=i;r<s;r+=h)e[o++]=t.slice(r,r+h);return e.length=o,e},coordinatess:function(t,i,s,h,n){var r,e,o=void 0!==n?n:[],a=0;for(r=0,e=s.length;r<e;++r){var u=s[r];o[a++]=ji.coordinates(t,i,u,h,o[a]),i=u}return o.length=a,o},coordinatesss:function(t,i,s,h,n){var r,e,o=void 0!==n?n:[],a=0;for(r=0,e=s.length;r<e;++r){var u=s[r];o[a++]=ji.coordinatess(t,i,u,h,o[a]),i=u[u.length-1]}return o.length=a,o}},Ui={lineString:function(t,i,s,h,n,r,e){var o=void 0!==e?e:[];return r||(s=Ui.radialDistance(t,i,s,h,n,o,0),t=o,i=0,h=2),o.length=Ui.douglasPeucker(t,i,s,h,n,o,0),o},douglasPeucker:function(t,i,s,h,n,r,e){var o=(s-i)/h;if(o<3){for(;i<s;i+=h)r[e++]=t[i],r[e++]=t[i+1];return e}var a=new Array(o);a[0]=1,a[o-1]=1;for(var u,f=[i,s-h],c=0;f.length>0;){var l=f.pop(),v=f.pop(),d=0,M=t[v],m=t[v+1],p=t[l],g=t[l+1];for(u=v+h;u<l;u+=h){var _=_i.squaredSegmentDistance(t[u],t[u+1],M,m,p,g);_>d&&(c=u,d=_)}d>n&&(a[(c-i)/h]=1,v+h<c&&f.push(v,c),c+h<l&&f.push(c,l))}for(u=0;u<o;++u)a[u]&&(r[e++]=t[i+u*h],r[e++]=t[i+u*h+1]);return e},douglasPeuckers:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a];e=Ui.douglasPeucker(t,i,f,h,n,r,e),o.push(e),i=f}return e},douglasPeuckerss:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a],c=[];e=Ui.douglasPeuckers(t,i,f,h,n,r,e,c),o.push(c),i=f[f.length-1]}return e},radialDistance:function(t,i,s,h,n,r,e){if(s<=i+h){for(;i<s;i+=h)r[e++]=t[i],r[e++]=t[i+1];return e}var o=t[i],a=t[i+1];r[e++]=o,r[e++]=a;var u=o,f=a;for(i+=h;i<s;i+=h)_i.squaredDistance(o,a,u=t[i],f=t[i+1])>n&&(r[e++]=u,r[e++]=f,o=u,a=f);return u==o&&f==a||(r[e++]=u,r[e++]=f),e},snap:function(t,i){return i*Math.round(t/i)},quantize:function(t,i,s,h,n,r,e){if(i==s)return e;var o,a,u=Ui.snap(t[i],n),f=Ui.snap(t[i+1],n);i+=h,r[e++]=u,r[e++]=f;do{if(o=Ui.snap(t[i],n),a=Ui.snap(t[i+1],n),(i+=h)==s)return r[e++]=o,r[e++]=a,e}while(o==u&&a==f);for(;i<s;){var c,l;if(c=Ui.snap(t[i],n),l=Ui.snap(t[i+1],n),i+=h,c!=o||l!=a){var v=o-u,d=a-f,M=c-u,m=l-f;v*m==d*M&&(v<0&&M<v||v==M||v>0&&M>v)&&(d<0&&m<d||d==m||d>0&&m>d)?(o=c,a=l):(r[e++]=o,r[e++]=a,u=o,f=a,o=c,a=l)}}return r[e++]=o,r[e++]=a,e},quantizes:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a];e=Ui.quantize(t,i,f,h,n,r,e),o.push(e),i=f}return e},quantizess:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a],c=[];e=Ui.quantizes(t,i,f,h,n,r,e,c),o.push(c),i=f[f.length-1]}return e}},Xi=function(t,i){Di.call(this),this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.setCoordinates(t,i)};ui.inherits(Xi,Di),Xi.prototype.clone=function(){var t=new Xi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice()),t},Xi.prototype.closestPointXY=function(t,i,s,h){return h<bi.closestSquaredDistanceXY(this.getExtent(),t,i)?h:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Wi.getMaxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wi.getClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,i,s,h))},Xi.prototype.getArea=function(){return Gi.linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},Xi.prototype.getCoordinates=function(){return ji.coordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},Xi.prototype.getSimplifiedGeometryInternal=function(t){var i=[];i.length=Ui.douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i,0);var s=new Xi(null);return s.setFlatCoordinates("XY",i),s},Xi.prototype.getType=function(){return"LinearRing"},Xi.prototype.intersectsExtent=function(){},Xi.prototype.setCoordinates=function(t,i){t?(this.setLayout(i,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vi.coordinates(this.flatCoordinates,0,t,this.stride),this.changed()):this.setFlatCoordinates("XY",null)},Xi.prototype.setFlatCoordinates=function(t,i){this.setFlatCoordinatesInternal(t,i),this.changed()};var qi=function(t,i){Di.call(this),this.setCoordinates(t,i)};ui.inherits(qi,Di),qi.prototype.clone=function(){var t=new qi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice()),t},qi.prototype.closestPointXY=function(t,i,s,h){var n=this.flatCoordinates,r=_i.squaredDistance(t,i,n[0],n[1]);if(r<h){var e,o=this.stride;for(e=0;e<o;++e)s[e]=n[e];return s.length=o,r}return h},qi.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},qi.prototype.computeExtent=function(t){return bi.createOrUpdateFromCoordinate(this.flatCoordinates,t)},qi.prototype.getType=function(){return"Point"},qi.prototype.intersectsExtent=function(t){return bi.containsXY(t,this.flatCoordinates[0],this.flatCoordinates[1])},qi.prototype.setCoordinates=function(t,i){t?(this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vi.coordinate(this.flatCoordinates,0,t,this.stride),this.changed()):this.setFlatCoordinates("XY",null)},qi.prototype.setFlatCoordinates=function(t,i){this.setFlatCoordinatesInternal(t,i),this.changed()};var Yi={linearRingContainsExtent:function(t,i,s,h,n){return!bi.forEachCorner(n,(function(n){return!Yi.linearRingContainsXY(t,i,s,h,n[0],n[1])}))},linearRingContainsXY:function(t,i,s,h,n,r){for(var e=0,o=t[s-h],a=t[s-h+1];i<s;i+=h){var u=t[i],f=t[i+1];a<=r?f>r&&(u-o)*(r-a)-(n-o)*(f-a)>0&&e++:f<=r&&(u-o)*(r-a)-(n-o)*(f-a)<0&&e--,o=u,a=f}return 0!==e},linearRingsContainsXY:function(t,i,s,h,n,r){if(0===s.length)return!1;if(!Yi.linearRingContainsXY(t,i,s[0],h,n,r))return!1;var e,o;for(e=1,o=s.length;e<o;++e)if(Yi.linearRingContainsXY(t,s[e-1],s[e],h,n,r))return!1;return!0},linearRingssContainsXY:function(t,i,s,h,n,r){if(0===s.length)return!1;var e,o;for(e=0,o=s.length;e<o;++e){var a=s[e];if(Yi.linearRingsContainsXY(t,i,a,h,n,r))return!0;i=a[a.length-1]}return!1}},Bi={linearRings:function(t,i,s,h,n,r,e){for(var o,a,u,f,c,l,v,d=n[r+1],M=[],m=0,p=s.length;m<p;++m){var g=s[m];for(f=t[g-h],l=t[g-h+1],o=i;o<g;o+=h)c=t[o],v=t[o+1],(d<=l&&v<=d||l<=d&&d<=v)&&M.push(u=(d-l)/(v-l)*(c-f)+f),f=c,l=v}var _=NaN,w=-1/0;for(M.sort(yi.numberSafeCompareFunction),f=M[0],o=1,a=M.length;o<a;++o){c=M[o];var y=Math.abs(c-f);y>w&&Yi.linearRingsContainsXY(t,i,s,h,u=(f+c)/2,d)&&(_=u,w=y),f=c}return isNaN(_)&&(_=n[r]),e?(e.push(_,d,w),e):[_,d,w]},linearRingss:function(t,i,s,h,n){var r,e,o=[];for(r=0,e=s.length;r<e;++r){var a=s[r];o=Bi.linearRings(t,i,a,h,n,2*r,o),i=a[a.length-1]}return o}},Hi=function(t,i,s,h,n,r){for(var e,o=[t[i],t[i+1]],a=[];i+h<s;i+=h){if(a[0]=t[i+h],a[1]=t[i+h+1],e=n.call(r,o,a))return e;o[0]=a[0],o[1]=a[1]}return!1},Ji={lineString:function(t,i,s,h,n){var r=bi.extendFlatCoordinates(bi.createEmpty(),t,i,s,h);return!!bi.intersects(n,r)&&(!!bi.containsExtent(n,r)||r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||Hi(t,i,s,h,(function(t,i){return bi.intersectsSegment(n,t,i)})))},lineStrings:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){if(Ji.lineString(t,i,s[r],h,n))return!0;i=s[r]}return!1},linearRing:function(t,i,s,h,n){return!!(Ji.lineString(t,i,s,h,n)||Yi.linearRingContainsXY(t,i,s,h,n[0],n[1])||Yi.linearRingContainsXY(t,i,s,h,n[0],n[3])||Yi.linearRingContainsXY(t,i,s,h,n[2],n[1])||Yi.linearRingContainsXY(t,i,s,h,n[2],n[3]))},linearRings:function(t,i,s,h,n){if(!Ji.linearRing(t,i,s[0],h,n))return!1;if(1===s.length)return!0;var r,e;for(r=1,e=s.length;r<e;++r)if(Yi.linearRingContainsExtent(t,s[r-1],s[r],h,n))return!1;return!0},linearRingss:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];if(Ji.linearRings(t,i,o,h,n))return!0;i=o[o.length-1]}return!1}},Zi=function(t,i,s,h){for(;i<s-h;){var n;for(n=0;n<h;++n){var r=t[i+n];t[i+n]=t[s-h+n],t[s-h+n]=r}i+=h,s-=h}},Ki={linearRingIsClockwise:function(t,i,s,h){for(var n=0,r=t[s-h],e=t[s-h+1];i<s;i+=h){var o=t[i],a=t[i+1];n+=(o-r)*(a+e),r=o,e=a}return n>0},linearRingsAreOriented:function(t,i,s,h,n){var r,e,o=void 0!==n&&n;for(r=0,e=s.length;r<e;++r){var a=s[r],u=Ki.linearRingIsClockwise(t,i,a,h);if(0===r){if(o&&u||!o&&!u)return!1}else if(o&&!u||!o&&u)return!1;i=a}return!0},linearRingssAreOriented:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r)if(!Ki.linearRingsAreOriented(t,i,s[r],h,n))return!1;return!0},orientLinearRings:function(t,i,s,h,n){var r,e,o=void 0!==n&&n;for(r=0,e=s.length;r<e;++r){var a=s[r],u=Ki.linearRingIsClockwise(t,i,a,h);(0===r?o&&u||!o&&!u:o&&!u||!o&&u)&&Zi(t,i,a,h),i=a}return i},orientLinearRingss:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r)i=Ki.orientLinearRings(t,i,s[r],h,n);return i}},Qi=function(t,i){Di.call(this),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,this.setCoordinates(t,i)};ui.inherits(Qi,Di),Qi.prototype.appendLinearRing=function(t){this.flatCoordinates?yi.extend(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},Qi.prototype.clone=function(){var t=new Qi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice(),this.ends_.slice()),t},Qi.prototype.closestPointXY=function(t,i,s,h){return h<bi.closestSquaredDistanceXY(this.getExtent(),t,i)?h:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Wi.getsMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wi.getsClosestPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,i,s,h))},Qi.prototype.containsXY=function(t,i){return Yi.linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,i)},Qi.prototype.getArea=function(){return Gi.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},Qi.prototype.getCoordinates=function(t){var i;return void 0!==t?(i=this.getOrientedFlatCoordinates().slice(),Ki.orientLinearRings(i,0,this.ends_,this.stride,t)):i=this.flatCoordinates,ji.coordinatess(i,0,this.ends_,this.stride)},Qi.prototype.getEnds=function(){return this.ends_},Qi.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=bi.getCenter(this.getExtent());this.flatInteriorPoint_=Bi.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},Qi.prototype.getInteriorPoint=function(){return new qi(this.getFlatInteriorPoint(),"XYM")},Qi.prototype.getLinearRingCount=function(){return this.ends_.length},Qi.prototype.getLinearRing=function(t){if(t<0||this.ends_.length<=t)return null;var i=new Xi(null);return i.setFlatCoordinates(this.layout,this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t])),i},Qi.prototype.getLinearRings=function(){var t,i,s=this.layout,h=this.flatCoordinates,n=this.ends_,r=[],e=0;for(t=0,i=n.length;t<i;++t){var o=n[t],a=new Xi(null);a.setFlatCoordinates(s,h.slice(e,o)),r.push(a),e=o}return r},Qi.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;Ki.linearRingsAreOriented(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ki.orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},Qi.prototype.getSimplifiedGeometryInternal=function(t){var i=[],s=[];i.length=Ui.quantizes(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),i,0,s);var h=new Qi(null);return h.setFlatCoordinates("XY",i,s),h},Qi.prototype.getType=function(){return"Polygon"},Qi.prototype.intersectsExtent=function(t){return Ji.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)},Qi.prototype.setCoordinates=function(t,i){if(t){this.setLayout(i,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var s=Vi.coordinatess(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===s.length?0:s[s.length-1],this.changed()}else this.setFlatCoordinates("XY",null,this.ends_)},Qi.prototype.setFlatCoordinates=function(t,i,s){this.setFlatCoordinatesInternal(t,i),this.ends_=s,this.changed()},Qi.circular=function(t,i,s,h){var n,r=h||32,e=[];for(n=0;n<r;++n)yi.extend(e,t.offset(i,s,2*Math.PI*n/r));e.push(e[0],e[1]);var o=new Qi(null);return o.setFlatCoordinates("XY",e,[e.length]),o},Qi.fromExtent=function(t){var i=t[0],s=t[1],h=t[2],n=t[3],r=[i,s,i,n,h,n,h,s,i,s],e=new Qi(null);return e.setFlatCoordinates("XY",r,[r.length]),e},Qi.fromCircle=function(t,i,s){for(var h=i||32,n=t.getStride(),r=t.getLayout(),e=new Qi(null,r),o=n*(h+1),a=new Array(o),u=0;u<o;u++)a[u]=0;return e.setFlatCoordinates(r,a,[a.length]),Qi.makeRegular(e,t.getCenter(),t.getRadius(),s),e},Qi.makeRegular=function(t,i,s,h){for(var n,r,e=t.getFlatCoordinates(),o=t.getLayout(),a=t.getStride(),u=t.getEnds(),f=e.length/a-1,c=h||0,l=0;l<=f;++l)r=l*a,n=c+2*_i.modulo(l,f)*Math.PI/f,e[r]=i[0]+s*Math.cos(n),e[r+1]=i[1]+s*Math.sin(n);t.setFlatCoordinates(o,e,u)};var $i={ONE:1,SRC_ALPHA:770,COLOR_ATTACHMENT0:36064,COLOR_BUFFER_BIT:16384,TRIANGLES:4,TRIANGLE_STRIP:5,ONE_MINUS_SRC_ALPHA:771,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,CULL_FACE:2884,BLEND:3042,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126,RGBA:6408,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,LINK_STATUS:35714,LINEAR:9729,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE0:33984,CLAMP_TO_EDGE:33071,COMPILE_STATUS:35713,FRAMEBUFFER:36160,CONTEXT_IDS_:["experimental-webgl","webgl","webkit-3d","moz-webgl"],getContext:function(t,i){var s,h,n=$i.CONTEXT_IDS_.length;for(h=0;h<n;++h)try{if(s=t.getContext($i.CONTEXT_IDS_[h],i))return s}catch(r){}return null}},ts={},is="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"";ts.FIREFOX=-1!==is.indexOf("firefox"),ts.SAFARI=-1!==is.indexOf("safari")&&-1==is.indexOf("chrom"),ts.WEBKIT=-1!==is.indexOf("webkit")&&-1==is.indexOf("edge"),ts.MAC=-1!==is.indexOf("macintosh"),ts.DEVICE_PIXEL_RATIO=window.devicePixelRatio||1,ts.CANVAS_LINE_DASH=!1,ts.CANVAS=ui.ENABLE_CANVAS&&function(){if(!("HTMLCanvasElement"in window))return!1;try{var t=document.createElement("CANVAS").getContext("2d");return!!t&&(void 0!==t.setLineDash&&(ts.CANVAS_LINE_DASH=!0),!0)}catch(i){return!1}}(),ts.DEVICE_ORIENTATION="DeviceOrientationEvent"in window,ts.GEOLOCATION="geolocation"in navigator,ts.TOUCH=ui.ASSUME_TOUCH||"ontouchstart"in window,ts.POINTER="PointerEvent"in window,ts.MSPOINTER=!!navigator.msPointerEnabled,function(){if(ui.ENABLE_WEBGL){var t,i=!1,s=[];if("WebGLRenderingContext"in window)try{var h=document.createElement("CANVAS"),n=$i.getContext(h,{failIfMajorPerformanceCaveat:!0});n&&(i=!0,t=n.getParameter(n.MAX_TEXTURE_SIZE),s=n.getSupportedExtensions())}catch(r){}ts.WEBGL=i,ui.WEBGL_EXTENSIONS=s,ui.WEBGL_MAX_TEXTURE_SIZE=t}}();var ss=function(t){mi.call(this);var i=t||{};this.position_=null,this.transform_=Li.identityTransform,this.sphere_=new wi(ki.RADIUS),this.watchId_=void 0,ci.listen(this,mi.getChangeEventType("projection"),this.handleProjectionChanged_,this),ci.listen(this,mi.getChangeEventType("tracking"),this.handleTrackingChanged_,this),void 0!==i.projection&&this.setProjection(i.projection),void 0!==i.trackingOptions&&this.setTrackingOptions(i.trackingOptions),this.setTracking(void 0!==i.tracking&&i.tracking)};ui.inherits(ss,mi),ss.prototype.disposeInternal=function(){this.setTracking(!1),mi.prototype.disposeInternal.call(this)},ss.prototype.handleProjectionChanged_=function(){var t=this.getProjection();t&&(this.transform_=Li.getTransformFromProjections(Li.get("EPSG:4326"),t),this.position_&&this.set("position",this.transform_(this.position_)))},ss.prototype.handleTrackingChanged_=function(){if(ts.GEOLOCATION){var t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}},ss.prototype.positionChange_=function(t){var i=t.coords;this.set("accuracy",i.accuracy),this.set("altitude",null===i.altitude?void 0:i.altitude),this.set("altitudeAccuracy",null===i.altitudeAccuracy?void 0:i.altitudeAccuracy),this.set("heading",null===i.heading?void 0:_i.toRadians(i.heading)),this.position_?(this.position_[0]=i.longitude,this.position_[1]=i.latitude):this.position_=[i.longitude,i.latitude];var s=this.transform_(this.position_);this.set("position",s),this.set("speed",null===i.speed?void 0:i.speed);var h=Qi.circular(this.sphere_,this.position_,i.accuracy);h.applyTransform(this.transform_),this.set("accuracyGeometry",h),this.changed()},ss.prototype.positionError_=function(t){t.type="error",this.setTracking(!1),this.dispatchEvent(t)},ss.prototype.getAccuracy=function(){return this.get("accuracy")},ss.prototype.getAccuracyGeometry=function(){return this.get("accuracyGeometry")||null},ss.prototype.getAltitude=function(){return this.get("altitude")},ss.prototype.getAltitudeAccuracy=function(){return this.get("altitudeAccuracy")},ss.prototype.getHeading=function(){return this.get("heading")},ss.prototype.getPosition=function(){return this.get("position")},ss.prototype.getProjection=function(){return this.get("projection")},ss.prototype.getSpeed=function(){return this.get("speed")},ss.prototype.getTracking=function(){return this.get("tracking")},ss.prototype.getTrackingOptions=function(){return this.get("trackingOptions")},ss.prototype.setProjection=function(t){this.set("projection",Li.get(t))},ss.prototype.setTracking=function(t){this.set("tracking",t)},ss.prototype.setTrackingOptions=function(t){this.set("trackingOptions",t)};var hs=function(t,i){if(mi.call(this),this.unique_=!!(i||{}).unique,this.array_=t||[],this.unique_)for(var s=0,h=this.array_.length;s<h;++s)this.assertUnique_(this.array_[s],s);this.updateLength_()};ui.inherits(hs,mi),hs.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},hs.prototype.extend=function(t){var i,s;for(i=0,s=t.length;i<s;++i)this.push(t[i]);return this},hs.prototype.forEach=function(t,i){for(var s=i?t.bind(i):t,h=this.array_,n=0,r=h.length;n<r;++n)s(h[n],n,h)},hs.prototype.getArray=function(){return this.array_},hs.prototype.item=function(t){return this.array_[t]},hs.prototype.getLength=function(){return this.get(hs.Property_.LENGTH)},hs.prototype.insertAt=function(t,i){this.unique_&&this.assertUnique_(i),this.array_.splice(t,0,i),this.updateLength_(),this.dispatchEvent(new hs.Event("add",i))},hs.prototype.pop=function(){return this.removeAt(this.getLength()-1)},hs.prototype.push=function(t){this.unique_&&this.assertUnique_(t);var i=this.getLength();return this.insertAt(i,t),this.getLength()},hs.prototype.remove=function(t){var i,s,h=this.array_;for(i=0,s=h.length;i<s;++i)if(h[i]===t)return this.removeAt(i)},hs.prototype.removeAt=function(t){var i=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new hs.Event("remove",i)),i},hs.prototype.setAt=function(t,i){var s=this.getLength();if(t<s){this.unique_&&this.assertUnique_(i,t);var h=this.array_[t];this.array_[t]=i,this.dispatchEvent(new hs.Event("remove",h)),this.dispatchEvent(new hs.Event("add",i))}else{var n;for(n=s;n<t;++n)this.insertAt(n,void 0);this.insertAt(t,i)}},hs.prototype.updateLength_=function(){this.set(hs.Property_.LENGTH,this.array_.length)},hs.prototype.assertUnique_=function(t,i){for(var s=0,h=this.array_.length;s<h;++s)if(this.array_[s]===t&&s!==i)throw new pi(58)},hs.Property_={LENGTH:"length"},ui.inherits(hs.Event=function(t,i){vi.call(this,t),this.element=i},vi);var ns=function(t,i,s){vi.call(this,t),this.map=i,this.frameState=void 0!==s?s:null};ui.inherits(ns,vi);var rs=function(t,i,s,h,n){ns.call(this,t,i,n),this.originalEvent=s,this.pixel=i.getEventPixel(s),this.coordinate=i.getCoordinateFromPixel(this.pixel),this.dragging=void 0!==h&&h};ui.inherits(rs,ns),rs.prototype.preventDefault=function(){ns.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},rs.prototype.stopPropagation=function(){ns.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()};var es={SINGLECLICK:"singleclick",CLICK:"click",DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},os=function(t,i,s,h,n){rs.call(this,t,i,s.originalEvent,h,n),this.pointerEvent=s};ui.inherits(os,rs);var as=function(t,i){this.dispatcher=t,this.mapping_=i};as.prototype.getEvents=function(){return Object.keys(this.mapping_)},as.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var us=function(t){as.call(this,t,{mousedown:this.mousedown,mousemove:this.mousemove,mouseup:this.mouseup,mouseover:this.mouseover,mouseout:this.mouseout}),this.pointerMap=t.pointerMap,this.lastTouches=[]};ui.inherits(us,as),us.POINTER_ID=1,us.POINTER_TYPE="mouse",us.DEDUP_DIST=25,us.prototype.isEventSimulatedFromTouch_=function(t){for(var i,s=this.lastTouches,h=t.clientX,n=t.clientY,r=0,e=s.length;r<e&&(i=s[r]);r++){var o=Math.abs(h-i[0]),a=Math.abs(n-i[1]);if(o<=us.DEDUP_DIST&&a<=us.DEDUP_DIST)return!0}return!1},us.prepareEvent=function(t,i){var s=i.cloneEvent(t,t),h=s.preventDefault;return s.preventDefault=function(){t.preventDefault(),h()},s.pointerId=us.POINTER_ID,s.isPrimary=!0,s.pointerType=us.POINTER_TYPE,s},us.prototype.mousedown=function(t){if(!this.isEventSimulatedFromTouch_(t)){us.POINTER_ID.toString()in this.pointerMap&&this.cancel(t);var i=us.prepareEvent(t,this.dispatcher);this.pointerMap[us.POINTER_ID.toString()]=t,this.dispatcher.down(i,t)}},us.prototype.mousemove=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.move(i,t)}},us.prototype.mouseup=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=this.pointerMap[us.POINTER_ID.toString()];if(i&&i.button===t.button){var s=us.prepareEvent(t,this.dispatcher);this.dispatcher.up(s,t),this.cleanupMouse()}}},us.prototype.mouseover=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.enterOver(i,t)}},us.prototype.mouseout=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.leaveOut(i,t)}},us.prototype.cancel=function(t){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.cancel(i,t),this.cleanupMouse()},us.prototype.cleanupMouse=function(){delete this.pointerMap[us.POINTER_ID.toString()]};var fs=function(t){as.call(this,t,{MSPointerDown:this.msPointerDown,MSPointerMove:this.msPointerMove,MSPointerUp:this.msPointerUp,MSPointerOut:this.msPointerOut,MSPointerOver:this.msPointerOver,MSPointerCancel:this.msPointerCancel,MSGotPointerCapture:this.msGotPointerCapture,MSLostPointerCapture:this.msLostPointerCapture}),this.pointerMap=t.pointerMap,this.POINTER_TYPES=["","unavailable","touch","pen","mouse"]};ui.inherits(fs,as),fs.prototype.prepareEvent_=function(t){var i=t;return"number"==typeof t.pointerType&&((i=this.dispatcher.cloneEvent(t,t)).pointerType=this.POINTER_TYPES[t.pointerType]),i},fs.prototype.cleanup=function(t){delete this.pointerMap[t.toString()]},fs.prototype.msPointerDown=function(t){this.pointerMap[t.pointerId.toString()]=t;var i=this.prepareEvent_(t);this.dispatcher.down(i,t)},fs.prototype.msPointerMove=function(t){var i=this.prepareEvent_(t);this.dispatcher.move(i,t)},fs.prototype.msPointerUp=function(t){var i=this.prepareEvent_(t);this.dispatcher.up(i,t),this.cleanup(t.pointerId)},fs.prototype.msPointerOut=function(t){var i=this.prepareEvent_(t);this.dispatcher.leaveOut(i,t)},fs.prototype.msPointerOver=function(t){var i=this.prepareEvent_(t);this.dispatcher.enterOver(i,t)},fs.prototype.msPointerCancel=function(t){var i=this.prepareEvent_(t);this.dispatcher.cancel(i,t),this.cleanup(t.pointerId)},fs.prototype.msLostPointerCapture=function(t){var i=this.dispatcher.makeEvent("lostpointercapture",t,t);this.dispatcher.dispatchEvent(i)},fs.prototype.msGotPointerCapture=function(t){var i=this.dispatcher.makeEvent("gotpointercapture",t,t);this.dispatcher.dispatchEvent(i)};var cs=function(t){as.call(this,t,{pointerdown:this.pointerDown,pointermove:this.pointerMove,pointerup:this.pointerUp,pointerout:this.pointerOut,pointerover:this.pointerOver,pointercancel:this.pointerCancel,gotpointercapture:this.gotPointerCapture,lostpointercapture:this.lostPointerCapture})};ui.inherits(cs,as),cs.prototype.pointerDown=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerMove=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerUp=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerOut=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerOver=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerCancel=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.lostPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.gotPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};var ls=function(t,i,s){vi.call(this,t),this.originalEvent=i;var h=s||{};this.buttons=this.getButtons_(h),this.pressure=this.getPressure_(h,this.buttons),this.bubbles="bubbles"in h&&h.bubbles,this.cancelable="cancelable"in h&&h.cancelable,this.view="view"in h?h.view:null,this.detail="detail"in h?h.detail:null,this.screenX="screenX"in h?h.screenX:0,this.screenY="screenY"in h?h.screenY:0,this.clientX="clientX"in h?h.clientX:0,this.clientY="clientY"in h?h.clientY:0,this.ctrlKey="ctrlKey"in h&&h.ctrlKey,this.altKey="altKey"in h&&h.altKey,this.shiftKey="shiftKey"in h&&h.shiftKey,this.metaKey="metaKey"in h&&h.metaKey,this.button="button"in h?h.button:0,this.relatedTarget="relatedTarget"in h?h.relatedTarget:null,this.pointerId="pointerId"in h?h.pointerId:0,this.width="width"in h?h.width:0,this.height="height"in h?h.height:0,this.tiltX="tiltX"in h?h.tiltX:0,this.tiltY="tiltY"in h?h.tiltY:0,this.pointerType="pointerType"in h?h.pointerType:"",this.hwTimestamp="hwTimestamp"in h?h.hwTimestamp:0,this.isPrimary="isPrimary"in h&&h.isPrimary,i.preventDefault&&(this.preventDefault=function(){i.preventDefault()})};ui.inherits(ls,vi),ls.prototype.getButtons_=function(t){var i;if(t.buttons||ls.HAS_BUTTONS)i=t.buttons;else switch(t.which){case 1:i=1;break;case 2:i=4;break;case 3:i=2;break;default:i=0}return i},ls.prototype.getPressure_=function(t,i){return t.pressure?t.pressure:i?.5:0},ls.HAS_BUTTONS=!1,function(){try{var t=new MouseEvent("click",{buttons:1});ls.HAS_BUTTONS=1===t.buttons}catch(i){}}();var vs=function(t,i){as.call(this,t,{touchstart:this.touchstart,touchmove:this.touchmove,touchend:this.touchend,touchcancel:this.touchcancel}),this.pointerMap=t.pointerMap,this.mouseSource=i,this.firstTouchId_=void 0,this.clickCount_=0,this.resetId_=void 0};ui.inherits(vs,as),vs.DEDUP_TIMEOUT=2500,vs.CLICK_COUNT_TIMEOUT=200,vs.POINTER_TYPE="touch",vs.prototype.isPrimaryTouch_=function(t){return this.firstTouchId_===t.identifier},vs.prototype.setPrimaryTouch_=function(t){var i=Object.keys(this.pointerMap).length;(0===i||1===i&&us.POINTER_ID.toString()in this.pointerMap)&&(this.firstTouchId_=t.identifier,this.cancelResetClickCount_())},vs.prototype.removePrimaryPointer_=function(t){t.isPrimary&&(this.firstTouchId_=void 0,this.resetClickCount_())},vs.prototype.resetClickCount_=function(){this.resetId_=setTimeout(this.resetClickCountHandler_.bind(this),vs.CLICK_COUNT_TIMEOUT)},vs.prototype.resetClickCountHandler_=function(){this.clickCount_=0,this.resetId_=void 0},vs.prototype.cancelResetClickCount_=function(){void 0!==this.resetId_&&clearTimeout(this.resetId_)},vs.prototype.touchToPointer_=function(t,i){var s=this.dispatcher.cloneEvent(t,i);return s.pointerId=i.identifier+2,s.bubbles=!0,s.cancelable=!0,s.detail=this.clickCount_,s.button=0,s.buttons=1,s.width=i.webkitRadiusX||i.radiusX||0,s.height=i.webkitRadiusY||i.radiusY||0,s.pressure=i.webkitForce||i.force||.5,s.isPrimary=this.isPrimaryTouch_(i),s.pointerType=vs.POINTER_TYPE,s.clientX=i.clientX,s.clientY=i.clientY,s.screenX=i.screenX,s.screenY=i.screenY,s},vs.prototype.processTouches_=function(t,i){var s,h,n=Array.prototype.slice.call(t.changedTouches),r=n.length;function e(){t.preventDefault()}for(s=0;s<r;++s)(h=this.touchToPointer_(t,n[s])).preventDefault=e,i.call(this,t,h)},vs.prototype.findTouch_=function(t,i){for(var s=t.length,h=0;h<s;h++)if(t[h].identifier===i)return!0;return!1},vs.prototype.vacuumTouches_=function(t){var i=t.touches,s=Object.keys(this.pointerMap),h=s.length;if(h>=i.length){var n,r,e,o=[];for(n=0;n<h;++n)e=this.pointerMap[r=s[n]],r==us.POINTER_ID||this.findTouch_(i,r-2)||o.push(e.out);for(n=0;n<o.length;++n)this.cancelOut_(t,o[n])}},vs.prototype.touchstart=function(t){this.vacuumTouches_(t),this.setPrimaryTouch_(t.changedTouches[0]),this.dedupSynthMouse_(t),this.clickCount_++,this.processTouches_(t,this.overDown_)},vs.prototype.overDown_=function(t,i){this.pointerMap[i.pointerId]={target:i.target,out:i,outTarget:i.target},this.dispatcher.over(i,t),this.dispatcher.enter(i,t),this.dispatcher.down(i,t)},vs.prototype.touchmove=function(t){t.preventDefault(),this.processTouches_(t,this.moveOverOut_)},vs.prototype.moveOverOut_=function(t,i){var s=i,h=this.pointerMap[s.pointerId];if(h){var n=h.out,r=h.outTarget;this.dispatcher.move(s,t),n&&r!==s.target&&(n.relatedTarget=s.target,s.relatedTarget=r,n.target=r,s.target?(this.dispatcher.leaveOut(n,t),this.dispatcher.enterOver(s,t)):(s.target=r,s.relatedTarget=null,this.cancelOut_(t,s))),h.out=s,h.outTarget=s.target}},vs.prototype.touchend=function(t){this.dedupSynthMouse_(t),this.processTouches_(t,this.upOut_)},vs.prototype.upOut_=function(t,i){this.dispatcher.up(i,t),this.dispatcher.out(i,t),this.dispatcher.leave(i,t),this.cleanUpPointer_(i)},vs.prototype.touchcancel=function(t){this.processTouches_(t,this.cancelOut_)},vs.prototype.cancelOut_=function(t,i){this.dispatcher.cancel(i,t),this.dispatcher.out(i,t),this.dispatcher.leave(i,t),this.cleanUpPointer_(i)},vs.prototype.cleanUpPointer_=function(t){delete this.pointerMap[t.pointerId],this.removePrimaryPointer_(t)},vs.prototype.dedupSynthMouse_=function(t){var i=this.mouseSource.lastTouches,s=t.changedTouches[0];if(this.isPrimaryTouch_(s)){var h=[s.clientX,s.clientY];i.push(h),setTimeout((function(){yi.remove(i,h)}),vs.DEDUP_TIMEOUT)}};var ds=function(t){di.call(this),this.element_=t,this.pointerMap={},this.eventMap_={},this.eventSourceList_=[],this.registerSources()};ui.inherits(ds,di),ds.prototype.registerSources=function(){if(ts.POINTER)this.registerSource("native",new cs(this));else if(ts.MSPOINTER)this.registerSource("ms",new fs(this));else{var t=new us(this);this.registerSource("mouse",t),ts.TOUCH&&this.registerSource("touch",new vs(this,t))}this.register_()},ds.prototype.registerSource=function(t,i){var s=i,h=s.getEvents();h&&(h.forEach((function(t){var i=s.getHandlerForEvent(t);i&&(this.eventMap_[t]=i.bind(s))}),this),this.eventSourceList_.push(s))},ds.prototype.register_=function(){for(var t=this.eventSourceList_.length,i=0;i<t;i++)this.addEvents_(this.eventSourceList_[i].getEvents())},ds.prototype.unregister_=function(){for(var t=this.eventSourceList_.length,i=0;i<t;i++)this.removeEvents_(this.eventSourceList_[i].getEvents())},ds.prototype.eventHandler_=function(t){var i=this.eventMap_[t.type];i&&i(t)},ds.prototype.addEvents_=function(t){t.forEach((function(t){ci.listen(this.element_,t,this.eventHandler_,this)}),this)},ds.prototype.removeEvents_=function(t){t.forEach((function(t){ci.unlisten(this.element_,t,this.eventHandler_,this)}),this)},ds.prototype.cloneEvent=function(t,i){for(var s,h={},n=0,r=ds.CLONE_PROPS.length;n<r;n++)h[s=ds.CLONE_PROPS[n][0]]=t[s]||i[s]||ds.CLONE_PROPS[n][1];return h},ds.prototype.down=function(t,i){this.fireEvent("pointerdown",t,i)},ds.prototype.move=function(t,i){this.fireEvent("pointermove",t,i)},ds.prototype.up=function(t,i){this.fireEvent("pointerup",t,i)},ds.prototype.enter=function(t,i){t.bubbles=!1,this.fireEvent("pointerenter",t,i)},ds.prototype.leave=function(t,i){t.bubbles=!1,this.fireEvent("pointerleave",t,i)},ds.prototype.over=function(t,i){t.bubbles=!0,this.fireEvent("pointerover",t,i)},ds.prototype.out=function(t,i){t.bubbles=!0,this.fireEvent("pointerout",t,i)},ds.prototype.cancel=function(t,i){this.fireEvent("pointercancel",t,i)},ds.prototype.leaveOut=function(t,i){this.out(t,i),this.contains_(t.target,t.relatedTarget)||this.leave(t,i)},ds.prototype.enterOver=function(t,i){this.over(t,i),this.contains_(t.target,t.relatedTarget)||this.enter(t,i)},ds.prototype.contains_=function(t,i){return!(!t||!i)&&t.contains(i)},ds.prototype.makeEvent=function(t,i,s){return new ls(t,s,i)},ds.prototype.fireEvent=function(t,i,s){var h=this.makeEvent(t,i,s);this.dispatchEvent(h)},ds.prototype.fireNativeEvent=function(t){var i=this.makeEvent(t.type,t,t);this.dispatchEvent(i)},ds.prototype.wrapMouseEvent=function(t,i){return this.makeEvent(t,us.prepareEvent(i,this),i)},ds.prototype.disposeInternal=function(){this.unregister_(),di.prototype.disposeInternal.call(this)},ds.CLONE_PROPS=[["bubbles",!1],["cancelable",!1],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",!1],["altKey",!1],["shiftKey",!1],["metaKey",!1],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",!1],["type",""],["target",null],["currentTarget",null],["which",0]];var Ms=function(t,i){di.call(this),this.map_=t,this.clickTimeoutId_=0,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=i?i*ts.DEVICE_PIXEL_RATIO:ts.DEVICE_PIXEL_RATIO,this.down_=null;var s=this.map_.getViewport();this.activePointers_=0,this.trackedTouches_={},this.pointerEventHandler_=new ds(s),this.documentPointerEventHandler_=null,this.pointerdownListenerKey_=ci.listen(this.pointerEventHandler_,"pointerdown",this.handlePointerDown_,this),this.relayedListenerKey_=ci.listen(this.pointerEventHandler_,"pointermove",this.relayEvent_,this)};ui.inherits(Ms,di),Ms.prototype.emulateClick_=function(t){var i=new os(es.CLICK,this.map_,t);this.dispatchEvent(i),0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=0,i=new os(es.DBLCLICK,this.map_,t),this.dispatchEvent(i)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=0;var i=new os(es.SINGLECLICK,this.map_,t);this.dispatchEvent(i)}.bind(this),250)},Ms.prototype.updateActivePointers_=function(t){var i=t;i.type==es.POINTERUP||i.type==es.POINTERCANCEL?delete this.trackedTouches_[i.pointerId]:i.type==es.POINTERDOWN&&(this.trackedTouches_[i.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},Ms.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var i=new os(es.POINTERUP,this.map_,t);this.dispatchEvent(i),i.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(ci.unlistenByKey),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null,this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null)},Ms.prototype.isMouseActionButton_=function(t){return 0===t.button},Ms.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var i=new os(es.POINTERDOWN,this.map_,t);this.dispatchEvent(i),this.down_=t,0===this.dragListenerKeys_.length&&(this.documentPointerEventHandler_=new ds(document),this.dragListenerKeys_.push(ci.listen(this.documentPointerEventHandler_,es.POINTERMOVE,this.handlePointerMove_,this),ci.listen(this.documentPointerEventHandler_,es.POINTERUP,this.handlePointerUp_,this),ci.listen(this.pointerEventHandler_,es.POINTERCANCEL,this.handlePointerUp_,this)))},Ms.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var i=new os(es.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(i)}t.preventDefault()},Ms.prototype.relayEvent_=function(t){var i=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new os(t.type,this.map_,t,i))},Ms.prototype.isMoving_=function(t){return Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},Ms.prototype.disposeInternal=function(){this.relayedListenerKey_&&(ci.unlistenByKey(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(ci.unlistenByKey(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ci.unlistenByKey),this.dragListenerKeys_.length=0,this.documentPointerEventHandler_&&(this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null),this.pointerEventHandler_&&(this.pointerEventHandler_.dispose(),this.pointerEventHandler_=null),di.prototype.disposeInternal.call(this)};var ms=function(t,i){this.priorityFunction_=t,this.keyFunction_=i,this.elements_=[],this.priorities_=[],this.queuedElements_={}};ms.DROP=1/0,ms.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,fi.clear(this.queuedElements_)},ms.prototype.dequeue=function(){var t=this.elements_,i=this.priorities_,s=t[0];1==t.length?(t.length=0,i.length=0):(t[0]=t.pop(),i[0]=i.pop(),this.siftUp_(0));var h=this.keyFunction_(s);return delete this.queuedElements_[h],s},ms.prototype.enqueue=function(t){gi(!(this.keyFunction_(t)in this.queuedElements_),31);var i=this.priorityFunction_(t);return i!=ms.DROP&&(this.elements_.push(t),this.priorities_.push(i),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},ms.prototype.getCount=function(){return this.elements_.length},ms.prototype.getLeftChildIndex_=function(t){return 2*t+1},ms.prototype.getRightChildIndex_=function(t){return 2*t+2},ms.prototype.getParentIndex_=function(t){return t-1>>1},ms.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},ms.prototype.isEmpty=function(){return 0===this.elements_.length},ms.prototype.isKeyQueued=function(t){return t in this.queuedElements_},ms.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},ms.prototype.siftUp_=function(t){for(var i=this.elements_,s=this.priorities_,h=i.length,n=i[t],r=s[t],e=t;t<h>>1;){var o=this.getLeftChildIndex_(t),a=this.getRightChildIndex_(t),u=a<h&&s[a]<s[o]?a:o;i[t]=i[u],s[t]=s[u],t=u}i[t]=n,s[t]=r,this.siftDown_(e,t)},ms.prototype.siftDown_=function(t,i){for(var s=this.elements_,h=this.priorities_,n=s[i],r=h[i];i>t;){var e=this.getParentIndex_(i);if(!(h[e]>r))break;s[i]=s[e],h[i]=h[e],i=e}s[i]=n,h[i]=r},ms.prototype.reprioritize=function(){var t,i,s,h=this.priorityFunction_,n=this.elements_,r=this.priorities_,e=0,o=n.length;for(i=0;i<o;++i)(s=h(t=n[i]))==ms.DROP?delete this.queuedElements_[this.keyFunction_(t)]:(r[e]=s,n[e++]=t);n.length=e,r.length=e,this.heapify_()};var ps=function(t,i){ms.call(this,(function(i){return t.apply(null,i)}),(function(t){return t[0].getKey()})),this.tileChangeCallback_=i,this.tilesLoading_=0,this.tilesLoadingKeys_={}};ui.inherits(ps,ms),ps.prototype.enqueue=function(t){var i=ms.prototype.enqueue.call(this,t);return i&&ci.listen(t[0],"change",this.handleTileChange,this),i},ps.prototype.getTilesLoading=function(){return this.tilesLoading_},ps.prototype.handleTileChange=function(t){var i=t.target,s=i.getState();if(2===s||3===s||4===s||5===s){ci.unlisten(i,"change",this.handleTileChange,this);var h=i.getKey();h in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[h],--this.tilesLoading_),this.tileChangeCallback_()}},ps.prototype.loadMoreTiles=function(t,i){for(var s,h,n,r=0,e=!1;this.tilesLoading_<t&&r<i&&this.getCount()>0;)n=(h=this.dequeue()[0]).getKey(),5===(s=h.getState())?e=!0:0!==s||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++r,h.load());0===r&&e&&this.tileChangeCallback_()};var gs={createExtent:function(t){return function(i){return i?[_i.clamp(i[0],t[0],t[2]),_i.clamp(i[1],t[1],t[3])]:void 0}},none:function(t){return t}},_s=function(t){return function(i,s,h){if(void 0!==i){var n=yi.linearFindNearest(t,i,h);n=_i.clamp(n+s,0,t.length-1);var r=Math.floor(n);return n!=r&&r<t.length-1?t[r]/Math.pow(t[r]/t[r+1],n-r):t[r]}}},ws=function(t,i,s){return function(h,n,r){if(void 0!==h){var e=-r/2+.5,o=Math.floor(Math.log(i/h)/Math.log(t)+e),a=Math.max(o+n,0);return void 0!==s&&(a=Math.min(a,s)),i/Math.pow(t,a)}}},ys={disable:function(t){return void 0!==t?0:void 0},none:function(t,i){return void 0!==t?t+i:void 0},createSnapToN:function(t){var i=2*Math.PI/t;return function(t,s){return void 0!==t?t=Math.floor((t+s)/i+.5)*i:void 0}},createSnapToZero:function(t){var i=t||_i.toRadians(5);return function(t,s){return void 0!==t?Math.abs(t+s)<=i?0:t+s:void 0}}},bs=function(t,i,s){var h=void 0!==s?t.toFixed(s):""+t,n=h.indexOf(".");return(n=-1===n?h.length:n)>i?h:new Array(1+i-n).join("0")+h},xs={add:function(t,i){return t[0]+=i[0],t[1]+=i[1],t},closestOnCircle:function(t,i){var s=i.getRadius(),h=i.getCenter(),n=h[0],r=h[1],e=t[0]-n,o=t[1]-r;0===e&&0===o&&(e=1);var a=Math.sqrt(e*e+o*o);return[n+s*e/a,r+s*o/a]},closestOnSegment:function(t,i){var s,h,n=i[0],r=i[1],e=n[0],o=n[1],a=r[0],u=r[1],f=a-e,c=u-o,l=0===f&&0===c?0:(f*(t[0]-e)+c*(t[1]-o))/(f*f+c*c||0);return l<=0?(s=e,h=o):l>=1?(s=a,h=u):(s=e+l*f,h=o+l*c),[s,h]},createStringXY:function(t){return function(i){return xs.toStringXY(i,t)}},degreesToStringHDMS:function(t,i,s){var h=_i.modulo(i+180,360)-180,n=Math.abs(3600*h),r=s||0,e=Math.pow(10,r),o=Math.floor(n/3600),a=Math.floor((n-3600*o)/60),u=n-3600*o-60*a;return(u=Math.ceil(u*e)/e)>=60&&(u=0,a+=1),a>=60&&(a=0,o+=1),o+"° "+bs(a,2)+"′ "+bs(u,2,r)+"″"+(0==h?"":" "+t.charAt(h<0?1:0))},format:function(t,i,s){return t?i.replace("{x}",t[0].toFixed(s)).replace("{y}",t[1].toFixed(s)):""},equals:function(t,i){for(var s=!0,h=t.length-1;h>=0;--h)if(t[h]!=i[h]){s=!1;break}return s},rotate:function(t,i){var s=Math.cos(i),h=Math.sin(i),n=t[1]*s+t[0]*h;return t[0]=t[0]*s-t[1]*h,t[1]=n,t},scale:function(t,i){return t[0]*=i,t[1]*=i,t},sub:function(t,i){return t[0]-=i[0],t[1]-=i[1],t},squaredDistance:function(t,i){var s=t[0]-i[0],h=t[1]-i[1];return s*s+h*h},distance:function(t,i){return Math.sqrt(xs.squaredDistance(t,i))},squaredDistanceToSegment:function(t,i){return xs.squaredDistance(t,xs.closestOnSegment(t,i))},toStringHDMS:function(t,i){return t?xs.degreesToStringHDMS("NS",t[1],i)+" "+xs.degreesToStringHDMS("EW",t[0],i):""},toStringXY:function(t,i){return xs.format(t,"{x}, {y}",i)}},Es={easeIn:function(t){return Math.pow(t,3)},easeOut:function(t){return 1-Es.easeIn(1-t)},inAndOut:function(t){return 3*t*t-2*t*t*t},linear:function(t){return t},upAndDown:function(t){return t<.5?Es.inAndOut(2*t):1-Es.inAndOut(2*(t-.5))}},Ss=function(t){mi.call(this);var i=fi.assign({},t);this.hints_=[0,0],this.animations_=[],this.updateAnimations_=this.updateAnimations_.bind(this),this.projection_=Li.createProjection(i.projection,"EPSG:3857"),this.applyOptions_(i)};ui.inherits(Ss,mi),Ss.prototype.applyOptions_=function(t){var i={};i.center=void 0!==t.center?t.center:null;var s=Ss.createResolutionConstraint_(t);this.maxResolution_=s.maxResolution,this.minResolution_=s.minResolution,this.zoomFactor_=s.zoomFactor,this.resolutions_=t.resolutions,this.minZoom_=s.minZoom;var h=Ss.createCenterConstraint_(t),n=s.constraint,r=Ss.createRotationConstraint_(t);this.constraints_={center:h,resolution:n,rotation:r},void 0!==t.resolution?i.resolution=t.resolution:void 0!==t.zoom&&(i.resolution=this.constrainResolution(this.maxResolution_,t.zoom-this.minZoom_),this.resolutions_&&(i.resolution=_i.clamp(Number(this.getResolution()||i.resolution),this.minResolution_,this.maxResolution_))),i.rotation=void 0!==t.rotation?t.rotation:0,this.setProperties(i),this.options_=t},Ss.prototype.getUpdatedOptions_=function(t){var i=fi.assign({},this.options_);return void 0!==i.resolution?i.resolution=this.getResolution():i.zoom=this.getZoom(),i.center=this.getCenter(),i.rotation=this.getRotation(),fi.assign({},i,t)},Ss.prototype.animate=function(t){var i,s=arguments.length;if(s>1&&"function"==typeof arguments[s-1]&&(i=arguments[s-1],--s),!this.isDef()){var h=arguments[s-1];return h.center&&this.setCenter(h.center),void 0!==h.zoom&&this.setZoom(h.zoom),void 0!==h.rotation&&this.setRotation(h.rotation),void(i&&i(!0))}for(var n=Date.now(),r=this.getCenter().slice(),e=this.getResolution(),o=this.getRotation(),a=[],u=0;u<s;++u){var f=arguments[u],c={start:n,complete:!1,anchor:f.anchor,duration:void 0!==f.duration?f.duration:1e3,easing:f.easing||Es.inAndOut};if(f.center&&(c.sourceCenter=r,c.targetCenter=f.center,r=c.targetCenter),void 0!==f.zoom?(c.sourceResolution=e,c.targetResolution=this.constrainResolution(this.maxResolution_,f.zoom-this.minZoom_,0),e=c.targetResolution):f.resolution&&(c.sourceResolution=e,c.targetResolution=f.resolution,e=c.targetResolution),void 0!==f.rotation){c.sourceRotation=o;var l=_i.modulo(f.rotation-o+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=o+l,o=c.targetRotation}c.callback=i,Ss.isNoopAnimation(c)?c.complete=!0:n+=c.duration,a.push(c)}this.animations_.push(a),this.setHint(0,1),this.updateAnimations_()},Ss.prototype.getAnimating=function(){return this.hints_[0]>0},Ss.prototype.getInteracting=function(){return this.hints_[1]>0},Ss.prototype.cancelAnimations=function(){this.setHint(0,-this.hints_[0]);for(var t=0,i=this.animations_.length;t<i;++t){var s=this.animations_[t];s[0].callback&&s[0].callback(!1)}this.animations_.length=0},Ss.prototype.updateAnimations_=function(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),this.getAnimating()){for(var t=Date.now(),i=!1,s=this.animations_.length-1;s>=0;--s){for(var h=this.animations_[s],n=!0,r=0,e=h.length;r<e;++r){var o=h[r];if(!o.complete){var a=o.duration>0?(t-o.start)/o.duration:1;a>=1?(o.complete=!0,a=1):n=!1;var u=o.easing(a);if(o.sourceCenter){var f=o.sourceCenter[0],c=o.sourceCenter[1];this.set("center",[f+u*(o.targetCenter[0]-f),c+u*(o.targetCenter[1]-c)])}if(o.sourceResolution&&o.targetResolution){var l=1===u?o.targetResolution:o.sourceResolution+u*(o.targetResolution-o.sourceResolution);o.anchor&&this.set("center",this.calculateCenterZoom(l,o.anchor)),this.set("resolution",l)}if(void 0!==o.sourceRotation&&void 0!==o.targetRotation){var v=1===u?_i.modulo(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+u*(o.targetRotation-o.sourceRotation);o.anchor&&this.set("center",this.calculateCenterRotate(v,o.anchor)),this.set("rotation",v)}if(i=!0,!o.complete)break}}if(n){this.animations_[s]=null,this.setHint(0,-1);var d=h[0].callback;d&&d(!0)}}this.animations_=this.animations_.filter(Boolean),i&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_))}},Ss.prototype.calculateCenterRotate=function(t,i){var s,h=this.getCenter();return void 0!==h&&(xs.rotate(s=[h[0]-i[0],h[1]-i[1]],t-this.getRotation()),xs.add(s,i)),s},Ss.prototype.calculateCenterZoom=function(t,i){var s,h=this.getCenter(),n=this.getResolution();return void 0!==h&&void 0!==n&&(s=[i[0]-t*(i[0]-h[0])/n,i[1]-t*(i[1]-h[1])/n]),s},Ss.prototype.getSizeFromViewport_=function(){var t=[100,100],i='.ol-viewport[data-view="'+ui.getUid(this)+'"]',s=document.querySelector(i);if(s){var h=getComputedStyle(s);t[0]=parseInt(h.width,10),t[1]=parseInt(h.height,10)}return t},Ss.prototype.constrainCenter=function(t){return this.constraints_.center(t)},Ss.prototype.constrainResolution=function(t,i,s){return this.constraints_.resolution(t,i||0,s||0)},Ss.prototype.constrainRotation=function(t,i){return this.constraints_.rotation(t,i||0)},Ss.prototype.getCenter=function(){return this.get("center")},Ss.prototype.getConstraints=function(){return this.constraints_},Ss.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},Ss.prototype.calculateExtent=function(t){var i=t||this.getSizeFromViewport_(),s=this.getCenter();gi(s,1);var h=this.getResolution();gi(void 0!==h,2);var n=this.getRotation();return gi(void 0!==n,3),bi.getForViewAndSize(s,h,n,i)},Ss.prototype.getMaxResolution=function(){return this.maxResolution_},Ss.prototype.getMinResolution=function(){return this.minResolution_},Ss.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},Ss.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},Ss.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},Ss.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},Ss.prototype.getProjection=function(){return this.projection_},Ss.prototype.getResolution=function(){return this.get("resolution")},Ss.prototype.getResolutions=function(){return this.resolutions_},Ss.prototype.getResolutionForExtent=function(t,i){var s=i||this.getSizeFromViewport_(),h=bi.getWidth(t)/s[0],n=bi.getHeight(t)/s[1];return Math.max(h,n)},Ss.prototype.getResolutionForValueFunction=function(t){var i=t||2,s=this.maxResolution_,h=Math.log(s/this.minResolution_)/Math.log(i);return function(t){return s/Math.pow(i,t*h)}},Ss.prototype.getRotation=function(){return this.get("rotation")},Ss.prototype.getValueForResolutionFunction=function(t){var i=t||2,s=this.maxResolution_,h=Math.log(s/this.minResolution_)/Math.log(i);return function(t){return Math.log(s/t)/Math.log(i)/h}},Ss.prototype.getState=function(){var t=this.getCenter(),i=this.getProjection(),s=this.getResolution(),h=this.getRotation();return{center:t.slice(),projection:void 0!==i?i:null,resolution:s,rotation:h,zoom:this.getZoom()}},Ss.prototype.getZoom=function(){var t,i=this.getResolution();return void 0!==i&&(t=this.getZoomForResolution(i)),t},Ss.prototype.getZoomForResolution=function(t){var i,s,h=this.minZoom_||0;if(this.resolutions_){var n=yi.linearFindNearest(this.resolutions_,t,1);h=n,i=this.resolutions_[n],s=n==this.resolutions_.length-1?2:i/this.resolutions_[n+1]}else i=this.maxResolution_,s=this.zoomFactor_;return h+Math.log(i/t)/Math.log(s)},Ss.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)},Ss.prototype.fit=function(t,i){var s,h=i||{},n=h.size;n||(n=this.getSizeFromViewport_()),t instanceof Di?"Circle"===t.getType()?(t=t.getExtent(),(s=Qi.fromExtent(t)).rotate(this.getRotation(),bi.getCenter(t))):s=t:(gi(Array.isArray(t),24),gi(!bi.isEmpty(t),25),s=Qi.fromExtent(t));var r,e=void 0!==h.padding?h.padding:[0,0,0,0],o=void 0===h.constrainResolution||h.constrainResolution,a=void 0!==h.nearest&&h.nearest;r=void 0!==h.minResolution?h.minResolution:void 0!==h.maxZoom?this.constrainResolution(this.maxResolution_,h.maxZoom-this.minZoom_,0):0;for(var u=s.getFlatCoordinates(),f=this.getRotation(),c=Math.cos(-f),l=Math.sin(-f),v=1/0,d=1/0,M=-1/0,m=-1/0,p=s.getStride(),g=0,_=u.length;g<_;g+=p){var w=u[g]*c-u[g+1]*l,y=u[g]*l+u[g+1]*c;v=Math.min(v,w),d=Math.min(d,y),M=Math.max(M,w),m=Math.max(m,y)}var b=this.getResolutionForExtent([v,d,M,m],[n[0]-e[1]-e[3],n[1]-e[0]-e[2]]);if(b=isNaN(b)?r:Math.max(b,r),o){var x=this.constrainResolution(b,0,0);!a&&x<b&&(x=this.constrainResolution(x,-1,0)),b=x}var E=(v+M)/2,S=(d+m)/2,C=[(E+=(e[1]-e[3])/2*b)*c-(S+=(e[0]-e[2])/2*b)*(l=-l),S*c+E*l],A=h.callback?h.callback:ui.nullFunction;void 0!==h.duration?this.animate({resolution:b,center:C,duration:h.duration,easing:h.easing},A):(this.setResolution(b),this.setCenter(C),setTimeout(A.bind(void 0,!0),0))},Ss.prototype.centerOn=function(t,i,s){var h=this.getRotation(),n=Math.cos(-h),r=Math.sin(-h),e=t[0]*n-t[1]*r,o=t[1]*n+t[0]*r,a=this.getResolution();this.setCenter([(e+=(i[0]/2-s[0])*a)*n-(o+=(s[1]-i[1]/2)*a)*(r=-r),o*n+e*r])},Ss.prototype.isDef=function(){return!!this.getCenter()&&void 0!==this.getResolution()},Ss.prototype.rotate=function(t,i){if(void 0!==i){var s=this.calculateCenterRotate(t,i);this.setCenter(s)}this.setRotation(t)},Ss.prototype.setCenter=function(t){this.set("center",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setHint=function(t,i){return this.hints_[t]+=i,this.changed(),this.hints_[t]},Ss.prototype.setResolution=function(t){this.set("resolution",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setRotation=function(t){this.set("rotation",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))},Ss.createCenterConstraint_=function(t){return void 0!==t.extent?gs.createExtent(t.extent):gs.none},Ss.createResolutionConstraint_=function(t){var i,s,h,n=void 0!==t.minZoom?t.minZoom:ui.DEFAULT_MIN_ZOOM,r=void 0!==t.maxZoom?t.maxZoom:28,e=void 0!==t.zoomFactor?t.zoomFactor:2;if(void 0!==t.resolutions){var o=t.resolutions;s=o[n],h=void 0!==o[r]?o[r]:o[o.length-1],i=_s(o)}else{var a=Li.createProjection(t.projection,"EPSG:3857"),u=a.getExtent(),f=(u?Math.max(bi.getWidth(u),bi.getHeight(u)):360*Li.METERS_PER_UNIT[Pi.DEGREES]/a.getMetersPerUnit())/ui.DEFAULT_TILE_SIZE/Math.pow(2,ui.DEFAULT_MIN_ZOOM),c=f/Math.pow(2,28-ui.DEFAULT_MIN_ZOOM);void 0!==(s=t.maxResolution)?n=0:s=f/Math.pow(e,n),void 0===(h=t.minResolution)&&(h=void 0!==t.maxZoom?void 0!==t.maxResolution?s/Math.pow(e,r):f/Math.pow(e,r):c),r=n+Math.floor(Math.log(s/h)/Math.log(e)),h=s/Math.pow(e,r-n),i=ws(e,s,r-n)}return{constraint:i,maxResolution:s,minResolution:h,minZoom:n,zoomFactor:e}},Ss.createRotationConstraint_=function(t){if(void 0===t.enableRotation||t.enableRotation){var i=t.constrainRotation;return void 0===i||!0===i?ys.createSnapToZero():!1===i?ys.none:"number"==typeof i?ys.createSnapToN(i):ys.none}return ys.disable},Ss.isNoopAnimation=function(t){return!(t.sourceCenter&&t.targetCenter&&!xs.equals(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation};var Cs=function(t,i){var s=document.createElement("CANVAS");return t&&(s.width=t),i&&(s.height=i),s.getContext("2d")},As=function(t,i){var s=i.parentNode;s&&s.replaceChild(t,i)},Ps=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null},Rs=function(t){mi.call(this);var i=fi.assign({},t);i.opacity=void 0!==t.opacity?t.opacity:1,i.visible=void 0===t.visible||t.visible,i.zIndex=void 0!==t.zIndex?t.zIndex:0,i.maxResolution=void 0!==t.maxResolution?t.maxResolution:1/0,i.minResolution=void 0!==t.minResolution?t.minResolution:0,this.setProperties(i),this.state_={layer:this,managed:!0}};ui.inherits(Rs,mi),Rs.prototype.getType=function(){return this.type},Rs.prototype.getLayerState=function(){return this.state_.opacity=_i.clamp(this.getOpacity(),0,1),this.state_.sourceState=this.getSourceState(),this.state_.visible=this.getVisible(),this.state_.extent=this.getExtent(),this.state_.zIndex=this.getZIndex(),this.state_.maxResolution=this.getMaxResolution(),this.state_.minResolution=Math.max(this.getMinResolution(),0),this.state_},Rs.prototype.getLayersArray=function(){},Rs.prototype.getLayerStatesArray=function(){},Rs.prototype.getExtent=function(){return this.get("extent")},Rs.prototype.getMaxResolution=function(){return this.get("maxResolution")},Rs.prototype.getMinResolution=function(){return this.get("minResolution")},Rs.prototype.getOpacity=function(){return this.get("opacity")},Rs.prototype.getSourceState=function(){},Rs.prototype.getVisible=function(){return this.get("visible")},Rs.prototype.getZIndex=function(){return this.get("zIndex")},Rs.prototype.setExtent=function(t){this.set("extent",t)},Rs.prototype.setMaxResolution=function(t){this.set("maxResolution",t)},Rs.prototype.setMinResolution=function(t){this.set("minResolution",t)},Rs.prototype.setOpacity=function(t){this.set("opacity",t)},Rs.prototype.setVisible=function(t){this.set("visible",t)},Rs.prototype.setZIndex=function(t){this.set("zIndex",t)};var Ns=function(t){var i=t||{},s=fi.assign({},i);delete s.layers;var h=i.layers;Rs.call(this,s),this.layersListenerKeys_=[],this.listenerKeys_={},ci.listen(this,mi.getChangeEventType(Ns.Property_.LAYERS),this.handleLayersChanged_,this),h?Array.isArray(h)?h=new hs(h.slice(),{unique:!0}):(gi(h instanceof hs,43),h=h):h=new hs(void 0,{unique:!0}),this.setLayers(h)};ui.inherits(Ns,Rs),Ns.prototype.handleLayerChange_=function(){this.changed()},Ns.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(ci.unlistenByKey),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var i in this.layersListenerKeys_.push(ci.listen(t,"add",this.handleLayersAdd_,this),ci.listen(t,"remove",this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[i].forEach(ci.unlistenByKey);fi.clear(this.listenerKeys_);var s,h,n,r=t.getArray();for(s=0,h=r.length;s<h;s++)this.listenerKeys_[ui.getUid(n=r[s]).toString()]=[ci.listen(n,"propertychange",this.handleLayerChange_,this),ci.listen(n,"change",this.handleLayerChange_,this)];this.changed()},Ns.prototype.handleLayersAdd_=function(t){var i=t.element,s=ui.getUid(i).toString();this.listenerKeys_[s]=[ci.listen(i,"propertychange",this.handleLayerChange_,this),ci.listen(i,"change",this.handleLayerChange_,this)],this.changed()},Ns.prototype.handleLayersRemove_=function(t){var i=ui.getUid(t.element).toString();this.listenerKeys_[i].forEach(ci.unlistenByKey),delete this.listenerKeys_[i],this.changed()},Ns.prototype.getLayers=function(){return this.get(Ns.Property_.LAYERS)},Ns.prototype.setLayers=function(t){this.set(Ns.Property_.LAYERS,t)},Ns.prototype.getLayersArray=function(t){var i=void 0!==t?t:[];return this.getLayers().forEach((function(t){t.getLayersArray(i)})),i},Ns.prototype.getLayerStatesArray=function(t){var i=void 0!==t?t:[],s=i.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(i)}));var h,n,r,e=this.getLayerState();for(h=s,n=i.length;h<n;h++)(r=i[h]).opacity*=e.opacity,r.visible=r.visible&&e.visible,r.maxResolution=Math.min(r.maxResolution,e.maxResolution),r.minResolution=Math.max(r.minResolution,e.minResolution),void 0!==e.extent&&(r.extent=void 0!==r.extent?bi.getIntersection(r.extent,e.extent):e.extent);return i},Ns.prototype.getSourceState=function(){return"ready"},Ns.Property_={LAYERS:"layers"};var zs={mapRendererPlugins_:[],getMapRendererPlugins:function(){return zs.mapRendererPlugins_},layerRendererPlugins_:[],getLayerRendererPlugins:function(){return zs.layerRendererPlugins_},register:function(t,i){switch(t){case"MAP_RENDERER":zs.mapRendererPlugins_.push(i);break;case"LAYER_RENDERER":zs.layerRendererPlugins_.push(i);break;default:throw new Error("Unsupported plugin type: "+t)}},registerMultiple:function(t,i){for(var s=0,h=i.length;s<h;++s)zs.register(t,i[s])}},ks=function(t){return t[0]>0&&t[1]>0},Ts=function(t,i,s){return void 0===s&&(s=[0,0]),s[0]=t[0]*i+.5|0,s[1]=t[1]*i+.5|0,s},Os=function(t,i){return Array.isArray(t)?t:(void 0===i?i=[t,t]:i[0]=i[1]=t,i)},Ls=function(t){mi.call(this);var i=Ls.createOptionsInternal(t);this.loadTilesWhileAnimating_=void 0!==t.loadTilesWhileAnimating&&t.loadTilesWhileAnimating,this.loadTilesWhileInteracting_=void 0!==t.loadTilesWhileInteracting&&t.loadTilesWhileInteracting,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:ts.DEVICE_PIXEL_RATIO,this.logos_=i.logos,this.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_.call(this,Date.now())}.bind(this),this.coordinateToPixelTransform_=Ii.create(),this.pixelToCoordinateTransform_=Ii.create(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("DIV"),this.viewport_.className="ol-viewport"+(ts.TOUCH?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.viewport_.style.msTouchAction="none",this.viewport_.style.touchAction="none",this.overlayContainer_=document.createElement("DIV"),this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("DIV"),this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent";for(var s=["click","dblclick","mousedown","touchstart","MSPointerDown",es.POINTERDOWN,"mousewheel","wheel"],h=0,n=s.length;h<n;++h)ci.listen(this.overlayContainerStopEvent_,s[h],vi.stopPropagation);for(var r in this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=new Ms(this,t.moveTolerance),es)ci.listen(this.mapBrowserEventHandler_,es[r],this.handleMapBrowserEvent,this);this.keyboardEventTarget_=i.keyboardEventTarget,this.keyHandlerKeys_=null,ci.listen(this.viewport_,"wheel",this.handleBrowserEvent,this),ci.listen(this.viewport_,"mousewheel",this.handleBrowserEvent,this),this.controls=i.controls||new hs,this.interactions=i.interactions||new hs,this.overlays_=i.overlays,this.overlayIdIndex_={},this.renderer_=i.mapRendererPlugin.create(this.viewport_,this),this.focus_=null,this.postRenderFunctions_=[],this.tileQueue_=new ps(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.skippedFeatureUids_={},ci.listen(this,mi.getChangeEventType("layergroup"),this.handleLayerGroupChanged_,this),ci.listen(this,mi.getChangeEventType("view"),this.handleViewChanged_,this),ci.listen(this,mi.getChangeEventType("size"),this.handleSizeChanged_,this),ci.listen(this,mi.getChangeEventType("target"),this.handleTargetChanged_,this),this.setProperties(i.values),this.controls.forEach((function(t){t.setMap(this)}),this),ci.listen(this.controls,"add",(function(t){t.element.setMap(this)}),this),ci.listen(this.controls,"remove",(function(t){t.element.setMap(null)}),this),this.interactions.forEach((function(t){t.setMap(this)}),this),ci.listen(this.interactions,"add",(function(t){t.element.setMap(this)}),this),ci.listen(this.interactions,"remove",(function(t){t.element.setMap(null)}),this),this.overlays_.forEach(this.addOverlayInternal_,this),ci.listen(this.overlays_,"add",(function(t){this.addOverlayInternal_(t.element)}),this),ci.listen(this.overlays_,"remove",(function(t){var i=t.element.getId();void 0!==i&&delete this.overlayIdIndex_[i.toString()],t.element.setMap(null)}),this)};ui.inherits(Ls,mi),Ls.prototype.addControl=function(t){this.getControls().push(t)},Ls.prototype.addInteraction=function(t){this.getInteractions().push(t)},Ls.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},Ls.prototype.addOverlay=function(t){this.getOverlays().push(t)},Ls.prototype.addOverlayInternal_=function(t){var i=t.getId();void 0!==i&&(this.overlayIdIndex_[i.toString()]=t),t.setMap(this)},Ls.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose(),ci.unlisten(this.viewport_,"wheel",this.handleBrowserEvent,this),ci.unlisten(this.viewport_,"mousewheel",this.handleBrowserEvent,this),void 0!==this.handleResize_&&(window.removeEventListener("resize",this.handleResize_,!1),this.handleResize_=void 0),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0),this.setTarget(null),mi.prototype.disposeInternal.call(this)},Ls.prototype.forEachFeatureAtPixel=function(t,i,s){if(this.frameState_){var h=this.getCoordinateFromPixel(t);return this.renderer_.forEachFeatureAtCoordinate(h,this.frameState_,void 0!==(s=void 0!==s?s:{}).hitTolerance?s.hitTolerance*this.frameState_.pixelRatio:0,i,null,void 0!==s.layerFilter?s.layerFilter:xi.TRUE,null)}},Ls.prototype.getFeaturesAtPixel=function(t,i){var s=null;return this.forEachFeatureAtPixel(t,(function(t){s||(s=[]),s.push(t)}),i),s},Ls.prototype.forEachLayerAtPixel=function(t,i,s,h,n){if(this.frameState_)return this.renderer_.forEachLayerAtPixel(t,this.frameState_,i,void 0!==s?s:null,void 0!==h?h:xi.TRUE,void 0!==n?n:null)},Ls.prototype.hasFeatureAtPixel=function(t,i){if(!this.frameState_)return!1;var s=this.getCoordinateFromPixel(t);return this.renderer_.hasFeatureAtCoordinate(s,this.frameState_,void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,void 0!==i.layerFilter?i.layerFilter:xi.TRUE,null)},Ls.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},Ls.prototype.getEventPixel=function(t){var i=this.viewport_.getBoundingClientRect(),s=t.changedTouches?t.changedTouches[0]:t;return[s.clientX-i.left,s.clientY-i.top]},Ls.prototype.getTarget=function(){return this.get("target")},Ls.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},Ls.prototype.getCoordinateFromPixel=function(t){var i=this.frameState_;return i?Ii.apply(i.pixelToCoordinateTransform,t.slice()):null},Ls.prototype.getControls=function(){return this.controls},Ls.prototype.getOverlays=function(){return this.overlays_},Ls.prototype.getOverlayById=function(t){var i=this.overlayIdIndex_[t.toString()];return void 0!==i?i:null},Ls.prototype.getInteractions=function(){return this.interactions},Ls.prototype.getLayerGroup=function(){return this.get("layergroup")},Ls.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},Ls.prototype.getPixelFromCoordinate=function(t){var i=this.frameState_;return i?Ii.apply(i.coordinateToPixelTransform,t.slice(0,2)):null},Ls.prototype.getRenderer=function(){return this.renderer_},Ls.prototype.getSize=function(){return this.get("size")},Ls.prototype.getView=function(){return this.get("view")},Ls.prototype.getViewport=function(){return this.viewport_},Ls.prototype.getOverlayContainer=function(){return this.overlayContainer_},Ls.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_},Ls.prototype.getTilePriority=function(t,i,s,h){var n=this.frameState_;if(!n||!(i in n.wantedTiles))return ms.DROP;if(!n.wantedTiles[i][t.getKey()])return ms.DROP;var r=s[0]-n.focus[0],e=s[1]-n.focus[1];return 65536*Math.log(h)+Math.sqrt(r*r+e*e)/h},Ls.prototype.handleBrowserEvent=function(t,i){var s=new rs(i||t.type,this,t);this.handleMapBrowserEvent(s)},Ls.prototype.handleMapBrowserEvent=function(t){if(this.frameState_){this.focus_=t.coordinate,t.frameState=this.frameState_;var i,s=this.getInteractions().getArray();if(!1!==this.dispatchEvent(t))for(i=s.length-1;i>=0;i--){var h=s[i];if(h.getActive()&&!h.handleEvent(t))break}}},Ls.prototype.handlePostRender=function(){var t=this.frameState_,i=this.tileQueue_;if(!i.isEmpty()){var s=16,h=s;if(t){var n=t.viewHints;n[0]&&(s=this.loadTilesWhileAnimating_?8:0,h=2),n[1]&&(s=this.loadTilesWhileInteracting_?8:0,h=2)}i.getTilesLoading()<s&&(i.reprioritize(),i.loadMoreTiles(s,h))}var r,e,o=this.postRenderFunctions_;for(r=0,e=o.length;r<e;++r)o[r](this,t);o.length=0},Ls.prototype.handleSizeChanged_=function(){this.render()},Ls.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()&&(t=this.getTargetElement()),this.keyHandlerKeys_){for(var i=0,s=this.keyHandlerKeys_.length;i<s;++i)ci.unlistenByKey(this.keyHandlerKeys_[i]);this.keyHandlerKeys_=null}if(t){t.appendChild(this.viewport_);var h=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.keyHandlerKeys_=[ci.listen(h,"keydown",this.handleBrowserEvent,this),ci.listen(h,"keypress",this.handleBrowserEvent,this)],this.handleResize_||(this.handleResize_=this.updateSize.bind(this),window.addEventListener("resize",this.handleResize_,!1))}else this.renderer_.removeLayerRenderers(),Ps(this.viewport_),void 0!==this.handleResize_&&(window.removeEventListener("resize",this.handleResize_,!1),this.handleResize_=void 0);this.updateSize()},Ls.prototype.handleTileChange_=function(){this.render()},Ls.prototype.handleViewPropertyChanged_=function(){this.render()},Ls.prototype.handleViewChanged_=function(){this.viewPropertyListenerKey_&&(ci.unlistenByKey(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ci.unlistenByKey(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);var t=this.getView();t&&(this.viewport_.setAttribute("data-view",ui.getUid(t)),this.viewPropertyListenerKey_=ci.listen(t,"propertychange",this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=ci.listen(t,"change",this.handleViewPropertyChanged_,this)),this.render()},Ls.prototype.handleLayerGroupChanged_=function(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ci.unlistenByKey),this.layerGroupPropertyListenerKeys_=null);var t=this.getLayerGroup();t&&(this.layerGroupPropertyListenerKeys_=[ci.listen(t,"propertychange",this.render,this),ci.listen(t,"change",this.render,this)]),this.render()},Ls.prototype.isRendered=function(){return!!this.frameState_},Ls.prototype.renderSync=function(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()},Ls.prototype.render=function(){void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))},Ls.prototype.removeControl=function(t){return this.getControls().remove(t)},Ls.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)},Ls.prototype.removeLayer=function(t){return this.getLayerGroup().getLayers().remove(t)},Ls.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)},Ls.prototype.renderFrame_=function(t){var i,s,h,n=this.getSize(),r=this.getView(),e=bi.createEmpty(),o=this.frameState_,a=null;if(void 0!==n&&ks(n)&&r&&r.isDef()){var u=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),f=this.getLayerGroup().getLayerStatesArray(),c={};for(i=0,s=f.length;i<s;++i)c[ui.getUid(f[i].layer)]=f[i];var l=(h=r.getState()).center,v=h.resolution/this.pixelRatio_;l[0]=Math.round(l[0]/v)*v,l[1]=Math.round(l[1]/v)*v,a={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,extent:e,focus:this.focus_?this.focus_:l,index:this.frameIndex_++,layerStates:c,layerStatesArray:f,logos:fi.assign({},this.logos_),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:n,skippedFeatureUids:this.skippedFeatureUids_,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:h,viewHints:u,wantedTiles:{}}}a&&(a.extent=bi.getForViewAndSize(h.center,h.resolution,h.rotation,a.size,e)),this.frameState_=a,this.renderer_.renderFrame(a),a&&(a.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,a.postRenderFunctions),o&&(!this.previousExtent_||!bi.isEmpty(this.previousExtent_)&&!bi.equals(a.extent,this.previousExtent_))&&(this.dispatchEvent(new ns("movestart",this,o)),this.previousExtent_=bi.createOrUpdateEmpty(this.previousExtent_)),this.previousExtent_&&!a.viewHints[0]&&!a.viewHints[1]&&!bi.equals(a.extent,this.previousExtent_)&&(this.dispatchEvent(new ns("moveend",this,a)),bi.clone(a.extent,this.previousExtent_))),this.dispatchEvent(new ns("postrender",this,a)),setTimeout(this.handlePostRender.bind(this),0)},Ls.prototype.setLayerGroup=function(t){this.set("layergroup",t)},Ls.prototype.setSize=function(t){this.set("size",t)},Ls.prototype.setTarget=function(t){this.set("target",t)},Ls.prototype.setView=function(t){this.set("view",t)},Ls.prototype.skipFeature=function(t){var i=ui.getUid(t).toString();this.skippedFeatureUids_[i]=!0,this.render()},Ls.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var i=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth)])}else this.setSize(void 0)},Ls.prototype.unskipFeature=function(t){var i=ui.getUid(t).toString();delete this.skippedFeatureUids_[i],this.render()},Ls.DEFAULT_RENDERER_TYPES=["canvas","webgl"],Ls.LOGO_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszWWMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvYasvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvXH1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1VkbMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLPVcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqTacrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaarldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+HizeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDnBAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSFhYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJREFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxCBrb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7ahgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCnB3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDgq82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC",Ls.createOptionsInternal=function(t){var i=null;void 0!==t.keyboardEventTarget&&(i="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var s={},h={};if(void 0===t.logo||"boolean"==typeof t.logo&&t.logo)h[Ls.LOGO_URL]="https://openlayers.org/";else{var n=t.logo;"string"==typeof n?h[n]="":n instanceof HTMLElement?h[ui.getUid(n).toString()]=n:n&&(gi("string"==typeof n.href,44),gi("string"==typeof n.src,45),h[n.src]=n.href)}var r,e,o=t.layers instanceof Ns?t.layers:new Ns({layers:t.layers});s.layergroup=o,s.target=t.target,s.view=void 0!==t.view?t.view:new Ss,void 0!==t.renderer?(Array.isArray(t.renderer)?r=t.renderer:"string"==typeof t.renderer?r=[t.renderer]:gi(!1,46),r.indexOf("dom")>=0&&(r=r.concat(Ls.DEFAULT_RENDERER_TYPES))):r=Ls.DEFAULT_RENDERER_TYPES;var a,u,f,c=zs.getMapRendererPlugins();t:for(var l=0,v=r.length;l<v;++l)for(var d=r[l],M=0,m=c.length;M<m;++M){var p=c[M];if(p.handles(d)){e=p;break t}}if(!e)throw new Error("Unable to create a map renderer for types: "+r.join(", "));return void 0!==t.controls&&(Array.isArray(t.controls)?a=new hs(t.controls.slice()):(gi(t.controls instanceof hs,47),a=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?u=new hs(t.interactions.slice()):(gi(t.interactions instanceof hs,48),u=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?f=new hs(t.overlays.slice()):(gi(t.overlays instanceof hs,49),f=t.overlays):f=new hs,{controls:a,interactions:u,keyboardEventTarget:i,logos:h,overlays:f,mapRendererPlugin:e,values:s}};var Is=function(t){mi.call(this),this.element=t.element?t.element:null,this.target_=null,this.map_=null,this.listenerKeys=[],this.render=t.render?t.render:ui.nullFunction,t.target&&this.setTarget(t.target)};ui.inherits(Is,mi),Is.prototype.disposeInternal=function(){Ps(this.element),mi.prototype.disposeInternal.call(this)},Is.prototype.getMap=function(){return this.map_},Is.prototype.setMap=function(t){this.map_&&Ps(this.element);for(var i=0,s=this.listenerKeys.length;i<s;++i)ci.unlistenByKey(this.listenerKeys[i]);this.listenerKeys.length=0,this.map_=t,this.map_&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==ui.nullFunction&&this.listenerKeys.push(ci.listen(t,"postrender",this.render,this)),t.render())},Is.prototype.setTarget=function(t){this.target_="string"==typeof t?document.getElementById(t):t};var Fs,Ds,Gs={CLASS_HIDDEN:"ol-hidden",CLASS_SELECTABLE:"ol-selectable",CLASS_UNSELECTABLE:"ol-unselectable",CLASS_UNSUPPORTED:"ol-unsupported",CLASS_CONTROL:"ol-control"};Gs.getFontFamilies=(Ds={},function(t){if(Fs||(Fs=document.createElement("div").style),!(t in Ds)){Fs.font=t;var i=Fs.fontFamily;if(Fs.font="",!i)return null;Ds[t]=i.split(/,\s?/)}return Ds[t]});var Ws=function(t){var i=fi.assign({},t);delete i.source,Rs.call(this,i),this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,t.map&&this.setMap(t.map),ci.listen(this,mi.getChangeEventType("source"),this.handleSourcePropertyChange_,this),this.setSource(t.source?t.source:null)};ui.inherits(Ws,Rs),Ws.visibleAtResolution=function(t,i){return t.visible&&i>=t.minResolution&&i<t.maxResolution},Ws.prototype.getLayersArray=function(t){var i=t||[];return i.push(this),i},Ws.prototype.getLayerStatesArray=function(t){var i=t||[];return i.push(this.getLayerState()),i},Ws.prototype.getSource=function(){return this.get("source")||null},Ws.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():"undefined"},Ws.prototype.handleSourceChange_=function(){this.changed()},Ws.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(ci.unlistenByKey(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=ci.listen(t,"change",this.handleSourceChange_,this)),this.changed()},Ws.prototype.setMap=function(t){this.mapPrecomposeKey_&&(ci.unlistenByKey(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ci.unlistenByKey(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=ci.listen(t,"precompose",(function(t){var i=this.getLayerState();i.managed=!1,i.zIndex=1/0,t.frameState.layerStatesArray.push(i),t.frameState.layerStates[ui.getUid(this)]=i}),this),this.mapRenderKey_=ci.listen(this,"change",t.render,t),this.changed())},Ws.prototype.setSource=function(t){this.set("source",t)};var Vs=function(t){var i=t||{};this.ulElement_=document.createElement("UL"),this.logoLi_=document.createElement("LI"),this.ulElement_.appendChild(this.logoLi_),this.logoLi_.style.display="none",this.collapsed_=void 0===i.collapsed||i.collapsed,this.collapsible_=void 0===i.collapsible||i.collapsible,this.collapsible_||(this.collapsed_=!1);var s=void 0!==i.className?i.className:"ol-attribution",h=void 0!==i.tipLabel?i.tipLabel:"Attributions",n=void 0!==i.collapseLabel?i.collapseLabel:"»";"string"==typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n):this.collapseLabel_=n;var r=void 0!==i.label?i.label:"i";"string"==typeof r?(this.label_=document.createElement("span"),this.label_.textContent=r):this.label_=r;var e=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,o=document.createElement("button");o.setAttribute("type","button"),o.title=h,o.appendChild(e),ci.listen(o,"click",this.handleClick_,this);var a=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" ol-collapsed":"")+(this.collapsible_?"":" ol-uncollapsible"),u=document.createElement("div");u.className=a,u.appendChild(this.ulElement_),u.appendChild(o),Is.call(this,{element:u,render:i.render?i.render:Vs.render,target:i.target}),this.renderedAttributions_=[],this.renderedVisible_=!0,this.logoElements_={}};ui.inherits(Vs,Is),Vs.prototype.getSourceAttributions_=function(t){for(var i={},s=[],h=t.layerStatesArray,n=t.viewState.resolution,r=0,e=h.length;r<e;++r){var o=h[r];if(Ws.visibleAtResolution(o,n)){var a=o.layer.getSource();if(a){var u=a.getAttributions2();if(u){var f=u(t);if(f)if(Array.isArray(f))for(var c=0,l=f.length;c<l;++c)f[c]in i||(s.push(f[c]),i[f[c]]=!0);else f in i||(s.push(f),i[f]=!0)}}}}return s},Vs.render=function(t){this.updateElement_(t.frameState)},Vs.prototype.updateElement_=function(t){if(t){var i=this.getSourceAttributions_(t);if(!yi.equals(i,this.renderedAttributions_)){for(;this.ulElement_.lastChild!==this.logoLi_;)this.ulElement_.removeChild(this.ulElement_.lastChild);for(var s=0,h=i.length;s<h;++s){var n=document.createElement("LI");n.innerHTML=i[s],this.ulElement_.appendChild(n)}0===i.length&&this.renderedAttributions_.length>0?this.element.classList.add("ol-logo-only"):0===this.renderedAttributions_.length&&i.length>0&&this.element.classList.remove("ol-logo-only");var r=i.length>0||!fi.isEmpty(t.logos);this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),this.renderedAttributions_=i,this.insertLogos_(t)}}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},Vs.prototype.insertLogos_=function(t){var i,s,h,n,r=t.logos,e=this.logoElements_;for(i in e)i in r||(Ps(e[i]),delete e[i]);for(n in r){var o=r[n];o instanceof HTMLElement&&(this.logoLi_.appendChild(o),e[n]=o),n in e||((s=new Image).src=n,""===o?h=s:((h=document.createElement("a")).href=o,h.appendChild(s)),this.logoLi_.appendChild(h),e[n]=h)}this.logoLi_.style.display=fi.isEmpty(r)?"none":""},Vs.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},Vs.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?As(this.collapseLabel_,this.label_):As(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_},Vs.prototype.getCollapsible=function(){return this.collapsible_},Vs.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},Vs.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},Vs.prototype.getCollapsed=function(){return this.collapsed_};var js=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-rotate",h=void 0!==i.label?i.label:"⇧";this.label_=null,"string"==typeof h?(this.label_=document.createElement("span"),this.label_.className="ol-compass",this.label_.textContent=h):(this.label_=h,this.label_.classList.add("ol-compass"));var n=i.tipLabel?i.tipLabel:"Reset rotation",r=document.createElement("button");r.className=s+"-reset",r.setAttribute("type","button"),r.title=n,r.appendChild(this.label_),ci.listen(r,"click",js.prototype.handleClick_,this);var e=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL,o=document.createElement("div");o.className=e,o.appendChild(r);var a=i.render?i.render:js.render;this.callResetNorth_=i.resetNorth?i.resetNorth:void 0,Is.call(this,{element:o,render:a,target:i.target}),this.duration_=void 0!==i.duration?i.duration:250,this.autoHide_=void 0===i.autoHide||i.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Gs.CLASS_HIDDEN)};ui.inherits(js,Is),js.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},js.prototype.resetNorth_=function(){var t=this.getMap().getView();t&&void 0!==t.getRotation()&&(this.duration_>0?t.animate({rotation:0,duration:this.duration_,easing:Es.easeOut}):t.setRotation(0))},js.render=function(t){var i=t.frameState;if(i){var s=i.viewState.rotation;if(s!=this.rotation_){var h="rotate("+s+"rad)";if(this.autoHide_){var n=this.element.classList.contains(Gs.CLASS_HIDDEN);n||0!==s?n&&0!==s&&this.element.classList.remove(Gs.CLASS_HIDDEN):this.element.classList.add(Gs.CLASS_HIDDEN)}this.label_.style.msTransform=h,this.label_.style.webkitTransform=h,this.label_.style.transform=h}this.rotation_=s}};var Us=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-zoom",h=void 0!==i.delta?i.delta:1,n=void 0!==i.zoomInLabel?i.zoomInLabel:"+",r=void 0!==i.zoomOutLabel?i.zoomOutLabel:"−",e=void 0!==i.zoomInTipLabel?i.zoomInTipLabel:"Zoom in",o=void 0!==i.zoomOutTipLabel?i.zoomOutTipLabel:"Zoom out",a=document.createElement("button");a.className=s+"-in",a.setAttribute("type","button"),a.title=e,a.appendChild("string"==typeof n?document.createTextNode(n):n),ci.listen(a,"click",Us.prototype.handleClick_.bind(this,h));var u=document.createElement("button");u.className=s+"-out",u.setAttribute("type","button"),u.title=o,u.appendChild("string"==typeof r?document.createTextNode(r):r),ci.listen(u,"click",Us.prototype.handleClick_.bind(this,-h));var f=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL,c=document.createElement("div");c.className=f,c.appendChild(a),c.appendChild(u),Is.call(this,{element:c,target:i.target}),this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Us,Is),Us.prototype.handleClick_=function(t,i){i.preventDefault(),this.zoomByDelta_(t)},Us.prototype.zoomByDelta_=function(t){var i=this.getMap().getView();if(i){var s=i.getResolution();if(s){var h=i.constrainResolution(s,t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:h,duration:this.duration_,easing:Es.easeOut})):i.setResolution(h)}}};var Xs=function(t){var i=t||{},s=new hs;return(void 0===i.zoom||i.zoom)&&s.push(new Us(i.zoomOptions)),(void 0===i.rotate||i.rotate)&&s.push(new js(i.rotateOptions)),(void 0===i.attribution||i.attribution)&&s.push(new Vs(i.attributionOptions)),s},qs=function(t,i,s){this.decay_=t,this.minVelocity_=i,this.delay_=s,this.points_=[],this.angle_=0,this.initialVelocity_=0};qs.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},qs.prototype.update=function(t,i){this.points_.push(t,i,Date.now())},qs.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,i=this.points_.length-3;if(this.points_[i+2]<t)return!1;for(var s=i-3;s>0&&this.points_[s+2]>t;)s-=3;var h=this.points_[i+2]-this.points_[s+2];if(h<1e3/60)return!1;var n=this.points_[i]-this.points_[s],r=this.points_[i+1]-this.points_[s+1];return this.angle_=Math.atan2(r,n),this.initialVelocity_=Math.sqrt(n*n+r*r)/h,this.initialVelocity_>this.minVelocity_},qs.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},qs.prototype.getAngle=function(){return this.angle_};var Ys=function(t){mi.call(this),this.map_=null,this.setActive(!0),this.handleEvent=t.handleEvent};ui.inherits(Ys,mi),Ys.prototype.getActive=function(){return this.get("active")},Ys.prototype.getMap=function(){return this.map_},Ys.prototype.setActive=function(t){this.set("active",t)},Ys.prototype.setMap=function(t){this.map_=t},Ys.pan=function(t,i,s){var h=t.getCenter();if(h){var n=t.constrainCenter([h[0]+i[0],h[1]+i[1]]);s?t.animate({duration:s,easing:Es.linear,center:n}):t.setCenter(n)}},Ys.rotate=function(t,i,s,h){i=t.constrainRotation(i,0),Ys.rotateWithoutConstraints(t,i,s,h)},Ys.rotateWithoutConstraints=function(t,i,s,h){if(void 0!==i){var n=t.getRotation(),r=t.getCenter();void 0!==n&&r&&h>0?t.animate({rotation:i,anchor:s,duration:h,easing:Es.easeOut}):t.rotate(i,s)}},Ys.zoom=function(t,i,s,h,n){i=t.constrainResolution(i,0,n),Ys.zoomWithoutConstraints(t,i,s,h)},Ys.zoomByDelta=function(t,i,s,h){var n=t.getResolution(),r=t.constrainResolution(n,i,0);if(void 0!==r){var e=t.getResolutions();r=_i.clamp(r,t.getMinResolution()||e[e.length-1],t.getMaxResolution()||e[0])}if(s&&void 0!==r&&r!==n){var o=t.getCenter(),a=t.calculateCenterZoom(r,s);a=t.constrainCenter(a),s=[(r*o[0]-n*a[0])/(r-n),(r*o[1]-n*a[1])/(r-n)]}Ys.zoomWithoutConstraints(t,r,s,h)},Ys.zoomWithoutConstraints=function(t,i,s,h){if(i){var n=t.getResolution(),r=t.getCenter();if(void 0!==n&&r&&i!==n&&h)t.animate({resolution:i,anchor:s,duration:h,easing:Es.easeOut});else{if(s){var e=t.calculateCenterZoom(i,s);t.setCenter(e)}t.setResolution(i)}}};var Bs=function(t){var i=t||{};this.delta_=i.delta?i.delta:1,Ys.call(this,{handleEvent:Bs.handleEvent}),this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Bs,Ys),Bs.handleEvent=function(t){var i=!1;if(t.type==es.DBLCLICK){var s=t.coordinate,h=t.originalEvent.shiftKey?-this.delta_:this.delta_,n=t.map.getView();Ys.zoomByDelta(n,h,s,this.duration_),t.preventDefault(),i=!0}return!i};var Hs={altKeyOnly:function(t){var i=t.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey},altShiftKeysOnly:function(t){var i=t.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&i.shiftKey}};Hs.always=xi.TRUE,Hs.click=function(t){return t.type==es.CLICK},Hs.mouseActionButton=function(t){var i=t.originalEvent;return 0==i.button&&!(ts.WEBKIT&&ts.MAC&&i.ctrlKey)},Hs.never=xi.FALSE,Hs.pointerMove=function(t){return"pointermove"==t.type},Hs.singleClick=function(t){return t.type==es.SINGLECLICK},Hs.doubleClick=function(t){return t.type==es.DBLCLICK},Hs.noModifierKeys=function(t){var i=t.originalEvent;return!i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey},Hs.platformModifierKeyOnly=function(t){var i=t.originalEvent;return!i.altKey&&(ts.MAC?i.metaKey:i.ctrlKey)&&!i.shiftKey},Hs.shiftKeyOnly=function(t){var i=t.originalEvent;return!i.altKey&&!(i.metaKey||i.ctrlKey)&&i.shiftKey},Hs.targetNotEditable=function(t){var i=t.originalEvent.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i},Hs.mouseOnly=function(t){return gi(t.pointerEvent,56),"mouse"==t.pointerEvent.pointerType},Hs.primaryAction=function(t){var i=t.pointerEvent;return i.isPrimary&&0===i.button};var Js=function(t){var i=t||{};Ys.call(this,{handleEvent:i.handleEvent?i.handleEvent:Js.handleEvent}),this.handleDownEvent_=i.handleDownEvent?i.handleDownEvent:Js.handleDownEvent,this.handleDragEvent_=i.handleDragEvent?i.handleDragEvent:Js.handleDragEvent,this.handleMoveEvent_=i.handleMoveEvent?i.handleMoveEvent:Js.handleMoveEvent,this.handleUpEvent_=i.handleUpEvent?i.handleUpEvent:Js.handleUpEvent,this.handlingDownUpSequence=!1,this.trackedPointers_={},this.targetPointers=[]};ui.inherits(Js,Ys),Js.centroid=function(t){for(var i=t.length,s=0,h=0,n=0;n<i;n++)s+=t[n].clientX,h+=t[n].clientY;return[s/i,h/i]},Js.prototype.isPointerDraggingEvent_=function(t){var i=t.type;return i===es.POINTERDOWN||i===es.POINTERDRAG||i===es.POINTERUP},Js.prototype.updateTrackedPointers_=function(t){if(this.isPointerDraggingEvent_(t)){var i=t.pointerEvent,s=i.pointerId.toString();t.type==es.POINTERUP?delete this.trackedPointers_[s]:(t.type==es.POINTERDOWN||s in this.trackedPointers_)&&(this.trackedPointers_[s]=i),this.targetPointers=fi.getValues(this.trackedPointers_)}},Js.handleDragEvent=ui.nullFunction,Js.handleUpEvent=xi.FALSE,Js.handleDownEvent=xi.FALSE,Js.handleMoveEvent=ui.nullFunction,Js.handleEvent=function(t){if(!(t instanceof os))return!0;var i=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==es.POINTERDRAG)this.handleDragEvent_(t);else if(t.type==es.POINTERUP){var s=this.handleUpEvent_(t);this.handlingDownUpSequence=s&&this.targetPointers.length>0}}else if(t.type==es.POINTERDOWN){var h=this.handleDownEvent_(t);this.handlingDownUpSequence=h,i=this.shouldStopEvent(h)}else t.type==es.POINTERMOVE&&this.handleMoveEvent_(t);return!i},Js.prototype.shouldStopEvent=function(t){return t};var Zs=function(t){Js.call(this,{handleDownEvent:Zs.handleDownEvent_,handleDragEvent:Zs.handleDragEvent_,handleUpEvent:Zs.handleUpEvent_});var i=t||{};this.kinetic_=i.kinetic,this.lastCentroid=null,this.condition_=i.condition?i.condition:Hs.noModifierKeys,this.noKinetic_=!1};ui.inherits(Zs,Js),Zs.handleDragEvent_=function(t){var i=this.targetPointers,s=Js.centroid(i);if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){var h=this.lastCentroid[0]-s[0],n=s[1]-this.lastCentroid[1],r=t.map.getView(),e=r.getState(),o=[h,n];xs.scale(o,e.resolution),xs.rotate(o,e.rotation),xs.add(o,e.center),o=r.constrainCenter(o),r.setCenter(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length},Zs.handleUpEvent_=function(t){var i=t.map,s=i.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var h=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=s.getCenter(),e=i.getPixelFromCoordinate(r),o=i.getCoordinateFromPixel([e[0]-h*Math.cos(n),e[1]-h*Math.sin(n)]);s.animate({center:s.constrainCenter(o),duration:500,easing:Es.easeOut})}return s.setHint(1,-1),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},Zs.handleDownEvent_=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var i=t.map.getView();return this.lastCentroid=null,this.handlingDownUpSequence||i.setHint(1,1),i.getAnimating()&&i.setCenter(t.frameState.viewState.center),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},Zs.prototype.shouldStopEvent=xi.FALSE;var Ks=function(t){var i=t||{};Js.call(this,{handleDownEvent:Ks.handleDownEvent_,handleDragEvent:Ks.handleDragEvent_,handleUpEvent:Ks.handleUpEvent_}),this.condition_=i.condition?i.condition:Hs.altShiftKeysOnly,this.lastAngle_=void 0,this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Ks,Js),Ks.handleDragEvent_=function(t){if(Hs.mouseOnly(t)){var i=t.map,s=i.getView();if(s.getConstraints().rotation!==ys.disable){var h=i.getSize(),n=t.pixel,r=Math.atan2(h[1]/2-n[1],n[0]-h[0]/2);if(void 0!==this.lastAngle_){var e=r-this.lastAngle_,o=s.getRotation();Ys.rotateWithoutConstraints(s,o-e)}this.lastAngle_=r}}},Ks.handleUpEvent_=function(t){if(!Hs.mouseOnly(t))return!0;var i=t.map.getView();i.setHint(1,-1);var s=i.getRotation();return Ys.rotate(i,s,void 0,this.duration_),!1},Ks.handleDownEvent_=function(t){return!(!Hs.mouseOnly(t)||!Hs.mouseActionButton(t)||!this.condition_(t)||(t.map.getView().setHint(1,1),this.lastAngle_=void 0,0))},Ks.prototype.shouldStopEvent=xi.FALSE;var Qs=function(t){this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null};ui.inherits(Qs,li),Qs.prototype.disposeInternal=function(){this.setMap(null)},Qs.prototype.render_=function(){var t=this.startPixel_,i=this.endPixel_,s="px",h=this.element_.style;h.left=Math.min(t[0],i[0])+s,h.top=Math.min(t[1],i[1])+s,h.width=Math.abs(i[0]-t[0])+s,h.height=Math.abs(i[1]-t[1])+s},Qs.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var i=this.element_.style;i.left=i.top=i.width=i.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},Qs.prototype.setPixels=function(t,i){this.startPixel_=t,this.endPixel_=i,this.createOrUpdateGeometry(),this.render_()},Qs.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,i=this.endPixel_,s=[t,[t[0],i[1]],i,[i[0],t[1]]].map(this.map_.getCoordinateFromPixel,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Qi([s])},Qs.prototype.getGeometry=function(){return this.geometry_};var $s=function(t){Js.call(this,{handleDownEvent:$s.handleDownEvent_,handleDragEvent:$s.handleDragEvent_,handleUpEvent:$s.handleUpEvent_});var i=t||{};this.box_=new Qs(i.className||"ol-dragbox"),this.minArea_=void 0!==i.minArea?i.minArea:64,this.startPixel_=null,this.condition_=i.condition?i.condition:Hs.always,this.boxEndCondition_=i.boxEndCondition?i.boxEndCondition:$s.defaultBoxEndCondition};ui.inherits($s,Js),$s.defaultBoxEndCondition=function(t,i,s){var h=s[0]-i[0],n=s[1]-i[1];return h*h+n*n>=this.minArea_},$s.handleDragEvent_=function(t){Hs.mouseOnly(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new $s.Event($s.EventType_.BOXDRAG,t.coordinate,t)))},$s.prototype.getGeometry=function(){return this.box_.getGeometry()},$s.prototype.onBoxEnd=ui.nullFunction,$s.handleUpEvent_=function(t){return!Hs.mouseOnly(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd(t),this.dispatchEvent(new $s.Event($s.EventType_.BOXEND,t.coordinate,t))),!1)},$s.handleDownEvent_=function(t){return!(!Hs.mouseOnly(t)||!Hs.mouseActionButton(t)||!this.condition_(t)||(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new $s.Event($s.EventType_.BOXSTART,t.coordinate,t)),0))},$s.EventType_={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend"},$s.Event=function(t,i,s){vi.call(this,t),this.coordinate=i,this.mapBrowserEvent=s},ui.inherits($s.Event,vi);var th=function(t){var i=t||{},s=i.condition?i.condition:Hs.shiftKeyOnly;this.duration_=void 0!==i.duration?i.duration:200,this.out_=void 0!==i.out&&i.out,$s.call(this,{condition:s,className:i.className||"ol-dragzoom"})};ui.inherits(th,$s),th.prototype.onBoxEnd=function(){var t=this.getMap(),i=t.getView(),s=t.getSize(),h=this.getGeometry().getExtent();if(this.out_){var n=i.calculateExtent(s),r=bi.createOrUpdateFromCoordinates([t.getPixelFromCoordinate(bi.getBottomLeft(h)),t.getPixelFromCoordinate(bi.getTopRight(h))]),e=i.getResolutionForExtent(r,s);bi.scaleFromCenter(n,1/e),h=n}var o=i.constrainResolution(i.getResolutionForExtent(h,s)),a=bi.getCenter(h);a=i.constrainCenter(a),i.animate({resolution:o,center:a,duration:this.duration_,easing:Es.easeOut})};var ih=function(t){Ys.call(this,{handleEvent:ih.handleEvent});var i=t||{};this.defaultCondition_=function(t){return Hs.noModifierKeys(t)&&Hs.targetNotEditable(t)},this.condition_=void 0!==i.condition?i.condition:this.defaultCondition_,this.duration_=void 0!==i.duration?i.duration:100,this.pixelDelta_=void 0!==i.pixelDelta?i.pixelDelta:128};ui.inherits(ih,Ys),ih.handleEvent=function(t){var i=!1;if("keydown"==t.type){var s=t.originalEvent.keyCode;if(this.condition_(t)&&(40==s||37==s||39==s||38==s)){var h=t.map.getView(),n=h.getResolution()*this.pixelDelta_,r=0,e=0;40==s?e=-n:37==s?r=-n:39==s?r=n:e=n;var o=[r,e];xs.rotate(o,h.getRotation()),Ys.pan(h,o,this.duration_),t.preventDefault(),i=!0}}return!i};var sh=function(t){Ys.call(this,{handleEvent:sh.handleEvent});var i=t||{};this.condition_=i.condition?i.condition:Hs.targetNotEditable,this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:100};ui.inherits(sh,Ys),sh.handleEvent=function(t){var i=!1;if("keydown"==t.type||"keypress"==t.type){var s=t.originalEvent.charCode;if(this.condition_(t)&&(s=="+".charCodeAt(0)||s=="-".charCodeAt(0))){var h=t.map,n=s=="+".charCodeAt(0)?this.delta_:-this.delta_,r=h.getView();Ys.zoomByDelta(r,n,void 0,this.duration_),t.preventDefault(),i=!0}}return!i};var hh=function(t){Ys.call(this,{handleEvent:hh.handleEvent});var i=t||{};this.delta_=0,this.duration_=void 0!==i.duration?i.duration:250,this.timeout_=void 0!==i.timeout?i.timeout:80,this.useAnchor_=void 0===i.useAnchor||i.useAnchor,this.constrainResolution_=i.constrainResolution||!1,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_=void 0,this.trackpadDeltaPerZoom_=300,this.trackpadZoomBuffer_=1.5};ui.inherits(hh,Ys),hh.handleEvent=function(t){var i=t.type;if("wheel"!==i&&"mousewheel"!==i)return!0;t.preventDefault();var s,h=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),"wheel"==t.type?(s=n.deltaY,ts.FIREFOX&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(s/=ts.DEVICE_PIXEL_RATIO),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(s*=40)):"mousewheel"==t.type&&(s=-n.wheelDeltaY,ts.SAFARI&&(s/=3)),0===s)return!1;var r=Date.now();if(void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?hh.Mode_.TRACKPAD:hh.Mode_.WHEEL),this.mode_===hh.Mode_.TRACKPAD){var e=h.getView();this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):e.setHint(1,1),this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var o=e.getResolution()*Math.pow(2,s/this.trackpadDeltaPerZoom_),a=e.getMinResolution(),u=e.getMaxResolution(),f=0;if(o<a?(o=Math.max(o,a/this.trackpadZoomBuffer_),f=1):o>u&&(o=Math.min(o,u*this.trackpadZoomBuffer_),f=-1),this.lastAnchor_){var c=e.calculateCenterZoom(o,this.lastAnchor_);e.setCenter(e.constrainCenter(c))}return e.setResolution(o),0===f&&this.constrainResolution_&&e.animate({resolution:e.constrainResolution(o,s>0?-1:1),easing:Es.easeOut,anchor:this.lastAnchor_,duration:this.duration_}),f>0?e.animate({resolution:a,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500}):f<0&&e.animate({resolution:u,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500}),this.startTime_=r,!1}this.delta_+=s;var l=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,h),l),!1},hh.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().setHint(1,-1)},hh.prototype.handleWheelZoom_=function(t){var i=t.getView();i.getAnimating()&&i.cancelAnimations();var s=ui.MOUSEWHEELZOOM_MAXDELTA,h=_i.clamp(this.delta_,-s,s);Ys.zoomByDelta(i,-h,this.lastAnchor_,this.duration_),this.mode_=void 0,this.delta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},hh.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},hh.Mode_={TRACKPAD:"trackpad",WHEEL:"wheel"};var nh=function(t){Js.call(this,{handleDownEvent:nh.handleDownEvent_,handleDragEvent:nh.handleDragEvent_,handleUpEvent:nh.handleUpEvent_});var i=t||{};this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==i.threshold?i.threshold:.3,this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(nh,Js),nh.handleDragEvent_=function(t){var i=0,s=this.targetPointers[0],h=this.targetPointers[1],n=Math.atan2(h.clientY-s.clientY,h.clientX-s.clientX);if(void 0!==this.lastAngle_){var r=n-this.lastAngle_;this.rotationDelta_+=r,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),i=r}this.lastAngle_=n;var e=t.map,o=e.getView();if(o.getConstraints().rotation!==ys.disable){var a=e.getViewport().getBoundingClientRect(),u=Js.centroid(this.targetPointers);if(u[0]-=a.left,u[1]-=a.top,this.anchor_=e.getCoordinateFromPixel(u),this.rotating_){var f=o.getRotation();e.render(),Ys.rotateWithoutConstraints(o,f+i,this.anchor_)}}},nh.handleUpEvent_=function(t){if(this.targetPointers.length<2){var i=t.map.getView();if(i.setHint(1,-1),this.rotating_){var s=i.getRotation();Ys.rotate(i,s,this.anchor_,this.duration_)}return!1}return!0},nh.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var i=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||i.getView().setHint(1,1),!0}return!1},nh.prototype.shouldStopEvent=xi.FALSE;var rh=function(t){Js.call(this,{handleDownEvent:rh.handleDownEvent_,handleDragEvent:rh.handleDragEvent_,handleUpEvent:rh.handleUpEvent_});var i=t||{};this.constrainResolution_=i.constrainResolution||!1,this.anchor_=null,this.duration_=void 0!==i.duration?i.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1};ui.inherits(rh,Js),rh.handleDragEvent_=function(t){var i=1,s=this.targetPointers[0],h=this.targetPointers[1],n=s.clientX-h.clientX,r=s.clientY-h.clientY,e=Math.sqrt(n*n+r*r);void 0!==this.lastDistance_&&(i=this.lastDistance_/e),this.lastDistance_=e;var o=t.map,a=o.getView(),u=a.getResolution(),f=a.getMaxResolution(),c=a.getMinResolution(),l=u*i;l>f?(i=f/u,l=f):l<c&&(i=c/u,l=c),1!=i&&(this.lastScaleDelta_=i);var v=o.getViewport().getBoundingClientRect(),d=Js.centroid(this.targetPointers);d[0]-=v.left,d[1]-=v.top,this.anchor_=o.getCoordinateFromPixel(d),o.render(),Ys.zoomWithoutConstraints(a,l,this.anchor_)},rh.handleUpEvent_=function(t){if(this.targetPointers.length<2){var i=t.map.getView();i.setHint(1,-1);var s=i.getResolution();return(this.constrainResolution_||s<i.getMinResolution()||s>i.getMaxResolution())&&Ys.zoom(i,s,this.anchor_,this.duration_,this.lastScaleDelta_-1),!1}return!0},rh.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var i=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||i.getView().setHint(1,1),!0}return!1},rh.prototype.shouldStopEvent=xi.FALSE;var eh=function(t){var i=t||{},s=new hs,h=new qs(-.005,.05,100);return(void 0===i.altShiftDragRotate||i.altShiftDragRotate)&&s.push(new Ks),(void 0===i.doubleClickZoom||i.doubleClickZoom)&&s.push(new Bs({delta:i.zoomDelta,duration:i.zoomDuration})),(void 0===i.dragPan||i.dragPan)&&s.push(new Zs({kinetic:h})),(void 0===i.pinchRotate||i.pinchRotate)&&s.push(new nh),(void 0===i.pinchZoom||i.pinchZoom)&&s.push(new rh({constrainResolution:i.constrainResolution,duration:i.zoomDuration})),(void 0===i.keyboard||i.keyboard)&&(s.push(new ih),s.push(new sh({delta:i.zoomDelta,duration:i.zoomDuration}))),(void 0===i.mouseWheelZoom||i.mouseWheelZoom)&&s.push(new hh({constrainResolution:i.constrainResolution,duration:i.zoomDuration})),(void 0===i.shiftDragZoom||i.shiftDragZoom)&&s.push(new th({duration:i.zoomDuration})),s},oh=function(t,i,s,h){di.call(this),this.extent=t,this.pixelRatio_=s,this.resolution=i,this.state=h};ui.inherits(oh,di),oh.prototype.changed=function(){this.dispatchEvent("change")},oh.prototype.getExtent=function(){return this.extent},oh.prototype.getImage=function(){},oh.prototype.getPixelRatio=function(){return this.pixelRatio_},oh.prototype.getResolution=function(){return this.resolution},oh.prototype.getState=function(){return this.state},oh.prototype.load=function(){};var ah=function(t,i,s,h,n){this.loader_=void 0!==n?n:null,oh.call(this,t,i,s,void 0!==n?0:2),this.canvas_=h,this.error_=null};ui.inherits(ah,oh),ah.prototype.getError=function(){return this.error_},ah.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=3):this.state=2,this.changed()},ah.prototype.load=function(){0==this.state&&(this.state=1,this.changed(),this.loader_(this.handleLoad_.bind(this)))},ah.prototype.getImage=function(){return this.canvas_};var uh=function(t,i,s,h,n){vi.call(this,t),this.vectorContext=i,this.frameState=s,this.context=h,this.glContext=n};ui.inherits(uh,vi);var fh=function(t){di.call(this),this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null};ui.inherits(fh,di),fh.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},fh.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null,this.dispatchEvent("clear")},fh.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},fh.prototype.forEach=function(t,i){for(var s=this.oldest_;s;)t.call(i,s.value_,s.key_,this),s=s.newer},fh.prototype.get=function(t){var i=this.entries_[t];return gi(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},fh.prototype.remove=function(t){var i=this.entries_[t];return gi(void 0!==i,15),i===this.newest_?(this.newest_=i.older,this.newest_&&(this.newest_.newer=null)):i===this.oldest_?(this.oldest_=i.newer,this.oldest_&&(this.oldest_.older=null)):(i.newer.older=i.older,i.older.newer=i.newer),delete this.entries_[t],--this.count_,i.value_},fh.prototype.getCount=function(){return this.count_},fh.prototype.getKeys=function(){var t,i=new Array(this.count_),s=0;for(t=this.newest_;t;t=t.older)i[s++]=t.key_;return i},fh.prototype.getValues=function(){var t,i=new Array(this.count_),s=0;for(t=this.newest_;t;t=t.older)i[s++]=t.value_;return i},fh.prototype.peekLast=function(){return this.oldest_.value_},fh.prototype.peekLastKey=function(){return this.oldest_.key_},fh.prototype.peekFirstKey=function(){return this.newest_.key_},fh.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_},fh.prototype.replace=function(t,i){this.get(t),this.entries_[t].value_=i},fh.prototype.set=function(t,i){gi(!(t in this.entries_),16);var s={key_:t,newer:null,older:this.newest_,value_:i};this.newest_?this.newest_.newer=s:this.oldest_=s,this.newest_=s,this.entries_[t]=s,++this.count_},fh.prototype.prune=function(){for(;this.canExpireCache();)this.pop()};var ch,lh,vh={defaultFont:"10px sans-serif",defaultFillStyle:[0,0,0,1],defaultLineCap:"round",defaultLineDash:[],defaultLineDashOffset:0,defaultLineJoin:"round",defaultMiterLimit:10,defaultStrokeStyle:[0,0,0,1],defaultTextAlign:"center",defaultTextBaseline:"middle",defaultPadding:[0,0,0,0],defaultLineWidth:1};vh.labelCache=new fh,vh.checkedFonts_={},vh.measureContext_=null,vh.textHeights_={},vh.checkFont=function(){var t,i,s=vh.checkedFonts_,h=vh.labelCache,n="wmytzilWMYTZIL@#/&?$%10";function r(t){var s=vh.getMeasureContext();s.font="32px monospace",i=s.measureText(n).width;var h=!0;return"monospace"!=t&&(s.font="32px "+t+",monospace",h=s.measureText(n).width!=i),h}function e(){var i=!0;for(var n in s)s[n]<60&&(r(n)?(s[n]=60,fi.clear(vh.textHeights_),vh.measureContext_=null,h.clear()):(++s[n],i=!1));i&&(window.clearInterval(t),t=void 0)}return function(i){var h=Gs.getFontFamilies(i);if(h)for(var n=0,o=h.length;n<o;++n){var a=h[n];a in s||(s[a]=60,r(a)||(s[a]=0,void 0===t&&(t=window.setInterval(e,32))))}}}(),vh.getMeasureContext=function(){var t=vh.measureContext_;return t||(t=vh.measureContext_=Cs(1,1)),t},vh.measureTextHeight=(lh=vh.textHeights_,function(t){var i=lh[t];return null==i&&(ch||((ch=document.createElement("span")).textContent="M",ch.style.margin=ch.style.padding="0 !important",ch.style.position="absolute !important",ch.style.left="-99999px !important"),ch.style.font=t,document.body.appendChild(ch),i=lh[t]=ch.offsetHeight,document.body.removeChild(ch)),i}),vh.measureTextWidth=function(t,i){var s=vh.getMeasureContext();return t!=s.font&&(s.font=t),s.measureText(i).width},vh.rotateAtOffset=function(t,i,s,h){0!==i&&(t.translate(s,h),t.rotate(i),t.translate(-s,-h))},vh.resetTransform_=Ii.create(),vh.drawImage=function(t,i,s,h,n,r,e,o,a,u,f){var c;1!=s&&(t.globalAlpha=(c=t.globalAlpha)*s),i&&t.setTransform.apply(t,i),t.drawImage(h,n,r,e,o,a,u,e*f,o*f),c&&(t.globalAlpha=c),i&&t.setTransform.apply(t,vh.resetTransform_)};var dh={HEX_COLOR_RE_:/^#(?:[0-9a-f]{3,4}){1,2}$/i,NAMED_COLOR_RE_:/^([a-z]*)$/i,asArray:function(t){return Array.isArray(t)?t:dh.fromString(t)},asString:function(t){return"string"==typeof t?t:dh.toString(t)},fromNamed:function(t){var i=document.createElement("div");i.style.color=t,document.body.appendChild(i);var s=getComputedStyle(i).color;return document.body.removeChild(i),s}};dh.fromString=function(){var t={},i=0;return function(s){var h;if(t.hasOwnProperty(s))h=t[s];else{if(i>=1024){var n,r=0;for(n in t)0==(3&r++)&&(delete t[n],--i)}h=dh.fromStringInternal_(s),t[s]=h,++i}return h}}(),dh.fromStringInternal_=function(t){var i,s,h,n,r,e;if(dh.NAMED_COLOR_RE_.exec(t)&&(t=dh.fromNamed(t)),dh.HEX_COLOR_RE_.exec(t)){var o,a=t.length-1;o=a<=4?1:2;var u=4===a||8===a;i=parseInt(t.substr(1+0*o,o),16),s=parseInt(t.substr(1+1*o,o),16),h=parseInt(t.substr(1+2*o,o),16),n=u?parseInt(t.substr(1+3*o,o),16):255,1==o&&(i=(i<<4)+i,s=(s<<4)+s,h=(h<<4)+h,u&&(n=(n<<4)+n)),r=[i,s,h,n/255]}else 0==t.indexOf("rgba(")?(e=t.slice(5,-1).split(",").map(Number),r=dh.normalize(e)):0==t.indexOf("rgb(")?((e=t.slice(4,-1).split(",").map(Number)).push(1),r=dh.normalize(e)):gi(!1,14);return r},dh.normalize=function(t,i){var s=i||[];return s[0]=_i.clamp(t[0]+.5|0,0,255),s[1]=_i.clamp(t[1]+.5|0,0,255),s[2]=_i.clamp(t[2]+.5|0,0,255),s[3]=_i.clamp(t[3],0,1),s},dh.toString=function(t){var i=t[0];i!=(0|i)&&(i=i+.5|0);var s=t[1];s!=(0|s)&&(s=s+.5|0);var h=t[2];return h!=(0|h)&&(h=h+.5|0),"rgba("+i+","+s+","+h+","+(void 0===t[3]?1:t[3])+")"};var Mh={asColorLike:function(t){return Mh.isColorLike(t)?t:dh.asString(t)},isColorLike:function(t){return"string"==typeof t||t instanceof CanvasPattern||t instanceof CanvasGradient}},mh=function(){};mh.prototype.drawCustom=function(){},mh.prototype.drawGeometry=function(){},mh.prototype.setStyle=function(){},mh.prototype.drawCircle=function(){},mh.prototype.drawFeature=function(){},mh.prototype.drawGeometryCollection=function(){},mh.prototype.drawLineString=function(){},mh.prototype.drawMultiLineString=function(){},mh.prototype.drawMultiPoint=function(){},mh.prototype.drawMultiPolygon=function(){},mh.prototype.drawPoint=function(){},mh.prototype.drawPolygon=function(){},mh.prototype.drawText=function(){},mh.prototype.setFillStrokeStyle=function(){},mh.prototype.setImageStyle=function(){},mh.prototype.setTextStyle=function(){};var ph=function(t,i,s,h,n){mh.call(this),this.context_=t,this.pixelRatio_=i,this.extent_=s,this.transform_=h,this.viewRotation_=n,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=0,this.imageSnapToPixel_=!1,this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=0,this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Ii.create()};ui.inherits(ph,mh),ph.prototype.drawImages_=function(t,i,s){if(this.image_){var h=Ei(t,i,s,2,this.transform_,this.pixelCoordinates_),n=this.context_,r=this.tmpLocalTransform_,e=n.globalAlpha;1!=this.imageOpacity_&&(n.globalAlpha=e*this.imageOpacity_);var o,a,u=this.imageRotation_;for(this.imageRotateWithView_&&(u+=this.viewRotation_),o=0,a=h.length;o<a;o+=2){var f=h[o]-this.imageAnchorX_,c=h[o+1]-this.imageAnchorY_;if(this.imageSnapToPixel_&&(f=Math.round(f),c=Math.round(c)),0!==u||1!=this.imageScale_){var l=f+this.imageAnchorX_,v=c+this.imageAnchorY_;Ii.compose(r,l,v,this.imageScale_,this.imageScale_,u,-l,-v),n.setTransform.apply(n,r)}n.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,c,this.imageWidth_,this.imageHeight_)}0===u&&1==this.imageScale_||n.setTransform(1,0,0,1,0,0),1!=this.imageOpacity_&&(n.globalAlpha=e)}},ph.prototype.drawText_=function(t,i,s,h){if(this.textState_&&""!==this.text_){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var n=Ei(t,i,s,h,this.transform_,this.pixelCoordinates_),r=this.context_,e=this.textRotation_;for(this.textRotateWithView_&&(e+=this.viewRotation_);i<s;i+=h){var o=n[i]+this.textOffsetX_,a=n[i+1]+this.textOffsetY_;if(0!==e||1!=this.textScale_){var u=Ii.compose(this.tmpLocalTransform_,o,a,this.textScale_,this.textScale_,e,-o,-a);r.setTransform.apply(r,u)}this.textStrokeState_&&r.strokeText(this.text_,o,a),this.textFillState_&&r.fillText(this.text_,o,a)}0===e&&1==this.textScale_||r.setTransform(1,0,0,1,0,0)}},ph.prototype.moveToLineTo_=function(t,i,s,h,n){var r=this.context_,e=Ei(t,i,s,h,this.transform_,this.pixelCoordinates_);r.moveTo(e[0],e[1]);var o=e.length;n&&(o-=2);for(var a=2;a<o;a+=2)r.lineTo(e[a],e[a+1]);return n&&r.closePath(),s},ph.prototype.drawRings_=function(t,i,s,h){var n,r;for(n=0,r=s.length;n<r;++n)i=this.moveToLineTo_(t,i,s[n],h,!0);return i},ph.prototype.drawCircle=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i=Di.transform2D(t,this.transform_,this.pixelCoordinates_),s=i[2]-i[0],h=i[3]-i[1],n=Math.sqrt(s*s+h*h),r=this.context_;r.beginPath(),r.arc(i[0],i[1],n,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}},ph.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},ph.prototype.drawGeometry=function(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}},ph.prototype.drawFeature=function(t,i){var s=i.getGeometryFunction()(t);s&&bi.intersects(this.extent_,s.getExtent())&&(this.setStyle(i),this.drawGeometry(s))},ph.prototype.drawGeometryCollection=function(t){var i,s,h=t.getGeometriesArray();for(i=0,s=h.length;i<s;++i)this.drawGeometry(h[i])},ph.prototype.drawPoint=function(t){var i=t.getFlatCoordinates(),s=t.getStride();this.image_&&this.drawImages_(i,0,i.length,s),""!==this.text_&&this.drawText_(i,0,i.length,s)},ph.prototype.drawMultiPoint=function(t){var i=t.getFlatCoordinates(),s=t.getStride();this.image_&&this.drawImages_(i,0,i.length,s),""!==this.text_&&this.drawText_(i,0,i.length,s)},ph.prototype.drawLineString=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_,s=t.getFlatCoordinates();i.beginPath(),this.moveToLineTo_(s,0,s.length,t.getStride(),!1),i.stroke()}if(""!==this.text_){var h=t.getFlatMidpoint();this.drawText_(h,0,2,2)}}},ph.prototype.drawMultiLineString=function(t){var i=t.getExtent();if(bi.intersects(this.extent_,i)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var s,h,n=this.context_,r=t.getFlatCoordinates(),e=0,o=t.getEnds(),a=t.getStride();for(n.beginPath(),s=0,h=o.length;s<h;++s)e=this.moveToLineTo_(r,e,o[s],a,!1);n.stroke()}if(""!==this.text_){var u=t.getFlatMidpoints();this.drawText_(u,0,u.length,2)}}},ph.prototype.drawPolygon=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i=this.context_;i.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(""!==this.text_){var s=t.getFlatInteriorPoint();this.drawText_(s,0,2,2)}}},ph.prototype.drawMultiPolygon=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i,s,h=this.context_,n=t.getOrientedFlatCoordinates(),r=0,e=t.getEndss(),o=t.getStride();for(h.beginPath(),i=0,s=e.length;i<s;++i)r=this.drawRings_(n,r,e[i],o);this.fillState_&&h.fill(),this.strokeState_&&h.stroke()}if(""!==this.text_){var a=t.getFlatInteriorPoints();this.drawText_(a,0,a.length,2)}}},ph.prototype.setContextFillState_=function(t){var i=this.context_,s=this.contextFillState_;s?s.fillStyle!=t.fillStyle&&(s.fillStyle=i.fillStyle=t.fillStyle):(i.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})},ph.prototype.setContextStrokeState_=function(t){var i=this.context_,s=this.contextStrokeState_;s?(s.lineCap!=t.lineCap&&(s.lineCap=i.lineCap=t.lineCap),ts.CANVAS_LINE_DASH&&(yi.equals(s.lineDash,t.lineDash)||i.setLineDash(s.lineDash=t.lineDash),s.lineDashOffset!=t.lineDashOffset&&(s.lineDashOffset=i.lineDashOffset=t.lineDashOffset)),s.lineJoin!=t.lineJoin&&(s.lineJoin=i.lineJoin=t.lineJoin),s.lineWidth!=t.lineWidth&&(s.lineWidth=i.lineWidth=t.lineWidth),s.miterLimit!=t.miterLimit&&(s.miterLimit=i.miterLimit=t.miterLimit),s.strokeStyle!=t.strokeStyle&&(s.strokeStyle=i.strokeStyle=t.strokeStyle)):(i.lineCap=t.lineCap,ts.CANVAS_LINE_DASH&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.lineJoin=t.lineJoin,i.lineWidth=t.lineWidth,i.miterLimit=t.miterLimit,i.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})},ph.prototype.setContextTextState_=function(t){var i=this.context_,s=this.contextTextState_,h=t.textAlign?t.textAlign:vh.defaultTextAlign;s?(s.font!=t.font&&(s.font=i.font=t.font),s.textAlign!=h&&(s.textAlign=h),s.textBaseline!=t.textBaseline&&(s.textBaseline=i.textBaseline=t.textBaseline)):(i.font=t.font,i.textAlign=h,i.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:h,textBaseline:t.textBaseline})},ph.prototype.setFillStrokeStyle=function(t,i){if(t){var s=t.getColor();this.fillState_={fillStyle:Mh.asColorLike(s||vh.defaultFillStyle)}}else this.fillState_=null;if(i){var h=i.getColor(),n=i.getLineCap(),r=i.getLineDash(),e=i.getLineDashOffset(),o=i.getLineJoin(),a=i.getWidth(),u=i.getMiterLimit();this.strokeState_={lineCap:void 0!==n?n:vh.defaultLineCap,lineDash:r||vh.defaultLineDash,lineDashOffset:e||vh.defaultLineDashOffset,lineJoin:void 0!==o?o:vh.defaultLineJoin,lineWidth:this.pixelRatio_*(void 0!==a?a:vh.defaultLineWidth),miterLimit:void 0!==u?u:vh.defaultMiterLimit,strokeStyle:Mh.asColorLike(h||vh.defaultStrokeStyle)}}else this.strokeState_=null},ph.prototype.setImageStyle=function(t){if(t){var i=t.getAnchor(),s=t.getImage(1),h=t.getOrigin(),n=t.getSize();this.imageAnchorX_=i[0],this.imageAnchorY_=i[1],this.imageHeight_=n[1],this.image_=s,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=h[0],this.imageOriginY_=h[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation(),this.imageScale_=t.getScale()*this.pixelRatio_,this.imageSnapToPixel_=t.getSnapToPixel(),this.imageWidth_=n[0]}else this.image_=null},ph.prototype.setTextStyle=function(t){if(t){var i=t.getFill();if(i){var s=i.getColor();this.textFillState_={fillStyle:Mh.asColorLike(s||vh.defaultFillStyle)}}else this.textFillState_=null;var h=t.getStroke();if(h){var n=h.getColor(),r=h.getLineCap(),e=h.getLineDash(),o=h.getLineDashOffset(),a=h.getLineJoin(),u=h.getWidth(),f=h.getMiterLimit();this.textStrokeState_={lineCap:void 0!==r?r:vh.defaultLineCap,lineDash:e||vh.defaultLineDash,lineDashOffset:o||vh.defaultLineDashOffset,lineJoin:void 0!==a?a:vh.defaultLineJoin,lineWidth:void 0!==u?u:vh.defaultLineWidth,miterLimit:void 0!==f?f:vh.defaultMiterLimit,strokeStyle:Mh.asColorLike(n||vh.defaultStrokeStyle)}}else this.textStrokeState_=null;var c=t.getFont(),l=t.getOffsetX(),v=t.getOffsetY(),d=t.getRotateWithView(),M=t.getRotation(),m=t.getScale(),p=t.getText(),g=t.getTextAlign(),_=t.getTextBaseline();this.textState_={font:void 0!==c?c:vh.defaultFont,textAlign:void 0!==g?g:vh.defaultTextAlign,textBaseline:void 0!==_?_:vh.defaultTextBaseline},this.text_=void 0!==p?p:"",this.textOffsetX_=void 0!==l?this.pixelRatio_*l:0,this.textOffsetY_=void 0!==v?this.pixelRatio_*v:0,this.textRotateWithView_=void 0!==d&&d,this.textRotation_=void 0!==M?M:0,this.textScale_=this.pixelRatio_*(void 0!==m?m:1)}else this.text_=""};var gh=function(t){Mi.call(this),this.layer_=t};ui.inherits(gh,Mi),gh.prototype.forEachFeatureAtCoordinate=ui.nullFunction,gh.prototype.hasFeatureAtCoordinate=xi.FALSE,gh.prototype.createLoadedTileFinder=function(t,i,s){return function(h,n){return t.forEachLoadedTile(i,h,n,(function(t){s[h]||(s[h]={}),s[h][t.tileCoord.toString()]=t}))}},gh.prototype.getLayer=function(){return this.layer_},gh.prototype.handleImageChange_=function(t){2===t.target.getState()&&this.renderIfReadyAndVisible()},gh.prototype.loadImage=function(t){var i=t.getState();return 2!=i&&3!=i&&ci.listen(t,"change",this.handleImageChange_,this),0==i&&(t.load(),i=t.getState()),2==i},gh.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&"ready"==t.getSourceState()&&this.changed()},gh.prototype.scheduleExpireCache=function(t,i){if(i.canExpireCache()){var s=function(t,i,s){var h=ui.getUid(t).toString();h in s.usedTiles&&t.expireCache(s.viewState.projection,s.usedTiles[h])}.bind(null,i);t.postRenderFunctions.push(s)}},gh.prototype.updateLogos=function(t,i){var s=i.getLogo();void 0!==s&&("string"==typeof s?t.logos[s]="":s&&(gi("string"==typeof s.href,44),gi("string"==typeof s.src,45),t.logos[s.src]=s.href))},gh.prototype.updateUsedTiles=function(t,i,s,h){var n=ui.getUid(i).toString(),r=s.toString();n in t?r in t[n]?t[n][r].extend(h):t[n][r]=h:(t[n]={},t[n][r]=h)},gh.prototype.manageTilePyramid=function(t,i,s,h,n,r,e,o,a,u){var f=ui.getUid(i).toString();f in t.wantedTiles||(t.wantedTiles[f]={});var c,l,v,d,M,m,p=t.wantedTiles[f],g=t.tileQueue;for(m=s.getMinZoom();m<=e;++m)for(l=s.getTileRangeForExtentAndZ(r,m,l),v=s.getResolution(m),d=l.minX;d<=l.maxX;++d)for(M=l.minY;M<=l.maxY;++M)e-m<=o?(0==(c=i.getTile(m,d,M,h,n)).getState()&&(p[c.getKey()]=!0,g.isKeyQueued(c.getKey())||g.enqueue([c,f,s.getTileCoordCenter(c.tileCoord),v])),void 0!==a&&a.call(u,c)):i.useTile(m,d,M,n)};var _h=function(t){gh.call(this,t),this.transform_=Ii.create()};ui.inherits(_h,gh),_h.prototype.clip=function(t,i,s){var h=i.pixelRatio,n=i.size[0]*h,r=i.size[1]*h,e=i.viewState.rotation,o=bi.getTopLeft(s),a=bi.getTopRight(s),u=bi.getBottomRight(s),f=bi.getBottomLeft(s);Ii.apply(i.coordinateToPixelTransform,o),Ii.apply(i.coordinateToPixelTransform,a),Ii.apply(i.coordinateToPixelTransform,u),Ii.apply(i.coordinateToPixelTransform,f),t.save(),vh.rotateAtOffset(t,-e,n/2,r/2),t.beginPath(),t.moveTo(o[0]*h,o[1]*h),t.lineTo(a[0]*h,a[1]*h),t.lineTo(u[0]*h,u[1]*h),t.lineTo(f[0]*h,f[1]*h),t.clip(),vh.rotateAtOffset(t,e,n/2,r/2)},_h.prototype.dispatchComposeEvent_=function(t,i,s,h){var n=this.getLayer();if(n.hasListener(t)){var r=s.size[0]*s.pixelRatio,e=s.size[1]*s.pixelRatio,o=s.viewState.rotation;vh.rotateAtOffset(i,-o,r/2,e/2);var a=void 0!==h?h:this.getTransform(s,0),u=new ph(i,s.pixelRatio,s.extent,a,s.viewState.rotation),f=new uh(t,u,s,i,null);n.dispatchEvent(f),vh.rotateAtOffset(i,o,r/2,e/2)}},_h.prototype.forEachLayerAtCoordinate=function(t,i,s,h){return this.forEachFeatureAtCoordinate(t,i,0,xi.TRUE,this)?s.call(h,this.getLayer(),null):void 0},_h.prototype.postCompose=function(t,i,s,h){this.dispatchComposeEvent_("postcompose",t,i,h)},_h.prototype.preCompose=function(t,i,s){this.dispatchComposeEvent_("precompose",t,i,s)},_h.prototype.dispatchRenderEvent=function(t,i,s){this.dispatchComposeEvent_("render",t,i,s)},_h.prototype.getTransform=function(t,i){var s=t.viewState,h=t.pixelRatio,n=h/s.resolution;return Ii.compose(this.transform_,h*t.size[0]/2,h*t.size[1]/2,n,-n,-s.rotation,-s.center[0]+i,-s.center[1])},_h.prototype.composeFrame=function(){},_h.prototype.prepareFrame=function(){};var wh=function(t){_h.call(this,t),this.coordinateToCanvasPixelTransform=Ii.create(),this.hitCanvasContext_=null};ui.inherits(wh,_h),wh.prototype.composeFrame=function(t,i,s){this.preCompose(s,t);var h=this.getImage();if(h){var n=i.extent,r=void 0!==n&&!bi.containsExtent(n,t.extent)&&bi.intersects(n,t.extent);r&&this.clip(s,t,n);var e=this.getImageTransform(),o=s.globalAlpha;s.globalAlpha=i.opacity;var a=e[5],u=h.width*e[0],f=h.height*e[3];s.drawImage(h,0,0,+h.width,+h.height,Math.round(e[4]),Math.round(a),Math.round(u),Math.round(f)),s.globalAlpha=o,r&&s.restore()}this.postCompose(s,t,i)},wh.prototype.getImage=function(){},wh.prototype.getImageTransform=function(){},wh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=this.getLayer();return r.getSource().forEachFeatureAtCoordinate(t,i.viewState.resolution,i.viewState.rotation,s,i.skippedFeatureUids,(function(t){return h.call(n,t,r)}))},wh.prototype.forEachLayerAtCoordinate=function(t,i,s,h){if(this.getImage()){if(this.getLayer().getSource().forEachFeatureAtCoordinate!==ui.nullFunction)return _h.prototype.forEachLayerAtCoordinate.apply(this,arguments);var n=Ii.apply(this.coordinateToCanvasPixelTransform,t.slice());xs.scale(n,i.viewState.resolution/this.renderedResolution),this.hitCanvasContext_||(this.hitCanvasContext_=Cs(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.getImage(),n[0],n[1],1,1,0,0,1,1);var r=this.hitCanvasContext_.getImageData(0,0,1,1).data;return r[3]>0?s.call(h,this.getLayer(),r):void 0}};var yh=function(t){wh.call(this,t),this.image_=null,this.imageTransform_=Ii.create(),this.skippedFeatures_=[],this.vectorRenderer_=null};ui.inherits(yh,wh),yh.handles=function(t,i){return"canvas"===t&&("IMAGE"===i.getType()||"VECTOR"===i.getType()&&"image"===i.getRenderMode())},yh.create=function(t,i){var s=new yh(i);if("VECTOR"===i.getType())for(var h=zs.getLayerRendererPlugins(),n=0,r=h.length;n<r;++n){var e=h[n];e!==yh&&e.handles("canvas",i)&&s.setVectorRenderer(e.create(t,i))}return s},yh.prototype.getImage=function(){return this.image_?this.image_.getImage():null},yh.prototype.getImageTransform=function(){return this.imageTransform_},yh.prototype.prepareFrame=function(t,i){var s,h=t.pixelRatio,n=t.size,r=t.viewState,e=r.center,o=r.resolution,a=this.getLayer().getSource(),u=t.viewHints,f=t.extent;if(void 0!==i.extent&&(f=bi.getIntersection(f,i.extent)),!u[0]&&!u[1]&&!bi.isEmpty(f)){var c=r.projection;if(!ui.ENABLE_RASTER_REPROJECTION){var l=a.getProjection();l&&(c=l)}var v=this.vectorRenderer_;if(v){var d=v.context,M=fi.assign({},t,{size:[bi.getWidth(f)/o,bi.getHeight(f)/o],viewState:fi.assign({},t.viewState,{rotation:0})}),m=Object.keys(M.skippedFeatureUids).sort();!v.prepareFrame(M,i)||!v.replayGroupChanged&&yi.equals(m,this.skippedFeatures_)||(d.canvas.width=M.size[0]*h,d.canvas.height=M.size[1]*h,v.composeFrame(M,i,d),this.image_=new ah(f,o,h,d.canvas),this.skippedFeatures_=m)}else(s=a.getImage(f,o,h,c))&&this.loadImage(s)&&(this.image_=s)}if(this.image_){var p=(s=this.image_).getExtent(),g=s.getResolution(),_=s.getPixelRatio(),w=h*g/(o*_),y=Ii.compose(this.imageTransform_,h*n[0]/2,h*n[1]/2,w,w,0,_*(p[0]-e[0])/g,_*(e[1]-p[3])/g);Ii.compose(this.coordinateToCanvasPixelTransform,h*n[0]/2-y[4],h*n[1]/2-y[5],h/o,-h/o,0,-e[0],-e[1]),this.updateLogos(t,a),this.renderedResolution=g*h/_}return!!this.image_},yh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,i,s,h,n):wh.prototype.forEachFeatureAtCoordinate.call(this,t,i,s,h,n)},yh.prototype.setVectorRenderer=function(t){this.vectorRenderer_=t};var bh=function(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32};bh.getKey=function(t,i,s){return i+":"+t+":"+(s?dh.asString(s):"null")},bh.prototype.clear=function(){this.cache_={},this.cacheSize_=0},bh.prototype.expire=function(){if(this.cacheSize_>this.maxCacheSize_){var t,i=0;for(t in this.cache_)0!=(3&i++)||this.cache_[t].hasListener()||(delete this.cache_[t],--this.cacheSize_)}},bh.prototype.get=function(t,i,s){var h=bh.getKey(t,i,s);return h in this.cache_?this.cache_[h]:null},bh.prototype.set=function(t,i,s,h){var n=bh.getKey(t,i,s);this.cache_[n]=h,++this.cacheSize_},bh.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()};var xh={};xh.iconImageCache=new bh;var Eh=function(t,i){li.call(this),this.map_=i,this.layerRenderers_={},this.layerRendererListeners_={}};ui.inherits(Eh,li),Eh.prototype.calculateMatrices2D=function(t){var i=t.viewState,s=t.coordinateToPixelTransform,h=t.pixelToCoordinateTransform;Ii.compose(s,t.size[0]/2,t.size[1]/2,1/i.resolution,-1/i.resolution,-i.rotation,-i.center[0],-i.center[1]),Ii.invert(Ii.setFromArray(h,s))},Eh.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_)this.removeLayerRendererByKey_(t).dispose()},Eh.expireIconCache_=function(){xh.iconImageCache.expire()},Eh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o,a=i.viewState,u=a.resolution;function f(t,s){var r=ui.getUid(t).toString(),e=i.layerStates[ui.getUid(s)].managed;if(!(r in i.skippedFeatureUids)||e)return h.call(n,t,e?s:null)}var c=a.projection,l=t;if(c.canWrapX()){var v=c.getExtent(),d=bi.getWidth(v),M=t[0];(M<v[0]||M>v[2])&&(l=[M+d*Math.ceil((v[0]-M)/d),t[1]])}var m,p=i.layerStatesArray;for(m=p.length-1;m>=0;--m){var g=p[m],_=g.layer;if(Ws.visibleAtResolution(g,u)&&r.call(e,_)){var w=this.getLayerRenderer(_);if(_.getSource()&&(o=w.forEachFeatureAtCoordinate(_.getSource().getWrapX()?l:t,i,s,f,n)),o)return o}}},Eh.prototype.forEachLayerAtPixel=function(){},Eh.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n){return void 0!==this.forEachFeatureAtCoordinate(t,i,s,xi.TRUE,this,h,n)},Eh.prototype.getLayerRenderer=function(t){var i=ui.getUid(t).toString();if(i in this.layerRenderers_)return this.layerRenderers_[i];for(var s,h=zs.getLayerRendererPlugins(),n=this.getType(),r=0,e=h.length;r<e;++r){var o=h[r];if(o.handles(n,t)){s=o.create(this,t);break}}if(!s)throw new Error("Unable to create renderer for layer: "+t.getType());return this.layerRenderers_[i]=s,this.layerRendererListeners_[i]=ci.listen(s,"change",this.handleLayerRendererChange_,this),s},Eh.prototype.getLayerRendererByKey=function(t){return this.layerRenderers_[t]},Eh.prototype.getLayerRenderers=function(){return this.layerRenderers_},Eh.prototype.getMap=function(){return this.map_},Eh.prototype.getType=function(){},Eh.prototype.handleLayerRendererChange_=function(){this.map_.render()},Eh.prototype.removeLayerRendererByKey_=function(t){var i=this.layerRenderers_[t];return delete this.layerRenderers_[t],ci.unlistenByKey(this.layerRendererListeners_[t]),delete this.layerRendererListeners_[t],i},Eh.prototype.renderFrame=ui.nullFunction,Eh.prototype.removeUnusedLayerRenderers_=function(t,i){var s;for(s in this.layerRenderers_)i&&s in i.layerStates||this.removeLayerRendererByKey_(s).dispose()},Eh.prototype.scheduleExpireIconCache=function(t){t.postRenderFunctions.push(Eh.expireIconCache_)},Eh.prototype.scheduleRemoveUnusedLayerRenderers=function(t){var i;for(i in this.layerRenderers_)if(!(i in t.layerStates))return void t.postRenderFunctions.push(this.removeUnusedLayerRenderers_.bind(this))},Eh.sortByZIndex=function(t,i){return t.zIndex-i.zIndex};var Sh=function(t,i){Eh.call(this,t,i),this.context_=Cs(),this.canvas_=this.context_.canvas,this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=Gs.CLASS_UNSELECTABLE,t.insertBefore(this.canvas_,t.childNodes[0]||null),this.renderedVisible_=!0,this.transform_=Ii.create()};ui.inherits(Sh,Eh),Sh.handles=function(t){return"canvas"===t},Sh.create=function(t,i){return new Sh(t,i)},Sh.prototype.dispatchComposeEvent_=function(t,i){var s=this.getMap(),h=this.context_;if(s.hasListener(t)){var n=i.extent,r=i.pixelRatio,e=i.viewState.rotation,o=this.getTransform(i),a=new ph(h,r,n,o,e),u=new uh(t,a,i,h,null);s.dispatchEvent(u)}},Sh.prototype.getTransform=function(t){var i=t.viewState,s=t.pixelRatio/i.resolution;return Ii.compose(this.transform_,this.canvas_.width/2,this.canvas_.height/2,s,-s,-i.rotation,-i.center[0],-i.center[1])},Sh.prototype.getType=function(){return"canvas"},Sh.prototype.renderFrame=function(t){if(t){var i=this.context_,s=t.pixelRatio,h=Math.round(t.size[0]*s),n=Math.round(t.size[1]*s);this.canvas_.width!=h||this.canvas_.height!=n?(this.canvas_.width=h,this.canvas_.height=n):i.clearRect(0,0,h,n);var r=t.viewState.rotation;this.calculateMatrices2D(t),this.dispatchComposeEvent_("precompose",t);var e=t.layerStatesArray;yi.stableSort(e,Eh.sortByZIndex),r&&(i.save(),vh.rotateAtOffset(i,r,h/2,n/2));var o,a,u,f,c=t.viewState.resolution;for(o=0,a=e.length;o<a;++o)u=this.getLayerRenderer((f=e[o]).layer),Ws.visibleAtResolution(f,c)&&"ready"==f.sourceState&&u.prepareFrame(t,f)&&u.composeFrame(t,f,i);r&&i.restore(),this.dispatchComposeEvent_("postcompose",t),this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1)},Sh.prototype.forEachLayerAtPixel=function(t,i,s,h,n,r){var e,o,a=i.viewState.resolution,u=i.layerStatesArray,f=u.length,c=Ii.apply(i.pixelToCoordinateTransform,t.slice());for(o=f-1;o>=0;--o){var l=u[o],v=l.layer;if(Ws.visibleAtResolution(l,a)&&n.call(r,v)&&(e=this.getLayerRenderer(v).forEachLayerAtCoordinate(c,i,s,h)))return e}};var Ch=function(t,i,s,h){this.minX=t,this.maxX=i,this.minY=s,this.maxY=h};Ch.createOrUpdate=function(t,i,s,h,n){return void 0!==n?(n.minX=t,n.maxX=i,n.minY=s,n.maxY=h,n):new Ch(t,i,s,h)},Ch.prototype.contains=function(t){return this.containsXY(t[1],t[2])},Ch.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},Ch.prototype.containsXY=function(t,i){return this.minX<=t&&t<=this.maxX&&this.minY<=i&&i<=this.maxY},Ch.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},Ch.prototype.extend=function(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)},Ch.prototype.getHeight=function(){return this.maxY-this.minY+1},Ch.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},Ch.prototype.getWidth=function(){return this.maxX-this.minX+1},Ch.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var Ah=function(t){wh.call(this,t),this.context=null===this.context?null:Cs(),this.renderedExtent_=null,this.renderedTiles=[],this.tmpExtent=bi.createEmpty(),this.tmpTileRange_=new Ch(0,0,0,0),this.imageTransform_=Ii.create(),this.zDirection=0};ui.inherits(Ah,wh),Ah.handles=function(t,i){return"canvas"===t&&"TILE"===i.getType()},Ah.create=function(t,i){return new Ah(i)},Ah.prototype.isDrawableTile_=function(t){var i=t.getState(),s=this.getLayer().getUseInterimTilesOnError();return 2==i||4==i||3==i&&!s},Ah.prototype.prepareFrame=function(t,i){var s=t.pixelRatio,h=t.size,n=t.viewState,r=n.projection,e=n.resolution,o=n.center,a=this.getLayer(),u=a.getSource(),f=u.getRevision(),c=u.getTileGridForProjection(r),l=c.getZForResolution(e,this.zDirection),v=c.getResolution(l),d=Math.round(e/v)||1,M=t.extent;if(void 0!==i.extent&&(M=bi.getIntersection(M,i.extent)),bi.isEmpty(M))return!1;var m=c.getTileRangeForExtentAndZ(M,l),p=c.getTileRangeExtent(l,m),g=u.getTilePixelRatio(s),_={};_[l]={};var w,y,b,x=this.createLoadedTileFinder(u,r,_),E=this.tmpExtent,S=this.tmpTileRange_,C=!1;for(y=m.minX;y<=m.maxX;++y)for(b=m.minY;b<=m.maxY;++b){if(3==(w=u.getTile(l,y,b,s,r)).getState()&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(C=!0):w.setState(2)),this.isDrawableTile_(w)||(w=w.getInterimTile()),this.isDrawableTile_(w)){var A=ui.getUid(this);if(2==w.getState()){_[l][w.tileCoord.toString()]=w;var P=w.inTransition(A);C||!P&&-1!==this.renderedTiles.indexOf(w)||(C=!0)}if(1===w.getAlpha(A,t.time))continue}var R=c.getTileCoordChildTileRange(w.tileCoord,S,E),N=!1;R&&(N=x(l+1,R)),N||c.forEachTileCoordParentTileRange(w.tileCoord,x,null,S,E)}var z=v*s/g*d,k=t.viewHints,T=k[0]||k[1];if(!(this.renderedResolution&&Date.now()-t.time>16&&T)&&(C||!this.renderedExtent_||!bi.containsExtent(this.renderedExtent_,M)||this.renderedRevision!=f||d!=this.oversampling_||!T&&z!=this.renderedResolution)){var O=this.context;if(O){var L=u.getTilePixelSize(l,s,r),I=Math.round(m.getWidth()*L[0]/d),F=Math.round(m.getHeight()*L[1]/d),D=O.canvas;D.width!=I||D.height!=F?(this.oversampling_=d,D.width=I,D.height=F):(this.renderedExtent_&&!bi.equals(p,this.renderedExtent_)&&O.clearRect(0,0,I,F),d=this.oversampling_)}this.renderedTiles.length=0;var G,W,V,j,U,X,q,Y,B=Object.keys(_).map(Number);for(B.sort((function(t,i){return t===l?1:i===l?-1:t>i?1:t<i?-1:0})),j=0,U=B.length;j<U;++j)for(var H in W=u.getTilePixelSize(V=B[j],s,r),G=c.getResolution(V)/v,q=g*u.getGutter(r),Y=_[V])X=c.getTileCoordExtent((w=Y[H]).getTileCoord(),E),this.drawTileImage(w,t,i,y=(X[0]-p[0])/v*g/d,b=(p[3]-X[3])/v*g/d,W[0]*G/d,W[1]*G/d,q,l===V),this.renderedTiles.push(w);this.renderedRevision=f,this.renderedResolution=v*s/g*d,this.renderedExtent_=p}var J=this.renderedResolution/e,Z=Ii.compose(this.imageTransform_,s*h[0]/2,s*h[1]/2,J,J,0,(this.renderedExtent_[0]-o[0])/this.renderedResolution*s,(o[1]-this.renderedExtent_[3])/this.renderedResolution*s);return Ii.compose(this.coordinateToCanvasPixelTransform,s*h[0]/2-Z[4],s*h[1]/2-Z[5],s/e,-s/e,0,-o[0],-o[1]),this.updateUsedTiles(t.usedTiles,u,l,m),this.manageTilePyramid(t,u,c,s,r,M,l,a.getPreload()),this.scheduleExpireCache(t,u),this.updateLogos(t,u),this.renderedTiles.length>0},Ah.prototype.drawTileImage=function(t,i,s,h,n,r,e,o,a){var u=t.getImage(this.getLayer());if(u){var f=ui.getUid(this),c=a?t.getAlpha(f,i.time):1;1!==c||this.getLayer().getSource().getOpaque(i.viewState.projection)||this.context.clearRect(h,n,r,e);var l=c!==this.context.globalAlpha;l&&(this.context.save(),this.context.globalAlpha=c),this.context.drawImage(u,o,o,u.width-2*o,u.height-2*o,h,n,r,e),l&&this.context.restore(),1!==c?i.animate=!0:a&&t.endTransition(f)}},Ah.prototype.getImage=function(){var t=this.context;return t?t.canvas:null},Ah.prototype.getImageTransform=function(){return this.imageTransform_};var Ph=e((function(t){t.exports=function(){function t(s,h,n,r,e){for(;r>n;){if(r-n>600){var o=r-n+1,a=h-n+1,u=Math.log(o),f=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*f*(o-f)/o)*(a-o/2<0?-1:1);t(s,h,Math.max(n,Math.floor(h-a*f/o+c)),Math.min(r,Math.floor(h+(o-a)*f/o+c)),e)}var l=s[h],v=n,d=r;for(i(s,n,h),e(s[r],l)>0&&i(s,n,r);v<d;){for(i(s,v,d),v++,d--;e(s[v],l)<0;)v++;for(;e(s[d],l)>0;)d--}0===e(s[n],l)?i(s,n,d):i(s,++d,r),d<=h&&(n=d+1),h<=d&&(r=d-1)}}function i(t,i,s){var h=t[i];t[i]=t[s],t[s]=h}function s(t,i){return t<i?-1:t>i?1:0}return function(i,h,n,r,e){t(i,h,n||0,r||i.length-1,e||s)}}()})),Rh=Nh;function Nh(t,i){if(!(this instanceof Nh))return new Nh(t,i);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),i&&this._initFormat(i),this.clear()}function zh(t,i,s){if(!s)return i.indexOf(t);for(var h=0;h<i.length;h++)if(s(t,i[h]))return h;return-1}function kh(t,i){Th(t,0,t.children.length,i,t)}function Th(t,i,s,h,n){n||(n=Vh(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var r,e=i;e<s;e++)r=t.children[e],Oh(n,t.leaf?h(r):r);return n}function Oh(t,i){return t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),t}function Lh(t,i){return t.minX-i.minX}function Ih(t,i){return t.minY-i.minY}function Fh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Dh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Gh(t,i){return t.minX<=i.minX&&t.minY<=i.minY&&i.maxX<=t.maxX&&i.maxY<=t.maxY}function Wh(t,i){return i.minX<=t.maxX&&i.minY<=t.maxY&&i.maxX>=t.minX&&i.maxY>=t.minY}function Vh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jh(t,i,s,h,n){for(var r,e=[i,s];e.length;)(s=e.pop())-(i=e.pop())<=h||(r=i+Math.ceil((s-i)/h/2)*h,Ph(t,r,i,s,n),e.push(i,r,r,s))}Nh.prototype={all:function(){return this._all(this.data,[])},search:function(t){var i=this.data,s=[],h=this.toBBox;if(!Wh(t,i))return s;for(var n,r,e,o,a=[];i;){for(n=0,r=i.children.length;n<r;n++)e=i.children[n],Wh(t,o=i.leaf?h(e):e)&&(i.leaf?s.push(e):Gh(t,o)?this._all(e,s):a.push(e));i=a.pop()}return s},collides:function(t){var i=this.data,s=this.toBBox;if(!Wh(t,i))return!1;for(var h,n,r,e,o=[];i;){for(h=0,n=i.children.length;h<n;h++)if(r=i.children[h],Wh(t,e=i.leaf?s(r):r)){if(i.leaf||Gh(t,e))return!0;o.push(r)}i=o.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var i=0,s=t.length;i<s;i++)this.insert(t[i]);return this}var h=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===h.height)this._splitRoot(this.data,h);else{if(this.data.height<h.height){var n=this.data;this.data=h,h=n}this._insert(h,this.data.height-h.height-1,!0)}else this.data=h;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Vh([]),this},remove:function(t,i){if(!t)return this;for(var s,h,n,r,e=this.data,o=this.toBBox(t),a=[],u=[];e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],s=u.pop(),r=!0),e.leaf&&-1!==(n=zh(t,e.children,i)))return e.children.splice(n,1),a.push(e),this._condense(a),this;r||e.leaf||!Gh(e,o)?h?(s++,e=h.children[s],r=!1):e=null:(a.push(e),u.push(s),s=0,h=e,e=e.children[0])}return this},toBBox:function(t){return t},compareMinX:Lh,compareMinY:Ih,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,i){for(var s=[];t;)t.leaf?i.push.apply(i,t.children):s.push.apply(s,t.children),t=s.pop();return i},_build:function(t,i,s,h){var n,r=s-i+1,e=this._maxEntries;if(r<=e)return kh(n=Vh(t.slice(i,s+1)),this.toBBox),n;h||(h=Math.ceil(Math.log(r)/Math.log(e)),e=Math.ceil(r/Math.pow(e,h-1))),(n=Vh([])).leaf=!1,n.height=h;var o,a,u,f,c=Math.ceil(r/e),l=c*Math.ceil(Math.sqrt(e));for(jh(t,i,s,l,this.compareMinX),o=i;o<=s;o+=l)for(jh(t,o,u=Math.min(o+l-1,s),c,this.compareMinY),a=o;a<=u;a+=c)f=Math.min(a+c-1,u),n.children.push(this._build(t,a,f,h-1));return kh(n,this.toBBox),n},_chooseSubtree:function(t,i,s,h){for(var n,r,e,o,a,u,f,c,l,v;h.push(i),!i.leaf&&h.length-1!==s;){for(f=c=1/0,n=0,r=i.children.length;n<r;n++)a=Fh(e=i.children[n]),l=t,v=e,(u=(Math.max(v.maxX,l.maxX)-Math.min(v.minX,l.minX))*(Math.max(v.maxY,l.maxY)-Math.min(v.minY,l.minY))-a)<c?(c=u,f=a<f?a:f,o=e):u===c&&a<f&&(f=a,o=e);i=o||i.children[0]}return i},_insert:function(t,i,s){var h=s?t:(0,this.toBBox)(t),n=[],r=this._chooseSubtree(h,this.data,i,n);for(r.children.push(t),Oh(r,h);i>=0&&n[i].children.length>this._maxEntries;)this._split(n,i),i--;this._adjustParentBBoxes(h,n,i)},_split:function(t,i){var s=t[i],h=s.children.length,n=this._minEntries;this._chooseSplitAxis(s,n,h);var r=this._chooseSplitIndex(s,n,h),e=Vh(s.children.splice(r,s.children.length-r));e.height=s.height,e.leaf=s.leaf,kh(s,this.toBBox),kh(e,this.toBBox),i?t[i-1].children.push(e):this._splitRoot(s,e)},_splitRoot:function(t,i){this.data=Vh([t,i]),this.data.height=t.height+1,this.data.leaf=!1,kh(this.data,this.toBBox)},_chooseSplitIndex:function(t,i,s){var h,n,r,e,o,a,u,f,c,l,v,d,M,m;for(a=u=1/0,h=i;h<=s-i;h++)c=n=Th(t,0,h,this.toBBox),l=r=Th(t,h,s,this.toBBox),void 0,void 0,void 0,void 0,v=Math.max(c.minX,l.minX),d=Math.max(c.minY,l.minY),M=Math.min(c.maxX,l.maxX),m=Math.min(c.maxY,l.maxY),e=Math.max(0,M-v)*Math.max(0,m-d),o=Fh(n)+Fh(r),e<a?(a=e,f=h,u=o<u?o:u):e===a&&o<u&&(u=o,f=h);return f},_chooseSplitAxis:function(t,i,s){var h=t.leaf?this.compareMinX:Lh,n=t.leaf?this.compareMinY:Ih;this._allDistMargin(t,i,s,h)<this._allDistMargin(t,i,s,n)&&t.children.sort(h)},_allDistMargin:function(t,i,s,h){t.children.sort(h);var n,r,e=this.toBBox,o=Th(t,0,i,e),a=Th(t,s-i,s,e),u=Dh(o)+Dh(a);for(n=i;n<s-i;n++)r=t.children[n],Oh(o,t.leaf?e(r):r),u+=Dh(o);for(n=s-i-1;n>=i;n--)r=t.children[n],Oh(a,t.leaf?e(r):r),u+=Dh(a);return u},_adjustParentBBoxes:function(t,i,s){for(var h=s;h>=0;h--)Oh(i[h],t)},_condense:function(t){for(var i,s=t.length-1;s>=0;s--)0===t[s].children.length?s>0?(i=t[s-1].children).splice(i.indexOf(t[s]),1):this.clear():kh(t[s],this.toBBox)},_initFormat:function(t){var i=["return a"," - b",";"];this.compareMinX=new Function("a","b",i.join(t[0])),this.compareMinY=new Function("a","b",i.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var Uh=function(){};Uh.prototype.getReplay=function(){},Uh.prototype.isEmpty=function(){};var Xh={lineString:function(t,i,s,h){var n,r=t[i],e=t[i+1],o=0;for(n=i+h;n<s;n+=h){var a=t[n],u=t[n+1];o+=Math.sqrt((a-r)*(a-r)+(u-e)*(u-e)),r=a,e=u}return o},linearRing:function(t,i,s,h){var n=Xh.lineString(t,i,s,h),r=t[s-h]-t[i],e=t[s-h+1]-t[i+1];return n+Math.sqrt(r*r+e*e)}},qh=function(t,i,s,h,n,r,e,o){for(var a,u,f=[],c=t[i]>t[s-h],l=n.length,v=t[i],d=t[i+1],M=t[i+=h],m=t[i+1],p=0,g=Math.sqrt(Math.pow(M-v,2)+Math.pow(m-d,2)),_="",w=0,y=0;y<l;++y){var b=n.charAt(c?l-y-1:y),x=r(_=c?b+_:_+b)-w;w+=x;for(var E=e+x/2;i<s-h&&p+g<E;)v=M,d=m,M=t[i+=h],m=t[i+1],p+=g,g=Math.sqrt(Math.pow(M-v,2)+Math.pow(m-d,2));var S=E-p,C=Math.atan2(m-d,M-v);if(c&&(C+=C>0?-Math.PI:Math.PI),void 0!==u){var A=C-u;if(A+=A>Math.PI?-2*Math.PI:A<-Math.PI?2*Math.PI:0,Math.abs(A)>o)return null}var P=S/g,R=_i.lerp(v,M,P),N=_i.lerp(d,m,P);u==C?(c&&(a[0]=R,a[1]=N,a[2]=x/2),a[4]=_):(w=x,a=[R,N,x/2,C,_=b],c?f.unshift(a):f.push(a),u=C),e+=x}return f},Yh={ORDER:["Polygon","Circle","LineString","Image","Text","Default"],TEXT_ALIGN:{}};Yh.TEXT_ALIGN.left=0,Yh.TEXT_ALIGN.end=0,Yh.TEXT_ALIGN.center=.5,Yh.TEXT_ALIGN.right=1,Yh.TEXT_ALIGN.start=1,Yh.TEXT_ALIGN.top=0,Yh.TEXT_ALIGN.middle=.5,Yh.TEXT_ALIGN.hanging=.2,Yh.TEXT_ALIGN.alphabetic=.8,Yh.TEXT_ALIGN.ideographic=.8,Yh.TEXT_ALIGN.bottom=1;var Bh=function(t,i,s,h,n,r){mh.call(this),this.declutterTree=r,this.tmpExtent_=bi.createEmpty(),this.tolerance=t,this.maxExtent=i,this.overlaps=n,this.pixelRatio=h,this.maxLineWidth=0,this.resolution=s,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.coordinateCache_={},this.renderedTransform_=Ii.create(),this.hitDetectionInstructions=[],this.pixelCoordinates_=null,this.state={},this.viewRotation_=0,this.tmpLocalTransform_=Ii.create(),this.resetTransform_=Ii.create()};ui.inherits(Bh,mh),Bh.prototype.replayTextBackground_=function(t,i,s,h,n,r,e){t.beginPath(),t.moveTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,h),t.lineTo.apply(t,n),t.lineTo.apply(t,i),r&&(this.fillOrigin_=r[2],this.fill_(t)),e&&(this.setStrokeStyle_(t,e),t.stroke())},Bh.prototype.replayImage_=function(t,i,s,h,n,r,e,o,a,u,f,c,l,v,d,M,m,p){var g=m||p,_=this.tmpLocalTransform_;i-=n*=l,s-=r*=l,v&&(i=Math.round(i),s=Math.round(s));var w,y,b,x,E=d+u>h.width?h.width-u:d,S=o+f>h.height?h.height-f:o,C=this.tmpExtent_,A=M[3]+E*l+M[1],P=M[0]+S*l+M[2],R=i-M[3],N=s-M[0];(g||0!==c)&&(w=[R,N],y=[R+A,N],b=[R+A,N+P],x=[R,N+P]);var z=null;if(0!==c){var k=i+n,T=s+r;z=Ii.compose(_,k,T,1,1,c,-k,-T),bi.createOrUpdateEmpty(C),bi.extendCoordinate(C,Ii.apply(_,w)),bi.extendCoordinate(C,Ii.apply(_,y)),bi.extendCoordinate(C,Ii.apply(_,b)),bi.extendCoordinate(C,Ii.apply(_,x))}else bi.createOrUpdate(R,N,R+A,N+P,C);var O=t.canvas,L=C[0]<=O.width&&C[2]>=0&&C[1]<=O.height&&C[3]>=0;if(e){if(!L&&1==e[4])return;bi.extend(e,C);var I=L?[t,z?z.slice(0):null,a,h,u,f,E,S,i,s,l]:null;I&&g&&I.push(m,p,w,y,b,x),e.push(I)}else L&&(g&&this.replayTextBackground_(t,w,y,b,x,m,p),vh.drawImage(t,z,a,h,u,f,E,S,i,s,l))},Bh.prototype.applyPixelRatio=function(t){var i=this.pixelRatio;return 1==i?t:t.map((function(t){return t*i}))},Bh.prototype.appendFlatCoordinates=function(t,i,s,h,n,r){var e=this.coordinates.length,o=this.getBufferedMaxExtent();r&&(i+=h);var a,u,f,c=[t[i],t[i+1]],l=[NaN,NaN],v=!0;for(a=i+h;a<s;a+=h)l[0]=t[a],l[1]=t[a+1],(f=bi.coordinateRelationship(o,l))!==u?(v&&(this.coordinates[e++]=c[0],this.coordinates[e++]=c[1]),this.coordinates[e++]=l[0],this.coordinates[e++]=l[1],v=!1):1===f?(this.coordinates[e++]=l[0],this.coordinates[e++]=l[1],v=!1):v=!0,c[0]=l[0],c[1]=l[1],u=f;return(n&&v||a===i+h)&&(this.coordinates[e++]=c[0],this.coordinates[e++]=c[1]),e},Bh.prototype.drawCustomCoordinates_=function(t,i,s,h,n){for(var r=0,e=s.length;r<e;++r){var o=s[r],a=this.appendFlatCoordinates(t,i,o,h,!1,!1);n.push(a),i=o}return i},Bh.prototype.drawCustom=function(t,i,s){this.beginGeometry(t,i);var h,n,r,e,o,a=t.getType(),u=t.getStride(),f=this.coordinates.length;if("MultiPolygon"==a){h=(t=t).getOrientedFlatCoordinates(),e=[];var c=t.getEndss();o=0;for(var l=0,v=c.length;l<v;++l){var d=[];o=this.drawCustomCoordinates_(h,o,c[l],u,d),e.push(d)}this.instructions.push([4,f,e,t,s,ji.coordinatesss])}else"Polygon"==a||"MultiLineString"==a?(r=[],h="Polygon"==a?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),o=this.drawCustomCoordinates_(h,0,t.getEnds(),u,r),this.instructions.push([4,f,r,t,s,ji.coordinatess])):"LineString"==a||"MultiPoint"==a?(h=t.getFlatCoordinates(),n=this.appendFlatCoordinates(h,0,h.length,u,!1,!1),this.instructions.push([4,f,n,t,s,ji.coordinates])):"Point"==a&&(h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),this.instructions.push([4,f,n=this.coordinates.length,t,s]));this.endGeometry(t,i)},Bh.prototype.beginGeometry=function(t,i){this.beginGeometryInstruction1_=[0,i,0],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,i,0],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},Bh.prototype.fill_=function(t){if(this.fillOrigin_){var i=Ii.apply(this.renderedTransform_,this.fillOrigin_.slice());t.translate(i[0],i[1]),t.rotate(this.viewRotation_)}t.fill(),this.fillOrigin_&&t.setTransform.apply(t,vh.resetTransform_)},Bh.prototype.setStrokeStyle_=function(t,i){t.strokeStyle=i[1],t.lineWidth=i[2],t.lineCap=i[3],t.lineJoin=i[4],t.miterLimit=i[5],ts.CANVAS_LINE_DASH&&(t.lineDashOffset=i[7],t.setLineDash(i[6]))},Bh.prototype.renderDeclutter_=function(t,i){if(t&&t.length>5){var s=t[4];if(1==s||s==t.length-5){var h={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:i};if(!this.declutterTree.collides(h)){this.declutterTree.insert(h);for(var n=vh.drawImage,r=5,e=t.length;r<e;++r){var o=t[r];o&&(o.length>11&&this.replayTextBackground_(o[0],o[13],o[14],o[15],o[16],o[11],o[12]),n.apply(void 0,o))}}t.length=5,bi.createOrUpdateEmpty(t)}}},Bh.prototype.replay_=function(t,i,s,h,n,r){var e;this.pixelCoordinates_&&yi.equals(i,this.renderedTransform_)?e=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),e=Ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Ii.setFromArray(this.renderedTransform_,i));for(var o,a,u,f,c,l,v,d,M,m=!fi.isEmpty(s),p=0,g=h.length,_=0,w=0,y=0,b=null,x=null,E=this.coordinateCache_,S=this.viewRotation_,C={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:S},A=this.instructions!=h||this.overlaps?0:200;p<g;){var P,R,N,z=h[p];switch(z[0]){case 0:P=z[1],m&&s[ui.getUid(P).toString()]||!P.getGeometry()?p=z[2]:void 0===r||bi.intersects(r,P.getGeometry().getExtent())?++p:p=z[2]+1;break;case 1:w>A&&(this.fill_(t),w=0),y>A&&(t.stroke(),y=0),w||y||(t.beginPath(),f=c=NaN),++p;break;case 2:var k=e[_=z[1]],T=e[_+1],O=e[_+2]-k,L=e[_+3]-T,I=Math.sqrt(O*O+L*L);t.moveTo(k+I,T),t.arc(k,T,I,0,2*Math.PI,!0),++p;break;case 3:t.closePath(),++p;break;case 4:_=z[1],o=z[2];var F=z[4],D=6==z.length?z[5]:void 0;C.geometry=z[3],C.feature=P,p in E||(E[p]=[]);var G=E[p];D?D(e,_,o,2,G):(G[0]=e[_],G[1]=e[_+1],G.length=2),F(G,C),++p;break;case 6:_=z[1],o=z[2],M=z[3],a=z[4],u=z[5],d=n?null:z[6];var W,V,j,U=z[7],X=z[8],q=z[9],Y=z[10],B=z[12],H=z[13],J=z[14],Z=z[15];for(z.length>16?(W=z[16],V=z[17],j=z[18]):(W=vh.defaultPadding,V=j=!1),z[11]&&(B+=S);_<o;_+=2)this.replayImage_(t,e[_],e[_+1],M,a,u,d,U,X,q,Y,B,H,J,Z,W,V?b:null,j?x:null);this.renderDeclutter_(d,P),++p;break;case 5:var K=z[1],Q=z[2],$=z[3];d=n?null:z[4];var tt=z[5],it=z[6],st=z[7],ht=z[8],nt=z[9],rt=z[10],et=z[11],ot=z[12],at=z[13],ut=z[14],ft=Xh.lineString(e,K,Q,2),ct=ht(ot);if(tt||ct<=ft){var lt=qh(e,K,Q,2,ot,ht,(ft-ct)*Yh.TEXT_ALIGN[this.textStates[at].textAlign],st);if(lt){var vt,dt,Mt,mt;if(rt)for(vt=0,dt=lt.length;vt<dt;++vt)Mt=this.getImage((mt=lt[vt])[4],at,"",rt),this.replayImage_(t,mt[0],mt[1],Mt,a=mt[2]+et,u=$*Mt.height+2*(.5-$)*et-nt,d,Mt.height,1,0,0,mt[3],ut,!1,Mt.width,vh.defaultPadding,null,null);if(it)for(vt=0,dt=lt.length;vt<dt;++vt)Mt=this.getImage((mt=lt[vt])[4],at,it,""),this.replayImage_(t,mt[0],mt[1],Mt,a=mt[2],u=$*Mt.height-nt,d,Mt.height,1,0,0,mt[3],ut,!1,Mt.width,vh.defaultPadding,null,null)}}this.renderDeclutter_(d,P),++p;break;case 7:if(void 0!==n){var pt=n(P=z[1]);if(pt)return pt}++p;break;case 8:A?w++:this.fill_(t),++p;break;case 9:for(o=z[2],v=(N=e[(_=z[1])+1])+.5|0,(l=(R=e[_])+.5|0)===f&&v===c||(t.moveTo(R,N),f=l,c=v),_+=2;_<o;_+=2)l=(R=e[_])+.5|0,v=(N=e[_+1])+.5|0,_!=o-2&&l===f&&v===c||(t.lineTo(R,N),f=l,c=v);++p;break;case 10:b=z,this.fillOrigin_=z[2],w&&(this.fill_(t),w=0,y&&(t.stroke(),y=0)),t.fillStyle=z[1],++p;break;case 11:x=z,y&&(t.stroke(),y=0),this.setStrokeStyle_(t,z),++p;break;case 12:A?y++:t.stroke(),++p;break;default:++p}}w&&this.fill_(t),y&&t.stroke()},Bh.prototype.replay=function(t,i,s,h){this.viewRotation_=s,this.replay_(t,i,h,this.instructions,void 0,void 0)},Bh.prototype.replayHitDetection=function(t,i,s,h,n,r){return this.viewRotation_=s,this.replay_(t,i,h,this.hitDetectionInstructions,n,r)},Bh.prototype.reverseHitDetectionInstructions=function(){var t,i=this.hitDetectionInstructions;i.reverse();var s,h,n=i.length,r=-1;for(t=0;t<n;++t)7==(h=(s=i[t])[0])?r=t:0==h&&(s[2]=t,yi.reverseSubArray(this.hitDetectionInstructions,r,t),r=-1)},Bh.prototype.setFillStrokeStyle=function(t,i){var s=this.state;if(t){var h=t.getColor();s.fillStyle=Mh.asColorLike(h||vh.defaultFillStyle)}else s.fillStyle=void 0;if(i){var n=i.getColor();s.strokeStyle=Mh.asColorLike(n||vh.defaultStrokeStyle);var r=i.getLineCap();s.lineCap=void 0!==r?r:vh.defaultLineCap;var e=i.getLineDash();s.lineDash=e?e.slice():vh.defaultLineDash;var o=i.getLineDashOffset();s.lineDashOffset=o||vh.defaultLineDashOffset;var a=i.getLineJoin();s.lineJoin=void 0!==a?a:vh.defaultLineJoin;var u=i.getWidth();s.lineWidth=void 0!==u?u:vh.defaultLineWidth;var f=i.getMiterLimit();s.miterLimit=void 0!==f?f:vh.defaultMiterLimit,s.lineWidth>this.maxLineWidth&&(this.maxLineWidth=s.lineWidth,this.bufferedMaxExtent_=null)}else s.strokeStyle=void 0,s.lineCap=void 0,s.lineDash=null,s.lineDashOffset=void 0,s.lineJoin=void 0,s.lineWidth=void 0,s.miterLimit=void 0},Bh.prototype.applyFill=function(t,i){var s=t.fillStyle,h=[10,s];if("string"!=typeof s){var n=i.getExtent();h.push([n[0],n[3]])}this.instructions.push(h)},Bh.prototype.applyStroke=function(t){this.instructions.push([11,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio])},Bh.prototype.updateFillStyle=function(t,i,s){var h=t.fillStyle;"string"==typeof h&&t.currentFillStyle==h||(i.call(this,t,s),t.currentFillStyle=h)},Bh.prototype.updateStrokeStyle=function(t,i){var s=t.strokeStyle,h=t.lineCap,n=t.lineDash,r=t.lineDashOffset,e=t.lineJoin,o=t.lineWidth,a=t.miterLimit;(t.currentStrokeStyle!=s||t.currentLineCap!=h||n!=t.currentLineDash&&!yi.equals(t.currentLineDash,n)||t.currentLineDashOffset!=r||t.currentLineJoin!=e||t.currentLineWidth!=o||t.currentMiterLimit!=a)&&(i.call(this,t),t.currentStrokeStyle=s,t.currentLineCap=h,t.currentLineDash=n,t.currentLineDashOffset=r,t.currentLineJoin=e,t.currentLineWidth=o,t.currentMiterLimit=a)},Bh.prototype.endGeometry=function(t,i){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var s=[7,i];this.instructions.push(s),this.hitDetectionInstructions.push(s)},Bh.prototype.finish=ui.nullFunction,Bh.prototype.getBufferedMaxExtent=function(){return this.bufferedMaxExtent_||(this.bufferedMaxExtent_=bi.clone(this.maxExtent),this.maxLineWidth>0&&bi.buffer(this.bufferedMaxExtent_,this.resolution*(this.maxLineWidth+1)/2,this.bufferedMaxExtent_)),this.bufferedMaxExtent_};var Hh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r),this.declutterGroup_=null,this.hitDetectionImage_=null,this.image_=null,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.snapToPixel_=void 0,this.width_=void 0};ui.inherits(Hh,Bh),Hh.prototype.drawCoordinates_=function(t,i,s,h){return this.appendFlatCoordinates(t,i,s,h,!1,!1)},Hh.prototype.drawPoint=function(t,i){if(this.image_){this.beginGeometry(t,i);var s=t.getFlatCoordinates(),h=t.getStride(),n=this.coordinates.length,r=this.drawCoordinates_(s,0,s.length,h);this.instructions.push([6,n,r,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]),this.hitDetectionInstructions.push([6,n,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]),this.endGeometry(t,i)}},Hh.prototype.drawMultiPoint=function(t,i){if(this.image_){this.beginGeometry(t,i);var s=t.getFlatCoordinates(),h=t.getStride(),n=this.coordinates.length,r=this.drawCoordinates_(s,0,s.length,h);this.instructions.push([6,n,r,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]),this.hitDetectionInstructions.push([6,n,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]),this.endGeometry(t,i)}},Hh.prototype.finish=function(){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.snapToPixel_=void 0,this.width_=void 0},Hh.prototype.setImageStyle=function(t,i){var s=t.getAnchor(),h=t.getSize(),n=t.getHitDetectionImage(1),r=t.getImage(1),e=t.getOrigin();this.anchorX_=s[0],this.anchorY_=s[1],this.declutterGroup_=i,this.hitDetectionImage_=n,this.image_=r,this.height_=h[1],this.opacity_=t.getOpacity(),this.originX_=e[0],this.originY_=e[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.snapToPixel_=t.getSnapToPixel(),this.width_=h[0]};var Jh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r)};ui.inherits(Jh,Bh),Jh.prototype.drawFlatCoordinates_=function(t,i,s,h){var n=[9,this.coordinates.length,this.appendFlatCoordinates(t,i,s,h,!1,!1)];return this.instructions.push(n),this.hitDetectionInstructions.push(n),s},Jh.prototype.drawLineString=function(t,i){var s=this.state;if(void 0!==s.strokeStyle&&void 0!==s.lineWidth){this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,i),this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset],[1]);var h=t.getFlatCoordinates(),n=t.getStride();this.drawFlatCoordinates_(h,0,h.length,n),this.hitDetectionInstructions.push([12]),this.endGeometry(t,i)}},Jh.prototype.drawMultiLineString=function(t,i){var s=this.state;if(void 0!==s.strokeStyle&&void 0!==s.lineWidth){this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,i),this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset],[1]);var h,n,r=t.getEnds(),e=t.getFlatCoordinates(),o=t.getStride(),a=0;for(h=0,n=r.length;h<n;++h)a=this.drawFlatCoordinates_(e,a,r[h],o);this.hitDetectionInstructions.push([12]),this.endGeometry(t,i)}},Jh.prototype.finish=function(){var t=this.state;null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push([12]),this.reverseHitDetectionInstructions(),this.state=null},Jh.prototype.applyStroke=function(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push([12]),t.lastStroke=this.coordinates.length),t.lastStroke=0,Bh.prototype.applyStroke.call(this,t),this.instructions.push([1])};var Zh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r)};ui.inherits(Zh,Bh),Zh.prototype.drawFlatCoordinatess_=function(t,i,s,h){var n=this.state,r=void 0!==n.fillStyle,e=null!=n.strokeStyle,o=s.length,a=[1];this.instructions.push(a),this.hitDetectionInstructions.push(a);for(var u=0;u<o;++u){var f=s[u],c=[9,this.coordinates.length,this.appendFlatCoordinates(t,i,f,h,!0,!e)];if(this.instructions.push(c),this.hitDetectionInstructions.push(c),e){var l=[3];this.instructions.push(l),this.hitDetectionInstructions.push(l)}i=f}var v=[8];if(this.hitDetectionInstructions.push(v),r&&this.instructions.push(v),e){var d=[12];this.instructions.push(d),this.hitDetectionInstructions.push(d)}return i},Zh.prototype.drawCircle=function(t,i){var s=this.state;if(void 0!==s.fillStyle||void 0!==s.strokeStyle){this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length;this.appendFlatCoordinates(h,0,h.length,n,!1,!1);var e=[1],o=[2,r];this.instructions.push(e,o),this.hitDetectionInstructions.push(e,o);var a=[8];if(this.hitDetectionInstructions.push(a),void 0!==s.fillStyle&&this.instructions.push(a),void 0!==s.strokeStyle){var u=[12];this.instructions.push(u),this.hitDetectionInstructions.push(u)}this.endGeometry(t,i)}},Zh.prototype.drawPolygon=function(t,i){var s=this.state;this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h=t.getEnds(),n=t.getOrientedFlatCoordinates(),r=t.getStride();this.drawFlatCoordinatess_(n,0,h,r),this.endGeometry(t,i)},Zh.prototype.drawMultiPolygon=function(t,i){var s=this.state;if(void 0!==s.fillStyle||void 0!==s.strokeStyle){this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h,n,r=t.getEndss(),e=t.getOrientedFlatCoordinates(),o=t.getStride(),a=0;for(h=0,n=r.length;h<n;++h)a=this.drawFlatCoordinatess_(e,a,r[h],o);this.endGeometry(t,i)}},Zh.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var t=this.tolerance;if(0!==t){var i,s,h=this.coordinates;for(i=0,s=h.length;i<s;++i)h[i]=Ui.snap(h[i],t)}},Zh.prototype.setFillStrokeStyles_=function(t){var i=this.state;void 0!==i.fillStyle&&this.updateFillStyle(i,this.applyFill,t),void 0!==i.strokeStyle&&this.updateStrokeStyle(i,this.applyStroke)};var Kh=function(t,i,s,h,n){var r,e,o,a,u,f,c,l,v,d=s,M=s,m=0,p=0,g=s;for(r=s;r<h;r+=n){var _=i[r],w=i[r+1];void 0!==a&&(l=_-a,v=w-u,o=Math.sqrt(l*l+v*v),void 0!==f&&(p+=e,Math.acos((f*l+c*v)/(e*o))>t&&(p>m&&(m=p,d=g,M=r),p=0,g=r-n)),e=o,f=l,c=v),a=_,u=w}return(p+=o)>m?[g,r]:[d,M]},Qh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.widths_={},vh.labelCache.prune()};ui.inherits(Qh,Bh),Qh.measureTextWidths=function(t,i,s){var h,n,r=i.length,e=0;for(n=0;n<r;++n)h=vh.measureTextWidth(t,i[n]),e=Math.max(e,h),s.push(h);return e},Qh.prototype.drawText=function(t,i){var s=this.textState_;if(""!==this.text_&&s&&(this.textFillState_||this.textStrokeState_)){var h,n,r=this.coordinates.length,e=t.getType(),o=null,a=2,u=2;if("line"===s.placement){if(!bi.intersects(this.getBufferedMaxExtent(),t.getExtent()))return;var f;if(o=t.getFlatCoordinates(),u=t.getStride(),"LineString"==e)f=[o.length];else if("MultiLineString"==e)f=t.getEnds();else if("Polygon"==e)f=t.getEnds().slice(0,1);else if("MultiPolygon"==e){var c=t.getEndss();for(f=[],h=0,n=c.length;h<n;++h)f.push(c[h][0])}this.beginGeometry(t,i);for(var l,v=s.textAlign,d=0,M=0,m=f.length;M<m;++M){if(null==v){var p=Kh(s.maxAngle,o,d,f[M],u);d=p[0],l=p[1]}else l=f[M];for(h=d;h<l;h+=u)this.coordinates.push(o[h],o[h+1]);d=f[M],this.drawChars_(r,a=this.coordinates.length,this.declutterGroup_),r=a}this.endGeometry(t,i)}else{var g=this.getImage(this.text_,this.textKey_,this.fillKey_,this.strokeKey_),_=g.width/this.pixelRatio;switch(e){case"Point":case"MultiPoint":a=(o=t.getFlatCoordinates()).length;break;case"LineString":o=t.getFlatMidpoint();break;case"Circle":o=t.getCenter();break;case"MultiLineString":a=(o=t.getFlatMidpoints()).length;break;case"Polygon":if(o=t.getFlatInteriorPoint(),!s.overflow&&o[2]/this.resolution<_)return;u=3;break;case"MultiPolygon":var w=t.getFlatInteriorPoints();for(o=[],h=0,n=w.length;h<n;h+=3)(s.overflow||w[h+2]/this.resolution>=_)&&o.push(w[h],w[h+1]);if(0==(a=o.length))return}a=this.appendFlatCoordinates(o,0,a,u,!1,!1),this.beginGeometry(t,i),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),this.updateFillStyle(this.state,this.applyFill,t),this.updateStrokeStyle(this.state,this.applyStroke)),this.drawTextImage_(g,r,a),this.endGeometry(t,i)}}},Qh.prototype.getImage=function(t,i,s,h){var n,r=h+i+t+s+this.pixelRatio,e=vh.labelCache;if(!e.containsKey(r)){var o=h?this.strokeStates[h]||this.textStrokeState_:null,a=s?this.fillStates[s]||this.textFillState_:null,u=this.textStates[i]||this.textState_,f=u.scale*this.pixelRatio,c=Yh.TEXT_ALIGN[u.textAlign||vh.defaultTextAlign],l=h&&o.lineWidth?o.lineWidth:0,v=t.split("\n"),d=v.length,M=[],m=Qh.measureTextWidths(u.font,v,M),p=vh.measureTextHeight(u.font),g=p*d,_=Cs(Math.ceil((m+l)*f),Math.ceil((g+l)*f));e.set(r,n=_.canvas),1!=f&&_.scale(f,f),_.font=u.font,h&&(_.strokeStyle=o.strokeStyle,_.lineWidth=l*(ts.SAFARI?f:1),_.lineCap=o.lineCap,_.lineJoin=o.lineJoin,_.miterLimit=o.miterLimit,ts.CANVAS_LINE_DASH&&o.lineDash.length&&(_.setLineDash(o.lineDash),_.lineDashOffset=o.lineDashOffset)),s&&(_.fillStyle=a.fillStyle),_.textBaseline="middle",_.textAlign="center";var w,y=.5-c,b=c*n.width/f+y*l;if(h)for(w=0;w<d;++w)_.strokeText(v[w],b+y*M[w],.5*(l+p)+w*p);if(s)for(w=0;w<d;++w)_.fillText(v[w],b+y*M[w],.5*(l+p)+w*p)}return e.get(r)},Qh.prototype.drawTextImage_=function(t,i,s){var h=this.textState_,n=this.textStrokeState_,r=this.pixelRatio,e=Yh.TEXT_ALIGN[h.textAlign||vh.defaultTextAlign],o=Yh.TEXT_ALIGN[h.textBaseline],a=n&&n.lineWidth?n.lineWidth:0,u=e*t.width/r+2*(.5-e)*a,f=o*t.height/r+2*(.5-o)*a;this.instructions.push([6,i,s,t,(u-this.textOffsetX_)*r,(f-this.textOffsetY_)*r,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1,!0,t.width,h.padding==vh.defaultPadding?vh.defaultPadding:h.padding.map((function(t){return t*r})),!!h.backgroundFill,!!h.backgroundStroke]),this.hitDetectionInstructions.push([6,i,s,t,(u-this.textOffsetX_)*r,(f-this.textOffsetY_)*r,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1/r,!0,t.width,h.padding,!!h.backgroundFill,!!h.backgroundStroke])},Qh.prototype.drawChars_=function(t,i,s){var h=this.textStrokeState_,n=this.textState_,r=this.textFillState_,e=this.strokeKey_;h&&(e in this.strokeStates||(this.strokeStates[e]={strokeStyle:h.strokeStyle,lineCap:h.lineCap,lineDashOffset:h.lineDashOffset,lineWidth:h.lineWidth,lineJoin:h.lineJoin,miterLimit:h.miterLimit,lineDash:h.lineDash}));var o=this.textKey_;this.textKey_ in this.textStates||(this.textStates[this.textKey_]={font:n.font,textAlign:n.textAlign||vh.defaultTextAlign,scale:n.scale});var a=this.fillKey_;r&&(a in this.fillStates||(this.fillStates[a]={fillStyle:r.fillStyle}));var u=this.pixelRatio,f=Yh.TEXT_ALIGN[n.textBaseline],c=this.textOffsetY_*u,l=this.text_,v=n.font,d=n.scale,M=h?h.lineWidth*d/2:0,m=this.widths_[v];m||(this.widths_[v]=m={}),this.instructions.push([5,t,i,f,s,n.overflow,a,n.maxAngle,function(t){var i=m[t];return i||(i=m[t]=vh.measureTextWidth(v,t)),i*d*u},c,e,M*u,l,o,1]),this.hitDetectionInstructions.push([5,t,i,f,s,n.overflow,a,n.maxAngle,function(t){var i=m[t];return i||(i=m[t]=vh.measureTextWidth(v,t)),i*d},c,e,M,l,o,1/u])},Qh.prototype.setTextStyle=function(t,i){var s,h,n;if(t){this.declutterGroup_=i;var r=t.getFill();r?((h=this.textFillState_)||(h=this.textFillState_={}),h.fillStyle=Mh.asColorLike(r.getColor()||vh.defaultFillStyle)):h=this.textFillState_=null;var e=t.getStroke();if(e){(n=this.textStrokeState_)||(n=this.textStrokeState_={});var o=e.getLineDash(),a=e.getLineDashOffset(),u=e.getWidth(),f=e.getMiterLimit();n.lineCap=e.getLineCap()||vh.defaultLineCap,n.lineDash=o?o.slice():vh.defaultLineDash,n.lineDashOffset=void 0===a?vh.defaultLineDashOffset:a,n.lineJoin=e.getLineJoin()||vh.defaultLineJoin,n.lineWidth=void 0===u?vh.defaultLineWidth:u,n.miterLimit=void 0===f?vh.defaultMiterLimit:f,n.strokeStyle=Mh.asColorLike(e.getColor()||vh.defaultStrokeStyle)}else n=this.textStrokeState_=null;s=this.textState_;var c=t.getFont()||vh.defaultFont;vh.checkFont(c);var l=t.getScale();s.overflow=t.getOverflow(),s.font=c,s.maxAngle=t.getMaxAngle(),s.placement=t.getPlacement(),s.textAlign=t.getTextAlign(),s.textBaseline=t.getTextBaseline()||vh.defaultTextBaseline,s.backgroundFill=t.getBackgroundFill(),s.backgroundStroke=t.getBackgroundStroke(),s.padding=t.getPadding()||vh.defaultPadding,s.scale=void 0===l?1:l;var v=t.getOffsetX(),d=t.getOffsetY(),M=t.getRotateWithView(),m=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===v?0:v,this.textOffsetY_=void 0===d?0:d,this.textRotateWithView_=void 0!==M&&M,this.textRotation_=void 0===m?0:m,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:ui.getUid(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=s.font+s.scale+(s.textAlign||"?"),this.fillKey_=h?"string"==typeof h.fillStyle?h.fillStyle:"|"+ui.getUid(h.fillStyle):""}else this.text_=""};var $h=function(t,i,s,h,n,r,e){Uh.call(this),this.declutterTree_=r,this.declutterGroup_=null,this.tolerance_=t,this.maxExtent_=i,this.overlaps_=n,this.pixelRatio_=h,this.resolution_=s,this.renderBuffer_=e,this.replaysByZIndex_={},this.hitDetectionContext_=Cs(1,1),this.hitDetectionTransform_=Ii.create()};ui.inherits($h,Uh),$h.circleArrayCache_={0:[[!0]]},$h.fillCircleArrayRowToMiddle_=function(t,i,s){var h,n=Math.floor(t.length/2);if(i>=n)for(h=n;h<i;h++)t[h][s]=!0;else if(i<n)for(h=i+1;h<n;h++)t[h][s]=!0},$h.getCircleArray_=function(t){if(void 0!==$h.circleArrayCache_[t])return $h.circleArrayCache_[t];for(var i=2*t+1,s=new Array(i),h=0;h<i;h++)s[h]=new Array(i);for(var n=t,r=0,e=0;n>=r;)$h.fillCircleArrayRowToMiddle_(s,t+n,t+r),$h.fillCircleArrayRowToMiddle_(s,t+r,t+n),$h.fillCircleArrayRowToMiddle_(s,t-r,t+n),$h.fillCircleArrayRowToMiddle_(s,t-n,t+r),$h.fillCircleArrayRowToMiddle_(s,t-n,t-r),$h.fillCircleArrayRowToMiddle_(s,t-r,t-n),$h.fillCircleArrayRowToMiddle_(s,t+r,t-n),$h.fillCircleArrayRowToMiddle_(s,t+n,t-r),2*((e+=1+2*++r)-n)+1>0&&(e+=1-2*(n-=1));return $h.circleArrayCache_[t]=s,s},$h.replayDeclutter=function(t,i,s){for(var h=Object.keys(t).map(Number).sort(yi.numberSafeCompareFunction),n={},r=0,e=h.length;r<e;++r)for(var o=t[h[r].toString()],a=0,u=o.length;a<u;){var f=o[a++],c=o[a++];f.replay(i,c,s,n)}},$h.prototype.addDeclutter=function(t){var i=null;return this.declutterTree_&&(t?(i=this.declutterGroup_)[4]++:(i=this.declutterGroup_=bi.createEmpty()).push(1)),i},$h.prototype.clip=function(t,i){var s=this.getClipCoords(i);t.beginPath(),t.moveTo(s[0],s[1]),t.lineTo(s[2],s[3]),t.lineTo(s[4],s[5]),t.lineTo(s[6],s[7]),t.clip()},$h.prototype.hasReplays=function(t){for(var i in this.replaysByZIndex_)for(var s=this.replaysByZIndex_[i],h=0,n=t.length;h<n;++h)if(t[h]in s)return!0;return!1},$h.prototype.finish=function(){var t;for(t in this.replaysByZIndex_){var i,s=this.replaysByZIndex_[t];for(i in s)s[i].finish()}},$h.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o,a=2*(h=Math.round(h))+1,u=Ii.compose(this.hitDetectionTransform_,h+.5,h+.5,1/i,-1/i,-s,-t[0],-t[1]),f=this.hitDetectionContext_;f.canvas.width!==a||f.canvas.height!==a?(f.canvas.width=a,f.canvas.height=a):f.clearRect(0,0,a,a),void 0!==this.renderBuffer_&&(o=bi.createEmpty(),bi.extendCoordinate(o,t),bi.buffer(o,i*(this.renderBuffer_+h),o));var c,l,v=$h.getCircleArray_(h);function d(t){for(var i=f.getImageData(0,0,a,a).data,s=0;s<a;s++)for(var h=0;h<a;h++){var n;if(v[s][h]&&i[4*(h*a+s)+3]>0)return(!c||"Image"!=l&&"Text"!=l||-1!==c.indexOf(t))&&(n=r(t)),n||void f.clearRect(0,0,a,a)}}this.declutterTree_&&(c=this.declutterTree_.all().map((function(t){return t.value})));var M,m,p,g,_,w=Object.keys(this.replaysByZIndex_).map(Number);for(w.sort(yi.numberSafeCompareFunction),M=w.length-1;M>=0;--M){var y=w[M].toString();for(p=this.replaysByZIndex_[y],m=Yh.ORDER.length-1;m>=0;--m)if(void 0!==(g=p[l=Yh.ORDER[m]]))if(!e||"Image"!=l&&"Text"!=l){if(_=g.replayHitDetection(f,u,s,n,d,o))return _}else{var b=e[y];b?b.push(g,u.slice(0)):e[y]=[g,u.slice(0)]}}},$h.prototype.getClipCoords=function(t){var i=this.maxExtent_,s=i[0],h=i[1],n=i[2],r=i[3],e=[s,h,s,r,n,r,n,h];return Ei(e,0,8,2,t,e),e},$h.prototype.getReplay=function(t,i){var s=void 0!==t?t.toString():"0",h=this.replaysByZIndex_[s];void 0===h&&(this.replaysByZIndex_[s]=h={});var n=h[i];return void 0===n&&(n=new(0,$h.BATCH_CONSTRUCTORS_[i])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_,this.overlaps_,this.declutterTree_),h[i]=n),n},$h.prototype.getReplays=function(){return this.replaysByZIndex_},$h.prototype.isEmpty=function(){return fi.isEmpty(this.replaysByZIndex_)},$h.prototype.replay=function(t,i,s,h,n,r){var e=Object.keys(this.replaysByZIndex_).map(Number);e.sort(yi.numberSafeCompareFunction),t.save(),this.clip(t,i);var o,a,u,f,c,l,v=n||Yh.ORDER;for(o=0,a=e.length;o<a;++o){var d=e[o].toString();for(c=this.replaysByZIndex_[d],u=0,f=v.length;u<f;++u){var M=v[u];if(void 0!==(l=c[M]))if(!r||"Image"!=M&&"Text"!=M)l.replay(t,i,s,h);else{var m=r[d];m?m.push(l,i.slice(0)):r[d]=[l,i.slice(0)]}}}t.restore()},$h.BATCH_CONSTRUCTORS_={Circle:Zh,Default:Bh,Image:Hh,LineString:Jh,Polygon:Zh,Text:Qh};var tn={defaultOrder:function(t,i){return ui.getUid(t)-ui.getUid(i)},getSquaredTolerance:function(t,i){var s=tn.getTolerance(t,i);return s*s},getTolerance:function(t,i){return ui.SIMPLIFY_TOLERANCE*t/i},renderCircleGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(n||r){var e=t.getReplay(s.getZIndex(),"Circle");e.setFillStrokeStyle(n,r),e.drawCircle(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}},renderFeature:function(t,i,s,h,n,r){var e,o,a=!1;return(e=s.getImage())&&(2==(o=e.getImageState())||3==o?e.unlistenImageChange(n,r):(0==o&&e.load(),o=e.getImageState(),e.listenImageChange(n,r),a=!0)),tn.renderFeature_(t,i,s,h),a},renderFeature_:function(t,i,s,h){var n=s.getGeometryFunction()(i);if(n){var r=n.getSimplifiedGeometry(h);s.getRenderer()?tn.renderGeometry_(t,r,s,i):(0,tn.GEOMETRY_RENDERERS_[r.getType()])(t,r,s,i)}},renderGeometry_:function(t,i,s,h){if("GeometryCollection"!=i.getType())t.getReplay(s.getZIndex(),"Default").drawCustom(i,h,s.getRenderer());else for(var n=i.getGeometries(),r=0,e=n.length;r<e;++r)tn.renderGeometry_(t,n[r],s,h)},renderGeometryCollectionGeometry_:function(t,i,s,h){var n,r,e=i.getGeometriesArray();for(n=0,r=e.length;n<r;++n)(0,tn.GEOMETRY_RENDERERS_[e[n].getType()])(t,e[n],s,h)},renderLineStringGeometry_:function(t,i,s,h){var n=s.getStroke();if(n){var r=t.getReplay(s.getZIndex(),"LineString");r.setFillStrokeStyle(null,n),r.drawLineString(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!1)),o.drawText(i,h)}},renderMultiLineStringGeometry_:function(t,i,s,h){var n=s.getStroke();if(n){var r=t.getReplay(s.getZIndex(),"LineString");r.setFillStrokeStyle(null,n),r.drawMultiLineString(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!1)),o.drawText(i,h)}},renderMultiPolygonGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(r||n){var e=t.getReplay(s.getZIndex(),"Polygon");e.setFillStrokeStyle(n,r),e.drawMultiPolygon(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}},renderPointGeometry_:function(t,i,s,h){var n=s.getImage();if(n){if(2!=n.getImageState())return;var r=t.getReplay(s.getZIndex(),"Image");r.setImageStyle(n,t.addDeclutter(!1)),r.drawPoint(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!!n)),o.drawText(i,h)}},renderMultiPointGeometry_:function(t,i,s,h){var n=s.getImage();if(n){if(2!=n.getImageState())return;var r=t.getReplay(s.getZIndex(),"Image");r.setImageStyle(n,t.addDeclutter(!1)),r.drawMultiPoint(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!!n)),o.drawText(i,h)}},renderPolygonGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(n||r){var e=t.getReplay(s.getZIndex(),"Polygon");e.setFillStrokeStyle(n,r),e.drawPolygon(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}}};tn.GEOMETRY_RENDERERS_={Point:tn.renderPointGeometry_,LineString:tn.renderLineStringGeometry_,Polygon:tn.renderPolygonGeometry_,MultiPoint:tn.renderMultiPointGeometry_,MultiLineString:tn.renderMultiLineStringGeometry_,MultiPolygon:tn.renderMultiPolygonGeometry_,GeometryCollection:tn.renderGeometryCollectionGeometry_,Circle:tn.renderCircleGeometry_};var sn=function(t){_h.call(this,t),this.declutterTree_=t.getDeclutter()?Rh(9):null,this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bi.createEmpty(),this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.context=Cs(),ci.listen(vh.labelCache,"clear",this.handleFontsChanged_,this)};ui.inherits(sn,_h),sn.handles=function(t,i){return"canvas"===t&&"VECTOR"===i.getType()},sn.create=function(t,i){return new sn(i)},sn.prototype.disposeInternal=function(){ci.unlisten(vh.labelCache,"clear",this.handleFontsChanged_,this),_h.prototype.disposeInternal.call(this)},sn.prototype.composeFrame=function(t,i,s){var h=t.extent,n=t.pixelRatio,r=i.managed?t.skippedFeatureUids:{},e=t.viewState,o=e.projection,a=e.rotation,u=o.getExtent(),f=this.getLayer().getSource(),c=this.getTransform(t,0);this.preCompose(s,t,c);var l=i.extent,v=void 0!==l;v&&this.clip(s,t,l);var d=this.replayGroup_;if(d&&!d.isEmpty()){this.declutterTree_&&this.declutterTree_.clear();var M,m=this.getLayer(),p=0,g=0,_=1!==i.opacity,w=m.hasListener("render");if(_||w){var y=s.canvas.width,b=s.canvas.height;if(a){var x=Math.round(Math.sqrt(y*y+b*b));p=(x-y)/2,g=(x-b)/2,y=b=x}this.context.canvas.width=y,this.context.canvas.height=b,M=this.context}else M=s;var E=M.globalAlpha;_||(M.globalAlpha=i.opacity),M!=s&&M.translate(p,g);var S=t.size[0]*n,C=t.size[1]*n;if(vh.rotateAtOffset(M,-a,S/2,C/2),d.replay(M,c,a,r),f.getWrapX()&&o.canWrapX()&&!bi.containsExtent(u,h)){for(var A=h[0],P=bi.getWidth(u),R=0;A<u[0];)--R,c=this.getTransform(t,P*R),d.replay(M,c,a,r),A+=P;for(R=0,A=h[2];A>u[2];)++R,c=this.getTransform(t,P*R),d.replay(M,c,a,r),A-=P;c=this.getTransform(t,0)}if(vh.rotateAtOffset(M,a,S/2,C/2),M!=s){if(w&&this.dispatchRenderEvent(M,t,c),_){var N=s.globalAlpha;s.globalAlpha=i.opacity,s.drawImage(M.canvas,-p,-g),s.globalAlpha=N}else s.drawImage(M.canvas,-p,-g);M.translate(-p,-g)}_||(M.globalAlpha=E)}v&&s.restore(),this.postCompose(s,t,i,c)},sn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){if(this.replayGroup_){var r=i.viewState.resolution,e=i.viewState.rotation,o=this.getLayer(),a={};return this.replayGroup_.forEachFeatureAtCoordinate(t,r,e,s,{},(function(t){var i=ui.getUid(t).toString();if(!(i in a))return a[i]=!0,h.call(n,t,o)}),null)}},sn.prototype.handleFontsChanged_=function(){var t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()},sn.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},sn.prototype.prepareFrame=function(t){var i=this.getLayer(),s=i.getSource();this.updateLogos(t,s);var h=t.viewHints[0],n=t.viewHints[1],r=i.getUpdateWhileAnimating(),e=i.getUpdateWhileInteracting();if(!this.dirty_&&!r&&h||!e&&n)return!0;var o=t.extent,a=t.viewState,u=a.projection,f=a.resolution,c=t.pixelRatio,l=i.getRevision(),v=i.getRenderBuffer(),d=i.getRenderOrder();void 0===d&&(d=tn.defaultOrder);var M=bi.buffer(o,v*f),m=a.projection.getExtent();if(s.getWrapX()&&a.projection.canWrapX()&&!bi.containsExtent(m,t.extent)){var p=bi.getWidth(m),g=Math.max(bi.getWidth(M)/2,p);M[0]=m[0]-g,M[2]=m[2]+g}if(!this.dirty_&&this.renderedResolution_==f&&this.renderedRevision_==l&&this.renderedRenderOrder_==d&&bi.containsExtent(this.renderedExtent_,M))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var _=new $h(tn.getTolerance(f,c),M,f,c,s.getOverlaps(),this.declutterTree_,i.getRenderBuffer());s.loadFeatures(M,f,u);var w=function(t){var s,h=t.getStyleFunction();if(h?s=h.call(t,f):(h=i.getStyleFunction())&&(s=h(t,f)),s){var n=this.renderFeature(t,f,c,s,_);this.dirty_=this.dirty_||n}}.bind(this);if(d){var y=[];s.forEachFeatureInExtent(M,(function(t){y.push(t)}),this),y.sort(d);for(var b=0,x=y.length;b<x;++b)w(y[b])}else s.forEachFeatureInExtent(M,w,this);return _.finish(),this.renderedResolution_=f,this.renderedRevision_=l,this.renderedRenderOrder_=d,this.renderedExtent_=M,this.replayGroup_=_,this.replayGroupChanged=!0,!0},sn.prototype.renderFeature=function(t,i,s,h,n){if(!h)return!1;var r=!1;if(Array.isArray(h))for(var e=0,o=h.length;e<o;++e)r=tn.renderFeature(n,t,h[e],tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;else r=tn.renderFeature(n,t,h,tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this);return r};var hn=function(t){this.context=null,Ah.call(this,t),this.declutterTree_=t.getDeclutter()?Rh(9):null,this.dirty_=!1,this.tmpTransform_=Ii.create(),this.zDirection="vector"==t.getRenderMode()?1:0,ci.listen(vh.labelCache,"clear",this.handleFontsChanged_,this)};ui.inherits(hn,Ah),hn.handles=function(t,i){return"canvas"===t&&"VECTOR_TILE"===i.getType()},hn.create=function(t,i){return new hn(i)},hn.IMAGE_REPLAYS={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"]},hn.VECTOR_REPLAYS={image:["Default"],hybrid:["Image","Text","Default"],vector:Yh.ORDER},hn.prototype.disposeInternal=function(){ci.unlisten(vh.labelCache,"clear",this.handleFontsChanged_,this),Ah.prototype.disposeInternal.call(this)},hn.prototype.prepareFrame=function(t,i){var s=this.getLayer(),h=s.getRevision();if(this.renderedLayerRevision_!=h){this.renderedTiles.length=0;var n=s.getRenderMode();this.context||"vector"==n||(this.context=Cs()),this.context&&"vector"==n&&(this.context=null)}return this.renderedLayerRevision_=h,Ah.prototype.prepareFrame.apply(this,arguments)},hn.prototype.createReplayGroup_=function(t,i){var s=this.getLayer(),h=i.pixelRatio,n=i.viewState.projection,r=s.getRevision(),e=s.getRenderOrder()||null,o=t.getReplayState(s);if(o.dirty||o.renderedRevision!=r||o.renderedRenderOrder!=e){for(var a=s.getSource(),u=a.getTileGrid(),f=a.getTileGridForProjection(n),c=f.getResolution(t.tileCoord[0]),l=f.getTileCoordExtent(t.wrappedTileCoord),v=0,d=t.tileKeys.length;v<d;++v){var M=t.getTile(t.tileKeys[v]);if(3!=M.getState()){var m=u.getTileCoordExtent(M.tileCoord),p=bi.getIntersection(l,m),g=bi.equals(m,p)?null:bi.buffer(p,s.getRenderBuffer()*c),_=M.getProjection(),w=!1;Li.equivalent(n,_)||(w=!0,M.setProjection(n)),o.dirty=!1;var y,b=new $h(0,p,c,h,a.getOverlaps(),this.declutterTree_,s.getRenderBuffer()),x=tn.getSquaredTolerance(c,h),E=function(t){var i,h=t.getStyleFunction();if(h?i=h.call(t,c):(h=s.getStyleFunction())&&(i=h(t,c)),i){var n=this.renderFeature(t,x,i,b);this.dirty_=this.dirty_||n,o.dirty=o.dirty||n}},S=M.getFeatures();e&&e!==o.renderedRenderOrder&&S.sort(e);for(var C=0,A=S.length;C<A;++C)y=S[C],w&&(_.getUnits()==Pi.TILE_PIXELS&&(_.setWorldExtent(m),_.setExtent(M.getExtent())),y.getGeometry().transform(_,n)),g&&!bi.intersects(g,y.getGeometry().getExtent())||E.call(this,y);for(var P in b.finish(),b.getReplays());M.setReplayGroup(s,t.tileCoord.toString(),b)}}o.renderedRevision=r,o.renderedRenderOrder=e}},hn.prototype.drawTileImage=function(t,i,s,h,n,r,e,o,a){var u=t;this.createReplayGroup_(u,i),this.context&&(this.renderTileImage_(u,i,s),Ah.prototype.drawTileImage.apply(this,arguments))},hn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=i.viewState.resolution,e=i.viewState.rotation;s=null==s?0:s;var o,a,u,f,c,l,v,d=this.getLayer(),M={},m=this.renderedTiles,p=d.getSource().getTileGridForProjection(i.viewState.projection);for(u=0,f=m.length;u<f;++u)if(v=p.getTileCoordExtent((l=m[u]).wrappedTileCoord,this.tmpExtent),o=bi.buffer(v,s*r,o),bi.containsCoordinate(o,t))for(var g=0,_=l.tileKeys.length;g<_;++g){var w=l.getTile(l.tileKeys[g]);3!=w.getState()&&(c=w.getReplayGroup(d,l.tileCoord.toString()),a=a||c.forEachFeatureAtCoordinate(t,r,e,s,{},(function(t){var i=ui.getUid(t).toString();if(!(i in M))return M[i]=!0,h.call(n,t,d)}),null))}return a},hn.prototype.getReplayTransform_=function(t,i){var s=this.getLayer().getSource().getTileGrid(),h=t.tileCoord,n=s.getResolution(h[0]),r=i.viewState,e=i.pixelRatio,o=r.resolution/e,a=s.getTileCoordExtent(h,this.tmpExtent),u=r.center,f=bi.getTopLeft(a),c=i.size,l=Math.round(e*c[0]/2),v=Math.round(e*c[1]/2);return Ii.compose(this.tmpTransform_,l,v,n/o,n/o,r.rotation,(f[0]-u[0])/n,(u[1]-f[1])/n)},hn.prototype.handleFontsChanged_=function(){var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},hn.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},hn.prototype.postCompose=function(t,i,s){var h,n,r=this.getLayer(),e=r.getDeclutter()?{}:null,o=r.getSource(),a=r.getRenderMode(),u=hn.VECTOR_REPLAYS[a],f=i.pixelRatio,c=i.viewState.rotation,l=i.size;c&&(h=Math.round(f*l[0]/2),n=Math.round(f*l[1]/2),vh.rotateAtOffset(t,-c,h,n)),e&&this.declutterTree_.clear();for(var v=this.renderedTiles,d=o.getTileGridForProjection(i.viewState.projection),M=[],m=[],p=v.length-1;p>=0;--p){var g=v[p];if(5!=g.getState())for(var _=g.tileCoord,w=d.getTileCoordExtent(_)[0]-d.getTileCoordExtent(g.wrappedTileCoord)[0],y=void 0,b=0,x=g.tileKeys.length;b<x;++b){var E=g.getTile(g.tileKeys[b]);if(3!=E.getState()){var S=E.getReplayGroup(r,_.toString());if("vector"==a||S.hasReplays(u)){y||(y=this.getTransform(i,w));var C=E.tileCoord[0],A=S.getClipCoords(y);t.save(),t.globalAlpha=s.opacity;for(var P=0,R=M.length;P<R;++P){var N=M[P];C<m[P]&&(t.beginPath(),t.moveTo(A[0],A[1]),t.lineTo(A[2],A[3]),t.lineTo(A[4],A[5]),t.lineTo(A[6],A[7]),t.moveTo(N[6],N[7]),t.lineTo(N[4],N[5]),t.lineTo(N[2],N[3]),t.lineTo(N[0],N[1]),t.clip())}S.replay(t,y,c,{},u,e),t.restore(),M.push(A),m.push(C)}}}}e&&$h.replayDeclutter(e,t,c),c&&vh.rotateAtOffset(t,c,h,n),Ah.prototype.postCompose.apply(this,arguments)},hn.prototype.renderFeature=function(t,i,s,h){if(!s)return!1;var n=!1;if(Array.isArray(s))for(var r=0,e=s.length;r<e;++r)n=tn.renderFeature(h,t,s[r],i,this.handleStyleImageChange_,this)||n;else n=tn.renderFeature(h,t,s,i,this.handleStyleImageChange_,this);return n},hn.prototype.renderTileImage_=function(t,i){var s=this.getLayer(),h=t.getReplayState(s),n=s.getRevision(),r=hn.IMAGE_REPLAYS[s.getRenderMode()];if(r&&h.renderedTileRevision!==n){h.renderedTileRevision=n;var e=t.wrappedTileCoord,o=e[0],a=i.pixelRatio,u=s.getSource(),f=u.getTileGridForProjection(i.viewState.projection),c=f.getResolution(o),l=t.getContext(s),v=u.getTilePixelSize(o,a,i.viewState.projection);l.canvas.width=v[0],l.canvas.height=v[1];for(var d=f.getTileCoordExtent(e),M=0,m=t.tileKeys.length;M<m;++M){var p=t.getTile(t.tileKeys[M]);if(3!=p.getState()){var g=a/c,_=Ii.reset(this.tmpTransform_);Ii.scale(_,g,-g),Ii.translate(_,-d[0],-d[3]),p.getReplayGroup(s,t.tileCoord.toString()).replay(l,_,0,{},r)}}}};var nn=function(t){this.source_=t};nn.prototype.getType=function(){},nn.prototype.getSource=function(){return this.source_},nn.prototype.isAnimated=xi.FALSE;var rn=function(t){nn.call(this,t)};ui.inherits(rn,nn),rn.prototype.getType=function(){return $i.FRAGMENT_SHADER};var en=function(t){nn.call(this,t)};ui.inherits(en,nn),en.prototype.getType=function(){return $i.VERTEX_SHADER};var on={};on.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_fillColor;\nuniform vec4 u_strokeColor;\nuniform vec2 u_size;\n\nvoid main(void) {\n vec2 windowCenter = vec2((v_center.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_center.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n vec2 windowOffset = vec2((v_offset.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_offset.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n float radius = length(windowCenter - windowOffset);\n float dist = length(windowCenter - gl_FragCoord.xy);\n if (dist > radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n":"precision mediump float;varying vec2 a;varying vec2 b;varying float c;varying float d;uniform float m;uniform vec4 n;uniform vec4 o;uniform vec2 p;void main(void){vec2 windowCenter=vec2((a.x+1.0)/2.0*p.x*d,(a.y+1.0)/2.0*p.y*d);vec2 windowOffset=vec2((b.x+1.0)/2.0*p.x*d,(b.y+1.0)/2.0*p.y*d);float radius=length(windowCenter-windowOffset);float dist=length(windowCenter-gl_FragCoord.xy);if(dist>radius+c){if(o.a==0.0){gl_FragColor=n;}else{gl_FragColor=o;}gl_FragColor.a=gl_FragColor.a-(dist-(radius+c));}else if(n.a==0.0){gl_FragColor=o;if(dist<radius-c){gl_FragColor.a=gl_FragColor.a-(radius-c-dist);}} else{gl_FragColor=n;float strokeDist=radius-c;float antialias=2.0*d;if(dist>strokeDist){gl_FragColor=o;}else if(dist>=strokeDist-antialias){float step=smoothstep(strokeDist-antialias,strokeDist,dist);gl_FragColor=mix(n,o,step);}} gl_FragColor.a=gl_FragColor.a*m;if(gl_FragColor.a<=0.0){discard;}}"),on.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n":"varying vec2 a;varying vec2 b;varying float c;varying float d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;void main(void){mat4 offsetMatrix=i*j;a=vec4(h*vec4(e,0.0,1.0)).xy;d=l;float lineWidth=k*l;c=lineWidth/2.0;if(lineWidth==0.0){lineWidth=2.0*l;}vec2 offset;float radius=g+3.0*l;//Until we get gl_VertexID in WebGL,we store an instruction.if(f==0.0){//Offsetting the edges of the triangle by lineWidth/2 is necessary,however//we should also leave some space for the antialiasing,thus we offset by lineWidth.offset=vec2(-1.0,1.0);}else if(f==1.0){offset=vec2(-1.0,-1.0);}else if(f==2.0){offset=vec2(1.0,-1.0);}else{offset=vec2(1.0,1.0);}gl_Position=h*vec4(e+offset*radius,0.0,1.0)+offsetMatrix*vec4(offset*lineWidth,0.0,0.0);b=vec4(h*vec4(e.x+g,e.y,0.0,1.0)).xy;if(distance(a,b)>20000.0){gl_Position=vec4(a,0.0,1.0);}}");var an=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_lineWidth=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_lineWidth":"k"),this.u_pixelRatio=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_pixelRatio":"l"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"m"),this.u_fillColor=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_fillColor":"n"),this.u_strokeColor=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_strokeColor":"o"),this.u_size=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_size":"p"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"e"),this.a_instruction=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_instruction":"f"),this.a_radius=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_radius":"g")},un=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},fn=function(t,i){return t[0]=i[0],t[1]=i[1],t[4]=i[2],t[5]=i[3],t[12]=i[4],t[13]=i[5],t},cn=function(t,i){mh.call(this),this.tolerance=t,this.maxExtent=i,this.origin=bi.getCenter(i),this.projectionMatrix_=Ii.create(),this.offsetRotateMatrix_=Ii.create(),this.offsetScaleMatrix_=Ii.create(),this.tmpMat4_=un(),this.indices=[],this.indicesBuffer=null,this.startIndices=[],this.startIndicesFeature=[],this.vertices=[],this.verticesBuffer=null,this.lineStringReplay=void 0};ui.inherits(cn,mh),cn.prototype.getDeleteResourcesFunction=function(){},cn.prototype.finish=function(){},cn.prototype.setUpProgram=function(){},cn.prototype.shutDownProgram=function(){},cn.prototype.drawReplay=function(){},cn.prototype.drawHitDetectionReplayOneByOne=function(){},cn.prototype.drawHitDetectionReplay=function(t,i,s,h,n,r){return n?this.drawHitDetectionReplayOneByOne(t,i,s,h,r):this.drawHitDetectionReplayAll(t,i,s,h)},cn.prototype.drawHitDetectionReplayAll=function(t,i,s,h){return t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawReplay(t,i,s,!0),h(null)||void 0},cn.prototype.replay=function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v,d,M,m,p,g,_=t.getGL();this.lineStringReplay&&(c=_.isEnabled(_.STENCIL_TEST),l=_.getParameter(_.STENCIL_FUNC),v=_.getParameter(_.STENCIL_VALUE_MASK),d=_.getParameter(_.STENCIL_REF),M=_.getParameter(_.STENCIL_WRITEMASK),m=_.getParameter(_.STENCIL_FAIL),p=_.getParameter(_.STENCIL_PASS_DEPTH_PASS),g=_.getParameter(_.STENCIL_PASS_DEPTH_FAIL),_.enable(_.STENCIL_TEST),_.clear(_.STENCIL_BUFFER_BIT),_.stencilMask(255),_.stencilFunc(_.ALWAYS,1,255),_.stencilOp(_.KEEP,_.KEEP,_.REPLACE),this.lineStringReplay.replay(t,i,s,h,n,r,e,o,a,u,f),_.stencilMask(0),_.stencilFunc(_.NOTEQUAL,1,255)),t.bindBuffer($i.ARRAY_BUFFER,this.verticesBuffer),t.bindBuffer($i.ELEMENT_ARRAY_BUFFER,this.indicesBuffer);var w=this.setUpProgram(_,t,n,r),y=Ii.reset(this.projectionMatrix_);Ii.scale(y,2/(s*n[0]),2/(s*n[1])),Ii.rotate(y,-h),Ii.translate(y,-(i[0]-this.origin[0]),-(i[1]-this.origin[1]));var b=Ii.reset(this.offsetScaleMatrix_);Ii.scale(b,2/n[0],2/n[1]);var x,E=Ii.reset(this.offsetRotateMatrix_);return 0!==h&&Ii.rotate(E,-h),_.uniformMatrix4fv(w.u_projectionMatrix,!1,fn(this.tmpMat4_,y)),_.uniformMatrix4fv(w.u_offsetScaleMatrix,!1,fn(this.tmpMat4_,b)),_.uniformMatrix4fv(w.u_offsetRotateMatrix,!1,fn(this.tmpMat4_,E)),_.uniform1f(w.u_opacity,e),void 0===a?this.drawReplay(_,t,o,!1):x=this.drawHitDetectionReplay(_,t,o,a,u,f),this.shutDownProgram(_,w),this.lineStringReplay&&(c||_.disable(_.STENCIL_TEST),_.clear(_.STENCIL_BUFFER_BIT),_.stencilFunc(l,d,v),_.stencilMask(M),_.stencilOp(m,g,p)),x},cn.prototype.drawElements=function(t,i,s,h){t.drawElements($i.TRIANGLES,h-s,i.hasOESElementIndexUint?$i.UNSIGNED_INT:$i.UNSIGNED_SHORT,s*(i.hasOESElementIndexUint?4:2))};var ln={defaultFont:"10px sans-serif",defaultFillStyle:[0,0,0,1],defaultLineCap:"round",defaultLineDash:[],defaultLineDashOffset:0,defaultLineJoin:"round",defaultMiterLimit:10,defaultStrokeStyle:[0,0,0,1],defaultTextAlign:.5,defaultTextBaseline:.5,defaultLineWidth:1,triangleIsCounterClockwise:function(t,i,s,h,n,r){var e=(s-t)*(r-i)-(n-t)*(h-i);return e<=ln.EPSILON&&e>=-ln.EPSILON?void 0:e>0}};ln.EPSILON=Number.EPSILON||2220446049250313e-31;var vn=function(t,i){this.arr_=void 0!==t?t:[],this.usage_=void 0!==i?i:vn.Usage_.STATIC_DRAW};vn.prototype.getArray=function(){return this.arr_},vn.prototype.getUsage=function(){return this.usage_},vn.Usage_={STATIC_DRAW:$i.STATIC_DRAW,STREAM_DRAW:$i.STREAM_DRAW,DYNAMIC_DRAW:$i.DYNAMIC_DRAW};var dn=function(t,i){cn.call(this,t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.radius_=0,this.state_={fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:void 0,lineWidth:void 0,changed:!1}};ui.inherits(dn,cn),dn.prototype.drawCoordinates_=function(t,i,s,h){var n,r,e=this.vertices.length,o=this.indices.length,a=e/4;for(n=i,r=s;n<r;n+=h)this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=0,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=1,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=2,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=3,this.vertices[e++]=this.radius_,this.indices[o++]=a,this.indices[o++]=a+1,this.indices[o++]=a+2,this.indices[o++]=a+2,this.indices[o++]=a+3,this.indices[o++]=a,a+=4},dn.prototype.drawCircle=function(t,i){var s=t.getRadius(),h=t.getStride();if(s){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.radius_=s;var n=t.getFlatCoordinates();n=Ai(n,0,2,h,-this.origin[0],-this.origin[1]),this.drawCoordinates_(n,0,2,h)}else if(this.state_.changed&&(this.styles_.pop(),this.styles_.length)){var r=this.styles_[this.styles_.length-1];this.state_.fillColor=r[0],this.state_.strokeColor=r[1],this.state_.lineWidth=r[2],this.state_.changed=!1}},dn.prototype.finish=function(){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},dn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer;return function(){t.deleteBuffer(i),t.deleteBuffer(s)}},dn.prototype.setUpProgram=function(t,i,s,h){var n,r=i.getProgram(on.fragment,on.vertex);return this.defaultLocations_?n=this.defaultLocations_:(n=new an(t,r),this.defaultLocations_=n),i.useProgram(r),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,$i.FLOAT,!1,16,0),t.enableVertexAttribArray(n.a_instruction),t.vertexAttribPointer(n.a_instruction,1,$i.FLOAT,!1,16,8),t.enableVertexAttribArray(n.a_radius),t.vertexAttribPointer(n.a_radius,1,$i.FLOAT,!1,16,12),t.uniform2fv(n.u_size,s),t.uniform1f(n.u_pixelRatio,h),n},dn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_instruction),t.disableVertexAttribArray(i.a_radius)},dn.prototype.drawReplay=function(t,i,s){var h,n,r,e;if(fi.isEmpty(s))for(r=this.startIndices[this.startIndices.length-1],h=this.styleIndices_.length-1;h>=0;--h)n=this.styleIndices_[h],this.setFillStyle_(t,(e=this.styles_[h])[0]),this.setStrokeStyle_(t,e[1],e[2]),this.drawElements(t,i,n,r),r=n;else this.drawReplaySkipping_(t,i,s)},dn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f,c;for(o=this.startIndices[1+(c=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setFillStyle_(t,(a=this.styles_[r])[0]),this.setStrokeStyle_(t,a[1],a[2]),u=this.styleIndices_[r];c>=0&&this.startIndices[c]>=u;){if(e=this.startIndices[c],void 0===s[ui.getUid(f=this.startIndicesFeature[c]).toString()]&&f.getGeometry()&&(void 0===n||bi.intersects(n,f.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var l=h(f);if(l)return l}c--,o=e}},dn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a,u;for(r=n=this.startIndices[1+(a=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setFillStyle_(t,(e=this.styles_[h])[0]),this.setStrokeStyle_(t,e[1],e[2]),o=this.styleIndices_[h];a>=0&&this.startIndices[a]>=o;)u=this.startIndices[a],s[ui.getUid(this.startIndicesFeature[a]).toString()]&&(n!==r&&this.drawElements(t,i,n,r),r=u),a--,n=u;n!==r&&this.drawElements(t,i,n,r),n=r=o}},dn.prototype.setFillStyle_=function(t,i){t.uniform4fv(this.defaultLocations_.u_fillColor,i)},dn.prototype.setStrokeStyle_=function(t,i,s){t.uniform4fv(this.defaultLocations_.u_strokeColor,i),t.uniform1f(this.defaultLocations_.u_lineWidth,s)},dn.prototype.setFillStrokeStyle=function(t,i){var s,h;if(i){var n=i.getLineDash();this.state_.lineDash=n||ln.defaultLineDash;var r=i.getLineDashOffset();this.state_.lineDashOffset=r||ln.defaultLineDashOffset,s=(s=i.getColor())instanceof CanvasGradient||s instanceof CanvasPattern?ln.defaultStrokeStyle:dh.asArray(s).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultStrokeStyle,h=void 0!==(h=i.getWidth())?h:ln.defaultLineWidth}else s=[0,0,0,0],h=0;var e=t?t.getColor():[0,0,0,0];e=e instanceof CanvasGradient||e instanceof CanvasPattern?ln.defaultFillStyle:dh.asArray(e).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultFillStyle,this.state_.strokeColor&&yi.equals(this.state_.strokeColor,s)&&this.state_.fillColor&&yi.equals(this.state_.fillColor,e)&&this.state_.lineWidth===h||(this.state_.changed=!0,this.state_.fillColor=e,this.state_.strokeColor=s,this.state_.lineWidth=h,this.styles_.push([e,s,h]))};var Mn={};Mn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),Mn.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n":"varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.0,0.0);gl_Position=h*vec4(c,0.0,1.0)+offsets;a=d;b=f;}");var mn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"k"),this.u_image=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_image":"l"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"c"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"d"),this.a_offsets=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_offsets":"e"),this.a_opacity=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_opacity":"f"),this.a_rotateWithView=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_rotateWithView":"g")},pn=function(t,i){this.canvas_=t,this.gl_=i,this.bufferCache_={},this.shaderCache_={},this.programCache_={},this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null,this.hasOESElementIndexUint=yi.includes(ui.WEBGL_EXTENSIONS,"OES_element_index_uint"),this.hasOESElementIndexUint&&i.getExtension("OES_element_index_uint"),ci.listen(this.canvas_,"webglcontextlost",this.handleWebGLContextLost,this),ci.listen(this.canvas_,"webglcontextrestored",this.handleWebGLContextRestored,this)};ui.inherits(pn,li),pn.prototype.bindBuffer=function(t,i){var s=this.getGL(),h=i.getArray(),n=String(ui.getUid(i));if(n in this.bufferCache_)s.bindBuffer(t,this.bufferCache_[n].buffer);else{var r,e=s.createBuffer();s.bindBuffer(t,e),t==$i.ARRAY_BUFFER?r=new Float32Array(h):t==$i.ELEMENT_ARRAY_BUFFER&&(r=this.hasOESElementIndexUint?new Uint32Array(h):new Uint16Array(h)),s.bufferData(t,r,i.getUsage()),this.bufferCache_[n]={buf:i,buffer:e}}},pn.prototype.deleteBuffer=function(t){var i=this.getGL(),s=String(ui.getUid(t)),h=this.bufferCache_[s];i.isContextLost()||i.deleteBuffer(h.buffer),delete this.bufferCache_[s]},pn.prototype.disposeInternal=function(){ci.unlistenAll(this.canvas_);var t=this.getGL();if(!t.isContextLost()){var i;for(i in this.bufferCache_)t.deleteBuffer(this.bufferCache_[i].buffer);for(i in this.programCache_)t.deleteProgram(this.programCache_[i]);for(i in this.shaderCache_)t.deleteShader(this.shaderCache_[i]);t.deleteFramebuffer(this.hitDetectionFramebuffer_),t.deleteRenderbuffer(this.hitDetectionRenderbuffer_),t.deleteTexture(this.hitDetectionTexture_)}},pn.prototype.getCanvas=function(){return this.canvas_},pn.prototype.getGL=function(){return this.gl_},pn.prototype.getHitDetectionFramebuffer=function(){return this.hitDetectionFramebuffer_||this.initHitDetectionFramebuffer_(),this.hitDetectionFramebuffer_},pn.prototype.getShader=function(t){var i=String(ui.getUid(t));if(i in this.shaderCache_)return this.shaderCache_[i];var s=this.getGL(),h=s.createShader(t.getType());return s.shaderSource(h,t.getSource()),s.compileShader(h),this.shaderCache_[i]=h,h},pn.prototype.getProgram=function(t,i){var s=ui.getUid(t)+"/"+ui.getUid(i);if(s in this.programCache_)return this.programCache_[s];var h=this.getGL(),n=h.createProgram();return h.attachShader(n,this.getShader(t)),h.attachShader(n,this.getShader(i)),h.linkProgram(n),this.programCache_[s]=n,n},pn.prototype.handleWebGLContextLost=function(){fi.clear(this.bufferCache_),fi.clear(this.shaderCache_),fi.clear(this.programCache_),this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null},pn.prototype.handleWebGLContextRestored=function(){},pn.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_,i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i);var s=pn.createEmptyTexture(t,1,1),h=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,h),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,h),t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.hitDetectionFramebuffer_=i,this.hitDetectionTexture_=s,this.hitDetectionRenderbuffer_=h},pn.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,!0)},pn.createTexture_=function(t,i,s){var h=t.createTexture();return t.bindTexture(t.TEXTURE_2D,h),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),void 0!==i&&t.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_S,i),void 0!==s&&t.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_T,s),h},pn.createEmptyTexture=function(t,i,s,h,n){var r=pn.createTexture_(t,h,n);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,i,s,0,t.RGBA,t.UNSIGNED_BYTE,null),r},pn.createTexture=function(t,i,s,h){var n=pn.createTexture_(t,s,h);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),n};var gn=function(t,i){cn.call(this,t,i),this.anchorX=void 0,this.anchorY=void 0,this.groupIndices=[],this.hitDetectionGroupIndices=[],this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.defaultLocations=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.width=void 0};ui.inherits(gn,cn),gn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer,h=this.getTextures(!0),n=t.getGL();return function(){var r,e;if(!n.isContextLost())for(r=0,e=h.length;r<e;++r)n.deleteTexture(h[r]);t.deleteBuffer(i),t.deleteBuffer(s)}},gn.prototype.drawCoordinates=function(t,i,s,h){var n,r,e,o,a,u,f=this.anchorX,c=this.anchorY,l=this.height,v=this.imageHeight,d=this.imageWidth,M=this.opacity,m=this.originX,p=this.originY,g=this.rotateWithView?1:0,_=-this.rotation,w=this.scale,y=this.width,b=Math.cos(_),x=Math.sin(_),E=this.indices.length,S=this.vertices.length;for(n=i;n<s;n+=h)u=t[n+1]-this.origin[1],r=S/8,e=-w*f,o=-w*(l-c),this.vertices[S++]=a=t[n]-this.origin[0],this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=m/d,this.vertices[S++]=(p+l)/v,this.vertices[S++]=M,this.vertices[S++]=g,e=w*(y-f),o=-w*(l-c),this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=(m+y)/d,this.vertices[S++]=(p+l)/v,this.vertices[S++]=M,this.vertices[S++]=g,e=w*(y-f),o=w*c,this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=(m+y)/d,this.vertices[S++]=p/v,this.vertices[S++]=M,this.vertices[S++]=g,e=-w*f,o=w*c,this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=m/d,this.vertices[S++]=p/v,this.vertices[S++]=M,this.vertices[S++]=g,this.indices[E++]=r,this.indices[E++]=r+1,this.indices[E++]=r+2,this.indices[E++]=r,this.indices[E++]=r+2,this.indices[E++]=r+3;return S},gn.prototype.createTextures=function(t,i,s,h){var n,r,e,o,a=i.length;for(o=0;o<a;++o)(e=ui.getUid(r=i[o]).toString())in s?n=s[e]:(n=pn.createTexture(h,r,$i.CLAMP_TO_EDGE,$i.CLAMP_TO_EDGE),s[e]=n),t[o]=n},gn.prototype.setUpProgram=function(t,i){var s,h=i.getProgram(Mn.fragment,Mn.vertex);return this.defaultLocations?s=this.defaultLocations:(s=new mn(t,h),this.defaultLocations=s),i.useProgram(h),t.enableVertexAttribArray(s.a_position),t.vertexAttribPointer(s.a_position,2,$i.FLOAT,!1,32,0),t.enableVertexAttribArray(s.a_offsets),t.vertexAttribPointer(s.a_offsets,2,$i.FLOAT,!1,32,8),t.enableVertexAttribArray(s.a_texCoord),t.vertexAttribPointer(s.a_texCoord,2,$i.FLOAT,!1,32,16),t.enableVertexAttribArray(s.a_opacity),t.vertexAttribPointer(s.a_opacity,1,$i.FLOAT,!1,32,24),t.enableVertexAttribArray(s.a_rotateWithView),t.vertexAttribPointer(s.a_rotateWithView,1,$i.FLOAT,!1,32,28),s},gn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_offsets),t.disableVertexAttribArray(i.a_texCoord),t.disableVertexAttribArray(i.a_opacity),t.disableVertexAttribArray(i.a_rotateWithView)},gn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o=h?this.getHitDetectionTextures():this.getTextures(),a=h?this.hitDetectionGroupIndices:this.groupIndices;if(fi.isEmpty(s))for(n=0,r=o.length,e=0;n<r;++n){t.bindTexture($i.TEXTURE_2D,o[n]);var u=a[n];this.drawElements(t,i,e,u),e=u}else this.drawReplaySkipping(t,i,s,o,a)},gn.prototype.drawReplaySkipping=function(t,i,s,h,n){var r,e,o=0;for(r=0,e=h.length;r<e;++r){t.bindTexture($i.TEXTURE_2D,h[r]);for(var a=r>0?n[r-1]:0,u=n[r],f=a,c=a;o<this.startIndices.length&&this.startIndices[o]<=u;)void 0!==s[ui.getUid(this.startIndicesFeature[o]).toString()]?(f!==c&&this.drawElements(t,i,f,c),c=f=o===this.startIndices.length-1?u:this.startIndices[o+1]):c=o===this.startIndices.length-1?u:this.startIndices[o+1],o++;f!==c&&this.drawElements(t,i,f,c)}},gn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f=this.startIndices.length-1,c=this.getHitDetectionTextures();for(r=c.length-1;r>=0;--r)for(t.bindTexture($i.TEXTURE_2D,c[r]),e=r>0?this.hitDetectionGroupIndices[r-1]:0,a=this.hitDetectionGroupIndices[r];f>=0&&this.startIndices[f]>=e;){if(o=this.startIndices[f],void 0===s[ui.getUid(u=this.startIndicesFeature[f]).toString()]&&u.getGeometry()&&(void 0===n||bi.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,o,a);var l=h(u);if(l)return l}a=o,f--}},gn.prototype.finish=function(){this.anchorX=void 0,this.anchorY=void 0,this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.indices=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.vertices=null,this.width=void 0},gn.prototype.getTextures=function(){},gn.prototype.getHitDetectionTextures=function(){};var _n=function(t,i){gn.call(this,t,i),this.images_=[],this.hitDetectionImages_=[],this.textures_=[],this.hitDetectionTextures_=[]};ui.inherits(_n,gn),_n.prototype.drawMultiPoint=function(t,i){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var s=t.getFlatCoordinates(),h=t.getStride();this.drawCoordinates(s,0,s.length,h)},_n.prototype.drawPoint=function(t,i){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var s=t.getFlatCoordinates(),h=t.getStride();this.drawCoordinates(s,0,s.length,h)},_n.prototype.finish=function(t){var i=t.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices.push(this.indices.length),this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices);var s={};this.createTextures(this.textures_,this.images_,s,i),this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,s,i),this.images_=null,this.hitDetectionImages_=null,gn.prototype.finish.call(this,t)},_n.prototype.setImageStyle=function(t){var i=t.getAnchor(),s=t.getImage(1),h=t.getImageSize(),n=t.getHitDetectionImage(1),r=t.getOpacity(),e=t.getOrigin(),o=t.getRotateWithView(),a=t.getRotation(),u=t.getSize(),f=t.getScale();0===this.images_.length?this.images_.push(s):ui.getUid(this.images_[this.images_.length-1])!=ui.getUid(s)&&(this.groupIndices.push(this.indices.length),this.images_.push(s)),0===this.hitDetectionImages_.length?this.hitDetectionImages_.push(n):ui.getUid(this.hitDetectionImages_[this.hitDetectionImages_.length-1])!=ui.getUid(n)&&(this.hitDetectionGroupIndices.push(this.indices.length),this.hitDetectionImages_.push(n)),this.anchorX=i[0],this.anchorY=i[1],this.height=u[1],this.imageHeight=h[1],this.imageWidth=h[0],this.opacity=r,this.originX=e[0],this.originY=e[1],this.rotation=a,this.rotateWithView=o,this.scale=f,this.width=u[0]},_n.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_},_n.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_};var wn=function(t,i,s,h){var n=s-h;return t[i]===t[n]&&t[i+1]===t[n+1]&&(s-i)/h>3&&!!Gi.linearRing(t,i,s,h)},yn={};yn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying float a;varying vec2 aVertex;varying float c;uniform float m;uniform vec4 n;uniform vec2 o;uniform float p;void main(void){if(a>0.0){vec2 windowCoords=vec2((aVertex.x+1.0)/2.0*o.x*p,(aVertex.y+1.0)/2.0*o.y*p);if(length(windowCoords-gl_FragCoord.xy)>c*p){discard;}} gl_FragColor=n;float alpha=n.a*m;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),yn.vertex=new en(ui.DEBUG_WEBGL?"varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n":"varying float a;varying vec2 aVertex;varying float c;attribute vec2 d;attribute vec2 e;attribute vec2 f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;bool nearlyEquals(in float value,in float ref){float epsilon=0.000000000001;return value>=ref-epsilon&&value<=ref+epsilon;}void alongNormal(out vec2 offset,in vec2 nextP,in float turnDir,in float direction){vec2 dirVect=nextP-e;vec2 normal=normalize(vec2(-turnDir*dirVect.y,turnDir*dirVect.x));offset=k/2.0*normal*direction;}void miterUp(out vec2 offset,out float round,in bool isRound,in float direction){float halfWidth=k/2.0;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=f-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;round=0.0;if(isRound){round=1.0;}else if(miterLength>l+k){offset=halfWidth*tmpNormal*direction;}} bool miterDown(out vec2 offset,in vec4 projPos,in mat4 offsetMatrix,in float direction){bool degenerate=false;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=d-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));vec2 longOffset,shortOffset,longVertex;vec4 shortProjVertex;float halfWidth=k/2.0;if(length(f-e)>length(d-e)){longOffset=tmpNormal*direction*halfWidth;shortOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=f;shortProjVertex=h*vec4(d,0.0,1.0);}else{shortOffset=tmpNormal*direction*halfWidth;longOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=d;shortProjVertex=h*vec4(f,0.0,1.0);}vec4 p1=h*vec4(longVertex,0.0,1.0)+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p2=projPos+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p3=shortProjVertex+offsetMatrix*vec4(-shortOffset,0.0,0.0);vec4 p4=shortProjVertex+offsetMatrix*vec4(shortOffset,0.0,0.0);float denom=(p4.y-p3.y)*(p2.x-p1.x)-(p4.x-p3.x)*(p2.y-p1.y);float firstU=((p4.x-p3.x)*(p1.y-p3.y)-(p4.y-p3.y)*(p1.x-p3.x))/denom;float secondU=((p2.x-p1.x)*(p1.y-p3.y)-(p2.y-p1.y)*(p1.x-p3.x))/denom;float epsilon=0.000000000001;if(firstU>epsilon&&firstU<1.0-epsilon&&secondU>epsilon&&secondU<1.0-epsilon){shortProjVertex.x=p1.x+firstU*(p2.x-p1.x);shortProjVertex.y=p1.y+firstU*(p2.y-p1.y);offset=shortProjVertex.xy;degenerate=true;}else{float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;}return degenerate;}void squareCap(out vec2 offset,out float round,in bool isRound,in vec2 nextP,in float turnDir,in float direction){round=0.0;vec2 dirVect=e-nextP;vec2 firstNormal=normalize(dirVect);vec2 secondNormal=vec2(turnDir*firstNormal.y*direction,-turnDir*firstNormal.x*direction);vec2 hypotenuse=normalize(firstNormal-secondNormal);vec2 normal=vec2(turnDir*hypotenuse.y*direction,-turnDir*hypotenuse.x*direction);float length=sqrt(c*c*2.0);offset=normal*length;if(isRound){round=1.0;}} void main(void){bool degenerate=false;float direction=float(sign(g));mat4 offsetMatrix=i*j;vec2 offset;vec4 projPos=h*vec4(e,0.0,1.0);bool round=nearlyEquals(mod(g,2.0),0.0);a=0.0;c=k/2.0;aVertex=projPos.xy;if(nearlyEquals(mod(g,3.0),0.0)||nearlyEquals(mod(g,17.0),0.0)){alongNormal(offset,f,1.0,direction);}else if(nearlyEquals(mod(g,5.0),0.0)||nearlyEquals(mod(g,13.0),0.0)){alongNormal(offset,d,-1.0,direction);}else if(nearlyEquals(mod(g,23.0),0.0)){miterUp(offset,a,round,direction);}else if(nearlyEquals(mod(g,19.0),0.0)){degenerate=miterDown(offset,projPos,offsetMatrix,direction);}else if(nearlyEquals(mod(g,7.0),0.0)){squareCap(offset,a,round,f,1.0,direction);}else if(nearlyEquals(mod(g,11.0),0.0)){squareCap(offset,a,round,d,-1.0,direction);}if(!degenerate){vec4 offsets=offsetMatrix*vec4(offset,0.0,0.0);gl_Position=projPos+offsets;}else{gl_Position=vec4(offset,0.0,1.0);}}");var bn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_lineWidth=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_lineWidth":"k"),this.u_miterLimit=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_miterLimit":"l"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"m"),this.u_color=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_color":"n"),this.u_size=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_size":"o"),this.u_pixelRatio=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_pixelRatio":"p"),this.a_lastPos=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_lastPos":"d"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"e"),this.a_nextPos=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_nextPos":"f"),this.a_direction=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_direction":"g")},xn=function(t,i){cn.call(this,t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0,changed:!1}};ui.inherits(xn,cn),xn.prototype.drawCoordinates_=function(t,i,s,h){var n,r,e,o,a,u,f,c,l=this.vertices.length,v=this.indices.length,d="bevel"===this.state_.lineJoin?0:"miter"===this.state_.lineJoin?1:2,M="butt"===this.state_.lineCap?0:"square"===this.state_.lineCap?1:2,m=wn(t,i,s,h),p=v,g=1;for(n=i,r=s;n<r;n+=h){if(a=l/7,u=f,f=c||[t[n],t[n+1]],n===i){if(c=[t[n+h],t[n+h+1]],s-i==2*h&&yi.equals(f,c))break;if(!m){M&&(l=this.addVertices_([0,0],f,c,g*xn.Instruction_.BEGIN_LINE_CAP*M,l),l=this.addVertices_([0,0],f,c,-g*xn.Instruction_.BEGIN_LINE_CAP*M,l),this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=a+1,this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a+2),l=this.addVertices_([0,0],f,c,g*xn.Instruction_.BEGIN_LINE*(M||1),l),p=(l=this.addVertices_([0,0],f,c,-g*xn.Instruction_.BEGIN_LINE*(M||1),l))/7-1;continue}u=[t[s-2*h],t[s-2*h+1]],e=c}else{if(n===s-h){if(m){c=e;break}l=this.addVertices_(u=u||[0,0],f,[0,0],g*xn.Instruction_.END_LINE*(M||1),l),l=this.addVertices_(u,f,[0,0],-g*xn.Instruction_.END_LINE*(M||1),l),this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=p,this.indices[v++]=a+1,this.indices[v++]=a,M&&(l=this.addVertices_(u,f,[0,0],g*xn.Instruction_.END_LINE_CAP*M,l),l=this.addVertices_(u,f,[0,0],-g*xn.Instruction_.END_LINE_CAP*M,l),this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=a+1,this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a+2);break}c=[t[n+h],t[n+h+1]]}o=ln.triangleIsCounterClockwise(u[0],u[1],f[0],f[1],c[0],c[1])?-1:1,l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_FIRST*(d||1),l),l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_SECOND*(d||1),l),l=this.addVertices_(u,f,c,-o*xn.Instruction_.MITER_BOTTOM*(d||1),l),n>i&&(this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=g*o>0?p:p-1),this.indices[v++]=a,this.indices[v++]=a+2,this.indices[v++]=a+1,p=a+2,g=o,d&&(l=this.addVertices_(u,f,c,o*xn.Instruction_.MITER_TOP*d,l),this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a)}m&&(a=a||l/7,o=Ki.linearRingIsClockwise([u[0],u[1],f[0],f[1],c[0],c[1]],0,6,2)?1:-1,l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_FIRST*(d||1),l),l=this.addVertices_(u,f,c,-o*xn.Instruction_.MITER_BOTTOM*(d||1),l),this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=a+1,this.indices[v++]=a,this.indices[v++]=g*o>0?p:p-1)},xn.prototype.addVertices_=function(t,i,s,h,n){return this.vertices[n++]=t[0],this.vertices[n++]=t[1],this.vertices[n++]=i[0],this.vertices[n++]=i[1],this.vertices[n++]=s[0],this.vertices[n++]=s[1],this.vertices[n++]=h,n},xn.prototype.isValid_=function(t,i,s,h){var n=s-i;return!(n<2*h||n===2*h&&yi.equals([t[i],t[i+1]],[t[i+h],t[i+h+1]]))},xn.prototype.drawLineString=function(t,i){var s=t.getFlatCoordinates(),h=t.getStride();this.isValid_(s,0,s.length,h)&&(s=Ai(s,0,s.length,h,-this.origin[0],-this.origin[1]),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.drawCoordinates_(s,0,s.length,h))},xn.prototype.drawMultiLineString=function(t,i){var s=this.indices.length,h=t.getEnds();h.unshift(0);var n,r,e=t.getFlatCoordinates(),o=t.getStride();if(h.length>1)for(n=1,r=h.length;n<r;++n)if(this.isValid_(e,h[n-1],h[n],o)){var a=Ai(e,h[n-1],h[n],o,-this.origin[0],-this.origin[1]);this.drawCoordinates_(a,0,a.length,o)}this.indices.length>s&&(this.startIndices.push(s),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(s),this.state_.changed=!1))},xn.prototype.drawPolygonCoordinates=function(t,i,s){var h,n;if(wn(t,0,t.length,s)||(t.push(t[0]),t.push(t[1])),this.drawCoordinates_(t,0,t.length,s),i.length)for(h=0,n=i.length;h<n;++h)wn(i[h],0,i[h].length,s)||(i[h].push(i[h][0]),i[h].push(i[h][1])),this.drawCoordinates_(i[h],0,i[h].length,s)},xn.prototype.setPolygonStyle=function(t,i){var s=void 0===i?this.indices.length:i;this.startIndices.push(s),this.startIndicesFeature.push(t),this.state_.changed&&(this.styleIndices_.push(s),this.state_.changed=!1)},xn.prototype.getCurrentIndex=function(){return this.indices.length},xn.prototype.finish=function(){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},xn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer;return function(){t.deleteBuffer(i),t.deleteBuffer(s)}},xn.prototype.setUpProgram=function(t,i,s,h){var n,r=i.getProgram(yn.fragment,yn.vertex);return this.defaultLocations_?n=this.defaultLocations_:(n=new bn(t,r),this.defaultLocations_=n),i.useProgram(r),t.enableVertexAttribArray(n.a_lastPos),t.vertexAttribPointer(n.a_lastPos,2,$i.FLOAT,!1,28,0),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,$i.FLOAT,!1,28,8),t.enableVertexAttribArray(n.a_nextPos),t.vertexAttribPointer(n.a_nextPos,2,$i.FLOAT,!1,28,16),t.enableVertexAttribArray(n.a_direction),t.vertexAttribPointer(n.a_direction,1,$i.FLOAT,!1,28,24),t.uniform2fv(n.u_size,s),t.uniform1f(n.u_pixelRatio,h),n},xn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_lastPos),t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_nextPos),t.disableVertexAttribArray(i.a_direction)},xn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o,a=t.getParameter(t.DEPTH_FUNC),u=t.getParameter(t.DEPTH_WRITEMASK);if(h||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),fi.isEmpty(s))for(e=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)r=this.styleIndices_[n],this.setStrokeStyle_(t,(o=this.styles_[n])[0],o[1],o[2]),this.drawElements(t,i,r,e),t.clear(t.DEPTH_BUFFER_BIT),e=r;else this.drawReplaySkipping_(t,i,s);h||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(u),t.depthFunc(a))},xn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a,u;for(r=n=this.startIndices[1+(a=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setStrokeStyle_(t,(e=this.styles_[h])[0],e[1],e[2]),o=this.styleIndices_[h];a>=0&&this.startIndices[a]>=o;)u=this.startIndices[a],s[ui.getUid(this.startIndicesFeature[a]).toString()]&&(n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),r=u),a--,n=u;n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),n=r=o}},xn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f,c;for(o=this.startIndices[1+(c=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setStrokeStyle_(t,(a=this.styles_[r])[0],a[1],a[2]),u=this.styleIndices_[r];c>=0&&this.startIndices[c]>=u;){if(e=this.startIndices[c],void 0===s[ui.getUid(f=this.startIndicesFeature[c]).toString()]&&f.getGeometry()&&(void 0===n||bi.intersects(n,f.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var l=h(f);if(l)return l}c--,o=e}},xn.prototype.setStrokeStyle_=function(t,i,s,h){t.uniform4fv(this.defaultLocations_.u_color,i),t.uniform1f(this.defaultLocations_.u_lineWidth,s),t.uniform1f(this.defaultLocations_.u_miterLimit,h)},xn.prototype.setFillStrokeStyle=function(t,i){var s=i.getLineCap();this.state_.lineCap=void 0!==s?s:ln.defaultLineCap;var h=i.getLineDash();this.state_.lineDash=h||ln.defaultLineDash;var n=i.getLineDashOffset();this.state_.lineDashOffset=n||ln.defaultLineDashOffset;var r=i.getLineJoin();this.state_.lineJoin=void 0!==r?r:ln.defaultLineJoin;var e=i.getColor();e=e instanceof CanvasGradient||e instanceof CanvasPattern?ln.defaultStrokeStyle:dh.asArray(e).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultStrokeStyle;var o=i.getWidth();o=void 0!==o?o:ln.defaultLineWidth;var a=i.getMiterLimit();a=void 0!==a?a:ln.defaultMiterLimit,this.state_.strokeColor&&yi.equals(this.state_.strokeColor,e)&&this.state_.lineWidth===o&&this.state_.miterLimit===a||(this.state_.changed=!0,this.state_.strokeColor=e,this.state_.lineWidth=o,this.state_.miterLimit=a,this.styles_.push([e,o,a]))},xn.Instruction_={ROUND:2,BEGIN_LINE:3,END_LINE:5,BEGIN_LINE_CAP:7,END_LINE_CAP:11,BEVEL_FIRST:13,BEVEL_SECOND:17,MITER_BOTTOM:19,MITER_TOP:23};var En={};En.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;uniform vec4 e;uniform float f;void main(void){gl_FragColor=e;float alpha=e.a*f;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),En.vertex=new en(ui.DEBUG_WEBGL?"\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n":"attribute vec2 a;uniform mat4 b;uniform mat4 c;uniform mat4 d;void main(void){gl_Position=b*vec4(a,0.0,1.0);}");var Sn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"b"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"c"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"d"),this.u_color=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_color":"e"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"f"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"a")},Cn=function(t){var i=t||{};this.color_=void 0!==i.color?i.color:null,this.lineCap_=i.lineCap,this.lineDash_=void 0!==i.lineDash?i.lineDash:null,this.lineDashOffset_=i.lineDashOffset,this.lineJoin_=i.lineJoin,this.miterLimit_=i.miterLimit,this.width_=i.width,this.checksum_=void 0};Cn.prototype.clone=function(){var t=this.getColor();return new Cn({color:t&&t.slice?t.slice():t||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()})},Cn.prototype.getColor=function(){return this.color_},Cn.prototype.getLineCap=function(){return this.lineCap_},Cn.prototype.getLineDash=function(){return this.lineDash_},Cn.prototype.getLineDashOffset=function(){return this.lineDashOffset_},Cn.prototype.getLineJoin=function(){return this.lineJoin_},Cn.prototype.getMiterLimit=function(){return this.miterLimit_},Cn.prototype.getWidth=function(){return this.width_},Cn.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},Cn.prototype.setLineCap=function(t){this.lineCap_=t,this.checksum_=void 0},Cn.prototype.setLineDash=function(t){this.lineDash_=t,this.checksum_=void 0},Cn.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t,this.checksum_=void 0},Cn.prototype.setLineJoin=function(t){this.lineJoin_=t,this.checksum_=void 0},Cn.prototype.setMiterLimit=function(t){this.miterLimit_=t,this.checksum_=void 0},Cn.prototype.setWidth=function(t){this.width_=t,this.checksum_=void 0},Cn.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_="s",this.checksum_+=this.color_?"string"==typeof this.color_?this.color_:ui.getUid(this.color_).toString():"-",this.checksum_+=","+(void 0!==this.lineCap_?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(void 0!==this.lineDashOffset_?this.lineDashOffset_:"-")+","+(void 0!==this.lineJoin_?this.lineJoin_:"-")+","+(void 0!==this.miterLimit_?this.miterLimit_.toString():"-")+","+(void 0!==this.width_?this.width_.toString():"-")),this.checksum_};var An=function(t){this.first_=void 0,this.last_=void 0,this.head_=void 0,this.circular_=void 0===t||t,this.length_=0};An.prototype.insertItem=function(t){var i={prev:void 0,next:void 0,data:t},s=this.head_;if(s){var h=s.next;i.prev=s,i.next=h,s.next=i,h&&(h.prev=i),s===this.last_&&(this.last_=i)}else this.first_=i,this.last_=i,this.circular_&&(i.next=i,i.prev=i);this.head_=i,this.length_++},An.prototype.removeItem=function(){var t=this.head_;if(t){var i=t.next,s=t.prev;i&&(i.prev=s),s&&(s.next=i),this.head_=i||s,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=s?this.head_.prev:this.head_),this.length_--}},An.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},An.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},An.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},An.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},An.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},An.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},An.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},An.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},An.prototype.concat=function(t){if(t.head_){if(this.head_){var i=this.head_.next;this.head_.next=t.first_,t.first_.prev=this.head_,i.prev=t.last_,t.last_.next=i,this.length_+=t.length_}else this.head_=t.head_,this.first_=t.first_,this.last_=t.last_,this.length_=t.length_;t.head_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}},An.prototype.getLength=function(){return this.length_};var Pn=function(t){this.rbush_=Rh(t),this.items_={}};Pn.prototype.insert=function(t,i){var s={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:i};this.rbush_.insert(s),this.items_[ui.getUid(i)]=s},Pn.prototype.load=function(t,i){for(var s=new Array(i.length),h=0,n=i.length;h<n;h++){var r=t[h],e=i[h],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:e};s[h]=o,this.items_[ui.getUid(e)]=o}this.rbush_.load(s)},Pn.prototype.remove=function(t){var i=ui.getUid(t),s=this.items_[i];return delete this.items_[i],null!==this.rbush_.remove(s)},Pn.prototype.update=function(t,i){var s=this.items_[ui.getUid(i)];bi.equals([s.minX,s.minY,s.maxX,s.maxY],t)||(this.remove(i),this.insert(t,i))},Pn.prototype.getAll=function(){return this.rbush_.all().map((function(t){return t.value}))},Pn.prototype.getInExtent=function(t){return this.rbush_.search({minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}).map((function(t){return t.value}))},Pn.prototype.forEach=function(t,i){return this.forEach_(this.getAll(),t,i)},Pn.prototype.forEachInExtent=function(t,i,s){return this.forEach_(this.getInExtent(t),i,s)},Pn.prototype.forEach_=function(t,i,s){for(var h,n=0,r=t.length;n<r;n++)if(h=i.call(s,t[n]))return h;return h},Pn.prototype.isEmpty=function(){return fi.isEmpty(this.items_)},Pn.prototype.clear=function(){this.rbush_.clear(),this.items_={}},Pn.prototype.getExtent=function(t){var i=this.rbush_.data;return bi.createOrUpdate(i.minX,i.minY,i.maxX,i.maxY,t)},Pn.prototype.concat=function(t){for(var i in this.rbush_.load(t.rbush_.all()),t.items_)this.items_[0|i]=t.items_[0|i]};var Rn=function(t,i){cn.call(this,t,i),this.lineStringReplay=new xn(t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={fillColor:null,changed:!1}};ui.inherits(Rn,cn),Rn.prototype.drawCoordinates_=function(t,i,s){var h=new An,n=new Pn;this.processFlatCoordinates_(t,s,h,n,!0);var r=this.getMaxCoords_(h);if(i.length){var e,o,a=[];for(e=0,o=i.length;e<o;++e){var u={list:new An,maxCoords:void 0,rtree:new Pn};a.push(u),this.processFlatCoordinates_(i[e],s,u.list,u.rtree,!1),this.classifyPoints_(u.list,u.rtree,!0),u.maxCoords=this.getMaxCoords_(u.list)}for(a.sort((function(t,i){return i.maxCoords[0]===t.maxCoords[0]?t.maxCoords[1]-i.maxCoords[1]:i.maxCoords[0]-t.maxCoords[0]})),e=0;e<a.length;++e){var f,c=a[e].list,l=c.firstItem(),v=l;do{if(this.getIntersections_(v,n).length){f=!0;break}v=c.nextItem()}while(l!==v);f||this.bridgeHole_(c,a[e].maxCoords[0],h,r[0],n)&&(n.concat(a[e].rtree),this.classifyPoints_(h,n,!1))}}else this.classifyPoints_(h,n,!1);this.triangulate_(h,n)},Rn.prototype.processFlatCoordinates_=function(t,i,s,h,n){var r,e,o,a,u,f=Ki.linearRingIsClockwise(t,0,t.length,i),c=this.vertices.length/2,l=[],v=[];if(n===f){for(a=o=this.createPoint_(t[0],t[1],c++),r=i,e=t.length;r<e;r+=i)u=this.createPoint_(t[r],t[r+1],c++),v.push(this.insertItem_(a,u,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)]),a=u;v.push(this.insertItem_(u,o,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)])}else{var d=t.length-i;for(a=o=this.createPoint_(t[d],t[d+1],c++),r=d-i,e=0;r>=e;r-=i)u=this.createPoint_(t[r],t[r+1],c++),v.push(this.insertItem_(a,u,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)]),a=u;v.push(this.insertItem_(u,o,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)])}h.load(l,v)},Rn.prototype.getMaxCoords_=function(t){var i=t.firstItem(),s=i,h=[s.p0.x,s.p0.y];do{(s=t.nextItem()).p0.x>h[0]&&(h=[s.p0.x,s.p0.y])}while(s!==i);return h},Rn.prototype.classifyPoints_=function(t,i,s){var h=t.firstItem(),n=h,r=t.nextItem(),e=!1;do{var o=s?ln.triangleIsCounterClockwise(r.p1.x,r.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):ln.triangleIsCounterClockwise(n.p0.x,n.p0.y,n.p1.x,n.p1.y,r.p1.x,r.p1.y);void 0===o?(this.removeItem_(n,r,t,i),e=!0,r===h&&(h=t.getNextItem()),r=n,t.prevItem()):n.p1.reflex!==o&&(n.p1.reflex=o,e=!0),n=r,r=t.nextItem()}while(n!==h);return e},Rn.prototype.bridgeHole_=function(t,i,s,h,n){for(var r=t.firstItem();r.p1.x!==i;)r=t.nextItem();var e,o,a,u,f=r.p1,c={x:h,y:f.y,i:-1},l=1/0,v=this.getIntersections_({p0:f,p1:c},n,!0);for(e=0,o=v.length;e<o;++e){var d=v[e],M=this.calculateIntersection_(f,c,d.p0,d.p1,!0),m=Math.abs(f.x-M[0]);m<l&&void 0!==ln.triangleIsCounterClockwise(f.x,f.y,d.p0.x,d.p0.y,d.p1.x,d.p1.y)&&(l=m,u={x:M[0],y:M[1],i:-1},r=d)}if(l===1/0)return!1;if(a=r.p1,l>0){var p=this.getPointsInTriangle_(f,u,r.p1,n);if(p.length){var g=1/0;for(e=0,o=p.length;e<o;++e){var _=p[e],w=Math.atan2(f.y-_.y,c.x-_.x);(w<g||w===g&&_.x<a.x)&&(g=w,a=_)}}}for(r=s.firstItem();r.p1.x!==a.x||r.p1.y!==a.y;)r=s.nextItem();var y={x:f.x,y:f.y,i:f.i,reflex:void 0},b={x:r.p1.x,y:r.p1.y,i:r.p1.i,reflex:void 0};return t.getNextItem().p0=y,this.insertItem_(f,r.p1,t,n),this.insertItem_(b,y,t,n),r.p1=b,t.setFirstItem(),s.concat(t),!0},Rn.prototype.triangulate_=function(t,i){for(var s=!1,h=this.isSimple_(t,i);t.getLength()>3;)if(h){if(!this.clipEars_(t,i,h,s)&&!this.classifyPoints_(t,i,s)&&!this.resolveSelfIntersections_(t,i,!0))break}else if(!this.clipEars_(t,i,h,s)&&!this.classifyPoints_(t,i,s)&&!this.resolveSelfIntersections_(t,i)){if(!(h=this.isSimple_(t,i))){this.splitPolygon_(t,i);break}s=!this.isClockwise_(t),this.classifyPoints_(t,i,s)}if(3===t.getLength()){var n=this.indices.length;this.indices[n++]=t.getPrevItem().p0.i,this.indices[n++]=t.getCurrItem().p0.i,this.indices[n++]=t.getNextItem().p0.i}},Rn.prototype.clipEars_=function(t,i,s,h){var n,r,e,o=this.indices.length,a=t.firstItem(),u=t.getPrevItem(),f=a,c=t.nextItem(),l=t.getNextItem(),v=!1;do{var d;n=f.p0,e=c.p1,!1===(r=f.p1).reflex&&(d=s?0===this.getPointsInTriangle_(n,r,e,i,!0).length:h?this.diagonalIsInside_(l.p1,e,r,n,u.p0):this.diagonalIsInside_(u.p0,n,r,e,l.p1),(s||0===this.getIntersections_({p0:n,p1:e},i).length)&&d&&(s||!1===n.reflex||!1===e.reflex||Ki.linearRingIsClockwise([u.p0.x,u.p0.y,n.x,n.y,r.x,r.y,e.x,e.y,l.p1.x,l.p1.y],0,10,2)===!h)&&(this.indices[o++]=n.i,this.indices[o++]=r.i,this.indices[o++]=e.i,this.removeItem_(f,c,t,i),c===a&&(a=l),v=!0)),u=t.getPrevItem(),f=t.getCurrItem(),c=t.nextItem(),l=t.getNextItem()}while(f!==a&&t.getLength()>3);return v},Rn.prototype.resolveSelfIntersections_=function(t,i,s){var h=t.firstItem();t.nextItem();var n=h,r=t.nextItem(),e=!1;do{var o=this.calculateIntersection_(n.p0,n.p1,r.p0,r.p1,s);if(o){var a,u=!1,f=this.indices.length,c=this.vertices.length/2,l=t.prevItem();if(t.removeItem(),i.remove(l),u=l===h,s?(o[0]===n.p0.x&&o[1]===n.p0.y?(t.prevItem(),r.p0=a=n.p0,i.remove(n),u=u||n===h):(n.p1=a=r.p1,i.remove(r),u=u||r===h),t.removeItem()):(a=this.createPoint_(o[0],o[1],c),n.p1=a,r.p0=a,i.update([Math.min(n.p0.x,n.p1.x),Math.min(n.p0.y,n.p1.y),Math.max(n.p0.x,n.p1.x),Math.max(n.p0.y,n.p1.y)],n),i.update([Math.min(r.p0.x,r.p1.x),Math.min(r.p0.y,r.p1.y),Math.max(r.p0.x,r.p1.x),Math.max(r.p0.y,r.p1.y)],r)),this.indices[f++]=l.p0.i,this.indices[f++]=l.p1.i,this.indices[f++]=a.i,e=!0,u)break}n=t.getPrevItem(),r=t.nextItem()}while(n!==h);return e},Rn.prototype.isSimple_=function(t,i){var s=t.firstItem(),h=s;do{if(this.getIntersections_(h,i).length)return!1;h=t.nextItem()}while(h!==s);return!0},Rn.prototype.isClockwise_=function(t){var i=2*t.getLength(),s=new Array(i),h=t.firstItem(),n=h,r=0;do{s[r++]=n.p0.x,s[r++]=n.p0.y,n=t.nextItem()}while(n!==h);return Ki.linearRingIsClockwise(s,0,i,2)},Rn.prototype.splitPolygon_=function(t,i){var s=t.firstItem(),h=s;do{var n=this.getIntersections_(h,i);if(n.length){var r=n[0],e=this.vertices.length/2,o=this.calculateIntersection_(h.p0,h.p1,r.p0,r.p1),a=this.createPoint_(o[0],o[1],e),u=new An,f=new Pn;this.insertItem_(a,h.p1,u,f),h.p1=a,i.update([Math.min(h.p0.x,a.x),Math.min(h.p0.y,a.y),Math.max(h.p0.x,a.x),Math.max(h.p0.y,a.y)],h);for(var c=t.nextItem();c!==r;)this.insertItem_(c.p0,c.p1,u,f),i.remove(c),t.removeItem(),c=t.getCurrItem();this.insertItem_(r.p0,a,u,f),r.p0=a,i.update([Math.min(r.p1.x,a.x),Math.min(r.p1.y,a.y),Math.max(r.p1.x,a.x),Math.max(r.p1.y,a.y)],r),this.classifyPoints_(t,i,!1),this.triangulate_(t,i),this.classifyPoints_(u,f,!1),this.triangulate_(u,f);break}h=t.nextItem()}while(h!==s)},Rn.prototype.createPoint_=function(t,i,s){var h=this.vertices.length;return this.vertices[h++]=t,this.vertices[h++]=i,{x:t,y:i,i:s,reflex:void 0}},Rn.prototype.insertItem_=function(t,i,s,h){var n={p0:t,p1:i};return s.insertItem(n),h&&h.insert([Math.min(t.x,i.x),Math.min(t.y,i.y),Math.max(t.x,i.x),Math.max(t.y,i.y)],n),n},Rn.prototype.removeItem_=function(t,i,s,h){s.getCurrItem()===i&&(s.removeItem(),t.p1=i.p1,h.remove(i),h.update([Math.min(t.p0.x,t.p1.x),Math.min(t.p0.y,t.p1.y),Math.max(t.p0.x,t.p1.x),Math.max(t.p0.y,t.p1.y)],t))},Rn.prototype.getPointsInTriangle_=function(t,i,s,h,n){var r,e,o,a,u=[],f=h.getInExtent([Math.min(t.x,i.x,s.x),Math.min(t.y,i.y,s.y),Math.max(t.x,i.x,s.x),Math.max(t.y,i.y,s.y)]);for(r=0,e=f.length;r<e;++r)for(o in f[r])"object"!=typeof(a=f[r][o])||n&&!a.reflex||a.x===t.x&&a.y===t.y||a.x===i.x&&a.y===i.y||a.x===s.x&&a.y===s.y||-1!==u.indexOf(a)||!Yi.linearRingContainsXY([t.x,t.y,i.x,i.y,s.x,s.y],0,6,2,a.x,a.y)||u.push(a);return u},Rn.prototype.getIntersections_=function(t,i,s){var h,n,r=t.p0,e=t.p1,o=i.getInExtent([Math.min(r.x,e.x),Math.min(r.y,e.y),Math.max(r.x,e.x),Math.max(r.y,e.y)]),a=[];for(h=0,n=o.length;h<n;++h){var u=o[h];t!==u&&(s||u.p0!==e||u.p1!==r)&&this.calculateIntersection_(r,e,u.p0,u.p1,s)&&a.push(u)}return a},Rn.prototype.calculateIntersection_=function(t,i,s,h,n){var r=(h.y-s.y)*(i.x-t.x)-(h.x-s.x)*(i.y-t.y);if(0!==r){var e=((h.x-s.x)*(t.y-s.y)-(h.y-s.y)*(t.x-s.x))/r,o=((i.x-t.x)*(t.y-s.y)-(i.y-t.y)*(t.x-s.x))/r;if(!n&&e>ln.EPSILON&&e<1-ln.EPSILON&&o>ln.EPSILON&&o<1-ln.EPSILON||n&&e>=0&&e<=1&&o>=0&&o<=1)return[t.x+e*(i.x-t.x),t.y+e*(i.y-t.y)]}},Rn.prototype.diagonalIsInside_=function(t,i,s,h,n){if(void 0===i.reflex||void 0===h.reflex)return!1;var r=(s.x-h.x)*(i.y-h.y)>(s.y-h.y)*(i.x-h.x),e=(n.x-h.x)*(i.y-h.y)<(n.y-h.y)*(i.x-h.x),o=(t.x-i.x)*(h.y-i.y)>(t.y-i.y)*(h.x-i.x),a=(s.x-i.x)*(h.y-i.y)<(s.y-i.y)*(h.x-i.x);return(h.reflex?e||r:e&&r)&&(i.reflex?a||o:a&&o)},Rn.prototype.drawMultiPolygon=function(t,i){var s,h,n,r,e=t.getEndss(),o=t.getStride(),a=this.indices.length,u=this.lineStringReplay.getCurrentIndex(),f=t.getFlatCoordinates(),c=0;for(s=0,h=e.length;s<h;++s){var l=e[s];if(l.length>0){var v=Ai(f,c,l[0],o,-this.origin[0],-this.origin[1]);if(v.length){var d,M=[];for(n=1,r=l.length;n<r;++n)l[n]!==l[n-1]&&(d=Ai(f,l[n-1],l[n],o,-this.origin[0],-this.origin[1]),M.push(d));this.lineStringReplay.drawPolygonCoordinates(v,M,o),this.drawCoordinates_(v,M,o)}}c=l[l.length-1]}this.indices.length>a&&(this.startIndices.push(a),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(a),this.state_.changed=!1)),this.lineStringReplay.getCurrentIndex()>u&&this.lineStringReplay.setPolygonStyle(i,u)},Rn.prototype.drawPolygon=function(t,i){var s=t.getEnds(),h=t.getStride();if(s.length>0){var n=t.getFlatCoordinates().map(Number),r=Ai(n,0,s[0],h,-this.origin[0],-this.origin[1]);if(r.length){var e,o,a,u=[];for(e=1,o=s.length;e<o;++e)s[e]!==s[e-1]&&(a=Ai(n,s[e-1],s[e],h,-this.origin[0],-this.origin[1]),u.push(a));this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.lineStringReplay.setPolygonStyle(i),this.lineStringReplay.drawPolygonCoordinates(r,u,h),this.drawCoordinates_(r,u,h)}}},Rn.prototype.finish=function(t){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),this.lineStringReplay.finish(t),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},Rn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer,h=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(i),t.deleteBuffer(s),h()}},Rn.prototype.setUpProgram=function(t,i){var s,h=i.getProgram(En.fragment,En.vertex);return this.defaultLocations_?s=this.defaultLocations_:(s=new Sn(t,h),this.defaultLocations_=s),i.useProgram(h),t.enableVertexAttribArray(s.a_position),t.vertexAttribPointer(s.a_position,2,$i.FLOAT,!1,8,0),s},Rn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position)},Rn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o=t.getParameter(t.DEPTH_FUNC),a=t.getParameter(t.DEPTH_WRITEMASK);if(h||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),fi.isEmpty(s))for(e=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)r=this.styleIndices_[n],this.setFillStyle_(t,this.styles_[n]),this.drawElements(t,i,r,e),e=r;else this.drawReplaySkipping_(t,i,s);h||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(a),t.depthFunc(o))},Rn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f;for(o=this.startIndices[1+(f=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setFillStyle_(t,this.styles_[r]),a=this.styleIndices_[r];f>=0&&this.startIndices[f]>=a;){if(e=this.startIndices[f],void 0===s[ui.getUid(u=this.startIndicesFeature[f]).toString()]&&u.getGeometry()&&(void 0===n||bi.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var c=h(u);if(c)return c}f--,o=e}},Rn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a;for(r=n=this.startIndices[1+(o=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setFillStyle_(t,this.styles_[h]),e=this.styleIndices_[h];o>=0&&this.startIndices[o]>=e;)a=this.startIndices[o],s[ui.getUid(this.startIndicesFeature[o]).toString()]&&(n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),r=a),o--,n=a;n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),n=r=e}},Rn.prototype.setFillStyle_=function(t,i){t.uniform4fv(this.defaultLocations_.u_color,i)},Rn.prototype.setFillStrokeStyle=function(t,i){var s=t?t.getColor():[0,0,0,0];if(s=s instanceof CanvasGradient||s instanceof CanvasPattern?ln.defaultFillStyle:dh.asArray(s).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultFillStyle,this.state_.fillColor&&yi.equals(s,this.state_.fillColor)||(this.state_.fillColor=s,this.state_.changed=!0,this.styles_.push(s)),i)this.lineStringReplay.setFillStrokeStyle(null,i);else{var h=new Cn({color:[0,0,0,0],lineWidth:0});this.lineStringReplay.setFillStrokeStyle(null,h)}};var Nn=function(t,i){this.space_=i,this.emptyBlocks_=[{x:0,y:0,width:t,height:t}],this.entries_={},this.context_=Cs(t,t),this.canvas_=this.context_.canvas};Nn.prototype.get=function(t){return this.entries_[t]||null},Nn.prototype.add=function(t,i,s,h,n){var r,e,o;for(e=0,o=this.emptyBlocks_.length;e<o;++e)if((r=this.emptyBlocks_[e]).width>=i+this.space_&&r.height>=s+this.space_){var a={offsetX:r.x+this.space_,offsetY:r.y+this.space_,image:this.canvas_};return this.entries_[t]=a,h.call(n,this.context_,r.x+this.space_,r.y+this.space_),this.split_(e,r,i+this.space_,s+this.space_),a}return null},Nn.prototype.split_=function(t,i,s,h){i.width-s>i.height-h?this.updateBlocks_(t,{x:i.x+s,y:i.y,width:i.width-s,height:i.height},{x:i.x,y:i.y+h,width:s,height:i.height-h}):this.updateBlocks_(t,{x:i.x+s,y:i.y,width:i.width-s,height:h},{x:i.x,y:i.y+h,width:i.width,height:i.height-h})},Nn.prototype.updateBlocks_=function(t,i,s){var h=[t,1];i.width>0&&i.height>0&&h.push(i),s.width>0&&s.height>0&&h.push(s),this.emptyBlocks_.splice.apply(this.emptyBlocks_,h)};var zn=function(t){var i=t||{};this.currentSize_=void 0!==i.initialSize?i.initialSize:ui.INITIAL_ATLAS_SIZE,this.maxSize_=void 0!==i.maxSize?i.maxSize:-1!=ui.MAX_ATLAS_SIZE?ui.MAX_ATLAS_SIZE:void 0!==ui.WEBGL_MAX_TEXTURE_SIZE?ui.WEBGL_MAX_TEXTURE_SIZE:2048,this.space_=void 0!==i.space?i.space:1,this.atlases_=[new Nn(this.currentSize_,this.space_)],this.currentHitSize_=this.currentSize_,this.hitAtlases_=[new Nn(this.currentHitSize_,this.space_)]};zn.prototype.getInfo=function(t){var i=this.getInfo_(this.atlases_,t);if(!i)return null;var s=this.getInfo_(this.hitAtlases_,t);return this.mergeInfos_(i,s)},zn.prototype.getInfo_=function(t,i){var s,h,n;for(h=0,n=t.length;h<n;++h)if(s=t[h].get(i))return s;return null},zn.prototype.mergeInfos_=function(t,i){return{offsetX:t.offsetX,offsetY:t.offsetY,image:t.image,hitImage:i.image}},zn.prototype.add=function(t,i,s,h,n,r){if(i+this.space_>this.maxSize_||s+this.space_>this.maxSize_)return null;var e=this.add_(!1,t,i,s,h,r);if(!e)return null;var o=this.add_(!0,t,i,s,void 0!==n?n:ui.nullFunction,r);return this.mergeInfos_(e,o)},zn.prototype.add_=function(t,i,s,h,n,r){var e,o,a,u,f=t?this.hitAtlases_:this.atlases_;for(a=0,u=f.length;a<u;++a){if(o=(e=f[a]).add(i,s,h,n,r))return o;var c;o||a!==u-1||(t?(c=Math.min(2*this.currentHitSize_,this.maxSize_),this.currentHitSize_=c):(c=Math.min(2*this.currentSize_,this.maxSize_),this.currentSize_=c),e=new Nn(c,this.space_),f.push(e),++u)}return null};var kn=function(t,i){gn.call(this,t,i),this.images_=[],this.textures_=[],this.measureCanvas_=Cs(0,0).canvas,this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:0,miterLimit:void 0,fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.atlases_={},this.currAtlas_=void 0,this.scale=1,this.opacity=1};ui.inherits(kn,gn),kn.prototype.drawText=function(t,i){if(this.text_){var s=null,h=2,n=2;switch(t.getType()){case"Point":case"MultiPoint":h=(s=t.getFlatCoordinates()).length,n=t.getStride();break;case"Circle":s=t.getCenter();break;case"LineString":s=t.getFlatMidpoint();break;case"MultiLineString":h=(s=t.getFlatMidpoints()).length;break;case"Polygon":s=t.getFlatInteriorPoint();break;case"MultiPolygon":h=(s=t.getFlatInteriorPoints()).length}this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var r,e,o,a,u,f,c,l,v=this.currAtlas_,d=this.text_.split("\n"),M=this.getTextSize_(d),m=Math.round(M[0]*this.textAlign_-this.offsetX_),p=Math.round(M[1]*this.textBaseline_-this.offsetY_),g=this.state_.lineWidth/2*this.state_.scale;for(r=0,e=d.length;r<e;++r)for(u=0,f=v.height*r,o=0,a=(c=d[r].split("")).length;o<a;++o){if(l=v.atlas.getInfo(c[o])){var _=l.image;this.anchorX=m-u,this.anchorY=p-f,this.originX=0===o?l.offsetX-g:l.offsetX,this.originY=l.offsetY,this.height=v.height,this.width=0===o||o===c.length-1?v.width[c[o]]+g:v.width[c[o]],this.imageHeight=_.height,this.imageWidth=_.width,0===this.images_.length?this.images_.push(_):ui.getUid(this.images_[this.images_.length-1])!=ui.getUid(_)&&(this.groupIndices.push(this.indices.length),this.images_.push(_)),this.drawText_(s,0,h,n)}u+=this.width}}},kn.prototype.getTextSize_=function(t){var i=this,s=this.currAtlas_,h=t.length*s.height;return[t.map((function(t){var h,n,r=0;for(h=0,n=t.length;h<n;++h){var e=t[h];s.width[e]||i.addCharToAtlas_(e),r+=s.width[e]?s.width[e]:0}return r})).reduce((function(t,i){return Math.max(t,i)})),h]},kn.prototype.drawText_=function(t,i,s,h){var n,r;for(n=i,r=s;n<r;n+=h)this.drawCoordinates(t,i,s,h)},kn.prototype.addCharToAtlas_=function(t){if(1===t.length){var i=this.currAtlas_,s=this.state_,h=this.measureCanvas_.getContext("2d");h.font=s.font;var n=Math.ceil(h.measureText(t).width*s.scale);i.atlas.add(t,n,i.height,(function(i,h,n){i.font=s.font,i.fillStyle=s.fillColor,i.strokeStyle=s.strokeColor,i.lineWidth=s.lineWidth,i.lineCap=s.lineCap,i.lineJoin=s.lineJoin,i.miterLimit=s.miterLimit,i.textAlign="left",i.textBaseline="top",ts.CANVAS_LINE_DASH&&s.lineDash&&(i.setLineDash(s.lineDash),i.lineDashOffset=s.lineDashOffset),1!==s.scale&&i.setTransform(s.scale,0,0,s.scale,0,0),s.strokeColor&&i.strokeText(t,h,n),s.fillColor&&i.fillText(t,h,n)}))&&(i.width[t]=n)}},kn.prototype.finish=function(t){var i=t.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices=this.groupIndices,this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.createTextures(this.textures_,this.images_,{},i),this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:0,miterLimit:void 0,fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.images_=null,this.atlases_={},this.currAtlas_=void 0,gn.prototype.finish.call(this,t)},kn.prototype.setTextStyle=function(t){var i=this.state_,s=t.getFill(),h=t.getStroke();if(t&&t.getText()&&(s||h)){if(s){var n=s.getColor();i.fillColor=Mh.asColorLike(n||ln.defaultFillStyle)}else i.fillColor=null;if(h){var r=h.getColor();i.strokeColor=Mh.asColorLike(r||ln.defaultStrokeStyle),i.lineWidth=h.getWidth()||ln.defaultLineWidth,i.lineCap=h.getLineCap()||ln.defaultLineCap,i.lineDashOffset=h.getLineDashOffset()||ln.defaultLineDashOffset,i.lineJoin=h.getLineJoin()||ln.defaultLineJoin,i.miterLimit=h.getMiterLimit()||ln.defaultMiterLimit;var e=h.getLineDash();i.lineDash=e?e.slice():ln.defaultLineDash}else i.strokeColor=null,i.lineWidth=0;i.font=t.getFont()||ln.defaultFont,i.scale=t.getScale()||1,this.text_=t.getText();var o=Yh.TEXT_ALIGN[t.getTextAlign()],a=Yh.TEXT_ALIGN[t.getTextBaseline()];this.textAlign_=void 0===o?ln.defaultTextAlign:o,this.textBaseline_=void 0===a?ln.defaultTextBaseline:a,this.offsetX_=t.getOffsetX()||0,this.offsetY_=t.getOffsetY()||0,this.rotateWithView=!!t.getRotateWithView(),this.rotation=t.getRotation()||0,this.currAtlas_=this.getAtlas_(i)}else this.text_=""},kn.prototype.getAtlas_=function(t){var i,s=[];for(i in t)(t[i]||0===t[i])&&(Array.isArray(t[i])?s=s.concat(t[i]):s.push(t[i]));var h=this.calculateHash_(s);if(!this.atlases_[h]){var n=this.measureCanvas_.getContext("2d");n.font=t.font;var r=Math.ceil((1.5*n.measureText("M").width+t.lineWidth/2)*t.scale);this.atlases_[h]={atlas:new zn({space:t.lineWidth+1}),width:{},height:r}}return this.atlases_[h]},kn.prototype.calculateHash_=function(t){var i,s,h="";for(i=0,s=t.length;i<s;++i)h+=t[i];return h},kn.prototype.getTextures=function(){return this.textures_},kn.prototype.getHitDetectionTextures=function(){return this.textures_};var Tn=function(t,i,s){Uh.call(this),this.maxExtent_=i,this.tolerance_=t,this.renderBuffer_=s,this.replaysByZIndex_={}};ui.inherits(Tn,Uh),Tn.prototype.addDeclutter=function(){},Tn.prototype.getDeleteResourcesFunction=function(t){var i,s=[];for(i in this.replaysByZIndex_){var h,n=this.replaysByZIndex_[i];for(h in n)s.push(n[h].getDeleteResourcesFunction(t))}return function(){for(var t,i=s.length,h=0;h<i;h++)t=s[h].apply(this,arguments);return t}},Tn.prototype.finish=function(t){var i;for(i in this.replaysByZIndex_){var s,h=this.replaysByZIndex_[i];for(s in h)h[s].finish(t)}},Tn.prototype.getReplay=function(t,i){var s=void 0!==t?t.toString():"0",h=this.replaysByZIndex_[s];void 0===h&&(this.replaysByZIndex_[s]=h={});var n=h[i];return void 0===n&&(n=new(0,Tn.BATCH_CONSTRUCTORS_[i])(this.tolerance_,this.maxExtent_),h[i]=n),n},Tn.prototype.isEmpty=function(){return fi.isEmpty(this.replaysByZIndex_)},Tn.prototype.replay=function(t,i,s,h,n,r,e,o){var a,u,f,c,l,v,d=Object.keys(this.replaysByZIndex_).map(Number);for(d.sort(yi.numberSafeCompareFunction),a=0,u=d.length;a<u;++a)for(l=this.replaysByZIndex_[d[a].toString()],f=0,c=Yh.ORDER.length;f<c;++f)void 0!==(v=l[Yh.ORDER[f]])&&v.replay(t,i,s,h,n,r,e,o,void 0,!1)},Tn.prototype.replayHitDetection_=function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v,d,M,m,p=Object.keys(this.replaysByZIndex_).map(Number);for(p.sort((function(t,i){return i-t})),c=0,l=p.length;c<l;++c)for(d=this.replaysByZIndex_[p[c].toString()],v=Yh.ORDER.length-1;v>=0;--v)if(void 0!==(M=d[Yh.ORDER[v]])&&(m=M.replay(t,i,s,h,n,r,e,o,a,u,f)))return m},Tn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e,o,a,u){var f,c=i.getGL();return c.bindFramebuffer(c.FRAMEBUFFER,i.getHitDetectionFramebuffer()),void 0!==this.renderBuffer_&&(f=bi.buffer(bi.createOrUpdateFromCoordinate(t),h*this.renderBuffer_)),this.replayHitDetection_(i,t,h,n,Tn.HIT_DETECTION_SIZE_,e,o,a,(function(t){var i=new Uint8Array(4);if(c.readPixels(0,0,1,1,c.RGBA,c.UNSIGNED_BYTE,i),i[3]>0){var s=u(t);if(s)return s}}),!0,f)},Tn.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n,r,e,o,a){var u=i.getGL();return u.bindFramebuffer(u.FRAMEBUFFER,i.getHitDetectionFramebuffer()),void 0!==this.replayHitDetection_(i,t,h,n,Tn.HIT_DETECTION_SIZE_,e,o,a,(function(){var t=new Uint8Array(4);return u.readPixels(0,0,1,1,u.RGBA,u.UNSIGNED_BYTE,t),t[3]>0}),!1)},Tn.HIT_DETECTION_SIZE_=[1,1],Tn.BATCH_CONSTRUCTORS_={Circle:dn,Image:_n,LineString:xn,Polygon:Rn,Text:kn};var On=function(t,i,s,h,n,r,e){mh.call(this),this.context_=t,this.center_=i,this.extent_=r,this.pixelRatio_=e,this.size_=n,this.rotation_=h,this.resolution_=s,this.imageStyle_=null,this.fillStyle_=null,this.strokeStyle_=null,this.textStyle_=null};ui.inherits(On,mh),On.prototype.drawText_=function(t,i){var s=this.context_,h=t.getReplay(0,"Text");h.setTextStyle(this.textStyle_),h.drawText(i,null),h.finish(s),h.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),h.getDeleteResourcesFunction(s)()},On.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},On.prototype.drawGeometry=function(t){switch(t.getType()){case"Point":this.drawPoint(t,null);break;case"LineString":this.drawLineString(t,null);break;case"Polygon":this.drawPolygon(t,null);break;case"MultiPoint":this.drawMultiPoint(t,null);break;case"MultiLineString":this.drawMultiLineString(t,null);break;case"MultiPolygon":this.drawMultiPolygon(t,null);break;case"GeometryCollection":this.drawGeometryCollection(t,null);break;case"Circle":this.drawCircle(t,null)}},On.prototype.drawFeature=function(t,i){var s=i.getGeometryFunction()(t);s&&bi.intersects(this.extent_,s.getExtent())&&(this.setStyle(i),this.drawGeometry(s))},On.prototype.drawGeometryCollection=function(t){var i,s,h=t.getGeometriesArray();for(i=0,s=h.length;i<s;++i)this.drawGeometry(h[i])},On.prototype.drawPoint=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Image");n.setImageStyle(this.imageStyle_),n.drawPoint(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiPoint=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Image");n.setImageStyle(this.imageStyle_),n.drawMultiPoint(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawLineString=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"LineString");n.setFillStrokeStyle(null,this.strokeStyle_),n.drawLineString(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiLineString=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"LineString");n.setFillStrokeStyle(null,this.strokeStyle_),n.drawMultiLineString(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawPolygon=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Polygon");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawPolygon(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiPolygon=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Polygon");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawMultiPolygon(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawCircle=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Circle");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawCircle(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.setImageStyle=function(t){this.imageStyle_=t},On.prototype.setFillStrokeStyle=function(t,i){this.fillStyle_=t,this.strokeStyle_=i},On.prototype.setTextStyle=function(t){this.textStyle_=t};var Ln={};Ln.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_texture, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n gl_FragColor.a = texColor.a * u_opacity;\n}\n":"precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}"),Ln.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\n\nuniform mat4 u_texCoordMatrix;\nuniform mat4 u_projectionMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.);\n v_texCoord = (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}");var In=function(t,i){this.u_texCoordMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texCoordMatrix":"d"),this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"e"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"f"),this.u_texture=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texture":"g"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"b"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"c")},Fn=function(t,i){gh.call(this,i),this.mapRenderer=t,this.arrayBuffer_=new vn([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0,this.texCoordMatrix=Ii.create(),this.projectionMatrix=Ii.create(),this.tmpMat4_=un(),this.defaultLocations_=null};ui.inherits(Fn,gh),Fn.prototype.bindFramebuffer=function(t,i){var s=this.mapRenderer.getGL();if(void 0===this.framebufferDimension||this.framebufferDimension!=i){var h=function(t,i,s){t.isContextLost()||(t.deleteFramebuffer(i),t.deleteTexture(s))}.bind(null,s,this.framebuffer,this.texture);t.postRenderFunctions.push(h);var n=pn.createEmptyTexture(s,i,i),r=s.createFramebuffer();s.bindFramebuffer($i.FRAMEBUFFER,r),s.framebufferTexture2D($i.FRAMEBUFFER,$i.COLOR_ATTACHMENT0,$i.TEXTURE_2D,n,0),this.texture=n,this.framebuffer=r,this.framebufferDimension=i}else s.bindFramebuffer($i.FRAMEBUFFER,this.framebuffer)},Fn.prototype.composeFrame=function(t,i,s){this.dispatchComposeEvent_("precompose",s,t),s.bindBuffer($i.ARRAY_BUFFER,this.arrayBuffer_);var h,n=s.getGL(),r=s.getProgram(Ln.fragment,Ln.vertex);this.defaultLocations_?h=this.defaultLocations_:(h=new In(n,r),this.defaultLocations_=h),s.useProgram(r)&&(n.enableVertexAttribArray(h.a_position),n.vertexAttribPointer(h.a_position,2,$i.FLOAT,!1,16,0),n.enableVertexAttribArray(h.a_texCoord),n.vertexAttribPointer(h.a_texCoord,2,$i.FLOAT,!1,16,8),n.uniform1i(h.u_texture,0)),n.uniformMatrix4fv(h.u_texCoordMatrix,!1,fn(this.tmpMat4_,this.getTexCoordMatrix())),n.uniformMatrix4fv(h.u_projectionMatrix,!1,fn(this.tmpMat4_,this.getProjectionMatrix())),n.uniform1f(h.u_opacity,i.opacity),n.bindTexture($i.TEXTURE_2D,this.getTexture()),n.drawArrays($i.TRIANGLE_STRIP,0,4),this.dispatchComposeEvent_("postcompose",s,t)},Fn.prototype.dispatchComposeEvent_=function(t,i,s){var h=this.getLayer();if(h.hasListener(t)){var n=s.viewState,r=new On(i,n.center,n.resolution,n.rotation,s.size,s.extent,s.pixelRatio),e=new uh(t,r,s,null,i);h.dispatchEvent(e)}},Fn.prototype.getTexCoordMatrix=function(){return this.texCoordMatrix},Fn.prototype.getTexture=function(){return this.texture},Fn.prototype.getProjectionMatrix=function(){return this.projectionMatrix},Fn.prototype.handleWebGLContextLost=function(){this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0},Fn.prototype.prepareFrame=function(){},Fn.prototype.forEachLayerAtPixel=function(){};var Dn=function(t,i){Fn.call(this,t,i),this.image_=null,this.hitCanvasContext_=null,this.hitTransformationMatrix_=null};ui.inherits(Dn,Fn),Dn.handles=function(t,i){return"webgl"===t&&"IMAGE"===i.getType()},Dn.create=function(t,i){return new Dn(t,i)},Dn.prototype.createTexture_=function(t){var i=t.getImage(),s=this.mapRenderer.getGL();return pn.createTexture(s,i,$i.CLAMP_TO_EDGE,$i.CLAMP_TO_EDGE)},Dn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=this.getLayer();return r.getSource().forEachFeatureAtCoordinate(t,i.viewState.resolution,i.viewState.rotation,s,i.skippedFeatureUids,(function(t){return h.call(n,t,r)}))},Dn.prototype.prepareFrame=function(t,i){var s=this.mapRenderer.getGL(),h=t.pixelRatio,n=t.viewState,r=n.center,e=n.resolution,o=n.rotation,a=this.image_,u=this.texture,f=this.getLayer().getSource(),c=t.viewHints,l=t.extent;if(void 0!==i.extent&&(l=bi.getIntersection(l,i.extent)),!c[0]&&!c[1]&&!bi.isEmpty(l)){var v=n.projection;if(!ui.ENABLE_RASTER_REPROJECTION){var d=f.getProjection();d&&(v=d)}var M=f.getImage(l,e,h,v);if(M&&this.loadImage(M)&&(a=M,u=this.createTexture_(M),this.texture)){var m=function(t,i){t.isContextLost()||t.deleteTexture(i)}.bind(null,s,this.texture);t.postRenderFunctions.push(m)}}if(a){var p=this.mapRenderer.getContext().getCanvas();this.updateProjectionMatrix_(p.width,p.height,h,r,e,o,a.getExtent()),this.hitTransformationMatrix_=null;var g=this.texCoordMatrix;Ii.reset(g),Ii.scale(g,1,-1),Ii.translate(g,0,-1),this.image_=a,this.texture=u,this.updateLogos(t,f)}return!!a},Dn.prototype.updateProjectionMatrix_=function(t,i,s,h,n,r,e){var o=t*n,a=i*n,u=this.projectionMatrix;Ii.reset(u),Ii.scale(u,2*s/o,2*s/a),Ii.rotate(u,-r),Ii.translate(u,e[0]-h[0],e[1]-h[1]),Ii.scale(u,(e[2]-e[0])/2,(e[3]-e[1])/2),Ii.translate(u,1,1)},Dn.prototype.hasFeatureAtCoordinate=function(t,i){return void 0!==this.forEachFeatureAtCoordinate(t,i,0,xi.TRUE,this)},Dn.prototype.forEachLayerAtPixel=function(t,i,s,h){if(this.image_&&this.image_.getImage()){if(this.getLayer().getSource().forEachFeatureAtCoordinate!==ui.nullFunction){var n=Ii.apply(i.pixelToCoordinateTransform,t.slice());return this.forEachFeatureAtCoordinate(n,i,0,xi.TRUE,this)?s.call(h,this.getLayer(),null):void 0}var r=[this.image_.getImage().width,this.image_.getImage().height];this.hitTransformationMatrix_||(this.hitTransformationMatrix_=this.getHitTransformationMatrix_(i.size,r));var e=Ii.apply(this.hitTransformationMatrix_,t.slice());if(!(e[0]<0||e[0]>r[0]||e[1]<0||e[1]>r[1])){this.hitCanvasContext_||(this.hitCanvasContext_=Cs(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.image_.getImage(),e[0],e[1],1,1,0,0,1,1);var o=this.hitCanvasContext_.getImageData(0,0,1,1).data;return o[3]>0?s.call(h,this.getLayer(),o):void 0}}},Dn.prototype.getHitTransformationMatrix_=function(t,i){var s=Ii.create();Ii.translate(s,-1,-1),Ii.scale(s,2/t[0],2/t[1]),Ii.translate(s,0,t[1]),Ii.scale(s,1,-1);var h=Ii.invert(this.projectionMatrix.slice()),n=Ii.create();return Ii.translate(n,0,i[1]),Ii.scale(n,1,-1),Ii.scale(n,i[0]/2,i[1]/2),Ii.translate(n,1,1),Ii.multiply(n,h),Ii.multiply(n,s),n};var Gn=function(t,i){Eh.call(this,t,i),this.canvas_=document.createElement("CANVAS"),this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=Gs.CLASS_UNSELECTABLE,t.insertBefore(this.canvas_,t.childNodes[0]||null),this.clipTileCanvasWidth_=0,this.clipTileCanvasHeight_=0,this.clipTileContext_=Cs(),this.renderedVisible_=!0,this.gl_=$i.getContext(this.canvas_,{antialias:!0,depth:!0,failIfMajorPerformanceCaveat:!0,preserveDrawingBuffer:!1,stencil:!0}),this.context_=new pn(this.canvas_,this.gl_),ci.listen(this.canvas_,"webglcontextlost",this.handleWebGLContextLost,this),ci.listen(this.canvas_,"webglcontextrestored",this.handleWebGLContextRestored,this),this.textureCache_=new fh,this.focus_=null,this.tileTextureQueue_=new ms(function(t){var i=t[1],s=t[2],h=i[0]-this.focus_[0],n=i[1]-this.focus_[1];return 65536*Math.log(s)+Math.sqrt(h*h+n*n)/s}.bind(this),(function(t){return t[0].getKey()})),this.loadNextTileTexture_=function(){if(!this.tileTextureQueue_.isEmpty()){this.tileTextureQueue_.reprioritize();var t=this.tileTextureQueue_.dequeue();this.bindTileTexture(t[0],t[3],t[4],$i.LINEAR,$i.LINEAR)}return!1}.bind(this),this.textureCacheFrameMarkerCount_=0,this.initializeGL_()};ui.inherits(Gn,Eh),Gn.handles=function(t){return ts.WEBGL&&"webgl"===t},Gn.create=function(t,i){return new Gn(t,i)},Gn.prototype.bindTileTexture=function(t,i,s,h,n){var r=this.getGL(),e=t.getKey();if(this.textureCache_.containsKey(e)){var o=this.textureCache_.get(e);r.bindTexture($i.TEXTURE_2D,o.texture),o.magFilter!=h&&(r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MAG_FILTER,h),o.magFilter=h),o.minFilter!=n&&(r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MIN_FILTER,n),o.minFilter=n)}else{var a=r.createTexture();if(r.bindTexture($i.TEXTURE_2D,a),s>0){var u=this.clipTileContext_.canvas,f=this.clipTileContext_;this.clipTileCanvasWidth_!==i[0]||this.clipTileCanvasHeight_!==i[1]?(u.width=i[0],u.height=i[1],this.clipTileCanvasWidth_=i[0],this.clipTileCanvasHeight_=i[1]):f.clearRect(0,0,i[0],i[1]),f.drawImage(t.getImage(),s,s,i[0],i[1],0,0,i[0],i[1]),r.texImage2D($i.TEXTURE_2D,0,$i.RGBA,$i.RGBA,$i.UNSIGNED_BYTE,u)}else r.texImage2D($i.TEXTURE_2D,0,$i.RGBA,$i.RGBA,$i.UNSIGNED_BYTE,t.getImage());r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MAG_FILTER,h),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MIN_FILTER,n),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_S,$i.CLAMP_TO_EDGE),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_T,$i.CLAMP_TO_EDGE),this.textureCache_.set(e,{texture:a,magFilter:h,minFilter:n})}},Gn.prototype.dispatchComposeEvent_=function(t,i){var s=this.getMap();if(s.hasListener(t)){var h=this.context_,n=i.viewState,r=new On(h,n.center,n.resolution,n.rotation,i.size,i.extent,i.pixelRatio),e=new uh(t,r,i,null,h);s.dispatchEvent(e)}},Gn.prototype.disposeInternal=function(){var t=this.getGL();t.isContextLost()||this.textureCache_.forEach((function(i){i&&t.deleteTexture(i.texture)})),this.context_.dispose(),Eh.prototype.disposeInternal.call(this)},Gn.prototype.expireCache_=function(t,i){for(var s,h=this.getGL();this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>ui.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK;){if(s=this.textureCache_.peekLast())h.deleteTexture(s.texture);else{if(+this.textureCache_.peekLastKey()==i.index)break;--this.textureCacheFrameMarkerCount_}this.textureCache_.pop()}},Gn.prototype.getContext=function(){return this.context_},Gn.prototype.getGL=function(){return this.gl_},Gn.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_},Gn.prototype.getType=function(){return"webgl"},Gn.prototype.handleWebGLContextLost=function(t){t.preventDefault(),this.textureCache_.clear(),this.textureCacheFrameMarkerCount_=0;var i=this.getLayerRenderers();for(var s in i)i[s].handleWebGLContextLost()},Gn.prototype.handleWebGLContextRestored=function(){this.initializeGL_(),this.getMap().render()},Gn.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture($i.TEXTURE0),t.blendFuncSeparate($i.SRC_ALPHA,$i.ONE_MINUS_SRC_ALPHA,$i.ONE,$i.ONE_MINUS_SRC_ALPHA),t.disable($i.CULL_FACE),t.disable($i.DEPTH_TEST),t.disable($i.SCISSOR_TEST),t.disable($i.STENCIL_TEST)},Gn.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())},Gn.prototype.renderFrame=function(t){var i=this.getContext(),s=this.getGL();if(s.isContextLost())return!1;if(!t)return this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1),!1;this.focus_=t.focus,this.textureCache_.set((-t.index).toString(),null),++this.textureCacheFrameMarkerCount_,this.dispatchComposeEvent_("precompose",t);var h=[],n=t.layerStatesArray;yi.stableSort(n,Eh.sortByZIndex);var r,e,o,a=t.viewState.resolution;for(r=0,e=n.length;r<e;++r)Ws.visibleAtResolution(o=n[r],a)&&"ready"==o.sourceState&&this.getLayerRenderer(o.layer).prepareFrame(t,o,i)&&h.push(o);var u=t.size[0]*t.pixelRatio,f=t.size[1]*t.pixelRatio;for(this.canvas_.width==u&&this.canvas_.height==f||(this.canvas_.width=u,this.canvas_.height=f),s.bindFramebuffer($i.FRAMEBUFFER,null),s.clearColor(0,0,0,0),s.clear($i.COLOR_BUFFER_BIT),s.enable($i.BLEND),s.viewport(0,0,this.canvas_.width,this.canvas_.height),r=0,e=h.length;r<e;++r)this.getLayerRenderer((o=h[r]).layer).composeFrame(t,o,i);this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.calculateMatrices2D(t),this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>ui.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK&&t.postRenderFunctions.push(this.expireCache_.bind(this)),this.tileTextureQueue_.isEmpty()||(t.postRenderFunctions.push(this.loadNextTileTexture_),t.animate=!0),this.dispatchComposeEvent_("postcompose",t),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)},Gn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o;if(this.getGL().isContextLost())return!1;var a,u=i.viewState,f=i.layerStatesArray;for(a=f.length-1;a>=0;--a){var c=f[a],l=c.layer;if(Ws.visibleAtResolution(c,u.resolution)&&r.call(e,l)&&(o=this.getLayerRenderer(l).forEachFeatureAtCoordinate(t,i,s,h,n)))return o}},Gn.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n){var r=!1;if(this.getGL().isContextLost())return!1;var e,o=i.viewState,a=i.layerStatesArray;for(e=a.length-1;e>=0;--e){var u=a[e],f=u.layer;if(Ws.visibleAtResolution(u,o.resolution)&&h.call(n,f)&&(r=this.getLayerRenderer(f).hasFeatureAtCoordinate(t,i)))return!0}return r},Gn.prototype.forEachLayerAtPixel=function(t,i,s,h,n){if(this.getGL().isContextLost())return!1;var r,e,o=i.viewState,a=i.layerStatesArray;for(e=a.length-1;e>=0;--e){var u=a[e],f=u.layer;if(Ws.visibleAtResolution(u,o.resolution)&&n.call(h,f)&&(r=this.getLayerRenderer(f).forEachLayerAtPixel(t,i,s,h)))return r}};var Wn={};Wn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n":"precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}"),Wn.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}");var Vn=function(t,i){this.u_tileOffset=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_tileOffset":"d"),this.u_texture=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texture":"e"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"b"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"c")},jn=function(t,i){Fn.call(this,t,i),this.fragmentShader_=Wn.fragment,this.vertexShader_=Wn.vertex,this.locations_=null,this.renderArrayBuffer_=new vn([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]),this.renderedTileRange_=null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,this.tmpSize_=[0,0]};ui.inherits(jn,Fn),jn.handles=function(t,i){return"webgl"===t&&"TILE"===i.getType()},jn.create=function(t,i){return new jn(t,i)},jn.prototype.disposeInternal=function(){this.mapRenderer.getContext().deleteBuffer(this.renderArrayBuffer_),Fn.prototype.disposeInternal.call(this)},jn.prototype.createLoadedTileFinder=function(t,i,s){var h=this.mapRenderer;return function(n,r){return t.forEachLoadedTile(i,n,r,(function(t){var i=h.isTileTextureLoaded(t);return i&&(s[n]||(s[n]={}),s[n][t.tileCoord.toString()]=t),i}))}},jn.prototype.handleWebGLContextLost=function(){Fn.prototype.handleWebGLContextLost.call(this),this.locations_=null},jn.prototype.prepareFrame=function(t,i,s){var h,n=this.mapRenderer,r=s.getGL(),e=t.viewState,o=e.projection,a=this.getLayer(),u=a.getSource(),f=u.getTileGridForProjection(o),c=f.getZForResolution(e.resolution),l=f.getResolution(c),v=u.getTilePixelSize(c,t.pixelRatio,o),d=v[0]/Os(f.getTileSize(c),this.tmpSize_)[0],M=l/d,m=u.getTilePixelRatio(d)*u.getGutter(o),p=e.center,g=t.extent,_=f.getTileRangeForExtentAndZ(g,c);if(this.renderedTileRange_&&this.renderedTileRange_.equals(_)&&this.renderedRevision_==u.getRevision())h=this.renderedFramebufferExtent_;else{var w=_.getSize(),y=Math.max(w[0]*v[0],w[1]*v[1]),b=_i.roundUpToPowerOfTwo(y),x=M*b,E=f.getOrigin(c),S=E[0]+_.minX*v[0]*M,C=E[1]+_.minY*v[1]*M;h=[S,C,S+x,C+x],this.bindFramebuffer(t,b),r.viewport(0,0,b,b),r.clearColor(0,0,0,0),r.clear($i.COLOR_BUFFER_BIT),r.disable($i.BLEND);var A=s.getProgram(this.fragmentShader_,this.vertexShader_);s.useProgram(A),this.locations_||(this.locations_=new Vn(r,A)),s.bindBuffer($i.ARRAY_BUFFER,this.renderArrayBuffer_),r.enableVertexAttribArray(this.locations_.a_position),r.vertexAttribPointer(this.locations_.a_position,2,$i.FLOAT,!1,16,0),r.enableVertexAttribArray(this.locations_.a_texCoord),r.vertexAttribPointer(this.locations_.a_texCoord,2,$i.FLOAT,!1,16,8),r.uniform1i(this.locations_.u_texture,0);var P={};P[c]={};var R,N,z,k,T,O,L=this.createLoadedTileFinder(u,o,P),I=a.getUseInterimTilesOnError(),F=!0,D=bi.createEmpty(),G=new Ch(0,0,0,0);for(k=_.minX;k<=_.maxX;++k)for(T=_.minY;T<=_.maxY;++T)if(N=u.getTile(c,k,T,d,o),void 0===i.extent||(O=f.getTileCoordExtent(N.tileCoord,D),bi.intersects(O,i.extent))){if(2==(z=N.getState())||4==z||3==z&&!I||(N=N.getInterimTile()),2==(z=N.getState())){if(n.isTileTextureLoaded(N)){P[c][N.tileCoord.toString()]=N;continue}}else if(4==z||3==z&&!I)continue;F=!1,f.forEachTileCoordParentTileRange(N.tileCoord,L,null,G,D)||(R=f.getTileCoordChildTileRange(N.tileCoord,G,D))&&L(c+1,R)}var W=Object.keys(P).map(Number);W.sort(yi.numberSafeCompareFunction);var V,j,U,X,q=new Float32Array(4);for(V=0,j=W.length;V<j;++V)for(U in X=P[W[V]])O=f.getTileCoordExtent((N=X[U]).tileCoord,D),q[0]=2*(O[2]-O[0])/x,q[1]=2*(O[3]-O[1])/x,q[2]=2*(O[0]-h[0])/x-1,q[3]=2*(O[1]-h[1])/x-1,r.uniform4fv(this.locations_.u_tileOffset,q),n.bindTileTexture(N,v,m*d,$i.LINEAR,$i.LINEAR),r.drawArrays($i.TRIANGLE_STRIP,0,4);F?(this.renderedTileRange_=_,this.renderedFramebufferExtent_=h,this.renderedRevision_=u.getRevision()):(this.renderedTileRange_=null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,t.animate=!0)}this.updateUsedTiles(t.usedTiles,u,c,_);var Y=n.getTileTextureQueue();this.manageTilePyramid(t,u,f,d,o,g,c,a.getPreload(),(function(t){2!=t.getState()||n.isTileTextureLoaded(t)||Y.isKeyQueued(t.getKey())||Y.enqueue([t,f.getTileCoordCenter(t.tileCoord),f.getResolution(t.tileCoord[0]),v,m*d])}),this),this.scheduleExpireCache(t,u),this.updateLogos(t,u);var B=this.texCoordMatrix;return Ii.reset(B),Ii.translate(B,(Math.round(p[0]/l)*l-h[0])/(h[2]-h[0]),(Math.round(p[1]/l)*l-h[1])/(h[3]-h[1])),0!==e.rotation&&Ii.rotate(B,e.rotation),Ii.scale(B,t.size[0]*e.resolution/(h[2]-h[0]),t.size[1]*e.resolution/(h[3]-h[1])),Ii.translate(B,-.5,-.5),!0},jn.prototype.forEachLayerAtPixel=function(t,i,s,h){if(this.framebuffer){var n=Ii.apply(this.texCoordMatrix,[t[0]/i.size[0],(i.size[1]-t[1])/i.size[1]].slice()),r=[n[0]*this.framebufferDimension,n[1]*this.framebufferDimension],e=this.mapRenderer.getContext().getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer);var o=new Uint8Array(4);return e.readPixels(r[0],r[1],1,1,e.RGBA,e.UNSIGNED_BYTE,o),o[3]>0?s.call(h,this.getLayer(),o):void 0}};var Un=function(t,i){Fn.call(this,t,i),this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bi.createEmpty(),this.renderedRenderOrder_=null,this.replayGroup_=null,this.layerState_=null};ui.inherits(Un,Fn),Un.handles=function(t,i){return"webgl"===t&&"VECTOR"===i.getType()},Un.create=function(t,i){return new Un(t,i)},Un.prototype.composeFrame=function(t,i,s){this.layerState_=i;var h=t.viewState,n=this.replayGroup_,r=t.size,e=t.pixelRatio,o=this.mapRenderer.getGL();n&&!n.isEmpty()&&(o.enable(o.SCISSOR_TEST),o.scissor(0,0,r[0]*e,r[1]*e),n.replay(s,h.center,h.resolution,h.rotation,r,e,i.opacity,i.managed?t.skippedFeatureUids:{}),o.disable(o.SCISSOR_TEST))},Un.prototype.disposeInternal=function(){var t=this.replayGroup_;if(t){var i=this.mapRenderer.getContext();t.getDeleteResourcesFunction(i)(),this.replayGroup_=null}Fn.prototype.disposeInternal.call(this)},Un.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){if(this.replayGroup_&&this.layerState_){var r=this.mapRenderer.getContext(),e=i.viewState,o=this.getLayer(),a={};return this.replayGroup_.forEachFeatureAtCoordinate(t,r,e.center,e.resolution,e.rotation,i.size,i.pixelRatio,this.layerState_.opacity,{},(function(t){var i=ui.getUid(t).toString();if(!(i in a))return a[i]=!0,h.call(n,t,o)}))}},Un.prototype.hasFeatureAtCoordinate=function(t,i){if(this.replayGroup_&&this.layerState_){var s=this.mapRenderer.getContext(),h=i.viewState;return this.replayGroup_.hasFeatureAtCoordinate(t,s,h.center,h.resolution,h.rotation,i.size,i.pixelRatio,this.layerState_.opacity,i.skippedFeatureUids)}return!1},Un.prototype.forEachLayerAtPixel=function(t,i,s,h){var n=Ii.apply(i.pixelToCoordinateTransform,t.slice());return this.hasFeatureAtCoordinate(n,i)?s.call(h,this.getLayer(),null):void 0},Un.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},Un.prototype.prepareFrame=function(t,i,s){var h=this.getLayer(),n=h.getSource();this.updateLogos(t,n);var r=t.viewHints[0],e=t.viewHints[1],o=h.getUpdateWhileAnimating(),a=h.getUpdateWhileInteracting();if(!this.dirty_&&!o&&r||!a&&e)return!0;var u=t.extent,f=t.viewState,c=f.projection,l=f.resolution,v=t.pixelRatio,d=h.getRevision(),M=h.getRenderBuffer(),m=h.getRenderOrder();void 0===m&&(m=tn.defaultOrder);var p=bi.buffer(u,M*l);if(!this.dirty_&&this.renderedResolution_==l&&this.renderedRevision_==d&&this.renderedRenderOrder_==m&&bi.containsExtent(this.renderedExtent_,p))return!0;this.replayGroup_&&t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(s)),this.dirty_=!1;var g=new Tn(tn.getTolerance(l,v),p,h.getRenderBuffer());n.loadFeatures(p,l,c);var _=function(t){var i,s=t.getStyleFunction();if(s?i=s.call(t,l):(s=h.getStyleFunction())&&(i=s(t,l)),i){var n=this.renderFeature(t,l,v,i,g);this.dirty_=this.dirty_||n}};if(m){var w=[];n.forEachFeatureInExtent(p,(function(t){w.push(t)}),this),w.sort(m),w.forEach(_,this)}else n.forEachFeatureInExtent(p,_,this);return g.finish(s),this.renderedResolution_=l,this.renderedRevision_=d,this.renderedRenderOrder_=m,this.renderedExtent_=p,this.replayGroup_=g,!0},Un.prototype.renderFeature=function(t,i,s,h,n){if(!h)return!1;var r=!1;if(Array.isArray(h))for(var e=h.length-1;e>=0;--e)r=tn.renderFeature(n,t,h[e],tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;else r=tn.renderFeature(n,t,h,tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;return r},ui.ENABLE_CANVAS&&(zs.register("MAP_RENDERER",Sh),zs.registerMultiple("LAYER_RENDERER",[yh,Ah,sn,hn])),ui.ENABLE_WEBGL&&(zs.register("MAP_RENDERER",Gn),zs.registerMultiple("LAYER_RENDERER",[Dn,jn,Un]));var Xn=function(t){(t=fi.assign({},t)).controls||(t.controls=Xs()),t.interactions||(t.interactions=eh()),Ls.call(this,t)};ui.inherits(Xn,Ls);var qn=function(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.snapToPixel_=t.snapToPixel};qn.prototype.getOpacity=function(){return this.opacity_},qn.prototype.getRotateWithView=function(){return this.rotateWithView_},qn.prototype.getRotation=function(){return this.rotation_},qn.prototype.getScale=function(){return this.scale_},qn.prototype.getSnapToPixel=function(){return this.snapToPixel_},qn.prototype.getAnchor=function(){},qn.prototype.getImage=function(){},qn.prototype.getHitDetectionImage=function(){},qn.prototype.getImageState=function(){},qn.prototype.getImageSize=function(){},qn.prototype.getHitDetectionImageSize=function(){},qn.prototype.getOrigin=function(){},qn.prototype.getSize=function(){},qn.prototype.setOpacity=function(t){this.opacity_=t},qn.prototype.setRotateWithView=function(t){this.rotateWithView_=t},qn.prototype.setRotation=function(t){this.rotation_=t},qn.prototype.setScale=function(t){this.scale_=t},qn.prototype.setSnapToPixel=function(t){this.snapToPixel_=t},qn.prototype.listenImageChange=function(){},qn.prototype.load=function(){},qn.prototype.unlistenImageChange=function(){};var Yn=function(t){this.checksums_=null,this.canvas_=null,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=void 0!==t.radius?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.anchor_=null,this.size_=null,this.imageSize_=null,this.hitDetectionImageSize_=null,this.atlasManager_=t.atlasManager,this.render_(this.atlasManager_),qn.call(this,{opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:1,snapToPixel:void 0===t.snapToPixel||t.snapToPixel})};ui.inherits(Yn,qn),Yn.prototype.clone=function(){var t=new Yn({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),snapToPixel:this.getSnapToPixel(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},Yn.prototype.getAnchor=function(){return this.anchor_},Yn.prototype.getAngle=function(){return this.angle_},Yn.prototype.getFill=function(){return this.fill_},Yn.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_},Yn.prototype.getImage=function(){return this.canvas_},Yn.prototype.getImageSize=function(){return this.imageSize_},Yn.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},Yn.prototype.getImageState=function(){return 2},Yn.prototype.getOrigin=function(){return this.origin_},Yn.prototype.getPoints=function(){return this.points_},Yn.prototype.getRadius=function(){return this.radius_},Yn.prototype.getRadius2=function(){return this.radius2_},Yn.prototype.getSize=function(){return this.size_},Yn.prototype.getStroke=function(){return this.stroke_},Yn.prototype.listenImageChange=function(){},Yn.prototype.load=function(){},Yn.prototype.unlistenImageChange=function(){},Yn.prototype.render_=function(t){var i,s,h="",n="",r=0,e=null,o=0,a=0;this.stroke_&&(null===(s=this.stroke_.getColor())&&(s=vh.defaultStrokeStyle),s=Mh.asColorLike(s),void 0===(a=this.stroke_.getWidth())&&(a=vh.defaultLineWidth),e=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),ts.CANVAS_LINE_DASH||(e=null,o=0),void 0===(n=this.stroke_.getLineJoin())&&(n=vh.defaultLineJoin),void 0===(h=this.stroke_.getLineCap())&&(h=vh.defaultLineCap),void 0===(r=this.stroke_.getMiterLimit())&&(r=vh.defaultMiterLimit));var u=2*(this.radius_+a)+1,f={strokeStyle:s,strokeWidth:a,size:u,lineCap:h,lineDash:e,lineDashOffset:o,lineJoin:n,miterLimit:r};if(void 0===t){var c=Cs(u,u);this.canvas_=c.canvas,i=u=this.canvas_.width,this.draw_(f,c,0,0),this.createHitDetectionCanvas_(f)}else{u=Math.round(u);var l,v=!this.fill_;v&&(l=this.drawHitDetectionCanvas_.bind(this,f));var d=this.getChecksum(),M=t.add(d,u,u,this.draw_.bind(this,f),l);this.canvas_=M.image,this.origin_=[M.offsetX,M.offsetY],i=M.image.width,v?(this.hitDetectionCanvas_=M.hitImage,this.hitDetectionImageSize_=[M.hitImage.width,M.hitImage.height]):(this.hitDetectionCanvas_=this.canvas_,this.hitDetectionImageSize_=[i,i])}this.anchor_=[u/2,u/2],this.size_=[u,u],this.imageSize_=[i,i]},Yn.prototype.draw_=function(t,i,s,h){var n,r,e;i.setTransform(1,0,0,1,0,0),i.translate(s,h),i.beginPath();var o=this.points_;if(o===1/0)i.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var a=void 0!==this.radius2_?this.radius2_:this.radius_;for(a!==this.radius_&&(o*=2),n=0;n<=o;n++)r=2*n*Math.PI/o-Math.PI/2+this.angle_,i.lineTo(t.size/2+(e=n%2==0?this.radius_:a)*Math.cos(r),t.size/2+e*Math.sin(r))}if(this.fill_){var u=this.fill_.getColor();null===u&&(u=vh.defaultFillStyle),i.fillStyle=Mh.asColorLike(u),i.fill()}this.stroke_&&(i.strokeStyle=t.strokeStyle,i.lineWidth=t.strokeWidth,t.lineDash&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.lineCap=t.lineCap,i.lineJoin=t.lineJoin,i.miterLimit=t.miterLimit,i.stroke()),i.closePath()},Yn.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.fill_)this.hitDetectionCanvas_=this.canvas_;else{var i=Cs(t.size,t.size);this.hitDetectionCanvas_=i.canvas,this.drawHitDetectionCanvas_(t,i,0,0)}},Yn.prototype.drawHitDetectionCanvas_=function(t,i,s,h){i.setTransform(1,0,0,1,0,0),i.translate(s,h),i.beginPath();var n=this.points_;if(n===1/0)i.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var r,e,o,a=void 0!==this.radius2_?this.radius2_:this.radius_;for(a!==this.radius_&&(n*=2),r=0;r<=n;r++)o=2*r*Math.PI/n-Math.PI/2+this.angle_,i.lineTo(t.size/2+(e=r%2==0?this.radius_:a)*Math.cos(o),t.size/2+e*Math.sin(o))}i.fillStyle=vh.defaultFillStyle,i.fill(),this.stroke_&&(i.strokeStyle=t.strokeStyle,i.lineWidth=t.strokeWidth,t.lineDash&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.stroke()),i.closePath()},Yn.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-",i=this.fill_?this.fill_.getChecksum():"-";if(!this.checksums_||t!=this.checksums_[1]||i!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.radius2_!=this.checksums_[4]||this.angle_!=this.checksums_[5]||this.points_!=this.checksums_[6]){var s="r"+t+i+(void 0!==this.radius_?this.radius_.toString():"-")+(void 0!==this.radius2_?this.radius2_.toString():"-")+(void 0!==this.angle_?this.angle_.toString():"-")+(void 0!==this.points_?this.points_.toString():"-");this.checksums_=[s,t,i,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]};var Bn=function(t){var i=t||{};Yn.call(this,{points:1/0,fill:i.fill,radius:i.radius,snapToPixel:i.snapToPixel,stroke:i.stroke,atlasManager:i.atlasManager})};ui.inherits(Bn,Yn),Bn.prototype.clone=function(){var t=new Bn({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),snapToPixel:this.getSnapToPixel(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},Bn.prototype.setRadius=function(t){this.radius_=t,this.render_(this.atlasManager_)};var Hn=function(t){var i=t||{};this.color_=void 0!==i.color?i.color:null,this.checksum_=void 0};Hn.prototype.clone=function(){var t=this.getColor();return new Hn({color:t&&t.slice?t.slice():t||void 0})},Hn.prototype.getColor=function(){return this.color_},Hn.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},Hn.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_=this.color_ instanceof CanvasPattern||this.color_ instanceof CanvasGradient?ui.getUid(this.color_).toString():"f"+(this.color_?dh.asString(this.color_):"-")),this.checksum_};var Jn=function(t){var i=t||{};this.geometry_=null,this.geometryFunction_=Jn.defaultGeometryFunction,void 0!==i.geometry&&this.setGeometry(i.geometry),this.fill_=void 0!==i.fill?i.fill:null,this.image_=void 0!==i.image?i.image:null,this.renderer_=void 0!==i.renderer?i.renderer:null,this.stroke_=void 0!==i.stroke?i.stroke:null,this.text_=void 0!==i.text?i.text:null,this.zIndex_=i.zIndex};Jn.prototype.clone=function(){var t=this.getGeometry();return t&&t.clone&&(t=t.clone()),new Jn({geometry:t,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()})},Jn.prototype.getRenderer=function(){return this.renderer_},Jn.prototype.setRenderer=function(t){this.renderer_=t},Jn.prototype.getGeometry=function(){return this.geometry_},Jn.prototype.getGeometryFunction=function(){return this.geometryFunction_},Jn.prototype.getFill=function(){return this.fill_},Jn.prototype.setFill=function(t){this.fill_=t},Jn.prototype.getImage=function(){return this.image_},Jn.prototype.setImage=function(t){this.image_=t},Jn.prototype.getStroke=function(){return this.stroke_},Jn.prototype.setStroke=function(t){this.stroke_=t},Jn.prototype.getText=function(){return this.text_},Jn.prototype.setText=function(t){this.text_=t},Jn.prototype.getZIndex=function(){return this.zIndex_},Jn.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(i){return i.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Jn.defaultGeometryFunction,this.geometry_=t},Jn.prototype.setZIndex=function(t){this.zIndex_=t},Jn.createFunction=function(t){var i,s;return"function"==typeof t?i=t:(Array.isArray(t)?s=t:(gi(t instanceof Jn,41),s=[t]),i=function(){return s}),i},Jn.default_=null,Jn.defaultFunction=function(){if(!Jn.default_){var t=new Hn({color:"rgba(255,255,255,0.4)"}),i=new Cn({color:"#3399CC",width:1.25});Jn.default_=[new Jn({image:new Bn({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return Jn.default_},Jn.createDefaultEditing=function(){var t={},i=[255,255,255,1],s=[0,153,255,1];return t.Polygon=[new Jn({fill:new Hn({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Jn({stroke:new Cn({color:i,width:5})}),new Jn({stroke:new Cn({color:s,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Jn({image:new Bn({radius:6,fill:new Hn({color:s}),stroke:new Cn({color:i,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t},Jn.defaultGeometryFunction=function(t){return t.getGeometry()};var Zn=function(t){mi.call(this),this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,ci.listen(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),void 0!==t&&(t instanceof Fi||!t?this.setGeometry(t):this.setProperties(t))};ui.inherits(Zn,mi),Zn.prototype.clone=function(){var t=new Zn(this.getProperties());t.setGeometryName(this.getGeometryName());var i=this.getGeometry();i&&t.setGeometry(i.clone());var s=this.getStyle();return s&&t.setStyle(s),t},Zn.prototype.getGeometry=function(){return this.get(this.geometryName_)},Zn.prototype.getId=function(){return this.id_},Zn.prototype.getGeometryName=function(){return this.geometryName_},Zn.prototype.getStyle=function(){return this.style_},Zn.prototype.getStyleFunction=function(){return this.styleFunction_},Zn.prototype.handleGeometryChange_=function(){this.changed()},Zn.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(ci.unlistenByKey(this.geometryChangeKey_),this.geometryChangeKey_=null);var t=this.getGeometry();t&&(this.geometryChangeKey_=ci.listen(t,"change",this.handleGeometryChange_,this)),this.changed()},Zn.prototype.setGeometry=function(t){this.set(this.geometryName_,t)},Zn.prototype.setStyle=function(t){this.style_=t,this.styleFunction_=t?Zn.createStyleFunction(t):void 0,this.changed()},Zn.prototype.setId=function(t){this.id_=t,this.changed()},Zn.prototype.setGeometryName=function(t){ci.unlisten(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),this.geometryName_=t,ci.listen(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),this.handleGeometryChanged_()},Zn.createStyleFunction=function(t){var i,s;return"function"==typeof t?i=2==t.length?function(i){return t(this,i)}:t:(Array.isArray(t)?s=t:(gi(t instanceof Jn,41),s=[t]),i=function(){return s}),i};var Kn={createOrUpdate:function(t,i,s,h){return void 0!==h?(h[0]=t,h[1]=i,h[2]=s,h):[t,i,s]},getKeyZXY:function(t,i,s){return t+"/"+i+"/"+s},getKey:function(t){return Kn.getKeyZXY(t[0],t[1],t[2])},fromKey:function(t){return t.split("/").map(Number)},hash:function(t){return(t[1]<<t[0])+t[2]},quadKey:function(t){var i,s,h=t[0],n=new Array(h),r=1<<h-1;for(i=0;i<h;++i)s=48,t[1]&r&&(s+=1),t[2]&r&&(s+=2),n[i]=String.fromCharCode(s),r>>=1;return n.join("")},withinExtentAndZ:function(t,i){var s=t[0],h=t[1],n=t[2];if(i.getMinZoom()>s||s>i.getMaxZoom())return!1;var r,e=i.getExtent();return!(r=e?i.getTileRangeForExtentAndZ(e,s):i.getFullTileRange(s))||r.containsXY(h,n)}},Qn={createFromTemplate:function(t,i){var s=/\{z\}/g,h=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(e){return e?t.replace(s,e[0].toString()).replace(h,e[1].toString()).replace(n,(function(){return(-e[2]-1).toString()})).replace(r,(function(){var t=i.getFullTileRange(e[0]);return gi(t,55),(t.getHeight()+e[2]).toString()})):void 0}},createFromTemplates:function(t,i){for(var s=t.length,h=new Array(s),n=0;n<s;++n)h[n]=Qn.createFromTemplate(t[n],i);return Qn.createFromTileUrlFunctions(h)},createFromTileUrlFunctions:function(t){return 1===t.length?t[0]:function(i,s,h){if(i){var n=Kn.hash(i),r=_i.modulo(n,t.length);return t[r](i,s,h)}}},nullTileUrlFunction:function(){},expandUrl:function(t){var i=[],s=/\{([a-z])-([a-z])\}/.exec(t);if(s){var h,n=s[1].charCodeAt(0),r=s[2].charCodeAt(0);for(h=n;h<=r;++h)i.push(t.replace(s[0],String.fromCharCode(h)));return i}if(s=s=/\{(\d+)-(\d+)\}/.exec(t)){for(var e=parseInt(s[2],10),o=parseInt(s[1],10);o<=e;o++)i.push(t.replace(s[0],o.toString()));return i}return i.push(t),i}},$n=function(t,i,s){di.call(this);var h=s||{};this.tileCoord=t,this.state=i,this.interimTile=null,this.key="",this.transition_=void 0===h.transition?250:h.transition,this.transitionStarts_={}};ui.inherits($n,di),$n.prototype.changed=function(){this.dispatchEvent("change")},$n.prototype.getKey=function(){return this.key+"/"+this.tileCoord},$n.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(2==t.getState())return t;t=t.interimTile}while(t);return this},$n.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,i=this;do{if(2==t.getState()){t.interimTile=null;break}1==t.getState()?i=t:0==t.getState()?i.interimTile=t.interimTile:i=t,t=i.interimTile}while(t)}},$n.prototype.getTileCoord=function(){return this.tileCoord},$n.prototype.getState=function(){return this.state},$n.prototype.setState=function(t){this.state=t,this.changed()},$n.prototype.load=function(){},$n.prototype.getAlpha=function(t,i){if(!this.transition_)return 1;var s=this.transitionStarts_[t];if(s){if(-1===s)return 1}else this.transitionStarts_[t]=s=i;var h=i-s+1e3/60;return h>=this.transition_?1:Es.easeIn(h/this.transition_)},$n.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},$n.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)};var tr=function(t,i,s,h,n,r){$n.call(this,t,i,r),this.crossOrigin_=h,this.src_=s,this.image_=new Image,null!==h&&(this.image_.crossOrigin=h),this.imageListenerKeys_=null,this.tileLoadFunction_=n};ui.inherits(tr,$n),tr.prototype.disposeInternal=function(){1==this.state&&(this.unlistenImage_(),this.image_=tr.getBlankImage()),this.interimTile&&this.interimTile.dispose(),this.state=5,this.changed(),$n.prototype.disposeInternal.call(this)},tr.prototype.getImage=function(){return this.image_},tr.prototype.getKey=function(){return this.src_},tr.prototype.handleImageError_=function(){this.state=3,this.unlistenImage_(),this.image_=tr.getBlankImage(),this.changed()},tr.prototype.handleImageLoad_=function(){this.state=this.image_.naturalWidth&&this.image_.naturalHeight?2:4,this.unlistenImage_(),this.changed()},tr.prototype.load=function(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.imageListenerKeys_=[ci.listenOnce(this.image_,"error",this.handleImageError_,this),ci.listenOnce(this.image_,"load",this.handleImageLoad_,this)],this.tileLoadFunction_(this,this.src_))},tr.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(ci.unlistenByKey),this.imageListenerKeys_=null},tr.getBlankImage=function(){var t=Cs(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas};var ir=function(t){fh.call(this,t)};ui.inherits(ir,fh),ir.prototype.expireCache=function(t){for(var i,s;this.canExpireCache()&&(!((s=(i=this.peekLast()).tileCoord[0].toString())in t)||!t[s].contains(i.tileCoord));)this.pop().dispose()},ir.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=this.peekFirstKey(),i=Kn.fromKey(t)[0];this.forEach((function(t){t.tileCoord[0]!==i&&(this.remove(Kn.getKey(t.tileCoord)),t.dispose())}),this)}};var sr={calculateSourceResolution:function(t,i,s,h){var n=Li.transform(s,i,t),r=Li.getPointResolution(i,h,s),e=i.getMetersPerUnit();void 0!==e&&(r*=e);var o=t.getMetersPerUnit();void 0!==o&&(r/=o);var a=t.getExtent();if(!a||bi.containsCoordinate(a,n)){var u=Li.getPointResolution(t,r,n)/r;isFinite(u)&&u>0&&(r/=u)}return r},enlargeClipPoint_:function(t,i,s,h){var n=s-t,r=h-i,e=Math.sqrt(n*n+r*r);return[Math.round(s+n/e),Math.round(h+r/e)]},render:function(t,i,s,h,n,r,e,o,a,u,f){var c=Cs(Math.round(s*t),Math.round(s*i));if(0===a.length)return c.canvas;c.scale(s,s);var l=bi.createEmpty();a.forEach((function(t){bi.extend(l,t.extent)}));var v=bi.getWidth(l),d=bi.getHeight(l),M=Cs(Math.round(s*v/h),Math.round(s*d/h)),m=s/h;a.forEach((function(t){var i=t.extent[0]-l[0],s=-(t.extent[3]-l[3]),h=bi.getWidth(t.extent),n=bi.getHeight(t.extent);M.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,i*m,s*m,h*m,n*m)}));var p=bi.getTopLeft(e);return o.getTriangles().forEach((function(t){var i=t.source,n=t.target,e=i[0][0],o=i[0][1],a=i[1][0],u=i[1][1],f=i[2][0],v=i[2][1],d=(n[0][0]-p[0])/r,m=-(n[0][1]-p[1])/r,g=(n[1][0]-p[0])/r,_=-(n[1][1]-p[1])/r,w=(n[2][0]-p[0])/r,y=-(n[2][1]-p[1])/r,b=e,x=o;e=0,o=0;var E=_i.solveLinearSystem([[a-=b,u-=x,0,0,g-d],[f-=b,v-=x,0,0,w-d],[0,0,a,u,_-m],[0,0,f,v,y-m]]);if(E){c.save(),c.beginPath();var S=(d+g+w)/3,C=(m+_+y)/3,A=sr.enlargeClipPoint_(S,C,d,m),P=sr.enlargeClipPoint_(S,C,g,_),R=sr.enlargeClipPoint_(S,C,w,y);c.moveTo(P[0],P[1]),c.lineTo(A[0],A[1]),c.lineTo(R[0],R[1]),c.clip(),c.transform(E[0],E[2],E[1],E[3],d,m),c.translate(l[0]-b,l[3]-x),c.scale(h/s,-h/s),c.drawImage(M.canvas,0,0),c.restore()}})),f&&(c.save(),c.strokeStyle="black",c.lineWidth=1,o.getTriangles().forEach((function(t){var i=t.target,s=(i[0][0]-p[0])/r,h=-(i[0][1]-p[1])/r,n=(i[1][0]-p[0])/r,e=-(i[1][1]-p[1])/r,o=(i[2][0]-p[0])/r,a=-(i[2][1]-p[1])/r;c.beginPath(),c.moveTo(n,e),c.lineTo(s,h),c.lineTo(o,a),c.closePath(),c.stroke()})),c.restore()),c.canvas}},hr=function(t,i,s,h,n){this.sourceProj_=t,this.targetProj_=i;var r={},e=Li.getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var i=t[0]+"/"+t[1];return r[i]||(r[i]=e(t)),r[i]},this.maxSourceExtent_=h,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!h&&!!this.sourceProj_.getExtent()&&bi.getWidth(h)==bi.getWidth(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?bi.getWidth(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?bi.getWidth(this.targetProj_.getExtent()):null;var o=bi.getTopLeft(s),a=bi.getTopRight(s),u=bi.getBottomRight(s),f=bi.getBottomLeft(s),c=this.transformInv_(o),l=this.transformInv_(a),v=this.transformInv_(u),d=this.transformInv_(f);if(this.addQuad_(o,a,u,f,c,l,v,d,ui.RASTER_REPROJECTION_MAX_SUBDIVISION),this.wrapsXInSource_){var M=1/0;this.triangles_.forEach((function(t){M=Math.min(M,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])-M>this.sourceWorldWidth_/2){var i=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];i[0][0]-M>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-M>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-M>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);var s=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-s<this.sourceWorldWidth_/2&&(t.source=i)}}),this)}r={}};hr.prototype.addTriangle_=function(t,i,s,h,n,r){this.triangles_.push({source:[h,n,r],target:[t,i,s]})},hr.prototype.addQuad_=function(t,i,s,h,n,r,e,o,a){var u=bi.boundingExtent([n,r,e,o]),f=this.sourceWorldWidth_?bi.getWidth(u)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,l=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(a>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){var d=bi.boundingExtent([t,i,s,h]);v|=bi.getWidth(d)/this.targetWorldWidth_>ui.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}!l&&this.sourceProj_.isGlobal()&&f&&(v|=f>ui.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH)}if(v||!this.maxSourceExtent_||bi.intersects(u,this.maxSourceExtent_)){if(!(v||isFinite(n[0])&&isFinite(n[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(o[0])&&isFinite(o[1]))){if(!(a>0))return;v=!0}if(a>0){if(!v){var M,m=this.transformInv_([(t[0]+s[0])/2,(t[1]+s[1])/2]);M=l?(_i.modulo(n[0],c)+_i.modulo(e[0],c))/2-_i.modulo(m[0],c):(n[0]+e[0])/2-m[0];var p=(n[1]+e[1])/2-m[1];v=M*M+p*p>this.errorThresholdSquared_}if(v){if(Math.abs(t[0]-s[0])<=Math.abs(t[1]-s[1])){var g=[(i[0]+s[0])/2,(i[1]+s[1])/2],_=this.transformInv_(g),w=[(h[0]+t[0])/2,(h[1]+t[1])/2],y=this.transformInv_(w);this.addQuad_(t,i,g,w,n,r,_,y,a-1),this.addQuad_(w,g,s,h,y,_,e,o,a-1)}else{var b=[(t[0]+i[0])/2,(t[1]+i[1])/2],x=this.transformInv_(b),E=[(s[0]+h[0])/2,(s[1]+h[1])/2],S=this.transformInv_(E);this.addQuad_(t,b,E,h,n,x,S,o,a-1),this.addQuad_(b,i,s,E,x,r,e,S,a-1)}return}}if(l){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,s,h,n,e,o),this.addTriangle_(t,i,s,n,r,e)}},hr.prototype.calculateSourceExtent=function(){var t=bi.createEmpty();return this.triangles_.forEach((function(i){var s=i.source;bi.extendCoordinate(t,s[0]),bi.extendCoordinate(t,s[1]),bi.extendCoordinate(t,s[2])})),t},hr.prototype.getTriangles=function(){return this.triangles_};var nr=function(t,i,s,h,n,r,e,o,a,u,f){$n.call(this,n,0),this.renderEdges_=void 0!==f&&f,this.pixelRatio_=e,this.gutter_=o,this.canvas_=null,this.sourceTileGrid_=i,this.targetTileGrid_=h,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;var c=h.getTileCoordExtent(this.wrappedTileCoord_),l=this.targetTileGrid_.getExtent(),v=this.sourceTileGrid_.getExtent(),d=l?bi.getIntersection(c,l):c;if(0!==bi.getArea(d)){var M=t.getExtent();M&&(v=v?bi.getIntersection(v,M):M);var m=h.getResolution(this.wrappedTileCoord_[0]),p=bi.getCenter(d),g=sr.calculateSourceResolution(t,s,p,m);if(!isFinite(g)||g<=0)this.state=4;else if(this.triangulation_=new hr(t,s,d,v,g*(void 0!==u?u:ui.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD)),0!==this.triangulation_.getTriangles().length){this.sourceZ_=i.getZForResolution(g);var _=this.triangulation_.calculateSourceExtent();if(v&&(t.canWrapX()?(_[1]=_i.clamp(_[1],v[1],v[3]),_[3]=_i.clamp(_[3],v[1],v[3])):_=bi.getIntersection(_,v)),bi.getArea(_)){for(var w=i.getTileRangeForExtentAndZ(_,this.sourceZ_),y=w.minX;y<=w.maxX;y++)for(var b=w.minY;b<=w.maxY;b++){var x=a(this.sourceZ_,y,b,e);x&&this.sourceTiles_.push(x)}0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}else this.state=4}else this.state=4};ui.inherits(nr,$n),nr.prototype.disposeInternal=function(){1==this.state&&this.unlistenSources_(),$n.prototype.disposeInternal.call(this)},nr.prototype.getImage=function(){return this.canvas_},nr.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach((function(i){i&&2==i.getState()&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(i.tileCoord),image:i.getImage()})}),this),this.sourceTiles_.length=0,0===t.length)this.state=3;else{var i=this.wrappedTileCoord_[0],s=this.targetTileGrid_.getTileSize(i),h="number"==typeof s?s:s[0],n="number"==typeof s?s:s[1],r=this.targetTileGrid_.getResolution(i),e=this.sourceTileGrid_.getResolution(this.sourceZ_),o=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sr.render(h,n,this.pixelRatio_,e,this.sourceTileGrid_.getExtent(),r,o,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=2}this.changed()},nr.prototype.load=function(){if(0==this.state){this.state=1,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((function(i){var s,h=i.getState();0!=h&&1!=h||(t++,s=ci.listen(i,"change",(function(){var h=i.getState();2!=h&&3!=h&&4!=h||(ci.unlistenByKey(s),0==--t&&(this.unlistenSources_(),this.reproject_()))}),this),this.sourcesListenerKeys_.push(s))}),this),this.sourceTiles_.forEach((function(t){0==t.getState()&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},nr.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(ci.unlistenByKey),this.sourcesListenerKeys_=null};var rr=function(t){var i;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,gi(yi.isSorted(this.resolutions_,(function(t,i){return i-t}),!0),17),!t.origins)for(var s=0,h=this.resolutions_.length-1;s<h;++s)if(i){if(this.resolutions_[s]/this.resolutions_[s+1]!==i){i=void 0;break}}else i=this.resolutions_[s]/this.resolutions_[s+1];this.zoomFactor_=i,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,gi(this.origins_.length==this.resolutions_.length,20));var n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=bi.getTopLeft(n)),gi(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,gi(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:ui.DEFAULT_TILE_SIZE,gi(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((function(t){return new Ch(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1))}),this):n&&this.calculateTileRanges_(n)};rr.tmpTileCoord_=[0,0,0],rr.prototype.forEachTileCoord=function(t,i,s){for(var h=this.getTileRangeForExtentAndZ(t,i),n=h.minX,r=h.maxX;n<=r;++n)for(var e=h.minY,o=h.maxY;e<=o;++e)s([i,n,e])},rr.prototype.forEachTileCoordParentTileRange=function(t,i,s,h,n){var r,e,o,a=null,u=t[0]-1;for(2===this.zoomFactor_?(e=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);u>=this.minZoom;){if(2===this.zoomFactor_?(e=Math.floor(e/2),o=Math.floor(o/2),r=Ch.createOrUpdate(e,e,o,o,h)):r=this.getTileRangeForExtentAndZ(a,u,h),i.call(s,u,r))return!0;--u}return!1},rr.prototype.getExtent=function(){return this.extent_},rr.prototype.getMaxZoom=function(){return this.maxZoom},rr.prototype.getMinZoom=function(){return this.minZoom},rr.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},rr.prototype.getResolution=function(t){return this.resolutions_[t]},rr.prototype.getResolutions=function(){return this.resolutions_},rr.prototype.getTileCoordChildTileRange=function(t,i,s){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){var h=2*t[1],n=2*t[2];return Ch.createOrUpdate(h,h+1,n,n+1,i)}var r=this.getTileCoordExtent(t,s);return this.getTileRangeForExtentAndZ(r,t[0]+1,i)}return null},rr.prototype.getTileRangeExtent=function(t,i,s){var h=this.getOrigin(t),n=this.getResolution(t),r=Os(this.getTileSize(t),this.tmpSize_);return bi.createOrUpdate(h[0]+i.minX*r[0]*n,h[1]+i.minY*r[1]*n,h[0]+(i.maxX+1)*r[0]*n,h[1]+(i.maxY+1)*r[1]*n,s)},rr.prototype.getTileRangeForExtentAndZ=function(t,i,s){var h=rr.tmpTileCoord_;this.getTileCoordForXYAndZ_(t[0],t[1],i,!1,h);var n=h[1],r=h[2];return this.getTileCoordForXYAndZ_(t[2],t[3],i,!0,h),Ch.createOrUpdate(n,h[1],r,h[2],s)},rr.prototype.getTileCoordCenter=function(t){var i=this.getOrigin(t[0]),s=this.getResolution(t[0]),h=Os(this.getTileSize(t[0]),this.tmpSize_);return[i[0]+(t[1]+.5)*h[0]*s,i[1]+(t[2]+.5)*h[1]*s]},rr.prototype.getTileCoordExtent=function(t,i){var s=this.getOrigin(t[0]),h=this.getResolution(t[0]),n=Os(this.getTileSize(t[0]),this.tmpSize_),r=s[0]+t[1]*n[0]*h,e=s[1]+t[2]*n[1]*h;return bi.createOrUpdate(r,e,r+n[0]*h,e+n[1]*h,i)},rr.prototype.getTileCoordForCoordAndResolution=function(t,i,s){return this.getTileCoordForXYAndResolution_(t[0],t[1],i,!1,s)},rr.prototype.getTileCoordForXYAndResolution_=function(t,i,s,h,n){var r=this.getZForResolution(s),e=s/this.getResolution(r),o=this.getOrigin(r),a=Os(this.getTileSize(r),this.tmpSize_),u=h?0:.5,f=Math.floor((t-o[0])/s+(h?.5:0)),c=Math.floor((i-o[1])/s+u),l=e*f/a[0],v=e*c/a[1];return h?(l=Math.ceil(l)-1,v=Math.ceil(v)-1):(l=Math.floor(l),v=Math.floor(v)),Kn.createOrUpdate(r,l,v,n)},rr.prototype.getTileCoordForXYAndZ_=function(t,i,s,h,n){var r=this.getOrigin(s),e=this.getResolution(s),o=Os(this.getTileSize(s),this.tmpSize_),a=h?0:.5,u=Math.floor((t-r[0])/e+(h?.5:0)),f=Math.floor((i-r[1])/e+a),c=u/o[0],l=f/o[1];return h?(c=Math.ceil(c)-1,l=Math.ceil(l)-1):(c=Math.floor(c),l=Math.floor(l)),Kn.createOrUpdate(s,c,l,n)},rr.prototype.getTileCoordForCoordAndZ=function(t,i,s){return this.getTileCoordForXYAndZ_(t[0],t[1],i,!1,s)},rr.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]},rr.prototype.getTileSize=function(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]},rr.prototype.getFullTileRange=function(t){return this.fullTileRanges_?this.fullTileRanges_[t]:null},rr.prototype.getZForResolution=function(t,i){var s=yi.linearFindNearest(this.resolutions_,t,i||0);return _i.clamp(s,this.minZoom,this.maxZoom)},rr.prototype.calculateTileRanges_=function(t){for(var i=this.resolutions_.length,s=new Array(i),h=this.minZoom;h<i;++h)s[h]=this.getTileRangeForExtentAndZ(t,h);this.fullTileRanges_=s};var er={getForProjection:function(t){var i=t.getDefaultTileGrid();return i||(i=er.createForProjection(t),t.setDefaultTileGrid(i)),i},wrapX:function(t,i,s){var h=i[0],n=t.getTileCoordCenter(i),r=er.extentFromProjection(s);if(bi.containsCoordinate(r,n))return i;var e=bi.getWidth(r),o=Math.ceil((r[0]-n[0])/e);return n[0]+=e*o,t.getTileCoordForCoordAndZ(n,h)},createForExtent:function(t,i,s,h){var n=void 0!==h?h:"top-left",r=er.resolutionsFromExtent(t,i,s);return new rr({extent:t,origin:bi.getCorner(t,n),resolutions:r,tileSize:s})},createXYZ:function(t){var i={};return fi.assign(i,void 0!==t?t:{}),void 0===i.extent&&(i.extent=Li.get("EPSG:3857").getExtent()),i.resolutions=er.resolutionsFromExtent(i.extent,i.maxZoom,i.tileSize),delete i.maxZoom,new rr(i)},resolutionsFromExtent:function(t,i,s){for(var h=void 0!==i?i:ui.DEFAULT_MAX_ZOOM,n=bi.getHeight(t),r=bi.getWidth(t),e=Os(void 0!==s?s:ui.DEFAULT_TILE_SIZE),o=Math.max(r/e[0],n/e[1]),a=h+1,u=new Array(a),f=0;f<a;++f)u[f]=o/Math.pow(2,f);return u},createForProjection:function(t,i,s,h){var n=er.extentFromProjection(t);return er.createForExtent(n,i,s,h)},extentFromProjection:function(t){var i=(t=Li.get(t)).getExtent();if(!i){var s=180*Li.METERS_PER_UNIT[Pi.DEGREES]/t.getMetersPerUnit();i=bi.createOrUpdate(-s,-s,s,s)}return i}},or=function(t){this.html_=t.html,this.tileRanges_=t.tileRanges?t.tileRanges:null};or.prototype.getHTML=function(){return this.html_},or.prototype.intersectsAnyTileRange=function(t,i,s){if(!this.tileRanges_)return!0;var h,n,r,e;for(e in t){var o;if(e in this.tileRanges_)for(r=t[e],h=0,n=this.tileRanges_[e].length;h<n;++h){if((o=this.tileRanges_[e][h]).intersects(r))return!0;var a=i.getTileRangeForExtentAndZ(er.extentFromProjection(s),parseInt(e,10)),u=a.getWidth();if(r.minX<a.minX||r.maxX>a.maxX){if(o.intersects(new Ch(_i.modulo(r.minX,u),_i.modulo(r.maxX,u),r.minY,r.maxY)))return!0;if(r.getWidth()>u&&o.intersects(a))return!0}}}return!1};var ar=function(t){mi.call(this),this.projection_=Li.get(t.projection),this.attributions_=null,this.attributions2_=this.adaptAttributions_(t.attributions),this.logo_=t.logo,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX};ui.inherits(ar,mi),ar.prototype.adaptAttributions_=function(t){if(!t)return null;if(t instanceof or)return this.attributions_=[t],function(){return[t.getHTML()]};if(Array.isArray(t)){if(t[0]instanceof or){this.attributions_=t;var i=t.map((function(t){return t.getHTML()}));return function(){return i}}return this.attributions_=t.map((function(t){return new or({html:t})})),function(){return t}}return"function"==typeof t?t:(this.attributions_=[new or({html:t})],function(){return[t]})},ar.prototype.forEachFeatureAtCoordinate=ui.nullFunction,ar.prototype.getAttributions=function(){return this.attributions_},ar.prototype.getAttributions2=function(){return this.attributions2_},ar.prototype.getLogo=function(){return this.logo_},ar.prototype.getProjection=function(){return this.projection_},ar.prototype.getResolutions=function(){},ar.prototype.getState=function(){return this.state_},ar.prototype.getWrapX=function(){return this.wrapX_},ar.prototype.refresh=function(){this.changed()},ar.prototype.setAttributions=function(t){this.attributions2_=this.adaptAttributions_(t),this.changed()},ar.prototype.setLogo=function(t){this.logo_=t},ar.prototype.setState=function(t){this.state_=t,this.changed()};var ur=function(t){ar.call(this,{attributions:t.attributions,extent:t.extent,logo:t.logo,projection:t.projection,state:t.state,wrapX:t.wrapX}),this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null,this.tileCache=new ir(t.cacheSize),this.tmpSize=[0,0],this.key_="",this.tileOptions={transition:t.transition}};ui.inherits(ur,ar),ur.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},ur.prototype.expireCache=function(t,i){var s=this.getTileCacheForProjection(t);s&&s.expireCache(i)},ur.prototype.forEachLoadedTile=function(t,i,s,h){var n=this.getTileCacheForProjection(t);if(!n)return!1;for(var r,e,o,a=!0,u=s.minX;u<=s.maxX;++u)for(var f=s.minY;f<=s.maxY;++f)e=Kn.getKeyZXY(i,u,f),o=!1,n.containsKey(e)&&(o=2===(r=n.get(e)).getState())&&(o=!1!==h(r)),o||(a=!1);return a},ur.prototype.getGutter=function(){return 0},ur.prototype.getKey=function(){return this.key_},ur.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},ur.prototype.getOpaque=function(){return this.opaque_},ur.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},ur.prototype.getTile=function(){},ur.prototype.getTileGrid=function(){return this.tileGrid},ur.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:er.getForProjection(t)},ur.prototype.getTileCacheForProjection=function(t){var i=this.getProjection();return i&&!Li.equivalent(i,t)?null:this.tileCache},ur.prototype.getTilePixelRatio=function(){return this.tilePixelRatio_},ur.prototype.getTilePixelSize=function(t,i,s){var h=this.getTileGridForProjection(s),n=this.getTilePixelRatio(i),r=Os(h.getTileSize(t),this.tmpSize);return 1==n?r:Ts(r,n,this.tmpSize)},ur.prototype.getTileCoordForTileUrlFunction=function(t,i){var s=void 0!==i?i:this.getProjection(),h=this.getTileGridForProjection(s);return this.getWrapX()&&s.isGlobal()&&(t=er.wrapX(h,t,s)),Kn.withinExtentAndZ(t,h)?t:null},ur.prototype.refresh=function(){this.tileCache.clear(),this.changed()},ur.prototype.useTile=ui.nullFunction,ui.inherits(ur.Event=function(t,i){vi.call(this,t),this.tile=i},vi);var fr=function(t){ur.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition}),this.tileLoadFunction=t.tileLoadFunction,this.tileUrlFunction=this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.nullTileUrlFunction,this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),t.tileUrlFunction&&this.setTileUrlFunction(t.tileUrlFunction),this.tileLoadingKeys_={}};ui.inherits(fr,ur),fr.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},fr.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},fr.prototype.getUrls=function(){return this.urls},fr.prototype.handleTileChange=function(t){var i,s=t.target,h=ui.getUid(s),n=s.getState();1==n?(this.tileLoadingKeys_[h]=!0,i="tileloadstart"):h in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[h],i=3==n?"tileloaderror":2==n||5==n?"tileloadend":void 0),null!=i&&this.dispatchEvent(new ur.Event(i,s))},fr.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},fr.prototype.setTileUrlFunction=function(t,i){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==i?this.setKey(i):this.changed()},fr.prototype.setUrl=function(t){var i=this.urls=Qn.expandUrl(t);this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTemplates(i,this.tileGrid),t)},fr.prototype.setUrls=function(t){this.urls=t;var i=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTemplates(t,this.tileGrid),i)},fr.prototype.useTile=function(t,i,s){var h=Kn.getKeyZXY(t,i,s);this.tileCache.containsKey(h)&&this.tileCache.get(h)};var cr=function(t){fr.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:cr.defaultTileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:tr,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1};ui.inherits(cr,fr),cr.prototype.canExpireCache=function(){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.canExpireCache.call(this);if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},cr.prototype.expireCache=function(t,i){if(ui.ENABLE_RASTER_REPROJECTION){var s=this.getTileCacheForProjection(t);for(var h in this.tileCache.expireCache(this.tileCache==s?i:{}),this.tileCacheForProjection){var n=this.tileCacheForProjection[h];n.expireCache(n==s?i:{})}}else fr.prototype.expireCache.call(this,t,i)},cr.prototype.getGutter=function(t){return ui.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Li.equivalent(this.getProjection(),t)?0:this.getGutterInternal()},cr.prototype.getGutterInternal=function(){return 0},cr.prototype.getOpaque=function(t){return!(ui.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Li.equivalent(this.getProjection(),t))&&fr.prototype.getOpaque.call(this,t)},cr.prototype.getTileGridForProjection=function(t){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.getTileGridForProjection.call(this,t);var i=this.getProjection();if(!this.tileGrid||i&&!Li.equivalent(i,t)){var s=ui.getUid(t).toString();return s in this.tileGridForProjection||(this.tileGridForProjection[s]=er.getForProjection(t)),this.tileGridForProjection[s]}return this.tileGrid},cr.prototype.getTileCacheForProjection=function(t){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.getTileCacheForProjection.call(this,t);var i=this.getProjection();if(!i||Li.equivalent(i,t))return this.tileCache;var s=ui.getUid(t).toString();return s in this.tileCacheForProjection||(this.tileCacheForProjection[s]=new ir(this.tileCache.highWaterMark)),this.tileCacheForProjection[s]},cr.prototype.createTile_=function(t,i,s,h,n,r){var e=[t,i,s],o=this.getTileCoordForTileUrlFunction(e,n),a=o?this.tileUrlFunction(o,h,n):void 0,u=new this.tileClass(e,void 0!==a?0:4,void 0!==a?a:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=r,ci.listen(u,"change",this.handleTileChange,this),u},cr.prototype.getTile=function(t,i,s,h,n){var r=this.getProjection();if(ui.ENABLE_RASTER_REPROJECTION&&r&&n&&!Li.equivalent(r,n)){var e,o=this.getTileCacheForProjection(n),a=[t,i,s],u=Kn.getKey(a);o.containsKey(u)&&(e=o.get(u));var f=this.getKey();if(e&&e.key==f)return e;var c=this.getTileGridForProjection(r),l=this.getTileGridForProjection(n),v=this.getTileCoordForTileUrlFunction(a,n),d=new nr(r,c,n,l,a,v,this.getTilePixelRatio(h),this.getGutterInternal(),function(t,i,s,h){return this.getTileInternal(t,i,s,h,r)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return d.key=f,e?(d.interimTile=e,d.refreshInterimChain(),o.replace(u,d)):o.set(u,d),d}return this.getTileInternal(t,i,s,h,r||n)},cr.prototype.getTileInternal=function(t,i,s,h,n){var r=null,e=Kn.getKeyZXY(t,i,s),o=this.getKey();if(this.tileCache.containsKey(e)){if((r=this.tileCache.get(e)).key!=o){var a=r;(r=this.createTile_(t,i,s,h,n,o)).interimTile=0==a.getState()?a.interimTile:a,r.refreshInterimChain(),this.tileCache.replace(e,r)}}else r=this.createTile_(t,i,s,h,n,o),this.tileCache.set(e,r);return r},cr.prototype.setRenderReprojectionEdges=function(t){if(ui.ENABLE_RASTER_REPROJECTION&&this.renderReprojectionEdges_!=t){for(var i in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[i].clear();this.changed()}},cr.prototype.setTileGridForProjection=function(t,i){if(ui.ENABLE_RASTER_REPROJECTION){var s=Li.get(t);if(s){var h=ui.getUid(s).toString();h in this.tileGridForProjection||(this.tileGridForProjection[h]=i)}}},cr.defaultTileLoadFunction=function(t,i){t.getImage().src=i};var lr=function(t){this.matrixIds_=t.matrixIds,rr.call(this,{extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes})};ui.inherits(lr,rr),lr.prototype.getMatrixId=function(t){return this.matrixIds_[t]},lr.prototype.getMatrixIds=function(){return this.matrixIds_},lr.createFromCapabilitiesMatrixSet=function(t,i,s){var h=[],n=[],r=[],e=[],o=[],a=void 0!==s?s:[],u=t.SupportedCRS,f=Li.get(u.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(u),c=f.getMetersPerUnit(),l="ne"==f.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,i){return i.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(t){if(!(a.length>0)||yi.find(a,(function(i){return t.Identifier==i.TileMatrix}))){n.push(t.Identifier);var i=28e-5*t.ScaleDenominator/c,s=t.TileWidth,u=t.TileHeight;r.push(l?[t.TopLeftCorner[1],t.TopLeftCorner[0]]:t.TopLeftCorner),h.push(i),e.push(s==u?s:[s,u]),o.push([t.MatrixWidth,-t.MatrixHeight])}})),new lr({extent:i,origins:r,resolutions:h,matrixIds:n,tileSizes:e,sizes:o})};var vr=function(t,i){var s=[];Object.keys(i).forEach((function(t){null!=i[t]&&s.push(t+"="+encodeURIComponent(i[t]))}));var h=s.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+h},dr=function(t){this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style;var i=t.urls;void 0===i&&void 0!==t.url&&(i=Qn.expandUrl(t.url)),this.requestEncoding_=void 0!==t.requestEncoding?t.requestEncoding:"KVP";var s=this.requestEncoding_,h=t.tileGrid,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==s&&fi.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_});var r=this.dimensions_;this.createFromWMTSTemplate_=function(t){return t="KVP"==s?vr(t,n):t.replace(/\{(\w+?)\}/g,(function(t,i){return i.toLowerCase()in n?n[i.toLowerCase()]:t})),function(i){if(i){var n={TileMatrix:h.getMatrixId(i[0]),TileCol:i[1],TileRow:-i[2]-1};fi.assign(n,r);var e=t;return"KVP"==s?vr(e,n):e.replace(/\{(\w+?)\}/g,(function(t,i){return n[i]}))}}};var e=i&&i.length>0?Qn.createFromTileUrlFunctions(i.map(this.createFromWMTSTemplate_)):Qn.nullTileUrlFunction;cr.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,logo:t.logo,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:h,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:e,urls:i,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition}),this.setKey(this.getKeyForDimensions_())};ui.inherits(dr,cr),dr.prototype.setUrls=function(t){this.urls=t;var i=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTileUrlFunctions(t.map(this.createFromWMTSTemplate_.bind(this))),i)},dr.prototype.getDimensions=function(){return this.dimensions_},dr.prototype.getFormat=function(){return this.format_},dr.prototype.getLayer=function(){return this.layer_},dr.prototype.getMatrixSet=function(){return this.matrixSet_},dr.prototype.getRequestEncoding=function(){return this.requestEncoding_},dr.prototype.getStyle=function(){return this.style_},dr.prototype.getVersion=function(){return this.version_},dr.prototype.getKeyForDimensions_=function(){var t=0,i=[];for(var s in this.dimensions_)i[t++]=s+"-"+this.dimensions_[s];return i.join("/")},dr.prototype.updateDimensions=function(t){fi.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},dr.optionsFromCapabilities=function(t,i){var s=yi.find(t.Contents.Layer,(function(t){return t.Identifier==i.layer}));if(null===s)return null;var h,n,r,e=t.Contents.TileMatrixSet;(h=s.TileMatrixSetLink.length>1?yi.findIndex(s.TileMatrixSetLink,"projection"in i?function(t){var s=yi.find(e,(function(i){return i.Identifier==t.TileMatrixSet})).SupportedCRS,h=Li.get(s.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(s),n=Li.get(i.projection);return h&&n?Li.equivalent(h,n):s==i.projection}:function(t){return t.TileMatrixSet==i.matrixSet}):0)<0&&(h=0),n=s.TileMatrixSetLink[h].TileMatrixSet,r=s.TileMatrixSetLink[h].TileMatrixSetLimits;var o=s.Format[0];"format"in i&&(o=i.format),(h=yi.findIndex(s.Style,(function(t){return"style"in i?t.Title==i.style:t.isDefault})))<0&&(h=0);var a=s.Style[h].Identifier,u={};"Dimension"in s&&s.Dimension.forEach((function(t){var i=t.Default;void 0===i&&(i=t.Value[0]),u[t.Identifier]=i}));var f,c=yi.find(t.Contents.TileMatrixSet,(function(t){return t.Identifier==n})),l=c.SupportedCRS;if(l&&(f=Li.get(l.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(l)),"projection"in i){var v=Li.get(i.projection);v&&(f&&!Li.equivalent(v,f)||(f=v))}var d,M,m=s.WGS84BoundingBox;if(void 0!==m){var p=Li.get("EPSG:4326").getExtent();M=m[0]==p[0]&&m[2]==p[2],d=Li.transformExtent(m,"EPSG:4326",f);var g=f.getExtent();g&&(bi.containsExtent(g,d)||(d=void 0))}var _=lr.createFromCapabilitiesMatrixSet(c,d,r),w=[],y=i.requestEncoding;if(y=void 0!==y?y:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var b=t.OperationsMetadata.GetTile.DCP.HTTP.Get,x=0,E=b.length;x<E;++x)if(b[x].Constraint){var S=yi.find(b[x].Constraint,(function(t){return"GetEncoding"==t.name})).AllowedValues.Value;if(""===y&&(y=S[0]),"KVP"!==y)break;yi.includes(S,"KVP")&&w.push(b[x].href)}else b[x].href&&(y="KVP",w.push(b[x].href));return 0===w.length&&(y="REST",s.ResourceURL.forEach((function(t){"tile"===t.resourceType&&(o=t.format,w.push(t.template))}))),{urls:w,layer:i.layer,matrixSet:n,format:o,projection:f,requestEncoding:y,tileGrid:_,style:a,dimensions:u,wrapX:M,crossOrigin:i.crossOrigin}};var Mr={};Mr.DOCUMENT=document.implementation.createDocument("","",null),Mr.createElementNS=function(t,i){return Mr.DOCUMENT.createElementNS(t,i)},Mr.getAllTextContent=function(t,i){return Mr.getAllTextContent_(t,i,[]).join("")},Mr.getAllTextContent_=function(t,i,s){var h;if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)s.push(i?String(t.nodeValue).replace(/(\r\n|\r|\n)/g,""):t.nodeValue);else for(h=t.firstChild;h;h=h.nextSibling)Mr.getAllTextContent_(h,i,s);return s},Mr.isDocument=function(t){return t instanceof Document},Mr.isNode=function(t){return t instanceof Node},Mr.getAttributeNS=function(t,i,s){return t.getAttributeNS(i,s)||""},Mr.setAttributeNS=function(t,i,s,h){t.setAttributeNS(i,s,h)},Mr.parse=function(t){return(new DOMParser).parseFromString(t,"application/xml")},Mr.makeArrayExtender=function(t,i){return function(s,h){var n=t.call(i,s,h);void 0!==n&&yi.extend(h[h.length-1],n)}},Mr.makeArrayPusher=function(t,i){return function(s,h){var n=t.call(void 0!==i?i:this,s,h);void 0!==n&&h[h.length-1].push(n)}},Mr.makeReplacer=function(t,i){return function(s,h){var n=t.call(void 0!==i?i:this,s,h);void 0!==n&&(h[h.length-1]=n)}},Mr.makeObjectPropertyPusher=function(t,i,s){return function(h,n){var r=t.call(void 0!==s?s:this,h,n);if(void 0!==r){var e=n[n.length-1],o=void 0!==i?i:h.localName;(o in e?e[o]:e[o]=[]).push(r)}}},Mr.makeObjectPropertySetter=function(t,i,s){return function(h,n){var r=t.call(void 0!==s?s:this,h,n);void 0!==r&&(n[n.length-1][void 0!==i?i:h.localName]=r)}},Mr.makeChildAppender=function(t,i){return function(s,h,n){t.call(void 0!==i?i:this,s,h,n),n[n.length-1].node.appendChild(s)}},Mr.makeArraySerializer=function(t){var i,s;return function(h,n,r){if(void 0===i){i={};var e={};e[h.localName]=t,i[h.namespaceURI]=e,s=Mr.makeSimpleNodeFactory(h.localName)}Mr.serialize(i,s,n,r)}},Mr.makeSimpleNodeFactory=function(t,i){var s=t;return function(t,h,n){var r=s;void 0===r&&(r=n);var e=i;return void 0===i&&(e=h[h.length-1].node.namespaceURI),Mr.createElementNS(e,r)}},Mr.OBJECT_PROPERTY_NODE_FACTORY=Mr.makeSimpleNodeFactory(),Mr.makeSequence=function(t,i){for(var s=i.length,h=new Array(s),n=0;n<s;++n)h[n]=t[i[n]];return h},Mr.makeStructureNS=function(t,i,s){var h,n,r=void 0!==s?s:{};for(h=0,n=t.length;h<n;++h)r[t[h]]=i;return r},Mr.parseNode=function(t,i,s,h){var n;for(n=i.firstElementChild;n;n=n.nextElementSibling){var r=t[n.namespaceURI];if(void 0!==r){var e=r[n.localName];void 0!==e&&e.call(h,n,s)}}},Mr.pushParseAndPop=function(t,i,s,h,n){return h.push(t),Mr.parseNode(i,s,h,n),h.pop()},Mr.serialize=function(t,i,s,h,n,r){for(var e,o,a=(void 0!==n?n:s).length,u=0;u<a;++u)void 0!==(e=s[u])&&void 0!==(o=i.call(r,e,h,void 0!==n?n[u]:void 0))&&t[o.namespaceURI][o.localName].call(r,o,e,h)},Mr.pushSerializeAndPop=function(t,i,s,h,n,r,e){return n.push(t),Mr.serialize(i,s,h,n,r,e),n.pop()};var mr={loadFeaturesXhr:function(t,i,s,h){return function(n,r,e){var o=new XMLHttpRequest;o.open("GET","function"==typeof t?t(n,r,e):t,!0),"arraybuffer"==i.getType()&&(o.responseType="arraybuffer"),o.onload=function(){if(!o.status||o.status>=200&&o.status<300){var t,n=i.getType();"json"==n||"text"==n?t=o.responseText:"xml"==n?(t=o.responseXML)||(t=Mr.parse(o.responseText)):"arraybuffer"==n&&(t=o.response),t?s.call(this,i.readFeatures(t,{featureProjection:e}),i.readProjection(t),i.getLastExtent()):h.call(this)}else h.call(this)}.bind(this),o.onerror=function(){h.call(this)}.bind(this),o.send()}},xhr:function(t,i){return mr.loadFeaturesXhr(t,i,(function(t){this.addFeatures(t)}),ui.nullFunction)}},pr={all:function(){return[[-1/0,-1/0,1/0,1/0]]},bbox:function(t){return[t]},tile:function(t){return function(i,s){var h=t.getZForResolution(s),n=t.getTileRangeForExtentAndZ(i,h),r=[],e=[h,0,0];for(e[1]=n.minX;e[1]<=n.maxX;++e[1])for(e[2]=n.minY;e[2]<=n.maxY;++e[2])r.push(t.getTileCoordExtent(e));return r}}},gr=function(t){var i=t||{};ar.call(this,{attributions:i.attributions,logo:i.logo,projection:void 0,state:"ready",wrapX:void 0===i.wrapX||i.wrapX}),this.loader_=ui.nullFunction,this.format_=i.format,this.overlaps_=null==i.overlaps||i.overlaps,this.url_=i.url,void 0!==i.loader?this.loader_=i.loader:void 0!==this.url_&&(gi(this.format_,7),this.loader_=mr.xhr(this.url_,this.format_)),this.strategy_=void 0!==i.strategy?i.strategy:pr.all;var s,h,n=void 0===i.useSpatialIndex||i.useSpatialIndex;this.featuresRtree_=n?new Pn:null,this.loadedExtentsRtree_=new Pn,this.nullGeometryFeatures_={},this.idIndex_={},this.undefIdIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,i.features instanceof hs?h=(s=i.features).getArray():Array.isArray(i.features)&&(h=i.features),n||void 0!==s||(s=new hs(h)),void 0!==h&&this.addFeaturesInternal(h),void 0!==s&&this.bindFeaturesCollection_(s)};ui.inherits(gr,ar),gr.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},gr.prototype.addFeatureInternal=function(t){var i=ui.getUid(t).toString();if(this.addToIndex_(i,t)){this.setupChangeEvents_(i,t);var s=t.getGeometry();if(s){var h=s.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(h,t)}else this.nullGeometryFeatures_[i]=t;this.dispatchEvent(new gr.Event("addfeature",t))}},gr.prototype.setupChangeEvents_=function(t,i){this.featureChangeKeys_[t]=[ci.listen(i,"change",this.handleFeatureChange_,this),ci.listen(i,"propertychange",this.handleFeatureChange_,this)]},gr.prototype.addToIndex_=function(t,i){var s=!0,h=i.getId();return void 0!==h?h.toString()in this.idIndex_?s=!1:this.idIndex_[h.toString()]=i:(gi(!(t in this.undefIdIndex_),30),this.undefIdIndex_[t]=i),s},gr.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},gr.prototype.addFeaturesInternal=function(t){var i,s,h,n,r=[],e=[],o=[];for(s=0,h=t.length;s<h;s++)i=ui.getUid(n=t[s]).toString(),this.addToIndex_(i,n)&&e.push(n);for(s=0,h=e.length;s<h;s++){i=ui.getUid(n=e[s]).toString(),this.setupChangeEvents_(i,n);var a=n.getGeometry();if(a){var u=a.getExtent();r.push(u),o.push(n)}else this.nullGeometryFeatures_[i]=n}for(this.featuresRtree_&&this.featuresRtree_.load(r,o),s=0,h=e.length;s<h;s++)this.dispatchEvent(new gr.Event("addfeature",e[s]))},gr.prototype.bindFeaturesCollection_=function(t){var i=!1;ci.listen(this,"addfeature",(function(s){i||(i=!0,t.push(s.feature),i=!1)})),ci.listen(this,"removefeature",(function(s){i||(i=!0,t.remove(s.feature),i=!1)})),ci.listen(t,"add",(function(t){i||(i=!0,this.addFeature(t.element),i=!1)}),this),ci.listen(t,"remove",(function(t){i||(i=!0,this.removeFeature(t.element),i=!1)}),this),this.featuresCollection_=t},gr.prototype.clear=function(t){if(t){for(var i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(ci.unlistenByKey);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.undefIdIndex_={})}else if(this.featuresRtree_)for(var s in this.featuresRtree_.forEach(this.removeFeatureInternal,this),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s]);this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.loadedExtentsRtree_.clear(),this.nullGeometryFeatures_={};var h=new gr.Event("clear");this.dispatchEvent(h),this.changed()},gr.prototype.forEachFeature=function(t,i){return this.featuresRtree_?this.featuresRtree_.forEach(t,i):this.featuresCollection_?this.featuresCollection_.forEach(t,i):void 0},gr.prototype.forEachFeatureAtCoordinateDirect=function(t,i,s){return this.forEachFeatureInExtent([t[0],t[1],t[0],t[1]],(function(h){return h.getGeometry().intersectsCoordinate(t)?i.call(s,h):void 0}))},gr.prototype.forEachFeatureInExtent=function(t,i,s){return this.featuresRtree_?this.featuresRtree_.forEachInExtent(t,i,s):this.featuresCollection_?this.featuresCollection_.forEach(i,s):void 0},gr.prototype.forEachFeatureIntersectingExtent=function(t,i,s){return this.forEachFeatureInExtent(t,(function(h){if(h.getGeometry().intersectsExtent(t)){var n=i.call(s,h);if(n)return n}}))},gr.prototype.getFeaturesCollection=function(){return this.featuresCollection_},gr.prototype.getFeatures=function(){var t;return this.featuresCollection_?t=this.featuresCollection_.getArray():this.featuresRtree_&&(t=this.featuresRtree_.getAll(),fi.isEmpty(this.nullGeometryFeatures_)||yi.extend(t,fi.getValues(this.nullGeometryFeatures_))),t},gr.prototype.getFeaturesAtCoordinate=function(t){var i=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){i.push(t)})),i},gr.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_.getInExtent(t)},gr.prototype.getClosestFeatureToCoordinate=function(t,i){var s=t[0],h=t[1],n=null,r=[NaN,NaN],e=1/0,o=[-1/0,-1/0,1/0,1/0],a=i||xi.TRUE;return this.featuresRtree_.forEachInExtent(o,(function(t){if(a(t)){var i=t.getGeometry(),u=e;if((e=i.closestPointXY(s,h,r,e))<u){n=t;var f=Math.sqrt(e);o[0]=s-f,o[1]=h-f,o[2]=s+f,o[3]=h+f}}})),n},gr.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)},gr.prototype.getFeatureById=function(t){var i=this.idIndex_[t.toString()];return void 0!==i?i:null},gr.prototype.getFormat=function(){return this.format_},gr.prototype.getOverlaps=function(){return this.overlaps_},gr.prototype.getResolutions=function(){},gr.prototype.getUrl=function(){return this.url_},gr.prototype.handleFeatureChange_=function(t){var i=t.target,s=ui.getUid(i).toString(),h=i.getGeometry();if(h){var n=h.getExtent();s in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[s],this.featuresRtree_&&this.featuresRtree_.insert(n,i)):this.featuresRtree_&&this.featuresRtree_.update(n,i)}else s in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(i),this.nullGeometryFeatures_[s]=i);var r=i.getId();if(void 0!==r){var e=r.toString();s in this.undefIdIndex_?(delete this.undefIdIndex_[s],this.idIndex_[e]=i):this.idIndex_[e]!==i&&(this.removeFromIdIndex_(i),this.idIndex_[e]=i)}else s in this.undefIdIndex_||(this.removeFromIdIndex_(i),this.undefIdIndex_[s]=i);this.changed(),this.dispatchEvent(new gr.Event("changefeature",i))},gr.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&fi.isEmpty(this.nullGeometryFeatures_)},gr.prototype.loadFeatures=function(t,i,s){var h,n,r=this.loadedExtentsRtree_,e=this.strategy_(t,i);for(h=0,n=e.length;h<n;++h){var o=e[h];r.forEachInExtent(o,(function(t){return bi.containsExtent(t.extent,o)}))||(this.loader_.call(this,o,i,s),r.insert(o,{extent:o.slice()}))}},gr.prototype.removeLoadedExtent=function(t){var i,s=this.loadedExtentsRtree_;s.forEachInExtent(t,(function(s){if(bi.equals(s.extent,t))return i=s,!0})),i&&s.remove(i)},gr.prototype.removeFeature=function(t){var i=ui.getUid(t).toString();i in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[i]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t),this.changed()},gr.prototype.removeFeatureInternal=function(t){var i=ui.getUid(t).toString();this.featureChangeKeys_[i].forEach(ci.unlistenByKey),delete this.featureChangeKeys_[i];var s=t.getId();void 0!==s?delete this.idIndex_[s.toString()]:delete this.undefIdIndex_[i],this.dispatchEvent(new gr.Event("removefeature",t))},gr.prototype.removeFromIdIndex_=function(t){var i=!1;for(var s in this.idIndex_)if(this.idIndex_[s]===t){delete this.idIndex_[s],i=!0;break}return i},gr.prototype.setLoader=function(t){this.loader_=t},ui.inherits(gr.Event=function(t,i){vi.call(this,t),this.feature=i},vi);var _r=function(t){var i=t||{},s=fi.assign({},i);delete s.preload,delete s.useInterimTilesOnError,Ws.call(this,s),this.setPreload(void 0!==i.preload?i.preload:0),this.setUseInterimTilesOnError(void 0===i.useInterimTilesOnError||i.useInterimTilesOnError),this.type="TILE"};ui.inherits(_r,Ws),_r.prototype.getPreload=function(){return this.get("preload")},_r.prototype.setPreload=function(t){this.set("preload",t)},_r.prototype.getUseInterimTilesOnError=function(){return this.get("useInterimTilesOnError")},_r.prototype.setUseInterimTilesOnError=function(t){this.set("useInterimTilesOnError",t)};var wr=function(t){var i=t||{},s=fi.assign({},i);delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,Ws.call(this,s),this.declutter_=void 0!==i.declutter&&i.declutter,this.renderBuffer_=void 0!==i.renderBuffer?i.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(i.style),this.updateWhileAnimating_=void 0!==i.updateWhileAnimating&&i.updateWhileAnimating,this.updateWhileInteracting_=void 0!==i.updateWhileInteracting&&i.updateWhileInteracting,this.renderMode_=i.renderMode||"vector",this.type="VECTOR"};ui.inherits(wr,Ws),wr.prototype.getDeclutter=function(){return this.declutter_},wr.prototype.setDeclutter=function(t){this.declutter_=t},wr.prototype.getRenderBuffer=function(){return this.renderBuffer_},wr.prototype.getRenderOrder=function(){return this.get(wr.Property_.RENDER_ORDER)},wr.prototype.getStyle=function(){return this.style_},wr.prototype.getStyleFunction=function(){return this.styleFunction_},wr.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},wr.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},wr.prototype.setRenderOrder=function(t){this.set(wr.Property_.RENDER_ORDER,t)},wr.prototype.setStyle=function(t){this.style_=void 0!==t?t:Jn.defaultFunction,this.styleFunction_=null===t?void 0:Jn.createFunction(this.style_),this.changed()},wr.prototype.getRenderMode=function(){return this.renderMode_},wr.Property_={RENDER_ORDER:"renderOrder"};var yr=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-scale-line";this.innerElement_=document.createElement("DIV"),this.innerElement_.className=s+"-inner",this.element_=document.createElement("DIV"),this.element_.className=s+" "+Gs.CLASS_UNSELECTABLE,this.element_.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==i.minWidth?i.minWidth:64,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",Is.call(this,{element:this.element_,render:i.render?i.render:yr.render,target:i.target}),ci.listen(this,mi.getChangeEventType(yr.Property_.UNITS),this.handleUnitsChanged_,this),this.setUnits(i.units||"metric")};ui.inherits(yr,Is),yr.LEADING_DIGITS=[1,2,5],yr.prototype.getUnits=function(){return this.get(yr.Property_.UNITS)},yr.render=function(t){var i=t.frameState;this.viewState_=i?i.viewState:null,this.updateElement_()},yr.prototype.handleUnitsChanged_=function(){this.updateElement_()},yr.prototype.setUnits=function(t){this.set(yr.Property_.UNITS,t)},yr.prototype.updateElement_=function(){var t=this.viewState_;if(t){var i=t.center,s=t.projection,h=this.getUnits(),n=Li.getPointResolution(s,t.resolution,i,"degrees"==h?Pi.DEGREES:Pi.METERS);"degrees"!=h&&(n*=s.getMetersPerUnit());var r=this.minWidth_*n,e="";if("degrees"==h){var o=Li.METERS_PER_UNIT[Pi.DEGREES];s.getUnits()==Pi.DEGREES?r*=o:n/=o,r<o/60?(e="″",n*=3600):r<o?(e="′",n*=60):e="°"}else"imperial"==h?r<.9144?(e="in",n/=.0254):r<1609.344?(e="ft",n/=.3048):(e="mi",n/=1609.344):"nautical"==h?(n/=1852,e="nm"):"metric"==h?r<.001?(e="μm",n*=1e6):r<1?(e="mm",n*=1e3):r<1e3?e="m":(e="km",n/=1e3):"us"==h?r<.9144?(e="in",n*=39.37):r<1609.344?(e="ft",n/=.30480061):(e="mi",n/=1609.3472):gi(!1,33);for(var a,u,f=3*Math.floor(Math.log(this.minWidth_*n)/Math.log(10));;){if(a=yr.LEADING_DIGITS[(f%3+3)%3]*Math.pow(10,Math.floor(f/3)),u=Math.round(a/n),isNaN(u))return this.element_.style.display="none",void(this.renderedVisible_=!1);if(u>=this.minWidth_)break;++f}var c=a+" "+e;this.renderedHTML_!=c&&(this.innerElement_.innerHTML=c,this.renderedHTML_=c),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},yr.Property_={UNITS:"units"};var br=function(t,i,s,h,n,r){di.call(this),this.hitDetectionImage_=null,this.image_=t||new Image,null!==h&&(this.image_.crossOrigin=h),this.canvas_=r?document.createElement("CANVAS"):null,this.color_=r,this.imageListenerKeys_=null,this.imageState_=n,this.size_=s,this.src_=i,this.tainting_=!1,2==this.imageState_&&this.determineTainting_()};ui.inherits(br,di),br.get=function(t,i,s,h,n,r){var e=xh.iconImageCache,o=e.get(i,h,r);return o||(o=new br(t,i,s,h,n,r),e.set(i,h,r,o)),o},br.prototype.determineTainting_=function(){var t=Cs(1,1);try{t.drawImage(this.image_,0,0),t.getImageData(0,0,1,1)}catch(i){this.tainting_=!0}},br.prototype.dispatchChangeEvent_=function(){this.dispatchEvent("change")},br.prototype.handleImageError_=function(){this.imageState_=3,this.unlistenImage_(),this.dispatchChangeEvent_()},br.prototype.handleImageLoad_=function(){this.imageState_=2,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.determineTainting_(),this.replaceColor_(),this.dispatchChangeEvent_()},br.prototype.getImage=function(){return this.canvas_?this.canvas_:this.image_},br.prototype.getImageState=function(){return this.imageState_},br.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.tainting_){var t=this.size_[0],i=this.size_[1],s=Cs(t,i);s.fillRect(0,0,t,i),this.hitDetectionImage_=s.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},br.prototype.getSize=function(){return this.size_},br.prototype.getSrc=function(){return this.src_},br.prototype.load=function(){if(0==this.imageState_){this.imageState_=1,this.imageListenerKeys_=[ci.listenOnce(this.image_,"error",this.handleImageError_,this),ci.listenOnce(this.image_,"load",this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}},br.prototype.replaceColor_=function(){if(!this.tainting_&&null!==this.color_){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 i=t.getImageData(0,0,this.image_.width,this.image_.height),s=i.data,h=this.color_[0]/255,n=this.color_[1]/255,r=this.color_[2]/255,e=0,o=s.length;e<o;e+=4)s[e]*=h,s[e+1]*=n,s[e+2]*=r;t.putImageData(i,0,0)}},br.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(ci.unlistenByKey),this.imageListenerKeys_=null};var xr=function(t){var i=t||{};this.anchor_=void 0!==i.anchor?i.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==i.anchorOrigin?i.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==i.anchorXUnits?i.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==i.anchorYUnits?i.anchorYUnits:"fraction",this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null;var s=void 0!==i.img?i.img:null,h=void 0!==i.imgSize?i.imgSize:null,n=i.src;gi(!(void 0!==n&&s),4),gi(!s||s&&h,5),void 0!==n&&0!==n.length||!s||(n=s.src||ui.getUid(s).toString()),gi(void 0!==n&&n.length>0,6);var r=void 0!==i.src?0:2;this.color_=void 0!==i.color?dh.asArray(i.color):null,this.iconImage_=br.get(s,n,h,this.crossOrigin_,r,this.color_),this.offset_=void 0!==i.offset?i.offset:[0,0],this.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==i.size?i.size:null,qn.call(this,{opacity:void 0!==i.opacity?i.opacity:1,rotation:void 0!==i.rotation?i.rotation:0,scale:void 0!==i.scale?i.scale:1,snapToPixel:void 0===i.snapToPixel||i.snapToPixel,rotateWithView:void 0!==i.rotateWithView&&i.rotateWithView})};ui.inherits(xr,qn),xr.prototype.clone=function(){return new xr({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(),snapToPixel:this.getSnapToPixel(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},xr.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,i=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!i)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=i[0]),"fraction"==this.anchorYUnits_&&(t[1]*=i[1])}if("top-left"!=this.anchorOrigin_){if(!i)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+i[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+i[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},xr.prototype.getColor=function(){return this.color_},xr.prototype.getImage=function(t){return this.iconImage_.getImage(t)},xr.prototype.getImageSize=function(){return this.iconImage_.getSize()},xr.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},xr.prototype.getImageState=function(){return this.iconImage_.getImageState()},xr.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},xr.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if("top-left"!=this.offsetOrigin_){var i=this.getSize(),s=this.iconImage_.getSize();if(!i||!s)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=s[0]-i[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=s[1]-i[1]-t[1])}return this.origin_=t,this.origin_},xr.prototype.getSrc=function(){return this.iconImage_.getSrc()},xr.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},xr.prototype.listenImageChange=function(t,i){return ci.listen(this.iconImage_,"change",t,i)},xr.prototype.load=function(){this.iconImage_.load()},xr.prototype.unlistenImageChange=function(t,i){ci.unlisten(this.iconImage_,"change",t,i)},window.proj4=st,window.proj4.defs("EPSG:2056","+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs");const Er={anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:.5,src:`${window.stzhComponents.pathMedia}/olmap/marker.png`},Sr=Object.assign(Object.assign({},Er),{src:`${window.stzhComponents.pathMedia}/olmap/marker-active.png`}),Cr=Object.assign(Object.assign({},Er),{anchor:[.5,.5],src:`${window.stzhComponents.pathMedia}/olmap/marker-position.png`}),Ar=class{constructor(s){t(this,s),this.stzhInitialized=i(this,"stzhInitialized",7),this.stzhPostRender=i(this,"stzhPostRender",7),this.stzhMoveStart=i(this,"stzhMoveStart",7),this.stzhMoveEnd=i(this,"stzhMoveEnd",7),this.handlePostRender=()=>{this.stzhPostRender.emit({component:"stzh-olmap"})},this.handleMoveStart=()=>{this.stzhMoveStart.emit({component:"stzh-olmap"})},this.handleMoveEnd=()=>{this.stzhMoveEnd.emit({component:"stzh-olmap"})},this.handleInsideModalOpen=()=>{this.map&&requestAnimationFrame((()=>{this.map.updateSize()}))},this.handlePrintButtonClick=()=>{this.printIframe||(this.printIframe=document.createElement("iframe"),Object.assign(this.printIframe.style,{height:"0px",width:"0px",position:"absolute",border:"none"}),this.element.append(this.printIframe)),this.printIframe.innerHTML="";const t=this.printIframe.contentWindow,i=this.constructor.style.replace('@charset "UTF-8";',""),s=Array.from(document.querySelectorAll("link")).map((t=>t.outerHTML));let h;this.map.once("postcompose",(function(t){h=t.context.canvas.toDataURL("image/png")})),this.map.renderSync(),t.document.body.innerHTML=`\n ${s.join("")}\n\n <style type="text/css">\n ${i}\n </style>\n\n <div class="stzh-olmap__map stzh-olmap__map--print">\n <img class="stzh-olmap__print-image" src="${h}" alt="">\n ${this.element.querySelector(".ol-scale-line.ol-unselectable").outerHTML}\n </div>\n `,setTimeout((()=>{try{t.document.execCommand("print",!1,null)}catch(i){t.print()}}),1e3)},this.localization=void 0,this.hostname="www.ogc.stadt-zuerich.ch",this.scaleControl=!0,this.layerControl=!0,this.printControl=!0,this.locationControl=!1,this.layer="streets",this.zoom=7,this.center=[2683311,1247082],this.centerMarker=!0,this.resolutions=[67.73333333333,33.8666666667,16.9333333333,8.4666666667,4.2333333333,2.1166666667,1.0583333333,.5291666667,.2645833333,.1322916667,.0661458333],this.layers={streets:{thumbnailUrl:`${window.stzhComponents.pathMedia}/olmap/thumb-streets.jpg`,options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"basiskarte_zuerich_gebaeudeschraegansicht",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}},satellite:{thumbnailUrl:`${window.stzhComponents.pathMedia}/olmap/thumb-satellite.jpg`,options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"orthofoto",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}}}}zoomWatcher(t){this.map&&this.map.getView().setZoom(t)}scaleControlWatcher(t){this.map&&(t?(this.scaleControlOl=new yr({units:"metric"}),this.map.addControl(this.scaleControlOl)):(this.scaleControl&&this.map.removeControl(this.scaleControlOl),this.scaleControlOl=null))}printControlWatcher(t){this.map&&(t?(this.printControlElement=document.createElement("button"),this.printControlElement.className="ol-print",this.printControlElement.ariaLabel=this.localization.printLabel,this.printControlElement.addEventListener("click",this.handlePrintButtonClick),this.printControlElement.innerHTML='<stzh-icon name="print" class="ol-print__icon"></stzh-icon>',this.printControlOl=new Is({element:this.printControlElement}),this.map.addControl(this.printControlOl)):(this.printControlOl&&this.map.removeControl(this.printControlOl),this.printControlOl=null,this.printControlElement=null))}layerControlWatcher(t){this.map&&1!==this.layersArray.length&&(t?(this.layerControlElement=document.createElement("button"),this.layerControlElement.className="ol-layer",this.layerControlElement.addEventListener("click",(()=>{this.layer="streets"===this.layer?"satellite":"streets"})),this.layerControlImageElement=document.createElement("img"),this.layerControlImageElement.className="ol-layer__thumbnail",this.layerControlImageElement.setAttribute("role","presentation"),this.layerControlImageElement.setAttribute("alt",""),this.layerControlTextElement=document.createElement("span"),this.layerControlTextElement.className="ol-layer__text",this.layerControlElement.appendChild(this.layerControlImageElement),this.layerControlElement.appendChild(this.layerControlTextElement),this.layerControlOl=new Is({element:this.layerControlElement}),this.map.addControl(this.layerControlOl)):(this.layerControlOl&&this.map.removeControl(this.layerControlOl),this.layerControlOl=null,this.layerControlElement=null,this.layerControlImageElement=null,this.layerControlTextElement=null))}locationControlWatcher(t){if(this.map)if(t){this.locationControlElement=document.createElement("button"),this.locationControlElement.className="ol-location",this.locationControlElement.innerHTML='<stzh-icon name="target-bullet" class="ol-location__icon"></stzh-icon>',this.locationControlElement.addEventListener("click",(()=>{this.geolocation.getTracking()?this.disableLocationTracking():this.enableLocationTracking()})),this.locationControlOl=new Is({element:this.locationControlElement}),this.geolocation=new ss({projection:this.map.getView().getProjection()}),this.positionMarkerOl=new Zn,this.positionMarkerOl.setId("position");const t=new Jn({image:new xr(Cr)});this.positionMarkerOl.setStyle(t),this.positionLayer.getSource().addFeature(this.positionMarkerOl),this.geolocation.on("change:position",(()=>{const t=this.geolocation.getPosition();this.positionMarkerOl.setGeometry(new qi(t)),bi.containsExtent(this.layers[this.layer].options.extent,this.positionMarkerOl.getGeometry().getExtent())&&this.map.getView().setCenter(t)})),this.geolocation.on("change:tracking",(()=>{const t=this.geolocation.getTracking();this.positionMarkerOl.setGeometry(null),this.setLocationControlState(t)})),this.geolocation.on("error",(()=>{this.setLocationControlState(!1)})),this.map.addControl(this.locationControlOl)}else this.disableLocationTracking(),this.locationControlOl&&this.map.removeControl(this.locationControlOl),this.positionMarkerOl&&this.positionLayer.getSource().removeFeature(this.positionMarkerOl),this.locationControlOl=null,this.locationControlElement=null,this.geolocation=null,this.positionMarkerOl=null}layerWatcher(t){this.map&&Object.entries(this.rasterLayers).forEach((([i,s])=>{if(i===t){s.setVisible(!0),this.map.getView().set("projection",this.projections[t]);const h=this.layersArray.find((([t])=>t!==this.layer));if(h&&(this.layerControlImageElement&&(this.layerControlImageElement.src=h[1].thumbnailUrl),this.layerControlTextElement)){let t="";"streets"===i?t=this.localization.streetsLayerTitle:"satellite"===i&&(t=this.localization.satelliteLayerTitle),this.layerControlTextElement.textContent=h[1].title||t}}else s.setVisible(!1)}))}centerWatcher(t){this.map.getView().setCenter(t),this.centerMarkerOl&&this.centerMarkerOl.setGeometry(new qi(t))}async centerMarkerWatcher(t){t?this.centerMarkerOl=await this.addIconMarker(this.center):this.centerMarkerOl&&this.removeIconMarker(this.centerMarkerOl)}async getMap(){return this.map}async addIconMarker(t){const i=new Zn({geometry:new qi(t)}),s=new Jn({image:new xr(Er)});return i.setStyle(s),this.iconLayer.getSource().addFeature(i),i}async removeIconMarker(t){return this.iconLayer.getSource().removeFeature(t)}async setIconMarkerActive(t){t.setStyle(new Jn({image:new xr(Sr)}))}async setIconMarkerInactive(t){t.setStyle(new Jn({image:new xr(Er)}))}async enableLocationTracking(){this.setLocationControlState(!0),this.geolocation&&this.geolocation.setTracking(!0)}async disableLocationTracking(){this.setLocationControlState(!1),this.geolocation&&this.geolocation.setTracking(!1)}setLocationControlState(t){this.positionLayer&&this.positionLayer.setVisible(t),this.locationControlElement&&this.locationControlElement.classList.toggle("active",t)}createMap(){const t=document.createElement("stzh-icon");t.ariaLabel=this.localization.zoomInLabel,t.name="plus";const i=document.createElement("stzh-icon");return i.ariaLabel=this.localization.zoomOutLabel,i.name="minus",new Xn({controls:Xs({zoomOptions:{zoomInLabel:t,zoomOutLabel:i,zoomInTipLabel:"",zoomOutTipLabel:""}}),interactions:eh({mouseWheelZoom:!1}),loadTilesWhileAnimating:!0,loadTilesWhileInteracting:!0,target:this.mapElement,logo:!1})}createRasterLayer(t,i){return new _r({title:"wmts",type:"base",extent:i.extent,source:this.createLayerSource(t,i)})}createLayerSource(t,i){return this.projections||(this.projections={}),this.projections[t]=new Ni({code:"EPSG:2056",extent:i.extent}),this.creatRasterSource(t,i)}creatRasterSource(t,i){const{url:s,layer:h,matrixSet:n,origin:r}=i,e=[];for(let a=0;a<this.resolutions.length;a++)e.push(a);const o=new lr({origin:r,resolutions:this.resolutions,matrixIds:e,tileSize:[512,512]});return new dr({url:s,tileGrid:o,style:"default",projection:this.projections[t],crossOrigin:"anonymous",layer:h,matrixSet:n,requestEncoding:"REST"})}createIconLayer(){return new wr({source:new gr({})})}initMap(){if(this.map=this.createMap(),this.map.on("postrender",this.handlePostRender),this.map.on("movestart",this.handleMoveStart),this.map.on("moveend",this.handleMoveEnd),this.layersArray=Object.entries(this.layers),this.layersArray.length>2)throw new Error("There are only two different layers allowed.");this.rasterLayers={},this.layersArray.forEach((([t,i])=>{i.options.url=i.options.url.replace(/{hostname}/gi,this.hostname),this.rasterLayers[t]=this.createRasterLayer(t,i.options),this.map.addLayer(this.rasterLayers[t])})),this.positionLayer=this.createIconLayer(),this.positionLayer.setVisible(!1),this.map.addLayer(this.positionLayer),this.iconLayer=this.createIconLayer(),this.map.addLayer(this.iconLayer);const t=new Ss({center:this.center,projection:this.projections[this.layer],zoom:this.zoom,resolutions:this.resolutions});this.map.setView(t),this.scaleControlWatcher(this.scaleControl),this.printControlWatcher(this.printControl),this.locationControlWatcher(this.locationControl),this.layerControlWatcher(this.layerControl),this.layerWatcher(this.layer),this.centerWatcher(this.center),this.centerMarkerWatcher(this.centerMarker),this.stzhInitialized.emit({component:"stzh-olmap"})}componentShouldUpdate(t,i,s){return["hostname","localization","layers","resolutions"].includes(s)}async componentWillLoad(){this.localization||(this.localization=await r(this.element,"olmap"))}componentWillUpdate(){this.map&&(this.map.setTarget(null),this.map=null)}componentDidRender(){this.map||this.initMap()}connectedCallback(){const t=this.element.closest("stzh-dialog");t&&t.addEventListener("stzhOpen",this.handleInsideModalOpen)}disconnectedCallback(){this.map&&(this.map.setTarget(null),this.map=null);const t=this.element.closest("stzh-dialog");t&&t.removeEventListener("stzhOpen",this.handleInsideModalOpen)}render(){return s(h,null,s("div",{class:{"stzh-olmap":!0}},s("div",{ref:t=>this.mapElement=t,class:"stzh-olmap__map"})))}get element(){return n(this)}static get watchers(){return{zoom:["zoomWatcher"],scaleControl:["scaleControlWatcher"],printControl:["printControlWatcher"],layerControl:["layerControlWatcher"],locationControl:["locationControlWatcher"],layer:["layerWatcher"],center:["centerWatcher"],centerMarker:["centerMarkerWatcher"]}}};Ar.style=":host{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}:host[hidden]{display:none}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}stzh-olmap{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block;position:relative;width:100%;height:18.75rem}stzh-olmap[hidden]{display:none}stzh-olmap *,stzh-olmap *::before,stzh-olmap *::after{-webkit-box-sizing:border-box;box-sizing:border-box}@media screen and (min-width: 800px){stzh-olmap{height:25rem}}.stzh-olmap__map{position:absolute;width:100%;height:100%;top:0;left:0}.stzh-olmap__map--print{margin-top:var(--stzh-space-xxlarge);max-width:100%;height:auto}.stzh-olmap__print-image{display:block;max-width:100%}.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom-in,.stzh-olmap .ol-zoom-out{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-deca-font-size);line-height:var(--stzh-font-deca-text-line-height);letter-spacing:var(--stzh-font-deca-text-letter-spacing);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;border-radius:0;color:var(--stzh-color-primary, var(--stzh-color-zueriblue));-webkit-transition:all var(--stzh-base-transition-animation-speed) ease;transition:all var(--stzh-base-transition-animation-speed) ease;background-color:var(--stzh-color-white);width:2.5rem;height:2.375rem;cursor:pointer}.stzh-olmap .ol-print stzh-icon,.stzh-olmap .ol-location stzh-icon,.stzh-olmap .ol-zoom-in stzh-icon,.stzh-olmap .ol-zoom-out stzh-icon{--size:var(--stzh-icon-size-small)}.stzh-olmap .ol-print:hover,.stzh-olmap .ol-location:hover,.stzh-olmap .ol-zoom-in:hover,.stzh-olmap .ol-zoom-out:hover{color:var(--stzh-color-white);background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom{position:absolute;right:0.625rem;-webkit-box-shadow:var(--stzh-box-shadow-popover);box-shadow:var(--stzh-box-shadow-popover);border-radius:var(--stzh-form-input-border-radius)}@media screen and (min-width: 800px){.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom{right:1.25rem}}.stzh-olmap .ol-layer{left:0.625rem;bottom:0.625rem;right:auto;padding:var(--stzh-space-xxxsmall);border:none}@media screen and (min-width: 800px){.stzh-olmap .ol-layer{left:1.25rem;bottom:1.25rem}}.stzh-olmap .ol-layer__thumbnail{width:4.6875rem;height:4.6875rem;display:block}.stzh-olmap .ol-layer__text{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);position:absolute;bottom:0;left:0;right:0;text-align:left;background-color:var(--stzh-color-white);color:var(--stzh-color-primary, var(--stzh-color-zueriblue));padding-left:calc(var(--stzh-space-xxxsmall) + 0.0625rem);padding-right:calc(var(--stzh-space-xxxsmall) + 0.0625rem)}.stzh-olmap .ol-layer:hover .ol-layer__text{color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-location{bottom:calc(3.75rem + 7.125rem + var(--stzh-space-small) * 2)}@media screen and (min-width: 800px){.stzh-olmap .ol-location{bottom:calc(4.375rem + 7.125rem + var(--stzh-space-small) * 2)}}.stzh-olmap .ol-location.active{background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));color:var(--stzh-color-white)}.stzh-olmap .ol-zoom{bottom:calc(3.75rem + 2.375rem + var(--stzh-space-small));background-color:var(--stzh-color-grey13)}@media screen and (min-width: 800px){.stzh-olmap .ol-zoom{bottom:calc(4.375rem + 2.375rem + var(--stzh-space-small))}}.stzh-olmap .ol-zoom-in{margin-bottom:0.0625rem}.stzh-olmap .ol-print{bottom:3.75rem}@media screen and (min-width: 800px){.stzh-olmap .ol-print{bottom:4.375rem}}.stzh-olmap .ol-rotate,.stzh-olmap .ol-attribution{display:none}.stzh-olmap .ol-scale-line{position:absolute;bottom:0;right:0;padding:var(--stzh-space-xxsmall);background:var(--stzh-color-white);border-top-left-radius:var(--stzh-form-input-border-radius)}.stzh-olmap .ol-scale-line-inner{font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);border:0.0625rem solid var(--stzh-color-grey55);border-top:0;color:var(--stzh-color-grey55);text-align:center}";export{Ar as stzh_olmap}
|
|
7
|
+
*/wi.prototype.geodesicArea=function(t){return wi.getArea_(t,this.radius)},wi.prototype.haversineDistance=function(t,i){return wi.getDistance_(t,i,this.radius)},wi.prototype.offset=function(t,i,s){var h=_i.toRadians(t[1]),n=_i.toRadians(t[0]),r=i/this.radius,e=Math.asin(Math.sin(h)*Math.cos(r)+Math.cos(h)*Math.sin(r)*Math.cos(s)),o=n+Math.atan2(Math.sin(s)*Math.sin(r)*Math.cos(h),Math.cos(r)-Math.sin(h)*Math.sin(e));return[_i.toDegrees(o),_i.toDegrees(e)]},wi.DEFAULT_RADIUS=6371008.8,wi.getLength=function(t,i){var s,h,n,r,e,o,a=i||{},u=a.radius||wi.DEFAULT_RADIUS,f=a.projection||"EPSG:3857",c=(t=t.clone().transform(f,"EPSG:4326")).getType(),l=0;switch(c){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":s=t.getCoordinates(),l=wi.getLength_(s,u);break;case"MultiLineString":case"Polygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)l+=wi.getLength_(s[n],u);break;case"MultiPolygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)for(e=0,o=(h=s[n]).length;e<o;++e)l+=wi.getLength_(h[e],u);break;case"GeometryCollection":var v=t.getGeometries();for(n=0,r=v.length;n<r;++n)l+=wi.getLength(v[n],i);break;default:throw new Error("Unsupported geometry type: "+c)}return l},wi.getLength_=function(t,i){for(var s=0,h=0,n=t.length;h<n-1;++h)s+=wi.getDistance_(t[h],t[h+1],i);return s},wi.getDistance_=function(t,i,s){var h=_i.toRadians(t[1]),n=_i.toRadians(i[1]),r=(n-h)/2,e=_i.toRadians(i[0]-t[0])/2,o=Math.sin(r)*Math.sin(r)+Math.sin(e)*Math.sin(e)*Math.cos(h)*Math.cos(n);return 2*s*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))},wi.getArea=function(t,i){var s,h,n,r,e,o,a=i||{},u=a.radius||wi.DEFAULT_RADIUS,f=a.projection||"EPSG:3857",c=(t=t.clone().transform(f,"EPSG:4326")).getType(),l=0;switch(c){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(s=t.getCoordinates(),l=Math.abs(wi.getArea_(s[0],u)),n=1,r=s.length;n<r;++n)l-=Math.abs(wi.getArea_(s[n],u));break;case"MultiPolygon":for(n=0,r=(s=t.getCoordinates()).length;n<r;++n)for(h=s[n],l+=Math.abs(wi.getArea_(h[0],u)),e=1,o=h.length;e<o;++e)l-=Math.abs(wi.getArea_(h[e],u));break;case"GeometryCollection":var v=t.getGeometries();for(n=0,r=v.length;n<r;++n)l+=wi.getArea(v[n],i);break;default:throw new Error("Unsupported geometry type: "+c)}return l},wi.getArea_=function(t,i){for(var s=0,h=t.length,n=t[h-1][0],r=t[h-1][1],e=0;e<h;e++){var o=t[e][0],a=t[e][1];s+=_i.toRadians(o-n)*(2+Math.sin(_i.toRadians(r))+Math.sin(_i.toRadians(a))),n=o,r=a}return s*i*i/2};var yi={binarySearch:function(t,i,s){for(var h,n,r=s||yi.numberSafeCompareFunction,e=0,o=t.length,a=!1;e<o;)(n=+r(t[h=e+(o-e>>1)],i))<0?e=h+1:(o=h,a=!n);return a?e:~e},numberSafeCompareFunction:function(t,i){return t>i?1:t<i?-1:0},includes:function(t,i){return t.indexOf(i)>=0},linearFindNearest:function(t,i,s){var h,n=t.length;if(t[0]<=i)return 0;if(i<=t[n-1])return n-1;if(s>0){for(h=1;h<n;++h)if(t[h]<i)return h-1}else if(s<0){for(h=1;h<n;++h)if(t[h]<=i)return h}else for(h=1;h<n;++h){if(t[h]==i)return h;if(t[h]<i)return t[h-1]-i<i-t[h]?h-1:h}return n-1},reverseSubArray:function(t,i,s){for(;i<s;){var h=t[i];t[i]=t[s],t[s]=h,++i,--s}},extend:function(t,i){var s,h=Array.isArray(i)?i:[i],n=h.length;for(s=0;s<n;s++)t[t.length]=h[s]},remove:function(t,i){var s=t.indexOf(i),h=s>-1;return h&&t.splice(s,1),h},find:function(t,i){for(var s,h=t.length>>>0,n=0;n<h;n++)if(i(s=t[n],n,t))return s;return null},equals:function(t,i){var s=t.length;if(s!==i.length)return!1;for(var h=0;h<s;h++)if(t[h]!==i[h])return!1;return!0},stableSort:function(t,i){var s,h=t.length,n=Array(t.length);for(s=0;s<h;s++)n[s]={index:s,value:t[s]};for(n.sort((function(t,s){return i(t.value,s.value)||t.index-s.index})),s=0;s<t.length;s++)t[s]=n[s].value},findIndex:function(t,i){var s;return t.every((function(h,n){return s=n,!i(h,n,t)}))?-1:s},isSorted:function(t,i,s){var h=i||yi.numberSafeCompareFunction;return t.every((function(i,n){if(0===n)return!0;var r=h(t[n-1],i);return!(r>0||s&&0===r)}))}},bi={boundingExtent:function(t){for(var i=bi.createEmpty(),s=0,h=t.length;s<h;++s)bi.extendCoordinate(i,t[s]);return i},boundingExtentXYs_:function(t,i,s){var h=Math.min.apply(null,t),n=Math.min.apply(null,i),r=Math.max.apply(null,t),e=Math.max.apply(null,i);return bi.createOrUpdate(h,n,r,e,s)},buffer:function(t,i,s){return s?(s[0]=t[0]-i,s[1]=t[1]-i,s[2]=t[2]+i,s[3]=t[3]+i,s):[t[0]-i,t[1]-i,t[2]+i,t[3]+i]},clone:function(t,i){return i?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i):t.slice()},closestSquaredDistanceXY:function(t,i,s){var h,n;return(h=i<t[0]?t[0]-i:t[2]<i?i-t[2]:0)*h+(n=s<t[1]?t[1]-s:t[3]<s?s-t[3]:0)*n},containsCoordinate:function(t,i){return bi.containsXY(t,i[0],i[1])},containsExtent:function(t,i){return t[0]<=i[0]&&i[2]<=t[2]&&t[1]<=i[1]&&i[3]<=t[3]},containsXY:function(t,i,s){return t[0]<=i&&i<=t[2]&&t[1]<=s&&s<=t[3]},coordinateRelationship:function(t,i){var s=i[0],h=i[1],n=0;return s<t[0]?n|=16:s>t[2]&&(n|=4),h<t[1]?n|=8:h>t[3]&&(n|=2),0===n&&(n=1),n},createEmpty:function(){return[1/0,1/0,-1/0,-1/0]},createOrUpdate:function(t,i,s,h,n){return n?(n[0]=t,n[1]=i,n[2]=s,n[3]=h,n):[t,i,s,h]},createOrUpdateEmpty:function(t){return bi.createOrUpdate(1/0,1/0,-1/0,-1/0,t)},createOrUpdateFromCoordinate:function(t,i){var s=t[0],h=t[1];return bi.createOrUpdate(s,h,s,h,i)},createOrUpdateFromCoordinates:function(t,i){var s=bi.createOrUpdateEmpty(i);return bi.extendCoordinates(s,t)},createOrUpdateFromFlatCoordinates:function(t,i,s,h,n){var r=bi.createOrUpdateEmpty(n);return bi.extendFlatCoordinates(r,t,i,s,h)},createOrUpdateFromRings:function(t,i){var s=bi.createOrUpdateEmpty(i);return bi.extendRings(s,t)},equals:function(t,i){return t[0]==i[0]&&t[2]==i[2]&&t[1]==i[1]&&t[3]==i[3]},extend:function(t,i){return i[0]<t[0]&&(t[0]=i[0]),i[2]>t[2]&&(t[2]=i[2]),i[1]<t[1]&&(t[1]=i[1]),i[3]>t[3]&&(t[3]=i[3]),t},extendCoordinate:function(t,i){i[0]<t[0]&&(t[0]=i[0]),i[0]>t[2]&&(t[2]=i[0]),i[1]<t[1]&&(t[1]=i[1]),i[1]>t[3]&&(t[3]=i[1])},extendCoordinates:function(t,i){var s,h;for(s=0,h=i.length;s<h;++s)bi.extendCoordinate(t,i[s]);return t},extendFlatCoordinates:function(t,i,s,h,n){for(;s<h;s+=n)bi.extendXY(t,i[s],i[s+1]);return t},extendRings:function(t,i){var s,h;for(s=0,h=i.length;s<h;++s)bi.extendCoordinates(t,i[s]);return t},extendXY:function(t,i,s){t[0]=Math.min(t[0],i),t[1]=Math.min(t[1],s),t[2]=Math.max(t[2],i),t[3]=Math.max(t[3],s)},forEachCorner:function(t,i,s){var h;return(h=i.call(s,bi.getBottomLeft(t)))||(h=i.call(s,bi.getBottomRight(t)))||(h=i.call(s,bi.getTopRight(t)))?h:(h=i.call(s,bi.getTopLeft(t)))||!1},getArea:function(t){var i=0;return bi.isEmpty(t)||(i=bi.getWidth(t)*bi.getHeight(t)),i},getBottomLeft:function(t){return[t[0],t[1]]},getBottomRight:function(t){return[t[2],t[1]]},getCenter:function(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]},getCorner:function(t,i){var s;return"bottom-left"===i?s=bi.getBottomLeft(t):"bottom-right"===i?s=bi.getBottomRight(t):"top-left"===i?s=bi.getTopLeft(t):"top-right"===i?s=bi.getTopRight(t):gi(!1,13),s},getEnlargedArea:function(t,i){var s=Math.min(t[0],i[0]),h=Math.min(t[1],i[1]);return(Math.max(t[2],i[2])-s)*(Math.max(t[3],i[3])-h)},getForViewAndSize:function(t,i,s,h,n){var r=i*h[0]/2,e=i*h[1]/2,o=Math.cos(s),a=Math.sin(s),u=r*o,f=r*a,c=e*o,l=e*a,v=t[0],d=t[1],M=v-u+l,m=v-u-l,p=v+u-l,g=v+u+l,_=d-f-c,w=d-f+c,y=d+f+c,b=d+f-c;return bi.createOrUpdate(Math.min(M,m,p,g),Math.min(_,w,y,b),Math.max(M,m,p,g),Math.max(_,w,y,b),n)},getHeight:function(t){return t[3]-t[1]},getIntersectionArea:function(t,i){var s=bi.getIntersection(t,i);return bi.getArea(s)},getIntersection:function(t,i,s){var h=s||bi.createEmpty();return bi.intersects(t,i)&&(h[0]=t[0]>i[0]?t[0]:i[0],h[1]=t[1]>i[1]?t[1]:i[1],h[2]=t[2]<i[2]?t[2]:i[2],h[3]=t[3]<i[3]?t[3]:i[3]),h},getMargin:function(t){return bi.getWidth(t)+bi.getHeight(t)},getSize:function(t){return[t[2]-t[0],t[3]-t[1]]},getTopLeft:function(t){return[t[0],t[3]]},getTopRight:function(t){return[t[2],t[3]]},getWidth:function(t){return t[2]-t[0]},intersects:function(t,i){return t[0]<=i[2]&&t[2]>=i[0]&&t[1]<=i[3]&&t[3]>=i[1]},isEmpty:function(t){return t[2]<t[0]||t[3]<t[1]},returnOrUpdate:function(t,i){return i?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i):t},scaleFromCenter:function(t,i){var s=(t[2]-t[0])/2*(i-1),h=(t[3]-t[1])/2*(i-1);t[0]-=s,t[2]+=s,t[1]-=h,t[3]+=h},intersectsSegment:function(t,i,s){var h=!1,n=bi.coordinateRelationship(t,i),r=bi.coordinateRelationship(t,s);if(1===n||1===r)h=!0;else{var e,o,a=t[0],u=t[1],f=t[2],c=t[3],l=s[0],v=s[1],d=(v-i[1])/(l-i[0]);2&r&&!(2&n)&&(h=(e=l-(v-c)/d)>=a&&e<=f),h||!(4&r)||4&n||(h=(o=v-(l-f)*d)>=u&&o<=c),h||!(8&r)||8&n||(h=(e=l-(v-u)/d)>=a&&e<=f),h||!(16&r)||16&n||(h=(o=v-(l-a)*d)>=u&&o<=c)}return h},applyTransform:function(t,i,s){var h=[t[0],t[1],t[0],t[3],t[2],t[1],t[2],t[3]];return i(h,h,2),bi.boundingExtentXYs_([h[0],h[2],h[4],h[6]],[h[1],h[3],h[5],h[7]],s)}},xi={TRUE:function(){return!0},FALSE:function(){return!1}},Ei=function(t,i,s,h,n,r){var e,o=r||[],a=0;for(e=i;e<s;e+=h){var u=t[e],f=t[e+1];o[a++]=n[0]*u+n[2]*f+n[4],o[a++]=n[1]*u+n[3]*f+n[5]}return r&&o.length!=a&&(o.length=a),o},Si=function(t,i,s,h,n,r,e){for(var o=e||[],a=Math.cos(n),u=Math.sin(n),f=r[0],c=r[1],l=0,v=i;v<s;v+=h){var d=t[v]-f,M=t[v+1]-c;o[l++]=f+d*a-M*u,o[l++]=c+d*u+M*a;for(var m=v+2;m<v+h;++m)o[l++]=t[m]}return e&&o.length!=l&&(o.length=l),o},Ci=function(t,i,s,h,n,r,e,o){for(var a=o||[],u=e[0],f=e[1],c=0,l=i;l<s;l+=h){var v=t[l+1]-f;a[c++]=u+n*(t[l]-u),a[c++]=f+r*v;for(var d=l+2;d<l+h;++d)a[c++]=t[d]}return o&&a.length!=c&&(a.length=c),a},Ai=function(t,i,s,h,n,r,e){var o,a,u=e||[],f=0;for(o=i;o<s;o+=h)for(u[f++]=t[o]+n,u[f++]=t[o+1]+r,a=o+2;a<o+h;++a)u[f++]=t[a];return e&&u.length!=f&&(u.length=f),u},Pi={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft",METERS_PER_UNIT:{}};Pi.METERS_PER_UNIT[Pi.DEGREES]=2*Math.PI*6370997/360,Pi.METERS_PER_UNIT[Pi.FEET]=.3048,Pi.METERS_PER_UNIT[Pi.METERS]=1,Pi.METERS_PER_UNIT[Pi.USFEET]=1200/3937;var Ri={cache_:null,set:function(t){Ri.cache_=t},get:function(){return Ri.cache_||window.proj4}},Ni=function(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit;var i=t.code;if(ui.ENABLE_PROJ4JS){var s=Ri.get();if("function"==typeof s){var h=s.defs(i);void 0!==h&&(void 0!==h.axis&&void 0===t.axisOrientation&&(this.axisOrientation_=h.axis),void 0===t.metersPerUnit&&(this.metersPerUnit_=h.to_meter),void 0===t.units&&(this.units_=h.units))}}};Ni.prototype.canWrapX=function(){return this.canWrapX_},Ni.prototype.getCode=function(){return this.code_},Ni.prototype.getExtent=function(){return this.extent_},Ni.prototype.getUnits=function(){return this.units_},Ni.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||Pi.METERS_PER_UNIT[this.units_]},Ni.prototype.getWorldExtent=function(){return this.worldExtent_},Ni.prototype.getAxisOrientation=function(){return this.axisOrientation_},Ni.prototype.isGlobal=function(){return this.global_},Ni.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},Ni.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},Ni.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},Ni.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},Ni.prototype.setWorldExtent=function(t){this.worldExtent_=t},Ni.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},Ni.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_};var zi={Projection_:function(t){Ni.call(this,{code:t,units:Pi.METERS,extent:zi.EXTENT,global:!0,worldExtent:zi.WORLD_EXTENT,getPointResolution:function(t,i){return t/_i.cosh(i[1]/zi.RADIUS)}})}};ui.inherits(zi.Projection_,Ni),zi.RADIUS=6378137,zi.HALF_SIZE=Math.PI*zi.RADIUS,zi.EXTENT=[-zi.HALF_SIZE,-zi.HALF_SIZE,zi.HALF_SIZE,zi.HALF_SIZE],zi.WORLD_EXTENT=[-180,-85,180,85],zi.PROJECTIONS=[new zi.Projection_("EPSG:3857"),new zi.Projection_("EPSG:102100"),new zi.Projection_("EPSG:102113"),new zi.Projection_("EPSG:900913"),new zi.Projection_("urn:ogc:def:crs:EPSG:6.18:3:3857"),new zi.Projection_("urn:ogc:def:crs:EPSG::3857"),new zi.Projection_("http://www.opengis.net/gml/srs/epsg.xml#3857")],zi.fromEPSG4326=function(t,i,s){var h=t.length,n=s>1?s:2,r=i;void 0===r&&(r=n>2?t.slice():new Array(h));for(var e=zi.HALF_SIZE,o=0;o<h;o+=n){r[o]=e*t[o]/180;var a=zi.RADIUS*Math.log(Math.tan(Math.PI*(t[o+1]+90)/360));a>e?a=e:a<-e&&(a=-e),r[o+1]=a}return r},zi.toEPSG4326=function(t,i,s){var h=t.length,n=s>1?s:2,r=i;void 0===r&&(r=n>2?t.slice():new Array(h));for(var e=0;e<h;e+=n)r[e]=180*t[e]/zi.HALF_SIZE,r[e+1]=360*Math.atan(Math.exp(t[e+1]/zi.RADIUS))/Math.PI-90;return r};var ki={Projection_:function(t,i){Ni.call(this,{code:t,units:Pi.DEGREES,extent:ki.EXTENT,axisOrientation:i,global:!0,metersPerUnit:ki.METERS_PER_UNIT,worldExtent:ki.EXTENT})}};ui.inherits(ki.Projection_,Ni),ki.RADIUS=6378137,ki.EXTENT=[-180,-90,180,90],ki.METERS_PER_UNIT=Math.PI*ki.RADIUS/180,ki.PROJECTIONS=[new ki.Projection_("CRS:84"),new ki.Projection_("EPSG:4326","neu"),new ki.Projection_("urn:ogc:def:crs:EPSG::4326","neu"),new ki.Projection_("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new ki.Projection_("urn:ogc:def:crs:OGC:1.3:CRS84"),new ki.Projection_("urn:ogc:def:crs:OGC:2:84"),new ki.Projection_("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ki.Projection_("urn:x-ogc:def:crs:EPSG:4326","neu")];var Ti={cache_:{},clear:function(){Ti.cache_={}},get:function(t){return Ti.cache_[t]||null},add:function(t,i){Ti.cache_[t]=i}},Oi={cache_:{},clear:function(){Oi.cache_={}},add:function(t,i,s){var h=t.getCode(),n=i.getCode(),r=Oi.cache_;h in r||(r[h]={}),r[h][n]=s},remove:function(t,i){var s=t.getCode(),h=i.getCode(),n=Oi.cache_,r=n[s][h];return delete n[s][h],fi.isEmpty(n[s])&&delete n[s],r},get:function(t,i){var s,h=Oi.cache_;return t in h&&i in h[t]&&(s=h[t][i]),s}},Li={};Li.METERS_PER_UNIT=Pi.METERS_PER_UNIT,Li.SPHERE_=new wi(wi.DEFAULT_RADIUS),ui.ENABLE_PROJ4JS&&(Li.setProj4=function(t){Ri.set(t)}),Li.getPointResolution=function(t,i,s,h){var n,r=(t=Li.get(t)).getPointResolutionFunc();if(r)n=r(i,s);else if(t.getUnits()==Pi.DEGREES&&!h||h==Pi.DEGREES)n=i;else{var e=Li.getTransformFromProjections(t,Li.get("EPSG:4326")),o=[s[0]-i/2,s[1],s[0]+i/2,s[1],s[0],s[1]-i/2,s[0],s[1]+i/2];o=e(o,o,2),n=(Li.SPHERE_.haversineDistance(o.slice(0,2),o.slice(2,4))+Li.SPHERE_.haversineDistance(o.slice(4,6),o.slice(6,8)))/2;var a=h?Pi.METERS_PER_UNIT[h]:t.getMetersPerUnit();void 0!==a&&(n/=a)}return n},Li.addEquivalentProjections=function(t){Li.addProjections(t),t.forEach((function(i){t.forEach((function(t){i!==t&&Oi.add(i,t,Li.cloneTransform)}))}))},Li.addEquivalentTransforms=function(t,i,s,h){t.forEach((function(t){i.forEach((function(i){Oi.add(t,i,s),Oi.add(i,t,h)}))}))},Li.addProjection=function(t){Ti.add(t.getCode(),t),Oi.add(t,t,Li.cloneTransform)},Li.addProjections=function(t){t.forEach(Li.addProjection)},Li.clearAllProjections=function(){Ti.clear(),Oi.clear()},Li.createProjection=function(t,i){return t?"string"==typeof t?Li.get(t):t:Li.get(i)},Li.addCoordinateTransforms=function(t,i,s,h){var n=Li.get(t),r=Li.get(i);Oi.add(n,r,Li.createTransformFromCoordinateTransform(s)),Oi.add(r,n,Li.createTransformFromCoordinateTransform(h))},Li.createTransformFromCoordinateTransform=function(t){return function(i,s,h){var n,r,e,o=i.length,a=void 0!==h?h:2,u=void 0!==s?s:new Array(o);for(r=0;r<o;r+=a)for(n=t([i[r],i[r+1]]),u[r]=n[0],u[r+1]=n[1],e=a-1;e>=2;--e)u[r+e]=i[r+e];return u}},Li.fromLonLat=function(t,i){return Li.transform(t,"EPSG:4326",void 0!==i?i:"EPSG:3857")},Li.toLonLat=function(t,i){var s=Li.transform(t,void 0!==i?i:"EPSG:3857","EPSG:4326"),h=s[0];return(h<-180||h>180)&&(s[0]=_i.modulo(h+180,360)-180),s},Li.get=function(t){var i=null;if(t instanceof Ni)i=t;else if("string"==typeof t){var s=t;if(i=Ti.get(s),ui.ENABLE_PROJ4JS&&!i){var h=Ri.get();"function"==typeof h&&void 0!==h.defs(s)&&(i=new Ni({code:s}),Li.addProjection(i))}}return i},Li.equivalent=function(t,i){if(t===i)return!0;var s=t.getUnits()===i.getUnits();return(t.getCode()===i.getCode()||Li.getTransformFromProjections(t,i)===Li.cloneTransform)&&s},Li.getTransform=function(t,i){var s=Li.get(t),h=Li.get(i);return Li.getTransformFromProjections(s,h)},Li.getTransformFromProjections=function(t,i){var s=t.getCode(),h=i.getCode(),n=Oi.get(s,h);if(ui.ENABLE_PROJ4JS&&!n){var r=Ri.get();if("function"==typeof r){var e=r.defs(s),o=r.defs(h);if(void 0!==e&&void 0!==o){if(e===o)Li.addEquivalentProjections([i,t]);else{var a=r(h,s);Li.addCoordinateTransforms(i,t,a.forward,a.inverse)}n=Oi.get(s,h)}}}return n||(n=Li.identityTransform),n},Li.identityTransform=function(t,i){if(void 0!==i&&t!==i){for(var s=0,h=t.length;s<h;++s)i[s]=t[s];t=i}return t},Li.cloneTransform=function(t,i){var s;if(void 0!==i){for(var h=0,n=t.length;h<n;++h)i[h]=t[h];s=i}else s=t.slice();return s},Li.transform=function(t,i,s){return Li.getTransform(i,s)(t,void 0,t.length)},Li.transformExtent=function(t,i,s){var h=Li.getTransform(i,s);return bi.applyTransform(t,h)},Li.transformWithProjections=function(t,i,s){return Li.getTransformFromProjections(i,s)(t)},Li.addCommon=function(){Li.addEquivalentProjections(zi.PROJECTIONS),Li.addEquivalentProjections(ki.PROJECTIONS),Li.addEquivalentTransforms(ki.PROJECTIONS,zi.PROJECTIONS,zi.fromEPSG4326,zi.toEPSG4326)},Li.addCommon();var Ii={};Ii.tmp_=new Array(6),Ii.create=function(){return[1,0,0,1,0,0]},Ii.reset=function(t){return Ii.set(t,1,0,0,1,0,0)},Ii.multiply=function(t,i){var s=t[0],h=t[1],n=t[2],r=t[3],e=t[4],o=t[5],a=i[0],u=i[1],f=i[2],c=i[3],l=i[4],v=i[5];return t[0]=s*a+n*u,t[1]=h*a+r*u,t[2]=s*f+n*c,t[3]=h*f+r*c,t[4]=s*l+n*v+e,t[5]=h*l+r*v+o,t},Ii.set=function(t,i,s,h,n,r,e){return t[0]=i,t[1]=s,t[2]=h,t[3]=n,t[4]=r,t[5]=e,t},Ii.setFromArray=function(t,i){return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t},Ii.apply=function(t,i){var s=i[0],h=i[1];return i[0]=t[0]*s+t[2]*h+t[4],i[1]=t[1]*s+t[3]*h+t[5],i},Ii.rotate=function(t,i){var s=Math.cos(i),h=Math.sin(i);return Ii.multiply(t,Ii.set(Ii.tmp_,s,h,-h,s,0,0))},Ii.scale=function(t,i,s){return Ii.multiply(t,Ii.set(Ii.tmp_,i,0,0,s,0,0))},Ii.translate=function(t,i,s){return Ii.multiply(t,Ii.set(Ii.tmp_,1,0,0,1,i,s))},Ii.compose=function(t,i,s,h,n,r,e,o){var a=Math.sin(r),u=Math.cos(r);return t[0]=h*u,t[1]=n*a,t[2]=-h*a,t[3]=n*u,t[4]=e*h*u-o*h*a+i,t[5]=e*n*a+o*n*u+s,t},Ii.invert=function(t){var i=Ii.determinant(t);gi(0!==i,32);var s=t[0],h=t[1],n=t[2],r=t[3],e=t[4],o=t[5];return t[0]=r/i,t[1]=-h/i,t[2]=-n/i,t[3]=s/i,t[4]=(n*o-r*e)/i,t[5]=-(s*o-h*e)/i,t},Ii.determinant=function(t){return t[0]*t[3]-t[1]*t[2]};var Fi=function(){mi.call(this),this.extent_=bi.createEmpty(),this.extentRevision_=-1,this.simplifiedGeometryCache={},this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.tmpTransform_=Ii.create()};ui.inherits(Fi,mi),Fi.prototype.clone=function(){},Fi.prototype.closestPointXY=function(){},Fi.prototype.getClosestPoint=function(t,i){var s=i||[NaN,NaN];return this.closestPointXY(t[0],t[1],s,1/0),s},Fi.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},Fi.prototype.computeExtent=function(){},Fi.prototype.containsXY=xi.FALSE,Fi.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),bi.returnOrUpdate(this.extent_,t)},Fi.prototype.rotate=function(){},Fi.prototype.scale=function(){},Fi.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},Fi.prototype.getSimplifiedGeometry=function(){},Fi.prototype.getType=function(){},Fi.prototype.applyTransform=function(){},Fi.prototype.intersectsExtent=function(){},Fi.prototype.translate=function(){},Fi.prototype.transform=function(t,i){var s=this.tmpTransform_,h=(t=Li.get(t)).getUnits()==Pi.TILE_PIXELS?function(h,n,r){var e=t.getExtent(),o=t.getWorldExtent(),a=bi.getHeight(o)/bi.getHeight(e);return Ii.compose(s,o[0],o[3],a,-a,0,0,0),Ei(h,0,h.length,r,s,n),Li.getTransform(t,i)(h,n,r)}:Li.getTransform(t,i);return this.applyTransform(h),this};var Di=function(){Fi.call(this),this.layout="XY",this.stride=2,this.flatCoordinates=null};ui.inherits(Di,Fi),Di.getLayoutForStride_=function(t){var i;return 2==t?i="XY":3==t?i="XYZ":4==t&&(i="XYZM"),i},Di.getStrideForLayout=function(t){var i;return"XY"==t?i=2:"XYZ"==t||"XYM"==t?i=3:"XYZM"==t&&(i=4),i},Di.prototype.containsXY=xi.FALSE,Di.prototype.computeExtent=function(t){return bi.createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},Di.prototype.getCoordinates=function(){},Di.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},Di.prototype.getFlatCoordinates=function(){return this.flatCoordinates},Di.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},Di.prototype.getLayout=function(){return this.layout},Di.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()&&(fi.clear(this.simplifiedGeometryCache),this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var i=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(i))return this.simplifiedGeometryCache[i];var s=this.getSimplifiedGeometryInternal(t);return s.getFlatCoordinates().length<this.flatCoordinates.length?(this.simplifiedGeometryCache[i]=s,s):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)},Di.prototype.getSimplifiedGeometryInternal=function(){return this},Di.prototype.getStride=function(){return this.stride},Di.prototype.setFlatCoordinatesInternal=function(t,i){this.stride=Di.getStrideForLayout(t),this.layout=t,this.flatCoordinates=i},Di.prototype.setCoordinates=function(){},Di.prototype.setLayout=function(t,i,s){var h;if(t)h=Di.getStrideForLayout(t);else{var n;for(n=0;n<s;++n){if(0===i.length)return this.layout="XY",void(this.stride=2);i=i[0]}t=Di.getLayoutForStride_(h=i.length)}this.layout=t,this.stride=h},Di.prototype.applyTransform=function(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},Di.prototype.rotate=function(t,i){var s=this.getFlatCoordinates();if(s){var h=this.getStride();Si(s,0,s.length,h,t,i,s),this.changed()}},Di.prototype.scale=function(t,i,s){var h=i;void 0===h&&(h=t);var n=s;n||(n=bi.getCenter(this.getExtent()));var r=this.getFlatCoordinates();if(r){var e=this.getStride();Ci(r,0,r.length,e,t,h,n,r),this.changed()}},Di.prototype.translate=function(t,i){var s=this.getFlatCoordinates();if(s){var h=this.getStride();Ai(s,0,s.length,h,t,i,s),this.changed()}},Di.transform2D=function(t,i,s){var h=t.getFlatCoordinates();if(h){var n=t.getStride();return Ei(h,0,h.length,n,i,s)}return null};var Gi={linearRing:function(t,i,s,h){for(var n=0,r=t[s-h],e=t[s-h+1];i<s;i+=h){var o=t[i],a=t[i+1];n+=e*o-r*a,r=o,e=a}return n/2},linearRings:function(t,i,s,h){var n,r,e=0;for(n=0,r=s.length;n<r;++n){var o=s[n];e+=Gi.linearRing(t,i,o,h),i=o}return e},linearRingss:function(t,i,s,h){var n,r,e=0;for(n=0,r=s.length;n<r;++n){var o=s[n];e+=Gi.linearRings(t,i,o,h),i=o[o.length-1]}return e}},Wi={point:function(t,i,s,h,n,r,e){var o,a,u=t[i],f=t[i+1],c=t[s]-u,l=t[s+1]-f;if(0===c&&0===l)a=i;else{var v=((n-u)*c+(r-f)*l)/(c*c+l*l);if(v>1)a=s;else{if(v>0){for(o=0;o<h;++o)e[o]=_i.lerp(t[i+o],t[s+o],v);return void(e.length=h)}a=i}}for(o=0;o<h;++o)e[o]=t[a+o];e.length=h},getMaxSquaredDelta:function(t,i,s,h,n){var r=t[i],e=t[i+1];for(i+=h;i<s;i+=h){var o=t[i],a=t[i+1],u=_i.squaredDistance(r,e,o,a);u>n&&(n=u),r=o,e=a}return n},getsMaxSquaredDelta:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];n=Wi.getMaxSquaredDelta(t,i,o,h,n),i=o}return n},getssMaxSquaredDelta:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];n=Wi.getsMaxSquaredDelta(t,i,o,h,n),i=o[o.length-1]}return n},getClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){if(i==s)return u;var c,l;if(0===n){if((l=_i.squaredDistance(e,o,t[i],t[i+1]))<u){for(c=0;c<h;++c)a[c]=t[i+c];return a.length=h,l}return u}for(var v=f||[NaN,NaN],d=i+h;d<s;)if(Wi.point(t,d-h,d,h,e,o,v),(l=_i.squaredDistance(e,o,v[0],v[1]))<u){for(u=l,c=0;c<h;++c)a[c]=v[c];a.length=h,d+=h}else d+=h*Math.max((Math.sqrt(l)-Math.sqrt(u))/n|0,1);if(r&&(Wi.point(t,s-h,i,h,e,o,v),(l=_i.squaredDistance(e,o,v[0],v[1]))<u)){for(u=l,c=0;c<h;++c)a[c]=v[c];a.length=h}return u},getsClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v=f||[NaN,NaN];for(c=0,l=s.length;c<l;++c){var d=s[c];u=Wi.getClosestPoint(t,i,d,h,n,r,e,o,a,u,v),i=d}return u},getssClosestPoint:function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v=f||[NaN,NaN];for(c=0,l=s.length;c<l;++c){var d=s[c];u=Wi.getsClosestPoint(t,i,d,h,n,r,e,o,a,u,v),i=d[d.length-1]}return u}},Vi={coordinate:function(t,i,s){var h,n;for(h=0,n=s.length;h<n;++h)t[i++]=s[h];return i},coordinates:function(t,i,s,h){var n,r;for(n=0,r=s.length;n<r;++n){var e,o=s[n];for(e=0;e<h;++e)t[i++]=o[e]}return i},coordinatess:function(t,i,s,h,n){var r,e,o=n||[],a=0;for(r=0,e=s.length;r<e;++r){var u=Vi.coordinates(t,i,s[r],h);o[a++]=u,i=u}return o.length=a,o},coordinatesss:function(t,i,s,h,n){var r,e,o=n||[],a=0;for(r=0,e=s.length;r<e;++r){var u=Vi.coordinatess(t,i,s[r],h,o[a]);o[a++]=u,i=u[u.length-1]}return o.length=a,o}},ji={coordinates:function(t,i,s,h,n){var r,e=void 0!==n?n:[],o=0;for(r=i;r<s;r+=h)e[o++]=t.slice(r,r+h);return e.length=o,e},coordinatess:function(t,i,s,h,n){var r,e,o=void 0!==n?n:[],a=0;for(r=0,e=s.length;r<e;++r){var u=s[r];o[a++]=ji.coordinates(t,i,u,h,o[a]),i=u}return o.length=a,o},coordinatesss:function(t,i,s,h,n){var r,e,o=void 0!==n?n:[],a=0;for(r=0,e=s.length;r<e;++r){var u=s[r];o[a++]=ji.coordinatess(t,i,u,h,o[a]),i=u[u.length-1]}return o.length=a,o}},Ui={lineString:function(t,i,s,h,n,r,e){var o=void 0!==e?e:[];return r||(s=Ui.radialDistance(t,i,s,h,n,o,0),t=o,i=0,h=2),o.length=Ui.douglasPeucker(t,i,s,h,n,o,0),o},douglasPeucker:function(t,i,s,h,n,r,e){var o=(s-i)/h;if(o<3){for(;i<s;i+=h)r[e++]=t[i],r[e++]=t[i+1];return e}var a=new Array(o);a[0]=1,a[o-1]=1;for(var u,f=[i,s-h],c=0;f.length>0;){var l=f.pop(),v=f.pop(),d=0,M=t[v],m=t[v+1],p=t[l],g=t[l+1];for(u=v+h;u<l;u+=h){var _=_i.squaredSegmentDistance(t[u],t[u+1],M,m,p,g);_>d&&(c=u,d=_)}d>n&&(a[(c-i)/h]=1,v+h<c&&f.push(v,c),c+h<l&&f.push(c,l))}for(u=0;u<o;++u)a[u]&&(r[e++]=t[i+u*h],r[e++]=t[i+u*h+1]);return e},douglasPeuckers:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a];e=Ui.douglasPeucker(t,i,f,h,n,r,e),o.push(e),i=f}return e},douglasPeuckerss:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a],c=[];e=Ui.douglasPeuckers(t,i,f,h,n,r,e,c),o.push(c),i=f[f.length-1]}return e},radialDistance:function(t,i,s,h,n,r,e){if(s<=i+h){for(;i<s;i+=h)r[e++]=t[i],r[e++]=t[i+1];return e}var o=t[i],a=t[i+1];r[e++]=o,r[e++]=a;var u=o,f=a;for(i+=h;i<s;i+=h)_i.squaredDistance(o,a,u=t[i],f=t[i+1])>n&&(r[e++]=u,r[e++]=f,o=u,a=f);return u==o&&f==a||(r[e++]=u,r[e++]=f),e},snap:function(t,i){return i*Math.round(t/i)},quantize:function(t,i,s,h,n,r,e){if(i==s)return e;var o,a,u=Ui.snap(t[i],n),f=Ui.snap(t[i+1],n);i+=h,r[e++]=u,r[e++]=f;do{if(o=Ui.snap(t[i],n),a=Ui.snap(t[i+1],n),(i+=h)==s)return r[e++]=o,r[e++]=a,e}while(o==u&&a==f);for(;i<s;){var c,l;if(c=Ui.snap(t[i],n),l=Ui.snap(t[i+1],n),i+=h,c!=o||l!=a){var v=o-u,d=a-f,M=c-u,m=l-f;v*m==d*M&&(v<0&&M<v||v==M||v>0&&M>v)&&(d<0&&m<d||d==m||d>0&&m>d)?(o=c,a=l):(r[e++]=o,r[e++]=a,u=o,f=a,o=c,a=l)}}return r[e++]=o,r[e++]=a,e},quantizes:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a];e=Ui.quantize(t,i,f,h,n,r,e),o.push(e),i=f}return e},quantizess:function(t,i,s,h,n,r,e,o){var a,u;for(a=0,u=s.length;a<u;++a){var f=s[a],c=[];e=Ui.quantizes(t,i,f,h,n,r,e,c),o.push(c),i=f[f.length-1]}return e}},Xi=function(t,i){Di.call(this),this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.setCoordinates(t,i)};ui.inherits(Xi,Di),Xi.prototype.clone=function(){var t=new Xi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice()),t},Xi.prototype.closestPointXY=function(t,i,s,h){return h<bi.closestSquaredDistanceXY(this.getExtent(),t,i)?h:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Wi.getMaxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wi.getClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,i,s,h))},Xi.prototype.getArea=function(){return Gi.linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},Xi.prototype.getCoordinates=function(){return ji.coordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},Xi.prototype.getSimplifiedGeometryInternal=function(t){var i=[];i.length=Ui.douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i,0);var s=new Xi(null);return s.setFlatCoordinates("XY",i),s},Xi.prototype.getType=function(){return"LinearRing"},Xi.prototype.intersectsExtent=function(){},Xi.prototype.setCoordinates=function(t,i){t?(this.setLayout(i,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vi.coordinates(this.flatCoordinates,0,t,this.stride),this.changed()):this.setFlatCoordinates("XY",null)},Xi.prototype.setFlatCoordinates=function(t,i){this.setFlatCoordinatesInternal(t,i),this.changed()};var qi=function(t,i){Di.call(this),this.setCoordinates(t,i)};ui.inherits(qi,Di),qi.prototype.clone=function(){var t=new qi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice()),t},qi.prototype.closestPointXY=function(t,i,s,h){var n=this.flatCoordinates,r=_i.squaredDistance(t,i,n[0],n[1]);if(r<h){var e,o=this.stride;for(e=0;e<o;++e)s[e]=n[e];return s.length=o,r}return h},qi.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},qi.prototype.computeExtent=function(t){return bi.createOrUpdateFromCoordinate(this.flatCoordinates,t)},qi.prototype.getType=function(){return"Point"},qi.prototype.intersectsExtent=function(t){return bi.containsXY(t,this.flatCoordinates[0],this.flatCoordinates[1])},qi.prototype.setCoordinates=function(t,i){t?(this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vi.coordinate(this.flatCoordinates,0,t,this.stride),this.changed()):this.setFlatCoordinates("XY",null)},qi.prototype.setFlatCoordinates=function(t,i){this.setFlatCoordinatesInternal(t,i),this.changed()};var Yi={linearRingContainsExtent:function(t,i,s,h,n){return!bi.forEachCorner(n,(function(n){return!Yi.linearRingContainsXY(t,i,s,h,n[0],n[1])}))},linearRingContainsXY:function(t,i,s,h,n,r){for(var e=0,o=t[s-h],a=t[s-h+1];i<s;i+=h){var u=t[i],f=t[i+1];a<=r?f>r&&(u-o)*(r-a)-(n-o)*(f-a)>0&&e++:f<=r&&(u-o)*(r-a)-(n-o)*(f-a)<0&&e--,o=u,a=f}return 0!==e},linearRingsContainsXY:function(t,i,s,h,n,r){if(0===s.length)return!1;if(!Yi.linearRingContainsXY(t,i,s[0],h,n,r))return!1;var e,o;for(e=1,o=s.length;e<o;++e)if(Yi.linearRingContainsXY(t,s[e-1],s[e],h,n,r))return!1;return!0},linearRingssContainsXY:function(t,i,s,h,n,r){if(0===s.length)return!1;var e,o;for(e=0,o=s.length;e<o;++e){var a=s[e];if(Yi.linearRingsContainsXY(t,i,a,h,n,r))return!0;i=a[a.length-1]}return!1}},Bi={linearRings:function(t,i,s,h,n,r,e){for(var o,a,u,f,c,l,v,d=n[r+1],M=[],m=0,p=s.length;m<p;++m){var g=s[m];for(f=t[g-h],l=t[g-h+1],o=i;o<g;o+=h)c=t[o],v=t[o+1],(d<=l&&v<=d||l<=d&&d<=v)&&M.push(u=(d-l)/(v-l)*(c-f)+f),f=c,l=v}var _=NaN,w=-1/0;for(M.sort(yi.numberSafeCompareFunction),f=M[0],o=1,a=M.length;o<a;++o){c=M[o];var y=Math.abs(c-f);y>w&&Yi.linearRingsContainsXY(t,i,s,h,u=(f+c)/2,d)&&(_=u,w=y),f=c}return isNaN(_)&&(_=n[r]),e?(e.push(_,d,w),e):[_,d,w]},linearRingss:function(t,i,s,h,n){var r,e,o=[];for(r=0,e=s.length;r<e;++r){var a=s[r];o=Bi.linearRings(t,i,a,h,n,2*r,o),i=a[a.length-1]}return o}},Hi=function(t,i,s,h,n,r){for(var e,o=[t[i],t[i+1]],a=[];i+h<s;i+=h){if(a[0]=t[i+h],a[1]=t[i+h+1],e=n.call(r,o,a))return e;o[0]=a[0],o[1]=a[1]}return!1},Ji={lineString:function(t,i,s,h,n){var r=bi.extendFlatCoordinates(bi.createEmpty(),t,i,s,h);return!!bi.intersects(n,r)&&(!!bi.containsExtent(n,r)||r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||Hi(t,i,s,h,(function(t,i){return bi.intersectsSegment(n,t,i)})))},lineStrings:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){if(Ji.lineString(t,i,s[r],h,n))return!0;i=s[r]}return!1},linearRing:function(t,i,s,h,n){return!!(Ji.lineString(t,i,s,h,n)||Yi.linearRingContainsXY(t,i,s,h,n[0],n[1])||Yi.linearRingContainsXY(t,i,s,h,n[0],n[3])||Yi.linearRingContainsXY(t,i,s,h,n[2],n[1])||Yi.linearRingContainsXY(t,i,s,h,n[2],n[3]))},linearRings:function(t,i,s,h,n){if(!Ji.linearRing(t,i,s[0],h,n))return!1;if(1===s.length)return!0;var r,e;for(r=1,e=s.length;r<e;++r)if(Yi.linearRingContainsExtent(t,s[r-1],s[r],h,n))return!1;return!0},linearRingss:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r){var o=s[r];if(Ji.linearRings(t,i,o,h,n))return!0;i=o[o.length-1]}return!1}},Zi=function(t,i,s,h){for(;i<s-h;){var n;for(n=0;n<h;++n){var r=t[i+n];t[i+n]=t[s-h+n],t[s-h+n]=r}i+=h,s-=h}},Ki={linearRingIsClockwise:function(t,i,s,h){for(var n=0,r=t[s-h],e=t[s-h+1];i<s;i+=h){var o=t[i],a=t[i+1];n+=(o-r)*(a+e),r=o,e=a}return n>0},linearRingsAreOriented:function(t,i,s,h,n){var r,e,o=void 0!==n&&n;for(r=0,e=s.length;r<e;++r){var a=s[r],u=Ki.linearRingIsClockwise(t,i,a,h);if(0===r){if(o&&u||!o&&!u)return!1}else if(o&&!u||!o&&u)return!1;i=a}return!0},linearRingssAreOriented:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r)if(!Ki.linearRingsAreOriented(t,i,s[r],h,n))return!1;return!0},orientLinearRings:function(t,i,s,h,n){var r,e,o=void 0!==n&&n;for(r=0,e=s.length;r<e;++r){var a=s[r],u=Ki.linearRingIsClockwise(t,i,a,h);(0===r?o&&u||!o&&!u:o&&!u||!o&&u)&&Zi(t,i,a,h),i=a}return i},orientLinearRingss:function(t,i,s,h,n){var r,e;for(r=0,e=s.length;r<e;++r)i=Ki.orientLinearRings(t,i,s[r],h,n);return i}},Qi=function(t,i){Di.call(this),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,this.setCoordinates(t,i)};ui.inherits(Qi,Di),Qi.prototype.appendLinearRing=function(t){this.flatCoordinates?yi.extend(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},Qi.prototype.clone=function(){var t=new Qi(null);return t.setFlatCoordinates(this.layout,this.flatCoordinates.slice(),this.ends_.slice()),t},Qi.prototype.closestPointXY=function(t,i,s,h){return h<bi.closestSquaredDistanceXY(this.getExtent(),t,i)?h:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Wi.getsMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wi.getsClosestPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,i,s,h))},Qi.prototype.containsXY=function(t,i){return Yi.linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,i)},Qi.prototype.getArea=function(){return Gi.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},Qi.prototype.getCoordinates=function(t){var i;return void 0!==t?(i=this.getOrientedFlatCoordinates().slice(),Ki.orientLinearRings(i,0,this.ends_,this.stride,t)):i=this.flatCoordinates,ji.coordinatess(i,0,this.ends_,this.stride)},Qi.prototype.getEnds=function(){return this.ends_},Qi.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=bi.getCenter(this.getExtent());this.flatInteriorPoint_=Bi.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},Qi.prototype.getInteriorPoint=function(){return new qi(this.getFlatInteriorPoint(),"XYM")},Qi.prototype.getLinearRingCount=function(){return this.ends_.length},Qi.prototype.getLinearRing=function(t){if(t<0||this.ends_.length<=t)return null;var i=new Xi(null);return i.setFlatCoordinates(this.layout,this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t])),i},Qi.prototype.getLinearRings=function(){var t,i,s=this.layout,h=this.flatCoordinates,n=this.ends_,r=[],e=0;for(t=0,i=n.length;t<i;++t){var o=n[t],a=new Xi(null);a.setFlatCoordinates(s,h.slice(e,o)),r.push(a),e=o}return r},Qi.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;Ki.linearRingsAreOriented(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ki.orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},Qi.prototype.getSimplifiedGeometryInternal=function(t){var i=[],s=[];i.length=Ui.quantizes(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),i,0,s);var h=new Qi(null);return h.setFlatCoordinates("XY",i,s),h},Qi.prototype.getType=function(){return"Polygon"},Qi.prototype.intersectsExtent=function(t){return Ji.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)},Qi.prototype.setCoordinates=function(t,i){if(t){this.setLayout(i,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var s=Vi.coordinatess(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===s.length?0:s[s.length-1],this.changed()}else this.setFlatCoordinates("XY",null,this.ends_)},Qi.prototype.setFlatCoordinates=function(t,i,s){this.setFlatCoordinatesInternal(t,i),this.ends_=s,this.changed()},Qi.circular=function(t,i,s,h){var n,r=h||32,e=[];for(n=0;n<r;++n)yi.extend(e,t.offset(i,s,2*Math.PI*n/r));e.push(e[0],e[1]);var o=new Qi(null);return o.setFlatCoordinates("XY",e,[e.length]),o},Qi.fromExtent=function(t){var i=t[0],s=t[1],h=t[2],n=t[3],r=[i,s,i,n,h,n,h,s,i,s],e=new Qi(null);return e.setFlatCoordinates("XY",r,[r.length]),e},Qi.fromCircle=function(t,i,s){for(var h=i||32,n=t.getStride(),r=t.getLayout(),e=new Qi(null,r),o=n*(h+1),a=new Array(o),u=0;u<o;u++)a[u]=0;return e.setFlatCoordinates(r,a,[a.length]),Qi.makeRegular(e,t.getCenter(),t.getRadius(),s),e},Qi.makeRegular=function(t,i,s,h){for(var n,r,e=t.getFlatCoordinates(),o=t.getLayout(),a=t.getStride(),u=t.getEnds(),f=e.length/a-1,c=h||0,l=0;l<=f;++l)r=l*a,n=c+2*_i.modulo(l,f)*Math.PI/f,e[r]=i[0]+s*Math.cos(n),e[r+1]=i[1]+s*Math.sin(n);t.setFlatCoordinates(o,e,u)};var $i={ONE:1,SRC_ALPHA:770,COLOR_ATTACHMENT0:36064,COLOR_BUFFER_BIT:16384,TRIANGLES:4,TRIANGLE_STRIP:5,ONE_MINUS_SRC_ALPHA:771,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,CULL_FACE:2884,BLEND:3042,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126,RGBA:6408,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,LINK_STATUS:35714,LINEAR:9729,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE0:33984,CLAMP_TO_EDGE:33071,COMPILE_STATUS:35713,FRAMEBUFFER:36160,CONTEXT_IDS_:["experimental-webgl","webgl","webkit-3d","moz-webgl"],getContext:function(t,i){var s,h,n=$i.CONTEXT_IDS_.length;for(h=0;h<n;++h)try{if(s=t.getContext($i.CONTEXT_IDS_[h],i))return s}catch(r){}return null}},ts={},is="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"";ts.FIREFOX=-1!==is.indexOf("firefox"),ts.SAFARI=-1!==is.indexOf("safari")&&-1==is.indexOf("chrom"),ts.WEBKIT=-1!==is.indexOf("webkit")&&-1==is.indexOf("edge"),ts.MAC=-1!==is.indexOf("macintosh"),ts.DEVICE_PIXEL_RATIO=window.devicePixelRatio||1,ts.CANVAS_LINE_DASH=!1,ts.CANVAS=ui.ENABLE_CANVAS&&function(){if(!("HTMLCanvasElement"in window))return!1;try{var t=document.createElement("CANVAS").getContext("2d");return!!t&&(void 0!==t.setLineDash&&(ts.CANVAS_LINE_DASH=!0),!0)}catch(i){return!1}}(),ts.DEVICE_ORIENTATION="DeviceOrientationEvent"in window,ts.GEOLOCATION="geolocation"in navigator,ts.TOUCH=ui.ASSUME_TOUCH||"ontouchstart"in window,ts.POINTER="PointerEvent"in window,ts.MSPOINTER=!!navigator.msPointerEnabled,function(){if(ui.ENABLE_WEBGL){var t,i=!1,s=[];if("WebGLRenderingContext"in window)try{var h=document.createElement("CANVAS"),n=$i.getContext(h,{failIfMajorPerformanceCaveat:!0});n&&(i=!0,t=n.getParameter(n.MAX_TEXTURE_SIZE),s=n.getSupportedExtensions())}catch(r){}ts.WEBGL=i,ui.WEBGL_EXTENSIONS=s,ui.WEBGL_MAX_TEXTURE_SIZE=t}}();var ss=function(t){mi.call(this);var i=t||{};this.position_=null,this.transform_=Li.identityTransform,this.sphere_=new wi(ki.RADIUS),this.watchId_=void 0,ci.listen(this,mi.getChangeEventType("projection"),this.handleProjectionChanged_,this),ci.listen(this,mi.getChangeEventType("tracking"),this.handleTrackingChanged_,this),void 0!==i.projection&&this.setProjection(i.projection),void 0!==i.trackingOptions&&this.setTrackingOptions(i.trackingOptions),this.setTracking(void 0!==i.tracking&&i.tracking)};ui.inherits(ss,mi),ss.prototype.disposeInternal=function(){this.setTracking(!1),mi.prototype.disposeInternal.call(this)},ss.prototype.handleProjectionChanged_=function(){var t=this.getProjection();t&&(this.transform_=Li.getTransformFromProjections(Li.get("EPSG:4326"),t),this.position_&&this.set("position",this.transform_(this.position_)))},ss.prototype.handleTrackingChanged_=function(){if(ts.GEOLOCATION){var t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}},ss.prototype.positionChange_=function(t){var i=t.coords;this.set("accuracy",i.accuracy),this.set("altitude",null===i.altitude?void 0:i.altitude),this.set("altitudeAccuracy",null===i.altitudeAccuracy?void 0:i.altitudeAccuracy),this.set("heading",null===i.heading?void 0:_i.toRadians(i.heading)),this.position_?(this.position_[0]=i.longitude,this.position_[1]=i.latitude):this.position_=[i.longitude,i.latitude];var s=this.transform_(this.position_);this.set("position",s),this.set("speed",null===i.speed?void 0:i.speed);var h=Qi.circular(this.sphere_,this.position_,i.accuracy);h.applyTransform(this.transform_),this.set("accuracyGeometry",h),this.changed()},ss.prototype.positionError_=function(t){t.type="error",this.setTracking(!1),this.dispatchEvent(t)},ss.prototype.getAccuracy=function(){return this.get("accuracy")},ss.prototype.getAccuracyGeometry=function(){return this.get("accuracyGeometry")||null},ss.prototype.getAltitude=function(){return this.get("altitude")},ss.prototype.getAltitudeAccuracy=function(){return this.get("altitudeAccuracy")},ss.prototype.getHeading=function(){return this.get("heading")},ss.prototype.getPosition=function(){return this.get("position")},ss.prototype.getProjection=function(){return this.get("projection")},ss.prototype.getSpeed=function(){return this.get("speed")},ss.prototype.getTracking=function(){return this.get("tracking")},ss.prototype.getTrackingOptions=function(){return this.get("trackingOptions")},ss.prototype.setProjection=function(t){this.set("projection",Li.get(t))},ss.prototype.setTracking=function(t){this.set("tracking",t)},ss.prototype.setTrackingOptions=function(t){this.set("trackingOptions",t)};var hs=function(t,i){if(mi.call(this),this.unique_=!!(i||{}).unique,this.array_=t||[],this.unique_)for(var s=0,h=this.array_.length;s<h;++s)this.assertUnique_(this.array_[s],s);this.updateLength_()};ui.inherits(hs,mi),hs.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},hs.prototype.extend=function(t){var i,s;for(i=0,s=t.length;i<s;++i)this.push(t[i]);return this},hs.prototype.forEach=function(t,i){for(var s=i?t.bind(i):t,h=this.array_,n=0,r=h.length;n<r;++n)s(h[n],n,h)},hs.prototype.getArray=function(){return this.array_},hs.prototype.item=function(t){return this.array_[t]},hs.prototype.getLength=function(){return this.get(hs.Property_.LENGTH)},hs.prototype.insertAt=function(t,i){this.unique_&&this.assertUnique_(i),this.array_.splice(t,0,i),this.updateLength_(),this.dispatchEvent(new hs.Event("add",i))},hs.prototype.pop=function(){return this.removeAt(this.getLength()-1)},hs.prototype.push=function(t){this.unique_&&this.assertUnique_(t);var i=this.getLength();return this.insertAt(i,t),this.getLength()},hs.prototype.remove=function(t){var i,s,h=this.array_;for(i=0,s=h.length;i<s;++i)if(h[i]===t)return this.removeAt(i)},hs.prototype.removeAt=function(t){var i=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new hs.Event("remove",i)),i},hs.prototype.setAt=function(t,i){var s=this.getLength();if(t<s){this.unique_&&this.assertUnique_(i,t);var h=this.array_[t];this.array_[t]=i,this.dispatchEvent(new hs.Event("remove",h)),this.dispatchEvent(new hs.Event("add",i))}else{var n;for(n=s;n<t;++n)this.insertAt(n,void 0);this.insertAt(t,i)}},hs.prototype.updateLength_=function(){this.set(hs.Property_.LENGTH,this.array_.length)},hs.prototype.assertUnique_=function(t,i){for(var s=0,h=this.array_.length;s<h;++s)if(this.array_[s]===t&&s!==i)throw new pi(58)},hs.Property_={LENGTH:"length"},ui.inherits(hs.Event=function(t,i){vi.call(this,t),this.element=i},vi);var ns=function(t,i,s){vi.call(this,t),this.map=i,this.frameState=void 0!==s?s:null};ui.inherits(ns,vi);var rs=function(t,i,s,h,n){ns.call(this,t,i,n),this.originalEvent=s,this.pixel=i.getEventPixel(s),this.coordinate=i.getCoordinateFromPixel(this.pixel),this.dragging=void 0!==h&&h};ui.inherits(rs,ns),rs.prototype.preventDefault=function(){ns.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},rs.prototype.stopPropagation=function(){ns.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()};var es={SINGLECLICK:"singleclick",CLICK:"click",DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},os=function(t,i,s,h,n){rs.call(this,t,i,s.originalEvent,h,n),this.pointerEvent=s};ui.inherits(os,rs);var as=function(t,i){this.dispatcher=t,this.mapping_=i};as.prototype.getEvents=function(){return Object.keys(this.mapping_)},as.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var us=function(t){as.call(this,t,{mousedown:this.mousedown,mousemove:this.mousemove,mouseup:this.mouseup,mouseover:this.mouseover,mouseout:this.mouseout}),this.pointerMap=t.pointerMap,this.lastTouches=[]};ui.inherits(us,as),us.POINTER_ID=1,us.POINTER_TYPE="mouse",us.DEDUP_DIST=25,us.prototype.isEventSimulatedFromTouch_=function(t){for(var i,s=this.lastTouches,h=t.clientX,n=t.clientY,r=0,e=s.length;r<e&&(i=s[r]);r++){var o=Math.abs(h-i[0]),a=Math.abs(n-i[1]);if(o<=us.DEDUP_DIST&&a<=us.DEDUP_DIST)return!0}return!1},us.prepareEvent=function(t,i){var s=i.cloneEvent(t,t),h=s.preventDefault;return s.preventDefault=function(){t.preventDefault(),h()},s.pointerId=us.POINTER_ID,s.isPrimary=!0,s.pointerType=us.POINTER_TYPE,s},us.prototype.mousedown=function(t){if(!this.isEventSimulatedFromTouch_(t)){us.POINTER_ID.toString()in this.pointerMap&&this.cancel(t);var i=us.prepareEvent(t,this.dispatcher);this.pointerMap[us.POINTER_ID.toString()]=t,this.dispatcher.down(i,t)}},us.prototype.mousemove=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.move(i,t)}},us.prototype.mouseup=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=this.pointerMap[us.POINTER_ID.toString()];if(i&&i.button===t.button){var s=us.prepareEvent(t,this.dispatcher);this.dispatcher.up(s,t),this.cleanupMouse()}}},us.prototype.mouseover=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.enterOver(i,t)}},us.prototype.mouseout=function(t){if(!this.isEventSimulatedFromTouch_(t)){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.leaveOut(i,t)}},us.prototype.cancel=function(t){var i=us.prepareEvent(t,this.dispatcher);this.dispatcher.cancel(i,t),this.cleanupMouse()},us.prototype.cleanupMouse=function(){delete this.pointerMap[us.POINTER_ID.toString()]};var fs=function(t){as.call(this,t,{MSPointerDown:this.msPointerDown,MSPointerMove:this.msPointerMove,MSPointerUp:this.msPointerUp,MSPointerOut:this.msPointerOut,MSPointerOver:this.msPointerOver,MSPointerCancel:this.msPointerCancel,MSGotPointerCapture:this.msGotPointerCapture,MSLostPointerCapture:this.msLostPointerCapture}),this.pointerMap=t.pointerMap,this.POINTER_TYPES=["","unavailable","touch","pen","mouse"]};ui.inherits(fs,as),fs.prototype.prepareEvent_=function(t){var i=t;return"number"==typeof t.pointerType&&((i=this.dispatcher.cloneEvent(t,t)).pointerType=this.POINTER_TYPES[t.pointerType]),i},fs.prototype.cleanup=function(t){delete this.pointerMap[t.toString()]},fs.prototype.msPointerDown=function(t){this.pointerMap[t.pointerId.toString()]=t;var i=this.prepareEvent_(t);this.dispatcher.down(i,t)},fs.prototype.msPointerMove=function(t){var i=this.prepareEvent_(t);this.dispatcher.move(i,t)},fs.prototype.msPointerUp=function(t){var i=this.prepareEvent_(t);this.dispatcher.up(i,t),this.cleanup(t.pointerId)},fs.prototype.msPointerOut=function(t){var i=this.prepareEvent_(t);this.dispatcher.leaveOut(i,t)},fs.prototype.msPointerOver=function(t){var i=this.prepareEvent_(t);this.dispatcher.enterOver(i,t)},fs.prototype.msPointerCancel=function(t){var i=this.prepareEvent_(t);this.dispatcher.cancel(i,t),this.cleanup(t.pointerId)},fs.prototype.msLostPointerCapture=function(t){var i=this.dispatcher.makeEvent("lostpointercapture",t,t);this.dispatcher.dispatchEvent(i)},fs.prototype.msGotPointerCapture=function(t){var i=this.dispatcher.makeEvent("gotpointercapture",t,t);this.dispatcher.dispatchEvent(i)};var cs=function(t){as.call(this,t,{pointerdown:this.pointerDown,pointermove:this.pointerMove,pointerup:this.pointerUp,pointerout:this.pointerOut,pointerover:this.pointerOver,pointercancel:this.pointerCancel,gotpointercapture:this.gotPointerCapture,lostpointercapture:this.lostPointerCapture})};ui.inherits(cs,as),cs.prototype.pointerDown=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerMove=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerUp=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerOut=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerOver=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.pointerCancel=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.lostPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)},cs.prototype.gotPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};var ls=function(t,i,s){vi.call(this,t),this.originalEvent=i;var h=s||{};this.buttons=this.getButtons_(h),this.pressure=this.getPressure_(h,this.buttons),this.bubbles="bubbles"in h&&h.bubbles,this.cancelable="cancelable"in h&&h.cancelable,this.view="view"in h?h.view:null,this.detail="detail"in h?h.detail:null,this.screenX="screenX"in h?h.screenX:0,this.screenY="screenY"in h?h.screenY:0,this.clientX="clientX"in h?h.clientX:0,this.clientY="clientY"in h?h.clientY:0,this.ctrlKey="ctrlKey"in h&&h.ctrlKey,this.altKey="altKey"in h&&h.altKey,this.shiftKey="shiftKey"in h&&h.shiftKey,this.metaKey="metaKey"in h&&h.metaKey,this.button="button"in h?h.button:0,this.relatedTarget="relatedTarget"in h?h.relatedTarget:null,this.pointerId="pointerId"in h?h.pointerId:0,this.width="width"in h?h.width:0,this.height="height"in h?h.height:0,this.tiltX="tiltX"in h?h.tiltX:0,this.tiltY="tiltY"in h?h.tiltY:0,this.pointerType="pointerType"in h?h.pointerType:"",this.hwTimestamp="hwTimestamp"in h?h.hwTimestamp:0,this.isPrimary="isPrimary"in h&&h.isPrimary,i.preventDefault&&(this.preventDefault=function(){i.preventDefault()})};ui.inherits(ls,vi),ls.prototype.getButtons_=function(t){var i;if(t.buttons||ls.HAS_BUTTONS)i=t.buttons;else switch(t.which){case 1:i=1;break;case 2:i=4;break;case 3:i=2;break;default:i=0}return i},ls.prototype.getPressure_=function(t,i){return t.pressure?t.pressure:i?.5:0},ls.HAS_BUTTONS=!1,function(){try{var t=new MouseEvent("click",{buttons:1});ls.HAS_BUTTONS=1===t.buttons}catch(i){}}();var vs=function(t,i){as.call(this,t,{touchstart:this.touchstart,touchmove:this.touchmove,touchend:this.touchend,touchcancel:this.touchcancel}),this.pointerMap=t.pointerMap,this.mouseSource=i,this.firstTouchId_=void 0,this.clickCount_=0,this.resetId_=void 0};ui.inherits(vs,as),vs.DEDUP_TIMEOUT=2500,vs.CLICK_COUNT_TIMEOUT=200,vs.POINTER_TYPE="touch",vs.prototype.isPrimaryTouch_=function(t){return this.firstTouchId_===t.identifier},vs.prototype.setPrimaryTouch_=function(t){var i=Object.keys(this.pointerMap).length;(0===i||1===i&&us.POINTER_ID.toString()in this.pointerMap)&&(this.firstTouchId_=t.identifier,this.cancelResetClickCount_())},vs.prototype.removePrimaryPointer_=function(t){t.isPrimary&&(this.firstTouchId_=void 0,this.resetClickCount_())},vs.prototype.resetClickCount_=function(){this.resetId_=setTimeout(this.resetClickCountHandler_.bind(this),vs.CLICK_COUNT_TIMEOUT)},vs.prototype.resetClickCountHandler_=function(){this.clickCount_=0,this.resetId_=void 0},vs.prototype.cancelResetClickCount_=function(){void 0!==this.resetId_&&clearTimeout(this.resetId_)},vs.prototype.touchToPointer_=function(t,i){var s=this.dispatcher.cloneEvent(t,i);return s.pointerId=i.identifier+2,s.bubbles=!0,s.cancelable=!0,s.detail=this.clickCount_,s.button=0,s.buttons=1,s.width=i.webkitRadiusX||i.radiusX||0,s.height=i.webkitRadiusY||i.radiusY||0,s.pressure=i.webkitForce||i.force||.5,s.isPrimary=this.isPrimaryTouch_(i),s.pointerType=vs.POINTER_TYPE,s.clientX=i.clientX,s.clientY=i.clientY,s.screenX=i.screenX,s.screenY=i.screenY,s},vs.prototype.processTouches_=function(t,i){var s,h,n=Array.prototype.slice.call(t.changedTouches),r=n.length;function e(){t.preventDefault()}for(s=0;s<r;++s)(h=this.touchToPointer_(t,n[s])).preventDefault=e,i.call(this,t,h)},vs.prototype.findTouch_=function(t,i){for(var s=t.length,h=0;h<s;h++)if(t[h].identifier===i)return!0;return!1},vs.prototype.vacuumTouches_=function(t){var i=t.touches,s=Object.keys(this.pointerMap),h=s.length;if(h>=i.length){var n,r,e,o=[];for(n=0;n<h;++n)e=this.pointerMap[r=s[n]],r==us.POINTER_ID||this.findTouch_(i,r-2)||o.push(e.out);for(n=0;n<o.length;++n)this.cancelOut_(t,o[n])}},vs.prototype.touchstart=function(t){this.vacuumTouches_(t),this.setPrimaryTouch_(t.changedTouches[0]),this.dedupSynthMouse_(t),this.clickCount_++,this.processTouches_(t,this.overDown_)},vs.prototype.overDown_=function(t,i){this.pointerMap[i.pointerId]={target:i.target,out:i,outTarget:i.target},this.dispatcher.over(i,t),this.dispatcher.enter(i,t),this.dispatcher.down(i,t)},vs.prototype.touchmove=function(t){t.preventDefault(),this.processTouches_(t,this.moveOverOut_)},vs.prototype.moveOverOut_=function(t,i){var s=i,h=this.pointerMap[s.pointerId];if(h){var n=h.out,r=h.outTarget;this.dispatcher.move(s,t),n&&r!==s.target&&(n.relatedTarget=s.target,s.relatedTarget=r,n.target=r,s.target?(this.dispatcher.leaveOut(n,t),this.dispatcher.enterOver(s,t)):(s.target=r,s.relatedTarget=null,this.cancelOut_(t,s))),h.out=s,h.outTarget=s.target}},vs.prototype.touchend=function(t){this.dedupSynthMouse_(t),this.processTouches_(t,this.upOut_)},vs.prototype.upOut_=function(t,i){this.dispatcher.up(i,t),this.dispatcher.out(i,t),this.dispatcher.leave(i,t),this.cleanUpPointer_(i)},vs.prototype.touchcancel=function(t){this.processTouches_(t,this.cancelOut_)},vs.prototype.cancelOut_=function(t,i){this.dispatcher.cancel(i,t),this.dispatcher.out(i,t),this.dispatcher.leave(i,t),this.cleanUpPointer_(i)},vs.prototype.cleanUpPointer_=function(t){delete this.pointerMap[t.pointerId],this.removePrimaryPointer_(t)},vs.prototype.dedupSynthMouse_=function(t){var i=this.mouseSource.lastTouches,s=t.changedTouches[0];if(this.isPrimaryTouch_(s)){var h=[s.clientX,s.clientY];i.push(h),setTimeout((function(){yi.remove(i,h)}),vs.DEDUP_TIMEOUT)}};var ds=function(t){di.call(this),this.element_=t,this.pointerMap={},this.eventMap_={},this.eventSourceList_=[],this.registerSources()};ui.inherits(ds,di),ds.prototype.registerSources=function(){if(ts.POINTER)this.registerSource("native",new cs(this));else if(ts.MSPOINTER)this.registerSource("ms",new fs(this));else{var t=new us(this);this.registerSource("mouse",t),ts.TOUCH&&this.registerSource("touch",new vs(this,t))}this.register_()},ds.prototype.registerSource=function(t,i){var s=i,h=s.getEvents();h&&(h.forEach((function(t){var i=s.getHandlerForEvent(t);i&&(this.eventMap_[t]=i.bind(s))}),this),this.eventSourceList_.push(s))},ds.prototype.register_=function(){for(var t=this.eventSourceList_.length,i=0;i<t;i++)this.addEvents_(this.eventSourceList_[i].getEvents())},ds.prototype.unregister_=function(){for(var t=this.eventSourceList_.length,i=0;i<t;i++)this.removeEvents_(this.eventSourceList_[i].getEvents())},ds.prototype.eventHandler_=function(t){var i=this.eventMap_[t.type];i&&i(t)},ds.prototype.addEvents_=function(t){t.forEach((function(t){ci.listen(this.element_,t,this.eventHandler_,this)}),this)},ds.prototype.removeEvents_=function(t){t.forEach((function(t){ci.unlisten(this.element_,t,this.eventHandler_,this)}),this)},ds.prototype.cloneEvent=function(t,i){for(var s,h={},n=0,r=ds.CLONE_PROPS.length;n<r;n++)h[s=ds.CLONE_PROPS[n][0]]=t[s]||i[s]||ds.CLONE_PROPS[n][1];return h},ds.prototype.down=function(t,i){this.fireEvent("pointerdown",t,i)},ds.prototype.move=function(t,i){this.fireEvent("pointermove",t,i)},ds.prototype.up=function(t,i){this.fireEvent("pointerup",t,i)},ds.prototype.enter=function(t,i){t.bubbles=!1,this.fireEvent("pointerenter",t,i)},ds.prototype.leave=function(t,i){t.bubbles=!1,this.fireEvent("pointerleave",t,i)},ds.prototype.over=function(t,i){t.bubbles=!0,this.fireEvent("pointerover",t,i)},ds.prototype.out=function(t,i){t.bubbles=!0,this.fireEvent("pointerout",t,i)},ds.prototype.cancel=function(t,i){this.fireEvent("pointercancel",t,i)},ds.prototype.leaveOut=function(t,i){this.out(t,i),this.contains_(t.target,t.relatedTarget)||this.leave(t,i)},ds.prototype.enterOver=function(t,i){this.over(t,i),this.contains_(t.target,t.relatedTarget)||this.enter(t,i)},ds.prototype.contains_=function(t,i){return!(!t||!i)&&t.contains(i)},ds.prototype.makeEvent=function(t,i,s){return new ls(t,s,i)},ds.prototype.fireEvent=function(t,i,s){var h=this.makeEvent(t,i,s);this.dispatchEvent(h)},ds.prototype.fireNativeEvent=function(t){var i=this.makeEvent(t.type,t,t);this.dispatchEvent(i)},ds.prototype.wrapMouseEvent=function(t,i){return this.makeEvent(t,us.prepareEvent(i,this),i)},ds.prototype.disposeInternal=function(){this.unregister_(),di.prototype.disposeInternal.call(this)},ds.CLONE_PROPS=[["bubbles",!1],["cancelable",!1],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",!1],["altKey",!1],["shiftKey",!1],["metaKey",!1],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",!1],["type",""],["target",null],["currentTarget",null],["which",0]];var Ms=function(t,i){di.call(this),this.map_=t,this.clickTimeoutId_=0,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=i?i*ts.DEVICE_PIXEL_RATIO:ts.DEVICE_PIXEL_RATIO,this.down_=null;var s=this.map_.getViewport();this.activePointers_=0,this.trackedTouches_={},this.pointerEventHandler_=new ds(s),this.documentPointerEventHandler_=null,this.pointerdownListenerKey_=ci.listen(this.pointerEventHandler_,"pointerdown",this.handlePointerDown_,this),this.relayedListenerKey_=ci.listen(this.pointerEventHandler_,"pointermove",this.relayEvent_,this)};ui.inherits(Ms,di),Ms.prototype.emulateClick_=function(t){var i=new os(es.CLICK,this.map_,t);this.dispatchEvent(i),0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=0,i=new os(es.DBLCLICK,this.map_,t),this.dispatchEvent(i)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=0;var i=new os(es.SINGLECLICK,this.map_,t);this.dispatchEvent(i)}.bind(this),250)},Ms.prototype.updateActivePointers_=function(t){var i=t;i.type==es.POINTERUP||i.type==es.POINTERCANCEL?delete this.trackedTouches_[i.pointerId]:i.type==es.POINTERDOWN&&(this.trackedTouches_[i.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},Ms.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var i=new os(es.POINTERUP,this.map_,t);this.dispatchEvent(i),i.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(ci.unlistenByKey),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null,this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null)},Ms.prototype.isMouseActionButton_=function(t){return 0===t.button},Ms.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var i=new os(es.POINTERDOWN,this.map_,t);this.dispatchEvent(i),this.down_=t,0===this.dragListenerKeys_.length&&(this.documentPointerEventHandler_=new ds(document),this.dragListenerKeys_.push(ci.listen(this.documentPointerEventHandler_,es.POINTERMOVE,this.handlePointerMove_,this),ci.listen(this.documentPointerEventHandler_,es.POINTERUP,this.handlePointerUp_,this),ci.listen(this.pointerEventHandler_,es.POINTERCANCEL,this.handlePointerUp_,this)))},Ms.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var i=new os(es.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(i)}t.preventDefault()},Ms.prototype.relayEvent_=function(t){var i=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new os(t.type,this.map_,t,i))},Ms.prototype.isMoving_=function(t){return Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},Ms.prototype.disposeInternal=function(){this.relayedListenerKey_&&(ci.unlistenByKey(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(ci.unlistenByKey(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ci.unlistenByKey),this.dragListenerKeys_.length=0,this.documentPointerEventHandler_&&(this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null),this.pointerEventHandler_&&(this.pointerEventHandler_.dispose(),this.pointerEventHandler_=null),di.prototype.disposeInternal.call(this)};var ms=function(t,i){this.priorityFunction_=t,this.keyFunction_=i,this.elements_=[],this.priorities_=[],this.queuedElements_={}};ms.DROP=1/0,ms.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,fi.clear(this.queuedElements_)},ms.prototype.dequeue=function(){var t=this.elements_,i=this.priorities_,s=t[0];1==t.length?(t.length=0,i.length=0):(t[0]=t.pop(),i[0]=i.pop(),this.siftUp_(0));var h=this.keyFunction_(s);return delete this.queuedElements_[h],s},ms.prototype.enqueue=function(t){gi(!(this.keyFunction_(t)in this.queuedElements_),31);var i=this.priorityFunction_(t);return i!=ms.DROP&&(this.elements_.push(t),this.priorities_.push(i),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},ms.prototype.getCount=function(){return this.elements_.length},ms.prototype.getLeftChildIndex_=function(t){return 2*t+1},ms.prototype.getRightChildIndex_=function(t){return 2*t+2},ms.prototype.getParentIndex_=function(t){return t-1>>1},ms.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},ms.prototype.isEmpty=function(){return 0===this.elements_.length},ms.prototype.isKeyQueued=function(t){return t in this.queuedElements_},ms.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},ms.prototype.siftUp_=function(t){for(var i=this.elements_,s=this.priorities_,h=i.length,n=i[t],r=s[t],e=t;t<h>>1;){var o=this.getLeftChildIndex_(t),a=this.getRightChildIndex_(t),u=a<h&&s[a]<s[o]?a:o;i[t]=i[u],s[t]=s[u],t=u}i[t]=n,s[t]=r,this.siftDown_(e,t)},ms.prototype.siftDown_=function(t,i){for(var s=this.elements_,h=this.priorities_,n=s[i],r=h[i];i>t;){var e=this.getParentIndex_(i);if(!(h[e]>r))break;s[i]=s[e],h[i]=h[e],i=e}s[i]=n,h[i]=r},ms.prototype.reprioritize=function(){var t,i,s,h=this.priorityFunction_,n=this.elements_,r=this.priorities_,e=0,o=n.length;for(i=0;i<o;++i)(s=h(t=n[i]))==ms.DROP?delete this.queuedElements_[this.keyFunction_(t)]:(r[e]=s,n[e++]=t);n.length=e,r.length=e,this.heapify_()};var ps=function(t,i){ms.call(this,(function(i){return t.apply(null,i)}),(function(t){return t[0].getKey()})),this.tileChangeCallback_=i,this.tilesLoading_=0,this.tilesLoadingKeys_={}};ui.inherits(ps,ms),ps.prototype.enqueue=function(t){var i=ms.prototype.enqueue.call(this,t);return i&&ci.listen(t[0],"change",this.handleTileChange,this),i},ps.prototype.getTilesLoading=function(){return this.tilesLoading_},ps.prototype.handleTileChange=function(t){var i=t.target,s=i.getState();if(2===s||3===s||4===s||5===s){ci.unlisten(i,"change",this.handleTileChange,this);var h=i.getKey();h in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[h],--this.tilesLoading_),this.tileChangeCallback_()}},ps.prototype.loadMoreTiles=function(t,i){for(var s,h,n,r=0,e=!1;this.tilesLoading_<t&&r<i&&this.getCount()>0;)n=(h=this.dequeue()[0]).getKey(),5===(s=h.getState())?e=!0:0!==s||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++r,h.load());0===r&&e&&this.tileChangeCallback_()};var gs={createExtent:function(t){return function(i){return i?[_i.clamp(i[0],t[0],t[2]),_i.clamp(i[1],t[1],t[3])]:void 0}},none:function(t){return t}},_s=function(t){return function(i,s,h){if(void 0!==i){var n=yi.linearFindNearest(t,i,h);n=_i.clamp(n+s,0,t.length-1);var r=Math.floor(n);return n!=r&&r<t.length-1?t[r]/Math.pow(t[r]/t[r+1],n-r):t[r]}}},ws=function(t,i,s){return function(h,n,r){if(void 0!==h){var e=-r/2+.5,o=Math.floor(Math.log(i/h)/Math.log(t)+e),a=Math.max(o+n,0);return void 0!==s&&(a=Math.min(a,s)),i/Math.pow(t,a)}}},ys={disable:function(t){return void 0!==t?0:void 0},none:function(t,i){return void 0!==t?t+i:void 0},createSnapToN:function(t){var i=2*Math.PI/t;return function(t,s){return void 0!==t?t=Math.floor((t+s)/i+.5)*i:void 0}},createSnapToZero:function(t){var i=t||_i.toRadians(5);return function(t,s){return void 0!==t?Math.abs(t+s)<=i?0:t+s:void 0}}},bs=function(t,i,s){var h=void 0!==s?t.toFixed(s):""+t,n=h.indexOf(".");return(n=-1===n?h.length:n)>i?h:new Array(1+i-n).join("0")+h},xs={add:function(t,i){return t[0]+=i[0],t[1]+=i[1],t},closestOnCircle:function(t,i){var s=i.getRadius(),h=i.getCenter(),n=h[0],r=h[1],e=t[0]-n,o=t[1]-r;0===e&&0===o&&(e=1);var a=Math.sqrt(e*e+o*o);return[n+s*e/a,r+s*o/a]},closestOnSegment:function(t,i){var s,h,n=i[0],r=i[1],e=n[0],o=n[1],a=r[0],u=r[1],f=a-e,c=u-o,l=0===f&&0===c?0:(f*(t[0]-e)+c*(t[1]-o))/(f*f+c*c||0);return l<=0?(s=e,h=o):l>=1?(s=a,h=u):(s=e+l*f,h=o+l*c),[s,h]},createStringXY:function(t){return function(i){return xs.toStringXY(i,t)}},degreesToStringHDMS:function(t,i,s){var h=_i.modulo(i+180,360)-180,n=Math.abs(3600*h),r=s||0,e=Math.pow(10,r),o=Math.floor(n/3600),a=Math.floor((n-3600*o)/60),u=n-3600*o-60*a;return(u=Math.ceil(u*e)/e)>=60&&(u=0,a+=1),a>=60&&(a=0,o+=1),o+"° "+bs(a,2)+"′ "+bs(u,2,r)+"″"+(0==h?"":" "+t.charAt(h<0?1:0))},format:function(t,i,s){return t?i.replace("{x}",t[0].toFixed(s)).replace("{y}",t[1].toFixed(s)):""},equals:function(t,i){for(var s=!0,h=t.length-1;h>=0;--h)if(t[h]!=i[h]){s=!1;break}return s},rotate:function(t,i){var s=Math.cos(i),h=Math.sin(i),n=t[1]*s+t[0]*h;return t[0]=t[0]*s-t[1]*h,t[1]=n,t},scale:function(t,i){return t[0]*=i,t[1]*=i,t},sub:function(t,i){return t[0]-=i[0],t[1]-=i[1],t},squaredDistance:function(t,i){var s=t[0]-i[0],h=t[1]-i[1];return s*s+h*h},distance:function(t,i){return Math.sqrt(xs.squaredDistance(t,i))},squaredDistanceToSegment:function(t,i){return xs.squaredDistance(t,xs.closestOnSegment(t,i))},toStringHDMS:function(t,i){return t?xs.degreesToStringHDMS("NS",t[1],i)+" "+xs.degreesToStringHDMS("EW",t[0],i):""},toStringXY:function(t,i){return xs.format(t,"{x}, {y}",i)}},Es={easeIn:function(t){return Math.pow(t,3)},easeOut:function(t){return 1-Es.easeIn(1-t)},inAndOut:function(t){return 3*t*t-2*t*t*t},linear:function(t){return t},upAndDown:function(t){return t<.5?Es.inAndOut(2*t):1-Es.inAndOut(2*(t-.5))}},Ss=function(t){mi.call(this);var i=fi.assign({},t);this.hints_=[0,0],this.animations_=[],this.updateAnimations_=this.updateAnimations_.bind(this),this.projection_=Li.createProjection(i.projection,"EPSG:3857"),this.applyOptions_(i)};ui.inherits(Ss,mi),Ss.prototype.applyOptions_=function(t){var i={};i.center=void 0!==t.center?t.center:null;var s=Ss.createResolutionConstraint_(t);this.maxResolution_=s.maxResolution,this.minResolution_=s.minResolution,this.zoomFactor_=s.zoomFactor,this.resolutions_=t.resolutions,this.minZoom_=s.minZoom;var h=Ss.createCenterConstraint_(t),n=s.constraint,r=Ss.createRotationConstraint_(t);this.constraints_={center:h,resolution:n,rotation:r},void 0!==t.resolution?i.resolution=t.resolution:void 0!==t.zoom&&(i.resolution=this.constrainResolution(this.maxResolution_,t.zoom-this.minZoom_),this.resolutions_&&(i.resolution=_i.clamp(Number(this.getResolution()||i.resolution),this.minResolution_,this.maxResolution_))),i.rotation=void 0!==t.rotation?t.rotation:0,this.setProperties(i),this.options_=t},Ss.prototype.getUpdatedOptions_=function(t){var i=fi.assign({},this.options_);return void 0!==i.resolution?i.resolution=this.getResolution():i.zoom=this.getZoom(),i.center=this.getCenter(),i.rotation=this.getRotation(),fi.assign({},i,t)},Ss.prototype.animate=function(t){var i,s=arguments.length;if(s>1&&"function"==typeof arguments[s-1]&&(i=arguments[s-1],--s),!this.isDef()){var h=arguments[s-1];return h.center&&this.setCenter(h.center),void 0!==h.zoom&&this.setZoom(h.zoom),void 0!==h.rotation&&this.setRotation(h.rotation),void(i&&i(!0))}for(var n=Date.now(),r=this.getCenter().slice(),e=this.getResolution(),o=this.getRotation(),a=[],u=0;u<s;++u){var f=arguments[u],c={start:n,complete:!1,anchor:f.anchor,duration:void 0!==f.duration?f.duration:1e3,easing:f.easing||Es.inAndOut};if(f.center&&(c.sourceCenter=r,c.targetCenter=f.center,r=c.targetCenter),void 0!==f.zoom?(c.sourceResolution=e,c.targetResolution=this.constrainResolution(this.maxResolution_,f.zoom-this.minZoom_,0),e=c.targetResolution):f.resolution&&(c.sourceResolution=e,c.targetResolution=f.resolution,e=c.targetResolution),void 0!==f.rotation){c.sourceRotation=o;var l=_i.modulo(f.rotation-o+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=o+l,o=c.targetRotation}c.callback=i,Ss.isNoopAnimation(c)?c.complete=!0:n+=c.duration,a.push(c)}this.animations_.push(a),this.setHint(0,1),this.updateAnimations_()},Ss.prototype.getAnimating=function(){return this.hints_[0]>0},Ss.prototype.getInteracting=function(){return this.hints_[1]>0},Ss.prototype.cancelAnimations=function(){this.setHint(0,-this.hints_[0]);for(var t=0,i=this.animations_.length;t<i;++t){var s=this.animations_[t];s[0].callback&&s[0].callback(!1)}this.animations_.length=0},Ss.prototype.updateAnimations_=function(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),this.getAnimating()){for(var t=Date.now(),i=!1,s=this.animations_.length-1;s>=0;--s){for(var h=this.animations_[s],n=!0,r=0,e=h.length;r<e;++r){var o=h[r];if(!o.complete){var a=o.duration>0?(t-o.start)/o.duration:1;a>=1?(o.complete=!0,a=1):n=!1;var u=o.easing(a);if(o.sourceCenter){var f=o.sourceCenter[0],c=o.sourceCenter[1];this.set("center",[f+u*(o.targetCenter[0]-f),c+u*(o.targetCenter[1]-c)])}if(o.sourceResolution&&o.targetResolution){var l=1===u?o.targetResolution:o.sourceResolution+u*(o.targetResolution-o.sourceResolution);o.anchor&&this.set("center",this.calculateCenterZoom(l,o.anchor)),this.set("resolution",l)}if(void 0!==o.sourceRotation&&void 0!==o.targetRotation){var v=1===u?_i.modulo(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+u*(o.targetRotation-o.sourceRotation);o.anchor&&this.set("center",this.calculateCenterRotate(v,o.anchor)),this.set("rotation",v)}if(i=!0,!o.complete)break}}if(n){this.animations_[s]=null,this.setHint(0,-1);var d=h[0].callback;d&&d(!0)}}this.animations_=this.animations_.filter(Boolean),i&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_))}},Ss.prototype.calculateCenterRotate=function(t,i){var s,h=this.getCenter();return void 0!==h&&(xs.rotate(s=[h[0]-i[0],h[1]-i[1]],t-this.getRotation()),xs.add(s,i)),s},Ss.prototype.calculateCenterZoom=function(t,i){var s,h=this.getCenter(),n=this.getResolution();return void 0!==h&&void 0!==n&&(s=[i[0]-t*(i[0]-h[0])/n,i[1]-t*(i[1]-h[1])/n]),s},Ss.prototype.getSizeFromViewport_=function(){var t=[100,100],i='.ol-viewport[data-view="'+ui.getUid(this)+'"]',s=document.querySelector(i);if(s){var h=getComputedStyle(s);t[0]=parseInt(h.width,10),t[1]=parseInt(h.height,10)}return t},Ss.prototype.constrainCenter=function(t){return this.constraints_.center(t)},Ss.prototype.constrainResolution=function(t,i,s){return this.constraints_.resolution(t,i||0,s||0)},Ss.prototype.constrainRotation=function(t,i){return this.constraints_.rotation(t,i||0)},Ss.prototype.getCenter=function(){return this.get("center")},Ss.prototype.getConstraints=function(){return this.constraints_},Ss.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},Ss.prototype.calculateExtent=function(t){var i=t||this.getSizeFromViewport_(),s=this.getCenter();gi(s,1);var h=this.getResolution();gi(void 0!==h,2);var n=this.getRotation();return gi(void 0!==n,3),bi.getForViewAndSize(s,h,n,i)},Ss.prototype.getMaxResolution=function(){return this.maxResolution_},Ss.prototype.getMinResolution=function(){return this.minResolution_},Ss.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},Ss.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},Ss.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},Ss.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},Ss.prototype.getProjection=function(){return this.projection_},Ss.prototype.getResolution=function(){return this.get("resolution")},Ss.prototype.getResolutions=function(){return this.resolutions_},Ss.prototype.getResolutionForExtent=function(t,i){var s=i||this.getSizeFromViewport_(),h=bi.getWidth(t)/s[0],n=bi.getHeight(t)/s[1];return Math.max(h,n)},Ss.prototype.getResolutionForValueFunction=function(t){var i=t||2,s=this.maxResolution_,h=Math.log(s/this.minResolution_)/Math.log(i);return function(t){return s/Math.pow(i,t*h)}},Ss.prototype.getRotation=function(){return this.get("rotation")},Ss.prototype.getValueForResolutionFunction=function(t){var i=t||2,s=this.maxResolution_,h=Math.log(s/this.minResolution_)/Math.log(i);return function(t){return Math.log(s/t)/Math.log(i)/h}},Ss.prototype.getState=function(){var t=this.getCenter(),i=this.getProjection(),s=this.getResolution(),h=this.getRotation();return{center:t.slice(),projection:void 0!==i?i:null,resolution:s,rotation:h,zoom:this.getZoom()}},Ss.prototype.getZoom=function(){var t,i=this.getResolution();return void 0!==i&&(t=this.getZoomForResolution(i)),t},Ss.prototype.getZoomForResolution=function(t){var i,s,h=this.minZoom_||0;if(this.resolutions_){var n=yi.linearFindNearest(this.resolutions_,t,1);h=n,i=this.resolutions_[n],s=n==this.resolutions_.length-1?2:i/this.resolutions_[n+1]}else i=this.maxResolution_,s=this.zoomFactor_;return h+Math.log(i/t)/Math.log(s)},Ss.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)},Ss.prototype.fit=function(t,i){var s,h=i||{},n=h.size;n||(n=this.getSizeFromViewport_()),t instanceof Di?"Circle"===t.getType()?(t=t.getExtent(),(s=Qi.fromExtent(t)).rotate(this.getRotation(),bi.getCenter(t))):s=t:(gi(Array.isArray(t),24),gi(!bi.isEmpty(t),25),s=Qi.fromExtent(t));var r,e=void 0!==h.padding?h.padding:[0,0,0,0],o=void 0===h.constrainResolution||h.constrainResolution,a=void 0!==h.nearest&&h.nearest;r=void 0!==h.minResolution?h.minResolution:void 0!==h.maxZoom?this.constrainResolution(this.maxResolution_,h.maxZoom-this.minZoom_,0):0;for(var u=s.getFlatCoordinates(),f=this.getRotation(),c=Math.cos(-f),l=Math.sin(-f),v=1/0,d=1/0,M=-1/0,m=-1/0,p=s.getStride(),g=0,_=u.length;g<_;g+=p){var w=u[g]*c-u[g+1]*l,y=u[g]*l+u[g+1]*c;v=Math.min(v,w),d=Math.min(d,y),M=Math.max(M,w),m=Math.max(m,y)}var b=this.getResolutionForExtent([v,d,M,m],[n[0]-e[1]-e[3],n[1]-e[0]-e[2]]);if(b=isNaN(b)?r:Math.max(b,r),o){var x=this.constrainResolution(b,0,0);!a&&x<b&&(x=this.constrainResolution(x,-1,0)),b=x}var E=(v+M)/2,S=(d+m)/2,C=[(E+=(e[1]-e[3])/2*b)*c-(S+=(e[0]-e[2])/2*b)*(l=-l),S*c+E*l],A=h.callback?h.callback:ui.nullFunction;void 0!==h.duration?this.animate({resolution:b,center:C,duration:h.duration,easing:h.easing},A):(this.setResolution(b),this.setCenter(C),setTimeout(A.bind(void 0,!0),0))},Ss.prototype.centerOn=function(t,i,s){var h=this.getRotation(),n=Math.cos(-h),r=Math.sin(-h),e=t[0]*n-t[1]*r,o=t[1]*n+t[0]*r,a=this.getResolution();this.setCenter([(e+=(i[0]/2-s[0])*a)*n-(o+=(s[1]-i[1]/2)*a)*(r=-r),o*n+e*r])},Ss.prototype.isDef=function(){return!!this.getCenter()&&void 0!==this.getResolution()},Ss.prototype.rotate=function(t,i){if(void 0!==i){var s=this.calculateCenterRotate(t,i);this.setCenter(s)}this.setRotation(t)},Ss.prototype.setCenter=function(t){this.set("center",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setHint=function(t,i){return this.hints_[t]+=i,this.changed(),this.hints_[t]},Ss.prototype.setResolution=function(t){this.set("resolution",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setRotation=function(t){this.set("rotation",t),this.getAnimating()&&this.cancelAnimations()},Ss.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))},Ss.createCenterConstraint_=function(t){return void 0!==t.extent?gs.createExtent(t.extent):gs.none},Ss.createResolutionConstraint_=function(t){var i,s,h,n=void 0!==t.minZoom?t.minZoom:ui.DEFAULT_MIN_ZOOM,r=void 0!==t.maxZoom?t.maxZoom:28,e=void 0!==t.zoomFactor?t.zoomFactor:2;if(void 0!==t.resolutions){var o=t.resolutions;s=o[n],h=void 0!==o[r]?o[r]:o[o.length-1],i=_s(o)}else{var a=Li.createProjection(t.projection,"EPSG:3857"),u=a.getExtent(),f=(u?Math.max(bi.getWidth(u),bi.getHeight(u)):360*Li.METERS_PER_UNIT[Pi.DEGREES]/a.getMetersPerUnit())/ui.DEFAULT_TILE_SIZE/Math.pow(2,ui.DEFAULT_MIN_ZOOM),c=f/Math.pow(2,28-ui.DEFAULT_MIN_ZOOM);void 0!==(s=t.maxResolution)?n=0:s=f/Math.pow(e,n),void 0===(h=t.minResolution)&&(h=void 0!==t.maxZoom?void 0!==t.maxResolution?s/Math.pow(e,r):f/Math.pow(e,r):c),r=n+Math.floor(Math.log(s/h)/Math.log(e)),h=s/Math.pow(e,r-n),i=ws(e,s,r-n)}return{constraint:i,maxResolution:s,minResolution:h,minZoom:n,zoomFactor:e}},Ss.createRotationConstraint_=function(t){if(void 0===t.enableRotation||t.enableRotation){var i=t.constrainRotation;return void 0===i||!0===i?ys.createSnapToZero():!1===i?ys.none:"number"==typeof i?ys.createSnapToN(i):ys.none}return ys.disable},Ss.isNoopAnimation=function(t){return!(t.sourceCenter&&t.targetCenter&&!xs.equals(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation};var Cs=function(t,i){var s=document.createElement("CANVAS");return t&&(s.width=t),i&&(s.height=i),s.getContext("2d")},As=function(t,i){var s=i.parentNode;s&&s.replaceChild(t,i)},Ps=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null},Rs=function(t){mi.call(this);var i=fi.assign({},t);i.opacity=void 0!==t.opacity?t.opacity:1,i.visible=void 0===t.visible||t.visible,i.zIndex=void 0!==t.zIndex?t.zIndex:0,i.maxResolution=void 0!==t.maxResolution?t.maxResolution:1/0,i.minResolution=void 0!==t.minResolution?t.minResolution:0,this.setProperties(i),this.state_={layer:this,managed:!0}};ui.inherits(Rs,mi),Rs.prototype.getType=function(){return this.type},Rs.prototype.getLayerState=function(){return this.state_.opacity=_i.clamp(this.getOpacity(),0,1),this.state_.sourceState=this.getSourceState(),this.state_.visible=this.getVisible(),this.state_.extent=this.getExtent(),this.state_.zIndex=this.getZIndex(),this.state_.maxResolution=this.getMaxResolution(),this.state_.minResolution=Math.max(this.getMinResolution(),0),this.state_},Rs.prototype.getLayersArray=function(){},Rs.prototype.getLayerStatesArray=function(){},Rs.prototype.getExtent=function(){return this.get("extent")},Rs.prototype.getMaxResolution=function(){return this.get("maxResolution")},Rs.prototype.getMinResolution=function(){return this.get("minResolution")},Rs.prototype.getOpacity=function(){return this.get("opacity")},Rs.prototype.getSourceState=function(){},Rs.prototype.getVisible=function(){return this.get("visible")},Rs.prototype.getZIndex=function(){return this.get("zIndex")},Rs.prototype.setExtent=function(t){this.set("extent",t)},Rs.prototype.setMaxResolution=function(t){this.set("maxResolution",t)},Rs.prototype.setMinResolution=function(t){this.set("minResolution",t)},Rs.prototype.setOpacity=function(t){this.set("opacity",t)},Rs.prototype.setVisible=function(t){this.set("visible",t)},Rs.prototype.setZIndex=function(t){this.set("zIndex",t)};var Ns=function(t){var i=t||{},s=fi.assign({},i);delete s.layers;var h=i.layers;Rs.call(this,s),this.layersListenerKeys_=[],this.listenerKeys_={},ci.listen(this,mi.getChangeEventType(Ns.Property_.LAYERS),this.handleLayersChanged_,this),h?Array.isArray(h)?h=new hs(h.slice(),{unique:!0}):(gi(h instanceof hs,43),h=h):h=new hs(void 0,{unique:!0}),this.setLayers(h)};ui.inherits(Ns,Rs),Ns.prototype.handleLayerChange_=function(){this.changed()},Ns.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(ci.unlistenByKey),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var i in this.layersListenerKeys_.push(ci.listen(t,"add",this.handleLayersAdd_,this),ci.listen(t,"remove",this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[i].forEach(ci.unlistenByKey);fi.clear(this.listenerKeys_);var s,h,n,r=t.getArray();for(s=0,h=r.length;s<h;s++)this.listenerKeys_[ui.getUid(n=r[s]).toString()]=[ci.listen(n,"propertychange",this.handleLayerChange_,this),ci.listen(n,"change",this.handleLayerChange_,this)];this.changed()},Ns.prototype.handleLayersAdd_=function(t){var i=t.element,s=ui.getUid(i).toString();this.listenerKeys_[s]=[ci.listen(i,"propertychange",this.handleLayerChange_,this),ci.listen(i,"change",this.handleLayerChange_,this)],this.changed()},Ns.prototype.handleLayersRemove_=function(t){var i=ui.getUid(t.element).toString();this.listenerKeys_[i].forEach(ci.unlistenByKey),delete this.listenerKeys_[i],this.changed()},Ns.prototype.getLayers=function(){return this.get(Ns.Property_.LAYERS)},Ns.prototype.setLayers=function(t){this.set(Ns.Property_.LAYERS,t)},Ns.prototype.getLayersArray=function(t){var i=void 0!==t?t:[];return this.getLayers().forEach((function(t){t.getLayersArray(i)})),i},Ns.prototype.getLayerStatesArray=function(t){var i=void 0!==t?t:[],s=i.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(i)}));var h,n,r,e=this.getLayerState();for(h=s,n=i.length;h<n;h++)(r=i[h]).opacity*=e.opacity,r.visible=r.visible&&e.visible,r.maxResolution=Math.min(r.maxResolution,e.maxResolution),r.minResolution=Math.max(r.minResolution,e.minResolution),void 0!==e.extent&&(r.extent=void 0!==r.extent?bi.getIntersection(r.extent,e.extent):e.extent);return i},Ns.prototype.getSourceState=function(){return"ready"},Ns.Property_={LAYERS:"layers"};var zs={mapRendererPlugins_:[],getMapRendererPlugins:function(){return zs.mapRendererPlugins_},layerRendererPlugins_:[],getLayerRendererPlugins:function(){return zs.layerRendererPlugins_},register:function(t,i){switch(t){case"MAP_RENDERER":zs.mapRendererPlugins_.push(i);break;case"LAYER_RENDERER":zs.layerRendererPlugins_.push(i);break;default:throw new Error("Unsupported plugin type: "+t)}},registerMultiple:function(t,i){for(var s=0,h=i.length;s<h;++s)zs.register(t,i[s])}},ks=function(t){return t[0]>0&&t[1]>0},Ts=function(t,i,s){return void 0===s&&(s=[0,0]),s[0]=t[0]*i+.5|0,s[1]=t[1]*i+.5|0,s},Os=function(t,i){return Array.isArray(t)?t:(void 0===i?i=[t,t]:i[0]=i[1]=t,i)},Ls=function(t){mi.call(this);var i=Ls.createOptionsInternal(t);this.loadTilesWhileAnimating_=void 0!==t.loadTilesWhileAnimating&&t.loadTilesWhileAnimating,this.loadTilesWhileInteracting_=void 0!==t.loadTilesWhileInteracting&&t.loadTilesWhileInteracting,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:ts.DEVICE_PIXEL_RATIO,this.logos_=i.logos,this.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_.call(this,Date.now())}.bind(this),this.coordinateToPixelTransform_=Ii.create(),this.pixelToCoordinateTransform_=Ii.create(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("DIV"),this.viewport_.className="ol-viewport"+(ts.TOUCH?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.viewport_.style.msTouchAction="none",this.viewport_.style.touchAction="none",this.overlayContainer_=document.createElement("DIV"),this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("DIV"),this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent";for(var s=["click","dblclick","mousedown","touchstart","MSPointerDown",es.POINTERDOWN,"mousewheel","wheel"],h=0,n=s.length;h<n;++h)ci.listen(this.overlayContainerStopEvent_,s[h],vi.stopPropagation);for(var r in this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=new Ms(this,t.moveTolerance),es)ci.listen(this.mapBrowserEventHandler_,es[r],this.handleMapBrowserEvent,this);this.keyboardEventTarget_=i.keyboardEventTarget,this.keyHandlerKeys_=null,ci.listen(this.viewport_,"wheel",this.handleBrowserEvent,this),ci.listen(this.viewport_,"mousewheel",this.handleBrowserEvent,this),this.controls=i.controls||new hs,this.interactions=i.interactions||new hs,this.overlays_=i.overlays,this.overlayIdIndex_={},this.renderer_=i.mapRendererPlugin.create(this.viewport_,this),this.focus_=null,this.postRenderFunctions_=[],this.tileQueue_=new ps(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.skippedFeatureUids_={},ci.listen(this,mi.getChangeEventType("layergroup"),this.handleLayerGroupChanged_,this),ci.listen(this,mi.getChangeEventType("view"),this.handleViewChanged_,this),ci.listen(this,mi.getChangeEventType("size"),this.handleSizeChanged_,this),ci.listen(this,mi.getChangeEventType("target"),this.handleTargetChanged_,this),this.setProperties(i.values),this.controls.forEach((function(t){t.setMap(this)}),this),ci.listen(this.controls,"add",(function(t){t.element.setMap(this)}),this),ci.listen(this.controls,"remove",(function(t){t.element.setMap(null)}),this),this.interactions.forEach((function(t){t.setMap(this)}),this),ci.listen(this.interactions,"add",(function(t){t.element.setMap(this)}),this),ci.listen(this.interactions,"remove",(function(t){t.element.setMap(null)}),this),this.overlays_.forEach(this.addOverlayInternal_,this),ci.listen(this.overlays_,"add",(function(t){this.addOverlayInternal_(t.element)}),this),ci.listen(this.overlays_,"remove",(function(t){var i=t.element.getId();void 0!==i&&delete this.overlayIdIndex_[i.toString()],t.element.setMap(null)}),this)};ui.inherits(Ls,mi),Ls.prototype.addControl=function(t){this.getControls().push(t)},Ls.prototype.addInteraction=function(t){this.getInteractions().push(t)},Ls.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},Ls.prototype.addOverlay=function(t){this.getOverlays().push(t)},Ls.prototype.addOverlayInternal_=function(t){var i=t.getId();void 0!==i&&(this.overlayIdIndex_[i.toString()]=t),t.setMap(this)},Ls.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose(),ci.unlisten(this.viewport_,"wheel",this.handleBrowserEvent,this),ci.unlisten(this.viewport_,"mousewheel",this.handleBrowserEvent,this),void 0!==this.handleResize_&&(window.removeEventListener("resize",this.handleResize_,!1),this.handleResize_=void 0),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0),this.setTarget(null),mi.prototype.disposeInternal.call(this)},Ls.prototype.forEachFeatureAtPixel=function(t,i,s){if(this.frameState_){var h=this.getCoordinateFromPixel(t);return this.renderer_.forEachFeatureAtCoordinate(h,this.frameState_,void 0!==(s=void 0!==s?s:{}).hitTolerance?s.hitTolerance*this.frameState_.pixelRatio:0,i,null,void 0!==s.layerFilter?s.layerFilter:xi.TRUE,null)}},Ls.prototype.getFeaturesAtPixel=function(t,i){var s=null;return this.forEachFeatureAtPixel(t,(function(t){s||(s=[]),s.push(t)}),i),s},Ls.prototype.forEachLayerAtPixel=function(t,i,s,h,n){if(this.frameState_)return this.renderer_.forEachLayerAtPixel(t,this.frameState_,i,void 0!==s?s:null,void 0!==h?h:xi.TRUE,void 0!==n?n:null)},Ls.prototype.hasFeatureAtPixel=function(t,i){if(!this.frameState_)return!1;var s=this.getCoordinateFromPixel(t);return this.renderer_.hasFeatureAtCoordinate(s,this.frameState_,void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,void 0!==i.layerFilter?i.layerFilter:xi.TRUE,null)},Ls.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},Ls.prototype.getEventPixel=function(t){var i=this.viewport_.getBoundingClientRect(),s=t.changedTouches?t.changedTouches[0]:t;return[s.clientX-i.left,s.clientY-i.top]},Ls.prototype.getTarget=function(){return this.get("target")},Ls.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},Ls.prototype.getCoordinateFromPixel=function(t){var i=this.frameState_;return i?Ii.apply(i.pixelToCoordinateTransform,t.slice()):null},Ls.prototype.getControls=function(){return this.controls},Ls.prototype.getOverlays=function(){return this.overlays_},Ls.prototype.getOverlayById=function(t){var i=this.overlayIdIndex_[t.toString()];return void 0!==i?i:null},Ls.prototype.getInteractions=function(){return this.interactions},Ls.prototype.getLayerGroup=function(){return this.get("layergroup")},Ls.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},Ls.prototype.getPixelFromCoordinate=function(t){var i=this.frameState_;return i?Ii.apply(i.coordinateToPixelTransform,t.slice(0,2)):null},Ls.prototype.getRenderer=function(){return this.renderer_},Ls.prototype.getSize=function(){return this.get("size")},Ls.prototype.getView=function(){return this.get("view")},Ls.prototype.getViewport=function(){return this.viewport_},Ls.prototype.getOverlayContainer=function(){return this.overlayContainer_},Ls.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_},Ls.prototype.getTilePriority=function(t,i,s,h){var n=this.frameState_;if(!n||!(i in n.wantedTiles))return ms.DROP;if(!n.wantedTiles[i][t.getKey()])return ms.DROP;var r=s[0]-n.focus[0],e=s[1]-n.focus[1];return 65536*Math.log(h)+Math.sqrt(r*r+e*e)/h},Ls.prototype.handleBrowserEvent=function(t,i){var s=new rs(i||t.type,this,t);this.handleMapBrowserEvent(s)},Ls.prototype.handleMapBrowserEvent=function(t){if(this.frameState_){this.focus_=t.coordinate,t.frameState=this.frameState_;var i,s=this.getInteractions().getArray();if(!1!==this.dispatchEvent(t))for(i=s.length-1;i>=0;i--){var h=s[i];if(h.getActive()&&!h.handleEvent(t))break}}},Ls.prototype.handlePostRender=function(){var t=this.frameState_,i=this.tileQueue_;if(!i.isEmpty()){var s=16,h=s;if(t){var n=t.viewHints;n[0]&&(s=this.loadTilesWhileAnimating_?8:0,h=2),n[1]&&(s=this.loadTilesWhileInteracting_?8:0,h=2)}i.getTilesLoading()<s&&(i.reprioritize(),i.loadMoreTiles(s,h))}var r,e,o=this.postRenderFunctions_;for(r=0,e=o.length;r<e;++r)o[r](this,t);o.length=0},Ls.prototype.handleSizeChanged_=function(){this.render()},Ls.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()&&(t=this.getTargetElement()),this.keyHandlerKeys_){for(var i=0,s=this.keyHandlerKeys_.length;i<s;++i)ci.unlistenByKey(this.keyHandlerKeys_[i]);this.keyHandlerKeys_=null}if(t){t.appendChild(this.viewport_);var h=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.keyHandlerKeys_=[ci.listen(h,"keydown",this.handleBrowserEvent,this),ci.listen(h,"keypress",this.handleBrowserEvent,this)],this.handleResize_||(this.handleResize_=this.updateSize.bind(this),window.addEventListener("resize",this.handleResize_,!1))}else this.renderer_.removeLayerRenderers(),Ps(this.viewport_),void 0!==this.handleResize_&&(window.removeEventListener("resize",this.handleResize_,!1),this.handleResize_=void 0);this.updateSize()},Ls.prototype.handleTileChange_=function(){this.render()},Ls.prototype.handleViewPropertyChanged_=function(){this.render()},Ls.prototype.handleViewChanged_=function(){this.viewPropertyListenerKey_&&(ci.unlistenByKey(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ci.unlistenByKey(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);var t=this.getView();t&&(this.viewport_.setAttribute("data-view",ui.getUid(t)),this.viewPropertyListenerKey_=ci.listen(t,"propertychange",this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=ci.listen(t,"change",this.handleViewPropertyChanged_,this)),this.render()},Ls.prototype.handleLayerGroupChanged_=function(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ci.unlistenByKey),this.layerGroupPropertyListenerKeys_=null);var t=this.getLayerGroup();t&&(this.layerGroupPropertyListenerKeys_=[ci.listen(t,"propertychange",this.render,this),ci.listen(t,"change",this.render,this)]),this.render()},Ls.prototype.isRendered=function(){return!!this.frameState_},Ls.prototype.renderSync=function(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()},Ls.prototype.render=function(){void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))},Ls.prototype.removeControl=function(t){return this.getControls().remove(t)},Ls.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)},Ls.prototype.removeLayer=function(t){return this.getLayerGroup().getLayers().remove(t)},Ls.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)},Ls.prototype.renderFrame_=function(t){var i,s,h,n=this.getSize(),r=this.getView(),e=bi.createEmpty(),o=this.frameState_,a=null;if(void 0!==n&&ks(n)&&r&&r.isDef()){var u=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),f=this.getLayerGroup().getLayerStatesArray(),c={};for(i=0,s=f.length;i<s;++i)c[ui.getUid(f[i].layer)]=f[i];var l=(h=r.getState()).center,v=h.resolution/this.pixelRatio_;l[0]=Math.round(l[0]/v)*v,l[1]=Math.round(l[1]/v)*v,a={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,extent:e,focus:this.focus_?this.focus_:l,index:this.frameIndex_++,layerStates:c,layerStatesArray:f,logos:fi.assign({},this.logos_),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:n,skippedFeatureUids:this.skippedFeatureUids_,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:h,viewHints:u,wantedTiles:{}}}a&&(a.extent=bi.getForViewAndSize(h.center,h.resolution,h.rotation,a.size,e)),this.frameState_=a,this.renderer_.renderFrame(a),a&&(a.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,a.postRenderFunctions),o&&(!this.previousExtent_||!bi.isEmpty(this.previousExtent_)&&!bi.equals(a.extent,this.previousExtent_))&&(this.dispatchEvent(new ns("movestart",this,o)),this.previousExtent_=bi.createOrUpdateEmpty(this.previousExtent_)),this.previousExtent_&&!a.viewHints[0]&&!a.viewHints[1]&&!bi.equals(a.extent,this.previousExtent_)&&(this.dispatchEvent(new ns("moveend",this,a)),bi.clone(a.extent,this.previousExtent_))),this.dispatchEvent(new ns("postrender",this,a)),setTimeout(this.handlePostRender.bind(this),0)},Ls.prototype.setLayerGroup=function(t){this.set("layergroup",t)},Ls.prototype.setSize=function(t){this.set("size",t)},Ls.prototype.setTarget=function(t){this.set("target",t)},Ls.prototype.setView=function(t){this.set("view",t)},Ls.prototype.skipFeature=function(t){var i=ui.getUid(t).toString();this.skippedFeatureUids_[i]=!0,this.render()},Ls.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var i=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth)])}else this.setSize(void 0)},Ls.prototype.unskipFeature=function(t){var i=ui.getUid(t).toString();delete this.skippedFeatureUids_[i],this.render()},Ls.DEFAULT_RENDERER_TYPES=["canvas","webgl"],Ls.LOGO_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszWWMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvYasvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvXH1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1VkbMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLPVcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqTacrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaarldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+HizeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDnBAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSFhYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJREFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxCBrb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7ahgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCnB3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDgq82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC",Ls.createOptionsInternal=function(t){var i=null;void 0!==t.keyboardEventTarget&&(i="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var s={},h={};if(void 0===t.logo||"boolean"==typeof t.logo&&t.logo)h[Ls.LOGO_URL]="https://openlayers.org/";else{var n=t.logo;"string"==typeof n?h[n]="":n instanceof HTMLElement?h[ui.getUid(n).toString()]=n:n&&(gi("string"==typeof n.href,44),gi("string"==typeof n.src,45),h[n.src]=n.href)}var r,e,o=t.layers instanceof Ns?t.layers:new Ns({layers:t.layers});s.layergroup=o,s.target=t.target,s.view=void 0!==t.view?t.view:new Ss,void 0!==t.renderer?(Array.isArray(t.renderer)?r=t.renderer:"string"==typeof t.renderer?r=[t.renderer]:gi(!1,46),r.indexOf("dom")>=0&&(r=r.concat(Ls.DEFAULT_RENDERER_TYPES))):r=Ls.DEFAULT_RENDERER_TYPES;var a,u,f,c=zs.getMapRendererPlugins();t:for(var l=0,v=r.length;l<v;++l)for(var d=r[l],M=0,m=c.length;M<m;++M){var p=c[M];if(p.handles(d)){e=p;break t}}if(!e)throw new Error("Unable to create a map renderer for types: "+r.join(", "));return void 0!==t.controls&&(Array.isArray(t.controls)?a=new hs(t.controls.slice()):(gi(t.controls instanceof hs,47),a=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?u=new hs(t.interactions.slice()):(gi(t.interactions instanceof hs,48),u=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?f=new hs(t.overlays.slice()):(gi(t.overlays instanceof hs,49),f=t.overlays):f=new hs,{controls:a,interactions:u,keyboardEventTarget:i,logos:h,overlays:f,mapRendererPlugin:e,values:s}};var Is=function(t){mi.call(this),this.element=t.element?t.element:null,this.target_=null,this.map_=null,this.listenerKeys=[],this.render=t.render?t.render:ui.nullFunction,t.target&&this.setTarget(t.target)};ui.inherits(Is,mi),Is.prototype.disposeInternal=function(){Ps(this.element),mi.prototype.disposeInternal.call(this)},Is.prototype.getMap=function(){return this.map_},Is.prototype.setMap=function(t){this.map_&&Ps(this.element);for(var i=0,s=this.listenerKeys.length;i<s;++i)ci.unlistenByKey(this.listenerKeys[i]);this.listenerKeys.length=0,this.map_=t,this.map_&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==ui.nullFunction&&this.listenerKeys.push(ci.listen(t,"postrender",this.render,this)),t.render())},Is.prototype.setTarget=function(t){this.target_="string"==typeof t?document.getElementById(t):t};var Fs,Ds,Gs={CLASS_HIDDEN:"ol-hidden",CLASS_SELECTABLE:"ol-selectable",CLASS_UNSELECTABLE:"ol-unselectable",CLASS_UNSUPPORTED:"ol-unsupported",CLASS_CONTROL:"ol-control"};Gs.getFontFamilies=(Ds={},function(t){if(Fs||(Fs=document.createElement("div").style),!(t in Ds)){Fs.font=t;var i=Fs.fontFamily;if(Fs.font="",!i)return null;Ds[t]=i.split(/,\s?/)}return Ds[t]});var Ws=function(t){var i=fi.assign({},t);delete i.source,Rs.call(this,i),this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,t.map&&this.setMap(t.map),ci.listen(this,mi.getChangeEventType("source"),this.handleSourcePropertyChange_,this),this.setSource(t.source?t.source:null)};ui.inherits(Ws,Rs),Ws.visibleAtResolution=function(t,i){return t.visible&&i>=t.minResolution&&i<t.maxResolution},Ws.prototype.getLayersArray=function(t){var i=t||[];return i.push(this),i},Ws.prototype.getLayerStatesArray=function(t){var i=t||[];return i.push(this.getLayerState()),i},Ws.prototype.getSource=function(){return this.get("source")||null},Ws.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():"undefined"},Ws.prototype.handleSourceChange_=function(){this.changed()},Ws.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(ci.unlistenByKey(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=ci.listen(t,"change",this.handleSourceChange_,this)),this.changed()},Ws.prototype.setMap=function(t){this.mapPrecomposeKey_&&(ci.unlistenByKey(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ci.unlistenByKey(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=ci.listen(t,"precompose",(function(t){var i=this.getLayerState();i.managed=!1,i.zIndex=1/0,t.frameState.layerStatesArray.push(i),t.frameState.layerStates[ui.getUid(this)]=i}),this),this.mapRenderKey_=ci.listen(this,"change",t.render,t),this.changed())},Ws.prototype.setSource=function(t){this.set("source",t)};var Vs=function(t){var i=t||{};this.ulElement_=document.createElement("UL"),this.logoLi_=document.createElement("LI"),this.ulElement_.appendChild(this.logoLi_),this.logoLi_.style.display="none",this.collapsed_=void 0===i.collapsed||i.collapsed,this.collapsible_=void 0===i.collapsible||i.collapsible,this.collapsible_||(this.collapsed_=!1);var s=void 0!==i.className?i.className:"ol-attribution",h=void 0!==i.tipLabel?i.tipLabel:"Attributions",n=void 0!==i.collapseLabel?i.collapseLabel:"»";"string"==typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n):this.collapseLabel_=n;var r=void 0!==i.label?i.label:"i";"string"==typeof r?(this.label_=document.createElement("span"),this.label_.textContent=r):this.label_=r;var e=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,o=document.createElement("button");o.setAttribute("type","button"),o.title=h,o.appendChild(e),ci.listen(o,"click",this.handleClick_,this);var a=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" ol-collapsed":"")+(this.collapsible_?"":" ol-uncollapsible"),u=document.createElement("div");u.className=a,u.appendChild(this.ulElement_),u.appendChild(o),Is.call(this,{element:u,render:i.render?i.render:Vs.render,target:i.target}),this.renderedAttributions_=[],this.renderedVisible_=!0,this.logoElements_={}};ui.inherits(Vs,Is),Vs.prototype.getSourceAttributions_=function(t){for(var i={},s=[],h=t.layerStatesArray,n=t.viewState.resolution,r=0,e=h.length;r<e;++r){var o=h[r];if(Ws.visibleAtResolution(o,n)){var a=o.layer.getSource();if(a){var u=a.getAttributions2();if(u){var f=u(t);if(f)if(Array.isArray(f))for(var c=0,l=f.length;c<l;++c)f[c]in i||(s.push(f[c]),i[f[c]]=!0);else f in i||(s.push(f),i[f]=!0)}}}}return s},Vs.render=function(t){this.updateElement_(t.frameState)},Vs.prototype.updateElement_=function(t){if(t){var i=this.getSourceAttributions_(t);if(!yi.equals(i,this.renderedAttributions_)){for(;this.ulElement_.lastChild!==this.logoLi_;)this.ulElement_.removeChild(this.ulElement_.lastChild);for(var s=0,h=i.length;s<h;++s){var n=document.createElement("LI");n.innerHTML=i[s],this.ulElement_.appendChild(n)}0===i.length&&this.renderedAttributions_.length>0?this.element.classList.add("ol-logo-only"):0===this.renderedAttributions_.length&&i.length>0&&this.element.classList.remove("ol-logo-only");var r=i.length>0||!fi.isEmpty(t.logos);this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),this.renderedAttributions_=i,this.insertLogos_(t)}}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},Vs.prototype.insertLogos_=function(t){var i,s,h,n,r=t.logos,e=this.logoElements_;for(i in e)i in r||(Ps(e[i]),delete e[i]);for(n in r){var o=r[n];o instanceof HTMLElement&&(this.logoLi_.appendChild(o),e[n]=o),n in e||((s=new Image).src=n,""===o?h=s:((h=document.createElement("a")).href=o,h.appendChild(s)),this.logoLi_.appendChild(h),e[n]=h)}this.logoLi_.style.display=fi.isEmpty(r)?"none":""},Vs.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},Vs.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?As(this.collapseLabel_,this.label_):As(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_},Vs.prototype.getCollapsible=function(){return this.collapsible_},Vs.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},Vs.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},Vs.prototype.getCollapsed=function(){return this.collapsed_};var js=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-rotate",h=void 0!==i.label?i.label:"⇧";this.label_=null,"string"==typeof h?(this.label_=document.createElement("span"),this.label_.className="ol-compass",this.label_.textContent=h):(this.label_=h,this.label_.classList.add("ol-compass"));var n=i.tipLabel?i.tipLabel:"Reset rotation",r=document.createElement("button");r.className=s+"-reset",r.setAttribute("type","button"),r.title=n,r.appendChild(this.label_),ci.listen(r,"click",js.prototype.handleClick_,this);var e=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL,o=document.createElement("div");o.className=e,o.appendChild(r);var a=i.render?i.render:js.render;this.callResetNorth_=i.resetNorth?i.resetNorth:void 0,Is.call(this,{element:o,render:a,target:i.target}),this.duration_=void 0!==i.duration?i.duration:250,this.autoHide_=void 0===i.autoHide||i.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Gs.CLASS_HIDDEN)};ui.inherits(js,Is),js.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},js.prototype.resetNorth_=function(){var t=this.getMap().getView();t&&void 0!==t.getRotation()&&(this.duration_>0?t.animate({rotation:0,duration:this.duration_,easing:Es.easeOut}):t.setRotation(0))},js.render=function(t){var i=t.frameState;if(i){var s=i.viewState.rotation;if(s!=this.rotation_){var h="rotate("+s+"rad)";if(this.autoHide_){var n=this.element.classList.contains(Gs.CLASS_HIDDEN);n||0!==s?n&&0!==s&&this.element.classList.remove(Gs.CLASS_HIDDEN):this.element.classList.add(Gs.CLASS_HIDDEN)}this.label_.style.msTransform=h,this.label_.style.webkitTransform=h,this.label_.style.transform=h}this.rotation_=s}};var Us=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-zoom",h=void 0!==i.delta?i.delta:1,n=void 0!==i.zoomInLabel?i.zoomInLabel:"+",r=void 0!==i.zoomOutLabel?i.zoomOutLabel:"−",e=void 0!==i.zoomInTipLabel?i.zoomInTipLabel:"Zoom in",o=void 0!==i.zoomOutTipLabel?i.zoomOutTipLabel:"Zoom out",a=document.createElement("button");a.className=s+"-in",a.setAttribute("type","button"),a.title=e,a.appendChild("string"==typeof n?document.createTextNode(n):n),ci.listen(a,"click",Us.prototype.handleClick_.bind(this,h));var u=document.createElement("button");u.className=s+"-out",u.setAttribute("type","button"),u.title=o,u.appendChild("string"==typeof r?document.createTextNode(r):r),ci.listen(u,"click",Us.prototype.handleClick_.bind(this,-h));var f=s+" "+Gs.CLASS_UNSELECTABLE+" "+Gs.CLASS_CONTROL,c=document.createElement("div");c.className=f,c.appendChild(a),c.appendChild(u),Is.call(this,{element:c,target:i.target}),this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Us,Is),Us.prototype.handleClick_=function(t,i){i.preventDefault(),this.zoomByDelta_(t)},Us.prototype.zoomByDelta_=function(t){var i=this.getMap().getView();if(i){var s=i.getResolution();if(s){var h=i.constrainResolution(s,t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:h,duration:this.duration_,easing:Es.easeOut})):i.setResolution(h)}}};var Xs=function(t){var i=t||{},s=new hs;return(void 0===i.zoom||i.zoom)&&s.push(new Us(i.zoomOptions)),(void 0===i.rotate||i.rotate)&&s.push(new js(i.rotateOptions)),(void 0===i.attribution||i.attribution)&&s.push(new Vs(i.attributionOptions)),s},qs=function(t,i,s){this.decay_=t,this.minVelocity_=i,this.delay_=s,this.points_=[],this.angle_=0,this.initialVelocity_=0};qs.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},qs.prototype.update=function(t,i){this.points_.push(t,i,Date.now())},qs.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,i=this.points_.length-3;if(this.points_[i+2]<t)return!1;for(var s=i-3;s>0&&this.points_[s+2]>t;)s-=3;var h=this.points_[i+2]-this.points_[s+2];if(h<1e3/60)return!1;var n=this.points_[i]-this.points_[s],r=this.points_[i+1]-this.points_[s+1];return this.angle_=Math.atan2(r,n),this.initialVelocity_=Math.sqrt(n*n+r*r)/h,this.initialVelocity_>this.minVelocity_},qs.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},qs.prototype.getAngle=function(){return this.angle_};var Ys=function(t){mi.call(this),this.map_=null,this.setActive(!0),this.handleEvent=t.handleEvent};ui.inherits(Ys,mi),Ys.prototype.getActive=function(){return this.get("active")},Ys.prototype.getMap=function(){return this.map_},Ys.prototype.setActive=function(t){this.set("active",t)},Ys.prototype.setMap=function(t){this.map_=t},Ys.pan=function(t,i,s){var h=t.getCenter();if(h){var n=t.constrainCenter([h[0]+i[0],h[1]+i[1]]);s?t.animate({duration:s,easing:Es.linear,center:n}):t.setCenter(n)}},Ys.rotate=function(t,i,s,h){i=t.constrainRotation(i,0),Ys.rotateWithoutConstraints(t,i,s,h)},Ys.rotateWithoutConstraints=function(t,i,s,h){if(void 0!==i){var n=t.getRotation(),r=t.getCenter();void 0!==n&&r&&h>0?t.animate({rotation:i,anchor:s,duration:h,easing:Es.easeOut}):t.rotate(i,s)}},Ys.zoom=function(t,i,s,h,n){i=t.constrainResolution(i,0,n),Ys.zoomWithoutConstraints(t,i,s,h)},Ys.zoomByDelta=function(t,i,s,h){var n=t.getResolution(),r=t.constrainResolution(n,i,0);if(void 0!==r){var e=t.getResolutions();r=_i.clamp(r,t.getMinResolution()||e[e.length-1],t.getMaxResolution()||e[0])}if(s&&void 0!==r&&r!==n){var o=t.getCenter(),a=t.calculateCenterZoom(r,s);a=t.constrainCenter(a),s=[(r*o[0]-n*a[0])/(r-n),(r*o[1]-n*a[1])/(r-n)]}Ys.zoomWithoutConstraints(t,r,s,h)},Ys.zoomWithoutConstraints=function(t,i,s,h){if(i){var n=t.getResolution(),r=t.getCenter();if(void 0!==n&&r&&i!==n&&h)t.animate({resolution:i,anchor:s,duration:h,easing:Es.easeOut});else{if(s){var e=t.calculateCenterZoom(i,s);t.setCenter(e)}t.setResolution(i)}}};var Bs=function(t){var i=t||{};this.delta_=i.delta?i.delta:1,Ys.call(this,{handleEvent:Bs.handleEvent}),this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Bs,Ys),Bs.handleEvent=function(t){var i=!1;if(t.type==es.DBLCLICK){var s=t.coordinate,h=t.originalEvent.shiftKey?-this.delta_:this.delta_,n=t.map.getView();Ys.zoomByDelta(n,h,s,this.duration_),t.preventDefault(),i=!0}return!i};var Hs={altKeyOnly:function(t){var i=t.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey},altShiftKeysOnly:function(t){var i=t.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&i.shiftKey}};Hs.always=xi.TRUE,Hs.click=function(t){return t.type==es.CLICK},Hs.mouseActionButton=function(t){var i=t.originalEvent;return 0==i.button&&!(ts.WEBKIT&&ts.MAC&&i.ctrlKey)},Hs.never=xi.FALSE,Hs.pointerMove=function(t){return"pointermove"==t.type},Hs.singleClick=function(t){return t.type==es.SINGLECLICK},Hs.doubleClick=function(t){return t.type==es.DBLCLICK},Hs.noModifierKeys=function(t){var i=t.originalEvent;return!i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey},Hs.platformModifierKeyOnly=function(t){var i=t.originalEvent;return!i.altKey&&(ts.MAC?i.metaKey:i.ctrlKey)&&!i.shiftKey},Hs.shiftKeyOnly=function(t){var i=t.originalEvent;return!i.altKey&&!(i.metaKey||i.ctrlKey)&&i.shiftKey},Hs.targetNotEditable=function(t){var i=t.originalEvent.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i},Hs.mouseOnly=function(t){return gi(t.pointerEvent,56),"mouse"==t.pointerEvent.pointerType},Hs.primaryAction=function(t){var i=t.pointerEvent;return i.isPrimary&&0===i.button};var Js=function(t){var i=t||{};Ys.call(this,{handleEvent:i.handleEvent?i.handleEvent:Js.handleEvent}),this.handleDownEvent_=i.handleDownEvent?i.handleDownEvent:Js.handleDownEvent,this.handleDragEvent_=i.handleDragEvent?i.handleDragEvent:Js.handleDragEvent,this.handleMoveEvent_=i.handleMoveEvent?i.handleMoveEvent:Js.handleMoveEvent,this.handleUpEvent_=i.handleUpEvent?i.handleUpEvent:Js.handleUpEvent,this.handlingDownUpSequence=!1,this.trackedPointers_={},this.targetPointers=[]};ui.inherits(Js,Ys),Js.centroid=function(t){for(var i=t.length,s=0,h=0,n=0;n<i;n++)s+=t[n].clientX,h+=t[n].clientY;return[s/i,h/i]},Js.prototype.isPointerDraggingEvent_=function(t){var i=t.type;return i===es.POINTERDOWN||i===es.POINTERDRAG||i===es.POINTERUP},Js.prototype.updateTrackedPointers_=function(t){if(this.isPointerDraggingEvent_(t)){var i=t.pointerEvent,s=i.pointerId.toString();t.type==es.POINTERUP?delete this.trackedPointers_[s]:(t.type==es.POINTERDOWN||s in this.trackedPointers_)&&(this.trackedPointers_[s]=i),this.targetPointers=fi.getValues(this.trackedPointers_)}},Js.handleDragEvent=ui.nullFunction,Js.handleUpEvent=xi.FALSE,Js.handleDownEvent=xi.FALSE,Js.handleMoveEvent=ui.nullFunction,Js.handleEvent=function(t){if(!(t instanceof os))return!0;var i=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==es.POINTERDRAG)this.handleDragEvent_(t);else if(t.type==es.POINTERUP){var s=this.handleUpEvent_(t);this.handlingDownUpSequence=s&&this.targetPointers.length>0}}else if(t.type==es.POINTERDOWN){var h=this.handleDownEvent_(t);this.handlingDownUpSequence=h,i=this.shouldStopEvent(h)}else t.type==es.POINTERMOVE&&this.handleMoveEvent_(t);return!i},Js.prototype.shouldStopEvent=function(t){return t};var Zs=function(t){Js.call(this,{handleDownEvent:Zs.handleDownEvent_,handleDragEvent:Zs.handleDragEvent_,handleUpEvent:Zs.handleUpEvent_});var i=t||{};this.kinetic_=i.kinetic,this.lastCentroid=null,this.condition_=i.condition?i.condition:Hs.noModifierKeys,this.noKinetic_=!1};ui.inherits(Zs,Js),Zs.handleDragEvent_=function(t){var i=this.targetPointers,s=Js.centroid(i);if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){var h=this.lastCentroid[0]-s[0],n=s[1]-this.lastCentroid[1],r=t.map.getView(),e=r.getState(),o=[h,n];xs.scale(o,e.resolution),xs.rotate(o,e.rotation),xs.add(o,e.center),o=r.constrainCenter(o),r.setCenter(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length},Zs.handleUpEvent_=function(t){var i=t.map,s=i.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var h=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=s.getCenter(),e=i.getPixelFromCoordinate(r),o=i.getCoordinateFromPixel([e[0]-h*Math.cos(n),e[1]-h*Math.sin(n)]);s.animate({center:s.constrainCenter(o),duration:500,easing:Es.easeOut})}return s.setHint(1,-1),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},Zs.handleDownEvent_=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var i=t.map.getView();return this.lastCentroid=null,this.handlingDownUpSequence||i.setHint(1,1),i.getAnimating()&&i.setCenter(t.frameState.viewState.center),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},Zs.prototype.shouldStopEvent=xi.FALSE;var Ks=function(t){var i=t||{};Js.call(this,{handleDownEvent:Ks.handleDownEvent_,handleDragEvent:Ks.handleDragEvent_,handleUpEvent:Ks.handleUpEvent_}),this.condition_=i.condition?i.condition:Hs.altShiftKeysOnly,this.lastAngle_=void 0,this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(Ks,Js),Ks.handleDragEvent_=function(t){if(Hs.mouseOnly(t)){var i=t.map,s=i.getView();if(s.getConstraints().rotation!==ys.disable){var h=i.getSize(),n=t.pixel,r=Math.atan2(h[1]/2-n[1],n[0]-h[0]/2);if(void 0!==this.lastAngle_){var e=r-this.lastAngle_,o=s.getRotation();Ys.rotateWithoutConstraints(s,o-e)}this.lastAngle_=r}}},Ks.handleUpEvent_=function(t){if(!Hs.mouseOnly(t))return!0;var i=t.map.getView();i.setHint(1,-1);var s=i.getRotation();return Ys.rotate(i,s,void 0,this.duration_),!1},Ks.handleDownEvent_=function(t){return!(!Hs.mouseOnly(t)||!Hs.mouseActionButton(t)||!this.condition_(t)||(t.map.getView().setHint(1,1),this.lastAngle_=void 0,0))},Ks.prototype.shouldStopEvent=xi.FALSE;var Qs=function(t){this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null};ui.inherits(Qs,li),Qs.prototype.disposeInternal=function(){this.setMap(null)},Qs.prototype.render_=function(){var t=this.startPixel_,i=this.endPixel_,s="px",h=this.element_.style;h.left=Math.min(t[0],i[0])+s,h.top=Math.min(t[1],i[1])+s,h.width=Math.abs(i[0]-t[0])+s,h.height=Math.abs(i[1]-t[1])+s},Qs.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var i=this.element_.style;i.left=i.top=i.width=i.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},Qs.prototype.setPixels=function(t,i){this.startPixel_=t,this.endPixel_=i,this.createOrUpdateGeometry(),this.render_()},Qs.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,i=this.endPixel_,s=[t,[t[0],i[1]],i,[i[0],t[1]]].map(this.map_.getCoordinateFromPixel,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Qi([s])},Qs.prototype.getGeometry=function(){return this.geometry_};var $s=function(t){Js.call(this,{handleDownEvent:$s.handleDownEvent_,handleDragEvent:$s.handleDragEvent_,handleUpEvent:$s.handleUpEvent_});var i=t||{};this.box_=new Qs(i.className||"ol-dragbox"),this.minArea_=void 0!==i.minArea?i.minArea:64,this.startPixel_=null,this.condition_=i.condition?i.condition:Hs.always,this.boxEndCondition_=i.boxEndCondition?i.boxEndCondition:$s.defaultBoxEndCondition};ui.inherits($s,Js),$s.defaultBoxEndCondition=function(t,i,s){var h=s[0]-i[0],n=s[1]-i[1];return h*h+n*n>=this.minArea_},$s.handleDragEvent_=function(t){Hs.mouseOnly(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new $s.Event($s.EventType_.BOXDRAG,t.coordinate,t)))},$s.prototype.getGeometry=function(){return this.box_.getGeometry()},$s.prototype.onBoxEnd=ui.nullFunction,$s.handleUpEvent_=function(t){return!Hs.mouseOnly(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd(t),this.dispatchEvent(new $s.Event($s.EventType_.BOXEND,t.coordinate,t))),!1)},$s.handleDownEvent_=function(t){return!(!Hs.mouseOnly(t)||!Hs.mouseActionButton(t)||!this.condition_(t)||(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new $s.Event($s.EventType_.BOXSTART,t.coordinate,t)),0))},$s.EventType_={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend"},$s.Event=function(t,i,s){vi.call(this,t),this.coordinate=i,this.mapBrowserEvent=s},ui.inherits($s.Event,vi);var th=function(t){var i=t||{},s=i.condition?i.condition:Hs.shiftKeyOnly;this.duration_=void 0!==i.duration?i.duration:200,this.out_=void 0!==i.out&&i.out,$s.call(this,{condition:s,className:i.className||"ol-dragzoom"})};ui.inherits(th,$s),th.prototype.onBoxEnd=function(){var t=this.getMap(),i=t.getView(),s=t.getSize(),h=this.getGeometry().getExtent();if(this.out_){var n=i.calculateExtent(s),r=bi.createOrUpdateFromCoordinates([t.getPixelFromCoordinate(bi.getBottomLeft(h)),t.getPixelFromCoordinate(bi.getTopRight(h))]),e=i.getResolutionForExtent(r,s);bi.scaleFromCenter(n,1/e),h=n}var o=i.constrainResolution(i.getResolutionForExtent(h,s)),a=bi.getCenter(h);a=i.constrainCenter(a),i.animate({resolution:o,center:a,duration:this.duration_,easing:Es.easeOut})};var ih=function(t){Ys.call(this,{handleEvent:ih.handleEvent});var i=t||{};this.defaultCondition_=function(t){return Hs.noModifierKeys(t)&&Hs.targetNotEditable(t)},this.condition_=void 0!==i.condition?i.condition:this.defaultCondition_,this.duration_=void 0!==i.duration?i.duration:100,this.pixelDelta_=void 0!==i.pixelDelta?i.pixelDelta:128};ui.inherits(ih,Ys),ih.handleEvent=function(t){var i=!1;if("keydown"==t.type){var s=t.originalEvent.keyCode;if(this.condition_(t)&&(40==s||37==s||39==s||38==s)){var h=t.map.getView(),n=h.getResolution()*this.pixelDelta_,r=0,e=0;40==s?e=-n:37==s?r=-n:39==s?r=n:e=n;var o=[r,e];xs.rotate(o,h.getRotation()),Ys.pan(h,o,this.duration_),t.preventDefault(),i=!0}}return!i};var sh=function(t){Ys.call(this,{handleEvent:sh.handleEvent});var i=t||{};this.condition_=i.condition?i.condition:Hs.targetNotEditable,this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:100};ui.inherits(sh,Ys),sh.handleEvent=function(t){var i=!1;if("keydown"==t.type||"keypress"==t.type){var s=t.originalEvent.charCode;if(this.condition_(t)&&(s=="+".charCodeAt(0)||s=="-".charCodeAt(0))){var h=t.map,n=s=="+".charCodeAt(0)?this.delta_:-this.delta_,r=h.getView();Ys.zoomByDelta(r,n,void 0,this.duration_),t.preventDefault(),i=!0}}return!i};var hh=function(t){Ys.call(this,{handleEvent:hh.handleEvent});var i=t||{};this.delta_=0,this.duration_=void 0!==i.duration?i.duration:250,this.timeout_=void 0!==i.timeout?i.timeout:80,this.useAnchor_=void 0===i.useAnchor||i.useAnchor,this.constrainResolution_=i.constrainResolution||!1,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_=void 0,this.trackpadDeltaPerZoom_=300,this.trackpadZoomBuffer_=1.5};ui.inherits(hh,Ys),hh.handleEvent=function(t){var i=t.type;if("wheel"!==i&&"mousewheel"!==i)return!0;t.preventDefault();var s,h=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),"wheel"==t.type?(s=n.deltaY,ts.FIREFOX&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(s/=ts.DEVICE_PIXEL_RATIO),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(s*=40)):"mousewheel"==t.type&&(s=-n.wheelDeltaY,ts.SAFARI&&(s/=3)),0===s)return!1;var r=Date.now();if(void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?hh.Mode_.TRACKPAD:hh.Mode_.WHEEL),this.mode_===hh.Mode_.TRACKPAD){var e=h.getView();this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):e.setHint(1,1),this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var o=e.getResolution()*Math.pow(2,s/this.trackpadDeltaPerZoom_),a=e.getMinResolution(),u=e.getMaxResolution(),f=0;if(o<a?(o=Math.max(o,a/this.trackpadZoomBuffer_),f=1):o>u&&(o=Math.min(o,u*this.trackpadZoomBuffer_),f=-1),this.lastAnchor_){var c=e.calculateCenterZoom(o,this.lastAnchor_);e.setCenter(e.constrainCenter(c))}return e.setResolution(o),0===f&&this.constrainResolution_&&e.animate({resolution:e.constrainResolution(o,s>0?-1:1),easing:Es.easeOut,anchor:this.lastAnchor_,duration:this.duration_}),f>0?e.animate({resolution:a,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500}):f<0&&e.animate({resolution:u,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500}),this.startTime_=r,!1}this.delta_+=s;var l=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,h),l),!1},hh.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().setHint(1,-1)},hh.prototype.handleWheelZoom_=function(t){var i=t.getView();i.getAnimating()&&i.cancelAnimations();var s=ui.MOUSEWHEELZOOM_MAXDELTA,h=_i.clamp(this.delta_,-s,s);Ys.zoomByDelta(i,-h,this.lastAnchor_,this.duration_),this.mode_=void 0,this.delta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},hh.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},hh.Mode_={TRACKPAD:"trackpad",WHEEL:"wheel"};var nh=function(t){Js.call(this,{handleDownEvent:nh.handleDownEvent_,handleDragEvent:nh.handleDragEvent_,handleUpEvent:nh.handleUpEvent_});var i=t||{};this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==i.threshold?i.threshold:.3,this.duration_=void 0!==i.duration?i.duration:250};ui.inherits(nh,Js),nh.handleDragEvent_=function(t){var i=0,s=this.targetPointers[0],h=this.targetPointers[1],n=Math.atan2(h.clientY-s.clientY,h.clientX-s.clientX);if(void 0!==this.lastAngle_){var r=n-this.lastAngle_;this.rotationDelta_+=r,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),i=r}this.lastAngle_=n;var e=t.map,o=e.getView();if(o.getConstraints().rotation!==ys.disable){var a=e.getViewport().getBoundingClientRect(),u=Js.centroid(this.targetPointers);if(u[0]-=a.left,u[1]-=a.top,this.anchor_=e.getCoordinateFromPixel(u),this.rotating_){var f=o.getRotation();e.render(),Ys.rotateWithoutConstraints(o,f+i,this.anchor_)}}},nh.handleUpEvent_=function(t){if(this.targetPointers.length<2){var i=t.map.getView();if(i.setHint(1,-1),this.rotating_){var s=i.getRotation();Ys.rotate(i,s,this.anchor_,this.duration_)}return!1}return!0},nh.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var i=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||i.getView().setHint(1,1),!0}return!1},nh.prototype.shouldStopEvent=xi.FALSE;var rh=function(t){Js.call(this,{handleDownEvent:rh.handleDownEvent_,handleDragEvent:rh.handleDragEvent_,handleUpEvent:rh.handleUpEvent_});var i=t||{};this.constrainResolution_=i.constrainResolution||!1,this.anchor_=null,this.duration_=void 0!==i.duration?i.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1};ui.inherits(rh,Js),rh.handleDragEvent_=function(t){var i=1,s=this.targetPointers[0],h=this.targetPointers[1],n=s.clientX-h.clientX,r=s.clientY-h.clientY,e=Math.sqrt(n*n+r*r);void 0!==this.lastDistance_&&(i=this.lastDistance_/e),this.lastDistance_=e;var o=t.map,a=o.getView(),u=a.getResolution(),f=a.getMaxResolution(),c=a.getMinResolution(),l=u*i;l>f?(i=f/u,l=f):l<c&&(i=c/u,l=c),1!=i&&(this.lastScaleDelta_=i);var v=o.getViewport().getBoundingClientRect(),d=Js.centroid(this.targetPointers);d[0]-=v.left,d[1]-=v.top,this.anchor_=o.getCoordinateFromPixel(d),o.render(),Ys.zoomWithoutConstraints(a,l,this.anchor_)},rh.handleUpEvent_=function(t){if(this.targetPointers.length<2){var i=t.map.getView();i.setHint(1,-1);var s=i.getResolution();return(this.constrainResolution_||s<i.getMinResolution()||s>i.getMaxResolution())&&Ys.zoom(i,s,this.anchor_,this.duration_,this.lastScaleDelta_-1),!1}return!0},rh.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var i=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||i.getView().setHint(1,1),!0}return!1},rh.prototype.shouldStopEvent=xi.FALSE;var eh=function(t){var i=t||{},s=new hs,h=new qs(-.005,.05,100);return(void 0===i.altShiftDragRotate||i.altShiftDragRotate)&&s.push(new Ks),(void 0===i.doubleClickZoom||i.doubleClickZoom)&&s.push(new Bs({delta:i.zoomDelta,duration:i.zoomDuration})),(void 0===i.dragPan||i.dragPan)&&s.push(new Zs({kinetic:h})),(void 0===i.pinchRotate||i.pinchRotate)&&s.push(new nh),(void 0===i.pinchZoom||i.pinchZoom)&&s.push(new rh({constrainResolution:i.constrainResolution,duration:i.zoomDuration})),(void 0===i.keyboard||i.keyboard)&&(s.push(new ih),s.push(new sh({delta:i.zoomDelta,duration:i.zoomDuration}))),(void 0===i.mouseWheelZoom||i.mouseWheelZoom)&&s.push(new hh({constrainResolution:i.constrainResolution,duration:i.zoomDuration})),(void 0===i.shiftDragZoom||i.shiftDragZoom)&&s.push(new th({duration:i.zoomDuration})),s},oh=function(t,i,s,h){di.call(this),this.extent=t,this.pixelRatio_=s,this.resolution=i,this.state=h};ui.inherits(oh,di),oh.prototype.changed=function(){this.dispatchEvent("change")},oh.prototype.getExtent=function(){return this.extent},oh.prototype.getImage=function(){},oh.prototype.getPixelRatio=function(){return this.pixelRatio_},oh.prototype.getResolution=function(){return this.resolution},oh.prototype.getState=function(){return this.state},oh.prototype.load=function(){};var ah=function(t,i,s,h,n){this.loader_=void 0!==n?n:null,oh.call(this,t,i,s,void 0!==n?0:2),this.canvas_=h,this.error_=null};ui.inherits(ah,oh),ah.prototype.getError=function(){return this.error_},ah.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=3):this.state=2,this.changed()},ah.prototype.load=function(){0==this.state&&(this.state=1,this.changed(),this.loader_(this.handleLoad_.bind(this)))},ah.prototype.getImage=function(){return this.canvas_};var uh=function(t,i,s,h,n){vi.call(this,t),this.vectorContext=i,this.frameState=s,this.context=h,this.glContext=n};ui.inherits(uh,vi);var fh=function(t){di.call(this),this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null};ui.inherits(fh,di),fh.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},fh.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null,this.dispatchEvent("clear")},fh.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},fh.prototype.forEach=function(t,i){for(var s=this.oldest_;s;)t.call(i,s.value_,s.key_,this),s=s.newer},fh.prototype.get=function(t){var i=this.entries_[t];return gi(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},fh.prototype.remove=function(t){var i=this.entries_[t];return gi(void 0!==i,15),i===this.newest_?(this.newest_=i.older,this.newest_&&(this.newest_.newer=null)):i===this.oldest_?(this.oldest_=i.newer,this.oldest_&&(this.oldest_.older=null)):(i.newer.older=i.older,i.older.newer=i.newer),delete this.entries_[t],--this.count_,i.value_},fh.prototype.getCount=function(){return this.count_},fh.prototype.getKeys=function(){var t,i=new Array(this.count_),s=0;for(t=this.newest_;t;t=t.older)i[s++]=t.key_;return i},fh.prototype.getValues=function(){var t,i=new Array(this.count_),s=0;for(t=this.newest_;t;t=t.older)i[s++]=t.value_;return i},fh.prototype.peekLast=function(){return this.oldest_.value_},fh.prototype.peekLastKey=function(){return this.oldest_.key_},fh.prototype.peekFirstKey=function(){return this.newest_.key_},fh.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_},fh.prototype.replace=function(t,i){this.get(t),this.entries_[t].value_=i},fh.prototype.set=function(t,i){gi(!(t in this.entries_),16);var s={key_:t,newer:null,older:this.newest_,value_:i};this.newest_?this.newest_.newer=s:this.oldest_=s,this.newest_=s,this.entries_[t]=s,++this.count_},fh.prototype.prune=function(){for(;this.canExpireCache();)this.pop()};var ch,lh,vh={defaultFont:"10px sans-serif",defaultFillStyle:[0,0,0,1],defaultLineCap:"round",defaultLineDash:[],defaultLineDashOffset:0,defaultLineJoin:"round",defaultMiterLimit:10,defaultStrokeStyle:[0,0,0,1],defaultTextAlign:"center",defaultTextBaseline:"middle",defaultPadding:[0,0,0,0],defaultLineWidth:1};vh.labelCache=new fh,vh.checkedFonts_={},vh.measureContext_=null,vh.textHeights_={},vh.checkFont=function(){var t,i,s=vh.checkedFonts_,h=vh.labelCache,n="wmytzilWMYTZIL@#/&?$%10";function r(t){var s=vh.getMeasureContext();s.font="32px monospace",i=s.measureText(n).width;var h=!0;return"monospace"!=t&&(s.font="32px "+t+",monospace",h=s.measureText(n).width!=i),h}function e(){var i=!0;for(var n in s)s[n]<60&&(r(n)?(s[n]=60,fi.clear(vh.textHeights_),vh.measureContext_=null,h.clear()):(++s[n],i=!1));i&&(window.clearInterval(t),t=void 0)}return function(i){var h=Gs.getFontFamilies(i);if(h)for(var n=0,o=h.length;n<o;++n){var a=h[n];a in s||(s[a]=60,r(a)||(s[a]=0,void 0===t&&(t=window.setInterval(e,32))))}}}(),vh.getMeasureContext=function(){var t=vh.measureContext_;return t||(t=vh.measureContext_=Cs(1,1)),t},vh.measureTextHeight=(lh=vh.textHeights_,function(t){var i=lh[t];return null==i&&(ch||((ch=document.createElement("span")).textContent="M",ch.style.margin=ch.style.padding="0 !important",ch.style.position="absolute !important",ch.style.left="-99999px !important"),ch.style.font=t,document.body.appendChild(ch),i=lh[t]=ch.offsetHeight,document.body.removeChild(ch)),i}),vh.measureTextWidth=function(t,i){var s=vh.getMeasureContext();return t!=s.font&&(s.font=t),s.measureText(i).width},vh.rotateAtOffset=function(t,i,s,h){0!==i&&(t.translate(s,h),t.rotate(i),t.translate(-s,-h))},vh.resetTransform_=Ii.create(),vh.drawImage=function(t,i,s,h,n,r,e,o,a,u,f){var c;1!=s&&(t.globalAlpha=(c=t.globalAlpha)*s),i&&t.setTransform.apply(t,i),t.drawImage(h,n,r,e,o,a,u,e*f,o*f),c&&(t.globalAlpha=c),i&&t.setTransform.apply(t,vh.resetTransform_)};var dh={HEX_COLOR_RE_:/^#(?:[0-9a-f]{3,4}){1,2}$/i,NAMED_COLOR_RE_:/^([a-z]*)$/i,asArray:function(t){return Array.isArray(t)?t:dh.fromString(t)},asString:function(t){return"string"==typeof t?t:dh.toString(t)},fromNamed:function(t){var i=document.createElement("div");i.style.color=t,document.body.appendChild(i);var s=getComputedStyle(i).color;return document.body.removeChild(i),s}};dh.fromString=function(){var t={},i=0;return function(s){var h;if(t.hasOwnProperty(s))h=t[s];else{if(i>=1024){var n,r=0;for(n in t)0==(3&r++)&&(delete t[n],--i)}h=dh.fromStringInternal_(s),t[s]=h,++i}return h}}(),dh.fromStringInternal_=function(t){var i,s,h,n,r,e;if(dh.NAMED_COLOR_RE_.exec(t)&&(t=dh.fromNamed(t)),dh.HEX_COLOR_RE_.exec(t)){var o,a=t.length-1;o=a<=4?1:2;var u=4===a||8===a;i=parseInt(t.substr(1+0*o,o),16),s=parseInt(t.substr(1+1*o,o),16),h=parseInt(t.substr(1+2*o,o),16),n=u?parseInt(t.substr(1+3*o,o),16):255,1==o&&(i=(i<<4)+i,s=(s<<4)+s,h=(h<<4)+h,u&&(n=(n<<4)+n)),r=[i,s,h,n/255]}else 0==t.indexOf("rgba(")?(e=t.slice(5,-1).split(",").map(Number),r=dh.normalize(e)):0==t.indexOf("rgb(")?((e=t.slice(4,-1).split(",").map(Number)).push(1),r=dh.normalize(e)):gi(!1,14);return r},dh.normalize=function(t,i){var s=i||[];return s[0]=_i.clamp(t[0]+.5|0,0,255),s[1]=_i.clamp(t[1]+.5|0,0,255),s[2]=_i.clamp(t[2]+.5|0,0,255),s[3]=_i.clamp(t[3],0,1),s},dh.toString=function(t){var i=t[0];i!=(0|i)&&(i=i+.5|0);var s=t[1];s!=(0|s)&&(s=s+.5|0);var h=t[2];return h!=(0|h)&&(h=h+.5|0),"rgba("+i+","+s+","+h+","+(void 0===t[3]?1:t[3])+")"};var Mh={asColorLike:function(t){return Mh.isColorLike(t)?t:dh.asString(t)},isColorLike:function(t){return"string"==typeof t||t instanceof CanvasPattern||t instanceof CanvasGradient}},mh=function(){};mh.prototype.drawCustom=function(){},mh.prototype.drawGeometry=function(){},mh.prototype.setStyle=function(){},mh.prototype.drawCircle=function(){},mh.prototype.drawFeature=function(){},mh.prototype.drawGeometryCollection=function(){},mh.prototype.drawLineString=function(){},mh.prototype.drawMultiLineString=function(){},mh.prototype.drawMultiPoint=function(){},mh.prototype.drawMultiPolygon=function(){},mh.prototype.drawPoint=function(){},mh.prototype.drawPolygon=function(){},mh.prototype.drawText=function(){},mh.prototype.setFillStrokeStyle=function(){},mh.prototype.setImageStyle=function(){},mh.prototype.setTextStyle=function(){};var ph=function(t,i,s,h,n){mh.call(this),this.context_=t,this.pixelRatio_=i,this.extent_=s,this.transform_=h,this.viewRotation_=n,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=0,this.imageSnapToPixel_=!1,this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=0,this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Ii.create()};ui.inherits(ph,mh),ph.prototype.drawImages_=function(t,i,s){if(this.image_){var h=Ei(t,i,s,2,this.transform_,this.pixelCoordinates_),n=this.context_,r=this.tmpLocalTransform_,e=n.globalAlpha;1!=this.imageOpacity_&&(n.globalAlpha=e*this.imageOpacity_);var o,a,u=this.imageRotation_;for(this.imageRotateWithView_&&(u+=this.viewRotation_),o=0,a=h.length;o<a;o+=2){var f=h[o]-this.imageAnchorX_,c=h[o+1]-this.imageAnchorY_;if(this.imageSnapToPixel_&&(f=Math.round(f),c=Math.round(c)),0!==u||1!=this.imageScale_){var l=f+this.imageAnchorX_,v=c+this.imageAnchorY_;Ii.compose(r,l,v,this.imageScale_,this.imageScale_,u,-l,-v),n.setTransform.apply(n,r)}n.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,c,this.imageWidth_,this.imageHeight_)}0===u&&1==this.imageScale_||n.setTransform(1,0,0,1,0,0),1!=this.imageOpacity_&&(n.globalAlpha=e)}},ph.prototype.drawText_=function(t,i,s,h){if(this.textState_&&""!==this.text_){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var n=Ei(t,i,s,h,this.transform_,this.pixelCoordinates_),r=this.context_,e=this.textRotation_;for(this.textRotateWithView_&&(e+=this.viewRotation_);i<s;i+=h){var o=n[i]+this.textOffsetX_,a=n[i+1]+this.textOffsetY_;if(0!==e||1!=this.textScale_){var u=Ii.compose(this.tmpLocalTransform_,o,a,this.textScale_,this.textScale_,e,-o,-a);r.setTransform.apply(r,u)}this.textStrokeState_&&r.strokeText(this.text_,o,a),this.textFillState_&&r.fillText(this.text_,o,a)}0===e&&1==this.textScale_||r.setTransform(1,0,0,1,0,0)}},ph.prototype.moveToLineTo_=function(t,i,s,h,n){var r=this.context_,e=Ei(t,i,s,h,this.transform_,this.pixelCoordinates_);r.moveTo(e[0],e[1]);var o=e.length;n&&(o-=2);for(var a=2;a<o;a+=2)r.lineTo(e[a],e[a+1]);return n&&r.closePath(),s},ph.prototype.drawRings_=function(t,i,s,h){var n,r;for(n=0,r=s.length;n<r;++n)i=this.moveToLineTo_(t,i,s[n],h,!0);return i},ph.prototype.drawCircle=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i=Di.transform2D(t,this.transform_,this.pixelCoordinates_),s=i[2]-i[0],h=i[3]-i[1],n=Math.sqrt(s*s+h*h),r=this.context_;r.beginPath(),r.arc(i[0],i[1],n,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}},ph.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},ph.prototype.drawGeometry=function(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}},ph.prototype.drawFeature=function(t,i){var s=i.getGeometryFunction()(t);s&&bi.intersects(this.extent_,s.getExtent())&&(this.setStyle(i),this.drawGeometry(s))},ph.prototype.drawGeometryCollection=function(t){var i,s,h=t.getGeometriesArray();for(i=0,s=h.length;i<s;++i)this.drawGeometry(h[i])},ph.prototype.drawPoint=function(t){var i=t.getFlatCoordinates(),s=t.getStride();this.image_&&this.drawImages_(i,0,i.length,s),""!==this.text_&&this.drawText_(i,0,i.length,s)},ph.prototype.drawMultiPoint=function(t){var i=t.getFlatCoordinates(),s=t.getStride();this.image_&&this.drawImages_(i,0,i.length,s),""!==this.text_&&this.drawText_(i,0,i.length,s)},ph.prototype.drawLineString=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_,s=t.getFlatCoordinates();i.beginPath(),this.moveToLineTo_(s,0,s.length,t.getStride(),!1),i.stroke()}if(""!==this.text_){var h=t.getFlatMidpoint();this.drawText_(h,0,2,2)}}},ph.prototype.drawMultiLineString=function(t){var i=t.getExtent();if(bi.intersects(this.extent_,i)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var s,h,n=this.context_,r=t.getFlatCoordinates(),e=0,o=t.getEnds(),a=t.getStride();for(n.beginPath(),s=0,h=o.length;s<h;++s)e=this.moveToLineTo_(r,e,o[s],a,!1);n.stroke()}if(""!==this.text_){var u=t.getFlatMidpoints();this.drawText_(u,0,u.length,2)}}},ph.prototype.drawPolygon=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i=this.context_;i.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(""!==this.text_){var s=t.getFlatInteriorPoint();this.drawText_(s,0,2,2)}}},ph.prototype.drawMultiPolygon=function(t){if(bi.intersects(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var i,s,h=this.context_,n=t.getOrientedFlatCoordinates(),r=0,e=t.getEndss(),o=t.getStride();for(h.beginPath(),i=0,s=e.length;i<s;++i)r=this.drawRings_(n,r,e[i],o);this.fillState_&&h.fill(),this.strokeState_&&h.stroke()}if(""!==this.text_){var a=t.getFlatInteriorPoints();this.drawText_(a,0,a.length,2)}}},ph.prototype.setContextFillState_=function(t){var i=this.context_,s=this.contextFillState_;s?s.fillStyle!=t.fillStyle&&(s.fillStyle=i.fillStyle=t.fillStyle):(i.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})},ph.prototype.setContextStrokeState_=function(t){var i=this.context_,s=this.contextStrokeState_;s?(s.lineCap!=t.lineCap&&(s.lineCap=i.lineCap=t.lineCap),ts.CANVAS_LINE_DASH&&(yi.equals(s.lineDash,t.lineDash)||i.setLineDash(s.lineDash=t.lineDash),s.lineDashOffset!=t.lineDashOffset&&(s.lineDashOffset=i.lineDashOffset=t.lineDashOffset)),s.lineJoin!=t.lineJoin&&(s.lineJoin=i.lineJoin=t.lineJoin),s.lineWidth!=t.lineWidth&&(s.lineWidth=i.lineWidth=t.lineWidth),s.miterLimit!=t.miterLimit&&(s.miterLimit=i.miterLimit=t.miterLimit),s.strokeStyle!=t.strokeStyle&&(s.strokeStyle=i.strokeStyle=t.strokeStyle)):(i.lineCap=t.lineCap,ts.CANVAS_LINE_DASH&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.lineJoin=t.lineJoin,i.lineWidth=t.lineWidth,i.miterLimit=t.miterLimit,i.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})},ph.prototype.setContextTextState_=function(t){var i=this.context_,s=this.contextTextState_,h=t.textAlign?t.textAlign:vh.defaultTextAlign;s?(s.font!=t.font&&(s.font=i.font=t.font),s.textAlign!=h&&(s.textAlign=h),s.textBaseline!=t.textBaseline&&(s.textBaseline=i.textBaseline=t.textBaseline)):(i.font=t.font,i.textAlign=h,i.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:h,textBaseline:t.textBaseline})},ph.prototype.setFillStrokeStyle=function(t,i){if(t){var s=t.getColor();this.fillState_={fillStyle:Mh.asColorLike(s||vh.defaultFillStyle)}}else this.fillState_=null;if(i){var h=i.getColor(),n=i.getLineCap(),r=i.getLineDash(),e=i.getLineDashOffset(),o=i.getLineJoin(),a=i.getWidth(),u=i.getMiterLimit();this.strokeState_={lineCap:void 0!==n?n:vh.defaultLineCap,lineDash:r||vh.defaultLineDash,lineDashOffset:e||vh.defaultLineDashOffset,lineJoin:void 0!==o?o:vh.defaultLineJoin,lineWidth:this.pixelRatio_*(void 0!==a?a:vh.defaultLineWidth),miterLimit:void 0!==u?u:vh.defaultMiterLimit,strokeStyle:Mh.asColorLike(h||vh.defaultStrokeStyle)}}else this.strokeState_=null},ph.prototype.setImageStyle=function(t){if(t){var i=t.getAnchor(),s=t.getImage(1),h=t.getOrigin(),n=t.getSize();this.imageAnchorX_=i[0],this.imageAnchorY_=i[1],this.imageHeight_=n[1],this.image_=s,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=h[0],this.imageOriginY_=h[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation(),this.imageScale_=t.getScale()*this.pixelRatio_,this.imageSnapToPixel_=t.getSnapToPixel(),this.imageWidth_=n[0]}else this.image_=null},ph.prototype.setTextStyle=function(t){if(t){var i=t.getFill();if(i){var s=i.getColor();this.textFillState_={fillStyle:Mh.asColorLike(s||vh.defaultFillStyle)}}else this.textFillState_=null;var h=t.getStroke();if(h){var n=h.getColor(),r=h.getLineCap(),e=h.getLineDash(),o=h.getLineDashOffset(),a=h.getLineJoin(),u=h.getWidth(),f=h.getMiterLimit();this.textStrokeState_={lineCap:void 0!==r?r:vh.defaultLineCap,lineDash:e||vh.defaultLineDash,lineDashOffset:o||vh.defaultLineDashOffset,lineJoin:void 0!==a?a:vh.defaultLineJoin,lineWidth:void 0!==u?u:vh.defaultLineWidth,miterLimit:void 0!==f?f:vh.defaultMiterLimit,strokeStyle:Mh.asColorLike(n||vh.defaultStrokeStyle)}}else this.textStrokeState_=null;var c=t.getFont(),l=t.getOffsetX(),v=t.getOffsetY(),d=t.getRotateWithView(),M=t.getRotation(),m=t.getScale(),p=t.getText(),g=t.getTextAlign(),_=t.getTextBaseline();this.textState_={font:void 0!==c?c:vh.defaultFont,textAlign:void 0!==g?g:vh.defaultTextAlign,textBaseline:void 0!==_?_:vh.defaultTextBaseline},this.text_=void 0!==p?p:"",this.textOffsetX_=void 0!==l?this.pixelRatio_*l:0,this.textOffsetY_=void 0!==v?this.pixelRatio_*v:0,this.textRotateWithView_=void 0!==d&&d,this.textRotation_=void 0!==M?M:0,this.textScale_=this.pixelRatio_*(void 0!==m?m:1)}else this.text_=""};var gh=function(t){Mi.call(this),this.layer_=t};ui.inherits(gh,Mi),gh.prototype.forEachFeatureAtCoordinate=ui.nullFunction,gh.prototype.hasFeatureAtCoordinate=xi.FALSE,gh.prototype.createLoadedTileFinder=function(t,i,s){return function(h,n){return t.forEachLoadedTile(i,h,n,(function(t){s[h]||(s[h]={}),s[h][t.tileCoord.toString()]=t}))}},gh.prototype.getLayer=function(){return this.layer_},gh.prototype.handleImageChange_=function(t){2===t.target.getState()&&this.renderIfReadyAndVisible()},gh.prototype.loadImage=function(t){var i=t.getState();return 2!=i&&3!=i&&ci.listen(t,"change",this.handleImageChange_,this),0==i&&(t.load(),i=t.getState()),2==i},gh.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&"ready"==t.getSourceState()&&this.changed()},gh.prototype.scheduleExpireCache=function(t,i){if(i.canExpireCache()){var s=function(t,i,s){var h=ui.getUid(t).toString();h in s.usedTiles&&t.expireCache(s.viewState.projection,s.usedTiles[h])}.bind(null,i);t.postRenderFunctions.push(s)}},gh.prototype.updateLogos=function(t,i){var s=i.getLogo();void 0!==s&&("string"==typeof s?t.logos[s]="":s&&(gi("string"==typeof s.href,44),gi("string"==typeof s.src,45),t.logos[s.src]=s.href))},gh.prototype.updateUsedTiles=function(t,i,s,h){var n=ui.getUid(i).toString(),r=s.toString();n in t?r in t[n]?t[n][r].extend(h):t[n][r]=h:(t[n]={},t[n][r]=h)},gh.prototype.manageTilePyramid=function(t,i,s,h,n,r,e,o,a,u){var f=ui.getUid(i).toString();f in t.wantedTiles||(t.wantedTiles[f]={});var c,l,v,d,M,m,p=t.wantedTiles[f],g=t.tileQueue;for(m=s.getMinZoom();m<=e;++m)for(l=s.getTileRangeForExtentAndZ(r,m,l),v=s.getResolution(m),d=l.minX;d<=l.maxX;++d)for(M=l.minY;M<=l.maxY;++M)e-m<=o?(0==(c=i.getTile(m,d,M,h,n)).getState()&&(p[c.getKey()]=!0,g.isKeyQueued(c.getKey())||g.enqueue([c,f,s.getTileCoordCenter(c.tileCoord),v])),void 0!==a&&a.call(u,c)):i.useTile(m,d,M,n)};var _h=function(t){gh.call(this,t),this.transform_=Ii.create()};ui.inherits(_h,gh),_h.prototype.clip=function(t,i,s){var h=i.pixelRatio,n=i.size[0]*h,r=i.size[1]*h,e=i.viewState.rotation,o=bi.getTopLeft(s),a=bi.getTopRight(s),u=bi.getBottomRight(s),f=bi.getBottomLeft(s);Ii.apply(i.coordinateToPixelTransform,o),Ii.apply(i.coordinateToPixelTransform,a),Ii.apply(i.coordinateToPixelTransform,u),Ii.apply(i.coordinateToPixelTransform,f),t.save(),vh.rotateAtOffset(t,-e,n/2,r/2),t.beginPath(),t.moveTo(o[0]*h,o[1]*h),t.lineTo(a[0]*h,a[1]*h),t.lineTo(u[0]*h,u[1]*h),t.lineTo(f[0]*h,f[1]*h),t.clip(),vh.rotateAtOffset(t,e,n/2,r/2)},_h.prototype.dispatchComposeEvent_=function(t,i,s,h){var n=this.getLayer();if(n.hasListener(t)){var r=s.size[0]*s.pixelRatio,e=s.size[1]*s.pixelRatio,o=s.viewState.rotation;vh.rotateAtOffset(i,-o,r/2,e/2);var a=void 0!==h?h:this.getTransform(s,0),u=new ph(i,s.pixelRatio,s.extent,a,s.viewState.rotation),f=new uh(t,u,s,i,null);n.dispatchEvent(f),vh.rotateAtOffset(i,o,r/2,e/2)}},_h.prototype.forEachLayerAtCoordinate=function(t,i,s,h){return this.forEachFeatureAtCoordinate(t,i,0,xi.TRUE,this)?s.call(h,this.getLayer(),null):void 0},_h.prototype.postCompose=function(t,i,s,h){this.dispatchComposeEvent_("postcompose",t,i,h)},_h.prototype.preCompose=function(t,i,s){this.dispatchComposeEvent_("precompose",t,i,s)},_h.prototype.dispatchRenderEvent=function(t,i,s){this.dispatchComposeEvent_("render",t,i,s)},_h.prototype.getTransform=function(t,i){var s=t.viewState,h=t.pixelRatio,n=h/s.resolution;return Ii.compose(this.transform_,h*t.size[0]/2,h*t.size[1]/2,n,-n,-s.rotation,-s.center[0]+i,-s.center[1])},_h.prototype.composeFrame=function(){},_h.prototype.prepareFrame=function(){};var wh=function(t){_h.call(this,t),this.coordinateToCanvasPixelTransform=Ii.create(),this.hitCanvasContext_=null};ui.inherits(wh,_h),wh.prototype.composeFrame=function(t,i,s){this.preCompose(s,t);var h=this.getImage();if(h){var n=i.extent,r=void 0!==n&&!bi.containsExtent(n,t.extent)&&bi.intersects(n,t.extent);r&&this.clip(s,t,n);var e=this.getImageTransform(),o=s.globalAlpha;s.globalAlpha=i.opacity;var a=e[5],u=h.width*e[0],f=h.height*e[3];s.drawImage(h,0,0,+h.width,+h.height,Math.round(e[4]),Math.round(a),Math.round(u),Math.round(f)),s.globalAlpha=o,r&&s.restore()}this.postCompose(s,t,i)},wh.prototype.getImage=function(){},wh.prototype.getImageTransform=function(){},wh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=this.getLayer();return r.getSource().forEachFeatureAtCoordinate(t,i.viewState.resolution,i.viewState.rotation,s,i.skippedFeatureUids,(function(t){return h.call(n,t,r)}))},wh.prototype.forEachLayerAtCoordinate=function(t,i,s,h){if(this.getImage()){if(this.getLayer().getSource().forEachFeatureAtCoordinate!==ui.nullFunction)return _h.prototype.forEachLayerAtCoordinate.apply(this,arguments);var n=Ii.apply(this.coordinateToCanvasPixelTransform,t.slice());xs.scale(n,i.viewState.resolution/this.renderedResolution),this.hitCanvasContext_||(this.hitCanvasContext_=Cs(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.getImage(),n[0],n[1],1,1,0,0,1,1);var r=this.hitCanvasContext_.getImageData(0,0,1,1).data;return r[3]>0?s.call(h,this.getLayer(),r):void 0}};var yh=function(t){wh.call(this,t),this.image_=null,this.imageTransform_=Ii.create(),this.skippedFeatures_=[],this.vectorRenderer_=null};ui.inherits(yh,wh),yh.handles=function(t,i){return"canvas"===t&&("IMAGE"===i.getType()||"VECTOR"===i.getType()&&"image"===i.getRenderMode())},yh.create=function(t,i){var s=new yh(i);if("VECTOR"===i.getType())for(var h=zs.getLayerRendererPlugins(),n=0,r=h.length;n<r;++n){var e=h[n];e!==yh&&e.handles("canvas",i)&&s.setVectorRenderer(e.create(t,i))}return s},yh.prototype.getImage=function(){return this.image_?this.image_.getImage():null},yh.prototype.getImageTransform=function(){return this.imageTransform_},yh.prototype.prepareFrame=function(t,i){var s,h=t.pixelRatio,n=t.size,r=t.viewState,e=r.center,o=r.resolution,a=this.getLayer().getSource(),u=t.viewHints,f=t.extent;if(void 0!==i.extent&&(f=bi.getIntersection(f,i.extent)),!u[0]&&!u[1]&&!bi.isEmpty(f)){var c=r.projection;if(!ui.ENABLE_RASTER_REPROJECTION){var l=a.getProjection();l&&(c=l)}var v=this.vectorRenderer_;if(v){var d=v.context,M=fi.assign({},t,{size:[bi.getWidth(f)/o,bi.getHeight(f)/o],viewState:fi.assign({},t.viewState,{rotation:0})}),m=Object.keys(M.skippedFeatureUids).sort();!v.prepareFrame(M,i)||!v.replayGroupChanged&&yi.equals(m,this.skippedFeatures_)||(d.canvas.width=M.size[0]*h,d.canvas.height=M.size[1]*h,v.composeFrame(M,i,d),this.image_=new ah(f,o,h,d.canvas),this.skippedFeatures_=m)}else(s=a.getImage(f,o,h,c))&&this.loadImage(s)&&(this.image_=s)}if(this.image_){var p=(s=this.image_).getExtent(),g=s.getResolution(),_=s.getPixelRatio(),w=h*g/(o*_),y=Ii.compose(this.imageTransform_,h*n[0]/2,h*n[1]/2,w,w,0,_*(p[0]-e[0])/g,_*(e[1]-p[3])/g);Ii.compose(this.coordinateToCanvasPixelTransform,h*n[0]/2-y[4],h*n[1]/2-y[5],h/o,-h/o,0,-e[0],-e[1]),this.updateLogos(t,a),this.renderedResolution=g*h/_}return!!this.image_},yh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,i,s,h,n):wh.prototype.forEachFeatureAtCoordinate.call(this,t,i,s,h,n)},yh.prototype.setVectorRenderer=function(t){this.vectorRenderer_=t};var bh=function(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32};bh.getKey=function(t,i,s){return i+":"+t+":"+(s?dh.asString(s):"null")},bh.prototype.clear=function(){this.cache_={},this.cacheSize_=0},bh.prototype.expire=function(){if(this.cacheSize_>this.maxCacheSize_){var t,i=0;for(t in this.cache_)0!=(3&i++)||this.cache_[t].hasListener()||(delete this.cache_[t],--this.cacheSize_)}},bh.prototype.get=function(t,i,s){var h=bh.getKey(t,i,s);return h in this.cache_?this.cache_[h]:null},bh.prototype.set=function(t,i,s,h){var n=bh.getKey(t,i,s);this.cache_[n]=h,++this.cacheSize_},bh.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()};var xh={};xh.iconImageCache=new bh;var Eh=function(t,i){li.call(this),this.map_=i,this.layerRenderers_={},this.layerRendererListeners_={}};ui.inherits(Eh,li),Eh.prototype.calculateMatrices2D=function(t){var i=t.viewState,s=t.coordinateToPixelTransform,h=t.pixelToCoordinateTransform;Ii.compose(s,t.size[0]/2,t.size[1]/2,1/i.resolution,-1/i.resolution,-i.rotation,-i.center[0],-i.center[1]),Ii.invert(Ii.setFromArray(h,s))},Eh.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_)this.removeLayerRendererByKey_(t).dispose()},Eh.expireIconCache_=function(){xh.iconImageCache.expire()},Eh.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o,a=i.viewState,u=a.resolution;function f(t,s){var r=ui.getUid(t).toString(),e=i.layerStates[ui.getUid(s)].managed;if(!(r in i.skippedFeatureUids)||e)return h.call(n,t,e?s:null)}var c=a.projection,l=t;if(c.canWrapX()){var v=c.getExtent(),d=bi.getWidth(v),M=t[0];(M<v[0]||M>v[2])&&(l=[M+d*Math.ceil((v[0]-M)/d),t[1]])}var m,p=i.layerStatesArray;for(m=p.length-1;m>=0;--m){var g=p[m],_=g.layer;if(Ws.visibleAtResolution(g,u)&&r.call(e,_)){var w=this.getLayerRenderer(_);if(_.getSource()&&(o=w.forEachFeatureAtCoordinate(_.getSource().getWrapX()?l:t,i,s,f,n)),o)return o}}},Eh.prototype.forEachLayerAtPixel=function(){},Eh.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n){return void 0!==this.forEachFeatureAtCoordinate(t,i,s,xi.TRUE,this,h,n)},Eh.prototype.getLayerRenderer=function(t){var i=ui.getUid(t).toString();if(i in this.layerRenderers_)return this.layerRenderers_[i];for(var s,h=zs.getLayerRendererPlugins(),n=this.getType(),r=0,e=h.length;r<e;++r){var o=h[r];if(o.handles(n,t)){s=o.create(this,t);break}}if(!s)throw new Error("Unable to create renderer for layer: "+t.getType());return this.layerRenderers_[i]=s,this.layerRendererListeners_[i]=ci.listen(s,"change",this.handleLayerRendererChange_,this),s},Eh.prototype.getLayerRendererByKey=function(t){return this.layerRenderers_[t]},Eh.prototype.getLayerRenderers=function(){return this.layerRenderers_},Eh.prototype.getMap=function(){return this.map_},Eh.prototype.getType=function(){},Eh.prototype.handleLayerRendererChange_=function(){this.map_.render()},Eh.prototype.removeLayerRendererByKey_=function(t){var i=this.layerRenderers_[t];return delete this.layerRenderers_[t],ci.unlistenByKey(this.layerRendererListeners_[t]),delete this.layerRendererListeners_[t],i},Eh.prototype.renderFrame=ui.nullFunction,Eh.prototype.removeUnusedLayerRenderers_=function(t,i){var s;for(s in this.layerRenderers_)i&&s in i.layerStates||this.removeLayerRendererByKey_(s).dispose()},Eh.prototype.scheduleExpireIconCache=function(t){t.postRenderFunctions.push(Eh.expireIconCache_)},Eh.prototype.scheduleRemoveUnusedLayerRenderers=function(t){var i;for(i in this.layerRenderers_)if(!(i in t.layerStates))return void t.postRenderFunctions.push(this.removeUnusedLayerRenderers_.bind(this))},Eh.sortByZIndex=function(t,i){return t.zIndex-i.zIndex};var Sh=function(t,i){Eh.call(this,t,i),this.context_=Cs(),this.canvas_=this.context_.canvas,this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=Gs.CLASS_UNSELECTABLE,t.insertBefore(this.canvas_,t.childNodes[0]||null),this.renderedVisible_=!0,this.transform_=Ii.create()};ui.inherits(Sh,Eh),Sh.handles=function(t){return"canvas"===t},Sh.create=function(t,i){return new Sh(t,i)},Sh.prototype.dispatchComposeEvent_=function(t,i){var s=this.getMap(),h=this.context_;if(s.hasListener(t)){var n=i.extent,r=i.pixelRatio,e=i.viewState.rotation,o=this.getTransform(i),a=new ph(h,r,n,o,e),u=new uh(t,a,i,h,null);s.dispatchEvent(u)}},Sh.prototype.getTransform=function(t){var i=t.viewState,s=t.pixelRatio/i.resolution;return Ii.compose(this.transform_,this.canvas_.width/2,this.canvas_.height/2,s,-s,-i.rotation,-i.center[0],-i.center[1])},Sh.prototype.getType=function(){return"canvas"},Sh.prototype.renderFrame=function(t){if(t){var i=this.context_,s=t.pixelRatio,h=Math.round(t.size[0]*s),n=Math.round(t.size[1]*s);this.canvas_.width!=h||this.canvas_.height!=n?(this.canvas_.width=h,this.canvas_.height=n):i.clearRect(0,0,h,n);var r=t.viewState.rotation;this.calculateMatrices2D(t),this.dispatchComposeEvent_("precompose",t);var e=t.layerStatesArray;yi.stableSort(e,Eh.sortByZIndex),r&&(i.save(),vh.rotateAtOffset(i,r,h/2,n/2));var o,a,u,f,c=t.viewState.resolution;for(o=0,a=e.length;o<a;++o)u=this.getLayerRenderer((f=e[o]).layer),Ws.visibleAtResolution(f,c)&&"ready"==f.sourceState&&u.prepareFrame(t,f)&&u.composeFrame(t,f,i);r&&i.restore(),this.dispatchComposeEvent_("postcompose",t),this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1)},Sh.prototype.forEachLayerAtPixel=function(t,i,s,h,n,r){var e,o,a=i.viewState.resolution,u=i.layerStatesArray,f=u.length,c=Ii.apply(i.pixelToCoordinateTransform,t.slice());for(o=f-1;o>=0;--o){var l=u[o],v=l.layer;if(Ws.visibleAtResolution(l,a)&&n.call(r,v)&&(e=this.getLayerRenderer(v).forEachLayerAtCoordinate(c,i,s,h)))return e}};var Ch=function(t,i,s,h){this.minX=t,this.maxX=i,this.minY=s,this.maxY=h};Ch.createOrUpdate=function(t,i,s,h,n){return void 0!==n?(n.minX=t,n.maxX=i,n.minY=s,n.maxY=h,n):new Ch(t,i,s,h)},Ch.prototype.contains=function(t){return this.containsXY(t[1],t[2])},Ch.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},Ch.prototype.containsXY=function(t,i){return this.minX<=t&&t<=this.maxX&&this.minY<=i&&i<=this.maxY},Ch.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},Ch.prototype.extend=function(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)},Ch.prototype.getHeight=function(){return this.maxY-this.minY+1},Ch.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},Ch.prototype.getWidth=function(){return this.maxX-this.minX+1},Ch.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var Ah=function(t){wh.call(this,t),this.context=null===this.context?null:Cs(),this.renderedExtent_=null,this.renderedTiles=[],this.tmpExtent=bi.createEmpty(),this.tmpTileRange_=new Ch(0,0,0,0),this.imageTransform_=Ii.create(),this.zDirection=0};ui.inherits(Ah,wh),Ah.handles=function(t,i){return"canvas"===t&&"TILE"===i.getType()},Ah.create=function(t,i){return new Ah(i)},Ah.prototype.isDrawableTile_=function(t){var i=t.getState(),s=this.getLayer().getUseInterimTilesOnError();return 2==i||4==i||3==i&&!s},Ah.prototype.prepareFrame=function(t,i){var s=t.pixelRatio,h=t.size,n=t.viewState,r=n.projection,e=n.resolution,o=n.center,a=this.getLayer(),u=a.getSource(),f=u.getRevision(),c=u.getTileGridForProjection(r),l=c.getZForResolution(e,this.zDirection),v=c.getResolution(l),d=Math.round(e/v)||1,M=t.extent;if(void 0!==i.extent&&(M=bi.getIntersection(M,i.extent)),bi.isEmpty(M))return!1;var m=c.getTileRangeForExtentAndZ(M,l),p=c.getTileRangeExtent(l,m),g=u.getTilePixelRatio(s),_={};_[l]={};var w,y,b,x=this.createLoadedTileFinder(u,r,_),E=this.tmpExtent,S=this.tmpTileRange_,C=!1;for(y=m.minX;y<=m.maxX;++y)for(b=m.minY;b<=m.maxY;++b){if(3==(w=u.getTile(l,y,b,s,r)).getState()&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(C=!0):w.setState(2)),this.isDrawableTile_(w)||(w=w.getInterimTile()),this.isDrawableTile_(w)){var A=ui.getUid(this);if(2==w.getState()){_[l][w.tileCoord.toString()]=w;var P=w.inTransition(A);C||!P&&-1!==this.renderedTiles.indexOf(w)||(C=!0)}if(1===w.getAlpha(A,t.time))continue}var R=c.getTileCoordChildTileRange(w.tileCoord,S,E),N=!1;R&&(N=x(l+1,R)),N||c.forEachTileCoordParentTileRange(w.tileCoord,x,null,S,E)}var z=v*s/g*d,k=t.viewHints,T=k[0]||k[1];if(!(this.renderedResolution&&Date.now()-t.time>16&&T)&&(C||!this.renderedExtent_||!bi.containsExtent(this.renderedExtent_,M)||this.renderedRevision!=f||d!=this.oversampling_||!T&&z!=this.renderedResolution)){var O=this.context;if(O){var L=u.getTilePixelSize(l,s,r),I=Math.round(m.getWidth()*L[0]/d),F=Math.round(m.getHeight()*L[1]/d),D=O.canvas;D.width!=I||D.height!=F?(this.oversampling_=d,D.width=I,D.height=F):(this.renderedExtent_&&!bi.equals(p,this.renderedExtent_)&&O.clearRect(0,0,I,F),d=this.oversampling_)}this.renderedTiles.length=0;var G,W,V,j,U,X,q,Y,B=Object.keys(_).map(Number);for(B.sort((function(t,i){return t===l?1:i===l?-1:t>i?1:t<i?-1:0})),j=0,U=B.length;j<U;++j)for(var H in W=u.getTilePixelSize(V=B[j],s,r),G=c.getResolution(V)/v,q=g*u.getGutter(r),Y=_[V])X=c.getTileCoordExtent((w=Y[H]).getTileCoord(),E),this.drawTileImage(w,t,i,y=(X[0]-p[0])/v*g/d,b=(p[3]-X[3])/v*g/d,W[0]*G/d,W[1]*G/d,q,l===V),this.renderedTiles.push(w);this.renderedRevision=f,this.renderedResolution=v*s/g*d,this.renderedExtent_=p}var J=this.renderedResolution/e,Z=Ii.compose(this.imageTransform_,s*h[0]/2,s*h[1]/2,J,J,0,(this.renderedExtent_[0]-o[0])/this.renderedResolution*s,(o[1]-this.renderedExtent_[3])/this.renderedResolution*s);return Ii.compose(this.coordinateToCanvasPixelTransform,s*h[0]/2-Z[4],s*h[1]/2-Z[5],s/e,-s/e,0,-o[0],-o[1]),this.updateUsedTiles(t.usedTiles,u,l,m),this.manageTilePyramid(t,u,c,s,r,M,l,a.getPreload()),this.scheduleExpireCache(t,u),this.updateLogos(t,u),this.renderedTiles.length>0},Ah.prototype.drawTileImage=function(t,i,s,h,n,r,e,o,a){var u=t.getImage(this.getLayer());if(u){var f=ui.getUid(this),c=a?t.getAlpha(f,i.time):1;1!==c||this.getLayer().getSource().getOpaque(i.viewState.projection)||this.context.clearRect(h,n,r,e);var l=c!==this.context.globalAlpha;l&&(this.context.save(),this.context.globalAlpha=c),this.context.drawImage(u,o,o,u.width-2*o,u.height-2*o,h,n,r,e),l&&this.context.restore(),1!==c?i.animate=!0:a&&t.endTransition(f)}},Ah.prototype.getImage=function(){var t=this.context;return t?t.canvas:null},Ah.prototype.getImageTransform=function(){return this.imageTransform_};var Ph=e((function(t){t.exports=function(){function t(s,h,n,r,e){for(;r>n;){if(r-n>600){var o=r-n+1,a=h-n+1,u=Math.log(o),f=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*f*(o-f)/o)*(a-o/2<0?-1:1);t(s,h,Math.max(n,Math.floor(h-a*f/o+c)),Math.min(r,Math.floor(h+(o-a)*f/o+c)),e)}var l=s[h],v=n,d=r;for(i(s,n,h),e(s[r],l)>0&&i(s,n,r);v<d;){for(i(s,v,d),v++,d--;e(s[v],l)<0;)v++;for(;e(s[d],l)>0;)d--}0===e(s[n],l)?i(s,n,d):i(s,++d,r),d<=h&&(n=d+1),h<=d&&(r=d-1)}}function i(t,i,s){var h=t[i];t[i]=t[s],t[s]=h}function s(t,i){return t<i?-1:t>i?1:0}return function(i,h,n,r,e){t(i,h,n||0,r||i.length-1,e||s)}}()})),Rh=Nh;function Nh(t,i){if(!(this instanceof Nh))return new Nh(t,i);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),i&&this._initFormat(i),this.clear()}function zh(t,i,s){if(!s)return i.indexOf(t);for(var h=0;h<i.length;h++)if(s(t,i[h]))return h;return-1}function kh(t,i){Th(t,0,t.children.length,i,t)}function Th(t,i,s,h,n){n||(n=Vh(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var r,e=i;e<s;e++)r=t.children[e],Oh(n,t.leaf?h(r):r);return n}function Oh(t,i){return t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),t}function Lh(t,i){return t.minX-i.minX}function Ih(t,i){return t.minY-i.minY}function Fh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Dh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Gh(t,i){return t.minX<=i.minX&&t.minY<=i.minY&&i.maxX<=t.maxX&&i.maxY<=t.maxY}function Wh(t,i){return i.minX<=t.maxX&&i.minY<=t.maxY&&i.maxX>=t.minX&&i.maxY>=t.minY}function Vh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jh(t,i,s,h,n){for(var r,e=[i,s];e.length;)(s=e.pop())-(i=e.pop())<=h||(r=i+Math.ceil((s-i)/h/2)*h,Ph(t,r,i,s,n),e.push(i,r,r,s))}Nh.prototype={all:function(){return this._all(this.data,[])},search:function(t){var i=this.data,s=[],h=this.toBBox;if(!Wh(t,i))return s;for(var n,r,e,o,a=[];i;){for(n=0,r=i.children.length;n<r;n++)e=i.children[n],Wh(t,o=i.leaf?h(e):e)&&(i.leaf?s.push(e):Gh(t,o)?this._all(e,s):a.push(e));i=a.pop()}return s},collides:function(t){var i=this.data,s=this.toBBox;if(!Wh(t,i))return!1;for(var h,n,r,e,o=[];i;){for(h=0,n=i.children.length;h<n;h++)if(r=i.children[h],Wh(t,e=i.leaf?s(r):r)){if(i.leaf||Gh(t,e))return!0;o.push(r)}i=o.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var i=0,s=t.length;i<s;i++)this.insert(t[i]);return this}var h=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===h.height)this._splitRoot(this.data,h);else{if(this.data.height<h.height){var n=this.data;this.data=h,h=n}this._insert(h,this.data.height-h.height-1,!0)}else this.data=h;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Vh([]),this},remove:function(t,i){if(!t)return this;for(var s,h,n,r,e=this.data,o=this.toBBox(t),a=[],u=[];e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],s=u.pop(),r=!0),e.leaf&&-1!==(n=zh(t,e.children,i)))return e.children.splice(n,1),a.push(e),this._condense(a),this;r||e.leaf||!Gh(e,o)?h?(s++,e=h.children[s],r=!1):e=null:(a.push(e),u.push(s),s=0,h=e,e=e.children[0])}return this},toBBox:function(t){return t},compareMinX:Lh,compareMinY:Ih,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,i){for(var s=[];t;)t.leaf?i.push.apply(i,t.children):s.push.apply(s,t.children),t=s.pop();return i},_build:function(t,i,s,h){var n,r=s-i+1,e=this._maxEntries;if(r<=e)return kh(n=Vh(t.slice(i,s+1)),this.toBBox),n;h||(h=Math.ceil(Math.log(r)/Math.log(e)),e=Math.ceil(r/Math.pow(e,h-1))),(n=Vh([])).leaf=!1,n.height=h;var o,a,u,f,c=Math.ceil(r/e),l=c*Math.ceil(Math.sqrt(e));for(jh(t,i,s,l,this.compareMinX),o=i;o<=s;o+=l)for(jh(t,o,u=Math.min(o+l-1,s),c,this.compareMinY),a=o;a<=u;a+=c)f=Math.min(a+c-1,u),n.children.push(this._build(t,a,f,h-1));return kh(n,this.toBBox),n},_chooseSubtree:function(t,i,s,h){for(var n,r,e,o,a,u,f,c,l,v;h.push(i),!i.leaf&&h.length-1!==s;){for(f=c=1/0,n=0,r=i.children.length;n<r;n++)a=Fh(e=i.children[n]),l=t,v=e,(u=(Math.max(v.maxX,l.maxX)-Math.min(v.minX,l.minX))*(Math.max(v.maxY,l.maxY)-Math.min(v.minY,l.minY))-a)<c?(c=u,f=a<f?a:f,o=e):u===c&&a<f&&(f=a,o=e);i=o||i.children[0]}return i},_insert:function(t,i,s){var h=s?t:(0,this.toBBox)(t),n=[],r=this._chooseSubtree(h,this.data,i,n);for(r.children.push(t),Oh(r,h);i>=0&&n[i].children.length>this._maxEntries;)this._split(n,i),i--;this._adjustParentBBoxes(h,n,i)},_split:function(t,i){var s=t[i],h=s.children.length,n=this._minEntries;this._chooseSplitAxis(s,n,h);var r=this._chooseSplitIndex(s,n,h),e=Vh(s.children.splice(r,s.children.length-r));e.height=s.height,e.leaf=s.leaf,kh(s,this.toBBox),kh(e,this.toBBox),i?t[i-1].children.push(e):this._splitRoot(s,e)},_splitRoot:function(t,i){this.data=Vh([t,i]),this.data.height=t.height+1,this.data.leaf=!1,kh(this.data,this.toBBox)},_chooseSplitIndex:function(t,i,s){var h,n,r,e,o,a,u,f,c,l,v,d,M,m;for(a=u=1/0,h=i;h<=s-i;h++)c=n=Th(t,0,h,this.toBBox),l=r=Th(t,h,s,this.toBBox),void 0,void 0,void 0,void 0,v=Math.max(c.minX,l.minX),d=Math.max(c.minY,l.minY),M=Math.min(c.maxX,l.maxX),m=Math.min(c.maxY,l.maxY),e=Math.max(0,M-v)*Math.max(0,m-d),o=Fh(n)+Fh(r),e<a?(a=e,f=h,u=o<u?o:u):e===a&&o<u&&(u=o,f=h);return f},_chooseSplitAxis:function(t,i,s){var h=t.leaf?this.compareMinX:Lh,n=t.leaf?this.compareMinY:Ih;this._allDistMargin(t,i,s,h)<this._allDistMargin(t,i,s,n)&&t.children.sort(h)},_allDistMargin:function(t,i,s,h){t.children.sort(h);var n,r,e=this.toBBox,o=Th(t,0,i,e),a=Th(t,s-i,s,e),u=Dh(o)+Dh(a);for(n=i;n<s-i;n++)r=t.children[n],Oh(o,t.leaf?e(r):r),u+=Dh(o);for(n=s-i-1;n>=i;n--)r=t.children[n],Oh(a,t.leaf?e(r):r),u+=Dh(a);return u},_adjustParentBBoxes:function(t,i,s){for(var h=s;h>=0;h--)Oh(i[h],t)},_condense:function(t){for(var i,s=t.length-1;s>=0;s--)0===t[s].children.length?s>0?(i=t[s-1].children).splice(i.indexOf(t[s]),1):this.clear():kh(t[s],this.toBBox)},_initFormat:function(t){var i=["return a"," - b",";"];this.compareMinX=new Function("a","b",i.join(t[0])),this.compareMinY=new Function("a","b",i.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var Uh=function(){};Uh.prototype.getReplay=function(){},Uh.prototype.isEmpty=function(){};var Xh={lineString:function(t,i,s,h){var n,r=t[i],e=t[i+1],o=0;for(n=i+h;n<s;n+=h){var a=t[n],u=t[n+1];o+=Math.sqrt((a-r)*(a-r)+(u-e)*(u-e)),r=a,e=u}return o},linearRing:function(t,i,s,h){var n=Xh.lineString(t,i,s,h),r=t[s-h]-t[i],e=t[s-h+1]-t[i+1];return n+Math.sqrt(r*r+e*e)}},qh=function(t,i,s,h,n,r,e,o){for(var a,u,f=[],c=t[i]>t[s-h],l=n.length,v=t[i],d=t[i+1],M=t[i+=h],m=t[i+1],p=0,g=Math.sqrt(Math.pow(M-v,2)+Math.pow(m-d,2)),_="",w=0,y=0;y<l;++y){var b=n.charAt(c?l-y-1:y),x=r(_=c?b+_:_+b)-w;w+=x;for(var E=e+x/2;i<s-h&&p+g<E;)v=M,d=m,M=t[i+=h],m=t[i+1],p+=g,g=Math.sqrt(Math.pow(M-v,2)+Math.pow(m-d,2));var S=E-p,C=Math.atan2(m-d,M-v);if(c&&(C+=C>0?-Math.PI:Math.PI),void 0!==u){var A=C-u;if(A+=A>Math.PI?-2*Math.PI:A<-Math.PI?2*Math.PI:0,Math.abs(A)>o)return null}var P=S/g,R=_i.lerp(v,M,P),N=_i.lerp(d,m,P);u==C?(c&&(a[0]=R,a[1]=N,a[2]=x/2),a[4]=_):(w=x,a=[R,N,x/2,C,_=b],c?f.unshift(a):f.push(a),u=C),e+=x}return f},Yh={ORDER:["Polygon","Circle","LineString","Image","Text","Default"],TEXT_ALIGN:{}};Yh.TEXT_ALIGN.left=0,Yh.TEXT_ALIGN.end=0,Yh.TEXT_ALIGN.center=.5,Yh.TEXT_ALIGN.right=1,Yh.TEXT_ALIGN.start=1,Yh.TEXT_ALIGN.top=0,Yh.TEXT_ALIGN.middle=.5,Yh.TEXT_ALIGN.hanging=.2,Yh.TEXT_ALIGN.alphabetic=.8,Yh.TEXT_ALIGN.ideographic=.8,Yh.TEXT_ALIGN.bottom=1;var Bh=function(t,i,s,h,n,r){mh.call(this),this.declutterTree=r,this.tmpExtent_=bi.createEmpty(),this.tolerance=t,this.maxExtent=i,this.overlaps=n,this.pixelRatio=h,this.maxLineWidth=0,this.resolution=s,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.coordinateCache_={},this.renderedTransform_=Ii.create(),this.hitDetectionInstructions=[],this.pixelCoordinates_=null,this.state={},this.viewRotation_=0,this.tmpLocalTransform_=Ii.create(),this.resetTransform_=Ii.create()};ui.inherits(Bh,mh),Bh.prototype.replayTextBackground_=function(t,i,s,h,n,r,e){t.beginPath(),t.moveTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,h),t.lineTo.apply(t,n),t.lineTo.apply(t,i),r&&(this.fillOrigin_=r[2],this.fill_(t)),e&&(this.setStrokeStyle_(t,e),t.stroke())},Bh.prototype.replayImage_=function(t,i,s,h,n,r,e,o,a,u,f,c,l,v,d,M,m,p){var g=m||p,_=this.tmpLocalTransform_;i-=n*=l,s-=r*=l,v&&(i=Math.round(i),s=Math.round(s));var w,y,b,x,E=d+u>h.width?h.width-u:d,S=o+f>h.height?h.height-f:o,C=this.tmpExtent_,A=M[3]+E*l+M[1],P=M[0]+S*l+M[2],R=i-M[3],N=s-M[0];(g||0!==c)&&(w=[R,N],y=[R+A,N],b=[R+A,N+P],x=[R,N+P]);var z=null;if(0!==c){var k=i+n,T=s+r;z=Ii.compose(_,k,T,1,1,c,-k,-T),bi.createOrUpdateEmpty(C),bi.extendCoordinate(C,Ii.apply(_,w)),bi.extendCoordinate(C,Ii.apply(_,y)),bi.extendCoordinate(C,Ii.apply(_,b)),bi.extendCoordinate(C,Ii.apply(_,x))}else bi.createOrUpdate(R,N,R+A,N+P,C);var O=t.canvas,L=C[0]<=O.width&&C[2]>=0&&C[1]<=O.height&&C[3]>=0;if(e){if(!L&&1==e[4])return;bi.extend(e,C);var I=L?[t,z?z.slice(0):null,a,h,u,f,E,S,i,s,l]:null;I&&g&&I.push(m,p,w,y,b,x),e.push(I)}else L&&(g&&this.replayTextBackground_(t,w,y,b,x,m,p),vh.drawImage(t,z,a,h,u,f,E,S,i,s,l))},Bh.prototype.applyPixelRatio=function(t){var i=this.pixelRatio;return 1==i?t:t.map((function(t){return t*i}))},Bh.prototype.appendFlatCoordinates=function(t,i,s,h,n,r){var e=this.coordinates.length,o=this.getBufferedMaxExtent();r&&(i+=h);var a,u,f,c=[t[i],t[i+1]],l=[NaN,NaN],v=!0;for(a=i+h;a<s;a+=h)l[0]=t[a],l[1]=t[a+1],(f=bi.coordinateRelationship(o,l))!==u?(v&&(this.coordinates[e++]=c[0],this.coordinates[e++]=c[1]),this.coordinates[e++]=l[0],this.coordinates[e++]=l[1],v=!1):1===f?(this.coordinates[e++]=l[0],this.coordinates[e++]=l[1],v=!1):v=!0,c[0]=l[0],c[1]=l[1],u=f;return(n&&v||a===i+h)&&(this.coordinates[e++]=c[0],this.coordinates[e++]=c[1]),e},Bh.prototype.drawCustomCoordinates_=function(t,i,s,h,n){for(var r=0,e=s.length;r<e;++r){var o=s[r],a=this.appendFlatCoordinates(t,i,o,h,!1,!1);n.push(a),i=o}return i},Bh.prototype.drawCustom=function(t,i,s){this.beginGeometry(t,i);var h,n,r,e,o,a=t.getType(),u=t.getStride(),f=this.coordinates.length;if("MultiPolygon"==a){h=(t=t).getOrientedFlatCoordinates(),e=[];var c=t.getEndss();o=0;for(var l=0,v=c.length;l<v;++l){var d=[];o=this.drawCustomCoordinates_(h,o,c[l],u,d),e.push(d)}this.instructions.push([4,f,e,t,s,ji.coordinatesss])}else"Polygon"==a||"MultiLineString"==a?(r=[],h="Polygon"==a?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),o=this.drawCustomCoordinates_(h,0,t.getEnds(),u,r),this.instructions.push([4,f,r,t,s,ji.coordinatess])):"LineString"==a||"MultiPoint"==a?(h=t.getFlatCoordinates(),n=this.appendFlatCoordinates(h,0,h.length,u,!1,!1),this.instructions.push([4,f,n,t,s,ji.coordinates])):"Point"==a&&(h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),this.instructions.push([4,f,n=this.coordinates.length,t,s]));this.endGeometry(t,i)},Bh.prototype.beginGeometry=function(t,i){this.beginGeometryInstruction1_=[0,i,0],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,i,0],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},Bh.prototype.fill_=function(t){if(this.fillOrigin_){var i=Ii.apply(this.renderedTransform_,this.fillOrigin_.slice());t.translate(i[0],i[1]),t.rotate(this.viewRotation_)}t.fill(),this.fillOrigin_&&t.setTransform.apply(t,vh.resetTransform_)},Bh.prototype.setStrokeStyle_=function(t,i){t.strokeStyle=i[1],t.lineWidth=i[2],t.lineCap=i[3],t.lineJoin=i[4],t.miterLimit=i[5],ts.CANVAS_LINE_DASH&&(t.lineDashOffset=i[7],t.setLineDash(i[6]))},Bh.prototype.renderDeclutter_=function(t,i){if(t&&t.length>5){var s=t[4];if(1==s||s==t.length-5){var h={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:i};if(!this.declutterTree.collides(h)){this.declutterTree.insert(h);for(var n=vh.drawImage,r=5,e=t.length;r<e;++r){var o=t[r];o&&(o.length>11&&this.replayTextBackground_(o[0],o[13],o[14],o[15],o[16],o[11],o[12]),n.apply(void 0,o))}}t.length=5,bi.createOrUpdateEmpty(t)}}},Bh.prototype.replay_=function(t,i,s,h,n,r){var e;this.pixelCoordinates_&&yi.equals(i,this.renderedTransform_)?e=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),e=Ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Ii.setFromArray(this.renderedTransform_,i));for(var o,a,u,f,c,l,v,d,M,m=!fi.isEmpty(s),p=0,g=h.length,_=0,w=0,y=0,b=null,x=null,E=this.coordinateCache_,S=this.viewRotation_,C={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:S},A=this.instructions!=h||this.overlaps?0:200;p<g;){var P,R,N,z=h[p];switch(z[0]){case 0:P=z[1],m&&s[ui.getUid(P).toString()]||!P.getGeometry()?p=z[2]:void 0===r||bi.intersects(r,P.getGeometry().getExtent())?++p:p=z[2]+1;break;case 1:w>A&&(this.fill_(t),w=0),y>A&&(t.stroke(),y=0),w||y||(t.beginPath(),f=c=NaN),++p;break;case 2:var k=e[_=z[1]],T=e[_+1],O=e[_+2]-k,L=e[_+3]-T,I=Math.sqrt(O*O+L*L);t.moveTo(k+I,T),t.arc(k,T,I,0,2*Math.PI,!0),++p;break;case 3:t.closePath(),++p;break;case 4:_=z[1],o=z[2];var F=z[4],D=6==z.length?z[5]:void 0;C.geometry=z[3],C.feature=P,p in E||(E[p]=[]);var G=E[p];D?D(e,_,o,2,G):(G[0]=e[_],G[1]=e[_+1],G.length=2),F(G,C),++p;break;case 6:_=z[1],o=z[2],M=z[3],a=z[4],u=z[5],d=n?null:z[6];var W,V,j,U=z[7],X=z[8],q=z[9],Y=z[10],B=z[12],H=z[13],J=z[14],Z=z[15];for(z.length>16?(W=z[16],V=z[17],j=z[18]):(W=vh.defaultPadding,V=j=!1),z[11]&&(B+=S);_<o;_+=2)this.replayImage_(t,e[_],e[_+1],M,a,u,d,U,X,q,Y,B,H,J,Z,W,V?b:null,j?x:null);this.renderDeclutter_(d,P),++p;break;case 5:var K=z[1],Q=z[2],$=z[3];d=n?null:z[4];var tt=z[5],it=z[6],st=z[7],ht=z[8],nt=z[9],rt=z[10],et=z[11],ot=z[12],at=z[13],ut=z[14],ft=Xh.lineString(e,K,Q,2),ct=ht(ot);if(tt||ct<=ft){var lt=qh(e,K,Q,2,ot,ht,(ft-ct)*Yh.TEXT_ALIGN[this.textStates[at].textAlign],st);if(lt){var vt,dt,Mt,mt;if(rt)for(vt=0,dt=lt.length;vt<dt;++vt)Mt=this.getImage((mt=lt[vt])[4],at,"",rt),this.replayImage_(t,mt[0],mt[1],Mt,a=mt[2]+et,u=$*Mt.height+2*(.5-$)*et-nt,d,Mt.height,1,0,0,mt[3],ut,!1,Mt.width,vh.defaultPadding,null,null);if(it)for(vt=0,dt=lt.length;vt<dt;++vt)Mt=this.getImage((mt=lt[vt])[4],at,it,""),this.replayImage_(t,mt[0],mt[1],Mt,a=mt[2],u=$*Mt.height-nt,d,Mt.height,1,0,0,mt[3],ut,!1,Mt.width,vh.defaultPadding,null,null)}}this.renderDeclutter_(d,P),++p;break;case 7:if(void 0!==n){var pt=n(P=z[1]);if(pt)return pt}++p;break;case 8:A?w++:this.fill_(t),++p;break;case 9:for(o=z[2],v=(N=e[(_=z[1])+1])+.5|0,(l=(R=e[_])+.5|0)===f&&v===c||(t.moveTo(R,N),f=l,c=v),_+=2;_<o;_+=2)l=(R=e[_])+.5|0,v=(N=e[_+1])+.5|0,_!=o-2&&l===f&&v===c||(t.lineTo(R,N),f=l,c=v);++p;break;case 10:b=z,this.fillOrigin_=z[2],w&&(this.fill_(t),w=0,y&&(t.stroke(),y=0)),t.fillStyle=z[1],++p;break;case 11:x=z,y&&(t.stroke(),y=0),this.setStrokeStyle_(t,z),++p;break;case 12:A?y++:t.stroke(),++p;break;default:++p}}w&&this.fill_(t),y&&t.stroke()},Bh.prototype.replay=function(t,i,s,h){this.viewRotation_=s,this.replay_(t,i,h,this.instructions,void 0,void 0)},Bh.prototype.replayHitDetection=function(t,i,s,h,n,r){return this.viewRotation_=s,this.replay_(t,i,h,this.hitDetectionInstructions,n,r)},Bh.prototype.reverseHitDetectionInstructions=function(){var t,i=this.hitDetectionInstructions;i.reverse();var s,h,n=i.length,r=-1;for(t=0;t<n;++t)7==(h=(s=i[t])[0])?r=t:0==h&&(s[2]=t,yi.reverseSubArray(this.hitDetectionInstructions,r,t),r=-1)},Bh.prototype.setFillStrokeStyle=function(t,i){var s=this.state;if(t){var h=t.getColor();s.fillStyle=Mh.asColorLike(h||vh.defaultFillStyle)}else s.fillStyle=void 0;if(i){var n=i.getColor();s.strokeStyle=Mh.asColorLike(n||vh.defaultStrokeStyle);var r=i.getLineCap();s.lineCap=void 0!==r?r:vh.defaultLineCap;var e=i.getLineDash();s.lineDash=e?e.slice():vh.defaultLineDash;var o=i.getLineDashOffset();s.lineDashOffset=o||vh.defaultLineDashOffset;var a=i.getLineJoin();s.lineJoin=void 0!==a?a:vh.defaultLineJoin;var u=i.getWidth();s.lineWidth=void 0!==u?u:vh.defaultLineWidth;var f=i.getMiterLimit();s.miterLimit=void 0!==f?f:vh.defaultMiterLimit,s.lineWidth>this.maxLineWidth&&(this.maxLineWidth=s.lineWidth,this.bufferedMaxExtent_=null)}else s.strokeStyle=void 0,s.lineCap=void 0,s.lineDash=null,s.lineDashOffset=void 0,s.lineJoin=void 0,s.lineWidth=void 0,s.miterLimit=void 0},Bh.prototype.applyFill=function(t,i){var s=t.fillStyle,h=[10,s];if("string"!=typeof s){var n=i.getExtent();h.push([n[0],n[3]])}this.instructions.push(h)},Bh.prototype.applyStroke=function(t){this.instructions.push([11,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio])},Bh.prototype.updateFillStyle=function(t,i,s){var h=t.fillStyle;"string"==typeof h&&t.currentFillStyle==h||(i.call(this,t,s),t.currentFillStyle=h)},Bh.prototype.updateStrokeStyle=function(t,i){var s=t.strokeStyle,h=t.lineCap,n=t.lineDash,r=t.lineDashOffset,e=t.lineJoin,o=t.lineWidth,a=t.miterLimit;(t.currentStrokeStyle!=s||t.currentLineCap!=h||n!=t.currentLineDash&&!yi.equals(t.currentLineDash,n)||t.currentLineDashOffset!=r||t.currentLineJoin!=e||t.currentLineWidth!=o||t.currentMiterLimit!=a)&&(i.call(this,t),t.currentStrokeStyle=s,t.currentLineCap=h,t.currentLineDash=n,t.currentLineDashOffset=r,t.currentLineJoin=e,t.currentLineWidth=o,t.currentMiterLimit=a)},Bh.prototype.endGeometry=function(t,i){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var s=[7,i];this.instructions.push(s),this.hitDetectionInstructions.push(s)},Bh.prototype.finish=ui.nullFunction,Bh.prototype.getBufferedMaxExtent=function(){return this.bufferedMaxExtent_||(this.bufferedMaxExtent_=bi.clone(this.maxExtent),this.maxLineWidth>0&&bi.buffer(this.bufferedMaxExtent_,this.resolution*(this.maxLineWidth+1)/2,this.bufferedMaxExtent_)),this.bufferedMaxExtent_};var Hh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r),this.declutterGroup_=null,this.hitDetectionImage_=null,this.image_=null,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.snapToPixel_=void 0,this.width_=void 0};ui.inherits(Hh,Bh),Hh.prototype.drawCoordinates_=function(t,i,s,h){return this.appendFlatCoordinates(t,i,s,h,!1,!1)},Hh.prototype.drawPoint=function(t,i){if(this.image_){this.beginGeometry(t,i);var s=t.getFlatCoordinates(),h=t.getStride(),n=this.coordinates.length,r=this.drawCoordinates_(s,0,s.length,h);this.instructions.push([6,n,r,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]),this.hitDetectionInstructions.push([6,n,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]),this.endGeometry(t,i)}},Hh.prototype.drawMultiPoint=function(t,i){if(this.image_){this.beginGeometry(t,i);var s=t.getFlatCoordinates(),h=t.getStride(),n=this.coordinates.length,r=this.drawCoordinates_(s,0,s.length,h);this.instructions.push([6,n,r,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]),this.hitDetectionInstructions.push([6,n,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]),this.endGeometry(t,i)}},Hh.prototype.finish=function(){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.snapToPixel_=void 0,this.width_=void 0},Hh.prototype.setImageStyle=function(t,i){var s=t.getAnchor(),h=t.getSize(),n=t.getHitDetectionImage(1),r=t.getImage(1),e=t.getOrigin();this.anchorX_=s[0],this.anchorY_=s[1],this.declutterGroup_=i,this.hitDetectionImage_=n,this.image_=r,this.height_=h[1],this.opacity_=t.getOpacity(),this.originX_=e[0],this.originY_=e[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.snapToPixel_=t.getSnapToPixel(),this.width_=h[0]};var Jh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r)};ui.inherits(Jh,Bh),Jh.prototype.drawFlatCoordinates_=function(t,i,s,h){var n=[9,this.coordinates.length,this.appendFlatCoordinates(t,i,s,h,!1,!1)];return this.instructions.push(n),this.hitDetectionInstructions.push(n),s},Jh.prototype.drawLineString=function(t,i){var s=this.state;if(void 0!==s.strokeStyle&&void 0!==s.lineWidth){this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,i),this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset],[1]);var h=t.getFlatCoordinates(),n=t.getStride();this.drawFlatCoordinates_(h,0,h.length,n),this.hitDetectionInstructions.push([12]),this.endGeometry(t,i)}},Jh.prototype.drawMultiLineString=function(t,i){var s=this.state;if(void 0!==s.strokeStyle&&void 0!==s.lineWidth){this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,i),this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset],[1]);var h,n,r=t.getEnds(),e=t.getFlatCoordinates(),o=t.getStride(),a=0;for(h=0,n=r.length;h<n;++h)a=this.drawFlatCoordinates_(e,a,r[h],o);this.hitDetectionInstructions.push([12]),this.endGeometry(t,i)}},Jh.prototype.finish=function(){var t=this.state;null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push([12]),this.reverseHitDetectionInstructions(),this.state=null},Jh.prototype.applyStroke=function(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push([12]),t.lastStroke=this.coordinates.length),t.lastStroke=0,Bh.prototype.applyStroke.call(this,t),this.instructions.push([1])};var Zh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r)};ui.inherits(Zh,Bh),Zh.prototype.drawFlatCoordinatess_=function(t,i,s,h){var n=this.state,r=void 0!==n.fillStyle,e=null!=n.strokeStyle,o=s.length,a=[1];this.instructions.push(a),this.hitDetectionInstructions.push(a);for(var u=0;u<o;++u){var f=s[u],c=[9,this.coordinates.length,this.appendFlatCoordinates(t,i,f,h,!0,!e)];if(this.instructions.push(c),this.hitDetectionInstructions.push(c),e){var l=[3];this.instructions.push(l),this.hitDetectionInstructions.push(l)}i=f}var v=[8];if(this.hitDetectionInstructions.push(v),r&&this.instructions.push(v),e){var d=[12];this.instructions.push(d),this.hitDetectionInstructions.push(d)}return i},Zh.prototype.drawCircle=function(t,i){var s=this.state;if(void 0!==s.fillStyle||void 0!==s.strokeStyle){this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length;this.appendFlatCoordinates(h,0,h.length,n,!1,!1);var e=[1],o=[2,r];this.instructions.push(e,o),this.hitDetectionInstructions.push(e,o);var a=[8];if(this.hitDetectionInstructions.push(a),void 0!==s.fillStyle&&this.instructions.push(a),void 0!==s.strokeStyle){var u=[12];this.instructions.push(u),this.hitDetectionInstructions.push(u)}this.endGeometry(t,i)}},Zh.prototype.drawPolygon=function(t,i){var s=this.state;this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h=t.getEnds(),n=t.getOrientedFlatCoordinates(),r=t.getStride();this.drawFlatCoordinatess_(n,0,h,r),this.endGeometry(t,i)},Zh.prototype.drawMultiPolygon=function(t,i){var s=this.state;if(void 0!==s.fillStyle||void 0!==s.strokeStyle){this.setFillStrokeStyles_(t),this.beginGeometry(t,i),this.hitDetectionInstructions.push([10,dh.asString(vh.defaultFillStyle)]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([11,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,s.lineDash,s.lineDashOffset]);var h,n,r=t.getEndss(),e=t.getOrientedFlatCoordinates(),o=t.getStride(),a=0;for(h=0,n=r.length;h<n;++h)a=this.drawFlatCoordinatess_(e,a,r[h],o);this.endGeometry(t,i)}},Zh.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var t=this.tolerance;if(0!==t){var i,s,h=this.coordinates;for(i=0,s=h.length;i<s;++i)h[i]=Ui.snap(h[i],t)}},Zh.prototype.setFillStrokeStyles_=function(t){var i=this.state;void 0!==i.fillStyle&&this.updateFillStyle(i,this.applyFill,t),void 0!==i.strokeStyle&&this.updateStrokeStyle(i,this.applyStroke)};var Kh=function(t,i,s,h,n){var r,e,o,a,u,f,c,l,v,d=s,M=s,m=0,p=0,g=s;for(r=s;r<h;r+=n){var _=i[r],w=i[r+1];void 0!==a&&(l=_-a,v=w-u,o=Math.sqrt(l*l+v*v),void 0!==f&&(p+=e,Math.acos((f*l+c*v)/(e*o))>t&&(p>m&&(m=p,d=g,M=r),p=0,g=r-n)),e=o,f=l,c=v),a=_,u=w}return(p+=o)>m?[g,r]:[d,M]},Qh=function(t,i,s,h,n,r){Bh.call(this,t,i,s,h,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.widths_={},vh.labelCache.prune()};ui.inherits(Qh,Bh),Qh.measureTextWidths=function(t,i,s){var h,n,r=i.length,e=0;for(n=0;n<r;++n)h=vh.measureTextWidth(t,i[n]),e=Math.max(e,h),s.push(h);return e},Qh.prototype.drawText=function(t,i){var s=this.textState_;if(""!==this.text_&&s&&(this.textFillState_||this.textStrokeState_)){var h,n,r=this.coordinates.length,e=t.getType(),o=null,a=2,u=2;if("line"===s.placement){if(!bi.intersects(this.getBufferedMaxExtent(),t.getExtent()))return;var f;if(o=t.getFlatCoordinates(),u=t.getStride(),"LineString"==e)f=[o.length];else if("MultiLineString"==e)f=t.getEnds();else if("Polygon"==e)f=t.getEnds().slice(0,1);else if("MultiPolygon"==e){var c=t.getEndss();for(f=[],h=0,n=c.length;h<n;++h)f.push(c[h][0])}this.beginGeometry(t,i);for(var l,v=s.textAlign,d=0,M=0,m=f.length;M<m;++M){if(null==v){var p=Kh(s.maxAngle,o,d,f[M],u);d=p[0],l=p[1]}else l=f[M];for(h=d;h<l;h+=u)this.coordinates.push(o[h],o[h+1]);d=f[M],this.drawChars_(r,a=this.coordinates.length,this.declutterGroup_),r=a}this.endGeometry(t,i)}else{var g=this.getImage(this.text_,this.textKey_,this.fillKey_,this.strokeKey_),_=g.width/this.pixelRatio;switch(e){case"Point":case"MultiPoint":a=(o=t.getFlatCoordinates()).length;break;case"LineString":o=t.getFlatMidpoint();break;case"Circle":o=t.getCenter();break;case"MultiLineString":a=(o=t.getFlatMidpoints()).length;break;case"Polygon":if(o=t.getFlatInteriorPoint(),!s.overflow&&o[2]/this.resolution<_)return;u=3;break;case"MultiPolygon":var w=t.getFlatInteriorPoints();for(o=[],h=0,n=w.length;h<n;h+=3)(s.overflow||w[h+2]/this.resolution>=_)&&o.push(w[h],w[h+1]);if(0==(a=o.length))return}a=this.appendFlatCoordinates(o,0,a,u,!1,!1),this.beginGeometry(t,i),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),this.updateFillStyle(this.state,this.applyFill,t),this.updateStrokeStyle(this.state,this.applyStroke)),this.drawTextImage_(g,r,a),this.endGeometry(t,i)}}},Qh.prototype.getImage=function(t,i,s,h){var n,r=h+i+t+s+this.pixelRatio,e=vh.labelCache;if(!e.containsKey(r)){var o=h?this.strokeStates[h]||this.textStrokeState_:null,a=s?this.fillStates[s]||this.textFillState_:null,u=this.textStates[i]||this.textState_,f=u.scale*this.pixelRatio,c=Yh.TEXT_ALIGN[u.textAlign||vh.defaultTextAlign],l=h&&o.lineWidth?o.lineWidth:0,v=t.split("\n"),d=v.length,M=[],m=Qh.measureTextWidths(u.font,v,M),p=vh.measureTextHeight(u.font),g=p*d,_=Cs(Math.ceil((m+l)*f),Math.ceil((g+l)*f));e.set(r,n=_.canvas),1!=f&&_.scale(f,f),_.font=u.font,h&&(_.strokeStyle=o.strokeStyle,_.lineWidth=l*(ts.SAFARI?f:1),_.lineCap=o.lineCap,_.lineJoin=o.lineJoin,_.miterLimit=o.miterLimit,ts.CANVAS_LINE_DASH&&o.lineDash.length&&(_.setLineDash(o.lineDash),_.lineDashOffset=o.lineDashOffset)),s&&(_.fillStyle=a.fillStyle),_.textBaseline="middle",_.textAlign="center";var w,y=.5-c,b=c*n.width/f+y*l;if(h)for(w=0;w<d;++w)_.strokeText(v[w],b+y*M[w],.5*(l+p)+w*p);if(s)for(w=0;w<d;++w)_.fillText(v[w],b+y*M[w],.5*(l+p)+w*p)}return e.get(r)},Qh.prototype.drawTextImage_=function(t,i,s){var h=this.textState_,n=this.textStrokeState_,r=this.pixelRatio,e=Yh.TEXT_ALIGN[h.textAlign||vh.defaultTextAlign],o=Yh.TEXT_ALIGN[h.textBaseline],a=n&&n.lineWidth?n.lineWidth:0,u=e*t.width/r+2*(.5-e)*a,f=o*t.height/r+2*(.5-o)*a;this.instructions.push([6,i,s,t,(u-this.textOffsetX_)*r,(f-this.textOffsetY_)*r,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1,!0,t.width,h.padding==vh.defaultPadding?vh.defaultPadding:h.padding.map((function(t){return t*r})),!!h.backgroundFill,!!h.backgroundStroke]),this.hitDetectionInstructions.push([6,i,s,t,(u-this.textOffsetX_)*r,(f-this.textOffsetY_)*r,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1/r,!0,t.width,h.padding,!!h.backgroundFill,!!h.backgroundStroke])},Qh.prototype.drawChars_=function(t,i,s){var h=this.textStrokeState_,n=this.textState_,r=this.textFillState_,e=this.strokeKey_;h&&(e in this.strokeStates||(this.strokeStates[e]={strokeStyle:h.strokeStyle,lineCap:h.lineCap,lineDashOffset:h.lineDashOffset,lineWidth:h.lineWidth,lineJoin:h.lineJoin,miterLimit:h.miterLimit,lineDash:h.lineDash}));var o=this.textKey_;this.textKey_ in this.textStates||(this.textStates[this.textKey_]={font:n.font,textAlign:n.textAlign||vh.defaultTextAlign,scale:n.scale});var a=this.fillKey_;r&&(a in this.fillStates||(this.fillStates[a]={fillStyle:r.fillStyle}));var u=this.pixelRatio,f=Yh.TEXT_ALIGN[n.textBaseline],c=this.textOffsetY_*u,l=this.text_,v=n.font,d=n.scale,M=h?h.lineWidth*d/2:0,m=this.widths_[v];m||(this.widths_[v]=m={}),this.instructions.push([5,t,i,f,s,n.overflow,a,n.maxAngle,function(t){var i=m[t];return i||(i=m[t]=vh.measureTextWidth(v,t)),i*d*u},c,e,M*u,l,o,1]),this.hitDetectionInstructions.push([5,t,i,f,s,n.overflow,a,n.maxAngle,function(t){var i=m[t];return i||(i=m[t]=vh.measureTextWidth(v,t)),i*d},c,e,M,l,o,1/u])},Qh.prototype.setTextStyle=function(t,i){var s,h,n;if(t){this.declutterGroup_=i;var r=t.getFill();r?((h=this.textFillState_)||(h=this.textFillState_={}),h.fillStyle=Mh.asColorLike(r.getColor()||vh.defaultFillStyle)):h=this.textFillState_=null;var e=t.getStroke();if(e){(n=this.textStrokeState_)||(n=this.textStrokeState_={});var o=e.getLineDash(),a=e.getLineDashOffset(),u=e.getWidth(),f=e.getMiterLimit();n.lineCap=e.getLineCap()||vh.defaultLineCap,n.lineDash=o?o.slice():vh.defaultLineDash,n.lineDashOffset=void 0===a?vh.defaultLineDashOffset:a,n.lineJoin=e.getLineJoin()||vh.defaultLineJoin,n.lineWidth=void 0===u?vh.defaultLineWidth:u,n.miterLimit=void 0===f?vh.defaultMiterLimit:f,n.strokeStyle=Mh.asColorLike(e.getColor()||vh.defaultStrokeStyle)}else n=this.textStrokeState_=null;s=this.textState_;var c=t.getFont()||vh.defaultFont;vh.checkFont(c);var l=t.getScale();s.overflow=t.getOverflow(),s.font=c,s.maxAngle=t.getMaxAngle(),s.placement=t.getPlacement(),s.textAlign=t.getTextAlign(),s.textBaseline=t.getTextBaseline()||vh.defaultTextBaseline,s.backgroundFill=t.getBackgroundFill(),s.backgroundStroke=t.getBackgroundStroke(),s.padding=t.getPadding()||vh.defaultPadding,s.scale=void 0===l?1:l;var v=t.getOffsetX(),d=t.getOffsetY(),M=t.getRotateWithView(),m=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===v?0:v,this.textOffsetY_=void 0===d?0:d,this.textRotateWithView_=void 0!==M&&M,this.textRotation_=void 0===m?0:m,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:ui.getUid(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=s.font+s.scale+(s.textAlign||"?"),this.fillKey_=h?"string"==typeof h.fillStyle?h.fillStyle:"|"+ui.getUid(h.fillStyle):""}else this.text_=""};var $h=function(t,i,s,h,n,r,e){Uh.call(this),this.declutterTree_=r,this.declutterGroup_=null,this.tolerance_=t,this.maxExtent_=i,this.overlaps_=n,this.pixelRatio_=h,this.resolution_=s,this.renderBuffer_=e,this.replaysByZIndex_={},this.hitDetectionContext_=Cs(1,1),this.hitDetectionTransform_=Ii.create()};ui.inherits($h,Uh),$h.circleArrayCache_={0:[[!0]]},$h.fillCircleArrayRowToMiddle_=function(t,i,s){var h,n=Math.floor(t.length/2);if(i>=n)for(h=n;h<i;h++)t[h][s]=!0;else if(i<n)for(h=i+1;h<n;h++)t[h][s]=!0},$h.getCircleArray_=function(t){if(void 0!==$h.circleArrayCache_[t])return $h.circleArrayCache_[t];for(var i=2*t+1,s=new Array(i),h=0;h<i;h++)s[h]=new Array(i);for(var n=t,r=0,e=0;n>=r;)$h.fillCircleArrayRowToMiddle_(s,t+n,t+r),$h.fillCircleArrayRowToMiddle_(s,t+r,t+n),$h.fillCircleArrayRowToMiddle_(s,t-r,t+n),$h.fillCircleArrayRowToMiddle_(s,t-n,t+r),$h.fillCircleArrayRowToMiddle_(s,t-n,t-r),$h.fillCircleArrayRowToMiddle_(s,t-r,t-n),$h.fillCircleArrayRowToMiddle_(s,t+r,t-n),$h.fillCircleArrayRowToMiddle_(s,t+n,t-r),2*((e+=1+2*++r)-n)+1>0&&(e+=1-2*(n-=1));return $h.circleArrayCache_[t]=s,s},$h.replayDeclutter=function(t,i,s){for(var h=Object.keys(t).map(Number).sort(yi.numberSafeCompareFunction),n={},r=0,e=h.length;r<e;++r)for(var o=t[h[r].toString()],a=0,u=o.length;a<u;){var f=o[a++],c=o[a++];f.replay(i,c,s,n)}},$h.prototype.addDeclutter=function(t){var i=null;return this.declutterTree_&&(t?(i=this.declutterGroup_)[4]++:(i=this.declutterGroup_=bi.createEmpty()).push(1)),i},$h.prototype.clip=function(t,i){var s=this.getClipCoords(i);t.beginPath(),t.moveTo(s[0],s[1]),t.lineTo(s[2],s[3]),t.lineTo(s[4],s[5]),t.lineTo(s[6],s[7]),t.clip()},$h.prototype.hasReplays=function(t){for(var i in this.replaysByZIndex_)for(var s=this.replaysByZIndex_[i],h=0,n=t.length;h<n;++h)if(t[h]in s)return!0;return!1},$h.prototype.finish=function(){var t;for(t in this.replaysByZIndex_){var i,s=this.replaysByZIndex_[t];for(i in s)s[i].finish()}},$h.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o,a=2*(h=Math.round(h))+1,u=Ii.compose(this.hitDetectionTransform_,h+.5,h+.5,1/i,-1/i,-s,-t[0],-t[1]),f=this.hitDetectionContext_;f.canvas.width!==a||f.canvas.height!==a?(f.canvas.width=a,f.canvas.height=a):f.clearRect(0,0,a,a),void 0!==this.renderBuffer_&&(o=bi.createEmpty(),bi.extendCoordinate(o,t),bi.buffer(o,i*(this.renderBuffer_+h),o));var c,l,v=$h.getCircleArray_(h);function d(t){for(var i=f.getImageData(0,0,a,a).data,s=0;s<a;s++)for(var h=0;h<a;h++){var n;if(v[s][h]&&i[4*(h*a+s)+3]>0)return(!c||"Image"!=l&&"Text"!=l||-1!==c.indexOf(t))&&(n=r(t)),n||void f.clearRect(0,0,a,a)}}this.declutterTree_&&(c=this.declutterTree_.all().map((function(t){return t.value})));var M,m,p,g,_,w=Object.keys(this.replaysByZIndex_).map(Number);for(w.sort(yi.numberSafeCompareFunction),M=w.length-1;M>=0;--M){var y=w[M].toString();for(p=this.replaysByZIndex_[y],m=Yh.ORDER.length-1;m>=0;--m)if(void 0!==(g=p[l=Yh.ORDER[m]]))if(!e||"Image"!=l&&"Text"!=l){if(_=g.replayHitDetection(f,u,s,n,d,o))return _}else{var b=e[y];b?b.push(g,u.slice(0)):e[y]=[g,u.slice(0)]}}},$h.prototype.getClipCoords=function(t){var i=this.maxExtent_,s=i[0],h=i[1],n=i[2],r=i[3],e=[s,h,s,r,n,r,n,h];return Ei(e,0,8,2,t,e),e},$h.prototype.getReplay=function(t,i){var s=void 0!==t?t.toString():"0",h=this.replaysByZIndex_[s];void 0===h&&(this.replaysByZIndex_[s]=h={});var n=h[i];return void 0===n&&(n=new(0,$h.BATCH_CONSTRUCTORS_[i])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_,this.overlaps_,this.declutterTree_),h[i]=n),n},$h.prototype.getReplays=function(){return this.replaysByZIndex_},$h.prototype.isEmpty=function(){return fi.isEmpty(this.replaysByZIndex_)},$h.prototype.replay=function(t,i,s,h,n,r){var e=Object.keys(this.replaysByZIndex_).map(Number);e.sort(yi.numberSafeCompareFunction),t.save(),this.clip(t,i);var o,a,u,f,c,l,v=n||Yh.ORDER;for(o=0,a=e.length;o<a;++o){var d=e[o].toString();for(c=this.replaysByZIndex_[d],u=0,f=v.length;u<f;++u){var M=v[u];if(void 0!==(l=c[M]))if(!r||"Image"!=M&&"Text"!=M)l.replay(t,i,s,h);else{var m=r[d];m?m.push(l,i.slice(0)):r[d]=[l,i.slice(0)]}}}t.restore()},$h.BATCH_CONSTRUCTORS_={Circle:Zh,Default:Bh,Image:Hh,LineString:Jh,Polygon:Zh,Text:Qh};var tn={defaultOrder:function(t,i){return ui.getUid(t)-ui.getUid(i)},getSquaredTolerance:function(t,i){var s=tn.getTolerance(t,i);return s*s},getTolerance:function(t,i){return ui.SIMPLIFY_TOLERANCE*t/i},renderCircleGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(n||r){var e=t.getReplay(s.getZIndex(),"Circle");e.setFillStrokeStyle(n,r),e.drawCircle(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}},renderFeature:function(t,i,s,h,n,r){var e,o,a=!1;return(e=s.getImage())&&(2==(o=e.getImageState())||3==o?e.unlistenImageChange(n,r):(0==o&&e.load(),o=e.getImageState(),e.listenImageChange(n,r),a=!0)),tn.renderFeature_(t,i,s,h),a},renderFeature_:function(t,i,s,h){var n=s.getGeometryFunction()(i);if(n){var r=n.getSimplifiedGeometry(h);s.getRenderer()?tn.renderGeometry_(t,r,s,i):(0,tn.GEOMETRY_RENDERERS_[r.getType()])(t,r,s,i)}},renderGeometry_:function(t,i,s,h){if("GeometryCollection"!=i.getType())t.getReplay(s.getZIndex(),"Default").drawCustom(i,h,s.getRenderer());else for(var n=i.getGeometries(),r=0,e=n.length;r<e;++r)tn.renderGeometry_(t,n[r],s,h)},renderGeometryCollectionGeometry_:function(t,i,s,h){var n,r,e=i.getGeometriesArray();for(n=0,r=e.length;n<r;++n)(0,tn.GEOMETRY_RENDERERS_[e[n].getType()])(t,e[n],s,h)},renderLineStringGeometry_:function(t,i,s,h){var n=s.getStroke();if(n){var r=t.getReplay(s.getZIndex(),"LineString");r.setFillStrokeStyle(null,n),r.drawLineString(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!1)),o.drawText(i,h)}},renderMultiLineStringGeometry_:function(t,i,s,h){var n=s.getStroke();if(n){var r=t.getReplay(s.getZIndex(),"LineString");r.setFillStrokeStyle(null,n),r.drawMultiLineString(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!1)),o.drawText(i,h)}},renderMultiPolygonGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(r||n){var e=t.getReplay(s.getZIndex(),"Polygon");e.setFillStrokeStyle(n,r),e.drawMultiPolygon(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}},renderPointGeometry_:function(t,i,s,h){var n=s.getImage();if(n){if(2!=n.getImageState())return;var r=t.getReplay(s.getZIndex(),"Image");r.setImageStyle(n,t.addDeclutter(!1)),r.drawPoint(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!!n)),o.drawText(i,h)}},renderMultiPointGeometry_:function(t,i,s,h){var n=s.getImage();if(n){if(2!=n.getImageState())return;var r=t.getReplay(s.getZIndex(),"Image");r.setImageStyle(n,t.addDeclutter(!1)),r.drawMultiPoint(i,h)}var e=s.getText();if(e){var o=t.getReplay(s.getZIndex(),"Text");o.setTextStyle(e,t.addDeclutter(!!n)),o.drawText(i,h)}},renderPolygonGeometry_:function(t,i,s,h){var n=s.getFill(),r=s.getStroke();if(n||r){var e=t.getReplay(s.getZIndex(),"Polygon");e.setFillStrokeStyle(n,r),e.drawPolygon(i,h)}var o=s.getText();if(o){var a=t.getReplay(s.getZIndex(),"Text");a.setTextStyle(o,t.addDeclutter(!1)),a.drawText(i,h)}}};tn.GEOMETRY_RENDERERS_={Point:tn.renderPointGeometry_,LineString:tn.renderLineStringGeometry_,Polygon:tn.renderPolygonGeometry_,MultiPoint:tn.renderMultiPointGeometry_,MultiLineString:tn.renderMultiLineStringGeometry_,MultiPolygon:tn.renderMultiPolygonGeometry_,GeometryCollection:tn.renderGeometryCollectionGeometry_,Circle:tn.renderCircleGeometry_};var sn=function(t){_h.call(this,t),this.declutterTree_=t.getDeclutter()?Rh(9):null,this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bi.createEmpty(),this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.context=Cs(),ci.listen(vh.labelCache,"clear",this.handleFontsChanged_,this)};ui.inherits(sn,_h),sn.handles=function(t,i){return"canvas"===t&&"VECTOR"===i.getType()},sn.create=function(t,i){return new sn(i)},sn.prototype.disposeInternal=function(){ci.unlisten(vh.labelCache,"clear",this.handleFontsChanged_,this),_h.prototype.disposeInternal.call(this)},sn.prototype.composeFrame=function(t,i,s){var h=t.extent,n=t.pixelRatio,r=i.managed?t.skippedFeatureUids:{},e=t.viewState,o=e.projection,a=e.rotation,u=o.getExtent(),f=this.getLayer().getSource(),c=this.getTransform(t,0);this.preCompose(s,t,c);var l=i.extent,v=void 0!==l;v&&this.clip(s,t,l);var d=this.replayGroup_;if(d&&!d.isEmpty()){this.declutterTree_&&this.declutterTree_.clear();var M,m=this.getLayer(),p=0,g=0,_=1!==i.opacity,w=m.hasListener("render");if(_||w){var y=s.canvas.width,b=s.canvas.height;if(a){var x=Math.round(Math.sqrt(y*y+b*b));p=(x-y)/2,g=(x-b)/2,y=b=x}this.context.canvas.width=y,this.context.canvas.height=b,M=this.context}else M=s;var E=M.globalAlpha;_||(M.globalAlpha=i.opacity),M!=s&&M.translate(p,g);var S=t.size[0]*n,C=t.size[1]*n;if(vh.rotateAtOffset(M,-a,S/2,C/2),d.replay(M,c,a,r),f.getWrapX()&&o.canWrapX()&&!bi.containsExtent(u,h)){for(var A=h[0],P=bi.getWidth(u),R=0;A<u[0];)--R,c=this.getTransform(t,P*R),d.replay(M,c,a,r),A+=P;for(R=0,A=h[2];A>u[2];)++R,c=this.getTransform(t,P*R),d.replay(M,c,a,r),A-=P;c=this.getTransform(t,0)}if(vh.rotateAtOffset(M,a,S/2,C/2),M!=s){if(w&&this.dispatchRenderEvent(M,t,c),_){var N=s.globalAlpha;s.globalAlpha=i.opacity,s.drawImage(M.canvas,-p,-g),s.globalAlpha=N}else s.drawImage(M.canvas,-p,-g);M.translate(-p,-g)}_||(M.globalAlpha=E)}v&&s.restore(),this.postCompose(s,t,i,c)},sn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){if(this.replayGroup_){var r=i.viewState.resolution,e=i.viewState.rotation,o=this.getLayer(),a={};return this.replayGroup_.forEachFeatureAtCoordinate(t,r,e,s,{},(function(t){var i=ui.getUid(t).toString();if(!(i in a))return a[i]=!0,h.call(n,t,o)}),null)}},sn.prototype.handleFontsChanged_=function(){var t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()},sn.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},sn.prototype.prepareFrame=function(t){var i=this.getLayer(),s=i.getSource();this.updateLogos(t,s);var h=t.viewHints[0],n=t.viewHints[1],r=i.getUpdateWhileAnimating(),e=i.getUpdateWhileInteracting();if(!this.dirty_&&!r&&h||!e&&n)return!0;var o=t.extent,a=t.viewState,u=a.projection,f=a.resolution,c=t.pixelRatio,l=i.getRevision(),v=i.getRenderBuffer(),d=i.getRenderOrder();void 0===d&&(d=tn.defaultOrder);var M=bi.buffer(o,v*f),m=a.projection.getExtent();if(s.getWrapX()&&a.projection.canWrapX()&&!bi.containsExtent(m,t.extent)){var p=bi.getWidth(m),g=Math.max(bi.getWidth(M)/2,p);M[0]=m[0]-g,M[2]=m[2]+g}if(!this.dirty_&&this.renderedResolution_==f&&this.renderedRevision_==l&&this.renderedRenderOrder_==d&&bi.containsExtent(this.renderedExtent_,M))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var _=new $h(tn.getTolerance(f,c),M,f,c,s.getOverlaps(),this.declutterTree_,i.getRenderBuffer());s.loadFeatures(M,f,u);var w=function(t){var s,h=t.getStyleFunction();if(h?s=h.call(t,f):(h=i.getStyleFunction())&&(s=h(t,f)),s){var n=this.renderFeature(t,f,c,s,_);this.dirty_=this.dirty_||n}}.bind(this);if(d){var y=[];s.forEachFeatureInExtent(M,(function(t){y.push(t)}),this),y.sort(d);for(var b=0,x=y.length;b<x;++b)w(y[b])}else s.forEachFeatureInExtent(M,w,this);return _.finish(),this.renderedResolution_=f,this.renderedRevision_=l,this.renderedRenderOrder_=d,this.renderedExtent_=M,this.replayGroup_=_,this.replayGroupChanged=!0,!0},sn.prototype.renderFeature=function(t,i,s,h,n){if(!h)return!1;var r=!1;if(Array.isArray(h))for(var e=0,o=h.length;e<o;++e)r=tn.renderFeature(n,t,h[e],tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;else r=tn.renderFeature(n,t,h,tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this);return r};var hn=function(t){this.context=null,Ah.call(this,t),this.declutterTree_=t.getDeclutter()?Rh(9):null,this.dirty_=!1,this.tmpTransform_=Ii.create(),this.zDirection="vector"==t.getRenderMode()?1:0,ci.listen(vh.labelCache,"clear",this.handleFontsChanged_,this)};ui.inherits(hn,Ah),hn.handles=function(t,i){return"canvas"===t&&"VECTOR_TILE"===i.getType()},hn.create=function(t,i){return new hn(i)},hn.IMAGE_REPLAYS={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"]},hn.VECTOR_REPLAYS={image:["Default"],hybrid:["Image","Text","Default"],vector:Yh.ORDER},hn.prototype.disposeInternal=function(){ci.unlisten(vh.labelCache,"clear",this.handleFontsChanged_,this),Ah.prototype.disposeInternal.call(this)},hn.prototype.prepareFrame=function(t,i){var s=this.getLayer(),h=s.getRevision();if(this.renderedLayerRevision_!=h){this.renderedTiles.length=0;var n=s.getRenderMode();this.context||"vector"==n||(this.context=Cs()),this.context&&"vector"==n&&(this.context=null)}return this.renderedLayerRevision_=h,Ah.prototype.prepareFrame.apply(this,arguments)},hn.prototype.createReplayGroup_=function(t,i){var s=this.getLayer(),h=i.pixelRatio,n=i.viewState.projection,r=s.getRevision(),e=s.getRenderOrder()||null,o=t.getReplayState(s);if(o.dirty||o.renderedRevision!=r||o.renderedRenderOrder!=e){for(var a=s.getSource(),u=a.getTileGrid(),f=a.getTileGridForProjection(n),c=f.getResolution(t.tileCoord[0]),l=f.getTileCoordExtent(t.wrappedTileCoord),v=0,d=t.tileKeys.length;v<d;++v){var M=t.getTile(t.tileKeys[v]);if(3!=M.getState()){var m=u.getTileCoordExtent(M.tileCoord),p=bi.getIntersection(l,m),g=bi.equals(m,p)?null:bi.buffer(p,s.getRenderBuffer()*c),_=M.getProjection(),w=!1;Li.equivalent(n,_)||(w=!0,M.setProjection(n)),o.dirty=!1;var y,b=new $h(0,p,c,h,a.getOverlaps(),this.declutterTree_,s.getRenderBuffer()),x=tn.getSquaredTolerance(c,h),E=function(t){var i,h=t.getStyleFunction();if(h?i=h.call(t,c):(h=s.getStyleFunction())&&(i=h(t,c)),i){var n=this.renderFeature(t,x,i,b);this.dirty_=this.dirty_||n,o.dirty=o.dirty||n}},S=M.getFeatures();e&&e!==o.renderedRenderOrder&&S.sort(e);for(var C=0,A=S.length;C<A;++C)y=S[C],w&&(_.getUnits()==Pi.TILE_PIXELS&&(_.setWorldExtent(m),_.setExtent(M.getExtent())),y.getGeometry().transform(_,n)),g&&!bi.intersects(g,y.getGeometry().getExtent())||E.call(this,y);for(var P in b.finish(),b.getReplays());M.setReplayGroup(s,t.tileCoord.toString(),b)}}o.renderedRevision=r,o.renderedRenderOrder=e}},hn.prototype.drawTileImage=function(t,i,s,h,n,r,e,o,a){var u=t;this.createReplayGroup_(u,i),this.context&&(this.renderTileImage_(u,i,s),Ah.prototype.drawTileImage.apply(this,arguments))},hn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=i.viewState.resolution,e=i.viewState.rotation;s=null==s?0:s;var o,a,u,f,c,l,v,d=this.getLayer(),M={},m=this.renderedTiles,p=d.getSource().getTileGridForProjection(i.viewState.projection);for(u=0,f=m.length;u<f;++u)if(v=p.getTileCoordExtent((l=m[u]).wrappedTileCoord,this.tmpExtent),o=bi.buffer(v,s*r,o),bi.containsCoordinate(o,t))for(var g=0,_=l.tileKeys.length;g<_;++g){var w=l.getTile(l.tileKeys[g]);3!=w.getState()&&(c=w.getReplayGroup(d,l.tileCoord.toString()),a=a||c.forEachFeatureAtCoordinate(t,r,e,s,{},(function(t){var i=ui.getUid(t).toString();if(!(i in M))return M[i]=!0,h.call(n,t,d)}),null))}return a},hn.prototype.getReplayTransform_=function(t,i){var s=this.getLayer().getSource().getTileGrid(),h=t.tileCoord,n=s.getResolution(h[0]),r=i.viewState,e=i.pixelRatio,o=r.resolution/e,a=s.getTileCoordExtent(h,this.tmpExtent),u=r.center,f=bi.getTopLeft(a),c=i.size,l=Math.round(e*c[0]/2),v=Math.round(e*c[1]/2);return Ii.compose(this.tmpTransform_,l,v,n/o,n/o,r.rotation,(f[0]-u[0])/n,(u[1]-f[1])/n)},hn.prototype.handleFontsChanged_=function(){var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},hn.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},hn.prototype.postCompose=function(t,i,s){var h,n,r=this.getLayer(),e=r.getDeclutter()?{}:null,o=r.getSource(),a=r.getRenderMode(),u=hn.VECTOR_REPLAYS[a],f=i.pixelRatio,c=i.viewState.rotation,l=i.size;c&&(h=Math.round(f*l[0]/2),n=Math.round(f*l[1]/2),vh.rotateAtOffset(t,-c,h,n)),e&&this.declutterTree_.clear();for(var v=this.renderedTiles,d=o.getTileGridForProjection(i.viewState.projection),M=[],m=[],p=v.length-1;p>=0;--p){var g=v[p];if(5!=g.getState())for(var _=g.tileCoord,w=d.getTileCoordExtent(_)[0]-d.getTileCoordExtent(g.wrappedTileCoord)[0],y=void 0,b=0,x=g.tileKeys.length;b<x;++b){var E=g.getTile(g.tileKeys[b]);if(3!=E.getState()){var S=E.getReplayGroup(r,_.toString());if("vector"==a||S.hasReplays(u)){y||(y=this.getTransform(i,w));var C=E.tileCoord[0],A=S.getClipCoords(y);t.save(),t.globalAlpha=s.opacity;for(var P=0,R=M.length;P<R;++P){var N=M[P];C<m[P]&&(t.beginPath(),t.moveTo(A[0],A[1]),t.lineTo(A[2],A[3]),t.lineTo(A[4],A[5]),t.lineTo(A[6],A[7]),t.moveTo(N[6],N[7]),t.lineTo(N[4],N[5]),t.lineTo(N[2],N[3]),t.lineTo(N[0],N[1]),t.clip())}S.replay(t,y,c,{},u,e),t.restore(),M.push(A),m.push(C)}}}}e&&$h.replayDeclutter(e,t,c),c&&vh.rotateAtOffset(t,c,h,n),Ah.prototype.postCompose.apply(this,arguments)},hn.prototype.renderFeature=function(t,i,s,h){if(!s)return!1;var n=!1;if(Array.isArray(s))for(var r=0,e=s.length;r<e;++r)n=tn.renderFeature(h,t,s[r],i,this.handleStyleImageChange_,this)||n;else n=tn.renderFeature(h,t,s,i,this.handleStyleImageChange_,this);return n},hn.prototype.renderTileImage_=function(t,i){var s=this.getLayer(),h=t.getReplayState(s),n=s.getRevision(),r=hn.IMAGE_REPLAYS[s.getRenderMode()];if(r&&h.renderedTileRevision!==n){h.renderedTileRevision=n;var e=t.wrappedTileCoord,o=e[0],a=i.pixelRatio,u=s.getSource(),f=u.getTileGridForProjection(i.viewState.projection),c=f.getResolution(o),l=t.getContext(s),v=u.getTilePixelSize(o,a,i.viewState.projection);l.canvas.width=v[0],l.canvas.height=v[1];for(var d=f.getTileCoordExtent(e),M=0,m=t.tileKeys.length;M<m;++M){var p=t.getTile(t.tileKeys[M]);if(3!=p.getState()){var g=a/c,_=Ii.reset(this.tmpTransform_);Ii.scale(_,g,-g),Ii.translate(_,-d[0],-d[3]),p.getReplayGroup(s,t.tileCoord.toString()).replay(l,_,0,{},r)}}}};var nn=function(t){this.source_=t};nn.prototype.getType=function(){},nn.prototype.getSource=function(){return this.source_},nn.prototype.isAnimated=xi.FALSE;var rn=function(t){nn.call(this,t)};ui.inherits(rn,nn),rn.prototype.getType=function(){return $i.FRAGMENT_SHADER};var en=function(t){nn.call(this,t)};ui.inherits(en,nn),en.prototype.getType=function(){return $i.VERTEX_SHADER};var on={};on.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_fillColor;\nuniform vec4 u_strokeColor;\nuniform vec2 u_size;\n\nvoid main(void) {\n vec2 windowCenter = vec2((v_center.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_center.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n vec2 windowOffset = vec2((v_offset.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_offset.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n float radius = length(windowCenter - windowOffset);\n float dist = length(windowCenter - gl_FragCoord.xy);\n if (dist > radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n":"precision mediump float;varying vec2 a;varying vec2 b;varying float c;varying float d;uniform float m;uniform vec4 n;uniform vec4 o;uniform vec2 p;void main(void){vec2 windowCenter=vec2((a.x+1.0)/2.0*p.x*d,(a.y+1.0)/2.0*p.y*d);vec2 windowOffset=vec2((b.x+1.0)/2.0*p.x*d,(b.y+1.0)/2.0*p.y*d);float radius=length(windowCenter-windowOffset);float dist=length(windowCenter-gl_FragCoord.xy);if(dist>radius+c){if(o.a==0.0){gl_FragColor=n;}else{gl_FragColor=o;}gl_FragColor.a=gl_FragColor.a-(dist-(radius+c));}else if(n.a==0.0){gl_FragColor=o;if(dist<radius-c){gl_FragColor.a=gl_FragColor.a-(radius-c-dist);}} else{gl_FragColor=n;float strokeDist=radius-c;float antialias=2.0*d;if(dist>strokeDist){gl_FragColor=o;}else if(dist>=strokeDist-antialias){float step=smoothstep(strokeDist-antialias,strokeDist,dist);gl_FragColor=mix(n,o,step);}} gl_FragColor.a=gl_FragColor.a*m;if(gl_FragColor.a<=0.0){discard;}}"),on.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n":"varying vec2 a;varying vec2 b;varying float c;varying float d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;void main(void){mat4 offsetMatrix=i*j;a=vec4(h*vec4(e,0.0,1.0)).xy;d=l;float lineWidth=k*l;c=lineWidth/2.0;if(lineWidth==0.0){lineWidth=2.0*l;}vec2 offset;float radius=g+3.0*l;//Until we get gl_VertexID in WebGL,we store an instruction.if(f==0.0){//Offsetting the edges of the triangle by lineWidth/2 is necessary,however//we should also leave some space for the antialiasing,thus we offset by lineWidth.offset=vec2(-1.0,1.0);}else if(f==1.0){offset=vec2(-1.0,-1.0);}else if(f==2.0){offset=vec2(1.0,-1.0);}else{offset=vec2(1.0,1.0);}gl_Position=h*vec4(e+offset*radius,0.0,1.0)+offsetMatrix*vec4(offset*lineWidth,0.0,0.0);b=vec4(h*vec4(e.x+g,e.y,0.0,1.0)).xy;if(distance(a,b)>20000.0){gl_Position=vec4(a,0.0,1.0);}}");var an=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_lineWidth=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_lineWidth":"k"),this.u_pixelRatio=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_pixelRatio":"l"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"m"),this.u_fillColor=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_fillColor":"n"),this.u_strokeColor=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_strokeColor":"o"),this.u_size=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_size":"p"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"e"),this.a_instruction=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_instruction":"f"),this.a_radius=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_radius":"g")},un=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},fn=function(t,i){return t[0]=i[0],t[1]=i[1],t[4]=i[2],t[5]=i[3],t[12]=i[4],t[13]=i[5],t},cn=function(t,i){mh.call(this),this.tolerance=t,this.maxExtent=i,this.origin=bi.getCenter(i),this.projectionMatrix_=Ii.create(),this.offsetRotateMatrix_=Ii.create(),this.offsetScaleMatrix_=Ii.create(),this.tmpMat4_=un(),this.indices=[],this.indicesBuffer=null,this.startIndices=[],this.startIndicesFeature=[],this.vertices=[],this.verticesBuffer=null,this.lineStringReplay=void 0};ui.inherits(cn,mh),cn.prototype.getDeleteResourcesFunction=function(){},cn.prototype.finish=function(){},cn.prototype.setUpProgram=function(){},cn.prototype.shutDownProgram=function(){},cn.prototype.drawReplay=function(){},cn.prototype.drawHitDetectionReplayOneByOne=function(){},cn.prototype.drawHitDetectionReplay=function(t,i,s,h,n,r){return n?this.drawHitDetectionReplayOneByOne(t,i,s,h,r):this.drawHitDetectionReplayAll(t,i,s,h)},cn.prototype.drawHitDetectionReplayAll=function(t,i,s,h){return t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawReplay(t,i,s,!0),h(null)||void 0},cn.prototype.replay=function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v,d,M,m,p,g,_=t.getGL();this.lineStringReplay&&(c=_.isEnabled(_.STENCIL_TEST),l=_.getParameter(_.STENCIL_FUNC),v=_.getParameter(_.STENCIL_VALUE_MASK),d=_.getParameter(_.STENCIL_REF),M=_.getParameter(_.STENCIL_WRITEMASK),m=_.getParameter(_.STENCIL_FAIL),p=_.getParameter(_.STENCIL_PASS_DEPTH_PASS),g=_.getParameter(_.STENCIL_PASS_DEPTH_FAIL),_.enable(_.STENCIL_TEST),_.clear(_.STENCIL_BUFFER_BIT),_.stencilMask(255),_.stencilFunc(_.ALWAYS,1,255),_.stencilOp(_.KEEP,_.KEEP,_.REPLACE),this.lineStringReplay.replay(t,i,s,h,n,r,e,o,a,u,f),_.stencilMask(0),_.stencilFunc(_.NOTEQUAL,1,255)),t.bindBuffer($i.ARRAY_BUFFER,this.verticesBuffer),t.bindBuffer($i.ELEMENT_ARRAY_BUFFER,this.indicesBuffer);var w=this.setUpProgram(_,t,n,r),y=Ii.reset(this.projectionMatrix_);Ii.scale(y,2/(s*n[0]),2/(s*n[1])),Ii.rotate(y,-h),Ii.translate(y,-(i[0]-this.origin[0]),-(i[1]-this.origin[1]));var b=Ii.reset(this.offsetScaleMatrix_);Ii.scale(b,2/n[0],2/n[1]);var x,E=Ii.reset(this.offsetRotateMatrix_);return 0!==h&&Ii.rotate(E,-h),_.uniformMatrix4fv(w.u_projectionMatrix,!1,fn(this.tmpMat4_,y)),_.uniformMatrix4fv(w.u_offsetScaleMatrix,!1,fn(this.tmpMat4_,b)),_.uniformMatrix4fv(w.u_offsetRotateMatrix,!1,fn(this.tmpMat4_,E)),_.uniform1f(w.u_opacity,e),void 0===a?this.drawReplay(_,t,o,!1):x=this.drawHitDetectionReplay(_,t,o,a,u,f),this.shutDownProgram(_,w),this.lineStringReplay&&(c||_.disable(_.STENCIL_TEST),_.clear(_.STENCIL_BUFFER_BIT),_.stencilFunc(l,d,v),_.stencilMask(M),_.stencilOp(m,g,p)),x},cn.prototype.drawElements=function(t,i,s,h){t.drawElements($i.TRIANGLES,h-s,i.hasOESElementIndexUint?$i.UNSIGNED_INT:$i.UNSIGNED_SHORT,s*(i.hasOESElementIndexUint?4:2))};var ln={defaultFont:"10px sans-serif",defaultFillStyle:[0,0,0,1],defaultLineCap:"round",defaultLineDash:[],defaultLineDashOffset:0,defaultLineJoin:"round",defaultMiterLimit:10,defaultStrokeStyle:[0,0,0,1],defaultTextAlign:.5,defaultTextBaseline:.5,defaultLineWidth:1,triangleIsCounterClockwise:function(t,i,s,h,n,r){var e=(s-t)*(r-i)-(n-t)*(h-i);return e<=ln.EPSILON&&e>=-ln.EPSILON?void 0:e>0}};ln.EPSILON=Number.EPSILON||2220446049250313e-31;var vn=function(t,i){this.arr_=void 0!==t?t:[],this.usage_=void 0!==i?i:vn.Usage_.STATIC_DRAW};vn.prototype.getArray=function(){return this.arr_},vn.prototype.getUsage=function(){return this.usage_},vn.Usage_={STATIC_DRAW:$i.STATIC_DRAW,STREAM_DRAW:$i.STREAM_DRAW,DYNAMIC_DRAW:$i.DYNAMIC_DRAW};var dn=function(t,i){cn.call(this,t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.radius_=0,this.state_={fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:void 0,lineWidth:void 0,changed:!1}};ui.inherits(dn,cn),dn.prototype.drawCoordinates_=function(t,i,s,h){var n,r,e=this.vertices.length,o=this.indices.length,a=e/4;for(n=i,r=s;n<r;n+=h)this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=0,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=1,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=2,this.vertices[e++]=this.radius_,this.vertices[e++]=t[n],this.vertices[e++]=t[n+1],this.vertices[e++]=3,this.vertices[e++]=this.radius_,this.indices[o++]=a,this.indices[o++]=a+1,this.indices[o++]=a+2,this.indices[o++]=a+2,this.indices[o++]=a+3,this.indices[o++]=a,a+=4},dn.prototype.drawCircle=function(t,i){var s=t.getRadius(),h=t.getStride();if(s){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.radius_=s;var n=t.getFlatCoordinates();n=Ai(n,0,2,h,-this.origin[0],-this.origin[1]),this.drawCoordinates_(n,0,2,h)}else if(this.state_.changed&&(this.styles_.pop(),this.styles_.length)){var r=this.styles_[this.styles_.length-1];this.state_.fillColor=r[0],this.state_.strokeColor=r[1],this.state_.lineWidth=r[2],this.state_.changed=!1}},dn.prototype.finish=function(){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},dn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer;return function(){t.deleteBuffer(i),t.deleteBuffer(s)}},dn.prototype.setUpProgram=function(t,i,s,h){var n,r=i.getProgram(on.fragment,on.vertex);return this.defaultLocations_?n=this.defaultLocations_:(n=new an(t,r),this.defaultLocations_=n),i.useProgram(r),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,$i.FLOAT,!1,16,0),t.enableVertexAttribArray(n.a_instruction),t.vertexAttribPointer(n.a_instruction,1,$i.FLOAT,!1,16,8),t.enableVertexAttribArray(n.a_radius),t.vertexAttribPointer(n.a_radius,1,$i.FLOAT,!1,16,12),t.uniform2fv(n.u_size,s),t.uniform1f(n.u_pixelRatio,h),n},dn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_instruction),t.disableVertexAttribArray(i.a_radius)},dn.prototype.drawReplay=function(t,i,s){var h,n,r,e;if(fi.isEmpty(s))for(r=this.startIndices[this.startIndices.length-1],h=this.styleIndices_.length-1;h>=0;--h)n=this.styleIndices_[h],this.setFillStyle_(t,(e=this.styles_[h])[0]),this.setStrokeStyle_(t,e[1],e[2]),this.drawElements(t,i,n,r),r=n;else this.drawReplaySkipping_(t,i,s)},dn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f,c;for(o=this.startIndices[1+(c=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setFillStyle_(t,(a=this.styles_[r])[0]),this.setStrokeStyle_(t,a[1],a[2]),u=this.styleIndices_[r];c>=0&&this.startIndices[c]>=u;){if(e=this.startIndices[c],void 0===s[ui.getUid(f=this.startIndicesFeature[c]).toString()]&&f.getGeometry()&&(void 0===n||bi.intersects(n,f.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var l=h(f);if(l)return l}c--,o=e}},dn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a,u;for(r=n=this.startIndices[1+(a=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setFillStyle_(t,(e=this.styles_[h])[0]),this.setStrokeStyle_(t,e[1],e[2]),o=this.styleIndices_[h];a>=0&&this.startIndices[a]>=o;)u=this.startIndices[a],s[ui.getUid(this.startIndicesFeature[a]).toString()]&&(n!==r&&this.drawElements(t,i,n,r),r=u),a--,n=u;n!==r&&this.drawElements(t,i,n,r),n=r=o}},dn.prototype.setFillStyle_=function(t,i){t.uniform4fv(this.defaultLocations_.u_fillColor,i)},dn.prototype.setStrokeStyle_=function(t,i,s){t.uniform4fv(this.defaultLocations_.u_strokeColor,i),t.uniform1f(this.defaultLocations_.u_lineWidth,s)},dn.prototype.setFillStrokeStyle=function(t,i){var s,h;if(i){var n=i.getLineDash();this.state_.lineDash=n||ln.defaultLineDash;var r=i.getLineDashOffset();this.state_.lineDashOffset=r||ln.defaultLineDashOffset,s=(s=i.getColor())instanceof CanvasGradient||s instanceof CanvasPattern?ln.defaultStrokeStyle:dh.asArray(s).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultStrokeStyle,h=void 0!==(h=i.getWidth())?h:ln.defaultLineWidth}else s=[0,0,0,0],h=0;var e=t?t.getColor():[0,0,0,0];e=e instanceof CanvasGradient||e instanceof CanvasPattern?ln.defaultFillStyle:dh.asArray(e).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultFillStyle,this.state_.strokeColor&&yi.equals(this.state_.strokeColor,s)&&this.state_.fillColor&&yi.equals(this.state_.fillColor,e)&&this.state_.lineWidth===h||(this.state_.changed=!0,this.state_.fillColor=e,this.state_.strokeColor=s,this.state_.lineWidth=h,this.styles_.push([e,s,h]))};var Mn={};Mn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),Mn.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n":"varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.0,0.0);gl_Position=h*vec4(c,0.0,1.0)+offsets;a=d;b=f;}");var mn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"k"),this.u_image=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_image":"l"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"c"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"d"),this.a_offsets=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_offsets":"e"),this.a_opacity=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_opacity":"f"),this.a_rotateWithView=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_rotateWithView":"g")},pn=function(t,i){this.canvas_=t,this.gl_=i,this.bufferCache_={},this.shaderCache_={},this.programCache_={},this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null,this.hasOESElementIndexUint=yi.includes(ui.WEBGL_EXTENSIONS,"OES_element_index_uint"),this.hasOESElementIndexUint&&i.getExtension("OES_element_index_uint"),ci.listen(this.canvas_,"webglcontextlost",this.handleWebGLContextLost,this),ci.listen(this.canvas_,"webglcontextrestored",this.handleWebGLContextRestored,this)};ui.inherits(pn,li),pn.prototype.bindBuffer=function(t,i){var s=this.getGL(),h=i.getArray(),n=String(ui.getUid(i));if(n in this.bufferCache_)s.bindBuffer(t,this.bufferCache_[n].buffer);else{var r,e=s.createBuffer();s.bindBuffer(t,e),t==$i.ARRAY_BUFFER?r=new Float32Array(h):t==$i.ELEMENT_ARRAY_BUFFER&&(r=this.hasOESElementIndexUint?new Uint32Array(h):new Uint16Array(h)),s.bufferData(t,r,i.getUsage()),this.bufferCache_[n]={buf:i,buffer:e}}},pn.prototype.deleteBuffer=function(t){var i=this.getGL(),s=String(ui.getUid(t)),h=this.bufferCache_[s];i.isContextLost()||i.deleteBuffer(h.buffer),delete this.bufferCache_[s]},pn.prototype.disposeInternal=function(){ci.unlistenAll(this.canvas_);var t=this.getGL();if(!t.isContextLost()){var i;for(i in this.bufferCache_)t.deleteBuffer(this.bufferCache_[i].buffer);for(i in this.programCache_)t.deleteProgram(this.programCache_[i]);for(i in this.shaderCache_)t.deleteShader(this.shaderCache_[i]);t.deleteFramebuffer(this.hitDetectionFramebuffer_),t.deleteRenderbuffer(this.hitDetectionRenderbuffer_),t.deleteTexture(this.hitDetectionTexture_)}},pn.prototype.getCanvas=function(){return this.canvas_},pn.prototype.getGL=function(){return this.gl_},pn.prototype.getHitDetectionFramebuffer=function(){return this.hitDetectionFramebuffer_||this.initHitDetectionFramebuffer_(),this.hitDetectionFramebuffer_},pn.prototype.getShader=function(t){var i=String(ui.getUid(t));if(i in this.shaderCache_)return this.shaderCache_[i];var s=this.getGL(),h=s.createShader(t.getType());return s.shaderSource(h,t.getSource()),s.compileShader(h),this.shaderCache_[i]=h,h},pn.prototype.getProgram=function(t,i){var s=ui.getUid(t)+"/"+ui.getUid(i);if(s in this.programCache_)return this.programCache_[s];var h=this.getGL(),n=h.createProgram();return h.attachShader(n,this.getShader(t)),h.attachShader(n,this.getShader(i)),h.linkProgram(n),this.programCache_[s]=n,n},pn.prototype.handleWebGLContextLost=function(){fi.clear(this.bufferCache_),fi.clear(this.shaderCache_),fi.clear(this.programCache_),this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null},pn.prototype.handleWebGLContextRestored=function(){},pn.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_,i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i);var s=pn.createEmptyTexture(t,1,1),h=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,h),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,h),t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.hitDetectionFramebuffer_=i,this.hitDetectionTexture_=s,this.hitDetectionRenderbuffer_=h},pn.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,!0)},pn.createTexture_=function(t,i,s){var h=t.createTexture();return t.bindTexture(t.TEXTURE_2D,h),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),void 0!==i&&t.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_S,i),void 0!==s&&t.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_T,s),h},pn.createEmptyTexture=function(t,i,s,h,n){var r=pn.createTexture_(t,h,n);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,i,s,0,t.RGBA,t.UNSIGNED_BYTE,null),r},pn.createTexture=function(t,i,s,h){var n=pn.createTexture_(t,s,h);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),n};var gn=function(t,i){cn.call(this,t,i),this.anchorX=void 0,this.anchorY=void 0,this.groupIndices=[],this.hitDetectionGroupIndices=[],this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.defaultLocations=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.width=void 0};ui.inherits(gn,cn),gn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer,h=this.getTextures(!0),n=t.getGL();return function(){var r,e;if(!n.isContextLost())for(r=0,e=h.length;r<e;++r)n.deleteTexture(h[r]);t.deleteBuffer(i),t.deleteBuffer(s)}},gn.prototype.drawCoordinates=function(t,i,s,h){var n,r,e,o,a,u,f=this.anchorX,c=this.anchorY,l=this.height,v=this.imageHeight,d=this.imageWidth,M=this.opacity,m=this.originX,p=this.originY,g=this.rotateWithView?1:0,_=-this.rotation,w=this.scale,y=this.width,b=Math.cos(_),x=Math.sin(_),E=this.indices.length,S=this.vertices.length;for(n=i;n<s;n+=h)u=t[n+1]-this.origin[1],r=S/8,e=-w*f,o=-w*(l-c),this.vertices[S++]=a=t[n]-this.origin[0],this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=m/d,this.vertices[S++]=(p+l)/v,this.vertices[S++]=M,this.vertices[S++]=g,e=w*(y-f),o=-w*(l-c),this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=(m+y)/d,this.vertices[S++]=(p+l)/v,this.vertices[S++]=M,this.vertices[S++]=g,e=w*(y-f),o=w*c,this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=(m+y)/d,this.vertices[S++]=p/v,this.vertices[S++]=M,this.vertices[S++]=g,e=-w*f,o=w*c,this.vertices[S++]=a,this.vertices[S++]=u,this.vertices[S++]=e*b-o*x,this.vertices[S++]=e*x+o*b,this.vertices[S++]=m/d,this.vertices[S++]=p/v,this.vertices[S++]=M,this.vertices[S++]=g,this.indices[E++]=r,this.indices[E++]=r+1,this.indices[E++]=r+2,this.indices[E++]=r,this.indices[E++]=r+2,this.indices[E++]=r+3;return S},gn.prototype.createTextures=function(t,i,s,h){var n,r,e,o,a=i.length;for(o=0;o<a;++o)(e=ui.getUid(r=i[o]).toString())in s?n=s[e]:(n=pn.createTexture(h,r,$i.CLAMP_TO_EDGE,$i.CLAMP_TO_EDGE),s[e]=n),t[o]=n},gn.prototype.setUpProgram=function(t,i){var s,h=i.getProgram(Mn.fragment,Mn.vertex);return this.defaultLocations?s=this.defaultLocations:(s=new mn(t,h),this.defaultLocations=s),i.useProgram(h),t.enableVertexAttribArray(s.a_position),t.vertexAttribPointer(s.a_position,2,$i.FLOAT,!1,32,0),t.enableVertexAttribArray(s.a_offsets),t.vertexAttribPointer(s.a_offsets,2,$i.FLOAT,!1,32,8),t.enableVertexAttribArray(s.a_texCoord),t.vertexAttribPointer(s.a_texCoord,2,$i.FLOAT,!1,32,16),t.enableVertexAttribArray(s.a_opacity),t.vertexAttribPointer(s.a_opacity,1,$i.FLOAT,!1,32,24),t.enableVertexAttribArray(s.a_rotateWithView),t.vertexAttribPointer(s.a_rotateWithView,1,$i.FLOAT,!1,32,28),s},gn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_offsets),t.disableVertexAttribArray(i.a_texCoord),t.disableVertexAttribArray(i.a_opacity),t.disableVertexAttribArray(i.a_rotateWithView)},gn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o=h?this.getHitDetectionTextures():this.getTextures(),a=h?this.hitDetectionGroupIndices:this.groupIndices;if(fi.isEmpty(s))for(n=0,r=o.length,e=0;n<r;++n){t.bindTexture($i.TEXTURE_2D,o[n]);var u=a[n];this.drawElements(t,i,e,u),e=u}else this.drawReplaySkipping(t,i,s,o,a)},gn.prototype.drawReplaySkipping=function(t,i,s,h,n){var r,e,o=0;for(r=0,e=h.length;r<e;++r){t.bindTexture($i.TEXTURE_2D,h[r]);for(var a=r>0?n[r-1]:0,u=n[r],f=a,c=a;o<this.startIndices.length&&this.startIndices[o]<=u;)void 0!==s[ui.getUid(this.startIndicesFeature[o]).toString()]?(f!==c&&this.drawElements(t,i,f,c),c=f=o===this.startIndices.length-1?u:this.startIndices[o+1]):c=o===this.startIndices.length-1?u:this.startIndices[o+1],o++;f!==c&&this.drawElements(t,i,f,c)}},gn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f=this.startIndices.length-1,c=this.getHitDetectionTextures();for(r=c.length-1;r>=0;--r)for(t.bindTexture($i.TEXTURE_2D,c[r]),e=r>0?this.hitDetectionGroupIndices[r-1]:0,a=this.hitDetectionGroupIndices[r];f>=0&&this.startIndices[f]>=e;){if(o=this.startIndices[f],void 0===s[ui.getUid(u=this.startIndicesFeature[f]).toString()]&&u.getGeometry()&&(void 0===n||bi.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,o,a);var l=h(u);if(l)return l}a=o,f--}},gn.prototype.finish=function(){this.anchorX=void 0,this.anchorY=void 0,this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.indices=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.vertices=null,this.width=void 0},gn.prototype.getTextures=function(){},gn.prototype.getHitDetectionTextures=function(){};var _n=function(t,i){gn.call(this,t,i),this.images_=[],this.hitDetectionImages_=[],this.textures_=[],this.hitDetectionTextures_=[]};ui.inherits(_n,gn),_n.prototype.drawMultiPoint=function(t,i){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var s=t.getFlatCoordinates(),h=t.getStride();this.drawCoordinates(s,0,s.length,h)},_n.prototype.drawPoint=function(t,i){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var s=t.getFlatCoordinates(),h=t.getStride();this.drawCoordinates(s,0,s.length,h)},_n.prototype.finish=function(t){var i=t.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices.push(this.indices.length),this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices);var s={};this.createTextures(this.textures_,this.images_,s,i),this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,s,i),this.images_=null,this.hitDetectionImages_=null,gn.prototype.finish.call(this,t)},_n.prototype.setImageStyle=function(t){var i=t.getAnchor(),s=t.getImage(1),h=t.getImageSize(),n=t.getHitDetectionImage(1),r=t.getOpacity(),e=t.getOrigin(),o=t.getRotateWithView(),a=t.getRotation(),u=t.getSize(),f=t.getScale();0===this.images_.length?this.images_.push(s):ui.getUid(this.images_[this.images_.length-1])!=ui.getUid(s)&&(this.groupIndices.push(this.indices.length),this.images_.push(s)),0===this.hitDetectionImages_.length?this.hitDetectionImages_.push(n):ui.getUid(this.hitDetectionImages_[this.hitDetectionImages_.length-1])!=ui.getUid(n)&&(this.hitDetectionGroupIndices.push(this.indices.length),this.hitDetectionImages_.push(n)),this.anchorX=i[0],this.anchorY=i[1],this.height=u[1],this.imageHeight=h[1],this.imageWidth=h[0],this.opacity=r,this.originX=e[0],this.originY=e[1],this.rotation=a,this.rotateWithView=o,this.scale=f,this.width=u[0]},_n.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_},_n.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_};var wn=function(t,i,s,h){var n=s-h;return t[i]===t[n]&&t[i+1]===t[n+1]&&(s-i)/h>3&&!!Gi.linearRing(t,i,s,h)},yn={};yn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying float a;varying vec2 aVertex;varying float c;uniform float m;uniform vec4 n;uniform vec2 o;uniform float p;void main(void){if(a>0.0){vec2 windowCoords=vec2((aVertex.x+1.0)/2.0*o.x*p,(aVertex.y+1.0)/2.0*o.y*p);if(length(windowCoords-gl_FragCoord.xy)>c*p){discard;}} gl_FragColor=n;float alpha=n.a*m;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),yn.vertex=new en(ui.DEBUG_WEBGL?"varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n":"varying float a;varying vec2 aVertex;varying float c;attribute vec2 d;attribute vec2 e;attribute vec2 f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;bool nearlyEquals(in float value,in float ref){float epsilon=0.000000000001;return value>=ref-epsilon&&value<=ref+epsilon;}void alongNormal(out vec2 offset,in vec2 nextP,in float turnDir,in float direction){vec2 dirVect=nextP-e;vec2 normal=normalize(vec2(-turnDir*dirVect.y,turnDir*dirVect.x));offset=k/2.0*normal*direction;}void miterUp(out vec2 offset,out float round,in bool isRound,in float direction){float halfWidth=k/2.0;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=f-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;round=0.0;if(isRound){round=1.0;}else if(miterLength>l+k){offset=halfWidth*tmpNormal*direction;}} bool miterDown(out vec2 offset,in vec4 projPos,in mat4 offsetMatrix,in float direction){bool degenerate=false;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=d-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));vec2 longOffset,shortOffset,longVertex;vec4 shortProjVertex;float halfWidth=k/2.0;if(length(f-e)>length(d-e)){longOffset=tmpNormal*direction*halfWidth;shortOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=f;shortProjVertex=h*vec4(d,0.0,1.0);}else{shortOffset=tmpNormal*direction*halfWidth;longOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=d;shortProjVertex=h*vec4(f,0.0,1.0);}vec4 p1=h*vec4(longVertex,0.0,1.0)+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p2=projPos+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p3=shortProjVertex+offsetMatrix*vec4(-shortOffset,0.0,0.0);vec4 p4=shortProjVertex+offsetMatrix*vec4(shortOffset,0.0,0.0);float denom=(p4.y-p3.y)*(p2.x-p1.x)-(p4.x-p3.x)*(p2.y-p1.y);float firstU=((p4.x-p3.x)*(p1.y-p3.y)-(p4.y-p3.y)*(p1.x-p3.x))/denom;float secondU=((p2.x-p1.x)*(p1.y-p3.y)-(p2.y-p1.y)*(p1.x-p3.x))/denom;float epsilon=0.000000000001;if(firstU>epsilon&&firstU<1.0-epsilon&&secondU>epsilon&&secondU<1.0-epsilon){shortProjVertex.x=p1.x+firstU*(p2.x-p1.x);shortProjVertex.y=p1.y+firstU*(p2.y-p1.y);offset=shortProjVertex.xy;degenerate=true;}else{float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;}return degenerate;}void squareCap(out vec2 offset,out float round,in bool isRound,in vec2 nextP,in float turnDir,in float direction){round=0.0;vec2 dirVect=e-nextP;vec2 firstNormal=normalize(dirVect);vec2 secondNormal=vec2(turnDir*firstNormal.y*direction,-turnDir*firstNormal.x*direction);vec2 hypotenuse=normalize(firstNormal-secondNormal);vec2 normal=vec2(turnDir*hypotenuse.y*direction,-turnDir*hypotenuse.x*direction);float length=sqrt(c*c*2.0);offset=normal*length;if(isRound){round=1.0;}} void main(void){bool degenerate=false;float direction=float(sign(g));mat4 offsetMatrix=i*j;vec2 offset;vec4 projPos=h*vec4(e,0.0,1.0);bool round=nearlyEquals(mod(g,2.0),0.0);a=0.0;c=k/2.0;aVertex=projPos.xy;if(nearlyEquals(mod(g,3.0),0.0)||nearlyEquals(mod(g,17.0),0.0)){alongNormal(offset,f,1.0,direction);}else if(nearlyEquals(mod(g,5.0),0.0)||nearlyEquals(mod(g,13.0),0.0)){alongNormal(offset,d,-1.0,direction);}else if(nearlyEquals(mod(g,23.0),0.0)){miterUp(offset,a,round,direction);}else if(nearlyEquals(mod(g,19.0),0.0)){degenerate=miterDown(offset,projPos,offsetMatrix,direction);}else if(nearlyEquals(mod(g,7.0),0.0)){squareCap(offset,a,round,f,1.0,direction);}else if(nearlyEquals(mod(g,11.0),0.0)){squareCap(offset,a,round,d,-1.0,direction);}if(!degenerate){vec4 offsets=offsetMatrix*vec4(offset,0.0,0.0);gl_Position=projPos+offsets;}else{gl_Position=vec4(offset,0.0,1.0);}}");var bn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"h"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"i"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"j"),this.u_lineWidth=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_lineWidth":"k"),this.u_miterLimit=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_miterLimit":"l"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"m"),this.u_color=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_color":"n"),this.u_size=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_size":"o"),this.u_pixelRatio=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_pixelRatio":"p"),this.a_lastPos=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_lastPos":"d"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"e"),this.a_nextPos=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_nextPos":"f"),this.a_direction=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_direction":"g")},xn=function(t,i){cn.call(this,t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0,changed:!1}};ui.inherits(xn,cn),xn.prototype.drawCoordinates_=function(t,i,s,h){var n,r,e,o,a,u,f,c,l=this.vertices.length,v=this.indices.length,d="bevel"===this.state_.lineJoin?0:"miter"===this.state_.lineJoin?1:2,M="butt"===this.state_.lineCap?0:"square"===this.state_.lineCap?1:2,m=wn(t,i,s,h),p=v,g=1;for(n=i,r=s;n<r;n+=h){if(a=l/7,u=f,f=c||[t[n],t[n+1]],n===i){if(c=[t[n+h],t[n+h+1]],s-i==2*h&&yi.equals(f,c))break;if(!m){M&&(l=this.addVertices_([0,0],f,c,g*xn.Instruction_.BEGIN_LINE_CAP*M,l),l=this.addVertices_([0,0],f,c,-g*xn.Instruction_.BEGIN_LINE_CAP*M,l),this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=a+1,this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a+2),l=this.addVertices_([0,0],f,c,g*xn.Instruction_.BEGIN_LINE*(M||1),l),p=(l=this.addVertices_([0,0],f,c,-g*xn.Instruction_.BEGIN_LINE*(M||1),l))/7-1;continue}u=[t[s-2*h],t[s-2*h+1]],e=c}else{if(n===s-h){if(m){c=e;break}l=this.addVertices_(u=u||[0,0],f,[0,0],g*xn.Instruction_.END_LINE*(M||1),l),l=this.addVertices_(u,f,[0,0],-g*xn.Instruction_.END_LINE*(M||1),l),this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=p,this.indices[v++]=a+1,this.indices[v++]=a,M&&(l=this.addVertices_(u,f,[0,0],g*xn.Instruction_.END_LINE_CAP*M,l),l=this.addVertices_(u,f,[0,0],-g*xn.Instruction_.END_LINE_CAP*M,l),this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=a+1,this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a+2);break}c=[t[n+h],t[n+h+1]]}o=ln.triangleIsCounterClockwise(u[0],u[1],f[0],f[1],c[0],c[1])?-1:1,l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_FIRST*(d||1),l),l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_SECOND*(d||1),l),l=this.addVertices_(u,f,c,-o*xn.Instruction_.MITER_BOTTOM*(d||1),l),n>i&&(this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=a+2,this.indices[v++]=a,this.indices[v++]=g*o>0?p:p-1),this.indices[v++]=a,this.indices[v++]=a+2,this.indices[v++]=a+1,p=a+2,g=o,d&&(l=this.addVertices_(u,f,c,o*xn.Instruction_.MITER_TOP*d,l),this.indices[v++]=a+1,this.indices[v++]=a+3,this.indices[v++]=a)}m&&(a=a||l/7,o=Ki.linearRingIsClockwise([u[0],u[1],f[0],f[1],c[0],c[1]],0,6,2)?1:-1,l=this.addVertices_(u,f,c,o*xn.Instruction_.BEVEL_FIRST*(d||1),l),l=this.addVertices_(u,f,c,-o*xn.Instruction_.MITER_BOTTOM*(d||1),l),this.indices[v++]=a,this.indices[v++]=p-1,this.indices[v++]=p,this.indices[v++]=a+1,this.indices[v++]=a,this.indices[v++]=g*o>0?p:p-1)},xn.prototype.addVertices_=function(t,i,s,h,n){return this.vertices[n++]=t[0],this.vertices[n++]=t[1],this.vertices[n++]=i[0],this.vertices[n++]=i[1],this.vertices[n++]=s[0],this.vertices[n++]=s[1],this.vertices[n++]=h,n},xn.prototype.isValid_=function(t,i,s,h){var n=s-i;return!(n<2*h||n===2*h&&yi.equals([t[i],t[i+1]],[t[i+h],t[i+h+1]]))},xn.prototype.drawLineString=function(t,i){var s=t.getFlatCoordinates(),h=t.getStride();this.isValid_(s,0,s.length,h)&&(s=Ai(s,0,s.length,h,-this.origin[0],-this.origin[1]),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.drawCoordinates_(s,0,s.length,h))},xn.prototype.drawMultiLineString=function(t,i){var s=this.indices.length,h=t.getEnds();h.unshift(0);var n,r,e=t.getFlatCoordinates(),o=t.getStride();if(h.length>1)for(n=1,r=h.length;n<r;++n)if(this.isValid_(e,h[n-1],h[n],o)){var a=Ai(e,h[n-1],h[n],o,-this.origin[0],-this.origin[1]);this.drawCoordinates_(a,0,a.length,o)}this.indices.length>s&&(this.startIndices.push(s),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(s),this.state_.changed=!1))},xn.prototype.drawPolygonCoordinates=function(t,i,s){var h,n;if(wn(t,0,t.length,s)||(t.push(t[0]),t.push(t[1])),this.drawCoordinates_(t,0,t.length,s),i.length)for(h=0,n=i.length;h<n;++h)wn(i[h],0,i[h].length,s)||(i[h].push(i[h][0]),i[h].push(i[h][1])),this.drawCoordinates_(i[h],0,i[h].length,s)},xn.prototype.setPolygonStyle=function(t,i){var s=void 0===i?this.indices.length:i;this.startIndices.push(s),this.startIndicesFeature.push(t),this.state_.changed&&(this.styleIndices_.push(s),this.state_.changed=!1)},xn.prototype.getCurrentIndex=function(){return this.indices.length},xn.prototype.finish=function(){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},xn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer;return function(){t.deleteBuffer(i),t.deleteBuffer(s)}},xn.prototype.setUpProgram=function(t,i,s,h){var n,r=i.getProgram(yn.fragment,yn.vertex);return this.defaultLocations_?n=this.defaultLocations_:(n=new bn(t,r),this.defaultLocations_=n),i.useProgram(r),t.enableVertexAttribArray(n.a_lastPos),t.vertexAttribPointer(n.a_lastPos,2,$i.FLOAT,!1,28,0),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,$i.FLOAT,!1,28,8),t.enableVertexAttribArray(n.a_nextPos),t.vertexAttribPointer(n.a_nextPos,2,$i.FLOAT,!1,28,16),t.enableVertexAttribArray(n.a_direction),t.vertexAttribPointer(n.a_direction,1,$i.FLOAT,!1,28,24),t.uniform2fv(n.u_size,s),t.uniform1f(n.u_pixelRatio,h),n},xn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_lastPos),t.disableVertexAttribArray(i.a_position),t.disableVertexAttribArray(i.a_nextPos),t.disableVertexAttribArray(i.a_direction)},xn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o,a=t.getParameter(t.DEPTH_FUNC),u=t.getParameter(t.DEPTH_WRITEMASK);if(h||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),fi.isEmpty(s))for(e=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)r=this.styleIndices_[n],this.setStrokeStyle_(t,(o=this.styles_[n])[0],o[1],o[2]),this.drawElements(t,i,r,e),t.clear(t.DEPTH_BUFFER_BIT),e=r;else this.drawReplaySkipping_(t,i,s);h||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(u),t.depthFunc(a))},xn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a,u;for(r=n=this.startIndices[1+(a=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setStrokeStyle_(t,(e=this.styles_[h])[0],e[1],e[2]),o=this.styleIndices_[h];a>=0&&this.startIndices[a]>=o;)u=this.startIndices[a],s[ui.getUid(this.startIndicesFeature[a]).toString()]&&(n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),r=u),a--,n=u;n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),n=r=o}},xn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f,c;for(o=this.startIndices[1+(c=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setStrokeStyle_(t,(a=this.styles_[r])[0],a[1],a[2]),u=this.styleIndices_[r];c>=0&&this.startIndices[c]>=u;){if(e=this.startIndices[c],void 0===s[ui.getUid(f=this.startIndicesFeature[c]).toString()]&&f.getGeometry()&&(void 0===n||bi.intersects(n,f.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var l=h(f);if(l)return l}c--,o=e}},xn.prototype.setStrokeStyle_=function(t,i,s,h){t.uniform4fv(this.defaultLocations_.u_color,i),t.uniform1f(this.defaultLocations_.u_lineWidth,s),t.uniform1f(this.defaultLocations_.u_miterLimit,h)},xn.prototype.setFillStrokeStyle=function(t,i){var s=i.getLineCap();this.state_.lineCap=void 0!==s?s:ln.defaultLineCap;var h=i.getLineDash();this.state_.lineDash=h||ln.defaultLineDash;var n=i.getLineDashOffset();this.state_.lineDashOffset=n||ln.defaultLineDashOffset;var r=i.getLineJoin();this.state_.lineJoin=void 0!==r?r:ln.defaultLineJoin;var e=i.getColor();e=e instanceof CanvasGradient||e instanceof CanvasPattern?ln.defaultStrokeStyle:dh.asArray(e).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultStrokeStyle;var o=i.getWidth();o=void 0!==o?o:ln.defaultLineWidth;var a=i.getMiterLimit();a=void 0!==a?a:ln.defaultMiterLimit,this.state_.strokeColor&&yi.equals(this.state_.strokeColor,e)&&this.state_.lineWidth===o&&this.state_.miterLimit===a||(this.state_.changed=!0,this.state_.strokeColor=e,this.state_.lineWidth=o,this.state_.miterLimit=a,this.styles_.push([e,o,a]))},xn.Instruction_={ROUND:2,BEGIN_LINE:3,END_LINE:5,BEGIN_LINE_CAP:7,END_LINE_CAP:11,BEVEL_FIRST:13,BEVEL_SECOND:17,MITER_BOTTOM:19,MITER_TOP:23};var En={};En.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;uniform vec4 e;uniform float f;void main(void){gl_FragColor=e;float alpha=e.a*f;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"),En.vertex=new en(ui.DEBUG_WEBGL?"\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n":"attribute vec2 a;uniform mat4 b;uniform mat4 c;uniform mat4 d;void main(void){gl_Position=b*vec4(a,0.0,1.0);}");var Sn=function(t,i){this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"b"),this.u_offsetScaleMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetScaleMatrix":"c"),this.u_offsetRotateMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_offsetRotateMatrix":"d"),this.u_color=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_color":"e"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"f"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"a")},Cn=function(t){var i=t||{};this.color_=void 0!==i.color?i.color:null,this.lineCap_=i.lineCap,this.lineDash_=void 0!==i.lineDash?i.lineDash:null,this.lineDashOffset_=i.lineDashOffset,this.lineJoin_=i.lineJoin,this.miterLimit_=i.miterLimit,this.width_=i.width,this.checksum_=void 0};Cn.prototype.clone=function(){var t=this.getColor();return new Cn({color:t&&t.slice?t.slice():t||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()})},Cn.prototype.getColor=function(){return this.color_},Cn.prototype.getLineCap=function(){return this.lineCap_},Cn.prototype.getLineDash=function(){return this.lineDash_},Cn.prototype.getLineDashOffset=function(){return this.lineDashOffset_},Cn.prototype.getLineJoin=function(){return this.lineJoin_},Cn.prototype.getMiterLimit=function(){return this.miterLimit_},Cn.prototype.getWidth=function(){return this.width_},Cn.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},Cn.prototype.setLineCap=function(t){this.lineCap_=t,this.checksum_=void 0},Cn.prototype.setLineDash=function(t){this.lineDash_=t,this.checksum_=void 0},Cn.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t,this.checksum_=void 0},Cn.prototype.setLineJoin=function(t){this.lineJoin_=t,this.checksum_=void 0},Cn.prototype.setMiterLimit=function(t){this.miterLimit_=t,this.checksum_=void 0},Cn.prototype.setWidth=function(t){this.width_=t,this.checksum_=void 0},Cn.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_="s",this.checksum_+=this.color_?"string"==typeof this.color_?this.color_:ui.getUid(this.color_).toString():"-",this.checksum_+=","+(void 0!==this.lineCap_?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(void 0!==this.lineDashOffset_?this.lineDashOffset_:"-")+","+(void 0!==this.lineJoin_?this.lineJoin_:"-")+","+(void 0!==this.miterLimit_?this.miterLimit_.toString():"-")+","+(void 0!==this.width_?this.width_.toString():"-")),this.checksum_};var An=function(t){this.first_=void 0,this.last_=void 0,this.head_=void 0,this.circular_=void 0===t||t,this.length_=0};An.prototype.insertItem=function(t){var i={prev:void 0,next:void 0,data:t},s=this.head_;if(s){var h=s.next;i.prev=s,i.next=h,s.next=i,h&&(h.prev=i),s===this.last_&&(this.last_=i)}else this.first_=i,this.last_=i,this.circular_&&(i.next=i,i.prev=i);this.head_=i,this.length_++},An.prototype.removeItem=function(){var t=this.head_;if(t){var i=t.next,s=t.prev;i&&(i.prev=s),s&&(s.next=i),this.head_=i||s,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=s?this.head_.prev:this.head_),this.length_--}},An.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},An.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},An.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},An.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},An.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},An.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},An.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},An.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},An.prototype.concat=function(t){if(t.head_){if(this.head_){var i=this.head_.next;this.head_.next=t.first_,t.first_.prev=this.head_,i.prev=t.last_,t.last_.next=i,this.length_+=t.length_}else this.head_=t.head_,this.first_=t.first_,this.last_=t.last_,this.length_=t.length_;t.head_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}},An.prototype.getLength=function(){return this.length_};var Pn=function(t){this.rbush_=Rh(t),this.items_={}};Pn.prototype.insert=function(t,i){var s={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:i};this.rbush_.insert(s),this.items_[ui.getUid(i)]=s},Pn.prototype.load=function(t,i){for(var s=new Array(i.length),h=0,n=i.length;h<n;h++){var r=t[h],e=i[h],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:e};s[h]=o,this.items_[ui.getUid(e)]=o}this.rbush_.load(s)},Pn.prototype.remove=function(t){var i=ui.getUid(t),s=this.items_[i];return delete this.items_[i],null!==this.rbush_.remove(s)},Pn.prototype.update=function(t,i){var s=this.items_[ui.getUid(i)];bi.equals([s.minX,s.minY,s.maxX,s.maxY],t)||(this.remove(i),this.insert(t,i))},Pn.prototype.getAll=function(){return this.rbush_.all().map((function(t){return t.value}))},Pn.prototype.getInExtent=function(t){return this.rbush_.search({minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}).map((function(t){return t.value}))},Pn.prototype.forEach=function(t,i){return this.forEach_(this.getAll(),t,i)},Pn.prototype.forEachInExtent=function(t,i,s){return this.forEach_(this.getInExtent(t),i,s)},Pn.prototype.forEach_=function(t,i,s){for(var h,n=0,r=t.length;n<r;n++)if(h=i.call(s,t[n]))return h;return h},Pn.prototype.isEmpty=function(){return fi.isEmpty(this.items_)},Pn.prototype.clear=function(){this.rbush_.clear(),this.items_={}},Pn.prototype.getExtent=function(t){var i=this.rbush_.data;return bi.createOrUpdate(i.minX,i.minY,i.maxX,i.maxY,t)},Pn.prototype.concat=function(t){for(var i in this.rbush_.load(t.rbush_.all()),t.items_)this.items_[0|i]=t.items_[0|i]};var Rn=function(t,i){cn.call(this,t,i),this.lineStringReplay=new xn(t,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={fillColor:null,changed:!1}};ui.inherits(Rn,cn),Rn.prototype.drawCoordinates_=function(t,i,s){var h=new An,n=new Pn;this.processFlatCoordinates_(t,s,h,n,!0);var r=this.getMaxCoords_(h);if(i.length){var e,o,a=[];for(e=0,o=i.length;e<o;++e){var u={list:new An,maxCoords:void 0,rtree:new Pn};a.push(u),this.processFlatCoordinates_(i[e],s,u.list,u.rtree,!1),this.classifyPoints_(u.list,u.rtree,!0),u.maxCoords=this.getMaxCoords_(u.list)}for(a.sort((function(t,i){return i.maxCoords[0]===t.maxCoords[0]?t.maxCoords[1]-i.maxCoords[1]:i.maxCoords[0]-t.maxCoords[0]})),e=0;e<a.length;++e){var f,c=a[e].list,l=c.firstItem(),v=l;do{if(this.getIntersections_(v,n).length){f=!0;break}v=c.nextItem()}while(l!==v);f||this.bridgeHole_(c,a[e].maxCoords[0],h,r[0],n)&&(n.concat(a[e].rtree),this.classifyPoints_(h,n,!1))}}else this.classifyPoints_(h,n,!1);this.triangulate_(h,n)},Rn.prototype.processFlatCoordinates_=function(t,i,s,h,n){var r,e,o,a,u,f=Ki.linearRingIsClockwise(t,0,t.length,i),c=this.vertices.length/2,l=[],v=[];if(n===f){for(a=o=this.createPoint_(t[0],t[1],c++),r=i,e=t.length;r<e;r+=i)u=this.createPoint_(t[r],t[r+1],c++),v.push(this.insertItem_(a,u,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)]),a=u;v.push(this.insertItem_(u,o,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)])}else{var d=t.length-i;for(a=o=this.createPoint_(t[d],t[d+1],c++),r=d-i,e=0;r>=e;r-=i)u=this.createPoint_(t[r],t[r+1],c++),v.push(this.insertItem_(a,u,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)]),a=u;v.push(this.insertItem_(u,o,s)),l.push([Math.min(a.x,u.x),Math.min(a.y,u.y),Math.max(a.x,u.x),Math.max(a.y,u.y)])}h.load(l,v)},Rn.prototype.getMaxCoords_=function(t){var i=t.firstItem(),s=i,h=[s.p0.x,s.p0.y];do{(s=t.nextItem()).p0.x>h[0]&&(h=[s.p0.x,s.p0.y])}while(s!==i);return h},Rn.prototype.classifyPoints_=function(t,i,s){var h=t.firstItem(),n=h,r=t.nextItem(),e=!1;do{var o=s?ln.triangleIsCounterClockwise(r.p1.x,r.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):ln.triangleIsCounterClockwise(n.p0.x,n.p0.y,n.p1.x,n.p1.y,r.p1.x,r.p1.y);void 0===o?(this.removeItem_(n,r,t,i),e=!0,r===h&&(h=t.getNextItem()),r=n,t.prevItem()):n.p1.reflex!==o&&(n.p1.reflex=o,e=!0),n=r,r=t.nextItem()}while(n!==h);return e},Rn.prototype.bridgeHole_=function(t,i,s,h,n){for(var r=t.firstItem();r.p1.x!==i;)r=t.nextItem();var e,o,a,u,f=r.p1,c={x:h,y:f.y,i:-1},l=1/0,v=this.getIntersections_({p0:f,p1:c},n,!0);for(e=0,o=v.length;e<o;++e){var d=v[e],M=this.calculateIntersection_(f,c,d.p0,d.p1,!0),m=Math.abs(f.x-M[0]);m<l&&void 0!==ln.triangleIsCounterClockwise(f.x,f.y,d.p0.x,d.p0.y,d.p1.x,d.p1.y)&&(l=m,u={x:M[0],y:M[1],i:-1},r=d)}if(l===1/0)return!1;if(a=r.p1,l>0){var p=this.getPointsInTriangle_(f,u,r.p1,n);if(p.length){var g=1/0;for(e=0,o=p.length;e<o;++e){var _=p[e],w=Math.atan2(f.y-_.y,c.x-_.x);(w<g||w===g&&_.x<a.x)&&(g=w,a=_)}}}for(r=s.firstItem();r.p1.x!==a.x||r.p1.y!==a.y;)r=s.nextItem();var y={x:f.x,y:f.y,i:f.i,reflex:void 0},b={x:r.p1.x,y:r.p1.y,i:r.p1.i,reflex:void 0};return t.getNextItem().p0=y,this.insertItem_(f,r.p1,t,n),this.insertItem_(b,y,t,n),r.p1=b,t.setFirstItem(),s.concat(t),!0},Rn.prototype.triangulate_=function(t,i){for(var s=!1,h=this.isSimple_(t,i);t.getLength()>3;)if(h){if(!this.clipEars_(t,i,h,s)&&!this.classifyPoints_(t,i,s)&&!this.resolveSelfIntersections_(t,i,!0))break}else if(!this.clipEars_(t,i,h,s)&&!this.classifyPoints_(t,i,s)&&!this.resolveSelfIntersections_(t,i)){if(!(h=this.isSimple_(t,i))){this.splitPolygon_(t,i);break}s=!this.isClockwise_(t),this.classifyPoints_(t,i,s)}if(3===t.getLength()){var n=this.indices.length;this.indices[n++]=t.getPrevItem().p0.i,this.indices[n++]=t.getCurrItem().p0.i,this.indices[n++]=t.getNextItem().p0.i}},Rn.prototype.clipEars_=function(t,i,s,h){var n,r,e,o=this.indices.length,a=t.firstItem(),u=t.getPrevItem(),f=a,c=t.nextItem(),l=t.getNextItem(),v=!1;do{var d;n=f.p0,e=c.p1,!1===(r=f.p1).reflex&&(d=s?0===this.getPointsInTriangle_(n,r,e,i,!0).length:h?this.diagonalIsInside_(l.p1,e,r,n,u.p0):this.diagonalIsInside_(u.p0,n,r,e,l.p1),(s||0===this.getIntersections_({p0:n,p1:e},i).length)&&d&&(s||!1===n.reflex||!1===e.reflex||Ki.linearRingIsClockwise([u.p0.x,u.p0.y,n.x,n.y,r.x,r.y,e.x,e.y,l.p1.x,l.p1.y],0,10,2)===!h)&&(this.indices[o++]=n.i,this.indices[o++]=r.i,this.indices[o++]=e.i,this.removeItem_(f,c,t,i),c===a&&(a=l),v=!0)),u=t.getPrevItem(),f=t.getCurrItem(),c=t.nextItem(),l=t.getNextItem()}while(f!==a&&t.getLength()>3);return v},Rn.prototype.resolveSelfIntersections_=function(t,i,s){var h=t.firstItem();t.nextItem();var n=h,r=t.nextItem(),e=!1;do{var o=this.calculateIntersection_(n.p0,n.p1,r.p0,r.p1,s);if(o){var a,u=!1,f=this.indices.length,c=this.vertices.length/2,l=t.prevItem();if(t.removeItem(),i.remove(l),u=l===h,s?(o[0]===n.p0.x&&o[1]===n.p0.y?(t.prevItem(),r.p0=a=n.p0,i.remove(n),u=u||n===h):(n.p1=a=r.p1,i.remove(r),u=u||r===h),t.removeItem()):(a=this.createPoint_(o[0],o[1],c),n.p1=a,r.p0=a,i.update([Math.min(n.p0.x,n.p1.x),Math.min(n.p0.y,n.p1.y),Math.max(n.p0.x,n.p1.x),Math.max(n.p0.y,n.p1.y)],n),i.update([Math.min(r.p0.x,r.p1.x),Math.min(r.p0.y,r.p1.y),Math.max(r.p0.x,r.p1.x),Math.max(r.p0.y,r.p1.y)],r)),this.indices[f++]=l.p0.i,this.indices[f++]=l.p1.i,this.indices[f++]=a.i,e=!0,u)break}n=t.getPrevItem(),r=t.nextItem()}while(n!==h);return e},Rn.prototype.isSimple_=function(t,i){var s=t.firstItem(),h=s;do{if(this.getIntersections_(h,i).length)return!1;h=t.nextItem()}while(h!==s);return!0},Rn.prototype.isClockwise_=function(t){var i=2*t.getLength(),s=new Array(i),h=t.firstItem(),n=h,r=0;do{s[r++]=n.p0.x,s[r++]=n.p0.y,n=t.nextItem()}while(n!==h);return Ki.linearRingIsClockwise(s,0,i,2)},Rn.prototype.splitPolygon_=function(t,i){var s=t.firstItem(),h=s;do{var n=this.getIntersections_(h,i);if(n.length){var r=n[0],e=this.vertices.length/2,o=this.calculateIntersection_(h.p0,h.p1,r.p0,r.p1),a=this.createPoint_(o[0],o[1],e),u=new An,f=new Pn;this.insertItem_(a,h.p1,u,f),h.p1=a,i.update([Math.min(h.p0.x,a.x),Math.min(h.p0.y,a.y),Math.max(h.p0.x,a.x),Math.max(h.p0.y,a.y)],h);for(var c=t.nextItem();c!==r;)this.insertItem_(c.p0,c.p1,u,f),i.remove(c),t.removeItem(),c=t.getCurrItem();this.insertItem_(r.p0,a,u,f),r.p0=a,i.update([Math.min(r.p1.x,a.x),Math.min(r.p1.y,a.y),Math.max(r.p1.x,a.x),Math.max(r.p1.y,a.y)],r),this.classifyPoints_(t,i,!1),this.triangulate_(t,i),this.classifyPoints_(u,f,!1),this.triangulate_(u,f);break}h=t.nextItem()}while(h!==s)},Rn.prototype.createPoint_=function(t,i,s){var h=this.vertices.length;return this.vertices[h++]=t,this.vertices[h++]=i,{x:t,y:i,i:s,reflex:void 0}},Rn.prototype.insertItem_=function(t,i,s,h){var n={p0:t,p1:i};return s.insertItem(n),h&&h.insert([Math.min(t.x,i.x),Math.min(t.y,i.y),Math.max(t.x,i.x),Math.max(t.y,i.y)],n),n},Rn.prototype.removeItem_=function(t,i,s,h){s.getCurrItem()===i&&(s.removeItem(),t.p1=i.p1,h.remove(i),h.update([Math.min(t.p0.x,t.p1.x),Math.min(t.p0.y,t.p1.y),Math.max(t.p0.x,t.p1.x),Math.max(t.p0.y,t.p1.y)],t))},Rn.prototype.getPointsInTriangle_=function(t,i,s,h,n){var r,e,o,a,u=[],f=h.getInExtent([Math.min(t.x,i.x,s.x),Math.min(t.y,i.y,s.y),Math.max(t.x,i.x,s.x),Math.max(t.y,i.y,s.y)]);for(r=0,e=f.length;r<e;++r)for(o in f[r])"object"!=typeof(a=f[r][o])||n&&!a.reflex||a.x===t.x&&a.y===t.y||a.x===i.x&&a.y===i.y||a.x===s.x&&a.y===s.y||-1!==u.indexOf(a)||!Yi.linearRingContainsXY([t.x,t.y,i.x,i.y,s.x,s.y],0,6,2,a.x,a.y)||u.push(a);return u},Rn.prototype.getIntersections_=function(t,i,s){var h,n,r=t.p0,e=t.p1,o=i.getInExtent([Math.min(r.x,e.x),Math.min(r.y,e.y),Math.max(r.x,e.x),Math.max(r.y,e.y)]),a=[];for(h=0,n=o.length;h<n;++h){var u=o[h];t!==u&&(s||u.p0!==e||u.p1!==r)&&this.calculateIntersection_(r,e,u.p0,u.p1,s)&&a.push(u)}return a},Rn.prototype.calculateIntersection_=function(t,i,s,h,n){var r=(h.y-s.y)*(i.x-t.x)-(h.x-s.x)*(i.y-t.y);if(0!==r){var e=((h.x-s.x)*(t.y-s.y)-(h.y-s.y)*(t.x-s.x))/r,o=((i.x-t.x)*(t.y-s.y)-(i.y-t.y)*(t.x-s.x))/r;if(!n&&e>ln.EPSILON&&e<1-ln.EPSILON&&o>ln.EPSILON&&o<1-ln.EPSILON||n&&e>=0&&e<=1&&o>=0&&o<=1)return[t.x+e*(i.x-t.x),t.y+e*(i.y-t.y)]}},Rn.prototype.diagonalIsInside_=function(t,i,s,h,n){if(void 0===i.reflex||void 0===h.reflex)return!1;var r=(s.x-h.x)*(i.y-h.y)>(s.y-h.y)*(i.x-h.x),e=(n.x-h.x)*(i.y-h.y)<(n.y-h.y)*(i.x-h.x),o=(t.x-i.x)*(h.y-i.y)>(t.y-i.y)*(h.x-i.x),a=(s.x-i.x)*(h.y-i.y)<(s.y-i.y)*(h.x-i.x);return(h.reflex?e||r:e&&r)&&(i.reflex?a||o:a&&o)},Rn.prototype.drawMultiPolygon=function(t,i){var s,h,n,r,e=t.getEndss(),o=t.getStride(),a=this.indices.length,u=this.lineStringReplay.getCurrentIndex(),f=t.getFlatCoordinates(),c=0;for(s=0,h=e.length;s<h;++s){var l=e[s];if(l.length>0){var v=Ai(f,c,l[0],o,-this.origin[0],-this.origin[1]);if(v.length){var d,M=[];for(n=1,r=l.length;n<r;++n)l[n]!==l[n-1]&&(d=Ai(f,l[n-1],l[n],o,-this.origin[0],-this.origin[1]),M.push(d));this.lineStringReplay.drawPolygonCoordinates(v,M,o),this.drawCoordinates_(v,M,o)}}c=l[l.length-1]}this.indices.length>a&&(this.startIndices.push(a),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(a),this.state_.changed=!1)),this.lineStringReplay.getCurrentIndex()>u&&this.lineStringReplay.setPolygonStyle(i,u)},Rn.prototype.drawPolygon=function(t,i){var s=t.getEnds(),h=t.getStride();if(s.length>0){var n=t.getFlatCoordinates().map(Number),r=Ai(n,0,s[0],h,-this.origin[0],-this.origin[1]);if(r.length){var e,o,a,u=[];for(e=1,o=s.length;e<o;++e)s[e]!==s[e-1]&&(a=Ai(n,s[e-1],s[e],h,-this.origin[0],-this.origin[1]),u.push(a));this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.lineStringReplay.setPolygonStyle(i),this.lineStringReplay.drawPolygonCoordinates(r,u,h),this.drawCoordinates_(r,u,h)}}},Rn.prototype.finish=function(t){this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.startIndices.push(this.indices.length),this.lineStringReplay.finish(t),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},Rn.prototype.getDeleteResourcesFunction=function(t){var i=this.verticesBuffer,s=this.indicesBuffer,h=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(i),t.deleteBuffer(s),h()}},Rn.prototype.setUpProgram=function(t,i){var s,h=i.getProgram(En.fragment,En.vertex);return this.defaultLocations_?s=this.defaultLocations_:(s=new Sn(t,h),this.defaultLocations_=s),i.useProgram(h),t.enableVertexAttribArray(s.a_position),t.vertexAttribPointer(s.a_position,2,$i.FLOAT,!1,8,0),s},Rn.prototype.shutDownProgram=function(t,i){t.disableVertexAttribArray(i.a_position)},Rn.prototype.drawReplay=function(t,i,s,h){var n,r,e,o=t.getParameter(t.DEPTH_FUNC),a=t.getParameter(t.DEPTH_WRITEMASK);if(h||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),fi.isEmpty(s))for(e=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)r=this.styleIndices_[n],this.setFillStyle_(t,this.styles_[n]),this.drawElements(t,i,r,e),e=r;else this.drawReplaySkipping_(t,i,s);h||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(a),t.depthFunc(o))},Rn.prototype.drawHitDetectionReplayOneByOne=function(t,i,s,h,n){var r,e,o,a,u,f;for(o=this.startIndices[1+(f=this.startIndices.length-2)],r=this.styleIndices_.length-1;r>=0;--r)for(this.setFillStyle_(t,this.styles_[r]),a=this.styleIndices_[r];f>=0&&this.startIndices[f]>=a;){if(e=this.startIndices[f],void 0===s[ui.getUid(u=this.startIndicesFeature[f]).toString()]&&u.getGeometry()&&(void 0===n||bi.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,i,e,o);var c=h(u);if(c)return c}f--,o=e}},Rn.prototype.drawReplaySkipping_=function(t,i,s){var h,n,r,e,o,a;for(r=n=this.startIndices[1+(o=this.startIndices.length-2)],h=this.styleIndices_.length-1;h>=0;--h){for(this.setFillStyle_(t,this.styles_[h]),e=this.styleIndices_[h];o>=0&&this.startIndices[o]>=e;)a=this.startIndices[o],s[ui.getUid(this.startIndicesFeature[o]).toString()]&&(n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),r=a),o--,n=a;n!==r&&(this.drawElements(t,i,n,r),t.clear(t.DEPTH_BUFFER_BIT)),n=r=e}},Rn.prototype.setFillStyle_=function(t,i){t.uniform4fv(this.defaultLocations_.u_color,i)},Rn.prototype.setFillStrokeStyle=function(t,i){var s=t?t.getColor():[0,0,0,0];if(s=s instanceof CanvasGradient||s instanceof CanvasPattern?ln.defaultFillStyle:dh.asArray(s).map((function(t,i){return 3!=i?t/255:t}))||ln.defaultFillStyle,this.state_.fillColor&&yi.equals(s,this.state_.fillColor)||(this.state_.fillColor=s,this.state_.changed=!0,this.styles_.push(s)),i)this.lineStringReplay.setFillStrokeStyle(null,i);else{var h=new Cn({color:[0,0,0,0],lineWidth:0});this.lineStringReplay.setFillStrokeStyle(null,h)}};var Nn=function(t,i){this.space_=i,this.emptyBlocks_=[{x:0,y:0,width:t,height:t}],this.entries_={},this.context_=Cs(t,t),this.canvas_=this.context_.canvas};Nn.prototype.get=function(t){return this.entries_[t]||null},Nn.prototype.add=function(t,i,s,h,n){var r,e,o;for(e=0,o=this.emptyBlocks_.length;e<o;++e)if((r=this.emptyBlocks_[e]).width>=i+this.space_&&r.height>=s+this.space_){var a={offsetX:r.x+this.space_,offsetY:r.y+this.space_,image:this.canvas_};return this.entries_[t]=a,h.call(n,this.context_,r.x+this.space_,r.y+this.space_),this.split_(e,r,i+this.space_,s+this.space_),a}return null},Nn.prototype.split_=function(t,i,s,h){i.width-s>i.height-h?this.updateBlocks_(t,{x:i.x+s,y:i.y,width:i.width-s,height:i.height},{x:i.x,y:i.y+h,width:s,height:i.height-h}):this.updateBlocks_(t,{x:i.x+s,y:i.y,width:i.width-s,height:h},{x:i.x,y:i.y+h,width:i.width,height:i.height-h})},Nn.prototype.updateBlocks_=function(t,i,s){var h=[t,1];i.width>0&&i.height>0&&h.push(i),s.width>0&&s.height>0&&h.push(s),this.emptyBlocks_.splice.apply(this.emptyBlocks_,h)};var zn=function(t){var i=t||{};this.currentSize_=void 0!==i.initialSize?i.initialSize:ui.INITIAL_ATLAS_SIZE,this.maxSize_=void 0!==i.maxSize?i.maxSize:-1!=ui.MAX_ATLAS_SIZE?ui.MAX_ATLAS_SIZE:void 0!==ui.WEBGL_MAX_TEXTURE_SIZE?ui.WEBGL_MAX_TEXTURE_SIZE:2048,this.space_=void 0!==i.space?i.space:1,this.atlases_=[new Nn(this.currentSize_,this.space_)],this.currentHitSize_=this.currentSize_,this.hitAtlases_=[new Nn(this.currentHitSize_,this.space_)]};zn.prototype.getInfo=function(t){var i=this.getInfo_(this.atlases_,t);if(!i)return null;var s=this.getInfo_(this.hitAtlases_,t);return this.mergeInfos_(i,s)},zn.prototype.getInfo_=function(t,i){var s,h,n;for(h=0,n=t.length;h<n;++h)if(s=t[h].get(i))return s;return null},zn.prototype.mergeInfos_=function(t,i){return{offsetX:t.offsetX,offsetY:t.offsetY,image:t.image,hitImage:i.image}},zn.prototype.add=function(t,i,s,h,n,r){if(i+this.space_>this.maxSize_||s+this.space_>this.maxSize_)return null;var e=this.add_(!1,t,i,s,h,r);if(!e)return null;var o=this.add_(!0,t,i,s,void 0!==n?n:ui.nullFunction,r);return this.mergeInfos_(e,o)},zn.prototype.add_=function(t,i,s,h,n,r){var e,o,a,u,f=t?this.hitAtlases_:this.atlases_;for(a=0,u=f.length;a<u;++a){if(o=(e=f[a]).add(i,s,h,n,r))return o;var c;o||a!==u-1||(t?(c=Math.min(2*this.currentHitSize_,this.maxSize_),this.currentHitSize_=c):(c=Math.min(2*this.currentSize_,this.maxSize_),this.currentSize_=c),e=new Nn(c,this.space_),f.push(e),++u)}return null};var kn=function(t,i){gn.call(this,t,i),this.images_=[],this.textures_=[],this.measureCanvas_=Cs(0,0).canvas,this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:0,miterLimit:void 0,fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.atlases_={},this.currAtlas_=void 0,this.scale=1,this.opacity=1};ui.inherits(kn,gn),kn.prototype.drawText=function(t,i){if(this.text_){var s=null,h=2,n=2;switch(t.getType()){case"Point":case"MultiPoint":h=(s=t.getFlatCoordinates()).length,n=t.getStride();break;case"Circle":s=t.getCenter();break;case"LineString":s=t.getFlatMidpoint();break;case"MultiLineString":h=(s=t.getFlatMidpoints()).length;break;case"Polygon":s=t.getFlatInteriorPoint();break;case"MultiPolygon":h=(s=t.getFlatInteriorPoints()).length}this.startIndices.push(this.indices.length),this.startIndicesFeature.push(i);var r,e,o,a,u,f,c,l,v=this.currAtlas_,d=this.text_.split("\n"),M=this.getTextSize_(d),m=Math.round(M[0]*this.textAlign_-this.offsetX_),p=Math.round(M[1]*this.textBaseline_-this.offsetY_),g=this.state_.lineWidth/2*this.state_.scale;for(r=0,e=d.length;r<e;++r)for(u=0,f=v.height*r,o=0,a=(c=d[r].split("")).length;o<a;++o){if(l=v.atlas.getInfo(c[o])){var _=l.image;this.anchorX=m-u,this.anchorY=p-f,this.originX=0===o?l.offsetX-g:l.offsetX,this.originY=l.offsetY,this.height=v.height,this.width=0===o||o===c.length-1?v.width[c[o]]+g:v.width[c[o]],this.imageHeight=_.height,this.imageWidth=_.width,0===this.images_.length?this.images_.push(_):ui.getUid(this.images_[this.images_.length-1])!=ui.getUid(_)&&(this.groupIndices.push(this.indices.length),this.images_.push(_)),this.drawText_(s,0,h,n)}u+=this.width}}},kn.prototype.getTextSize_=function(t){var i=this,s=this.currAtlas_,h=t.length*s.height;return[t.map((function(t){var h,n,r=0;for(h=0,n=t.length;h<n;++h){var e=t[h];s.width[e]||i.addCharToAtlas_(e),r+=s.width[e]?s.width[e]:0}return r})).reduce((function(t,i){return Math.max(t,i)})),h]},kn.prototype.drawText_=function(t,i,s,h){var n,r;for(n=i,r=s;n<r;n+=h)this.drawCoordinates(t,i,s,h)},kn.prototype.addCharToAtlas_=function(t){if(1===t.length){var i=this.currAtlas_,s=this.state_,h=this.measureCanvas_.getContext("2d");h.font=s.font;var n=Math.ceil(h.measureText(t).width*s.scale);i.atlas.add(t,n,i.height,(function(i,h,n){i.font=s.font,i.fillStyle=s.fillColor,i.strokeStyle=s.strokeColor,i.lineWidth=s.lineWidth,i.lineCap=s.lineCap,i.lineJoin=s.lineJoin,i.miterLimit=s.miterLimit,i.textAlign="left",i.textBaseline="top",ts.CANVAS_LINE_DASH&&s.lineDash&&(i.setLineDash(s.lineDash),i.lineDashOffset=s.lineDashOffset),1!==s.scale&&i.setTransform(s.scale,0,0,s.scale,0,0),s.strokeColor&&i.strokeText(t,h,n),s.fillColor&&i.fillText(t,h,n)}))&&(i.width[t]=n)}},kn.prototype.finish=function(t){var i=t.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices=this.groupIndices,this.verticesBuffer=new vn(this.vertices),this.indicesBuffer=new vn(this.indices),this.createTextures(this.textures_,this.images_,{},i),this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:0,miterLimit:void 0,fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.images_=null,this.atlases_={},this.currAtlas_=void 0,gn.prototype.finish.call(this,t)},kn.prototype.setTextStyle=function(t){var i=this.state_,s=t.getFill(),h=t.getStroke();if(t&&t.getText()&&(s||h)){if(s){var n=s.getColor();i.fillColor=Mh.asColorLike(n||ln.defaultFillStyle)}else i.fillColor=null;if(h){var r=h.getColor();i.strokeColor=Mh.asColorLike(r||ln.defaultStrokeStyle),i.lineWidth=h.getWidth()||ln.defaultLineWidth,i.lineCap=h.getLineCap()||ln.defaultLineCap,i.lineDashOffset=h.getLineDashOffset()||ln.defaultLineDashOffset,i.lineJoin=h.getLineJoin()||ln.defaultLineJoin,i.miterLimit=h.getMiterLimit()||ln.defaultMiterLimit;var e=h.getLineDash();i.lineDash=e?e.slice():ln.defaultLineDash}else i.strokeColor=null,i.lineWidth=0;i.font=t.getFont()||ln.defaultFont,i.scale=t.getScale()||1,this.text_=t.getText();var o=Yh.TEXT_ALIGN[t.getTextAlign()],a=Yh.TEXT_ALIGN[t.getTextBaseline()];this.textAlign_=void 0===o?ln.defaultTextAlign:o,this.textBaseline_=void 0===a?ln.defaultTextBaseline:a,this.offsetX_=t.getOffsetX()||0,this.offsetY_=t.getOffsetY()||0,this.rotateWithView=!!t.getRotateWithView(),this.rotation=t.getRotation()||0,this.currAtlas_=this.getAtlas_(i)}else this.text_=""},kn.prototype.getAtlas_=function(t){var i,s=[];for(i in t)(t[i]||0===t[i])&&(Array.isArray(t[i])?s=s.concat(t[i]):s.push(t[i]));var h=this.calculateHash_(s);if(!this.atlases_[h]){var n=this.measureCanvas_.getContext("2d");n.font=t.font;var r=Math.ceil((1.5*n.measureText("M").width+t.lineWidth/2)*t.scale);this.atlases_[h]={atlas:new zn({space:t.lineWidth+1}),width:{},height:r}}return this.atlases_[h]},kn.prototype.calculateHash_=function(t){var i,s,h="";for(i=0,s=t.length;i<s;++i)h+=t[i];return h},kn.prototype.getTextures=function(){return this.textures_},kn.prototype.getHitDetectionTextures=function(){return this.textures_};var Tn=function(t,i,s){Uh.call(this),this.maxExtent_=i,this.tolerance_=t,this.renderBuffer_=s,this.replaysByZIndex_={}};ui.inherits(Tn,Uh),Tn.prototype.addDeclutter=function(){},Tn.prototype.getDeleteResourcesFunction=function(t){var i,s=[];for(i in this.replaysByZIndex_){var h,n=this.replaysByZIndex_[i];for(h in n)s.push(n[h].getDeleteResourcesFunction(t))}return function(){for(var t,i=s.length,h=0;h<i;h++)t=s[h].apply(this,arguments);return t}},Tn.prototype.finish=function(t){var i;for(i in this.replaysByZIndex_){var s,h=this.replaysByZIndex_[i];for(s in h)h[s].finish(t)}},Tn.prototype.getReplay=function(t,i){var s=void 0!==t?t.toString():"0",h=this.replaysByZIndex_[s];void 0===h&&(this.replaysByZIndex_[s]=h={});var n=h[i];return void 0===n&&(n=new(0,Tn.BATCH_CONSTRUCTORS_[i])(this.tolerance_,this.maxExtent_),h[i]=n),n},Tn.prototype.isEmpty=function(){return fi.isEmpty(this.replaysByZIndex_)},Tn.prototype.replay=function(t,i,s,h,n,r,e,o){var a,u,f,c,l,v,d=Object.keys(this.replaysByZIndex_).map(Number);for(d.sort(yi.numberSafeCompareFunction),a=0,u=d.length;a<u;++a)for(l=this.replaysByZIndex_[d[a].toString()],f=0,c=Yh.ORDER.length;f<c;++f)void 0!==(v=l[Yh.ORDER[f]])&&v.replay(t,i,s,h,n,r,e,o,void 0,!1)},Tn.prototype.replayHitDetection_=function(t,i,s,h,n,r,e,o,a,u,f){var c,l,v,d,M,m,p=Object.keys(this.replaysByZIndex_).map(Number);for(p.sort((function(t,i){return i-t})),c=0,l=p.length;c<l;++c)for(d=this.replaysByZIndex_[p[c].toString()],v=Yh.ORDER.length-1;v>=0;--v)if(void 0!==(M=d[Yh.ORDER[v]])&&(m=M.replay(t,i,s,h,n,r,e,o,a,u,f)))return m},Tn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e,o,a,u){var f,c=i.getGL();return c.bindFramebuffer(c.FRAMEBUFFER,i.getHitDetectionFramebuffer()),void 0!==this.renderBuffer_&&(f=bi.buffer(bi.createOrUpdateFromCoordinate(t),h*this.renderBuffer_)),this.replayHitDetection_(i,t,h,n,Tn.HIT_DETECTION_SIZE_,e,o,a,(function(t){var i=new Uint8Array(4);if(c.readPixels(0,0,1,1,c.RGBA,c.UNSIGNED_BYTE,i),i[3]>0){var s=u(t);if(s)return s}}),!0,f)},Tn.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n,r,e,o,a){var u=i.getGL();return u.bindFramebuffer(u.FRAMEBUFFER,i.getHitDetectionFramebuffer()),void 0!==this.replayHitDetection_(i,t,h,n,Tn.HIT_DETECTION_SIZE_,e,o,a,(function(){var t=new Uint8Array(4);return u.readPixels(0,0,1,1,u.RGBA,u.UNSIGNED_BYTE,t),t[3]>0}),!1)},Tn.HIT_DETECTION_SIZE_=[1,1],Tn.BATCH_CONSTRUCTORS_={Circle:dn,Image:_n,LineString:xn,Polygon:Rn,Text:kn};var On=function(t,i,s,h,n,r,e){mh.call(this),this.context_=t,this.center_=i,this.extent_=r,this.pixelRatio_=e,this.size_=n,this.rotation_=h,this.resolution_=s,this.imageStyle_=null,this.fillStyle_=null,this.strokeStyle_=null,this.textStyle_=null};ui.inherits(On,mh),On.prototype.drawText_=function(t,i){var s=this.context_,h=t.getReplay(0,"Text");h.setTextStyle(this.textStyle_),h.drawText(i,null),h.finish(s),h.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),h.getDeleteResourcesFunction(s)()},On.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},On.prototype.drawGeometry=function(t){switch(t.getType()){case"Point":this.drawPoint(t,null);break;case"LineString":this.drawLineString(t,null);break;case"Polygon":this.drawPolygon(t,null);break;case"MultiPoint":this.drawMultiPoint(t,null);break;case"MultiLineString":this.drawMultiLineString(t,null);break;case"MultiPolygon":this.drawMultiPolygon(t,null);break;case"GeometryCollection":this.drawGeometryCollection(t,null);break;case"Circle":this.drawCircle(t,null)}},On.prototype.drawFeature=function(t,i){var s=i.getGeometryFunction()(t);s&&bi.intersects(this.extent_,s.getExtent())&&(this.setStyle(i),this.drawGeometry(s))},On.prototype.drawGeometryCollection=function(t){var i,s,h=t.getGeometriesArray();for(i=0,s=h.length;i<s;++i)this.drawGeometry(h[i])},On.prototype.drawPoint=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Image");n.setImageStyle(this.imageStyle_),n.drawPoint(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiPoint=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Image");n.setImageStyle(this.imageStyle_),n.drawMultiPoint(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawLineString=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"LineString");n.setFillStrokeStyle(null,this.strokeStyle_),n.drawLineString(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiLineString=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"LineString");n.setFillStrokeStyle(null,this.strokeStyle_),n.drawMultiLineString(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawPolygon=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Polygon");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawPolygon(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawMultiPolygon=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Polygon");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawMultiPolygon(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.drawCircle=function(t,i){var s=this.context_,h=new Tn(1,this.extent_),n=h.getReplay(0,"Circle");n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawCircle(t,i),n.finish(s),n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(s)(),this.textStyle_&&this.drawText_(h,t)},On.prototype.setImageStyle=function(t){this.imageStyle_=t},On.prototype.setFillStrokeStyle=function(t,i){this.fillStyle_=t,this.strokeStyle_=i},On.prototype.setTextStyle=function(t){this.textStyle_=t};var Ln={};Ln.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_texture, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n gl_FragColor.a = texColor.a * u_opacity;\n}\n":"precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}"),Ln.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\n\nuniform mat4 u_texCoordMatrix;\nuniform mat4 u_projectionMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.);\n v_texCoord = (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}");var In=function(t,i){this.u_texCoordMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texCoordMatrix":"d"),this.u_projectionMatrix=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_projectionMatrix":"e"),this.u_opacity=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_opacity":"f"),this.u_texture=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texture":"g"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"b"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"c")},Fn=function(t,i){gh.call(this,i),this.mapRenderer=t,this.arrayBuffer_=new vn([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0,this.texCoordMatrix=Ii.create(),this.projectionMatrix=Ii.create(),this.tmpMat4_=un(),this.defaultLocations_=null};ui.inherits(Fn,gh),Fn.prototype.bindFramebuffer=function(t,i){var s=this.mapRenderer.getGL();if(void 0===this.framebufferDimension||this.framebufferDimension!=i){var h=function(t,i,s){t.isContextLost()||(t.deleteFramebuffer(i),t.deleteTexture(s))}.bind(null,s,this.framebuffer,this.texture);t.postRenderFunctions.push(h);var n=pn.createEmptyTexture(s,i,i),r=s.createFramebuffer();s.bindFramebuffer($i.FRAMEBUFFER,r),s.framebufferTexture2D($i.FRAMEBUFFER,$i.COLOR_ATTACHMENT0,$i.TEXTURE_2D,n,0),this.texture=n,this.framebuffer=r,this.framebufferDimension=i}else s.bindFramebuffer($i.FRAMEBUFFER,this.framebuffer)},Fn.prototype.composeFrame=function(t,i,s){this.dispatchComposeEvent_("precompose",s,t),s.bindBuffer($i.ARRAY_BUFFER,this.arrayBuffer_);var h,n=s.getGL(),r=s.getProgram(Ln.fragment,Ln.vertex);this.defaultLocations_?h=this.defaultLocations_:(h=new In(n,r),this.defaultLocations_=h),s.useProgram(r)&&(n.enableVertexAttribArray(h.a_position),n.vertexAttribPointer(h.a_position,2,$i.FLOAT,!1,16,0),n.enableVertexAttribArray(h.a_texCoord),n.vertexAttribPointer(h.a_texCoord,2,$i.FLOAT,!1,16,8),n.uniform1i(h.u_texture,0)),n.uniformMatrix4fv(h.u_texCoordMatrix,!1,fn(this.tmpMat4_,this.getTexCoordMatrix())),n.uniformMatrix4fv(h.u_projectionMatrix,!1,fn(this.tmpMat4_,this.getProjectionMatrix())),n.uniform1f(h.u_opacity,i.opacity),n.bindTexture($i.TEXTURE_2D,this.getTexture()),n.drawArrays($i.TRIANGLE_STRIP,0,4),this.dispatchComposeEvent_("postcompose",s,t)},Fn.prototype.dispatchComposeEvent_=function(t,i,s){var h=this.getLayer();if(h.hasListener(t)){var n=s.viewState,r=new On(i,n.center,n.resolution,n.rotation,s.size,s.extent,s.pixelRatio),e=new uh(t,r,s,null,i);h.dispatchEvent(e)}},Fn.prototype.getTexCoordMatrix=function(){return this.texCoordMatrix},Fn.prototype.getTexture=function(){return this.texture},Fn.prototype.getProjectionMatrix=function(){return this.projectionMatrix},Fn.prototype.handleWebGLContextLost=function(){this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0},Fn.prototype.prepareFrame=function(){},Fn.prototype.forEachLayerAtPixel=function(){};var Dn=function(t,i){Fn.call(this,t,i),this.image_=null,this.hitCanvasContext_=null,this.hitTransformationMatrix_=null};ui.inherits(Dn,Fn),Dn.handles=function(t,i){return"webgl"===t&&"IMAGE"===i.getType()},Dn.create=function(t,i){return new Dn(t,i)},Dn.prototype.createTexture_=function(t){var i=t.getImage(),s=this.mapRenderer.getGL();return pn.createTexture(s,i,$i.CLAMP_TO_EDGE,$i.CLAMP_TO_EDGE)},Dn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){var r=this.getLayer();return r.getSource().forEachFeatureAtCoordinate(t,i.viewState.resolution,i.viewState.rotation,s,i.skippedFeatureUids,(function(t){return h.call(n,t,r)}))},Dn.prototype.prepareFrame=function(t,i){var s=this.mapRenderer.getGL(),h=t.pixelRatio,n=t.viewState,r=n.center,e=n.resolution,o=n.rotation,a=this.image_,u=this.texture,f=this.getLayer().getSource(),c=t.viewHints,l=t.extent;if(void 0!==i.extent&&(l=bi.getIntersection(l,i.extent)),!c[0]&&!c[1]&&!bi.isEmpty(l)){var v=n.projection;if(!ui.ENABLE_RASTER_REPROJECTION){var d=f.getProjection();d&&(v=d)}var M=f.getImage(l,e,h,v);if(M&&this.loadImage(M)&&(a=M,u=this.createTexture_(M),this.texture)){var m=function(t,i){t.isContextLost()||t.deleteTexture(i)}.bind(null,s,this.texture);t.postRenderFunctions.push(m)}}if(a){var p=this.mapRenderer.getContext().getCanvas();this.updateProjectionMatrix_(p.width,p.height,h,r,e,o,a.getExtent()),this.hitTransformationMatrix_=null;var g=this.texCoordMatrix;Ii.reset(g),Ii.scale(g,1,-1),Ii.translate(g,0,-1),this.image_=a,this.texture=u,this.updateLogos(t,f)}return!!a},Dn.prototype.updateProjectionMatrix_=function(t,i,s,h,n,r,e){var o=t*n,a=i*n,u=this.projectionMatrix;Ii.reset(u),Ii.scale(u,2*s/o,2*s/a),Ii.rotate(u,-r),Ii.translate(u,e[0]-h[0],e[1]-h[1]),Ii.scale(u,(e[2]-e[0])/2,(e[3]-e[1])/2),Ii.translate(u,1,1)},Dn.prototype.hasFeatureAtCoordinate=function(t,i){return void 0!==this.forEachFeatureAtCoordinate(t,i,0,xi.TRUE,this)},Dn.prototype.forEachLayerAtPixel=function(t,i,s,h){if(this.image_&&this.image_.getImage()){if(this.getLayer().getSource().forEachFeatureAtCoordinate!==ui.nullFunction){var n=Ii.apply(i.pixelToCoordinateTransform,t.slice());return this.forEachFeatureAtCoordinate(n,i,0,xi.TRUE,this)?s.call(h,this.getLayer(),null):void 0}var r=[this.image_.getImage().width,this.image_.getImage().height];this.hitTransformationMatrix_||(this.hitTransformationMatrix_=this.getHitTransformationMatrix_(i.size,r));var e=Ii.apply(this.hitTransformationMatrix_,t.slice());if(!(e[0]<0||e[0]>r[0]||e[1]<0||e[1]>r[1])){this.hitCanvasContext_||(this.hitCanvasContext_=Cs(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.image_.getImage(),e[0],e[1],1,1,0,0,1,1);var o=this.hitCanvasContext_.getImageData(0,0,1,1).data;return o[3]>0?s.call(h,this.getLayer(),o):void 0}}},Dn.prototype.getHitTransformationMatrix_=function(t,i){var s=Ii.create();Ii.translate(s,-1,-1),Ii.scale(s,2/t[0],2/t[1]),Ii.translate(s,0,t[1]),Ii.scale(s,1,-1);var h=Ii.invert(this.projectionMatrix.slice()),n=Ii.create();return Ii.translate(n,0,i[1]),Ii.scale(n,1,-1),Ii.scale(n,i[0]/2,i[1]/2),Ii.translate(n,1,1),Ii.multiply(n,h),Ii.multiply(n,s),n};var Gn=function(t,i){Eh.call(this,t,i),this.canvas_=document.createElement("CANVAS"),this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=Gs.CLASS_UNSELECTABLE,t.insertBefore(this.canvas_,t.childNodes[0]||null),this.clipTileCanvasWidth_=0,this.clipTileCanvasHeight_=0,this.clipTileContext_=Cs(),this.renderedVisible_=!0,this.gl_=$i.getContext(this.canvas_,{antialias:!0,depth:!0,failIfMajorPerformanceCaveat:!0,preserveDrawingBuffer:!1,stencil:!0}),this.context_=new pn(this.canvas_,this.gl_),ci.listen(this.canvas_,"webglcontextlost",this.handleWebGLContextLost,this),ci.listen(this.canvas_,"webglcontextrestored",this.handleWebGLContextRestored,this),this.textureCache_=new fh,this.focus_=null,this.tileTextureQueue_=new ms(function(t){var i=t[1],s=t[2],h=i[0]-this.focus_[0],n=i[1]-this.focus_[1];return 65536*Math.log(s)+Math.sqrt(h*h+n*n)/s}.bind(this),(function(t){return t[0].getKey()})),this.loadNextTileTexture_=function(){if(!this.tileTextureQueue_.isEmpty()){this.tileTextureQueue_.reprioritize();var t=this.tileTextureQueue_.dequeue();this.bindTileTexture(t[0],t[3],t[4],$i.LINEAR,$i.LINEAR)}return!1}.bind(this),this.textureCacheFrameMarkerCount_=0,this.initializeGL_()};ui.inherits(Gn,Eh),Gn.handles=function(t){return ts.WEBGL&&"webgl"===t},Gn.create=function(t,i){return new Gn(t,i)},Gn.prototype.bindTileTexture=function(t,i,s,h,n){var r=this.getGL(),e=t.getKey();if(this.textureCache_.containsKey(e)){var o=this.textureCache_.get(e);r.bindTexture($i.TEXTURE_2D,o.texture),o.magFilter!=h&&(r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MAG_FILTER,h),o.magFilter=h),o.minFilter!=n&&(r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MIN_FILTER,n),o.minFilter=n)}else{var a=r.createTexture();if(r.bindTexture($i.TEXTURE_2D,a),s>0){var u=this.clipTileContext_.canvas,f=this.clipTileContext_;this.clipTileCanvasWidth_!==i[0]||this.clipTileCanvasHeight_!==i[1]?(u.width=i[0],u.height=i[1],this.clipTileCanvasWidth_=i[0],this.clipTileCanvasHeight_=i[1]):f.clearRect(0,0,i[0],i[1]),f.drawImage(t.getImage(),s,s,i[0],i[1],0,0,i[0],i[1]),r.texImage2D($i.TEXTURE_2D,0,$i.RGBA,$i.RGBA,$i.UNSIGNED_BYTE,u)}else r.texImage2D($i.TEXTURE_2D,0,$i.RGBA,$i.RGBA,$i.UNSIGNED_BYTE,t.getImage());r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MAG_FILTER,h),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_MIN_FILTER,n),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_S,$i.CLAMP_TO_EDGE),r.texParameteri($i.TEXTURE_2D,$i.TEXTURE_WRAP_T,$i.CLAMP_TO_EDGE),this.textureCache_.set(e,{texture:a,magFilter:h,minFilter:n})}},Gn.prototype.dispatchComposeEvent_=function(t,i){var s=this.getMap();if(s.hasListener(t)){var h=this.context_,n=i.viewState,r=new On(h,n.center,n.resolution,n.rotation,i.size,i.extent,i.pixelRatio),e=new uh(t,r,i,null,h);s.dispatchEvent(e)}},Gn.prototype.disposeInternal=function(){var t=this.getGL();t.isContextLost()||this.textureCache_.forEach((function(i){i&&t.deleteTexture(i.texture)})),this.context_.dispose(),Eh.prototype.disposeInternal.call(this)},Gn.prototype.expireCache_=function(t,i){for(var s,h=this.getGL();this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>ui.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK;){if(s=this.textureCache_.peekLast())h.deleteTexture(s.texture);else{if(+this.textureCache_.peekLastKey()==i.index)break;--this.textureCacheFrameMarkerCount_}this.textureCache_.pop()}},Gn.prototype.getContext=function(){return this.context_},Gn.prototype.getGL=function(){return this.gl_},Gn.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_},Gn.prototype.getType=function(){return"webgl"},Gn.prototype.handleWebGLContextLost=function(t){t.preventDefault(),this.textureCache_.clear(),this.textureCacheFrameMarkerCount_=0;var i=this.getLayerRenderers();for(var s in i)i[s].handleWebGLContextLost()},Gn.prototype.handleWebGLContextRestored=function(){this.initializeGL_(),this.getMap().render()},Gn.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture($i.TEXTURE0),t.blendFuncSeparate($i.SRC_ALPHA,$i.ONE_MINUS_SRC_ALPHA,$i.ONE,$i.ONE_MINUS_SRC_ALPHA),t.disable($i.CULL_FACE),t.disable($i.DEPTH_TEST),t.disable($i.SCISSOR_TEST),t.disable($i.STENCIL_TEST)},Gn.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())},Gn.prototype.renderFrame=function(t){var i=this.getContext(),s=this.getGL();if(s.isContextLost())return!1;if(!t)return this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1),!1;this.focus_=t.focus,this.textureCache_.set((-t.index).toString(),null),++this.textureCacheFrameMarkerCount_,this.dispatchComposeEvent_("precompose",t);var h=[],n=t.layerStatesArray;yi.stableSort(n,Eh.sortByZIndex);var r,e,o,a=t.viewState.resolution;for(r=0,e=n.length;r<e;++r)Ws.visibleAtResolution(o=n[r],a)&&"ready"==o.sourceState&&this.getLayerRenderer(o.layer).prepareFrame(t,o,i)&&h.push(o);var u=t.size[0]*t.pixelRatio,f=t.size[1]*t.pixelRatio;for(this.canvas_.width==u&&this.canvas_.height==f||(this.canvas_.width=u,this.canvas_.height=f),s.bindFramebuffer($i.FRAMEBUFFER,null),s.clearColor(0,0,0,0),s.clear($i.COLOR_BUFFER_BIT),s.enable($i.BLEND),s.viewport(0,0,this.canvas_.width,this.canvas_.height),r=0,e=h.length;r<e;++r)this.getLayerRenderer((o=h[r]).layer).composeFrame(t,o,i);this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.calculateMatrices2D(t),this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>ui.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK&&t.postRenderFunctions.push(this.expireCache_.bind(this)),this.tileTextureQueue_.isEmpty()||(t.postRenderFunctions.push(this.loadNextTileTexture_),t.animate=!0),this.dispatchComposeEvent_("postcompose",t),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)},Gn.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n,r,e){var o;if(this.getGL().isContextLost())return!1;var a,u=i.viewState,f=i.layerStatesArray;for(a=f.length-1;a>=0;--a){var c=f[a],l=c.layer;if(Ws.visibleAtResolution(c,u.resolution)&&r.call(e,l)&&(o=this.getLayerRenderer(l).forEachFeatureAtCoordinate(t,i,s,h,n)))return o}},Gn.prototype.hasFeatureAtCoordinate=function(t,i,s,h,n){var r=!1;if(this.getGL().isContextLost())return!1;var e,o=i.viewState,a=i.layerStatesArray;for(e=a.length-1;e>=0;--e){var u=a[e],f=u.layer;if(Ws.visibleAtResolution(u,o.resolution)&&h.call(n,f)&&(r=this.getLayerRenderer(f).hasFeatureAtCoordinate(t,i)))return!0}return r},Gn.prototype.forEachLayerAtPixel=function(t,i,s,h,n){if(this.getGL().isContextLost())return!1;var r,e,o=i.viewState,a=i.layerStatesArray;for(e=a.length-1;e>=0;--e){var u=a[e],f=u.layer;if(Ws.visibleAtResolution(u,o.resolution)&&n.call(h,f)&&(r=this.getLayerRenderer(f).forEachLayerAtPixel(t,i,s,h)))return r}};var Wn={};Wn.fragment=new rn(ui.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n":"precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}"),Wn.vertex=new en(ui.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}");var Vn=function(t,i){this.u_tileOffset=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_tileOffset":"d"),this.u_texture=t.getUniformLocation(i,ui.DEBUG_WEBGL?"u_texture":"e"),this.a_position=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_position":"b"),this.a_texCoord=t.getAttribLocation(i,ui.DEBUG_WEBGL?"a_texCoord":"c")},jn=function(t,i){Fn.call(this,t,i),this.fragmentShader_=Wn.fragment,this.vertexShader_=Wn.vertex,this.locations_=null,this.renderArrayBuffer_=new vn([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]),this.renderedTileRange_=null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,this.tmpSize_=[0,0]};ui.inherits(jn,Fn),jn.handles=function(t,i){return"webgl"===t&&"TILE"===i.getType()},jn.create=function(t,i){return new jn(t,i)},jn.prototype.disposeInternal=function(){this.mapRenderer.getContext().deleteBuffer(this.renderArrayBuffer_),Fn.prototype.disposeInternal.call(this)},jn.prototype.createLoadedTileFinder=function(t,i,s){var h=this.mapRenderer;return function(n,r){return t.forEachLoadedTile(i,n,r,(function(t){var i=h.isTileTextureLoaded(t);return i&&(s[n]||(s[n]={}),s[n][t.tileCoord.toString()]=t),i}))}},jn.prototype.handleWebGLContextLost=function(){Fn.prototype.handleWebGLContextLost.call(this),this.locations_=null},jn.prototype.prepareFrame=function(t,i,s){var h,n=this.mapRenderer,r=s.getGL(),e=t.viewState,o=e.projection,a=this.getLayer(),u=a.getSource(),f=u.getTileGridForProjection(o),c=f.getZForResolution(e.resolution),l=f.getResolution(c),v=u.getTilePixelSize(c,t.pixelRatio,o),d=v[0]/Os(f.getTileSize(c),this.tmpSize_)[0],M=l/d,m=u.getTilePixelRatio(d)*u.getGutter(o),p=e.center,g=t.extent,_=f.getTileRangeForExtentAndZ(g,c);if(this.renderedTileRange_&&this.renderedTileRange_.equals(_)&&this.renderedRevision_==u.getRevision())h=this.renderedFramebufferExtent_;else{var w=_.getSize(),y=Math.max(w[0]*v[0],w[1]*v[1]),b=_i.roundUpToPowerOfTwo(y),x=M*b,E=f.getOrigin(c),S=E[0]+_.minX*v[0]*M,C=E[1]+_.minY*v[1]*M;h=[S,C,S+x,C+x],this.bindFramebuffer(t,b),r.viewport(0,0,b,b),r.clearColor(0,0,0,0),r.clear($i.COLOR_BUFFER_BIT),r.disable($i.BLEND);var A=s.getProgram(this.fragmentShader_,this.vertexShader_);s.useProgram(A),this.locations_||(this.locations_=new Vn(r,A)),s.bindBuffer($i.ARRAY_BUFFER,this.renderArrayBuffer_),r.enableVertexAttribArray(this.locations_.a_position),r.vertexAttribPointer(this.locations_.a_position,2,$i.FLOAT,!1,16,0),r.enableVertexAttribArray(this.locations_.a_texCoord),r.vertexAttribPointer(this.locations_.a_texCoord,2,$i.FLOAT,!1,16,8),r.uniform1i(this.locations_.u_texture,0);var P={};P[c]={};var R,N,z,k,T,O,L=this.createLoadedTileFinder(u,o,P),I=a.getUseInterimTilesOnError(),F=!0,D=bi.createEmpty(),G=new Ch(0,0,0,0);for(k=_.minX;k<=_.maxX;++k)for(T=_.minY;T<=_.maxY;++T)if(N=u.getTile(c,k,T,d,o),void 0===i.extent||(O=f.getTileCoordExtent(N.tileCoord,D),bi.intersects(O,i.extent))){if(2==(z=N.getState())||4==z||3==z&&!I||(N=N.getInterimTile()),2==(z=N.getState())){if(n.isTileTextureLoaded(N)){P[c][N.tileCoord.toString()]=N;continue}}else if(4==z||3==z&&!I)continue;F=!1,f.forEachTileCoordParentTileRange(N.tileCoord,L,null,G,D)||(R=f.getTileCoordChildTileRange(N.tileCoord,G,D))&&L(c+1,R)}var W=Object.keys(P).map(Number);W.sort(yi.numberSafeCompareFunction);var V,j,U,X,q=new Float32Array(4);for(V=0,j=W.length;V<j;++V)for(U in X=P[W[V]])O=f.getTileCoordExtent((N=X[U]).tileCoord,D),q[0]=2*(O[2]-O[0])/x,q[1]=2*(O[3]-O[1])/x,q[2]=2*(O[0]-h[0])/x-1,q[3]=2*(O[1]-h[1])/x-1,r.uniform4fv(this.locations_.u_tileOffset,q),n.bindTileTexture(N,v,m*d,$i.LINEAR,$i.LINEAR),r.drawArrays($i.TRIANGLE_STRIP,0,4);F?(this.renderedTileRange_=_,this.renderedFramebufferExtent_=h,this.renderedRevision_=u.getRevision()):(this.renderedTileRange_=null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,t.animate=!0)}this.updateUsedTiles(t.usedTiles,u,c,_);var Y=n.getTileTextureQueue();this.manageTilePyramid(t,u,f,d,o,g,c,a.getPreload(),(function(t){2!=t.getState()||n.isTileTextureLoaded(t)||Y.isKeyQueued(t.getKey())||Y.enqueue([t,f.getTileCoordCenter(t.tileCoord),f.getResolution(t.tileCoord[0]),v,m*d])}),this),this.scheduleExpireCache(t,u),this.updateLogos(t,u);var B=this.texCoordMatrix;return Ii.reset(B),Ii.translate(B,(Math.round(p[0]/l)*l-h[0])/(h[2]-h[0]),(Math.round(p[1]/l)*l-h[1])/(h[3]-h[1])),0!==e.rotation&&Ii.rotate(B,e.rotation),Ii.scale(B,t.size[0]*e.resolution/(h[2]-h[0]),t.size[1]*e.resolution/(h[3]-h[1])),Ii.translate(B,-.5,-.5),!0},jn.prototype.forEachLayerAtPixel=function(t,i,s,h){if(this.framebuffer){var n=Ii.apply(this.texCoordMatrix,[t[0]/i.size[0],(i.size[1]-t[1])/i.size[1]].slice()),r=[n[0]*this.framebufferDimension,n[1]*this.framebufferDimension],e=this.mapRenderer.getContext().getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer);var o=new Uint8Array(4);return e.readPixels(r[0],r[1],1,1,e.RGBA,e.UNSIGNED_BYTE,o),o[3]>0?s.call(h,this.getLayer(),o):void 0}};var Un=function(t,i){Fn.call(this,t,i),this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bi.createEmpty(),this.renderedRenderOrder_=null,this.replayGroup_=null,this.layerState_=null};ui.inherits(Un,Fn),Un.handles=function(t,i){return"webgl"===t&&"VECTOR"===i.getType()},Un.create=function(t,i){return new Un(t,i)},Un.prototype.composeFrame=function(t,i,s){this.layerState_=i;var h=t.viewState,n=this.replayGroup_,r=t.size,e=t.pixelRatio,o=this.mapRenderer.getGL();n&&!n.isEmpty()&&(o.enable(o.SCISSOR_TEST),o.scissor(0,0,r[0]*e,r[1]*e),n.replay(s,h.center,h.resolution,h.rotation,r,e,i.opacity,i.managed?t.skippedFeatureUids:{}),o.disable(o.SCISSOR_TEST))},Un.prototype.disposeInternal=function(){var t=this.replayGroup_;if(t){var i=this.mapRenderer.getContext();t.getDeleteResourcesFunction(i)(),this.replayGroup_=null}Fn.prototype.disposeInternal.call(this)},Un.prototype.forEachFeatureAtCoordinate=function(t,i,s,h,n){if(this.replayGroup_&&this.layerState_){var r=this.mapRenderer.getContext(),e=i.viewState,o=this.getLayer(),a={};return this.replayGroup_.forEachFeatureAtCoordinate(t,r,e.center,e.resolution,e.rotation,i.size,i.pixelRatio,this.layerState_.opacity,{},(function(t){var i=ui.getUid(t).toString();if(!(i in a))return a[i]=!0,h.call(n,t,o)}))}},Un.prototype.hasFeatureAtCoordinate=function(t,i){if(this.replayGroup_&&this.layerState_){var s=this.mapRenderer.getContext(),h=i.viewState;return this.replayGroup_.hasFeatureAtCoordinate(t,s,h.center,h.resolution,h.rotation,i.size,i.pixelRatio,this.layerState_.opacity,i.skippedFeatureUids)}return!1},Un.prototype.forEachLayerAtPixel=function(t,i,s,h){var n=Ii.apply(i.pixelToCoordinateTransform,t.slice());return this.hasFeatureAtCoordinate(n,i)?s.call(h,this.getLayer(),null):void 0},Un.prototype.handleStyleImageChange_=function(){this.renderIfReadyAndVisible()},Un.prototype.prepareFrame=function(t,i,s){var h=this.getLayer(),n=h.getSource();this.updateLogos(t,n);var r=t.viewHints[0],e=t.viewHints[1],o=h.getUpdateWhileAnimating(),a=h.getUpdateWhileInteracting();if(!this.dirty_&&!o&&r||!a&&e)return!0;var u=t.extent,f=t.viewState,c=f.projection,l=f.resolution,v=t.pixelRatio,d=h.getRevision(),M=h.getRenderBuffer(),m=h.getRenderOrder();void 0===m&&(m=tn.defaultOrder);var p=bi.buffer(u,M*l);if(!this.dirty_&&this.renderedResolution_==l&&this.renderedRevision_==d&&this.renderedRenderOrder_==m&&bi.containsExtent(this.renderedExtent_,p))return!0;this.replayGroup_&&t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(s)),this.dirty_=!1;var g=new Tn(tn.getTolerance(l,v),p,h.getRenderBuffer());n.loadFeatures(p,l,c);var _=function(t){var i,s=t.getStyleFunction();if(s?i=s.call(t,l):(s=h.getStyleFunction())&&(i=s(t,l)),i){var n=this.renderFeature(t,l,v,i,g);this.dirty_=this.dirty_||n}};if(m){var w=[];n.forEachFeatureInExtent(p,(function(t){w.push(t)}),this),w.sort(m),w.forEach(_,this)}else n.forEachFeatureInExtent(p,_,this);return g.finish(s),this.renderedResolution_=l,this.renderedRevision_=d,this.renderedRenderOrder_=m,this.renderedExtent_=p,this.replayGroup_=g,!0},Un.prototype.renderFeature=function(t,i,s,h,n){if(!h)return!1;var r=!1;if(Array.isArray(h))for(var e=h.length-1;e>=0;--e)r=tn.renderFeature(n,t,h[e],tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;else r=tn.renderFeature(n,t,h,tn.getSquaredTolerance(i,s),this.handleStyleImageChange_,this)||r;return r},ui.ENABLE_CANVAS&&(zs.register("MAP_RENDERER",Sh),zs.registerMultiple("LAYER_RENDERER",[yh,Ah,sn,hn])),ui.ENABLE_WEBGL&&(zs.register("MAP_RENDERER",Gn),zs.registerMultiple("LAYER_RENDERER",[Dn,jn,Un]));var Xn=function(t){(t=fi.assign({},t)).controls||(t.controls=Xs()),t.interactions||(t.interactions=eh()),Ls.call(this,t)};ui.inherits(Xn,Ls);var qn=function(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.snapToPixel_=t.snapToPixel};qn.prototype.getOpacity=function(){return this.opacity_},qn.prototype.getRotateWithView=function(){return this.rotateWithView_},qn.prototype.getRotation=function(){return this.rotation_},qn.prototype.getScale=function(){return this.scale_},qn.prototype.getSnapToPixel=function(){return this.snapToPixel_},qn.prototype.getAnchor=function(){},qn.prototype.getImage=function(){},qn.prototype.getHitDetectionImage=function(){},qn.prototype.getImageState=function(){},qn.prototype.getImageSize=function(){},qn.prototype.getHitDetectionImageSize=function(){},qn.prototype.getOrigin=function(){},qn.prototype.getSize=function(){},qn.prototype.setOpacity=function(t){this.opacity_=t},qn.prototype.setRotateWithView=function(t){this.rotateWithView_=t},qn.prototype.setRotation=function(t){this.rotation_=t},qn.prototype.setScale=function(t){this.scale_=t},qn.prototype.setSnapToPixel=function(t){this.snapToPixel_=t},qn.prototype.listenImageChange=function(){},qn.prototype.load=function(){},qn.prototype.unlistenImageChange=function(){};var Yn=function(t){this.checksums_=null,this.canvas_=null,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=void 0!==t.radius?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.anchor_=null,this.size_=null,this.imageSize_=null,this.hitDetectionImageSize_=null,this.atlasManager_=t.atlasManager,this.render_(this.atlasManager_),qn.call(this,{opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:1,snapToPixel:void 0===t.snapToPixel||t.snapToPixel})};ui.inherits(Yn,qn),Yn.prototype.clone=function(){var t=new Yn({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),snapToPixel:this.getSnapToPixel(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},Yn.prototype.getAnchor=function(){return this.anchor_},Yn.prototype.getAngle=function(){return this.angle_},Yn.prototype.getFill=function(){return this.fill_},Yn.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_},Yn.prototype.getImage=function(){return this.canvas_},Yn.prototype.getImageSize=function(){return this.imageSize_},Yn.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},Yn.prototype.getImageState=function(){return 2},Yn.prototype.getOrigin=function(){return this.origin_},Yn.prototype.getPoints=function(){return this.points_},Yn.prototype.getRadius=function(){return this.radius_},Yn.prototype.getRadius2=function(){return this.radius2_},Yn.prototype.getSize=function(){return this.size_},Yn.prototype.getStroke=function(){return this.stroke_},Yn.prototype.listenImageChange=function(){},Yn.prototype.load=function(){},Yn.prototype.unlistenImageChange=function(){},Yn.prototype.render_=function(t){var i,s,h="",n="",r=0,e=null,o=0,a=0;this.stroke_&&(null===(s=this.stroke_.getColor())&&(s=vh.defaultStrokeStyle),s=Mh.asColorLike(s),void 0===(a=this.stroke_.getWidth())&&(a=vh.defaultLineWidth),e=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),ts.CANVAS_LINE_DASH||(e=null,o=0),void 0===(n=this.stroke_.getLineJoin())&&(n=vh.defaultLineJoin),void 0===(h=this.stroke_.getLineCap())&&(h=vh.defaultLineCap),void 0===(r=this.stroke_.getMiterLimit())&&(r=vh.defaultMiterLimit));var u=2*(this.radius_+a)+1,f={strokeStyle:s,strokeWidth:a,size:u,lineCap:h,lineDash:e,lineDashOffset:o,lineJoin:n,miterLimit:r};if(void 0===t){var c=Cs(u,u);this.canvas_=c.canvas,i=u=this.canvas_.width,this.draw_(f,c,0,0),this.createHitDetectionCanvas_(f)}else{u=Math.round(u);var l,v=!this.fill_;v&&(l=this.drawHitDetectionCanvas_.bind(this,f));var d=this.getChecksum(),M=t.add(d,u,u,this.draw_.bind(this,f),l);this.canvas_=M.image,this.origin_=[M.offsetX,M.offsetY],i=M.image.width,v?(this.hitDetectionCanvas_=M.hitImage,this.hitDetectionImageSize_=[M.hitImage.width,M.hitImage.height]):(this.hitDetectionCanvas_=this.canvas_,this.hitDetectionImageSize_=[i,i])}this.anchor_=[u/2,u/2],this.size_=[u,u],this.imageSize_=[i,i]},Yn.prototype.draw_=function(t,i,s,h){var n,r,e;i.setTransform(1,0,0,1,0,0),i.translate(s,h),i.beginPath();var o=this.points_;if(o===1/0)i.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var a=void 0!==this.radius2_?this.radius2_:this.radius_;for(a!==this.radius_&&(o*=2),n=0;n<=o;n++)r=2*n*Math.PI/o-Math.PI/2+this.angle_,i.lineTo(t.size/2+(e=n%2==0?this.radius_:a)*Math.cos(r),t.size/2+e*Math.sin(r))}if(this.fill_){var u=this.fill_.getColor();null===u&&(u=vh.defaultFillStyle),i.fillStyle=Mh.asColorLike(u),i.fill()}this.stroke_&&(i.strokeStyle=t.strokeStyle,i.lineWidth=t.strokeWidth,t.lineDash&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.lineCap=t.lineCap,i.lineJoin=t.lineJoin,i.miterLimit=t.miterLimit,i.stroke()),i.closePath()},Yn.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.fill_)this.hitDetectionCanvas_=this.canvas_;else{var i=Cs(t.size,t.size);this.hitDetectionCanvas_=i.canvas,this.drawHitDetectionCanvas_(t,i,0,0)}},Yn.prototype.drawHitDetectionCanvas_=function(t,i,s,h){i.setTransform(1,0,0,1,0,0),i.translate(s,h),i.beginPath();var n=this.points_;if(n===1/0)i.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var r,e,o,a=void 0!==this.radius2_?this.radius2_:this.radius_;for(a!==this.radius_&&(n*=2),r=0;r<=n;r++)o=2*r*Math.PI/n-Math.PI/2+this.angle_,i.lineTo(t.size/2+(e=r%2==0?this.radius_:a)*Math.cos(o),t.size/2+e*Math.sin(o))}i.fillStyle=vh.defaultFillStyle,i.fill(),this.stroke_&&(i.strokeStyle=t.strokeStyle,i.lineWidth=t.strokeWidth,t.lineDash&&(i.setLineDash(t.lineDash),i.lineDashOffset=t.lineDashOffset),i.stroke()),i.closePath()},Yn.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-",i=this.fill_?this.fill_.getChecksum():"-";if(!this.checksums_||t!=this.checksums_[1]||i!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.radius2_!=this.checksums_[4]||this.angle_!=this.checksums_[5]||this.points_!=this.checksums_[6]){var s="r"+t+i+(void 0!==this.radius_?this.radius_.toString():"-")+(void 0!==this.radius2_?this.radius2_.toString():"-")+(void 0!==this.angle_?this.angle_.toString():"-")+(void 0!==this.points_?this.points_.toString():"-");this.checksums_=[s,t,i,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]};var Bn=function(t){var i=t||{};Yn.call(this,{points:1/0,fill:i.fill,radius:i.radius,snapToPixel:i.snapToPixel,stroke:i.stroke,atlasManager:i.atlasManager})};ui.inherits(Bn,Yn),Bn.prototype.clone=function(){var t=new Bn({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),snapToPixel:this.getSnapToPixel(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},Bn.prototype.setRadius=function(t){this.radius_=t,this.render_(this.atlasManager_)};var Hn=function(t){var i=t||{};this.color_=void 0!==i.color?i.color:null,this.checksum_=void 0};Hn.prototype.clone=function(){var t=this.getColor();return new Hn({color:t&&t.slice?t.slice():t||void 0})},Hn.prototype.getColor=function(){return this.color_},Hn.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},Hn.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_=this.color_ instanceof CanvasPattern||this.color_ instanceof CanvasGradient?ui.getUid(this.color_).toString():"f"+(this.color_?dh.asString(this.color_):"-")),this.checksum_};var Jn=function(t){var i=t||{};this.geometry_=null,this.geometryFunction_=Jn.defaultGeometryFunction,void 0!==i.geometry&&this.setGeometry(i.geometry),this.fill_=void 0!==i.fill?i.fill:null,this.image_=void 0!==i.image?i.image:null,this.renderer_=void 0!==i.renderer?i.renderer:null,this.stroke_=void 0!==i.stroke?i.stroke:null,this.text_=void 0!==i.text?i.text:null,this.zIndex_=i.zIndex};Jn.prototype.clone=function(){var t=this.getGeometry();return t&&t.clone&&(t=t.clone()),new Jn({geometry:t,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()})},Jn.prototype.getRenderer=function(){return this.renderer_},Jn.prototype.setRenderer=function(t){this.renderer_=t},Jn.prototype.getGeometry=function(){return this.geometry_},Jn.prototype.getGeometryFunction=function(){return this.geometryFunction_},Jn.prototype.getFill=function(){return this.fill_},Jn.prototype.setFill=function(t){this.fill_=t},Jn.prototype.getImage=function(){return this.image_},Jn.prototype.setImage=function(t){this.image_=t},Jn.prototype.getStroke=function(){return this.stroke_},Jn.prototype.setStroke=function(t){this.stroke_=t},Jn.prototype.getText=function(){return this.text_},Jn.prototype.setText=function(t){this.text_=t},Jn.prototype.getZIndex=function(){return this.zIndex_},Jn.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(i){return i.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Jn.defaultGeometryFunction,this.geometry_=t},Jn.prototype.setZIndex=function(t){this.zIndex_=t},Jn.createFunction=function(t){var i,s;return"function"==typeof t?i=t:(Array.isArray(t)?s=t:(gi(t instanceof Jn,41),s=[t]),i=function(){return s}),i},Jn.default_=null,Jn.defaultFunction=function(){if(!Jn.default_){var t=new Hn({color:"rgba(255,255,255,0.4)"}),i=new Cn({color:"#3399CC",width:1.25});Jn.default_=[new Jn({image:new Bn({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return Jn.default_},Jn.createDefaultEditing=function(){var t={},i=[255,255,255,1],s=[0,153,255,1];return t.Polygon=[new Jn({fill:new Hn({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Jn({stroke:new Cn({color:i,width:5})}),new Jn({stroke:new Cn({color:s,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Jn({image:new Bn({radius:6,fill:new Hn({color:s}),stroke:new Cn({color:i,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t},Jn.defaultGeometryFunction=function(t){return t.getGeometry()};var Zn=function(t){mi.call(this),this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,ci.listen(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),void 0!==t&&(t instanceof Fi||!t?this.setGeometry(t):this.setProperties(t))};ui.inherits(Zn,mi),Zn.prototype.clone=function(){var t=new Zn(this.getProperties());t.setGeometryName(this.getGeometryName());var i=this.getGeometry();i&&t.setGeometry(i.clone());var s=this.getStyle();return s&&t.setStyle(s),t},Zn.prototype.getGeometry=function(){return this.get(this.geometryName_)},Zn.prototype.getId=function(){return this.id_},Zn.prototype.getGeometryName=function(){return this.geometryName_},Zn.prototype.getStyle=function(){return this.style_},Zn.prototype.getStyleFunction=function(){return this.styleFunction_},Zn.prototype.handleGeometryChange_=function(){this.changed()},Zn.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(ci.unlistenByKey(this.geometryChangeKey_),this.geometryChangeKey_=null);var t=this.getGeometry();t&&(this.geometryChangeKey_=ci.listen(t,"change",this.handleGeometryChange_,this)),this.changed()},Zn.prototype.setGeometry=function(t){this.set(this.geometryName_,t)},Zn.prototype.setStyle=function(t){this.style_=t,this.styleFunction_=t?Zn.createStyleFunction(t):void 0,this.changed()},Zn.prototype.setId=function(t){this.id_=t,this.changed()},Zn.prototype.setGeometryName=function(t){ci.unlisten(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),this.geometryName_=t,ci.listen(this,mi.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this),this.handleGeometryChanged_()},Zn.createStyleFunction=function(t){var i,s;return"function"==typeof t?i=2==t.length?function(i){return t(this,i)}:t:(Array.isArray(t)?s=t:(gi(t instanceof Jn,41),s=[t]),i=function(){return s}),i};var Kn={createOrUpdate:function(t,i,s,h){return void 0!==h?(h[0]=t,h[1]=i,h[2]=s,h):[t,i,s]},getKeyZXY:function(t,i,s){return t+"/"+i+"/"+s},getKey:function(t){return Kn.getKeyZXY(t[0],t[1],t[2])},fromKey:function(t){return t.split("/").map(Number)},hash:function(t){return(t[1]<<t[0])+t[2]},quadKey:function(t){var i,s,h=t[0],n=new Array(h),r=1<<h-1;for(i=0;i<h;++i)s=48,t[1]&r&&(s+=1),t[2]&r&&(s+=2),n[i]=String.fromCharCode(s),r>>=1;return n.join("")},withinExtentAndZ:function(t,i){var s=t[0],h=t[1],n=t[2];if(i.getMinZoom()>s||s>i.getMaxZoom())return!1;var r,e=i.getExtent();return!(r=e?i.getTileRangeForExtentAndZ(e,s):i.getFullTileRange(s))||r.containsXY(h,n)}},Qn={createFromTemplate:function(t,i){var s=/\{z\}/g,h=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(e){return e?t.replace(s,e[0].toString()).replace(h,e[1].toString()).replace(n,(function(){return(-e[2]-1).toString()})).replace(r,(function(){var t=i.getFullTileRange(e[0]);return gi(t,55),(t.getHeight()+e[2]).toString()})):void 0}},createFromTemplates:function(t,i){for(var s=t.length,h=new Array(s),n=0;n<s;++n)h[n]=Qn.createFromTemplate(t[n],i);return Qn.createFromTileUrlFunctions(h)},createFromTileUrlFunctions:function(t){return 1===t.length?t[0]:function(i,s,h){if(i){var n=Kn.hash(i),r=_i.modulo(n,t.length);return t[r](i,s,h)}}},nullTileUrlFunction:function(){},expandUrl:function(t){var i=[],s=/\{([a-z])-([a-z])\}/.exec(t);if(s){var h,n=s[1].charCodeAt(0),r=s[2].charCodeAt(0);for(h=n;h<=r;++h)i.push(t.replace(s[0],String.fromCharCode(h)));return i}if(s=s=/\{(\d+)-(\d+)\}/.exec(t)){for(var e=parseInt(s[2],10),o=parseInt(s[1],10);o<=e;o++)i.push(t.replace(s[0],o.toString()));return i}return i.push(t),i}},$n=function(t,i,s){di.call(this);var h=s||{};this.tileCoord=t,this.state=i,this.interimTile=null,this.key="",this.transition_=void 0===h.transition?250:h.transition,this.transitionStarts_={}};ui.inherits($n,di),$n.prototype.changed=function(){this.dispatchEvent("change")},$n.prototype.getKey=function(){return this.key+"/"+this.tileCoord},$n.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(2==t.getState())return t;t=t.interimTile}while(t);return this},$n.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,i=this;do{if(2==t.getState()){t.interimTile=null;break}1==t.getState()?i=t:0==t.getState()?i.interimTile=t.interimTile:i=t,t=i.interimTile}while(t)}},$n.prototype.getTileCoord=function(){return this.tileCoord},$n.prototype.getState=function(){return this.state},$n.prototype.setState=function(t){this.state=t,this.changed()},$n.prototype.load=function(){},$n.prototype.getAlpha=function(t,i){if(!this.transition_)return 1;var s=this.transitionStarts_[t];if(s){if(-1===s)return 1}else this.transitionStarts_[t]=s=i;var h=i-s+1e3/60;return h>=this.transition_?1:Es.easeIn(h/this.transition_)},$n.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},$n.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)};var tr=function(t,i,s,h,n,r){$n.call(this,t,i,r),this.crossOrigin_=h,this.src_=s,this.image_=new Image,null!==h&&(this.image_.crossOrigin=h),this.imageListenerKeys_=null,this.tileLoadFunction_=n};ui.inherits(tr,$n),tr.prototype.disposeInternal=function(){1==this.state&&(this.unlistenImage_(),this.image_=tr.getBlankImage()),this.interimTile&&this.interimTile.dispose(),this.state=5,this.changed(),$n.prototype.disposeInternal.call(this)},tr.prototype.getImage=function(){return this.image_},tr.prototype.getKey=function(){return this.src_},tr.prototype.handleImageError_=function(){this.state=3,this.unlistenImage_(),this.image_=tr.getBlankImage(),this.changed()},tr.prototype.handleImageLoad_=function(){this.state=this.image_.naturalWidth&&this.image_.naturalHeight?2:4,this.unlistenImage_(),this.changed()},tr.prototype.load=function(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.imageListenerKeys_=[ci.listenOnce(this.image_,"error",this.handleImageError_,this),ci.listenOnce(this.image_,"load",this.handleImageLoad_,this)],this.tileLoadFunction_(this,this.src_))},tr.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(ci.unlistenByKey),this.imageListenerKeys_=null},tr.getBlankImage=function(){var t=Cs(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas};var ir=function(t){fh.call(this,t)};ui.inherits(ir,fh),ir.prototype.expireCache=function(t){for(var i,s;this.canExpireCache()&&(!((s=(i=this.peekLast()).tileCoord[0].toString())in t)||!t[s].contains(i.tileCoord));)this.pop().dispose()},ir.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=this.peekFirstKey(),i=Kn.fromKey(t)[0];this.forEach((function(t){t.tileCoord[0]!==i&&(this.remove(Kn.getKey(t.tileCoord)),t.dispose())}),this)}};var sr={calculateSourceResolution:function(t,i,s,h){var n=Li.transform(s,i,t),r=Li.getPointResolution(i,h,s),e=i.getMetersPerUnit();void 0!==e&&(r*=e);var o=t.getMetersPerUnit();void 0!==o&&(r/=o);var a=t.getExtent();if(!a||bi.containsCoordinate(a,n)){var u=Li.getPointResolution(t,r,n)/r;isFinite(u)&&u>0&&(r/=u)}return r},enlargeClipPoint_:function(t,i,s,h){var n=s-t,r=h-i,e=Math.sqrt(n*n+r*r);return[Math.round(s+n/e),Math.round(h+r/e)]},render:function(t,i,s,h,n,r,e,o,a,u,f){var c=Cs(Math.round(s*t),Math.round(s*i));if(0===a.length)return c.canvas;c.scale(s,s);var l=bi.createEmpty();a.forEach((function(t){bi.extend(l,t.extent)}));var v=bi.getWidth(l),d=bi.getHeight(l),M=Cs(Math.round(s*v/h),Math.round(s*d/h)),m=s/h;a.forEach((function(t){var i=t.extent[0]-l[0],s=-(t.extent[3]-l[3]),h=bi.getWidth(t.extent),n=bi.getHeight(t.extent);M.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,i*m,s*m,h*m,n*m)}));var p=bi.getTopLeft(e);return o.getTriangles().forEach((function(t){var i=t.source,n=t.target,e=i[0][0],o=i[0][1],a=i[1][0],u=i[1][1],f=i[2][0],v=i[2][1],d=(n[0][0]-p[0])/r,m=-(n[0][1]-p[1])/r,g=(n[1][0]-p[0])/r,_=-(n[1][1]-p[1])/r,w=(n[2][0]-p[0])/r,y=-(n[2][1]-p[1])/r,b=e,x=o;e=0,o=0;var E=_i.solveLinearSystem([[a-=b,u-=x,0,0,g-d],[f-=b,v-=x,0,0,w-d],[0,0,a,u,_-m],[0,0,f,v,y-m]]);if(E){c.save(),c.beginPath();var S=(d+g+w)/3,C=(m+_+y)/3,A=sr.enlargeClipPoint_(S,C,d,m),P=sr.enlargeClipPoint_(S,C,g,_),R=sr.enlargeClipPoint_(S,C,w,y);c.moveTo(P[0],P[1]),c.lineTo(A[0],A[1]),c.lineTo(R[0],R[1]),c.clip(),c.transform(E[0],E[2],E[1],E[3],d,m),c.translate(l[0]-b,l[3]-x),c.scale(h/s,-h/s),c.drawImage(M.canvas,0,0),c.restore()}})),f&&(c.save(),c.strokeStyle="black",c.lineWidth=1,o.getTriangles().forEach((function(t){var i=t.target,s=(i[0][0]-p[0])/r,h=-(i[0][1]-p[1])/r,n=(i[1][0]-p[0])/r,e=-(i[1][1]-p[1])/r,o=(i[2][0]-p[0])/r,a=-(i[2][1]-p[1])/r;c.beginPath(),c.moveTo(n,e),c.lineTo(s,h),c.lineTo(o,a),c.closePath(),c.stroke()})),c.restore()),c.canvas}},hr=function(t,i,s,h,n){this.sourceProj_=t,this.targetProj_=i;var r={},e=Li.getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var i=t[0]+"/"+t[1];return r[i]||(r[i]=e(t)),r[i]},this.maxSourceExtent_=h,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!h&&!!this.sourceProj_.getExtent()&&bi.getWidth(h)==bi.getWidth(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?bi.getWidth(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?bi.getWidth(this.targetProj_.getExtent()):null;var o=bi.getTopLeft(s),a=bi.getTopRight(s),u=bi.getBottomRight(s),f=bi.getBottomLeft(s),c=this.transformInv_(o),l=this.transformInv_(a),v=this.transformInv_(u),d=this.transformInv_(f);if(this.addQuad_(o,a,u,f,c,l,v,d,ui.RASTER_REPROJECTION_MAX_SUBDIVISION),this.wrapsXInSource_){var M=1/0;this.triangles_.forEach((function(t){M=Math.min(M,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])-M>this.sourceWorldWidth_/2){var i=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];i[0][0]-M>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-M>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-M>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);var s=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-s<this.sourceWorldWidth_/2&&(t.source=i)}}),this)}r={}};hr.prototype.addTriangle_=function(t,i,s,h,n,r){this.triangles_.push({source:[h,n,r],target:[t,i,s]})},hr.prototype.addQuad_=function(t,i,s,h,n,r,e,o,a){var u=bi.boundingExtent([n,r,e,o]),f=this.sourceWorldWidth_?bi.getWidth(u)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,l=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(a>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){var d=bi.boundingExtent([t,i,s,h]);v|=bi.getWidth(d)/this.targetWorldWidth_>ui.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}!l&&this.sourceProj_.isGlobal()&&f&&(v|=f>ui.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH)}if(v||!this.maxSourceExtent_||bi.intersects(u,this.maxSourceExtent_)){if(!(v||isFinite(n[0])&&isFinite(n[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(o[0])&&isFinite(o[1]))){if(!(a>0))return;v=!0}if(a>0){if(!v){var M,m=this.transformInv_([(t[0]+s[0])/2,(t[1]+s[1])/2]);M=l?(_i.modulo(n[0],c)+_i.modulo(e[0],c))/2-_i.modulo(m[0],c):(n[0]+e[0])/2-m[0];var p=(n[1]+e[1])/2-m[1];v=M*M+p*p>this.errorThresholdSquared_}if(v){if(Math.abs(t[0]-s[0])<=Math.abs(t[1]-s[1])){var g=[(i[0]+s[0])/2,(i[1]+s[1])/2],_=this.transformInv_(g),w=[(h[0]+t[0])/2,(h[1]+t[1])/2],y=this.transformInv_(w);this.addQuad_(t,i,g,w,n,r,_,y,a-1),this.addQuad_(w,g,s,h,y,_,e,o,a-1)}else{var b=[(t[0]+i[0])/2,(t[1]+i[1])/2],x=this.transformInv_(b),E=[(s[0]+h[0])/2,(s[1]+h[1])/2],S=this.transformInv_(E);this.addQuad_(t,b,E,h,n,x,S,o,a-1),this.addQuad_(b,i,s,E,x,r,e,S,a-1)}return}}if(l){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,s,h,n,e,o),this.addTriangle_(t,i,s,n,r,e)}},hr.prototype.calculateSourceExtent=function(){var t=bi.createEmpty();return this.triangles_.forEach((function(i){var s=i.source;bi.extendCoordinate(t,s[0]),bi.extendCoordinate(t,s[1]),bi.extendCoordinate(t,s[2])})),t},hr.prototype.getTriangles=function(){return this.triangles_};var nr=function(t,i,s,h,n,r,e,o,a,u,f){$n.call(this,n,0),this.renderEdges_=void 0!==f&&f,this.pixelRatio_=e,this.gutter_=o,this.canvas_=null,this.sourceTileGrid_=i,this.targetTileGrid_=h,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;var c=h.getTileCoordExtent(this.wrappedTileCoord_),l=this.targetTileGrid_.getExtent(),v=this.sourceTileGrid_.getExtent(),d=l?bi.getIntersection(c,l):c;if(0!==bi.getArea(d)){var M=t.getExtent();M&&(v=v?bi.getIntersection(v,M):M);var m=h.getResolution(this.wrappedTileCoord_[0]),p=bi.getCenter(d),g=sr.calculateSourceResolution(t,s,p,m);if(!isFinite(g)||g<=0)this.state=4;else if(this.triangulation_=new hr(t,s,d,v,g*(void 0!==u?u:ui.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD)),0!==this.triangulation_.getTriangles().length){this.sourceZ_=i.getZForResolution(g);var _=this.triangulation_.calculateSourceExtent();if(v&&(t.canWrapX()?(_[1]=_i.clamp(_[1],v[1],v[3]),_[3]=_i.clamp(_[3],v[1],v[3])):_=bi.getIntersection(_,v)),bi.getArea(_)){for(var w=i.getTileRangeForExtentAndZ(_,this.sourceZ_),y=w.minX;y<=w.maxX;y++)for(var b=w.minY;b<=w.maxY;b++){var x=a(this.sourceZ_,y,b,e);x&&this.sourceTiles_.push(x)}0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}else this.state=4}else this.state=4};ui.inherits(nr,$n),nr.prototype.disposeInternal=function(){1==this.state&&this.unlistenSources_(),$n.prototype.disposeInternal.call(this)},nr.prototype.getImage=function(){return this.canvas_},nr.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach((function(i){i&&2==i.getState()&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(i.tileCoord),image:i.getImage()})}),this),this.sourceTiles_.length=0,0===t.length)this.state=3;else{var i=this.wrappedTileCoord_[0],s=this.targetTileGrid_.getTileSize(i),h="number"==typeof s?s:s[0],n="number"==typeof s?s:s[1],r=this.targetTileGrid_.getResolution(i),e=this.sourceTileGrid_.getResolution(this.sourceZ_),o=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sr.render(h,n,this.pixelRatio_,e,this.sourceTileGrid_.getExtent(),r,o,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=2}this.changed()},nr.prototype.load=function(){if(0==this.state){this.state=1,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((function(i){var s,h=i.getState();0!=h&&1!=h||(t++,s=ci.listen(i,"change",(function(){var h=i.getState();2!=h&&3!=h&&4!=h||(ci.unlistenByKey(s),0==--t&&(this.unlistenSources_(),this.reproject_()))}),this),this.sourcesListenerKeys_.push(s))}),this),this.sourceTiles_.forEach((function(t){0==t.getState()&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},nr.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(ci.unlistenByKey),this.sourcesListenerKeys_=null};var rr=function(t){var i;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,gi(yi.isSorted(this.resolutions_,(function(t,i){return i-t}),!0),17),!t.origins)for(var s=0,h=this.resolutions_.length-1;s<h;++s)if(i){if(this.resolutions_[s]/this.resolutions_[s+1]!==i){i=void 0;break}}else i=this.resolutions_[s]/this.resolutions_[s+1];this.zoomFactor_=i,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,gi(this.origins_.length==this.resolutions_.length,20));var n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=bi.getTopLeft(n)),gi(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,gi(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:ui.DEFAULT_TILE_SIZE,gi(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((function(t){return new Ch(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1))}),this):n&&this.calculateTileRanges_(n)};rr.tmpTileCoord_=[0,0,0],rr.prototype.forEachTileCoord=function(t,i,s){for(var h=this.getTileRangeForExtentAndZ(t,i),n=h.minX,r=h.maxX;n<=r;++n)for(var e=h.minY,o=h.maxY;e<=o;++e)s([i,n,e])},rr.prototype.forEachTileCoordParentTileRange=function(t,i,s,h,n){var r,e,o,a=null,u=t[0]-1;for(2===this.zoomFactor_?(e=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);u>=this.minZoom;){if(2===this.zoomFactor_?(e=Math.floor(e/2),o=Math.floor(o/2),r=Ch.createOrUpdate(e,e,o,o,h)):r=this.getTileRangeForExtentAndZ(a,u,h),i.call(s,u,r))return!0;--u}return!1},rr.prototype.getExtent=function(){return this.extent_},rr.prototype.getMaxZoom=function(){return this.maxZoom},rr.prototype.getMinZoom=function(){return this.minZoom},rr.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},rr.prototype.getResolution=function(t){return this.resolutions_[t]},rr.prototype.getResolutions=function(){return this.resolutions_},rr.prototype.getTileCoordChildTileRange=function(t,i,s){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){var h=2*t[1],n=2*t[2];return Ch.createOrUpdate(h,h+1,n,n+1,i)}var r=this.getTileCoordExtent(t,s);return this.getTileRangeForExtentAndZ(r,t[0]+1,i)}return null},rr.prototype.getTileRangeExtent=function(t,i,s){var h=this.getOrigin(t),n=this.getResolution(t),r=Os(this.getTileSize(t),this.tmpSize_);return bi.createOrUpdate(h[0]+i.minX*r[0]*n,h[1]+i.minY*r[1]*n,h[0]+(i.maxX+1)*r[0]*n,h[1]+(i.maxY+1)*r[1]*n,s)},rr.prototype.getTileRangeForExtentAndZ=function(t,i,s){var h=rr.tmpTileCoord_;this.getTileCoordForXYAndZ_(t[0],t[1],i,!1,h);var n=h[1],r=h[2];return this.getTileCoordForXYAndZ_(t[2],t[3],i,!0,h),Ch.createOrUpdate(n,h[1],r,h[2],s)},rr.prototype.getTileCoordCenter=function(t){var i=this.getOrigin(t[0]),s=this.getResolution(t[0]),h=Os(this.getTileSize(t[0]),this.tmpSize_);return[i[0]+(t[1]+.5)*h[0]*s,i[1]+(t[2]+.5)*h[1]*s]},rr.prototype.getTileCoordExtent=function(t,i){var s=this.getOrigin(t[0]),h=this.getResolution(t[0]),n=Os(this.getTileSize(t[0]),this.tmpSize_),r=s[0]+t[1]*n[0]*h,e=s[1]+t[2]*n[1]*h;return bi.createOrUpdate(r,e,r+n[0]*h,e+n[1]*h,i)},rr.prototype.getTileCoordForCoordAndResolution=function(t,i,s){return this.getTileCoordForXYAndResolution_(t[0],t[1],i,!1,s)},rr.prototype.getTileCoordForXYAndResolution_=function(t,i,s,h,n){var r=this.getZForResolution(s),e=s/this.getResolution(r),o=this.getOrigin(r),a=Os(this.getTileSize(r),this.tmpSize_),u=h?0:.5,f=Math.floor((t-o[0])/s+(h?.5:0)),c=Math.floor((i-o[1])/s+u),l=e*f/a[0],v=e*c/a[1];return h?(l=Math.ceil(l)-1,v=Math.ceil(v)-1):(l=Math.floor(l),v=Math.floor(v)),Kn.createOrUpdate(r,l,v,n)},rr.prototype.getTileCoordForXYAndZ_=function(t,i,s,h,n){var r=this.getOrigin(s),e=this.getResolution(s),o=Os(this.getTileSize(s),this.tmpSize_),a=h?0:.5,u=Math.floor((t-r[0])/e+(h?.5:0)),f=Math.floor((i-r[1])/e+a),c=u/o[0],l=f/o[1];return h?(c=Math.ceil(c)-1,l=Math.ceil(l)-1):(c=Math.floor(c),l=Math.floor(l)),Kn.createOrUpdate(s,c,l,n)},rr.prototype.getTileCoordForCoordAndZ=function(t,i,s){return this.getTileCoordForXYAndZ_(t[0],t[1],i,!1,s)},rr.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]},rr.prototype.getTileSize=function(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]},rr.prototype.getFullTileRange=function(t){return this.fullTileRanges_?this.fullTileRanges_[t]:null},rr.prototype.getZForResolution=function(t,i){var s=yi.linearFindNearest(this.resolutions_,t,i||0);return _i.clamp(s,this.minZoom,this.maxZoom)},rr.prototype.calculateTileRanges_=function(t){for(var i=this.resolutions_.length,s=new Array(i),h=this.minZoom;h<i;++h)s[h]=this.getTileRangeForExtentAndZ(t,h);this.fullTileRanges_=s};var er={getForProjection:function(t){var i=t.getDefaultTileGrid();return i||(i=er.createForProjection(t),t.setDefaultTileGrid(i)),i},wrapX:function(t,i,s){var h=i[0],n=t.getTileCoordCenter(i),r=er.extentFromProjection(s);if(bi.containsCoordinate(r,n))return i;var e=bi.getWidth(r),o=Math.ceil((r[0]-n[0])/e);return n[0]+=e*o,t.getTileCoordForCoordAndZ(n,h)},createForExtent:function(t,i,s,h){var n=void 0!==h?h:"top-left",r=er.resolutionsFromExtent(t,i,s);return new rr({extent:t,origin:bi.getCorner(t,n),resolutions:r,tileSize:s})},createXYZ:function(t){var i={};return fi.assign(i,void 0!==t?t:{}),void 0===i.extent&&(i.extent=Li.get("EPSG:3857").getExtent()),i.resolutions=er.resolutionsFromExtent(i.extent,i.maxZoom,i.tileSize),delete i.maxZoom,new rr(i)},resolutionsFromExtent:function(t,i,s){for(var h=void 0!==i?i:ui.DEFAULT_MAX_ZOOM,n=bi.getHeight(t),r=bi.getWidth(t),e=Os(void 0!==s?s:ui.DEFAULT_TILE_SIZE),o=Math.max(r/e[0],n/e[1]),a=h+1,u=new Array(a),f=0;f<a;++f)u[f]=o/Math.pow(2,f);return u},createForProjection:function(t,i,s,h){var n=er.extentFromProjection(t);return er.createForExtent(n,i,s,h)},extentFromProjection:function(t){var i=(t=Li.get(t)).getExtent();if(!i){var s=180*Li.METERS_PER_UNIT[Pi.DEGREES]/t.getMetersPerUnit();i=bi.createOrUpdate(-s,-s,s,s)}return i}},or=function(t){this.html_=t.html,this.tileRanges_=t.tileRanges?t.tileRanges:null};or.prototype.getHTML=function(){return this.html_},or.prototype.intersectsAnyTileRange=function(t,i,s){if(!this.tileRanges_)return!0;var h,n,r,e;for(e in t){var o;if(e in this.tileRanges_)for(r=t[e],h=0,n=this.tileRanges_[e].length;h<n;++h){if((o=this.tileRanges_[e][h]).intersects(r))return!0;var a=i.getTileRangeForExtentAndZ(er.extentFromProjection(s),parseInt(e,10)),u=a.getWidth();if(r.minX<a.minX||r.maxX>a.maxX){if(o.intersects(new Ch(_i.modulo(r.minX,u),_i.modulo(r.maxX,u),r.minY,r.maxY)))return!0;if(r.getWidth()>u&&o.intersects(a))return!0}}}return!1};var ar=function(t){mi.call(this),this.projection_=Li.get(t.projection),this.attributions_=null,this.attributions2_=this.adaptAttributions_(t.attributions),this.logo_=t.logo,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX};ui.inherits(ar,mi),ar.prototype.adaptAttributions_=function(t){if(!t)return null;if(t instanceof or)return this.attributions_=[t],function(){return[t.getHTML()]};if(Array.isArray(t)){if(t[0]instanceof or){this.attributions_=t;var i=t.map((function(t){return t.getHTML()}));return function(){return i}}return this.attributions_=t.map((function(t){return new or({html:t})})),function(){return t}}return"function"==typeof t?t:(this.attributions_=[new or({html:t})],function(){return[t]})},ar.prototype.forEachFeatureAtCoordinate=ui.nullFunction,ar.prototype.getAttributions=function(){return this.attributions_},ar.prototype.getAttributions2=function(){return this.attributions2_},ar.prototype.getLogo=function(){return this.logo_},ar.prototype.getProjection=function(){return this.projection_},ar.prototype.getResolutions=function(){},ar.prototype.getState=function(){return this.state_},ar.prototype.getWrapX=function(){return this.wrapX_},ar.prototype.refresh=function(){this.changed()},ar.prototype.setAttributions=function(t){this.attributions2_=this.adaptAttributions_(t),this.changed()},ar.prototype.setLogo=function(t){this.logo_=t},ar.prototype.setState=function(t){this.state_=t,this.changed()};var ur=function(t){ar.call(this,{attributions:t.attributions,extent:t.extent,logo:t.logo,projection:t.projection,state:t.state,wrapX:t.wrapX}),this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null,this.tileCache=new ir(t.cacheSize),this.tmpSize=[0,0],this.key_="",this.tileOptions={transition:t.transition}};ui.inherits(ur,ar),ur.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},ur.prototype.expireCache=function(t,i){var s=this.getTileCacheForProjection(t);s&&s.expireCache(i)},ur.prototype.forEachLoadedTile=function(t,i,s,h){var n=this.getTileCacheForProjection(t);if(!n)return!1;for(var r,e,o,a=!0,u=s.minX;u<=s.maxX;++u)for(var f=s.minY;f<=s.maxY;++f)e=Kn.getKeyZXY(i,u,f),o=!1,n.containsKey(e)&&(o=2===(r=n.get(e)).getState())&&(o=!1!==h(r)),o||(a=!1);return a},ur.prototype.getGutter=function(){return 0},ur.prototype.getKey=function(){return this.key_},ur.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},ur.prototype.getOpaque=function(){return this.opaque_},ur.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},ur.prototype.getTile=function(){},ur.prototype.getTileGrid=function(){return this.tileGrid},ur.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:er.getForProjection(t)},ur.prototype.getTileCacheForProjection=function(t){var i=this.getProjection();return i&&!Li.equivalent(i,t)?null:this.tileCache},ur.prototype.getTilePixelRatio=function(){return this.tilePixelRatio_},ur.prototype.getTilePixelSize=function(t,i,s){var h=this.getTileGridForProjection(s),n=this.getTilePixelRatio(i),r=Os(h.getTileSize(t),this.tmpSize);return 1==n?r:Ts(r,n,this.tmpSize)},ur.prototype.getTileCoordForTileUrlFunction=function(t,i){var s=void 0!==i?i:this.getProjection(),h=this.getTileGridForProjection(s);return this.getWrapX()&&s.isGlobal()&&(t=er.wrapX(h,t,s)),Kn.withinExtentAndZ(t,h)?t:null},ur.prototype.refresh=function(){this.tileCache.clear(),this.changed()},ur.prototype.useTile=ui.nullFunction,ui.inherits(ur.Event=function(t,i){vi.call(this,t),this.tile=i},vi);var fr=function(t){ur.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition}),this.tileLoadFunction=t.tileLoadFunction,this.tileUrlFunction=this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.nullTileUrlFunction,this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),t.tileUrlFunction&&this.setTileUrlFunction(t.tileUrlFunction),this.tileLoadingKeys_={}};ui.inherits(fr,ur),fr.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},fr.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},fr.prototype.getUrls=function(){return this.urls},fr.prototype.handleTileChange=function(t){var i,s=t.target,h=ui.getUid(s),n=s.getState();1==n?(this.tileLoadingKeys_[h]=!0,i="tileloadstart"):h in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[h],i=3==n?"tileloaderror":2==n||5==n?"tileloadend":void 0),null!=i&&this.dispatchEvent(new ur.Event(i,s))},fr.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},fr.prototype.setTileUrlFunction=function(t,i){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==i?this.setKey(i):this.changed()},fr.prototype.setUrl=function(t){var i=this.urls=Qn.expandUrl(t);this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTemplates(i,this.tileGrid),t)},fr.prototype.setUrls=function(t){this.urls=t;var i=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTemplates(t,this.tileGrid),i)},fr.prototype.useTile=function(t,i,s){var h=Kn.getKeyZXY(t,i,s);this.tileCache.containsKey(h)&&this.tileCache.get(h)};var cr=function(t){fr.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:cr.defaultTileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:tr,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1};ui.inherits(cr,fr),cr.prototype.canExpireCache=function(){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.canExpireCache.call(this);if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},cr.prototype.expireCache=function(t,i){if(ui.ENABLE_RASTER_REPROJECTION){var s=this.getTileCacheForProjection(t);for(var h in this.tileCache.expireCache(this.tileCache==s?i:{}),this.tileCacheForProjection){var n=this.tileCacheForProjection[h];n.expireCache(n==s?i:{})}}else fr.prototype.expireCache.call(this,t,i)},cr.prototype.getGutter=function(t){return ui.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Li.equivalent(this.getProjection(),t)?0:this.getGutterInternal()},cr.prototype.getGutterInternal=function(){return 0},cr.prototype.getOpaque=function(t){return!(ui.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Li.equivalent(this.getProjection(),t))&&fr.prototype.getOpaque.call(this,t)},cr.prototype.getTileGridForProjection=function(t){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.getTileGridForProjection.call(this,t);var i=this.getProjection();if(!this.tileGrid||i&&!Li.equivalent(i,t)){var s=ui.getUid(t).toString();return s in this.tileGridForProjection||(this.tileGridForProjection[s]=er.getForProjection(t)),this.tileGridForProjection[s]}return this.tileGrid},cr.prototype.getTileCacheForProjection=function(t){if(!ui.ENABLE_RASTER_REPROJECTION)return fr.prototype.getTileCacheForProjection.call(this,t);var i=this.getProjection();if(!i||Li.equivalent(i,t))return this.tileCache;var s=ui.getUid(t).toString();return s in this.tileCacheForProjection||(this.tileCacheForProjection[s]=new ir(this.tileCache.highWaterMark)),this.tileCacheForProjection[s]},cr.prototype.createTile_=function(t,i,s,h,n,r){var e=[t,i,s],o=this.getTileCoordForTileUrlFunction(e,n),a=o?this.tileUrlFunction(o,h,n):void 0,u=new this.tileClass(e,void 0!==a?0:4,void 0!==a?a:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=r,ci.listen(u,"change",this.handleTileChange,this),u},cr.prototype.getTile=function(t,i,s,h,n){var r=this.getProjection();if(ui.ENABLE_RASTER_REPROJECTION&&r&&n&&!Li.equivalent(r,n)){var e,o=this.getTileCacheForProjection(n),a=[t,i,s],u=Kn.getKey(a);o.containsKey(u)&&(e=o.get(u));var f=this.getKey();if(e&&e.key==f)return e;var c=this.getTileGridForProjection(r),l=this.getTileGridForProjection(n),v=this.getTileCoordForTileUrlFunction(a,n),d=new nr(r,c,n,l,a,v,this.getTilePixelRatio(h),this.getGutterInternal(),function(t,i,s,h){return this.getTileInternal(t,i,s,h,r)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return d.key=f,e?(d.interimTile=e,d.refreshInterimChain(),o.replace(u,d)):o.set(u,d),d}return this.getTileInternal(t,i,s,h,r||n)},cr.prototype.getTileInternal=function(t,i,s,h,n){var r=null,e=Kn.getKeyZXY(t,i,s),o=this.getKey();if(this.tileCache.containsKey(e)){if((r=this.tileCache.get(e)).key!=o){var a=r;(r=this.createTile_(t,i,s,h,n,o)).interimTile=0==a.getState()?a.interimTile:a,r.refreshInterimChain(),this.tileCache.replace(e,r)}}else r=this.createTile_(t,i,s,h,n,o),this.tileCache.set(e,r);return r},cr.prototype.setRenderReprojectionEdges=function(t){if(ui.ENABLE_RASTER_REPROJECTION&&this.renderReprojectionEdges_!=t){for(var i in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[i].clear();this.changed()}},cr.prototype.setTileGridForProjection=function(t,i){if(ui.ENABLE_RASTER_REPROJECTION){var s=Li.get(t);if(s){var h=ui.getUid(s).toString();h in this.tileGridForProjection||(this.tileGridForProjection[h]=i)}}},cr.defaultTileLoadFunction=function(t,i){t.getImage().src=i};var lr=function(t){this.matrixIds_=t.matrixIds,rr.call(this,{extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes})};ui.inherits(lr,rr),lr.prototype.getMatrixId=function(t){return this.matrixIds_[t]},lr.prototype.getMatrixIds=function(){return this.matrixIds_},lr.createFromCapabilitiesMatrixSet=function(t,i,s){var h=[],n=[],r=[],e=[],o=[],a=void 0!==s?s:[],u=t.SupportedCRS,f=Li.get(u.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(u),c=f.getMetersPerUnit(),l="ne"==f.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,i){return i.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(t){if(!(a.length>0)||yi.find(a,(function(i){return t.Identifier==i.TileMatrix}))){n.push(t.Identifier);var i=28e-5*t.ScaleDenominator/c,s=t.TileWidth,u=t.TileHeight;r.push(l?[t.TopLeftCorner[1],t.TopLeftCorner[0]]:t.TopLeftCorner),h.push(i),e.push(s==u?s:[s,u]),o.push([t.MatrixWidth,-t.MatrixHeight])}})),new lr({extent:i,origins:r,resolutions:h,matrixIds:n,tileSizes:e,sizes:o})};var vr=function(t,i){var s=[];Object.keys(i).forEach((function(t){null!=i[t]&&s.push(t+"="+encodeURIComponent(i[t]))}));var h=s.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+h},dr=function(t){this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style;var i=t.urls;void 0===i&&void 0!==t.url&&(i=Qn.expandUrl(t.url)),this.requestEncoding_=void 0!==t.requestEncoding?t.requestEncoding:"KVP";var s=this.requestEncoding_,h=t.tileGrid,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==s&&fi.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_});var r=this.dimensions_;this.createFromWMTSTemplate_=function(t){return t="KVP"==s?vr(t,n):t.replace(/\{(\w+?)\}/g,(function(t,i){return i.toLowerCase()in n?n[i.toLowerCase()]:t})),function(i){if(i){var n={TileMatrix:h.getMatrixId(i[0]),TileCol:i[1],TileRow:-i[2]-1};fi.assign(n,r);var e=t;return"KVP"==s?vr(e,n):e.replace(/\{(\w+?)\}/g,(function(t,i){return n[i]}))}}};var e=i&&i.length>0?Qn.createFromTileUrlFunctions(i.map(this.createFromWMTSTemplate_)):Qn.nullTileUrlFunction;cr.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,logo:t.logo,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:h,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:e,urls:i,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition}),this.setKey(this.getKeyForDimensions_())};ui.inherits(dr,cr),dr.prototype.setUrls=function(t){this.urls=t;var i=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):Qn.createFromTileUrlFunctions(t.map(this.createFromWMTSTemplate_.bind(this))),i)},dr.prototype.getDimensions=function(){return this.dimensions_},dr.prototype.getFormat=function(){return this.format_},dr.prototype.getLayer=function(){return this.layer_},dr.prototype.getMatrixSet=function(){return this.matrixSet_},dr.prototype.getRequestEncoding=function(){return this.requestEncoding_},dr.prototype.getStyle=function(){return this.style_},dr.prototype.getVersion=function(){return this.version_},dr.prototype.getKeyForDimensions_=function(){var t=0,i=[];for(var s in this.dimensions_)i[t++]=s+"-"+this.dimensions_[s];return i.join("/")},dr.prototype.updateDimensions=function(t){fi.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},dr.optionsFromCapabilities=function(t,i){var s=yi.find(t.Contents.Layer,(function(t){return t.Identifier==i.layer}));if(null===s)return null;var h,n,r,e=t.Contents.TileMatrixSet;(h=s.TileMatrixSetLink.length>1?yi.findIndex(s.TileMatrixSetLink,"projection"in i?function(t){var s=yi.find(e,(function(i){return i.Identifier==t.TileMatrixSet})).SupportedCRS,h=Li.get(s.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(s),n=Li.get(i.projection);return h&&n?Li.equivalent(h,n):s==i.projection}:function(t){return t.TileMatrixSet==i.matrixSet}):0)<0&&(h=0),n=s.TileMatrixSetLink[h].TileMatrixSet,r=s.TileMatrixSetLink[h].TileMatrixSetLimits;var o=s.Format[0];"format"in i&&(o=i.format),(h=yi.findIndex(s.Style,(function(t){return"style"in i?t.Title==i.style:t.isDefault})))<0&&(h=0);var a=s.Style[h].Identifier,u={};"Dimension"in s&&s.Dimension.forEach((function(t){var i=t.Default;void 0===i&&(i=t.Value[0]),u[t.Identifier]=i}));var f,c=yi.find(t.Contents.TileMatrixSet,(function(t){return t.Identifier==n})),l=c.SupportedCRS;if(l&&(f=Li.get(l.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Li.get(l)),"projection"in i){var v=Li.get(i.projection);v&&(f&&!Li.equivalent(v,f)||(f=v))}var d,M,m=s.WGS84BoundingBox;if(void 0!==m){var p=Li.get("EPSG:4326").getExtent();M=m[0]==p[0]&&m[2]==p[2],d=Li.transformExtent(m,"EPSG:4326",f);var g=f.getExtent();g&&(bi.containsExtent(g,d)||(d=void 0))}var _=lr.createFromCapabilitiesMatrixSet(c,d,r),w=[],y=i.requestEncoding;if(y=void 0!==y?y:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var b=t.OperationsMetadata.GetTile.DCP.HTTP.Get,x=0,E=b.length;x<E;++x)if(b[x].Constraint){var S=yi.find(b[x].Constraint,(function(t){return"GetEncoding"==t.name})).AllowedValues.Value;if(""===y&&(y=S[0]),"KVP"!==y)break;yi.includes(S,"KVP")&&w.push(b[x].href)}else b[x].href&&(y="KVP",w.push(b[x].href));return 0===w.length&&(y="REST",s.ResourceURL.forEach((function(t){"tile"===t.resourceType&&(o=t.format,w.push(t.template))}))),{urls:w,layer:i.layer,matrixSet:n,format:o,projection:f,requestEncoding:y,tileGrid:_,style:a,dimensions:u,wrapX:M,crossOrigin:i.crossOrigin}};var Mr={};Mr.DOCUMENT=document.implementation.createDocument("","",null),Mr.createElementNS=function(t,i){return Mr.DOCUMENT.createElementNS(t,i)},Mr.getAllTextContent=function(t,i){return Mr.getAllTextContent_(t,i,[]).join("")},Mr.getAllTextContent_=function(t,i,s){var h;if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)s.push(i?String(t.nodeValue).replace(/(\r\n|\r|\n)/g,""):t.nodeValue);else for(h=t.firstChild;h;h=h.nextSibling)Mr.getAllTextContent_(h,i,s);return s},Mr.isDocument=function(t){return t instanceof Document},Mr.isNode=function(t){return t instanceof Node},Mr.getAttributeNS=function(t,i,s){return t.getAttributeNS(i,s)||""},Mr.setAttributeNS=function(t,i,s,h){t.setAttributeNS(i,s,h)},Mr.parse=function(t){return(new DOMParser).parseFromString(t,"application/xml")},Mr.makeArrayExtender=function(t,i){return function(s,h){var n=t.call(i,s,h);void 0!==n&&yi.extend(h[h.length-1],n)}},Mr.makeArrayPusher=function(t,i){return function(s,h){var n=t.call(void 0!==i?i:this,s,h);void 0!==n&&h[h.length-1].push(n)}},Mr.makeReplacer=function(t,i){return function(s,h){var n=t.call(void 0!==i?i:this,s,h);void 0!==n&&(h[h.length-1]=n)}},Mr.makeObjectPropertyPusher=function(t,i,s){return function(h,n){var r=t.call(void 0!==s?s:this,h,n);if(void 0!==r){var e=n[n.length-1],o=void 0!==i?i:h.localName;(o in e?e[o]:e[o]=[]).push(r)}}},Mr.makeObjectPropertySetter=function(t,i,s){return function(h,n){var r=t.call(void 0!==s?s:this,h,n);void 0!==r&&(n[n.length-1][void 0!==i?i:h.localName]=r)}},Mr.makeChildAppender=function(t,i){return function(s,h,n){t.call(void 0!==i?i:this,s,h,n),n[n.length-1].node.appendChild(s)}},Mr.makeArraySerializer=function(t){var i,s;return function(h,n,r){if(void 0===i){i={};var e={};e[h.localName]=t,i[h.namespaceURI]=e,s=Mr.makeSimpleNodeFactory(h.localName)}Mr.serialize(i,s,n,r)}},Mr.makeSimpleNodeFactory=function(t,i){var s=t;return function(t,h,n){var r=s;void 0===r&&(r=n);var e=i;return void 0===i&&(e=h[h.length-1].node.namespaceURI),Mr.createElementNS(e,r)}},Mr.OBJECT_PROPERTY_NODE_FACTORY=Mr.makeSimpleNodeFactory(),Mr.makeSequence=function(t,i){for(var s=i.length,h=new Array(s),n=0;n<s;++n)h[n]=t[i[n]];return h},Mr.makeStructureNS=function(t,i,s){var h,n,r=void 0!==s?s:{};for(h=0,n=t.length;h<n;++h)r[t[h]]=i;return r},Mr.parseNode=function(t,i,s,h){var n;for(n=i.firstElementChild;n;n=n.nextElementSibling){var r=t[n.namespaceURI];if(void 0!==r){var e=r[n.localName];void 0!==e&&e.call(h,n,s)}}},Mr.pushParseAndPop=function(t,i,s,h,n){return h.push(t),Mr.parseNode(i,s,h,n),h.pop()},Mr.serialize=function(t,i,s,h,n,r){for(var e,o,a=(void 0!==n?n:s).length,u=0;u<a;++u)void 0!==(e=s[u])&&void 0!==(o=i.call(r,e,h,void 0!==n?n[u]:void 0))&&t[o.namespaceURI][o.localName].call(r,o,e,h)},Mr.pushSerializeAndPop=function(t,i,s,h,n,r,e){return n.push(t),Mr.serialize(i,s,h,n,r,e),n.pop()};var mr={loadFeaturesXhr:function(t,i,s,h){return function(n,r,e){var o=new XMLHttpRequest;o.open("GET","function"==typeof t?t(n,r,e):t,!0),"arraybuffer"==i.getType()&&(o.responseType="arraybuffer"),o.onload=function(){if(!o.status||o.status>=200&&o.status<300){var t,n=i.getType();"json"==n||"text"==n?t=o.responseText:"xml"==n?(t=o.responseXML)||(t=Mr.parse(o.responseText)):"arraybuffer"==n&&(t=o.response),t?s.call(this,i.readFeatures(t,{featureProjection:e}),i.readProjection(t),i.getLastExtent()):h.call(this)}else h.call(this)}.bind(this),o.onerror=function(){h.call(this)}.bind(this),o.send()}},xhr:function(t,i){return mr.loadFeaturesXhr(t,i,(function(t){this.addFeatures(t)}),ui.nullFunction)}},pr={all:function(){return[[-1/0,-1/0,1/0,1/0]]},bbox:function(t){return[t]},tile:function(t){return function(i,s){var h=t.getZForResolution(s),n=t.getTileRangeForExtentAndZ(i,h),r=[],e=[h,0,0];for(e[1]=n.minX;e[1]<=n.maxX;++e[1])for(e[2]=n.minY;e[2]<=n.maxY;++e[2])r.push(t.getTileCoordExtent(e));return r}}},gr=function(t){var i=t||{};ar.call(this,{attributions:i.attributions,logo:i.logo,projection:void 0,state:"ready",wrapX:void 0===i.wrapX||i.wrapX}),this.loader_=ui.nullFunction,this.format_=i.format,this.overlaps_=null==i.overlaps||i.overlaps,this.url_=i.url,void 0!==i.loader?this.loader_=i.loader:void 0!==this.url_&&(gi(this.format_,7),this.loader_=mr.xhr(this.url_,this.format_)),this.strategy_=void 0!==i.strategy?i.strategy:pr.all;var s,h,n=void 0===i.useSpatialIndex||i.useSpatialIndex;this.featuresRtree_=n?new Pn:null,this.loadedExtentsRtree_=new Pn,this.nullGeometryFeatures_={},this.idIndex_={},this.undefIdIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,i.features instanceof hs?h=(s=i.features).getArray():Array.isArray(i.features)&&(h=i.features),n||void 0!==s||(s=new hs(h)),void 0!==h&&this.addFeaturesInternal(h),void 0!==s&&this.bindFeaturesCollection_(s)};ui.inherits(gr,ar),gr.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},gr.prototype.addFeatureInternal=function(t){var i=ui.getUid(t).toString();if(this.addToIndex_(i,t)){this.setupChangeEvents_(i,t);var s=t.getGeometry();if(s){var h=s.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(h,t)}else this.nullGeometryFeatures_[i]=t;this.dispatchEvent(new gr.Event("addfeature",t))}},gr.prototype.setupChangeEvents_=function(t,i){this.featureChangeKeys_[t]=[ci.listen(i,"change",this.handleFeatureChange_,this),ci.listen(i,"propertychange",this.handleFeatureChange_,this)]},gr.prototype.addToIndex_=function(t,i){var s=!0,h=i.getId();return void 0!==h?h.toString()in this.idIndex_?s=!1:this.idIndex_[h.toString()]=i:(gi(!(t in this.undefIdIndex_),30),this.undefIdIndex_[t]=i),s},gr.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},gr.prototype.addFeaturesInternal=function(t){var i,s,h,n,r=[],e=[],o=[];for(s=0,h=t.length;s<h;s++)i=ui.getUid(n=t[s]).toString(),this.addToIndex_(i,n)&&e.push(n);for(s=0,h=e.length;s<h;s++){i=ui.getUid(n=e[s]).toString(),this.setupChangeEvents_(i,n);var a=n.getGeometry();if(a){var u=a.getExtent();r.push(u),o.push(n)}else this.nullGeometryFeatures_[i]=n}for(this.featuresRtree_&&this.featuresRtree_.load(r,o),s=0,h=e.length;s<h;s++)this.dispatchEvent(new gr.Event("addfeature",e[s]))},gr.prototype.bindFeaturesCollection_=function(t){var i=!1;ci.listen(this,"addfeature",(function(s){i||(i=!0,t.push(s.feature),i=!1)})),ci.listen(this,"removefeature",(function(s){i||(i=!0,t.remove(s.feature),i=!1)})),ci.listen(t,"add",(function(t){i||(i=!0,this.addFeature(t.element),i=!1)}),this),ci.listen(t,"remove",(function(t){i||(i=!0,this.removeFeature(t.element),i=!1)}),this),this.featuresCollection_=t},gr.prototype.clear=function(t){if(t){for(var i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(ci.unlistenByKey);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.undefIdIndex_={})}else if(this.featuresRtree_)for(var s in this.featuresRtree_.forEach(this.removeFeatureInternal,this),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s]);this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.loadedExtentsRtree_.clear(),this.nullGeometryFeatures_={};var h=new gr.Event("clear");this.dispatchEvent(h),this.changed()},gr.prototype.forEachFeature=function(t,i){return this.featuresRtree_?this.featuresRtree_.forEach(t,i):this.featuresCollection_?this.featuresCollection_.forEach(t,i):void 0},gr.prototype.forEachFeatureAtCoordinateDirect=function(t,i,s){return this.forEachFeatureInExtent([t[0],t[1],t[0],t[1]],(function(h){return h.getGeometry().intersectsCoordinate(t)?i.call(s,h):void 0}))},gr.prototype.forEachFeatureInExtent=function(t,i,s){return this.featuresRtree_?this.featuresRtree_.forEachInExtent(t,i,s):this.featuresCollection_?this.featuresCollection_.forEach(i,s):void 0},gr.prototype.forEachFeatureIntersectingExtent=function(t,i,s){return this.forEachFeatureInExtent(t,(function(h){if(h.getGeometry().intersectsExtent(t)){var n=i.call(s,h);if(n)return n}}))},gr.prototype.getFeaturesCollection=function(){return this.featuresCollection_},gr.prototype.getFeatures=function(){var t;return this.featuresCollection_?t=this.featuresCollection_.getArray():this.featuresRtree_&&(t=this.featuresRtree_.getAll(),fi.isEmpty(this.nullGeometryFeatures_)||yi.extend(t,fi.getValues(this.nullGeometryFeatures_))),t},gr.prototype.getFeaturesAtCoordinate=function(t){var i=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){i.push(t)})),i},gr.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_.getInExtent(t)},gr.prototype.getClosestFeatureToCoordinate=function(t,i){var s=t[0],h=t[1],n=null,r=[NaN,NaN],e=1/0,o=[-1/0,-1/0,1/0,1/0],a=i||xi.TRUE;return this.featuresRtree_.forEachInExtent(o,(function(t){if(a(t)){var i=t.getGeometry(),u=e;if((e=i.closestPointXY(s,h,r,e))<u){n=t;var f=Math.sqrt(e);o[0]=s-f,o[1]=h-f,o[2]=s+f,o[3]=h+f}}})),n},gr.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)},gr.prototype.getFeatureById=function(t){var i=this.idIndex_[t.toString()];return void 0!==i?i:null},gr.prototype.getFormat=function(){return this.format_},gr.prototype.getOverlaps=function(){return this.overlaps_},gr.prototype.getResolutions=function(){},gr.prototype.getUrl=function(){return this.url_},gr.prototype.handleFeatureChange_=function(t){var i=t.target,s=ui.getUid(i).toString(),h=i.getGeometry();if(h){var n=h.getExtent();s in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[s],this.featuresRtree_&&this.featuresRtree_.insert(n,i)):this.featuresRtree_&&this.featuresRtree_.update(n,i)}else s in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(i),this.nullGeometryFeatures_[s]=i);var r=i.getId();if(void 0!==r){var e=r.toString();s in this.undefIdIndex_?(delete this.undefIdIndex_[s],this.idIndex_[e]=i):this.idIndex_[e]!==i&&(this.removeFromIdIndex_(i),this.idIndex_[e]=i)}else s in this.undefIdIndex_||(this.removeFromIdIndex_(i),this.undefIdIndex_[s]=i);this.changed(),this.dispatchEvent(new gr.Event("changefeature",i))},gr.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&fi.isEmpty(this.nullGeometryFeatures_)},gr.prototype.loadFeatures=function(t,i,s){var h,n,r=this.loadedExtentsRtree_,e=this.strategy_(t,i);for(h=0,n=e.length;h<n;++h){var o=e[h];r.forEachInExtent(o,(function(t){return bi.containsExtent(t.extent,o)}))||(this.loader_.call(this,o,i,s),r.insert(o,{extent:o.slice()}))}},gr.prototype.removeLoadedExtent=function(t){var i,s=this.loadedExtentsRtree_;s.forEachInExtent(t,(function(s){if(bi.equals(s.extent,t))return i=s,!0})),i&&s.remove(i)},gr.prototype.removeFeature=function(t){var i=ui.getUid(t).toString();i in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[i]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t),this.changed()},gr.prototype.removeFeatureInternal=function(t){var i=ui.getUid(t).toString();this.featureChangeKeys_[i].forEach(ci.unlistenByKey),delete this.featureChangeKeys_[i];var s=t.getId();void 0!==s?delete this.idIndex_[s.toString()]:delete this.undefIdIndex_[i],this.dispatchEvent(new gr.Event("removefeature",t))},gr.prototype.removeFromIdIndex_=function(t){var i=!1;for(var s in this.idIndex_)if(this.idIndex_[s]===t){delete this.idIndex_[s],i=!0;break}return i},gr.prototype.setLoader=function(t){this.loader_=t},ui.inherits(gr.Event=function(t,i){vi.call(this,t),this.feature=i},vi);var _r=function(t){var i=t||{},s=fi.assign({},i);delete s.preload,delete s.useInterimTilesOnError,Ws.call(this,s),this.setPreload(void 0!==i.preload?i.preload:0),this.setUseInterimTilesOnError(void 0===i.useInterimTilesOnError||i.useInterimTilesOnError),this.type="TILE"};ui.inherits(_r,Ws),_r.prototype.getPreload=function(){return this.get("preload")},_r.prototype.setPreload=function(t){this.set("preload",t)},_r.prototype.getUseInterimTilesOnError=function(){return this.get("useInterimTilesOnError")},_r.prototype.setUseInterimTilesOnError=function(t){this.set("useInterimTilesOnError",t)};var wr=function(t){var i=t||{},s=fi.assign({},i);delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,Ws.call(this,s),this.declutter_=void 0!==i.declutter&&i.declutter,this.renderBuffer_=void 0!==i.renderBuffer?i.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(i.style),this.updateWhileAnimating_=void 0!==i.updateWhileAnimating&&i.updateWhileAnimating,this.updateWhileInteracting_=void 0!==i.updateWhileInteracting&&i.updateWhileInteracting,this.renderMode_=i.renderMode||"vector",this.type="VECTOR"};ui.inherits(wr,Ws),wr.prototype.getDeclutter=function(){return this.declutter_},wr.prototype.setDeclutter=function(t){this.declutter_=t},wr.prototype.getRenderBuffer=function(){return this.renderBuffer_},wr.prototype.getRenderOrder=function(){return this.get(wr.Property_.RENDER_ORDER)},wr.prototype.getStyle=function(){return this.style_},wr.prototype.getStyleFunction=function(){return this.styleFunction_},wr.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},wr.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},wr.prototype.setRenderOrder=function(t){this.set(wr.Property_.RENDER_ORDER,t)},wr.prototype.setStyle=function(t){this.style_=void 0!==t?t:Jn.defaultFunction,this.styleFunction_=null===t?void 0:Jn.createFunction(this.style_),this.changed()},wr.prototype.getRenderMode=function(){return this.renderMode_},wr.Property_={RENDER_ORDER:"renderOrder"};var yr=function(t){var i=t||{},s=void 0!==i.className?i.className:"ol-scale-line";this.innerElement_=document.createElement("DIV"),this.innerElement_.className=s+"-inner",this.element_=document.createElement("DIV"),this.element_.className=s+" "+Gs.CLASS_UNSELECTABLE,this.element_.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==i.minWidth?i.minWidth:64,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",Is.call(this,{element:this.element_,render:i.render?i.render:yr.render,target:i.target}),ci.listen(this,mi.getChangeEventType(yr.Property_.UNITS),this.handleUnitsChanged_,this),this.setUnits(i.units||"metric")};ui.inherits(yr,Is),yr.LEADING_DIGITS=[1,2,5],yr.prototype.getUnits=function(){return this.get(yr.Property_.UNITS)},yr.render=function(t){var i=t.frameState;this.viewState_=i?i.viewState:null,this.updateElement_()},yr.prototype.handleUnitsChanged_=function(){this.updateElement_()},yr.prototype.setUnits=function(t){this.set(yr.Property_.UNITS,t)},yr.prototype.updateElement_=function(){var t=this.viewState_;if(t){var i=t.center,s=t.projection,h=this.getUnits(),n=Li.getPointResolution(s,t.resolution,i,"degrees"==h?Pi.DEGREES:Pi.METERS);"degrees"!=h&&(n*=s.getMetersPerUnit());var r=this.minWidth_*n,e="";if("degrees"==h){var o=Li.METERS_PER_UNIT[Pi.DEGREES];s.getUnits()==Pi.DEGREES?r*=o:n/=o,r<o/60?(e="″",n*=3600):r<o?(e="′",n*=60):e="°"}else"imperial"==h?r<.9144?(e="in",n/=.0254):r<1609.344?(e="ft",n/=.3048):(e="mi",n/=1609.344):"nautical"==h?(n/=1852,e="nm"):"metric"==h?r<.001?(e="μm",n*=1e6):r<1?(e="mm",n*=1e3):r<1e3?e="m":(e="km",n/=1e3):"us"==h?r<.9144?(e="in",n*=39.37):r<1609.344?(e="ft",n/=.30480061):(e="mi",n/=1609.3472):gi(!1,33);for(var a,u,f=3*Math.floor(Math.log(this.minWidth_*n)/Math.log(10));;){if(a=yr.LEADING_DIGITS[(f%3+3)%3]*Math.pow(10,Math.floor(f/3)),u=Math.round(a/n),isNaN(u))return this.element_.style.display="none",void(this.renderedVisible_=!1);if(u>=this.minWidth_)break;++f}var c=a+" "+e;this.renderedHTML_!=c&&(this.innerElement_.innerHTML=c,this.renderedHTML_=c),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},yr.Property_={UNITS:"units"};var br=function(t,i,s,h,n,r){di.call(this),this.hitDetectionImage_=null,this.image_=t||new Image,null!==h&&(this.image_.crossOrigin=h),this.canvas_=r?document.createElement("CANVAS"):null,this.color_=r,this.imageListenerKeys_=null,this.imageState_=n,this.size_=s,this.src_=i,this.tainting_=!1,2==this.imageState_&&this.determineTainting_()};ui.inherits(br,di),br.get=function(t,i,s,h,n,r){var e=xh.iconImageCache,o=e.get(i,h,r);return o||(o=new br(t,i,s,h,n,r),e.set(i,h,r,o)),o},br.prototype.determineTainting_=function(){var t=Cs(1,1);try{t.drawImage(this.image_,0,0),t.getImageData(0,0,1,1)}catch(i){this.tainting_=!0}},br.prototype.dispatchChangeEvent_=function(){this.dispatchEvent("change")},br.prototype.handleImageError_=function(){this.imageState_=3,this.unlistenImage_(),this.dispatchChangeEvent_()},br.prototype.handleImageLoad_=function(){this.imageState_=2,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.determineTainting_(),this.replaceColor_(),this.dispatchChangeEvent_()},br.prototype.getImage=function(){return this.canvas_?this.canvas_:this.image_},br.prototype.getImageState=function(){return this.imageState_},br.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.tainting_){var t=this.size_[0],i=this.size_[1],s=Cs(t,i);s.fillRect(0,0,t,i),this.hitDetectionImage_=s.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},br.prototype.getSize=function(){return this.size_},br.prototype.getSrc=function(){return this.src_},br.prototype.load=function(){if(0==this.imageState_){this.imageState_=1,this.imageListenerKeys_=[ci.listenOnce(this.image_,"error",this.handleImageError_,this),ci.listenOnce(this.image_,"load",this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}},br.prototype.replaceColor_=function(){if(!this.tainting_&&null!==this.color_){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 i=t.getImageData(0,0,this.image_.width,this.image_.height),s=i.data,h=this.color_[0]/255,n=this.color_[1]/255,r=this.color_[2]/255,e=0,o=s.length;e<o;e+=4)s[e]*=h,s[e+1]*=n,s[e+2]*=r;t.putImageData(i,0,0)}},br.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(ci.unlistenByKey),this.imageListenerKeys_=null};var xr=function(t){var i=t||{};this.anchor_=void 0!==i.anchor?i.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==i.anchorOrigin?i.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==i.anchorXUnits?i.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==i.anchorYUnits?i.anchorYUnits:"fraction",this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null;var s=void 0!==i.img?i.img:null,h=void 0!==i.imgSize?i.imgSize:null,n=i.src;gi(!(void 0!==n&&s),4),gi(!s||s&&h,5),void 0!==n&&0!==n.length||!s||(n=s.src||ui.getUid(s).toString()),gi(void 0!==n&&n.length>0,6);var r=void 0!==i.src?0:2;this.color_=void 0!==i.color?dh.asArray(i.color):null,this.iconImage_=br.get(s,n,h,this.crossOrigin_,r,this.color_),this.offset_=void 0!==i.offset?i.offset:[0,0],this.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==i.size?i.size:null,qn.call(this,{opacity:void 0!==i.opacity?i.opacity:1,rotation:void 0!==i.rotation?i.rotation:0,scale:void 0!==i.scale?i.scale:1,snapToPixel:void 0===i.snapToPixel||i.snapToPixel,rotateWithView:void 0!==i.rotateWithView&&i.rotateWithView})};ui.inherits(xr,qn),xr.prototype.clone=function(){return new xr({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(),snapToPixel:this.getSnapToPixel(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},xr.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,i=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!i)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=i[0]),"fraction"==this.anchorYUnits_&&(t[1]*=i[1])}if("top-left"!=this.anchorOrigin_){if(!i)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+i[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+i[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},xr.prototype.getColor=function(){return this.color_},xr.prototype.getImage=function(t){return this.iconImage_.getImage(t)},xr.prototype.getImageSize=function(){return this.iconImage_.getSize()},xr.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},xr.prototype.getImageState=function(){return this.iconImage_.getImageState()},xr.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},xr.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if("top-left"!=this.offsetOrigin_){var i=this.getSize(),s=this.iconImage_.getSize();if(!i||!s)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=s[0]-i[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=s[1]-i[1]-t[1])}return this.origin_=t,this.origin_},xr.prototype.getSrc=function(){return this.iconImage_.getSrc()},xr.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},xr.prototype.listenImageChange=function(t,i){return ci.listen(this.iconImage_,"change",t,i)},xr.prototype.load=function(){this.iconImage_.load()},xr.prototype.unlistenImageChange=function(t,i){ci.unlisten(this.iconImage_,"change",t,i)},window.proj4=st,window.proj4.defs("EPSG:2056","+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs");const Er={anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:.5,src:`${window.stzhComponents.pathMedia}/olmap/marker.png`},Sr=Object.assign(Object.assign({},Er),{src:`${window.stzhComponents.pathMedia}/olmap/marker-active.png`}),Cr=Object.assign(Object.assign({},Er),{anchor:[.5,.5],src:`${window.stzhComponents.pathMedia}/olmap/marker-position.png`}),Ar=class{constructor(s){t(this,s),this.stzhInitialized=i(this,"stzhInitialized",7),this.stzhPostRender=i(this,"stzhPostRender",7),this.stzhMoveStart=i(this,"stzhMoveStart",7),this.stzhMoveEnd=i(this,"stzhMoveEnd",7),this.handlePostRender=()=>{this.stzhPostRender.emit({component:"stzh-olmap"})},this.handleMoveStart=()=>{this.stzhMoveStart.emit({component:"stzh-olmap"})},this.handleMoveEnd=()=>{this.stzhMoveEnd.emit({component:"stzh-olmap"})},this.handleInsideModalOpen=()=>{this.map&&requestAnimationFrame((()=>{this.map.updateSize()}))},this.handlePrintButtonClick=()=>{this.printIframe||(this.printIframe=document.createElement("iframe"),Object.assign(this.printIframe.style,{height:"0px",width:"0px",position:"absolute",border:"none"}),this.element.append(this.printIframe)),this.printIframe.innerHTML="";const t=this.printIframe.contentWindow,i=this.constructor.style.replace('@charset "UTF-8";',""),s=Array.from(document.querySelectorAll("link")).map((t=>t.outerHTML));let h;this.map.once("postcompose",(function(t){h=t.context.canvas.toDataURL("image/png")})),this.map.renderSync(),t.document.body.innerHTML=`\n ${s.join("")}\n\n <style type="text/css">\n ${i}\n </style>\n\n <div class="stzh-olmap__map stzh-olmap__map--print">\n <img class="stzh-olmap__print-image" src="${h}">\n ${this.element.querySelector(".ol-scale-line.ol-unselectable").outerHTML}\n </div>\n `,setTimeout((()=>{try{t.document.execCommand("print",!1,null)}catch(i){t.print()}}),1e3)},this.localization=void 0,this.hostname="www.ogc.stadt-zuerich.ch",this.scaleControl=!0,this.layerControl=!0,this.printControl=!0,this.locationControl=!1,this.layer="streets",this.zoom=7,this.center=[2683311,1247082],this.centerMarker=!0,this.resolutions=[67.73333333333,33.8666666667,16.9333333333,8.4666666667,4.2333333333,2.1166666667,1.0583333333,.5291666667,.2645833333,.1322916667,.0661458333],this.layers={streets:{thumbnailUrl:`${window.stzhComponents.pathMedia}/olmap/thumb-streets.jpg`,options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"basiskarte_zuerich_gebaeudeschraegansicht",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}},satellite:{thumbnailUrl:`${window.stzhComponents.pathMedia}/olmap/thumb-satellite.jpg`,options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"orthofoto",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}}}}zoomWatcher(t){this.map&&this.map.getView().setZoom(t)}scaleControlWatcher(t){this.map&&(t?(this.scaleControlOl=new yr({units:"metric"}),this.map.addControl(this.scaleControlOl)):(this.scaleControl&&this.map.removeControl(this.scaleControlOl),this.scaleControlOl=null))}printControlWatcher(t){this.map&&(t?(this.printControlElement=document.createElement("button"),this.printControlElement.className="ol-print",this.printControlElement.ariaLabel=this.localization.printLabel,this.printControlElement.addEventListener("click",this.handlePrintButtonClick),this.printControlElement.innerHTML='<stzh-icon name="print" class="ol-print__icon"></stzh-icon>',this.printControlOl=new Is({element:this.printControlElement}),this.map.addControl(this.printControlOl)):(this.printControlOl&&this.map.removeControl(this.printControlOl),this.printControlOl=null,this.printControlElement=null))}layerControlWatcher(t){this.map&&1!==this.layersArray.length&&(t?(this.layerControlElement=document.createElement("button"),this.layerControlElement.className="ol-layer",this.layerControlElement.addEventListener("click",(()=>{this.layer="streets"===this.layer?"satellite":"streets"})),this.layerControlImageElement=document.createElement("img"),this.layerControlImageElement.className="ol-layer__thumbnail",this.layerControlImageElement.setAttribute("role","presentation"),this.layerControlImageElement.setAttribute("alt",""),this.layerControlTextElement=document.createElement("span"),this.layerControlTextElement.className="ol-layer__text",this.layerControlElement.appendChild(this.layerControlImageElement),this.layerControlElement.appendChild(this.layerControlTextElement),this.layerControlOl=new Is({element:this.layerControlElement}),this.map.addControl(this.layerControlOl)):(this.layerControlOl&&this.map.removeControl(this.layerControlOl),this.layerControlOl=null,this.layerControlElement=null,this.layerControlImageElement=null,this.layerControlTextElement=null))}locationControlWatcher(t){if(this.map)if(t){this.locationControlElement=document.createElement("button"),this.locationControlElement.className="ol-location",this.locationControlElement.innerHTML='<stzh-icon name="target-bullet" class="ol-location__icon"></stzh-icon>',this.locationControlElement.addEventListener("click",(()=>{this.geolocation.getTracking()?this.disableLocationTracking():this.enableLocationTracking()})),this.locationControlOl=new Is({element:this.locationControlElement}),this.geolocation=new ss({projection:this.map.getView().getProjection()}),this.positionMarkerOl=new Zn,this.positionMarkerOl.setId("position");const t=new Jn({image:new xr(Cr)});this.positionMarkerOl.setStyle(t),this.positionLayer.getSource().addFeature(this.positionMarkerOl),this.geolocation.on("change:position",(()=>{const t=this.geolocation.getPosition();this.positionMarkerOl.setGeometry(new qi(t)),bi.containsExtent(this.layers[this.layer].options.extent,this.positionMarkerOl.getGeometry().getExtent())&&this.map.getView().setCenter(t)})),this.geolocation.on("change:tracking",(()=>{const t=this.geolocation.getTracking();this.positionMarkerOl.setGeometry(null),this.setLocationControlState(t)})),this.geolocation.on("error",(()=>{this.setLocationControlState(!1)})),this.map.addControl(this.locationControlOl)}else this.disableLocationTracking(),this.locationControlOl&&this.map.removeControl(this.locationControlOl),this.positionMarkerOl&&this.positionLayer.getSource().removeFeature(this.positionMarkerOl),this.locationControlOl=null,this.locationControlElement=null,this.geolocation=null,this.positionMarkerOl=null}layerWatcher(t){this.map&&Object.entries(this.rasterLayers).forEach((([i,s])=>{if(i===t){s.setVisible(!0),this.map.getView().set("projection",this.projections[t]);const h=this.layersArray.find((([t])=>t!==this.layer));if(h&&(this.layerControlImageElement&&(this.layerControlImageElement.src=h[1].thumbnailUrl),this.layerControlTextElement)){let t="";"streets"===i?t=this.localization.streetsLayerTitle:"satellite"===i&&(t=this.localization.satelliteLayerTitle),this.layerControlTextElement.textContent=h[1].title||t}}else s.setVisible(!1)}))}centerWatcher(t){this.map.getView().setCenter(t),this.centerMarkerOl&&this.centerMarkerOl.setGeometry(new qi(t))}async centerMarkerWatcher(t){t?this.centerMarkerOl=await this.addIconMarker(this.center):this.centerMarkerOl&&this.removeIconMarker(this.centerMarkerOl)}async getMap(){return this.map}async addIconMarker(t){const i=new Zn({geometry:new qi(t)}),s=new Jn({image:new xr(Er)});return i.setStyle(s),this.iconLayer.getSource().addFeature(i),i}async removeIconMarker(t){return this.iconLayer.getSource().removeFeature(t)}async setIconMarkerActive(t){t.setStyle(new Jn({image:new xr(Sr)}))}async setIconMarkerInactive(t){t.setStyle(new Jn({image:new xr(Er)}))}async enableLocationTracking(){this.setLocationControlState(!0),this.geolocation&&this.geolocation.setTracking(!0)}async disableLocationTracking(){this.setLocationControlState(!1),this.geolocation&&this.geolocation.setTracking(!1)}setLocationControlState(t){this.positionLayer&&this.positionLayer.setVisible(t),this.locationControlElement&&this.locationControlElement.classList.toggle("active",t)}createMap(){const t=document.createElement("stzh-icon");t.ariaLabel=this.localization.zoomInLabel,t.name="plus";const i=document.createElement("stzh-icon");return i.ariaLabel=this.localization.zoomOutLabel,i.name="minus",new Xn({controls:Xs({zoomOptions:{zoomInLabel:t,zoomOutLabel:i,zoomInTipLabel:"",zoomOutTipLabel:""}}),interactions:eh({mouseWheelZoom:!1}),loadTilesWhileAnimating:!0,loadTilesWhileInteracting:!0,target:this.mapElement,logo:!1})}createRasterLayer(t,i){return new _r({title:"wmts",type:"base",extent:i.extent,source:this.createLayerSource(t,i)})}createLayerSource(t,i){return this.projections||(this.projections={}),this.projections[t]=new Ni({code:"EPSG:2056",extent:i.extent}),this.creatRasterSource(t,i)}creatRasterSource(t,i){const{url:s,layer:h,matrixSet:n,origin:r}=i,e=[];for(let a=0;a<this.resolutions.length;a++)e.push(a);const o=new lr({origin:r,resolutions:this.resolutions,matrixIds:e,tileSize:[512,512]});return new dr({url:s,tileGrid:o,style:"default",projection:this.projections[t],crossOrigin:"anonymous",layer:h,matrixSet:n,requestEncoding:"REST"})}createIconLayer(){return new wr({source:new gr({})})}initMap(){if(this.map=this.createMap(),this.map.on("postrender",this.handlePostRender),this.map.on("movestart",this.handleMoveStart),this.map.on("moveend",this.handleMoveEnd),this.layersArray=Object.entries(this.layers),this.layersArray.length>2)throw new Error("There are only two different layers allowed.");this.rasterLayers={},this.layersArray.forEach((([t,i])=>{i.options.url=i.options.url.replace(/{hostname}/gi,this.hostname),this.rasterLayers[t]=this.createRasterLayer(t,i.options),this.map.addLayer(this.rasterLayers[t])})),this.positionLayer=this.createIconLayer(),this.positionLayer.setVisible(!1),this.map.addLayer(this.positionLayer),this.iconLayer=this.createIconLayer(),this.map.addLayer(this.iconLayer);const t=new Ss({center:this.center,projection:this.projections[this.layer],zoom:this.zoom,resolutions:this.resolutions});this.map.setView(t),this.scaleControlWatcher(this.scaleControl),this.printControlWatcher(this.printControl),this.locationControlWatcher(this.locationControl),this.layerControlWatcher(this.layerControl),this.layerWatcher(this.layer),this.centerWatcher(this.center),this.centerMarkerWatcher(this.centerMarker),this.stzhInitialized.emit({component:"stzh-olmap"})}componentShouldUpdate(t,i,s){return["hostname","localization","layers","resolutions"].includes(s)}async componentWillLoad(){this.localization||(this.localization=await r(this.element,"olmap"))}componentWillUpdate(){this.map&&(this.map.setTarget(null),this.map=null)}componentDidRender(){this.map||this.initMap()}connectedCallback(){const t=this.element.closest("stzh-dialog");t&&t.addEventListener("stzhOpen",this.handleInsideModalOpen)}disconnectedCallback(){this.map&&(this.map.setTarget(null),this.map=null);const t=this.element.closest("stzh-dialog");t&&t.removeEventListener("stzhOpen",this.handleInsideModalOpen)}render(){return s(h,null,s("div",{class:{"stzh-olmap":!0}},s("div",{ref:t=>this.mapElement=t,class:"stzh-olmap__map"})))}get element(){return n(this)}static get watchers(){return{zoom:["zoomWatcher"],scaleControl:["scaleControlWatcher"],printControl:["printControlWatcher"],layerControl:["layerControlWatcher"],locationControl:["locationControlWatcher"],layer:["layerWatcher"],center:["centerWatcher"],centerMarker:["centerMarkerWatcher"]}}};Ar.style=":host{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}:host[hidden]{display:none}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}stzh-olmap{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block;position:relative;width:100%;height:18.75rem}stzh-olmap[hidden]{display:none}stzh-olmap *,stzh-olmap *::before,stzh-olmap *::after{-webkit-box-sizing:border-box;box-sizing:border-box}@media screen and (min-width: 800px){stzh-olmap{height:25rem}}.stzh-olmap__map{position:absolute;width:100%;height:100%;top:0;left:0}.stzh-olmap__map--print{margin-top:var(--stzh-space-xxlarge);max-width:100%;height:auto}.stzh-olmap__print-image{display:block;max-width:100%}.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom-in,.stzh-olmap .ol-zoom-out{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-deca-font-size);line-height:var(--stzh-font-deca-text-line-height);letter-spacing:var(--stzh-font-deca-text-letter-spacing);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;border-radius:0;color:var(--stzh-color-primary, var(--stzh-color-zueriblue));-webkit-transition:all var(--stzh-base-transition-animation-speed) ease;transition:all var(--stzh-base-transition-animation-speed) ease;background-color:var(--stzh-color-white);width:2.5rem;height:2.375rem;cursor:pointer}.stzh-olmap .ol-print stzh-icon,.stzh-olmap .ol-location stzh-icon,.stzh-olmap .ol-zoom-in stzh-icon,.stzh-olmap .ol-zoom-out stzh-icon{--size:var(--stzh-icon-size-small)}.stzh-olmap .ol-print:hover,.stzh-olmap .ol-location:hover,.stzh-olmap .ol-zoom-in:hover,.stzh-olmap .ol-zoom-out:hover{color:var(--stzh-color-white);background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom{position:absolute;right:0.625rem;-webkit-box-shadow:var(--stzh-box-shadow-popover);box-shadow:var(--stzh-box-shadow-popover);border-radius:var(--stzh-form-input-border-radius)}@media screen and (min-width: 800px){.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom{right:1.25rem}}.stzh-olmap .ol-layer{left:0.625rem;bottom:0.625rem;right:auto;padding:var(--stzh-space-xxxsmall);border:none}@media screen and (min-width: 800px){.stzh-olmap .ol-layer{left:1.25rem;bottom:1.25rem}}.stzh-olmap .ol-layer__thumbnail{width:4.6875rem;height:4.6875rem;display:block}.stzh-olmap .ol-layer__text{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);position:absolute;bottom:0;left:0;right:0;text-align:left;background-color:var(--stzh-color-white);color:var(--stzh-color-primary, var(--stzh-color-zueriblue));padding-left:calc(var(--stzh-space-xxxsmall) + 0.0625rem);padding-right:calc(var(--stzh-space-xxxsmall) + 0.0625rem)}.stzh-olmap .ol-layer:hover .ol-layer__text{color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-location{bottom:calc(3.75rem + 7.125rem + var(--stzh-space-small) * 2)}@media screen and (min-width: 800px){.stzh-olmap .ol-location{bottom:calc(4.375rem + 7.125rem + var(--stzh-space-small) * 2)}}.stzh-olmap .ol-location.active{background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));color:var(--stzh-color-white)}.stzh-olmap .ol-zoom{bottom:calc(3.75rem + 2.375rem + var(--stzh-space-small));background-color:var(--stzh-color-grey13)}@media screen and (min-width: 800px){.stzh-olmap .ol-zoom{bottom:calc(4.375rem + 2.375rem + var(--stzh-space-small))}}.stzh-olmap .ol-zoom-in{margin-bottom:0.0625rem}.stzh-olmap .ol-print{bottom:3.75rem}@media screen and (min-width: 800px){.stzh-olmap .ol-print{bottom:4.375rem}}.stzh-olmap .ol-rotate,.stzh-olmap .ol-attribution{display:none}.stzh-olmap .ol-scale-line{position:absolute;bottom:0;right:0;padding:var(--stzh-space-xxsmall);background:var(--stzh-color-white);border-top-left-radius:var(--stzh-form-input-border-radius)}.stzh-olmap .ol-scale-line-inner{font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);border:0.0625rem solid var(--stzh-color-grey55);border-top:0;color:var(--stzh-color-grey55);text-align:center}";export{Ar as stzh_olmap}
|