[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nindent_style = tab\nindent_size = 4\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.{yml, json}]\nindent_style = space\nindent_size = 2\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".gitattributes",
    "content": "README.md       export-ignore\nCHANGELOG.md    export-ignore\n/resources      export-ignore\n.gitignore      export-ignore\n.gitattributes  export-ignore\n/.idea          export-ignore\n.editorconfig   export-ignore\n/docs           export-ignore\n"
  },
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "content": "# Code of Conduct\n\nDon't be a twat."
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "# Contributing\n\n### New Features\n\nYou can request new features by submitting an issue with `[FR]` prefix in the title.\n\n### Bugs\n\nIf you find a bug, submit an issue and I promise I will get around to it. Eventually.\nMake sure you search around to see if the same (or similar) issue exists before \nsubmitting a new one.\n\nKnow how to fix a bug and have too much spare time on your hands? Submit a Pull Request!\nCheck out the code conventions below before hand.\n\n## Code Conventions\n\nIn addition to [Crafts Guidelines](https://github.com/craftcms/docs/blob/v3/en/coding-guidelines.md):\n\n- Use tabs not spaces\n- Try to keep within the 80 characters line length\n- If function arguments or array values can't fit on one line, break each value onto it's own line\n- Comment as much as possible\n\n#### JavaScript\n\nIn addition to the above:\n\n- Write valid ES6\n- Use single quotes `'`\n\nDon't follow my example, try to stick to the above guidelines!\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [tam]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/craft-3-issue.md",
    "content": "---\nname: Craft 3 Issue\nabout: An issue with the Craft 3 version of the plugin\ntitle: ''\nlabels: Craft 3\nassignees: ''\n\n---\n\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/craft-4-issue.md",
    "content": "---\nname: Craft 4 Issue\nabout: An issue with the Craft 4 version of the plugin\ntitle: ''\nlabels: Craft 4\nassignees: ''\n\n---\n\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "### Description\n\n\n\n### Steps to reproduce\n\n1.\n2.\n\n\n### Additional info\n\n- Craft version:\n- Maps version:\n- PHP version:\n- Database driver & version:\n- Other Plugins:\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "Fixes # .\n\nChanges proposed in this pull request:\n\n- \n- \n- "
  },
  {
    "path": ".gitignore",
    "content": "### OSX\n.DS_Store\n.AppleDouble\n.LSOverride\n\n# Icon must end with two \\r\nIcon\n\n# Thumbnails\n._*\n\n# Files that might appear in the root of a volume\n.DocumentRevisions-V100\n.fseventsd\n.Spotlight-V100\n.TemporaryItems\n.Trashes\n.VolumeIcon.icns\n\n# Directories potentially created on remote AFP share\n.AppleDB\n.AppleDesktop\nNetwork Trash Folder\nTemporary Items\n.apdisk\n\nvendor\nnode_modules\nhot\nmix-manifest.json\n/.idea"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## 5.0.4 - 2024-11-11\n### Added\n- Add support for WordPress ACF -> Craft import (via @brandonkelly)\n\n## 5.0.3 - 2024-09-16\n### Fixed\n- Fixed location filter affecting unrelated queries (Fixes #405)\n\n## 5.0.2 - 2024-09-10\n### Fixed\n- Fixes location search (Fixes #394, #393, #392)\n\n## 5.0.1 - 2024-06-27 [CRITICAL]\n### Security\n- Removed Polyfill.io (https://sansec.io/research/polyfill-supply-chain-attack)\n\n## 5.0.0 - 2024-04-04\n### Fixed\n- Fix referred on Mapbox geo requests (Fixes #338, via @maxdmyers)\n- Fix type errors in front-end usage (Fixes #379, via @samhibberd)\n- Fix error when normalizing invalid location (Fixes #368, #380, via @Decyphr)\n- Fix intermittent issues w/ Google Maps API loading (Fixes #294, via @davidwebca)\n- Allow nullable zoom value (Fixes #381)\n- Pass site language to embedded Google map (Fixes #373)\n- Support casting map to string (Fixes #362)\n- Remove reference to MaxMind Lite from docs (Fixes #358)\n\n## 5.0.0-rc1 - 2024-03-01\n### Changed\n- Add support for Craft 5\n\n## 4.0.4 - 2023-06-26\n### Fixed\n- Update settings autosuggest input (Fixes #374)\n\n## 4.0.3 - 2022-07-11\n### Fixed\n- Fixed $id embed issue (Fixes #353)\n- Allow all Parts to be null as well as an empty string (Fixes #349)\n- Fix issue placing marker along coastline when using Mapbox (Fixes #322)\n\n### Changed\n- Removed WikiMedia tiles, falling back to OpenStreetMap (Fixes #307)\n\n## 4.0.2 - 2022-06-08\n### Fixed\n- Misc fixes via @davidwebca & @jamesedmonston\n\n## 4.0.1 - 2022-05-18\n### Fixed\n- Fix Geo Location Token only allowing string (Fixes #343)\n\n## 4.0.0 - 2022-05-10\n### Fixed\n- Mostly functional, only slightly buggy, Craft 4 Support\n\n## 3.9.3 - 2022-01-17\n### Fixed\n- Fix Mapbox Forbidden issue (Fixes #218, via @Saboteur777)\n\n## 3.9.2 - 2021-08-26\n### Changed\n- Change default map tileset to Carto Voyager\n\n### Fixed\n- Fix some geolocation services conversion failing when the given location is not a valid address (Fixes #322)\n- Fix error when upgrading due to missing `type` field (via @cornernote)\n\n## 3.9.1 - 2021-04-30\n### Added\n- Add Guzzle 7 support (via @dwheeldo)\n\n## 3.9.0.2 - 2020-12-01\n### Improved\n- Improved GQL docs\n\n### Fixed\n- Fix GQL Coords type missing `lng`\n\n## 3.9.0.1 - 2020-11-27\n### Fixed\n- Removed distance field from GQL mutation input\n\n## 3.9.0 - 2020-11-27\n> {warning} **BREAKING**: This release changes how GraphQL querying works for\nthe map field. You should now pass the search query as an input rather than a \nJSON string.\n\n### Added\n- Added GraphQL support for query filtering and mutations\n\n### Improved\n- Address inputs will span full width when map is disabled (Fixes #282)\n\n## 3.8.5 - 2020-10-08\n### Added\n- Add `centerFallback` option to map embeds (Fixes #263)\n\n### Changed\n- Prefix name of `Map` graphql elements\n\n### Fixed\n- Reduce search radius to 0 if location is not valid (Fixes #277)\n- Fix mapbox geocode error when country is not valid ISO code (Fixes #276)\n\n### Removed\n- Remove MaxMind Lite option\n\n## 3.8.4.1 - 2020-07-03\n### Fixed\n- Fix url encode issue for markers in static map images\n\n## 3.8.4 - 2020-06-12\n### Changed\n- Allow zoom override on Google/Mapbox embeds\n- Allow style override on Mapbox embeds (Fixes #256)\n\n### Fixed\n- Cast embed center coordinates to floats\n- Upgraded Mapbox to use new Static Tiles API\n\n## 3.8.3 - 2020-04-09\n### Added\n- Added JSON support when filtering by a map field. Very useful for Crafts current GQL implementation (Fixes #248)\n\n### Fixed\n- Markers coodinates are now cast to floats (via [@Sekonda](https://github.com/Sekonda))\n- Exclude empty map fields when sorting by distance (Fixes #245)\n\n## 3.8.2 - 2020-03-04\n### Fixed\n- Fix issue where elements failed to save when searching for a location via Google or Here (Fixes #242)\n- Fix what3words not updating when searching for a location\n\n## 3.8.1 - 2020-02-27\n### Added\n- Add env support to settings (Closes #241)\n\n### Improved\n- Improve settings page appearance during load\n\n## 3.8.0 - 2020-02-25\n### Added\n- Add What3Words support (Closes #236)\n\n### Fixed\n- Fix issue when trying to render a static map without markers (Fixes #225)\n\n## 3.7.7 - 2020-01-17\n### Fixes\n- Fix error when attempts to populate missing data return null (Fixes #233)\n\n## 3.7.6 - 2019-12-18\n### Fixed\n- Fix issue with getting distance when lat/lng was stored as string (Fixes #230)\n- Fix issue when upgrading maps for fields that no longer exist (Fixes #227)\n\n## 3.7.5 - 2019-12-04\n### Added\n- Add config option to disable missing field data population (Fixes #226)\n- Add Current Location button to Map (Closes #219)\n\n## 3.7.4 - 2019-12-03\n### Improved\n- 🔥 Improved location searching and distance sorting by up to 1800%! ⚡️\n\n## 3.7.3 - 2019-11-29\n### Fixed\n- Fix issue with Mapbox parts lookup when address property is missing\n- Fix issue with count when doing a location search\n\n## 3.7.2 - 2019-11-19\n### Changed\n- Embed map width and height can now be set to `null` (Fixes #221)\n\n### Fixed\n- Fix map embed / static options not converting center string correctly\n- Fix multiple leaflet maps not rendering correctly\n- Fix map not being draggable on mobile (Fixes #220)\n- Fix mini-map going off screen on small laptops (Fixes #222)\n\n## 3.7.1 - 2019-10-24\n### Added\n- Add support for `:empty:` and `:notempty:` (Fixes #214)\n\n### Fixed\n- Fix `embed` and `imgSrcSet` not setting options correctly when outputting from a map field (Fixes #215)\n\n## 3.7.0 - 2019-10-15\n### Added\n- Add docs\n- Add Craft GraphQL support\n- Add Pro edition\n- Add static map image support\n- Add new map field size options\n- Add IP based user location lookup\n- Add ability to redirect to a specific site based off user location\n- Add `coordinate` query argument to CraftQL (Closes #205)\n- Add \"mini\" size for a tiny field footprint (Closes #203)\n- Add `address()` method to map value for easy address formatting\n- Add galactic address parts\n\n### Changed\n- 🍆 New, sexier UI! 💦\n- Mapbox, Apple Maps, and Here are now only available in Maps Pro\n- Now requires Craft 3.2.1 or newer\n\n### Improved\n- Remove Vue from JS bundle to reduce file size\n- Removed fly animation when updating map location for snappier UI (Closes #202)\n\n### Fixed\n- Fix map not showing when other Vue based plugins interfere (Fixes #196)\n- Fix issue when migrating from an older version of Maps (Fixes #195)\n- Fix project config migration issue (Fixes #207)\n- Fix issues upgrading Maps from Craft 2 to 3 (via [@roelvanhintum](https://github.com/roelvanhintum))\n\n## 3.6.4.3 - 2019-08-30\n### Fixed\n- Fix issue when trying to save map field on initial draft entry\n\n## 3.6.4.2 - 2019-08-01\n### Changed\n- Don't update project config unnecessarily during migration (Closes #194)\n\n### Fixed\n- Fix migration error when upgrading from 3.3.4 or lower (Fixes #192)\n\n## 3.6.4.1 - 2019-07-30\n### Fixed\n- Fix error when populating legacy parts server-side from lat/lng\n- Fix error when logging invalid legacy part\n\n## 3.6.4 - 2019-07-30\n### Fixed\n- Remove errant debug code causing migration to run every request (Fixes #190)\n- Fix migration trying to change a column type to a table (Fixes #189, #188)\n\n## 3.6.3 - 2019-07-25\n### Added\n- Add min / max zoom settings to map field (Closes #186)\n\n### Fixed\n- Fix migration from Craft 2 (Fixes #153)\n- Fix issue when column already exists during migration (Fixes #187)\n\n## 3.6.2.2 - 2019-07-24\n### Fixed\n- Fix migration issue when matrix / super table blocks don't have any fields (Fixes #184)\n\n## 3.6.2.1 - 2019-07-23\n### Fixed\n- Fix migration issue when no matrix or SuperTable blocks exist (Fixes #182)\n- Fix issue with Google trying to set legacy parts that aren’t supported (Fixes #183)\n- Fix getting top-level map value part if no parts exist (Fixes #181)\n\n## 3.6.2 - 2019-07-23\n### Added\n- Add `postal_code_suffix` to `PartsLegacy` (Fixes #179)\n\n### Fixed\n- Fix migration error when upgrading from 3.4.x to 3.6.x (Fixes #178)\n- Fix project config content column type being string instead of text (Fixes #180)\n\n## 3.6.1 - 2019-07-19\n### Added\n- Add support for getting parts without having to go via the `parts` property. \n(i.e. `myMap.parts.number` can be simply `myMap.number`). This _doesn't_ work \nfor the `address` part, which is already in use and returns the full address \nas a string (alternatively, use the `streetAddress` alias). (Closes #154)\n- Add `streetAddress` alias of `address` to Parts.\n\n### Changed\n- `PartsLegacy` will be used when Google is the chosen Geo service, giving \naccess to additional Google specific parts (Fixes #167)\n\n### Fixed\n- Fix error when normalizing value without an element (Fixes #174)\n- Fix JS error when using two different API keys for Google maps services (Fixes #165)\n- Fix parts being lost when moving from new to legacy (any other geo service to google)\n- Fix issue with Mapbox geo service when country was unrestricted\n- Fix JS issues when using Apple or Google Maps in an element edit HUD (Fixes #175)\n\n## 3.6.0 - 2019-07-12\n\n> {warning} This update changes how map data is stored, moving away from an \nelement type. This means if you are eager loading the a map field, you'll want \nto remove the `with` from your query and `[0]` when outputting the map (if you \nhave it). We also **strongly** recommend taking a backup before updating.\n\n> {tip} If you get a `Column not found` error when upgrading, try running `./craft migrate/all`.\n\n### Changed\n- Reformat data structure to remove map element type and need for eager loading\n\n### Fixed\n- Fix missing postcode warning (Fixes #169)\n- Fix map save DB issue in Craft 3.2 (Fixes #170)\n- Fix map not retrieving saved values in Craft 3.2 (Fixes #171)\n- Fix DB error on duplicate import via FeedMe (Fixes #168)\n- Fix maps not propagating across sites (Fixes #141)\n\n## 3.5.2 - 2019-06-20\n### Improved\n- FeedMe can now import the individual map parts\n\n## 3.5.1 - 2019-06-20\n### Added\n- Maps can now populate address and lat/lng data based off only a postcode\n\n## 3.5.0 - 2019-06-13\n### Added\n- Added FeedMe support!\n\n### Fixed\n- Fixed results being duplicated when searching by location when an entry has \nmultiple map fields within the search catchment.\n- Account for missing Craft 2 API keys\n- Fix HERE search not working when no country restriction was set\n\n### Changed\n- Add default zoom to map element\n- Update preferred country instructions to be clearer\n- Support rendering a map field without a value\n- Use field handle as table alias suffix, instead of random bytes\n\n## 3.4.11 - 2019-04-05\n### Fixed\n- Map records are no longer double saved when upgrading to from Craft 2 to 3\n\n## 3.4.10 - 2019-04-04\n### Fixed\n- Map records are no longer double saved when upgrading to >3.4.x\n\n## 3.4.9 - 2019-04-01\n### Added\n- Added option to show lat / lng fields\n\n### Fixed\n- Fixed map not validating correctly\n- Fixed wrong map value being shown on element index with multiple sites\n- Fixed missing table prefix in map element query\n- Fixed migration issue when upgrading due to duplicate element IDs\n\n### Improved\n- Scrolling to zoom disabled on map\n- Clearing the map will no longer store the default data\n\n## 3.4.8 - 2019-03-27\n### Fixed\n- Fix error when migrating a field from Craft 2 when `countryRestriction` isn't set\n- Location search excludes elements that have been soft-deleted\n- Fixed issue restoring trashed elements that have a map field\n- Map field elements are trashed and deleted correctly\n- Fixed syntax issue on PHP <7.1.0\n- Fixed error during repair migration when element doesn't exist\n\n## 3.4.7 - 2019-03-25\n### Fixed\n- Fixed JS error when clearing field\n- Fixed missing parts when using Google maps for geo-coding\n\n### Improved\n- Clear button now translatable\n\n## 3.4.6 - 2019-03-25\n### Added\n- Added \"Clear\" button\n- Always show full address field even if address block is hidden\n\n### Fixed\n- The really shitty element stuff. Is good now. I think.\n\n## 3.4.5 - 2019-03-25\n### Fixed\n- Fixed maps failing to get value after save\n\n### Changed\n- Using Google Maps geo service will result in legacy parts always being used, \nmeaning you can access all available address components.\n\n## 3.4.4 - 2019-03-22\n### Fixed\n- Fixed some issues when upgrading from older versions of Maps. We recommend \nupgrading from 3.3.4 or lower directly to this release or later.\n\n## 3.4.3 - 2019-03-20\n### Changed\n- You can now pass a map to the location query (fixes #99)\n\n### Fixed\n- Fixed issue when `cp-field-inspect` plugin is installed (fixes #127)\n- Fixed `elementId cannot be null` error on saving new entries with map fields (fixes #126)\n\n## 3.4.2 - 2019-03-20\n### Fixed\n- Fixed issue setting old field settings after upgrade.\n\n## 3.4.1 - 2019-03-20\n### Fixed\n- Fixed an issue where the map field class broke after upgrading.\n\n## 3.4.0 - 2019-03-20\n\n> {warning} This is a major update, we strongly recommend taking a database backup before updating!\n\n### Changed\n- SimpleMap is now Maps! We've re-written the plugin from the ground-up while \nkeeping it backwards compatible (even back to Craft 2!)\n- Maps is now powered by Vue!\n- New icon yo\n\n### Added \n- OpenStreetMap Support and map tiles\n- Mapbox Support and map tiles\n- Apple MapKit Map Tiles\n- Here Maps Support and map tiles\n- Wikimedia Map Tiles\n- Carto Map Tiles\n- Address inputs for manually settings address parts data.\n\n### Improved\n- We've normalized the map \"Parts\", so you'll always know what data you have available.\n- CraftQL support: you can now query and mutate Maps fields via Graph!\n- Field Customization: It's now possible to hide the location search, map, and address inputs.\n\n### Fixed\n- Maps are now multi-site aware and can be translated.\n\n### Removed\n- Removed lat/lng inputs from field\n- Removed restrict by type\n- Removed boundary restriction\n\n## 3.3.4 - 2018-09-05\n### Fixed\n- Fixed a bug where SimpleMap would not validate required fields. (via @samhibberd)\n\n## 3.3.3 - 2018-03-13\n### Fixed\n- Fixed a bug where SimpleMap would cause the `ResaveElements` job to error when triggered via console.\n\n## 3.3.2 - 2018-03-05\n### Added\n- Added docs for using a config file to configure the plugin.\n\n### Fixed\n- Fixed JOIN alias issue when using the Element API plugin (via @idontmessabout)\n\n## 3.3.1 - 2018-01-30\n### Fixed\n- Fixed JS bug on settings page\n\n## 3.3.0 - 2018-01-30\n### Fixed\n- Added a fix for those annoying `Call to a member function getMap() on null` bugs\n\n### Improved\n- Map height no longer jumps when page loads\n- Vastly improved the map fields settings UI/UX\n\t- No more nasty text fields!\n\t- Map height and position is now set by resizing and moving a map\n\t- Auto-complete search bounds can now be drawn directly onto a map\n\t- Radio buttons are now drop-downs\n\n### Changed\n- Now using the plugins `afterInstall` function instead of the plugin after install event\n- The \"Hide Lat/Lng\" option is now true by default\n\n## 3.2.0 - 2018-01-25\n### Fixed\n- Fixed bug where pagination would error when querying via a map field. #70\n\n### Improved\n- Updated CraftQL support (via @markhuot)\n- Removed webonyx/graphql-php dependency #71\n- Improved address and lat/lng input sizing on smaller screens and in a HUD #73\n- Updated Mapbox example to use latest API #74\n\n## 3.1.3 - 2017-12-18\n### Fixed\n- Map fields no longer cause global sets to fail to save!\n\n## 3.1.2 - 2017-12-18\n### Fixed\n- Fixed settings not translating for non-English languages\n- Fixed boundary settings fields not accepting decimals\n\n## 3.1.1 - 2017-11-30\n### Fixed\n- Fixed bug where maps were failing to save.\n\n## 3.1.0 - 2017-11-30\n### Added\n- [CraftQL](https://github.com/markhuot/craftql) support!\n- Added `craft.simpleMap.getLatLngFromAddress($addressString[, $country])`.\n\n### Improved\n- The maps `parts` now contains all available options from [here](https://developers.google.com/maps/documentation/geocoding/intro#Types) (including the `_small` variants). Any options without values are returned as empty strings.\n\n## 3.0.4 - 2017-11-28\n### Added\n- Added ability to restrict location search by country\n\n### Changed\n- New icon!\n\n## 3.0.3 - 2017-11-08\n### Added\n- It's now possible to save the map field with only an address! Useful for populating the field from the front-end. (Requires the Geocoding API).\n\n### Improved\n- The address and lat/lng are now validated.\n\n## 3.0.2 - 2017-11-03\n### Fixed\n- Fixed a bug where location searches would error if `orderBy` was not defined\n\n## 3.0.1 - 2017-11-03\n### Fixed\n- Fixed maps not rendering\n\n## 3.0.0 - 2017-11-03\n### Changed\n- Initial Craft 3 Release\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright © Ether Creative\n\nPermission is hereby granted to any person obtaining a copy of this software\n(the “Software”) to use, copy, modify, merge, publish and/or distribute copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\n1. **Don’t plagiarize.** The above copyright notice and this license shall be\n   included in all copies or substantial portions of the Software.\n\n2. **Don’t use the same license on more than one project.** Each licensed copy\n   of the Software shall be actively installed in no more than one production\n   environment at a time.\n\n3. **Don’t mess with the licensing features.** Software features related to\n   licensing shall not be altered or circumvented in any way, including (but\n   not limited to) license validation, payment prompts, feature restrictions,\n   and update eligibility.\n\n4. **Pay up.** Payment shall be made immediately upon receipt of any notice,\n   prompt, reminder, or other message indicating that a payment is owed.\n\n5. **Follow the law.** All use of the Software shall not violate any applicable\n   law or regulation, nor infringe the rights of any other person or entity.\n\nFailure to comply with the foregoing conditions will automatically and\nimmediately result in termination of the permission granted hereby. This\nlicense does not include any right to receive updates to the Software or\ntechnical support. Licensees bear all risk related to the quality and\nperformance of the Software and any modifications made or obtained to it,\nincluding liability for actual and consequential harm, such as loss or\ncorruption of data, and any necessary service, repair, or correction.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER\nLIABILITY, INCLUDING SPECIAL, INCIDENTAL AND CONSEQUENTIAL DAMAGES, WHETHER IN\nAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "![Maps](./resources/imgs/map-banner.jpg)\n\n# Maps\n\nA beautifully simple, yet deceptively powerful, Map field that works out of the \nbox with no setup or API tokens needed! \n\nConfigure the map field to only show the features you want; hide the address, \nshow latitude / longitude, or hide the map entirely. Choose from 4 geocoding \nservices, 3 geolocation services, and 24 map tilesets!\n\nMaps offers full multi-site support, compatibility with Matrix, \n[SuperTable](https://verbb.io/craft-plugins/super-table/features), and \n[CraftQL](https://plugins.craftcms.com/craftql), and the ability to search by \nlocation and sort by distance.\n\n![Maps Field](./resources/imgs/normal.png)\n\n![Searching](./resources/imgs/normal-searching.png)\n\n## Mini Map\n\nMaps offers a mini map field that fits perfectly in a Super Table without \ntaking up a lot of space!\n\n![Mini](./resources/imgs/mini.png)\n\n## Map Tiles and Geo\n\nMaps supports the following map tiles:\n\n<details>\n  <summary>Wikimedia</summary>\n\n  [Wikimedia](https://foundation.wikimedia.org/wiki/Maps_Terms_of_Use) | | | \n  --- | --- | ---  \n  ![Wikimedia](./resources/imgs/tilesets/wikimedia.png) | <img src=\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%27400%27%20style%3D%27background%3Atransparent%27%2F%3E\" /> | <img src=\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%27400%27%20style%3D%27background%3Atransparent%27%2F%3E\" />\n  Wikimedia | | \n</details>\n<details>\n  <summary>OpenStreetMap</summary>\n  \n  [OpenStreetMap](https://www.openstreetmap.org) | | | \n  --- | --- | ---\n  ![OpenStreetMap](./resources/imgs/tilesets/openstreetmap.png) | <img src=\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%27400%27%20style%3D%27background%3Atransparent%27%2F%3E\" /> | <img src=\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%27400%27%20style%3D%27background%3Atransparent%27%2F%3E\" />\n  OpenStreetMap | | \n</details>\n<details>\n  <summary>Carto (Voyager, Positron, Dark Matter)</summary>\n \n  [Carto](https://carto.com/location-data-services/basemaps/) | | | \n  --- | --- | ---\n  ![Carto Voyager](./resources/imgs/tilesets/carto-rastertiles-voyager.png) | ![Carto Positron](./resources/imgs/tilesets/carto-light_all.png) | ![Carto Dark Matter](./resources/imgs/tilesets/carto-dark_all.png)\n  Voyager | Positron | Dark Matter\n</details>\n<details>\n  <summary>Mapbox (Outdoors, Streets, Dark, Light)</summary>\n\n  [Mapbox](https://www.mapbox.com) | | | \n  --- | --- | ---  \n  ![Mapbox Outdoors](./resources/imgs/tilesets/mapbox-outdoors.png) | ![Mapbox Streets](./resources/imgs/tilesets/mapbox-streets.png) | ![Mapbox Dark](./resources/imgs/tilesets/mapbox-dark.png)\n  Outdoors | Streets | Dark\n  ![Mapbox Light](./resources/imgs/tilesets/mapbox-light.png) | |\n  Light | |\n</details>\n<details>\n  <summary>Google Maps (Roadmap, Terrain, Hybrid)</summary>\n\n  [Google Maps](https://www.google.com/maps) | | | \n  --- | --- | ---  \n  ![Google Roadmap](./resources/imgs/tilesets/google-roadmap.png) | ![Google Terrain](./resources/imgs/tilesets/google-terrain.png) | ![Google Hybrid](./resources/imgs/tilesets/google-hybrid.png)\n  Roadmap | Terrain | Hybrid\n</details>\n<details>\n  <summary>Apple MapKit (Standard, Muted, Satellite, Hybrid)</summary>\n\n  [Apple MapKit](https://developer.apple.com/maps/mapkitjs/) | | | \n  --- | --- | ---  \n  ![MapKit Standard](./resources/imgs/tilesets/mapkit-standard.png) | ![MapKit Muted](./resources/imgs/tilesets/mapkit-muted.png) | ![MapKit Satellite](./resources/imgs/tilesets/mapkit-satellite.png)\n  Standard | Muted | Satellite\n  ![MapKit Hybrid](./resources/imgs/tilesets/mapkit-hybrid.png) | |\n  Hybrid | |  \n</details>\n<details>\n  <summary>Here (Day, Day Grey, Day Transit, Reduced, Pedestrian, Terrain, Satellite, Hybrid)</summary>\n  \n  [Here](https://www.here.com/) | | | \n  --- | --- | ---\n  ![Here Day](./resources/imgs/tilesets/here-normal-day.png) | ![Here Day Grey](./resources/imgs/tilesets/here-normal-day-grey.png) | ![Here Day Transit](./resources/imgs/tilesets/here-normal-day-transit.png)\n  Day | Day Grey | Day Transit\n  ![Here Reduced](./resources/imgs/tilesets/here-reduced-day.png) | ![Here Pedestrian](./resources/imgs/tilesets/here-pedestrian-day.png) | ![Here Terrain](./resources/imgs/tilesets/here-terrain-day.png)\n  Reduced | Pedestrian | Terrain\n  ![Here Satellite](./resources/imgs/tilesets/here-satellite-day.png) | ![Here Hybrid](./resources/imgs/tilesets/here-hybrid-day.png) |\n  Satellite | Hybrid |\n</details>\n\n  \nAnd these geocoding services:\n\n- [Nominatim (OpenStreetMap)](https://nominatim.openstreetmap.org/)\n- [Mapbox](https://www.mapbox.com/)\n- [Google Maps](https://www.google.com/maps)\n- [Here](https://www.here.com/)\n\nAnd these geolocation services:\n- [ipstack](https://ipstack.com/)\n- [MaxMind Lite](https://dev.maxmind.com/geoip/geoip2/geolite2/)\n- [MaxMind](https://maxmind.com/)\n\n## Documentation\nFor full documentation visit the \n**[Maps Ether Docs](https://docs.ethercreative.co.uk/maps)**.\n"
  },
  {
    "path": "composer.json",
    "content": "{\n  \"name\": \"ether/simplemap\",\n  \"description\": \"A beautifully simple Map field type for Craft CMS\",\n  \"type\": \"craft-plugin\",\n  \"license\": \"proprietary\",\n  \"minimum-stability\": \"dev\",\n  \"require\": {\n    \"craftcms/cms\": \"^5.0.0\",\n    \"mapkit/jwt\": \"^1.1.2\",\n    \"geoip2/geoip2\": \"~2.0\",\n    \"guzzlehttp/guzzle\": \"^6.3.3|^7.2.0\",\n    \"what3words/w3w-php-wrapper\": \"3.*\",\n    \"ext-openssl\": \"*\",\n    \"ext-json\": \"*\",\n    \"ext-zlib\": \"*\",\n    \"php\": \"^8.2\"\n  },\n  \"require-dev\": {\n    \"craftcms/wp-import\": \"dev-main\"\n  },\n  \"autoload\": {\n    \"psr-4\": {\n      \"ether\\\\simplemap\\\\\": \"src/\"\n    }\n  },\n  \"support\": {\n    \"email\": \"help@ethercreative.co.uk\",\n    \"docs\": \"https://docs.ethercreative.co.uk/maps\",\n    \"source\": \"https://github.com/ethercreative/simplemap\",\n    \"issues\": \"https://github.com/ethercreative/simplemap/issues\"\n  },\n  \"extra\": {\n    \"handle\": \"simplemap\",\n    \"name\": \"Maps\",\n    \"developer\": \"Ether Creative\",\n    \"developerUrl\": \"https://ethercreative.co.uk\",\n\n    \"class\": \"ether\\\\simplemap\\\\SimpleMap\",\n    \"schemaVersion\": \"3.4.2\"\n  },\n  \"config\": {\n    \"allow-plugins\": {\n      \"yiisoft/yii2-composer\": true,\n      \"craftcms/plugin-installer\": true\n    }\n  }\n}\n"
  },
  {
    "path": "docs/.docs.json",
    "content": "{\n  \"nav\": {\n    \"index\": \"Introduction\",\n    \"getting-started\": {\n      \"_label\": \"Getting Started\",\n      \"installation\": \"Installation\",\n      \"config\": \"Configuration\",\n      \"usage\": \"Usage\"\n    },\n    \"how-to\": {\n      \"_label\": \"How-to Guides\",\n      \"search\": \"Search by Location\",\n      \"graphql\": \"Querying in GraphQL\"\n    },\n    \"rendering\": {\n      \"_label\": \"Rendering\",\n      \"static\": \"Static\",\n      \"embed\": \"Embed\"\n    },\n    \"geolocation\": {\n      \"_label\": \"Geo-location\",\n      \"get\": \"Get User Location\",\n      \"redirect\": \"User Location Redirecting\"\n    }\n  }\n}\n"
  },
  {
    "path": "docs/geolocation/get.md",
    "content": "---\ntitle: Get User Location\n---\n\n# Get User Location\n\nGetting the current users location based of their IP address is easy using the \nhandy Craft Twig method:\n\n```twig\n{% set userLocation = craft.maps.getUserLocation([ip]) %}\n```\n\n- **`ip`** is an optional parameter that expects a valid and not private or \nreserved IPv4 or IPv6. If null the function will use the IP address from the \nuser of the current request.\n\nThis function returns a [`UserLocation`](#User-Location) which is very similar to the location\nreturned by a Map field, with a few added bonuses.\n\n## User Location\n\nThe user location has the following properties:\n\n- **`ip`** The IP address of the user (that was used to lookup the location).\n- **`lat`** The latitude of the users location.\n- **`lng`** The longitude of the users location.\n- **`address`** The full address (see [Address](../getting-started/usage.md#address)).\n- **`parts`** The separate parts of the address (see [Parts](../getting-started/usage.md#parts)).\n- **`countryCode`** The ISO country code of the user locations country.\n- **`isEU`** Will be true if the user is in an EU country.\n\n### Distance\n\nYou can get the distance between the user and a given location using this method\non the User Location:\n\n```twig\n{{ userLocation.distance({ lat: 51.272154, lng: 0.514951 }, 'miles') }}\n```\n\nThe method accepts two parameters:\n\n- **`to`** A lat/lng keyed array, address string, or a Map or User location.\n- **`unit`** An optional parameter specifying which unit to use for the \nmeasurement. Either `mi` (miles) or `km` (kilometers). _Defaults to `km`._\n\nIt will return a float of the distance between the two locations in the unit \nspecified (or `km` if no unit is specified).\n"
  },
  {
    "path": "docs/geolocation/redirect.md",
    "content": "---\ntitle: User Location Redirecting\n---\n\n# User Location Redirecting\n\nWith Maps it is now possible to redirect the user to a specific site based off \ntheir physical location. You can do this by setting the \n[`geoLocationRedirectMap`](../getting-started/config.md#geolocationredirectmap)\nin the [`simplemap.php`](../getting-started/config.md) config file.\n\nThe value of `geoLocationRedirectMap` should be a keyed array. The key of each\nitem should be the handle for the site you want to redirect to. The value of \neach item should be an array of properties to match against \n([explained below](#location-matching)), or a string containing an asterisk `*`\n which will act as a catch-all.\n\n## Location Matching\n\nLocation matching is performed by looking at each key/value pair in an array and\nchecking if they all match the users location. The keys should match the \navailable properties in the [User Location](./get.md#user-location). The values\nshould be an exact match for the contents of the User Location.\n\nThe priority is top-down, first come first serve. This means that the first site\nthat matches the users location will be the one that is used.\n\nSee the example below for a visual explanation.\n\n### Example\n\n```php\n<?php\n\nreturn [\n    'geoLocationRedirectMap' => [\n        'uk'       => [ 'countryCode' => ['uk', 'ie'] ],\n        'eu'       => [ 'isEU' => true ],\n        'southern' => [ 'lat' => function ($lat) { return $lat <= 0; } ],\n        'global'   => '*',\n    ],\n];\n```\n\nThe first site, `uk`, is checking to see if the `countryCode` of the users \nlocation matches either `'uk'` or `'ie'` because we want to bundle the Irish in \nwith the English. I'm sure they won't mind. If it does match, the user will be \nredirected to the current page on the UK site.\n\nThe second site, `eu`, checks to see if the user is in the EU and will redirect\nto the `eu` site if they are.\n\n`southern` is using an anonymous function, or lambda, to check if the users \nlatitude is on or below the equator. You can use lambdas for any of the \nproperties. The first and only argument will be the value of that property on \nthe users location. All lambdas must return a boolean value.\n\nThe final site, `global`, uses an asterisk as a catch-all. This means that if \nnone of the previous rules match this one will be used. You should always use \nthe wildcard last since any subsequent rules will be ignored.\n"
  },
  {
    "path": "docs/getting-started/config.md",
    "content": "---\ntitle: Configuration\n---\n\n# Configuration\n\nThere are two ways to configure **Maps**, via the Craft CP or using a config\nfile (for advanced configuration).\n\n### Services & Tokens\n\nBelow is a list of the various services supported by Maps and links on how to\nget their tokens.\n\n#### Map Tiles & Geocoding\n\n##### OpenStreetMap / Nominatim\nNo token required\n\n##### Wikimedia\nNo token required\n\n##### Carto\nNo token required\n\n##### [Google](https://cloud.google.com/maps-platform/#get-started)\nYou will need to enable the **Maps JavaScript API** and **Places API** for if\nusing Google for the map tiles, and the **Places API** and **Geocoding API** if\nyou are using it for the Geo service.\n\n##### [Mapbox](https://docs.mapbox.com/help/how-mapbox-works/access-tokens/)\nYou can use the same key for both map tiles and geo service, no configuration\nneeded!\n\n##### [Apple MapKit](https://developer.apple.com/documentation/mapkitjs/setting_up_mapkit_js)\nWe currently only support Apple MapKit for map tiles only.\n\n##### [Here](https://developer.here.com/)\nYou can use the same key for both map tiles and geo service, no configuration\nneeded!\n\n#### Geolocation\n\n##### [ipstack](https://ipstack.com/product)\nipstack offer free and paid-for versions of their API.\n\n##### [MaxMind](https://www.maxmind.com/en/geoip2-precision-services)\nMaxMind offer free lookup database that must be stored locally, and a more\naccurate paid-for version of their API.\n\n## CP\n\nYou can get to the Maps settings in the Craft CP by navigating to \"Settings\" ->\n\"Maps\" in an environment where `allowAdminChanges` is set to `true`.\n\n## Config File\n\nFor advanced configuration create a `simplemap.php` file in your `config` folder.\nThis file should return an array of Maps settings.\n\n```php\n<?php\n\nreturn [\n    'mapToken' => '123abc',\n];\n```\n\n### Settings\n\n#### `mapTiles`\n_Default: `MapTiles::Wikimedia`_\n\nThe map tileset to use. Must be set to one of the `MapTiles` constants.\n\n```php\n<?php\n\nuse ether\\simplemap\\enums\\MapTiles;\n\nreturn [\n    'mapTiles' => MapTiles::CartoVoyager,\n];\n```\n\n#### `mapToken`\n_Default: `''`_\n\nThe token to use with your selected map tileset. This is only required when you\nare using a tileset that requires a token.\n\n**Mapbox & Google Maps**\nFor these services your token should be a string containing the token.\n\n```php\n<?php\n\nreturn [\n    'mapToken' => '',\n];\n```\n\n**Apple MapKit**\nYour token should be an array containing `privateKey`, `teamId`, `keyId`.\n\n```php\n<?php\n\nreturn [\n    'mapToken' => [\n        'privateKey' => '',\n        'teamId'     => '',\n        'keyId'      => '',\n    ],\n];\n```\n\n**Here**\nThe token should be an array containing `appId`, `apiKey`, `appCode`.\n\n```php\n<?php\n\nreturn [\n    'mapToken' => [\n        'appId'   => '',\n        'apiKey'  => '',\n        'appCode' => '',\n    ],\n];\n```\n\n#### `geoService`\n_Default: `GeoService::Nominatim`_\n\nThe geocoding service to use. Must be set to one of the `GeoService` constants.\n\n```php\n<?php\n\nuse ether\\simplemap\\enums\\GeoService;\n\nreturn [\n    'geoService' => GeoService::GoogleMaps,\n];\n```\n\n#### `geoToken`\n_Default: `''`_\n\nThe token to use with your selected geocoding service. This is only required\nwhen you are using a geocoding that requires a token.\n\n**Mapbox & Google Maps**\nFor these services your token should be a string containing the token.\n\n```php\n<?php\n\nreturn [\n    'geoToken' => '',\n];\n```\n\n**Here**\nThe token should be an array containing `appId`, `appCode`.\n\n```php\n<?php\n\nreturn [\n    'geoToken' => [\n        'appId'   => '',\n        'appCode' => '',\n    ],\n];\n```\n\n#### `disablePopulateMissingFieldData`\n_Default: `false`_\n\nWill disable the automatic population of missing field data. This can be useful \nin preventing API spam when importing lots of map data.\n\n#### `geoLocationService`\n_Default: `GeoLocationService::None`_\n\nThe geolocation service to use. Must be set to one of the `GeoLocationService`\nconstants.\n\n```php\n<?php\n\nuse ether\\simplemap\\services\\GeoLocationService;\n\nreturn [\n    'geoLocationService' => GeoLocationService::MaxMind,\n];\n```\n\n#### `geoLocationToken`\n_Default: `''`_\n\nThe token to use with your selected geolocation service. This is only required\nwhen you are using a geolocation that requires a token.\n\n**ipstack**\nFor this services your token should be a string containing the token.\n\n```php\n<?php\n\nreturn [\n    'geoLocationToken' => '',\n];\n```\n\n**MaxMind**\nThe token should be an array containing `accountId`, `licenseKey`.\n\n```php\n<?php\n\nreturn [\n    'geoLocationToken' => [\n        'accountId'  => '',\n        'licenseKey' => '',\n    ],\n];\n```\n\n#### `geoLocationCacheDuration`\n_Default: `'P2M'`_\n\nA string (a [duration interval](https://en.wikipedia.org/wiki/ISO_8601#Durations))\nor int (in seconds) of how long we should cache IP lookups.\n\n#### `geoLocationAutoRedirect`\n_Default: `false`_\n\nWill automatically redirect the user according to `geoLocationRedirectMap` when\nset to true.\n\n#### `geoLocationRedirectMap`\n_Default: `[]`_\n\nThis dictates what site the user is redirected to based off their IPs location.\n\nIt should be a key value array where key is the handle of the site to redirect,\nand value is a key value array of user location properties and their required\nmatches or an string to catch all.\n\nFor more details on how to setup your geolocation redirects have a look at the\n[Geolocation / Redirect](../geolocation/redirect.md) docs.\n\n```php\n<?php\n\nreturn [\n    'geoLocationRedirectMap' => [\n        'uk'     => [ 'country' => 'uk' ],\n        'eu'     => [ 'isEU' => true ],\n        'global' => '*',\n    ],\n];\n```\n"
  },
  {
    "path": "docs/getting-started/installation.md",
    "content": "---\ntitle: Installation\n---\n\n# Installation\n\n## Plugin Store\n\nYou can install **Maps** from the [Craft Plugin Store](https://plugins.craftcms.com/simplemap)\ninside your Craft admin! Simply search for \"Maps\" and click the \n<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"width:20px;vertical-align:text-top\" viewBox=\"0 0 344 345\"><g fill=\"none\" fill-rule=\"evenodd\"><path fill=\"#EF2F30\" d=\"M73.013407,2.6866064 C106.18824,0.895535467 139.183771,-3.78753344e-15 172,0 C204.832174,0 237.664282,0.896405919 270.496323,2.68921776 L270.496323,2.68921771 C308.699378,4.77531668 339.208201,35.2833237 341.295323,73.4863222 C343.098441,106.490881 344,139.495441 344,172.5 C344,205.511425 343.098066,238.52285 341.294197,271.534276 L341.294197,271.534275 C339.20649,309.740047 308.693155,340.248892 270.487077,342.330977 C237.836179,344.110326 205.007154,345 172,345 C139.007428,345 106.01479,344.111111 73.0220864,342.333334 L73.0220864,342.333335 C34.4742283,340.256224 3.79947595,309.257162 2.12787429,270.689591 C0.709291429,237.959727 1.89395185e-15,205.229864 0,172.5 C0,139.776865 0.708999838,107.053729 2.12699951,74.3305938 L2.12699924,74.3305938 C3.79813889,35.7657548 34.4685114,4.76760084 73.013407,2.6866064 Z\"/><path fill=\"#5C0405\" fill-rule=\"nonzero\" d=\"M171.727273,63 C131.659862,63 99,95.5999003 99,135.578099 C99,162.959499 118.676238,184.419499 132.773492,205.617199 C146.870545,226.815099 155.716439,248.2265 163.322107,276.5547 C164.381317,280.5076 168.202458,283 171.727273,283 C175.252088,283 179.073229,280.5076 180.132439,276.5547 C188.433881,245.6352 197.223398,224.385199 211.131661,203.839799 C225.040527,183.294099 244.454545,162.889399 244.454545,135.578099 C244.454545,95.5999003 211.794683,63 171.727273,63 Z M172.181818,107.545455 C186.048118,107.545455 197.181818,118.679154 197.181818,132.545456 C197.181818,146.411755 186.048118,157.545455 172.181818,157.545455 C158.315518,157.545455 147.181818,146.411755 147.181818,132.545456 C147.181818,118.679154 158.315518,107.545455 172.181818,107.545455 Z\"/></g></svg> \nicon.\n \n## Composer\n\nTo install via command-line execute the following from inside your projects root\ndirectory:\n\n```bash\ncomposer require ether/simplemap\n\n./craft install/plugin simplemap\n```\n"
  },
  {
    "path": "docs/getting-started/usage.md",
    "content": "---\ntitle: Usage\n---\n\n# Usage\n\n## Creating a Map field\n\nYou can create a Map field in the same way you would create any other field in \nCraft. Simple go to \"Settings\" -> \"Fields\" and click the \"New Field\" button.\nFill out the fields required and select \"Map\" from the \"Field Type\" select.\n\nYou can now configure the initial state of the map and how it appears to the \nuser. Use the Map to select the initial location of the map and the fields\nbelow the map to customize the layout and any restrictions.\n\n## Displaying the Map\n\nWhen accessing the Map field in twig you will have access to the following \nproperties:\n\n- **`lat`** The latitude of the selected maps location\n- **`lng`** The longitude of the selected maps location\n- **`zoom`** The zoom level of the map\n- **`address`** The full address (see [Address](#address))\n- **`parts`** The separate parts of the address (see [Parts](#parts))\n- **`distance`** The distance the location is from your search (only populated when [Searching](#searching))\n\n### Address\nThe `address` comes in two flavours. The first is as a string, and will output\nthe Full Address as it appears in the Map field.\n\n```twig\n{{ myMapField.address }}\n```\n\nThe second is as a function, `address([exclude = [] [, glue = '<br/>']])`, which \nwill allow you to output the address in a more formatted way. Both arguments are \noptional.\n\n- **`exclude`** expects an array of [Parts](#parts) that you don't want to \nappear when outputting the address. _Defaults to `[]`_.\n- **`glue`** is the string that joins the parts together. _Defaults to `'<br/>'`.\n\n```twig\n{{ myMapField.address(['country'], ', ') }}\n```\n\nThe example above is outputting the address as a comma-separated string, \nexcluding the country.\n\n### Parts\n\nThe parts contains the, well, parts that make up the address.\n\n- **`number`** The name or number of the location\n- **`address`** The street address of the location (not the full address)\n- **`city`** The city in which the location is situated\n- **`postcode`** The postal or zip code of the location\n- **`county`** The county of the location\n- **`state`** The state or region of the location\n- **`country`** The locations country\n\n&nbsp;\n\n- **`planet`** The planet of the location\n- **`system`** The system containing the planet of the location\n- **`arm`** The galactic arm of the location\n- **`galaxy`** The galaxy the arm is attached to\n- **`group`** The group the locations galaxy belongs to\n- **`cluster`** The galaxy cluster containing the group\n- **`supercluster`** The supercluster the galaxy belongs to\n\n```twig\n{{ myMapField.parts.city }}\n```\n\nYou can also access the parts directly from the map with the exception of the\n`address` part, which can be accessed via `streetAddress`.\n\n```twig\n{{ myMapField.streetAddress }}\n{{ myMapField.city }}\n```\n\n### Searching\n\nWhen querying elements you can filter them by proximity to a given location. To\ndo so, simply pass an address and radius to the Map field in the \n[element query](https://docs.craftcms.com/v3/dev/element-queries/).\n\n- **`location`** An address string, map field, or `{ lat: 0, lng: 0 }` object to \nsearch by.\n- **`country`** An optional country to restrict the address string to.\n- **`radius`** The radius around the location to get results from. _Defaults to `50`_.\n- **`unit`** The distance unit to use. Can be either `mi` or `km`. _Defaults to `km`_.\n\n```twig\n{% set entries = craft.entries.myMapField({\n    location: 'Maidstone, Kent',\n    country: 'UK',\n    radius: 100,\n    unit: 'mi',\n}).all() %}\n```\n\nIf you search using this method you will have access to the `distance` property\nin the resulting elements Map fields. This will return the distance that \nlocation is from the location searched for, in the unit specified when searching.\n\nYou can also sort by `distance` when searching for an address.\n\n```twig\n{% set entries = craft.entries.myMapField({\n    location: { lat: 51.272154, lng: 0.514951 },\n}).orderBy('distance').all() %}\n```\n\n```twig\n{% set entries = craft.entries.myMapField({\n    location: myOtherMapField,\n}).orderBy('distance desc').all() %}\n```\n"
  },
  {
    "path": "docs/how-to/graphql.md",
    "content": "---\ntitle: Querying in GraphQL\n---\n\n# Querying in GraphQL\n\nThe query input can support all the parameters that you can use in regular \n[Searching](../getting-started/usage/#searching), with the exception that \n`location` only supports a string value. This means if you want to search by \nlat/lng you need to pass them to the `coordinate` input.\n\n```graphql\n{\n  entries (\n    map: {\n      unit: Kilometres\n      location: \"Maidstone, Kent\"\n      country: \"UK\"\n      radius: 10\n      coordinate: {\n        lat: 51.27136675686769\n        lng: 0.4939985275268555\n      }\n    }\n    section: \"locations\"\n    orderBy: \"distance\"\n  ) {\n    title\n    ... on locations_locations_Entry {\n      map {\n        lat\n        lng\n        distance\n        zoom\n        address\n        parts {\n          number\n          address\n          city\n          postcode\n          county\n          state\n          country\n        }\n      } \n    }\n  }\n}\n```\n"
  },
  {
    "path": "docs/how-to/search.md",
    "content": "---\ntitle: Search by Location\n---\n\n# Search by Location\n\nBeing able to search your maps by a location is one of the most important parts \nof using a map plugin. So here's how you do it.\n\nWhen building your [element query](https://docs.craftcms.com/v3/dev/element-queries/)\n(in either Twig or PHP) you can pass an object to the map field that will let \nyou search by your location. This object can have the following properties:\n\n- **`location`**: An address string, map field, or `{ lat: 0, lng: 0 }` object to search by.\n- **`country`**: An optional country to restrict the address string to.\n- **`radius`**: The radius around the location to get results from. _Defaults to `50`_.\n- **`unit`**: The distance unit to use. Can be either `mi` (miles) or `km` (kilometres). _Defaults to `km`_.\n\n### By Address\n\nLet's say you want to search for a location within 10 miles of a given address \n(this can be a full address, or just part of an address like a town or city \nname). In that case you would do the following:\n\n```twig\n{% set entries = craft.entries.myMapField({\n    location: 'Maidstone, Kent',\n    radius: 10,\n    unit: 'mi',\n}).all() %}\n```\n\nHere we're saying that we want to find all locations with 10 (radius) miles \n(unit) of Maidstone, Kent (location).\n\n### By Coordinates\n\nAlternatively you could have a set of coordinates that you want to search by. In \nthat case you would pass the coordinates to the `location` parameter instead of \nan address string.\n\n```twig\n{% set entries = craft.entries.myMapField({\n    location: { lat: 51.272154, lng: 0.514951 },\n}).all() %}\n```\n\nBy excluding the other fields we're letting them fall back to their defaults (as\nspecified above). In this case we're searching for all locations around those \ngiven coordinates within 50 kilometres.\n"
  },
  {
    "path": "docs/index.md",
    "content": "---\ntitle: Maps\n---\n\n![Maps](map-banner.png)\n\n# Maps\n\nA beautifully simple, yet deceptively powerful map field that works out of the \nbox with no setup or API tokens needed!\n\nConfigure the map field to show only the features you want; display \nlatitude/longitude, hide the address or even the entire map. Choose from 4 \ngeocoding services, 3 geolocation services, and 24 map tilesets!\n\n'Maps' offers full multi-site support, compatibility with Matrix, \n[SuperTable](https://verbb.io/craft-plugins/super-table/features), \n[CraftQL](https://plugins.craftcms.com/craftql), and the ability to search by \nlocation and sort by distance.\n\n**[View Maps on the Plugin Store](https://plugins.craftcms.com/simplemap)**\n\n![Maps Field](./normal.png)\n\n![Searching](./normal-searching.png)\n"
  },
  {
    "path": "docs/rendering/embed.md",
    "content": "---\ntitle: Embed Dynamic Maps\n---\n\n# Embed Dynamic Maps\n\nWith **Maps** you can quickly and easily output an interactive map using one of\ntwo templating methods. The first is via a Map field, and the second is using \nthe global map variable.\n\n## Options\n\n*The available options include those from the [Static Map](./static.md#options)\nas well as two additional options:*\n\n- **`id`** - The ID to use when creating the map (using in JavaScript and on the \n             HTML tag).\n- **`options`** - An object of options that will be passed to the JavaScript, \n                  allowing you to customise the map according to the map library \n                  being used.\n\n## From a Map field\n\nBoth of the below `embed` methods will return a div tag with the given (or \ngenerated) ID, and will include the necessary JavaScript and CSS to render the \nmap. They both accept an [options](#options) object as their only parameter.\n\n### `mapField.embed([options])`\n\nTo render a dynamic map from a Map field, use the `embed` method on the fields \nvalue. The `center` and `zoom` options will be ignored, since their values are \ngathered from the Map field's value.\n\n```twig\n{{ myMapField.embed({\n    id: 'map',\n    markers: [{}],\n}) }}\n```\n\n### `craft.maps.embed([options])`\n\n```twig\n{{ craft.maps.embed({\n    center: 'Maidstone, UK',\n    options: {\n        disableDefaultUI: true,\n        draggable: false,\n    },\n}) }}\n```\n\n## Additional attributes\n\nIf you want to add additional attributes to the output div from the `embed` \nmethods you should do so using Craft's built-in [`|attr` filter](https://docs.craftcms.com/v3/dev/filters.html#attr).\n\n```twig\n{{ myMapField.embed()|attr({\n    class: 'map',\n}) }}\n```\n\n## Libraries & Caveats\n\n### Google Maps\nThe Google Maps service uses Google's [Maps JavaScript library](https://developers.google.com/maps/documentation/javascript/reference/).\nYou can view the options that you can pass to `options.options` [here](https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions).\n\n**Caveats**\n- Google Maps doesn't support coloured markers.\n\n### Apple Maps\nApple Maps uses the [Mapkit JS library](https://developer.apple.com/documentation/mapkitjs).\nYou can view the options [here](https://developer.apple.com/documentation/mapkitjs/mapconstructoroptions).\n\n### Mapbox\nMapbox uses [Mapbox](https://docs.mapbox.com/mapbox-gl-js/api/). You can view \nthe options [here](https://docs.mapbox.com/mapbox-gl-js/api/#map).\n\n**Caveats**\n- Mapbox doesn't support marker labels.\n\n### Here\nHere uses [Here](https://developer.here.com/documentation/maps/topics/overview.html).\nYou can view the options [here](https://developer.here.com/documentation/maps/topics_api/h-map-options.html).\n\n### Others\nWikimedia, OSM, and Carto all use [Leaflet JS](https://leafletjs.com/). You can\nview the options [here](https://leafletjs.com/reference-1.5.0.html#map-option).\n"
  },
  {
    "path": "docs/rendering/static.md",
    "content": "---\ntitle: Static Map Images\n---\n\n# Static Map Images\n\n**Maps** makes it really easy to render static map images in twig. There are two\nways of rendering a static map image. First is via a Map field, second is using \nthe global map variable.\n\n## Options\n\nBoth methods support the following options, passed as a Twig object to the \nmethod (we'll cover that later):\n\n- **`center`** - This can be an address string (i.e. \"Maidstone, UK\"), a lat / \n                 lng variable (i.e. `[51.272154, 0.514951]` or \n                 `{ lat: 51.272154, lng: 0.514951 }`).\n- **`centerFallback`** - The fallback location that will be used if the center \n                         specified above is empty. Must be lat / lng.\n- **`width`** - The width of the map image (see max image sizes below).\n- **`height`** - The height of the map image (see max image sizes below).\n- **`zoom`** - The zoom level of the map (must be between 0 and 18).\n- **`scale`** - The scale of the image (can be either 1 or 2 (retina), defaults to 1).\n- **`markers`** - An array of map [markers](#markers) (see below)\n\n### Markers\n\nThe `markers` option accepts an array of objects with the following parameters \n(all are optional):\n\n- **`location`** - This can be an address string (i.e. \"Maidstone, UK\"), a lat / \n                   lng variable (i.e. `[51.272154, 0.514951]` or \n                   `{ lat: 51.272154, lng: 0.514951 }`). If left blank the \n                   marker will appear at the center of the map.\n- **`color`** - A valid hex colour string. Will default to `#ff0000` if blank.\n- **`label`** - An option label, must be a single character A-Z0-9.\n\n## From a Map field\n\nTo render a map from a Map field, use the `img` or `imgSrcSet` methods on the \nfields value:\n\n```twig\n{% set myMapField = entry.myMapField %}\n<img\n    src=\"{{ myMapField.img() }}\"\n    srcset=\"{{ myMapField.imgSrcSet() }}\"\n    alt=\"{{ myMapField.address }}\"\n/>\n```\n\n### `mapField.img([options])`\n\nThe `img` method returns the URL for the static map image. It accepts an \n[options](#options) object as its only parameter. Since we already\nhave a location and zoom level from the Map field, the `center` and `zoom` \noptions will be ignored.\n\n```twig\n{{ entry.mapField.img({\n    width: 800,\n    height: 600,\n}) }}\n```\n\n### `mapField.imgSrcSet([options])`\n\n`imgSrcSet` is similar to `img` accept it returns a `srcset` ready string, \nsupporting @1x and @2x resolutions. As with `img` it accepts an \n[options](#options) object as its only parameter. Along with the `center` and \n`zoom` options being ignored (as with `img`), the `scale` option is also \nignored.\n\n## Using the global `maps` variable\n\nYou can turn any address into a static map using the globally available `maps` \nvariable.\n\n```twig\n<img\n    src=\"{{ craft.maps.img() }}\"\n    srcset=\"{{ craft.maps.imgSrcSet() }}\"\n    alt=\"\"\n/>\n```\n\n### `craft.maps.img([options])`\n\nThe `img` method returns the URL for the static map image. It accepts an \n[options](#options) object as its only parameter.\n\n```twig\n{{ craft.maps.img({\n    center: 'Maidstone, UK',\n    width: 800,\n    height: 600,\n}) }}\n```\n\n### `craft.maps.imgSrcSet([options])`\n\n`imgSrcSet` is similar to `img` accept it returns a `srcset` ready string, \nsupporting @1x and @2x resolutions. As with `img` it accepts an \n[options](#options) object as its only parameter. The `scale` is ignored.\n"
  },
  {
    "path": "resources/.editorconfig",
    "content": "[*.{js,jsx,ts,tsx,vue}]\nindent_style = tab\nindent_size = 4\nend_of_line = lf\ninsert_final_newline = true\nmax_line_length = 80\n"
  },
  {
    "path": "resources/.gitignore",
    "content": ".DS_Store\nnode_modules\n/dist\n\n# local env files\n.env.local\n.env.*.local\n\n# Log files\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Editor directories and files\n.idea\n.vscode\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw*\n"
  },
  {
    "path": "resources/README.md",
    "content": "# simplemap\n\n## Project setup\n```\nyarn install\n```\n\n### Compiles and hot-reloads for development\n```\nyarn run serve\n```\n\n### Compiles and minifies for production\n```\nyarn run build\n```\n\n### Run your tests\n```\nyarn run test\n```\n\n### Lints and fixes files\n```\nyarn run lint\n```\n\n### Customize configuration\nSee [Configuration Reference](https://cli.vuejs.org/config/).\n"
  },
  {
    "path": "resources/babel.config.js",
    "content": "module.exports = {\n  presets: [\n    '@vue/app',\n  ],\n};\n"
  },
  {
    "path": "resources/package.json",
    "content": "{\n  \"name\": \"simplemap\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"PORT=8080 vue-cli-service serve\",\n    \"build\": \"vue-cli-service build\",\n    \"lint\": \"vue-cli-service lint\"\n  },\n  \"dependencies\": {\n    \"leaflet\": \"^1.4.0\",\n    \"leaflet.gridlayer.googlemutant\": \"^0.8.0\",\n    \"leaflet.mapkitmutant\": \"^0.3.0\",\n    \"vue\": \"^2.6.10\",\n    \"vue-autosuggest\": \"^2.0.0\"\n  },\n  \"devDependencies\": {\n    \"@vue/cli-plugin-babel\": \"^3.3.0\",\n    \"@vue/cli-plugin-eslint\": \"^3.3.0\",\n    \"@vue/cli-service\": \"^3.3.0\",\n    \"@vue/eslint-config-airbnb\": \"^4.0.0\",\n    \"babel-eslint\": \"^10.0.1\",\n    \"eslint\": \"^5.8.0\",\n    \"eslint-plugin-vue\": \"^5.0.0\",\n    \"less\": \"^3.0.4\",\n    \"less-loader\": \"^4.1.0\",\n    \"vue-template-compiler\": \"^2.5.21\",\n    \"webpack-bundle-analyzer\": \"^3.4.1\"\n  },\n  \"eslintConfig\": {\n    \"root\": true,\n    \"env\": {\n      \"node\": true\n    },\n    \"extends\": [\n      \"plugin:vue/essential\",\n      \"@vue/airbnb\"\n    ],\n    \"rules\": {\n      \"no-tabs\": \"off\",\n      \"indent\": \"off\",\n      \"padded-blocks\": \"off\",\n      \"comma-dangle\": \"off\",\n      \"arrow-parens\": \"off\",\n      \"space-before-function-paren\": \"off\",\n      \"no-underscore-dangle\": \"off\",\n      \"no-param-reassign\": \"off\",\n      \"nonblock-statement-body-position\": \"off\",\n      \"func-names\": \"off\",\n      \"prefer-template\": \"off\",\n      \"lines-between-class-members\": \"off\",\n      \"class-methods-use-this\": \"off\",\n      \"curly\": \"off\",\n      \"prefer-destructuring\": \"off\",\n      \"no-trailing-spaces\": \"off\",\n      \"import/extensions\": \"off\",\n      \"max-len\": \"off\",\n      \"comma-style\": \"off\",\n      \"import/prefer-default-export\": \"off\",\n      \"one-var\": \"off\",\n      \"operator-linebreak\": \"off\",\n      \"no-multi-spaces\": \"off\",\n      \"no-prototype-builtins\": \"off\",\n      \"object-curly-newline\": \"off\",\n      \"no-plusplus\": \"off\",\n      \"no-continue\": \"off\"\n    },\n    \"parserOptions\": {\n      \"parser\": \"babel-eslint\",\n      \"ecmaFeatures\": {\n        \"legacyDecorators\": true\n      }\n    }\n  },\n  \"postcss\": {\n    \"plugins\": {\n      \"autoprefixer\": {}\n    }\n  },\n  \"browserslist\": [\n    \"> 1%\",\n    \"last 2 versions\",\n    \"not ie <= 8\"\n  ]\n}\n"
  },
  {
    "path": "resources/src/App.vue",
    "content": "<template>\n\t<div>\n\t\t<div :class=\"wrapCls\" ref=\"field\">\n\t\t\t<Map\n\t\t\t\tv-if=\"!config.hideMap\"\n\t\t\t\t:tiles=\"config.mapTiles\"\n\t\t\t\t:token=\"config.mapToken\"\n\t\t\t\t:latLng=\"{ lat: val.lat, lng: val.lng }\"\n\t\t\t\t:zoom=\"+val.zoom\"\n\t\t\t\t:min-zoom=\"config.minZoom\"\n\t\t\t\t:max-zoom=\"config.maxZoom\"\n\t\t\t\t@change=\"onMapChange\"\n\t\t\t\t@zoom=\"onZoom\"\n\t\t\t\t:hide-search=\"config.hideSearch\"\n\t\t\t\t:hide-address=\"config.hideAddress\"\n\t\t\t\t:show-current-location=\"config.showCurrentLocation\"\n\t\t\t\t:w3w-enabled=\"config.w3wEnabled\"\n\t\t\t\t:show-w3w-grid=\"config.showW3WGrid\"\n\t\t\t/>\n\n\t\t\t<div :class=\"[$style.content, config.hideMap && $style.noMap]\">\n\t\t\t\t<Search\n\t\t\t\t\tv-if=\"!config.hideSearch\"\n\t\t\t\t\t:service=\"config.geoService\"\n\t\t\t\t\t:default-value=\"val.address\"\n\t\t\t\t\t:geo=\"geo\"\n\t\t\t\t\t@selected=\"onSearchSelected\"\n\t\t\t\t\t@open-offset=\"onResultsOpenOffset\"\n\t\t\t\t\t:has-map=\"!config.hideMap\"\n\t\t\t\t/>\n\n\t\t\t\t<Address\n\t\t\t\t\tv-if=\"!config.isSettings\"\n\t\t\t\t\t:hide=\"config.hideAddress\"\n\t\t\t\t\t:has-search=\"!config.hideSearch\"\n\t\t\t\t\t:has-map=\"!config.hideMap\"\n\t\t\t\t\t:showLatLng=\"config.showLatLng\"\n\t\t\t\t\t:value=\"val\"\n\t\t\t\t\t@changed=\"onPartChange\"\n\t\t\t\t\t@clear=\"onClear\"\n\t\t\t\t\t@w3w-change=\"onW3WChange\"\n\t\t\t\t\t:open-offset=\"resultsOpenOffset\"\n\t\t\t\t\t:show-w3w-field=\"config.showW3WField\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div v-if=\"config.size === 'mini'\" :class=\"$style.mini\">\n\t\t\t<span :class=\"value.address === '' && $style.empty\">{{ value.address || emptyLabel }}</span>\n\t\t\t<button\n\t\t\t\t@click=\"onEditClick\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tref=\"btn\"\n\t\t\t\tclass=\"btn\"\n\t\t\t>Edit</button>\n\t\t</div>\n\n\t\t<input\n\t\t\ttype=\"hidden\"\n\t\t\t:name=\"config.name\"\n\t\t\t:value=\"JSON.stringify(value)\"\n\t\t\tv-if=\"!config.isSettings\"\n\t\t/>\n\n\t\t<Fragment v-if=\"config.isSettings\">\n\t\t\t<input\n\t\t\t\ttype=\"hidden\"\n\t\t\t\t:name=\"config.name.replace('__settings__', 'lat')\"\n\t\t\t\t:value=\"value.lat\"\n\t\t\t/>\n\t\t\t<input\n\t\t\t\ttype=\"hidden\"\n\t\t\t\t:name=\"config.name.replace('__settings__', 'lng')\"\n\t\t\t\t:value=\"value.lng\"\n\t\t\t/>\n\t\t\t<input\n\t\t\t\ttype=\"hidden\"\n\t\t\t\t:name=\"config.name.replace('__settings__', 'zoom')\"\n\t\t\t\t:value=\"value.zoom\"\n\t\t\t/>\n\t\t</Fragment>\n\t</div>\n</template>\n\n<script lang=\"js\">\n\timport Geo from './common/Geo';\n\timport GeoService from './enums/GeoService';\n\timport Parts from './models/Parts';\n\timport Fragment from './components/Fragment';\n\timport PartsLegacy from './models/PartsLegacy';\n\timport Search from './components/Search';\n\timport Address from './components/Address';\n\timport Map from './components/Map';\n\timport { t } from './filters/craft';\n\n\tconst MapHud = window.Garnish.HUD.extend();\n\n\texport default {\n\t\tprops: {\n\t\t\toptions: String,\n\t\t},\n\n\t\tcomponents: {\n\t\t\tSearch,\n\t\t\tAddress,\n\t\t\tMap,\n\t\t\tFragment,\n\t\t},\n\n\t\tdata () {\n\t\t\treturn {\n\t\t\t\tconfig: {\n\t\t\t\t\tisSettings: false,\n\t\t\t\t\tname: '',\n\t\t\t\t\thideSearch: false,\n\t\t\t\t\thideMap: false,\n\t\t\t\t\thideAddress: false,\n\t\t\t\t\tshowLatLng: false,\n\t\t\t\t\tshowCurrentLocation: false,\n\t\t\t\t\tminZoom: 3,\n\t\t\t\t\tmaxZoom: 20,\n\t\t\t\t\tmapTiles: 'wikimedia',\n\t\t\t\t\tmapToken: '',\n\t\t\t\t\tgeoService: 'nominatim',\n\t\t\t\t\tgeoToken: '',\n\t\t\t\t\tw3wEnabled: false,\n\t\t\t\t\tshowW3WGrid: false,\n\t\t\t\t\tshowW3WField: false,\n\t\t\t\t\tlocale: 'en',\n\t\t\t\t\tsize: 'large',\n\t\t\t\t},\n\n\t\t\t\tvalue: {\n\t\t\t\t\taddress: '',\n\t\t\t\t\tzoom: 15,\n\t\t\t\t\tlat: null,\n\t\t\t\t\tlng: null,\n\t\t\t\t\tparts: new Parts(),\n\t\t\t\t\twhat3words: '',\n\t\t\t\t},\n\n\t\t\t\tgeo: null,\n\n\t\t\t\tfullAddressDirty: false,\n\t\t\t\tdefaultValue: null,\n\t\t\t\temptyLabel: t('No address selected'),\n\n\t\t\t\thud: null,\n\t\t\t\tresultsOpenOffset: 0,\n\t\t\t};\n\t\t},\n\n\t\tcreated () {\n\t\t\tconst { config, value, defaultValue } = JSON.parse(this.options);\n\n\t\t\tconst isGoogle = config.geoService === GeoService.GoogleMaps;\n\n\t\t\tthis.config = config;\n\n\t\t\tthis.value = value;\n\t\t\tthis.value.parts = isGoogle\n\t\t\t\t? new PartsLegacy(value.parts)\n\t\t\t\t: Parts.from(value.parts);\n\n\t\t\tthis.defaultValue = defaultValue;\n\t\t\tthis.defaultValue.parts = isGoogle\n\t\t\t\t? new PartsLegacy()\n\t\t\t\t: new Parts();\n\n\t\t\tthis.geo = new Geo(config);\n\t\t},\n\n\t\tmounted () {\n\t\t\tif (this.config.size === 'mini')\n\t\t\t\tthis.$refs.field.style.display = 'none';\n\t\t},\n\n\t\tcomputed: {\n\t\t\twrapCls () {\n\t\t\t\tconst cls = [this.$style.wrap];\n\n\t\t\t\tif (this.config.hideMap)\n\t\t\t\t\tcls.push(this.$style['no-map']);\n\n\t\t\t\treturn cls;\n\t\t\t},\n\t\t\tval () {\n\t\t\t\treturn this.value.lat === null ? this.defaultValue : this.value;\n\t\t\t},\n\t\t},\n\n\t\tmethods: {\n\t\t\tonEditClick () {\n\t\t\t\tif (this.hud) {\n\t\t\t\t\tthis.hud.show();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet minBodyWidth;\n\n\t\t\t\tif (this.config.hideMap) {\n\t\t\t\t\tminBodyWidth = Math.min(626, window.innerWidth * 0.9);\n\t\t\t\t} else {\n\t\t\t\t\tminBodyWidth = Math.min(834, window.innerWidth * 0.9);\n\t\t\t\t}\n\n\t\t\t\tthis.$refs.field.style.display = 'block';\n\t\t\t\tthis.hud = new MapHud(this.$refs.btn, this.$refs.field, {\n\t\t\t\t\tminBodyWidth,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tonResultsOpenOffset (value) {\n\t\t\t\tthis.resultsOpenOffset = value;\n\t\t\t},\n\n\t\t\tasync onSearchSelected (item) {\n\t\t\t\tthis.value = {\n\t\t\t\t\t...this.value,\n\t\t\t\t\t...item,\n\t\t\t\t};\n\n\t\t\t\tawait this.updateW3WByLatLng({ lat: item.lat, lng: item.lng });\n\t\t\t},\n\n\t\t\tasync onMapChange (latLng) {\n\t\t\t\tconst zoom = this.value.zoom;\n\n\t\t\t\tawait this.onLatLngChange(latLng);\n\t\t\t\tawait this.updateW3WByLatLng(latLng);\n\n\t\t\t\tthis.value.zoom       = zoom;\n\t\t\t\tthis.fullAddressDirty = false;\n\t\t\t},\n\n\t\t\tasync updateW3WByLatLng (latLng) {\n\t\t\t\tif (this.config.w3wEnabled) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst res = await window.what3words.api.convertTo3wa(latLng);\n\t\t\t\t\t\tthis.value.what3words = res.words;\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.value.what3words = null;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.value.what3words = null;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync onW3WChange (words) {\n\t\t\t\tif (this.config.w3wEnabled && !/([a-z]+\\.){2}[a-z]+/g.test(words))\n\t\t\t\t\treturn;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst res = await window.what3words.api.convertToCoordinates(words);\n\t\t\t\t\tthis.onLatLngChange(res.coordinates);\n\t\t\t\t\tthis.value.what3words = words;\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// do nothing\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync onLatLngChange (latLng) {\n\t\t\t\tswitch (this.config.geoService) {\n\t\t\t\t\tcase GeoService.Nominatim:\n\t\t\t\t\t\tthis.value = await this.geo.reverseNominatim(latLng, this.value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GeoService.Mapbox:\n\t\t\t\t\t\tthis.value = await this.geo.reverseMapbox(latLng, this.value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GeoService.GoogleMaps:\n\t\t\t\t\t\tthis.value = await this.geo.reverseGoogle(latLng, this.value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GeoService.AppleMapKit:\n\t\t\t\t\t\tthis.value = await this.geo.reverseApple(latLng, this.value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GeoService.Here:\n\t\t\t\t\t\tthis.value = await this.geo.reverseHere(latLng, this.value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error('Unknown geo service: ' + this.config.geoService);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonZoom (zoom) {\n\t\t\t\tthis.value.zoom = zoom;\n\t\t\t},\n\n\t\t\tonPartChange ({ name, value }) {\n\t\t\t\tif (name === 'fullAddress') {\n\t\t\t\t\tthis.value.address    = value;\n\t\t\t\t\tthis.fullAddressDirty = value !== '';\n\t\t\t\t} else if (name === 'lat' || name === 'lng') {\n\t\t\t\t\tthis.value[name] = value;\n\t\t\t\t} else {\n\t\t\t\t\tthis.value.parts[name] = value;\n\n\t\t\t\t\tif (this.value.address === '' || !this.fullAddressDirty) {\n\t\t\t\t\t\tconst parts = [];\n\t\t\t\t\t\tconst keys = Object.keys(this.value.parts);\n\n\t\t\t\t\t\tfor (let i = 0, l = keys.length; i < l; i++) {\n\t\t\t\t\t\t\tconst k = keys[i];\n\n\t\t\t\t\t\t\t// Filter out guff google properties\n\t\t\t\t\t\t\tif (['number', 'address', 'city', 'postcode', 'county', 'state', 'country'].indexOf(k) === -1)\n\t\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t\tparts.push(this.value.parts[k]);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthis.value.address = parts.filter(Boolean).join(', ');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonClear () {\n\t\t\t\tthis.value = {\n\t\t\t\t\taddress: '',\n\t\t\t\t\tzoom: 15,\n\t\t\t\t\tlat: null,\n\t\t\t\t\tlng: null,\n\t\t\t\t\tparts: new Parts(),\n\t\t\t\t\twhat3words: null,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.wrap {\n\t\tposition: relative;\n\t\tmargin: 0 -24px;\n\t\tmin-height: 284px;\n\n\t\toverflow: hidden;\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\tmargin: 0 -12px;\n\t\t}\n\n\t\t:global(.hud) & {\n\t\t\tmargin: -24px !important;\n\t\t}\n\n\t\t:global(.matrixblock) & {\n\t\t\tmargin: 0 -14px !important;\n\t\t}\n\n\t\t:global(.superTable-layout-table) &,\n\t\t:global(.superTable-layout-row) & {\n\t\t\tmargin: -4px -10px !important;\n\t\t}\n\n\t\t&.no-map {\n\t\t\tmin-height: 0;\n\t\t\tmargin: 0;\n\t\t\toverflow: visible;\n\n\t\t\t.content {\n\t\t\t\tpadding: 0;\n\n\t\t\t\t:global(.hud) & {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tpadding: 24px;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.mini {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\n\t\t:global(.btn) {\n\t\t\tmargin-left: 24px;\n\t\t\tfont-size: 14px;\n\t\t}\n\t}\n\n\t.empty {\n\t\topacity: 0.5;\n\t}\n\n\t.content {\n\t\tposition: relative;\n\t\tz-index: 2;\n\t\tbox-sizing: border-box;\n\t\twidth: 50%;\n\t\tpadding: 24px;\n\n\t\tpointer-events: none;\n\n\t\t&.noMap {\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t:global(.matrixblock) &,\n\t\t:global(.superTable-layout-table) &,\n\t\t:global(.superTable-layout-row) & {\n\t\t\tpadding: 14px;\n\t\t}\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\twidth: 100%;\n\t\t\tpadding: 12px;\n\t\t}\n\n\t\t& > * {\n\t\t\tpointer-events: all;\n\t\t}\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/common/Geo.js",
    "content": "import GeoService from '../enums/GeoService';\nimport Parts from '../models/Parts';\nimport PartsLegacy from '../models/PartsLegacy';\nimport waitForGlobal from '../helpers/waitForGlobal';\n\nexport default class Geo {\n\n\t// Properties\n\t// =========================================================================\n\n\tcountry = null;\n\tservice = null;\n\ttoken = null;\n\tlocale = null;\n\n\tgoogle = { service: null, session: null };\n\tapple = { Search: null };\n\n\t// Constructor\n\t// =========================================================================\n\n\tconstructor ({ country, geoService: service, geoToken: token, locale }) {\n\t\tthis.country = country ? country.toLowerCase() : null;\n\t\tthis.service = service;\n\t\tthis.token = token;\n\t\tthis.locale = locale;\n\n\t\tif (service === GeoService.GoogleMaps) {\n\t\t\twaitForGlobal('google', () => this.initGoogle());\n\t\t} else if (service === GeoService.AppleMapKit) {\n\t\t\twaitForGlobal('mapkit', () => this.initApple(token));\n\t\t}\n\t}\n\n\t// Initializers\n\t// =========================================================================\n\n\tinitGoogle () {\n\t\tthis.google = {\n\t\t\tservice: new window.google.maps.places.AutocompleteService(),\n\t\t\tsession: new window.google.maps.places.AutocompleteSessionToken(),\n\t\t\tgeocoder: new window.google.maps.Geocoder(),\n\t\t\tplaces: new window.google.maps.places.PlacesService(\n\t\t\t\tdocument.createElement('div')\n\t\t\t),\n\t\t};\n\t}\n\n\tinitApple (token) {\n\t\twindow.mapkit.init({\n\t\t\tauthorizationCallback: done => done(token),\n\t\t});\n\n\t\tthis.apple = {\n\t\t\tSearch: new window.mapkit.Search(),\n\t\t\tGeocoder: new window.mapkit.Geocoder(),\n\t\t\tCoordinate: window.mapkit.Coordinate,\n\t\t};\n\t}\n\n\t// Actions\n\t// =========================================================================\n\n\t// Actions: Search\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Run the search\n\t *\n\t * @param {string} text\n\t * @returns {Promise<Array>}\n\t */\n\tasync search (text) {\n\t\tif (!text || text.trim() === '') {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet suggestions = [];\n\n\t\tswitch (this.service) {\n\t\t\tcase GeoService.Nominatim:\n\t\t\t\tsuggestions = await this.searchNominatim(text);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.Mapbox:\n\t\t\t\tsuggestions = await this.searchMapbox(text);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.GoogleMaps:\n\t\t\t\tsuggestions = await this.searchGoogle(text);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.AppleMapKit:\n\t\t\t\tsuggestions = await this.searchApple(text);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.Here:\n\t\t\t\tsuggestions = await this.searchHere(text);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Unknown geocoding service: ' + this.service);\n\t\t}\n\n\t\treturn suggestions;\n\t}\n\n\t/**\n\t * Search using Nominatim\n\t *\n\t * @param {string} query\n\t * @returns {Promise<*>}\n\t */\n\tasync searchNominatim (query) {\n\t\tconst params = new URLSearchParams({\n\t\t\tq: query,\n\t\t\tformat: 'jsonv2',\n\t\t\tlimit: 5,\n\t\t\taddressdetails: 1,\n\t\t\tcountrycodes: this.country,\n\t\t\t'accept-language': this.locale,\n\t\t}).toString();\n\n\t\tconst data = await fetch(\n\t\t\t'https://nominatim.openstreetmap.org/search?' + params\n\t\t).then(res => res.json());\n\n\t\treturn data.map(result => ({\n\t\t\taddress: result.display_name,\n\t\t\tlat: result.lat,\n\t\t\tlng: result.lon,\n\t\t\tparts: new Parts({\n\t\t\t\t...result.address,\n\t\t\t\ttype: result.type,\n\t\t\t}, GeoService.Nominatim),\n\t\t}));\n\t}\n\n\t/**\n\t * Search using Mapbox\n\t *\n\t * @param {string} query\n\t * @returns {Promise<*>}\n\t */\n\tasync searchMapbox (query) {\n\t\tconst rawParams = {\n\t\t\ttypes: 'address,country,postcode,place,locality,district,neighborhood',\n\t\t\tlimit: 5,\n\t\t\taccess_token: this.token,\n\t\t\tlanguage: this.locale,\n\t\t};\n\n\t\tif (this.country)\n\t\t\trawParams.country = this.country;\n\n\t\tconst params = new URLSearchParams(rawParams).toString();\n\n\t\tconst data = await fetch(\n\t\t\t'https://api.mapbox.com/geocoding/v5/mapbox.places/' + query + '.json?' + params\n\t\t).then(res => res.json());\n\n\t\treturn data.features.map(result => ({\n\t\t\taddress: result.place_name,\n\t\t\tlat: result.center[1],\n\t\t\tlng: result.center[0],\n\t\t\tparts: new Parts(result, GeoService.Mapbox),\n\t\t}));\n\t}\n\n\t/**\n\t * Search using Google Places\n\t *\n\t * @param {string} query\n\t * @returns {Promise<*>}\n\t */\n\tsearchGoogle (query) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.google.service.getPlacePredictions({\n\t\t\t\tinput: query,\n\t\t\t\tsessionToken: this.google.session,\n\t\t\t\tcomponentRestrictions: {\n\t\t\t\t\tcountry: this.country,\n\t\t\t\t},\n\t\t\t}, predictions => {\n\t\t\t\tif (!predictions)\n\t\t\t\t\treturn resolve([]);\n\n\t\t\t\treturn resolve(predictions.map(result => ({\n\t\t\t\t\t__placeId: result.place_id,\n\t\t\t\t\taddress: result.description,\n\t\t\t\t\t// See Geo::getGooglePlaceDetails() for `lat`, `lng`, and `parts`\n\t\t\t\t})));\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Search using Apple MapKit\n\t *\n\t * @param {string} query\n\t * @return {Promise<*>}\n\t */\n\tsearchApple (query) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.apple.Search.autocomplete(query, (err, data) => {\n\t\t\t\tresolve(data.results.slice(0, 5).map(result => ({\n\t\t\t\t\taddress: result.displayLines.join(', '),\n\t\t\t\t\tlat: result.coordinate.latitude,\n\t\t\t\t\tlng: result.coordinate.longitude,\n\t\t\t\t\t// There's no way to get detailed address information from MapKit :(\n\t\t\t\t\tparts: new Parts(null, GeoService.AppleMapKit),\n\t\t\t\t})));\n\t\t\t});\n\t\t\t// TODO: Workout how to support preferred country\n\t\t});\n\t}\n\n\t/**\n\t * Search using Here\n\t *\n\t * @param {string} query\n\t * @return {Promise<*>}\n\t */\n\tasync searchHere (query) {\n\t\tconst params = new URLSearchParams({\n\t\t\tapp_id: this.token.appId,\n\t\t\tapp_code: this.token.appCode,\n\t\t\tquery,\n\t\t\tcountry: this.country ? this.country.toUpperCase() : '',\n\t\t\tmaxresults: 5,\n\t\t\tlanguage: this.locale,\n\t\t}).toString();\n\n\t\tconst data = await fetch(\n\t\t\t'https://autocomplete.geocoder.api.here.com/6.2/suggest.json?' + params\n\t\t).then(res => res.json());\n\n\t\tif (!data.hasOwnProperty('suggestions'))\n\t\t\treturn [];\n\n\t\treturn data.suggestions.map(suggestion => ({\n\t\t\t__placeId: suggestion.locationId,\n\t\t\taddress: suggestion.label,\n\t\t\t// See Geo::getHerePlaceDetails() for `lat`, `lng`, and `parts`\n\t\t}));\n\t}\n\n\t// Actions: Reverse\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Lookup the given lat/lng using Nominatim\n\t *\n\t * @param lat\n\t * @param lng\n\t * @param oldVal\n\t * @return {Promise<{address: *, lng: *, parts: Parts, lat: *}>}\n\t */\n\tasync reverseNominatim ({ lat, lng }, oldVal) {\n\t\tconst params = new URLSearchParams({\n\t\t\tlat,\n\t\t\tlon: lng,\n\t\t\tformat: 'jsonv2',\n\t\t\taddressdetails: 1,\n\t\t\t'accept-language': this.locale,\n\t\t}).toString();\n\n\t\tconst result = await fetch(\n\t\t\t'https://nominatim.openstreetmap.org/reverse?' + params\n\t\t).then(res => res.json());\n\n\n\t\tif (!result || (result.hasOwnProperty('error') && result.error))\n\t\t\treturn { address: '', lat, lng, parts: new Parts() };\n\n\t\treturn {\n\t\t\t...oldVal,\n\t\t\taddress: result.display_name,\n\t\t\tlat,\n\t\t\tlng,\n\t\t\tparts: new Parts({\n\t\t\t\t...result.address,\n\t\t\t\ttype: result.type,\n\t\t\t}, GeoService.Nominatim),\n\t\t};\n\t}\n\n\t/**\n\t * Lookup the given lat/lng using Mapbox\n\t *\n\t * @param lat\n\t * @param lng\n\t * @param oldVal\n\t * @return {Promise<{address: *, lng: *, parts: Parts, lat: *}>}\n\t */\n\tasync reverseMapbox ({ lat, lng }, oldVal) {\n\t\tconst params = new URLSearchParams({\n\t\t\ttypes: 'address,country,postcode,place,locality,district,neighborhood',\n\t\t\tlimit: 1,\n\t\t\taccess_token: this.token,\n\t\t\tlanguage: this.locale,\n\t\t}).toString();\n\n\t\tconst result = await fetch(\n\t\t\t'https://api.mapbox.com/geocoding/v5/mapbox.places/' + lng + ',' + lat + '.json?' + params\n\t\t).then(res => res.json());\n\n\t\tconst feature = result.features[0];\n\n\t\tif (!feature)\n\t\t\treturn { address: '', lat, lng, parts: new Parts() };\n\n\t\treturn {\n\t\t\t...oldVal,\n\t\t\taddress: feature.place_name,\n\t\t\tlat,\n\t\t\tlng,\n\t\t\tparts: new Parts(feature, GeoService.Mapbox),\n\t\t};\n\t}\n\n\t/**\n\t * Lookup the given lat/lng using Google Maps\n\t *\n\t * @param latLng\n\t * @param oldVal\n\t * @return {Promise<any>}\n\t */\n\treverseGoogle (latLng, oldVal) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.google.geocoder.geocode({\n\t\t\t\tlocation: latLng,\n\t\t\t}, results => {\n\t\t\t\tconst result = results[0];\n\n\t\t\t\tresolve({\n\t\t\t\t\t...oldVal,\n\t\t\t\t\taddress: result.formatted_address,\n\t\t\t\t\t...latLng,\n\t\t\t\t\tparts: new PartsLegacy(\n\t\t\t\t\t\tresult.address_components\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Lookup the given lat/lng using Apple MapKit\n\t *\n\t * @param lat\n\t * @param lng\n\t * @param oldVal\n\t * @return {Promise<any>}\n\t */\n\treverseApple ({ lat, lng }, oldVal) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.apple.Geocoder.reverseLookup(\n\t\t\t\tnew this.apple.Coordinate(lat, lng),\n\t\t\t\t(err, data) => {\n\t\t\t\t\tconst result = data.results[0];\n\n\t\t\t\t\tresolve({\n\t\t\t\t\t\t...oldVal,\n\t\t\t\t\t\taddress: result.formattedAddress,\n\t\t\t\t\t\tlat,\n\t\t\t\t\t\tlng,\n\t\t\t\t\t\t// There's no way to get detailed address information from MapKit :(\n\t\t\t\t\t\tparts: new Parts(null, GeoService.AppleMapKit),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Lookup the given lat/lng using Here\n\t *\n\t * @param lat\n\t * @param lng\n\t * @param oldVal\n\t * @return {Promise<{address: *, lng: *, parts: Parts, lat: *}>}\n\t */\n\tasync reverseHere ({ lat, lng }, oldVal) {\n\t\tconst params = new URLSearchParams({\n\t\t\tapp_id: this.token.appId,\n\t\t\tapp_code: this.token.appCode,\n\t\t\tmode: 'retrieveAddresses',\n\t\t\tjsonattributes: 1,\n\t\t\tlimit: 1,\n\t\t\tprox: `${lat},${lng},1`,\n\t\t\tlanguage: this.locale,\n\t\t});\n\n\t\tconst { response } = await fetch(\n\t\t\t'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?' + params\n\t\t).then(res => res.json());\n\n\t\tif (response.view.length === 0)\n\t\t\treturn { address: '', lat, lng, parts: new Parts() };\n\n\t\tconst { address } = response.view[0].result[0].location;\n\n\t\treturn {\n\t\t\t...oldVal,\n\t\t\taddress: address.label,\n\t\t\tlat,\n\t\t\tlng,\n\t\t\tparts: new Parts(address, GeoService.Here),\n\t\t};\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Gets the details about the given place\n\t *\n\t * @param {string} placeId\n\t * @param {Object} item\n\t * @returns {Promise<*>}\n\t */\n\tgetGooglePlaceDetails (placeId, item) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.google.places.getDetails({\n\t\t\t\tplaceId,\n\t\t\t\tfields: [\n\t\t\t\t\t'geometry',\n\t\t\t\t\t'address_component',\n\t\t\t\t],\n\t\t\t}, place => {\n\t\t\t\tresolve({\n\t\t\t\t\t...item,\n\t\t\t\t\taddress: item.address,\n\t\t\t\t\tlat: place.geometry.location.lat(),\n\t\t\t\t\tlng: place.geometry.location.lng(),\n\t\t\t\t\tparts: new PartsLegacy(\n\t\t\t\t\t\tplace.address_components\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Gets the details about the given location\n\t *\n\t * @param {string} locationId\n\t * @param {Object} item\n\t * @return {Promise<*>}\n\t */\n\tasync getHerePlaceDetails (locationId, item) {\n\t\tconst params = new URLSearchParams({\n\t\t\tapp_id: this.token.appId,\n\t\t\tapp_code: this.token.appCode,\n\t\t\tlocationid: locationId,\n\t\t\tjsonattributes: 1,\n\t\t\tgen: 9,\n\t\t\tlanguage: this.locale,\n\t\t}).toString();\n\n\t\tconst data = await fetch(\n\t\t\t'https://geocoder.api.here.com/6.2/geocode.json?' + params\n\t\t).then(res => res.json());\n\n\t\tconst place = data.response.view[0].result[0].location;\n\n\t\treturn {\n\t\t\t...item,\n\t\t\tlat: place.displayPosition.latitude,\n\t\t\tlng: place.displayPosition.longitude,\n\t\t\tparts: new Parts(\n\t\t\t\tplace.address,\n\t\t\t\tGeoService.Here\n\t\t\t),\n\t\t};\n\t}\n\n}\n"
  },
  {
    "path": "resources/src/components/Address.vue",
    "content": "<template>\n\t<div :class=\"cls\" :style=\"styl\">\n\t\t<Fragment v-if=\"showLatLng\">\n\t\t\t<Input\n\t\t\t\t:label=\"labels.lat\"\n\t\t\t\t:value=\"value.lat\"\n\t\t\t\t@input=\"onInput('lat', $event)\"\n\t\t\t/>\n\t\t\t<Input\n\t\t\t\t:label=\"labels.lng\"\n\t\t\t\t:value=\"value.lng\"\n\t\t\t\t@input=\"onInput('lng', $event)\"\n\t\t\t/>\n\t\t</Fragment>\n\n\t\t<div :class=\"[$style.full, $style.row]\">\n\t\t\t<Input\n\t\t\t\t:label=\"labels.fullAddress\"\n\t\t\t\t:value=\"value.address\"\n\t\t\t\t@input=\"onInput('fullAddress', $event)\"\n\t\t\t\t:disabled=\"hide\"\n\t\t\t/>\n\t\t\t<button\n\t\t\t\t:class=\"$style.btn\"\n\t\t\t\t@click=\"onClear()\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t@mouseenter=\"onDeleteEnter\"\n\t\t\t\t@mouseleave=\"onDeleteLeave\"\n\t\t\t\t:title=\"labels.clear\"\n\t\t\t>\n\t\t\t\t<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\">\n\t\t\t\t\t<path fill=\"#29323D\" d=\"M7 14c-3.832 0-7-3.167-7-6.997C0 3.167 3.162 0 6.993 0 10.825 0 14 3.167 14 7.003 14 10.833 10.832 14 7 14zM4.65 9.994a.65.65 0 0 0 .468-.19l1.875-1.88 1.889 1.88c.115.116.27.19.46.19.366 0 .65-.29.65-.65a.674.674 0 0 0-.19-.46l-1.888-1.88 1.889-1.895a.581.581 0 0 0 .196-.447.64.64 0 0 0-.65-.643.59.59 0 0 0-.453.19L6.993 6.097 5.104 4.216a.607.607 0 0 0-.453-.19.64.64 0 0 0-.65.643c0 .17.074.331.196.447L6.08 7.003 4.197 8.898a.608.608 0 0 0-.196.447c0 .358.291.65.65.65z\"/>\n\t\t\t\t</svg>\n\t\t\t</button>\n\t\t</div>\n\n\t\t<Input\n\t\t\t:label=\"labels.what3words\"\n\t\t\t:value=\"'/// ' + (value.what3words || '')\"\n\t\t\t:class=\"$style.full\"\n\t\t\tv-if=\"showW3wField\"\n\t\t\t@input=\"onW3WInput\"\n\t\t/>\n\n\t\t<Fragment v-if=\"!hide\">\n\t\t\t<Input\n\t\t\t\t:label=\"labels.number\"\n\t\t\t\t:value=\"value.parts.number\"\n\t\t\t\t@input=\"onInput('number', $event)\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.address\"\n\t\t\t\t:value=\"value.parts.address\"\n\t\t\t\t@input=\"onInput('address', $event)\"\n\t\t\t\t:class=\"$style.right\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.city\"\n\t\t\t\t:value=\"value.parts.city\"\n\t\t\t\t@input=\"onInput('city', $event)\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.postcode\"\n\t\t\t\t:value=\"value.parts.postcode\"\n\t\t\t\t@input=\"onInput('postcode', $event)\"\n\t\t\t\t:class=\"$style.right\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.county\"\n\t\t\t\t:value=\"value.parts.county\"\n\t\t\t\t@input=\"onInput('county', $event)\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.state\"\n\t\t\t\t:value=\"value.parts.state\"\n\t\t\t\t@input=\"onInput('state', $event)\"\n\t\t\t\t:class=\"$style.right\"\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t:label=\"labels.country\"\n\t\t\t\t:value=\"value.parts.country\"\n\t\t\t\t@input=\"onInput('country', $event)\"\n\t\t\t/>\n\t\t</Fragment>\n\t</div>\n</template>\n\n<script lang=\"js\">\n\timport Input from './Input';\n\timport Fragment from './Fragment';\n\timport { t } from '../filters/craft';\n\n\texport default {\n\t\tprops: {\n\t\t\tvalue: {\n\t\t\t\ttype: Object,\n\t\t\t\tdefault: () => ({\n\t\t\t\t\taddress: '',\n\t\t\t\t\tlat: 0,\n\t\t\t\t\tlng: 0,\n\t\t\t\t\tparts: {},\n\t\t\t\t\twhat3words: '',\n\t\t\t\t}),\n\t\t\t},\n\t\t\tshowLatLng: Boolean,\n\t\t\tfullAddressDirty: Boolean,\n\t\t\thide: Boolean,\n\t\t\thasSearch: Boolean,\n\t\t\thasMap: Boolean,\n\t\t\tsize: String,\n\t\t\topenOffset: Number,\n\t\t\tshowW3wField: Boolean,\n\t\t},\n\n\t\tcomponents: {\n\t\t\tInput,\n\t\t\tFragment,\n\t\t},\n\n\t\tdata () {\n\t\t\treturn {\n\t\t\t\thoverDelete: false,\n\t\t\t\tlabels: {\n\t\t\t\t\tfullAddress: t('Full Address'),\n\t\t\t\t\tnumber: t('Name / Number'),\n\t\t\t\t\taddress: t('Street Address'),\n\t\t\t\t\tcity: t('Town / City'),\n\t\t\t\t\tpostcode: t('Postcode'),\n\t\t\t\t\tcounty: t('County'),\n\t\t\t\t\tstate: t('State'),\n\t\t\t\t\tcountry: t('Country'),\n\t\t\t\t\tlat: t('Latitude'),\n\t\t\t\t\tlng: t('Longitude'),\n\t\t\t\t\tclear: t('Clear address'),\n\t\t\t\t\twhat3words: t('what3words'),\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\n\t\tcomputed: {\n\t\t\tcls () {\n\t\t\t\tconst cls = [this.$style.grid];\n\n\t\t\t\tif (this.hasMap && this.openOffset > 0)\n\t\t\t\t\tcls.push(this.$style.fade);\n\n\t\t\t\tif (!this.hasSearch)\n\t\t\t\t\tcls.push(this.$style['no-search']);\n\n\t\t\t\tif (!this.hasMap)\n\t\t\t\t\tcls.push(this.$style['no-map']);\n\n\t\t\t\tif (this.hoverDelete)\n\t\t\t\t\tcls.push(this.$style.delete);\n\n\t\t\t\tif (this.hasValue)\n\t\t\t\t\tcls.push(this.$style['show-clear']);\n\n\t\t\t\treturn cls;\n\t\t\t},\n\n\t\t\tstyl () {\n\t\t\t\tif (!this.hasMap)\n\t\t\t\t\treturn {};\n\n\t\t\t\treturn {\n\t\t\t\t\ttransform: `translateY(${this.openOffset}px)`,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\thasValue () {\n\t\t\t\treturn this.value.address !== null;\n\t\t\t},\n\t\t},\n\n\t\tmethods: {\n\t\t\tonInput (name, e) {\n\t\t\t\tthis.$emit('changed', {\n\t\t\t\t\tname,\n\t\t\t\t\tvalue: e.target.value,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tasync onW3WInput (e) {\n\t\t\t\tthis.$emit(\n\t\t\t\t\t'w3w-change',\n\t\t\t\t\te.target.value.trim().replace(/\\/|\\s/g, '').toLowerCase()\n\t\t\t\t);\n\t\t\t},\n\n\t\t\tonClear () {\n\t\t\t\tthis.$emit('clear');\n\t\t\t},\n\n\t\t\tonDeleteEnter () {\n\t\t\t\tthis.hoverDelete = true;\n\t\t\t},\n\n\t\t\tonDeleteLeave () {\n\t\t\t\tthis.hoverDelete = false;\n\t\t\t},\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.grid {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: 1fr 1fr;\n\n\t\tbackground-color: #fff;\n\t\tborder-radius: 5px;\n\t\tbox-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.20);\n\n\t\toverflow: hidden;\n\t\ttransition: transform 0.3s ease, opacity 0.3s ease;\n\n\t\t&:not(:first-child) {\n\t\t\tmargin-top: 24px;\n\t\t}\n\n\t\t&.fade {\n\t\t\topacity: 0.8;\n\t\t}\n\n\t\t&.no-map {\n\t\t\tbox-shadow: none;\n\t\t\tborder: 1px solid #DCE4EA;\n\t\t}\n\n\t\t@media only screen and (max-width: 1199px) {\n\t\t\tgrid-template-columns: 1fr;\n\n\t\t\tlabel {\n\t\t\t\tborder-right: none;\n\t\t\t}\n\t\t}\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\t&:not(.no-map):not(.no-search) {\n\t\t\t\tmargin-top: 200px !important;\n\t\t\t}\n\t\t\t&:not(.no-map).no-search {\n\t\t\t\tmargin-top: 260px !important;\n\t\t\t}\n\t\t}\n\n\t\t&, * {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\tlabel.right {\n\t\t\tborder-right: none;\n\t\t}\n\n\t\t.full,\n\t\tlabel:last-child {\n\t\t\tgrid-column: span 2;\n\t\t\tborder-right: none;\n\n\t\t\t@media only screen and (max-width: 1199px) {\n\t\t\t\tgrid-column: span 1;\n\t\t\t}\n\t\t}\n\t}\n\t.row {\n\t\tdisplay: flex;\n\n\t\t&:last-child > * {\n\t\t\tborder-bottom: none;\n\t\t}\n\n\t\tlabel {\n\t\t\tflex-grow: 1;\n\t\t\tborder-right: none;\n\t\t}\n\t}\n\t.btn {\n\t\tappearance: none;\n\t\tbackground: none;\n\t\tborder: none;\n\t\tborder-bottom: 1px solid #DCE4EA;\n\t\tborder-radius: 0 5px 0 0;\n\t\tcursor: pointer;\n\n\t\tpointer-events: none;\n\n\t\tsvg {\n\t\t\topacity: 0.5;\n\n\t\t\ttransform: translateX(200%);\n\t\t\ttransition: transform 0.3s ease, opacity 0.15s ease;\n\t\t}\n\n\t\tpath {\n\t\t\ttransition: fill 0.15s ease;\n\t\t}\n\n\t\t.show-clear & {\n\t\t\tpointer-events: auto;\n\n\t\t\tsvg {\n\t\t\t\ttransform: translateX(0);\n\t\t\t}\n\t\t}\n\n\t\t&:hover {\n\t\t\tsvg {\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t\tpath {\n\t\t\t\tfill: #F22C26;\n\t\t\t}\n\t\t}\n\t}\n\t.delete input {\n\t\tcolor: #F22C26;\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/components/Fragment.vue",
    "content": "<script>\n\texport default {\n\t\tfunctional: true,\n\t\trender (h, ctx) {\n\t\t\treturn ctx.children;\n\t\t}\n\t};\n</script>\n"
  },
  {
    "path": "resources/src/components/Input.vue",
    "content": "<template>\n\t<Label :label=\"label\" :class=\"className\">\n\t\t<input\n\t\t\t:class=\"$style.input\"\n\t\t\t:type=\"type\"\n\t\t\t:name=\"name\"\n\t\t\t:value=\"value\"\n\t\t\t:disabled=\"disabled\"\n\t\t\t@input=\"$emit('input', $event)\"\n\t\t/>\n\t</Label>\n</template>\n\n<script lang=\"js\">\n\timport Label from './Label';\n\n\texport default {\n\t\tprops: {\n\t\t\tlabel: String,\n\t\t\tname: String,\n\t\t\ttype: {\n\t\t\t\ttype: String,\n\t\t\t\tdefault: 'text',\n\t\t\t},\n\t\t\tvalue: [String, Number],\n\t\t\tdisabled: Boolean,\n\t\t\tclassName: Boolean,\n\t\t},\n\n\t\tcomponents: {\n\t\t\tLabel,\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.input {\n\t\twidth: 100%;\n\t\tpadding: 29px 0 10px;\n\n\t\tcolor: #29323D;\n\t\tfont-size: 15px;\n\t\tletter-spacing: 0;\n\t\ttext-indent: 12px;\n\n\t\tappearance: none;\n\t\tbackground: none;\n\t\tborder: none;\n\t\tborder-radius: 0;\n\n\t\ttransition: color 0.15s ease;\n\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t}\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/components/Label.vue",
    "content": "<template>\n\t<label :class=\"$style.label\">\n\t\t<span :class=\"$style.name\">\n\t\t\t{{ label }}\n\t\t</span>\n\t\t<slot></slot>\n\t</label>\n</template>\n\n<script lang=\"js\">\n\texport default {\n\t\tprops: {\n\t\t\tlabel: String,\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.label {\n\t\tposition: relative;\n\t\tdisplay: block;\n\n\t\tborder-right: 1px solid #DCE4EA;\n\n\t\t&:not(:last-child) {\n\t\t\tborder-bottom: 1px solid #DCE4EA;\n\t\t}\n\t}\n\n\t.name {\n\t\tposition: absolute;\n\t\ttop: 9px;\n\t\tleft: 12px;\n\n\t\tdisplay: block;\n\n\t\tcolor: rgba(41, 50, 61, 0.41);\n\t\tfont-size: 12px;\n\t\tfont-weight: 500;\n\t\tletter-spacing: 0;\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/components/Map.vue",
    "content": "<template>\n\t<div :class=\"cls\"></div>\n</template>\n\n<script lang=\"js\">\n\t// TODO: Only load mutants in if they're needed\n\timport L from 'leaflet';\n\timport 'leaflet.gridlayer.googlemutant';\n\timport 'leaflet.mapkitmutant';\n\timport MapTiles from '../enums/MapTiles';\n\timport 'leaflet/dist/leaflet.css';\n\timport waitForGlobal from '../helpers/waitForGlobal';\n\timport { t } from '../filters/craft';\n\timport createW3WGrid from '../helpers/createW3WGrid';\n\n\tconst icon = (w, h, f = '#E7433B') => `<svg width=\"${w}\" height=\"${h}\" viewBox=\"0 0 14 20\"><path fill=\"${f}\" d=\"M6.976.478C3.482.478.634 3.313.634 6.79c0 2.381 1.716 4.247 2.945 6.09 1.23 1.844 2 3.706 2.664 6.17a.78.78 0 0 0 .733.56c.308 0 .64-.217.733-.56.724-2.69 1.49-4.537 2.704-6.324 1.213-1.786 2.906-3.56 2.906-5.936 0-3.476-2.849-6.31-6.343-6.31zm.04 3.874c1.21 0 2.18.968 2.18 2.174A2.17 2.17 0 0 1 7.016 8.7a2.17 2.17 0 0 1-2.18-2.174 2.17 2.17 0 0 1 2.18-2.174z\"/></svg>`;\n\tconst posIcon = (w, h) => `<svg width=\"${w}\" height=\"${h}\" viewBox=\"0 0 48 48\"><path fill=\"rgba(41, 50, 61, 0.75)\" d=\"M24 16c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm17.88 6c-.92-8.34-7.54-14.96-15.88-15.88v-4.12h-4v4.12c-8.34.92-14.96 7.54-15.88 15.88h-4.12v4h4.12c.92 8.34 7.54 14.96 15.88 15.88v4.12h4v-4.12c8.34-.92 14.96-7.54 15.88-15.88h4.12v-4h-4.12zm-17.88 16c-7.73 0-14-6.27-14-14s6.27-14 14-14 14 6.27 14 14-6.27 14-14 14z\"/></svg>`;\n\n\texport default {\n\t\tprops: {\n\t\t\ttiles: String,\n\t\t\ttoken: [String, Object],\n\t\t\tlatLng: Object,\n\t\t\tzoom: Number,\n\t\t\tminZoom: Number,\n\t\t\tmaxZoom: Number,\n\t\t\thideSearch: Boolean,\n\t\t\thideAddress: Boolean,\n\t\t\tshowCurrentLocation: Boolean,\n\t\t\tw3wEnabled: Boolean,\n\t\t\tshowW3wGrid: Boolean,\n\t\t},\n\n\t\tdata () {\n\t\t\treturn {\n\t\t\t\tmap: null,\n\t\t\t\tmarker: null,\n\t\t\t};\n\t\t},\n\n\t\tmounted () {\n\t\t\tthis.map = L.map(this.$el, {\n\t\t\t\tminZoom: this.minZoom,\n\t\t\t\tmaxZoom: this.maxZoom,\n\t\t\t\tscrollWheelZoom: false,\n\t\t\t\tzoomControl: false,\n\t\t\t}).setView(this.latLng, this.zoom);\n\n\t\t\tconst self = this;\n\n\t\t\tL.Control.CustomZoom = L.Control.extend({\n\t\t\t\tonAdd: map => {\n\t\t\t\t\tconst wrap    = L.DomUtil.create('div')\n\t\t\t\t\t\t, zIn     = L.DomUtil.create('button')\n\t\t\t\t\t\t, zOut    = L.DomUtil.create('button')\n\t\t\t\t\t\t, center  = L.DomUtil.create('button')\n\t\t\t\t\t\t, current = L.DomUtil.create('button');\n\n\t\t\t\t\twrap.classList.add(self.$style.control);\n\n\t\t\t\t\tzIn.textContent = '+';\n\t\t\t\t\tzOut.textContent = '-';\n\t\t\t\t\tcenter.innerHTML = icon(\n\t\t\t\t\t\t14 * 0.75,\n\t\t\t\t\t\t20 * 0.75,\n\t\t\t\t\t\t'rgba(41, 50, 61, 0.75)'\n\t\t\t\t\t);\n\t\t\t\t\tcurrent.innerHTML = posIcon(\n\t\t\t\t\t\t20 * 0.75,\n\t\t\t\t\t\t20 * 0.75,\n\t\t\t\t\t);\n\n\t\t\t\t\tzIn.setAttribute('title', t('Zoom In'));\n\t\t\t\t\tzOut.setAttribute('title', t('Zoom Out'));\n\t\t\t\t\tcenter.setAttribute('title', t('Center on Marker'));\n\t\t\t\t\tcurrent.setAttribute('title', t('Current Location'));\n\n\t\t\t\t\twrap.appendChild(zIn);\n\t\t\t\t\twrap.appendChild(zOut);\n\t\t\t\t\twrap.appendChild(center);\n\n\t\t\t\t\tif (this.showCurrentLocation && 'geolocation' in navigator)\n\t\t\t\t\t\twrap.appendChild(current);\n\n\t\t\t\t\tzIn.addEventListener('click', e => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tmap.setZoomAround(\n\t\t\t\t\t\t\tself.getOffsetPoint(map.getCenter(), true),\n\t\t\t\t\t\t\tmap.getZoom() + map.options.zoomDelta,\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\n\t\t\t\t\tzOut.addEventListener('click', e => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tmap.setZoomAround(\n\t\t\t\t\t\t\tself.getOffsetPoint(map.getCenter(), true),\n\t\t\t\t\t\t\tmap.getZoom() - map.options.zoomDelta,\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\n\t\t\t\t\tcenter.addEventListener('click', e => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tself.panTo(self.latLng);\n\t\t\t\t\t});\n\n\t\t\t\t\tcurrent.addEventListener('click', e => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tnavigator.geolocation.getCurrentPosition(({ coords }) => {\n\t\t\t\t\t\t\tconst latLng = { lat: coords.latitude, lng: coords.longitude };\n\t\t\t\t\t\t\tself.panTo(latLng);\n\t\t\t\t\t\t\tself.marker.setLatLng(latLng);\n\t\t\t\t\t\t\tself.$emit('change', latLng);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\twindow.Craft.cp.displayError(`<strong>Maps:</strong> ${err.message}`);\n\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\tenableHighAccuracy: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\treturn wrap;\n\t\t\t\t},\n\t\t\t\tonRemove: () => {},\n\t\t\t});\n\n\t\t\tL.control.customZoom = function (opts) {\n\t\t\t\treturn new L.Control.CustomZoom(opts);\n\t\t\t};\n\n\t\t\tL.control.customZoom({ position: 'topright' }).addTo(this.map);\n\n\t\t\tthis.map.panBy(\n\t\t\t\tL.point(this.offsetAmount()),\n\t\t\t\t{ animate: false }\n\t\t\t);\n\n\t\t\tif (this.tiles.indexOf('google') > -1) {\n\t\t\t\tthis._googleMutant();\n\t\t\t} else if (this.tiles.indexOf('mapkit') > -1) {\n\t\t\t\tthis._mapKitMutant();\n\t\t\t} else {\n\t\t\t\tconst opts = {\n\t\t\t\t\tattribution: this.tileLayer.attr,\n\t\t\t\t\t...(this.tileLayer.opts || {}),\n\t\t\t\t};\n\n\t\t\t\tif (this.tileLayer.subdomains)\n\t\t\t\t\topts.subdomains = this.tileLayer.subdomains;\n\n\t\t\t\tconst tileLayer = L.tileLayer(\n\t\t\t\t\tthis.tileLayer.url,\n\t\t\t\t\topts\n\t\t\t\t);\n\t\t\t\tthis.map.addLayer(tileLayer);\n\t\t\t}\n\n\t\t\tif (this.w3wEnabled && this.showW3wGrid) {\n\t\t\t\tconst drawGrid = createW3WGrid(L, this.map);\n\t\t\t\tthis.map.whenReady(drawGrid);\n\t\t\t\tthis.map.on('move', drawGrid);\n\t\t\t}\n\n\t\t\tthis.map.on('zoom', this.onZoom);\n\n\t\t\tthis.setMarker();\n\n\t\t\t// Re-draw the map if it was hidden\n\t\t\tconst io = new IntersectionObserver(entries => {\n\t\t\t\tif (entries[0].intersectionRatio <= 0)\n\t\t\t\t\treturn;\n\n\t\t\t\tthis.map.invalidateSize(true);\n\t\t\t});\n\n\t\t\tio.observe(this.$el);\n\t\t},\n\n\t\tcomputed: {\n\t\t\tcls () {\n\t\t\t\treturn [this.$style.map];\n\t\t\t},\n\n\t\t\ttileLayer () {\n\t\t\t\tconst scale     = L.Browser.retina ? '@2x.png' : '.png'\n\t\t\t\t\t, hereScale = L.Browser.retina ? '512' : '256'\n\t\t\t\t\t, mbScale   = L.Browser.retina ? '@2x' : ''\n\t\t\t\t\t, style     = this.tiles.split(/\\.(.+)/)[1];\n\n\t\t\t\tswitch (this.tiles) {\n\t\t\t\t\tcase MapTiles.Wikimedia:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: `https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}${scale}`,\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://maps.wikimedia.org\" target=\"_blank\" rel=\"noreferrer\">Wikimedia</a>',\n\t\t\t\t\t\t};\n\t\t\t\t\tcase MapTiles.OpenStreetMap:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>',\n\t\t\t\t\t\t};\n\t\t\t\t\tcase MapTiles.CartoVoyager:\n\t\t\t\t\tcase MapTiles.CartoPositron:\n\t\t\t\t\tcase MapTiles.CartoDarkMatter:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: `https://{s}.basemaps.cartocdn.com/${style}/{z}/{x}/{y}${scale}`,\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://carto.com/attribution\" target=\"_blank\" rel=\"noreferrer\">CARTO</a>',\n\t\t\t\t\t\t};\n\t\t\t\t\tcase MapTiles.MapboxOutdoors:\n\t\t\t\t\tcase MapTiles.MapboxStreets:\n\t\t\t\t\tcase MapTiles.MapboxLight:\n\t\t\t\t\tcase MapTiles.MapboxDark: {\n\t\t\t\t\t\tlet v = '-v11';\n\n\t\t\t\t\t\tif (this.tiles === MapTiles.MapboxLight || this.tiles === MapTiles.MapboxDark)\n\t\t\t\t\t\t\tv = '-v10';\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}{scale}?access_token={accessToken}',\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://www.mapbox.com/\" target=\"_blank\" rel=\"noreferrer\">Mapbox</a>',\n\t\t\t\t\t\t\topts: {\n\t\t\t\t\t\t\t\taccessToken: this.token,\n\t\t\t\t\t\t\t\tid: `mapbox/${style}${v}`,\n\t\t\t\t\t\t\t\ttileSize: 512,\n\t\t\t\t\t\t\t\tzoomOffset: -1,\n\t\t\t\t\t\t\t\tscale: mbScale,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tcase MapTiles.HereNormalDay:\n\t\t\t\t\tcase MapTiles.HereNormalDayGrey:\n\t\t\t\t\tcase MapTiles.HereNormalDayTransit:\n\t\t\t\t\tcase MapTiles.HereReduced:\n\t\t\t\t\tcase MapTiles.HerePedestrian:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: `https://{s}.base.maps.api.here.com/maptile/2.1/maptile/newest/${style}/{z}/{x}/{y}/${hereScale}/png8?app_id=${this.token.appId}&app_code=${this.token.appCode}`,\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://here.com/\" target=\"_blank\" rel=\"noreferrer\">Here</a>',\n\t\t\t\t\t\t\tsubdomains: '1234',\n\t\t\t\t\t\t};\n\t\t\t\t\tcase MapTiles.HereTerrain:\n\t\t\t\t\tcase MapTiles.HereSatellite:\n\t\t\t\t\tcase MapTiles.HereHybrid:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\turl: `https://{s}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/${style}/{z}/{x}/{y}/${hereScale}/png8?app_id=${this.token.appId}&app_code=${this.token.appCode}`,\n\t\t\t\t\t\t\tattr: '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://here.com/\" target=\"_blank\" rel=\"noreferrer\">Here</a>',\n\t\t\t\t\t\t\tsubdomains: '1234',\n\t\t\t\t\t\t};\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error('Unknown map tiles service: ' + this.tiles);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\ticon () {\n\t\t\t\tconst w = 14 * 2\n\t\t\t\t\t, h = 20 * 2;\n\n\t\t\t\treturn L.divIcon({\n\t\t\t\t\thtml: icon(w, h),\n\t\t\t\t\ticonSize: [w, h],\n\t\t\t\t\ticonAnchor: [w / 2, h],\n\t\t\t\t\tclassName: '',\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\n\t\twatch: {\n\t\t\tlatLng: {\n\t\t\t\tdeep: true,\n\t\t\t\t/**\n\t\t\t\t * Watches the latLng prop for changes, then updates the map location\n\t\t\t\t * accordingly\n\t\t\t\t */\n\t\t\t\thandler (next, old) {\n\t\t\t\t\tif (next.lat === old.lat && next.lng === old.lng)\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\tthis.panTo(this.latLng);\n\t\t\t\t\tthis.setMarker();\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tmethods: {\n\t\t\toffsetAmount () {\n\t\t\t\tlet x = 0;\n\n\t\t\t\tif (!window.matchMedia('(max-width: 767px)').matches)\n\t\t\t\t\tx = -(this.$el.getBoundingClientRect().width / 4);\n\n\t\t\t\treturn { x, y: this.hideSearch ? 5 : -15 };\n\t\t\t},\n\n\t\t\tgetOffsetPoint (latLng, invert = false) {\n\t\t\t\tconst point = this.map.latLngToContainerPoint(latLng);\n\t\t\t\tif (invert) {\n\t\t\t\t\tpoint.x -= this.offsetAmount().x;\n\t\t\t\t\tpoint.y -= this.offsetAmount().y;\n\t\t\t\t} else {\n\t\t\t\t\tpoint.x += this.offsetAmount().x;\n\t\t\t\t\tpoint.y += this.offsetAmount().y;\n\t\t\t\t}\n\t\t\t\treturn point;\n\t\t\t},\n\n\t\t\tpanTo (latLng) {\n\t\t\t\tthis.map.panTo(\n\t\t\t\t\tthis.map.containerPointToLatLng(\n\t\t\t\t\t\tthis.getOffsetPoint(latLng)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\n\t\t\tsetMarker () {\n\t\t\t\tif (this.marker)\n\t\t\t\t\tthis.map.removeLayer(this.marker);\n\n\t\t\t\tthis.marker = L.marker(this.latLng, {\n\t\t\t\t\ticon: this.icon,\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tautoPan: true,\n\t\t\t\t});\n\n\t\t\t\tthis.map.addLayer(this.marker);\n\n\t\t\t\tthis.marker.on('dragend', () => {\n\t\t\t\t\tthis.$emit('change', this.marker.getLatLng());\n\t\t\t\t});\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Listens to map zoom event and triggers component zoom event.\n\t\t\t */\n\t\t\tonZoom () {\n\t\t\t\tthis.$emit('zoom', this.map.getZoom());\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Sets up Leaflet to use Google Maps\n\t\t\t *\n\t\t\t * @private\n\t\t\t */\n\t\t\t_googleMutant () {\n\t\t\t\twaitForGlobal('google', () => {\n\t\t\t\t\tL.gridLayer.googleMutant({\n\t\t\t\t\t\ttype: this.tiles.split('.')[1],\n\t\t\t\t\t}).addTo(this.map);\n\t\t\t\t});\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Sets up Leaflet to use Apple MapKit\n\t\t\t *\n\t\t\t * @private\n\t\t\t */\n\t\t\t_mapKitMutant () {\n\t\t\t\twaitForGlobal('mapkit', () => {\n\t\t\t\t\tL.mapkitMutant({\n\t\t\t\t\t\ttype: this.tiles.split('.')[1],\n\t\t\t\t\t\tauthorizationCallback: done => done(this.token),\n\t\t\t\t\t\tlanguage: window.Craft.language,\n\t\t\t\t\t}).addTo(this.map);\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.map {\n\t\tposition: absolute;\n\t\tz-index: 0;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\n\t\tbox-sizing: border-box;\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\theight: 300px;\n\t\t\tbottom: auto;\n\t\t}\n\t}\n\t.control {\n\t\tmargin: 24px !important;\n\t\tfont-size: 0;\n\n\t\tborder-radius: 5px;\n\t\tbox-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.20);\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\tmargin: 14px !important;\n\t\t}\n\n\t\tbutton {\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tpadding: 2px 10px 3px;\n\n\t\t\tcolor: rgba(41, 50, 61, 0.75);\n\t\t\tfont-size: 20px;\n\t\t\tfont-weight: bold;\n\t\t\tline-height: normal;\n\n\t\t\tappearance: none;\n\t\t\tbackground-color: #fff;\n\t\t\tborder: none;\n\t\t\tcursor: pointer;\n\n\t\t\ttransition: background-color 0.15s ease;\n\n\t\t\t&:not(:last-child) {\n\t\t\t\tborder-bottom: 1px solid #DCE4EA;\n\t\t\t}\n\n\t\t\t&:first-child {\n\t\t\t\tpadding-bottom: 4px;\n\t\t\t\tborder-radius: 5px 5px 0 0;\n\t\t\t}\n\n\t\t\t&:last-child {\n\t\t\t\tpadding-top: 4px;\n\t\t\t\tborder-radius: 0 0 5px 5px;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\tbackground-color: #f0f9ff;\n\t\t\t}\n\t\t}\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/components/Search.vue",
    "content": "<template>\n\t<label :class=\"cls\">\n\t\t<svg width=\"17\" height=\"17\" viewBox=\"0 0 17 17\">\n\t\t\t<path fill=\"#29323D\" d=\"M6.938 13.893c-3.805 0-6.917-3.112-6.917-6.917C.021 3.17 3.133.059 6.938.059c3.797 0 6.917 3.11 6.917 6.917a6.846 6.846 0 0 1-1.265 3.963l3.832 3.841c.246.246.36.572.36.906 0 .72-.536 1.292-1.274 1.292-.343 0-.677-.124-.923-.37l-3.85-3.858a6.874 6.874 0 0 1-3.797 1.143zm0-1.846c2.778 0 5.072-2.285 5.072-5.071 0-2.778-2.294-5.072-5.072-5.072-2.786 0-5.07 2.294-5.07 5.072 0 2.786 2.284 5.07 5.07 5.07z\"/>\n\t\t</svg>\n\t\t<vue-autosuggest\n\t\t\t:suggestions=\"suggestions\"\n\t\t\t:render-suggestion=\"renderSuggestion\"\n\t\t\t:get-suggestion-value=\"getSuggestionValue\"\n\t\t\t:should-render-suggestions=\"shouldRenderSuggestions\"\n\t\t\t:input-props=\"inputProps\"\n\t\t\t@selected=\"onSelected\"\n\t\t\t@input=\"onInputChange\"\n\t\t\tref=\"self\"\n\t\t\t:component-attr-class-autosuggest-results-container=\"$style.resultsWrap\"\n\t\t\t:component-attr-class-autosuggest-results=\"$style.results\"\n\t\t/>\n\t</label>\n</template>\n\n<script lang=\"jsx\">\n\timport { VueAutosuggest } from 'vue-autosuggest';\n\timport { t } from '../filters/craft';\n\timport GeoService from '../enums/GeoService';\n\timport Geo from '../common/Geo';\n\n\tlet to;\n\n\texport default {\n\t\tprops: {\n\t\t\tgeo: Geo,\n\t\t\tservice: String,\n\t\t\tdefaultValue: String,\n\t\t\thasMap: Boolean,\n\t\t\tsize: String,\n\t\t},\n\n\t\tcomponents: {\n\t\t\tVueAutosuggest,\n\t\t},\n\n\t\tdata () {\n\t\t\treturn {\n\t\t\t\tshouldShow: false,\n\t\t\t\tsuggestions: [{ data: [] }],\n\t\t\t};\n\t\t},\n\n\t\tcomputed: {\n\t\t\tcls () {\n\t\t\t\tconst cls = [this.$style.wrap];\n\n\t\t\t\tif (this.isOpen)\n\t\t\t\t\tcls.push(this.$style.open);\n\n\t\t\t\tif (!this.hasMap)\n\t\t\t\t\tcls.push(this.$style['no-map']);\n\n\t\t\t\treturn cls;\n\t\t\t},\n\n\t\t\tinputProps () {\n\t\t\t\tconst cls = [this.$style.input];\n\n\t\t\t\tif (!this.hasMap)\n\t\t\t\t\tcls.push(this.$style['no-map']);\n\n\t\t\t\treturn {\n\t\t\t\t\tclass: cls,\n\t\t\t\t\tinitialValue: this.initialValue,\n\t\t\t\t\tplaceholder: t('Search for a location'),\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tisOpen () {\n\t\t\t\treturn this.suggestions[0].data.length > 0 && this.shouldShow;\n\t\t\t},\n\n\t\t\tsuggestLengthShow () {\n\t\t\t\treturn `${this.shouldShow}${this.suggestions[0].data.length}`;\n\t\t\t},\n\t\t},\n\n\t\twatch: {\n\t\t\tsuggestLengthShow () {\n\t\t\t\tthis.emitHeightChange();\n\t\t\t},\n\t\t},\n\n\t\tmethods: {\n\t\t\tshouldRenderSuggestions (count, loading) {\n\t\t\t\tthis.shouldShow = count > 0 && !loading;\n\t\t\t\treturn () => true;\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Fired on autocomplete input change\n\t\t\t */\n\t\t\tonInputChange (text) {\n\t\t\t\tif (text.trim() === '')\n\t\t\t\t\tthis.shouldShow = false;\n\n\t\t\t\tclearTimeout(to);\n\t\t\t\tto = setTimeout(async () => {\n\t\t\t\t\tconst data       = await this.geo.search(text);\n\t\t\t\t\tthis.suggestions = [{ data }];\n\t\t\t\t\tthis.emitHeightChange();\n\t\t\t\t}, 500);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * When an item from the autocomplete is selected\n\t\t\t *\n\t\t\t * @param selected\n\t\t\t */\n\t\t\tasync onSelected (selected) {\n\t\t\t\tif (!selected)\n\t\t\t\t\treturn;\n\n\t\t\t\tlet item = selected.item;\n\t\t\t\tconst placeId = item.__placeId;\n\t\t\t\tdelete item.__placeId;\n\n\t\t\t\t// eslint-disable-next-line default-case\n\t\t\t\tswitch (this.service) {\n\t\t\t\t\tcase GeoService.GoogleMaps:\n\t\t\t\t\t\titem = await this.geo.getGooglePlaceDetails(placeId, item);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GeoService.Here:\n\t\t\t\t\t\titem = await this.geo.getHerePlaceDetails(placeId, item);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.$emit('selected', item);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Renders the given item in the autocomplete dropdown\n\t\t\t *\n\t\t\t * TODO: Highlight search term?\n\t\t\t *\n\t\t\t * @param item\n\t\t\t * @returns {*|string}\n\t\t\t */\n\t\t\trenderSuggestion: ({ item }) => item.address,\n\n\t\t\t/**\n\t\t\t * Converts the given autocomplete suggestion to a string\n\t\t\t * (to auto-fill the input)\n\t\t\t *\n\t\t\t * @param suggestion\n\t\t\t * @returns {string}\n\t\t\t */\n\t\t\tgetSuggestionValue: suggestion => suggestion.item.address,\n\n\t\t\t/**\n\t\t\t * Notifies the parent of a height change in the dropdown\n\t\t\t */\n\t\t\temitHeightChange () {\n\t\t\t\tif (!this.hasMap)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst list = this.$refs.self.$el.lastElementChild;\n\n\t\t\t\tif (!this.isOpen || !list.firstElementChild || window.matchMedia('(max-width: 767px)').matches) {\n\t\t\t\t\tthis.$emit('open-offset', 0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.$emit('open-offset', list.firstElementChild.getBoundingClientRect().height);\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t};\n</script>\n\n<style lang=\"less\" module>\n\t.wrap {\n\t\tposition: relative;\n\t\tdisplay: block;\n\n\t\t@media only screen and (max-width: 767px) {\n\t\t\tmargin-right: 44px;\n\t\t}\n\n\t\t&, * {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t> svg {\n\t\t\tposition: absolute;\n\t\t\ttop: 17px;\n\t\t\tleft: 16px;\n\t\t\tpointer-events: none;\n\t\t}\n\n\t\t&.no-map {\n\t\t\tmargin-right: 0;\n\t\t}\n\t}\n\t.input {\n\t\twidth: 100%;\n\t\tpadding: 16px 0 15px 48px;\n\n\t\tfont-size: 16px;\n\n\t\tappearance: none;\n\t\tbackground-color: #fff;\n\t\tborder: none;\n\t\tborder-bottom: 1px solid transparent;\n\t\tborder-radius: 5px;\n\t\tbox-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.20);\n\n\t\t&.no-map {\n\t\t\tbox-shadow: none;\n\t\t\tborder: 1px solid #DCE4EA;\n\t\t}\n\n\t\t.open & {\n\t\t\tborder-radius: 5px 5px 0 0;\n\t\t\tborder-bottom-color: #D2DBE1;\n\t\t}\n\t}\n\t.resultsWrap {\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: -20px;\n\n\t\twidth: calc(100% + 40px);\n\t\theight: 210px;\n\t\tpadding: 0 20px 20px;\n\n\t\toverflow: hidden;\n\t\tpointer-events: none;\n\t}\n\t.results {\n\t\tposition: relative;\n\t\tz-index: 2;\n\t\twidth: 100%;\n\t\tpadding: 7px 0;\n\n\t\tbackground-color: #fff;\n\t\tbox-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.10);\n\t\tborder-radius: 0 0 5px 5px;\n\n\t\ttransform: translateY(calc(-100% - 15px));\n\t\ttransition: transform 0.3s ease;\n\t\tpointer-events: all;\n\n\t\t.open & {\n\t\t\ttransform: translateY(0);\n\t\t}\n\n\t\tli {\n\t\t\tpadding: 7px 14px;\n\t\t\ttransition: background-color 0.15s ease;\n\n\t\t\t&[class*=\"highlighted\"] {\n\t\t\t\tbackground-color: #e4edf3;\n\t\t\t\tcursor: pointer;\n\t\t\t}\n\t\t}\n\t}\n</style>\n"
  },
  {
    "path": "resources/src/enums/GeoService.js",
    "content": "const GeoService = {\n\tNominatim: 'nominatim',\n\tMapbox: 'mapbox',\n\tGoogleMaps: 'google',\n\tAppleMapKit: 'apple',\n\tHere: 'here',\n};\n\nexport default GeoService;\n"
  },
  {
    "path": "resources/src/enums/MapTiles.js",
    "content": "const MapTiles = {\n\t// Open Source\n\t// -------------------------------------------------------------------------\n\n\t// Wikimedia\n\t// https://foundation.wikimedia.org/wiki/Maps_Terms_of_Use\n\tWikimedia: 'wikimedia',\n\n\t// OpenStreetMaps\n\t// https://operations.osmfoundation.org/policies/tiles/\n\tOpenStreetMap: 'openstreetmap',\n\n\t// Carto\n\t// https://github.com/CartoDB/basemap-styles\n\tCartoVoyager: 'carto.rastertiles/voyager',\n\tCartoPositron: 'carto.light_all',\n\tCartoDarkMatter: 'carto.dark_all',\n\n\t// Requires API Key (Token)\n\t// -------------------------------------------------------------------------\n\n\t// Mapbox\n\tMapboxOutdoors: 'mapbox.outdoors',\n\tMapboxStreets: 'mapbox.streets',\n\tMapboxLight: 'mapbox.light',\n\tMapboxDark: 'mapbox.dark',\n\n\t// Google Maps\n\tGoogleRoadmap: 'google.roadmap',\n\tGoogleTerrain: 'google.terrain',\n\tGoogleHybrid: 'google.hybrid',\n\n\t// Apple MapKit\n\tMapKitStandard: 'mapkit.standard',\n\tMapKitMutedStandard: 'mapkit.muted',\n\tMapKitSatellite: 'mapkit.satellite',\n\tMapKitHybrid: 'mapkit.hybrid',\n\n\t// Here\n\tHereNormalDay: 'here.normal.day',\n\tHereNormalDayGrey: 'here.normal.day.grey',\n\tHereNormalDayTransit: 'here.normal.day.transit',\n\tHereReduced: 'here.reduced.day',\n\tHerePedestrian: 'here.pedestrian.day',\n\tHereTerrain: 'here.terrain.day',\n\tHereSatellite: 'here.satellite.day',\n\tHereHybrid: 'here.hybrid.day',\n};\n\nexport default MapTiles;\n"
  },
  {
    "path": "resources/src/filters/craft.js",
    "content": "export function t (message, params = null) {\n    // @ts-ignore\n    return window.Craft.t('simplemap', message, params);\n}\n"
  },
  {
    "path": "resources/src/helpers/createW3WGrid.js",
    "content": "export default function createW3WGrid (L, map) {\n\tlet gridLayer;\n\n\treturn function drawGrid () {\n\t\tconst zoom = map.getZoom();\n\t\tconst loadFeatures = zoom > 17;\n\n\t\tif (loadFeatures) { // Zoom level is high enough\n\t\t\tconst ne = map.getBounds().getNorthEast();\n\t\t\tconst sw = map.getBounds().getSouthWest();\n\n\t\t\t// Call the what3words Grid API to obtain the grid squares within the current visble bounding box\n\t\t\twindow.what3words.api\n\t\t\t\t.gridSectionGeoJson({\n\t\t\t\t\tsouthwest: {\n\t\t\t\t\t\tlat: sw.lat,\n\t\t\t\t\t\tlng: sw.lng\n\t\t\t\t\t},\n\t\t\t\t\tnortheast: {\n\t\t\t\t\t\tlat: ne.lat,\n\t\t\t\t\t\tlng: ne.lng\n\t\t\t\t\t}\n\t\t\t\t}).then(data => {\n\t\t\t\t// If the grid layer is already present, remove it as it will need to be replaced by the new grid section\n\t\t\t\tif (gridLayer)\n\t\t\t\t\tmap.removeLayer(gridLayer);\n\n\t\t\t\t// Create a new GeoJSON layer, based on the GeoJSON returned from the what3words API\n\t\t\t\tgridLayer = L.geoJSON(data, {\n\t\t\t\t\tstyle: () => ({\n\t\t\t\t\t\tcolor: '#777',\n\t\t\t\t\t\tstroke: true,\n\t\t\t\t\t\tweight: 0.5\n\t\t\t\t\t}),\n\t\t\t\t}).addTo(map);\n\t\t\t\t// eslint-disable-next-line\n\t\t\t}).catch(console.error);\n\t\t} else if (gridLayer) {\n\t\t\t// If the grid layer already exists, remove it as the zoom level no longer requires the grid to be displayed\n\t\t\tmap.removeLayer(gridLayer);\n\t\t}\n\t};\n}\n"
  },
  {
    "path": "resources/src/helpers/debounce.js",
    "content": "/**\n * ## Debounce\n *\n * A function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds.\n *\n * If `immediate` is passed, trigger the function on the leading edge,\n * instead of the trailing.\n *\n * ```jsx\n *\n * // ...\n *\n * <input onInput={this.handleInput}>\n *\n * // ...\n *\n * handleInput = debounce(e => { /* ... *\\/ });\n *\n * ```\n *\n * @param {function} func - The function to debounce\n * @param {number=} wait - How long, in milliseconds, to delay between attempts\n * @param {boolean=} immediate - Fire on the leading edge\n * @returns {Function}\n */\nexport default function debounce (func, wait = 500, immediate = false) {\n\tlet timeout;\n\n\tif (wait === 0) {\n\t\treturn function () {\n\t\t\tfunc.apply(this, arguments);\n\t\t};\n\t}\n\n\treturn function () {\n\t\tconst context = this\n\t\t\t, args = arguments;\n\n\t\tif (args[0].constructor.name === 'SyntheticEvent')\n\t\t\targs[0].persist();\n\n\t\tconst later = function () {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tconst callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}\n"
  },
  {
    "path": "resources/src/helpers/waitForGlobal.js",
    "content": "export default function waitForGlobal (property, callback) {\n\tif (window.hasOwnProperty(property)) {\n\t\tcallback();\n\t\treturn;\n\t}\n\n\tconst i = setInterval(() => {\n\t\tif (window.hasOwnProperty(property)) {\n\t\t\tcallback();\n\t\t\tclearTimeout(i);\n\t\t}\n\t});\n}\n"
  },
  {
    "path": "resources/src/main.js",
    "content": "import App from './App.vue';\nimport { t } from './filters/craft';\n\nconst VueSimpleMapPlugin = {\n\tinstall (Vue) {\n\t\tVue.filter('t', t);\n\t\tVue.component('simple-map', App);\n\t}\n};\n\nif (typeof window !== 'undefined' && window.Vue)\n\twindow.Vue.use(VueSimpleMapPlugin);\n"
  },
  {
    "path": "resources/src/models/Parts.js",
    "content": "import GeoService from '../enums/GeoService';\n\nexport default class Parts {\n\n\t// Properties\n\t// =========================================================================\n\n\tnumber   = '';\n\taddress  = '';\n\tcity     = '';\n\tpostcode = '';\n\tcounty   = '';\n\tstate    = '';\n\tcountry  = '';\n\n\tconstructor (parts, service) {\n\t\tswitch (service) {\n\t\t\tcase GeoService.Nominatim:\n\t\t\t\tthis._nominatim(parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.Mapbox:\n\t\t\t\tthis._mapbox(parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.GoogleMaps:\n\t\t\t\tthis._google(parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService.Here:\n\t\t\t\tthis._here(parts);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn this;\n\t\t}\n\t}\n\n\t/**\n\t * Create from existing parts (i.e. from server)\n\t *\n\t * @param parts\n\t * @return {Parts}\n\t */\n\tstatic from (parts) {\n\t\tconst p = new Parts();\n\n\t\tp.number   = parts.number || '';\n\t\tp.address  = parts.address || '';\n\t\tp.city     = parts.city || '';\n\t\tp.postcode = parts.postcode || '';\n\t\tp.county   = parts.county || '';\n\t\tp.state    = parts.state || '';\n\t\tp.country  = parts.country || '';\n\n\t\treturn p;\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Parse Nominatim parts\n\t *\n\t * @param parts\n\t * @private\n\t */\n\t_nominatim (parts) {\n\t\tthis.number = this._join([\n\t\t\tparts.house_number,\n\t\t\tparts.address29,\n\t\t\t[\n\t\t\t\t'pedestrian',\n\t\t\t\t'footway',\n\t\t\t\t'path',\n\t\t\t\t'road',\n\t\t\t\t'neighbourhood',\n\t\t\t\t'suburb',\n\t\t\t\t'village',\n\t\t\t\t'town',\n\t\t\t\t'city_district',\n\t\t\t\t'city',\n\t\t\t].indexOf(parts.type) === -1 ? parts[parts.type] : null,\n\t\t]);\n\n\t\tthis.address = this._join([\n\t\t\tparts.pedestrian,\n\t\t\tparts.footway,\n\t\t\tparts.path,\n\t\t\tparts.road,\n\t\t\tparts.neighbourhood,\n\t\t\tparts.suburb,\n\t\t]);\n\n\t\tthis.city = this._join([\n\t\t\tparts.village,\n\t\t\tparts.town,\n\t\t\tparts.city_district,\n\t\t\tparts.city,\n\t\t]);\n\n\t\tthis.postcode = parts.postcode;\n\t\tthis.county = parts.county;\n\n\t\tthis.state = this._join([\n\t\t\tparts.state_district,\n\t\t\tparts.state,\n\t\t]);\n\n\t\tthis.country = parts.country;\n\t}\n\n\t/**\n\t * Parse Mapbox parts\n\t *\n\t * @param parts\n\t * @private\n\t */\n\t_mapbox (parts) {\n\t\tif (!parts.context) {\n\t\t\tthis.number   = null;\n\t\t\tthis.address  = null;\n\t\t\tthis.city     = null;\n\t\t\tthis.postcode = null;\n\t\t\tthis.county   = null;\n\t\t\tthis.state    = null;\n\t\t\tthis.country  = null;\n\t\t\treturn;\n\t\t}\n\n\t\tparts = parts.context.reduce((a, part) => {\n\t\t\tconst key = part.id.split('.')[0];\n\t\t\ta[key] = part.text;\n\n\t\t\treturn a;\n\t\t}, {\n\t\t\tnumber: parts.address,\n\t\t\t[parts.place_type[0]]: parts.text,\n\t\t});\n\n\t\tthis.number   = parts.number;\n\t\tthis.address  = parts.address;\n\t\tthis.city     = parts.place;\n\t\tthis.postcode = parts.postcode;\n\t\tthis.county   = parts.district;\n\t\tthis.state    = parts.region;\n\t\tthis.country  = parts.country;\n\t}\n\n\t/**\n\t * Parse Google Maps parts\n\t *\n\t * @param parts\n\t * @private\n\t */\n\t_google (parts) {\n\t\tif (Array.isArray(parts)) {\n\t\t\tparts = parts.reduce((a, part) => {\n\t\t\t\tconst key = part.types[0];\n\t\t\t\ta[key]    = part.long_name;\n\n\t\t\t\treturn a;\n\t\t\t}, {});\n\t\t}\n\n\t\tthis.number = this._join([\n\t\t\tparts.subpremise,\n\t\t\tparts.premise,\n\t\t\tparts.street_number,\n\t\t]);\n\n\t\tthis.address = this._join([\n\t\t\tparts.route,\n\t\t\tparts.neighborhood,\n\t\t\tparts.sublocality_level_5,\n\t\t\tparts.sublocality_level_4,\n\t\t\tparts.sublocality_level_3,\n\t\t\tparts.sublocality_level_2,\n\t\t\tparts.sublocality_level_1,\n\t\t\tparts.sublocality,\n\t\t]);\n\n\t\tthis.city = this._join([\n\t\t\tparts.postal_town,\n\t\t\tparts.locality,\n\t\t]);\n\n\t\tthis.postcode = parts.postal_code || parts.postal_code_prefix;\n\t\tthis.county = parts.administrative_area_level_2;\n\t\tthis.state = parts.administrative_area_level_1;\n\t\tthis.country = parts.country;\n\t}\n\n\t/**\n\t * Parse Here parts\n\t *\n\t * @param parts\n\t * @private\n\t */\n\t_here (parts) {\n\t\tparts = {\n\t\t\t...parts,\n\t\t\t...parts.additionalData.reduce((a, b) => {\n\t\t\t\ta[b.key] = b.value;\n\t\t\t\treturn a;\n\t\t\t}, {}),\n\t\t};\n\n\t\tdelete parts.additionalData;\n\n\t\tthis.number = parts.houseNumber || '';\n\t\tthis.address = this._join([\n\t\t\tparts.street,\n\t\t\tparts.district,\n\t\t]);\n\t\tthis.city = parts.city || '';\n\t\tthis.postcode = parts.postalCode || '';\n\t\tthis.county = parts.CountyName || parts.county || '';\n\t\tthis.state = parts.StateName || parts.state || '';\n\t\tthis.country = parts.CountryName || parts.country || '';\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Filters and joins the given array\n\t *\n\t * @param {array} parts\n\t * @return {string}\n\t * @private\n\t */\n\t_join (parts) {\n\t\treturn parts.filter(Boolean).join(', ');\n\t}\n\n}\n"
  },
  {
    "path": "resources/src/models/PartsLegacy.js",
    "content": "/* eslint-disable camelcase */\n\nimport Parts from './Parts';\nimport GeoService from '../enums/GeoService';\n\nexport default class PartsLegacy extends Parts {\n\n\t// Properties\n\t// =========================================================================\n\n\tadministrative_area_level_1 = '';\n\tadministrative_area_level_2 = '';\n\tadministrative_area_level_3 = '';\n\tadministrative_area_level_4 = '';\n\tadministrative_area_level_5 = '';\n\tairport = '';\n\tbus_station = '';\n\tcolloquial_area = '';\n\testablishment = '';\n\tfloor = '';\n\tintersection = '';\n\tlocality = '';\n\tnatural_feature = '';\n\tneighborhood = '';\n\tpark = '';\n\tparking = '';\n\tpoint_of_interest = '';\n\tpolitical = '';\n\tpost_box = '';\n\tpostal_code = '';\n\tpostal_code_prefix = '';\n\tpostal_town = '';\n\tpremise = '';\n\troom = '';\n\troute = '';\n\tstreet_address = '';\n\tstreet_number = '';\n\tsublocality = '';\n\tsublocality_level_1 = '';\n\tsublocality_level_2 = '';\n\tsublocality_level_3 = '';\n\tsublocality_level_4 = '';\n\tsublocality_level_5 = '';\n\tsubpremise = '';\n\ttrain_station = '';\n\ttransit_station = '';\n\n\tadministrative_area_level_1_short = '';\n\tadministrative_area_level_2_short = '';\n\tadministrative_area_level_3_short = '';\n\tadministrative_area_level_4_short = '';\n\tadministrative_area_level_5_short = '';\n\tairport_short = '';\n\tbus_station_short = '';\n\tcolloquial_area_short = '';\n\testablishment_short = '';\n\tfloor_short = '';\n\tintersection_short = '';\n\tlocality_short = '';\n\tnatural_feature_short = '';\n\tneighborhood_short = '';\n\tpark_short = '';\n\tparking_short = '';\n\tpoint_of_interest_short = '';\n\tpolitical_short = '';\n\tpost_box_short = '';\n\tpostal_code_short = '';\n\tpostal_code_prefix_short = '';\n\tpostal_town_short = '';\n\tpremise_short = '';\n\troom_short = '';\n\troute_short = '';\n\tstreet_address_short = '';\n\tstreet_number_short = '';\n\tsublocality_short = '';\n\tsublocality_level_1_short = '';\n\tsublocality_level_2_short = '';\n\tsublocality_level_3_short = '';\n\tsublocality_level_4_short = '';\n\tsublocality_level_5_short = '';\n\tsubpremise_short = '';\n\ttrain_station_short = '';\n\ttransit_station_short = '';\n\n\tconstructor (parts = {}) {\n\t\tsuper(parts, GeoService.GoogleMaps);\n\n\t\tif (Array.isArray(parts)) {\n\t\t\tparts = parts.reduce((a, part) => {\n\t\t\t\tconst key = part.types[0];\n\t\t\t\ta[key]    = part.long_name;\n\n\t\t\t\treturn a;\n\t\t\t}, {});\n\t\t}\n\n\t\tObject.keys(parts).forEach(key => {\n\t\t\tthis[key] = parts[key];\n\t\t});\n\t}\n\n}\n"
  },
  {
    "path": "resources/vue.config.js",
    "content": "module.exports = {\n\tfilenameHashing: false,\n\toutputDir: '../src/web/assets/map',\n\tdevServer: {\n\t\thttps: true,\n\t\theaders: { \"Access-Control-Allow-Origin\": \"*\" },\n\t\tdisableHostCheck: true,\n\t\tport: 8080,\n\t},\n\tconfigureWebpack: config => {\n\t\tconfig.output.library = 'EtherMaps';\n\t\t// config.plugins.push(\n\t\t// \tnew require('webpack-bundle-analyzer').BundleAnalyzerPlugin()\n\t\t// );\n\t},\n};\n"
  },
  {
    "path": "src/SimpleMap.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap;\n\nuse Craft;\nuse craft\\base\\Model;\nuse craft\\base\\Plugin;\nuse craft\\events\\RegisterComponentTypesEvent;\nuse craft\\events\\RegisterGqlTypesEvent;\nuse craft\\events\\RegisterUrlRulesEvent;\nuse craft\\helpers\\UrlHelper;\nuse craft\\services\\Fields;\nuse craft\\services\\Gql;\nuse craft\\web\\Application;\nuse craft\\web\\twig\\variables\\CraftVariable;\nuse craft\\web\\UrlManager;\nuse craft\\wpimport\\Command as WpImportCommand;\nuse ether\\simplemap\\acfadapters\\GoogleMap as GoogleMapAcfAdapter;\nuse ether\\simplemap\\fields\\MapField as MapField;\nuse ether\\simplemap\\integrations\\feedme\\FeedMeMaps;\nuse ether\\simplemap\\integrations\\graphql\\MapPartsType;\nuse ether\\simplemap\\integrations\\graphql\\MapType;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\services\\EmbedService;\nuse ether\\simplemap\\services\\GeoLocationService;\nuse ether\\simplemap\\services\\MapService;\nuse ether\\simplemap\\services\\StaticService;\nuse ether\\simplemap\\web\\Variable;\nuse Exception;\nuse yii\\base\\Event;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class SimpleMap\n *\n * @author  Ether Creative\n * @package ether\\simplemap\n * @property MapService $map\n * @property StaticService $static\n * @property EmbedService $embed\n * @property GeoLocationService $geolocation\n */\nclass SimpleMap extends Plugin\n{\n\n\tconst EDITION_LITE = 'lite';\n\tconst EDITION_PRO = 'pro';\n\n\t// Properties\n\t// =========================================================================\n\n\tpublic bool $hasCpSettings = true;\n\n\t// Static\n\t// =========================================================================\n\n\tpublic static function editions (): array\n\t{\n\t\treturn [\n\t\t\tself::EDITION_LITE,\n\t\t\tself::EDITION_PRO,\n\t\t];\n\t}\n\n\t// Craft\n\t// =========================================================================\n\n\tpublic function init ()\n\t{\n\t\tparent::init();\n\n\t\tCraft::setAlias(\n\t\t\t'simplemap',\n\t\t\t__DIR__\n\t\t);\n\n\t\tCraft::setAlias(\n\t\t\t'simplemapimages',\n\t\t\t__DIR__ . '/web/assets/imgs'\n\t\t);\n\n\t\t$this->setComponents([\n\t\t\t'map' => MapService::class,\n\t\t\t'static' => StaticService::class,\n\t\t\t'embed' => EmbedService::class,\n\t\t\t'geolocation' => GeoLocationService::class,\n\t\t]);\n\n\t\tEvent::on(\n\t\t\tUrlManager::class,\n\t\t\tUrlManager::EVENT_REGISTER_CP_URL_RULES,\n\t\t\t[$this, 'onRegisterCPUrlRules']\n\t\t);\n\n\t\tEvent::on(\n\t\t\tFields::class,\n\t\t\tFields::EVENT_REGISTER_FIELD_TYPES,\n\t\t\t[$this, 'onRegisterFieldTypes']\n\t\t);\n\n\t\tEvent::on(\n\t\t\tCraftVariable::class,\n\t\t\tCraftVariable::EVENT_INIT,\n\t\t\t[$this, 'onRegisterVariable']\n\t\t);\n\n\t\tif (class_exists(Gql::class))\n\t\t{\n\t\t\tEvent::on(\n\t\t\t\tGql::class,\n\t\t\t\tGql::EVENT_REGISTER_GQL_TYPES,\n\t\t\t\t[$this, 'onRegisterGqlTypes']\n\t\t\t);\n\t\t}\n\n\t\tif (class_exists(\\craft\\feedme\\Plugin::class))\n\t\t{\n\t\t\tEvent::on(\n\t\t\t\t\\craft\\feedme\\services\\Fields::class,\n\t\t\t\t\\craft\\feedme\\services\\Fields::EVENT_REGISTER_FEED_ME_FIELDS,\n\t\t\t\t[$this, 'onRegisterFeedMeFields']\n\t\t\t);\n\t\t}\n\n\t\t$request = Craft::$app->getRequest();\n\t\tif (\n\t\t\t!$request->getIsConsoleRequest()\n\t\t\t&& $request->getMethod() === 'GET'\n\t\t\t&& $request->getIsSiteRequest()\n\t\t\t&& !$request->getIsPreview()\n\t\t\t&& !$request->getIsActionRequest()\n\t\t) {\n\t\t\tEvent::on(\n\t\t\t\tApplication::class,\n\t\t\t\tApplication::EVENT_INIT,\n\t\t\t\t[$this, 'onApplicationInit']\n\t\t\t);\n\t\t}\n\n\t\tif (class_exists(WpImportCommand::class)) {\n\t\t\tEvent::on(\n\t\t\t\tWpImportCommand::class,\n\t\t\t\tWpImportCommand::EVENT_REGISTER_ACF_ADAPTERS,\n\t\t\t\tstatic function (RegisterComponentTypesEvent $event) {\n\t\t\t\t\t$event->types[] = GoogleMapAcfAdapter::class;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected function beforeUninstall (): void\n\t{\n\t\tif ($this->getSettings()->geoLocationService === GeoLocationService::MaxMindLite)\n\t\t\tGeoLocationService::purgeDb();\n\t}\n\n\t// Settings\n\t// =========================================================================\n\n\tprotected function createSettingsModel (): Model\n\t{\n\t\treturn new Settings();\n\t}\n\n\t/**\n\t * @return Model\n\t */\n\tpublic function getSettings (): Model\n\t{\n\t\treturn parent::getSettings();\n\t}\n\n\tprotected function settingsHtml (): ?string\n\t{\n\t\t// Redirect to our settings page\n\t\tCraft::$app->controller->redirect(\n\t\t\tUrlHelper::cpUrl('maps/settings')\n\t\t);\n\n\t\treturn null;\n\t}\n\n\tpublic function afterSaveSettings (): void\n\t{\n\t\tparent::afterSaveSettings();\n\n\t\t$service = $this->getSettings()->geoLocationService;\n\n\t\tif ($service !== GeoLocationService::MaxMindLite)\n\t\t\tGeoLocationService::purgeDb();\n\t\telse if (!GeoLocationService::dbExists())\n\t\t\tGeoLocationService::dbQueueDownload();\n\t}\n\n\t// Events\n\t// =========================================================================\n\n\tpublic function onRegisterCPUrlRules (RegisterUrlRulesEvent $event)\n\t{\n\t\t$event->rules['maps/settings'] = 'simplemap/settings';\n\t}\n\n\tpublic function onRegisterFieldTypes (RegisterComponentTypesEvent $event)\n\t{\n\t\t$event->types[] = MapField::class;\n\t}\n\n\t/**\n\t * @param Event $event\n\t *\n\t * @throws InvalidConfigException\n\t */\n\tpublic function onRegisterVariable (Event $event)\n\t{\n\t\t/** @var CraftVariable $variable */\n\t\t$variable = $event->sender;\n\t\t$variable->set('simpleMap', Variable::class);\n\t\t$variable->set('maps', Variable::class);\n\t}\n\n\tpublic function onRegisterFeedMeFields (\\craft\\feedme\\events\\RegisterFeedMeFieldsEvent $event)\n\t{\n\t\t$event->fields[] = FeedMeMaps::class;\n\t}\n\n\tpublic function onRegisterGqlTypes (RegisterGqlTypesEvent $event)\n\t{\n\t\t$event->types[] = MapType::class;\n\t\t$event->types[] = MapPartsType::class;\n\t}\n\n\t/**\n\t * @throws Exception\n\t */\n\tpublic function onApplicationInit ()\n\t{\n\t\tif ($this->getSettings()->geoLocationAutoRedirect)\n\t\t\t$this->geolocation->redirect();\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tpublic static function t ($message, $params = []): string\n\t{\n\t\treturn Craft::t('simplemap', $message, $params);\n\t}\n\n\tpublic static function v ($version, $operator = '='): bool\n\t{\n\t\treturn SimpleMap::getInstance()->is($version, $operator);\n\t}\n\n}\n"
  },
  {
    "path": "src/acfadapters/GoogleMap.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2024 Ether Creative\n */\n\nnamespace ether\\simplemap\\acfadapters;\n\nuse craft\\base\\FieldInterface;\nuse craft\\wpimport\\BaseAcfAdapter;\nuse ether\\simplemap\\fields\\MapField;\n\n/**\n * Class GoogleMap\n *\n * @author  Ether Creative\n * @author  Brandon Kelly\n * @package ether\\simplemap\\acfadapters\n */\nclass GoogleMap extends BaseAcfAdapter\n{\n\tpublic static function type(): string\n\t{\n\t\treturn 'google_map';\n\t}\n\n\tpublic function create(array $data): FieldInterface\n\t{\n\t\t$field = new MapField();\n\t\tif ($data['center_lat']) {\n\t\t\t$field->lat = $data['center_lat'];\n\t\t}\n\t\tif ($data['center_lng']) {\n\t\t\t$field->lng = $data['center_lng'];\n\t\t}\n\t\tif ($data['zoom']) {\n\t\t\t$field->zoom = $data['zoom'];\n\t\t}\n\t\treturn $field;\n\t}\n\n\tpublic function normalizeValue(mixed $value, array $data): mixed\n\t{\n\t\treturn [\n\t\t\t'address' => $value['address'],\n\t\t\t'lat' => $value['lat'],\n\t\t\t'lng' => $value['lng'],\n\t\t\t'zoom' => $value['zoom'],\n\t\t\t'parts' => [\n\t\t\t\t'number' => $value['street_number'],\n\t\t\t\t'address' => $value['street_name'],\n\t\t\t\t'city' => $value['city'],\n\t\t\t\t'postcode' => $value['post_code'],\n\t\t\t\t'state' => $value['state'],\n\t\t\t\t'country' => $value['country'],\n\t\t\t\t'administrative_area_level_1' => $value['state'],\n\t\t\t\t'locality' => $value['city'],\n\t\t\t\t'postal_code' => $value['post_code'],\n\t\t\t\t'route' => $value['street_name'],\n\t\t\t\t'street_number' => $value['street_number'],\n\t\t\t],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/config.php",
    "content": "<?php\n\nuse ether\\simplemap\\enums\\GeoService;\nuse ether\\simplemap\\enums\\MapTiles;\n\nreturn [\n\t'mapTiles' => MapTiles::Wikimedia,\n\t'mapToken' => '',\n\n\t'geoService' => GeoService::Nominatim,\n\t'geoToken' => '',\n\n\t'w3wToken' => '',\n];\n"
  },
  {
    "path": "src/controllers/SettingsController.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\controllers;\n\nuse craft\\web\\Controller;\nuse ether\\simplemap\\enums\\GeoService;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\services\\GeoLocationService;\nuse ether\\simplemap\\SimpleMap;\nuse yii\\web\\Response as YiiResponse;\n\n/**\n * Class SettingsController\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\controllers\n */\nclass SettingsController extends Controller\n{\n\n\tpublic function actionIndex (): YiiResponse\n\t{\n\t\treturn $this->renderTemplate(\n\t\t\t'simplemap/settings',\n\t\t\t[\n\t\t\t\t'isLite'             => SimpleMap::v(SimpleMap::EDITION_LITE),\n\t\t\t\t'settings'           => SimpleMap::getInstance()->getSettings(),\n\t\t\t\t'mapTileOptions'     => MapTiles::getSelectOptions(),\n\t\t\t\t'geoServiceOptions'  => GeoService::getSelectOptions(),\n\t\t\t\t'geoLocationOptions' => GeoLocationService::getSelectOptions(),\n\t\t\t]\n\t\t);\n\t}\n\n}\n"
  },
  {
    "path": "src/controllers/StaticController.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\controllers;\n\nuse Craft;\nuse craft\\web\\Controller;\nuse ether\\simplemap\\utilities\\StaticMap;\nuse Exception;\nuse Yii;\nuse yii\\web\\BadRequestHttpException;\n\n/**\n * Class StaticController\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\controllers\n */\nclass StaticController extends Controller\n{\n\n\tprotected int|bool|array $allowAnonymous = true;\n\n\t/**\n\t * @throws BadRequestHttpException\n\t * @throws Exception\n\t */\n\tpublic function actionIndex ()\n\t{\n\t\t$request = Craft::$app->getRequest();\n\n\t\tif (!$request->validateCsrfToken($request->getRequiredQueryParam('csrf')))\n\t\t\tthrow new BadRequestHttpException(Yii::t('yii', 'Unable to verify your data submission.'));\n\n\t\treturn (new StaticMap(\n\t\t\t$request->getRequiredQueryParam('lat'),\n\t\t\t$request->getRequiredQueryParam('lng'),\n\t\t\t$request->getRequiredQueryParam('width'),\n\t\t\t$request->getRequiredQueryParam('height'),\n\t\t\t$request->getRequiredQueryParam('zoom'),\n\t\t\t$request->getRequiredQueryParam('scale'),\n\t\t\t$request->getQueryParam('markers')\n\t\t))->render();\n\t}\n\n}\n"
  },
  {
    "path": "src/enums/GeoService.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\enums;\n\nuse ether\\simplemap\\SimpleMap;\n\n/**\n * Class GeoService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\enums\n */\nabstract class GeoService\n{\n\n\t// Consts\n\t// =========================================================================\n\n\t// Open Source\n\t// -------------------------------------------------------------------------\n\n\t// https://operations.osmfoundation.org/policies/nominatim/\n\tconst Nominatim = 'nominatim';\n\n\t// Requires API Key (Token)\n\t// -------------------------------------------------------------------------\n\n\tconst Mapbox = 'mapbox';\n\n\tconst GoogleMaps = 'google';\n\n\tconst AppleMapKit = 'apple';\n\n\tconst Here = 'here';\n\n\t// Helpers\n\t// =========================================================================\n\n\tpublic static function getSelectOptions (): array\n\t{\n\t\t$isLite = SimpleMap::v(SimpleMap::EDITION_LITE);\n\n\t\treturn [\n\t\t\t[ 'optgroup' => SimpleMap::t('Open Source') ],\n\n\t\t\tself::Nominatim => SimpleMap::t('Nominatim'),\n\n\t\t\t[ 'optgroup' => SimpleMap::t('Requires API Key (Token)') ],\n\n\t\t\tself::GoogleMaps => SimpleMap::t('Google Maps'),\n\t\t\tself::Mapbox => MapTiles::pro('Mapbox', $isLite),\n\n\t\t\t// MapKit lacks both separate address parts and country restriction\n\t\t\t// on the front-end, and any sort of server-side API, so it's\n\t\t\t// disabled for now.\n//\t\t\tself::AppleMapKit => MapTiles::pro('Apple MapKit', $isLite),\n\n\t\t\tself::Here => MapTiles::pro('Here', $isLite),\n\t\t];\n\t}\n\n}\n"
  },
  {
    "path": "src/enums/MapTiles.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\enums;\n\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\SimpleMap;\nuse ether\\simplemap\\services\\GeoService;\nuse Exception;\n\n/**\n * Class MapTiles\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\enums\n */\nabstract class MapTiles\n{\n\n\t// Consts\n\t// =========================================================================\n\n\t// Open Source\n\t// -------------------------------------------------------------------------\n\n\t// Wikimedia\n\t// https://foundation.wikimedia.org/wiki/Maps_Terms_of_Use\n\t// No longer available, falling back to osm in MapField.php::_renderMap\n\tconst Wikimedia = 'wikimedia';\n\n\t// OpenStreetMaps\n\t// https://operations.osmfoundation.org/policies/tiles/\n\tconst OpenStreetMap = 'openstreetmap';\n\n\t// Carto\n\t// https://github.com/CartoDB/basemap-styles\n\tconst CartoVoyager = 'carto.rastertiles/voyager';\n\tconst CartoPositron = 'carto.light_all';\n\tconst CartoDarkMatter = 'carto.dark_all';\n\n\t// Requires API Key (Token)\n\t// -------------------------------------------------------------------------\n\n\t// Mapbox\n\tconst MapboxOutdoors = 'mapbox.outdoors';\n\tconst MapboxStreets = 'mapbox.streets';\n\tconst MapboxLight = 'mapbox.light';\n\tconst MapboxDark = 'mapbox.dark';\n\n\t// Google Maps\n\tconst GoogleRoadmap = 'google.roadmap';\n\tconst GoogleTerrain = 'google.terrain';\n\tconst GoogleHybrid = 'google.hybrid';\n\n\t// Apple MapKit\n\tconst MapKitStandard      = 'mapkit.standard';\n\tconst MapKitMutedStandard = 'mapkit.muted';\n\tconst MapKitSatellite     = 'mapkit.satellite';\n\tconst MapKitHybrid        = 'mapkit.hybrid';\n\n\t// Here\n\tconst HereNormalDay        = 'here.normal.day';\n\tconst HereNormalDayGrey    = 'here.normal.day.grey';\n\tconst HereNormalDayTransit = 'here.normal.day.transit';\n\tconst HereReduced          = 'here.reduced.day';\n\tconst HerePedestrian       = 'here.pedestrian.day';\n\tconst HereTerrain          = 'here.terrain.day';\n\tconst HereSatellite        = 'here.satellite.day';\n\tconst HereHybrid           = 'here.hybrid.day';\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic static function getSelectOptions (): array\n\t{\n\t\t$isLite = SimpleMap::v(SimpleMap::EDITION_LITE);\n\n\t\treturn [\n\t\t\t['optgroup' => SimpleMap::t('Open Source')],\n\n//\t\t\tself::Wikimedia => SimpleMap::t('Wikimedia'),\n\n\t\t\tself::OpenStreetMap => SimpleMap::t('OpenStreetMap'),\n\n\t\t\tself::CartoVoyager    => SimpleMap::t('Carto: Voyager'),\n\t\t\tself::CartoPositron   => SimpleMap::t('Carto: Positron'),\n\t\t\tself::CartoDarkMatter => SimpleMap::t('Carto: Dark Matter'),\n\n\t\t\t['optgroup' => SimpleMap::t('Requires API Key (Token)')],\n\n\t\t\tself::GoogleRoadmap => SimpleMap::t('Google Maps: Roadmap'),\n\t\t\tself::GoogleTerrain => SimpleMap::t('Google Maps: Terrain'),\n\t\t\tself::GoogleHybrid  => SimpleMap::t('Google Maps: Hybrid'),\n\n\t\t\tself::MapboxOutdoors => self::pro('Mapbox: Outdoors', $isLite),\n\t\t\tself::MapboxStreets  => self::pro('Mapbox: Streets', $isLite),\n\t\t\tself::MapboxLight    => self::pro('Mapbox: Light', $isLite),\n\t\t\tself::MapboxDark     => self::pro('Mapbox: Dark', $isLite),\n\n\t\t\tself::MapKitStandard       => self::pro('Apple MapKit: Standard', $isLite),\n\t\t\tself::MapKitMutedStandard  => self::pro('Apple MapKit: Muted Standard', $isLite),\n\t\t\tself::MapKitSatellite      => self::pro('Apple MapKit: Satellite', $isLite),\n\t\t\tself::MapKitHybrid         => self::pro('Apple MapKit: Hybrid', $isLite),\n\n\t\t\tself::HereNormalDay        => self::pro('Here: Normal Day', $isLite),\n\t\t\tself::HereNormalDayGrey    => self::pro('Here: Normal Day Grey', $isLite),\n\t\t\tself::HereNormalDayTransit => self::pro('Here: Normal Day Transit', $isLite),\n\t\t\tself::HereReduced          => self::pro('Here: Reduced', $isLite),\n\t\t\tself::HerePedestrian       => self::pro('Here: Pedestrian', $isLite),\n\t\t\tself::HereTerrain          => self::pro('Here: Terrain', $isLite),\n\t\t\tself::HereSatellite        => self::pro('Here: Satellite', $isLite),\n\t\t\tself::HereHybrid           => self::pro('Here: Hybrid', $isLite),\n\t\t];\n\t}\n\n\t/**\n\t * Get the tiles url for the given type and scale\n\t *\n\t * @param string $type\n\t * @param int    $scale\n\t *\n\t * @return array\n\t * @throws Exception\n\t */\n\tpublic static function getTiles (string $type, int $scale = 1): array\n\t{\n\t\t$scale = $scale == 1 ? '.png' : '@2x.png';\n\t\t$style = str_contains($type, '.') ? explode('.', $type, 2)[1] : '';\n\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase self::Wikimedia:\n\t\t\t\treturn [\n\t\t\t\t\t'url' => 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}' . $scale,\n\t\t\t\t\t'size' => 512,\n\t\t\t\t];\n\t\t\tcase self::OpenStreetMap:\n\t\t\t\treturn [\n\t\t\t\t\t'url' => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',\n\t\t\t\t\t'size' => 256,\n\t\t\t\t];\n\t\t\tcase self::CartoVoyager:\n\t\t\tcase self::CartoPositron:\n\t\t\tcase self::CartoDarkMatter:\n\t\t\t\treturn [\n\t\t\t\t\t'url' => 'https://a.basemaps.cartocdn.com/' . $style . '/{z}/{x}/{y}' . $scale,\n\t\t\t\t\t'size' => 256,\n\t\t\t\t];\n\t\t}\n\n\t\tthrow new Exception('Unknown tile type \"' . $type . '\"');\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tpublic static function pro ($label, $isLite): array\n\t{\n\t\treturn [\n\t\t\t'label'    => SimpleMap::t($label) . ($isLite ? ' (Pro)' : ''),\n\t\t\t'disabled' => $isLite,\n\t\t];\n\t}\n\n}\n"
  },
  {
    "path": "src/fields/MapField.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\fields;\n\nuse Craft;\nuse craft\\base\\Element;\nuse craft\\base\\ElementInterface;\nuse craft\\base\\Event;\nuse craft\\base\\Field;\nuse craft\\base\\PreviewableFieldInterface;\nuse craft\\elements\\db\\ElementQuery;\nuse craft\\elements\\db\\ElementQueryInterface;\nuse craft\\errors\\InvalidFieldException;\nuse craft\\events\\CancelableEvent;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\enums\\GeoService as GeoEnum;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\integrations\\graphql\\MapType;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\services\\GeoService;\nuse ether\\simplemap\\SimpleMap;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\web\\assets\\MapAsset;\nuse Exception;\nuse GraphQL\\Type\\Definition\\Type;\nuse Throwable;\nuse Twig\\Error\\LoaderError;\nuse Twig\\Error\\RuntimeError;\nuse Twig\\Error\\SyntaxError;\nuse Twig\\Markup;\nuse yii\\base\\InvalidConfigException;\nuse yii\\db\\ExpressionInterface;\nuse yii\\db\\Schema;\n\n/**\n * Class Map\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\fields\n */\nclass MapField extends Field implements PreviewableFieldInterface\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/**\n\t * @var float - The maps latitude\n\t */\n\tpublic float $lat = 51.272154;\n\n\t/**\n\t * @var float - The maps longitude\n\t */\n\tpublic float $lng = 0.514951;\n\n\t/**\n\t * @var int - The maps zoom level\n\t */\n\tpublic int $zoom = 15;\n\n\t/**\n\t * @var float - The maps min zoom level (how far OUT it can be zoomed)\n\t */\n\tpublic float $minZoom = 3;\n\n\t/**\n\t * @var float - The maps max zoom level (how far IN it can be zoomed)\n\t */\n\tpublic float $maxZoom = 18;\n\n\t/**\n\t * @var string|null - The preferred country when searching\n\t */\n\tpublic ?string $country = null;\n\n\t/**\n\t * @var bool - If true, the location search will not be displayed\n\t */\n\tpublic bool $hideSearch = false;\n\n\t/**\n\t * @var bool - If true, the map will not be displayed\n\t */\n\tpublic bool $hideMap = false;\n\n\t/**\n\t * @var bool - If true, the address fields will not be displayed\n\t */\n\tpublic bool $hideAddress = false;\n\n\t/**\n\t * @var bool - If true, show the lat/lng fields\n\t */\n\tpublic bool $showLatLng = false;\n\n\t/**\n\t * @var bool - If true, will show a button to centre the map on the users\n\t *   current location.\n\t */\n\tpublic bool $showCurrentLocation = false;\n\n\t/**\n\t * @var string - The size of the field\n\t *   (can be either \"normal\", \"mini\")\n\t */\n\tpublic string $size = 'normal';\n\n\t/**\n\t * @var bool - Will show the what3words overlay when true\n\t */\n\tpublic bool $showW3WGrid = false;\n\n\t/**\n\t * @var bool - Show the what3words field on the map field\n\t */\n\tpublic bool $showW3WField = false;\n\n\t/**\n\t * @deprecated\n\t */\n\tpublic $hideLatLng;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $height;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $countryRestriction;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $typeRestriction;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $boundaryRestrictionNELat;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $boundaryRestrictionNELng;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $boundaryRestrictionSWLat;\n\t/**\n\t * @deprecated\n\t */\n\tpublic $boundaryRestrictionSWLng;\n\t/**\n\t * @deprecated\n\t */\n\tpublic string $boundary = '\"\"';\n\n\tprivate static $searchParams = null;\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function init(): void\n\t{\n\t\tEvent::on(\n\t\t\tElementQuery::class,\n\t\t\tElementQuery::EVENT_AFTER_PREPARE,\n\t\t\t[$this, 'afterPrepareElementQuery'],\n\t\t);\n\n\t\tparent::init();\n\t}\n\n\t// Methods: Static\n\t// -------------------------------------------------------------------------\n\n\tpublic static function displayName (): string\n\t{\n\t\treturn SimpleMap::t('Map');\n\t}\n\n\tpublic static function hasContentColumn (): bool\n\t{\n\t\treturn true;\n\t}\n\n\tpublic static function icon (): string\n\t{\n\t\treturn 'map-pin';\n\t}\n\n\tpublic function getContentColumnType (): string\n\t{\n\t\treturn Schema::TYPE_TEXT;\n\t}\n\n\tpublic static function supportedTranslationMethods (): array\n\t{\n\t\treturn [\n\t\t\tself::TRANSLATION_METHOD_NONE,\n\t\t\tself::TRANSLATION_METHOD_SITE,\n\t\t\tself::TRANSLATION_METHOD_SITE_GROUP,\n\t\t\tself::TRANSLATION_METHOD_LANGUAGE,\n\t\t\tself::TRANSLATION_METHOD_CUSTOM,\n\t\t];\n\t}\n\n\tpublic static function queryCondition(array $instances, mixed $value, array &$params): array|string|ExpressionInterface|false|null\n\t{\n\t\tif (empty($instances) || empty($value))\n\t\t\treturn null;\n\n\t\tself::$searchParams = [\n\t\t\t'field' => $instances[0],\n\t\t\t'value' => $value,\n\t\t];\n\n\t\treturn null;\n\t}\n\n\t// Methods: Instance\n\t// -------------------------------------------------------------------------\n\n\tpublic function setCountryRestriction ($value)\n\t{\n\t\t$this->country = $value;\n\t}\n\n\tpublic function rules (): array\n\t{\n\t\t$rules = parent::rules();\n\n\t\t$rules[] = [\n\t\t\t['zoom', 'minZoom', 'maxZoom'],\n\t\t\t'required',\n\t\t];\n\n\t\t$rules[] = [\n\t\t\t['minZoom', 'maxZoom'],\n\t\t\t'double',\n\t\t\t'min' => 0,\n\t\t\t'max' => 18,\n\t\t];\n\n\t\t$rules[] = [\n\t\t\t['lat'],\n\t\t\t'double',\n\t\t\t'min' => -90,\n\t\t\t'max' => 90,\n\t\t];\n\n\t\t$rules[] = [\n\t\t\t['lng'],\n\t\t\t'double',\n\t\t\t'min' => -180,\n\t\t\t'max' => 180,\n\t\t];\n\n\t\treturn $rules;\n\t}\n\n\tpublic function normalizeValue (mixed $value, ElementInterface|Element $element = null): Map\n\t{\n\t\tif (is_string($value))\n\t\t\t$value = Json::decodeIfJson($value);\n\n\t\tif ($value instanceof Map)\n\t\t\t$map = $value;\n\t\telseif (is_array($value))\n\t\t\t$map = new Map($value);\n\t\telse\n\t\t\t$map = new Map([\n\t\t\t\t'lat'  => null,\n\t\t\t\t'lng'  => null,\n\t\t\t\t'zoom' => $this->zoom,\n\t\t\t]);\n\n\t\tSimpleMap::getInstance()->map->populateMissingData($map, $this);\n\n\t\t$map->fieldId = $this->id;\n\n\t\tif ($element)\n\t\t{\n\t\t\t$map->ownerId     = $element->id;\n\t\t\t$map->ownerSiteId = $element->siteId;\n\n\t\t\t$handle = $this->handle;\n\t\t\t$element->setFieldValue($handle, $map);\n\t\t}\n\n\t\treturn $map;\n\t}\n\n\tpublic function getSettingsHtml (): string\n\t{\n\t\t$value = new Map();\n\n\t\t$value->lat  = $this->lat;\n\t\t$value->lng  = $this->lng;\n\t\t$value->zoom = $this->zoom;\n\n\t\t$originalHandle              = $this->handle;\n\t\t$originalCountry             = $this->country;\n\t\t$originalHideSearch          = $this->hideSearch;\n\t\t$originalHideMap             = $this->hideMap;\n\t\t$originalHideAddress         = $this->hideAddress;\n\t\t$originalShowCurrentLocation = $this->showCurrentLocation;\n\t\t$originalSize                = $this->size;\n\t\t$originalShowW3WGrid         = $this->showW3WGrid;\n\t\t$originalShowW3WField        = $this->showW3WField;\n\n\t\t$this->handle              = '__settings__';\n\t\t$this->country             = null;\n\t\t$this->hideSearch          = false;\n\t\t$this->hideMap             = false;\n\t\t$this->hideAddress         = true;\n\t\t$this->showCurrentLocation = true;\n\t\t$this->size                = 'normal';\n\t\t$this->showW3WGrid         = false;\n\t\t$this->showW3WField        = false;\n\n\t\t$mapField = new Markup(\n\t\t\t$this->_renderMap($value, true),\n\t\t\t'utf-8'\n\t\t);\n\n\t\t$this->handle              = $originalHandle;\n\t\t$this->country             = $originalCountry;\n\t\t$this->hideSearch          = $originalHideSearch;\n\t\t$this->hideMap             = $originalHideMap;\n\t\t$this->hideAddress         = $originalHideAddress;\n\t\t$this->showCurrentLocation = $originalShowCurrentLocation;\n\t\t$this->size                = $originalSize;\n\t\t$this->showW3WGrid         = $originalShowW3WGrid;\n\t\t$this->showW3WField        = $originalShowW3WField;\n\n\t\t$view = Craft::$app->getView();\n\n\t\t$countries = array_merge([\n\t\t\t'*' => SimpleMap::t('All Countries'),\n\t\t], GeoService::$countries);\n\n\t\treturn $view->renderTemplate('simplemap/field-settings', [\n\t\t\t'map' => $mapField,\n\t\t\t'field' => $this,\n\t\t\t'countries' => $countries,\n\t\t\t'settings' => SimpleMap::getInstance()->getSettings(),\n\t\t]);\n\t}\n\n\tpublic function getInputHtml ($value = null, ElementInterface $element = null): string\n\t{\n\t\tif ($element !== null && $element->hasEagerLoadedElements($this->handle))\n\t\t\t$value = $element->getEagerLoadedElements($this->handle);\n\n\t\treturn new Markup(\n\t\t\t$this->_renderMap($value ?: new Map()),\n\t\t\t'utf-8'\n\t\t);\n\t}\n\n\tpublic function getTableAttributeHtml (mixed $value, ElementInterface $element): string\n\t{\n\t\treturn $this->normalizeValue($value, $element)->address;\n\t}\n\n\tpublic function isValueEmpty ($value, ElementInterface $element): bool\n\t{\n\t\treturn $this->normalizeValue($value)->isValueEmpty();\n\t}\n\n\t// GraphQl\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic function getContentGqlType (): Type|array\n\t{\n\t\treturn MapType::getType();\n\t}\n\n\tpublic function getContentGqlQueryArgumentType (): Type|array\n\t{\n\t\treturn MapType::getQueryType();\n\t}\n\n\tpublic function getContentGqlMutationArgumentType (): Type|array\n\t{\n\t\treturn MapType::getInputType();\n\t}\n\n\t// Methods: Events\n\t// -------------------------------------------------------------------------\n\n\tpublic function beforeSave (bool $isNew): bool\n\t{\n\t\t$this->lat  = (float) $this->lat;\n\t\t$this->lng  = (float) $this->lng;\n\t\t$this->zoom = (int) $this->zoom;\n\n\t\tif ($this->country === '*')\n\t\t\t$this->country = null;\n\n\t\treturn parent::beforeSave($isNew);\n\t}\n\n\tpublic function beforeElementSave (ElementInterface $element, bool $isNew): bool\n\t{\n\t\tif (!SimpleMap::getInstance()->map->validateField($this, $element))\n\t\t\treturn false;\n\n\t\treturn parent::beforeElementSave($element, $isNew);\n\t}\n\n\tpublic function afterElementSave (ElementInterface $element, bool $isNew): void\n\t{\n\t\tSimpleMap::getInstance()->map->saveField($this, $element);\n\n\t\tparent::afterElementSave($element, $isNew);\n\t}\n\n\tpublic function afterPrepareElementQuery (CancelableEvent $event): void\n\t{\n\t\tif (!self::$searchParams) return;\n\n\t\t/** @var ElementQueryInterface $query */\n\t\t$query = $event->sender;\n\n\t\tSimpleMap::getInstance()->map->modifyElementsQuery(\n\t\t\t$query,\n\t\t\tself::$searchParams['value'],\n\t\t\tself::$searchParams['field'],\n\t\t);\n\n\t\t// Clear search params to prevent it being applied to unrelated queries.\n\t\tself::$searchParams = null;\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Renders the map input\n\t *\n\t * @param Map  $value\n\t * @param bool $isSettings\n\t *\n\t * @return string\n\t * @throws InvalidConfigException\n\t */\n\tprivate function _renderMap (Map $value, bool $isSettings = false): string\n\t{\n\t\t$view = Craft::$app->getView();\n\n\t\t$containerId = 'map-' . $this->id . 'container';\n\t\t$vueContainerId = $view->namespaceInputId($containerId);\n\t\t$view->registerAssetBundle(MapAsset::class);\n\t\t$view->registerJs('new Vue({ el: \\'#' . $vueContainerId . '\\' });');\n\t\t$view->registerTranslations('simplemap', [\n\t\t\t'Search for a location',\n\t\t\t'Clear address',\n\t\t\t'Full Address',\n\t\t\t'Name / Number',\n\t\t\t'Street Address',\n\t\t\t'Town / City',\n\t\t\t'Postcode',\n\t\t\t'County',\n\t\t\t'State',\n\t\t\t'Country',\n\t\t\t'Latitude',\n\t\t\t'Longitude',\n\t\t\t'Zoom In',\n\t\t\t'Zoom Out',\n\t\t\t'Center on Marker',\n\t\t\t'Current Location',\n\t\t\t'No address selected',\n\t\t\t'what3words',\n\t\t]);\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\t$country = $this->country;\n\t\t// Convert ISO2 to ISO3 for Here autocomplete\n\t\tif ($country && $settings->geoService === GeoEnum::Here)\n\t\t\t$country = GeoService::$countriesIso3[$country];\n\n\t\t$tiles = $settings->mapTiles;\n\t\tif ($tiles === MapTiles::Wikimedia)\n\t\t\t$tiles = MapTiles::OpenStreetMap;\n\n\t\t$opts = [\n\t\t\t'config' => [\n\t\t\t\t'isSettings' => $isSettings,\n\n\t\t\t\t'name'                => $view->namespaceInputName($this->handle),\n\t\t\t\t'country'             => $country,\n\t\t\t\t'hideSearch'          => (bool) $this->hideSearch,\n\t\t\t\t'hideMap'             => (bool) $this->hideMap,\n\t\t\t\t'hideAddress'         => (bool) $this->hideAddress,\n\t\t\t\t'showLatLng'          => (bool) $this->showLatLng,\n\t\t\t\t'showCurrentLocation' => (bool) $this->showCurrentLocation,\n\t\t\t\t'minZoom'             => $isSettings ? 0 : (float) $this->minZoom,\n\t\t\t\t'maxZoom'             => $isSettings ? 18 : (float) $this->maxZoom,\n\t\t\t\t'size'                => $this->size,\n\n\t\t\t\t'mapTiles' => $tiles,\n\t\t\t\t'mapToken' => GeoService::getToken(\n\t\t\t\t\t$settings->getMapToken(),\n\t\t\t\t\t$tiles\n\t\t\t\t),\n\n\t\t\t\t'geoService' => $settings->geoService,\n\t\t\t\t'geoToken'   => GeoService::getToken(\n\t\t\t\t\t$settings->getGeoToken(),\n\t\t\t\t\t$settings->geoService\n\t\t\t\t),\n\n\t\t\t\t'w3wEnabled'   => $settings->isW3WEnabled(),\n\t\t\t\t'showW3WGrid'  => (bool) $this->showW3WGrid,\n\t\t\t\t'showW3WField' => (bool) $this->showW3WField,\n\n\t\t\t\t'locale' => Craft::$app->locale->getLanguageID(),\n\t\t\t],\n\n\t\t\t'value' => [\n\t\t\t\t'address'    => $value->address,\n\t\t\t\t'lat'        => self::_parseFloat($value->lat),\n\t\t\t\t'lng'        => self::_parseFloat($value->lng),\n\t\t\t\t'zoom'       => $value->zoom,\n\t\t\t\t'parts'      => $value->parts,\n\t\t\t\t'what3words' => $value->what3words,\n\t\t\t],\n\n\t\t\t'defaultValue' => [\n\t\t\t\t'address'    => null,\n\t\t\t\t'lat'        => self::_parseFloat($this->lat),\n\t\t\t\t'lng'        => self::_parseFloat($this->lng),\n\t\t\t\t'zoom'       => $this->zoom,\n\t\t\t\t'parts'      => null,\n\t\t\t\t'what3words' => null,\n\t\t\t],\n\t\t];\n\n\t\t// Map Services\n\t\t// ---------------------------------------------------------------------\n\n\t\tif (str_contains($tiles, 'google'))\n\t\t{\n\t\t\tif ($settings->getMapToken() !== $settings->getGeoToken())\n\t\t\t{\n\t\t\t\t$view->registerJsFile(\n\t\t\t\t\t'https://maps.googleapis.com/maps/api/js?key=' .\n\t\t\t\t\t$settings->getMapToken()\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telseif (str_contains($tiles, 'mapkit'))\n\t\t{\n\t\t\t$view->registerJsFile(\n\t\t\t\t'https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js'\n\t\t\t);\n\t\t}\n\n\t\t// Geo Services\n\t\t// ---------------------------------------------------------------------\n\n\t\tif ($settings->geoService === GeoEnum::GoogleMaps)\n\t\t{\n\t\t\t$view->registerJsFile(\n\t\t\t\t'https://maps.googleapis.com/maps/api/js?libraries=places&key=' .\n\t\t\t\t$settings->getGeoToken()\n\t\t\t);\n\t\t}\n\t\telseif ($settings->geoService === GeoEnum::AppleMapKit)\n\t\t{\n\t\t\t$view->registerJsFile(\n\t\t\t\t'https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js'\n\t\t\t);\n\t\t}\n\n\t\t// what3words\n\t\t// ---------------------------------------------------------------------\n\n\t\tif ($settings->w3wEnabled && !empty($settings->getW3WToken()))\n\t\t{\n\t\t\t$view->registerJsFile(\n\t\t\t\t'https://assets.what3words.com/sdk/v3/what3words.js?key=' .\n\t\t\t\t$settings->getW3WToken()\n\t\t\t);\n\t\t}\n\n\t\t// ---------------------------------------------------------------------\n\n\t\t$options = preg_replace(\n\t\t\t'/\\'/',\n\t\t\t'&#039;',\n\t\t\tjson_encode($opts)\n\t\t);\n\n\t\tif ($this->size === 'normal')\n\t\t\t$children = '<div style=\"height:360px\"></div>';\n\t\telse\n\t\t\t$children = $value->address;\n\n\t\treturn '<div id=\"' . $containerId . '\"><simple-map options=\\'' . $options . '\\'>' . $children . '</simple-map></div>';\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Will cast the given value to a float if not null\n\t *\n\t * @param null $value\n\t *\n\t * @return float|null\n\t */\n\tprivate static function _parseFloat ($value = null): ?float\n\t{\n\t\tif ($value === null)\n\t\t\treturn null;\n\n\t\treturn (float) $value;\n\t}\n\n}\n"
  },
  {
    "path": "src/integrations/feedme/FeedMeMaps.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\integrations\\feedme;\n\nuse Cake\\Utility\\Hash;\nuse craft\\feedme\\base\\Field;\nuse craft\\feedme\\base\\FieldInterface;\nuse craft\\feedme\\helpers\\DataHelper;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\fields\\MapField;\nuse ether\\simplemap\\models\\Parts;\n\n/**\n * Class FeedMeMaps\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\integrations\\feedme\n */\nclass FeedMeMaps extends Field implements FieldInterface\n{\n\n\t// Properties\n\t// =========================================================================\n\n\tpublic static $name = 'Maps';\n\n\tpublic static $class = MapField::class;\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function getMappingTemplate (): string\n\t{\n\t\treturn 'simplemap/_feedme-mapping';\n\t}\n\n\tpublic function parseField (): ?Map\n\t{\n\t\t$preppedData = [];\n\n\t\t$fields = Hash::get($this->fieldInfo, 'fields');\n\n\t\tif (!$fields)\n\t\t\treturn null;\n\n\t\tforeach ($fields as $subFieldHandle => $subFieldInfo)\n\t\t{\n\t\t\tif ($subFieldHandle === 'parts') {\n\t\t\t\tforeach ($subFieldInfo as $handle => $info)\n\t\t\t\t\t$preppedData[$subFieldHandle][$handle] = DataHelper::fetchValue(\n\t\t\t\t\t\t$this->feedData,\n\t\t\t\t\t\t$info\n\t\t\t\t\t);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$preppedData[$subFieldHandle] = DataHelper::fetchValue(\n\t\t\t\t$this->feedData,\n\t\t\t\t$subFieldInfo\n\t\t\t);\n\t\t}\n\n\t\tif (isset($preppedData['parts']))\n\t\t\t$preppedData['parts'] = new Parts($preppedData['parts']);\n\n\t\tif (!$preppedData)\n\t\t\treturn null;\n\n\t\treturn new Map($preppedData);\n\t}\n\n}\n"
  },
  {
    "path": "src/integrations/graphql/MapPartsType.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\integrations\\graphql;\n\nuse craft\\gql\\GqlEntityRegistry;\nuse GraphQL\\Type\\Definition\\InputObjectType;\nuse GraphQL\\Type\\Definition\\InputType;\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n/**\n * Class MapPartsType\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\integrations\\graphql\n */\nclass MapPartsType\n{\n\n\tpublic static function getName (): string\n\t{\n\t\treturn 'Ether_MapParts';\n\t}\n\n\tpublic static function getFieldDefinitions (): array\n\t{\n\t\treturn [\n\t\t\t'number'        => [\n\t\t\t\t'name'        => 'number',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The address name / number.',\n\t\t\t],\n\t\t\t'address' => [\n\t\t\t\t'name'        => 'address',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The street address.',\n\t\t\t],\n\t\t\t'city'          => [\n\t\t\t\t'name'        => 'city',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The city.',\n\t\t\t],\n\t\t\t'postcode'      => [\n\t\t\t\t'name'        => 'postcode',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The postal code.',\n\t\t\t],\n\t\t\t'county'        => [\n\t\t\t\t'name'        => 'county',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The county.',\n\t\t\t],\n\t\t\t'state'         => [\n\t\t\t\t'name'        => 'state',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The state.',\n\t\t\t],\n\t\t\t'country'       => [\n\t\t\t\t'name'        => 'country',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The country.',\n\t\t\t],\n\t\t];\n\t}\n\n\tpublic static function getType (): Type\n\t{\n\t\tif ($type = GqlEntityRegistry::getEntity(static::class))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\tstatic::class,\n\t\t\tnew ObjectType(\n\t\t\t\t[\n\t\t\t\t\t'name'   => static::getName(),\n\t\t\t\t\t'fields' => static::class . '::getFieldDefinitions',\n\t\t\t\t]\n\t\t\t)\n\t\t);\n\t}\n\n\tpublic static function getInputType (): InputType\n\t{\n\t\t$name = static::class . 'Input';\n\n\t\tif ($type = GqlEntityRegistry::getEntity($name))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\t$name,\n\t\t\tnew InputObjectType([\n\t\t\t\t'name'   => static::getName() . 'Input',\n\t\t\t\t'fields' => static::class . '::getFieldDefinitions',\n\t\t\t])\n\t\t);\n\t}\n\n}\n"
  },
  {
    "path": "src/integrations/graphql/MapType.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\integrations\\graphql;\n\nuse craft\\gql\\GqlEntityRegistry;\nuse GraphQL\\Type\\Definition\\EnumType;\nuse GraphQL\\Type\\Definition\\InputObjectType;\nuse GraphQL\\Type\\Definition\\InputType;\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n/**\n * Class MapType\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\integrations\\graphql\n */\nclass MapType\n{\n\n\tpublic static function getName (): string\n\t{\n\t\treturn 'Ether_Map';\n\t}\n\n\tpublic static function getFieldDefinitions (): array\n\t{\n\t\treturn [\n\t\t\t'lat'      => [\n\t\t\t\t'name'        => 'lat',\n\t\t\t\t'type'        => Type::float(),\n\t\t\t\t'description' => 'The maps latitude.',\n\t\t\t],\n\t\t\t'lng'      => [\n\t\t\t\t'name'        => 'lng',\n\t\t\t\t'type'        => Type::float(),\n\t\t\t\t'description' => 'The maps longitude.',\n\t\t\t],\n\t\t\t'zoom'     => [\n\t\t\t\t'name'        => 'zoom',\n\t\t\t\t'type'        => Type::int(),\n\t\t\t\t'description' => 'The maps zoom level.',\n\t\t\t],\n\t\t\t'distance' => [\n\t\t\t\t'name'        => 'distance',\n\t\t\t\t'type'        => Type::float(),\n\t\t\t\t'description' => 'The distance to this location.',\n\t\t\t],\n\t\t\t'address'  => [\n\t\t\t\t'name'        => 'address',\n\t\t\t\t'type'        => Type::string(),\n\t\t\t\t'description' => 'The full address.',\n\t\t\t],\n\t\t\t'parts'    => [\n\t\t\t\t'name'        => 'parts',\n\t\t\t\t'type'        => MapPartsType::getType(),\n\t\t\t\t'description' => 'The maps address parts.',\n\t\t\t],\n\t\t];\n\t}\n\n\tpublic static function getInputDefinitions (): array\n\t{\n\t\t$fields = static::getFieldDefinitions();\n\n\t\tunset($fields['distance']);\n\t\t$fields['parts']['type'] = MapPartsType::getInputType();\n\n\t\treturn $fields;\n\t}\n\n\tpublic static function getQueryInputDefinitions (): array\n\t{\n\t\treturn [\n\t\t\t'coordinate' => [\n\t\t\t\t'name' => 'coordinate',\n\t\t\t\t'type' => static::getCoordsType(),\n\t\t\t],\n\t\t\t'location' => [\n\t\t\t\t'name' => 'location',\n\t\t\t\t'type' => Type::string(),\n\t\t\t],\n\t\t\t'country' => [\n\t\t\t\t'name' => 'country',\n\t\t\t\t'type' => Type::string(),\n\t\t\t],\n\t\t\t'radius' => [\n\t\t\t\t'name' => 'radius',\n\t\t\t\t'type' => Type::float(),\n\t\t\t],\n\t\t\t'unit' => [\n\t\t\t\t'name' => 'unit',\n\t\t\t\t'type' => static::getUnitType(),\n\t\t\t],\n\t\t];\n\t}\n\n\tpublic static function getType (): Type\n\t{\n\t\tif ($type = GqlEntityRegistry::getEntity(static::getName()))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\tstatic::getName(),\n\t\t\tnew ObjectType([\n\t\t\t\t'name' => static::getName(),\n\t\t\t\t'fields' => static::class . '::getFieldDefinitions',\n\t\t\t])\n\t\t);\n\t}\n\n\tpublic static function getInputType (): InputType\n\t{\n\t\t$name = static::getName() . 'Input';\n\n\t\tif ($type = GqlEntityRegistry::getEntity($name))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\t$name,\n\t\t\tnew InputObjectType([\n\t\t\t\t'name' => static::getName() . 'Input',\n\t\t\t\t'fields' => static::class . '::getInputDefinitions',\n\t\t\t])\n\t\t);\n\t}\n\n\tpublic static function getQueryType (): InputType\n\t{\n\t\t$name = static::getName() . 'Query';\n\n\t\tif ($type = GqlEntityRegistry::getEntity($name))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\t$name,\n\t\t\tnew InputObjectType([\n\t\t\t\t'name' => static::getName() . 'Query',\n\t\t\t\t'fields' => static::class . '::getQueryInputDefinitions',\n\t\t\t])\n\t\t);\n\t}\n\n\tpublic static function getCoordsType (): InputType\n\t{\n\t\t$name = static::getName() . 'Coords';\n\n\t\tif ($type = GqlEntityRegistry::getEntity($name))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\t$name,\n\t\t\tnew InputObjectType([\n\t\t\t\t'name' => static::getName() . 'Coords',\n\t\t\t\t'fields' => [\n\t\t\t\t\t'lat' => [\n\t\t\t\t\t\t'name' => 'lat',\n\t\t\t\t\t\t'type' => Type::nonNull(Type::float()),\n\t\t\t\t\t],\n\t\t\t\t\t'lng' => [\n\t\t\t\t\t\t'name' => 'lng',\n\t\t\t\t\t\t'type' => Type::nonNull(Type::float()),\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t])\n\t\t);\n\t}\n\n\tpublic static function getUnitType (): EnumType\n\t{\n\t\t$name = static::getName() . 'Unit';\n\n\t\tif ($type = GqlEntityRegistry::getEntity($name))\n\t\t\treturn $type;\n\n\t\treturn GqlEntityRegistry::createEntity(\n\t\t\t$name,\n\t\t\tnew EnumType([\n\t\t\t\t'name' => static::getName() . 'Unit',\n\t\t\t\t'values' => [\n\t\t\t\t\t'Miles' => 'mi',\n\t\t\t\t\t'Kilometres' => 'km',\n\t\t\t\t],\n\t\t\t])\n\t\t);\n\t}\n\n}\n"
  },
  {
    "path": "src/jobs/MaxMindDBDownloadJob.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\jobs;\n\nuse Craft;\nuse craft\\helpers\\FileHelper;\nuse craft\\queue\\BaseJob;\nuse craft\\queue\\QueueInterface;\nuse ether\\simplemap\\services\\GeoLocationService;\nuse Exception;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse yii\\queue\\Queue;\n\n/**\n * Class MaxMindDBDownloadJob\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\jobs\n */\nclass MaxMindDBDownloadJob extends BaseJob\n{\n\n\tprotected function defaultDescription (): string\n\t{\n\t\treturn 'Downloading MaxMind DB';\n\t}\n\n\t/**\n\t * @param Queue|QueueInterface $queue The queue the job belongs to\n\t *\n\t * @throws Exception|GuzzleException\n\t */\n\tpublic function execute ($queue): void\n\t{\n\t\ttry {\n\t\t\t$temp   = tempnam(sys_get_temp_dir(), 'mmdb');\n\t\t\t$target = Craft::getAlias(\n\t\t\t\tGeoLocationService::DB_STORAGE . DIRECTORY_SEPARATOR . 'default.mmdb'\n\t\t\t);\n\n\t\t\t$client = Craft::createGuzzleClient();\n\t\t\t$client->get(\n\t\t\t\t'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz',\n\t\t\t\t[\n\t\t\t\t\t'save_to' => $temp,\n\t\t\t\t\t'progress' => function ($total, $current) use ($queue) {\n\t\t\t\t\t\tif ($total > 0)\n\t\t\t\t\t\t\t$queue->setProgress(($current / $total) * 100);\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t$extracted = '';\n\t\t\t$gz        = gzopen($temp, 'r');\n\n\t\t\twhile ($data = gzread($gz, 10000000))\n\t\t\t\t$extracted .= $data;\n\n\t\t\tgzclose($gz);\n\n\t\t\tif (!file_exists($target))\n\t\t\t\tFileHelper::createDirectory(pathinfo($target)['dirname']);\n\n\t\t\t$saved = file_put_contents($target, $extracted);\n\t\t\t@unlink($temp);\n\n\t\t\tif (!$saved)\n\t\t\t\tCraft::error('Unable to save MaxMind DB!', 'maps');\n\n\t\t\tCraft::$app->getCache()->delete('maps_db_updating');\n\t\t} catch (Exception $e) {\n\t\t\tCraft::$app->getCache()->delete('maps_db_updating');\n\t\t\tthrow $e;\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/migrations/Install.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\migrations;\n\nuse craft\\db\\Migration;\nuse craft\\db\\Table;\nuse ether\\simplemap\\records\\Map;\n\n/**\n * Class Install\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\migrations\n */\nclass Install extends Migration\n{\n\n\tpublic function safeUp ()\n\t{\n\t\t// Create\n\n\t\t$this->createTable(\n\t\t\tMap::TableName,\n\t\t\t[\n\t\t\t\t'id'          => $this->primaryKey(),\n\t\t\t\t'ownerId'     => $this->integer()->notNull(),\n\t\t\t\t'ownerSiteId' => $this->integer(),\n\t\t\t\t'fieldId'     => $this->integer()->notNull(),\n\n\t\t\t\t'lat'     => $this->decimal(11, 9),\n\t\t\t\t'lng'     => $this->decimal(12, 9),\n\n\t\t\t\t'dateCreated' => $this->dateTime()->notNull(),\n\t\t\t\t'dateUpdated' => $this->dateTime()->notNull(),\n\t\t\t\t'uid'         => $this->uid()->notNull(),\n\t\t\t]\n\t\t);\n\n\t\t// Indexes\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['ownerId', 'ownerSiteId', 'fieldId'],\n\t\t\ttrue\n\t\t);\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['lat']\n\t\t);\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['lng']\n\t\t);\n\n\t\t// Relations\n\n\t\t$this->addForeignKey(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['ownerId'],\n\t\t\tTable::ELEMENTS,\n\t\t\t['id'],\n\t\t\t'CASCADE'\n\t\t);\n\n\t\t$this->addForeignKey(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['ownerSiteId'],\n\t\t\tTable::SITES,\n\t\t\t['id'],\n\t\t\t'CASCADE',\n\t\t\t'CASCADE'\n\t\t);\n\n\t\t$this->addForeignKey(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['fieldId'],\n\t\t\tTable::FIELDS,\n\t\t\t['id'],\n\t\t\t'CASCADE'\n\t\t);\n\n\t\t// Upgrade from Craft 2\n\t\tif ($this->db->tableExists('{{%simplemap_maps}}'))\n\t\t\t(new m190226_143809_craft3_upgrade())->safeUp();\n\t}\n\n\tpublic function safeUpPre34 ()\n\t{\n\t\t// Create\n\n\t\t$this->createTable(\n\t\t\tMap::TableName,\n\t\t\t[\n\t\t\t\t'id'          => $this->primaryKey(),\n\t\t\t\t'ownerId'     => $this->integer()->notNull(),\n\t\t\t\t'ownerSiteId' => $this->integer(),\n\t\t\t\t'fieldId'     => $this->integer()->notNull(),\n\n\t\t\t\t'lat'     => $this->decimal(11, 9),\n\t\t\t\t'lng'     => $this->decimal(12, 9),\n\t\t\t\t'zoom'    => $this->integer(2),\n\t\t\t\t'address' => $this->string(255),\n\t\t\t\t'parts'   => $this->text(),\n\n\t\t\t\t'dateCreated' => $this->dateTime()->notNull(),\n\t\t\t\t'dateUpdated' => $this->dateTime()->notNull(),\n\t\t\t\t'uid'         => $this->uid()->notNull(),\n\t\t\t]\n\t\t);\n\n\t\t// Indexes\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['ownerId', 'ownerSiteId', 'fieldId'],\n\t\t\ttrue\n\t\t);\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['lat']\n\t\t);\n\n\t\t$this->createIndex(\n\t\t\tnull,\n\t\t\tMap::TableName,\n\t\t\t['lng']\n\t\t);\n\n\t}\n\n\tpublic function safeDown ()\n\t{\n\t\t$this->dropTableIfExists(Map::TableName);\n\t}\n\n}\n"
  },
  {
    "path": "src/migrations/m190226_143809_craft3_upgrade.php",
    "content": "<?php\n\nnamespace ether\\simplemap\\migrations;\n\nuse Craft;\nuse craft\\db\\Migration;\nuse craft\\db\\Query;\nuse craft\\db\\Table;\nuse craft\\helpers\\Json;\nuse craft\\services\\Plugins;\nuse craft\\validators\\HandleValidator;\nuse ether\\simplemap\\enums\\GeoService;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\records\\Map as MapRecord;\nuse ether\\simplemap\\fields\\MapField;\nuse ether\\simplemap\\SimpleMap;\n\n/**\n * m190226_143809_craft3_upgrade migration.\n */\nclass m190226_143809_craft3_upgrade extends Migration\n{\n\t// Properties\n\t// =========================================================================\n\n\tstatic array $sitesByOldLocale = [];\n\n\t// Methods\n\t// =========================================================================\n\n    /**\n     * @inheritdoc\n     *\n     * @throws \\Throwable\n     * @throws \\yii\\base\\Exception\n     * @throws \\yii\\db\\Exception\n     */\n    public function safeUp()\n    {\n        // 1. Run the install migration\n\t    if (!$this->db->tableExists(MapRecord::OldTableName) && !$this->db->tableExists(MapRecord::TableName))\n\t        (new Install())->safeUp();\n\n\t    // 2. Upgrade the data\n\t    if ($this->db->tableExists('{{%simplemap_maps}}'))\n\t    \t$this->_upgrade2();\n\t    else\n\t    \t$this->_upgrade3();\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function safeDown()\n    {\n        echo \"m190226_143809_craft3_upgrade cannot be reverted.\\n\";\n        return false;\n    }\n\n\t/**\n\t * Upgrade from Craft 2\n\t *\n\t * @throws \\Throwable\n\t * @throws \\yii\\base\\Exception\n\t * @throws \\yii\\db\\Exception\n\t */\n    private function _upgrade2 ()\n    {\n    \t$mapService = SimpleMap::getInstance()->map;\n\t\t$fieldsService = Craft::$app->getFields();\n\n    \t// Delete the old plugin row\n\t    $this->delete(Table::PLUGINS, ['handle' => 'simple-map']);\n\n\t    // Update the old data\n\t    echo '    > Start map data upgrade' . PHP_EOL;\n\n\t    $rows = (new Query())\n\t\t    ->select('*')\n\t\t    ->from('{{%simplemap_maps}}')\n\t\t    ->all();\n\n\t    foreach ($rows as $row)\n\t    {\n\t\t    echo '    > Upgrade map value ' . $row['address'] . PHP_EOL;\n\n\t    \t$site = $this->getSiteByLocale($row['ownerLocale']);\n\n\t\t    $map              = new Map();\n\t\t    $map->ownerId     = $row['ownerId'];\n\t\t    $map->ownerSiteId = $site->id;\n\t\t    $map->fieldId     = $row['fieldId'];\n\t\t    $map->lat         = $row['lat'];\n\t\t    $map->lng         = $row['lng'];\n\n\t\t    $mapService->saveRecord($map, true);\n\t    }\n\n\t    $this->dropTable('{{%simplemap_maps}}');\n\n\t    // Update old field types\n\t\techo '    > Upgrade map field type upgrade' . PHP_EOL;\n\n\t\t$fieldContexts = [];\n\t\t$fieldContextsData = (new \\craft\\db\\Query())\n\t\t\t->select(['context'])\n\t\t\t->from(['{{%fields}}'])\n\t\t\t->all();\n\t\tforeach ($fieldContextsData as $fieldData) {\n\t\t\t$fieldContexts[] = $fieldData['context'];\n\t\t}\n\t\t$fieldContexts = array_unique($fieldContexts);\n\n\t\t$fields = $fieldsService->getAllFields($fieldContexts);\n\t\tforeach ($fields as $field)\n\t\t{\n\t\t\tif ($field instanceof \\craft\\fields\\MissingField && $field->expectedType === 'SimpleMap_Map') {\n\t\t\t\techo '    > Upgrade map field ' . $field->handle . PHP_EOL;\n\n\t\t\t\t$oldSettings = Json::decodeIfJson($field->settings);\n\n\t\t\t\t$newField = new MapField([\n\t\t\t\t\t'id'                   => $field->id,\n\t\t\t\t\t'groupId'              => $field->groupId,\n\t\t\t\t\t'name'                 => $field->name,\n\t\t\t\t\t'handle'               => $field->handle,\n\t\t\t\t\t'instructions'         => $field->instructions,\n\t\t\t\t\t'searchable'           => $field->searchable,\n\t\t\t\t\t'translationMethod'    => $field->translationMethod,\n\t\t\t\t\t'translationKeyFormat' => $field->translationKeyFormat,\n\n\t\t\t\t\t'lat'     => $oldSettings['lat'],\n\t\t\t\t\t'lng'     => $oldSettings['lng'],\n\t\t\t\t\t'zoom'    => $oldSettings['zoom'] ?? 15,\n\t\t\t\t\t'country' => strtoupper($oldSettings['countryRestriction'] ?? '') ?: null,\n\t\t\t\t\t'hideMap' => $oldSettings['hideMap'],\n\t\t\t\t]);\n\n\t\t\t\t$fieldsService->saveField($newField);\n\t\t\t}\n\t    }\n\n\t    // Update the plugin settings\n\t    $this->updatePluginSettings();\n    }\n\n\t/**\n\t * Upgrade from SimpleMap (3.3.x)\n\t *\n\t * @throws \\Throwable\n\t * @throws \\yii\\base\\Exception\n\t */\n    private function _upgrade3 ()\n    {\n\t    $mapService = SimpleMap::getInstance()->map;\n\n\t    // 1. Store the old data\n\t    echo '    > Start map data upgrade' . PHP_EOL;\n\n\t    $rows = (new Query())\n\t\t    ->select([\n\t\t    \t'ownerId',\n\t\t\t    'ownerSiteId',\n\t\t\t    'fieldId',\n\t\t\t    'lat',\n\t\t\t    'lng',\n\t\t\t    'zoom',\n\t\t\t    'address',\n\t\t\t    'parts',\n\t\t    ])\n\t\t    ->from(MapRecord::OldTableName)\n\t\t    ->all();\n\n\t    // 2. Re-create the table\n\t    $this->dropTable(MapRecord::OldTableName);\n\n\t    if (!$this->db->tableExists(MapRecord::TableName))\n\t        (new Install())->safeUpPre34();\n\n\t    // 3. Store the old data as new\n\t    $dupeKeys = [];\n\t    foreach ($rows as $row)\n\t    {\n\t\t    $key = $row['ownerId'] . '_' . $row['ownerSiteId'] . '_' . $row['fieldId'];\n\n\t\t    if (in_array($key, $dupeKeys))\n\t\t\t    continue;\n\n\t\t    $dupeKeys[] = $key;\n\n\t\t    echo '    > Upgrade map value ' . $row['address'] . PHP_EOL;\n\n\t\t    $map              = new Map($row);\n\t\t    $map->ownerId     = $row['ownerId'];\n\t\t    $map->ownerSiteId = $row['ownerSiteId'];\n\t\t    $map->fieldId     = $row['fieldId'];\n\n\t\t    if (!$map->zoom)\n\t\t    \t$map->zoom = 15;\n\n\t\t    $mapService->saveRecord($map, true);\n\t    }\n\n\t    // 4. Update field settings\n\t    echo '    > Upgrade map field type upgrade' . PHP_EOL;\n\n\t    $rows = (new Query())\n\t\t    ->select(['id', 'settings', 'handle'])\n\t\t    ->from(Table::FIELDS)\n\t\t    ->where(['type' => MapField::class])\n\t\t    ->all();\n\n\t    foreach ($rows as $row)\n\t    {\n\t\t    echo '    > Upgrade map field ' . $row['handle'] . PHP_EOL;\n\n\t\t    $id          = $row['id'];\n\t\t    $oldSettings = Json::decodeIfJson($row['settings']);\n\n\t\t    $newSettings = [\n\t\t\t    'lat'     => $oldSettings['lat'],\n\t\t\t    'lng'     => $oldSettings['lng'],\n\t\t\t    'zoom'    => $oldSettings['zoom'] ?? 15,\n\t\t\t    'country' => strtoupper($oldSettings['countryRestriction']),\n\t\t\t    'hideMap' => $oldSettings['hideMap'],\n\t\t    ];\n\n\t\t    $this->db->createCommand()\n\t\t\t\t->update(\n\t\t\t\t\tTable::FIELDS,\n\t\t\t\t\t[ 'settings' => Json::encode($newSettings) ],\n\t\t\t\t\tcompact('id')\n\t\t\t\t)\n\t\t\t\t->execute();\n\t    }\n\n\t    $this->updatePluginSettings();\n    }\n\n    // Helpers\n    // =========================================================================\n\n\t/**\n\t * Returns a site handle based on a given locale.\n\t *\n\t * @param string $locale\n\t *\n\t * @return string\n\t */\n\tprivate function locale2handle (string $locale): string\n\t{\n\t\tif (\n\t\t\t!preg_match('/^' . HandleValidator::$handlePattern . '$/', $locale) ||\n\t\t\tin_array(strtolower($locale), HandleValidator::$baseReservedWords, true)\n\t\t) {\n\t\t\t$localeParts = array_filter(preg_split('/[^a-zA-Z0-9]/', $locale));\n\n\t\t\treturn $localeParts ? '_' . implode('_', $localeParts) : '';\n\t\t}\n\n\t\treturn $locale;\n\t}\n\n\t/**\n\t * Gets the new site based off the old locale\n\t *\n\t * @param string $locale\n\t *\n\t * @return \\craft\\models\\Site\n\t */\n\tprivate function getSiteByLocale ($locale)\n\t{\n\t\t$sites = \\Craft::$app->sites;\n\n\t\tif ($locale === null)\n\t\t\treturn static::$sitesByOldLocale[$locale] = $sites->primarySite;\n\n\t\tif (array_key_exists($locale, static::$sitesByOldLocale))\n\t\t\treturn static::$sitesByOldLocale[$locale];\n\n\t\t$handle = $this->locale2handle($locale);\n\n\t\t$siteId = (new Query())\n\t\t\t->select('id')\n\t\t\t->from(Table::SITES)\n\t\t\t->where(['like', 'handle', '%' . $handle])\n\t\t\t->column();\n\n\t\tif (!empty($siteId))\n\t\t\treturn static::$sitesByOldLocale[$locale] = $sites->getSiteById($siteId[0]);\n\n\t\treturn static::$sitesByOldLocale[$locale] = $sites->primarySite;\n\t}\n\n\t/**\n\t * Updates the plugins settings\n\t * @throws \\craft\\errors\\InvalidPluginException\n\t */\n\tprivate function updatePluginSettings ()\n\t{\n\t\techo '    > Upgrade Maps settings' . PHP_EOL;\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings()->toArray();\n\t\t$newSettings = SimpleMap::getInstance()->getSettings()->toArray();\n\n\t\t$craft2Settings = \\Craft::$app->projectConfig->get(\n\t\t\tPlugins::CONFIG_PLUGINS_KEY . '.simple-map.settings'\n\t\t);\n\n\t\tif (is_array($craft2Settings) && !empty($craft2Settings))\n\t\t{\n\t\t\t$settings = [\n\t\t\t\t'apiKey' => @$craft2Settings['browserApiKey'] ?: '',\n\t\t\t\t'unrestrictedApiKey' => @$craft2Settings['serverApiKey'] ?: '',\n\t\t\t];\n\t\t}\n\n\t\tif ($settings['unrestrictedApiKey'])\n\t\t{\n\t\t\t$newSettings['geoService'] = GeoService::GoogleMaps;\n\t\t\t$newSettings['geoToken'] = $settings['unrestrictedApiKey'];\n\t\t}\n\n\t\tif ($settings['apiKey'])\n\t\t{\n\t\t\t$newSettings['mapTiles'] = MapTiles::GoogleRoadmap;\n\t\t\t$newSettings['mapToken'] = $settings['apiKey'];\n\n\t\t\tif (!$settings['unrestrictedApiKey'])\n\t\t\t{\n\t\t\t\t$newSettings['geoService'] = GeoService::GoogleMaps;\n\t\t\t\t$newSettings['geoToken'] = $settings['apiKey'];\n\t\t\t}\n\t\t}\n\n\t\t\\Craft::$app->plugins->savePluginSettings(\n\t\t\tSimpleMap::getInstance(),\n\t\t\t$newSettings\n\t\t);\n\n\t\t\\Craft::$app->plugins->enablePlugin(SimpleMap::getInstance()->handle);\n\t}\n\n}\n"
  },
  {
    "path": "src/migrations/m190325_130533_repair_map_elements.php",
    "content": "<?php\n\nnamespace ether\\simplemap\\migrations;\n\nuse craft\\db\\Migration;\nuse craft\\db\\Query;\nuse craft\\db\\Table;\nuse ether\\simplemap\\records\\Map;\nuse ether\\simplemap\\elements\\Map as MapElement;\n\n/**\n * m190325_130533_repair_map_elements migration.\n */\nclass m190325_130533_repair_map_elements extends Migration\n{\n\t/**\n\t * @inheritdoc\n\t * @return bool\n\t * @throws \\yii\\base\\Exception\n\t * @throws \\yii\\base\\NotSupportedException\n\t */\n    public function safeUp()\n    {\n        if (!$this->db->columnExists(Map::TableName, 'elementId'))\n        \treturn true;\n\n\t    echo '    > Start map data fix' . PHP_EOL;\n\n        $rows = (new Query())\n\t        ->select('*')\n\t        ->from(Map::TableName)\n\t        ->orderBy('dateUpdated DESC')\n\t        ->all();\n\n        $validMapElementIds = (new Query())\n\t        ->select('id')\n\t        ->from(Table::ELEMENTS)\n\t        ->where(['=', 'type', MapElement::class])\n\t        ->column();\n\n        $this->dropTable(Map::TableName);\n\t    (new Install())->safeUp();\n\n\t    $updatedElementIds = [];\n\n        foreach ($rows as $row)\n        {\n        \t// Skip any rows that don't have a matching element\n        \tif (!in_array($row['elementId'], $validMapElementIds))\n        \t\tcontinue;\n\n        \t// Skip and duplicate elements\n\t        if (in_array($row['elementId'], $updatedElementIds))\n\t        \tcontinue;\n\n\t        echo '    > Fix map value ' . $row['address'] . PHP_EOL;\n\n\t        $record              = new Map();\n\t        $record->id          = $row['elementId'];\n\t        $record->ownerId     = $row['ownerId'];\n\t        $record->ownerSiteId = $row['ownerSiteId'];\n\t        $record->fieldId     = $row['fieldId'];\n\n\t        $record->lat     = $row['lat'];\n\t        $record->lng     = $row['lng'];\n\t        $record->zoom    = $row['zoom'];\n\t        $record->address = $row['address'];\n\t        $record->parts   = $row['parts'];\n\n\t        $record->save(false);\n\n\t        $updatedElementIds[] = $record->id;\n        }\n\n\t    return true;\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function safeDown()\n    {\n        echo \"m190325_130533_repair_map_elements cannot be reverted.\\n\";\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/migrations/m190712_104805_new_data_format.php",
    "content": "<?php\n\nnamespace ether\\simplemap\\migrations;\n\nuse Craft;\nuse craft\\base\\FieldInterface;\nuse craft\\db\\Migration;\nuse craft\\db\\Query;\nuse craft\\fields\\Matrix;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\fields\\MapField;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\records\\Map as MapRecord;\nuse ether\\simplemap\\SimpleMap;\nuse verbb\\supertable\\fields\\SuperTableField;\n\n/**\n * m190712_104805_new_data_format migration.\n */\nclass m190712_104805_new_data_format extends Migration\n{\n\n\t/**\n\t * @inheritdoc\n\t * @throws \\yii\\db\\Exception\n\t * @throws \\Exception\n\t */\n    public function safeUp ()\n    {\n    \t$db = $this->getDb();\n    \t$mapService = SimpleMap::getInstance()->map;\n    \t$matrixService = Craft::$app->getMatrix();\n    \t$superTableService = null;\n    \t$hasSuperTable = class_exists(SuperTableField::class);\n\n        // 1. Add content columns\n        // ---------------------------------------------------------------------\n\n\t    echo '1. Creating Maps content columns' . PHP_EOL;\n\n\t    $matrixFields = [];\n\t    $superTableFields = [];\n\n\t    $fields = array_reduce(\n\t\t    Craft::$app->getFields()->getAllFields(),\n\t\t    function ($carry, FieldInterface $field) use ($hasSuperTable, &$matrixFields, &$superTableFields) {\n\t\t    \tif ($field instanceof MapField)\n\t\t\t    \t$carry[$field->id] = $field;\n\n\t\t    \telseif ($field instanceof Matrix)\n\t\t\t\t    $matrixFields[] = $field;\n\n\t\t    \telseif ($hasSuperTable && $field instanceof SuperTableField)\n\t\t\t\t    $superTableFields[] = $field;\n\n\t\t    \treturn $carry;\n\t\t    },\n\t\t    []\n\t    );\n\n\t    $matrixMapFields = [];\n\t    $superTableMapFields = [];\n\n\t    $matrixMapFields = array_merge(\n\t    \t$matrixMapFields,\n\t\t    $this->_reduceMatrixFields(\n\t\t\t    $matrixFields,\n\t\t\t    $hasSuperTable,\n\t\t\t    $matrixMapFields,\n\t\t\t    $superTableMapFields\n\t\t    )\n\t    );\n\n\t    $superTableMapFields = array_merge(\n\t    \t$superTableMapFields,\n\t\t    $this->_reduceSuperTableFields(\n\t\t\t    $superTableFields,\n\t\t\t    $matrixMapFields,\n\t\t\t    $superTableMapFields\n\t\t    )\n\t    );\n\n\t    $fieldIdToMatrixBlockHandle = [];\n\n\t    if (!empty($matrixMapFields))\n\t    {\n\t    \tforeach ($matrixFields as $field)\n\t\t    {\n\t\t    \t$blockTypes = $matrixService->getBlockTypesByFieldId($field->id);\n\n\t\t    \tforeach ($blockTypes as $blockType)\n\t\t\t    \tforeach ($blockType->getFields() as $field)\n\t\t\t\t    \t$fieldIdToMatrixBlockHandle[$field->id] = $blockType->handle;\n\t\t    }\n\t    }\n\n\t    $columnType = (new MapField())->getContentColumnType();\n\t    $contentTable = Craft::$app->getContent()->contentTable;\n\t    $fieldColumnPrefix = Craft::$app->getContent()->fieldColumnPrefix;\n\n\t    /** @var MapField $field */\n\t    foreach ($fields as $field)\n\t    {\n\t    \techo '- Create content column for ' . $field->name . ' in content table' . PHP_EOL;\n\n\t    \t$exists = $this->db->columnExists(\n\t\t\t    $contentTable,\n\t\t\t    $fieldColumnPrefix . $field->handle\n\t\t    );\n\n\t    \tif ($exists)\n\t\t    {\n\t\t\t    $this->alterColumn(\n\t\t\t\t    $contentTable,\n\t\t\t\t    $fieldColumnPrefix . $field->handle,\n\t\t\t\t    $columnType\n\t\t\t    );\n\t\t\t    continue;\n\t\t    }\n\n\t\t    $this->addColumn(\n\t\t\t    $contentTable,\n\t\t\t    $fieldColumnPrefix . $field->handle,\n\t\t\t    $columnType\n\t\t    );\n\t    }\n\n\t    foreach ($matrixMapFields as $table => $mmFields)\n\t    {\n\t    \tforeach ($mmFields as $field)\n\t\t    {\n\t\t    \tif (!$blockTypeHandle = @$fieldIdToMatrixBlockHandle[$field->id])\n\t\t    \t\tcontinue;\n\n\t\t\t    echo '- Create content column for ' . $field->name . ' in matrix ' . $blockTypeHandle . PHP_EOL;\n\n\t\t\t    $handle =\n\t\t\t\t    $fieldColumnPrefix . $blockTypeHandle . '_' . $field->handle;\n\n\t\t\t    $exists = $this->db->columnExists(\n\t\t\t\t    $table,\n\t\t\t\t    $handle\n\t\t\t    );\n\n\t\t\t    if ($exists)\n\t\t\t    {\n\t\t\t    \t$this->alterColumn(\n\t\t\t    \t\t$table,\n\t\t\t\t\t    $handle,\n\t\t\t\t\t    $columnType\n\t\t\t\t    );\n\t\t\t\t    continue;\n\t\t\t    }\n\n\t\t\t    $this->addColumn(\n\t\t\t\t    $table,\n\t\t\t\t    $handle,\n\t\t\t\t    $columnType\n\t\t\t    );\n\t\t    }\n\t    }\n\n\t    foreach ($superTableMapFields as $table => $stFields)\n\t    {\n\t    \tforeach ($stFields as $field)\n\t\t    {\n\t\t\t    echo '- Create content column for ' . $field->name . ' in super table' . PHP_EOL;\n\n\t\t\t    $exists = $this->db->columnExists(\n\t\t\t\t    $table,\n\t\t\t\t    $fieldColumnPrefix . $field->handle\n\t\t\t    );\n\n\t\t\t    if ($exists)\n\t\t\t    {\n\t\t\t\t    $this->alterColumn(\n\t\t\t\t\t    $table,\n\t\t\t\t\t    $fieldColumnPrefix . $field->handle,\n\t\t\t\t\t    $columnType\n\t\t\t\t    );\n\t\t\t\t    continue;\n\t\t\t    }\n\n\t\t\t    $this->addColumn(\n\t\t\t\t    $table,\n\t\t\t\t    $fieldColumnPrefix . $field->handle,\n\t\t\t\t    $columnType\n\t\t\t    );\n\t\t    }\n\t    }\n\n\t    // 2. Create new maps table\n\t    // ---------------------------------------------------------------------\n\n\t    echo '2. Creating new Maps table' . PHP_EOL;\n\n\t    if ($this->db->tableExists(MapRecord::TableName))\n\t    {\n\t    \t$rawTableName = $this->getDb()->getSchema()->getRawTableName(\n\t\t\t    MapRecord::TableName\n\t\t    );\n\n\t    \tif ($this->getDb()->getDriverName() === 'pgsql')\n\t\t    {\n\t\t    \t$indexNames = $this->getDb()->createCommand(\n\t\t\t\t    'SELECT indexname FROM pg_indexes WHERE [[tablename]]=:tablename',\n\t\t\t\t    ['tablename' => $rawTableName]\n\t\t\t    )->queryColumn();\n\n\t\t    \tforeach ($indexNames as $name)\n\t\t    \t\t$this->getDb()->createCommand(\n\t\t    \t\t\t'ALTER INDEX \"' . $name . '\" RENAME TO \"' . $name . '_old\"'\n\t\t\t\t    )->execute();\n\t\t    }\n\t    \telse\n\t\t    {\n\t\t\t    $indexNames = $this->getDb()->createCommand(\n\t\t\t\t    'SHOW INDEX FROM ' . $rawTableName\n\t\t\t    )->queryAll();\n\n\t\t\t    $indexNames = array_unique(array_reduce(\n\t\t\t    \t$indexNames,\n\t\t\t\t    function ($carry, $row) {\n\t\t\t    \t\tif ($row['Key_name'] === 'PRIMARY')\n\t\t\t    \t\t\treturn $carry;\n\n\t\t\t    \t\t$carry[] = $row['Key_name'];\n\t\t\t    \t\treturn $carry;\n\t\t\t\t    },\n\t\t\t\t    []\n\t\t\t    ));\n\n\t\t\t    // Look, I know this is hacky but whatever who still uses MySQL\n\t\t\t    // anyway? You know Postgres exists, right?\n\t\t\t    $this->getDb()->createCommand('SET foreign_key_checks = 0;')->execute();\n\n\t\t\t    foreach ($indexNames as $name)\n\t\t\t\t    $this->dropIndex($name, MapRecord::TableName);\n\n\t\t\t    $this->getDb()->createCommand('SET foreign_key_checks = 1;')->execute();\n\t\t    }\n\n\t\t    $this->renameTable(MapRecord::TableName, MapRecord::OldTableName);\n\t    }\n\n        (new Install())->safeUp();\n\n\t    // 3. Move content to table\n\t    // ---------------------------------------------------------------------\n\n\t    echo '3. Moving existing maps content' . PHP_EOL;\n\n\t    $contentRows = (new Query())\n\t\t    ->select('id, elementId, siteId')\n\t\t    ->from($contentTable);\n\n\t    foreach ($contentRows->each() as $row)\n\t    {\n\t    \t$mapContent = $this->_getMapContent(\n\t    \t\t$row['elementId'],\n\t\t\t    $row['siteId']\n\t\t    );\n\n\t    \tif (empty($mapContent))\n\t    \t\tcontinue;\n\n\t    \tforeach ($mapContent as $mapData)\n\t\t    {\n\t\t    \t$map = new Map($mapData);\n\n\t\t    \techo '- Moving ' . $map->address . ' (' . $mapData['id'] . ') to ' . $contentTable . PHP_EOL;\n\n\t\t    \t$map->ownerId = $row['elementId'];\n\t\t    \t$map->ownerSiteId = $row['siteId'];\n\t\t    \t$map->fieldId = $mapData['fieldId'];\n\n\t\t    \t$field = @$fields[$mapData['fieldId']];\n\n\t\t    \t// Skip if the field no longer exists\n\t\t    \tif (!$field)\n\t\t\t    {\n\t\t\t\t    echo '- Skipping ' . $map->address . ' (' . $mapData['id'] . ') - Field no longer exists' . PHP_EOL;\n\t\t\t\t    continue;\n\t\t\t    }\n\n\t\t    \t$col = $fieldColumnPrefix . $field->handle;\n\n\t\t    \t$db->createCommand()\n\t\t\t\t    ->update(\n\t\t\t\t    \t$contentTable,\n\t\t\t\t\t    [$col => Json::encode($map)],\n\t\t\t\t\t    ['id' => $row['id']]\n\t\t\t\t    )\n\t\t\t\t    ->execute();\n\n\t\t    \t$mapService->saveRecord($map, true);\n\t\t    }\n\t    }\n\n\t    foreach ($matrixMapFields as $contentTable => $fields)\n\t    {\n\t    \t$contentRows = (new Query())\n\t\t\t    ->select('id, elementId, siteId')\n\t\t\t    ->from($contentTable);\n\n\t    \tforeach ($contentRows->each() as $row)\n\t\t    {\n\t\t    \t$mapContent = $this->_getMapContent(\n\t\t    \t\t$row['elementId'],\n\t\t\t\t    $row['siteId']\n\t\t\t    );\n\n\t\t    \tif (empty($mapContent))\n\t\t    \t\tcontinue;\n\n\t\t    \tforeach ($mapContent as $mapData)\n\t\t\t    {\n\t\t\t\t    if (!$blockHandle = @$fieldIdToMatrixBlockHandle[$mapData['fieldId']])\n\t\t\t\t\t    continue;\n\n\t\t\t\t    $map = new Map($mapData);\n\n\t\t\t\t    $map->ownerId     = $row['elementId'];\n\t\t\t\t    $map->ownerSiteId = $row['siteId'];\n\t\t\t\t    $map->fieldId     = $mapData['fieldId'];\n\n\t\t\t\t    $field = $fields[$mapData['fieldId']];\n\t\t\t\t    $col   = $fieldColumnPrefix . $blockHandle . '_' . $field->handle;\n\n\t\t\t\t    echo '- Moving ' . $map->address . ' (' . $mapData['id'] . ') to ' . $contentTable . ', ' . $col . PHP_EOL;\n\n\t\t\t\t    $db->createCommand()\n\t\t\t\t       ->update(\n\t\t\t\t\t       $contentTable,\n\t\t\t\t\t       [$col => Json::encode($map)],\n\t\t\t\t\t       ['id' => $row['id']]\n\t\t\t\t       )\n\t\t\t\t       ->execute();\n\n\t\t\t\t    $mapService->saveRecord($map, true);\n\t\t\t    }\n\t\t    }\n\t    }\n\n\t    foreach ($superTableMapFields as $contentTable => $fields)\n\t    {\n\t    \t$contentRows = (new Query())\n\t\t\t    ->select('id, elementId, siteId')\n\t\t\t    ->from($contentTable);\n\n\t    \tforeach ($contentRows->each() as $row)\n\t\t    {\n\t\t    \t$mapContent = $this->_getMapContent(\n\t\t    \t\t$row['elementId'],\n\t\t\t\t    $row['siteId']\n\t\t\t    );\n\n\t\t    \tif (empty($mapContent))\n\t\t    \t\tcontinue;\n\n\t\t    \tforeach ($mapContent as $mapData)\n\t\t\t    {\n\t\t\t\t    $map = new Map($mapData);\n\n\t\t\t\t    $map->ownerId     = $row['elementId'];\n\t\t\t\t    $map->ownerSiteId = $row['siteId'];\n\t\t\t\t    $map->fieldId     = $mapData['fieldId'];\n\n\t\t\t\t    $field = $fields[$mapData['fieldId']];\n\t\t\t\t    $col   = $fieldColumnPrefix . $field->handle;\n\n\t\t\t\t    echo '- Moving ' . $map->address . ' (' . $mapData['id'] . ') to ' . $contentTable . ', ' . $col . PHP_EOL;\n\n\t\t\t\t    $db->createCommand()\n\t\t\t\t       ->update(\n\t\t\t\t\t       $contentTable,\n\t\t\t\t\t       [$col => Json::encode($map)],\n\t\t\t\t\t       ['id' => $row['id']]\n\t\t\t\t       )\n\t\t\t\t       ->execute();\n\n\t\t\t\t    $mapService->saveRecord($map, true);\n\t\t\t    }\n\t\t    }\n\t    }\n\n\t    // 4. Drop old data table\n\t    // ---------------------------------------------------------------------\n\n\t    $this->dropTableIfExists(MapRecord::OldTableName);\n\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function safeDown()\n    {\n        echo \"m190712_104805_new_data_format cannot be reverted.\\n\";\n        return false;\n    }\n\n    // Helpers\n    // =========================================================================\n\n\tprivate function _reduceMatrixFields ($matrixFields, $hasSuperTable, &$matrixMapFields, &$superTableMapFields)\n\t{\n\t\treturn array_reduce(\n\t\t\t$matrixFields,\n\t\t\tfunction ($carry, Matrix $matrix) use (\n\t\t\t\t$hasSuperTable, &$matrixMapFields, &$superTableMapFields\n\t\t\t) {\n\t\t\t\t$fields = [];\n\n\t\t\t\tforeach ($matrix->getBlockTypeFields() as $field)\n\t\t\t\t{\n\t\t\t\t\tif ($field instanceof MapField)\n\t\t\t\t\t\t$fields[$field->id] = $field;\n\n\t\t\t\t\telseif ($hasSuperTable && $field instanceof SuperTableField)\n\t\t\t\t\t\t$superTableMapFields = array_merge(\n\t\t\t\t\t\t\t$superTableMapFields,\n\t\t\t\t\t\t\t$this->_reduceSuperTableFields(\n\t\t\t\t\t\t\t\t[$field],\n\t\t\t\t\t\t\t\t$matrixMapFields,\n\t\t\t\t\t\t\t\t$superTableMapFields\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!empty($fields))\n\t\t\t\t\t$carry[$matrix->contentTable] = $fields;\n\n\t\t\t\treturn $carry;\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t}\n\n\tprivate function _reduceSuperTableFields ($superTableFields, &$matrixMapFields, &$superTableMapFields)\n\t{\n\t\treturn array_reduce(\n\t\t\t$superTableFields,\n\t\t\tfunction ($carry, SuperTableField $superTable) use (\n\t\t\t\t&$matrixMapFields, &$superTableMapFields\n\t\t\t) {\n\t\t\t\t$fields = [];\n\n\t\t\t\tforeach ($superTable->getBlockTypeFields() as $field)\n\t\t\t\t{\n\t\t\t\t\tif ($field instanceof MapField)\n\t\t\t\t\t\t$fields[$field->id] = $field;\n\n\t\t\t\t\telseif ($field instanceof Matrix)\n\t\t\t\t\t\t$matrixMapFields = array_merge(\n\t\t\t\t\t\t\t$matrixMapFields,\n\t\t\t\t\t\t\t$this->_reduceMatrixFields(\n\t\t\t\t\t\t\t\t[$field],\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t$matrixMapFields,\n\t\t\t\t\t\t\t\t$superTableMapFields\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!empty($fields))\n\t\t\t\t\t$carry[$superTable->contentTable] = $fields;\n\n\t\t\t\treturn $carry;\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t}\n\n\tprivate function _getMapContent ($elementId, $siteId)\n\t{\n\t\treturn (new Query())\n\t\t\t->select(\n\t\t\t\t'id, ownerId, ownerSiteId, fieldId, lat, lng, zoom, address, parts'\n\t\t\t)\n\t\t\t->from(MapRecord::OldTableName)\n\t\t\t->where([\n\t\t\t\t'ownerId' => $elementId,\n\t\t\t\t'ownerSiteId' => $siteId,\n\t\t\t])\n\t\t\t->groupBy('id, fieldId')\n\t\t\t->orderBy('dateUpdated')\n\t\t\t->all();\n\t}\n\n}\n"
  },
  {
    "path": "src/migrations/m190723_105637_fix_map_field_column_type.php",
    "content": "<?php\n\nnamespace ether\\simplemap\\migrations;\n\nuse Craft;\nuse craft\\db\\Migration;\nuse ether\\simplemap\\fields\\MapField;\nuse yii\\base\\ErrorException;\nuse yii\\base\\Exception;\nuse yii\\base\\NotSupportedException;\nuse yii\\web\\ServerErrorHttpException;\n\n/**\n * m190723_105637_fix_map_field_column_type migration.\n */\nclass m190723_105637_fix_map_field_column_type extends Migration\n{\n\n\t/**\n\t * @inheritdoc\n\t * @throws NotSupportedException\n\t * @throws ErrorException\n\t * @throws Exception\n\t * @throws ServerErrorHttpException\n\t */\n\tpublic function safeUp ()\n\t{\n\t\t$pc = Craft::$app->getProjectConfig();\n\n\t\t$fields               = $pc->get('fields', true) ?? [];\n\t\t$matrixBlockTypes     = $pc->get('matrixBlockTypes', true) ?? [];\n\t\t$superTableBlockTypes = $pc->get('superTableBlockTypes', true) ?? [];\n\t\t$updates              = [];\n\n\t\tforeach ($fields as $f => $field)\n\t\t\tif (!empty($field['type']) && $field['type'] === MapField::class && $field['contentColumnType'] !== 'text')\n\t\t\t\t$updates[\"fields.$f.contentColumnType\"] = 'text';\n\n\t\tforeach ($matrixBlockTypes as $b => $blockType)\n\t\t\tif (array_key_exists('fields', $blockType) && is_array($blockType['fields']))\n\t\t\t\tforeach ($blockType['fields'] as $f => $field)\n\t\t\t\t\tif ($field['type'] === MapField::class && $field['contentColumnType'] !== 'text')\n\t\t\t\t\t\t$updates[\"matrixBlockTypes.$b.fields.$f.contentColumnType\"] = 'text';\n\n\t\tforeach ($superTableBlockTypes as $b => $blockType)\n\t\t\tif (array_key_exists('fields', $blockType) && is_array($blockType['fields']))\n\t\t\t\tforeach ($blockType['fields'] as $f => $field)\n\t\t\t\t\tif ($field['type'] === MapField::class && $field['contentColumnType'] !== 'text')\n\t\t\t\t\t\t$updates[\"superTableBlockTypes.$b.fields.$f.contentColumnType\"] = 'text';\n\n\t\tforeach ($updates as $path => $value)\n\t\t\t$pc->set($path, $value);\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic function safeDown ()\n\t{\n\t\techo \"m190723_105637_fix_map_field_column_type cannot be reverted.\\n\";\n\n\t\treturn false;\n\t}\n\n}\n"
  },
  {
    "path": "src/models/BaseLocation.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\helpers\\Json;\nuse craft\\helpers\\Typecast;\nuse Twig\\Markup;\nuse yii\\base\\Model;\n\n/**\n * Class BaseLocation\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nabstract class BaseLocation extends Model\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var float|null */\n\tpublic ?float $lat = null;\n\n\t/** @var float|null */\n\tpublic ?float $lng = null;\n\n\t/** @var string|null */\n\tpublic ?string $address = null;\n\n\t/** @var PartsLegacy|Parts|array|null */\n\tpublic PartsLegacy|Parts|array|null $parts = null;\n\n\t/** @var string|null */\n\tpublic ?string $what3words = null;\n\n\t// Constructor\n\t// =========================================================================\n\n\tpublic function __construct ($config = [])\n\t{\n\t\tTypecast::properties(static::class, $config);\n\n\t\tparent::__construct($config);\n\n\t\tif ($this->address === null)\n\t\t\t$this->address = '';\n\n\t\tif ($this->parts === null)\n\t\t{\n\t\t\t$this->parts = new Parts();\n\t\t}\n\t\telse if (!($this->parts instanceof Parts))\n\t\t{\n\t\t\tif ($this->parts && !is_array($this->parts))\n\t\t\t\t$this->parts = Json::decodeIfJson($this->parts, true);\n\n\t\t\tif (Parts::isLegacy($this->parts))\n\t\t\t\t$this->parts = new PartsLegacy($this->parts);\n\t\t\telse\n\t\t\t\t$this->parts = new Parts($this->parts);\n\t\t}\n\t}\n\n\t// Methods\n\t// =========================================================================\n\n\t/**\n\t * Output the address in an easily formatted way\n\t *\n\t * @param array  $exclude - An array of parts to exclude from the output\n\t * @param string $glue    - The glue to join the parts together\n\t *\n\t * @return Markup\n\t */\n\tpublic function address (array $exclude = [], string $glue = '<br/>'): Markup\n\t{\n\t\t$addr = [];\n\n\t\tif (!is_array($exclude))\n\t\t\t$exclude = [$exclude];\n\n\t\tforeach ([['number', 'address'], 'city', 'county', 'state', 'postcode', 'country'] as $part)\n\t\t{\n\t\t\tif (is_array($part))\n\t\t\t{\n\t\t\t\t$line = [];\n\n\t\t\t\tforeach ($part as $p)\n\t\t\t\t{\n\t\t\t\t\tif (in_array($p, $exclude))\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t$line[] = $this->parts->$p;\n\t\t\t\t}\n\n\t\t\t\t$addr[] = implode(' ', array_filter($line));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (in_array($part, $exclude))\n\t\t\t\tcontinue;\n\n\t\t\t$addr[] = $this->parts->$part;\n\t\t}\n\n\t\t$addr = array_filter($addr);\n\n\t\treturn new Markup(implode($glue, $addr), 'utf8');\n\t}\n\n\tpublic function __toString(): string\n\t{\n\t\treturn (string) $this->address([], ', ');\n\t}\n\n}\n"
  },
  {
    "path": "src/models/EmbedOptions.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\helpers\\StringHelper;\n\n/**\n * Class EmbedOptions\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass EmbedOptions extends StaticOptions\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var string|null The ID of the map (unique ID will be generated if null) */\n\tpublic ?string $id = null;\n\n\t/** @var array Options to be passed to the JS map */\n\tpublic array $options = [];\n\n\t// Constructor\n\t// =========================================================================\n\n\tpublic function __construct ($config = [])\n\t{\n\t\tparent::__construct($config);\n\n\t\tif (!$this->id)\n\t\t\t$this->id = StringHelper::appendUniqueIdentifier('map');\n\t}\n\n}\n"
  },
  {
    "path": "src/models/Map.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\base\\Model;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse Twig\\Markup;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class Map\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass Map extends BaseLocation\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var int|null */\n\tpublic ?int $id = null;\n\n\t/** @var int|null */\n\tpublic ?int $ownerId = null;\n\n\t/** @var int|null */\n\tpublic ?int $ownerSiteId = null;\n\n\t/** @var int|null */\n\tpublic ?int $fieldId = null;\n\n\t/** @var int */\n\tpublic ?int $zoom = 15;\n\n\t/** @var int|float|null */\n\tpublic int|null|float $distance = null;\n\n\t// Constructor\n\t// =========================================================================\n\n\tpublic function __construct ($config = [])\n\t{\n\t\tforeach (['id', 'ownerId', 'ownerSiteId', 'fieldId'] as $key)\n\t\t\tif (array_key_exists($key, $config))\n\t\t\t\tunset($config[$key]);\n\n\t\tparent::__construct($config);\n\n\t\t$this->distance = SimpleMap::getInstance()->map->getDistance($this);\n\t}\n\n\t// Getters\n\t// =========================================================================\n\n\tpublic function __get ($name)\n\t{\n\t\t$isPart = property_exists($this->parts, $name) || $name === 'streetAddress';\n\n\t\tif (in_array($name, PartsLegacy::$legacyKeys) && !$isPart)\n\t\t\treturn null;\n\t\telse if ($isPart)\n\t\t\treturn $this->parts->$name;\n\n\t\treturn parent::__get($name);\n\t}\n\n\tpublic function canGetProperty ($name, $checkVars = true, $checkBehaviors = true): bool\n\t{\n\t\ttry\n\t\t{\n\t\t\tif (\n\t\t\t\tproperty_exists($this->parts, $name) ||\n\t\t\t\t$name === 'streetAddress' ||\n\t\t\t\tin_array($name, PartsLegacy::$legacyKeys)\n\t\t\t) return true;\n\t\t} catch (Exception $e) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn parent::canGetProperty($name, $checkVars, $checkBehaviors);\n\t}\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function rules (): array\n\t{\n\t\t$rules = parent::rules();\n\n\t\t$rules[] = [\n\t\t\t['zoom'],\n\t\t\t'required',\n\t\t];\n\t\t$rules[] = [\n\t\t\t['lat'],\n\t\t\t'double',\n\t\t\t'min' => -90,\n\t\t\t'max' => 90,\n\t\t];\n\t\t$rules[] = [\n\t\t\t['lng'],\n\t\t\t'double',\n\t\t\t'min' => -180,\n\t\t\t'max' => 180,\n\t\t];\n\n\t\treturn $rules;\n\t}\n\n\tpublic function isValueEmpty (): bool\n\t{\n\t\treturn empty($this->lat) && empty($this->lng);\n\t}\n\n\t// Render Map\n\t// =========================================================================\n\n\t// Render Map: Image\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Output the map field as a static image\n\t *\n\t * @param array $options\n\t *\n\t * @return string|void\n\t * @throws Exception\n\t */\n\tpublic function img (array $options = [])\n\t{\n\t\treturn SimpleMap::getInstance()->static->generate(\n\t\t\t$this->_getMapOptions($options)\n\t\t);\n\t}\n\n\t/**\n\t * Output the map ready for srcset\n\t *\n\t * @param array $options\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tpublic function imgSrcSet (array $options = []): string\n\t{\n\t\t$options = $this->_getMapOptions($options);\n\n\t\t$x1 = $this->img(array_merge($options, ['scale' => 1]));\n\t\t$x2 = $this->img(array_merge($options, ['scale' => 2]));\n\n\t\treturn $x1 . ' 1x, ' . $x2 . ' 2x';\n\t}\n\n\t/**\n\t * Output an interactive map\n\t *\n\t * @param array $options\n\t *\n\t * @return string|void\n\t * @throws InvalidConfigException\n\t */\n\tpublic function embed (array $options = [])\n\t{\n\t\t$options = $this->_getMapOptions($options);\n\t\treturn SimpleMap::getInstance()->embed->embed($options);\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Merge options w/ map properties\n\t *\n\t * @param array $options\n\t *\n\t * @return array\n\t */\n\tprivate function _getMapOptions (array $options): array\n\t{\n\t\treturn array_merge($options, [\n\t\t\t'center' => [\n\t\t\t\t$this->lat,\n\t\t\t\t$this->lng,\n\t\t\t],\n\t\t\t'zoom'   => $this->zoom,\n\t\t]);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/Marker.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\services\\GeoService;\nuse Exception;\nuse Yii;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class Marker\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass Marker\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var string|array Can be an address string, or a [lat, lng] or ['lat' => lat, 'lng' => lng] array */\n\tpublic string|array $location;\n\n\t/** @var string The colour of the marker in Hex format */\n\tpublic string $color = '#ff0000';\n\n\t/** @var string|null A single character label, or null for no label */\n\tpublic mixed $label = null;\n\n\t// Constructor\n\t// =========================================================================\n\n\tpublic function __construct ($config = [])\n\t{\n\t\tif (!empty($config))\n\t\t\tYii::configure($this, $config);\n\n\t\tif (empty($this->location))\n\t\t\tthrow new InvalidConfigException('Marker location is missing!');\n\n\t\tif (empty($this->color))\n\t\t\tthrow new InvalidConfigException('Marker colour is missing!');\n\n\t\t$this->color = strtolower($this->color);\n\t\tif (preg_match('/^#[a-z0-9]{3}$/', $this->color))\n\t\t\t$this->color = Marker::_expandHex($this->color);\n\n\t\tif ($this->label === '')\n\t\t\t$this->label = null;\n\n\t\tif ($this->label !== null && strlen($this->label) > 1)\n\t\t\t$this->label = $this->label[0];\n\t}\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function __toString ()\n\t{\n\t\treturn implode('|', [\n\t\t\tJson::encode($this->location),\n\t\t\t$this->color,\n\t\t\t$this->label,\n\t\t]);\n\t}\n\n\tpublic function getLocation ($toLatLng = false): array|string\n\t{\n\t\tif (is_string($this->location))\n\t\t\treturn $toLatLng\n\t\t\t\t? implode(',', array_values(GeoService::latLngFromAddress($this->location)))\n\t\t\t\t: $this->location;\n\n\t\treturn implode(',', array_values($this->location));\n\t}\n\n\t/**\n\t * @return array|string|null\n\t * @throws Exception\n\t */\n\tpublic function getCenter (): array|string|null\n\t{\n\t\tif (is_string($this->location))\n\t\t\treturn GeoService::latLngFromAddress($this->location);\n\n\t\tif (!array_key_exists('lat', $this->location) || !array_key_exists('lng', $this->location))\n\t\t\treturn ['lat' => (float)$this->location[0], 'lng' => (float)$this->location[1]];\n\n\t\treturn $this->location;\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tprivate static function _expandHex ($hex): string\n\t{\n\t\t$r = $hex[1];\n\t\t$g = $hex[2];\n\t\t$b = $hex[3];\n\n\t\treturn '#' . $r . $r . $g . $g . $b . $b;\n\t}\n\n}\n"
  },
  {
    "path": "src/models/Parts.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\enums\\GeoService;\nuse yii\\base\\BaseObject;\n\n/**\n * Class Parts\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass Parts extends BaseObject\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var string|null */\n\tpublic ?string $number = '';\n\n\t/** @var string|null */\n\tpublic ?string $address = '';\n\n\t/** @var string|null */\n\tpublic ?string $city = '';\n\n\t/** @var string|null */\n\tpublic ?string $postcode = '';\n\n\t/** @var string|null */\n\tpublic ?string $county = '';\n\n\t/** @var string|null */\n\tpublic ?string $state = '';\n\n\t/** @var string|null */\n\tpublic ?string $country = '';\n\n\t/** @var string|null */\n\tpublic ?string $planet = 'Earth';\n\n\t/** @var string|null */\n\tpublic ?string $system = 'the Solar System';\n\n\t/** @var string|null */\n\tpublic ?string $arm = 'Orion Arm';\n\n\t/** @var string|null */\n\tpublic ?string $galaxy = 'Milky Way';\n\n\t/** @var string|null */\n\tpublic ?string $group = 'the Local Group';\n\n\t/** @var string|null */\n\tpublic ?string $cluster = 'Virgo Cluster';\n\n\t/** @var string|null */\n\tpublic ?string $supercluster = 'Laniakea Supercluster';\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function __construct ($parts = null, string $service = null)\n\t{\n\t\tparent::__construct();\n\n\t\tif ($parts === null)\n\t\t\treturn $this;\n\n\t\tif (is_string($parts))\n\t\t\t$parts = Json::decodeIfJson($parts);\n\n\t\tswitch ($service)\n\t\t{\n\t\t\tcase GeoService::Nominatim:\n\t\t\t\t$this->_nominatim($parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService::Mapbox:\n\t\t\t\t$this->_mapbox($parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService::GoogleMaps:\n\t\t\t\t$this->_google($parts);\n\t\t\t\tbreak;\n\t\t\tcase GeoService::Here:\n\t\t\t\t$this->_here($parts);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->_fromArray($parts);\n\t\t}\n\t}\n\n\tpublic function getStreetAddress (): string\n\t{\n\t\treturn $this->address;\n\t}\n\n\t// Methods: Private\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Parse Nominatim parts\n\t *\n\t * @param array $parts\n\t */\n\tprivate function _nominatim (array $parts)\n\t{\n\t\t// Add any missing values\n\t\t$keys = [\n\t\t\t'house_number',\n\t\t\t'address29',\n\t\t\t'type',\n\t\t\t'pedestrian',\n\t\t\t'footway',\n\t\t\t'path',\n\t\t\t'road',\n\t\t\t'neighbourhood',\n\t\t\t'suburb',\n\t\t\t'village',\n\t\t\t'town',\n\t\t\t'city_district',\n\t\t\t'city',\n\t\t\t'postcode',\n\t\t\t'county',\n\t\t\t'state_district',\n\t\t\t'state',\n\t\t\t'country',\n\t\t];\n\n\t\tforeach ($keys as $key)\n\t\t\tif (!array_key_exists($key, $parts))\n\t\t\t\t$parts[$key] = null;\n\n\t\t$this->number = $this->_join([\n\t\t\t$parts['house_number'],\n\t\t\t$parts['address29'],\n\t\t\tin_array($parts['type'], [\n\t\t\t\t'pedestrian',\n\t\t\t\t'footway',\n\t\t\t\t'path',\n\t\t\t\t'road',\n\t\t\t\t'neighbourhood',\n\t\t\t\t'suburb',\n\t\t\t\t'village',\n\t\t\t\t'town',\n\t\t\t\t'city_district',\n\t\t\t\t'city',\n\t\t\t]) ? $parts[$parts['type']] : null,\n\t\t]);\n\n\t\t$this->address = $this->_join([\n\t\t\t$parts['pedestrian'],\n\t\t\t$parts['footway'],\n\t\t\t$parts['path'],\n\t\t\t$parts['road'],\n\t\t\t$parts['neighbourhood'],\n\t\t\t$parts['suburb'],\n\t\t]);\n\n\t\t$this->city = $this->_join([\n\t\t\t$parts['village'],\n\t\t\t$parts['town'],\n\t\t\t$parts['city_district'],\n\t\t\t$parts['city'],\n\t\t]);\n\n\t\t$this->postcode = $parts['postcode'];\n\t\t$this->county = $parts['county'];\n\n\t\t$this->state = $this->_join([\n\t\t\t$parts['state_district'],\n\t\t\t$parts['state'],\n\t\t]);\n\n\t\t$this->country = $parts['country'];\n\t}\n\n\t/**\n\t * Parse Mapbox parts\n\t *\n\t * @param array $parts\n\t */\n\tprivate function _mapbox (array $parts)\n\t{\n\t\t$parts = array_reduce(\n\t\t\t$parts['context'],\n\t\t\tfunction ($a, $part) {\n\t\t\t\t$key     = explode('.', $part['id'])[0];\n\t\t\t\t$a[$key] = $part['text'];\n\n\t\t\t\treturn $a;\n\t\t\t},\n\t\t\t[\n\t\t\t\t'number' => @$parts['address'],\n\t\t\t\t$parts['place_type'][0] => $parts['text'],\n\t\t\t]\n\t\t);\n\n\t\t$this->number   = @$parts['number'];\n\t\t$this->address  = @$parts['address'];\n\t\t$this->city     = @$parts['city'];\n\t\t$this->postcode = @$parts['postcode'];\n\t\t$this->county   = @$parts['county'];\n\t\t$this->state    = @$parts['state'];\n\t\t$this->country  = @$parts['country'];\n\t}\n\n\t/**\n\t * Parse Google parts\n\t *\n\t * @param $parts\n\t */\n\tprivate function _google ($parts)\n\t{\n\t\tif (!$this->_isAssoc($parts))\n\t\t{\n\t\t\t$parts = array_reduce(\n\t\t\t\t$parts,\n\t\t\t\tfunction ($a, $part) {\n\t\t\t\t\t$key     = $part['types'][0];\n\t\t\t\t\t$a[$key] = $part['long_name'];\n\n\t\t\t\t\treturn $a;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\t\t}\n\n\t\tforeach (PartsLegacy::$legacyKeys as $key)\n\t\t\tif (!array_key_exists($key, $parts))\n\t\t\t\t$parts[$key] = '';\n\n\t\t$this->number = $parts['number'] ?? $this->_join([\n\t\t\t$parts['subpremise'],\n\t\t\t$parts['premise'],\n\t\t\t$parts['street_number'],\n\t\t]);\n\n\t\t$this->address = $parts['address'] ?? $this->_join([\n\t\t\t$parts['route'],\n\t\t\t$parts['neighborhood'],\n\t\t\t$parts['sublocality_level_5'],\n\t\t\t$parts['sublocality_level_4'],\n\t\t\t$parts['sublocality_level_3'],\n\t\t\t$parts['sublocality_level_2'],\n\t\t\t$parts['sublocality_level_1'],\n\t\t\t$parts['sublocality'],\n\t\t]);\n\n\t\t$this->city = $parts['city'] ?? $this->_join([\n\t\t\t$parts['postal_town'],\n\t\t\t$parts['locality'],\n\t\t]);\n\n\t\t$this->postcode = $parts['postcode'] ?? $parts['postal_code'] ?? $parts['postal_code_prefix'];\n\t\t$this->county = $parts['county'] ?? $parts['administrative_area_level_2'];\n\t\t$this->state = $parts['state'] ?? $parts['administrative_area_level_1'];\n\t\t$this->country = $parts['country'];\n\t}\n\n\t/**\n\t * Parse Here parts\n\t *\n\t * @param $parts\n\t */\n\tprivate function _here ($parts)\n\t{\n\t\t$parts = array_merge(\n\t\t\t$parts,\n\t\t\tarray_reduce($parts['additionalData'], function ($a, $b) {\n\t\t\t\t$a[$b['key']] = $b['value'];\n\t\t\t\treturn $a;\n\t\t\t}, [])\n\t\t);\n\n\t\t$this->number   = $parts['number'];\n\t\t$this->address  = $this->_join([\n\t\t\t$parts['street'],\n\t\t\t$parts['district'],\n\t\t]);\n\t\t$this->city     = $parts['city'];\n\t\t$this->postcode = $parts['postalCode'];\n\t\t$this->county   = $parts['CountyName'] ?? $parts['county'];\n\t\t$this->state    = $parts['StateName'] ?? $parts['state'];\n\t\t$this->country  = $parts['CountryName'] ?? $parts['country'];\n\t}\n\n\t// Methods: Helpers\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Determines if the given array of parts contains legacy data\n\t *\n\t * @param array|null $parts\n\t *\n\t * @return bool\n\t */\n\tpublic static function isLegacy (array $parts = null): bool\n\t{\n\t\tif ($parts === null)\n\t\t\treturn false;\n\n\t\t$keys = PartsLegacy::$legacyKeys;\n\n\t\tunset($keys[array_search('country', $keys)]);\n\n\t\tforeach ($keys as $key)\n\t\t\tif (isset($parts[$key]) || array_key_exists($key, $parts))\n\t\t\t\treturn true;\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Filters and joins the given array\n\t *\n\t * @param array $parts\n\t *\n\t * @return string\n\t */\n\tprivate function _join (array $parts): string\n\t{\n\t\treturn implode(', ', array_filter($parts));\n\t}\n\n\t/**\n\t * Populates Parts from the given array\n\t *\n\t * @param array $parts\n\t */\n\tprivate function _fromArray (array $parts)\n\t{\n\t\t$this->number   = $parts['number'] ?? '';\n\t\t$this->address  = $parts['address'] ?? '';\n\t\t$this->city     = $parts['city'] ?? '';\n\t\t$this->postcode = $parts['postcode'] ?? '';\n\t\t$this->county   = $parts['county'] ?? '';\n\t\t$this->state    = $parts['state'] ?? '';\n\t\t$this->country  = $parts['country'] ?? '';\n\t}\n\n\t/**\n\t * Returns true if the given array is associative\n\t *\n\t * @param array $arr\n\t *\n\t * @return bool\n\t */\n\tprotected function _isAssoc (array $arr): bool\n\t{\n\t\tif ([] === $arr) return false;\n\t\treturn array_keys($arr) !== range(0, count($arr) - 1);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/PartsLegacy.php",
    "content": "<?php\n/**\n * Maps for Craft CMS 3\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse Craft;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\enums\\GeoService;\n\n/**\n * Class PartsLegacy\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass PartsLegacy extends Parts\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t// Properties: Static\n\t// -------------------------------------------------------------------------\n\n\tpublic static array $legacyKeys = [\n\t\t'administrative_area_level_1',\n\t\t'administrative_area_level_2',\n\t\t'administrative_area_level_3',\n\t\t'administrative_area_level_4',\n\t\t'administrative_area_level_5',\n\t\t'airport',\n\t\t'bus_station',\n\t\t'colloquial_area',\n\t\t'country',\n\t\t'establishment',\n\t\t'floor',\n\t\t'intersection',\n\t\t'locality',\n\t\t'natural_feature',\n\t\t'neighborhood',\n\t\t'park',\n\t\t'parking',\n\t\t'point_of_interest',\n\t\t'political',\n\t\t'post_box',\n\t\t'postal_code',\n\t\t'postal_code_prefix',\n\t\t'postal_code_suffix',\n\t\t'postal_town',\n\t\t'premise',\n\t\t'room',\n\t\t'route',\n\t\t'street_address',\n\t\t'street_number',\n\t\t'sublocality',\n\t\t'sublocality_level_1',\n\t\t'sublocality_level_2',\n\t\t'sublocality_level_3',\n\t\t'sublocality_level_4',\n\t\t'sublocality_level_5',\n\t\t'subpremise',\n\t\t'train_station',\n\t\t'transit_station',\n\t];\n\n\t// Properties: Instance\n\t// -------------------------------------------------------------------------\n\n\tpublic $administrative_area_level_1;\n\tpublic $administrative_area_level_2;\n\tpublic $administrative_area_level_3;\n\tpublic $administrative_area_level_4;\n\tpublic $administrative_area_level_5;\n\tpublic $airport;\n\tpublic $bus_station;\n\tpublic $colloquial_area;\n\tpublic $establishment;\n\tpublic $floor;\n\tpublic $intersection;\n\tpublic $locality;\n\tpublic $natural_feature;\n\tpublic $neighborhood;\n\tpublic $park;\n\tpublic $parking;\n\tpublic $point_of_interest;\n\tpublic $political;\n\tpublic $post_box;\n\tpublic $postal_code;\n\tpublic $postal_code_prefix;\n\tpublic $postal_code_suffix;\n\tpublic $postal_town;\n\tpublic $premise;\n\tpublic $room;\n\tpublic $route;\n\tpublic $street_address;\n\tpublic $street_number;\n\tpublic $sublocality;\n\tpublic $sublocality_level_1;\n\tpublic $sublocality_level_2;\n\tpublic $sublocality_level_3;\n\tpublic $sublocality_level_4;\n\tpublic $sublocality_level_5;\n\tpublic $subpremise;\n\tpublic $train_station;\n\tpublic $transit_station;\n\n\tpublic $administrative_area_level_1_short;\n\tpublic $administrative_area_level_2_short;\n\tpublic $administrative_area_level_3_short;\n\tpublic $administrative_area_level_4_short;\n\tpublic $administrative_area_level_5_short;\n\tpublic $airport_short;\n\tpublic $bus_station_short;\n\tpublic $colloquial_area_short;\n\tpublic $establishment_short;\n\tpublic $floor_short;\n\tpublic $intersection_short;\n\tpublic $locality_short;\n\tpublic $natural_feature_short;\n\tpublic $neighborhood_short;\n\tpublic $park_short;\n\tpublic $parking_short;\n\tpublic $point_of_interest_short;\n\tpublic $political_short;\n\tpublic $post_box_short;\n\tpublic $postal_code_short;\n\tpublic $postal_code_prefix_short;\n\tpublic $postal_code_suffix_short;\n\tpublic $postal_town_short;\n\tpublic $premise_short;\n\tpublic $room_short;\n\tpublic $route_short;\n\tpublic $street_address_short;\n\tpublic $street_number_short;\n\tpublic $sublocality_short;\n\tpublic $sublocality_level_1_short;\n\tpublic $sublocality_level_2_short;\n\tpublic $sublocality_level_3_short;\n\tpublic $sublocality_level_4_short;\n\tpublic $sublocality_level_5_short;\n\tpublic $subpremise_short;\n\tpublic $train_station_short;\n\tpublic $transit_station_short;\n\n\t// Constructor\n\t// =========================================================================\n\n\tpublic function __construct ($parts = null)\n\t{\n\t\tif (!$this->_isAssoc($parts))\n\t\t{\n\t\t\t$parts = array_reduce(\n\t\t\t\t$parts,\n\t\t\t\tfunction ($a, $part) {\n\t\t\t\t\t$key     = $part['types'][0];\n\t\t\t\t\t$a[$key] = $part['long_name'];\n\n\t\t\t\t\treturn $a;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\t\t}\n\n\t\t\\Yii::configure($this, $parts);\n\n\t\tparent::__construct($parts, GeoService::GoogleMaps);\n\t}\n\n\tpublic function __set ($name, $value)\n\t{\n\t\t// Prevent setting any new parameters that we don't support\n\t\tif (!$this->hasProperty($name))\n\t\t{\n\t\t\t$name = Json::encode($name);\n\t\t\t$value = Json::encode($value);\n\n\t\t\tCraft::info(\n\t\t\t\t'Attempted to set unsupported legacy part: \"' . $name . '\" to value \"' . $value . '\"',\n\t\t\t\t'simplemap'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tparent::__set($name, $value);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/Point.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse Imagine\\Image\\BoxInterface;\nuse Imagine\\Image\\PointInterface;\n\n/**\n * Class Point\n *\n * Custom Point class to allow negative coordinates\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass Point implements PointInterface\n{\n\n\t/**\n\t * @var int\n\t */\n\tprivate int $x;\n\n\t/**\n\t * @var int\n\t */\n\tprivate int $y;\n\n\t/**\n\t * Constructs a point of coordinates.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t */\n\tpublic function __construct (int $x, int $y)\n\t{\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t}\n\n\t/**\n\t * {@inheritdoc}\n\t *\n\t * @see \\Imagine\\Image\\PointInterface::getX()\n\t */\n\tpublic function getX (): int\n\t{\n\t\treturn $this->x;\n\t}\n\n\t/**\n\t * {@inheritdoc}\n\t *\n\t * @see \\Imagine\\Image\\PointInterface::getY()\n\t */\n\tpublic function getY (): int\n\t{\n\t\treturn $this->y;\n\t}\n\n\t/**\n\t * {@inheritdoc}\n\t *\n\t * @see \\Imagine\\Image\\PointInterface::in()\n\t */\n\tpublic function in (BoxInterface $box): bool\n\t{\n\t\treturn $this->x < $box->getWidth() && $this->y < $box->getHeight();\n\t}\n\n\t/**\n\t * {@inheritdoc}\n\t *\n\t * @see \\Imagine\\Image\\PointInterface::move()\n\t */\n\tpublic function move ($amount): Point|PointInterface\n\t{\n\t\treturn new self($this->x + $amount, $this->y + $amount);\n\t}\n\n\t/**\n\t * {@inheritdoc}\n\t *\n\t * @see \\Imagine\\Image\\PointInterface::__toString()\n\t */\n\tpublic function __toString ()\n\t{\n\t\treturn sprintf('(%d, %d)', $this->x, $this->y);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/Settings.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse Craft;\nuse craft\\base\\Model;\nuse craft\\helpers\\App;\nuse craft\\helpers\\ConfigHelper;\nuse ether\\simplemap\\enums\\GeoService;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\services\\GeoLocationService;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\n\n/**\n * Class Settings\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass Settings extends Model\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @deprecated */\n\tpublic $browserApiKey, $serverApiKey, $apiKey, $unrestrictedApiKey;\n\n\t// Properties: Map\n\t// -------------------------------------------------------------------------\n\n\t/** @var string The map tile set to use */\n\tpublic string $mapTiles = MapTiles::CartoVoyager;\n\n\t/** @var string|array The token for the map tile set */\n\tpublic string|array $mapToken = '';\n\n\t// Properties: Geo-coding\n\t// -------------------------------------------------------------------------\n\n\t/** @var string The geo-coding service to use */\n\tpublic string $geoService = GeoService::Nominatim;\n\n\t/** @var string|array The token for the geo-coding service */\n\tpublic string|array $geoToken = '';\n\n\t/**\n\t * @var bool Will disable the automatic population of missing field data.\n\t *   This can be useful in preventing API spam when importing lots of map\n\t *   data.\n\t */\n\tpublic bool $disablePopulateMissingFieldData = false;\n\n\t// Properties: w3w\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * @var bool Will enable what3words integration when set to true\n\t */\n\tpublic bool $w3wEnabled = false;\n\n\t/**\n\t * @var string The token (API Key) for what3words\n\t */\n\tpublic string $w3wToken = '';\n\n\t// Properties: Geo-location\n\t// -------------------------------------------------------------------------\n\n\t/** @var string The geo-location service */\n\tpublic string $geoLocationService = GeoLocationService::None;\n\n\t/** @var string|array The token for the geo-location service */\n\tpublic string|array $geoLocationToken = '';\n\n\t/** @var string|int How long to cache IP look-ups for (set to 0 to disable caching) */\n\tpublic string|int $geoLocationCacheDuration = 'P2M';\n\n\t/** @var bool Will automatically redirect the user according to $geoLocationRedirectMap when true */\n\tpublic bool $geoLocationAutoRedirect = false;\n\n\t/**\n\t * @var array A key value array where key is the handle of the site to\n\t *   redirect, and value is a key value array of user location properties\n\t *   and their required matches or an * string to catch all.\n\t *\n\t * @example [\n\t *   'uk'     => [ 'countryCode' => 'uk' ],\n\t *   'eu'     => [ 'isEU' => true ],\n\t *   'global' => '*',\n\t * ]\n\t */\n\tpublic array $geoLocationRedirectMap = [];\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic function __construct ($config = [])\n\t{\n\t\tparent::__construct($config);\n\n\t\ttry {\n\t\t\t$this->geoLocationCacheDuration = ConfigHelper::durationInSeconds(\n\t\t\t\t$this->geoLocationCacheDuration\n\t\t\t);\n\t\t} catch (Exception $e) {\n\t\t\tCraft::error($e->getMessage());\n\t\t}\n\t}\n\n\tpublic function isW3WEnabled (): bool\n\t{\n\t\treturn $this->w3wEnabled && SimpleMap::v(SimpleMap::EDITION_PRO);\n\t}\n\n\t// Getters\n\t// =========================================================================\n\n\tpublic function getMapToken (): bool|array|string|null\n\t{\n\t\treturn $this->_parseEnv($this->mapToken);\n\t}\n\n\tpublic function getGeoToken (): bool|array|string|null\n\t{\n\t\treturn $this->_parseEnv($this->geoToken);\n\t}\n\n\tpublic function getW3WToken (): bool|array|string|null\n\t{\n\t\treturn $this->_parseEnv($this->w3wToken);\n\t}\n\n\tpublic function getGeoLocationToken (): bool|array|string|null\n\t{\n\t\treturn $this->_parseEnv($this->geoLocationToken);\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tprivate function _parseEnv ($value): array|bool|string|null\n\t{\n\t\tif (is_string($value))\n\t\t\treturn App::parseEnv($value);\n\n\t\treturn array_map(function ($v) {\n\t\t\treturn App::parseEnv($v);\n\t\t}, $value);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/StaticOptions.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse ether\\simplemap\\services\\GeoService;\nuse Exception;\nuse Yii;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class StaticOptions\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass StaticOptions\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var string|array Can be an address string, or a [lat, lng] or ['lat' => lat, 'lng' => lng] array */\n\tpublic string|array $center = [51.272154, 0.514951];\n\n\t/** @var string|array Must be [lat, lng] or ['lat' => lat, 'lng' => lng] array */\n\tpublic string|array $centerFallback = [51.272154, 0.514951];\n\n\t/** @var int The width of the map */\n\tpublic int $width = 640;\n\n\t/** @var int The height of the map */\n\tpublic int $height = 480;\n\n\t/** @var int The maps zoom level */\n\tpublic int $zoom = 12;\n\n\t/** @var int The scale of the map image (i.e. 2 for @2x retina screens) */\n\tpublic int $scale = 1;\n\n\t/**\n\t * @var Marker[] An array of map markers\n\t */\n\tpublic array $markers = [];\n\n\t// Constructor\n\t// =========================================================================\n\n\t/**\n\t * StaticOptions constructor.\n\t *\n\t * @param array $config\n\t *\n\t * @throws InvalidConfigException\n\t * @throws Exception\n\t */\n\tpublic function __construct (array $config = [])\n\t{\n\t\t$center = $config['center'] ?? null;\n\n\t\tif ($center instanceof Map)\n\t\t\t$center = ['lat' => $center->lat, 'lng' => $center->lng, 'zoom' => $center->zoom];\n\t\telseif ($center instanceof UserLocation)\n\t\t\t$center = ['lat' => $center->lat, 'lng' => $center->lng];\n\t\telseif (is_string($center))\n\t\t\t$center = GeoService::latLngFromAddress($center);\n\n\t\tif (empty($center))\n\t\t\t$center = $config['centerFallback'] ?? $this->centerFallback;\n\n\t\t$config['center'] = $center;\n\n\t\t$markers = $config['markers'] ?? [];\n\t\tunset($config['markers']);\n\n\t\tif (!empty($config))\n\t\t\tYii::configure($this, $config);\n\n\t\tforeach (['center', 'zoom', 'scale'] as $key)\n\t\t\tif (empty($this->$key))\n\t\t\t\tthrow new InvalidConfigException('Map ' . $key . ' is missing!');\n\n\t\tif (!empty($markers))\n\t\t{\n\t\t\tforeach ($markers as $marker)\n\t\t\t{\n\t\t\t\tif (!array_key_exists('location', $marker) || empty($marker['location']))\n\t\t\t\t\t$marker['location'] = $this->center;\n\n\t\t\t\t$this->markers[] = new Marker($marker);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Getters\n\t// =========================================================================\n\n\t/**\n\t * @return array|string|null\n\t * @throws Exception\n\t */\n\tpublic function getCenter (): array|string|null\n\t{\n\t\tif (!array_key_exists('lat', $this->center) || !array_key_exists('lng', $this->center))\n\t\t\t$this->center = ['lat' => $this->center[0], 'lng' => $this->center[1]];\n\n\t\t$this->center['lat'] = floatval($this->center['lat']);\n\t\t$this->center['lng'] = floatval($this->center['lng']);\n\n\t\treturn $this->center;\n\t}\n\n\tpublic function getSize (): string\n\t{\n\t\treturn ($this->width ?? 0) . 'x' . ($this->height ?? 0);\n\t}\n\n}\n"
  },
  {
    "path": "src/models/UserLocation.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\models;\n\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\services\\GeoService;\nuse Exception;\nuse Yii;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class UserLocation\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\models\n */\nclass UserLocation extends BaseLocation\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @var string */\n\tpublic string $ip;\n\n\t/** @var string */\n\tpublic string $countryCode;\n\n\t/** @var bool */\n\tpublic bool $isEU;\n\n\t// Methods\n\t// =========================================================================\n\n\t/**\n\t * Get the distance from this user location to the given location\n\t *\n\t * @param array  $to   - a lat/lng keyed array\n\t * @param string $unit - the unit to measure by (either 'mi' (miles) or\n\t *                     'km' (kilometers))\n\t *\n\t * @return float|int\n\t * @throws InvalidConfigException\n\t * @throws Exception\n\t */\n\tpublic function distance (array $to, string $unit = 'km'): float|int\n\t{\n\t\t// Normalize unit\n\t\t$unit = GeoService::normalizeDistance($unit);\n\n\t\t// Base Distance\n\t\t$distance = $unit === 'km' ? '111.045' : '69.0';\n\n\t\t// Coordinates\n\t\t$to = GeoService::normalizeLocation($to);\n\n\t\tif (empty($to))\n\t\t\tthrow new InvalidConfigException('Invalid target lat/lng');\n\n\t\t$targetLat = $to['lat'];\n\t\t$targetLng = $to['lng'];\n\n\t\treturn (\n\t\t\t$distance *\n\t\t\trad2deg(\n\t\t\t\tacos(\n\t\t\t\t\tcos(deg2rad($this->lat)) *\n\t\t\t\t\tcos(deg2rad($targetLat)) *\n\t\t\t\t\tcos(deg2rad($this->lng) - deg2rad($targetLng)) +\n\t\t\t\t\tsin(deg2rad($this->lat)) *\n\t\t\t\t\tsin(deg2rad($targetLat))\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t}\n\n}\n"
  },
  {
    "path": "src/records/Map.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\records;\n\nuse craft\\db\\ActiveRecord;\nuse craft\\records\\Element;\nuse craft\\records\\Field;\nuse craft\\records\\Site;\nuse yii\\db\\ActiveQueryInterface;\n\n/**\n * Class Map\n *\n * @property int    $id\n * @property int    $ownerId\n * @property int    $ownerSiteId\n * @property int    $fieldId\n * @property float  $lat\n * @property float  $lng\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\records\n */\nclass Map extends ActiveRecord\n{\n\n\t// Properties\n\t// =========================================================================\n\n\t/** @deprecated Remove in 4.x */\n\tconst OldTableName = '{{%simplemaps}}';\n\n\tconst TableName = '{{%maps}}';\n\tconst TableNameClean = 'maps';\n\n\t// Methods\n\t// =========================================================================\n\n\tpublic static function tableName (): string\n\t{\n\t\treturn self::TableName;\n\t}\n\n\tpublic function getOwner (): ActiveQueryInterface\n\t{\n\t\treturn $this->hasOne(Element::class, ['id' => 'ownerId']);\n\t}\n\n\tpublic function getOwnerSite (): ActiveQueryInterface\n\t{\n\t\treturn $this->hasOne(Site::class, ['id' => 'ownerSiteId']);\n\t}\n\n\tpublic function getField (): ActiveQueryInterface\n\t{\n\t\treturn $this->hasOne(Field::class, ['id' => 'fieldId']);\n\t}\n\n}\n"
  },
  {
    "path": "src/resources/OpenSans_LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "src/services/EmbedService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse Craft;\nuse craft\\base\\Component;\nuse craft\\helpers\\Json;\nuse craft\\helpers\\Template;\nuse craft\\web\\View;\nuse enshrined\\svgSanitize\\Sanitizer;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\models\\EmbedOptions;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class EmbedService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass EmbedService extends Component\n{\n\n\t// Constants\n\t// =========================================================================\n\n\tconst JSON_OPTS = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;\n\n\t// Embed\n\t// =========================================================================\n\n\t/**\n\t * @param array $options\n\t *\n\t * @return string|void\n\t * @throws InvalidConfigException\n\t * @throws Exception\n\t */\n\tpublic function embed (array $options = [])\n\t{\n\t\tif (SimpleMap::v(SimpleMap::EDITION_LITE))\n\t\t\treturn 'Sorry, embed maps are a Maps Pro feature!';\n\n\t\t$options = new EmbedOptions($options);\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tcase MapTiles::GoogleHybrid:\n\t\t\tcase MapTiles::GoogleRoadmap:\n\t\t\tcase MapTiles::GoogleTerrain:\n\t\t\t\t$code = $this->_embedGoogle($options, $settings);\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitHybrid:\n\t\t\tcase MapTiles::MapKitMutedStandard:\n\t\t\tcase MapTiles::MapKitSatellite:\n\t\t\tcase MapTiles::MapKitStandard:\n\t\t\t\t$code = $this->_embedApple($options, $settings);\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxDark:\n\t\t\tcase MapTiles::MapboxLight:\n\t\t\tcase MapTiles::MapboxOutdoors:\n\t\t\tcase MapTiles::MapboxStreets:\n\t\t\t\t$code = $this->_embedMapbox($options, $settings);\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereHybrid:\n\t\t\tcase MapTiles::HereNormalDay:\n\t\t\tcase MapTiles::HereNormalDayGrey:\n\t\t\tcase MapTiles::HereNormalDayTransit:\n\t\t\tcase MapTiles::HerePedestrian:\n\t\t\tcase MapTiles::HereReduced:\n\t\t\tcase MapTiles::HereSatellite:\n\t\t\tcase MapTiles::HereTerrain:\n\t\t\t\t$code = $this->_embedHere($options, $settings);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$code = $this->_embedDefault($options, $settings);\n\t\t}\n\n\t\treturn Template::raw($code);\n\t}\n\n\t// Embed-ers\n\t// =========================================================================\n\n\t/**\n\t * @param EmbedOptions $options\n\t * @param Settings     $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _embedGoogle (EmbedOptions $options, Settings $settings): string\n\t{\n\t\t$view = Craft::$app->getView();\n\t\t$callbackName = 'init_' . $options->id;\n\t\t$loadedCallbackName =  $options->id . '_loaded';\n\n\t\t$mapTypeId = match ($settings->mapTiles)\n\t\t{\n\t\t\tMapTiles::GoogleRoadmap => 'roadmap',\n\t\t\tMapTiles::GoogleTerrain => 'terrain',\n\t\t\tdefault => 'hybrid',\n\t\t};\n\n\t\t$formattedOptions = Json::encode(\n\t\t\tarray_merge(\n\t\t\t\t[\n\t\t\t\t\t'zoom' => $options->zoom,\n\t\t\t\t],\n\t\t\t\t$options->options,\n\t\t\t\t[\n\t\t\t\t\t'center'    => $options->getCenter(),\n\t\t\t\t\t'mapTypeId' => $mapTypeId,\n\t\t\t\t]\n\t\t\t),\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$formattedMarkers = [];\n\n\t\tforeach ($options->markers as $marker)\n\t\t\t$formattedMarkers[] = [\n\t\t\t\t'position' => $marker->getCenter(),\n\t\t\t\t'label' => $marker->label,\n\t\t\t\t// TODO: Add custom colour support\n\t\t\t];\n\n\t\t$formattedMarkers = Json::encode(\n\t\t\t$formattedMarkers,\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$params = http_build_query([\n\t\t\t'key' => $settings->getMapToken(),\n\t\t\t'callback' => $callbackName,\n\t\t\t'language' => Craft::$app->getSites()->getCurrentSite()->language,\n\t\t]);\n\n\t\t$js = <<<JS\nlet {$options->id};\n\nfunction {$callbackName} () {\n\t{$options->id} = new google.maps.Map(document.getElementById('{$options->id}'), $formattedOptions);\n\n\t{$options->id}._markers = [];\n\t{$formattedMarkers}.forEach(function (marker) {\n\t\tmarker.map = {$options->id};\n\t\t{$options->id}._markers.push(new google.maps.Marker(marker));\n\t});\n}\nJS;\n\n\n\t\t$view->registerScript($js, View::POS_END);\n\n\t\t$this->_js(\n\t\t\t'https://maps.googleapis.com/maps/api/js?' . $params,\n\t\t\t['async' => '', 'defer' => '', 'onload' => \"typeof {$loadedCallbackName} != 'undefined' && {$loadedCallbackName}()\"]\n\t\t);\n\n\t\t$css = $this->_getCss($options);\n\t\t$css && $view->registerCss($css);\n\n\t\treturn '<div id=\"' . $options->id . '\"></div>';\n\t}\n\n\t/**\n\t * @param EmbedOptions $options\n\t * @param Settings     $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _embedApple (EmbedOptions $options, Settings $settings): string\n\t{\n\t\t$view = Craft::$app->getView();\n\n\t\t$token = GeoService::getToken(\n\t\t\t$settings->getMapToken(),\n\t\t\t$settings->mapTiles\n\t\t);\n\t\t$latLng = implode(', ', array_values($options->getCenter()));\n\n\t\t$formattedOptions = Json::encode(\n\t\t\tarray_merge(\n\t\t\t\t$options->options,\n\t\t\t\t[\n\t\t\t\t\t'center'         => '##CENTER##',\n\t\t\t\t\t'cameraDistance' => '##ZOOM##',\n\t\t\t\t\t'mapType'        => '##MAPTYPE##',\n\t\t\t\t]\n\t\t\t),\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tdefault:\n\t\t\tcase MapTiles::MapKitStandard:\n\t\t\t\t$type = 'Standard';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitSatellite:\n\t\t\t\t$type = 'Satellite';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitMutedStandard:\n\t\t\t\t$type = 'MutedStandard';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitHybrid:\n\t\t\t\t$type = 'Hybrid';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$formattedOptions = str_replace([\n\t\t\t'\"##CENTER##\"',\n\t\t\t'\"##ZOOM##\"',\n\t\t\t'\"##MAPTYPE##\"',\n\t\t], [\n\t\t\t'new mapkit.Coordinate(' . $latLng . ')',\n\t\t\t'156543.03392 * Math.cos(' . $options->getCenter()['lat'] . ' * Math.PI / 180) / Math.pow(2, ' . $options->zoom . ') * ' . $options->width,\n\t\t\t'mapkit.Map.MapTypes.' . $type,\n\t\t], $formattedOptions);\n\n\t\t$formattedMarkers = [];\n\n\t\tforeach ($options->markers as $marker)\n\t\t\t$formattedMarkers[] = [\n\t\t\t\t'position' => array_values($marker->getCenter()),\n\t\t\t\t'label'    => $marker->label,\n\t\t\t\t'color'    => $marker->color,\n\t\t\t];\n\n\t\t$formattedMarkers = Json::encode(\n\t\t\t$formattedMarkers,\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$initJs = <<<JS\nmapkit.init({ authorizationCallback: function (done) { done('{$token}') } });\nJS;\n\n\n\t\t$js = <<<JS\nconst {$options->id} = new mapkit.Map('{$options->id}', {$formattedOptions});\n{$options->id}._markers = [];\n{$formattedMarkers}.forEach(function (marker) {\n\tmarker.position.unshift(null);\n\tconst m = new mapkit.MarkerAnnotation(\n\t\tnew (mapkit.Coordinate.bind.apply(mapkit.Coordinate, marker.position)),\n\t\t{\n\t\t\tglyphText: marker.label || '',\n\t\t\tcolor: marker.color || '',\n\t\t}\n\t);\n\t{$options->id}._markers.push(m);\n\t{$options->id}.addAnnotation(m);\n});\nJS;\n\n\t\t$css = $this->_getCss($options);\n\n\t\t$this->_js('https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js');\n\t\t$view->registerJs($initJs, View::POS_END);\n\t\t$view->registerJs($js, View::POS_END);\n\t\t$css && $view->registerCss($css);\n\n\t\treturn '<div id=\"' . $options->id . '\"></div>';\n\t}\n\n\t/**\n\t * @param EmbedOptions $options\n\t * @param Settings     $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _embedMapbox (EmbedOptions $options, Settings $settings): string\n\t{\n\t\t$view = Craft::$app->getView();\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tdefault:\n\t\t\tcase MapTiles::MapboxStreets:\n\t\t\t\t$type = 'streets-v11';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxOutdoors:\n\t\t\t\t$type = 'outdoors-v11';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxLight:\n\t\t\t\t$type = 'light-v10';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxDark:\n\t\t\t\t$type = 'dark-v10';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$formattedOptions = Json::encode(\n\t\t\tarray_merge(\n\t\t\t\t[\n\t\t\t\t\t'style' => 'mapbox://styles/mapbox/' . $type,\n\t\t\t\t\t'zoom' => $options->zoom,\n\t\t\t\t],\n\t\t\t\t$options->options,\n\t\t\t\t[\n\t\t\t\t\t'container' => $options->id,\n\t\t\t\t\t'center' => array_reverse(array_values($options->getCenter())),\n\t\t\t\t]\n\t\t\t),\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$formattedMarkers = [];\n\n\t\tforeach ($options->markers as $marker)\n\t\t\t$formattedMarkers[] = [\n\t\t\t\t'position' => array_reverse(array_values($marker->getCenter())),\n\t\t\t\t// TODO: Add label support\n\t\t\t\t'color'    => $marker->color,\n\t\t\t];\n\n\t\t$formattedMarkers = Json::encode(\n\t\t\t$formattedMarkers,\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$initJs = <<<JS\nmapboxgl.accessToken = '{$settings->getMapToken()}';\nJS;\n\n\n\t\t$js = <<<JS\nconst {$options->id} = new mapboxgl.Map({$formattedOptions});\n{$options->id}._markers = [];\n{$formattedMarkers}.forEach(function (marker) {\n\t{$options->id}._markers.push(\n\t\tnew mapboxgl.Marker({ color: marker.color })\n\t\t\t.setLngLat(marker.position)\n\t\t\t.addTo({$options->id})\n\t);\n});\nJS;\n\n\t\t$css = $this->_getCss($options);\n\n\t\t$this->_js('https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.1/mapbox-gl.js');\n\t\t$view->registerCssFile('https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.1/mapbox-gl.css');\n\t\t$view->registerJs($initJs, View::POS_END);\n\t\t$view->registerJs($js, View::POS_END);\n\t\t$css && $view->registerCss($css);\n\n\t\treturn '<div id=\"' . $options->id . '\"></div>';\n\t}\n\n\t/**\n\t * @param EmbedOptions $options\n\t * @param Settings     $settings\n\t *\n\t * @return string\n\t * @throws InvalidConfigException\n\t */\n\tprivate function _embedHere (EmbedOptions $options, Settings $settings): string\n\t{\n\t\tif (!array_key_exists('apiKey', $settings->getMapToken()) || !$settings->getMapToken()['apiKey'])\n\t\t\tthrow new InvalidConfigException('Missing HERE API Key');\n\n\t\t$view = Craft::$app->getView();\n\t\t$markerIcon = $this->_iconSvg();\n\n\t\t$formattedOptions = Json::encode(\n\t\t\tarray_merge(\n\t\t\t\t[\n\t\t\t\t\t'zoom' => $options->zoom,\n\t\t\t\t],\n\t\t\t\t$options->options,\n\t\t\t\t[\n\t\t\t\t\t'center'     => $options->getCenter(),\n\t\t\t\t\t'pixelRatio' => '##PIXELRATIO##',\n\t\t\t\t]\n\t\t\t),\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$formattedOptions = str_replace([\n\t\t\t'\"##PIXELRATIO##\"',\n\t\t], [\n\t\t\t'window.devicePixelRatio || 1',\n\t\t], $formattedOptions);\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tdefault:\n\t\t\tcase MapTiles::HereReduced:\n\t\t\tcase MapTiles::HerePedestrian:\n\t\t\tcase MapTiles::HereNormalDay:\n\t\t\t\t$type = 'normal.map';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereTerrain:\n\t\t\tcase MapTiles::HereNormalDayGrey:\n\t\t\t\t$type = 'terrain.map';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereNormalDayTransit:\n\t\t\t\t$type = 'normal.transit';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereSatellite:\n\t\t\t\t$type = 'satellite.xbase';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereHybrid:\n\t\t\t\t$type = 'satellite.map';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$formattedMarkers = [];\n\n\t\tforeach ($options->markers as $marker)\n\t\t\t$formattedMarkers[] = [\n\t\t\t\t'position' => $marker->getCenter(),\n\t\t\t\t'label'    => $marker->label ?: '',\n\t\t\t\t'color'    => $marker->color,\n\t\t\t];\n\n\t\t$formattedMarkers = Json::encode(\n\t\t\t$formattedMarkers,\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$initJs = <<<JS\nconst HERE_platform = new H.service.Platform({ apikey: '{$settings->getMapToken()['apiKey']}' });\nwindow.HERE_defaultLayers = HERE_platform.createDefaultLayers();\nJS;\n\n\t\t$js = <<<JS\nconst {$options->id} = new H.Map(\n\tdocument.getElementById('{$options->id}'),\n\twindow.HERE_defaultLayers.raster.{$type},\n\t{$formattedOptions}\n);\n\n{$options->id}._behaviour = new H.mapevents.Behavior(new H.mapevents.MapEvents({$options->id}));\n{$options->id}._ui = H.ui.UI.createDefault({$options->id}, window.HERE_defaultLayers);\n{$options->id}._markers = [];\n\n{$formattedMarkers}.forEach(function (marker) {\n\tconst m = new H.map.Marker(\n\t\tmarker.position,\n\t\t{\n\t\t\ticon: new H.map.Icon('{$markerIcon}'.replace('##FILL##', marker.color).replace('##LABEL##', marker.label)),\n\t\t}\n\t);\n\t{$options->id}._markers.push(m);\n\t{$options->id}.addObject(m);\n});\n\nwindow.addEventListener('resize', function () { {$options->id}.getViewPort().resize() });\nJS;\n\n\t\t$css = $this->_getCss($options);\n\n\t\t$this->_js('https://js.api.here.com/v3/3.1/mapsjs-core.js');\n\t\t$this->_js('https://js.api.here.com/v3/3.1/mapsjs-service.js');\n\t\t$this->_js('https://js.api.here.com/v3/3.1/mapsjs-ui.js');\n\t\t$this->_js('https://js.api.here.com/v3/3.1/mapsjs-mapevents.js');\n\t\t$view->registerCssFile('https://js.api.here.com/v3/3.1/mapsjs-ui.css');\n\t\t$view->registerJs($initJs, View::POS_END);\n\t\t$view->registerJs($js, View::POS_END);\n\t\t$css && $view->registerCss($css);\n\n\t\treturn '<div id=\"' . $options->id . '\"></div>';\n\t}\n\n\t/**\n\t * @param EmbedOptions $options\n\t * @param Settings     $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _embedDefault (EmbedOptions $options, Settings $settings): string\n\t{\n\t\t$view       = Craft::$app->getView();\n\t\t$markerIcon = $this->_iconSvg();\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tdefault:\n\t\t\tcase MapTiles::Wikimedia:\n\t\t\t\t$tiles = 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}##SCALE##';\n\t\t\t\t$attr  = '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://maps.wikimedia.org\" target=\"_blank\" rel=\"noreferrer\">Wikimedia</a>';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::OpenStreetMap:\n\t\t\t\t$tiles = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';\n\t\t\t\t$attr  = '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::CartoVoyager:\n\t\t\tcase MapTiles::CartoPositron:\n\t\t\tcase MapTiles::CartoDarkMatter:\n\t\t\t\t$style = explode('.', $settings->mapTiles)[1];\n\t\t\t\t$tiles = 'https://{s}.basemaps.cartocdn.com/' . $style . '/{z}/{x}/{y}##SCALE##';\n\t\t\t\t$attr  = '&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://carto.com/attribution\" target=\"_blank\" rel=\"noreferrer\">CARTO</a>';\n\t\t}\n\n\t\t$formattedOptions = Json::encode($options->options, self::JSON_OPTS);\n\t\t$formattedMarkers = [];\n\n\t\tforeach ($options->markers as $marker)\n\t\t\t$formattedMarkers[] = [\n\t\t\t\t'position' => $marker->getCenter(),\n\t\t\t\t'label'    => $marker->label ?: '',\n\t\t\t\t'color'    => $marker->color,\n\t\t\t];\n\n\t\t$formattedMarkers = Json::encode(\n\t\t\t$formattedMarkers,\n\t\t\tself::JSON_OPTS\n\t\t);\n\n\t\t$center = Json::encode(array_values($options->getCenter()), self::JSON_OPTS);\n\n\t\t$initJs = <<<JS\nwindow.LMapTiles = function (map) {\n\tL.tileLayer('{$tiles}'.replace('##SCALE##', L.Browser.retina ? '@2x.png' : '.png'), {\n\t\tattribution: '{$attr}',\n\t}).addTo(map);\n};\nwindow.LMapMarkerIcon = function (marker) {\n\treturn L.divIcon({\n\t\thtml: '{$markerIcon}'.replace('##FILL##', marker.color).replace('##LABEL##', marker.label),\n\t\ticonSize: [29, 44],\n\t\ticonAnchor: [29/2, 44],\n\t\tclassName: '',\n\t});\n}\nJS;\n\n\t\t$js = <<<JS\n/* Start Map: {$options->id} */\nconst {$options->id} = L.map('{$options->id}', {$formattedOptions})\n\t.setView({$center}, {$options->zoom});\n\nwindow.LMapTiles({$options->id});\n{$options->id}._markers = [];\n{$formattedMarkers}.forEach(function (marker) {\n\tconst m = L.marker(\n\t\tmarker.position,\n\t\t{ icon: window.LMapMarkerIcon(marker) }\n\t);\n\t{$options->id}._markers.push(m);\n\t{$options->id}.addLayer(m);\n});\n/* End Map: {$options->id} */\nJS;\n\n\t\t$css = $this->_getCss($options);\n\n\t\t$this->_js(\n\t\t\t'https://unpkg.com/leaflet@1.5.1/dist/leaflet.js',\n\t\t\t[\n\t\t\t\t'integrity'   => 'sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==',\n\t\t\t\t'crossorigin' => '',\n\t\t\t]\n\t\t);\n\t\t$view->registerCssFile(\n\t\t\t'https://unpkg.com/leaflet@1.5.1/dist/leaflet.css',\n\t\t\t[\n\t\t\t\t'integrity'   => 'sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==',\n\t\t\t\t'crossorigin' => '',\n\t\t\t]\n\t\t);\n\t\t$view->registerJs($initJs, View::POS_END);\n\t\t$view->registerJs($js, View::POS_END);\n\t\t$css && $view->registerCss($css);\n\n\t\treturn '<div id=\"' . $options->id . '\"></div>';\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * @param string $url     - The URL to the JS file\n\t * @param array  $options - An array of options to be used as attributes\n\t * @param string $pre     - Will link rel=\"pre${pre}\" if not null\n\t */\n\tprivate function _js (string $url, array $options = [], string $pre = 'connect')\n\t{\n\t\t$view = Craft::$app->getView();\n\n\t\tif ($pre)\n\t\t{\n\t\t\t$crossOrigin = !$this->_compareUrls(\n\t\t\t\t$url,\n\t\t\t\tCraft::$app->sites->currentSite->baseUrl\n\t\t\t);\n\n\t\t\t$view->registerLinkTag(\n\t\t\t\t[\n\t\t\t\t\t'rel'         => 'pre' . $pre,\n\t\t\t\t\t'href'        => $url,\n\t\t\t\t\t'as'          => 'script',\n\t\t\t\t\t'crossorigin' => $crossOrigin,\n\t\t\t\t]\n\t\t\t);\n\t\t}\n\n\t\t$view->registerScript(\n\t\t\t'',\n\t\t\tView::POS_END,\n\t\t\tarray_merge(\n\t\t\t\t['src' => $url],\n\t\t\t\t$options\n\t\t\t),\n\t\t\tmd5($url)\n\t\t);\n\t}\n\n\tprivate function _compareUrls ($a, $b): bool\n\t{\n\t\t$a = parse_url($a, PHP_URL_HOST);\n\t\t$b = parse_url($b, PHP_URL_HOST);\n\n\t\treturn $this->_trim($a) === $this->_trim($b);\n\t}\n\n\tprivate function _trim ($str): string\n\t{\n\t\tif (stripos($str, 'www.') === 0)\n\t\t\treturn substr($str, 4);\n\n\t\treturn $str;\n\t}\n\n\tprivate function _iconSvg ()\n\t{\n\t\tstatic $svg;\n\n\t\tif ($svg)\n\t\t\treturn $svg;\n\n\t\t$svg = Craft::getAlias('@simplemap/resources/marker.svg');\n\t\t$svg = file_get_contents($svg);\n\t\t$svg = (new Sanitizer())->sanitize($svg);\n\t\t$svg = preg_replace('/<!--.*?-->\\s*/s', '', $svg);\n\t\t$svg = preg_replace('/<title>.*?<\\/title>\\s*/is', '', $svg);\n\t\t$svg = preg_replace('/<desc>.*?<\\/desc>\\s*/is', '', $svg);\n\t\t$svg = preg_replace('/<\\?xml.*?\\?>/', '', $svg);\n\t\t$svg = preg_replace('/[\\r\\n]/', '', $svg);\n\t\t$svg = preg_replace('/[\\s]{2,}/', '', $svg);\n\n\t\treturn $svg;\n\t}\n\n\tprivate function _getCss (EmbedOptions $options): ?string\n\t{\n\t\tif ($options->width === null && $options->height === null)\n\t\t\treturn null;\n\n\t\t$css = \"#{$options->id} {\";\n\n\t\tif ($options->width !== null)\n\t\t\t$css .= 'width:' . $options->width . 'px;';\n\n\t\tif ($options->height !== null)\n\t\t\t$css .= 'height:' . $options->height . 'px;';\n\n\t\treturn $css . '}';\n\t}\n\n}\n"
  },
  {
    "path": "src/services/GeoLocationService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse Craft;\nuse craft\\base\\Component;\nuse craft\\helpers\\Json;\nuse DateTime;\nuse ether\\simplemap\\jobs\\MaxMindDBDownloadJob;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\models\\UserLocation;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse GeoIp2\\Database\\Reader;\nuse GeoIp2\\WebService\\Client;\n\n/**\n * Class GeoLocationService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass GeoLocationService extends Component\n{\n\n\t// Consts\n\t// =========================================================================\n\n\tconst DB_STORAGE = '@runtime/maps/db';\n\n\tconst None = 'none';\n\tconst IpStack = 'ipstack';\n\tconst MaxMindLite = 'maxmind-lite';\n\tconst MaxMind = 'maxmind';\n\n\t// Methods\n\t// =========================================================================\n\n\t/**\n\t * Lookup the location of the current users IP (or passed IP)\n\t *\n\t * @param string|null $ip\n\t *\n\t * @return UserLocation|null\n\t * @throws Exception\n\t */\n\tpublic function lookup (string $ip = null): ?UserLocation\n\t{\n\t\tif (SimpleMap::v(SimpleMap::EDITION_LITE))\n\t\t\tthrow new Exception('Sorry, user geolocation is a Maps Pro feature!');\n\n\t\tif (!$ip)\n\t\t\t$ip = Craft::$app->getRequest()->getUserIP();\n\n\t\tif (!self::_isValidIp($ip))\n\t\t{\n\t\t\tCraft::error('Invalid or not allowed IP address: \"' . $ip . '\"', 'maps');\n\n\t\t\treturn null;\n\t\t}\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\tif ($cached = $this->_getUserLocationFromCache($ip, $settings))\n\t\t\treturn $cached;\n\n\t\t$userLocation = match ($settings->geoLocationService)\n\t\t{\n\t\t\tself::IpStack => $this->_lookup_IpStack(\n\t\t\t\t$settings->getGeoLocationToken(), $ip\n\t\t\t),\n\t\t\tself::MaxMind => $this->_lookup_MaxMind(\n\t\t\t\t$settings->getGeoLocationToken(), $ip\n\t\t\t),\n\t\t\tself::MaxMindLite => $this->_lookup_MaxMindLite($ip),\n\t\t\tdefault => null,\n\t\t};\n\n\t\tif ($userLocation)\n\t\t\t$this->_cacheUserLocation($userLocation, $settings);\n\n\t\treturn $userLocation;\n\t}\n\n\t/**\n\t * @throws Exception\n\t */\n\tpublic function redirect ()\n\t{\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\t\t$siteHandle = null;\n\t\t$location = $this->lookup();\n\n\t\tif (!$location || empty($settings->geoLocationAutoRedirect))\n\t\t\treturn;\n\n\t\tforeach ($settings->geoLocationRedirectMap as $handle => $props)\n\t\t{\n\t\t\tif ($props === '*')\n\t\t\t{\n\t\t\t\t$siteHandle = $handle;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (self::_validateProps($location, $props))\n\t\t\t{\n\t\t\t\t$siteHandle = $handle;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ($siteHandle === null)\n\t\t\treturn;\n\n\t\t$site = Craft::$app->getSites()->getSiteByHandle($siteHandle);\n\n\t\tif ($site->id === Craft::$app->getSites()->getCurrentSite()->id)\n\t\t\treturn;\n\n\t\tif (!$site)\n\t\t{\n\t\t\tCraft::error('Unable to find site with handle \"' . $siteHandle . '\"', 'simplemap');\n\t\t\treturn;\n\t\t}\n\n\t\tif (!$site->hasUrls)\n\t\t{\n\t\t\tCraft::error('Selected site (' . $siteHandle . ') doesn\\'t have URLs!', 'simplemap');\n\t\t\treturn;\n\t\t}\n\n\t\t$currentBaseUrl = Craft::$app->getSites()->getCurrentSite()->getBaseUrl();\n\t\t$currentUrl = str_replace(\n\t\t\t$currentBaseUrl,\n\t\t\t'',\n\t\t\tCraft::$app->getRequest()->getAbsoluteUrl()\n\t\t);\n\n\t\tif (str_contains($currentUrl, '://'))\n\t\t\t$currentUrl = str_replace(\n\t\t\t\tCraft::$app->getRequest()->getBaseUrl(),\n\t\t\t\t'',\n\t\t\t\t$currentUrl\n\t\t\t);\n\n\t\t$url = rtrim($site->getBaseUrl(), '/') . '/' . $currentUrl;\n\n\t\tCraft::$app->getResponse()->redirect($url);\n\t}\n\n\t// Public Helpers\n\t// =========================================================================\n\n\tpublic static function getSelectOptions (): array\n\t{\n\t\treturn [\n\t\t\tself::None => SimpleMap::t('None'),\n\t\t\tself::IpStack => SimpleMap::t('ipstack'),\n//\t\t\tself::MaxMindLite => SimpleMap::t('MaxMind (Lite, ~60MB download)'),\n\t\t\tself::MaxMind => SimpleMap::t('MaxMind'),\n\t\t];\n\t}\n\n\t// MaxMind DB\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Check if the database file exists\n\t *\n\t * @param string $filename\n\t *\n\t * @return bool\n\t */\n\tpublic static function dbExists (string $filename = 'default.mmdb'): bool\n\t{\n\t\treturn file_exists(\n\t\t\tCraft::getAlias(self::DB_STORAGE . DIRECTORY_SEPARATOR . $filename)\n\t\t);\n\t}\n\n\t/**\n\t * Should we update the database (is it older than 1 week?)\n\t *\n\t * @param string $filename\n\t *\n\t * @return bool\n\t * @throws Exception\n\t */\n\tpublic static function dbShouldUpdate (string $filename = 'default.mmdb'): bool\n\t{\n\t\t$updated = filemtime(\n\t\t\tCraft::getAlias(self::DB_STORAGE . DIRECTORY_SEPARATOR . $filename)\n\t\t);\n\n\t\tif ($updated === false) return false;\n\t\treturn $updated < (new DateTime())->modify('-7 days')->getTimestamp();\n\t}\n\n\t/**\n\t * Start the MaxMind DB download job\n\t */\n\tpublic static function dbQueueDownload ()\n\t{\n\t\tif (Craft::$app->getCache()->get('maps_db_updating'))\n\t\t\treturn;\n\n\t\tCraft::$app->getCache()->set('maps_db_updating', true);\n\t\tCraft::$app->getQueue()->push(new MaxMindDBDownloadJob());\n\t}\n\n\tpublic static function purgeDb ($filename = 'default.mmdb')\n\t{\n\t\t$file = Craft::getAlias(self::DB_STORAGE . DIRECTORY_SEPARATOR . $filename);\n\n\t\tif (file_exists($file))\n\t\t\tunlink($file);\n\t}\n\n\t// Private Helpers\n\t// =========================================================================\n\n\t// Caching\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * @param string   $ip\n\t * @param Settings $settings\n\t *\n\t * @return UserLocation|false\n\t */\n\tprivate function _getUserLocationFromCache (string $ip, Settings $settings): bool|UserLocation\n\t{\n\t\tif (!$settings->geoLocationCacheDuration)\n\t\t\treturn false;\n\n\t\treturn Craft::$app->getCache()->get(\n\t\t\t'maps_ip_' . $ip\n\t\t);\n\t}\n\n\t/**\n\t * @param UserLocation $userLocation\n\t * @param Settings     $settings\n\t *\n\t * @return bool\n\t */\n\tprivate function _cacheUserLocation (UserLocation $userLocation, Settings $settings): bool\n\t{\n\t\tif (!$settings->geoLocationCacheDuration)\n\t\t\treturn true;\n\n\t\treturn Craft::$app->getCache()->set(\n\t\t\t'maps_ip_' . $userLocation->ip,\n\t\t\t$userLocation,\n\t\t\t$settings->geoLocationCacheDuration\n\t\t);\n\t}\n\n\t// Lookup Services\n\t// -------------------------------------------------------------------------\n\n\tprivate function _lookup_IpStack ($token, $ip): ?UserLocation\n\t{\n\t\t$url = 'http://api.ipstack.com/' . $ip;\n\t\t$url .= '?access_key=' . $token;\n\t\t$url .= '&language=' . Craft::$app->getLocale()->getLanguageID();\n\n\t\t$data = self::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (array_key_exists('success', $data) && $data['success'] === false)\n\t\t{\n\t\t\tCraft::error($data['error']['info'], 'maps');\n\n\t\t\treturn null;\n\t\t}\n\n\t\t$parts = [\n\t\t\t'city'     => $data['city'],\n\t\t\t'postcode' => $data['zip'],\n\t\t\t'state'    => $data['region_name'],\n\t\t\t'country'  => $data['country_name'],\n\t\t];\n\n\t\treturn new UserLocation([\n\t\t\t'ip'          => $ip,\n\t\t\t'lat'         => $data['latitude'],\n\t\t\t'lng'         => $data['longitude'],\n\t\t\t'address'     => implode(', ', array_filter($parts)),\n\t\t\t'countryCode' => $data['country_code'],\n\t\t\t'isEU'        => $data['location']['is_eu'],\n\t\t\t'parts'       => $parts,\n\t\t]);\n\t}\n\n\tprivate function _lookup_MaxMind ($token, $ip): ?UserLocation\n\t{\n\t\t$client = new Client(\n\t\t\t$token['accountId'],\n\t\t\t$token['licenseKey'],\n\t\t\t[\n\t\t\t\tCraft::$app->getLocale()->getLanguageID(),\n\t\t\t\t'en'\n\t\t\t]\n\t\t);\n\n\t\t$record = null;\n\n\t\ttry {\n\t\t\t$record = $client->city($ip);\n\t\t} catch (Exception $e) {\n\t\t\tCraft::error($e->getMessage(), 'maps');\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn self::_populateMaxMind($ip, $record);\n\t}\n\n\t/**\n\t * @param $ip\n\t *\n\t * @return UserLocation|null\n\t * @throws Exception\n\t */\n\tprivate function _lookup_MaxMindLite ($ip): ?UserLocation\n\t{\n\t\tif (!self::dbExists())\n\t\t{\n//\t\t\tself::dbQueueDownload();\n\n\t\t\tthrow new Exception('MaxMind Lite is no longer supported');\n\t\t}\n\n//\t\tif (self::dbShouldUpdate())\n//\t\t\tself::dbQueueDownload();\n\t\tCraft::warning('MaxMind Lite is no longer supported and will not receive updates');\n\n\t\ttry\n\t\t{\n\t\t\t$reader = new Reader(\n\t\t\t\tCraft::getAlias(\n\t\t\t\t\tself::DB_STORAGE . DIRECTORY_SEPARATOR . 'default.mmdb'\n\t\t\t\t)\n\t\t\t);\n\t\t\t$record = $reader->city($ip);\n\t\t} catch (Exception $e)\n\t\t{\n\t\t\tCraft::dd($e);\n\t\t\tCraft::error($e->getMessage(), 'maps');\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn self::_populateMaxMind($ip, $record);\n\t}\n\n\t// Misc\n\t// -------------------------------------------------------------------------\n\n\tprivate static function _client ()\n\t{\n\t\tstatic $client;\n\n\t\tif (!$client)\n\t\t\t$client = Craft::createGuzzleClient();\n\n\t\treturn $client;\n\t}\n\n\t/**\n\t * Ensure IP is valid and not private or reserved\n\t *\n\t * @param string $ip\n\t *\n\t * @return mixed\n\t */\n\tprivate static function _isValidIp (string $ip): mixed\n\t{\n\t\treturn filter_var(\n\t\t\t$ip,\n\t\t\tFILTER_VALIDATE_IP,\n\t\t\tFILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE\n\t\t);\n\t}\n\n\t/**\n\t * @param $ip\n\t * @param $record\n\t *\n\t * @return UserLocation\n\t */\n\tprivate static function _populateMaxMind ($ip, $record): UserLocation\n\t{\n\t\t$parts = [\n\t\t\t'city'     => $record->city->name,\n\t\t\t'postcode' => $record->postal->code,\n\t\t\t'state'    => $record->mostSpecificSubdivision->name,\n\t\t\t'country'  => $record->country->name,\n\t\t];\n\n\t\treturn new UserLocation([\n\t\t\t'ip'          => $ip,\n\t\t\t'lat'         => $record->location->latitude,\n\t\t\t'lng'         => $record->location->longitude,\n\t\t\t'address'     => implode(', ', array_filter($parts)),\n\t\t\t'countryCode' => $record->country->isoCode,\n\t\t\t'isEU'        => $record->country->isInEuropeanUnion,\n\t\t\t'parts'       => $parts,\n\t\t]);\n\t}\n\n\t/**\n\t * @param UserLocation $location\n\t * @param              $props\n\t *\n\t * @return bool\n\t */\n\tprivate static function _validateProps (UserLocation $location, $props): bool\n\t{\n\t\tforeach ($props as $key => $value)\n\t\t{\n\t\t\tif (is_array($value))\n\t\t\t{\n\t\t\t\tforeach ($value as $item)\n\t\t\t\t\tif ($location->$key === $item)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (is_callable($value))\n\t\t\t\treturn $value($location->$key);\n\n\t\t\tif ($location->$key !== $value)\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n}\n"
  },
  {
    "path": "src/services/GeoService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS 3\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse Craft;\nuse craft\\base\\Component;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\enums\\GeoService as GeoEnum;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\models\\Parts;\nuse ether\\simplemap\\models\\PartsLegacy;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\SimpleMap;\nuse GuzzleHttp\\Client;\nuse Mapkit\\JWT;\nuse Exception;\n\n/**\n * Class GeoService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass GeoService extends Component\n{\n\n\t// Properties\n\t// =========================================================================\n\n\tpublic static array $countries = [\n\t\t'AF' => 'Afghanistan',\n\t\t'AX' => 'Åland Islands',\n\t\t'AL' => 'Albania',\n\t\t'DZ' => 'Algeria',\n\t\t'AS' => 'American Samoa',\n\t\t'AD' => 'Andorra',\n\t\t'AO' => 'Angola',\n\t\t'AI' => 'Anguilla',\n\t\t'AQ' => 'Antarctica',\n\t\t'AG' => 'Antigua and Barbuda',\n\t\t'AR' => 'Argentina',\n\t\t'AM' => 'Armenia',\n\t\t'AW' => 'Aruba',\n\t\t'AU' => 'Australia',\n\t\t'AT' => 'Austria',\n\t\t'AZ' => 'Azerbaijan',\n\t\t'BS' => 'Bahamas',\n\t\t'BH' => 'Bahrain',\n\t\t'BD' => 'Bangladesh',\n\t\t'BB' => 'Barbados',\n\t\t'BY' => 'Belarus',\n\t\t'BE' => 'Belgium',\n\t\t'BZ' => 'Belize',\n\t\t'BJ' => 'Benin',\n\t\t'BM' => 'Bermuda',\n\t\t'BT' => 'Bhutan',\n\t\t'BO' => 'Bolivia, Plurinational State of',\n\t\t'BQ' => 'Bonaire, Sint Eustatius and Saba',\n\t\t'BA' => 'Bosnia and Herzegovina',\n\t\t'BW' => 'Botswana',\n\t\t'BV' => 'Bouvet Island',\n\t\t'BR' => 'Brazil',\n\t\t'IO' => 'British Indian Ocean Territory',\n\t\t'BN' => 'Brunei Darussalam',\n\t\t'BG' => 'Bulgaria',\n\t\t'BF' => 'Burkina Faso',\n\t\t'BI' => 'Burundi',\n\t\t'KH' => 'Cambodia',\n\t\t'CM' => 'Cameroon',\n\t\t'CA' => 'Canada',\n\t\t'CV' => 'Cape Verde',\n\t\t'KY' => 'Cayman Islands',\n\t\t'CF' => 'Central African Republic',\n\t\t'TD' => 'Chad',\n\t\t'CL' => 'Chile',\n\t\t'CN' => 'China',\n\t\t'CX' => 'Christmas Island',\n\t\t'CC' => 'Cocos (Keeling) Islands',\n\t\t'CO' => 'Colombia',\n\t\t'KM' => 'Comoros',\n\t\t'CG' => 'Congo',\n\t\t'CD' => 'Congo, the Democratic Republic of the',\n\t\t'CK' => 'Cook Islands',\n\t\t'CR' => 'Costa Rica',\n\t\t'CI' => 'Côte d\\'Ivoire',\n\t\t'HR' => 'Croatia',\n\t\t'CU' => 'Cuba',\n\t\t'CW' => 'Curaçao',\n\t\t'CY' => 'Cyprus',\n\t\t'CZ' => 'Czech Republic',\n\t\t'DK' => 'Denmark',\n\t\t'DJ' => 'Djibouti',\n\t\t'DM' => 'Dominica',\n\t\t'DO' => 'Dominican Republic',\n\t\t'EC' => 'Ecuador',\n\t\t'EG' => 'Egypt',\n\t\t'SV' => 'El Salvador',\n\t\t'GQ' => 'Equatorial Guinea',\n\t\t'ER' => 'Eritrea',\n\t\t'EE' => 'Estonia',\n\t\t'ET' => 'Ethiopia',\n\t\t'FK' => 'Falkland Islands (Malvinas)',\n\t\t'FO' => 'Faroe Islands',\n\t\t'FJ' => 'Fiji',\n\t\t'FI' => 'Finland',\n\t\t'FR' => 'France',\n\t\t'GF' => 'French Guiana',\n\t\t'PF' => 'French Polynesia',\n\t\t'TF' => 'French Southern Territories',\n\t\t'GA' => 'Gabon',\n\t\t'GM' => 'Gambia',\n\t\t'GE' => 'Georgia',\n\t\t'DE' => 'Germany',\n\t\t'GH' => 'Ghana',\n\t\t'GI' => 'Gibraltar',\n\t\t'GR' => 'Greece',\n\t\t'GL' => 'Greenland',\n\t\t'GD' => 'Grenada',\n\t\t'GP' => 'Guadeloupe',\n\t\t'GU' => 'Guam',\n\t\t'GT' => 'Guatemala',\n\t\t'GG' => 'Guernsey',\n\t\t'GN' => 'Guinea',\n\t\t'GW' => 'Guinea-Bissau',\n\t\t'GY' => 'Guyana',\n\t\t'HT' => 'Haiti',\n\t\t'HM' => 'Heard Island and McDonald Islands',\n\t\t'VA' => 'Holy See (Vatican City State)',\n\t\t'HN' => 'Honduras',\n\t\t'HK' => 'Hong Kong',\n\t\t'HU' => 'Hungary',\n\t\t'IS' => 'Iceland',\n\t\t'IN' => 'India',\n\t\t'ID' => 'Indonesia',\n\t\t'IR' => 'Iran, Islamic Republic of',\n\t\t'IQ' => 'Iraq',\n\t\t'IE' => 'Ireland',\n\t\t'IM' => 'Isle of Man',\n\t\t'IL' => 'Israel',\n\t\t'IT' => 'Italy',\n\t\t'JM' => 'Jamaica',\n\t\t'JP' => 'Japan',\n\t\t'JE' => 'Jersey',\n\t\t'JO' => 'Jordan',\n\t\t'KZ' => 'Kazakhstan',\n\t\t'KE' => 'Kenya',\n\t\t'KI' => 'Kiribati',\n\t\t'KP' => 'Korea, Democratic People\\'s Republic of',\n\t\t'KR' => 'Korea, Republic of',\n\t\t'KW' => 'Kuwait',\n\t\t'KG' => 'Kyrgyzstan',\n\t\t'LA' => 'Lao People\\'s Democratic Republic',\n\t\t'LV' => 'Latvia',\n\t\t'LB' => 'Lebanon',\n\t\t'LS' => 'Lesotho',\n\t\t'LR' => 'Liberia',\n\t\t'LY' => 'Libya',\n\t\t'LI' => 'Liechtenstein',\n\t\t'LT' => 'Lithuania',\n\t\t'LU' => 'Luxembourg',\n\t\t'MO' => 'Macao',\n\t\t'MK' => 'Macedonia, the Former Yugoslav Republic of',\n\t\t'MG' => 'Madagascar',\n\t\t'MW' => 'Malawi',\n\t\t'MY' => 'Malaysia',\n\t\t'MV' => 'Maldives',\n\t\t'ML' => 'Mali',\n\t\t'MT' => 'Malta',\n\t\t'MH' => 'Marshall Islands',\n\t\t'MQ' => 'Martinique',\n\t\t'MR' => 'Mauritania',\n\t\t'MU' => 'Mauritius',\n\t\t'YT' => 'Mayotte',\n\t\t'MX' => 'Mexico',\n\t\t'FM' => 'Micronesia, Federated States of',\n\t\t'MD' => 'Moldova, Republic of',\n\t\t'MC' => 'Monaco',\n\t\t'MN' => 'Mongolia',\n\t\t'ME' => 'Montenegro',\n\t\t'MS' => 'Montserrat',\n\t\t'MA' => 'Morocco',\n\t\t'MZ' => 'Mozambique',\n\t\t'MM' => 'Myanmar',\n\t\t'NA' => 'Namibia',\n\t\t'NR' => 'Nauru',\n\t\t'NP' => 'Nepal',\n\t\t'NL' => 'Netherlands',\n\t\t'NC' => 'New Caledonia',\n\t\t'NZ' => 'New Zealand',\n\t\t'NI' => 'Nicaragua',\n\t\t'NE' => 'Niger',\n\t\t'NG' => 'Nigeria',\n\t\t'NU' => 'Niue',\n\t\t'NF' => 'Norfolk Island',\n\t\t'MP' => 'Northern Mariana Islands',\n\t\t'NO' => 'Norway',\n\t\t'OM' => 'Oman',\n\t\t'PK' => 'Pakistan',\n\t\t'PW' => 'Palau',\n\t\t'PS' => 'Palestine, State of',\n\t\t'PA' => 'Panama',\n\t\t'PG' => 'Papua New Guinea',\n\t\t'PY' => 'Paraguay',\n\t\t'PE' => 'Peru',\n\t\t'PH' => 'Philippines',\n\t\t'PN' => 'Pitcairn',\n\t\t'PL' => 'Poland',\n\t\t'PT' => 'Portugal',\n\t\t'PR' => 'Puerto Rico',\n\t\t'QA' => 'Qatar',\n\t\t'RE' => 'Réunion',\n\t\t'RO' => 'Romania',\n\t\t'RU' => 'Russian Federation',\n\t\t'RW' => 'Rwanda',\n\t\t'BL' => 'Saint Barthélemy',\n\t\t'SH' => 'Saint Helena, Ascension and Tristan da Cunha',\n\t\t'KN' => 'Saint Kitts and Nevis',\n\t\t'LC' => 'Saint Lucia',\n\t\t'MF' => 'Saint Martin (French part)',\n\t\t'PM' => 'Saint Pierre and Miquelon',\n\t\t'VC' => 'Saint Vincent and the Grenadines',\n\t\t'WS' => 'Samoa',\n\t\t'SM' => 'San Marino',\n\t\t'ST' => 'Sao Tome and Principe',\n\t\t'SA' => 'Saudi Arabia',\n\t\t'SN' => 'Senegal',\n\t\t'RS' => 'Serbia',\n\t\t'SC' => 'Seychelles',\n\t\t'SL' => 'Sierra Leone',\n\t\t'SG' => 'Singapore',\n\t\t'SX' => 'Sint Maarten (Dutch part)',\n\t\t'SK' => 'Slovakia',\n\t\t'SI' => 'Slovenia',\n\t\t'SB' => 'Solomon Islands',\n\t\t'SO' => 'Somalia',\n\t\t'ZA' => 'South Africa',\n\t\t'GS' => 'South Georgia and the South Sandwich Islands',\n\t\t'SS' => 'South Sudan',\n\t\t'ES' => 'Spain',\n\t\t'LK' => 'Sri Lanka',\n\t\t'SD' => 'Sudan',\n\t\t'SR' => 'Suriname',\n\t\t'SJ' => 'Svalbard and Jan Mayen',\n\t\t'SZ' => 'Swaziland',\n\t\t'SE' => 'Sweden',\n\t\t'CH' => 'Switzerland',\n\t\t'SY' => 'Syrian Arab Republic',\n\t\t'TW' => 'Taiwan, Province of China',\n\t\t'TJ' => 'Tajikistan',\n\t\t'TZ' => 'Tanzania, United Republic of',\n\t\t'TH' => 'Thailand',\n\t\t'TL' => 'Timor-Leste',\n\t\t'TG' => 'Togo',\n\t\t'TK' => 'Tokelau',\n\t\t'TO' => 'Tonga',\n\t\t'TT' => 'Trinidad and Tobago',\n\t\t'TN' => 'Tunisia',\n\t\t'TR' => 'Turkey',\n\t\t'TM' => 'Turkmenistan',\n\t\t'TC' => 'Turks and Caicos Islands',\n\t\t'TV' => 'Tuvalu',\n\t\t'UG' => 'Uganda',\n\t\t'UA' => 'Ukraine',\n\t\t'AE' => 'United Arab Emirates',\n\t\t'GB' => 'United Kingdom',\n\t\t'US' => 'United States',\n\t\t'UM' => 'United States Minor Outlying Islands',\n\t\t'UY' => 'Uruguay',\n\t\t'UZ' => 'Uzbekistan',\n\t\t'VU' => 'Vanuatu',\n\t\t'VE' => 'Venezuela, Bolivarian Republic of',\n\t\t'VN' => 'Viet Nam',\n\t\t'VG' => 'Virgin Islands, British',\n\t\t'VI' => 'Virgin Islands, U.S.',\n\t\t'WF' => 'Wallis and Futuna',\n\t\t'EH' => 'Western Sahara',\n\t\t'YE' => 'Yemen',\n\t\t'ZM' => 'Zambia',\n\t\t'ZW' => 'Zimbabwe',\n\t];\n\n\tpublic static array $countriesIso3 = [\n\t\t'AD' => 'AND',\n\t\t'AE' => 'ARE',\n\t\t'AF' => 'AFG',\n\t\t'AG' => 'ATG',\n\t\t'AI' => 'AIA',\n\t\t'AL' => 'ALB',\n\t\t'AM' => 'ARM',\n\t\t'AO' => 'AGO',\n\t\t'AQ' => 'ATA',\n\t\t'AR' => 'ARG',\n\t\t'AS' => 'ASM',\n\t\t'AT' => 'AUT',\n\t\t'AU' => 'AUS',\n\t\t'AW' => 'ABW',\n\t\t'AX' => 'ALA',\n\t\t'AZ' => 'AZE',\n\t\t'BA' => 'BIH',\n\t\t'BB' => 'BRB',\n\t\t'BD' => 'BGD',\n\t\t'BE' => 'BEL',\n\t\t'BF' => 'BFA',\n\t\t'BG' => 'BGR',\n\t\t'BH' => 'BHR',\n\t\t'BI' => 'BDI',\n\t\t'BJ' => 'BEN',\n\t\t'BL' => 'BLM',\n\t\t'BM' => 'BMU',\n\t\t'BN' => 'BRN',\n\t\t'BO' => 'BOL',\n\t\t'BQ' => 'BES',\n\t\t'BR' => 'BRA',\n\t\t'BS' => 'BHS',\n\t\t'BT' => 'BTN',\n\t\t'BV' => 'BVT',\n\t\t'BW' => 'BWA',\n\t\t'BY' => 'BLR',\n\t\t'BZ' => 'BLZ',\n\t\t'CA' => 'CAN',\n\t\t'CC' => 'CCK',\n\t\t'CD' => 'COD',\n\t\t'CF' => 'CAF',\n\t\t'CG' => 'COG',\n\t\t'CH' => 'CHE',\n\t\t'CI' => 'CIV',\n\t\t'CK' => 'COK',\n\t\t'CL' => 'CHL',\n\t\t'CM' => 'CMR',\n\t\t'CN' => 'CHN',\n\t\t'CO' => 'COL',\n\t\t'CR' => 'CRI',\n\t\t'CU' => 'CUB',\n\t\t'CV' => 'CPV',\n\t\t'CW' => 'CUW',\n\t\t'CX' => 'CXR',\n\t\t'CY' => 'CYP',\n\t\t'CZ' => 'CZE',\n\t\t'DE' => 'DEU',\n\t\t'DJ' => 'DJI',\n\t\t'DK' => 'DNK',\n\t\t'DM' => 'DMA',\n\t\t'DO' => 'DOM',\n\t\t'DZ' => 'DZA',\n\t\t'EC' => 'ECU',\n\t\t'EE' => 'EST',\n\t\t'EG' => 'EGY',\n\t\t'EH' => 'ESH',\n\t\t'ER' => 'ERI',\n\t\t'ES' => 'ESP',\n\t\t'ET' => 'ETH',\n\t\t'FI' => 'FIN',\n\t\t'FJ' => 'FJI',\n\t\t'FK' => 'FLK',\n\t\t'FM' => 'FSM',\n\t\t'FO' => 'FRO',\n\t\t'FR' => 'FRA',\n\t\t'GA' => 'GAB',\n\t\t'GB' => 'GBR',\n\t\t'GD' => 'GRD',\n\t\t'GE' => 'GEO',\n\t\t'GF' => 'GUF',\n\t\t'GG' => 'GGY',\n\t\t'GH' => 'GHA',\n\t\t'GI' => 'GIB',\n\t\t'GL' => 'GRL',\n\t\t'GM' => 'GMB',\n\t\t'GN' => 'GIN',\n\t\t'GP' => 'GLP',\n\t\t'GQ' => 'GNQ',\n\t\t'GR' => 'GRC',\n\t\t'GS' => 'SGS',\n\t\t'GT' => 'GTM',\n\t\t'GU' => 'GUM',\n\t\t'GW' => 'GNB',\n\t\t'GY' => 'GUY',\n\t\t'HK' => 'HKG',\n\t\t'HM' => 'HMD',\n\t\t'HN' => 'HND',\n\t\t'HR' => 'HRV',\n\t\t'HT' => 'HTI',\n\t\t'HU' => 'HUN',\n\t\t'ID' => 'IDN',\n\t\t'IE' => 'IRL',\n\t\t'IL' => 'ISR',\n\t\t'IM' => 'IMN',\n\t\t'IN' => 'IND',\n\t\t'IO' => 'IOT',\n\t\t'IQ' => 'IRQ',\n\t\t'IR' => 'IRN',\n\t\t'IS' => 'ISL',\n\t\t'IT' => 'ITA',\n\t\t'JE' => 'JEY',\n\t\t'JM' => 'JAM',\n\t\t'JO' => 'JOR',\n\t\t'JP' => 'JPN',\n\t\t'KE' => 'KEN',\n\t\t'KG' => 'KGZ',\n\t\t'KH' => 'KHM',\n\t\t'KI' => 'KIR',\n\t\t'KM' => 'COM',\n\t\t'KN' => 'KNA',\n\t\t'KP' => 'PRK',\n\t\t'KR' => 'KOR',\n\t\t'KW' => 'KWT',\n\t\t'KY' => 'CYM',\n\t\t'KZ' => 'KAZ',\n\t\t'LA' => 'LAO',\n\t\t'LB' => 'LBN',\n\t\t'LC' => 'LCA',\n\t\t'LI' => 'LIE',\n\t\t'LK' => 'LKA',\n\t\t'LR' => 'LBR',\n\t\t'LS' => 'LSO',\n\t\t'LT' => 'LTU',\n\t\t'LU' => 'LUX',\n\t\t'LV' => 'LVA',\n\t\t'LY' => 'LBY',\n\t\t'MA' => 'MAR',\n\t\t'MC' => 'MCO',\n\t\t'MD' => 'MDA',\n\t\t'ME' => 'MNE',\n\t\t'MF' => 'MAF',\n\t\t'MG' => 'MDG',\n\t\t'MH' => 'MHL',\n\t\t'MK' => 'MKD',\n\t\t'ML' => 'MLI',\n\t\t'MM' => 'MMR',\n\t\t'MN' => 'MNG',\n\t\t'MO' => 'MAC',\n\t\t'MP' => 'MNP',\n\t\t'MQ' => 'MTQ',\n\t\t'MR' => 'MRT',\n\t\t'MS' => 'MSR',\n\t\t'MT' => 'MLT',\n\t\t'MU' => 'MUS',\n\t\t'MV' => 'MDV',\n\t\t'MW' => 'MWI',\n\t\t'MX' => 'MEX',\n\t\t'MY' => 'MYS',\n\t\t'MZ' => 'MOZ',\n\t\t'NA' => 'NAM',\n\t\t'NC' => 'NCL',\n\t\t'NE' => 'NER',\n\t\t'NF' => 'NFK',\n\t\t'NG' => 'NGA',\n\t\t'NI' => 'NIC',\n\t\t'NL' => 'NLD',\n\t\t'NO' => 'NOR',\n\t\t'NP' => 'NPL',\n\t\t'NR' => 'NRU',\n\t\t'NU' => 'NIU',\n\t\t'NZ' => 'NZL',\n\t\t'OM' => 'OMN',\n\t\t'PA' => 'PAN',\n\t\t'PE' => 'PER',\n\t\t'PF' => 'PYF',\n\t\t'PG' => 'PNG',\n\t\t'PH' => 'PHL',\n\t\t'PK' => 'PAK',\n\t\t'PL' => 'POL',\n\t\t'PM' => 'SPM',\n\t\t'PN' => 'PCN',\n\t\t'PR' => 'PRI',\n\t\t'PS' => 'PSE',\n\t\t'PT' => 'PRT',\n\t\t'PW' => 'PLW',\n\t\t'PY' => 'PRY',\n\t\t'QA' => 'QAT',\n\t\t'RE' => 'REU',\n\t\t'RO' => 'ROU',\n\t\t'RS' => 'SRB',\n\t\t'RU' => 'RUS',\n\t\t'RW' => 'RWA',\n\t\t'SA' => 'SAU',\n\t\t'SB' => 'SLB',\n\t\t'SC' => 'SYC',\n\t\t'SD' => 'SDN',\n\t\t'SE' => 'SWE',\n\t\t'SG' => 'SGP',\n\t\t'SH' => 'SHN',\n\t\t'SI' => 'SVN',\n\t\t'SJ' => 'SJM',\n\t\t'SK' => 'SVK',\n\t\t'SL' => 'SLE',\n\t\t'SM' => 'SMR',\n\t\t'SN' => 'SEN',\n\t\t'SO' => 'SOM',\n\t\t'SR' => 'SUR',\n\t\t'SS' => 'SSD',\n\t\t'ST' => 'STP',\n\t\t'SV' => 'SLV',\n\t\t'SX' => 'SXM',\n\t\t'SY' => 'SYR',\n\t\t'SZ' => 'SWZ',\n\t\t'TC' => 'TCA',\n\t\t'TD' => 'TCD',\n\t\t'TF' => 'ATF',\n\t\t'TG' => 'TGO',\n\t\t'TH' => 'THA',\n\t\t'TJ' => 'TJK',\n\t\t'TK' => 'TKL',\n\t\t'TL' => 'TLS',\n\t\t'TM' => 'TKM',\n\t\t'TN' => 'TUN',\n\t\t'TO' => 'TON',\n\t\t'TR' => 'TUR',\n\t\t'TT' => 'TTO',\n\t\t'TV' => 'TUV',\n\t\t'TW' => 'TWN',\n\t\t'TZ' => 'TZA',\n\t\t'UA' => 'UKR',\n\t\t'UG' => 'UGA',\n\t\t'UM' => 'UMI',\n\t\t'US' => 'USA',\n\t\t'UY' => 'URY',\n\t\t'UZ' => 'UZB',\n\t\t'VA' => 'VAT',\n\t\t'VC' => 'VCT',\n\t\t'VE' => 'VEN',\n\t\t'VG' => 'VGB',\n\t\t'VI' => 'VIR',\n\t\t'VN' => 'VNM',\n\t\t'VU' => 'VUT',\n\t\t'WF' => 'WLF',\n\t\t'WS' => 'WSM',\n\t\t'XK' => 'XKX',\n\t\t'YE' => 'YEM',\n\t\t'YT' => 'MYT',\n\t\t'ZA' => 'ZAF',\n\t\t'ZM' => 'ZMB',\n\t\t'ZW' => 'ZWE',\n\t];\n\n\t// Methods\n\t// =========================================================================\n\n\t/**\n\t * Parses the token based off the given service\n\t *\n\t * @param array|string $token\n\t * @param string       $service\n\t *\n\t * @return bool|array|string\n\t */\n\tpublic static function getToken (array|string $token, string $service): bool|array|string\n\t{\n\t\tswitch ($service)\n\t\t{\n\t\t\tcase GeoEnum::AppleMapKit:\n\t\t\tcase MapTiles::MapKitStandard:\n\t\t\tcase MapTiles::MapKitMutedStandard:\n\t\t\tcase MapTiles::MapKitSatellite:\n\t\t\tcase MapTiles::MapKitHybrid:\n\t\t\t\treturn JWT::getToken(\n\t\t\t\t\ttrim($token['privateKey']),\n\t\t\t\t\ttrim($token['keyId']),\n\t\t\t\t\ttrim($token['teamId'])\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\treturn $token;\n\t\t}\n\t}\n\n\t/**\n\t * Find the lat/lng for the given address\n\t *\n\t * @param string      $address\n\t * @param string|null $country\n\t *\n\t * @return array|null\n\t * @throws Exception\n\t */\n\tpublic static function latLngFromAddress (string $address, string $country = null): ?array\n\t{\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\t\t$token = static::getToken($settings->getGeoToken(), $settings->geoService);\n\n\t\treturn match ($settings->geoService)\n\t\t{\n\t\t\tGeoEnum::Here => static::_latLngFromAddress_Here(\n\t\t\t\t$token,\n\t\t\t\t$address, $country\n\t\t\t),\n\t\t\tGeoEnum::GoogleMaps => static::_latLngFromAddress_Google(\n\t\t\t\t$token,\n\t\t\t\t$address, $country\n\t\t\t),\n\t\t\tGeoEnum::Mapbox => static::_latLngFromAddress_Mapbox(\n\t\t\t\t$token,\n\t\t\t\t$address, $country\n\t\t\t),\n\t\t\tGeoEnum::Nominatim => static::_latLngFromAddress_Nominatim(\n\t\t\t\t$address, $country\n\t\t\t),\n\t\t\tdefault => throw new Exception(\n\t\t\t\t'Unknown geo-coding service: ' . $settings->geoService\n\t\t\t),\n\t\t};\n\t}\n\n\t/**\n\t * Find an address from the given lat/lng\n\t *\n\t * @param float $lat\n\t * @param float $lng\n\t *\n\t * @return array|null - Returns the address and associated parts\n\t * @throws Exception\n\t */\n\tpublic static function addressFromLatLng (float $lat, float $lng): ?array\n\t{\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\t\t$token    =\n\t\t\tstatic::getToken($settings->getGeoToken(), $settings->geoService);\n\n\t\treturn match ($settings->geoService)\n\t\t{\n\t\t\tGeoEnum::Here => static::_addressFromLatLng_Here(\n\t\t\t\t$token,\n\t\t\t\t$lat, $lng\n\t\t\t),\n\t\t\tGeoEnum::GoogleMaps => static::_addressFromLatLng_Google(\n\t\t\t\t$token,\n\t\t\t\t$lat, $lng\n\t\t\t),\n\t\t\tGeoEnum::Mapbox => static::_addressFromLatLng_Mapbox(\n\t\t\t\t$token,\n\t\t\t\t$lat, $lng\n\t\t\t),\n\t\t\tGeoEnum::Nominatim => static::_addressFromLatLng_Nominatim(\n\t\t\t\t$lat, $lng\n\t\t\t),\n\t\t\tdefault => throw new Exception(\n\t\t\t\t'Unknown geo-coding service: ' . $settings->geoService\n\t\t\t),\n\t\t};\n\t}\n\n\t/**\n\t * Normalize the given distance unit\n\t *\n\t * @param string $unit\n\t *\n\t * @return string\n\t */\n\tpublic static function normalizeDistance (string $unit): string\n\t{\n\t\tif ($unit === 'miles') $unit = 'mi';\n\t\telse if ($unit === 'kilometers') $unit = 'km';\n\t\telse if (!in_array($unit, ['mi', 'km'])) $unit = 'km';\n\n\t\treturn $unit;\n\t}\n\n\t/**\n\t * Will normalize the given location to a lat/lng array\n\t *\n\t * @param mixed       $location\n\t * @param string|null $country\n\t *\n\t * @return array\n\t * @throws Exception\n\t */\n\tpublic static function normalizeLocation (mixed $location, string $country = null): array\n\t{\n\t\tif (is_string($location))\n\t\t\t$location = self::latLngFromAddress($location, $country);\n\t\telse if ($location instanceof Map)\n\t\t\t$location = ['lat' => $location->lat, 'lng' => $location->lng];\n\t\telse if (!is_array($location) || !isset($location['lat'], $location['lng']))\n\t\t\t$location = [];\n\n\t\tif (!$location) {\n\t\t\t$location = [];\n\t\t}\n\n\t\treturn $location;\n\t}\n\n\t// Private Methods\n\t// =========================================================================\n\n\t// Lat/Lng from Address\n\t// -------------------------------------------------------------------------\n\n\tprivate static function _latLngFromAddress_Here ($token, $address, $country): ?array\n\t{\n\t\t$url = 'https://geocoder.api.here.com/6.2/geocode.json';\n\t\t$url .= '?app_id=' . $token['appId'];\n\t\t$url .= '&app_code=' . $token['appCode'];\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&searchtext=' . rawurlencode($address);\n\n\t\tif ($country !== null)\n\t\t{\n\t\t\tif (static::_validateCountryCode($country))\n\t\t\t\t$url .= '&country=' . rawurlencode(strtoupper($country));\n\t\t\telse\n\t\t\t\t$url .= rawurlencode(', ' . $country);\n\t\t}\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['Response']['View']))\n\t\t\treturn null;\n\n\t\t$pos = $data['Response']['View'][0]['Result'][0]['Location']['DisplayPosition'];\n\n\t\treturn [\n\t\t\t'lat' => $pos['Latitude'],\n\t\t\t'lng' => $pos['Longitude'],\n\t\t];\n\t}\n\n\tprivate static function _latLngFromAddress_Google ($token, $address, $country): ?array\n\t{\n\t\t$url = 'https://maps.googleapis.com/maps/api/geocode/json';\n\t\t$url .= '?address=' . rawurlencode($address);\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\tif ($country !== null)\n\t\t{\n\t\t\tif (static::_validateCountryCode($country))\n\t\t\t\t$url .= '&components=country:' . rawurlencode(strtoupper($country));\n\t\t\telse\n\t\t\t\t$url .= rawurlencode(', ' . $country);\n\t\t}\n\t\t$url .= '&key=' . $token;\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['results']))\n\t\t\treturn null;\n\n\t\treturn [\n\t\t\t'lat' => $data['results'][0]['geometry']['location']['lat'],\n\t\t\t'lng' => $data['results'][0]['geometry']['location']['lng'],\n\t\t];\n\t}\n\n\tprivate static function _latLngFromAddress_Mapbox ($token, $address, $country): ?array\n\t{\n\t\t$url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/';\n\t\t$url .= rawurlencode($address) . '.json?limit=1';\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&access_token=' . $token;\n\t\tif ($country !== null)\n\t\t{\n\t\t\tif (static::_validateCountryCode($country))\n\t\t\t\t$url .= '&country=' . rawurlencode(strtolower($country));\n\t\t\telse\n\t\t\t\t$url = str_replace('.json', rawurlencode(', ' . $country) . '.json', $url);\n\t\t}\n\n\t\t$referer = Craft::$app->getRequest()->getIsConsoleRequest()\n\t\t\t? Craft::getAlias('@web')\n\t\t\t: Craft::$app->urlManager->getHostInfo();\n\n\t\t$data = (string) static::_client()->get($url, [\n            'headers' => [\n                'referer' => $referer,\n            ]\n        ])->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['features']))\n\t\t\treturn null;\n\n\t\treturn [\n\t\t\t'lat' => $data['features'][0]['center'][1],\n\t\t\t'lng' => $data['features'][0]['center'][0],\n\t\t];\n\t}\n\n\tprivate static function _latLngFromAddress_Nominatim ($address, $country): ?array\n\t{\n\t\t$url = 'https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1';\n\t\t$url .= '&accept-language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&q=' . rawurlencode($address);\n\t\tif ($country !== null)\n\t\t{\n\t\t\tif (static::_validateCountryCode($country))\n\t\t\t\t$url .= '&countrycode=' . rawurlencode(strtolower($country));\n\t\t\telse\n\t\t\t\t$url .= '&country=' . rawurlencode($country);\n\t\t}\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data))\n\t\t\treturn null;\n\n\t\treturn [\n\t\t\t'lat' => $data[0]['lat'],\n\t\t\t'lng' => $data[0]['lon'],\n\t\t];\n\t}\n\n\t// Address from Lat/Lng\n\t// -------------------------------------------------------------------------\n\n\tprivate static function _addressFromLatLng_Here ($token, $lat, $lng): ?array\n\t{\n\t\t$url = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json';\n\t\t$url .= '?app_id=' . $token['appId'];\n\t\t$url .= '&app_code=' . $token['appCode'];\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&mode=retrieveAddresses&limit=1&jsonattributes=1';\n\t\t$url .= '&prox=' . rawurlencode($lat) . ',' . rawurldecode($lng) . ',1';\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['Response']['View']))\n\t\t\treturn null;\n\n\t\t$pos = $data['Response']['View'][0]['Result'][0]['Location'];\n\n\t\treturn [\n\t\t\t'address' => $pos['label'],\n\t\t\t'parts' => new Parts($pos, GeoEnum::Here),\n\t\t];\n\t}\n\n\tprivate static function _addressFromLatLng_Google ($token, $lat, $lng): ?array\n\t{\n\t\t$url = 'https://maps.googleapis.com/maps/api/geocode/json';\n\t\t$url .= '?latlng=' . rawurlencode($lat) . ',' . rawurldecode($lng);\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&key=' . $token;\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['results']))\n\t\t\treturn null;\n\n\t\t$pos = $data['results'][0];\n\n\t\treturn [\n\t\t\t'address' => $pos['formatted_address'],\n\t\t\t'parts' => new PartsLegacy($pos['address_components']),\n\t\t];\n\t}\n\n\tprivate static function _addressFromLatLng_Mapbox ($token, $lat, $lng): ?array\n\t{\n\t\t$url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/';\n\t\t$url .= rawurlencode($lng) . ',' . rawurldecode($lat) . '.json?limit=1';\n\t\t$url .= '&types=address,country,postcode,place,locality,district,neighborhood';\n\t\t$url .= '&language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&access_token=' . $token;\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data['features']))\n\t\t\treturn null;\n\n\t\t$feature = $data['features'][0];\n\n\t\treturn [\n\t\t\t'address' => $feature['place_name'],\n\t\t\t'parts' => new Parts($feature, GeoEnum::Mapbox),\n\t\t];\n\t}\n\n\tprivate static function _addressFromLatLng_Nominatim ($lat, $lng): ?array\n\t{\n\t\t$url = 'https://nominatim.openstreetmap.org/reverse?format=jsonv2&limit=1&addressdetails=1';\n\t\t$url .= '&accept-language=' . Craft::$app->locale->getLanguageID();\n\t\t$url .= '&lat=' . rawurlencode($lat) . '&lon=' . rawurldecode($lng);\n\n\t\t$data = (string) static::_client()->get($url)->getBody();\n\t\t$data = Json::decodeIfJson($data);\n\n\t\tif (!is_array($data) || empty($data) || array_key_exists('error', $data))\n\t\t\treturn null;\n\n\t\treturn [\n\t\t\t'address' => $data['display_name'],\n\t\t\t'parts' => new Parts(\n\t\t\t\tarray_merge(\n\t\t\t\t\t$data['address'],\n\t\t\t\t\t['type' => $data['type']]\n\t\t\t\t),\n\t\t\t\tGeoEnum::Nominatim\n\t\t\t),\n\t\t];\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tprivate static function _client ()\n\t{\n\t\tstatic $client;\n\n\t\tif (!$client)\n\t\t\t$client = Craft::createGuzzleClient();\n\n\t\treturn $client;\n\t}\n\n\tprivate static function _validateCountryCode (string $code): bool\n\t{\n\t\treturn in_array(strtoupper($code), array_keys(static::$countries));\n\t}\n\n}\n"
  },
  {
    "path": "src/services/MapService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS 3\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse Craft;\nuse craft\\base\\Component;\nuse craft\\base\\Element;\nuse craft\\base\\ElementInterface;\nuse craft\\elements\\db\\ElementQuery;\nuse craft\\elements\\db\\ElementQueryInterface;\nuse craft\\errors\\InvalidFieldException;\nuse craft\\helpers\\Json;\nuse ether\\simplemap\\models\\Map;\nuse ether\\simplemap\\fields\\MapField;\nuse ether\\simplemap\\records\\Map as MapRecord;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse function Arrayy\\array_first;\n\n/**\n * Class MapService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass MapService extends Component\n{\n\n\t// Properties\n\t// =========================================================================\n\n\tprivate $_location;\n\tprivate $_distance;\n\n\t// Methods\n\t// =========================================================================\n\n\t/**\n\t * @param MapField         $field\n\t * @param ElementInterface $owner\n\t *\n\t * @return bool\n\t * @throws InvalidFieldException\n\t */\n\tpublic function validateField (MapField $field, ElementInterface $owner): bool\n\t{\n\t\t/** @var Map $map */\n\t\t$map = $owner->getFieldValue($field->handle);\n\n\t\t$valid = $map->validate();\n\n\t\tforeach ($map->getErrors() as $error)\n\t\t\t$owner->addError($field->handle, $error[0]);\n\n\t\treturn $valid;\n\t}\n\n\t/**\n\t * @param MapField         $field\n\t * @param ElementInterface $owner\n\t *\n\t * @throws InvalidFieldException\n\t */\n\tpublic function saveField (MapField $field, ElementInterface $owner)\n\t{\n\t\t/** @var Map $map */\n\t\t$map = $owner->getFieldValue($field->handle);\n\n\t\t$map->fieldId     = $field->id;\n\t\t$map->ownerId     = $owner->id;\n\t\t$map->ownerSiteId = $owner->siteId;\n\n\t\t$record = MapRecord::findOne([\n\t\t\t'ownerId'     => $map->ownerId,\n\t\t\t'ownerSiteId' => $map->ownerSiteId,\n\t\t\t'fieldId'     => $map->fieldId,\n\t\t]);\n\n\t\tif ($record)\n\t\t\t$map->id = $record->id;\n\n\t\t$this->saveRecord($map, !$map->id);\n\t}\n\n\t/**\n\t * @param Map $map\n\t * @param     $isNew\n\t *\n\t * @throws Exception\n\t */\n\tpublic function saveRecord (Map $map, $isNew)\n\t{\n\t\t$record = null;\n\n\t\tif (!$isNew)\n\t\t{\n\t\t\t$record = MapRecord::findOne($map->id);\n\n\t\t\tif (!$record)\n\t\t\t\tthrow new Exception('Invalid map ID: ' . $map->id);\n\t\t}\n\n\t\tif ($record === null)\n\t\t{\n\t\t\t$record = new MapRecord();\n\n\t\t\tif ($map->id)\n\t\t\t\t$record->id = $map->id;\n\n\t\t\t$record->ownerId     = $map->ownerId;\n\t\t\t$record->ownerSiteId = $map->ownerSiteId;\n\t\t\t$record->fieldId     = $map->fieldId;\n\t\t}\n\n\t\t$record->lat = $map->lat;\n\t\t$record->lng = $map->lng;\n\n\t\t$record->save(false);\n\t}\n\n\t/**\n\t * Returns the distance from the search origin (if one exists)\n\t *\n\t * @param Map $map\n\t *\n\t * @return float|int|null\n\t */\n\tpublic function getDistance (Map $map): float|int|null\n\t{\n\t\tif (!$this->_location || !$this->_distance)\n\t\t\treturn null;\n\n\t\t$originLat = (float) $this->_location['lat'];\n\t\t$originLng = (float) $this->_location['lng'];\n\n\t\t$targetLat = (float) $map->lat;\n\t\t$targetLng = (float) $map->lng;\n\n\t\treturn (\n\t\t\t$this->_distance *\n\t\t\trad2deg(\n\t\t\t\tacos(\n\t\t\t\t\tcos(deg2rad($originLat)) *\n\t\t\t\t\tcos(deg2rad($targetLat)) *\n\t\t\t\t\tcos(deg2rad($originLng) - deg2rad($targetLng)) +\n\t\t\t\t\tsin(deg2rad($originLat)) *\n\t\t\t\t\tsin(deg2rad($targetLat))\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * @param ElementQueryInterface $query\n\t * @param mixed                 $value\n\t * @param MapField              $field\n\t *\n\t * @throws Exception\n\t */\n\tpublic function modifyElementsQuery (ElementQueryInterface $query, mixed $value, MapField $field)\n\t{\n\t\tif (is_null($value))\n\t\t\treturn;\n\n\t\t// Work-around for Craft built-in GraphQL not supporting custom\n\t\t// arguments for fields:\n\n\t\t// If it's an array with a 0 key, that means it's likely to be a `[QueryArgument]`\n\t\tif (is_array($value) && array_key_exists(0, $value))\n\t\t\t$value = $value[0];\n\n\t\t// If it's a string, check to see if it's JSON and decode it.\n\t\tif (is_string($value))\n\t\t\t$value = Json::decodeIfJson($value);\n\n\t\t// End work-around\n\n\t\t/** @var ElementQuery $query */\n\n\t\t$table = MapRecord::TableName;\n\t\t$alias = MapRecord::TableNameClean . '_' . $field->handle;\n\t\t$on = [\n\t\t\t'and',\n\t\t\t'[[elements.id]] = [[' . $alias . '.ownerId]]',\n\t\t\t'[[elements.dateDeleted]] IS NULL',\n\t\t\t'[[elements_sites.siteId]] = [[' . $alias . '.ownerSiteId]]',\n\t\t\t'[[' . $alias . '.fieldId]] = ' . $field->id,\n\t\t];\n\n\t\t$query->subQuery->join('LEFT JOIN', $table . ' ' . $alias, $on);\n\n\t\tif ($value === ':empty:')\n\t\t{\n\t\t\t$query->subQuery->andWhere([\n\t\t\t\t'[[' . $alias . '.lat]]' => null,\n\t\t\t]);\n\n\t\t\treturn;\n\t\t}\n\t\telse if ($value === ':notempty:' || $value === 'not :empty:')\n\t\t{\n\t\t\t$query->subQuery->andWhere([\n\t\t\t\t'not',\n\t\t\t\t['[[' . $alias . '.lat]]' => null],\n\t\t\t]);\n\n\t\t\treturn;\n\t\t}\n\n\t\t$oldOrderBy = null;\n\t\t$search = false;\n\n\t\tif (!is_array($query->orderBy))\n\t\t{\n\t\t\t$oldOrderBy = $query->orderBy;\n\t\t\t$query->orderBy = [];\n\t\t}\n\n\t\t// Coordinate CraftQL support\n\t\tif (array_key_exists('coordinate', $value))\n\t\t\t$value['location'] = $value['coordinate'];\n\n\t\tif (array_key_exists('location', $value))\n\t\t\t$search = $this->_searchLocation($query, $value, $alias);\n\n\t\tif (array_key_exists('distance', $query->orderBy))\n\t\t\t$this->_replaceOrderBy($query, $search);\n\n\t\tif (empty($query->orderBy))\n\t\t\t$query->orderBy = $oldOrderBy;\n\t}\n\n\t/**\n\t * Populates any missing location data\n\t *\n\t * @param Map      $map\n\t * @param MapField $field\n\t *\n\t * @throws Exception\n\t */\n\tpublic function populateMissingData (Map $map, MapField $field)\n\t{\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\t// Missing zoom\n\t\tif (!$map->zoom)\n\t\t\t$map->zoom = $field->zoom;\n\n\t\t// Skip the rest if populate missing is disabled\n\t\tif ($settings->disablePopulateMissingFieldData)\n\t\t\treturn;\n\n\t\t$postcode = is_array($map->parts)\n\t\t\t? @$map->parts['postcode']\n\t\t\t: $map->parts->postcode;\n\n\t\t// Missing Lat / Lng\n\t\tif (!($map->lat && $map->lng) && !empty($map->address ?: $postcode))\n\t\t{\n\t\t\t$latLng = GeoService::latLngFromAddress($map->address ?: $postcode);\n\t\t\tif ($latLng)\n\t\t\t{\n\t\t\t\t$map->lat = $latLng['lat'];\n\t\t\t\t$map->lng = $latLng['lng'];\n\t\t\t}\n\t\t}\n\n\t\t// Missing address / parts\n\t\tif ((!$map->address || $map->address === $postcode) && ($map->lat && $map->lng))\n\t\t{\n\t\t\t$loc = GeoService::addressFromLatLng($map->lat, $map->lng);\n\t\t\tif ($loc)\n\t\t\t{\n\t\t\t\t$map->address = $loc['address'];\n\t\t\t\t$map->parts   = array_merge(\n\t\t\t\t\tarray_filter((array) $loc['parts']),\n\t\t\t\t\tarray_filter((array) $map->parts)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Missing what3words\n\t\tif ($settings->isW3WEnabled() && empty($map->what3words))\n\t\t\t$map->what3words = What3WordsService::convertLatLngToW3W($map->lat, $map->lng);\n\t}\n\n\t// Private Methods\n\t// =========================================================================\n\n\t/**\n\t * Filters the query by location.\n\t *\n\t * Returns either `false` if we can't filter by location, or the location\n\t * search string if we can.\n\t *\n\t * @param ElementQuery $query\n\t * @param mixed        $value\n\t * @param string       $table\n\t *\n\t * @return bool|string\n\t * @throws Exception\n\t */\n\tprivate function _searchLocation (ElementQuery $query, mixed $value, string $table): bool|string\n\t{\n\t\t$location = $value['location'];\n\t\t$country  = $value['country'] ?? null;\n\t\t$radius   = $value['radius'] ?? 50.0;\n\t\t$unit     = $value['unit'] ?? 'km';\n\n\t\t// Normalize location\n\t\t$location = GeoService::normalizeLocation($location, $country);\n\n\t\t// If we don't have a location, reduce the search radius to 0\n\t\tif (empty($location))\n\t\t{\n\t\t\t$location = ['lat' => 0, 'lng' => 0];\n\t\t\t$radius = 0;\n\t\t}\n\n\t\t$lat = $location['lat'];\n\t\t$lng = $location['lng'];\n\n\t\t// Normalize radius\n\t\tif (!is_numeric($radius))\n\t\t\t$radius = (float) $radius;\n\n\t\tif (!is_numeric($radius))\n\t\t\t$radius = 50.0;\n\n\t\t// Normalize unit\n\t\t$unit = GeoService::normalizeDistance($unit);\n\n\t\t// Base Distance\n\t\t$distance = $unit === 'km' ? '111.045' : '69.0';\n\n\t\t// Store for populating search result distance\n\t\t$this->_location = $location;\n\t\t$this->_distance = (float) $distance;\n\n\t\t// Search Query\n\t\t$search = str_replace([\"\\r\", \"\\n\", \"\\t\"], '', \"(\n\t\t\t$distance *\n\t\t\tDEGREES(\n\t\t\t\tACOS(\n\t\t\t\t\tCOS(RADIANS($lat)) *\n\t\t\t\t\tCOS(RADIANS([[$table.lat]])) *\n\t\t\t\t\tCOS(RADIANS($lng) - RADIANS([[$table.lng]])) +\n\t\t\t\t\tSIN(RADIANS($lat)) *\n\t\t\t\t\tSIN(RADIANS([[$table.lat]]))\n\t\t\t\t)\n\t\t\t)\n\t\t)\");\n\n\t\t// Restrict the results\n\t\t$restrict = [\n\t\t\t'and',\n\t\t\t[\n\t\t\t\t'and',\n\t\t\t\t\"[[$table.lat]] >= $lat - ($radius / $distance)\",\n\t\t\t\t\"[[$table.lat]] <= $lat + ($radius / $distance)\",\n\t\t\t],\n\t\t\t[\n\t\t\t\t'and',\n\t\t\t\t\"[[$table.lng]] >= $lng - ($radius / ($distance * COS(RADIANS($lat))))\",\n\t\t\t\t\"[[$table.lng]] <= $lng + ($radius / ($distance * COS(RADIANS($lat))))\",\n\t\t\t]\n\t\t];\n\n\t\t// Filter the query\n\t\t$query\n\t\t\t->subQuery\n\t\t\t->addSelect($search . ' as [[distance]]')\n\t\t\t->andWhere($restrict)\n\t\t\t->andWhere([\n\t\t\t\t'not',\n\t\t\t\t['[[' . $table . '.lat]]' => null],\n\t\t\t]);\n\n\t\tif (Craft::$app->getDb()->driverName === 'pgsql')\n\t\t\t$query->subQuery->andWhere($search . ' <= ' . $radius);\n\t\telse\n\t\t\t$query->subQuery->andHaving('[[distance]] <= ' . $radius);\n\n\t\treturn '[[distance]]';\n\t}\n\n\t/**\n\t * Will replace the distance search with the correct query if available,\n\t * or otherwise remove it.\n\t *\n\t * @param ElementQuery $query\n\t * @param bool         $search\n\t */\n\tprivate function _replaceOrderBy (ElementQuery $query, string $search = \"\")\n\t{\n\t\t$nextOrder = [];\n\n\t\tforeach ((array) $query->orderBy as $order => $sort)\n\t\t{\n\t\t\tif ($order === 'distance' && !empty($search)) $nextOrder[$search] = $sort;\n\t\t\telseif ($order !== 'distance') $nextOrder[$order] = $sort;\n\t\t}\n\n\t\t$query->subQuery->orderBy($nextOrder);\n\t\t$query->orderBy($nextOrder);\n\t}\n\n}\n"
  },
  {
    "path": "src/services/StaticService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse Craft;\nuse craft\\base\\Component;\nuse craft\\helpers\\Json;\nuse craft\\helpers\\UrlHelper;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\models\\Marker;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\models\\StaticOptions;\nuse ether\\simplemap\\SimpleMap;\nuse ether\\simplemap\\utilities\\StaticMap;\nuse Exception;\n\n/**\n * Class StaticService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass StaticService extends Component\n{\n\n\t/**\n\t * @param array $options\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tpublic function generate (array $options = []): string\n\t{\n\t\tif (SimpleMap::v(SimpleMap::EDITION_LITE))\n\t\t\treturn 'Sorry, static maps are a Maps Pro feature!';\n\n\t\t$options = new StaticOptions($options);\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\tswitch ($settings->mapTiles) {\n\t\t\tcase MapTiles::GoogleHybrid:\n\t\t\tcase MapTiles::GoogleRoadmap:\n\t\t\tcase MapTiles::GoogleTerrain:\n\t\t\t\treturn $this->_generateGoogle($options, $settings);\n\t\t\tcase MapTiles::MapKitHybrid:\n\t\t\tcase MapTiles::MapKitMutedStandard:\n\t\t\tcase MapTiles::MapKitSatellite:\n\t\t\tcase MapTiles::MapKitStandard:\n\t\t\t\treturn $this->_generateApple($options, $settings);\n\t\t\tcase MapTiles::MapboxDark:\n\t\t\tcase MapTiles::MapboxLight:\n\t\t\tcase MapTiles::MapboxOutdoors:\n\t\t\tcase MapTiles::MapboxStreets:\n\t\t\t\treturn $this->_generateMapbox($options, $settings);\n\t\t\tcase MapTiles::HereHybrid:\n\t\t\tcase MapTiles::HereNormalDay:\n\t\t\tcase MapTiles::HereNormalDayGrey:\n\t\t\tcase MapTiles::HereNormalDayTransit:\n\t\t\tcase MapTiles::HerePedestrian:\n\t\t\tcase MapTiles::HereReduced:\n\t\t\tcase MapTiles::HereSatellite:\n\t\t\tcase MapTiles::HereTerrain:\n\t\t\t\treturn $this->_generateHere($options, $settings);\n\t\t\tdefault:\n\t\t\t\treturn $this->_generateDefault($options);\n\t\t}\n\t}\n\n\t// Generators\n\t// =========================================================================\n\n\t/**\n\t * @param StaticOptions $options\n\t * @param Settings      $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _generateGoogle (StaticOptions $options, Settings $settings): string\n\t{\n\t\t$params = [\n\t\t\t'center' => implode(',', $options->getCenter()),\n\t\t\t'zoom' => $options->zoom,\n\t\t\t'size' => $options->getSize(),\n\t\t\t'scale' => $options->scale,\n\t\t\t'language' => Craft::$app->getLocale()->getLanguageID(),\n\t\t\t'region' => $this->_getTld(),\n\t\t\t'key' => GeoService::getToken(\n\t\t\t\t$settings->getMapToken(),\n\t\t\t\t$settings->mapTiles\n\t\t\t),\n\t\t];\n\n\t\t$markersString = '';\n\t\tif (!empty($options->markers))\n\t\t{\n\t\t\t$markers = [];\n\n\t\t\t/** @var Marker $marker */\n\t\t\tforeach ($options->markers as $marker)\n\t\t\t{\n\t\t\t\t$m = [\n\t\t\t\t\t'color:' . str_replace('#', '0x', $marker->color),\n\t\t\t\t];\n\n\t\t\t\tif ($marker->label !== null)\n\t\t\t\t\t$m[] = 'label:' . strtoupper($marker->label);\n\n\t\t\t\t$m[] = $marker->getLocation();\n\n\t\t\t\t$markers[] = implode('|', $m);\n\t\t\t}\n\n\t\t\t$markersString = '&markers=' . implode('&markers=', $markers);\n\t\t}\n\n\t\t$params['maptype'] = match ($settings->mapTiles)\n\t\t{\n\t\t\tMapTiles::GoogleTerrain => 'terrain',\n\t\t\tMapTiles::GoogleRoadmap => 'roadmap',\n\t\t\tMapTiles::GoogleHybrid => 'hybrid',\n\t\t};\n\n\t\treturn 'https://maps.googleapis.com/maps/api/staticmap?' . http_build_query($params) . $markersString;\n\t}\n\n\t/**\n\t * @param StaticOptions $options\n\t * @param Settings      $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _generateApple (StaticOptions $options, Settings $settings): string\n\t{\n\t\t$params = [\n\t\t\t'center' => implode(',', $options->getCenter()),\n\t\t\t'z' => $options->zoom,\n\t\t\t'size' => $options->getSize(),\n\t\t\t'scale' => $options->scale,\n\t\t\t'lang' => Craft::$app->getLocale()->getLanguageID(),\n\t\t\t'teamId' => $settings->getMapToken()['teamId'],\n\t\t\t'keyId' => $settings->getMapToken()['keyId'],\n\t\t];\n\n\t\tif (!empty($options->markers))\n\t\t{\n\t\t\t$params['annotations'] = [];\n\n\t\t\tforeach ($options->markers as $marker)\n\t\t\t{\n\t\t\t\t$params['annotations'][] = [\n\t\t\t\t\t'color' => str_replace('#', '', $marker->color),\n\t\t\t\t\t'glyphText' => $marker->label,\n\t\t\t\t\t'point' => $marker->getLocation(true),\n\t\t\t\t];\n\t\t\t}\n\n\t\t\t$params['annotations'] = Json::encode($params['annotations']);\n\t\t}\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tcase MapTiles::MapKitStandard:\n\t\t\t\t$params['type'] = 'standard';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitSatellite:\n\t\t\t\t$params['type'] = 'satellite';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitMutedStandard:\n\t\t\t\t$params['type'] = 'mutedStandard';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapKitHybrid:\n\t\t\t\t$params['type'] = 'hybrid';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$path = '/api/v1/snapshot?' . http_build_query($params);\n\t\topenssl_sign($path, $signature, $settings->getMapToken()['privateKey'], OPENSSL_ALGO_SHA256);\n\t\t$signature = $this->_encode($signature);\n\n\t\treturn 'https://snapshot.apple-mapkit.com' . $path . '&signature=' . $signature;\n\t}\n\n\t/**\n\t * @param StaticOptions $options\n\t * @param Settings      $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _generateMapbox (StaticOptions $options, Settings $settings): string\n\t{\n\t\t$url = 'https://api.mapbox.com/styles/v1/mapbox/';\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tcase MapTiles::MapboxStreets:\n\t\t\t\t$url .= 'streets-v11';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxOutdoors:\n\t\t\t\t$url .= 'outdoors-v11';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxLight:\n\t\t\t\t$url .= 'light-v10';\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::MapboxDark:\n\t\t\t\t$url .= 'dark-v10';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$url .= '/static/';\n\n\t\tif (!empty($options->markers))\n\t\t{\n\t\t\t$markers = [];\n\t\t\t$i = 0;\n\n\t\t\tforeach ($options->markers as $marker)\n\t\t\t{\n\t\t\t\t$m = 'pin-l-';\n\t\t\t\t$m .= strtolower($marker->label ?: ++$i);\n\t\t\t\t$m .= '+' . str_replace('#', '', $marker->color);\n\t\t\t\t$m .= '(' . implode(',', array_reverse(explode(',', $marker->getLocation(true)))) . ')';\n\n\t\t\t\t$markers[] = $m;\n\t\t\t}\n\n\t\t\t$url .= implode(',', $markers) . '/';\n\t\t}\n\n\t\t$center = $options->getCenter();\n\t\t$url .= $center['lng'] . ',';\n\t\t$url .= $center['lat'] . ',';\n\t\t$url .= $options->zoom . ',0,0';\n\t\t$url .= '/' . $options->getSize();\n\n\t\tif ($options->scale > 1)\n\t\t\t$url .= '@2x';\n\n\t\treturn $url . '?access_token=' . $settings->getMapToken();\n\t}\n\n\t/**\n\t * @param StaticOptions $options\n\t * @param Settings      $settings\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _generateHere (StaticOptions $options, Settings $settings): string\n\t{\n\t\t$params = [\n\t\t\t'app_id' => $settings->getMapToken()['appId'],\n\t\t\t'app_code' => $settings->getMapToken()['appCode'],\n\t\t\t'nodot' => true,\n\t\t\t'c' => implode(',', $options->getCenter()),\n\t\t\t'z' => $options->zoom,\n\t\t\t'w' => $options->width * $options->scale,\n\t\t\t'h' => $options->height * $options->scale,\n\t\t];\n\n\t\tswitch ($settings->mapTiles)\n\t\t{\n\t\t\tcase MapTiles::HereHybrid:\n\t\t\t\t$params['t'] = 3;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereNormalDay:\n\t\t\t\t$params['t'] = 0;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereNormalDayGrey:\n\t\t\t\t$params['t'] = 5;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereNormalDayTransit:\n\t\t\t\t$params['t'] = 4;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereReduced:\n\t\t\t\t$params['t'] = 6;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HerePedestrian:\n\t\t\t\t$params['t'] = 13;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereSatellite:\n\t\t\t\t$params['t'] = 1;\n\t\t\t\tbreak;\n\t\t\tcase MapTiles::HereTerrain:\n\t\t\t\t$params['t'] = 2;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (!empty($options->markers))\n\t\t{\n\t\t\t$i = 0;\n\n\t\t\tforeach ($options->markers as $marker)\n\t\t\t{\n\t\t\t\t$m = [$marker->getLocation(true)];\n\t\t\t\t$m[] = str_replace('#', '', $marker->color);\n\t\t\t\t$m[] = StaticMap::getLabelColour($marker->color);\n\t\t\t\t$m[] = 18;\n\t\t\t\t$m[] = $marker->label ?: ++$i;\n\n\t\t\t\t$params['poix' . ($i - 1)] = implode(';', $m);\n\t\t\t}\n\t\t}\n\n\t\treturn 'https://image.maps.api.here.com/mia/1.6/mapview?' . http_build_query($params);\n\t}\n\n\t/**\n\t * @param StaticOptions $options\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tprivate function _generateDefault (StaticOptions $options): string\n\t{\n\t\t$center = $options->getCenter();\n\n\t\treturn UrlHelper::actionUrl(\n\t\t\t'simplemap/static',\n\t\t\t[\n\t\t\t\t'lat' => $center['lat'],\n\t\t\t\t'lng' => $center['lng'],\n\t\t\t\t'zoom' => $options->zoom,\n\t\t\t\t'width' => $options->width,\n\t\t\t\t'height' => $options->height,\n\t\t\t\t'scale' => $options->scale,\n\t\t\t\t'markers' => urlencode(implode(';', $options->markers)),\n\t\t\t\t'csrf' => Craft::$app->getRequest()->getCsrfToken(),\n\t\t\t]\n\t\t);\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tprivate function _getTld (): array\n\t{\n\t\t$url = 'http://' . $_SERVER['SERVER_NAME'];\n\n\t\treturn explode(\".\", parse_url($url, PHP_URL_HOST));\n\t}\n\n\tprivate function _encode ($data): string\n\t{\n\t\t$encoded = strtr(base64_encode($data), '+/', '-_');\n\n\t\treturn rtrim($encoded, '=');\n\t}\n\n}\n"
  },
  {
    "path": "src/services/What3WordsService.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2020 Ether Creative\n */\n\nnamespace ether\\simplemap\\services;\n\nuse ether\\simplemap\\SimpleMap;\nuse What3words\\Geocoder\\Geocoder;\n\n/**\n * Class What3WordsService\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\services\n */\nclass What3WordsService\n{\n\n\tpublic static function convertLatLngToW3W ($lat, $lng)\n\t{\n\t\treturn self::_geocoder()->convertTo3wa($lat, $lng)['words'] ?? false;\n\t}\n\n\tprivate static function _geocoder ()\n\t{\n\t\tstatic $geocoder;\n\n\t\tif ($geocoder)\n\t\t\treturn $geocoder;\n\n\t\treturn $geocoder = new Geocoder(SimpleMap::getInstance()->getSettings()->getW3WToken());\n\t}\n\n}\n"
  },
  {
    "path": "src/templates/_feedme-mapping.twig",
    "content": "{# ------------------------ #}\n{# Available Variables #}\n{# ------------------------ #}\n{# Attributes: #}\n{# type, name, handle, instructions, attribute, default, feed, feedData #}\n{# ------------------------ #}\n{# Fields: #}\n{# name, handle, instructions, feed, feedData, field, fieldClass #}\n{# ------------------------ #}\n\n{% import 'feed-me/_macros' as feedMeMacro %}\n{% import '_includes/forms' as forms %}\n\n{# Special case when inside another complex field (Matrix) #}\n{% if parentPath is defined %}\n\t{% set prefixPath = parentPath %}\n{% else %}\n\t{% set prefixPath = [handle] %}\n{% endif %}\n\n{% set classes = ['complex-field'] %}\n\n<tr class=\"complex-field complex-field-header\">\n\t<td class=\"col-field\" colspan=\"3\">\n\t\t<div class=\"field\">\n\t\t\t<div class=\"heading\">\n\t\t\t\t<label class=\"\">{{ name }}</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"additional-mapping-fields\">\n\t\t\t\t{% namespace 'fieldMapping[' ~ prefixPath | join('][') ~ ']' %}\n\t\t\t\t\t<input type=\"text\" name=\"field\" value=\"{{ className(field) }}\">\n\t\t\t\t{% endnamespace %}\n\t\t\t</div>\n\t\t</div>\n\t</td>\n</tr>\n\n{% set simpleMapSubfields = {\n\tlat: 'Latitude'|t('simplemap'),\n\tlng: 'Longitude'|t('simplemap'),\n\tzoom: 'Zoom'|t('simplemap'),\n\taddress: 'Full Address'|t('simplemap'),\n\t'parts.number': 'Number'|t('simplemap'),\n\t'parts.address': 'Address'|t('simplemap'),\n\t'parts.city': 'City'|t('simplemap'),\n\t'parts.postcode': 'Postcode'|t('simplemap'),\n\t'parts.county': 'County'|t('simplemap'),\n\t'parts.state': 'State'|t('simplemap'),\n\t'parts.country': 'Country'|t('simplemap'),\n} %}\n\n{% for key, col in simpleMapSubfields %}\n\t{% set splitKey = '.' in key %}\n\t{% set subKey = null %}\n\n\t{% if splitKey %}\n\t\t{% set key = key|split('.') %}\n\t\t{% set subKey = key[1] %}\n\t\t{% set key = key[0] %}\n\t{% endif %}\n\n\t{% set nameLabel = col %}\n\t{% set instructionsHandle = handle ~ '[' ~ key ~ ']' ~ (subKey ? '[' ~ subKey ~ ']') %}\n\n\t{% set path = prefixPath | merge ([ 'fields', key, subKey ]|filter) %}\n\n\t{% set default = default ?? {\n\t\ttype: 'text',\n\t} %}\n\n\t{% embed 'feed-me/_includes/fields/_base' %}\n\t\t{% block additionalFieldSettings %}\n\n\t\t{% endblock %}\n\n\t\t{% block fieldSettings %}\n\n\t\t{% endblock %}\n\t{% endembed %}\n{% endfor %}\n"
  },
  {
    "path": "src/templates/field-settings.twig",
    "content": "{% import '_includes/forms' as forms %}\n\n{{ forms.field({\n\tlabel: 'Initial Location'|t('simplemap'),\n\tinstructions: 'The initial location and zoom that will show in the map field'|t('simplemap'),\n}, map) }}\n\n{{ forms.lightswitchField({\n\tlabel: 'Hide Search'|t('simplemap'),\n\tinstructions: 'Hide the location search field'|t('simplemap'),\n\tid: 'hideSearch',\n\tname: 'hideSearch',\n\ton: field.hideSearch\n}) }}\n\n{{ forms.lightswitchField({\n\tlabel: 'Hide Map'|t('simplemap'),\n\tinstructions: 'Hide the map'|t('simplemap'),\n\tid: 'hideMap',\n\tname: 'hideMap',\n\ton: field.hideMap\n}) }}\n\n{{ forms.lightswitchField({\n\tlabel: 'Hide Address'|t('simplemap'),\n\tinstructions: 'Hide the address fields'|t('simplemap'),\n\tid: 'hideAddress',\n\tname: 'hideAddress',\n\ton: field.hideAddress\n}) }}\n\n{{ forms.lightswitchField({\n\tlabel: 'Show Latitude / Longitude'|t('simplemap'),\n\tinstructions: 'Show the latitude / longitude fields'|t('simplemap'),\n\tid: 'showLatLng',\n\tname: 'showLatLng',\n\ton: field.showLatLng\n}) }}\n\n{{ forms.lightswitchField({\n\tlabel: 'Show Current Location'|t('simplemap'),\n\tinstructions: 'Show a button to centre the map on the users current location'|t('simplemap'),\n\tid: 'showCurrentLocation',\n\tname: 'showCurrentLocation',\n\ton: field.showCurrentLocation\n}) }}\n\n{{ forms.selectField({\n\tlabel: 'Field Size'|t('simplemap'),\n\tinstructions: 'Choose the size of the field to display'|t('simplemap'),\n\tid: 'size',\n\tname: 'size',\n\toptions: {\n\t\t'normal': 'Normal'|t('simplemap'),\n\t\t'mini': 'Mini'|t('simplemap'),\n\t},\n\tvalue: field.size,\n}) }}\n\n{{ forms.selectField({\n\tlabel: 'Preferred Country'|t('simplemap'),\n\tinstructions: 'When searching for a location, results in this country will take precedence. Be aware that some services will show results ONLY within this country.'|t('simplemap'),\n\tid: 'country',\n\tname: 'country',\n\toptions: countries,\n\tvalue: field.country,\n}) }}\n\n{{ forms.textField({\n\tlabel: 'Min Zoom'|t('simplemap'),\n\tinstructions: 'The minimum level the user can zoom the map out to.'|t('simplemap'),\n\tid: 'minZoom',\n\tname: 'minZoom',\n\ttype: 'number',\n\tvalue: field.minZoom,\n\tmin: 0,\n\tmax: 18,\n\tstep: 0.01,\n}) }}\n\n{{ forms.textField({\n\tlabel: 'Max Zoom'|t('simplemap'),\n\tinstructions: 'The maximum level the user can zoom the map in to.'|t('simplemap'),\n\tid: 'maxZoom',\n\tname: 'maxZoom',\n\ttype: 'number',\n\tvalue: field.maxZoom,\n\tmin: 0,\n\tmax: 18,\n\tstep: 0.01,\n}) }}\n\n{% if settings.isW3WEnabled() %}\n\t{{ forms.lightswitchField({\n\t\tlabel: 'Enable what3words grid'|t('simplemap'),\n\t\tinstructions: 'Will enable the what3words grid overlay when zoomed in above 17'|t('simplemap'),\n\t\tid: 'showW3WGrid',\n\t\tname: 'showW3WGrid',\n\t\ton: field.showW3WGrid\n\t}) }}\n\n\t{{ forms.lightswitchField({\n\t\tlabel: 'Show what3words field'|t('simplemap'),\n\t\tinstructions: 'Show the what3words field for the selected location'|t('simplemap'),\n\t\tid: 'showW3WField',\n\t\tname: 'showW3WField',\n\t\ton: field.showW3WField\n\t}) }}\n{% endif %}\n"
  },
  {
    "path": "src/templates/settings.twig",
    "content": "{% extends '_layouts/cp' %}\n{% set title = 'Settings'|t('app') %}\n{% set showHeader = false %}\n{% set fullPageForm = true %}\n{% do craft.app.view.registerAssetBundle('craft\\\\web\\\\assets\\\\vue\\\\VueAsset') %}\n\n{#{% dd settings %}#}\n\n{% macro selectLoop (options, value) %}\n\t{% set hasOptgroups = false %}\n\t{% for key, option in options %}\n\t\t{% if option.optgroup is defined %}\n\t\t\t{% if hasOptgroups %}\n\t\t\t\t</optgroup>\n\t\t\t{% else %}\n\t\t\t\t{% set hasOptgroups = true %}\n\t\t\t{% endif %}\n\t\t\t<optgroup label=\"{{ option.optgroup }}\">\n\t\t{% else %}\n\t\t\t{% set optionLabel = (option.label is defined ? option.label : option) %}\n\t\t\t{% set optionValue = (option.value is defined ? option.value : key) %}\n\t\t\t{% set optionDisabled = (option.disabled is defined ? option.disabled : false) %}\n\t\t\t<option value=\"{{ optionValue }}\"{% if (optionValue~'') is same as (value~'') %} selected{% endif %}{% if optionDisabled %} disabled{% endif %}>\n\t\t\t\t{{- optionLabel -}}\n\t\t\t</option>\n\t\t{% endif %}\n\t{% endfor %}\n\t{% if hasOptgroups %}\n\t\t</optgroup>\n\t{% endif %}\n{% endmacro %}\n{% macro label (label, instructions, children) %}\n\t<label class=\"maps-label\">\n\t\t<strong>{{ label|t('simplemap') }}</strong>\n\t\t<span>{{ instructions|t('simplemap') }}</span>\n\t\t{{ children }}\n\t</label>\n{% endmacro %}\n{% macro tokenValue (token, key) -%}\n\t{%- if token is iterable and key in token|keys -%}\n\t\t{{- token[key] -}}\n\t{%- endif -%}\n{%- endmacro %}\n{% from _self import selectLoop, label, tokenValue %}\n\n{% block content %}\n<div v-cloak>\n\t<input type=\"hidden\" name=\"action\" value=\"plugins/save-plugin-settings\">\n\t<input type=\"hidden\" name=\"pluginHandle\" value=\"simplemap\">\n\t{{ redirectInput('maps/settings') }}\n\n\t<header class=\"maps-header\">\n\t\t<h1>\n\t\t\t{{ svg('@simplemap/icon.svg') }}\n\t\t\t<span>{{ 'Maps'|t('simplemap') }}</span>\n\t\t</h1>\n\t\t<button>\n\t\t\tSave\n\t\t</button>\n\t</header>\n\n\t<section class=\"maps-map\">\n\t\t{% for key, label in mapTileOptions %}\n\t\t\t{% if key != '0' and key != '1' %}\n\t\t\t\t{% set x1 = craft.app.assetManager.getPublishedUrl('@simplemapimages/' ~ (key|replace({'.':'-','/':'-'})) ~ '-1x.jpg', true) %}\n\t\t\t\t{% set x2 = craft.app.assetManager.getPublishedUrl('@simplemapimages/' ~ (key|replace({'.':'-','/':'-'})) ~ '.jpg', true) %}\n\t\t\t\t<image-fade-on-load\n\t\t\t\t\tsrc=\"{{ x1 }}\"\n\t\t\t\t\tsrcset=\"{{ x1 }} 1x, {{ x2 }} 2x\"\n\t\t\t\t\talt=\"{{ label is iterable ? label.label : label }}\"\n\t\t\t\t\t:show=\"mapTiles === '{{ key }}'\"\n\t\t\t\t></image-fade-on-load>\n\t\t\t{% endif %}\n\t\t{% endfor %}\n\n\t\t{% namespace 'settings' %}\n\t\t<label class=\"maps-card maps-style\">\n\t\t\t<span>{{ 'Select your map style'|t('simplemap') }}</span>\n\t\t\t<select name=\"mapTiles\" v-model=\"mapTiles\">\n\t\t\t\t{{ selectLoop(mapTileOptions, settings.mapTiles) }}\n\t\t\t</select>\n\t\t</label>\n\n\t\t<div class=\"maps-card\">\n\t\t\t{% set mapTokenIterable = settings.mapToken is iterable %}\n\n\t\t\t<div v-if=\"mapTilesSimple && requiresMapToken\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken\"\n\t\t\t\t\t\tvalue=\"{{ not mapTokenIterable ? settings.mapToken }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Map Token', 'Add the API key for map tiles service you are using.', children) }}\n\t\t\t</div>\n\t\t\t<div v-if=\"mapTiles.indexOf('mapkit') > -1\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tname=\"mapToken[privateKey]\"\n\t\t\t\t\t\trows=\"6\"\n\t\t\t\t\t>{{ tokenValue(settings.mapToken, 'privateKey') }}</textarea>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Private Key', 'Paste the contents of your private key files below (supports env variables).', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken[keyId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.mapToken, 'keyId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Key ID', 'The ID of the key associated with your private key.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken[teamId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.mapToken, 'teamId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Team ID', 'The team ID that created the key ID and private key.', children) }}\n\t\t\t</div>\n\t\t\t<div v-if=\"mapTiles.indexOf('here') > -1\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken[appId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.mapToken, 'appId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('App ID', 'Your Here app ID.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken[appCode]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.mapToken, 'appCode') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('App Code', 'Your Here app code.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"mapToken[apiKey]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.mapToken, 'apiKey') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('API Key', 'Your Here API Key (only required for front-end embed maps).', children) }}\n\t\t\t</div>\n\t\t</div>\n\t</section>\n\n\t<section class=\"maps-settings\">\n\t\t<div class=\"maps-card\">\n\t\t\t<h2>Geocoding</h2>\n\t\t\t{% set children %}\n\t\t\t\t<div class=\"maps-select\">\n\t\t\t\t\t<select name=\"geoService\" v-model=\"geoService\">\n\t\t\t\t\t\t{{ selectLoop(geoServiceOptions, settings.geoService) }}\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t{% endset %}\n\t\t\t{{ label('Geo Service', 'Select the service to be used for Geocoding.', children) }}\n\n\t\t\t{% set geoTokenIterable = settings.geoToken is iterable %}\n\n\t\t\t<div v-if=\"geoServiceSimple && requiresGeoToken\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoToken\"\n\t\t\t\t\t\tvalue=\"{{ not geoTokenIterable ? settings.geoToken }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Geo Token', 'Add the API key for the geocoding service.', children) }}\n\t\t\t</div>\n\n\t\t\t<div v-if=\"geoService.indexOf('mapkit') > -1\">\n\t\t\t\t<div class=\"field\">\n\t\t\t\t\t<div class=\"warning\">\n\t\t\t\t\t\t<p style=\"display:inline-block;vertical-align:top\">\n\t\t\t\t\t\t\t<strong>{{ 'Notice'|t('simplemap') }}</strong><br>\n\t\t\t\t\t\t\t{{ 'MapKit does not support individual address parts.'|t('simplemap') }}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tname=\"geoToken[privateKey]\"\n\t\t\t\t\t\trows=\"6\"\n\t\t\t\t\t>{{ tokenValue(settings.geoToken, 'privateKey') }}</textarea>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Private Key', 'Paste the contents of your private key files below (supports env variables).', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoToken[keyId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoToken, 'keyId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Key ID', 'The ID of the key associated with your private key.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoToken[teamId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoToken, 'teamId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Team ID', 'The team ID that created the key ID and private key.', children) }}\n\t\t\t</div>\n\n\t\t\t<div v-if=\"geoService.indexOf('here') > -1\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoToken[appId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoToken, 'appId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('App ID', 'Your Here app ID.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoToken[appCode]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoToken, 'appCode') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('App Code', 'Your Here app code.', children) }}\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"maps-card maps-help\">\n\t\t\t<h2>{{ 'Getting API Keys'|t('simplemap') }}</h2>\n\t\t\t<a href=\"https://cloud.google.com/maps-platform/#get-started\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~mapTiles.indexOf('google')||~geoService.indexOf('google')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/google.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'Google Maps'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'You will need to enable the **Maps JavaScript API** and **Places API** for if using Google for the map tiles, and the **Places API** and **Geocoding API** if you are using it for the Geo service.'|md|striptags('<strong>')|raw }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t\t<a href=\"https://docs.mapbox.com/help/how-mapbox-works/access-tokens/\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~mapTiles.indexOf('mapbox')||~geoService.indexOf('mapbox')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/mapbox.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'Mapbox'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'You can use the same key for both map tiles and geo service, no configuration needed!'|t('simplemap') }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t\t<a href=\"https://developer.apple.com/documentation/mapkitjs/setting_up_mapkit_js\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~mapTiles.indexOf('mapkit')||~geoService.indexOf('mapkit')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/apple.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'Apple MapKit'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'We currently only support Apple MapKit for map tiles only.'|t('simplemap') }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t\t<a href=\"https://developer.here.com/\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~mapTiles.indexOf('here')||~geoService.indexOf('here')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/here.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'Here'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'You can use the same key for both map tiles and geo service, no configuration needed!'|t('simplemap') }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t</div>\n\n\t\t<hr>\n\n\t\t<div class=\"maps-card {{ isLite ? 'disabled' }}\">\n\t\t\t<h2>\n\t\t\t\tIP Geolocation\n\t\t\t\t<span class=\"maps-pro\">Pro</span>\n\t\t\t</h2>\n\t\t\t{% set children %}\n\t\t\t\t<div class=\"maps-select\">\n\t\t\t\t\t<select name=\"geoLocationService\" v-model=\"geoLocationService\">\n\t\t\t\t\t\t{{ selectLoop(geoLocationOptions, settings.geoLocationService) }}\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t{% endset %}\n\t\t\t{{ label('Geolocation Service', 'Select the service to be used for Geolocating users.', children) }}\n\n\t\t\t{% set geoLocationTokenIterable = settings.geoLocationToken is iterable %}\n\t\t\t<div v-if=\"geoLocationSimple && requiresGeoLocationToken\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoLocationToken\"\n\t\t\t\t\t\tvalue=\"{{ not geoLocationTokenIterable ? settings.geoLocationToken }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Geolocation Token', 'Add the API key for the geolocation service.', children) }}\n\t\t\t</div>\n\t\t\t<div v-if=\"requiresGeoLocationToken && geoLocationService.indexOf('maxmind') > -1\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoLocationToken[accountId]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoLocationToken, 'accountId') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('Account ID', 'Your MaxMind account ID.', children) }}\n\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"geoLocationToken[licenseKey]\"\n\t\t\t\t\t\tvalue=\"{{ tokenValue(settings.geoLocationToken, 'licenseKey') }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('License Key', 'Your MaxMind license key.', children) }}\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"maps-card maps-help\">\n\t\t\t<h2>{{ 'Getting Geolocation API Keys'|t('simplemap') }}</h2>\n\t\t\t<a href=\"https://ipstack.com/product\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~geoLocationService.indexOf('ipstack')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/ipstack.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'ipstack'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'ipstack offer free and paid-for versions of their API.'|raw }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t\t<a href=\"https://www.maxmind.com/en/geoip2-precision-services\" target=\"_blank\" rel=\"nofollow\" :class=\"{active:~geoLocationService.indexOf('maxmind')}\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/maxmind.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'MaxMind'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'MaxMind offer free lookup database that must be stored locally, and a more accurate paid-for version of their API.'|raw }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t</div>\n\n\t\t<hr>\n\n\t\t<div class=\"maps-card {{ isLite ? 'disabled' }}\">\n\t\t\t<h2>\n\t\t\t\t{{ 'what3words'|t('simplemap') }}\n\t\t\t\t<span class=\"maps-pro\">Pro</span>\n\t\t\t</h2>\n\n\t\t\t{% set children %}\n\t\t\t\t<div class=\"maps-select\">\n\t\t\t\t\t<select name=\"w3wEnabled\" v-model=\"w3wEnabled\">\n\t\t\t\t\t\t{{ selectLoop([\n\t\t\t\t\t\t\t{ label: 'Yes', value: '1' },\n\t\t\t\t\t\t\t{ label: 'No', value: '' },\n\t\t\t\t\t\t], settings.w3wEnabled ? '1' : '') }}\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t{% endset %}\n\t\t\t{{ label('Enable what3words Integration', '', children) }}\n\n\t\t\t<div v-if=\"requiresW3WToken\">\n\t\t\t\t{% set children %}\n\t\t\t\t\t<craft-autosuggest\n\t\t\t\t\t\tname=\"w3wToken\"\n\t\t\t\t\t\tvalue=\"{{ settings.w3wToken }}\"\n\t\t\t\t\t></craft-autosuggest>\n\t\t\t\t{% endset %}\n\t\t\t\t{{ label('what3words Token', 'Your what3words API key.', children) }}\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"maps-card maps-help\">\n\t\t\t<h2>{{ 'Getting a what3words API Key'|t('simplemap') }}</h2>\n\t\t\t<a href=\"https://developer.what3words.com/public-api\" target=\"_blank\" rel=\"nofollow\" class=\"active\">\n\t\t\t\t{{ svg('@simplemap/web/assets/svgs/w3w.svg') }}\n\t\t\t\t<span>\n\t\t\t\t\t<em>{{ 'what3words'|t('simplemap') }}</em>\n\t\t\t\t\t{{ 'what3words offer a free public API key.'|raw }}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t</div>\n\t</section>\n\n\t{% endnamespace %}\n</div>\n{% endblock %}\n\n{% do craft.app.view.registerAssetBundle('craft\\\\web\\\\assets\\\\vue\\\\VueAsset') %}\n{# Note: these are separate purely as a workaround for issues with PHPStorms syntax highlighting :( #}\n{% js %}\nwindow.__mapsData = {\n\tmapTiles: '{{ settings.mapTiles }}',\n\tgeoService: '{{ settings.geoService }}',\n\tgeoLocationService: '{{ settings.geoLocationService }}',\n\tw3wEnabled: '{{ settings.w3wEnabled ? 1 }}',\n};\nwindow.__mapsCraftAutosuggestSuggestions = {{ craft.cp.getEnvSuggestions()|json_encode|raw }};\n{% endjs %}\n{% js %}\nconst CraftAutosuggest = {\n\tprops: ['name', 'value'],\n\tdelimiters: ['%{', '}'],\n\ttemplate: `<div class=\"autosuggest-container\">\n\t\t<vue-autosuggest\n\t\t\t:suggestions=\"filteredOptions\"\n\t\t\t:get-suggestion-value=\"getSuggestionValue\"\n\t\t\t:input-props=\"inputProps\"\n\t\t\t:limit=\"limit\"\n\t\t\t@selected=\"onSelected\"\n\t\t\t@focus=\"updateFilteredOptions\"\n\t\t\t@blur=\"onBlur\"\n\t\t\t@input=\"onInputChange\"\n\t\t\tv-model=\"inputProps.initialValue\"\n\t\t>\n\t\t\t<template slot-scope=\"{suggestion}\">\n\t\t\t\t%{suggestion.item.name || suggestion.item}\n\t\t\t\t<span v-if=\"suggestion.item.hint\" class=\"light\">– %{suggestion.item.hint}</span>\n\t\t\t</template>\n\t\t</vue-autosuggest>\n\t</div>`,\n\tdata () {\n\t\treturn {\n\t\t\tquery: '',\n\t\t\tselected: '',\n\t\t\tfilteredOptions: [],\n\t\t\tsuggestions: window.__mapsCraftAutosuggestSuggestions || [],\n\t\t\tlimit: 5,\n\t\t\tinputProps: {\n\t\t\t\tinitialValue: this.value,\n\t\t\t\tname: this.name,\n\t\t\t},\n\t\t};\n\t},\n\tmethods: {\n\t\tonInputChange(q) {\n\t\t\tthis.query = (q || '').toLowerCase();\n\t\t\tthis.updateFilteredOptions();\n\t\t},\n\t\tupdateFilteredOptions() {\n\t\t\tif (this.query === '') {\n\t\t\t\tthis.filteredOptions = this.suggestions;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar filtered = [];\n\t\t\tvar i, j, sectionFilter, item, name;\n\t\t\tvar that = this;\n\n\t\t\tfor (i = 0; i < this.suggestions.length; i++) {\n\t\t\t\tsectionFilter = [];\n\t\t\t\tfor (j = 0; j < this.suggestions[i].data.length; j++) {\n\t\t\t\t\titem = this.suggestions[i].data[j];\n\t\t\t\t\tif (\n\t\t\t\t\t\t(item.name || item).toLowerCase().indexOf(this.query) !== -1 ||\n\t\t\t\t\t\t(item.hint && item.hint.toLowerCase().indexOf(this.query) !== -1)\n\t\t\t\t\t) {\n\t\t\t\t\t\tsectionFilter.push(item.name ? item : {name: item});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (sectionFilter.length) {\n\t\t\t\t\tsectionFilter.sort(function(a, b) {\n\t\t\t\t\t\tvar scoreA = that.scoreItem(a, this.query);\n\t\t\t\t\t\tvar scoreB = that.scoreItem(b, this.query);\n\t\t\t\t\t\tif (scoreA === scoreB) {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn scoreA < scoreB ? 1 : -1;\n\t\t\t\t\t});\n\t\t\t\t\tfiltered.push({\n\t\t\t\t\t\tlabel: this.suggestions[i].label || null,\n\t\t\t\t\t\tdata: sectionFilter.slice(0, this.limit)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.filteredOptions = filtered;\n\t\t},\n\t\tscoreItem(item) {\n\t\t\tvar score = 0;\n\t\t\tif (item.name.toLowerCase().indexOf(this.query) !== -1) {\n\t\t\t\tscore += 100 + this.query.length / item.name.length;\n\t\t\t}\n\t\t\tif (item.hint && item.hint.toLowerCase().indexOf(this.query) !== -1) {\n\t\t\t\tscore += this.query.length / item.hint.length;\n\t\t\t}\n\t\t\treturn score;\n\t\t},\n\t\tonSelected(option) {\n\t\t\tif (!option) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.selected = option.item;\n\n\t\t\t// Bring focus back to the input if they selected an alias\n\t\t\tif (option.item.name[0] == '@') {\n\t\t\t\tvar input = this.$el.querySelector('input');\n\t\t\t\tinput.focus();\n\t\t\t\tinput.selectionStart = input.selectionEnd = input.value.length;\n\t\t\t}\n\t\t},\n\t\tgetSuggestionValue(suggestion) {\n\t\t\treturn suggestion.item.name || suggestion.item;\n\t\t},\n\t\tonBlur(e) {\n\t\t\t// Clear out the autosuggestions if the focus has shifted to a new element\n\t\t\tif (e.relatedTarget) {\n\t\t\t\tthis.filteredOptions = [];\n\t\t\t}\n\t\t},\n\t},\n};\n\nconst ImageFadeOnLoad = {\n\tprops: ['src', 'srcset', 'alt', 'show'],\n\ttemplate: `<transition name=\"fade\">\n\t\t<img\n\t\t\t:src=\"src\"\n\t\t\t:srcset=\"srcset\"\n\t\t\t:alt=\"alt\"\n\t\t\tloading=\"lazy\"\n\t\t\t@load=\"onLoaded\"\n\t\t\tv-show=\"loaded && show\"\n\t\t/>\n\t</transition>`,\n\tdata () {\n\t\treturn { loaded: false };\n\t},\n\tmethods: {\n\t\tonLoaded () {\n\t\t\tthis.loaded = true;\n\t\t},\n\t},\n};\n\nnew Vue({\n\tel: '#content',\n\tcomponents: {\n\t\t'craft-autosuggest': CraftAutosuggest,\n\t\t'image-fade-on-load': ImageFadeOnLoad,\n\t},\n\tdata () {\n\t\treturn window.__mapsData;\n\t},\n\tcomputed: {\n\t\trequiresMapToken () {\n\t\t\treturn !(\n\t\t\t\tthis.mapTiles.indexOf('wikimedia') > -1 ||\n\t\t\t\tthis.mapTiles.indexOf('openstreetmap') > -1 ||\n\t\t\t\tthis.mapTiles.indexOf('carto') > -1\n\t\t\t);\n\t\t},\n\t\tmapTilesSimple () {\n\t\t\treturn (\n\t\t\t\tthis.mapTiles.indexOf('mapkit') === -1 &&\n\t\t\t\tthis.mapTiles.indexOf('here') === -1\n\t\t\t);\n\t\t},\n\t\trequiresGeoToken () {\n\t\t\treturn !(\n\t\t\t\tthis.geoService.indexOf('nominatim') > -1\n\t\t\t);\n\t\t},\n\t\tgeoServiceSimple () {\n\t\t\treturn (\n\t\t\t\tthis.geoService.indexOf('mapkit') === -1 &&\n\t\t\t\tthis.geoService.indexOf('here') === -1\n\t\t\t);\n\t\t},\n\t\trequiresGeoLocationToken () {\n\t\t\treturn (\n\t\t\t\tthis.geoLocationService !== 'none' &&\n\t\t\t\tthis.geoLocationService.indexOf('lite') === -1\n\t\t\t);\n\t\t},\n\t\tgeoLocationSimple () {\n\t\t\treturn (\n\t\t\t\tthis.geoLocationService.indexOf('maxmind') === -1\n\t\t\t);\n\t\t},\n\t\trequiresW3WToken () {\n\t\t\treturn this.w3wEnabled;\n\t\t},\n\t}\n});\n{% endjs %}\n\n{% css %}\n:root {\n\t--x-pad: 30px;\n\t--y-pad: 30px;\n}\n\n@media only screen and (max-width: 767px) {\n\t:root {\n\t\t--x-pad: 12px;\n\t}\n}\n\nhr {\n\tdisplay: block;\n\twidth: 100%;\n\tmargin: 0 50px 30px;\n\tmargin: 0 50px var(--y-pad, 30px);\n\tborder-top: 1px solid #D2DBE1;\n\topacity: 0.5;\n}\n\n[v-cloak] {\n\tdisplay: none;\n}\n\n.fade-enter-active, .fade-leave-active {\n\ttransition: opacity .5s;\n}\n.fade-enter, .fade-leave-to {\n\topacity: 0;\n}\n\n#content {\n\tpadding: 0 !important;\n\tbackground-color: #EEF5FA !important;\n\tborder: none !important;\n}\n\n.maps-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\theight: 90px;\n\tpadding: 0 30px;\n\tpadding: 0 var(--x-pad, 30px);\n}\n\n.maps-header h1 {\n\tdisplay: flex;\n\talign-items: center;\n\tfont-size: 0;\n\tmargin-bottom: 0;\n}\n.maps-header svg {\n\tposition: relative;\n\twidth: 30px;\n\theight: 30px;\n\tvertical-align: bottom;\n\tmargin-right: 10px;\n}\n.maps-header span {\n\tfont-size: 32px;\n\tfont-weight: 200;\n}\n.maps-header button {\n\tdisplay: inline-block;\n\tpadding: 10px 22px;\n\n\tcolor: #fff;\n\tfont-size: 14px;\n\tletter-spacing: 0;\n\tfont-weight: 500;\n\n\tappearance: none;\n\t-moz-appearance: none;\n\t-webkit-appearance: none;\n\tbackground-color: #EF2F30;\n\tborder: none;\n\tborder-radius: 5px;\n\tbox-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.20);\n\tcursor: pointer;\n\n\ttransition:\n\t\tbackground-color 0.1s ease,\n\t\tbox-shadow 0.1s ease,\n\t\ttransform 0.1s ease;\n}\n.maps-header button:hover {\n\tbackground-color: #C82C2D;\n}\n.maps-header button:active {\n\tbox-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.20);\n\ttransform: translateY(1px);\n}\n\n.maps-card {\n\tbackground-color: #fff;\n\tbox-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.10);\n\tborder-radius: 5px;\n}\n.maps-card h2 {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin-bottom: 0;\n\tpadding: 25px 30px;\n\n\tcolor: #29323D;\n\tfont-size: 20px;\n\tfont-weight: normal;\n\tletter-spacing: 0;\n\n\tborder-bottom: 1px solid #D2DBE1;\n}\n\n.maps-pro {\n\tdisplay: inline-block;\n\tpadding: 5px 10px 5px 12px;\n\n\tcolor: #F22C26;\n\tfont-size: 12px;\n\tfont-weight: 800;\n\tletter-spacing: 1px;\n\tline-height: normal;\n\ttext-transform: uppercase;\n\ttext-align: center;\n\n\tbackground-color: rgba(242, 44, 38, 0.20);\n\tborder-radius: 18px;\n}\n.maps-card.disabled {\n\topacity: 1;\n}\n.maps-card.disabled .maps-label {\n\topacity: 0.25;\n\tpointer-events: none;\n}\n\n.maps-map {\n\tposition: relative;\n\tz-index: 2;\n\tpadding: 30px;\n\tpadding: var(--y-pad, 30px) var(--x-pad, 30px);\n\tmin-height: 561px;\n\tbackground-color: #e4edf6;\n}\n@media only screen and (max-width: 767px) {\n\t.maps-map {\n\t\tpadding: 30px 30px 250px;\n\t\tpadding: var(--y-pad, 30px) var(--x-pad, 30px) 250px;\n\t}\n}\n.maps-map img {\n\tposition: absolute;\n\tz-index: -2;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n}\n.maps-map .maps-card {\n\tmax-width: 538px;\n}\n.maps-map .maps-card:not(:last-child) {\n\tmargin-bottom: 10px;\n}\n\n.maps-style {\n\tposition: relative;\n\tdisplay: block;\n}\n.maps-style:before,\n.maps-style:after {\n\tposition: absolute;\n\ttop: 50%;\n\tright: 21px;\n\tcontent: '';\n\tborder: 4px solid transparent;\n\tborder-top: none;\n\tborder-bottom: 7px solid #29323D;\n\topacity: 0.5;\n\tpointer-events: none;\n}\n.maps-style:before {\n\ttransform: translateY(-10px);\n}\n.maps-style:after {\n\ttransform: translateY(6px) rotate(180deg);\n}\n.maps-style span {\n\tposition: absolute;\n\ttop: 14px;\n\tleft: 20px;\n\n\tcolor: #29323D;\n\tfont-size: 13px;\n\tletter-spacing: 0;\n\n\tpointer-events: none;\n\topacity: 0.4;\n}\n.maps-style select {\n\twidth: 100%;\n\theight: 80px;\n\tpadding: 32px 40px 13px 20px;\n\tfont-size: 24px;\n\n\tappearance: none;\n\t-moz-appearance: none;\n\t-webkit-appearance: none;\n\tbackground: none;\n\tborder: none;\n}\n\n.maps-label {\n\tdisplay: block;\n\tpadding: 20px;\n\tline-height: normal;\n}\n.maps-label:not(:last-child) {\n\tborder-bottom: 1px solid #D2DBE1;\n}\n.maps-label strong {\n\tdisplay: block;\n\tmargin-bottom: 2px;\n\n\tcolor: #29323D;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tletter-spacing: 0;\n\topacity: 0.7;\n}\n.maps-label span {\n\tdisplay: block;\n\n\tcolor: #29323D;\n\tfont-size: 12px;\n\tfont-weight: 300;\n\tletter-spacing: 0;\n\topacity: 0.4;\n}\n.maps-label input,\n.maps-label textarea,\n.maps-label select {\n\twidth: calc(100% + 40px);\n\tmargin: 7px -20px 0;\n\n\tcolor: #29323D;\n\tfont-size: 16px;\n\tletter-spacing: 0;\n\ttext-indent: 20px;\n\n\tappearance: none;\n\t-moz-appearance: none;\n\t-webkit-appearance: none;\n\tbackground: none;\n\tborder: none;\n\tresize: none;\n}\n.maps-label textarea,\n.maps-label select {\n\tpadding: 0 20px;\n\ttext-indent: 0;\n}\n.maps-label textarea {\n\twidth: 100%;\n}\n\n.maps-select {\n\tposition: relative;\n\tdisplay: block;\n}\n.maps-select:before,\n.maps-select:after {\n\tposition: absolute;\n\ttop: 50%;\n\tright: 0;\n\tcontent: '';\n\tborder: 3px solid transparent;\n\tborder-top: none;\n\tborder-bottom: 5px solid #29323D;\n\topacity: 0.5;\n\tpointer-events: none;\n}\n.maps-select:before {\n\ttransform: translateY(-4px);\n}\n.maps-select:after {\n\ttransform: translateY(6px) rotate(180deg);\n}\n\n.maps-settings {\n\tposition: relative;\n\tz-index: 3;\n\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-start;\n\twidth: 750px;\n\tmargin: -65px auto 0;\n\n\tpadding: 30px;\n\tpadding: var(--y-pad, 30px) var(--x-pad, 30px);\n}\n\n.maps-settings .maps-card {\n\twidth: 100%;\n\tmargin-bottom: 30px;\n}\n\n.maps-help {\n\tbackground-color: rgba(210, 219, 225, 0.2);\n\tborder: 1px solid #D2DBE1;\n\tbox-shadow: none;\n}\n.maps-help a {\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 12px 30px;\n\n\tcolor: #29323D;\n\tfont-size: 12px;\n\tline-height: 1.5em;\n\n\topacity: 0.5;\n\ttransition: opacity 0.15s ease;\n}\n.maps-help a:hover,\n.maps-help a.active {\n\ttext-decoration: none;\n\topacity: 1;\n}\n.maps-help a em {\n\tdisplay: block;\n\tmargin-bottom: 5px;\n\n\tfont-size: 16px;\n\tfont-weight: 500;\n\tfont-style: normal;\n}\n.maps-help h2 + a {\n\tpadding-top: 25px;\n}\n.maps-help a:last-child {\n\tpadding-bottom: 24px;\n}\n.maps-help svg {\n\twidth: 30px;\n\theight: 30px;\n\tmargin-right: 20px;\n}\n.maps-help span {\n\tflex-shrink: 9999;\n}\n{% endcss %}\n"
  },
  {
    "path": "src/translations/en/simplemap.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nreturn [\n\n\t// Field\n\t// =========================================================================\n\n\t'Map' => 'Map',\n\t'Geo-Coding' => 'Geo-Coding',\n\n\t'Search for a location' => 'Search for a location',\n\t'Clear address' => 'Clear address',\n\t'No address selected' => 'No address selected',\n\n\t'Full Address' => 'Full Address',\n\t'Name / Number' => 'Name / Number',\n\t'Street Address' => 'Street Address',\n\t'Town / City' => 'Town / City',\n\t'Postcode' => 'Postcode',\n\t'County' => 'County',\n\t'State' => 'State',\n\t'Country' => 'Country',\n\n\t'Latitude' => 'Latitude',\n\t'Longitude' => 'Longitude',\n\n\t'Zoom In' => 'Zoom In',\n\t'Zoom Out' => 'Zoom Out',\n\t'Center on Marker' => 'Center on Marker',\n\t'Current Location' => 'Current Location',\n\n\t// Field: Settings\n\t// -------------------------------------------------------------------------\n\n\t'Initial Location' => 'Initial Location',\n\t'The initial location and zoom that will show in the map field' =>\n\t\t'The initial location and zoom that will show in the map field',\n\n\t'Hide Search' => 'Hide Search',\n\t'Hide the location search field' => 'Hide the location search field',\n\n\t'Hide Map' => 'Hide Map',\n\t'Hide the map' => 'Hide the map',\n\n\t'Hide Address' => 'Hide Address',\n\t'Hide the address fields' => 'Hide the address fields',\n\n\t'Show Latitude / Longitude' => 'Show Latitude / Longitude',\n\t'Show the latitude / longitude fields' => 'Show the latitude / longitude fields',\n\n\t'Show Current Location' => 'Show Current Location',\n\t'Show a button to centre the map on the users current location' =>\n\t\t'Show a button to centre the map on the users current location',\n\n\t'Field Size' => 'Field Size',\n\t'Choose the size of the field to display' => 'Choose the size of the field to display',\n\t'Normal' => 'Normal',\n\t'Mini' => 'Mini',\n\n\t'All Countries' => 'All Countries',\n\t'Preferred Country' => 'Preferred Country',\n\t'When searching for a location, results in this country will take precedence. Be aware that some services will show results ONLY within this country.' =>\n\t\t'When searching for a location, results in this country will take precedence. Be aware that some services will show results ONLY within this country.',\n\n\t'Enable what3words grid' => 'Enable what3words grid',\n\t'Will enable the what3words grid overlay when zoomed in above 17' => 'Will enable the what3words grid overlay when zoomed in above 17',\n\n\t'Show what3words field' => 'Show what3words field',\n\t'Show the what3words field for the selected location' => 'Show the what3words field for the selected location',\n\n\t// Settings\n\t// =========================================================================\n\n\t'Select your map style' => 'Select your map style',\n\t'Map Tiles' => 'Map Tiles',\n\t'Select the style of map tiles.' => 'Select the style of map tiles.',\n\n\t'Map Token' => 'Map Token',\n\t'Add the API key for map tiles service you are using.' =>\n\t\t'Add the API key for map tiles service you are using.',\n\n\t'Geo Service' => 'Geo Service',\n\t'Select the service to be used for Geocoding.' =>\n\t\t'Select the service to be used for Geocoding.',\n\n\t'Geo Token' => 'Geo Token',\n\t'Add the API key for the geocoding service.' =>\n\t\t'Add the API key for the geocoding service.',\n\n\t'Private Key' => 'Private Key',\n\t'Paste the contents of your private key files below (supports env variables).' => 'Paste the contents of your private key files below (supports env variables).',\n\n\t'Key ID' => 'Key ID',\n\t'The ID of the key associated with your private key.' => 'The ID of the key associated with your private key.',\n\n\t'Team ID' => 'Team ID',\n\t'The team ID that created the key ID and private key.' => 'The team ID that created the key ID and private key.',\n\n\t'Notice' => 'Notice',\n\t'MapKit does not support individual address parts.' => 'MapKit does not support individual address parts.',\n\n\t'App ID' => 'App ID',\n\t'Your Here app ID.' => 'Your Here app ID.',\n\n\t'App Code' => 'App Code',\n\t'Your Here app code.' => 'Your Here app code.',\n\n\t'API Key' => 'API Key',\n\t'Your Here API Key (only required for front-end embed maps).' => 'Your Here API Key (only required for front-end embed maps).',\n\n\t'Geolocation Service' => 'Geolocation Service',\n\t'Select the service to be used for Geolocating users.' => 'Select the service to be used for Geolocating users.',\n\n\t'Geolocation Token' => 'Geolocation Token',\n\t'Add the API key for the geolocation service.' => 'Add the API key for the geolocation service.',\n\n\t'Account ID' => 'Account ID',\n\t'Your MaxMind account ID.' => 'Your MaxMind account ID.',\n\n\t'License Key' => 'License Key',\n\t'Your MaxMind license key.' => 'Your MaxMind license key.',\n\n\t'what3words' => 'what3words',\n\t'Enable what3words Integration' => 'Enable what3words Integration',\n\t'what3words Token' => 'what3words Token',\n\t'Your what3words API key.' => 'Your what3words API key.',\n\n\t'Getting a what3words API Key' => 'Getting a what3words API Key',\n\t'what3words offer a free public API key.' => 'what3words offer a free public API key.',\n\n\t// Settings: Map Tiles Options\n\t// -------------------------------------------------------------------------\n\n\t'Open Source' => 'Open Source',\n\n\t'Wikimedia' => 'Wikimedia',\n\n\t'OpenStreetMap' => 'OpenStreetMap',\n\n\t'Carto: Voyager' => 'Carto: Voyager',\n\t'Carto: Positron' => 'Carto: Positron',\n\t'Carto: Dark Matter' => 'Carto: Dark Matter',\n\n\t'Requires API Key (Token)' => 'Requires API Key (Token)',\n\n\t'Mapbox: Outdoors' => 'Mapbox: Outdoors',\n\t'Mapbox: Streets' => 'Mapbox: Streets',\n\t'Mapbox: Light' => 'Mapbox: Light',\n\t'Mapbox: Dark' => 'Mapbox: Dark',\n\n\t'Google Maps: Roadmap' => 'Google Maps: Roadmap',\n\t'Google Maps: Terrain' => 'Google Maps: Terrain',\n\t'Google Maps: Hybrid' => 'Google Maps: Hybrid',\n\n\t'Apple MapKit: Standard' => 'Apple MapKit: Standard',\n\t'Apple MapKit: Muted Standard' => 'Apple MapKit: Muted Standard',\n\t'Apple MapKit: Satellite' => 'Apple MapKit: Satellite',\n\t'Apple MapKit: Hybrid' => 'Apple MapKit: Hybrid',\n\n\t'Here: Normal Day' => 'Here: Normal Day',\n\t'Here: Normal Day Grey' => 'Here: Normal Day Grey',\n\t'Here: Normal Day Transit' => 'Here: Normal Day Transit',\n\t'Here: Reduced' => 'Here: Reduced',\n\t'Here: Pedestrian' => 'Here: Pedestrian',\n\t'Here: Terrain' => 'Here: Terrain',\n\t'Here: Satellite' => 'Here: Satellite',\n\t'Here: Hybrid' => 'Here: Hybrid',\n\n\t// Settings: Geo Service Options\n\t// -------------------------------------------------------------------------\n\n\t'Nominatim' => 'Nominatim',\n\t'Mapbox' => 'Mapbox',\n\t'Google Maps' => 'Google Maps',\n\t'Apple MapKit' => 'Apple MapKit',\n\t'Here' => 'Here',\n\n\t// Settings: Geo Location Services\n\t// -------------------------------------------------------------------------\n\n\t'None' => 'None',\n\t'ipstack' => 'ipstack',\n\t'MaxMind (Lite, ~60MB download)' => 'MaxMind (Lite, ~60MB download)',\n\t'MaxMind' => 'MaxMind',\n\n\t// Settings: Info\n\t// -------------------------------------------------------------------------\n\n\t'Getting API Keys' => 'Getting API Keys',\n\t'You will need to enable the **Maps JavaScript API** and **Places API** for if using Google for the map tiles, and the **Places API** and **Geocoding API** if you are using it for the Geo service.' =>\n\t\t'You will need to enable the **Maps JavaScript API** and **Places API** for if using Google for the map tiles, and the **Places API** and **Geocoding API** if you are using it for the Geo service.',\n\t'You can use the same key for both map tiles and geo service, no configuration needed!' =>\n\t\t'You can use the same key for both map tiles and geo service, no configuration needed!',\n\t'We currently only support Apple MapKit for map tiles only.' =>\n\t\t'We currently only support Apple MapKit for map tiles only.',\n\n\t'Getting Geolocation API Keys' => 'Getting Geolocation API Keys',\n\t'ipstack offer free and paid-for versions of their API.' => 'ipstack offer free and paid-for versions of their API.',\n\t'MaxMind offer free lookup database that must be stored locally, and a paid-for version of their API.' =>\n\t\t'MaxMind offer free lookup database that must be stored locally, and a paid-for version of their API.',\n\n];\n"
  },
  {
    "path": "src/utilities/StaticMap.php",
    "content": "<?php\n/**\n * Maps for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\utilities;\n\nuse Craft;\nuse craft\\helpers\\Json;\nuse craft\\web\\Response;\nuse ether\\simplemap\\enums\\MapTiles;\nuse ether\\simplemap\\models\\Marker;\nuse ether\\simplemap\\models\\Point;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse Imagine\\Image\\Box;\nuse Imagine\\Image\\FontInterface;\nuse Imagine\\Image\\ImageInterface;\nuse Imagine\\Image\\Palette\\Color\\ColorInterface;\nuse Imagine\\Image\\Palette\\RGB;\nuse Imagine\\Image\\Point\\Center;\nuse Imagine\\Imagick\\Imagick;\nuse Psr\\Http\\Message\\StreamInterface;\n\n/**\n * Class StaticMap\n *\n * Based off https://github.com/dfacts/staticmaplite/blob/master/staticmap.php\n *\n * TODO: Support external volumes (i.e. S3, Spaces)\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\utilities\n */\nclass StaticMap\n{\n\n\t// Properties\n\t// =========================================================================\n\n\tconst TILE_CACHE_DIR = '@runtime/maps/tiles';\n\tconst MAP_CACHE_DIR  = '@runtime/maps/maps';\n\n\tprivate float  $lat;\n\tprivate float  $lng;\n\tprivate int    $width;\n\tprivate int    $height;\n\tprivate int    $zoom;\n\tprivate int    $scale;\n\tprivate mixed  $tiles;\n\tprivate mixed  $tileSize;\n\tprivate string $mapTiles;\n\tprivate        $centerX, $centerY, $offsetX, $offsetY;\n\tprivate array  $markers;\n\n\t/**\n\t * @var ImageInterface\n\t */\n\tprivate ImageInterface $image;\n\n\t// Constructor\n\t// =========================================================================\n\n\t/**\n\t * StaticMap constructor.\n\t *\n\t * @param float       $lat\n\t * @param float       $lng\n\t * @param int         $width\n\t * @param int         $height\n\t * @param int         $zoom\n\t * @param int         $scale\n\t * @param string|null $markers\n\t *\n\t * @throws Exception\n\t */\n\tpublic function __construct (\n\t\tfloat $lat = 51.272154,\n\t\tfloat $lng = 0.514951,\n\t\tint   $width = 640,\n\t\tint   $height = 480,\n\t\tint   $zoom = 15,\n\t\tint   $scale = 1,\n\t\tstring $markers = null\n\t) {\n\t\t$this->lat    = $lat;\n\t\t$this->lng    = $lng;\n\t\t$this->width  = $width;\n\t\t$this->height = $height;\n\t\t$this->zoom   = $zoom;\n\t\t$this->scale  = $scale;\n\n\t\tif (empty($markers)) $this->markers = [];\n\t\telse\n\t\t{\n\t\t\t$this->markers = array_map(function ($m) {\n\t\t\t\t$m = explode('|', $m);\n\n\t\t\t\treturn new Marker([\n\t\t\t\t\t'location' => Json::decode($m[0]),\n\t\t\t\t\t'color' => $m[1],\n\t\t\t\t\t'label' => $m[2],\n\t\t\t\t]);\n\t\t\t}, explode(';', urldecode($markers)));\n\t\t}\n\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\t\t$tiles = MapTiles::getTiles($settings->mapTiles, $scale);\n\t\t$this->tiles = $tiles['url'];\n\t\t$this->tileSize = $tiles['size'];\n\t\t$this->mapTiles = $settings->mapTiles;\n\t}\n\n\t// Public Methods\n\t// =========================================================================\n\n\tpublic function render ()\n\t{\n\t\t$filename = $this->_mapCacheIdToFilename();\n\n\t\tif ($this->_checkMapCache())\n\t\t\treturn $this->_send(file_get_contents($filename));\n\n\t\t$this->_initCoords();\n\t\t$this->_createBaseMap();\n\t\t$this->_placeMarkers();\n\n\t\tself::_mkdirRecursive(dirname($filename), 0777);\n\t\t$this->image->save($filename);\n\n\t\tif (file_exists($filename))\n\t\t\treturn $this->_send(file_get_contents($filename));\n\n\t\treturn $this->_send($this->image->show('png'));\n\t}\n\n\t// Private Methods\n\t// =========================================================================\n\n\tprivate function _initCoords (): void\n\t{\n\t\t$this->centerX = $this->_lngToTile($this->lng);\n\t\t$this->centerY = $this->_latToTile($this->lat);\n\t}\n\n\tprivate function _createBaseMap (): void\n\t{\n\t\t$imagine = $this->_getImagine();\n\t\t$palette = new RGB();\n\n\t\t$w = $this->width * $this->scale;\n\t\t$h = $this->height * $this->scale;\n\t\t$_ts = $this->tileSize * $this->scale;\n\n\t\t$this->image = $imagine->create(new Box($w, $h));\n\n\t\t$startX = floor($this->centerX - ($w / $_ts) / 2);\n\t\t$startY = floor($this->centerY - ($h / $_ts) / 2);\n\n\t\t$endX = ceil($this->centerX + ($w / $_ts) / 2);\n\t\t$endY = ceil($this->centerY + ($h / $_ts) / 2);\n\n\t\t$this->offsetX = -floor(($this->centerX - floor($this->centerX)) * $_ts);\n\t\t$this->offsetY = -floor(($this->centerY - floor($this->centerY)) * $_ts);\n\n\t\t$this->offsetX += floor($w / 2);\n\t\t$this->offsetY += floor($h / 2);\n\n\t\t$this->offsetX += floor($startX - floor($this->centerX)) * $_ts;\n\t\t$this->offsetY += floor($startY - floor($this->centerY)) * $_ts;\n\n\t\tfor ($x = $startX; $x <= $endX; $x++)\n\t\t{\n\t\t\tfor ($y = $startY; $y <= $endY; $y++)\n\t\t\t{\n\t\t\t\t$url = str_replace(\n\t\t\t\t\t['{z}', '{x}', '{y}'],\n\t\t\t\t\t[$this->zoom, $x, $y],\n\t\t\t\t\t$this->tiles\n\t\t\t\t);\n\n\t\t\t\t$tileData = $this->_fetchTile($url);\n\n\t\t\t\tif ($tileData) {\n\t\t\t\t\t$tileImg = $imagine->load($tileData);\n\t\t\t\t} else {\n\t\t\t\t\t$tileImg = $imagine->create(new Box($_ts, $_ts));\n\t\t\t\t\t$tileImg->draw()->text(\n\t\t\t\t\t\t'err',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tnew Point($_ts / 2, $_ts / 2),\n\t\t\t\t\t\t$palette->color('#fff', 100)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t$destX = ($x - $startX) * $_ts + $this->offsetX;\n\t\t\t\t$destY = ($y - $startY) * $_ts + $this->offsetY;\n\n\t\t\t\t$this->image->paste(\n\t\t\t\t\t$tileImg,\n\t\t\t\t\tnew Point($destX, $destY)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function _placeMarkers (): void\n\t{\n\t\t$w   = $this->width * $this->scale;\n\t\t$h   = $this->height * $this->scale;\n\t\t$_ts = $this->tileSize * $this->scale;\n\n\t\t/** @var Marker $marker */\n\t\tforeach ($this->markers as $marker)\n\t\t{\n\t\t\t$img = $this->_renderMarker(\n\t\t\t\t$marker->color,\n\t\t\t\t$marker->label\n\t\t\t);\n\n\t\t\t$pos = explode(',', $marker->getLocation(true));\n\n\t\t\t$x = floor(($w / 2) - $_ts * ($this->centerX - $this->_lngToTile($pos[1])));\n\t\t\t$y = floor(($h / 2) - $_ts * ($this->centerY - $this->_latToTile($pos[0])));\n\n\t\t\t$x -= $img->getSize()->getWidth() / 2;\n\t\t\t$y -= $img->getSize()->getHeight();\n\n\t\t\t$this->image->paste(\n\t\t\t\t$img,\n\t\t\t\tnew Point($x, $y)\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate function _send ($file)\n\t{\n\t\t$response = Craft::$app->getResponse();\n\t\t$response->format = Response::FORMAT_RAW;\n\n\t\t$expires = 60 * 60 * 24 * 14;\n\t\t$headers = $response->getHeaders();\n\t\t$headers->set('content-type', 'image/png');\n\t\t$headers->set('cache-control', 'maxage=' . $expires);\n\t\t$headers->set('expires', gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');\n\n\t\treturn $file;\n\t}\n\n\t// Helpers\n\t// =========================================================================\n\n\tpublic static function getLabelColour ($color): string\n\t{\n\t\t$r = hexdec($color[1] . $color[2]);\n\t\t$g = hexdec($color[3] . $color[4]);\n\t\t$b = hexdec($color[5] . $color[6]);\n\n\t\treturn (($r * 299 + $g * 587 + $b * 114) / 1000 > 130) ? '000' : 'fff';\n\t}\n\n\tprivate static function _join (): string\n\t{\n\t\t$paths = func_get_args();\n\t\t$paths = array_map(function ($p) {\n\t\t\treturn rtrim($p, '/');\n\t\t}, $paths);\n\t\t$paths = array_filter($paths);\n\n\t\treturn join('/', $paths);\n\t}\n\n\tprivate static function _mkdirRecursive ($pathname, $mode): bool\n\t{\n\t\tis_dir(dirname($pathname)) || self::_mkdirRecursive(dirname($pathname), $mode);\n\t\treturn is_dir($pathname) || mkdir($pathname, $mode);\n\t}\n\n\t// Imagine\n\t// -------------------------------------------------------------------------\n\n\tprivate function _getImageDriver ()\n\t{\n\t\tstatic $driver;\n\n\t\tif ($driver)\n\t\t\treturn $driver;\n\n\t\t$generalConfig = Craft::$app->getConfig()->getGeneral();\n\t\t$extension     = strtolower($generalConfig->imageDriver);\n\n\t\tif ($extension === 'gd' || Craft::$app->getImages()->getIsGd())\n\t\t\t$driver = 'gd';\n\t\telse\n\t\t\t$driver = 'imagick';\n\n\t\treturn $driver;\n\t}\n\n\tprivate function _getImagine ()\n\t{\n\t\tstatic $imagine;\n\n\t\tif ($imagine)\n\t\t\treturn $imagine;\n\n\t\tif ($this->_getImageDriver() === 'gd') {\n\t\t\t$imagine = new \\Imagine\\Gd\\Imagine();\n\t\t} else {\n\t\t\t$imagine = new \\Imagine\\Imagick\\Imagine();\n\t\t}\n\n\t\treturn $imagine;\n\t}\n\n\tprivate function _getFont (ColorInterface $colour, $size = 10): \\Imagine\\Imagick\\Font|FontInterface|\\Imagine\\Gd\\Font\n\t{\n\t\t$key = ((string) $colour) . '-' . $size;\n\n\t\t/** @var FontInterface[] $fonts */\n\t\tstatic $fonts = [];\n\n\t\tif (array_key_exists($key, $fonts))\n\t\t\treturn $fonts[$key];\n\n\t\t$file = Craft::getAlias('@simplemap/resources/OpenSans-Bold.ttf');\n\n\t\tif ($this->_getImageDriver() === 'gd')\n\t\t\t$fonts[$key] = new \\Imagine\\Gd\\Font($file, $size, $colour);\n\t\telse\n\t\t\t$fonts[$key] = new \\Imagine\\Imagick\\Font(new Imagick(), $file, $size, $colour);\n\n\t\treturn $fonts[$key];\n\t}\n\n\tprivate function _renderMarker ($colour, $label = null): ImageInterface\n\t{\n\t\t$resizeMultiplier = 0.1 * $this->scale;\n\t\t$fontSize = 12 * $this->scale;\n\t\t$fontOffset = 4 * $this->scale;\n\n\t\t$svg = $label === null ? 'markerNoLabel.png' : 'marker.png';\n\n\t\t$img = $this->_getImagine()->open(\n\t\t\tCraft::getAlias('@simplemap/resources/' . $svg)\n\t\t);\n\t\t$img->resize(new Box(\n\t\t\t$img->getSize()->getWidth() * $resizeMultiplier,\n\t\t\t$img->getSize()->getHeight() * $resizeMultiplier\n\t\t), ImageInterface::FILTER_MITCHELL);\n\t\t$img->effects()->colorize($img->palette()->color($colour));\n\n\t\tif ($label !== null)\n\t\t{\n\t\t\t$textColour = $img->palette()->color(self::getLabelColour($colour));\n\t\t\t$imgCenter = new Center($img->getSize());\n\t\t\t$font = $this->_getFont($textColour, $fontSize);\n\t\t\t$textCenter = new Center($font->box($label));\n\n\t\t\t$img->draw()->text(\n\t\t\t\t$label,\n\t\t\t\t$font,\n\t\t\t\tnew Point(\n\t\t\t\t\t$imgCenter->getX() - $textCenter->getX(),\n\t\t\t\t\t$fontOffset\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn $img;\n\t}\n\n\t// Tiles\n\t// -------------------------------------------------------------------------\n\n\tprivate function _latToTile ($lat): float|int\n\t{\n\t\treturn (1 - log(tan($lat * pi() / 180) + 1 / cos($lat * pi() / 180)) / pi()) / 2 * pow(2, $this->zoom);\n\t}\n\n\tprivate function _lngToTile ($lng): float|int\n\t{\n\t\treturn (($lng + 180) / 360) * pow(2, $this->zoom);\n\t}\n\n\t/**\n\t * @throws GuzzleException\n\t */\n\tprivate function _fetchTile ($url): StreamInterface|string\n\t{\n\t\tif ($cached = $this->_checkTileCache($url))\n\t\t\treturn $cached;\n\n\t\t$client = new Client();\n\t\t$res = $client->get($url);\n\t\t$tile = $res->getBody();\n\t\t$this->_writeTileToCache($url, $tile);\n\n\t\treturn $tile;\n\t}\n\n\t// Map\n\t// -------------------------------------------------------------------------\n\n\tprivate function _getMapId (): string\n\t{\n\t\treturn md5(\n\t\t\thttp_build_query([\n\t\t\t\t'lat'    => $this->lat,\n\t\t\t\t'lng'    => $this->lng,\n\t\t\t\t'width'  => $this->width,\n\t\t\t\t'height' => $this->height,\n\t\t\t\t'zoom'   => $this->zoom,\n\t\t\t\t'scale'  => $this->scale,\n\t\t\t\t'tiles'  => $this->mapTiles,\n\t\t\t\t'markers' => $this->markers,\n\t\t\t])\n\t\t);\n\t}\n\n\t// Cache\n\t// -------------------------------------------------------------------------\n\n\tprivate static function _tileCache (): bool|string\n\t{\n\t\treturn Craft::getAlias(self::TILE_CACHE_DIR);\n\t}\n\n\tprivate static function _mapCache (): bool|string\n\t{\n\t\treturn Craft::getAlias(self::MAP_CACHE_DIR);\n\t}\n\n\tprivate function _tileUrlToFilename ($url): string\n\t{\n\t\treturn self::_join(\n\t\t\tself::_tileCache(),\n\t\t\tstr_replace(['http://', 'https://'], '', $url)\n\t\t);\n\t}\n\n\tprivate function _mapCacheIdToFilename (): string\n\t{\n\t\t$id = $this->_getMapId();\n\n\t\treturn self::_join(\n\t\t\tself::_mapCache(),\n\t\t\tsubstr($id, 0, 2),\n\t\t\tsubstr($id, 2, 2),\n\t\t\tsubstr($id, 4)\n\t\t) . '.png';\n\t}\n\n\tprivate function _checkTileCache ($url): bool|string|null\n\t{\n\t\t$filename = $this->_tileUrlToFilename($url);\n\n\t\treturn file_exists($filename) ? file_get_contents($filename) : null;\n\t}\n\n\tprivate function _checkMapCache (): bool\n\t{\n\t\treturn file_exists($this->_mapCacheIdToFilename());\n\t}\n\n\tprivate function _writeTileToCache ($url, $data): void\n\t{\n\t\t$filename = $this->_tileUrlToFilename($url);\n\t\tself::_mkdirRecursive(dirname($filename), 0777);\n\t\tfile_put_contents($filename, $data);\n\t}\n\n}\n"
  },
  {
    "path": "src/web/Variable.php",
    "content": "<?php\n/**\n * Maps for Craft CMS 3\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\web;\n\nuse Craft;\nuse craft\\errors\\DeprecationException;\nuse ether\\simplemap\\models\\Settings;\nuse ether\\simplemap\\models\\UserLocation;\nuse ether\\simplemap\\services\\GeoService;\nuse ether\\simplemap\\SimpleMap;\nuse Exception;\nuse yii\\base\\InvalidConfigException;\n\n/**\n * Class Variable\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\web\n */\nclass Variable\n{\n\n\t/**\n\t * Returns the map token\n\t *\n\t * @return string\n\t */\n\tpublic function getMapToken (): string\n\t{\n\t\t/** @var Settings $settings */\n\t\t$settings = SimpleMap::getInstance()->getSettings();\n\n\t\treturn GeoService::getToken(\n\t\t\t$settings->getMapToken(),\n\t\t\t$settings->mapTiles\n\t\t);\n\t}\n\n\t/**\n\t * Returns the map token\n\t *\n\t * @deprecated as of 3.4.0\n\t * @return string\n\t * @throws DeprecationException\n\t */\n\tpublic function getApiKey (): string\n\t{\n\t\tCraft::$app->getDeprecator()->log(\n\t\t\t'Variable::getApiKey()',\n\t\t\t'ether\\simplemap\\web\\Variable::getApiKey() has been deprecated. Use `getMapToken()` instead.'\n\t\t);\n\n\t\treturn $this->getMapToken();\n\t}\n\n\t/**\n\t * Returns the current users approximate location\n\t *\n\t * @param string|null $ip - Override the lookup IP\n\t *\n\t * @return UserLocation|null\n\t * @throws Exception\n\t */\n\tpublic function getUserLocation (string $ip = null): ?UserLocation\n\t{\n\t\treturn SimpleMap::getInstance()->geolocation->lookup($ip);\n\t}\n\n\t/**\n\t * Converts the given address to lat/lng\n\t *\n\t * @param string      $address The address to search\n\t * @param string|null $country The ISO 3166-1 alpha-2 country code to\n\t *                             restrict the search to\n\t *\n\t * @return array|null\n\t */\n\tpublic function getLatLngFromAddress (string $address, string $country = null): ?array\n\t{\n\t\ttry\n\t\t{\n\t\t\treturn GeoService::latLngFromAddress($address, $country);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\tCraft::error($e->getMessage(), 'simplemap');\n\n\t\t\treturn [\n\t\t\t\t'lat' => '',\n\t\t\t\t'lng' => '',\n\t\t\t];\n\t\t}\n\t}\n\n\t/**\n\t * Will return a static map image using the given options.\n\t *\n\t * @param $options - See StaticOptions for the available options\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tpublic function getImg ($options): string\n\t{\n\t\treturn SimpleMap::getInstance()->static->generate($options);\n\t}\n\n\t/**\n\t * Will return a static map image ready for srcset\n\t *\n\t * @param $options - See StaticOptions for the available options\n\t *\n\t * @return string\n\t * @throws Exception\n\t */\n\tpublic function getImgSrcSet ($options): string\n\t{\n\t\t$x1 = $this->getImg(array_merge($options, ['scale' => 1]));\n\t\t$x2 = $this->getImg(array_merge($options, ['scale' => 2]));\n\n\t\treturn $x1 . ' 1x, ' . $x2 . ' 2x';\n\t}\n\n\t/**\n\t * Will return markup for a dynamic map embed\n\t *\n\t * @param $options - See EmbedOptions for the available options\n\t *\n\t * @return string|void\n\t * @throws InvalidConfigException\n\t */\n\tpublic function getEmbed ($options)\n\t{\n\t\treturn SimpleMap::getInstance()->embed->embed($options);\n\t}\n\n}\n"
  },
  {
    "path": "src/web/assets/MapAsset.php",
    "content": "<?php\n/**\n * SimpleMap for Craft CMS\n *\n * @link      https://ethercreative.co.uk\n * @copyright Copyright (c) 2019 Ether Creative\n */\n\nnamespace ether\\simplemap\\web\\assets;\n\nuse craft\\web\\AssetBundle;\nuse craft\\web\\assets\\cp\\CpAsset;\nuse craft\\web\\assets\\vue\\VueAsset;\n\n/**\n * Class MapAsset\n *\n * @author  Ether Creative\n * @package ether\\simplemap\\web\\assets\n */\nclass MapAsset extends AssetBundle\n{\n\n\tpublic function init ()\n\t{\n\t\t$this->sourcePath = __DIR__ . '/map';\n\n\t\t$this->depends = [\n\t\t\tCpAsset::class,\n\t\t\tVueAsset::class,\n\t\t];\n\n\t\tif (getenv('ETHER_ENVIRONMENT') === 'true')\n\t\t{\n\t\t\t$this->js = [\n\t\t\t\t'https://localhost:8080/app.js',\n\t\t\t];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->css = [\n\t\t\t\t'css/app.css',\n\t\t\t\t'css/chunk-vendors.css',\n\t\t\t];\n\n\t\t\t$this->js = [\n\t\t\t\t'js/app.js',\n\t\t\t\t'js/chunk-vendors.js',\n\t\t\t];\n\t\t}\n\n\t\tparent::init();\n\t}\n\n}\n"
  },
  {
    "path": "src/web/assets/map/css/app.css",
    "content": ".Search_wrap_rNtoB{position:relative;display:block}@media only screen and (max-width:767px){.Search_wrap_rNtoB{margin-right:44px}}.Search_wrap_rNtoB,.Search_wrap_rNtoB *{-webkit-box-sizing:border-box;box-sizing:border-box}.Search_wrap_rNtoB>svg{position:absolute;top:17px;left:16px;pointer-events:none}.Search_wrap_rNtoB.Search_no-map_1K6JR{margin-right:0}.Search_input_3tpBT{width:100%;padding:16px 0 15px 48px;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:none;border-bottom:1px solid transparent;border-radius:5px;-webkit-box-shadow:0 2px 15px 0 rgba(0,0,0,.2);box-shadow:0 2px 15px 0 rgba(0,0,0,.2)}.Search_input_3tpBT.Search_no-map_1K6JR{-webkit-box-shadow:none;box-shadow:none;border:1px solid #dce4ea}.Search_open_a4lCm .Search_input_3tpBT{border-radius:5px 5px 0 0;border-bottom-color:#d2dbe1}.Search_resultsWrap_1ufuc{position:absolute;top:100%;left:-20px;width:calc(100% + 40px);height:210px;padding:0 20px 20px;overflow:hidden;pointer-events:none}.Search_results_nREcw{position:relative;z-index:2;width:100%;padding:7px 0;background-color:#fff;-webkit-box-shadow:0 5px 15px 0 rgba(0,0,0,.1);box-shadow:0 5px 15px 0 rgba(0,0,0,.1);border-radius:0 0 5px 5px;-webkit-transform:translateY(calc(-100% - 15px));transform:translateY(calc(-100% - 15px));-webkit-transition:-webkit-transform .3s ease;transition:-webkit-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease,-webkit-transform .3s ease;pointer-events:all}.Search_open_a4lCm .Search_results_nREcw{-webkit-transform:translateY(0);transform:translateY(0)}.Search_results_nREcw li{padding:7px 14px;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.Search_results_nREcw li[class*=highlighted]{background-color:#e4edf3;cursor:pointer}.Label_label_GHq68{position:relative;display:block;border-right:1px solid #dce4ea}.Label_label_GHq68:not(:last-child){border-bottom:1px solid #dce4ea}.Label_name_3Feow{position:absolute;top:9px;left:12px;display:block;color:rgba(41,50,61,.41);font-size:12px;font-weight:500;letter-spacing:0}.Input_input_1qTm5{width:100%;padding:29px 0 10px;color:#29323d;font-size:15px;letter-spacing:0;text-indent:12px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;border-radius:0;-webkit-transition:color .15s ease;transition:color .15s ease}.Input_input_1qTm5:disabled{opacity:.5}.Address_grid_3Vxrg{display:grid;grid-template-columns:1fr 1fr;background-color:#fff;border-radius:5px;-webkit-box-shadow:0 2px 15px 0 rgba(0,0,0,.2);box-shadow:0 2px 15px 0 rgba(0,0,0,.2);overflow:hidden;-webkit-transition:opacity .3s ease,-webkit-transform .3s ease;transition:opacity .3s ease,-webkit-transform .3s ease;transition:transform .3s ease,opacity .3s ease;transition:transform .3s ease,opacity .3s ease,-webkit-transform .3s ease}.Address_grid_3Vxrg:not(:first-child){margin-top:24px}.Address_grid_3Vxrg.Address_fade_1Khjf{opacity:.8}.Address_grid_3Vxrg.Address_no-map_kB9Ag{-webkit-box-shadow:none;box-shadow:none;border:1px solid #dce4ea}@media only screen and (max-width:1199px){.Address_grid_3Vxrg{grid-template-columns:1fr}.Address_grid_3Vxrg label{border-right:none}}@media only screen and (max-width:767px){.Address_grid_3Vxrg:not(.Address_no-map_kB9Ag):not(.Address_no-search_1JpdT){margin-top:200px!important}.Address_grid_3Vxrg:not(.Address_no-map_kB9Ag).Address_no-search_1JpdT{margin-top:260px!important}}.Address_grid_3Vxrg,.Address_grid_3Vxrg *{-webkit-box-sizing:border-box;box-sizing:border-box}.Address_grid_3Vxrg label.Address_right_3dCTx{border-right:none}.Address_grid_3Vxrg .Address_full_2Hoxx,.Address_grid_3Vxrg label:last-child{grid-column:span 2;border-right:none}@media only screen and (max-width:1199px){.Address_grid_3Vxrg .Address_full_2Hoxx,.Address_grid_3Vxrg label:last-child{grid-column:span 1}}.Address_row_3kuz9{display:-webkit-box;display:-ms-flexbox;display:flex}.Address_row_3kuz9:last-child>*{border-bottom:none}.Address_row_3kuz9 label{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;border-right:none}.Address_btn_2BSW6{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;border-bottom:1px solid #dce4ea;border-radius:0 5px 0 0;cursor:pointer;pointer-events:none}.Address_btn_2BSW6 svg{opacity:.5;-webkit-transform:translateX(200%);transform:translateX(200%);-webkit-transition:opacity .15s ease,-webkit-transform .3s ease;transition:opacity .15s ease,-webkit-transform .3s ease;transition:transform .3s ease,opacity .15s ease;transition:transform .3s ease,opacity .15s ease,-webkit-transform .3s ease}.Address_btn_2BSW6 path{-webkit-transition:fill .15s ease;transition:fill .15s ease}.Address_show-clear_rAelt .Address_btn_2BSW6{pointer-events:auto}.Address_show-clear_rAelt .Address_btn_2BSW6 svg{-webkit-transform:translateX(0);transform:translateX(0)}.Address_btn_2BSW6:hover svg{opacity:1}.Address_btn_2BSW6:hover path{fill:#f22c26}.Address_delete_gHZG0 input{color:#f22c26}.Map_map_2NpD9{position:absolute;z-index:0;top:0;left:0;right:0;bottom:0;-webkit-box-sizing:border-box;box-sizing:border-box}@media only screen and (max-width:767px){.Map_map_2NpD9{height:300px;bottom:auto}}.Map_control_3-EIS{margin:24px!important;font-size:0;border-radius:5px;-webkit-box-shadow:0 2px 15px 0 rgba(0,0,0,.2);box-shadow:0 2px 15px 0 rgba(0,0,0,.2)}@media only screen and (max-width:767px){.Map_control_3-EIS{margin:14px!important}}.Map_control_3-EIS button{display:block;width:100%;padding:2px 10px 3px;color:rgba(41,50,61,.75);font-size:20px;font-weight:700;line-height:normal;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:none;cursor:pointer;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.Map_control_3-EIS button:not(:last-child){border-bottom:1px solid #dce4ea}.Map_control_3-EIS button:first-child{padding-bottom:4px;border-radius:5px 5px 0 0}.Map_control_3-EIS button:last-child{padding-top:4px;border-radius:0 0 5px 5px}.Map_control_3-EIS button:hover{background-color:#f0f9ff}.App_wrap_2esTH{position:relative;margin:0 -24px;min-height:284px;overflow:hidden}@media only screen and (max-width:767px){.App_wrap_2esTH{margin:0 -12px}}.hud .App_wrap_2esTH{margin:-24px!important}.matrixblock .App_wrap_2esTH{margin:0 -14px!important}.superTable-layout-row .App_wrap_2esTH,.superTable-layout-table .App_wrap_2esTH{margin:-4px -10px!important}.App_wrap_2esTH.App_no-map_2mvF1{min-height:0;margin:0;overflow:visible}.App_wrap_2esTH.App_no-map_2mvF1 .App_content_pIJBB{padding:0}.hud .App_wrap_2esTH.App_no-map_2mvF1 .App_content_pIJBB{width:100%;padding:24px}.App_mini_RpxNW{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.App_mini_RpxNW .btn{margin-left:24px;font-size:14px}.App_empty_1A4ND{opacity:.5}.App_content_pIJBB{position:relative;z-index:2;-webkit-box-sizing:border-box;box-sizing:border-box;width:50%;padding:24px;pointer-events:none}.App_content_pIJBB.App_noMap_Mu8tf{width:100%}.matrixblock .App_content_pIJBB,.superTable-layout-row .App_content_pIJBB,.superTable-layout-table .App_content_pIJBB{padding:14px}@media only screen and (max-width:767px){.App_content_pIJBB{width:100%;padding:12px}}.App_content_pIJBB>*{pointer-events:all}"
  },
  {
    "path": "src/web/assets/map/css/chunk-vendors.css",
    "content": ".leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-overlay-pane svg,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{-webkit-filter:inherit;filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile{will-change:opacity}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;transform-origin:0 0}.leaflet-zoom-anim .leaflet-zoom-animated{will-change:transform;-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1),-webkit-transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078a8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:hsla(0,0%,100%,.5)}.leaflet-container{font:12px/1.5 Helvetica Neue,Arial,Helvetica,sans-serif}.leaflet-bar{-webkit-box-shadow:0 1px 5px rgba(0,0,0,.65);box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{-webkit-box-shadow:0 1px 5px rgba(0,0,0,.4);box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers-expanded .leaflet-control-layers-toggle,.leaflet-control-layers .leaflet-control-layers-list{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:hsla(0,0%,100%,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;background:#fff;background:hsla(0,0%,100%,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{-webkit-box-shadow:none;box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;-webkit-box-shadow:0 3px 14px rgba(0,0,0,.4);box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;border:none;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:\"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678,M12=0.70710678,M21=-0.70710678,M22=0.70710678)}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-clickable{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:\"\"}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}"
  },
  {
    "path": "src/web/assets/map/index.html",
    "content": "<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content=\"IE=edge\"><meta name=viewport content=\"width=device-width,initial-scale=1\"><title>Vue App</title><link href=/css/app.css rel=preload as=style><link href=/css/chunk-vendors.css rel=preload as=style><link href=/js/app.js rel=preload as=script><link href=/js/chunk-vendors.js rel=preload as=script><link href=/css/chunk-vendors.css rel=stylesheet><link href=/css/app.css rel=stylesheet></head><body><div id=app></div><script src=/js/chunk-vendors.js></script><script src=/js/app.js></script></body></html>"
  },
  {
    "path": "src/web/assets/map/js/app.js",
    "content": "var EtherMaps=function(e){function t(t){for(var n,s,i=t[0],c=t[1],l=t[2],p=0,h=[];p<i.length;p++)s=i[p],Object.prototype.hasOwnProperty.call(r,s)&&r[s]&&h.push(r[s][0]),r[s]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);u&&u(t);while(h.length)h.shift()();return o.push.apply(o,l||[]),a()}function a(){for(var e,t=0;t<o.length;t++){for(var a=o[t],n=!0,i=1;i<a.length;i++){var c=a[i];0!==r[c]&&(n=!1)}n&&(o.splice(t--,1),e=s(s.s=a[0]))}return e}var n={},r={app:0},o=[];function s(t){if(n[t])return n[t].exports;var a=n[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,s),a.l=!0,a.exports}s.m=e,s.c=n,s.d=function(e,t,a){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},s.r=function(e){\"undefined\"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&\"object\"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(s.r(a),Object.defineProperty(a,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var n in e)s.d(a,n,function(t){return e[t]}.bind(null,n));return a},s.n=function(e){var t=e&&e.__esModule?function(){return e[\"default\"]}:function(){return e};return s.d(t,\"a\",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p=\"/\";var i=window[\"webpackJsonpEtherMaps\"]=window[\"webpackJsonpEtherMaps\"]||[],c=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=c;return o.push([0,\"chunk-vendors\"]),a()}({0:function(e,t,a){e.exports=a(\"56d7\")},1305:function(e,t,a){\"use strict\";var n=a(\"1957\"),r=a.n(n);t[\"default\"]=r.a},1957:function(e,t,a){e.exports={wrap:\"Search_wrap_rNtoB\",\"no-map\":\"Search_no-map_1K6JR\",input:\"Search_input_3tpBT\",open:\"Search_open_a4lCm\",resultsWrap:\"Search_resultsWrap_1ufuc\",results:\"Search_results_nREcw\"}},\"1c37\":function(e,t,a){\"use strict\";var n=a(\"bfca\"),r=a.n(n);t[\"default\"]=r.a},\"2e97\":function(e,t,a){\"use strict\";var n=a(\"7857\"),r=a.n(n);t[\"default\"]=r.a},\"56d7\":function(e,t,a){\"use strict\";a.r(t);a(\"cadf\"),a(\"551c\"),a(\"f751\"),a(\"097d\");var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"div\",[a(\"div\",{ref:\"field\",class:e.wrapCls},[e.config.hideMap?e._e():a(\"Map\",{attrs:{tiles:e.config.mapTiles,token:e.config.mapToken,latLng:{lat:e.val.lat,lng:e.val.lng},zoom:+e.val.zoom,\"min-zoom\":e.config.minZoom,\"max-zoom\":e.config.maxZoom,\"hide-search\":e.config.hideSearch,\"hide-address\":e.config.hideAddress,\"show-current-location\":e.config.showCurrentLocation,\"w3w-enabled\":e.config.w3wEnabled,\"show-w3w-grid\":e.config.showW3WGrid},on:{change:e.onMapChange,zoom:e.onZoom}}),a(\"div\",{class:[e.$style.content,e.config.hideMap&&e.$style.noMap]},[e.config.hideSearch?e._e():a(\"Search\",{attrs:{service:e.config.geoService,\"default-value\":e.val.address,geo:e.geo,\"has-map\":!e.config.hideMap},on:{selected:e.onSearchSelected,\"open-offset\":e.onResultsOpenOffset}}),e.config.isSettings?e._e():a(\"Address\",{attrs:{hide:e.config.hideAddress,\"has-search\":!e.config.hideSearch,\"has-map\":!e.config.hideMap,showLatLng:e.config.showLatLng,value:e.val,\"open-offset\":e.resultsOpenOffset,\"show-w3w-field\":e.config.showW3WField},on:{changed:e.onPartChange,clear:e.onClear,\"w3w-change\":e.onW3WChange}})],1)],1),\"mini\"===e.config.size?a(\"div\",{class:e.$style.mini},[a(\"span\",{class:\"\"===e.value.address&&e.$style.empty},[e._v(e._s(e.value.address||e.emptyLabel))]),a(\"button\",{ref:\"btn\",staticClass:\"btn\",attrs:{type:\"button\"},on:{click:e.onEditClick}},[e._v(\"Edit\")])]):e._e(),e.config.isSettings?e._e():a(\"input\",{attrs:{type:\"hidden\",name:e.config.name},domProps:{value:JSON.stringify(e.value)}}),e.config.isSettings?a(\"Fragment\",[a(\"input\",{attrs:{type:\"hidden\",name:e.config.name.replace(\"__settings__\",\"lat\")},domProps:{value:e.value.lat}}),a(\"input\",{attrs:{type:\"hidden\",name:e.config.name.replace(\"__settings__\",\"lng\")},domProps:{value:e.value.lng}}),a(\"input\",{attrs:{type:\"hidden\",name:e.config.name.replace(\"__settings__\",\"zoom\")},domProps:{value:e.value.zoom}})]):e._e()],1)},r=[],o=(a(\"8e6e\"),a(\"ac6a\"),a(\"456d\"),a(\"7f7f\"),a(\"bd86\")),s=(a(\"96cf\"),a(\"3b8d\")),i=(a(\"6b54\"),a(\"d225\")),c=a(\"b0b4\"),l={Nominatim:\"nominatim\",Mapbox:\"mapbox\",GoogleMaps:\"google\",AppleMapKit:\"apple\",Here:\"here\"},u=l;a(\"28a5\");function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function h(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(a,!0).forEach(function(t){Object(o[\"a\"])(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var d=function(){function e(t,a){switch(Object(i[\"a\"])(this,e),Object(o[\"a\"])(this,\"number\",\"\"),Object(o[\"a\"])(this,\"address\",\"\"),Object(o[\"a\"])(this,\"city\",\"\"),Object(o[\"a\"])(this,\"postcode\",\"\"),Object(o[\"a\"])(this,\"county\",\"\"),Object(o[\"a\"])(this,\"state\",\"\"),Object(o[\"a\"])(this,\"country\",\"\"),a){case u.Nominatim:this._nominatim(t);break;case u.Mapbox:this._mapbox(t);break;case u.GoogleMaps:this._google(t);break;case u.Here:this._here(t);break;default:return this}}return Object(c[\"a\"])(e,[{key:\"_nominatim\",value:function(e){this.number=this._join([e.house_number,e.address29,-1===[\"pedestrian\",\"footway\",\"path\",\"road\",\"neighbourhood\",\"suburb\",\"village\",\"town\",\"city_district\",\"city\"].indexOf(e.type)?e[e.type]:null]),this.address=this._join([e.pedestrian,e.footway,e.path,e.road,e.neighbourhood,e.suburb]),this.city=this._join([e.village,e.town,e.city_district,e.city]),this.postcode=e.postcode,this.county=e.county,this.state=this._join([e.state_district,e.state]),this.country=e.country}},{key:\"_mapbox\",value:function(e){if(!e.context)return this.number=null,this.address=null,this.city=null,this.postcode=null,this.county=null,this.state=null,void(this.country=null);e=e.context.reduce(function(e,t){var a=t.id.split(\".\")[0];return e[a]=t.text,e},Object(o[\"a\"])({number:e.address},e.place_type[0],e.text)),this.number=e.number,this.address=e.address,this.city=e.place,this.postcode=e.postcode,this.county=e.district,this.state=e.region,this.country=e.country}},{key:\"_google\",value:function(e){Array.isArray(e)&&(e=e.reduce(function(e,t){var a=t.types[0];return e[a]=t.long_name,e},{})),this.number=this._join([e.subpremise,e.premise,e.street_number]),this.address=this._join([e.route,e.neighborhood,e.sublocality_level_5,e.sublocality_level_4,e.sublocality_level_3,e.sublocality_level_2,e.sublocality_level_1,e.sublocality]),this.city=this._join([e.postal_town,e.locality]),this.postcode=e.postal_code||e.postal_code_prefix,this.county=e.administrative_area_level_2,this.state=e.administrative_area_level_1,this.country=e.country}},{key:\"_here\",value:function(e){e=h({},e,{},e.additionalData.reduce(function(e,t){return e[t.key]=t.value,e},{})),delete e.additionalData,this.number=e.houseNumber||\"\",this.address=this._join([e.street,e.district]),this.city=e.city||\"\",this.postcode=e.postalCode||\"\",this.county=e.CountyName||e.county||\"\",this.state=e.StateName||e.state||\"\",this.country=e.CountryName||e.country||\"\"}},{key:\"_join\",value:function(e){return e.filter(Boolean).join(\", \")}}],[{key:\"from\",value:function(t){var a=new e;return a.number=t.number||\"\",a.address=t.address||\"\",a.city=t.city||\"\",a.postcode=t.postcode||\"\",a.county=t.county||\"\",a.state=t.state||\"\",a.country=t.country||\"\",a}}]),e}(),f=a(\"308d\"),b=a(\"6bb5\"),g=a(\"013f\"),m=a(\"4e2b\"),v=function(e){function t(){var e,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i[\"a\"])(this,t),e=Object(f[\"a\"])(this,Object(b[\"a\"])(t).call(this,a,u.GoogleMaps)),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_1\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_2\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_3\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_4\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_5\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"airport\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"bus_station\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"colloquial_area\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"establishment\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"floor\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"intersection\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"locality\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"natural_feature\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"neighborhood\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"park\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"parking\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"point_of_interest\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"political\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"post_box\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_code\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_code_prefix\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_town\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"premise\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"room\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"route\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"street_address\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"street_number\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_1\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_2\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_3\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_4\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_5\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"subpremise\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"train_station\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"transit_station\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_1_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_2_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_3_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_4_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"administrative_area_level_5_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"airport_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"bus_station_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"colloquial_area_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"establishment_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"floor_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"intersection_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"locality_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"natural_feature_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"neighborhood_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"park_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"parking_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"point_of_interest_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"political_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"post_box_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_code_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_code_prefix_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"postal_town_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"premise_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"room_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"route_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"street_address_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"street_number_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_1_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_2_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_3_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_4_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"sublocality_level_5_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"subpremise_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"train_station_short\",\"\"),Object(o[\"a\"])(Object(g[\"a\"])(e),\"transit_station_short\",\"\"),Array.isArray(a)&&(a=a.reduce(function(e,t){var a=t.types[0];return e[a]=t.long_name,e},{})),Object.keys(a).forEach(function(t){e[t]=a[t]}),e}return Object(m[\"a\"])(t,e),t}(d);function y(e,t){if(window.hasOwnProperty(e))t();else var a=setInterval(function(){window.hasOwnProperty(e)&&(t(),clearTimeout(a))})}function w(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function O(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?w(a,!0).forEach(function(t){Object(o[\"a\"])(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):w(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var _,j,k,x=function(){function e(t){var a=this,n=t.country,r=t.geoService,s=t.geoToken,c=t.locale;Object(i[\"a\"])(this,e),Object(o[\"a\"])(this,\"country\",null),Object(o[\"a\"])(this,\"service\",null),Object(o[\"a\"])(this,\"token\",null),Object(o[\"a\"])(this,\"locale\",null),Object(o[\"a\"])(this,\"google\",{service:null,session:null}),Object(o[\"a\"])(this,\"apple\",{Search:null}),this.country=n?n.toLowerCase():null,this.service=r,this.token=s,this.locale=c,r===u.GoogleMaps?y(\"google\",function(){return a.initGoogle()}):r===u.AppleMapKit&&y(\"mapkit\",function(){return a.initApple(s)})}return Object(c[\"a\"])(e,[{key:\"initGoogle\",value:function(){this.google={service:new window.google.maps.places.AutocompleteService,session:new window.google.maps.places.AutocompleteSessionToken,geocoder:new window.google.maps.Geocoder,places:new window.google.maps.places.PlacesService(document.createElement(\"div\"))}}},{key:\"initApple\",value:function(e){window.mapkit.init({authorizationCallback:function(t){return t(e)}}),this.apple={Search:new window.mapkit.Search,Geocoder:new window.mapkit.Geocoder,Coordinate:window.mapkit.Coordinate}}},{key:\"search\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(t&&\"\"!==t.trim()){e.next=2;break}return e.abrupt(\"return\",[]);case 2:a=[],e.t0=this.service,e.next=e.t0===u.Nominatim?6:e.t0===u.Mapbox?10:e.t0===u.GoogleMaps?14:e.t0===u.AppleMapKit?18:e.t0===u.Here?22:26;break;case 6:return e.next=8,this.searchNominatim(t);case 8:return a=e.sent,e.abrupt(\"break\",27);case 10:return e.next=12,this.searchMapbox(t);case 12:return a=e.sent,e.abrupt(\"break\",27);case 14:return e.next=16,this.searchGoogle(t);case 16:return a=e.sent,e.abrupt(\"break\",27);case 18:return e.next=20,this.searchApple(t);case 20:return a=e.sent,e.abrupt(\"break\",27);case 22:return e.next=24,this.searchHere(t);case 24:return a=e.sent,e.abrupt(\"break\",27);case 26:throw new Error(\"Unknown geocoding service: \"+this.service);case 27:return e.abrupt(\"return\",a);case 28:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:\"searchNominatim\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return a=new URLSearchParams({q:t,format:\"jsonv2\",limit:5,addressdetails:1,countrycodes:this.country,\"accept-language\":this.locale}).toString(),e.next=3,fetch(\"https://nominatim.openstreetmap.org/search?\"+a).then(function(e){return e.json()});case 3:return n=e.sent,e.abrupt(\"return\",n.map(function(e){return{address:e.display_name,lat:e.lat,lng:e.lon,parts:new d(O({},e.address,{type:e.type}),u.Nominatim)}}));case 5:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:\"searchMapbox\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a,n,r;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return a={types:\"address,country,postcode,place,locality,district,neighborhood\",limit:5,access_token:this.token,language:this.locale},this.country&&(a.country=this.country),n=new URLSearchParams(a).toString(),e.next=5,fetch(\"https://api.mapbox.com/geocoding/v5/mapbox.places/\"+t+\".json?\"+n).then(function(e){return e.json()});case 5:return r=e.sent,e.abrupt(\"return\",r.features.map(function(e){return{address:e.place_name,lat:e.center[1],lng:e.center[0],parts:new d(e,u.Mapbox)}}));case 7:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:\"searchGoogle\",value:function(e){var t=this;return new Promise(function(a){t.google.service.getPlacePredictions({input:e,sessionToken:t.google.session,componentRestrictions:{country:t.country}},function(e){return a(e?e.map(function(e){return{__placeId:e.place_id,address:e.description}}):[])})})}},{key:\"searchApple\",value:function(e){var t=this;return new Promise(function(a){t.apple.Search.autocomplete(e,function(e,t){a(t.results.slice(0,5).map(function(e){return{address:e.displayLines.join(\", \"),lat:e.coordinate.latitude,lng:e.coordinate.longitude,parts:new d(null,u.AppleMapKit)}}))})})}},{key:\"searchHere\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return a=new URLSearchParams({app_id:this.token.appId,app_code:this.token.appCode,query:t,country:this.country?this.country.toUpperCase():\"\",maxresults:5,language:this.locale}).toString(),e.next=3,fetch(\"https://autocomplete.geocoder.api.here.com/6.2/suggest.json?\"+a).then(function(e){return e.json()});case 3:if(n=e.sent,n.hasOwnProperty(\"suggestions\")){e.next=6;break}return e.abrupt(\"return\",[]);case 6:return e.abrupt(\"return\",n.suggestions.map(function(e){return{__placeId:e.locationId,address:e.label}}));case 7:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:\"reverseNominatim\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t,a){var n,r,o,s;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return n=t.lat,r=t.lng,o=new URLSearchParams({lat:n,lon:r,format:\"jsonv2\",addressdetails:1,\"accept-language\":this.locale}).toString(),e.next=4,fetch(\"https://nominatim.openstreetmap.org/reverse?\"+o).then(function(e){return e.json()});case 4:if(s=e.sent,!(!s||s.hasOwnProperty(\"error\")&&s.error)){e.next=7;break}return e.abrupt(\"return\",{address:\"\",lat:n,lng:r,parts:new d});case 7:return e.abrupt(\"return\",O({},a,{address:s.display_name,lat:n,lng:r,parts:new d(O({},s.address,{type:s.type}),u.Nominatim)}));case 8:case\"end\":return e.stop()}},e,this)}));function t(t,a){return e.apply(this,arguments)}return t}()},{key:\"reverseMapbox\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t,a){var n,r,o,s,i;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return n=t.lat,r=t.lng,o=new URLSearchParams({types:\"address,country,postcode,place,locality,district,neighborhood\",limit:1,access_token:this.token,language:this.locale}).toString(),e.next=4,fetch(\"https://api.mapbox.com/geocoding/v5/mapbox.places/\"+r+\",\"+n+\".json?\"+o).then(function(e){return e.json()});case 4:if(s=e.sent,i=s.features[0],i){e.next=8;break}return e.abrupt(\"return\",{address:\"\",lat:n,lng:r,parts:new d});case 8:return e.abrupt(\"return\",O({},a,{address:i.place_name,lat:n,lng:r,parts:new d(i,u.Mapbox)}));case 9:case\"end\":return e.stop()}},e,this)}));function t(t,a){return e.apply(this,arguments)}return t}()},{key:\"reverseGoogle\",value:function(e,t){var a=this;return new Promise(function(n){a.google.geocoder.geocode({location:e},function(a){var r=a[0];n(O({},t,{address:r.formatted_address},e,{parts:new v(r.address_components)}))})})}},{key:\"reverseApple\",value:function(e,t){var a=this,n=e.lat,r=e.lng;return new Promise(function(e){a.apple.Geocoder.reverseLookup(new a.apple.Coordinate(n,r),function(a,o){var s=o.results[0];e(O({},t,{address:s.formattedAddress,lat:n,lng:r,parts:new d(null,u.AppleMapKit)}))})})}},{key:\"reverseHere\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t,a){var n,r,o,s,i,c;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return n=t.lat,r=t.lng,o=new URLSearchParams({app_id:this.token.appId,app_code:this.token.appCode,mode:\"retrieveAddresses\",jsonattributes:1,limit:1,prox:\"\".concat(n,\",\").concat(r,\",1\"),language:this.locale}),e.next=4,fetch(\"https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?\"+o).then(function(e){return e.json()});case 4:if(s=e.sent,i=s.response,0!==i.view.length){e.next=8;break}return e.abrupt(\"return\",{address:\"\",lat:n,lng:r,parts:new d});case 8:return c=i.view[0].result[0].location.address,e.abrupt(\"return\",O({},a,{address:c.label,lat:n,lng:r,parts:new d(c,u.Here)}));case 10:case\"end\":return e.stop()}},e,this)}));function t(t,a){return e.apply(this,arguments)}return t}()},{key:\"getGooglePlaceDetails\",value:function(e,t){var a=this;return new Promise(function(n){a.google.places.getDetails({placeId:e,fields:[\"geometry\",\"address_component\"]},function(e){n(O({},t,{address:t.address,lat:e.geometry.location.lat(),lng:e.geometry.location.lng(),parts:new v(e.address_components)}))})})}},{key:\"getHerePlaceDetails\",value:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t,a){var n,r,o;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return n=new URLSearchParams({app_id:this.token.appId,app_code:this.token.appCode,locationid:t,jsonattributes:1,gen:9,language:this.locale}).toString(),e.next=3,fetch(\"https://geocoder.api.here.com/6.2/geocode.json?\"+n).then(function(e){return e.json()});case 3:return r=e.sent,o=r.response.view[0].result[0].location,e.abrupt(\"return\",O({},a,{lat:o.displayPosition.latitude,lng:o.displayPosition.longitude,parts:new d(o.address,u.Here)}));case 6:case\"end\":return e.stop()}},e,this)}));function t(t,a){return e.apply(this,arguments)}return t}()}]),e}(),S={functional:!0,render:function(e,t){return t.children}},M=S,L=a(\"2877\"),C=Object(L[\"a\"])(M,_,j,!1,null,null,null),P=C.exports,A=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"label\",{class:e.cls},[a(\"svg\",{attrs:{width:\"17\",height:\"17\",viewBox:\"0 0 17 17\"}},[a(\"path\",{attrs:{fill:\"#29323D\",d:\"M6.938 13.893c-3.805 0-6.917-3.112-6.917-6.917C.021 3.17 3.133.059 6.938.059c3.797 0 6.917 3.11 6.917 6.917a6.846 6.846 0 0 1-1.265 3.963l3.832 3.841c.246.246.36.572.36.906 0 .72-.536 1.292-1.274 1.292-.343 0-.677-.124-.923-.37l-3.85-3.858a6.874 6.874 0 0 1-3.797 1.143zm0-1.846c2.778 0 5.072-2.285 5.072-5.071 0-2.778-2.294-5.072-5.072-5.072-2.786 0-5.07 2.294-5.07 5.072 0 2.786 2.284 5.07 5.07 5.07z\"}})]),a(\"vue-autosuggest\",{ref:\"self\",attrs:{suggestions:e.suggestions,\"render-suggestion\":e.renderSuggestion,\"get-suggestion-value\":e.getSuggestionValue,\"should-render-suggestions\":e.shouldRenderSuggestions,\"input-props\":e.inputProps,\"component-attr-class-autosuggest-results-container\":e.$style.resultsWrap,\"component-attr-class-autosuggest-results\":e.$style.results},on:{selected:e.onSelected,input:e.onInputChange}})],1)},D=[],$=(a(\"386d\"),a(\"2831\"));function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return window.Craft.t(\"simplemap\",e,t)}var z={props:{geo:x,service:String,defaultValue:String,hasMap:Boolean,size:String},components:{VueAutosuggest:$[\"a\"]},data:function(){return{shouldShow:!1,suggestions:[{data:[]}]}},computed:{cls:function(){var e=[this.$style.wrap];return this.isOpen&&e.push(this.$style.open),this.hasMap||e.push(this.$style[\"no-map\"]),e},inputProps:function(){var e=[this.$style.input];return this.hasMap||e.push(this.$style[\"no-map\"]),{class:e,initialValue:this.initialValue,placeholder:R(\"Search for a location\")}},isOpen:function(){return this.suggestions[0].data.length>0&&this.shouldShow},suggestLengthShow:function(){return\"\".concat(this.shouldShow).concat(this.suggestions[0].data.length)}},watch:{suggestLengthShow:function(){this.emitHeightChange()}},methods:{shouldRenderSuggestions:function(e,t){return this.shouldShow=e>0&&!t,function(){return!0}},onInputChange:function(e){var t=this;\"\"===e.trim()&&(this.shouldShow=!1),clearTimeout(k),k=setTimeout(Object(s[\"a\"])(regeneratorRuntime.mark(function a(){var n;return regeneratorRuntime.wrap(function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,t.geo.search(e);case 2:n=a.sent,t.suggestions=[{data:n}],t.emitHeightChange();case 5:case\"end\":return a.stop()}},a)})),500)},onSelected:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt(\"return\");case 2:a=t.item,n=a.__placeId,delete a.__placeId,e.t0=this.service,e.next=e.t0===u.GoogleMaps?8:e.t0===u.Here?12:16;break;case 8:return e.next=10,this.geo.getGooglePlaceDetails(n,a);case 10:return a=e.sent,e.abrupt(\"break\",16);case 12:return e.next=14,this.geo.getHerePlaceDetails(n,a);case 14:return a=e.sent,e.abrupt(\"break\",16);case 16:this.$emit(\"selected\",a);case 17:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),renderSuggestion:function(e){var t=e.item;return t.address},getSuggestionValue:function(e){return e.item.address},emitHeightChange:function(){var e=this;if(this.hasMap){var t=this.$refs.self.$el.lastElementChild;this.isOpen&&t.firstElementChild&&!window.matchMedia(\"(max-width: 767px)\").matches?setTimeout(function(){e.$emit(\"open-offset\",t.firstElementChild.getBoundingClientRect().height)}):this.$emit(\"open-offset\",0)}}}},H=z,E=a(\"1305\");function I(e){this[\"$style\"]=E[\"default\"].locals||E[\"default\"]}var T=Object(L[\"a\"])(H,A,D,!1,I,null,null),B=T.exports,N=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"div\",{class:e.cls,style:e.styl},[e.showLatLng?a(\"Fragment\",[a(\"Input\",{attrs:{label:e.labels.lat,value:e.value.lat},on:{input:function(t){return e.onInput(\"lat\",t)}}}),a(\"Input\",{attrs:{label:e.labels.lng,value:e.value.lng},on:{input:function(t){return e.onInput(\"lng\",t)}}})],1):e._e(),a(\"div\",{class:[e.$style.full,e.$style.row]},[a(\"Input\",{attrs:{label:e.labels.fullAddress,value:e.value.address,disabled:e.hide},on:{input:function(t){return e.onInput(\"fullAddress\",t)}}}),a(\"button\",{class:e.$style.btn,attrs:{type:\"button\",title:e.labels.clear},on:{click:function(t){return e.onClear()},mouseenter:e.onDeleteEnter,mouseleave:e.onDeleteLeave}},[a(\"svg\",{attrs:{width:\"14\",height:\"14\",viewBox:\"0 0 14 14\"}},[a(\"path\",{attrs:{fill:\"#29323D\",d:\"M7 14c-3.832 0-7-3.167-7-6.997C0 3.167 3.162 0 6.993 0 10.825 0 14 3.167 14 7.003 14 10.833 10.832 14 7 14zM4.65 9.994a.65.65 0 0 0 .468-.19l1.875-1.88 1.889 1.88c.115.116.27.19.46.19.366 0 .65-.29.65-.65a.674.674 0 0 0-.19-.46l-1.888-1.88 1.889-1.895a.581.581 0 0 0 .196-.447.64.64 0 0 0-.65-.643.59.59 0 0 0-.453.19L6.993 6.097 5.104 4.216a.607.607 0 0 0-.453-.19.64.64 0 0 0-.65.643c0 .17.074.331.196.447L6.08 7.003 4.197 8.898a.608.608 0 0 0-.196.447c0 .358.291.65.65.65z\"}})])])],1),e.showW3wField?a(\"Input\",{class:e.$style.full,attrs:{label:e.labels.what3words,value:\"/// \"+(e.value.what3words||\"\")},on:{input:e.onW3WInput}}):e._e(),e.hide?e._e():a(\"Fragment\",[a(\"Input\",{attrs:{label:e.labels.number,value:e.value.parts.number},on:{input:function(t){return e.onInput(\"number\",t)}}}),a(\"Input\",{class:e.$style.right,attrs:{label:e.labels.address,value:e.value.parts.address},on:{input:function(t){return e.onInput(\"address\",t)}}}),a(\"Input\",{attrs:{label:e.labels.city,value:e.value.parts.city},on:{input:function(t){return e.onInput(\"city\",t)}}}),a(\"Input\",{class:e.$style.right,attrs:{label:e.labels.postcode,value:e.value.parts.postcode},on:{input:function(t){return e.onInput(\"postcode\",t)}}}),a(\"Input\",{attrs:{label:e.labels.county,value:e.value.parts.county},on:{input:function(t){return e.onInput(\"county\",t)}}}),a(\"Input\",{class:e.$style.right,attrs:{label:e.labels.state,value:e.value.parts.state},on:{input:function(t){return e.onInput(\"state\",t)}}}),a(\"Input\",{attrs:{label:e.labels.country,value:e.value.parts.country},on:{input:function(t){return e.onInput(\"country\",t)}}})],1)],1)},W=[],G=(a(\"a481\"),a(\"c5f6\"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"Label\",{class:e.className,attrs:{label:e.label}},[a(\"input\",{class:e.$style.input,attrs:{type:e.type,name:e.name,disabled:e.disabled},domProps:{value:e.value},on:{input:function(t){return e.$emit(\"input\",t)}}})])}),Z=[],V=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"label\",{class:e.$style.label},[a(\"span\",{class:e.$style.name},[e._v(\"\\n\\t\\t\"+e._s(e.label)+\"\\n\\t\")]),e._t(\"default\")],2)},U=[],K={props:{label:String}},F=K,J=a(\"9e21\");function q(e){this[\"$style\"]=J[\"default\"].locals||J[\"default\"]}var Y=Object(L[\"a\"])(F,V,U,!1,q,null,null),Q=Y.exports,X={props:{label:String,name:String,type:{type:String,default:\"text\"},value:[String,Number],disabled:Boolean,className:Boolean},components:{Label:Q}},ee=X,te=a(\"1c37\");function ae(e){this[\"$style\"]=te[\"default\"].locals||te[\"default\"]}var ne=Object(L[\"a\"])(ee,G,Z,!1,ae,null,null),re=ne.exports,oe={props:{value:{type:Object,default:function(){return{address:\"\",lat:0,lng:0,parts:{},what3words:\"\"}}},showLatLng:Boolean,fullAddressDirty:Boolean,hide:Boolean,hasSearch:Boolean,hasMap:Boolean,size:String,openOffset:Number,showW3wField:Boolean},components:{Input:re,Fragment:P},data:function(){return{hoverDelete:!1,labels:{fullAddress:R(\"Full Address\"),number:R(\"Name / Number\"),address:R(\"Street Address\"),city:R(\"Town / City\"),postcode:R(\"Postcode\"),county:R(\"County\"),state:R(\"State\"),country:R(\"Country\"),lat:R(\"Latitude\"),lng:R(\"Longitude\"),clear:R(\"Clear address\"),what3words:R(\"what3words\")}}},computed:{cls:function(){var e=[this.$style.grid];return this.hasMap&&this.openOffset>0&&e.push(this.$style.fade),this.hasSearch||e.push(this.$style[\"no-search\"]),this.hasMap||e.push(this.$style[\"no-map\"]),this.hoverDelete&&e.push(this.$style.delete),this.hasValue&&e.push(this.$style[\"show-clear\"]),e},styl:function(){return this.hasMap?{transform:\"translateY(\".concat(this.openOffset,\"px)\")}:{}},hasValue:function(){return null!==this.value.address}},methods:{onInput:function(e,t){this.$emit(\"changed\",{name:e,value:t.target.value})},onW3WInput:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:this.$emit(\"w3w-change\",t.target.value.trim().replace(/\\/|\\s/g,\"\").toLowerCase());case 1:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),onClear:function(){this.$emit(\"clear\")},onDeleteEnter:function(){this.hoverDelete=!0},onDeleteLeave:function(){this.hoverDelete=!1}}},se=oe,ie=a(\"9685\");function ce(e){this[\"$style\"]=ie[\"default\"].locals||ie[\"default\"]}var le=Object(L[\"a\"])(se,N,W,!1,ce,null,null),ue=le.exports,pe=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a(\"div\",{class:e.cls})},he=[],de=a(\"e11e\"),fe=a.n(de),be=(a(\"2acb\"),a(\"898b\"),{Wikimedia:\"wikimedia\",OpenStreetMap:\"openstreetmap\",CartoVoyager:\"carto.rastertiles/voyager\",CartoPositron:\"carto.light_all\",CartoDarkMatter:\"carto.dark_all\",MapboxOutdoors:\"mapbox.outdoors\",MapboxStreets:\"mapbox.streets\",MapboxLight:\"mapbox.light\",MapboxDark:\"mapbox.dark\",GoogleRoadmap:\"google.roadmap\",GoogleTerrain:\"google.terrain\",GoogleHybrid:\"google.hybrid\",MapKitStandard:\"mapkit.standard\",MapKitMutedStandard:\"mapkit.muted\",MapKitSatellite:\"mapkit.satellite\",MapKitHybrid:\"mapkit.hybrid\",HereNormalDay:\"here.normal.day\",HereNormalDayGrey:\"here.normal.day.grey\",HereNormalDayTransit:\"here.normal.day.transit\",HereReduced:\"here.reduced.day\",HerePedestrian:\"here.pedestrian.day\",HereTerrain:\"here.terrain.day\",HereSatellite:\"here.satellite.day\",HereHybrid:\"here.hybrid.day\"}),ge=be;a(\"6cc5\");function me(e,t){var a;return function(){var n=t.getZoom(),r=n>17;if(r){var o=t.getBounds().getNorthEast(),s=t.getBounds().getSouthWest();window.what3words.api.gridSectionGeoJson({southwest:{lat:s.lat,lng:s.lng},northeast:{lat:o.lat,lng:o.lng}}).then(function(n){a&&t.removeLayer(a),a=e.geoJSON(n,{style:function(){return{color:\"#777\",stroke:!0,weight:.5}}}).addTo(t)}).catch(console.error)}else a&&t.removeLayer(a)}}function ve(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function ye(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ve(a,!0).forEach(function(t){Object(o[\"a\"])(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ve(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var we=function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"#E7433B\";return'<svg width=\"'.concat(e,'\" height=\"').concat(t,'\" viewBox=\"0 0 14 20\"><path fill=\"').concat(a,'\" d=\"M6.976.478C3.482.478.634 3.313.634 6.79c0 2.381 1.716 4.247 2.945 6.09 1.23 1.844 2 3.706 2.664 6.17a.78.78 0 0 0 .733.56c.308 0 .64-.217.733-.56.724-2.69 1.49-4.537 2.704-6.324 1.213-1.786 2.906-3.56 2.906-5.936 0-3.476-2.849-6.31-6.343-6.31zm.04 3.874c1.21 0 2.18.968 2.18 2.174A2.17 2.17 0 0 1 7.016 8.7a2.17 2.17 0 0 1-2.18-2.174 2.17 2.17 0 0 1 2.18-2.174z\"/></svg>')},Oe=function(e,t){return'<svg width=\"'.concat(e,'\" height=\"').concat(t,'\" viewBox=\"0 0 48 48\"><path fill=\"rgba(41, 50, 61, 0.75)\" d=\"M24 16c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm17.88 6c-.92-8.34-7.54-14.96-15.88-15.88v-4.12h-4v4.12c-8.34.92-14.96 7.54-15.88 15.88h-4.12v4h4.12c.92 8.34 7.54 14.96 15.88 15.88v4.12h4v-4.12c8.34-.92 14.96-7.54 15.88-15.88h4.12v-4h-4.12zm-17.88 16c-7.73 0-14-6.27-14-14s6.27-14 14-14 14 6.27 14 14-6.27 14-14 14z\"/></svg>')},_e={props:{tiles:String,token:[String,Object],latLng:Object,zoom:Number,minZoom:Number,maxZoom:Number,hideSearch:Boolean,hideAddress:Boolean,showCurrentLocation:Boolean,w3wEnabled:Boolean,showW3wGrid:Boolean},data:function(){return{map:null,marker:null}},mounted:function(){var e=this;this.map=fe.a.map(this.$el,{minZoom:this.minZoom,maxZoom:this.maxZoom,scrollWheelZoom:!1,zoomControl:!1}).setView(this.latLng,this.zoom);var t=this;if(fe.a.Control.CustomZoom=fe.a.Control.extend({onAdd:function(a){var n=fe.a.DomUtil.create(\"div\"),r=fe.a.DomUtil.create(\"button\"),o=fe.a.DomUtil.create(\"button\"),s=fe.a.DomUtil.create(\"button\"),i=fe.a.DomUtil.create(\"button\");return n.classList.add(t.$style.control),r.textContent=\"+\",o.textContent=\"-\",s.innerHTML=we(10.5,15,\"rgba(41, 50, 61, 0.75)\"),i.innerHTML=Oe(15,15),r.setAttribute(\"title\",R(\"Zoom In\")),o.setAttribute(\"title\",R(\"Zoom Out\")),s.setAttribute(\"title\",R(\"Center on Marker\")),i.setAttribute(\"title\",R(\"Current Location\")),n.appendChild(r),n.appendChild(o),n.appendChild(s),e.showCurrentLocation&&\"geolocation\"in navigator&&n.appendChild(i),r.addEventListener(\"click\",function(e){e.preventDefault(),a.setZoomAround(t.getOffsetPoint(a.getCenter(),!0),a.getZoom()+a.options.zoomDelta)}),o.addEventListener(\"click\",function(e){e.preventDefault(),a.setZoomAround(t.getOffsetPoint(a.getCenter(),!0),a.getZoom()-a.options.zoomDelta)}),s.addEventListener(\"click\",function(e){e.preventDefault(),t.panTo(t.latLng)}),i.addEventListener(\"click\",function(e){e.preventDefault(),navigator.geolocation.getCurrentPosition(function(e){var a=e.coords,n={lat:a.latitude,lng:a.longitude};t.panTo(n),t.marker.setLatLng(n),t.$emit(\"change\",n)},function(e){window.Craft.cp.displayError(\"<strong>Maps:</strong> \".concat(e.message))},{enableHighAccuracy:!0})}),n},onRemove:function(){}}),fe.a.control.customZoom=function(e){return new fe.a.Control.CustomZoom(e)},fe.a.control.customZoom({position:\"topright\"}).addTo(this.map),this.map.panBy(fe.a.point(this.offsetAmount()),{animate:!1}),this.tiles.indexOf(\"google\")>-1)this._googleMutant();else if(this.tiles.indexOf(\"mapkit\")>-1)this._mapKitMutant();else{var a=ye({attribution:this.tileLayer.attr},this.tileLayer.opts||{});this.tileLayer.subdomains&&(a.subdomains=this.tileLayer.subdomains);var n=fe.a.tileLayer(this.tileLayer.url,a);this.map.addLayer(n)}if(this.w3wEnabled&&this.showW3wGrid){var r=me(fe.a,this.map);this.map.whenReady(r),this.map.on(\"move\",r)}this.map.on(\"zoom\",this.onZoom),this.setMarker();var o=new IntersectionObserver(function(t){t[0].intersectionRatio<=0||e.map.invalidateSize(!0)});o.observe(this.$el)},computed:{cls:function(){return[this.$style.map]},tileLayer:function(){var e=fe.a.Browser.retina?\"@2x.png\":\".png\",t=fe.a.Browser.retina?\"512\":\"256\",a=fe.a.Browser.retina?\"@2x\":\"\",n=this.tiles.split(/\\.(.+)/)[1];switch(this.tiles){case ge.Wikimedia:return{url:\"https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}\".concat(e),attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://maps.wikimedia.org\" target=\"_blank\" rel=\"noreferrer\">Wikimedia</a>'};case ge.OpenStreetMap:return{url:\"https://tile.openstreetmap.org/{z}/{x}/{y}.png\",attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>'};case ge.CartoVoyager:case ge.CartoPositron:case ge.CartoDarkMatter:return{url:\"https://{s}.basemaps.cartocdn.com/\".concat(n,\"/{z}/{x}/{y}\").concat(e),attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://carto.com/attribution\" target=\"_blank\" rel=\"noreferrer\">CARTO</a>'};case ge.MapboxOutdoors:case ge.MapboxStreets:case ge.MapboxLight:case ge.MapboxDark:var r=\"-v11\";return this.tiles!==ge.MapboxLight&&this.tiles!==ge.MapboxDark||(r=\"-v10\"),{url:\"https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}{scale}?access_token={accessToken}\",attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://www.mapbox.com/\" target=\"_blank\" rel=\"noreferrer\">Mapbox</a>',opts:{accessToken:this.token,id:\"mapbox/\".concat(n).concat(r),tileSize:512,zoomOffset:-1,scale:a}};case ge.HereNormalDay:case ge.HereNormalDayGrey:case ge.HereNormalDayTransit:case ge.HereReduced:case ge.HerePedestrian:return{url:\"https://{s}.base.maps.api.here.com/maptile/2.1/maptile/newest/\".concat(n,\"/{z}/{x}/{y}/\").concat(t,\"/png8?app_id=\").concat(this.token.appId,\"&app_code=\").concat(this.token.appCode),attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://here.com/\" target=\"_blank\" rel=\"noreferrer\">Here</a>',subdomains:\"1234\"};case ge.HereTerrain:case ge.HereSatellite:case ge.HereHybrid:return{url:\"https://{s}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/\".concat(n,\"/{z}/{x}/{y}/\").concat(t,\"/png8?app_id=\").concat(this.token.appId,\"&app_code=\").concat(this.token.appCode),attr:'&copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noreferrer\">OpenStreetMap</a>, &copy; <a href=\"https://here.com/\" target=\"_blank\" rel=\"noreferrer\">Here</a>',subdomains:\"1234\"};default:throw new Error(\"Unknown map tiles service: \"+this.tiles)}},icon:function(){var e=28,t=40;return fe.a.divIcon({html:we(e,t),iconSize:[e,t],iconAnchor:[e/2,t],className:\"\"})}},watch:{latLng:{deep:!0,handler:function(e,t){e.lat===t.lat&&e.lng===t.lng||(this.panTo(this.latLng),this.setMarker())}}},methods:{offsetAmount:function(){var e=0;return window.matchMedia(\"(max-width: 767px)\").matches||(e=-this.$el.getBoundingClientRect().width/4),{x:e,y:this.hideSearch?5:-15}},getOffsetPoint:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=this.map.latLngToContainerPoint(e);return t?(a.x-=this.offsetAmount().x,a.y-=this.offsetAmount().y):(a.x+=this.offsetAmount().x,a.y+=this.offsetAmount().y),a},panTo:function(e){this.map.panTo(this.map.containerPointToLatLng(this.getOffsetPoint(e)))},setMarker:function(){var e=this;this.marker&&this.map.removeLayer(this.marker),this.marker=fe.a.marker(this.latLng,{icon:this.icon,draggable:!0,autoPan:!0}),this.map.addLayer(this.marker),this.marker.on(\"dragend\",function(){e.$emit(\"change\",e.marker.getLatLng())})},onZoom:function(){this.$emit(\"zoom\",this.map.getZoom())},_googleMutant:function(){var e=this;y(\"google\",function(){fe.a.gridLayer.googleMutant({type:e.tiles.split(\".\")[1]}).addTo(e.map)})},_mapKitMutant:function(){var e=this;y(\"mapkit\",function(){fe.a.mapkitMutant({type:e.tiles.split(\".\")[1],authorizationCallback:function(t){return t(e.token)},language:window.Craft.language}).addTo(e.map)})}}},je=_e,ke=a(\"f3c8\");function xe(e){this[\"$style\"]=ke[\"default\"].locals||ke[\"default\"]}var Se=Object(L[\"a\"])(je,pe,he,!1,xe,null,null),Me=Se.exports;function Le(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function Ce(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Le(a,!0).forEach(function(t){Object(o[\"a\"])(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Le(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var Pe=window.Garnish.HUD.extend(),Ae={props:{options:String},components:{Search:B,Address:ue,Map:Me,Fragment:P},data:function(){return{config:{isSettings:!1,name:\"\",hideSearch:!1,hideMap:!1,hideAddress:!1,showLatLng:!1,showCurrentLocation:!1,minZoom:3,maxZoom:20,mapTiles:\"wikimedia\",mapToken:\"\",geoService:\"nominatim\",geoToken:\"\",w3wEnabled:!1,showW3WGrid:!1,showW3WField:!1,locale:\"en\",size:\"large\"},value:{address:\"\",zoom:15,lat:null,lng:null,parts:new d,what3words:\"\"},geo:null,fullAddressDirty:!1,defaultValue:null,emptyLabel:R(\"No address selected\"),hud:null,resultsOpenOffset:0}},created:function(){var e=JSON.parse(this.options),t=e.config,a=e.value,n=e.defaultValue,r=t.geoService===u.GoogleMaps;this.config=t,this.value=a,this.value.parts=r?new v(a.parts):d.from(a.parts),this.defaultValue=n,this.defaultValue.parts=r?new v:new d,this.geo=new x(t)},mounted:function(){\"mini\"===this.config.size&&(this.$refs.field.style.display=\"none\")},computed:{wrapCls:function(){var e=[this.$style.wrap];return this.config.hideMap&&e.push(this.$style[\"no-map\"]),e},val:function(){return null===this.value.lat?this.defaultValue:this.value}},methods:{onEditClick:function(){var e;this.hud?this.hud.show():(e=this.config.hideMap?Math.min(626,.9*window.innerWidth):Math.min(834,.9*window.innerWidth),this.$refs.field.style.display=\"block\",this.hud=new Pe(this.$refs.btn,this.$refs.field,{minBodyWidth:e}))},onResultsOpenOffset:function(e){this.resultsOpenOffset=e},onSearchSelected:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return this.value=Ce({},this.value,{},t),e.next=3,this.updateW3WByLatLng({lat:t.lat,lng:t.lng});case 3:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),onMapChange:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return a=this.value.zoom,e.next=3,this.onLatLngChange(t);case 3:return e.next=5,this.updateW3WByLatLng(t);case 5:this.value.zoom=a,this.fullAddressDirty=!1;case 7:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),updateW3WByLatLng:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.config.w3wEnabled){e.next=13;break}return e.prev=1,e.next=4,window.what3words.api.convertTo3wa(t);case 4:a=e.sent,this.value.what3words=a.words,e.next=11;break;case 8:e.prev=8,e.t0=e[\"catch\"](1),this.value.what3words=null;case 11:e.next=14;break;case 13:this.value.what3words=null;case 14:case\"end\":return e.stop()}},e,this,[[1,8]])}));function t(t){return e.apply(this,arguments)}return t}(),onW3WChange:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){var a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.config.w3wEnabled||/([a-z]+\\.){2}[a-z]+/g.test(t)){e.next=2;break}return e.abrupt(\"return\");case 2:return e.prev=2,e.next=5,window.what3words.api.convertToCoordinates(t);case 5:a=e.sent,this.onLatLngChange(a.coordinates),this.value.what3words=t,e.next=12;break;case 10:e.prev=10,e.t0=e[\"catch\"](2);case 12:case\"end\":return e.stop()}},e,this,[[2,10]])}));function t(t){return e.apply(this,arguments)}return t}(),onLatLngChange:function(){var e=Object(s[\"a\"])(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:e.t0=this.config.geoService,e.next=e.t0===u.Nominatim?3:e.t0===u.Mapbox?7:e.t0===u.GoogleMaps?11:e.t0===u.AppleMapKit?15:e.t0===u.Here?19:23;break;case 3:return e.next=5,this.geo.reverseNominatim(t,this.value);case 5:return this.value=e.sent,e.abrupt(\"break\",24);case 7:return e.next=9,this.geo.reverseMapbox(t,this.value);case 9:return this.value=e.sent,e.abrupt(\"break\",24);case 11:return e.next=13,this.geo.reverseGoogle(t,this.value);case 13:return this.value=e.sent,e.abrupt(\"break\",24);case 15:return e.next=17,this.geo.reverseApple(t,this.value);case 17:return this.value=e.sent,e.abrupt(\"break\",24);case 19:return e.next=21,this.geo.reverseHere(t,this.value);case 21:return this.value=e.sent,e.abrupt(\"break\",24);case 23:throw new Error(\"Unknown geo service: \"+this.config.geoService);case 24:case\"end\":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),onZoom:function(e){this.value.zoom=e},onPartChange:function(e){var t=e.name,a=e.value;if(\"fullAddress\"===t)this.value.address=a,this.fullAddressDirty=\"\"!==a;else if(\"lat\"===t||\"lng\"===t)this.value[t]=a;else if(this.value.parts[t]=a,\"\"===this.value.address||!this.fullAddressDirty){for(var n=[],r=Object.keys(this.value.parts),o=0,s=r.length;o<s;o++){var i=r[o];-1!==[\"number\",\"address\",\"city\",\"postcode\",\"county\",\"state\",\"country\"].indexOf(i)&&n.push(this.value.parts[i])}this.value.address=n.filter(Boolean).join(\", \")}},onClear:function(){this.value={address:\"\",zoom:15,lat:null,lng:null,parts:new d,what3words:null}}}},De=Ae,$e=a(\"2e97\");function Re(e){this[\"$style\"]=$e[\"default\"].locals||$e[\"default\"]}var ze=Object(L[\"a\"])(De,n,r,!1,Re,null,null),He=ze.exports,Ee={install:function(e){e.filter(\"t\",R),e.component(\"simple-map\",He)}};\"undefined\"!==typeof window&&window.Vue&&window.Vue.use(Ee)},\"6bca\":function(e,t,a){e.exports={grid:\"Address_grid_3Vxrg\",fade:\"Address_fade_1Khjf\",\"no-map\":\"Address_no-map_kB9Ag\",\"no-search\":\"Address_no-search_1JpdT\",right:\"Address_right_3dCTx\",full:\"Address_full_2Hoxx\",row:\"Address_row_3kuz9\",btn:\"Address_btn_2BSW6\",\"show-clear\":\"Address_show-clear_rAelt\",delete:\"Address_delete_gHZG0\"}},7857:function(e,t,a){e.exports={wrap:\"App_wrap_2esTH\",\"no-map\":\"App_no-map_2mvF1\",content:\"App_content_pIJBB\",mini:\"App_mini_RpxNW\",empty:\"App_empty_1A4ND\",noMap:\"App_noMap_Mu8tf\"}},9685:function(e,t,a){\"use strict\";var n=a(\"6bca\"),r=a.n(n);t[\"default\"]=r.a},\"9e21\":function(e,t,a){\"use strict\";var n=a(\"abcf\"),r=a.n(n);t[\"default\"]=r.a},abcf:function(e,t,a){e.exports={label:\"Label_label_GHq68\",name:\"Label_name_3Feow\"}},b4c0:function(e,t,a){e.exports={map:\"Map_map_2NpD9\",control:\"Map_control_3-EIS\"}},bfca:function(e,t,a){e.exports={input:\"Input_input_1qTm5\"}},f3c8:function(e,t,a){\"use strict\";var n=a(\"b4c0\"),r=a.n(n);t[\"default\"]=r.a}});\n//# sourceMappingURL=app.js.map\n"
  },
  {
    "path": "src/web/assets/map/js/chunk-vendors.js",
    "content": "(window[\"webpackJsonpEtherMaps\"]=window[\"webpackJsonpEtherMaps\"]||[]).push([[\"chunk-vendors\"],{\"013f\":function(t,e,n){\"use strict\";function i(t){if(void 0===t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return t}n.d(e,\"a\",function(){return i})},\"014b\":function(t,e,n){\"use strict\";var i=n(\"e53d\"),o=n(\"07e3\"),r=n(\"8e60\"),s=n(\"63b6\"),a=n(\"9138\"),u=n(\"ebfd\").KEY,h=n(\"294c\"),c=n(\"dbdb\"),l=n(\"45f2\"),f=n(\"62a0\"),d=n(\"5168\"),p=n(\"ccb9\"),_=n(\"6718\"),m=n(\"47ee\"),v=n(\"9003\"),g=n(\"e4ae\"),y=n(\"f772\"),b=n(\"241e\"),x=n(\"36c3\"),w=n(\"1bc3\"),L=n(\"aebd\"),P=n(\"a159\"),T=n(\"0395\"),S=n(\"bf0b\"),M=n(\"9aa9\"),C=n(\"d9f6\"),E=n(\"c3a1\"),O=S.f,z=C.f,I=T.f,k=i.Symbol,A=i.JSON,Z=A&&A.stringify,B=\"prototype\",j=d(\"_hidden\"),R=d(\"toPrimitive\"),N={}.propertyIsEnumerable,D=c(\"symbol-registry\"),F=c(\"symbols\"),W=c(\"op-symbols\"),H=Object[B],U=\"function\"==typeof k&&!!M.f,V=i.QObject,G=!V||!V[B]||!V[B].findChild,q=r&&h(function(){return 7!=P(z({},\"a\",{get:function(){return z(this,\"a\",{value:7}).a}})).a})?function(t,e,n){var i=O(H,e);i&&delete H[e],z(t,e,n),i&&t!==H&&z(H,e,i)}:z,K=function(t){var e=F[t]=P(k[B]);return e._k=t,e},$=U&&\"symbol\"==typeof k.iterator?function(t){return\"symbol\"==typeof t}:function(t){return t instanceof k},Y=function(t,e,n){return t===H&&Y(W,e,n),g(t),e=w(e,!0),g(n),o(F,e)?(n.enumerable?(o(t,j)&&t[j][e]&&(t[j][e]=!1),n=P(n,{enumerable:L(0,!1)})):(o(t,j)||z(t,j,L(1,{})),t[j][e]=!0),q(t,e,n)):z(t,e,n)},X=function(t,e){g(t);var n,i=m(e=x(e)),o=0,r=i.length;while(r>o)Y(t,n=i[o++],e[n]);return t},J=function(t,e){return void 0===e?P(t):X(P(t),e)},Q=function(t){var e=N.call(this,t=w(t,!0));return!(this===H&&o(F,t)&&!o(W,t))&&(!(e||!o(this,t)||!o(F,t)||o(this,j)&&this[j][t])||e)},tt=function(t,e){if(t=x(t),e=w(e,!0),t!==H||!o(F,e)||o(W,e)){var n=O(t,e);return!n||!o(F,e)||o(t,j)&&t[j][e]||(n.enumerable=!0),n}},et=function(t){var e,n=I(x(t)),i=[],r=0;while(n.length>r)o(F,e=n[r++])||e==j||e==u||i.push(e);return i},nt=function(t){var e,n=t===H,i=I(n?W:x(t)),r=[],s=0;while(i.length>s)!o(F,e=i[s++])||n&&!o(H,e)||r.push(F[e]);return r};U||(k=function(){if(this instanceof k)throw TypeError(\"Symbol is not a constructor!\");var t=f(arguments.length>0?arguments[0]:void 0),e=function(n){this===H&&e.call(W,n),o(this,j)&&o(this[j],t)&&(this[j][t]=!1),q(this,t,L(1,n))};return r&&G&&q(H,t,{configurable:!0,set:e}),K(t)},a(k[B],\"toString\",function(){return this._k}),S.f=tt,C.f=Y,n(\"6abf\").f=T.f=et,n(\"355d\").f=Q,M.f=nt,r&&!n(\"b8e3\")&&a(H,\"propertyIsEnumerable\",Q,!0),p.f=function(t){return K(d(t))}),s(s.G+s.W+s.F*!U,{Symbol:k});for(var it=\"hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables\".split(\",\"),ot=0;it.length>ot;)d(it[ot++]);for(var rt=E(d.store),st=0;rt.length>st;)_(rt[st++]);s(s.S+s.F*!U,\"Symbol\",{for:function(t){return o(D,t+=\"\")?D[t]:D[t]=k(t)},keyFor:function(t){if(!$(t))throw TypeError(t+\" is not a symbol!\");for(var e in D)if(D[e]===t)return e},useSetter:function(){G=!0},useSimple:function(){G=!1}}),s(s.S+s.F*!U,\"Object\",{create:J,defineProperty:Y,defineProperties:X,getOwnPropertyDescriptor:tt,getOwnPropertyNames:et,getOwnPropertySymbols:nt});var at=h(function(){M.f(1)});s(s.S+s.F*at,\"Object\",{getOwnPropertySymbols:function(t){return M.f(b(t))}}),A&&s(s.S+s.F*(!U||h(function(){var t=k();return\"[null]\"!=Z([t])||\"{}\"!=Z({a:t})||\"{}\"!=Z(Object(t))})),\"JSON\",{stringify:function(t){var e,n,i=[t],o=1;while(arguments.length>o)i.push(arguments[o++]);if(n=e=i[1],(y(e)||void 0!==t)&&!$(t))return v(e)||(e=function(t,e){if(\"function\"==typeof n&&(e=n.call(this,t,e)),!$(e))return e}),i[1]=e,Z.apply(A,i)}}),k[B][R]||n(\"35e8\")(k[B],R,k[B].valueOf),l(k,\"Symbol\"),l(Math,\"Math\",!0),l(i.JSON,\"JSON\",!0)},\"01f9\":function(t,e,n){\"use strict\";var i=n(\"2d00\"),o=n(\"5ca1\"),r=n(\"2aba\"),s=n(\"32e9\"),a=n(\"84f2\"),u=n(\"41a0\"),h=n(\"7f20\"),c=n(\"38fd\"),l=n(\"2b4c\")(\"iterator\"),f=!([].keys&&\"next\"in[].keys()),d=\"@@iterator\",p=\"keys\",_=\"values\",m=function(){return this};t.exports=function(t,e,n,v,g,y,b){u(n,e,v);var x,w,L,P=function(t){if(!f&&t in C)return C[t];switch(t){case p:return function(){return new n(this,t)};case _:return function(){return new n(this,t)}}return function(){return new n(this,t)}},T=e+\" Iterator\",S=g==_,M=!1,C=t.prototype,E=C[l]||C[d]||g&&C[g],O=E||P(g),z=g?S?P(\"entries\"):O:void 0,I=\"Array\"==e&&C.entries||E;if(I&&(L=c(I.call(new t)),L!==Object.prototype&&L.next&&(h(L,T,!0),i||\"function\"==typeof L[l]||s(L,l,m))),S&&E&&E.name!==_&&(M=!0,O=function(){return E.call(this)}),i&&!b||!f&&!M&&C[l]||s(C,l,O),a[e]=O,a[T]=m,g)if(x={values:S?O:P(_),keys:y?O:P(p),entries:z},b)for(w in x)w in C||r(C,w,x[w]);else o(o.P+o.F*(f||M),e,x);return x}},\"0293\":function(t,e,n){var i=n(\"241e\"),o=n(\"53e2\");n(\"ce7e\")(\"getPrototypeOf\",function(){return function(t){return o(i(t))}})},\"02f4\":function(t,e,n){var i=n(\"4588\"),o=n(\"be13\");t.exports=function(t){return function(e,n){var r,s,a=String(o(e)),u=i(n),h=a.length;return u<0||u>=h?t?\"\":void 0:(r=a.charCodeAt(u),r<55296||r>56319||u+1===h||(s=a.charCodeAt(u+1))<56320||s>57343?t?a.charAt(u):r:t?a.slice(u,u+2):s-56320+(r-55296<<10)+65536)}}},\"0390\":function(t,e,n){\"use strict\";var i=n(\"02f4\")(!0);t.exports=function(t,e,n){return e+(n?i(t,e).length:1)}},\"0395\":function(t,e,n){var i=n(\"36c3\"),o=n(\"6abf\").f,r={}.toString,s=\"object\"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return s.slice()}};t.exports.f=function(t){return s&&\"[object Window]\"==r.call(t)?a(t):o(i(t))}},\"061b\":function(t,e,n){t.exports=n(\"fa99\")},\"07e3\":function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},\"097d\":function(t,e,n){\"use strict\";var i=n(\"5ca1\"),o=n(\"8378\"),r=n(\"7726\"),s=n(\"ebd6\"),a=n(\"bcaa\");i(i.P+i.R,\"Promise\",{finally:function(t){var e=s(this,o.Promise||r.Promise),n=\"function\"==typeof t;return this.then(n?function(n){return a(e,t()).then(function(){return n})}:t,n?function(n){return a(e,t()).then(function(){throw n})}:t)}})},\"0bfb\":function(t,e,n){\"use strict\";var i=n(\"cb7c\");t.exports=function(){var t=i(this),e=\"\";return t.global&&(e+=\"g\"),t.ignoreCase&&(e+=\"i\"),t.multiline&&(e+=\"m\"),t.unicode&&(e+=\"u\"),t.sticky&&(e+=\"y\"),e}},\"0d58\":function(t,e,n){var i=n(\"ce10\"),o=n(\"e11e2\");t.exports=Object.keys||function(t){return i(t,o)}},\"0fc9\":function(t,e,n){var i=n(\"3a38\"),o=Math.max,r=Math.min;t.exports=function(t,e){return t=i(t),t<0?o(t+e,0):r(t,e)}},1173:function(t,e){t.exports=function(t,e,n,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(n+\": incorrect invocation!\");return t}},\"11e9\":function(t,e,n){var i=n(\"52a7\"),o=n(\"4630\"),r=n(\"6821\"),s=n(\"6a99\"),a=n(\"69a8\"),u=n(\"c69a\"),h=Object.getOwnPropertyDescriptor;e.f=n(\"9e1e\")?h:function(t,e){if(t=r(t),e=s(e,!0),u)try{return h(t,e)}catch(n){}if(a(t,e))return o(!i.f.call(t,e),t[e])}},1495:function(t,e,n){var i=n(\"86cc\"),o=n(\"cb7c\"),r=n(\"0d58\");t.exports=n(\"9e1e\")?Object.defineProperties:function(t,e){o(t);var n,s=r(e),a=s.length,u=0;while(a>u)i.f(t,n=s[u++],e[n]);return t}},1654:function(t,e,n){\"use strict\";var i=n(\"71c1\")(!0);n(\"30f1\")(String,\"String\",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})})},1691:function(t,e){t.exports=\"constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf\".split(\",\")},1991:function(t,e,n){var i,o,r,s=n(\"9b43\"),a=n(\"31f4\"),u=n(\"fab2\"),h=n(\"230e\"),c=n(\"7726\"),l=c.process,f=c.setImmediate,d=c.clearImmediate,p=c.MessageChannel,_=c.Dispatch,m=0,v={},g=\"onreadystatechange\",y=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},b=function(t){y.call(t.data)};f&&d||(f=function(t){var e=[],n=1;while(arguments.length>n)e.push(arguments[n++]);return v[++m]=function(){a(\"function\"==typeof t?t:Function(t),e)},i(m),m},d=function(t){delete v[t]},\"process\"==n(\"2d95\")(l)?i=function(t){l.nextTick(s(y,t,1))}:_&&_.now?i=function(t){_.now(s(y,t,1))}:p?(o=new p,r=o.port2,o.port1.onmessage=b,i=s(r.postMessage,r,1)):c.addEventListener&&\"function\"==typeof postMessage&&!c.importScripts?(i=function(t){c.postMessage(t+\"\",\"*\")},c.addEventListener(\"message\",b,!1)):i=g in h(\"script\")?function(t){u.appendChild(h(\"script\"))[g]=function(){u.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:f,clear:d}},\"1bc3\":function(t,e,n){var i=n(\"f772\");t.exports=function(t,e){if(!i(t))return t;var n,o;if(e&&\"function\"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;if(\"function\"==typeof(n=t.valueOf)&&!i(o=n.call(t)))return o;if(!e&&\"function\"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;throw TypeError(\"Can't convert object to primitive value\")}},\"1df8\":function(t,e,n){var i=n(\"63b6\");i(i.S,\"Object\",{setPrototypeOf:n(\"ead6\").set})},\"1ec9\":function(t,e,n){var i=n(\"f772\"),o=n(\"e53d\").document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.createElement(t):{}}},\"1fa8\":function(t,e,n){var i=n(\"cb7c\");t.exports=function(t,e,n,o){try{return o?e(i(n)[0],n[1]):e(n)}catch(s){var r=t[\"return\"];throw void 0!==r&&i(r.call(t)),s}}},\"214f\":function(t,e,n){\"use strict\";n(\"b0c5\");var i=n(\"2aba\"),o=n(\"32e9\"),r=n(\"79e5\"),s=n(\"be13\"),a=n(\"2b4c\"),u=n(\"520a\"),h=a(\"species\"),c=!r(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:\"7\"},t},\"7\"!==\"\".replace(t,\"$<a>\")}),l=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n=\"ab\".split(t);return 2===n.length&&\"a\"===n[0]&&\"b\"===n[1]}();t.exports=function(t,e,n){var f=a(t),d=!r(function(){var e={};return e[f]=function(){return 7},7!=\"\"[t](e)}),p=d?!r(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},\"split\"===t&&(n.constructor={},n.constructor[h]=function(){return n}),n[f](\"\"),!e}):void 0;if(!d||!p||\"replace\"===t&&!c||\"split\"===t&&!l){var _=/./[f],m=n(s,f,\"\"[t],function(t,e,n,i,o){return e.exec===u?d&&!o?{done:!0,value:_.call(e,n,i)}:{done:!0,value:t.call(n,e,i)}:{done:!1}}),v=m[0],g=m[1];i(String.prototype,t,v),o(RegExp.prototype,f,2==e?function(t,e){return g.call(t,this,e)}:function(t){return g.call(t,this)})}}},\"230e\":function(t,e,n){var i=n(\"d3f4\"),o=n(\"7726\").document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.createElement(t):{}}},\"23c6\":function(t,e,n){var i=n(\"2d95\"),o=n(\"2b4c\")(\"toStringTag\"),r=\"Arguments\"==i(function(){return arguments}()),s=function(t,e){try{return t[e]}catch(n){}};t.exports=function(t){var e,n,a;return void 0===t?\"Undefined\":null===t?\"Null\":\"string\"==typeof(n=s(e=Object(t),o))?n:r?i(e):\"Object\"==(a=i(e))&&\"function\"==typeof e.callee?\"Arguments\":a}},\"241e\":function(t,e,n){var i=n(\"25eb\");t.exports=function(t){return Object(i(t))}},\"24c5\":function(t,e,n){\"use strict\";var i,o,r,s,a=n(\"b8e3\"),u=n(\"e53d\"),h=n(\"d864\"),c=n(\"40c3\"),l=n(\"63b6\"),f=n(\"f772\"),d=n(\"79aa\"),p=n(\"1173\"),_=n(\"a22a\"),m=n(\"f201\"),v=n(\"4178\").set,g=n(\"aba2\")(),y=n(\"656e\"),b=n(\"4439\"),x=n(\"bc13\"),w=n(\"cd78\"),L=\"Promise\",P=u.TypeError,T=u.process,S=T&&T.versions,M=S&&S.v8||\"\",C=u[L],E=\"process\"==c(T),O=function(){},z=o=y.f,I=!!function(){try{var t=C.resolve(1),e=(t.constructor={})[n(\"5168\")(\"species\")]=function(t){t(O,O)};return(E||\"function\"==typeof PromiseRejectionEvent)&&t.then(O)instanceof e&&0!==M.indexOf(\"6.6\")&&-1===x.indexOf(\"Chrome/66\")}catch(i){}}(),k=function(t){var e;return!(!f(t)||\"function\"!=typeof(e=t.then))&&e},A=function(t,e){if(!t._n){t._n=!0;var n=t._c;g(function(){var i=t._v,o=1==t._s,r=0,s=function(e){var n,r,s,a=o?e.ok:e.fail,u=e.resolve,h=e.reject,c=e.domain;try{a?(o||(2==t._h&&j(t),t._h=1),!0===a?n=i:(c&&c.enter(),n=a(i),c&&(c.exit(),s=!0)),n===e.promise?h(P(\"Promise-chain cycle\")):(r=k(n))?r.call(n,u,h):u(n)):h(i)}catch(l){c&&!s&&c.exit(),h(l)}};while(n.length>r)s(n[r++]);t._c=[],t._n=!1,e&&!t._h&&Z(t)})}},Z=function(t){v.call(u,function(){var e,n,i,o=t._v,r=B(t);if(r&&(e=b(function(){E?T.emit(\"unhandledRejection\",o,t):(n=u.onunhandledrejection)?n({promise:t,reason:o}):(i=u.console)&&i.error&&i.error(\"Unhandled promise rejection\",o)}),t._h=E||B(t)?2:1),t._a=void 0,r&&e.e)throw e.v})},B=function(t){return 1!==t._h&&0===(t._a||t._c).length},j=function(t){v.call(u,function(){var e;E?T.emit(\"rejectionHandled\",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},R=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),A(e,!0))},N=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw P(\"Promise can't be resolved itself\");(e=k(t))?g(function(){var i={_w:n,_d:!1};try{e.call(t,h(N,i,1),h(R,i,1))}catch(o){R.call(i,o)}}):(n._v=t,n._s=1,A(n,!1))}catch(i){R.call({_w:n,_d:!1},i)}}};I||(C=function(t){p(this,C,L,\"_h\"),d(t),i.call(this);try{t(h(N,this,1),h(R,this,1))}catch(e){R.call(this,e)}},i=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(\"5c95\")(C.prototype,{then:function(t,e){var n=z(m(this,C));return n.ok=\"function\"!=typeof t||t,n.fail=\"function\"==typeof e&&e,n.domain=E?T.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&A(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),r=function(){var t=new i;this.promise=t,this.resolve=h(N,t,1),this.reject=h(R,t,1)},y.f=z=function(t){return t===C||t===s?new r(t):o(t)}),l(l.G+l.W+l.F*!I,{Promise:C}),n(\"45f2\")(C,L),n(\"4c95\")(L),s=n(\"584a\")[L],l(l.S+l.F*!I,L,{reject:function(t){var e=z(this),n=e.reject;return n(t),e.promise}}),l(l.S+l.F*(a||!I),L,{resolve:function(t){return w(a&&this===s?C:this,t)}}),l(l.S+l.F*!(I&&n(\"4ee1\")(function(t){C.all(t)[\"catch\"](O)})),L,{all:function(t){var e=this,n=z(e),i=n.resolve,o=n.reject,r=b(function(){var n=[],r=0,s=1;_(t,!1,function(t){var a=r++,u=!1;n.push(void 0),s++,e.resolve(t).then(function(t){u||(u=!0,n[a]=t,--s||i(n))},o)}),--s||i(n)});return r.e&&o(r.v),n.promise},race:function(t){var e=this,n=z(e),i=n.reject,o=b(function(){_(t,!1,function(t){e.resolve(t).then(n.resolve,i)})});return o.e&&i(o.v),n.promise}})},\"25b0\":function(t,e,n){n(\"1df8\"),t.exports=n(\"584a\").Object.setPrototypeOf},\"25eb\":function(t,e){t.exports=function(t){if(void 0==t)throw TypeError(\"Can't call method on  \"+t);return t}},2621:function(t,e){e.f=Object.getOwnPropertySymbols},\"27ee\":function(t,e,n){var i=n(\"23c6\"),o=n(\"2b4c\")(\"iterator\"),r=n(\"84f2\");t.exports=n(\"8378\").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t[\"@@iterator\"]||r[i(t)]}},2831:function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return u});var i={name:\"default-section\",props:{section:{type:Object,required:!0},currentIndex:{type:[Number,String],required:!1,default:1/0},renderSuggestion:{type:Function,required:!1},normalizeItemFunction:{type:Function,required:!0}},data:function(){return{_currentIndex:null}},computed:{list:function(){var t=this.section,e=t.limit,n=t.data;return n.length<e&&(e=n.length),n.slice(0,e)}},methods:{getItemIndex:function(t){return this.section.start_index+t},getItemByIndex:function(t){return this.section.data[t]},onMouseEnter:function(t){var e=t.currentTarget.getAttribute(\"data-suggestion-index\");this._currentIndex=e,this.$emit(\"updateCurrentIndex\",e)},onMouseLeave:function(){this.$emit(\"updateCurrentIndex\",null)}},render:function(t){var e=this,n={beforeSection:this.$scopedSlots[\"before-section-\"+this.section.name],afterSectionDefault:this.$scopedSlots[\"after-section\"],afterSectionNamed:this.$scopedSlots[\"after-section-\"+this.section.name]},i=\"autosuggest__results-before autosuggest__results-before--\"+this.section.name,o=n.beforeSection&&n.beforeSection({section:this.section,className:i})||[];return t(\"ul\",{attrs:{role:\"listbox\",\"aria-labelledby\":\"autosuggest\"}},[o[0]&&o[0]||this.section.label&&t(\"li\",{class:i},this.section.label)||\"\",this.list.map(function(n,i){var o=e.normalizeItemFunction(e.section.name,e.section.type,e.section.label,n);return t(\"li\",{attrs:{role:\"option\",\"data-suggestion-index\":e.getItemIndex(i),\"data-section-name\":e.section.name,id:\"autosuggest__results-item--\"+e.getItemIndex(i)},key:e.getItemIndex(i),class:{\"autosuggest__results-item--highlighted\":e.getItemIndex(i)==e._currentIndex,\"autosuggest__results-item\":!0},on:{mouseenter:e.onMouseEnter,mouseleave:e.onMouseLeave}},[e.renderSuggestion?e.renderSuggestion(o):e.$scopedSlots.default&&e.$scopedSlots.default({_key:i,suggestion:o})])}),n.afterSectionDefault&&n.afterSectionDefault({section:this.section,className:\"autosuggest__results-after autosuggest__results-after--\"+this.section.name}),n.afterSectionNamed&&n.afterSectionNamed({section:this.section,className:\"autosuggest__results_after autosuggest__results-after--\"+this.section.name})])}};function o(t,e){return!!t.className.match(new RegExp(\"(\\\\s|^)\"+e+\"(\\\\s|$)\"))}function r(t,e){o(t,e)||(t.className+=\" \"+e)}function s(t,e){t.classList&&t.classList.remove(e)}var a={name:\"default\",type:\"default-section\"},u={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(\"div\",{attrs:{id:t.componentAttrIdAutosuggest}},[t._t(\"before-input\"),n(\"input\",t._g(t._b({class:[t.isOpen?\"autosuggest__input--open\":\"\",t.internal_inputProps.class],attrs:{type:t.internal_inputProps.type,autocomplete:t.internal_inputProps.autocomplete,role:\"combobox\",\"aria-autocomplete\":\"list\",\"aria-owns\":\"autosuggest__results\",\"aria-activedescendant\":t.isOpen&&null!==t.currentIndex?\"autosuggest__results-item--\"+t.currentIndex:\"\",\"aria-haspopup\":t.isOpen?\"true\":\"false\",\"aria-expanded\":t.isOpen?\"true\":\"false\"},domProps:{value:t.internalValue},on:{input:t.inputHandler,keydown:t.handleKeyStroke}},\"input\",t.internal_inputProps,!1),t.listeners)),t._t(\"after-input\"),t._v(\" \"),n(\"div\",{class:t.componentAttrClassAutosuggestResultsContainer},[t.isOpen?n(\"div\",{class:t.componentAttrClassAutosuggestResults,attrs:{\"aria-labelledby\":t.componentAttrIdAutosuggest}},[t._t(\"before-suggestions\"),t._v(\" \"),t._l(t.computedSections,function(e,i){return n(e.type,{key:t.getSectionRef(i),ref:t.getSectionRef(i),refInFor:!0,tag:\"component\",attrs:{\"current-index\":t.currentIndex,\"normalize-item-function\":t.normalizeItem,\"render-suggestion\":t.renderSuggestion,section:e},on:{updateCurrentIndex:t.updateCurrentIndex},scopedSlots:t._u([{key:\"before-section-\"+(e.name||e.label),fn:function(n){var i=n.section,o=n.className;return[t._t(\"before-section-\"+(e.name||e.label),null,{section:i,className:o})]}},{key:\"default\",fn:function(e){var n=e.suggestion,i=e._key;return[t._t(\"default\",[t._v(\" \"+t._s(n.item)+\" \")],{suggestion:n,index:i})]}},{key:\"after-section-\"+(e.name||e.label),fn:function(n){var i=n.section;return[t._t(\"after-section-\"+(e.name||e.label),null,{section:i})]}},{key:\"after-section\",fn:function(e){var n=e.section;return[t._t(\"after-section\",null,{section:n})]}}])})}),t._v(\" \"),t._t(\"after-suggestions\")],2):t._e()])],2)},staticRenderFns:[],name:\"Autosuggest\",components:{DefaultSection:i},props:{value:{type:String,default:null},inputProps:{type:Object,required:!0},limit:{type:Number,required:!1,default:1/0},suggestions:{type:Array,required:!0},renderSuggestion:{type:Function,required:!1,default:null},getSuggestionValue:{type:Function,required:!1,default:function(t){var e=t.item;return\"object\"==typeof e&&e.hasOwnProperty(\"name\")?e.name:e}},shouldRenderSuggestions:{type:Function,required:!1,default:function(t,e){return t>0&&!e}},sectionConfigs:{type:Object,required:!1,default:function(){return{default:{onSelected:null}}}},onSelected:{type:Function,required:!1,default:null},componentAttrIdAutosuggest:{type:String,required:!1,default:\"autosuggest\"},componentAttrClassAutosuggestResultsContainer:{type:String,required:!1,default:\"autosuggest__results-container\"},componentAttrClassAutosuggestResults:{type:String,required:!1,default:\"autosuggest__results\"}},data:function(){return{internalValue:null,searchInputOriginal:null,currentIndex:null,currentItem:null,loading:!1,didSelectFromOptions:!1,internal_inputProps:{},defaultInputProps:{type:\"text\",autocomplete:\"off\"},clientXMouseDownInitial:null}},computed:{listeners:function(){var t=this;return Object.assign({},this.$listeners,{input:function(t){},click:function(){t.loading=!1,t.$listeners.click&&t.$listeners.click(t.currentItem),t.ensureItemVisible(t.currentItem,t.currentIndex)},selected:function(){t.currentItem&&t.sectionConfigs[t.currentItem.name]&&t.sectionConfigs[t.currentItem.name].onSelected?t.sectionConfigs[t.currentItem.name].onSelected(t.currentItem,t.searchInputOriginal):t.sectionConfigs.default.onSelected?t.sectionConfigs.default.onSelected(null,t.searchInputOriginal):t.$listeners.selected&&t.$emit(\"selected\",t.currentItem),t.setChangeItem(null)}})},isOpen:function(){return this.shouldRenderSuggestions(this.totalResults,this.loading)},computedSections:function(){var t=this,e=0;return this.suggestions.map(function(n){if(n.data){var i,o,r=n.name?n.name:a.name,s=null;t.sectionConfigs[r]&&(i=t.sectionConfigs[r].limit,s=t.sectionConfigs[r].type,o=t.sectionConfigs[r].label),s=s||a.type,i=(i=i||t.limit)||1/0,i=n.data.length<i?n.data.length:i;var u={name:r,label:o=o||n.label,type:s,limit:i,data:n.data,start_index:e,end_index:e+i-1};return e+=i,u}})},totalResults:function(){return this.computedSections.reduce(function(t,e){var n=e.limit,i=e.data;return t+(i.length>=n?n:i.length)},0)}},watch:{value:{handler:function(t){this.internalValue=t},immediate:!0}},created:function(){this.internal_inputProps=Object.assign({},this.defaultInputProps,this.inputProps),this.loading=!0},mounted:function(){document.addEventListener(\"mouseup\",this.onDocumentMouseUp),document.addEventListener(\"mousedown\",this.onDocumentMouseDown)},beforeDestroy:function(){document.removeEventListener(\"mouseup\",this.onDocumentMouseUp),document.removeEventListener(\"mousedown\",this.onDocumentMouseDown)},methods:{inputHandler:function(t){var e=t.target.value;this.$emit(\"input\",e),this.internalValue=e,this.didSelectFromOptions||(this.searchInputOriginal=e,this.currentIndex=null)},getSectionRef:function(t){return\"computed_section_\"+t},getItemByIndex:function(t){var e=!1;if(null===t)return e;for(var n=0;n<this.computedSections.length;n++)if(t>=this.computedSections[n].start_index&&t<=this.computedSections[n].end_index){var i=t-this.computedSections[n].start_index,o=this.$refs[\"computed_section_\"+n][0];if(o){e=this.normalizeItem(this.computedSections[n].name,this.computedSections[n].type,o.section.label,o.getItemByIndex(i));break}}return e},handleKeyStroke:function(t){var e=t.keyCode;if(!([16,9,18,91,93].indexOf(e)>-1))switch(this.loading=!1,this.didSelectFromOptions=!1,e){case 40:case 38:if(t.preventDefault(),this.isOpen){if(38===e&&null===this.currentIndex)break;var n=40===e?1:-1,i=parseInt(this.currentIndex)+n;this.setCurrentIndex(i,this.totalResults),this.didSelectFromOptions=!0,this.totalResults>0&&this.currentIndex>=0?(this.setChangeItem(this.getItemByIndex(this.currentIndex)),this.didSelectFromOptions=!0):-1==this.currentIndex&&(this.currentIndex=null,this.internalValue=this.searchInputOriginal,t.preventDefault())}break;case 13:t.preventDefault(),this.totalResults>0&&this.currentIndex>=0&&(this.setChangeItem(this.getItemByIndex(this.currentIndex),!0),this.didSelectFromOptions=!0),this.loading=!0,this.listeners.selected(this.didSelectFromOptions);break;case 27:this.isOpen&&(this.loading=!0,this.currentIndex=null,this.internalValue=this.searchInputOriginal,this.$emit(\"input\",this.searchInputOriginal),t.preventDefault())}},setChangeItem:function(t,e){if(void 0===e&&(e=!1),null!==this.currentIndex&&t){if(t){this.currentItem=t;var n=this.getSuggestionValue(t);this.internalValue=n,e&&(this.searchInputOriginal=n),this.ensureItemVisible(t,this.currentIndex)}}else this.currentItem=null},normalizeItem:function(t,e,n,i){return{name:t,type:e,label:n,item:i}},ensureItemVisible:function(t,e){var n=this.$el.querySelector(\".\"+this.componentAttrClassAutosuggestResults);if(t&&(e||0===e)&&n){var i=this.$el.querySelector(\"#autosuggest__results-item--\"+e);if(i){var o=n.clientHeight,r=n.scrollTop,s=i.clientHeight,a=i.offsetTop;s+a>=r+o?n.scrollTop=s+a-o:a<r&&r>0&&(n.scrollTop=a)}}},updateCurrentIndex:function(t){this.setCurrentIndex(t,-1,!0)},clickedOnScrollbar:function(t,e){var n=this.$el.querySelector(\".\"+this.componentAttrClassAutosuggestResults),i=n&&n.clientWidth<=e+17&&e+17<=n.clientWidth+34;return\"DIV\"===t.target.tagName&&n&&i||!1},onDocumentMouseDown:function(t){var e=t.target.getBoundingClientRect?t.target.getBoundingClientRect():0;this.clientXMouseDownInitial=t.clientX-e.left},onDocumentMouseUp:function(t){if(!this.$el.contains(t.target))return this.loading=!0,void(this.currentIndex=null);\"INPUT\"===t.target.tagName||this.clickedOnScrollbar(t,this.clientXMouseDownInitial)||(this.loading=!0,this.didSelectFromOptions=!0,this.setChangeItem(this.getItemByIndex(this.currentIndex),!0),this.listeners.selected(!0))},setCurrentIndex:function(t,e,n){void 0===e&&(e=-1),void 0===n&&(n=!1);var i=t;n||(null===this.currentIndex||t>=e)&&(i=0),this.currentIndex=i;var o=this.$el.querySelector(\"#autosuggest__results-item--\"+this.currentIndex),a=\"autosuggest__results-item--highlighted\";this.$el.querySelector(\".\"+a)&&s(this.$el.querySelector(\".\"+a),a),o&&r(o,a)}}},h={install:function(t){t.component(\"vue-autosuggest-default-section\",i),t.component(\"vue-autosuggest\",u)}};\"undefined\"!=typeof window&&window.Vue&&window.Vue.use(h)},2877:function(t,e,n){\"use strict\";function i(t,e,n,i,o,r,s,a){var u,h=\"function\"===typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=n,h._compiled=!0),i&&(h.functional=!0),r&&(h._scopeId=\"data-v-\"+r),s?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||\"undefined\"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},h._ssrRegister=u):o&&(u=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),u)if(h.functional){h._injectStyles=u;var c=h.render;h.render=function(t,e){return u.call(e),c(t,e)}}else{var l=h.beforeCreate;h.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:h}}n.d(e,\"a\",function(){return i})},\"28a5\":function(t,e,n){\"use strict\";var i=n(\"aae3\"),o=n(\"cb7c\"),r=n(\"ebd6\"),s=n(\"0390\"),a=n(\"9def\"),u=n(\"5f1b\"),h=n(\"520a\"),c=n(\"79e5\"),l=Math.min,f=[].push,d=\"split\",p=\"length\",_=\"lastIndex\",m=4294967295,v=!c(function(){RegExp(m,\"y\")});n(\"214f\")(\"split\",2,function(t,e,n,c){var g;return g=\"c\"==\"abbc\"[d](/(b)*/)[1]||4!=\"test\"[d](/(?:)/,-1)[p]||2!=\"ab\"[d](/(?:ab)*/)[p]||4!=\".\"[d](/(.?)(.?)/)[p]||\".\"[d](/()()/)[p]>1||\"\"[d](/.?/)[p]?function(t,e){var o=String(this);if(void 0===t&&0===e)return[];if(!i(t))return n.call(o,t,e);var r,s,a,u=[],c=(t.ignoreCase?\"i\":\"\")+(t.multiline?\"m\":\"\")+(t.unicode?\"u\":\"\")+(t.sticky?\"y\":\"\"),l=0,d=void 0===e?m:e>>>0,v=new RegExp(t.source,c+\"g\");while(r=h.call(v,o)){if(s=v[_],s>l&&(u.push(o.slice(l,r.index)),r[p]>1&&r.index<o[p]&&f.apply(u,r.slice(1)),a=r[0][p],l=s,u[p]>=d))break;v[_]===r.index&&v[_]++}return l===o[p]?!a&&v.test(\"\")||u.push(\"\"):u.push(o.slice(l)),u[p]>d?u.slice(0,d):u}:\"0\"[d](void 0,0)[p]?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,i){var o=t(this),r=void 0==n?void 0:n[e];return void 0!==r?r.call(n,o,i):g.call(String(o),n,i)},function(t,e){var i=c(g,t,this,e,g!==n);if(i.done)return i.value;var h=o(t),f=String(this),d=r(h,RegExp),p=h.unicode,_=(h.ignoreCase?\"i\":\"\")+(h.multiline?\"m\":\"\")+(h.unicode?\"u\":\"\")+(v?\"y\":\"g\"),y=new d(v?h:\"^(?:\"+h.source+\")\",_),b=void 0===e?m:e>>>0;if(0===b)return[];if(0===f.length)return null===u(y,f)?[f]:[];var x=0,w=0,L=[];while(w<f.length){y.lastIndex=v?w:0;var P,T=u(y,v?f:f.slice(w));if(null===T||(P=l(a(y.lastIndex+(v?0:w)),f.length))===x)w=s(f,w,p);else{if(L.push(f.slice(x,w)),L.length===b)return L;for(var S=1;S<=T.length-1;S++)if(L.push(T[S]),L.length===b)return L;w=x=P}}return L.push(f.slice(x)),L}]})},\"294c\":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},\"2aba\":function(t,e,n){var i=n(\"7726\"),o=n(\"32e9\"),r=n(\"69a8\"),s=n(\"ca5a\")(\"src\"),a=n(\"fa5b\"),u=\"toString\",h=(\"\"+a).split(u);n(\"8378\").inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var u=\"function\"==typeof n;u&&(r(n,\"name\")||o(n,\"name\",e)),t[e]!==n&&(u&&(r(n,s)||o(n,s,t[e]?\"\"+t[e]:h.join(String(e)))),t===i?t[e]=n:a?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,u,function(){return\"function\"==typeof this&&this[s]||a.call(this)})},\"2acb\":function(t,e){L.GridLayer.GoogleMutant=L.GridLayer.extend({options:{minZoom:0,maxZoom:23,tileSize:256,subdomains:\"abc\",errorTileUrl:\"\",attribution:\"\",opacity:1,continuousWorld:!1,noWrap:!1,type:\"roadmap\",maxNativeZoom:21},initialize:function(t){L.GridLayer.prototype.initialize.call(this,t),this._ready=!!window.google&&!!window.google.maps&&!!window.google.maps.Map,this._GAPIPromise=this._ready?Promise.resolve(window.google):new Promise(function(t,e){var n=0,i=null;i=setInterval(function(){return n>=10?(clearInterval(i),e(new Error(\"window.google not found after 10 attempts\"))):window.google&&window.google.maps&&window.google.maps.Map?(clearInterval(i),t(window.google)):void n++},500)}),this._tileCallbacks={},this._freshTiles={},this._imagesPerTile=\"hybrid\"===this.options.type?2:1,this._boundOnMutatedImage=this._onMutatedImage.bind(this)},onAdd:function(t){L.GridLayer.prototype.onAdd.call(this,t),this._initMutantContainer(),this._GAPIPromise.then(function(){if(this._ready=!0,this._map=t,this._initMutant(),t.on(\"viewreset\",this._reset,this),this.options.updateWhenIdle?t.on(\"moveend\",this._update,this):t.on(\"move\",this._update,this),t.on(\"zoomend\",this._handleZoomAnim,this),t.on(\"resize\",this._resize,this),google.maps.event.addListenerOnce(this._mutant,\"idle\",function(){this._checkZoomLevels(),this._mutantIsReady=!0}.bind(this)),t._controlCorners.bottomright.style.marginBottom=\"20px\",t._controlCorners.bottomleft.style.marginBottom=\"20px\",this._reset(),this._update(),this._subLayers)for(var e in this._subLayers)this._subLayers[e].setMap(this._mutant)}.bind(this))},onRemove:function(t){L.GridLayer.prototype.onRemove.call(this,t),this._observer.disconnect(),t._container.removeChild(this._mutantContainer),google.maps.event.clearListeners(t,\"idle\"),google.maps.event.clearListeners(this._mutant,\"idle\"),t.off(\"viewreset\",this._reset,this),t.off(\"move\",this._update,this),t.off(\"moveend\",this._update,this),t.off(\"zoomend\",this._handleZoomAnim,this),t.off(\"resize\",this._resize,this),t._controlCorners&&(t._controlCorners.bottomright.style.marginBottom=\"0em\",t._controlCorners.bottomleft.style.marginBottom=\"0em\")},getAttribution:function(){return this.options.attribution},setElementSize:function(t,e){t.style.width=e.x+\"px\",t.style.height=e.y+\"px\"},addGoogleLayer:function(t,e){return this._subLayers||(this._subLayers={}),this._GAPIPromise.then(function(){var n=google.maps[t],i=new n(e);return i.setMap(this._mutant),this._subLayers[t]=i,i}.bind(this))},removeGoogleLayer:function(t){var e=this._subLayers&&this._subLayers[t];e&&(e.setMap(null),delete this._subLayers[t])},_initMutantContainer:function(){this._mutantContainer||(this._mutantContainer=L.DomUtil.create(\"div\",\"leaflet-google-mutant leaflet-top leaflet-left\"),this._mutantContainer.id=\"_MutantContainer_\"+L.Util.stamp(this._mutantContainer),this._mutantContainer.style.zIndex=\"800\",this._mutantContainer.style.pointerEvents=\"none\",L.DomEvent.off(this._mutantContainer)),this._map.getContainer().appendChild(this._mutantContainer),this.setOpacity(this.options.opacity),this.setElementSize(this._mutantContainer,this._map.getSize()),this._attachObserver(this._mutantContainer)},_initMutant:function(){if(this._ready&&this._mutantContainer)if(this._mutant)this._resize();else{this._mutantCenter=new google.maps.LatLng(0,0);var t=new google.maps.Map(this._mutantContainer,{center:this._mutantCenter,zoom:0,tilt:0,mapTypeId:this.options.type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1,styles:this.options.styles||{},backgroundColor:\"transparent\"});this._mutant=t,google.maps.event.addListenerOnce(t,\"idle\",function(){for(var t=this._mutantContainer.querySelectorAll(\"a\"),e=0;e<t.length;e++)t[e].style.pointerEvents=\"auto\"}.bind(this)),this.fire(\"spawned\",{mapObject:t})}},_attachObserver:function(t){this._observer||(this._observer=new MutationObserver(this._onMutations.bind(this))),this._observer.observe(t,{childList:!0,subtree:!0}),Array.prototype.forEach.call(t.querySelectorAll(\"img\"),this._boundOnMutatedImage)},_onMutations:function(t){for(var e=0;e<t.length;++e)for(var n=t[e],i=0;i<n.addedNodes.length;++i){var o=n.addedNodes[i];o instanceof HTMLImageElement?this._onMutatedImage(o):o instanceof HTMLElement&&(Array.prototype.forEach.call(o.querySelectorAll(\"img\"),this._boundOnMutatedImage),\"white\"===o.style.backgroundColor&&L.DomUtil.remove(o),0===o.textContent.indexOf(\"For development purposes only\")&&L.DomUtil.remove(o),Array.prototype.forEach.call(o.querySelectorAll('div[draggable=false][style*=\"text-align: center\"]'),L.DomUtil.remove))}},_roadRegexp:/!1i(\\d+)!2i(\\d+)!3i(\\d+)!/,_satRegexp:/x=(\\d+)&y=(\\d+)&z=(\\d+)/,_staticRegExp:/StaticMapService\\.GetMapImage/,_onMutatedImage:function(t){var e,n=t.src.match(this._roadRegexp),i=0;if(n?(e={z:n[1],x:n[2],y:n[3]},this._imagesPerTile>1&&(t.style.zIndex=1,i=1)):(n=t.src.match(this._satRegexp),n&&(e={x:n[1],y:n[2],z:n[3]}),i=0),e){var o=this._tileCoordsToKey(e);t.style.position=\"absolute\",t.style.visibility=\"hidden\";var r=o+\"/\"+i;if(this._freshTiles[r]=t,r in this._tileCallbacks&&this._tileCallbacks[r])this._tileCallbacks[r].pop()(t),this._tileCallbacks[r].length||delete this._tileCallbacks[r];else if(this._tiles[o]){var s=this._tiles[o].el,a=0===i?s.firstChild:s.firstChild.nextSibling,u=this._clone(t);s.replaceChild(u,a)}}else t.src.match(this._staticRegExp)&&(t.style.visibility=\"hidden\")},createTile:function(t,e){var n=this._tileCoordsToKey(t),i=L.DomUtil.create(\"div\");i.dataset.pending=this._imagesPerTile,e=e.bind(this,null,i);for(var o=0;o<this._imagesPerTile;o++){var r=n+\"/\"+o;if(r in this._freshTiles){var s=this._freshTiles[r];i.appendChild(this._clone(s)),i.dataset.pending--}else this._tileCallbacks[r]=this._tileCallbacks[r]||[],this._tileCallbacks[r].push(function(t){return function(n){t.appendChild(this._clone(n)),t.dataset.pending--,parseInt(t.dataset.pending)||e()}.bind(this)}.bind(this)(i))}return parseInt(i.dataset.pending)||L.Util.requestAnimFrame(e),i},_clone:function(t){var e=t.cloneNode(!0);return e.style.visibility=\"visible\",e},_checkZoomLevels:function(){var t=this._map.getZoom(),e=this._mutant.getZoom();t&&e&&(e!==t||e>this.options.maxNativeZoom)&&this._setMaxNativeZoom(e)},_setMaxNativeZoom:function(t){t!=this.options.maxNativeZoom&&(this.options.maxNativeZoom=t,this._resetView())},_reset:function(){this._initContainer()},_update:function(){if(this._mutant){var t=this._map.getCenter(),e=new google.maps.LatLng(t.lat,t.lng);this._mutant.setCenter(e);var n=this._map.getZoom(),i=n!==Math.round(n),o=this._mutant.getZoom();i||n==o||(this._mutant.setZoom(n),this._mutantIsReady&&this._checkZoomLevels())}L.GridLayer.prototype._update.call(this)},_resize:function(){var t=this._map.getSize();this._mutantContainer.style.width===t.x&&this._mutantContainer.style.height===t.y||(this.setElementSize(this._mutantContainer,t),this._mutant&&google.maps.event.trigger(this._mutant,\"resize\"))},_handleZoomAnim:function(){if(this._mutant){var t=this._map.getCenter(),e=new google.maps.LatLng(t.lat,t.lng);this._mutant.setCenter(e),this._mutant.setZoom(Math.round(this._map.getZoom()))}},_removeTile:function(t){if(this._mutant)return setTimeout(this._pruneTile.bind(this,t),1e3),L.GridLayer.prototype._removeTile.call(this,t)},_pruneTile:function(t){for(var e=this._mutant.getZoom(),n=t.split(\":\")[2],i=this._mutant.getBounds(),o=i.getSouthWest(),r=i.getNorthEast(),s=L.latLngBounds([[o.lat(),o.lng()],[r.lat(),r.lng()]]),a=0;a<this._imagesPerTile;a++){var u=t+\"/\"+a;if(u in this._freshTiles){var h=this._map&&this._keyToBounds(t),c=this._map&&h.overlaps(s)&&n==e;c||delete this._freshTiles[u]}}}}),L.gridLayer.googleMutant=function(t){return new L.GridLayer.GoogleMutant(t)}},\"2aeb\":function(t,e,n){var i=n(\"cb7c\"),o=n(\"1495\"),r=n(\"e11e2\"),s=n(\"613b\")(\"IE_PROTO\"),a=function(){},u=\"prototype\",h=function(){var t,e=n(\"230e\")(\"iframe\"),i=r.length,o=\"<\",s=\">\";e.style.display=\"none\",n(\"fab2\").appendChild(e),e.src=\"javascript:\",t=e.contentWindow.document,t.open(),t.write(o+\"script\"+s+\"document.F=Object\"+o+\"/script\"+s),t.close(),h=t.F;while(i--)delete h[u][r[i]];return h()};t.exports=Object.create||function(t,e){var n;return null!==t?(a[u]=i(t),n=new a,a[u]=null,n[s]=t):n=h(),void 0===e?n:o(n,e)}},\"2b4c\":function(t,e,n){var i=n(\"5537\")(\"wks\"),o=n(\"ca5a\"),r=n(\"7726\").Symbol,s=\"function\"==typeof r,a=t.exports=function(t){return i[t]||(i[t]=s&&r[t]||(s?r:o)(\"Symbol.\"+t))};a.store=i},\"2d00\":function(t,e){t.exports=!1},\"2d95\":function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},3024:function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},\"308d\":function(t,e,n){\"use strict\";var i=n(\"5d58\"),o=n.n(i),r=n(\"67bb\"),s=n.n(r);function a(t){return a=\"function\"===typeof s.a&&\"symbol\"===typeof o.a?function(t){return typeof t}:function(t){return t&&\"function\"===typeof s.a&&t.constructor===s.a&&t!==s.a.prototype?\"symbol\":typeof t},a(t)}function u(t){return u=\"function\"===typeof s.a&&\"symbol\"===a(o.a)?function(t){return a(t)}:function(t){return t&&\"function\"===typeof s.a&&t.constructor===s.a&&t!==s.a.prototype?\"symbol\":a(t)},u(t)}var h=n(\"013f\");function c(t,e){return!e||\"object\"!==u(e)&&\"function\"!==typeof e?Object(h[\"a\"])(t):e}n.d(e,\"a\",function(){return c})},\"30f1\":function(t,e,n){\"use strict\";var i=n(\"b8e3\"),o=n(\"63b6\"),r=n(\"9138\"),s=n(\"35e8\"),a=n(\"481b\"),u=n(\"8f60\"),h=n(\"45f2\"),c=n(\"53e2\"),l=n(\"5168\")(\"iterator\"),f=!([].keys&&\"next\"in[].keys()),d=\"@@iterator\",p=\"keys\",_=\"values\",m=function(){return this};t.exports=function(t,e,n,v,g,y,b){u(n,e,v);var x,w,L,P=function(t){if(!f&&t in C)return C[t];switch(t){case p:return function(){return new n(this,t)};case _:return function(){return new n(this,t)}}return function(){return new n(this,t)}},T=e+\" Iterator\",S=g==_,M=!1,C=t.prototype,E=C[l]||C[d]||g&&C[g],O=E||P(g),z=g?S?P(\"entries\"):O:void 0,I=\"Array\"==e&&C.entries||E;if(I&&(L=c(I.call(new t)),L!==Object.prototype&&L.next&&(h(L,T,!0),i||\"function\"==typeof L[l]||s(L,l,m))),S&&E&&E.name!==_&&(M=!0,O=function(){return E.call(this)}),i&&!b||!f&&!M&&C[l]||s(C,l,O),a[e]=O,a[T]=m,g)if(x={values:S?O:P(_),keys:y?O:P(p),entries:z},b)for(w in x)w in C||r(C,w,x[w]);else o(o.P+o.F*(f||M),e,x);return x}},\"31f4\":function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},\"32e9\":function(t,e,n){var i=n(\"86cc\"),o=n(\"4630\");t.exports=n(\"9e1e\")?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},\"32fc\":function(t,e,n){var i=n(\"e53d\").document;t.exports=i&&i.documentElement},\"335c\":function(t,e,n){var i=n(\"6b4c\");t.exports=Object(\"z\").propertyIsEnumerable(0)?Object:function(t){return\"String\"==i(t)?t.split(\"\"):Object(t)}},\"33a4\":function(t,e,n){var i=n(\"84f2\"),o=n(\"2b4c\")(\"iterator\"),r=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||r[o]===t)}},\"355d\":function(t,e){e.f={}.propertyIsEnumerable},\"35e8\":function(t,e,n){var i=n(\"d9f6\"),o=n(\"aebd\");t.exports=n(\"8e60\")?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},\"36c3\":function(t,e,n){var i=n(\"335c\"),o=n(\"25eb\");t.exports=function(t){return i(o(t))}},3702:function(t,e,n){var i=n(\"481b\"),o=n(\"5168\")(\"iterator\"),r=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||r[o]===t)}},3846:function(t,e,n){n(\"9e1e\")&&\"g\"!=/./g.flags&&n(\"86cc\").f(RegExp.prototype,\"flags\",{configurable:!0,get:n(\"0bfb\")})},\"386d\":function(t,e,n){\"use strict\";var i=n(\"cb7c\"),o=n(\"83a1\"),r=n(\"5f1b\");n(\"214f\")(\"search\",1,function(t,e,n,s){return[function(n){var i=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,i):new RegExp(n)[e](String(i))},function(t){var e=s(n,t,this);if(e.done)return e.value;var a=i(t),u=String(this),h=a.lastIndex;o(h,0)||(a.lastIndex=0);var c=r(a,u);return o(a.lastIndex,h)||(a.lastIndex=h),null===c?-1:c.index}]})},\"38fd\":function(t,e,n){var i=n(\"69a8\"),o=n(\"4bf8\"),r=n(\"613b\")(\"IE_PROTO\"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),i(t,r)?t[r]:\"function\"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},\"3a38\":function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},\"3b8d\":function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return s});var i=n(\"795b\"),o=n.n(i);function r(t,e,n,i,r,s,a){try{var u=t[s](a),h=u.value}catch(c){return void n(c)}u.done?e(h):o.a.resolve(h).then(i,r)}function s(t){return function(){var e=this,n=arguments;return new o.a(function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,u,\"next\",t)}function u(t){r(s,i,o,a,u,\"throw\",t)}a(void 0)})}}},\"3c11\":function(t,e,n){\"use strict\";var i=n(\"63b6\"),o=n(\"584a\"),r=n(\"e53d\"),s=n(\"f201\"),a=n(\"cd78\");i(i.P+i.R,\"Promise\",{finally:function(t){var e=s(this,o.Promise||r.Promise),n=\"function\"==typeof t;return this.then(n?function(n){return a(e,t()).then(function(){return n})}:t,n?function(n){return a(e,t()).then(function(){throw n})}:t)}})},\"40c3\":function(t,e,n){var i=n(\"6b4c\"),o=n(\"5168\")(\"toStringTag\"),r=\"Arguments\"==i(function(){return arguments}()),s=function(t,e){try{return t[e]}catch(n){}};t.exports=function(t){var e,n,a;return void 0===t?\"Undefined\":null===t?\"Null\":\"string\"==typeof(n=s(e=Object(t),o))?n:r?i(e):\"Object\"==(a=i(e))&&\"function\"==typeof e.callee?\"Arguments\":a}},4178:function(t,e,n){var i,o,r,s=n(\"d864\"),a=n(\"3024\"),u=n(\"32fc\"),h=n(\"1ec9\"),c=n(\"e53d\"),l=c.process,f=c.setImmediate,d=c.clearImmediate,p=c.MessageChannel,_=c.Dispatch,m=0,v={},g=\"onreadystatechange\",y=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},b=function(t){y.call(t.data)};f&&d||(f=function(t){var e=[],n=1;while(arguments.length>n)e.push(arguments[n++]);return v[++m]=function(){a(\"function\"==typeof t?t:Function(t),e)},i(m),m},d=function(t){delete v[t]},\"process\"==n(\"6b4c\")(l)?i=function(t){l.nextTick(s(y,t,1))}:_&&_.now?i=function(t){_.now(s(y,t,1))}:p?(o=new p,r=o.port2,o.port1.onmessage=b,i=s(r.postMessage,r,1)):c.addEventListener&&\"function\"==typeof postMessage&&!c.importScripts?(i=function(t){c.postMessage(t+\"\",\"*\")},c.addEventListener(\"message\",b,!1)):i=g in h(\"script\")?function(t){u.appendChild(h(\"script\"))[g]=function(){u.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:f,clear:d}},\"41a0\":function(t,e,n){\"use strict\";var i=n(\"2aeb\"),o=n(\"4630\"),r=n(\"7f20\"),s={};n(\"32e9\")(s,n(\"2b4c\")(\"iterator\"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(s,{next:o(1,n)}),r(t,e+\" Iterator\")}},\"43fc\":function(t,e,n){\"use strict\";var i=n(\"63b6\"),o=n(\"656e\"),r=n(\"4439\");i(i.S,\"Promise\",{try:function(t){var e=o.f(this),n=r(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},4439:function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(e){return{e:!0,v:e}}}},\"454f\":function(t,e,n){n(\"46a7\");var i=n(\"584a\").Object;t.exports=function(t,e,n){return i.defineProperty(t,e,n)}},\"456d\":function(t,e,n){var i=n(\"4bf8\"),o=n(\"0d58\");n(\"5eda\")(\"keys\",function(){return function(t){return o(i(t))}})},4588:function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},\"45f2\":function(t,e,n){var i=n(\"d9f6\").f,o=n(\"07e3\"),r=n(\"5168\")(\"toStringTag\");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,r)&&i(t,r,{configurable:!0,value:e})}},4630:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},\"46a7\":function(t,e,n){var i=n(\"63b6\");i(i.S+i.F*!n(\"8e60\"),\"Object\",{defineProperty:n(\"d9f6\").f})},\"47ee\":function(t,e,n){var i=n(\"c3a1\"),o=n(\"9aa9\"),r=n(\"355d\");t.exports=function(t){var e=i(t),n=o.f;if(n){var s,a=n(t),u=r.f,h=0;while(a.length>h)u.call(t,s=a[h++])&&e.push(s)}return e}},\"481b\":function(t,e){t.exports={}},\"4a59\":function(t,e,n){var i=n(\"9b43\"),o=n(\"1fa8\"),r=n(\"33a4\"),s=n(\"cb7c\"),a=n(\"9def\"),u=n(\"27ee\"),h={},c={};e=t.exports=function(t,e,n,l,f){var d,p,_,m,v=f?function(){return t}:u(t),g=i(n,l,e?2:1),y=0;if(\"function\"!=typeof v)throw TypeError(t+\" is not iterable!\");if(r(v)){for(d=a(t.length);d>y;y++)if(m=e?g(s(p=t[y])[0],p[1]):g(t[y]),m===h||m===c)return m}else for(_=v.call(t);!(p=_.next()).done;)if(m=o(_,g,p.value,e),m===h||m===c)return m};e.BREAK=h,e.RETURN=c},\"4aa6\":function(t,e,n){t.exports=n(\"dc62\")},\"4bf8\":function(t,e,n){var i=n(\"be13\");t.exports=function(t){return Object(i(t))}},\"4c95\":function(t,e,n){\"use strict\";var i=n(\"e53d\"),o=n(\"584a\"),r=n(\"d9f6\"),s=n(\"8e60\"),a=n(\"5168\")(\"species\");t.exports=function(t){var e=\"function\"==typeof o[t]?o[t]:i[t];s&&e&&!e[a]&&r.f(e,a,{configurable:!0,get:function(){return this}})}},\"4d16\":function(t,e,n){t.exports=n(\"25b0\")},\"4e2b\":function(t,e,n){\"use strict\";var i=n(\"4aa6\"),o=n.n(i),r=n(\"4d16\"),s=n.n(r);function a(t,e){return a=s.a||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t,e){if(\"function\"!==typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=o()(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}n.d(e,\"a\",function(){return u})},\"4ee1\":function(t,e,n){var i=n(\"5168\")(\"iterator\"),o=!1;try{var r=[7][i]();r[\"return\"]=function(){o=!0},Array.from(r,function(){throw 2})}catch(s){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var r=[7],a=r[i]();a.next=function(){return{done:n=!0}},r[i]=function(){return a},t(r)}catch(s){}return n}},\"50ed\":function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},5168:function(t,e,n){var i=n(\"dbdb\")(\"wks\"),o=n(\"62a0\"),r=n(\"e53d\").Symbol,s=\"function\"==typeof r,a=t.exports=function(t){return i[t]||(i[t]=s&&r[t]||(s?r:o)(\"Symbol.\"+t))};a.store=i},\"520a\":function(t,e,n){\"use strict\";var i=n(\"0bfb\"),o=RegExp.prototype.exec,r=String.prototype.replace,s=o,a=\"lastIndex\",u=function(){var t=/a/,e=/b*/g;return o.call(t,\"a\"),o.call(e,\"a\"),0!==t[a]||0!==e[a]}(),h=void 0!==/()??/.exec(\"\")[1],c=u||h;c&&(s=function(t){var e,n,s,c,l=this;return h&&(n=new RegExp(\"^\"+l.source+\"$(?!\\\\s)\",i.call(l))),u&&(e=l[a]),s=o.call(l,t),u&&s&&(l[a]=l.global?s.index+s[0].length:e),h&&s&&s.length>1&&r.call(s[0],n,function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(s[c]=void 0)}),s}),t.exports=s},\"52a7\":function(t,e){e.f={}.propertyIsEnumerable},\"53e2\":function(t,e,n){var i=n(\"07e3\"),o=n(\"241e\"),r=n(\"5559\")(\"IE_PROTO\"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),i(t,r)?t[r]:\"function\"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},\"551c\":function(t,e,n){\"use strict\";var i,o,r,s,a=n(\"2d00\"),u=n(\"7726\"),h=n(\"9b43\"),c=n(\"23c6\"),l=n(\"5ca1\"),f=n(\"d3f4\"),d=n(\"d8e8\"),p=n(\"f605\"),_=n(\"4a59\"),m=n(\"ebd6\"),v=n(\"1991\").set,g=n(\"8079\")(),y=n(\"a5b8\"),b=n(\"9c80\"),x=n(\"a25f\"),w=n(\"bcaa\"),L=\"Promise\",P=u.TypeError,T=u.process,S=T&&T.versions,M=S&&S.v8||\"\",C=u[L],E=\"process\"==c(T),O=function(){},z=o=y.f,I=!!function(){try{var t=C.resolve(1),e=(t.constructor={})[n(\"2b4c\")(\"species\")]=function(t){t(O,O)};return(E||\"function\"==typeof PromiseRejectionEvent)&&t.then(O)instanceof e&&0!==M.indexOf(\"6.6\")&&-1===x.indexOf(\"Chrome/66\")}catch(i){}}(),k=function(t){var e;return!(!f(t)||\"function\"!=typeof(e=t.then))&&e},A=function(t,e){if(!t._n){t._n=!0;var n=t._c;g(function(){var i=t._v,o=1==t._s,r=0,s=function(e){var n,r,s,a=o?e.ok:e.fail,u=e.resolve,h=e.reject,c=e.domain;try{a?(o||(2==t._h&&j(t),t._h=1),!0===a?n=i:(c&&c.enter(),n=a(i),c&&(c.exit(),s=!0)),n===e.promise?h(P(\"Promise-chain cycle\")):(r=k(n))?r.call(n,u,h):u(n)):h(i)}catch(l){c&&!s&&c.exit(),h(l)}};while(n.length>r)s(n[r++]);t._c=[],t._n=!1,e&&!t._h&&Z(t)})}},Z=function(t){v.call(u,function(){var e,n,i,o=t._v,r=B(t);if(r&&(e=b(function(){E?T.emit(\"unhandledRejection\",o,t):(n=u.onunhandledrejection)?n({promise:t,reason:o}):(i=u.console)&&i.error&&i.error(\"Unhandled promise rejection\",o)}),t._h=E||B(t)?2:1),t._a=void 0,r&&e.e)throw e.v})},B=function(t){return 1!==t._h&&0===(t._a||t._c).length},j=function(t){v.call(u,function(){var e;E?T.emit(\"rejectionHandled\",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},R=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),A(e,!0))},N=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw P(\"Promise can't be resolved itself\");(e=k(t))?g(function(){var i={_w:n,_d:!1};try{e.call(t,h(N,i,1),h(R,i,1))}catch(o){R.call(i,o)}}):(n._v=t,n._s=1,A(n,!1))}catch(i){R.call({_w:n,_d:!1},i)}}};I||(C=function(t){p(this,C,L,\"_h\"),d(t),i.call(this);try{t(h(N,this,1),h(R,this,1))}catch(e){R.call(this,e)}},i=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(\"dcbc\")(C.prototype,{then:function(t,e){var n=z(m(this,C));return n.ok=\"function\"!=typeof t||t,n.fail=\"function\"==typeof e&&e,n.domain=E?T.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&A(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),r=function(){var t=new i;this.promise=t,this.resolve=h(N,t,1),this.reject=h(R,t,1)},y.f=z=function(t){return t===C||t===s?new r(t):o(t)}),l(l.G+l.W+l.F*!I,{Promise:C}),n(\"7f20\")(C,L),n(\"7a56\")(L),s=n(\"8378\")[L],l(l.S+l.F*!I,L,{reject:function(t){var e=z(this),n=e.reject;return n(t),e.promise}}),l(l.S+l.F*(a||!I),L,{resolve:function(t){return w(a&&this===s?C:this,t)}}),l(l.S+l.F*!(I&&n(\"5cc5\")(function(t){C.all(t)[\"catch\"](O)})),L,{all:function(t){var e=this,n=z(e),i=n.resolve,o=n.reject,r=b(function(){var n=[],r=0,s=1;_(t,!1,function(t){var a=r++,u=!1;n.push(void 0),s++,e.resolve(t).then(function(t){u||(u=!0,n[a]=t,--s||i(n))},o)}),--s||i(n)});return r.e&&o(r.v),n.promise},race:function(t){var e=this,n=z(e),i=n.reject,o=b(function(){_(t,!1,function(t){e.resolve(t).then(n.resolve,i)})});return o.e&&i(o.v),n.promise}})},5537:function(t,e,n){var i=n(\"8378\"),o=n(\"7726\"),r=\"__core-js_shared__\",s=o[r]||(o[r]={});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})(\"versions\",[]).push({version:i.version,mode:n(\"2d00\")?\"pure\":\"global\",copyright:\"© 2019 Denis Pushkarev (zloirock.ru)\"})},5559:function(t,e,n){var i=n(\"dbdb\")(\"keys\"),o=n(\"62a0\");t.exports=function(t){return i[t]||(i[t]=o(t))}},\"584a\":function(t,e){var n=t.exports={version:\"2.6.9\"};\"number\"==typeof __e&&(__e=n)},\"5b4e\":function(t,e,n){var i=n(\"36c3\"),o=n(\"b447\"),r=n(\"0fc9\");t.exports=function(t){return function(e,n,s){var a,u=i(e),h=o(u.length),c=r(s,h);if(t&&n!=n){while(h>c)if(a=u[c++],a!=a)return!0}else for(;h>c;c++)if((t||c in u)&&u[c]===n)return t||c||0;return!t&&-1}}},\"5c95\":function(t,e,n){var i=n(\"35e8\");t.exports=function(t,e,n){for(var o in e)n&&t[o]?t[o]=e[o]:i(t,o,e[o]);return t}},\"5ca1\":function(t,e,n){var i=n(\"7726\"),o=n(\"8378\"),r=n(\"32e9\"),s=n(\"2aba\"),a=n(\"9b43\"),u=\"prototype\",h=function(t,e,n){var c,l,f,d,p=t&h.F,_=t&h.G,m=t&h.S,v=t&h.P,g=t&h.B,y=_?i:m?i[e]||(i[e]={}):(i[e]||{})[u],b=_?o:o[e]||(o[e]={}),x=b[u]||(b[u]={});for(c in _&&(n=e),n)l=!p&&y&&void 0!==y[c],f=(l?y:n)[c],d=g&&l?a(f,i):v&&\"function\"==typeof f?a(Function.call,f):f,y&&s(y,c,f,t&h.U),b[c]!=f&&r(b,c,d),v&&x[c]!=f&&(x[c]=f)};i.core=o,h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},\"5cc5\":function(t,e,n){var i=n(\"2b4c\")(\"iterator\"),o=!1;try{var r=[7][i]();r[\"return\"]=function(){o=!0},Array.from(r,function(){throw 2})}catch(s){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var r=[7],a=r[i]();a.next=function(){return{done:n=!0}},r[i]=function(){return a},t(r)}catch(s){}return n}},\"5d58\":function(t,e,n){t.exports=n(\"d8d6\")},\"5dbc\":function(t,e,n){var i=n(\"d3f4\"),o=n(\"8b97\").set;t.exports=function(t,e,n){var r,s=e.constructor;return s!==n&&\"function\"==typeof s&&(r=s.prototype)!==n.prototype&&i(r)&&o&&o(t,r),t}},\"5eda\":function(t,e,n){var i=n(\"5ca1\"),o=n(\"8378\"),r=n(\"79e5\");t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*r(function(){n(1)}),\"Object\",s)}},\"5f1b\":function(t,e,n){\"use strict\";var i=n(\"23c6\"),o=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if(\"function\"===typeof n){var r=n.call(t,e);if(\"object\"!==typeof r)throw new TypeError(\"RegExp exec method returned something other than an Object or null\");return r}if(\"RegExp\"!==i(t))throw new TypeError(\"RegExp#exec called on incompatible receiver\");return o.call(t,e)}},\"613b\":function(t,e,n){var i=n(\"5537\")(\"keys\"),o=n(\"ca5a\");t.exports=function(t){return i[t]||(i[t]=o(t))}},\"626a\":function(t,e,n){var i=n(\"2d95\");t.exports=Object(\"z\").propertyIsEnumerable(0)?Object:function(t){return\"String\"==i(t)?t.split(\"\"):Object(t)}},\"62a0\":function(t,e){var n=0,i=Math.random();t.exports=function(t){return\"Symbol(\".concat(void 0===t?\"\":t,\")_\",(++n+i).toString(36))}},\"63b6\":function(t,e,n){var i=n(\"e53d\"),o=n(\"584a\"),r=n(\"d864\"),s=n(\"35e8\"),a=n(\"07e3\"),u=\"prototype\",h=function(t,e,n){var c,l,f,d=t&h.F,p=t&h.G,_=t&h.S,m=t&h.P,v=t&h.B,g=t&h.W,y=p?o:o[e]||(o[e]={}),b=y[u],x=p?i:_?i[e]:(i[e]||{})[u];for(c in p&&(n=e),n)l=!d&&x&&void 0!==x[c],l&&a(y,c)||(f=l?x[c]:n[c],y[c]=p&&\"function\"!=typeof x[c]?n[c]:v&&l?r(f,i):g&&x[c]==f?function(t){var e=function(e,n,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,i)}return t.apply(this,arguments)};return e[u]=t[u],e}(f):m&&\"function\"==typeof f?r(Function.call,f):f,m&&((y.virtual||(y.virtual={}))[c]=f,t&h.R&&b&&!b[c]&&s(b,c,f)))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},\"656e\":function(t,e,n){\"use strict\";var i=n(\"79aa\");function o(t){var e,n;this.promise=new t(function(t,i){if(void 0!==e||void 0!==n)throw TypeError(\"Bad Promise constructor\");e=t,n=i}),this.resolve=i(e),this.reject=i(n)}t.exports.f=function(t){return new o(t)}},6718:function(t,e,n){var i=n(\"e53d\"),o=n(\"584a\"),r=n(\"b8e3\"),s=n(\"ccb9\"),a=n(\"d9f6\").f;t.exports=function(t){var e=o.Symbol||(o.Symbol=r?{}:i.Symbol||{});\"_\"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},\"67bb\":function(t,e,n){t.exports=n(\"f921\")},6821:function(t,e,n){var i=n(\"626a\"),o=n(\"be13\");t.exports=function(t){return i(o(t))}},\"696e\":function(t,e,n){n(\"c207\"),n(\"1654\"),n(\"6c1c\"),n(\"24c5\"),n(\"3c11\"),n(\"43fc\"),t.exports=n(\"584a\").Promise},\"69a8\":function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},\"69d3\":function(t,e,n){n(\"6718\")(\"asyncIterator\")},\"6a99\":function(t,e,n){var i=n(\"d3f4\");t.exports=function(t,e){if(!i(t))return t;var n,o;if(e&&\"function\"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;if(\"function\"==typeof(n=t.valueOf)&&!i(o=n.call(t)))return o;if(!e&&\"function\"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;throw TypeError(\"Can't convert object to primitive value\")}},\"6abf\":function(t,e,n){var i=n(\"e6f3\"),o=n(\"1691\").concat(\"length\",\"prototype\");e.f=Object.getOwnPropertyNames||function(t){return i(t,o)}},\"6b4c\":function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},\"6b54\":function(t,e,n){\"use strict\";n(\"3846\");var i=n(\"cb7c\"),o=n(\"0bfb\"),r=n(\"9e1e\"),s=\"toString\",a=/./[s],u=function(t){n(\"2aba\")(RegExp.prototype,s,t,!0)};n(\"79e5\")(function(){return\"/a/b\"!=a.call({source:\"a\",flags:\"b\"})})?u(function(){var t=i(this);return\"/\".concat(t.source,\"/\",\"flags\"in t?t.flags:!r&&t instanceof RegExp?o.call(t):void 0)}):a.name!=s&&u(function(){return a.call(this)})},\"6bb5\":function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return a});var i=n(\"061b\"),o=n.n(i),r=n(\"4d16\"),s=n.n(r);function a(t){return a=s.a?o.a:function(t){return t.__proto__||o()(t)},a(t)}},\"6c1c\":function(t,e,n){n(\"c367\");for(var i=n(\"e53d\"),o=n(\"35e8\"),r=n(\"481b\"),s=n(\"5168\")(\"toStringTag\"),a=\"CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList\".split(\",\"),u=0;u<a.length;u++){var h=a[u],c=i[h],l=c&&c.prototype;l&&!l[s]&&o(l,s,h),r[h]=r.Array}},\"6cc5\":function(t,e,n){},\"71c1\":function(t,e,n){var i=n(\"3a38\"),o=n(\"25eb\");t.exports=function(t){return function(e,n){var r,s,a=String(o(e)),u=i(n),h=a.length;return u<0||u>=h?t?\"\":void 0:(r=a.charCodeAt(u),r<55296||r>56319||u+1===h||(s=a.charCodeAt(u+1))<56320||s>57343?t?a.charAt(u):r:t?a.slice(u,u+2):s-56320+(r-55296<<10)+65536)}}},7333:function(t,e,n){\"use strict\";var i=n(\"9e1e\"),o=n(\"0d58\"),r=n(\"2621\"),s=n(\"52a7\"),a=n(\"4bf8\"),u=n(\"626a\"),h=Object.assign;t.exports=!h||n(\"79e5\")(function(){var t={},e={},n=Symbol(),i=\"abcdefghijklmnopqrst\";return t[n]=7,i.split(\"\").forEach(function(t){e[t]=t}),7!=h({},t)[n]||Object.keys(h({},e)).join(\"\")!=i})?function(t,e){var n=a(t),h=arguments.length,c=1,l=r.f,f=s.f;while(h>c){var d,p=u(arguments[c++]),_=l?o(p).concat(l(p)):o(p),m=_.length,v=0;while(m>v)d=_[v++],i&&!f.call(p,d)||(n[d]=p[d])}return n}:h},\"765d\":function(t,e,n){n(\"6718\")(\"observable\")},7726:function(t,e){var n=t.exports=\"undefined\"!=typeof window&&window.Math==Math?window:\"undefined\"!=typeof self&&self.Math==Math?self:Function(\"return this\")();\"number\"==typeof __g&&(__g=n)},\"77f1\":function(t,e,n){var i=n(\"4588\"),o=Math.max,r=Math.min;t.exports=function(t,e){return t=i(t),t<0?o(t+e,0):r(t,e)}},\"794b\":function(t,e,n){t.exports=!n(\"8e60\")&&!n(\"294c\")(function(){return 7!=Object.defineProperty(n(\"1ec9\")(\"div\"),\"a\",{get:function(){return 7}}).a})},\"795b\":function(t,e,n){t.exports=n(\"696e\")},\"79aa\":function(t,e){t.exports=function(t){if(\"function\"!=typeof t)throw TypeError(t+\" is not a function!\");return t}},\"79e5\":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},\"7a56\":function(t,e,n){\"use strict\";var i=n(\"7726\"),o=n(\"86cc\"),r=n(\"9e1e\"),s=n(\"2b4c\")(\"species\");t.exports=function(t){var e=i[t];r&&e&&!e[s]&&o.f(e,s,{configurable:!0,get:function(){return this}})}},\"7cd6\":function(t,e,n){var i=n(\"40c3\"),o=n(\"5168\")(\"iterator\"),r=n(\"481b\");t.exports=n(\"584a\").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t[\"@@iterator\"]||r[i(t)]}},\"7e90\":function(t,e,n){var i=n(\"d9f6\"),o=n(\"e4ae\"),r=n(\"c3a1\");t.exports=n(\"8e60\")?Object.defineProperties:function(t,e){o(t);var n,s=r(e),a=s.length,u=0;while(a>u)i.f(t,n=s[u++],e[n]);return t}},\"7f20\":function(t,e,n){var i=n(\"86cc\").f,o=n(\"69a8\"),r=n(\"2b4c\")(\"toStringTag\");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,r)&&i(t,r,{configurable:!0,value:e})}},\"7f7f\":function(t,e,n){var i=n(\"86cc\").f,o=Function.prototype,r=/^\\s*function ([^ (]*)/,s=\"name\";s in o||n(\"9e1e\")&&i(o,s,{configurable:!0,get:function(){try{return(\"\"+this).match(r)[1]}catch(t){return\"\"}}})},8079:function(t,e,n){var i=n(\"7726\"),o=n(\"1991\").set,r=i.MutationObserver||i.WebKitMutationObserver,s=i.process,a=i.Promise,u=\"process\"==n(\"2d95\")(s);t.exports=function(){var t,e,n,h=function(){var i,o;u&&(i=s.domain)&&i.exit();while(t){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,i&&i.enter()};if(u)n=function(){s.nextTick(h)};else if(!r||i.navigator&&i.navigator.standalone)if(a&&a.resolve){var c=a.resolve(void 0);n=function(){c.then(h)}}else n=function(){o.call(i,h)};else{var l=!0,f=document.createTextNode(\"\");new r(h).observe(f,{characterData:!0}),n=function(){f.data=l=!l}}return function(i){var o={fn:i,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},8378:function(t,e){var n=t.exports={version:\"2.6.9\"};\"number\"==typeof __e&&(__e=n)},\"83a1\":function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e}},8436:function(t,e){t.exports=function(){}},\"84f2\":function(t,e){t.exports={}},\"85f2\":function(t,e,n){t.exports=n(\"454f\")},\"86cc\":function(t,e,n){var i=n(\"cb7c\"),o=n(\"c69a\"),r=n(\"6a99\"),s=Object.defineProperty;e.f=n(\"9e1e\")?Object.defineProperty:function(t,e,n){if(i(t),e=r(e,!0),i(n),o)try{return s(t,e,n)}catch(a){}if(\"get\"in n||\"set\"in n)throw TypeError(\"Accessors not supported!\");return\"value\"in n&&(t[e]=n.value),t}},\"898b\":function(t,e){L.MapkitMutant=L.Layer.extend({options:{minZoom:3,maxZoom:23,type:\"standard\",authorizationCallback:function(){},opacity:1,debugRectangle:!1},initialize:function(t){L.Util.setOptions(this,t),mapkit.init({authorizationCallback:this.options.authorizationCallback,language:this.options.langhage})},onAdd:function(t){this._map=t,this._initMutantContainer(),this._initMutant(),t.on(\"move zoom moveend zoomend\",this._update,this),t.on(\"resize\",this._resize,this),this._resize()},onRemove:function(t){t._container.removeChild(this._mutantContainer),this._mutantContainer=void 0,t.off(\"move zoom moveend zoomend\",this._update,this),t.off(\"resize\",this._resize,this),this._mutant.removeEventListener(\"region-change-end\",this._onRegionChangeEnd,this),this._canvasOverlay&&this._canvasOverlay.remove()},_initMutantContainer:function(){this._mutantContainer||(this._mutantContainer=L.DomUtil.create(\"div\",\"leaflet-mapkit-mutant leaflet-top leaflet-left\"),this._mutantContainer.id=\"_MutantContainer_\"+L.Util.stamp(this._mutantContainer),this._mutantContainer.style.zIndex=\"200\",this._mutantContainer.style.pointerEvents=\"none\",this._map.getContainer().appendChild(this._mutantContainer)),this.setElementSize(this._mutantContainer,this._map.getSize())},_initMutant:function(){if(this._mutantContainer){var t=mapkit.Map.MapTypes.Standard;\"hybrid\"===this.options.type?t=mapkit.Map.MapTypes.Hybrid:\"satellite\"===this.options.type?t=mapkit.Map.MapTypes.Satellite:\"muted\"===this.options.type&&(t=mapkit.Map.MapTypes.MutedStandard);var e=new mapkit.Map(this._mutantContainer,{visibleMapRect:this._leafletBoundsToMapkitRect(),showsUserLocation:!1,showsUserLocationControl:!1,showsCompass:\"hidden\",showsZoomControl:!1,showsUserLocationControl:!1,showsScale:!1,showsMapTypeControl:!1,mapType:t});this._mutant=e,e.addEventListener(\"region-change-end\",this._onRegionChangeEnd,this),e.addEventListener(\"region-change-start\",this._onRegionChangeStart,this),this.fire(\"spawned\",{mapObject:e}),L.Util.requestAnimFrame(this._update,this)}},_leafletBoundsToMapkitRect:function(){var t=this._map.getPixelBounds(),e=this._map.options.crs.scale(this._map.getZoom()),n=t.getTopLeft().divideBy(e),i=t.getBottomRight().divideBy(e),o=L.bounds([n,i]),r=o.getCenter(),s=o.getSize(),a=new mapkit.MapRect(r.x-s.x/2,r.y-s.y/2,s.x,s.y);return a},_mapkitRectToLeafletBounds:function(t){var e=new mapkit.MapPoint(t.minX(),t.maxY()).toCoordinate(),n=new mapkit.MapPoint(t.maxX(),t.minY()).toCoordinate(),i=e.longitude+360*Math.floor(t.minX()),o=n.longitude+360*Math.floor(t.maxX()),r=this._map.getCenter().lng;if(r<i){var s=360*Math.floor((r-i)/360);i+=s,o+=s}else if(r>o){s=360*Math.ceil((r-o)/360);i+=s,o+=s}return L.latLngBounds([L.latLng(e.latitude,i),L.latLng(n.latitude,o)])},_update:function(){this._map&&this._mutant&&this._mutant.setVisibleMapRectAnimated(this._leafletBoundsToMapkitRect(),!1)},_resize:function(){var t=this._map.getSize();this._mutantContainer.style.width===t.x&&this._mutantContainer.style.height===t.y||(this.setElementSize(this._mutantContainer,t),this._mutant)},_onRegionChangeEnd:function(t){if(this._mutantCanvas||(this._mutantCanvas=this._mutantContainer.querySelector(\"canvas.syrup-canvas\")),this._map&&this._mutantCanvas){var e=this._mapkitRectToLeafletBounds(this._mutant.visibleMapRect);L.Util.cancelAnimFrame(this._requestedFrame),this._requestedFrame=L.Util.requestAnimFrame(function(){if(this._canvasOverlay)this._canvasOverlay.setBounds(e);else{this._canvasOverlay=L.imageOverlay(null,e);var t=this._canvasOverlay._image=L.DomUtil.create(\"div\");L.DomUtil.addClass(t,\"leaflet-image-layer\"),L.DomUtil.addClass(t,\"leaflet-zoom-animated\"),this._mutantCanvas.parentElement.removeChild(this._mutantCanvas),t.appendChild(this._mutantCanvas),this._canvasOverlay.addTo(this._map),this._updateOpacity()}this._mutantCanvas.style.width=\"100%\",this._mutantCanvas.style.height=\"100%\",this._mutantCanvas.style.position=\"absolute\",this.options.debugRectangle&&(this.rectangle?this.rectangle.setBounds(e):this.rectangle=L.rectangle(e,{fill:!1}).addTo(this._map))},this)}},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},_updateOpacity:function(){this._mutantCanvas&&L.DomUtil.setOpacity(this._mutantCanvas,this.options.opacity)},_onRegionChangeStart:function(t){},setElementSize:function(t,e){t.style.width=e.x+\"px\",t.style.height=e.y+\"px\"}}),L.mapkitMutant=function(t){return new L.MapkitMutant(t)}},\"8b97\":function(t,e,n){var i=n(\"d3f4\"),o=n(\"cb7c\"),r=function(t,e){if(o(t),!i(e)&&null!==e)throw TypeError(e+\": can't set as prototype!\")};t.exports={set:Object.setPrototypeOf||(\"__proto__\"in{}?function(t,e,i){try{i=n(\"9b43\")(Function.call,n(\"11e9\").f(Object.prototype,\"__proto__\").set,2),i(t,[]),e=!(t instanceof Array)}catch(o){e=!0}return function(t,n){return r(t,n),e?t.__proto__=n:i(t,n),t}}({},!1):void 0),check:r}},\"8e60\":function(t,e,n){t.exports=!n(\"294c\")(function(){return 7!=Object.defineProperty({},\"a\",{get:function(){return 7}}).a})},\"8e6e\":function(t,e,n){var i=n(\"5ca1\"),o=n(\"990b\"),r=n(\"6821\"),s=n(\"11e9\"),a=n(\"f1ae\");i(i.S,\"Object\",{getOwnPropertyDescriptors:function(t){var e,n,i=r(t),u=s.f,h=o(i),c={},l=0;while(h.length>l)n=u(i,e=h[l++]),void 0!==n&&a(c,e,n);return c}})},\"8f60\":function(t,e,n){\"use strict\";var i=n(\"a159\"),o=n(\"aebd\"),r=n(\"45f2\"),s={};n(\"35e8\")(s,n(\"5168\")(\"iterator\"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(s,{next:o(1,n)}),r(t,e+\" Iterator\")}},9003:function(t,e,n){var i=n(\"6b4c\");t.exports=Array.isArray||function(t){return\"Array\"==i(t)}},9093:function(t,e,n){var i=n(\"ce10\"),o=n(\"e11e2\").concat(\"length\",\"prototype\");e.f=Object.getOwnPropertyNames||function(t){return i(t,o)}},9138:function(t,e,n){t.exports=n(\"35e8\")},9427:function(t,e,n){var i=n(\"63b6\");i(i.S,\"Object\",{create:n(\"a159\")})},\"96cf\":function(t,e,n){var i=function(t){\"use strict\";var e,n=Object.prototype,i=n.hasOwnProperty,o=\"function\"===typeof Symbol?Symbol:{},r=o.iterator||\"@@iterator\",s=o.asyncIterator||\"@@asyncIterator\",a=o.toStringTag||\"@@toStringTag\";function u(t,e,n,i){var o=e&&e.prototype instanceof _?e:_,r=Object.create(o.prototype),s=new C(i||[]);return r._invoke=P(t,n,s),r}function h(t,e,n){try{return{type:\"normal\",arg:t.call(e,n)}}catch(i){return{type:\"throw\",arg:i}}}t.wrap=u;var c=\"suspendedStart\",l=\"suspendedYield\",f=\"executing\",d=\"completed\",p={};function _(){}function m(){}function v(){}var g={};g[r]=function(){return this};var y=Object.getPrototypeOf,b=y&&y(y(E([])));b&&b!==n&&i.call(b,r)&&(g=b);var x=v.prototype=_.prototype=Object.create(g);function w(t){[\"next\",\"throw\",\"return\"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function L(t){function e(n,o,r,s){var a=h(t[n],t,o);if(\"throw\"!==a.type){var u=a.arg,c=u.value;return c&&\"object\"===typeof c&&i.call(c,\"__await\")?Promise.resolve(c.__await).then(function(t){e(\"next\",t,r,s)},function(t){e(\"throw\",t,r,s)}):Promise.resolve(c).then(function(t){u.value=t,r(u)},function(t){return e(\"throw\",t,r,s)})}s(a.arg)}var n;function o(t,i){function o(){return new Promise(function(n,o){e(t,i,n,o)})}return n=n?n.then(o,o):o()}this._invoke=o}function P(t,e,n){var i=c;return function(o,r){if(i===f)throw new Error(\"Generator is already running\");if(i===d){if(\"throw\"===o)throw r;return O()}n.method=o,n.arg=r;while(1){var s=n.delegate;if(s){var a=T(s,n);if(a){if(a===p)continue;return a}}if(\"next\"===n.method)n.sent=n._sent=n.arg;else if(\"throw\"===n.method){if(i===c)throw i=d,n.arg;n.dispatchException(n.arg)}else\"return\"===n.method&&n.abrupt(\"return\",n.arg);i=f;var u=h(t,e,n);if(\"normal\"===u.type){if(i=n.done?d:l,u.arg===p)continue;return{value:u.arg,done:n.done}}\"throw\"===u.type&&(i=d,n.method=\"throw\",n.arg=u.arg)}}}function T(t,n){var i=t.iterator[n.method];if(i===e){if(n.delegate=null,\"throw\"===n.method){if(t.iterator[\"return\"]&&(n.method=\"return\",n.arg=e,T(t,n),\"throw\"===n.method))return p;n.method=\"throw\",n.arg=new TypeError(\"The iterator does not provide a 'throw' method\")}return p}var o=h(i,t.iterator,n.arg);if(\"throw\"===o.type)return n.method=\"throw\",n.arg=o.arg,n.delegate=null,p;var r=o.arg;return r?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,\"return\"!==n.method&&(n.method=\"next\",n.arg=e),n.delegate=null,p):r:(n.method=\"throw\",n.arg=new TypeError(\"iterator result is not an object\"),n.delegate=null,p)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type=\"normal\",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:\"root\"}],t.forEach(S,this),this.reset(!0)}function E(t){if(t){var n=t[r];if(n)return n.call(t);if(\"function\"===typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){while(++o<t.length)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}return{next:O}}function O(){return{value:e,done:!0}}return m.prototype=x.constructor=v,v.constructor=m,v[a]=m.displayName=\"GeneratorFunction\",t.isGeneratorFunction=function(t){var e=\"function\"===typeof t&&t.constructor;return!!e&&(e===m||\"GeneratorFunction\"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,a in t||(t[a]=\"GeneratorFunction\")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},w(L.prototype),L.prototype[s]=function(){return this},t.AsyncIterator=L,t.async=function(e,n,i,o){var r=new L(u(e,n,i,o));return t.isGeneratorFunction(n)?r:r.next().then(function(t){return t.done?t.value:r.next()})},w(x),x[a]=\"Generator\",x[r]=function(){return this},x.toString=function(){return\"[object Generator]\"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){while(e.length){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=E,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=\"next\",this.arg=e,this.tryEntries.forEach(M),!t)for(var n in this)\"t\"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(\"throw\"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(i,o){return a.type=\"throw\",a.arg=t,n.next=i,o&&(n.method=\"next\",n.arg=e),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r],a=s.completion;if(\"root\"===s.tryLoc)return o(\"end\");if(s.tryLoc<=this.prev){var u=i.call(s,\"catchLoc\"),h=i.call(s,\"finallyLoc\");if(u&&h){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!h)throw new Error(\"try statement without catch or finally\");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,\"finallyLoc\")&&this.prev<o.finallyLoc){var r=o;break}}r&&(\"break\"===t||\"continue\"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var s=r?r.completion:{};return s.type=t,s.arg=e,r?(this.method=\"next\",this.next=r.finallyLoc,p):this.complete(s)},complete:function(t,e){if(\"throw\"===t.type)throw t.arg;return\"break\"===t.type||\"continue\"===t.type?this.next=t.arg:\"return\"===t.type?(this.rval=this.arg=t.arg,this.method=\"return\",this.next=\"end\"):\"normal\"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if(\"throw\"===i.type){var o=i.arg;M(n)}return o}}throw new Error(\"illegal catch attempt\")},delegateYield:function(t,n,i){return this.delegate={iterator:E(t),resultName:n,nextLoc:i},\"next\"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=i}catch(o){Function(\"r\",\"regeneratorRuntime = r\")(i)}},\"990b\":function(t,e,n){var i=n(\"9093\"),o=n(\"2621\"),r=n(\"cb7c\"),s=n(\"7726\").Reflect;t.exports=s&&s.ownKeys||function(t){var e=i.f(r(t)),n=o.f;return n?e.concat(n(t)):e}},\"9aa9\":function(t,e){e.f=Object.getOwnPropertySymbols},\"9b43\":function(t,e,n){var i=n(\"d8e8\");t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)}}return function(){return t.apply(e,arguments)}}},\"9c6c\":function(t,e,n){var i=n(\"2b4c\")(\"unscopables\"),o=Array.prototype;void 0==o[i]&&n(\"32e9\")(o,i,{}),t.exports=function(t){o[i][t]=!0}},\"9c80\":function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(e){return{e:!0,v:e}}}},\"9def\":function(t,e,n){var i=n(\"4588\"),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},\"9e1e\":function(t,e,n){t.exports=!n(\"79e5\")(function(){return 7!=Object.defineProperty({},\"a\",{get:function(){return 7}}).a})},a159:function(t,e,n){var i=n(\"e4ae\"),o=n(\"7e90\"),r=n(\"1691\"),s=n(\"5559\")(\"IE_PROTO\"),a=function(){},u=\"prototype\",h=function(){var t,e=n(\"1ec9\")(\"iframe\"),i=r.length,o=\"<\",s=\">\";e.style.display=\"none\",n(\"32fc\").appendChild(e),e.src=\"javascript:\",t=e.contentWindow.document,t.open(),t.write(o+\"script\"+s+\"document.F=Object\"+o+\"/script\"+s),t.close(),h=t.F;while(i--)delete h[u][r[i]];return h()};t.exports=Object.create||function(t,e){var n;return null!==t?(a[u]=i(t),n=new a,a[u]=null,n[s]=t):n=h(),void 0===e?n:o(n,e)}},a22a:function(t,e,n){var i=n(\"d864\"),o=n(\"b0dc\"),r=n(\"3702\"),s=n(\"e4ae\"),a=n(\"b447\"),u=n(\"7cd6\"),h={},c={};e=t.exports=function(t,e,n,l,f){var d,p,_,m,v=f?function(){return t}:u(t),g=i(n,l,e?2:1),y=0;if(\"function\"!=typeof v)throw TypeError(t+\" is not iterable!\");if(r(v)){for(d=a(t.length);d>y;y++)if(m=e?g(s(p=t[y])[0],p[1]):g(t[y]),m===h||m===c)return m}else for(_=v.call(t);!(p=_.next()).done;)if(m=o(_,g,p.value,e),m===h||m===c)return m};e.BREAK=h,e.RETURN=c},a25f:function(t,e,n){var i=n(\"7726\"),o=i.navigator;t.exports=o&&o.userAgent||\"\"},a481:function(t,e,n){\"use strict\";var i=n(\"cb7c\"),o=n(\"4bf8\"),r=n(\"9def\"),s=n(\"4588\"),a=n(\"0390\"),u=n(\"5f1b\"),h=Math.max,c=Math.min,l=Math.floor,f=/\\$([$&`']|\\d\\d?|<[^>]*>)/g,d=/\\$([$&`']|\\d\\d?)/g,p=function(t){return void 0===t?t:String(t)};n(\"214f\")(\"replace\",2,function(t,e,n,_){return[function(i,o){var r=t(this),s=void 0==i?void 0:i[e];return void 0!==s?s.call(i,r,o):n.call(String(r),i,o)},function(t,e){var o=_(n,t,this,e);if(o.done)return o.value;var l=i(t),f=String(this),d=\"function\"===typeof e;d||(e=String(e));var v=l.global;if(v){var g=l.unicode;l.lastIndex=0}var y=[];while(1){var b=u(l,f);if(null===b)break;if(y.push(b),!v)break;var x=String(b[0]);\"\"===x&&(l.lastIndex=a(f,r(l.lastIndex),g))}for(var w=\"\",L=0,P=0;P<y.length;P++){b=y[P];for(var T=String(b[0]),S=h(c(s(b.index),f.length),0),M=[],C=1;C<b.length;C++)M.push(p(b[C]));var E=b.groups;if(d){var O=[T].concat(M,S,f);void 0!==E&&O.push(E);var z=String(e.apply(void 0,O))}else z=m(T,f,S,M,E,e);S>=L&&(w+=f.slice(L,S)+z,L=S+T.length)}return w+f.slice(L)}];function m(t,e,i,r,s,a){var u=i+t.length,h=r.length,c=d;return void 0!==s&&(s=o(s),c=f),n.call(a,c,function(n,o){var a;switch(o.charAt(0)){case\"$\":return\"$\";case\"&\":return t;case\"`\":return e.slice(0,i);case\"'\":return e.slice(u);case\"<\":a=s[o.slice(1,-1)];break;default:var c=+o;if(0===c)return n;if(c>h){var f=l(c/10);return 0===f?n:f<=h?void 0===r[f-1]?o.charAt(1):r[f-1]+o.charAt(1):n}a=r[c-1]}return void 0===a?\"\":a})}})},a5b8:function(t,e,n){\"use strict\";var i=n(\"d8e8\");function o(t){var e,n;this.promise=new t(function(t,i){if(void 0!==e||void 0!==n)throw TypeError(\"Bad Promise constructor\");e=t,n=i}),this.resolve=i(e),this.reject=i(n)}t.exports.f=function(t){return new o(t)}},aa77:function(t,e,n){var i=n(\"5ca1\"),o=n(\"be13\"),r=n(\"79e5\"),s=n(\"fdef\"),a=\"[\"+s+\"]\",u=\"​\",h=RegExp(\"^\"+a+a+\"*\"),c=RegExp(a+a+\"*$\"),l=function(t,e,n){var o={},a=r(function(){return!!s[t]()||u[t]()!=u}),h=o[t]=a?e(f):s[t];n&&(o[n]=h),i(i.P+i.F*a,\"String\",o)},f=l.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(h,\"\")),2&e&&(t=t.replace(c,\"\")),t};t.exports=l},aae3:function(t,e,n){var i=n(\"d3f4\"),o=n(\"2d95\"),r=n(\"2b4c\")(\"match\");t.exports=function(t){var e;return i(t)&&(void 0!==(e=t[r])?!!e:\"RegExp\"==o(t))}},aba2:function(t,e,n){var i=n(\"e53d\"),o=n(\"4178\").set,r=i.MutationObserver||i.WebKitMutationObserver,s=i.process,a=i.Promise,u=\"process\"==n(\"6b4c\")(s);t.exports=function(){var t,e,n,h=function(){var i,o;u&&(i=s.domain)&&i.exit();while(t){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,i&&i.enter()};if(u)n=function(){s.nextTick(h)};else if(!r||i.navigator&&i.navigator.standalone)if(a&&a.resolve){var c=a.resolve(void 0);n=function(){c.then(h)}}else n=function(){o.call(i,h)};else{var l=!0,f=document.createTextNode(\"\");new r(h).observe(f,{characterData:!0}),n=function(){f.data=l=!l}}return function(i){var o={fn:i,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},ac6a:function(t,e,n){for(var i=n(\"cadf\"),o=n(\"0d58\"),r=n(\"2aba\"),s=n(\"7726\"),a=n(\"32e9\"),u=n(\"84f2\"),h=n(\"2b4c\"),c=h(\"iterator\"),l=h(\"toStringTag\"),f=u.Array,d={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=o(d),_=0;_<p.length;_++){var m,v=p[_],g=d[v],y=s[v],b=y&&y.prototype;if(b&&(b[c]||a(b,c,f),b[l]||a(b,l,v),u[v]=f,g))for(m in i)b[m]||r(b,m,i[m],!0)}},aebd:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},b0b4:function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return s});var i=n(\"85f2\"),o=n.n(i);function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,\"value\"in i&&(i.writable=!0),o()(t,i.key,i)}}function s(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},b0c5:function(t,e,n){\"use strict\";var i=n(\"520a\");n(\"5ca1\")({target:\"RegExp\",proto:!0,forced:i!==/./.exec},{exec:i})},b0dc:function(t,e,n){var i=n(\"e4ae\");t.exports=function(t,e,n,o){try{return o?e(i(n)[0],n[1]):e(n)}catch(s){var r=t[\"return\"];throw void 0!==r&&i(r.call(t)),s}}},b447:function(t,e,n){var i=n(\"3a38\"),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},b8e3:function(t,e){t.exports=!0},bc13:function(t,e,n){var i=n(\"e53d\"),o=i.navigator;t.exports=o&&o.userAgent||\"\"},bcaa:function(t,e,n){var i=n(\"cb7c\"),o=n(\"d3f4\"),r=n(\"a5b8\");t.exports=function(t,e){if(i(t),o(e)&&e.constructor===t)return e;var n=r.f(t),s=n.resolve;return s(e),n.promise}},bd86:function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return r});var i=n(\"85f2\"),o=n.n(i);function r(t,e,n){return e in t?o()(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},be13:function(t,e){t.exports=function(t){if(void 0==t)throw TypeError(\"Can't call method on  \"+t);return t}},bf0b:function(t,e,n){var i=n(\"355d\"),o=n(\"aebd\"),r=n(\"36c3\"),s=n(\"1bc3\"),a=n(\"07e3\"),u=n(\"794b\"),h=Object.getOwnPropertyDescriptor;e.f=n(\"8e60\")?h:function(t,e){if(t=r(t),e=s(e,!0),u)try{return h(t,e)}catch(n){}if(a(t,e))return o(!i.f.call(t,e),t[e])}},c207:function(t,e){},c366:function(t,e,n){var i=n(\"6821\"),o=n(\"9def\"),r=n(\"77f1\");t.exports=function(t){return function(e,n,s){var a,u=i(e),h=o(u.length),c=r(s,h);if(t&&n!=n){while(h>c)if(a=u[c++],a!=a)return!0}else for(;h>c;c++)if((t||c in u)&&u[c]===n)return t||c||0;return!t&&-1}}},c367:function(t,e,n){\"use strict\";var i=n(\"8436\"),o=n(\"50ed\"),r=n(\"481b\"),s=n(\"36c3\");t.exports=n(\"30f1\")(Array,\"Array\",function(t,e){this._t=s(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,\"keys\"==e?n:\"values\"==e?t[n]:[n,t[n]])},\"values\"),r.Arguments=r.Array,i(\"keys\"),i(\"values\"),i(\"entries\")},c3a1:function(t,e,n){var i=n(\"e6f3\"),o=n(\"1691\");t.exports=Object.keys||function(t){return i(t,o)}},c5f6:function(t,e,n){\"use strict\";var i=n(\"7726\"),o=n(\"69a8\"),r=n(\"2d95\"),s=n(\"5dbc\"),a=n(\"6a99\"),u=n(\"79e5\"),h=n(\"9093\").f,c=n(\"11e9\").f,l=n(\"86cc\").f,f=n(\"aa77\").trim,d=\"Number\",p=i[d],_=p,m=p.prototype,v=r(n(\"2aeb\")(m))==d,g=\"trim\"in String.prototype,y=function(t){var e=a(t,!1);if(\"string\"==typeof e&&e.length>2){e=g?e.trim():f(e,3);var n,i,o,r=e.charCodeAt(0);if(43===r||45===r){if(n=e.charCodeAt(2),88===n||120===n)return NaN}else if(48===r){switch(e.charCodeAt(1)){case 66:case 98:i=2,o=49;break;case 79:case 111:i=8,o=55;break;default:return+e}for(var s,u=e.slice(2),h=0,c=u.length;h<c;h++)if(s=u.charCodeAt(h),s<48||s>o)return NaN;return parseInt(u,i)}}return+e};if(!p(\" 0o1\")||!p(\"0b1\")||p(\"+0x1\")){p=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof p&&(v?u(function(){m.valueOf.call(n)}):r(n)!=d)?s(new _(y(e)),n,p):y(e)};for(var b,x=n(\"9e1e\")?h(_):\"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger\".split(\",\"),w=0;x.length>w;w++)o(_,b=x[w])&&!o(p,b)&&l(p,b,c(_,b));p.prototype=m,m.constructor=p,n(\"2aba\")(i,d,p)}},c69a:function(t,e,n){t.exports=!n(\"9e1e\")&&!n(\"79e5\")(function(){return 7!=Object.defineProperty(n(\"230e\")(\"div\"),\"a\",{get:function(){return 7}}).a})},ca5a:function(t,e){var n=0,i=Math.random();t.exports=function(t){return\"Symbol(\".concat(void 0===t?\"\":t,\")_\",(++n+i).toString(36))}},cadf:function(t,e,n){\"use strict\";var i=n(\"9c6c\"),o=n(\"d53b\"),r=n(\"84f2\"),s=n(\"6821\");t.exports=n(\"01f9\")(Array,\"Array\",function(t,e){this._t=s(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,\"keys\"==e?n:\"values\"==e?t[n]:[n,t[n]])},\"values\"),r.Arguments=r.Array,i(\"keys\"),i(\"values\"),i(\"entries\")},cb7c:function(t,e,n){var i=n(\"d3f4\");t.exports=function(t){if(!i(t))throw TypeError(t+\" is not an object!\");return t}},ccb9:function(t,e,n){e.f=n(\"5168\")},cd78:function(t,e,n){var i=n(\"e4ae\"),o=n(\"f772\"),r=n(\"656e\");t.exports=function(t,e){if(i(t),o(e)&&e.constructor===t)return e;var n=r.f(t),s=n.resolve;return s(e),n.promise}},ce10:function(t,e,n){var i=n(\"69a8\"),o=n(\"6821\"),r=n(\"c366\")(!1),s=n(\"613b\")(\"IE_PROTO\");t.exports=function(t,e){var n,a=o(t),u=0,h=[];for(n in a)n!=s&&i(a,n)&&h.push(n);while(e.length>u)i(a,n=e[u++])&&(~r(h,n)||h.push(n));return h}},ce7e:function(t,e,n){var i=n(\"63b6\"),o=n(\"584a\"),r=n(\"294c\");t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*r(function(){n(1)}),\"Object\",s)}},d225:function(t,e,n){\"use strict\";function i(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}n.d(e,\"a\",function(){return i})},d3f4:function(t,e){t.exports=function(t){return\"object\"===typeof t?null!==t:\"function\"===typeof t}},d53b:function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},d864:function(t,e,n){var i=n(\"79aa\");t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)}}return function(){return t.apply(e,arguments)}}},d8d6:function(t,e,n){n(\"1654\"),n(\"6c1c\"),t.exports=n(\"ccb9\").f(\"iterator\")},d8e8:function(t,e){t.exports=function(t){if(\"function\"!=typeof t)throw TypeError(t+\" is not a function!\");return t}},d9f6:function(t,e,n){var i=n(\"e4ae\"),o=n(\"794b\"),r=n(\"1bc3\"),s=Object.defineProperty;e.f=n(\"8e60\")?Object.defineProperty:function(t,e,n){if(i(t),e=r(e,!0),i(n),o)try{return s(t,e,n)}catch(a){}if(\"get\"in n||\"set\"in n)throw TypeError(\"Accessors not supported!\");return\"value\"in n&&(t[e]=n.value),t}},dbdb:function(t,e,n){var i=n(\"584a\"),o=n(\"e53d\"),r=\"__core-js_shared__\",s=o[r]||(o[r]={});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})(\"versions\",[]).push({version:i.version,mode:n(\"b8e3\")?\"pure\":\"global\",copyright:\"© 2019 Denis Pushkarev (zloirock.ru)\"})},dc62:function(t,e,n){n(\"9427\");var i=n(\"584a\").Object;t.exports=function(t,e){return i.create(t,e)}},dcbc:function(t,e,n){var i=n(\"2aba\");t.exports=function(t,e,n){for(var o in e)i(t,o,e[o],n);return t}},e11e:function(t,e,n){\n/* @preserve\n * Leaflet 1.5.1+build.2e3e0ff, a JS library for interactive maps. http://leafletjs.com\n * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade\n */\n(function(t,n){n(e)})(0,function(t){\"use strict\";var e=\"1.5.1+build.2e3e0ffb\",n=Object.freeze;function i(t){var e,n,i,o;for(n=1,i=arguments.length;n<i;n++)for(e in o=arguments[n],o)t[e]=o[e];return t}Object.freeze=function(t){return t};var o=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function r(t,e){var n=Array.prototype.slice;if(t.bind)return t.bind.apply(t,n.call(arguments,1));var i=n.call(arguments,2);return function(){return t.apply(e,i.length?i.concat(n.call(arguments)):arguments)}}var s=0;function a(t){return t._leaflet_id=t._leaflet_id||++s,t._leaflet_id}function u(t,e,n){var i,o,r,s;return s=function(){i=!1,o&&(r.apply(n,o),o=!1)},r=function(){i?o=arguments:(t.apply(n,arguments),setTimeout(s,e),i=!0)},r}function h(t,e,n){var i=e[1],o=e[0],r=i-o;return t===i&&n?t:((t-o)%r+r)%r+o}function c(){return!1}function l(t,e){return e=void 0===e?6:e,+(Math.round(t+\"e+\"+e)+\"e-\"+e)}function f(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,\"\")}function d(t){return f(t).split(/\\s+/)}function p(t,e){for(var n in t.hasOwnProperty(\"options\")||(t.options=t.options?o(t.options):{}),e)t.options[n]=e[n];return t.options}function _(t,e,n){var i=[];for(var o in t)i.push(encodeURIComponent(n?o.toUpperCase():o)+\"=\"+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf(\"?\")?\"&\":\"?\")+i.join(\"&\")}var m=/\\{ *([\\w_-]+) *\\}/g;function v(t,e){return t.replace(m,function(t,n){var i=e[n];if(void 0===i)throw new Error(\"No value provided for variable \"+t);return\"function\"===typeof i&&(i=i(e)),i})}var g=Array.isArray||function(t){return\"[object Array]\"===Object.prototype.toString.call(t)};function y(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}var b=\"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=\";function x(t){return window[\"webkit\"+t]||window[\"moz\"+t]||window[\"ms\"+t]}var w=0;function P(t){var e=+new Date,n=Math.max(0,16-(e-w));return w=e+n,window.setTimeout(t,n)}var T=window.requestAnimationFrame||x(\"RequestAnimationFrame\")||P,S=window.cancelAnimationFrame||x(\"CancelAnimationFrame\")||x(\"CancelRequestAnimationFrame\")||function(t){window.clearTimeout(t)};function M(t,e,n){if(!n||T!==P)return T.call(window,r(t,e));t.call(e)}function C(t){t&&S.call(window,t)}var E=(Object.freeze||Object)({freeze:n,extend:i,create:o,bind:r,lastId:s,stamp:a,throttle:u,wrapNum:h,falseFn:c,formatNum:l,trim:f,splitWords:d,setOptions:p,getParamString:_,template:v,isArray:g,indexOf:y,emptyImageUrl:b,requestFn:T,cancelFn:S,requestAnimFrame:M,cancelAnimFrame:C});function O(){}function z(t){if(\"undefined\"!==typeof L&&L&&L.Mixin){t=g(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn(\"Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.\",(new Error).stack)}}O.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},n=e.__super__=this.prototype,r=o(n);for(var s in r.constructor=e,e.prototype=r,this)this.hasOwnProperty(s)&&\"prototype\"!==s&&\"__super__\"!==s&&(e[s]=this[s]);return t.statics&&(i(e,t.statics),delete t.statics),t.includes&&(z(t.includes),i.apply(null,[r].concat(t.includes)),delete t.includes),r.options&&(t.options=i(o(r.options),t.options)),i(r,t),r._initHooks=[],r.callInitHooks=function(){if(!this._initHooksCalled){n.callInitHooks&&n.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=r._initHooks.length;t<e;t++)r._initHooks[t].call(this)}},e},O.include=function(t){return i(this.prototype,t),this},O.mergeOptions=function(t){return i(this.prototype.options,t),this},O.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),n=\"function\"===typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var I={on:function(t,e,n){if(\"object\"===typeof t)for(var i in t)this._on(i,t[i],e);else{t=d(t);for(var o=0,r=t.length;o<r;o++)this._on(t[o],e,n)}return this},off:function(t,e,n){if(t)if(\"object\"===typeof t)for(var i in t)this._off(i,t[i],e);else{t=d(t);for(var o=0,r=t.length;o<r;o++)this._off(t[o],e,n)}else delete this._events;return this},_on:function(t,e,n){this._events=this._events||{};var i=this._events[t];i||(i=[],this._events[t]=i),n===this&&(n=void 0);for(var o={fn:e,ctx:n},r=i,s=0,a=r.length;s<a;s++)if(r[s].fn===e&&r[s].ctx===n)return;r.push(o)},_off:function(t,e,n){var i,o,r;if(this._events&&(i=this._events[t],i))if(e){if(n===this&&(n=void 0),i)for(o=0,r=i.length;o<r;o++){var s=i[o];if(s.ctx===n&&s.fn===e)return s.fn=c,this._firingCount&&(this._events[t]=i=i.slice()),void i.splice(o,1)}}else{for(o=0,r=i.length;o<r;o++)i[o].fn=c;delete this._events[t]}},fire:function(t,e,n){if(!this.listens(t,n))return this;var o=i({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var r=this._events[t];if(r){this._firingCount=this._firingCount+1||1;for(var s=0,a=r.length;s<a;s++){var u=r[s];u.fn.call(u.ctx||this,o)}this._firingCount--}}return n&&this._propagateEvent(o),this},listens:function(t,e){var n=this._events&&this._events[t];if(n&&n.length)return!0;if(e)for(var i in this._eventParents)if(this._eventParents[i].listens(t,e))return!0;return!1},once:function(t,e,n){if(\"object\"===typeof t){for(var i in t)this.once(i,t[i],e);return this}var o=r(function(){this.off(t,e,n).off(t,o,n)},this);return this.on(t,e,n).on(t,o,n)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,i({layer:t.target,propagatedFrom:t.target},t),!0)}};I.addEventListener=I.on,I.removeEventListener=I.clearAllEventListeners=I.off,I.addOneTimeEventListener=I.once,I.fireEvent=I.fire,I.hasEventListeners=I.listens;var k=O.extend(I);function A(t,e,n){this.x=n?Math.round(t):t,this.y=n?Math.round(e):e}var Z=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function B(t,e,n){return t instanceof A?t:g(t)?new A(t[0],t[1]):void 0===t||null===t?t:\"object\"===typeof t&&\"x\"in t&&\"y\"in t?new A(t.x,t.y):new A(t,e,n)}function j(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function R(t,e){return!t||t instanceof j?t:new j(t,e)}function N(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function D(t,e){return t instanceof N?t:new N(t,e)}function F(t,e,n){if(isNaN(t)||isNaN(e))throw new Error(\"Invalid LatLng object: (\"+t+\", \"+e+\")\");this.lat=+t,this.lng=+e,void 0!==n&&(this.alt=+n)}function W(t,e,n){return t instanceof F?t:g(t)&&\"object\"!==typeof t[0]?3===t.length?new F(t[0],t[1],t[2]):2===t.length?new F(t[0],t[1]):null:void 0===t||null===t?t:\"object\"===typeof t&&\"lat\"in t?new F(t.lat,\"lng\"in t?t.lng:t.lon,t.alt):void 0===e?null:new F(t,e,n)}A.prototype={clone:function(){return new A(this.x,this.y)},add:function(t){return this.clone()._add(B(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(B(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new A(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new A(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Z(this.x),this.y=Z(this.y),this},distanceTo:function(t){t=B(t);var e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},equals:function(t){return t=B(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=B(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return\"Point(\"+l(this.x)+\", \"+l(this.y)+\")\"}},j.prototype={extend:function(t){return t=B(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new A((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new A(this.min.x,this.max.y)},getTopRight:function(){return new A(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,n;return t=\"number\"===typeof t[0]||t instanceof A?B(t):R(t),t instanceof j?(e=t.min,n=t.max):e=n=t,e.x>=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,o=t.max,r=o.x>=e.x&&i.x<=n.x,s=o.y>=e.y&&i.y<=n.y;return r&&s},overlaps:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,o=t.max,r=o.x>e.x&&i.x<n.x,s=o.y>e.y&&i.y<n.y;return r&&s},isValid:function(){return!(!this.min||!this.max)}},N.prototype={extend:function(t){var e,n,i=this._southWest,o=this._northEast;if(t instanceof F)e=t,n=t;else{if(!(t instanceof N))return t?this.extend(W(t)||D(t)):this;if(e=t._southWest,n=t._northEast,!e||!n)return this}return i||o?(i.lat=Math.min(e.lat,i.lat),i.lng=Math.min(e.lng,i.lng),o.lat=Math.max(n.lat,o.lat),o.lng=Math.max(n.lng,o.lng)):(this._southWest=new F(e.lat,e.lng),this._northEast=new F(n.lat,n.lng)),this},pad:function(t){var e=this._southWest,n=this._northEast,i=Math.abs(e.lat-n.lat)*t,o=Math.abs(e.lng-n.lng)*t;return new N(new F(e.lat-i,e.lng-o),new F(n.lat+i,n.lng+o))},getCenter:function(){return new F((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new F(this.getNorth(),this.getWest())},getSouthEast:function(){return new F(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t=\"number\"===typeof t[0]||t instanceof F||\"lat\"in t?W(t):D(t);var e,n,i=this._southWest,o=this._northEast;return t instanceof N?(e=t.getSouthWest(),n=t.getNorthEast()):e=n=t,e.lat>=i.lat&&n.lat<=o.lat&&e.lng>=i.lng&&n.lng<=o.lng},intersects:function(t){t=D(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>=e.lat&&i.lat<=n.lat,s=o.lng>=e.lng&&i.lng<=n.lng;return r&&s},overlaps:function(t){t=D(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>e.lat&&i.lat<n.lat,s=o.lng>e.lng&&i.lng<n.lng;return r&&s},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(\",\")},equals:function(t,e){return!!t&&(t=D(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},F.prototype={equals:function(t,e){if(!t)return!1;t=W(t);var n=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return n<=(void 0===e?1e-9:e)},toString:function(t){return\"LatLng(\"+l(this.lat,t)+\", \"+l(this.lng,t)+\")\"},distanceTo:function(t){return U.distance(this,W(t))},wrap:function(){return U.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return D([this.lat-e,this.lng-n],[this.lat+e,this.lng+n])},clone:function(){return new F(this.lat,this.lng,this.alt)}};var H={latLngToPoint:function(t,e){var n=this.projection.project(t),i=this.scale(e);return this.transformation._transform(n,i)},pointToLatLng:function(t,e){var n=this.scale(e),i=this.transformation.untransform(t,n);return this.projection.unproject(i)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,n=this.scale(t),i=this.transformation.transform(e.min,n),o=this.transformation.transform(e.max,n);return new j(i,o)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?h(t.lng,this.wrapLng,!0):t.lng,n=this.wrapLat?h(t.lat,this.wrapLat,!0):t.lat,i=t.alt;return new F(n,e,i)},wrapLatLngBounds:function(t){var e=t.getCenter(),n=this.wrapLatLng(e),i=e.lat-n.lat,o=e.lng-n.lng;if(0===i&&0===o)return t;var r=t.getSouthWest(),s=t.getNorthEast(),a=new F(r.lat-i,r.lng-o),u=new F(s.lat-i,s.lng-o);return new N(a,u)}},U=i({},H,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var n=Math.PI/180,i=t.lat*n,o=e.lat*n,r=Math.sin((e.lat-t.lat)*n/2),s=Math.sin((e.lng-t.lng)*n/2),a=r*r+Math.cos(i)*Math.cos(o)*s*s,u=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*u}}),V=6378137,G={R:V,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,t.lat),-n),o=Math.sin(i*e);return new A(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new F((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=V*Math.PI;return new j([-t,-t],[t,t])}()};function q(t,e,n,i){if(g(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=n,this._d=i}function K(t,e,n,i){return new q(t,e,n,i)}q.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new A((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var $=i({},U,{code:\"EPSG:3857\",projection:G,transformation:function(){var t=.5/(Math.PI*G.R);return K(t,.5,-t,.5)}()}),Y=i({},$,{code:\"EPSG:900913\"});function X(t){return document.createElementNS(\"http://www.w3.org/2000/svg\",t)}function J(t,e){var n,i,o,r,s,a,u=\"\";for(n=0,o=t.length;n<o;n++){for(s=t[n],i=0,r=s.length;i<r;i++)a=s[i],u+=(i?\"L\":\"M\")+a.x+\" \"+a.y;u+=e?Et?\"z\":\"x\":\"\"}return u||\"M0 0\"}var Q=document.documentElement.style,tt=\"ActiveXObject\"in window,et=tt&&!document.addEventListener,nt=\"msLaunchUri\"in navigator&&!(\"documentMode\"in document),it=zt(\"webkit\"),ot=zt(\"android\"),rt=zt(\"android 2\")||zt(\"android 3\"),st=parseInt(/WebKit\\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&zt(\"Google\")&&st<537&&!(\"AudioNode\"in window),ut=!!window.opera,ht=zt(\"chrome\"),ct=zt(\"gecko\")&&!it&&!ut&&!tt,lt=!ht&&zt(\"safari\"),ft=zt(\"phantom\"),dt=\"OTransition\"in Q,pt=0===navigator.platform.indexOf(\"Win\"),_t=tt&&\"transition\"in Q,mt=\"WebKitCSSMatrix\"in window&&\"m11\"in new window.WebKitCSSMatrix&&!rt,vt=\"MozPerspective\"in Q,gt=!window.L_DISABLE_3D&&(_t||mt||vt)&&!dt&&!ft,yt=\"undefined\"!==typeof orientation||zt(\"mobile\"),bt=yt&&it,xt=yt&&mt,wt=!window.PointerEvent&&window.MSPointerEvent,Lt=!(!window.PointerEvent&&!wt),Pt=!window.L_NO_TOUCH&&(Lt||\"ontouchstart\"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Tt=yt&&ut,St=yt&&ct,Mt=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ct=function(){return!!document.createElement(\"canvas\").getContext}(),Et=!(!document.createElementNS||!X(\"svg\").createSVGRect),Ot=!Et&&function(){try{var t=document.createElement(\"div\");t.innerHTML='<v:shape adj=\"1\"/>';var e=t.firstChild;return e.style.behavior=\"url(#default#VML)\",e&&\"object\"===typeof e.adj}catch(n){return!1}}();function zt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var It=(Object.freeze||Object)({ie:tt,ielt9:et,edge:nt,webkit:it,android:ot,android23:rt,androidStock:at,opera:ut,chrome:ht,gecko:ct,safari:lt,phantom:ft,opera12:dt,win:pt,ie3d:_t,webkit3d:mt,gecko3d:vt,any3d:gt,mobile:yt,mobileWebkit:bt,mobileWebkit3d:xt,msPointer:wt,pointer:Lt,touch:Pt,mobileOpera:Tt,mobileGecko:St,retina:Mt,canvas:Ct,svg:Et,vml:Ot}),kt=wt?\"MSPointerDown\":\"pointerdown\",At=wt?\"MSPointerMove\":\"pointermove\",Zt=wt?\"MSPointerUp\":\"pointerup\",Bt=wt?\"MSPointerCancel\":\"pointercancel\",jt=[\"INPUT\",\"SELECT\",\"OPTION\"],Rt={},Nt=!1,Dt=0;function Ft(t,e,n,i){return\"touchstart\"===e?Ht(t,n,i):\"touchmove\"===e?Kt(t,n,i):\"touchend\"===e&&$t(t,n,i),this}function Wt(t,e,n){var i=t[\"_leaflet_\"+e+n];return\"touchstart\"===e?t.removeEventListener(kt,i,!1):\"touchmove\"===e?t.removeEventListener(At,i,!1):\"touchend\"===e&&(t.removeEventListener(Zt,i,!1),t.removeEventListener(Bt,i,!1)),this}function Ht(t,e,n){var i=r(function(t){if(\"mouse\"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(jt.indexOf(t.target.tagName)<0))return;He(t)}qt(t,e)});t[\"_leaflet_touchstart\"+n]=i,t.addEventListener(kt,i,!1),Nt||(document.documentElement.addEventListener(kt,Ut,!0),document.documentElement.addEventListener(At,Vt,!0),document.documentElement.addEventListener(Zt,Gt,!0),document.documentElement.addEventListener(Bt,Gt,!0),Nt=!0)}function Ut(t){Rt[t.pointerId]=t,Dt++}function Vt(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Gt(t){delete Rt[t.pointerId],Dt--}function qt(t,e){for(var n in t.touches=[],Rt)t.touches.push(Rt[n]);t.changedTouches=[t],e(t)}function Kt(t,e,n){var i=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&\"mouse\"!==t.pointerType||0!==t.buttons)&&qt(t,e)};t[\"_leaflet_touchmove\"+n]=i,t.addEventListener(At,i,!1)}function $t(t,e,n){var i=function(t){qt(t,e)};t[\"_leaflet_touchend\"+n]=i,t.addEventListener(Zt,i,!1),t.addEventListener(Bt,i,!1)}var Yt=wt?\"MSPointerDown\":Lt?\"pointerdown\":\"touchstart\",Xt=wt?\"MSPointerUp\":Lt?\"pointerup\":\"touchend\",Jt=\"_leaflet_\";function Qt(t,e,n){var i,o,r=!1,s=250;function a(t){var e;if(Lt){if(!nt||\"mouse\"===t.pointerType)return;e=Dt}else e=t.touches.length;if(!(e>1)){var n=Date.now(),a=n-(i||n);o=t.touches?t.touches[0]:t,r=a>0&&a<=s,i=n}}function u(t){if(r&&!o.cancelBubble){if(Lt){if(!nt||\"mouse\"===t.pointerType)return;var n,s,a={};for(s in o)n=o[s],a[s]=n&&n.bind?n.bind(o):n;o=a}o.type=\"dblclick\",o.button=0,e(o),i=null}}return t[Jt+Yt+n]=a,t[Jt+Xt+n]=u,t[Jt+\"dblclick\"+n]=e,t.addEventListener(Yt,a,!1),t.addEventListener(Xt,u,!1),t.addEventListener(\"dblclick\",e,!1),this}function te(t,e){var n=t[Jt+Yt+e],i=t[Jt+Xt+e],o=t[Jt+\"dblclick\"+e];return t.removeEventListener(Yt,n,!1),t.removeEventListener(Xt,i,!1),nt||t.removeEventListener(\"dblclick\",o,!1),this}var ee,ne,ie,oe,re,se=Le([\"transform\",\"webkitTransform\",\"OTransform\",\"MozTransform\",\"msTransform\"]),ae=Le([\"webkitTransition\",\"transition\",\"OTransition\",\"MozTransition\",\"msTransition\"]),ue=\"webkitTransition\"===ae||\"OTransition\"===ae?ae+\"End\":\"transitionend\";function he(t){return\"string\"===typeof t?document.getElementById(t):t}function ce(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||\"auto\"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(t,null);n=i?i[e]:null}return\"auto\"===n?null:n}function le(t,e,n){var i=document.createElement(t);return i.className=e||\"\",n&&n.appendChild(i),i}function fe(t){var e=t.parentNode;e&&e.removeChild(t)}function de(t){while(t.firstChild)t.removeChild(t.firstChild)}function pe(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function _e(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function me(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=be(t);return n.length>0&&new RegExp(\"(^|\\\\s)\"+e+\"(\\\\s|$)\").test(n)}function ve(t,e){if(void 0!==t.classList)for(var n=d(e),i=0,o=n.length;i<o;i++)t.classList.add(n[i]);else if(!me(t,e)){var r=be(t);ye(t,(r?r+\" \":\"\")+e)}}function ge(t,e){void 0!==t.classList?t.classList.remove(e):ye(t,f((\" \"+be(t)+\" \").replace(\" \"+e+\" \",\" \")))}function ye(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function be(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function xe(t,e){\"opacity\"in t.style?t.style.opacity=e:\"filter\"in t.style&&we(t,e)}function we(t,e){var n=!1,i=\"DXImageTransform.Microsoft.Alpha\";try{n=t.filters.item(i)}catch(o){if(1===e)return}e=Math.round(100*e),n?(n.Enabled=100!==e,n.Opacity=e):t.style.filter+=\" progid:\"+i+\"(opacity=\"+e+\")\"}function Le(t){for(var e=document.documentElement.style,n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1}function Pe(t,e,n){var i=e||new A(0,0);t.style[se]=(_t?\"translate(\"+i.x+\"px,\"+i.y+\"px)\":\"translate3d(\"+i.x+\"px,\"+i.y+\"px,0)\")+(n?\" scale(\"+n+\")\":\"\")}function Te(t,e){t._leaflet_pos=e,gt?Pe(t,e):(t.style.left=e.x+\"px\",t.style.top=e.y+\"px\")}function Se(t){return t._leaflet_pos||new A(0,0)}if(\"onselectstart\"in document)ee=function(){Ze(window,\"selectstart\",He)},ne=function(){je(window,\"selectstart\",He)};else{var Me=Le([\"userSelect\",\"WebkitUserSelect\",\"OUserSelect\",\"MozUserSelect\",\"msUserSelect\"]);ee=function(){if(Me){var t=document.documentElement.style;ie=t[Me],t[Me]=\"none\"}},ne=function(){Me&&(document.documentElement.style[Me]=ie,ie=void 0)}}function Ce(){Ze(window,\"dragstart\",He)}function Ee(){je(window,\"dragstart\",He)}function Oe(t){while(-1===t.tabIndex)t=t.parentNode;t.style&&(ze(),oe=t,re=t.style.outline,t.style.outline=\"none\",Ze(window,\"keydown\",ze))}function ze(){oe&&(oe.style.outline=re,oe=void 0,re=void 0,je(window,\"keydown\",ze))}function Ie(t){do{t=t.parentNode}while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function ke(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Ae=(Object.freeze||Object)({TRANSFORM:se,TRANSITION:ae,TRANSITION_END:ue,get:he,getStyle:ce,create:le,remove:fe,empty:de,toFront:pe,toBack:_e,hasClass:me,addClass:ve,removeClass:ge,setClass:ye,getClass:be,setOpacity:xe,testProp:Le,setTransform:Pe,setPosition:Te,getPosition:Se,disableTextSelection:ee,enableTextSelection:ne,disableImageDrag:Ce,enableImageDrag:Ee,preventOutline:Oe,restoreOutline:ze,getSizedParentNode:Ie,getScale:ke});function Ze(t,e,n,i){if(\"object\"===typeof e)for(var o in e)Re(t,o,e[o],n);else{e=d(e);for(var r=0,s=e.length;r<s;r++)Re(t,e[r],n,i)}return this}var Be=\"_leaflet_events\";function je(t,e,n,i){if(\"object\"===typeof e)for(var o in e)Ne(t,o,e[o],n);else if(e){e=d(e);for(var r=0,s=e.length;r<s;r++)Ne(t,e[r],n,i)}else{for(var a in t[Be])Ne(t,a,t[Be][a]);delete t[Be]}return this}function Re(t,e,n,i){var o=e+a(n)+(i?\"_\"+a(i):\"\");if(t[Be]&&t[Be][o])return this;var r=function(e){return n.call(i||t,e||window.event)},s=r;Lt&&0===e.indexOf(\"touch\")?Ft(t,e,r,o):!Pt||\"dblclick\"!==e||!Qt||Lt&&ht?\"addEventListener\"in t?\"mousewheel\"===e?t.addEventListener(\"onwheel\"in t?\"wheel\":\"mousewheel\",r,!1):\"mouseenter\"===e||\"mouseleave\"===e?(r=function(e){e=e||window.event,Je(t,e)&&s(e)},t.addEventListener(\"mouseenter\"===e?\"mouseover\":\"mouseout\",r,!1)):(\"click\"===e&&ot&&(r=function(t){Qe(t,s)}),t.addEventListener(e,r,!1)):\"attachEvent\"in t&&t.attachEvent(\"on\"+e,r):Qt(t,r,o),t[Be]=t[Be]||{},t[Be][o]=r}function Ne(t,e,n,i){var o=e+a(n)+(i?\"_\"+a(i):\"\"),r=t[Be]&&t[Be][o];if(!r)return this;Lt&&0===e.indexOf(\"touch\")?Wt(t,e,o):!Pt||\"dblclick\"!==e||!te||Lt&&ht?\"removeEventListener\"in t?\"mousewheel\"===e?t.removeEventListener(\"onwheel\"in t?\"wheel\":\"mousewheel\",r,!1):t.removeEventListener(\"mouseenter\"===e?\"mouseover\":\"mouseleave\"===e?\"mouseout\":e,r,!1):\"detachEvent\"in t&&t.detachEvent(\"on\"+e,r):te(t,o),t[Be][o]=null}function De(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Xe(t),this}function Fe(t){return Re(t,\"mousewheel\",De),this}function We(t){return Ze(t,\"mousedown touchstart dblclick\",De),Re(t,\"click\",Ye),this}function He(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ue(t){return He(t),De(t),this}function Ve(t,e){if(!e)return new A(t.clientX,t.clientY);var n=ke(e),i=n.boundingClientRect;return new A((t.clientX-i.left)/n.x-e.clientLeft,(t.clientY-i.top)/n.y-e.clientTop)}var Ge=pt&&ht?2*window.devicePixelRatio:ct?window.devicePixelRatio:1;function qe(t){return nt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Ge:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ke,$e={};function Ye(t){$e[t.type]=!0}function Xe(t){var e=$e[t.type];return $e[t.type]=!1,e}function Je(t,e){var n=e.relatedTarget;if(!n)return!0;try{while(n&&n!==t)n=n.parentNode}catch(i){return!1}return n!==t}function Qe(t,e){var n=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,i=Ke&&n-Ke;i&&i>100&&i<500||t.target._simulatedClick&&!t._simulated?Ue(t):(Ke=n,e(t))}var tn=(Object.freeze||Object)({on:Ze,off:je,stopPropagation:De,disableScrollPropagation:Fe,disableClickPropagation:We,preventDefault:He,stop:Ue,getMousePosition:Ve,getWheelDelta:qe,fakeStop:Ye,skipped:Xe,isExternalTarget:Je,addListener:Ze,removeListener:je}),en=k.extend({run:function(t,e,n,i){this.stop(),this._el=t,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=Se(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire(\"start\"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=M(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,n=1e3*this._duration;e<n?this._runFrame(this._easeOut(e/n),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var n=this._startPos.add(this._offset.multiplyBy(t));e&&n._round(),Te(this._el,n),this.fire(\"step\")},_complete:function(){C(this._animId),this._inProgress=!1,this.fire(\"end\")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),nn=k.extend({options:{crs:$,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=p(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(W(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&gt&&!Tt&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ze(this._proxy,ue,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,n){if(e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(W(t),e,this.options.maxBounds),n=n||{},this._stop(),this._loaded&&!n.reset&&!0!==n){void 0!==n.animate&&(n.zoom=i({animate:n.animate},n.zoom),n.pan=i({animate:n.animate,duration:n.duration},n.pan));var o=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,n.zoom):this._tryAnimatedPan(t,n.pan);if(o)return clearTimeout(this._sizeTimer),this}return this._resetView(t,e),this},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(gt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(gt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,n){var i=this.getZoomScale(e),o=this.getSize().divideBy(2),r=t instanceof A?t:this.latLngToContainerPoint(t),s=r.subtract(o).multiplyBy(1-1/i),a=this.containerPointToLatLng(o.add(s));return this.setView(a,e,{zoom:n})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():D(t);var n=B(e.paddingTopLeft||e.padding||[0,0]),i=B(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,n.add(i));if(o=\"number\"===typeof e.maxZoom?Math.min(e.maxZoom,o):o,o===1/0)return{center:t.getCenter(),zoom:o};var r=i.subtract(n).divideBy(2),s=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o),u=this.unproject(s.add(a).divideBy(2).add(r),o);return{center:u,zoom:o}},fitBounds:function(t,e){if(t=D(t),!t.isValid())throw new Error(\"Bounds are not valid.\");var n=this._getBoundsCenterZoom(t,e);return this.setView(n.center,n.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(t=B(t).round(),e=e||{},!t.x&&!t.y)return this.fire(\"moveend\");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new en,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire(\"movestart\"),!1!==e.animate){ve(this._mapPane,\"leaflet-pan-anim\");var n=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,n,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire(\"move\").fire(\"moveend\");return this},flyTo:function(t,e,n){if(n=n||{},!1===n.animate||!gt)return this.setView(t,e,n);this._stop();var i=this.project(this.getCenter()),o=this.project(t),r=this.getSize(),s=this._zoom;t=W(t),e=void 0===e?s:e;var a=Math.max(r.x,r.y),u=a*this.getZoomScale(s,e),h=o.distanceTo(i)||1,c=1.42,l=c*c;function f(t){var e=t?-1:1,n=t?u:a,i=u*u-a*a+e*l*l*h*h,o=2*n*l*h,r=i/o,s=Math.sqrt(r*r+1)-r,c=s<1e-9?-18:Math.log(s);return c}function d(t){return(Math.exp(t)-Math.exp(-t))/2}function p(t){return(Math.exp(t)+Math.exp(-t))/2}function _(t){return d(t)/p(t)}var m=f(0);function v(t){return a*(p(m)/p(m+c*t))}function g(t){return a*(p(m)*_(m+c*t)-d(m))/l}function y(t){return 1-Math.pow(1-t,1.5)}var b=Date.now(),x=(f(1)-m)/c,w=n.duration?1e3*n.duration:1e3*x*.8;function L(){var n=(Date.now()-b)/w,r=y(n)*x;n<=1?(this._flyToFrame=M(L,this),this._move(this.unproject(i.add(o.subtract(i).multiplyBy(g(r)/h)),s),this.getScaleZoom(a/v(r),s),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),L.call(this),this},flyToBounds:function(t,e){var n=this._getBoundsCenterZoom(t,e);return this.flyTo(n.center,n.zoom,e)},setMaxBounds:function(t){return t=D(t),t.isValid()?(this.options.maxBounds&&this.off(\"moveend\",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on(\"moveend\",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off(\"moveend\",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire(\"zoomlevelschange\"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire(\"zoomlevelschange\"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,D(t));return n.equals(i)||this.panTo(i,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var n=B(e.paddingTopLeft||e.padding||[0,0]),i=B(e.paddingBottomRight||e.padding||[0,0]),o=this.getCenter(),r=this.project(o),s=this.project(t),a=this.getPixelBounds(),u=a.getSize().divideBy(2),h=R([a.min.add(n),a.max.subtract(i)]);if(!h.contains(s)){this._enforcingBounds=!0;var c=r.subtract(s),l=B(s.x+c.x,s.y+c.y);(s.x<h.min.x||s.x>h.max.x)&&(l.x=r.x-c.x,c.x>0?l.x+=u.x-n.x:l.x-=u.x-i.x),(s.y<h.min.y||s.y>h.max.y)&&(l.y=r.y-c.y,c.y>0?l.y+=u.y-n.y:l.y-=u.y-i.y),this.panTo(this.unproject(l),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=i({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var n=this.getSize(),o=e.divideBy(2).round(),s=n.divideBy(2).round(),a=o.subtract(s);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire(\"move\"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,\"moveend\"),200)):this.fire(\"moveend\")),this.fire(\"resize\",{oldSize:e,newSize:n})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire(\"viewreset\"),this._stop()},locate:function(t){if(t=this._locateOptions=i({timeout:1e4,watch:!1},t),!(\"geolocation\"in navigator))return this._handleGeolocationError({code:0,message:\"Geolocation not supported.\"}),this;var e=r(this._handleGeolocationResponse,this),n=r(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,n,t):navigator.geolocation.getCurrentPosition(e,n,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,n=t.message||(1===e?\"permission denied\":2===e?\"position unavailable\":\"timeout\");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire(\"locationerror\",{code:e,message:\"Geolocation error: \"+n+\".\"})},_handleGeolocationResponse:function(t){var e=t.coords.latitude,n=t.coords.longitude,i=new F(e,n),o=i.toBounds(2*t.coords.accuracy),r=this._locateOptions;if(r.setView){var s=this.getBoundsZoom(o);this.setView(i,r.maxZoom?Math.min(s,r.maxZoom):s)}var a={latlng:i,bounds:o,timestamp:t.timestamp};for(var u in t.coords)\"number\"===typeof t.coords[u]&&(a[u]=t.coords[u]);this.fire(\"locationfound\",a)},addHandler:function(t,e){if(!e)return this;var n=this[t]=new e(this);return this._handlers.push(n),this.options[t]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error(\"Map container is being reused by another instance\");try{delete this._container._leaflet_id,delete this._containerId}catch(e){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),fe(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire(\"unload\"),this._layers)this._layers[t].remove();for(t in this._panes)fe(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var n=\"leaflet-pane\"+(t?\" leaflet-\"+t.replace(\"Pane\",\"\")+\"-pane\":\"\"),i=le(\"div\",n,e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),n=this.unproject(t.getTopRight());return new N(e,n)},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=D(t),n=B(n||[0,0]);var i=this.getZoom()||0,o=this.getMinZoom(),r=this.getMaxZoom(),s=t.getNorthWest(),a=t.getSouthEast(),u=this.getSize().subtract(n),h=R(this.project(a,i),this.project(s,i)).getSize(),c=gt?this.options.zoomSnap:1,l=u.x/h.x,f=u.y/h.y,d=e?Math.max(l,f):Math.min(l,f);return i=this.getScaleZoom(d,i),c&&(i=Math.round(i/(c/100))*(c/100),i=e?Math.ceil(i/c)*c:Math.floor(i/c)*c),Math.max(o,Math.min(r,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new A(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var n=this._getTopLeftPoint(t,e);return new j(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return\"string\"===typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;e=void 0===e?this._zoom:e;var i=n.zoom(t*n.scale(e));return isNaN(i)?1/0:i},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(W(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(B(t),e)},layerPointToLatLng:function(t){var e=B(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(W(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(W(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(D(t))},distance:function(t,e){return this.options.crs.distance(W(t),W(e))},containerPointToLayerPoint:function(t){return B(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return B(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(B(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)))},mouseEventToContainerPoint:function(t){return Ve(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=he(t);if(!e)throw new Error(\"Map container not found.\");if(e._leaflet_id)throw new Error(\"Map container is already initialized.\");Ze(e,\"scroll\",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&gt,ve(t,\"leaflet-container\"+(Pt?\" leaflet-touch\":\"\")+(Mt?\" leaflet-retina\":\"\")+(et?\" leaflet-oldie\":\"\")+(lt?\" leaflet-safari\":\"\")+(this._fadeAnimated?\" leaflet-fade-anim\":\"\"));var e=ce(t,\"position\");\"absolute\"!==e&&\"relative\"!==e&&\"fixed\"!==e&&(t.style.position=\"relative\"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane(\"mapPane\",this._container),Te(this._mapPane,new A(0,0)),this.createPane(\"tilePane\"),this.createPane(\"shadowPane\"),this.createPane(\"overlayPane\"),this.createPane(\"markerPane\"),this.createPane(\"tooltipPane\"),this.createPane(\"popupPane\"),this.options.markerZoomAnimation||(ve(t.markerPane,\"leaflet-zoom-hide\"),ve(t.shadowPane,\"leaflet-zoom-hide\"))},_resetView:function(t,e){Te(this._mapPane,new A(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire(\"viewprereset\");var i=this._zoom!==e;this._moveStart(i,!1)._move(t,e)._moveEnd(i),this.fire(\"viewreset\"),n&&this.fire(\"load\")},_moveStart:function(t,e){return t&&this.fire(\"zoomstart\"),e||this.fire(\"movestart\"),this},_move:function(t,e,n){void 0===e&&(e=this._zoom);var i=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(i||n&&n.pinch)&&this.fire(\"zoom\",n),this.fire(\"move\",n)},_moveEnd:function(t){return t&&this.fire(\"zoomend\"),this.fire(\"moveend\")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Te(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error(\"Set map center and zoom first.\")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?je:Ze;e(this._container,\"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup\",this._handleDOMEvent,this),this.options.trackResize&&e(window,\"resize\",this._onResize,this),gt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,\"moveend\",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){var n,i=[],o=\"mouseout\"===e||\"mouseover\"===e,r=t.target||t.srcElement,s=!1;while(r){if(n=this._targets[a(r)],n&&(\"click\"===e||\"preclick\"===e)&&!t._simulated&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(o&&!Je(r,t))break;if(i.push(n),o)break}if(r===this._container)break;r=r.parentNode}return i.length||s||o||!Je(r,t)||(i=[this]),i},_handleDOMEvent:function(t){if(this._loaded&&!Xe(t)){var e=t.type;\"mousedown\"!==e&&\"keypress\"!==e&&\"keyup\"!==e&&\"keydown\"!==e||Oe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:[\"click\",\"dblclick\",\"mouseover\",\"mouseout\",\"contextmenu\"],_fireDOMEvent:function(t,e,n){if(\"click\"===t.type){var o=i({},t);o.type=\"preclick\",this._fireDOMEvent(o,o.type,n)}if(!t._stopped&&(n=(n||[]).concat(this._findEventTargets(t,e)),n.length)){var r=n[0];\"contextmenu\"===e&&r.listens(e,!0)&&He(t);var s={originalEvent:t};if(\"keypress\"!==t.type&&\"keydown\"!==t.type&&\"keyup\"!==t.type){var a=r.getLatLng&&(!r._radius||r._radius<=10);s.containerPoint=a?this.latLngToContainerPoint(r.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=a?r.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var u=0;u<n.length;u++)if(n[u].fire(e,s,!0),s.originalEvent._stopped||!1===n[u].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,e))return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on(\"load\",t,e),this},_getMapPanePos:function(){return Se(this._mapPane)||new A(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){var n=t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin();return n.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var n=this.getSize()._divideBy(2);return this.project(t,e)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return this.project(t,e)._subtract(i)},_latLngBoundsToNewLayerBounds:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return R([this.project(t.getSouthWest(),e)._subtract(i),this.project(t.getNorthWest(),e)._subtract(i),this.project(t.getSouthEast(),e)._subtract(i),this.project(t.getNorthEast(),e)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,n){if(!n)return t;var i=this.project(t,e),o=this.getSize().divideBy(2),r=new j(i.subtract(o),i.add(o)),s=this._getBoundsOffset(r,n,e);return s.round().equals([0,0])?t:this.unproject(i.add(s),e)},_limitOffset:function(t,e){if(!e)return t;var n=this.getPixelBounds(),i=new j(n.min.add(t),n.max.add(t));return t.add(this._getBoundsOffset(i,e))},_getBoundsOffset:function(t,e,n){var i=R(this.project(e.getNorthEast(),n),this.project(e.getSouthWest(),n)),o=i.min.subtract(t.min),r=i.max.subtract(t.max),s=this._rebound(o.x,-r.x),a=this._rebound(o.y,-r.y);return new A(s,a)},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),n=this.getMaxZoom(),i=gt?this.options.zoomSnap:1;return i&&(t=Math.round(t/i)*i),Math.max(e,Math.min(n,t))},_onPanTransitionStep:function(){this.fire(\"move\")},_onPanTransitionEnd:function(){ge(this._mapPane,\"leaflet-pan-anim\"),this.fire(\"moveend\")},_tryAnimatedPan:function(t,e){var n=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(n))&&(this.panBy(n,e),!0)},_createAnimProxy:function(){var t=this._proxy=le(\"div\",\"leaflet-proxy leaflet-zoom-animated\");this._panes.mapPane.appendChild(t),this.on(\"zoomanim\",function(t){var e=se,n=this._proxy.style[e];Pe(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),n===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on(\"load moveend\",function(){var t=this.getCenter(),e=this.getZoom();Pe(this._proxy,this.project(t,e),this.getZoomScale(e,1))},this),this._on(\"unload\",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){fe(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf(\"transform\")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName(\"leaflet-zoom-animated\").length},_tryAnimatedZoom:function(t,e,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,\"leaflet-zoom-anim\")),this.fire(\"zoomanim\",{center:t,zoom:e,noUpdate:i}),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ge(this._mapPane,\"leaflet-zoom-anim\"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function on(t,e){return new nn(t,e)}var rn=O.extend({options:{position:\"topright\"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition(),i=t._controlCorners[n];return ve(e,\"leaflet-control\"),-1!==n.indexOf(\"bottom\")?i.insertBefore(e,i.firstChild):i.appendChild(e),this._map.on(\"unload\",this.remove,this),this},remove:function(){return this._map?(fe(this._container),this.onRemove&&this.onRemove(this._map),this._map.off(\"unload\",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),sn=function(t){return new rn(t)};nn.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e=\"leaflet-\",n=this._controlContainer=le(\"div\",e+\"control-container\",this._container);function i(i,o){var r=e+i+\" \"+e+o;t[i+o]=le(\"div\",r,n)}i(\"top\",\"left\"),i(\"top\",\"right\"),i(\"bottom\",\"left\"),i(\"bottom\",\"right\")},_clearControlPos:function(){for(var t in this._controlCorners)fe(this._controlCorners[t]);fe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var an=rn.extend({options:{collapsed:!0,position:\"topright\",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,n,i){return n<i?-1:i<n?1:0}},initialize:function(t,e,n){for(var i in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i);for(i in e)this._addLayer(e[i],i,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on(\"zoomend\",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on(\"add remove\",this._onLayerChange,this);return this._container},addTo:function(t){return rn.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off(\"zoomend\",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off(\"add remove\",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off(\"add remove\",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,\"leaflet-control-layers-expanded\"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,\"leaflet-control-layers-scrollbar\"),this._section.style.height=t+\"px\"):ge(this._section,\"leaflet-control-layers-scrollbar\"),this._checkDisabledLayers(),this},collapse:function(){return ge(this._container,\"leaflet-control-layers-expanded\"),this},_initLayout:function(){var t=\"leaflet-control-layers\",e=this._container=le(\"div\",t),n=this.options.collapsed;e.setAttribute(\"aria-haspopup\",!0),We(e),Fe(e);var i=this._section=le(\"section\",t+\"-list\");n&&(this._map.on(\"click\",this.collapse,this),ot||Ze(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=le(\"a\",t+\"-toggle\",e);o.href=\"#\",o.title=\"Layers\",Pt?(Ze(o,\"click\",Ue),Ze(o,\"click\",this.expand,this)):Ze(o,\"focus\",this.expand,this),n||this.expand(),this._baseLayersList=le(\"div\",t+\"-base\",i),this._separator=le(\"div\",t+\"-separator\",i),this._overlaysList=le(\"div\",t+\"-overlays\",i),e.appendChild(i)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,n){this._map&&t.on(\"add remove\",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:n}),this.options.sortLayers&&this._layers.sort(r(function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;de(this._baseLayersList),de(this._overlaysList),this._layerControlInputs=[];var t,e,n,i,o=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,o+=i.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?\"\":\"none\"),this._separator.style.display=e&&t?\"\":\"none\",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),n=e.overlay?\"add\"===t.type?\"overlayadd\":\"overlayremove\":\"add\"===t.type?\"baselayerchange\":null;n&&this._map.fire(n,e)},_createRadioElement:function(t,e){var n='<input type=\"radio\" class=\"leaflet-control-layers-selector\" name=\"'+t+'\"'+(e?' checked=\"checked\"':\"\")+\"/>\",i=document.createElement(\"div\");return i.innerHTML=n,i.firstChild},_addItem:function(t){var e,n=document.createElement(\"label\"),i=this._map.hasLayer(t.layer);t.overlay?(e=document.createElement(\"input\"),e.type=\"checkbox\",e.className=\"leaflet-control-layers-selector\",e.defaultChecked=i):e=this._createRadioElement(\"leaflet-base-layers_\"+a(this),i),this._layerControlInputs.push(e),e.layerId=a(t.layer),Ze(e,\"click\",this._onInputClick,this);var o=document.createElement(\"span\");o.innerHTML=\" \"+t.name;var r=document.createElement(\"div\");n.appendChild(r),r.appendChild(e),r.appendChild(o);var s=t.overlay?this._overlaysList:this._baseLayersList;return s.appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){var t,e,n=this._layerControlInputs,i=[],o=[];this._handlingClick=!0;for(var r=n.length-1;r>=0;r--)t=n[r],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||o.push(e);for(r=0;r<o.length;r++)this._map.hasLayer(o[r])&&this._map.removeLayer(o[r]);for(r=0;r<i.length;r++)this._map.hasLayer(i[r])||this._map.addLayer(i[r]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,n=this._layerControlInputs,i=this._map.getZoom(),o=n.length-1;o>=0;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&i<e.options.minZoom||void 0!==e.options.maxZoom&&i>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),un=function(t,e,n){return new an(t,e,n)},hn=rn.extend({options:{position:\"topleft\",zoomInText:\"+\",zoomInTitle:\"Zoom in\",zoomOutText:\"&#x2212;\",zoomOutTitle:\"Zoom out\"},onAdd:function(t){var e=\"leaflet-control-zoom\",n=le(\"div\",e+\" leaflet-bar\"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+\"-in\",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+\"-out\",n,this._zoomOut),this._updateDisabled(),t.on(\"zoomend zoomlevelschange\",this._updateDisabled,this),n},onRemove:function(t){t.off(\"zoomend zoomlevelschange\",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,o){var r=le(\"a\",n,i);return r.innerHTML=t,r.href=\"#\",r.title=e,r.setAttribute(\"role\",\"button\"),r.setAttribute(\"aria-label\",e),We(r),Ze(r,\"click\",Ue),Ze(r,\"click\",o,this),Ze(r,\"click\",this._refocusOnMap,this),r},_updateDisabled:function(){var t=this._map,e=\"leaflet-disabled\";ge(this._zoomInButton,e),ge(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});nn.mergeOptions({zoomControl:!0}),nn.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new hn,this.addControl(this.zoomControl))});var cn=function(t){return new hn(t)},ln=rn.extend({options:{position:\"bottomleft\",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e=\"leaflet-control-scale\",n=le(\"div\",e),i=this.options;return this._addScales(i,e+\"-line\",n),t.on(i.updateWhenIdle?\"moveend\":\"move\",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?\"moveend\":\"move\",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=le(\"div\",e,n)),t.imperial&&(this._iScale=le(\"div\",e,n))},_update:function(){var t=this._map,e=t.getSize().y/2,n=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(n)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),n=e<1e3?e+\" m\":e/1e3+\" km\";this._updateScale(this._mScale,n,e/t)},_updateImperial:function(t){var e,n,i,o=3.2808399*t;o>5280?(e=o/5280,n=this._getRoundNum(e),this._updateScale(this._iScale,n+\" mi\",n/e)):(i=this._getRoundNum(o),this._updateScale(this._iScale,i+\" ft\",i/o))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+\"px\",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+\"\").length-1),n=t/e;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1,e*n}}),fn=function(t){return new ln(t)},dn=rn.extend({options:{position:\"bottomright\",prefix:'<a href=\"https://leafletjs.com\" title=\"A JS library for interactive maps\">Leaflet</a>'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=le(\"div\",\"leaflet-control-attribution\"),We(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var n=[];this.options.prefix&&n.push(this.options.prefix),t.length&&n.push(t.join(\", \")),this._container.innerHTML=n.join(\" | \")}}});nn.mergeOptions({attributionControl:!0}),nn.addInitHook(function(){this.options.attributionControl&&(new dn).addTo(this)});var pn=function(t){return new dn(t)};rn.Layers=an,rn.Zoom=hn,rn.Scale=ln,rn.Attribution=dn,sn.layers=un,sn.zoom=cn,sn.scale=fn,sn.attribution=pn;var _n=O.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});_n.addTo=function(t,e){return t.addHandler(e,this),this};var mn,vn={Events:I},gn=Pt?\"touchstart mousedown\":\"mousedown\",yn={mousedown:\"mouseup\",touchstart:\"touchend\",pointerdown:\"touchend\",MSPointerDown:\"touchend\"},bn={mousedown:\"mousemove\",touchstart:\"touchmove\",pointerdown:\"touchmove\",MSPointerDown:\"touchmove\"},xn=k.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){p(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(Ze(this._dragStartTarget,gn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xn._dragging===this&&this.finishDrag(),je(this._dragStartTarget,gn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!me(this._element,\"leaflet-zoom-anim\")&&!(xn._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches)&&(xn._dragging=this,this._preventOutline&&Oe(this._element),Ce(),ee(),!this._moving))){this.fire(\"down\");var e=t.touches?t.touches[0]:t,n=Ie(this._element);this._startPoint=new A(e.clientX,e.clientY),this._parentScale=ke(n),Ze(document,bn[t.type],this._onMove,this),Ze(document,yn[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,n=new A(e.clientX,e.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,He(t),this._moved||(this.fire(\"dragstart\"),this._moved=!0,this._startPos=Se(this._element).subtract(n),ve(document.body,\"leaflet-dragging\"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,\"leaflet-drag-target\")),this._newPos=this._startPos.add(n),this._moving=!0,C(this._animRequest),this._lastEvent=t,this._animRequest=M(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire(\"predrag\",t),Te(this._element,this._newPos),this.fire(\"drag\",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ge(document.body,\"leaflet-dragging\"),this._lastTarget&&(ge(this._lastTarget,\"leaflet-drag-target\"),this._lastTarget=null),bn)je(document,bn[t],this._onMove,this),je(document,yn[t],this._onUp,this);Ee(),ne(),this._moved&&this._moving&&(C(this._animRequest),this.fire(\"dragend\",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xn._dragging=!1}});function wn(t,e){if(!e||!t.length)return t.slice();var n=e*e;return t=Mn(t,n),t=Tn(t,n),t}function Ln(t,e,n){return Math.sqrt(In(t,e,n,!0))}function Pn(t,e,n){return In(t,e,n)}function Tn(t,e){var n=t.length,i=typeof Uint8Array!==void 0+\"\"?Uint8Array:Array,o=new i(n);o[0]=o[n-1]=1,Sn(t,o,e,0,n-1);var r,s=[];for(r=0;r<n;r++)o[r]&&s.push(t[r]);return s}function Sn(t,e,n,i,o){var r,s,a,u=0;for(s=i+1;s<=o-1;s++)a=In(t[s],t[i],t[o],!0),a>u&&(r=s,u=a);u>n&&(e[r]=1,Sn(t,e,n,i,r),Sn(t,e,n,r,o))}function Mn(t,e){for(var n=[t[0]],i=1,o=0,r=t.length;i<r;i++)zn(t[i],t[o])>e&&(n.push(t[i]),o=i);return o<r-1&&n.push(t[r-1]),n}function Cn(t,e,n,i,o){var r,s,a,u=i?mn:On(t,n),h=On(e,n);mn=h;while(1){if(!(u|h))return[t,e];if(u&h)return!1;r=u||h,s=En(t,e,r,n,o),a=On(s,n),r===u?(t=s,u=a):(e=s,h=a)}}function En(t,e,n,i,o){var r,s,a=e.x-t.x,u=e.y-t.y,h=i.min,c=i.max;return 8&n?(r=t.x+a*(c.y-t.y)/u,s=c.y):4&n?(r=t.x+a*(h.y-t.y)/u,s=h.y):2&n?(r=c.x,s=t.y+u*(c.x-t.x)/a):1&n&&(r=h.x,s=t.y+u*(h.x-t.x)/a),new A(r,s,o)}function On(t,e){var n=0;return t.x<e.min.x?n|=1:t.x>e.max.x&&(n|=2),t.y<e.min.y?n|=4:t.y>e.max.y&&(n|=8),n}function zn(t,e){var n=e.x-t.x,i=e.y-t.y;return n*n+i*i}function In(t,e,n,i){var o,r=e.x,s=e.y,a=n.x-r,u=n.y-s,h=a*a+u*u;return h>0&&(o=((t.x-r)*a+(t.y-s)*u)/h,o>1?(r=n.x,s=n.y):o>0&&(r+=a*o,s+=u*o)),a=t.x-r,u=t.y-s,i?a*a+u*u:new A(r,s)}function kn(t){return!g(t[0])||\"object\"!==typeof t[0][0]&&\"undefined\"!==typeof t[0][0]}function An(t){return console.warn(\"Deprecated use of _flat, please use L.LineUtil.isFlat instead.\"),kn(t)}var Zn=(Object.freeze||Object)({simplify:wn,pointToSegmentDistance:Ln,closestPointOnSegment:Pn,clipSegment:Cn,_getEdgeIntersection:En,_getBitCode:On,_sqClosestPointOnSegment:In,isFlat:kn,_flat:An});function Bn(t,e,n){var i,o,r,s,a,u,h,c,l,f=[1,4,2,8];for(o=0,h=t.length;o<h;o++)t[o]._code=On(t[o],e);for(s=0;s<4;s++){for(c=f[s],i=[],o=0,h=t.length,r=h-1;o<h;r=o++)a=t[o],u=t[r],a._code&c?u._code&c||(l=En(u,a,c,e,n),l._code=On(l,e),i.push(l)):(u._code&c&&(l=En(u,a,c,e,n),l._code=On(l,e),i.push(l)),i.push(a));t=i}return t}var jn=(Object.freeze||Object)({clipPolygon:Bn}),Rn={project:function(t){return new A(t.lng,t.lat)},unproject:function(t){return new F(t.y,t.x)},bounds:new j([-180,-90],[180,90])},Nn={R:6378137,R_MINOR:6356752.314245179,bounds:new j([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,n=this.R,i=t.lat*e,o=this.R_MINOR/n,r=Math.sqrt(1-o*o),s=r*Math.sin(i),a=Math.tan(Math.PI/4-i/2)/Math.pow((1-s)/(1+s),r/2);return i=-n*Math.log(Math.max(a,1e-10)),new A(t.lng*e*n,i)},unproject:function(t){for(var e,n=180/Math.PI,i=this.R,o=this.R_MINOR/i,r=Math.sqrt(1-o*o),s=Math.exp(-t.y/i),a=Math.PI/2-2*Math.atan(s),u=0,h=.1;u<15&&Math.abs(h)>1e-7;u++)e=r*Math.sin(a),e=Math.pow((1-e)/(1+e),r/2),h=Math.PI/2-2*Math.atan(s*e)-a,a+=h;return new F(a*n,t.x*n/i)}},Dn=(Object.freeze||Object)({LonLat:Rn,Mercator:Nn,SphericalMercator:G}),Fn=i({},U,{code:\"EPSG:3395\",projection:Nn,transformation:function(){var t=.5/(Math.PI*Nn.R);return K(t,.5,-t,.5)}()}),Wn=i({},U,{code:\"EPSG:4326\",projection:Rn,transformation:K(1/180,1,-1/180,.5)}),Hn=i({},H,{projection:Rn,transformation:K(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var n=e.lng-t.lng,i=e.lat-t.lat;return Math.sqrt(n*n+i*i)},infinite:!0});H.Earth=U,H.EPSG3395=Fn,H.EPSG3857=$,H.EPSG900913=Y,H.EPSG4326=Wn,H.Simple=Hn;var Un=k.extend({options:{pane:\"overlayPane\",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var n=this.getEvents();e.on(n,this),this.once(\"remove\",function(){e.off(n,this)},this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire(\"add\"),e.fire(\"layeradd\",{layer:this})}}});nn.include({addLayer:function(t){if(!t._layerAdd)throw new Error(\"The provided object is not a Layer.\");var e=a(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire(\"layerremove\",{layer:t}),t.fire(\"remove\")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},_addLayers:function(t){t=t?g(t)?t:[t]:[];for(var e=0,n=t.length;e<n;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var o=this._zoomBoundLayers[i].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,n!==this._getZoomSpan()&&this.fire(\"zoomlevelschange\"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Vn=Un.extend({initialize:function(t,e){var n,i;if(p(this,e),this._layers={},t)for(n=0,i=t.length;n<i;n++)this.addLayer(t[n])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,n,i=Array.prototype.slice.call(arguments,1);for(e in this._layers)n=this._layers[e],n[t]&&n[t].apply(n,i);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke(\"setZIndex\",t)},getLayerId:function(t){return a(t)}}),Gn=function(t,e){return new Vn(t,e)},qn=Vn.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Vn.prototype.addLayer.call(this,t),this.fire(\"layeradd\",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Vn.prototype.removeLayer.call(this,t),this.fire(\"layerremove\",{layer:t})):this},setStyle:function(t){return this.invoke(\"setStyle\",t)},bringToFront:function(){return this.invoke(\"bringToFront\")},bringToBack:function(){return this.invoke(\"bringToBack\")},getBounds:function(){var t=new N;for(var e in this._layers){var n=this._layers[e];t.extend(n.getBounds?n.getBounds():n.getLatLng())}return t}}),Kn=function(t){return new qn(t)},$n=O.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon(\"icon\",t)},createShadow:function(t){return this._createIcon(\"shadow\",t)},_createIcon:function(t,e){var n=this._getIconUrl(t);if(!n){if(\"icon\"===t)throw new Error(\"iconUrl not set in Icon options (see the docs).\");return null}var i=this._createImg(n,e&&\"IMG\"===e.tagName?e:null);return this._setIconStyles(i,t),i},_setIconStyles:function(t,e){var n=this.options,i=n[e+\"Size\"];\"number\"===typeof i&&(i=[i,i]);var o=B(i),r=B(\"shadow\"===e&&n.shadowAnchor||n.iconAnchor||o&&o.divideBy(2,!0));t.className=\"leaflet-marker-\"+e+\" \"+(n.className||\"\"),r&&(t.style.marginLeft=-r.x+\"px\",t.style.marginTop=-r.y+\"px\"),o&&(t.style.width=o.x+\"px\",t.style.height=o.y+\"px\")},_createImg:function(t,e){return e=e||document.createElement(\"img\"),e.src=t,e},_getIconUrl:function(t){return Mt&&this.options[t+\"RetinaUrl\"]||this.options[t+\"Url\"]}});function Yn(t){return new $n(t)}var Xn=$n.extend({options:{iconUrl:\"marker-icon.png\",iconRetinaUrl:\"marker-icon-2x.png\",shadowUrl:\"marker-shadow.png\",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xn.imagePath||(Xn.imagePath=this._detectIconPath()),(this.options.imagePath||Xn.imagePath)+$n.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=le(\"div\",\"leaflet-default-icon-path\",document.body),e=ce(t,\"background-image\")||ce(t,\"backgroundImage\");return document.body.removeChild(t),e=null===e||0!==e.indexOf(\"url\")?\"\":e.replace(/^url\\([\"']?/,\"\").replace(/marker-icon\\.png[\"']?\\)$/,\"\"),e}}),Jn=_n.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,\"leaflet-marker-draggable\")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ge(this._marker._icon,\"leaflet-marker-draggable\")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,n=e._map,i=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,r=Se(e._icon),s=n.getPixelBounds(),a=n.getPixelOrigin(),u=R(s.min._subtract(a).add(o),s.max._subtract(a).subtract(o));if(!u.contains(r)){var h=B((Math.max(u.max.x,r.x)-u.max.x)/(s.max.x-u.max.x)-(Math.min(u.min.x,r.x)-u.min.x)/(s.min.x-u.min.x),(Math.max(u.max.y,r.y)-u.max.y)/(s.max.y-u.max.y)-(Math.min(u.min.y,r.y)-u.min.y)/(s.min.y-u.min.y)).multiplyBy(i);n.panBy(h,{animate:!1}),this._draggable._newPos._add(h),this._draggable._startPos._add(h),Te(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=M(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire(\"movestart\").fire(\"dragstart\")},_onPreDrag:function(t){this._marker.options.autoPan&&(C(this._panRequest),this._panRequest=M(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,n=e._shadow,i=Se(e._icon),o=e._map.layerPointToLatLng(i);n&&Te(n,i),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire(\"move\",t).fire(\"drag\",t)},_onDragEnd:function(t){C(this._panRequest),delete this._oldLatLng,this._marker.fire(\"moveend\").fire(\"dragend\",t)}}),Qn=Un.extend({options:{icon:new Xn,interactive:!0,keyboard:!0,title:\"\",alt:\"\",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:\"markerPane\",shadowPane:\"shadowPane\",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){p(this,e),this._latlng=W(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on(\"zoomanim\",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off(\"zoomanim\",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=W(t),this.update(),this.fire(\"move\",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e=\"leaflet-zoom-\"+(this._zoomAnimated?\"animated\":\"hide\"),n=t.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(n.title=t.title),\"IMG\"===n.tagName&&(n.alt=t.alt||\"\")),ve(n,e),t.keyboard&&(n.tabIndex=\"0\"),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),r=!1;o!==this._shadow&&(this._removeShadow(),r=!0),o&&(ve(o,e),o.alt=\"\"),this._shadow=o,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&r&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),fe(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&fe(this._shadow),this._shadow=null},_setPos:function(t){Te(this._icon,t),this._shadow&&Te(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,\"leaflet-interactive\"),this.addInteractiveTarget(this._icon),Jn)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Jn(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&xe(this._icon,t),this._shadow&&xe(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ti(t,e){return new Qn(t,e)}var ei=Un.extend({options:{stroke:!0,color:\"#3388ff\",weight:3,opacity:1,lineCap:\"round\",lineJoin:\"round\",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:\"evenodd\",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty(\"weight\")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),ni=ei.extend({options:{fill:!0,radius:10},initialize:function(t,e){p(this,e),this._latlng=W(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=W(t),this.redraw(),this.fire(\"move\",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return ei.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,n=this._clickTolerance(),i=[t+n,e+n];this._pxBounds=new j(this._point.subtract(i),this._point.add(i))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function ii(t,e){return new ni(t,e)}var oi=ni.extend({initialize:function(t,e,n){if(\"number\"===typeof e&&(e=i({},n,{radius:e})),p(this,e),this._latlng=W(t),isNaN(this.options.radius))throw new Error(\"Circle radius cannot be NaN\");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new N(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:ei.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===U.distance){var o=Math.PI/180,r=this._mRadius/U.R/o,s=n.project([e+r,t]),a=n.project([e-r,t]),u=s.add(a).divideBy(2),h=n.unproject(u).lat,c=Math.acos((Math.cos(r*o)-Math.sin(e*o)*Math.sin(h*o))/(Math.cos(e*o)*Math.cos(h*o)))/o;(isNaN(c)||0===c)&&(c=r/Math.cos(Math.PI/180*e)),this._point=u.subtract(n.getPixelOrigin()),this._radius=isNaN(c)?0:u.x-n.project([h,t-c]).x,this._radiusY=u.y-s.y}else{var l=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(l).x}this._updateBounds()}});function ri(t,e,n){return new oi(t,e,n)}var si=ei.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){p(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,n,i=1/0,o=null,r=In,s=0,a=this._parts.length;s<a;s++)for(var u=this._parts[s],h=1,c=u.length;h<c;h++){e=u[h-1],n=u[h];var l=r(t,e,n,!0);l<i&&(i=l,o=r(t,e,n))}return o&&(o.distance=Math.sqrt(i)),o},getCenter:function(){if(!this._map)throw new Error(\"Must add layer to map before using getCenter()\");var t,e,n,i,o,r,s,a=this._rings[0],u=a.length;if(!u)return null;for(t=0,e=0;t<u-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,i=0;t<u-1;t++)if(o=a[t],r=a[t+1],n=o.distanceTo(r),i+=n,i>e)return s=(i-e)/n,this._map.layerPointToLatLng([r.x-s*(r.x-o.x),r.y-s*(r.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=W(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new N,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return kn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],n=kn(t),i=0,o=t.length;i<o;i++)n?(e[i]=W(t[i]),this._bounds.extend(e[i])):e[i]=this._convertLatLngs(t[i]);return e},_project:function(){var t=new j;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new A(t,t);this._pxBounds=new j([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,n){var i,o,r=t[0]instanceof F,s=t.length;if(r){for(o=[],i=0;i<s;i++)o[i]=this._map.latLngToLayerPoint(t[i]),n.extend(o[i]);e.push(o)}else for(i=0;i<s;i++)this._projectLatlngs(t[i],e,n)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,n,i,o,r,s,a,u=this._parts;for(e=0,i=0,o=this._rings.length;e<o;e++)for(a=this._rings[e],n=0,r=a.length;n<r-1;n++)s=Cn(a[n],a[n+1],t,n,!0),s&&(u[i]=u[i]||[],u[i].push(s[0]),s[1]===a[n+1]&&n!==r-2||(u[i].push(s[1]),i++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,n=0,i=t.length;n<i;n++)t[n]=wn(t[n],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var n,i,o,r,s,a,u=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,r=this._parts.length;n<r;n++)for(a=this._parts[n],i=0,s=a.length,o=s-1;i<s;o=i++)if((e||0!==i)&&Ln(t,a[o],a[i])<=u)return!0;return!1}});function ai(t,e){return new si(t,e)}si._flat=An;var ui=si.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error(\"Must add layer to map before using getCenter()\");var t,e,n,i,o,r,s,a,u,h=this._rings[0],c=h.length;if(!c)return null;for(r=s=a=0,t=0,e=c-1;t<c;e=t++)n=h[t],i=h[e],o=n.y*i.x-i.y*n.x,s+=(n.x+i.x)*o,a+=(n.y+i.y)*o,r+=3*o;return u=0===r?h[0]:[s/r,a/r],this._map.layerPointToLatLng(u)},_convertLatLngs:function(t){var e=si.prototype._convertLatLngs.call(this,t),n=e.length;return n>=2&&e[0]instanceof F&&e[0].equals(e[n-1])&&e.pop(),e},_setLatLngs:function(t){si.prototype._setLatLngs.call(this,t),kn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return kn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,n=new A(e,e);if(t=new j(t.min.subtract(n),t.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,o=0,r=this._rings.length;o<r;o++)i=Bn(this._rings[o],t,!0),i.length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,n,i,o,r,s,a,u,h=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(e=this._parts[o],r=0,u=e.length,s=u-1;r<u;s=r++)n=e[r],i=e[s],n.y>t.y!==i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(h=!h);return h||si.prototype._containsPoint.call(this,t,!0)}});function hi(t,e){return new ui(t,e)}var ci=qn.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,o=g(t)?t:t.features;if(o){for(e=0,n=o.length;e<n;e++)i=o[e],(i.geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var r=this.options;if(r.filter&&!r.filter(t))return this;var s=li(t,r);return s?(s.feature=vi(t),s.defaultOptions=s.options,this.resetStyle(s),r.onEachFeature&&r.onEachFeature(t,s),this.addLayer(s)):this},resetStyle:function(t){return t.options=i({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){t.setStyle&&(\"function\"===typeof e&&(e=e(t.feature)),t.setStyle(e))}});function li(t,e){var n,i,o,r,s=\"Feature\"===t.type?t.geometry:t,a=s?s.coordinates:null,u=[],h=e&&e.pointToLayer,c=e&&e.coordsToLatLng||fi;if(!a&&!s)return null;switch(s.type){case\"Point\":return n=c(a),h?h(t,n):new Qn(n);case\"MultiPoint\":for(o=0,r=a.length;o<r;o++)n=c(a[o]),u.push(h?h(t,n):new Qn(n));return new qn(u);case\"LineString\":case\"MultiLineString\":return i=di(a,\"LineString\"===s.type?0:1,c),new si(i,e);case\"Polygon\":case\"MultiPolygon\":return i=di(a,\"Polygon\"===s.type?1:2,c),new ui(i,e);case\"GeometryCollection\":for(o=0,r=s.geometries.length;o<r;o++){var l=li({geometry:s.geometries[o],type:\"Feature\",properties:t.properties},e);l&&u.push(l)}return new qn(u);default:throw new Error(\"Invalid GeoJSON object.\")}}function fi(t){return new F(t[1],t[0],t[2])}function di(t,e,n){for(var i,o=[],r=0,s=t.length;r<s;r++)i=e?di(t[r],e-1,n):(n||fi)(t[r]),o.push(i);return o}function pi(t,e){return e=\"number\"===typeof e?e:6,void 0!==t.alt?[l(t.lng,e),l(t.lat,e),l(t.alt,e)]:[l(t.lng,e),l(t.lat,e)]}function _i(t,e,n,i){for(var o=[],r=0,s=t.length;r<s;r++)o.push(e?_i(t[r],e-1,n,i):pi(t[r],i));return!e&&n&&o.push(o[0]),o}function mi(t,e){return t.feature?i({},t.feature,{geometry:e}):vi(e)}function vi(t){return\"Feature\"===t.type||\"FeatureCollection\"===t.type?t:{type:\"Feature\",properties:{},geometry:t}}var gi={toGeoJSON:function(t){return mi(this,{type:\"Point\",coordinates:pi(this.getLatLng(),t)})}};function yi(t,e){return new ci(t,e)}Qn.include(gi),oi.include(gi),ni.include(gi),si.include({toGeoJSON:function(t){var e=!kn(this._latlngs),n=_i(this._latlngs,e?1:0,!1,t);return mi(this,{type:(e?\"Multi\":\"\")+\"LineString\",coordinates:n})}}),ui.include({toGeoJSON:function(t){var e=!kn(this._latlngs),n=e&&!kn(this._latlngs[0]),i=_i(this._latlngs,n?2:e?1:0,!0,t);return e||(i=[i]),mi(this,{type:(n?\"Multi\":\"\")+\"Polygon\",coordinates:i})}}),Vn.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(n){e.push(n.toGeoJSON(t).geometry.coordinates)}),mi(this,{type:\"MultiPoint\",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(\"MultiPoint\"===e)return this.toMultiPoint(t);var n=\"GeometryCollection\"===e,i=[];return this.eachLayer(function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(n)i.push(o.geometry);else{var r=vi(o);\"FeatureCollection\"===r.type?i.push.apply(i,r.features):i.push(r)}}}),n?mi(this,{geometries:i,type:\"GeometryCollection\"}):{type:\"FeatureCollection\",features:i}}});var bi=yi,xi=Un.extend({options:{opacity:1,alt:\"\",interactive:!1,crossOrigin:!1,errorOverlayUrl:\"\",zIndex:1,className:\"\"},initialize:function(t,e,n){this._url=t,this._bounds=D(e),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,\"leaflet-interactive\"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){fe(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&pe(this._image),this},bringToBack:function(){return this._map&&_e(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=D(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=\"IMG\"===this._url.tagName,e=this._image=t?this._url:le(\"img\");ve(e,\"leaflet-image-layer\"),this._zoomAnimated&&ve(e,\"leaflet-zoom-animated\"),this.options.className&&ve(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onload=r(this.fire,this,\"load\"),e.onerror=r(this._overlayOnError,this,\"error\"),(this.options.crossOrigin||\"\"===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?\"\":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Pe(this._image,n,e)},_reset:function(){var t=this._image,e=new j(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=e.getSize();Te(t,e.min),t.style.width=n.x+\"px\",t.style.height=n.y+\"px\"},_updateOpacity:function(){xe(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire(\"error\");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wi=function(t,e,n){return new xi(t,e,n)},Li=xi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t=\"VIDEO\"===this._url.tagName,e=this._image=t?this._url:le(\"video\");if(ve(e,\"leaflet-image-layer\"),this._zoomAnimated&&ve(e,\"leaflet-zoom-animated\"),e.onselectstart=c,e.onmousemove=c,e.onloadeddata=r(this.fire,this,\"load\"),t){for(var n=e.getElementsByTagName(\"source\"),i=[],o=0;o<n.length;o++)i.push(n[o].src);this._url=n.length>0?i:[e.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty(\"objectFit\")&&(e.style[\"objectFit\"]=\"fill\"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var s=0;s<this._url.length;s++){var a=le(\"source\");a.src=this._url[s],e.appendChild(a)}}}});function Pi(t,e,n){return new Li(t,e,n)}var Ti=xi.extend({_initImage:function(){var t=this._image=this._url;ve(t,\"leaflet-image-layer\"),this._zoomAnimated&&ve(t,\"leaflet-zoom-animated\"),t.onselectstart=c,t.onmousemove=c}});function Si(t,e,n){return new Ti(t,e,n)}var Mi=Un.extend({options:{offset:[0,7],className:\"\",pane:\"popupPane\"},initialize:function(t,e){p(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&xe(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&xe(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(xe(this._container,0),this._removeTimeout=setTimeout(r(fe,void 0,this._container),200)):fe(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=W(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility=\"hidden\",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility=\"\",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&pe(this._container),this},bringToBack:function(){return this._map&&_e(this._container),this},_prepareOpen:function(t,e,n){if(e instanceof Un||(n=e,e=t),e instanceof qn)for(var i in t._layers){e=t._layers[i];break}if(!n)if(e.getCenter)n=e.getCenter();else{if(!e.getLatLng)throw new Error(\"Unable to get source layer LatLng.\");n=e.getLatLng()}return this._source=e,this.update(),n},_updateContent:function(){if(this._content){var t=this._contentNode,e=\"function\"===typeof this._content?this._content(this._source||this):this._content;if(\"string\"===typeof e)t.innerHTML=e;else{while(t.hasChildNodes())t.removeChild(t.firstChild);t.appendChild(e)}this.fire(\"contentupdate\")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=B(this.options.offset),n=this._getAnchor();this._zoomAnimated?Te(this._container,t.add(n)):e=e.add(t).add(n);var i=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=i+\"px\",this._container.style.left=o+\"px\"}},_getAnchor:function(){return[0,0]}}),Ci=Mi.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:\"\"},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Mi.prototype.onAdd.call(this,t),t.fire(\"popupopen\",{popup:this}),this._source&&(this._source.fire(\"popupopen\",{popup:this},!0),this._source instanceof ei||this._source.on(\"preclick\",De))},onRemove:function(t){Mi.prototype.onRemove.call(this,t),t.fire(\"popupclose\",{popup:this}),this._source&&(this._source.fire(\"popupclose\",{popup:this},!0),this._source instanceof ei||this._source.off(\"preclick\",De))},getEvents:function(){var t=Mi.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t=\"leaflet-popup\",e=this._container=le(\"div\",t+\" \"+(this.options.className||\"\")+\" leaflet-zoom-animated\"),n=this._wrapper=le(\"div\",t+\"-content-wrapper\",e);if(this._contentNode=le(\"div\",t+\"-content\",n),We(n),Fe(this._contentNode),Ze(n,\"contextmenu\",De),this._tipContainer=le(\"div\",t+\"-tip-container\",e),this._tip=le(\"div\",t+\"-tip\",this._tipContainer),this.options.closeButton){var i=this._closeButton=le(\"a\",t+\"-close-button\",e);i.href=\"#close\",i.innerHTML=\"&#215;\",Ze(i,\"click\",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width=\"\",e.whiteSpace=\"nowrap\";var n=t.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),e.width=n+1+\"px\",e.whiteSpace=\"\",e.height=\"\";var i=t.offsetHeight,o=this.options.maxHeight,r=\"leaflet-popup-scrolled\";o&&i>o?(e.height=o+\"px\",ve(t,r)):ge(t,r),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),n=this._getAnchor();Te(this._container,e.add(n))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(ce(this._container,\"marginBottom\"),10)||0,n=this._container.offsetHeight+e,i=this._containerWidth,o=new A(this._containerLeft,-n-this._containerBottom);o._add(Se(this._container));var r=t.layerPointToContainerPoint(o),s=B(this.options.autoPanPadding),a=B(this.options.autoPanPaddingTopLeft||s),u=B(this.options.autoPanPaddingBottomRight||s),h=t.getSize(),c=0,l=0;r.x+i+u.x>h.x&&(c=r.x+i-h.x+u.x),r.x-c-a.x<0&&(c=r.x-a.x),r.y+n+u.y>h.y&&(l=r.y+n-h.y+u.y),r.y-l-a.y<0&&(l=r.y-a.y),(c||l)&&t.fire(\"autopanstart\").panBy([c,l])}},_onCloseButtonClick:function(t){this._close(),Ue(t)},_getAnchor:function(){return B(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Ei=function(t,e){return new Ci(t,e)};nn.mergeOptions({closePopupOnClick:!0}),nn.include({openPopup:function(t,e,n){return t instanceof Ci||(t=new Ci(n).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Un.include({bindPopup:function(t,e){return t instanceof Ci?(p(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Ci(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Ue(t),e instanceof ei?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Oi=Mi.extend({options:{pane:\"tooltipPane\",offset:[0,0],direction:\"auto\",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Mi.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire(\"tooltipopen\",{tooltip:this}),this._source&&this._source.fire(\"tooltipopen\",{tooltip:this},!0)},onRemove:function(t){Mi.prototype.onRemove.call(this,t),t.fire(\"tooltipclose\",{tooltip:this}),this._source&&this._source.fire(\"tooltipclose\",{tooltip:this},!0)},getEvents:function(){var t=Mi.prototype.getEvents.call(this);return Pt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t=\"leaflet-tooltip\",e=t+\" \"+(this.options.className||\"\")+\" leaflet-zoom-\"+(this._zoomAnimated?\"animated\":\"hide\");this._contentNode=this._container=le(\"div\",e)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,n=this._container,i=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),r=this.options.direction,s=n.offsetWidth,a=n.offsetHeight,u=B(this.options.offset),h=this._getAnchor();\"top\"===r?t=t.add(B(-s/2+u.x,-a+u.y+h.y,!0)):\"bottom\"===r?t=t.subtract(B(s/2-u.x,-u.y,!0)):\"center\"===r?t=t.subtract(B(s/2+u.x,a/2-h.y+u.y,!0)):\"right\"===r||\"auto\"===r&&o.x<i.x?(r=\"right\",t=t.add(B(u.x+h.x,h.y-a/2+u.y,!0))):(r=\"left\",t=t.subtract(B(s+h.x-u.x,a/2-h.y-u.y,!0))),ge(n,\"leaflet-tooltip-right\"),ge(n,\"leaflet-tooltip-left\"),ge(n,\"leaflet-tooltip-top\"),ge(n,\"leaflet-tooltip-bottom\"),ve(n,\"leaflet-tooltip-\"+r),Te(n,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&xe(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return B(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),zi=function(t,e){return new Oi(t,e)};nn.include({openTooltip:function(t,e,n){return t instanceof Oi||(t=new Oi(n).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Un.include({bindTooltip:function(t,e){return t instanceof Oi?(p(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Oi(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?\"off\":\"on\",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),Pt&&(n.click=this._openTooltip)),this[e](n),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,\"leaflet-clickable\"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ge(this._tooltip._container,\"leaflet-clickable\"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,n,i=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(e),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var Ii=$n.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:\"leaflet-div-icon\"},createIcon:function(t){var e=t&&\"DIV\"===t.tagName?t:document.createElement(\"div\"),n=this.options;if(n.html instanceof Element?(de(e),e.appendChild(n.html)):e.innerHTML=!1!==n.html?n.html:\"\",n.bgPos){var i=B(n.bgPos);e.style.backgroundPosition=-i.x+\"px \"+-i.y+\"px\"}return this._setIconStyles(e,\"icon\"),e},createShadow:function(){return null}});function ki(t){return new Ii(t)}$n.Default=Xn;var Ai=Un.extend({options:{tileSize:256,opacity:1,updateWhenIdle:yt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:\"tilePane\",className:\"\",keepBuffer:2},initialize:function(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),fe(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(pe(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(_e(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=u(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement(\"div\")},getTileSize:function(){var t=this.options.tileSize;return t instanceof A?t:new A(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,n=this.getPane().children,i=-t(-1/0,1/0),o=0,r=n.length;o<r;o++)e=n[o].style.zIndex,n[o]!==this._container&&e&&(i=t(i,+e));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){xe(this._container,this.options.opacity);var t=+new Date,e=!1,n=!1;for(var i in this._tiles){var o=this._tiles[i];if(o.current&&o.loaded){var r=Math.min(1,(t-o.loaded)/200);xe(o.el,r),r<1?e=!0:(o.active?n=!0:this._onOpaqueTile(o),o.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),e&&(C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=le(\"div\",\"leaflet-layer \"+(this.options.className||\"\")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var n in this._levels)this._levels[n].el.children.length||n===t?(this._levels[n].el.style.zIndex=e-Math.abs(t-n),this._onUpdateLevel(n)):(fe(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[t],o=this._map;return i||(i=this._levels[t]={},i.el=le(\"div\",\"leaflet-tile-container leaflet-zoom-animated\",this._container),i.el.style.zIndex=e,i.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),i.zoom=t,this._setZoomTransform(i,o.getCenter(),o.getZoom()),c(i.el.offsetWidth),this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var t,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)e=this._tiles[t],e.retain=e.current;for(t in this._tiles)if(e=this._tiles[t],e.current&&!e.active){var i=e.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)fe(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,n,i){var o=Math.floor(t/2),r=Math.floor(e/2),s=n-1,a=new A(+o,+r);a.z=+s;var u=this._tileCoordsToKey(a),h=this._tiles[u];return h&&h.active?(h.retain=!0,!0):(h&&h.loaded&&(h.retain=!0),s>i&&this._retainParent(o,r,s,i))},_retainChildren:function(t,e,n,i){for(var o=2*t;o<2*t+2;o++)for(var r=2*e;r<2*e+2;r++){var s=new A(o,r);s.z=n+1;var a=this._tileCoordsToKey(s),u=this._tiles[a];u&&u.active?u.retain=!0:(u&&u.loaded&&(u.retain=!0),n+1<i&&this._retainChildren(o,r,n+1,i))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,n,i){var o=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var r=this.options.updateWhenZooming&&o!==this._tileZoom;i&&!r||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var n in this._levels)this._setZoomTransform(this._levels[n],t,e)},_setZoomTransform:function(t,e,n){var i=this._map.getZoomScale(n,t.zoom),o=t.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(e,n)).round();gt?Pe(t.el,o,i):Te(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],i).x/n.x),Math.ceil(t.project([0,e.wrapLng[1]],i).x/n.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],i).y/n.x),Math.ceil(t.project([e.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,n=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(n,this._tileZoom),o=e.project(t,this._tileZoom).floor(),r=e.getSize().divideBy(2*i);return new j(o.subtract(r),o.add(r))},_update:function(t){var e=this._map;if(e){var n=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(i),r=o.getCenter(),s=[],a=this.options.keepBuffer,u=new j(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error(\"Attempted to load an infinite number of tiles\");for(var h in this._tiles){var c=this._tiles[h].coords;c.z===this._tileZoom&&u.contains(new A(c.x,c.y))||(this._tiles[h].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(t,n);else{for(var l=o.min.y;l<=o.max.y;l++)for(var f=o.min.x;f<=o.max.x;f++){var d=new A(f,l);if(d.z=this._tileZoom,this._isValidTile(d)){var p=this._tiles[this._tileCoordsToKey(d)];p?p.current=!0:s.push(d)}}if(s.sort(function(t,e){return t.distanceTo(r)-e.distanceTo(r)}),0!==s.length){this._loading||(this._loading=!0,this.fire(\"loading\"));var _=document.createDocumentFragment();for(f=0;f<s.length;f++)this._addTile(s[f],_);this._level.el.appendChild(_)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var n=this._globalTileRange;if(!e.wrapLng&&(t.x<n.min.x||t.x>n.max.x)||!e.wrapLat&&(t.y<n.min.y||t.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n),o=i.add(n),r=e.unproject(i,t.z),s=e.unproject(o,t.z);return[r,s]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),n=new N(e[0],e[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(t){return t.x+\":\"+t.y+\":\"+t.z},_keyToTileCoords:function(t){var e=t.split(\":\"),n=new A(+e[0],+e[1]);return n.z=+e[2],n},_removeTile:function(t){var e=this._tiles[t];e&&(fe(e.el),delete this._tiles[t],this.fire(\"tileunload\",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,\"leaflet-tile\");var e=this.getTileSize();t.style.width=e.x+\"px\",t.style.height=e.y+\"px\",t.onselectstart=c,t.onmousemove=c,et&&this.options.opacity<1&&xe(t,this.options.opacity),ot&&!rt&&(t.style.WebkitBackfaceVisibility=\"hidden\")},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),Te(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire(\"tileloadstart\",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire(\"tileerror\",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);n=this._tiles[i],n&&(n.loaded=+new Date,this._map._fadeAnimated?(xe(n.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(ve(n.el,\"leaflet-tile-loaded\"),this.fire(\"tileload\",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire(\"load\"),et||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new A(this._wrapX?h(t.x,this._wrapX):t.x,this._wrapY?h(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new j(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Zi(t){return new Ai(t)}var Bi=Ai.extend({options:{minZoom:0,maxZoom:18,subdomains:\"abc\",errorTileUrl:\"\",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,e=p(this,e),e.detectRetina&&Mt&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),\"string\"===typeof e.subdomains&&(e.subdomains=e.subdomains.split(\"\")),ot||this.on(\"tileunload\",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var n=document.createElement(\"img\");return Ze(n,\"load\",r(this._tileOnLoad,this,e,n)),Ze(n,\"error\",r(this._tileOnError,this,e,n)),(this.options.crossOrigin||\"\"===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?\"\":this.options.crossOrigin),n.alt=\"\",n.setAttribute(\"role\",\"presentation\"),n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Mt?\"@2x\":\"\",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-t.y;this.options.tms&&(e[\"y\"]=n),e[\"-y\"]=n}return v(this._url,i(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(r(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,n){var i=this.options.errorTileUrl;i&&e.getAttribute(\"src\")!==i&&(e.src=i),t(n,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,n=this.options.zoomReverse,i=this.options.zoomOffset;return n&&(t=e-t),t+i},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&(e=this._tiles[t].el,e.onload=c,e.onerror=c,e.complete||(e.src=b,fe(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute(\"src\",b),Ai.prototype._removeTile.call(this,t)},_tileReady:function(t,e,n){if(this._map&&(!n||n.getAttribute(\"src\")!==b))return Ai.prototype._tileReady.call(this,t,e,n)}});function ji(t,e){return new Bi(t,e)}var Ri=Bi.extend({defaultWmsParams:{service:\"WMS\",request:\"GetMap\",layers:\"\",styles:\"\",format:\"image/jpeg\",transparent:!1,version:\"1.1.1\"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var n=i({},this.defaultWmsParams);for(var o in e)o in this.options||(n[o]=e[o]);e=p(this,e);var r=e.detectRetina&&Mt?2:1,s=this.getTileSize();n.width=s.x*r,n.height=s.y*r,this.wmsParams=n},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?\"crs\":\"srs\";this.wmsParams[e]=this._crs.code,Bi.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),n=this._crs,i=R(n.project(e[0]),n.project(e[1])),o=i.min,r=i.max,s=(this._wmsVersion>=1.3&&this._crs===Wn?[o.y,o.x,r.y,r.x]:[o.x,o.y,r.x,r.y]).join(\",\"),a=Bi.prototype.getTileUrl.call(this,t);return a+_(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?\"&BBOX=\":\"&bbox=\")+s},setParams:function(t,e){return i(this.wmsParams,t),e||this.redraw(),this}});function Ni(t,e){return new Ri(t,e)}Bi.WMS=Ri,ji.wms=Ni;var Di=Un.extend({options:{padding:.1,tolerance:0},initialize:function(t){p(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,\"leaflet-zoom-animated\")),this.getPane().appendChild(this._container),this._update(),this.on(\"update\",this._updatePaths,this)},onRemove:function(){this.off(\"update\",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var n=this._map.getZoomScale(e,this._zoom),i=Se(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,e),s=this._map.project(t,e),a=s.subtract(r),u=o.multiplyBy(-n).add(i).add(o).subtract(a);gt?Pe(this._container,u,n):Te(this._container,u)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),n=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new j(n,n.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Fi=Di.extend({getEvents:function(){var t=Di.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Di.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement(\"canvas\");Ze(t,\"mousemove\",u(this._onMouseMove,32,this),this),Ze(t,\"click dblclick mousedown mouseup contextmenu\",this._onClick,this),Ze(t,\"mouseout\",this._handleMouseOut,this),this._ctx=t.getContext(\"2d\")},_destroyContainer:function(){C(this._redrawRequest),delete this._ctx,fe(this._container),je(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;for(var e in this._redrawBounds=null,this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Di.prototype._update.call(this);var t=this._bounds,e=this._container,n=t.getSize(),i=Mt?2:1;Te(e,t.min),e.width=i*n.x,e.height=i*n.y,e.style.width=n.x+\"px\",e.style.height=n.y+\"px\",Mt&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire(\"update\")}},_reset:function(){Di.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,n=e.next,i=e.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(\"string\"===typeof t.options.dashArray){var e,n,i=t.options.dashArray.split(/[, ]+/),o=[];for(n=0;n<i.length;n++){if(e=Number(i[n]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||M(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new j,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var n=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var n,i,o,r,s=t._parts,a=s.length,u=this._ctx;if(a){for(u.beginPath(),n=0;n<a;n++){for(i=0,o=s[n].length;i<o;i++)r=s[n][i],u[i?\"lineTo\":\"moveTo\"](r.x,r.y);e&&u.closePath()}this._fillStroke(u,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,n=this._ctx,i=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||i)/i;1!==o&&(n.save(),n.scale(1,o)),n.beginPath(),n.arc(e.x,e.y/o,i,0,2*Math.PI,!1),1!==o&&n.restore(),this._fillStroke(n,t)}},_fillStroke:function(t,e){var n=e.options;n.fill&&(t.globalAlpha=n.fillOpacity,t.fillStyle=n.fillColor||n.color,t.fill(n.fillRule||\"evenodd\")),n.stroke&&0!==n.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=n.opacity,t.lineWidth=n.weight,t.strokeStyle=n.color,t.lineCap=n.lineCap,t.lineJoin=n.lineJoin,t.stroke())},_onClick:function(t){for(var e,n,i=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)e=o.layer,e.options.interactive&&e._containsPoint(i)&&!this._map._draggableMoved(e)&&(n=e);n&&(Ye(t),this._fireEvent([n],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ge(this._container,\"leaflet-interactive\"),this._fireEvent([e],t,\"mouseout\"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var n,i,o=this._drawFirst;o;o=o.next)n=o.layer,n.options.interactive&&n._containsPoint(e)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(ve(this._container,\"leaflet-interactive\"),this._fireEvent([i],t,\"mouseover\"),this._hoveredLayer=i)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,n){this._map._fireDOMEvent(e,n||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Wi(t){return Ct?new Fi(t):null}var Hi=function(){try{return document.namespaces.add(\"lvml\",\"urn:schemas-microsoft-com:vml\"),function(t){return document.createElement(\"<lvml:\"+t+' class=\"lvml\">')}}catch(t){return function(t){return document.createElement(\"<\"+t+' xmlns=\"urn:schemas-microsoft.com:vml\" class=\"lvml\">')}}}(),Ui={_initContainer:function(){this._container=le(\"div\",\"leaflet-vml-container\")},_update:function(){this._map._animatingZoom||(Di.prototype._update.call(this),this.fire(\"update\"))},_initPath:function(t){var e=t._container=Hi(\"shape\");ve(e,\"leaflet-vml-shape \"+(this.options.className||\"\")),e.coordsize=\"1 1\",t._path=Hi(\"path\"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;fe(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,o=t._container;o.stroked=!!i.stroke,o.filled=!!i.fill,i.stroke?(e||(e=t._stroke=Hi(\"stroke\")),o.appendChild(e),e.weight=i.weight+\"px\",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=g(i.dashArray)?i.dashArray.join(\" \"):i.dashArray.replace(/( *, *)/g,\" \"):e.dashStyle=\"\",e.endcap=i.lineCap.replace(\"butt\",\"flat\"),e.joinstyle=i.lineJoin):e&&(o.removeChild(e),t._stroke=null),i.fill?(n||(n=t._fill=Hi(\"fill\")),o.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(o.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?\"M0 0\":\"AL \"+e.x+\",\"+e.y+\" \"+n+\",\"+i+\" 0,23592600\")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){pe(t._container)},_bringToBack:function(t){_e(t._container)}},Vi=Ot?Hi:X,Gi=Di.extend({getEvents:function(){var t=Di.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Vi(\"svg\"),this._container.setAttribute(\"pointer-events\",\"none\"),this._rootGroup=Vi(\"g\"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){fe(this._container),je(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){Di.prototype._update.call(this);var t=this._bounds,e=t.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute(\"width\",e.x),n.setAttribute(\"height\",e.y)),Te(n,t.min),n.setAttribute(\"viewBox\",[t.min.x,t.min.y,e.x,e.y].join(\" \")),this.fire(\"update\")}},_initPath:function(t){var e=t._path=Vi(\"path\");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,\"leaflet-interactive\"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){fe(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,n=t.options;e&&(n.stroke?(e.setAttribute(\"stroke\",n.color),e.setAttribute(\"stroke-opacity\",n.opacity),e.setAttribute(\"stroke-width\",n.weight),e.setAttribute(\"stroke-linecap\",n.lineCap),e.setAttribute(\"stroke-linejoin\",n.lineJoin),n.dashArray?e.setAttribute(\"stroke-dasharray\",n.dashArray):e.removeAttribute(\"stroke-dasharray\"),n.dashOffset?e.setAttribute(\"stroke-dashoffset\",n.dashOffset):e.removeAttribute(\"stroke-dashoffset\")):e.setAttribute(\"stroke\",\"none\"),n.fill?(e.setAttribute(\"fill\",n.fillColor||n.color),e.setAttribute(\"fill-opacity\",n.fillOpacity),e.setAttribute(\"fill-rule\",n.fillRule||\"evenodd\")):e.setAttribute(\"fill\",\"none\"))},_updatePoly:function(t,e){this._setPath(t,J(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i=Math.max(Math.round(t._radiusY),1)||n,o=\"a\"+n+\",\"+i+\" 0 1,0 \",r=t._empty()?\"M0 0\":\"M\"+(e.x-n)+\",\"+e.y+o+2*n+\",0 \"+o+2*-n+\",0 \";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute(\"d\",e)},_bringToFront:function(t){pe(t._path)},_bringToBack:function(t){_e(t._path)}});function qi(t){return Et||Ot?new Gi(t):null}Ot&&Gi.include(Ui),nn.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if(\"overlayPane\"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Wi(t)||qi(t)}});var Ki=ui.extend({initialize:function(t,e){ui.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=D(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function $i(t,e){return new Ki(t,e)}Gi.create=Vi,Gi.pointsToPath=J,ci.geometryToLayer=li,ci.coordsToLatLng=fi,ci.coordsToLatLngs=di,ci.latLngToCoords=pi,ci.latLngsToCoords=_i,ci.getFeature=mi,ci.asFeature=vi,nn.mergeOptions({boxZoom:!0});var Yi=_n.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on(\"unload\",this._destroy,this)},addHooks:function(){Ze(this._container,\"mousedown\",this._onMouseDown,this)},removeHooks:function(){je(this._container,\"mousedown\",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){fe(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),Ce(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ze(document,{contextmenu:Ue,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=le(\"div\",\"leaflet-zoom-box\",this._container),ve(this._container,\"leaflet-crosshair\"),this._map.fire(\"boxzoomstart\")),this._point=this._map.mouseEventToContainerPoint(t);var e=new j(this._point,this._startPoint),n=e.getSize();Te(this._box,e.min),this._box.style.width=n.x+\"px\",this._box.style.height=n.y+\"px\"},_finish:function(){this._moved&&(fe(this._box),ge(this._container,\"leaflet-crosshair\")),ne(),Ee(),je(document,{contextmenu:Ue,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var e=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire(\"boxzoomend\",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});nn.addInitHook(\"addHandler\",\"boxZoom\",Yi),nn.mergeOptions({doubleClickZoom:!0});var Xi=_n.extend({addHooks:function(){this._map.on(\"dblclick\",this._onDoubleClick,this)},removeHooks:function(){this._map.off(\"dblclick\",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta,o=t.originalEvent.shiftKey?n-i:n+i;\"center\"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});nn.addInitHook(\"addHandler\",\"doubleClickZoom\",Xi),nn.mergeOptions({dragging:!0,inertia:!rt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Ji=_n.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on(\"predrag\",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on(\"predrag\",this._onPreDragWrap,this),t.on(\"zoomend\",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,\"leaflet-grab leaflet-touch-drag\"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ge(this._map._container,\"leaflet-grab\"),ge(this._map._container,\"leaflet-touch-drag\"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire(\"movestart\").fire(\"dragstart\"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(e),this._prunePositions(e)}this._map.fire(\"move\",t).fire(\"drag\",t)},_prunePositions:function(t){while(this._positions.length>1&&t-this._times[0]>50)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,o=(i-e+n)%t+e-n,r=(i+e+n)%t-e-n,s=Math.abs(o+n)<Math.abs(r+n)?o:r;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=s},_onDragEnd:function(t){var e=this._map,n=e.options,i=!n.inertia||this._times.length<2;if(e.fire(\"dragend\",t),i)e.fire(\"moveend\");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),r=(this._lastTime-this._times[0])/1e3,s=n.easeLinearity,a=o.multiplyBy(s/r),u=a.distanceTo([0,0]),h=Math.min(n.inertiaMaxSpeed,u),c=a.multiplyBy(h/u),l=h/(n.inertiaDeceleration*s),f=c.multiplyBy(-l/2).round();f.x||f.y?(f=e._limitOffset(f,e.options.maxBounds),M(function(){e.panBy(f,{duration:l,easeLinearity:s,noMoveStart:!0,animate:!0})})):e.fire(\"moveend\")}}});nn.addInitHook(\"addHandler\",\"dragging\",Ji),nn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Qi=_n.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex=\"0\"),Ze(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),je(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,n=t.scrollTop||e.scrollTop,i=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire(\"focus\")},_onBlur:function(){this._focused=!1,this._map.fire(\"blur\")},_setPanDelta:function(t){var e,n,i=this._panKeys={},o=this.keyCodes;for(e=0,n=o.left.length;e<n;e++)i[o.left[e]]=[-1*t,0];for(e=0,n=o.right.length;e<n;e++)i[o.right[e]]=[t,0];for(e=0,n=o.down.length;e<n;e++)i[o.down[e]]=[0,t];for(e=0,n=o.up.length;e<n;e++)i[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,n,i=this._zoomKeys={},o=this.keyCodes;for(e=0,n=o.zoomIn.length;e<n;e++)i[o.zoomIn[e]]=t;for(e=0,n=o.zoomOut.length;e<n;e++)i[o.zoomOut[e]]=-t},_addHooks:function(){Ze(document,\"keydown\",this._onKeyDown,this)},_removeHooks:function(){je(document,\"keydown\",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,n=t.keyCode,i=this._map;if(n in this._panKeys)i._panAnim&&i._panAnim._inProgress||(e=this._panKeys[n],t.shiftKey&&(e=B(e).multiplyBy(3)),i.panBy(e),i.options.maxBounds&&i.panInsideBounds(i.options.maxBounds));else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Ue(t)}}});nn.addInitHook(\"addHandler\",\"keyboard\",Qi),nn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var to=_n.extend({addHooks:function(){Ze(this._map._container,\"mousewheel\",this._onWheelScroll,this),this._delta=0},removeHooks:function(){je(this._map._container,\"mousewheel\",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=qe(t),n=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),i),Ue(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),n=this._map.options.zoomSnap||0;t._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,r=n?Math.ceil(o/n)*n:o,s=t._limitZoom(e+(this._delta>0?r:-r))-e;this._delta=0,this._startTime=null,s&&(\"center\"===t.options.scrollWheelZoom?t.setZoom(e+s):t.setZoomAround(this._lastMousePos,e+s))}});nn.addInitHook(\"addHandler\",\"scrollWheelZoom\",to),nn.mergeOptions({tap:!0,tapTolerance:15});var eo=_n.extend({addHooks:function(){Ze(this._map._container,\"touchstart\",this._onDown,this)},removeHooks:function(){je(this._map._container,\"touchstart\",this._onDown,this)},_onDown:function(t){if(t.touches){if(He(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],n=e.target;this._startPos=this._newPos=new A(e.clientX,e.clientY),n.tagName&&\"a\"===n.tagName.toLowerCase()&&ve(n,\"leaflet-active\"),this._holdTimeout=setTimeout(r(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent(\"contextmenu\",e))},this),1e3),this._simulateEvent(\"mousedown\",e),Ze(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),je(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],n=e.target;n&&n.tagName&&\"a\"===n.tagName.toLowerCase()&&ge(n,\"leaflet-active\"),this._simulateEvent(\"mouseup\",e),this._isTapValid()&&this._simulateEvent(\"click\",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new A(e.clientX,e.clientY),this._simulateEvent(\"mousemove\",e)},_simulateEvent:function(t,e){var n=document.createEvent(\"MouseEvents\");n._simulated=!0,e.target._simulatedClick=!0,n.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(n)}});Pt&&!Lt&&nn.addInitHook(\"addHandler\",\"tap\",eo),nn.mergeOptions({touchZoom:Pt&&!rt,bounceAtZoomLimits:!0});var no=_n.extend({addHooks:function(){ve(this._map._container,\"leaflet-touch-zoom\"),Ze(this._map._container,\"touchstart\",this._onTouchStart,this)},removeHooks:function(){ge(this._map._container,\"leaflet-touch-zoom\"),je(this._map._container,\"touchstart\",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),\"center\"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Ze(document,\"touchmove\",this._onTouchMove,this),Ze(document,\"touchend\",this._onTouchEnd,this),He(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]),o=n.distanceTo(i)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),\"center\"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var s=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===s.x&&0===s.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),C(this._animRequest);var a=r(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=M(a,this,!0),He(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,C(this._animRequest),je(document,\"touchmove\",this._onTouchMove),je(document,\"touchend\",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});nn.addInitHook(\"addHandler\",\"touchZoom\",no),nn.BoxZoom=Yi,nn.DoubleClickZoom=Xi,nn.Drag=Ji,nn.Keyboard=Qi,nn.ScrollWheelZoom=to,nn.Tap=eo,nn.TouchZoom=no,Object.freeze=n,t.version=e,t.Control=rn,t.control=sn,t.Browser=It,t.Evented=k,t.Mixin=vn,t.Util=E,t.Class=O,t.Handler=_n,t.extend=i,t.bind=r,t.stamp=a,t.setOptions=p,t.DomEvent=tn,t.DomUtil=Ae,t.PosAnimation=en,t.Draggable=xn,t.LineUtil=Zn,t.PolyUtil=jn,t.Point=A,t.point=B,t.Bounds=j,t.bounds=R,t.Transformation=q,t.transformation=K,t.Projection=Dn,t.LatLng=F,t.latLng=W,t.LatLngBounds=N,t.latLngBounds=D,t.CRS=H,t.GeoJSON=ci,t.geoJSON=yi,t.geoJson=bi,t.Layer=Un,t.LayerGroup=Vn,t.layerGroup=Gn,t.FeatureGroup=qn,t.featureGroup=Kn,t.ImageOverlay=xi,t.imageOverlay=wi,t.VideoOverlay=Li,t.videoOverlay=Pi,t.SVGOverlay=Ti,t.svgOverlay=Si,t.DivOverlay=Mi,t.Popup=Ci,t.popup=Ei,t.Tooltip=Oi,t.tooltip=zi,t.Icon=$n,t.icon=Yn,t.DivIcon=Ii,t.divIcon=ki,t.Marker=Qn,t.marker=ti,t.TileLayer=Bi,t.tileLayer=ji,t.GridLayer=Ai,t.gridLayer=Zi,t.SVG=Gi,t.svg=qi,t.Renderer=Di,t.Canvas=Fi,t.canvas=Wi,t.Path=ei,t.CircleMarker=ni,t.circleMarker=ii,t.Circle=oi,t.circle=ri,t.Polyline=si,t.polyline=ai,t.Polygon=ui,t.polygon=hi,t.Rectangle=Ki,t.rectangle=$i,t.Map=nn,t.map=on;var io=window.L;t.noConflict=function(){return window.L=io,this},window.L=t})},e11e2:function(t,e){t.exports=\"constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf\".split(\",\")},e4ae:function(t,e,n){var i=n(\"f772\");t.exports=function(t){if(!i(t))throw TypeError(t+\" is not an object!\");return t}},e53d:function(t,e){var n=t.exports=\"undefined\"!=typeof window&&window.Math==Math?window:\"undefined\"!=typeof self&&self.Math==Math?self:Function(\"return this\")();\"number\"==typeof __g&&(__g=n)},e6f3:function(t,e,n){var i=n(\"07e3\"),o=n(\"36c3\"),r=n(\"5b4e\")(!1),s=n(\"5559\")(\"IE_PROTO\");t.exports=function(t,e){var n,a=o(t),u=0,h=[];for(n in a)n!=s&&i(a,n)&&h.push(n);while(e.length>u)i(a,n=e[u++])&&(~r(h,n)||h.push(n));return h}},ead6:function(t,e,n){var i=n(\"f772\"),o=n(\"e4ae\"),r=function(t,e){if(o(t),!i(e)&&null!==e)throw TypeError(e+\": can't set as prototype!\")};t.exports={set:Object.setPrototypeOf||(\"__proto__\"in{}?function(t,e,i){try{i=n(\"d864\")(Function.call,n(\"bf0b\").f(Object.prototype,\"__proto__\").set,2),i(t,[]),e=!(t instanceof Array)}catch(o){e=!0}return function(t,n){return r(t,n),e?t.__proto__=n:i(t,n),t}}({},!1):void 0),check:r}},ebd6:function(t,e,n){var i=n(\"cb7c\"),o=n(\"d8e8\"),r=n(\"2b4c\")(\"species\");t.exports=function(t,e){var n,s=i(t).constructor;return void 0===s||void 0==(n=i(s)[r])?e:o(n)}},ebfd:function(t,e,n){var i=n(\"62a0\")(\"meta\"),o=n(\"f772\"),r=n(\"07e3\"),s=n(\"d9f6\").f,a=0,u=Object.isExtensible||function(){return!0},h=!n(\"294c\")(function(){return u(Object.preventExtensions({}))}),c=function(t){s(t,i,{value:{i:\"O\"+ ++a,w:{}}})},l=function(t,e){if(!o(t))return\"symbol\"==typeof t?t:(\"string\"==typeof t?\"S\":\"P\")+t;if(!r(t,i)){if(!u(t))return\"F\";if(!e)return\"E\";c(t)}return t[i].i},f=function(t,e){if(!r(t,i)){if(!u(t))return!0;if(!e)return!1;c(t)}return t[i].w},d=function(t){return h&&p.NEED&&u(t)&&!r(t,i)&&c(t),t},p=t.exports={KEY:i,NEED:!1,fastKey:l,getWeak:f,onFreeze:d}},f1ae:function(t,e,n){\"use strict\";var i=n(\"86cc\"),o=n(\"4630\");t.exports=function(t,e,n){e in t?i.f(t,e,o(0,n)):t[e]=n}},f201:function(t,e,n){var i=n(\"e4ae\"),o=n(\"79aa\"),r=n(\"5168\")(\"species\");t.exports=function(t,e){var n,s=i(t).constructor;return void 0===s||void 0==(n=i(s)[r])?e:o(n)}},f605:function(t,e){t.exports=function(t,e,n,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(n+\": incorrect invocation!\");return t}},f751:function(t,e,n){var i=n(\"5ca1\");i(i.S+i.F,\"Object\",{assign:n(\"7333\")})},f772:function(t,e){t.exports=function(t){return\"object\"===typeof t?null!==t:\"function\"===typeof t}},f921:function(t,e,n){n(\"014b\"),n(\"c207\"),n(\"69d3\"),n(\"765d\"),t.exports=n(\"584a\").Symbol},fa5b:function(t,e,n){t.exports=n(\"5537\")(\"native-function-to-string\",Function.toString)},fa99:function(t,e,n){n(\"0293\"),t.exports=n(\"584a\").Object.getPrototypeOf},fab2:function(t,e,n){var i=n(\"7726\").document;t.exports=i&&i.documentElement},fdef:function(t,e){t.exports=\"\\t\\n\\v\\f\\r   ᠎             　\\u2028\\u2029\\ufeff\"}}]);\n//# sourceMappingURL=chunk-vendors.js.map"
  }
]