From 4edba5618e017e1dbd1454d19bf53a03261a75b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 9 Mar 2023 22:21:49 -0300 Subject: [PATCH 1/3] Update PHPStan baseline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- phpstan-baseline.neon | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 7080cf2831..b0e373150f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5085,11 +5085,6 @@ parameters: count: 1 path: libraries/classes/InsertEdit.php - - - message: "#^Parameter \\#1 \\$str of method PhpMyAdmin\\\\DatabaseInterface\\:\\:escapeString\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: libraries/classes/InsertEdit.php - - message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:addMicroseconds\\(\\) expects string, string\\|null given\\.$#" count: 1 From b2ab87a0fa72a0f14e33b3214be010b4226f27c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 9 Mar 2023 22:27:03 -0300 Subject: [PATCH 2/3] Update JavaScript dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- yarn.lock | 350 +++++++++++++++++++++++++++--------------------------- 1 file changed, 178 insertions(+), 172 deletions(-) diff --git a/yarn.lock b/yarn.lock index e0e144416e..814e2e9a20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.1.0": +"@ampproject/remapping@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== @@ -11,11 +11,11 @@ "@jridgewell/trace-mapping" "^0.3.9" "@babel/cli@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.20.7.tgz#8fc12e85c744a1a617680eacb488fab1fcd35b7c" - integrity sha512-WylgcELHB66WwQqItxNILsMlaTd8/SO6SgTTjMp4uCI7P4QyH1r3nqgFmO3BfM4AtfniHgFMH3EpYFj/zynBkQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.21.0.tgz#1868eb70e9824b427fc607610cce8e9e7889e7e1" + integrity sha512-xi7CxyS8XjSyiwUGCfwf+brtJxjW1/ZTcBUkP10xawIEXLX5HzLn+3aXkgxozcP2UhRhtKTmQurw9Uaes7jZrA== dependencies: - "@jridgewell/trace-mapping" "^0.3.8" + "@jridgewell/trace-mapping" "^0.3.17" commander "^4.0.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" @@ -41,38 +41,39 @@ "@babel/highlight" "^7.18.6" "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": - version "7.20.14" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.14.tgz#4106fc8b755f3e3ee0a0a7c27dde5de1d2b2baf8" - integrity sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.0.tgz#c241dc454e5b5917e40d37e525e2f4530c399298" + integrity sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g== "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.17.9", "@babel/core@^7.18.9", "@babel/core@^7.7.2", "@babel/core@^7.8.0": - version "7.20.12" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.12.tgz#7930db57443c6714ad216953d1356dac0eb8496d" - integrity sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.0.tgz#1341aefdcc14ccc7553fcc688dd8986a2daffc13" + integrity sha512-PuxUbxcW6ZYe656yL3EAhpy7qXKq0DmYsrJLpbB8XrsCP9Nm+XCg9XFMb5vIDliPD7+U/+M+QJlH17XOcB7eXA== dependencies: - "@ampproject/remapping" "^2.1.0" + "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.7" + "@babel/generator" "^7.21.0" "@babel/helper-compilation-targets" "^7.20.7" - "@babel/helper-module-transforms" "^7.20.11" - "@babel/helpers" "^7.20.7" - "@babel/parser" "^7.20.7" + "@babel/helper-module-transforms" "^7.21.0" + "@babel/helpers" "^7.21.0" + "@babel/parser" "^7.21.0" "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.12" - "@babel/types" "^7.20.7" + "@babel/traverse" "^7.21.0" + "@babel/types" "^7.21.0" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.2" semver "^6.3.0" -"@babel/generator@^7.20.7", "@babel/generator@^7.7.2": - version "7.20.14" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.14.tgz#9fa772c9f86a46c6ac9b321039400712b96f64ce" - integrity sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg== +"@babel/generator@^7.21.0", "@babel/generator@^7.21.1", "@babel/generator@^7.7.2": + version "7.21.1" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.1.tgz#951cc626057bc0af2c35cd23e9c64d384dea83dd" + integrity sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA== dependencies: - "@babel/types" "^7.20.7" + "@babel/types" "^7.21.0" "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" "@babel/helper-annotate-as-pure@^7.18.6": @@ -101,27 +102,27 @@ lru-cache "^5.1.1" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.20.5", "@babel/helper-create-class-features-plugin@^7.20.7": - version "7.20.12" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.20.12.tgz#4349b928e79be05ed2d1643b20b99bb87c503819" - integrity sha512-9OunRkbT0JQcednL0UFvbfXpAsUXiGjUk0a7sN8fUXX7Mue79cUSMjHGDRRi/Vz9vYlpIhLV5fMD5dKoMhhsNQ== +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.0.tgz#64f49ecb0020532f19b1d014b03bccaa1ab85fb9" + integrity sha512-Q8wNiMIdwsv5la5SPxNYzzkPnjgC0Sy0i7jLkVOCdllu/xcVNkr3TeZzbHBJrj+XXRqzX5uCyCoV9eu6xUG7KQ== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-member-expression-to-functions" "^7.20.7" + "@babel/helper-function-name" "^7.21.0" + "@babel/helper-member-expression-to-functions" "^7.21.0" "@babel/helper-optimise-call-expression" "^7.18.6" "@babel/helper-replace-supers" "^7.20.7" "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.20.5.tgz#5ea79b59962a09ec2acf20a963a01ab4d076ccca" - integrity sha512-m68B1lkg3XDGX5yCvGO0kPx3v9WIYLnzjKfPcQiwntEQa5ZeRkPmo2X/ISJc8qxWGfwUr+kvZAeEzAwLec2r2w== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.0.tgz#53ff78472e5ce10a52664272a239787107603ebb" + integrity sha512-N+LaFW/auRSWdx7SHD/HiARwXQju1vXTW4fKr4u5SgBUTm51OKEjKgj+cs00ggW3kEvNqwErnlwuq7Y3xBe4eg== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - regexpu-core "^5.2.1" + regexpu-core "^5.3.1" "@babel/helper-define-polyfill-provider@^0.3.3": version "0.3.3" @@ -147,13 +148,13 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" - integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== +"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0", "@babel/helper-function-name@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" + integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg== dependencies: - "@babel/template" "^7.18.10" - "@babel/types" "^7.19.0" + "@babel/template" "^7.20.7" + "@babel/types" "^7.21.0" "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" @@ -162,12 +163,12 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-member-expression-to-functions@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.20.7.tgz#a6f26e919582275a93c3aa6594756d71b0bb7f05" - integrity sha512-9J0CxJLq315fEdi4s7xK5TQaNYjZw+nDVpVqr1axNGKzdrdwYBD5b4uKv3n75aABG0rCCTK8Im8Ww7eYfMrZgw== +"@babel/helper-member-expression-to-functions@^7.20.7", "@babel/helper-member-expression-to-functions@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz#319c6a940431a133897148515877d2f3269c3ba5" + integrity sha512-Muu8cdZwNN6mRRNG6lAYErJ5X3bRevgYR2O8wN0yn7jJSnGDu6eG59RfT29JHxGUovyfrh6Pj0XzmR7drNVL3Q== dependencies: - "@babel/types" "^7.20.7" + "@babel/types" "^7.21.0" "@babel/helper-module-imports@^7.18.6": version "7.18.6" @@ -176,10 +177,10 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz#df4c7af713c557938c50ea3ad0117a7944b2f1b0" - integrity sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg== +"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11", "@babel/helper-module-transforms@^7.21.0", "@babel/helper-module-transforms@^7.21.2": + version "7.21.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz#160caafa4978ac8c00ac66636cb0fa37b024e2d2" + integrity sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ== dependencies: "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" @@ -187,8 +188,8 @@ "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-validator-identifier" "^7.19.1" "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.10" - "@babel/types" "^7.20.7" + "@babel/traverse" "^7.21.2" + "@babel/types" "^7.21.2" "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" @@ -256,9 +257,9 @@ integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== "@babel/helper-validator-option@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" - integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" + integrity sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ== "@babel/helper-wrap-function@^7.18.9": version "7.20.5" @@ -270,14 +271,14 @@ "@babel/traverse" "^7.20.5" "@babel/types" "^7.20.5" -"@babel/helpers@^7.20.7": - version "7.20.13" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.13.tgz#e3cb731fb70dc5337134cadc24cbbad31cc87ad2" - integrity sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg== +"@babel/helpers@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.21.0.tgz#9dd184fb5599862037917cdc9eecb84577dc4e7e" + integrity sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA== dependencies: "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.13" - "@babel/types" "^7.20.7" + "@babel/traverse" "^7.21.0" + "@babel/types" "^7.21.0" "@babel/highlight@^7.10.4", "@babel/highlight@^7.18.6": version "7.18.6" @@ -288,10 +289,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.13", "@babel/parser@^7.20.7": - version "7.20.13" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.13.tgz#ddf1eb5a813588d2fb1692b70c6fce75b945c088" - integrity sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.0", "@babel/parser@^7.21.2": + version "7.21.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.2.tgz#dacafadfc6d7654c3051a66d6fe55b6cb2f2a0b3" + integrity sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -328,11 +329,11 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-proposal-class-static-block@^7.18.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.20.7.tgz#92592e9029b13b15be0f7ce6a7aedc2879ca45a7" - integrity sha512-AveGOoi9DAjUYYuUAG//Ig69GlazLnoyzMw68VCDux+c1tsnnH/OkYcpz/5xzMkEFC6UxjR5Gw1c+iY2wOGVeQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.21.0.tgz#77bdd66fb7b605f3a61302d224bdfacf5547977d" + integrity sha512-XP5G9MWNUskFuP30IfFSEFB0Z6HzLIUcjYM4bYOPHXl7eiJ9HFv8tWj6TXTN5QODiEhDZAeI4hLok2iHFFV4hw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.20.7" + "@babel/helper-create-class-features-plugin" "^7.21.0" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-class-static-block" "^7.14.5" @@ -404,9 +405,9 @@ "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-proposal-optional-chaining@^7.18.9", "@babel/plugin-proposal-optional-chaining@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.20.7.tgz#49f2b372519ab31728cc14115bb0998b15bfda55" - integrity sha512-T+A7b1kfjtRM51ssoOfS1+wbyCVqorfyZhT99TvxxLMirPShD8CzKMRepMlCBGM5RpHMbn8s+5MMHnPstJH6mQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" + integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" @@ -421,12 +422,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-proposal-private-property-in-object@^7.18.6": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.20.5.tgz#309c7668f2263f1c711aa399b5a9a6291eef6135" - integrity sha512-Vq7b9dUA12ByzB4EjQTPo25sFhY+08pQDBSZRtUAkj7lb7jahaHR5igera16QZ+3my1nYR4dKsNdYj5IjPHilQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0.tgz#19496bd9883dd83c23c7d7fc45dcd9ad02dfa1dc" + integrity sha512-ha4zfehbJjc5MmXBlHec1igel5TJXXLDDRbuJ4+XT2TJcyD9/V1919BA8gMvsdHcNMBy4WBUBiRb3nw/EQUtBw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-create-class-features-plugin" "^7.20.5" + "@babel/helper-create-class-features-plugin" "^7.21.0" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" @@ -588,21 +589,21 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-block-scoping@^7.20.2": - version "7.20.14" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.14.tgz#2f5025f01713ba739daf737997308e0d29d1dd75" - integrity sha512-sMPepQtsOs5fM1bwNvuJJHvaCfOEQfmc01FGw0ELlTpTJj5Ql/zuNRRldYhAPys4ghXdBIQJbRVYi44/7QflQQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.21.0.tgz#e737b91037e5186ee16b76e7ae093358a5634f02" + integrity sha512-Mdrbunoh9SxwFZapeHVrwFmri16+oYotcZysSzhNIVDwIAb1UV+kvnxULSYq9J3/q5MDG+4X6w8QVgD1zhBXNQ== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-classes@^7.20.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.7.tgz#f438216f094f6bb31dc266ebfab8ff05aecad073" - integrity sha512-LWYbsiXTPKl+oBlXUGlwNlJZetXD5Am+CyBdqhPsDVjM9Jc8jwBJFrKhHf900Kfk2eZG1y9MAG3UNajol7A4VQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.21.0.tgz#f469d0b07a4c5a7dbb21afad9e27e57b47031665" + integrity sha512-RZhbYTCEUAe6ntPehC4hlslPWosNHDox+vAs4On/mCLRLfoDVHf6hVEd7kuxr1RnHwJmxFfUM3cZiZRmPxJPXQ== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-compilation-targets" "^7.20.7" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" + "@babel/helper-function-name" "^7.21.0" "@babel/helper-optimise-call-expression" "^7.18.6" "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-replace-supers" "^7.20.7" @@ -648,11 +649,11 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-for-of@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" - integrity sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.21.0.tgz#964108c9988de1a60b4be2354a7d7e245f36e86e" + integrity sha512-LlUYlydgDkKpIY7mcBWvyPPmMcOphEyYA27Ef4xpbh1IiDNLr0kZsos2nf92vz3IccvJI25QUwp86Eo5s6HmBQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-function-name@^7.18.9": version "7.18.9" @@ -686,11 +687,11 @@ "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-modules-commonjs@^7.19.6": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.20.11.tgz#8cb23010869bf7669fd4b3098598b6b2be6dc607" - integrity sha512-S8e1f7WQ7cimJQ51JkAaDrEtohVEitXjgCGAS2N8S31Y42E+kWwfSz83LYz57QdBm7q9diARVqanIaH2oVgQnw== + version "7.21.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.2.tgz#6ff5070e71e3192ef2b7e39820a06fb78e3058e7" + integrity sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA== dependencies: - "@babel/helper-module-transforms" "^7.20.11" + "@babel/helper-module-transforms" "^7.21.2" "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-simple-access" "^7.20.2" @@ -907,10 +908,15 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" +"@babel/regjsgen@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" + integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== + "@babel/runtime@^7.8.4": - version "7.20.13" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.13.tgz#7055ab8a7cff2b8f6058bf6ae45ff84ad2aded4b" - integrity sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" + integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== dependencies: regenerator-runtime "^0.13.11" @@ -923,26 +929,26 @@ "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" -"@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.13", "@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.7.2": - version "7.20.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.13.tgz#817c1ba13d11accca89478bd5481b2d168d07473" - integrity sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ== +"@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.7.2": + version "7.21.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.2.tgz#ac7e1f27658750892e815e60ae90f382a46d8e75" + integrity sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.7" + "@babel/generator" "^7.21.1" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" + "@babel/helper-function-name" "^7.21.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.13" - "@babel/types" "^7.20.7" + "@babel/parser" "^7.21.2" + "@babel/types" "^7.21.2" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f" - integrity sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg== +"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.21.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.2.tgz#92246f6e00f91755893c2876ad653db70c8310d1" + integrity sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw== dependencies: "@babel/helper-string-parser" "^7.19.4" "@babel/helper-validator-identifier" "^7.19.1" @@ -1199,7 +1205,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/trace-mapping@^0.3.8", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.17" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== @@ -1383,9 +1389,9 @@ integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== "@types/node@*": - version "18.11.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" - integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== + version "18.15.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.0.tgz#286a65e3fdffd691e170541e6ecb0410b16a38be" + integrity sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -1425,9 +1431,9 @@ "@types/yargs-parser" "*" "@zxcvbn-ts/core@^2.0.1": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@zxcvbn-ts/core/-/core-2.2.0.tgz#cb955aa86310491f4acf3123f1629cecef2ec156" - integrity sha512-LPKwI9ZBXGbXhQD39L//c923743yhmiTvnR8cu+u0mpsBt/kRdOJGMUMrbVV0sZZgn0XFc5RokjIxWllghN9kA== + version "2.2.1" + resolved "https://registry.yarnpkg.com/@zxcvbn-ts/core/-/core-2.2.1.tgz#18780bde852b1f5068c93219b2dec78cb6d9c6f9" + integrity sha512-Cg1JyRpCDIF+Dh3nauqygmmCYxogNVZDxSn+9PgkPD1HZ2QiJe4elruVJrGmYRS7muGmZ1hNJq8ySQdPv6GHaw== dependencies: fastest-levenshtein "1.0.16" @@ -1575,12 +1581,12 @@ asynckit@^0.4.0: integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== autoprefixer@^10.4.7: - version "10.4.13" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.13.tgz#b5136b59930209a321e9fa3dca2e7c4d223e83a8" - integrity sha512-49vKpMqcZYsJjwotvt4+h/BCjJVnhGwcLpDt5xkcaOG3eLrG/HUYLagrihYsQ+qrIBgIzX1Rw7a6L8I/ZA1Atg== + version "10.4.14" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d" + integrity sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ== dependencies: - browserslist "^4.21.4" - caniuse-lite "^1.0.30001426" + browserslist "^4.21.5" + caniuse-lite "^1.0.30001464" fraction.js "^4.2.0" normalize-range "^0.1.2" picocolors "^1.0.0" @@ -1729,7 +1735,7 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.12.0, browserslist@^4.16.8, browserslist@^4.21.3, browserslist@^4.21.4: +browserslist@^4.12.0, browserslist@^4.16.8, browserslist@^4.21.3, browserslist@^4.21.5: version "4.21.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7" integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w== @@ -1775,10 +1781,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001251, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449: - version "1.0.30001450" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz#022225b91200589196b814b51b1bbe45144cf74f" - integrity sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew== +caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001251, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464: + version "1.0.30001464" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001464.tgz#888922718df48ce5e33dcfe1a2af7d42676c5eb7" + integrity sha512-oww27MtUmusatpRpCGSOneQk2/l5czXANDSFvsc7VuOQ86s3ANhZetpwXNf1zY/zdfP63Xvjz325DAdAoES13g== chalk@^2.0.0: version "2.4.2" @@ -1833,9 +1839,9 @@ character-reference-invalid@^1.0.0: fsevents "~2.3.2" ci-info@^3.2.0: - version "3.7.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.7.1.tgz#708a6cdae38915d597afdf3b145f2f8e1ff55f3f" - integrity sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w== + version "3.8.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" + integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== cjs-module-lexer@^1.0.0: version "1.2.2" @@ -1929,16 +1935,16 @@ convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.6.0, integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== core-js-compat@^3.25.1: - version "3.27.2" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.27.2.tgz#607c50ad6db8fd8326af0b2883ebb987be3786da" - integrity sha512-welaYuF7ZtbYKGrIy7y3eb40d37rG1FvzEOfe7hSLd2iD6duMDqUhRfSvCGyC46HhR6Y8JXXdZ2lnRUMkPBpvg== + version "3.29.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.29.0.tgz#1b8d9eb4191ab112022e7f6364b99b65ea52f528" + integrity sha512-ScMn3uZNAFhK2DGoEfErguoiAHhV2Ju+oJo/jK08p7B3f3UhocUrCCkTvnZaiS+edl5nlIoiBXKcwMc6elv4KQ== dependencies: - browserslist "^4.21.4" + browserslist "^4.21.5" core-js@^3.16.2: - version "3.27.2" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.27.2.tgz#85b35453a424abdcacb97474797815f4d62ebbf7" - integrity sha512-9ashVQskuh5AZEZ1JdQWp1GqSoC1e1G87MzRqg2gIfVAQ7Qn9K+uFj8EcniUFA4P2NLZfV+TOlX1SzoKfo+s7w== + version "3.29.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.29.0.tgz#0273e142b67761058bcde5615c503c7406b572d6" + integrity sha512-VG23vuEisJNkGl6XQmFJd3rEG/so/CNatqeE+7uZAwTSwFeB/qaO0be8xZYUNWprJ/GIwL8aMt9cj1kvbpTZhg== cosmiconfig@^7.0.0: version "7.1.0" @@ -2111,9 +2117,9 @@ domutils@^1.5.1: domelementtype "1" electron-to-chromium@^1.4.284: - version "1.4.284" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" - integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== + version "1.4.327" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.327.tgz#288b106518cfed0a60f7de8a0480432a9be45477" + integrity sha512-DIk2H4g/3ZhjgiABJjVdQvUdMlSABOsjeCm6gmUzIdKxAuFrGiJ8QXMm3i09grZdDBMC/d8MELMrdwYRC0+YHg== emittery@^0.8.1: version "0.8.1" @@ -2286,9 +2292,9 @@ esprima@^4.0.0, esprima@^4.0.1: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" @@ -2731,9 +2737,9 @@ ignore@^5.1.8, ignore@^5.1.9, ignore@^5.2.0: integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== immutable@^4.0.0: - version "4.2.2" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.2.2.tgz#2da9ff4384a4330c36d4d1bc88e90f9e0b0ccd16" - integrity sha512-fTMKDwtbvO5tldky9QZ2fMX7slR0mYpY5nbnFWYp0fOzDhHqhgIw9KoYgxLWsoNTS9ZHGauHj18DTyEw6BK3Og== + version "4.2.4" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.2.4.tgz#83260d50889526b4b531a5e293709a77f7c55a2a" + integrity sha512-WDxL3Hheb1JkRN3sQkyujNlL/xRjAo3rJtaU5xeufUauG66JdMr32bLj4gF+vWl84DIA3Zxw7tiAjneYzRRw+w== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" @@ -3379,11 +3385,16 @@ jquery-validation@1.19.5: resolved "https://registry.yarnpkg.com/jquery-validation/-/jquery-validation-1.19.5.tgz#557495b7cad79716897057c4447ad3cd76fda811" integrity sha512-X2SmnPq1mRiDecVYL8edWx+yTBZDyC8ohWXFhXdtqFHgU9Wd4KHkvcbCoIZ0JaSaumzS8s2gXSkP8F7ivg/8ZQ== -jquery@3.6.3, jquery@>=1.2.6, jquery@>=1.7, "jquery@>=1.8.0 <4.0.0": +jquery@3.6.3: version "3.6.3" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.3.tgz#23ed2ffed8a19e048814f13391a19afcdba160e6" integrity sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg== +jquery@>=1.2.6, jquery@>=1.7, "jquery@>=1.8.0 <4.0.0": + version "3.6.4" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.4.tgz#ba065c188142100be4833699852bf7c24dc0252f" + integrity sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ== + js-cookie@2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" @@ -3526,9 +3537,9 @@ levn@~0.3.0: type-check "~0.3.2" lilconfig@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.6.tgz#32a384558bd58af3d4c6e077dd1ad1d397bc69d4" - integrity sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" + integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== lines-and-columns@^1.1.6: version "1.2.4" @@ -3759,9 +3770,9 @@ minimist-options@4.1.0: kind-of "^6.0.3" minimist@^1.2.5, minimist@^1.2.6: - version "1.2.7" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" - integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== ms@2.1.2: version "2.1.2" @@ -3784,9 +3795,9 @@ node-int64@^0.4.0: integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.8: - version "2.0.9" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.9.tgz#fe66405285382b0c4ac6bcfbfbe7e8a510650b4d" - integrity sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA== + version "2.0.10" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.10.tgz#c311ebae3b6a148c89b1813fd7c4d3c024ef537f" + integrity sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w== normalize-package-data@^2.5.0: version "2.5.0" @@ -4269,9 +4280,9 @@ read-pkg@^5.2.0: type-fest "^0.6.0" readable-stream@^3.1.1: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + version "3.6.1" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.1.tgz#f9f9b5f536920253b3d26e7660e7da4ccff9bb62" + integrity sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -4321,23 +4332,18 @@ regexpp@^3.1.0: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== -regexpu-core@^5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.2.2.tgz#3e4e5d12103b64748711c3aad69934d7718e75fc" - integrity sha512-T0+1Zp2wjF/juXMrMxHxidqGYn8U4R+zleSJhX9tQ1PUsS8a9UtYfbsF9LdiVgNX3kiX8RNaKM42nfSgvFJjmw== +regexpu-core@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.1.tgz#66900860f88def39a5cb79ebd9490e84f17bcdfb" + integrity sha512-nCOzW2V/X15XpLsK2rlgdwrysrBq+AauCn+omItIz4R1pIcmeot5zvjdmOBRLzEH/CkC6IxMJVmxDe3QcMuNVQ== dependencies: + "@babel/regjsgen" "^0.8.0" regenerate "^1.4.2" regenerate-unicode-properties "^10.1.0" - regjsgen "^0.7.1" regjsparser "^0.9.1" unicode-match-property-ecmascript "^2.0.0" unicode-match-property-value-ecmascript "^2.1.0" -regjsgen@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.7.1.tgz#ee5ef30e18d3f09b7c369b76e7c2373ed25546f6" - integrity sha512-RAt+8H2ZEzHeYWxZ3H2z6tF18zyyOnlcdaafLrm21Bguj7uZy6ULibiAFdXEtKQY4Sy7wDTwDiOazasMLc4KPA== - regjsparser@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" @@ -4471,9 +4477,9 @@ safe-buffer@~5.2.0: integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== sass@^1.53.0: - version "1.58.0" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.58.0.tgz#ee8aea3ad5ea5c485c26b3096e2df6087d0bb1cc" - integrity sha512-PiMJcP33DdKtZ/1jSjjqVIKihoDc6yWmYr9K/4r3fVVIEDAluD0q7XZiRKrNJcPK3qkLRF/79DND1H5q1LBjgg== + version "1.58.3" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.58.3.tgz#2348cc052061ba4f00243a208b09c40e031f270d" + integrity sha512-Q7RaEtYf6BflYrQ+buPudKR26/lH+10EmO9bBqbmPh/KeLqv8bjpTNqxe71ocONqXq+jYiCbpPUmQMS+JJPk4A== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0" @@ -4598,9 +4604,9 @@ source-map@^0.7.3: integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== spdx-correct@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" - integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" @@ -5289,9 +5295,9 @@ yargs@^16.2.0: yargs-parser "^20.2.2" yargs@^17.0.0: - version "17.6.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" - integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== + version "17.7.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967" + integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw== dependencies: cliui "^8.0.1" escalade "^3.1.1" From 59b4fdbea0c0e39d76f7ba3eca238f213589853c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 9 Mar 2023 22:51:31 -0300 Subject: [PATCH 3/3] Update OpenLayers and zxcvbn-ts files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- js/config/ol/webpack.config.js | 3 + js/vendor/openlayers/OpenLayers.js | 37453 ++++++++++++++++++++++- js/vendor/openlayers/OpenLayers.js.map | 2 +- js/vendor/zxcvbn-ts.js | 849 +- js/vendor/zxcvbn-ts.js.map | 2 +- 5 files changed, 37739 insertions(+), 570 deletions(-) diff --git a/js/config/ol/webpack.config.js b/js/config/ol/webpack.config.js index 271f72e7f0..6efac6c5d6 100644 --- a/js/config/ol/webpack.config.js +++ b/js/config/ol/webpack.config.js @@ -16,4 +16,7 @@ module.exports = { libraryTarget: 'umd', libraryExport: 'default', }, + optimization: { + minimize: false, + }, }; diff --git a/js/vendor/openlayers/OpenLayers.js b/js/vendor/openlayers/OpenLayers.js index f7872f8926..45cb49e194 100644 --- a/js/vendor/openlayers/OpenLayers.js +++ b/js/vendor/openlayers/OpenLayers.js @@ -5,5 +5,37456 @@ * * @license BSD-2-Clause */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(self,(function(){return function(){var t={582:function(t){t.exports=function(){"use strict";function t(t,n,o,r,s){!function t(i,n,o,r,s){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,h=Math.log(a),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(a-u)/a)*(l-a/2<0?-1:1);t(i,n,Math.max(o,Math.floor(n-l*u/a+c)),Math.min(r,Math.floor(n+(a-l)*u/a+c)),s)}var p=i[n],f=o,d=r;for(e(i,o,n),s(i[r],p)>0&&e(i,o,r);f0;)d--}0===s(i[o],p)?e(i,o,d):e(i,++d,r),d<=n&&(o=d+1),n<=d&&(r=d-1)}}(t,n,o||0,r||t.length-1,s||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(e,i,n,o,r){for(var s=[i,n];s.length;)if(!((n=s.pop())-(i=s.pop())<=o)){var a=i+Math.ceil((n-i)/o/2)*o;t(e,a,i,n,r),s.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!f(t,e))return i;for(var n=this.toBBox,o=[];e;){for(var r=0;r=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,n);var s=this._chooseSplitIndex(i,o,n),a=d(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,r(i,this.toBBox),r(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,o,r,a,l,h,c,p=1/0,f=1/0,d=e;d<=i-e;d++){var g=s(t,0,d,this.toBBox),_=s(t,d,i,this.toBBox),y=(o=g,r=_,void 0,void 0,void 0,void 0,a=Math.max(o.minX,r.minX),l=Math.max(o.minY,r.minY),h=Math.min(o.maxX,r.maxX),c=Math.min(o.maxY,r.maxY),Math.max(0,h-a)*Math.max(0,c-l)),v=u(g)+u(_);y=e;f--){var d=t.children[f];a(l,t.leaf?o(d):d),h+=c(l)}return h},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},n}()}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={exports:{}};return t[n].call(r.exports,r,r.exports,i),r.exports}i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var n={};return function(){"use strict";i.d(n,{default:function(){return uh}});var t=function(){function t(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),e="propertychange",o=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function r(t,e){return t>e?1:t0){for(o=1;o0?o-1:o:t[o-1]-e0)},i.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=p,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},i}(o),x="change",C="contextmenu",w="click",S="keydown",E="keypress",T="touchmove",b="wheel";function O(t,e,i,n,o){if(n&&n!==t&&(i=i.bind(n)),o){var r=i;i=function(){t.removeEventListener(e,i),r.apply(this,arguments)}}var s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function R(t,e,i,n){return O(t,e,i,n,!0)}function P(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),d(t))}var I=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),M=function(t){function e(){var e=t.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return I(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(x)},e.prototype.getRevision=function(){return this.revision_},e.prototype.onInternal=function(t,e){if(Array.isArray(t)){for(var i=t.length,n=new Array(i),o=0;o=0||N.match(/cpu (os|iphone os) 15_4 like mac os x/)),-1!==N.indexOf("webkit")&&-1==N.indexOf("edge")),K=-1!==N.indexOf("macintosh"),Z="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,V="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,U="undefined"!=typeof Image&&Image.prototype.decode,H=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function q(t,e,i,n){var o;return o=i&&i.length?i.shift():V?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(o.width=t),e&&(o.height=e),o.getContext("2d",n)}function J(t){var e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Q(t,e){var i=e.parentNode;i&&i.replaceChild(t,e)}function $(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}var tt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),et=function(t){function e(e){var i=t.call(this)||this,n=e.element;return!n||e.target||n.style.pointerEvents||(n.style.pointerEvents="auto"),i.element=n||null,i.target_=null,i.map_=null,i.listenerKeys=[],e.render&&(i.render=e.render),e.target&&i.setTarget(e.target),i}return tt(e,t),e.prototype.disposeInternal=function(){$(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&$(this.element);for(var e=0,i=this.listenerKeys.length;e1?(i=o,n=r):l>0&&(i+=s*l,n+=a*l)}return Tt(t,e,i,n)}function Tt(t,e,i,n){var o=i-t,r=n-e;return o*o+r*r}function bt(t){return t*Math.PI/180}function Ot(t,e){var i=t%e;return i*e<0?i+e:i}function Rt(t,e,i){return t+i*(e-t)}function Pt(t,e){var i=Math.pow(10,e);return Math.round(t*i)/i}function It(t,e){return Math.floor(Pt(t,e))}function Mt(t,e){return Math.ceil(Pt(t,e))}var Ft=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Lt=function(t){function e(e){var i=t.call(this)||this;i.on,i.once,i.un,i.background_=e.background;var n=f({},e);return"object"==typeof e.properties&&(delete n.properties,f(n,e.properties)),n[ht]=void 0!==e.opacity?e.opacity:1,xt("number"==typeof n[ht],64),n[ut]=void 0===e.visible||e.visible,n[pt]=e.zIndex,n[ft]=void 0!==e.maxResolution?e.maxResolution:1/0,n[dt]=void 0!==e.minResolution?e.minResolution:0,n[_t]=void 0!==e.minZoom?e.minZoom:-1/0,n[gt]=void 0!==e.maxZoom?e.maxZoom:1/0,i.className_=void 0!==n.className?n.className:"ol-layer",delete n.className,i.setProperties(n),i.state_=null,i}return Ft(e,t),e.prototype.getBackground=function(){return this.background_},e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=Ct(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return L()},e.prototype.getLayerStatesArray=function(t){return L()},e.prototype.getExtent=function(){return this.get(ct)},e.prototype.getMaxResolution=function(){return this.get(ft)},e.prototype.getMinResolution=function(){return this.get(dt)},e.prototype.getMinZoom=function(){return this.get(_t)},e.prototype.getMaxZoom=function(){return this.get(gt)},e.prototype.getOpacity=function(){return this.get(ht)},e.prototype.getSourceState=function(){return L()},e.prototype.getVisible=function(){return this.get(ut)},e.prototype.getZIndex=function(){return this.get(pt)},e.prototype.setBackground=function(t){this.background_=t,this.changed()},e.prototype.setExtent=function(t){this.set(ct,t)},e.prototype.setMaxResolution=function(t){this.set(ft,t)},e.prototype.setMinResolution=function(t){this.set(dt,t)},e.prototype.setMaxZoom=function(t){this.set(gt,t)},e.prototype.setMinZoom=function(t){this.set(_t,t)},e.prototype.setOpacity=function(t){xt("number"==typeof t,64),this.set(ht,t)},e.prototype.setVisible=function(t){this.set(ut,t)},e.prototype.setZIndex=function(t){this.set(pt,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(G),At="precompose",Dt="rendercomplete",kt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function jt(t,e){if(!t.visible)return!1;var i=e.resolution;if(i=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Gt=function(t){function e(e){var i=this,n=f({},e);delete n.source,(i=t.call(this,n)||this).on,i.once,i.un,i.mapPrecomposeKey_=null,i.mapRenderKey_=null,i.sourceChangeKey_=null,i.renderer_=null,i.rendered=!1,e.render&&(i.render=e.render),e.map&&i.setMap(e.map),i.addChangeListener(yt,i.handleSourcePropertyChange_);var o=e.source?e.source:null;return i.setSource(o),i}return kt(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(yt)||null},e.prototype.getRenderSource=function(){return this.getSource()},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():"undefined"},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(P(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=O(t,x,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise((function(t){return t([])}))},e.prototype.getData=function(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null},e.prototype.render=function(t,e){var i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)},e.prototype.unrender=function(){this.rendered=!1},e.prototype.setMapInternal=function(t){t||this.unrender(),this.set("map",t)},e.prototype.getMapInternal=function(){return this.get("map")},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(P(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(P(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=O(t,At,(function(t){var e=t.frameState.layerStatesArray,i=this.getLayerState(!1);xt(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=O(this,x,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(yt,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),t.prototype.disposeInternal.call(this)},e}(Lt),zt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wt=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).ulElement_=document.createElement("ul"),i.collapsed_=void 0===n.collapsed||n.collapsed,i.userCollapsed_=i.collapsed_,i.overrideCollapsible_=void 0!==n.collapsible,i.collapsible_=void 0===n.collapsible||n.collapsible,i.collapsible_||(i.collapsed_=!1);var o=void 0!==n.className?n.className:"ol-attribution",r=void 0!==n.tipLabel?n.tipLabel:"Attributions",s=void 0!==n.expandClassName?n.expandClassName:o+"-expand",a=void 0!==n.collapseLabel?n.collapseLabel:"›",l=void 0!==n.collapseClassName?n.collapseClassName:o+"-collapse";"string"==typeof a?(i.collapseLabel_=document.createElement("span"),i.collapseLabel_.textContent=a,i.collapseLabel_.className=l):i.collapseLabel_=a;var h=void 0!==n.label?n.label:"i";"string"==typeof h?(i.label_=document.createElement("span"),i.label_.textContent=h,i.label_.className=s):i.label_=h;var u=i.collapsible_&&!i.collapsed_?i.collapseLabel_:i.label_;i.toggleButton_=document.createElement("button"),i.toggleButton_.setAttribute("type","button"),i.toggleButton_.setAttribute("aria-expanded",String(!i.collapsed_)),i.toggleButton_.title=r,i.toggleButton_.appendChild(u),i.toggleButton_.addEventListener(w,i.handleClick_.bind(i),!1);var c=o+" "+nt+" "+ot+(i.collapsed_&&i.collapsible_?" "+rt:"")+(i.collapsible_?"":" ol-uncollapsible"),p=i.element;return p.className=c,p.appendChild(i.toggleButton_),p.appendChild(i.ulElement_),i.renderedAttributions_=[],i.renderedVisible_=!0,i}return zt(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},i=[],n=!0,o=t.layerStatesArray,r=0,s=o.length;r0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!h(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(var n=0,o=e.length;no&&(l|=4),ar&&(l|=2),0===l&&(l=1),l}function ye(t,e,i,n,o){return o?(o[0]=t,o[1]=e,o[2]=i,o[3]=n,o):[t,e,i,n]}function ve(t){return ye(1/0,1/0,-1/0,-1/0,t)}function me(t,e,i,n,o){return we(ve(o),t,e,i,n)}function xe(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Ce(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function we(t,e,i,n,o){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ge(t){return t[2]=i[2])){var o=ke(i),r=Math.floor((n[0]-i[0])/o)*o;t[0]-=r,t[2]-=r}return t}function We(t,e){for(var i=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Xe(t,e){var i=Math.cos(e),n=Math.sin(e),o=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=o,t[1]=r,t}function Ne(t,e){if(e.canWrapX()){var i=ke(e.getExtent()),n=function(t,e,i){var n=e.getExtent(),o=0;if(e.canWrapX()&&(t[0]n[2])){var r=i||ke(n);o=Math.floor((t[0]-n[0])/r)}return o}(t,e,i);n&&(t[0]-=n*i)}return t}function Ye(t,e,i){var n=i||6371008.8,o=bt(t[1]),r=bt(e[1]),s=(r-o)/2,a=bt(e[0]-t[0])/2,l=Math.sin(s)*Math.sin(s)+Math.sin(a)*Math.sin(a)*Math.cos(o)*Math.cos(r);return 2*n*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))}var Be=!0;function Ke(t){Be=!(void 0===t||t)}function Ze(t,e,i){var n;if(void 0!==e){for(var o=0,r=t.length;o1)for(var r=t[2]-t[0],s=t[3]-t[1],a=0;a=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Be=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function ci(t,e){return t}function pi(t,e){return t}function fi(t,e){return t}Je(te),Je(re),oi=te,ri=function(t,e,i){var n=t.length,o=i>1?i:2,r=e;void 0===r&&(r=o>2?t.slice():new Array(n));for(var s=0;sQt?a=Qt:a<-Qt&&(a=-Qt),r[s+1]=a}return r},si=function(t,e,i){var n=t.length,o=i>1?i:2,r=e;void 0===r&&(r=o>2?t.slice():new Array(n));for(var s=0;s0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:xi})):e.setZoom(n)}}},e}(et),bi="XY",Oi="XYM",Ri="XYZM";function Pi(t,e){var i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Ii(t,e,i,n,o,r,s,a){var l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=o*l,t[2]=-n*l,t[3]=o*h,t[4]=s*n*h-a*n*l+e,t[5]=s*o*l+a*o*h+i,t}function Mi(t,e){var i,n=(i=e)[0]*i[3]-i[1]*i[2];xt(0!==n,32);var o=e[0],r=e[1],s=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/n,t[1]=-r/n,t[2]=-s/n,t[3]=o/n,t[4]=(s*h-a*l)/n,t[5]=-(o*h-r*l)/n,t}function Fi(t){var e="matrix("+t.join(", ")+")";if(V)return e;var i=Si||(Si=document.createElement("div"));return i.style.transform=e,i.style.transform}function Li(t,e,i,n,o,r){for(var s=r||[],a=0,l=e;l1)a=i;else{if(p>0){for(var f=0;fo&&(o=h),r=a,s=l}return o}function Ki(t,e,i,n,o){for(var r=0,s=i.length;r0;){for(var c=h.pop(),p=h.pop(),f=0,d=t[p],g=t[p+1],_=t[c],y=t[c+1],v=p+n;vf&&(u=v,f=m)}f>o&&(l[(u-e)/n]=1,p+n0&&g>f)&&(d<0&&_0&&_>d)?(a=c,l=p):(r[s++]=a,r[s++]=l,h=a,u=l,a=c,l=p)}}return r[s++]=a,r[s++]=l,s}function $i(t,e,i,n,o,r,s,a){for(var l=0,h=i.length;l>1)],e))<0?a=n+1:(l=n,h=!o);return h?a:~a}(d,v);m<0?(h=(v-d[-m-2])/(d[-m-1]-d[-m-2]),l=e+(-m-2)*n):l=e+m*n}var x=a>1?a:2,C=s||new Array(x);for(g=0;g>1;or&&(h-a)*(r-l)-(o-a)*(u-l)>0&&s++:u<=r&&(h-a)*(r-l)-(o-a)*(u-l)<0&&s--,a=h,l=u}return 0!==s}function hn(t,e,i,n,o,r){if(0===i.length)return!1;if(!ln(t,e,i[0],n,o,r))return!1;for(var s=1,a=i.length;s=o[0]&&r[2]<=o[2]||r[1]>=o[1]&&r[3]<=o[3]||tn(t,e,i,n,(function(t,e){return function(t,e,i){var n=!1,o=_e(t,e),r=_e(t,i);if(1===o||1===r)n=!0;else{var s=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],p=i[0],f=i[1],d=(f-c)/(p-u),g=void 0,_=void 0;2&r&&!(2&o)&&(n=(g=p-(f-h)/d)>=s&&g<=l),n||!(4&r)||4&o||(n=(_=f-(p-l)*d)>=a&&_<=h),n||!(8&r)||8&o||(n=(g=p-(f-a)/d)>=s&&g<=l),n||!(16&r)||16&o||(n=(_=f-(p-s)*d)>=a&&_<=h)}return n}(o,t,e)})))}function cn(t,e,i,n,o){return!!(un(t,e,i,n,o)||ln(t,e,i,n,o[0],o[1])||ln(t,e,i,n,o[0],o[3])||ln(t,e,i,n,o[2],o[1])||ln(t,e,i,n,o[2],o[3]))}function pn(t,e,i,n,o){if(!cn(t,e,i[0],n,o))return!1;if(1===i.length)return!0;for(var r=1,s=i.length;rC&&hn(t,e,i,n,u=(c+p)/2,g)&&(x=u,C=w),c=p}return isNaN(x)&&(x=o[s]),a?(a.push(x,g,C),a):[x,g,C]}function Fn(t,e,i,n){for(;e0}function An(t,e,i,n,o){for(var r=void 0!==o&&o,s=0,a=i.length;s=1024){var o=0;for(var r in t)0==(3&o++)&&(delete t[r],--e)}n=function(t){var e,i,n,o,r;if($n.exec(t)&&(t=function(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}(t)),Qn.exec(t)){var s,a=t.length-1;s=a<=4?1:2;var l=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),i=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),o=l?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(o=(o<<4)+o)),r=[e,i,n,o/255]}else 0==t.indexOf("rgba(")?no(r=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((r=t.slice(4,-1).split(",").map(Number)).push(1),no(r)):xt(!1,14);return r}(i),t[i]=n,++e}return n}}();function io(t){return Array.isArray(t)?t:eo(t)}function no(t){return t[0]=Ct(t[0]+.5|0,0,255),t[1]=Ct(t[1]+.5|0,0,255),t[2]=Ct(t[2]+.5|0,0,255),t[3]=Ct(t[3],0,1),t}function oo(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}var ro=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),so=[],ao=null,lo=function(t){function e(e){var i=t.call(this,e)||this;return i.container=null,i.renderedResolution,i.tempTransform=[1,0,0,1,0,0],i.pixelTransform=[1,0,0,1,0,0],i.inversePixelTransform=[1,0,0,1,0,0],i.context=null,i.containerReused=!1,i.pixelContext_=null,i.frameState=null,i}return ro(e,t),e.prototype.getImageData=function(t,e,i){var n,o;ao||((n=document.createElement("canvas")).width=1,n.height=1,ao=n.getContext("2d")),ao.clearRect(0,0,1,1);try{ao.drawImage(t,e,i,1,1,0,0,1,1),o=ao.getImageData(0,0,1,1).data}catch(t){return ao=null,null}return o},e.prototype.getBackground=function(t){var e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0},e.prototype.useContainer=function(t,e,i){var n,o,r=this.getLayer().getClassName();if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&h(io(t.style.backgroundColor),io(i)))&&(a=t.firstElementChild)instanceof HTMLCanvasElement&&(o=a.getContext("2d")),o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){(n=document.createElement("div")).className=r;var s=n.style;s.position="absolute",s.width="100%",s.height="100%";var a=(o=q()).canvas;n.appendChild(a),(s=a.style).position="absolute",s.left="0",s.transformOrigin="top left",this.container=n,this.context=o}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)},e.prototype.clipUnrotated=function(t,e,i){var n=Ae(i),o=De(i),r=Oe(i),s=be(i);Pi(e.coordinateToPixelTransform,n),Pi(e.coordinateToPixelTransform,o),Pi(e.coordinateToPixelTransform,r),Pi(e.coordinateToPixelTransform,s);var a=this.inversePixelTransform;Pi(a,n),Pi(a,o),Pi(a,r),Pi(a,s),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,i){var n=this.getLayer();if(n.hasListener(t)){var o=new Jn(t,this.inversePixelTransform,i,e);n.dispatchEvent(o)}},e.prototype.preRender=function(t,e){this.frameState=e,this.dispatchRenderEvent_("prerender",t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_("postrender",t,e)},e.prototype.getRenderTransform=function(t,e,i,n,o,r,s){var a=o/2,l=r/2,h=n/e,u=-h,c=-t[0]+s,p=-t[1];return Ii(this.tempTransform,a,l,h,u,-i,c,p)},e.prototype.getDataAtPixel=function(t,e,i){var n=Pi(this.inversePixelTransform,t.slice()),o=this.context,r=this.getLayer().getExtent();if(r&&!fe(r,Pi(e.pixelToCoordinateTransform,t.slice())))return null;var s,a=Math.round(n[0]),l=Math.round(n[1]),h=this.pixelContext_;if(!h){var u=document.createElement("canvas");u.width=1,u.height=1,h=u.getContext("2d"),this.pixelContext_=h}h.clearRect(0,0,1,1);try{h.drawImage(o.canvas,a,l,1,1,0,0,1,1),s=h.getImageData(0,0,1,1).data}catch(t){return"SecurityError"===t.name?(this.pixelContext_=null,new Uint8Array):s}return 0===s[3]?null:s},e.prototype.disposeInternal=function(){delete this.frameState,t.prototype.disposeInternal.call(this)},e}(Hn),ho=lo,uo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),co=function(t){function e(e,i,n){var o=t.call(this)||this,r=n||{};return o.tileCoord=e,o.state=i,o.interimTile=null,o.key="",o.transition_=void 0===r.transition?250:r.transition,o.transitionStarts_={},o.interpolate=!!r.interpolate,o}return uo(e,t),e.prototype.changed=function(){this.dispatchEvent(x)},e.prototype.release=function(){},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(2==t.getState())return this.transition_=0,t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(2==t.getState()){t.interimTile=null;break}1==t.getState()?e=t:0==t.getState()?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){L()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n=e-i+1e3/60;return n>=this.transition_?1:mi(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(m),po=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),fo=function(t){function e(e,i,n,o){var r=t.call(this)||this;return r.extent=e,r.pixelRatio_=n,r.resolution=i,r.state=o,r}return po(e,t),e.prototype.changed=function(){this.dispatchEvent(x)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return L()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){L()},e}(m),go=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function _o(t,e,i){var n=t,o=!0,r=!1,s=!1,a=[R(n,"load",(function(){s=!0,r||e()}))];return n.src&&U?(r=!0,n.decode().then((function(){o&&e()})).catch((function(t){o&&(s?e():i())}))):a.push(R(n,"error",i)),function(){o=!1,a.forEach(P)}}!function(t){function e(e,i,n,o,r,s){var a=t.call(this,e,i,n,0)||this;return a.src_=o,a.image_=new Image,null!==r&&(a.image_.crossOrigin=r),a.unlisten_=null,a.state=0,a.imageLoadFunction_=s,a}go(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=3,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Fe(this.extent)/this.image_.height),this.state=2,this.unlistenImage_(),this.changed()},e.prototype.load=function(){0!=this.state&&3!=this.state||(this.state=1,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=_o(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t,this.resolution=Fe(this.extent)/this.image_.height},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}(fo);var yo,vo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),mo=function(t){function e(e,i,n,o,r,s){var a=t.call(this,e,i,s)||this;return a.crossOrigin_=o,a.src_=n,a.key=n,a.image_=new Image,null!==o&&(a.image_.crossOrigin=o),a.unlisten_=null,a.tileLoadFunction_=r,a}return vo(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.setImage=function(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()},e.prototype.handleImageError_=function(){var t;this.state=3,this.unlistenImage_(),this.image_=((t=q(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4,this.unlistenImage_(),this.changed()},e.prototype.load=function(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=_o(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(co),xo=function(){function t(t,e,i,n,o,r){this.sourceProj_=t,this.targetProj_=e;var s={},a=ei(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return s[e]||(s[e]=a(t)),s[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ke(n)==ke(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ke(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ke(this.targetProj_.getExtent()):null;var l=Ae(i),h=De(i),u=Oe(i),c=be(i),p=this.transformInv_(l),f=this.transformInv_(h),d=this.transformInv_(u),g=this.transformInv_(c),_=10+(r?Math.max(0,Math.ceil(St(Te(i)/(r*r*256*256)))):0);if(this.addQuad_(l,h,u,c,p,f,d,g,_),this.wrapsXInSource_){var y=1/0;this.triangles_.forEach((function(t,e,i){y=Math.min(y,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-y>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&u<1,f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=ke(he([t,e,i,n]))/this.targetWorldWidth_>.25||f),!p&&this.sourceProj_.isGlobal()&&u&&(f=u>.25||f)),!(!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3]))||je(h,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(o[0])&&isFinite(o[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(o[0])&&isFinite(o[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(s[0])&&isFinite(s[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!f){var g=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(g),y=void 0;y=p?(Ot(o[0],c)+Ot(s[0],c))/2-Ot(_[0],c):(o[0]+s[0])/2-_[0];var v=(o[1]+s[1])/2-_[1];f=y*y+v*v>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),C=[(n[0]+t[0])/2,(n[1]+t[1])/2],w=this.transformInv_(C);this.addQuad_(t,e,m,C,o,r,x,w,l-1),this.addQuad_(C,m,i,n,w,x,s,a,l-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(S),T=[(i[0]+n[0])/2,(i[1]+n[1])/2],b=this.transformInv_(T);this.addQuad_(t,S,T,n,o,E,b,a,l-1),this.addQuad_(S,e,i,T,E,r,s,b,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,i,n,o,s,a),0==(14&d)&&this.addTriangle_(t,i,e,o,s,r),d&&(0==(13&d)&&this.addTriangle_(e,n,t,r,a,o),0==(7&d)&&this.addTriangle_(e,n,i,r,a,s))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var o=e.source;Ce(t,o[0]),Ce(t,o[1]),Ce(t,o[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Co={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1},wo={imageSmoothingEnabled:!0,msImageSmoothingEnabled:!0},So=[];function Eo(t,e,i,n,o){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,o),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,o)),t.restore()}function To(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function bo(t,e,i,n){var o=ii(i,e,t),r=qe(e,n,i),s=e.getMetersPerUnit();void 0!==s&&(r*=s);var a=t.getMetersPerUnit();void 0!==a&&(r/=a);var l=t.getExtent();if(!l||fe(l,o)){var h=qe(t,r,o)/r;isFinite(h)&&h>0&&(r/=h)}return r}var Oo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ro=function(t){function e(e,i,n,o,r,s,a,l,h,u,c,p){var f=t.call(this,r,0,{interpolate:!!p})||this;f.renderEdges_=void 0!==c&&c,f.pixelRatio_=a,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=i,f.targetTileGrid_=o,f.wrappedTileCoord_=s||r,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=o.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),_=f.sourceTileGrid_.getExtent(),y=g?Le(d,g):d;if(0===Te(y))return f.state=4,f;var v=e.getExtent();v&&(_=_?Le(_,v):v);var m=o.getResolution(f.wrappedTileCoord_[0]),x=function(t,e,i,n){var o=Re(i),r=bo(t,e,o,n);return(!isFinite(r)||r<=0)&&Ee(i,(function(i){return r=bo(t,e,i,n),isFinite(r)&&r>0})),r}(e,n,y,m);if(!isFinite(x)||x<=0)return f.state=4,f;var C=void 0!==u?u:.5;if(f.triangulation_=new xo(e,n,y,_,x*C,m),0===f.triangulation_.getTriangles().length)return f.state=4,f;f.sourceZ_=i.getZForResolution(x);var w=f.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(w[1]=Ct(w[1],_[1],_[3]),w[3]=Ct(w[3],_[1],_[3])):w=Le(w,_)),Te(w)){for(var S=i.getTileRangeForExtentAndZ(w,f.sourceZ_),E=S.minX;E<=S.maxX;E++)for(var T=S.minY;T<=S.maxY;T++){var b=h(f.sourceZ_,E,T,a);b&&f.sourceTiles_.push(b)}0===f.sourceTiles_.length&&(f.state=4)}else f.state=4;return f}return Oo(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&2==e.getState()&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=3;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],o="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,o,r,s,a,l,h,u,c){var p=q(Math.round(i*t),Math.round(i*e),So);if(c||f(p,Co),0===l.length)return p.canvas;function d(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";var g=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){var n,o;n=g,(o=t.extent)[0]n[2]&&(n[2]=o[2]),o[1]n[3]&&(n[3]=o[3])}));var _=ke(g),y=Fe(g),v=q(Math.round(i*_/n),Math.round(i*y/n));c||f(v,Co);var m=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-g[0],o=-(t.extent[3]-g[3]),r=ke(t.extent),s=Fe(t.extent);t.image.width>0&&t.image.height>0&&v.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*m,o*m,r*m,s*m)}));var x=Ae(s);return a.getTriangles().forEach((function(t,e,o){var s=t.source,a=t.target,l=s[0][0],h=s[0][1],u=s[1][0],f=s[1][1],_=s[2][0],y=s[2][1],m=d((a[0][0]-x[0])/r),C=d(-(a[0][1]-x[1])/r),w=d((a[1][0]-x[0])/r),S=d(-(a[1][1]-x[1])/r),E=d((a[2][0]-x[0])/r),T=d(-(a[2][1]-x[1])/r),b=l,O=h;l=0,h=0;var R=function(t){for(var e=t.length,i=0;io&&(o=s,n=r)}if(0===o)return null;var a=t[n];t[n]=t[i],t[i]=a;for(var l=i+1;l=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[u-=b,f-=O,0,0,w-m],[_-=b,y-=O,0,0,E-m],[0,0,u,f,S-C],[0,0,_,y,T-C]]);if(R){if(p.save(),p.beginPath(),function(){if(void 0===yo){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Eo(t,4,5,4,0),Eo(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;yo=To(e,0)||To(e,4)||To(e,8)}return yo}()||!c){p.moveTo(w,S);for(var P=m-w,I=C-S,M=0;M<4;M++)p.lineTo(w+d((M+1)*P/4),S+d(M*I/3)),3!=M&&p.lineTo(w+d((M+1)*P/4),S+d((M+1)*I/3));p.lineTo(E,T)}else p.moveTo(w,S),p.lineTo(m,C),p.lineTo(E,T);p.clip(),p.transform(R[0],R[2],R[1],R[3],m,C),p.translate(g[0]-b,g[3]-O),p.scale(n/i,-n/i),p.drawImage(v.canvas,0,0),p.restore()}})),u&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach((function(t,e,i){var n=t.target,o=(n[0][0]-x[0])/r,s=-(n[0][1]-x[1])/r,a=(n[1][0]-x[0])/r,l=-(n[1][1]-x[1])/r,h=(n[2][0]-x[0])/r,u=-(n[2][1]-x[1])/r;p.beginPath(),p.moveTo(a,l),p.lineTo(o,s),p.lineTo(h,u),p.closePath(),p.stroke()})),p.restore()),p.canvas}(n,o,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()},e.prototype.load=function(){if(0==this.state){this.state=1,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var o=e.getState();if(0==o||1==o){t++;var r=O(e,x,(function(i){var n=e.getState();2!=n&&3!=n&&4!=n||(P(r),0==--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(r)}}.bind(this)),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){0==t.getState()&&t.load()}))}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(P),this.sourcesListenerKeys_=null},e.prototype.release=function(){this.canvas_&&(J(this.canvas_.getContext("2d")),So.push(this.canvas_),this.canvas_=null),t.prototype.release.call(this)},e}(co),Po=function(){function t(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function Io(t,e,i,n,o){return void 0!==o?(o.minX=t,o.maxX=e,o.minY=i,o.maxY=n,o):new Po(t,e,i,n)}var Mo=Po;function Fo(t){return t[0]>0&&t[1]>0}function Lo(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var Ao=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Do=function(t){function e(e){var i=t.call(this,e)||this;return i.extentChanged=!0,i.renderedExtent_=null,i.renderedPixelRatio,i.renderedProjection=null,i.renderedRevision,i.renderedTiles=[],i.newTiles_=!1,i.tmpExtent=[1/0,1/0,-1/0,-1/0],i.tmpTileRange_=new Mo(0,0,0,0),i}return Ao(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return 2==i||4==i||3==i&&!n},e.prototype.getTile=function(t,e,i,n){var o=n.pixelRatio,r=n.viewState.projection,s=this.getLayer(),a=s.getSource().getTile(t,e,i,o,r);return 3==a.getState()&&(s.getUseInterimTilesOnError()?s.getPreload()>0&&(this.newTiles_=!0):a.setState(2)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.getData=function(t){var e=this.frameState;if(!e)return null;var i=this.getLayer(),n=Pi(e.pixelToCoordinateTransform,t.slice()),o=i.getExtent();if(o&&!fe(o,n))return null;for(var r=e.pixelRatio,s=e.viewState.projection,a=e.viewState,l=i.getRenderSource(),h=l.getTileGridForProjection(a.projection),u=l.getTilePixelRatio(e.pixelRatio),c=h.getZForResolution(a.resolution);c>=h.getMinZoom();--c){var p=h.getTileCoordForCoordAndZ(n,c),f=l.getTile(c,p[1],p[2],r,s);if(!(f instanceof mo||f instanceof Ro))return null;if(2===f.getState()){var d=h.getOrigin(c),g=Lo(h.getTileSize(c)),_=h.getResolution(c),y=Math.floor(u*((n[0]-d[0])/_-p[1]*g[0])),v=Math.floor(u*((d[1]-n[1])/_-p[2]*g[1])),m=Math.round(u*l.getGutterForProjection(a.projection));return this.getImageData(f.getImage(),y+m,v+m)}}return null},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],n=t.viewState,o=n.projection,s=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,u=this.getLayer(),c=u.getSource(),p=c.getRevision(),d=c.getTileGridForProjection(o),g=d.getZForResolution(s,c.zDirection),_=d.getResolution(g),y=t.extent,v=t.viewState.resolution,m=c.getTilePixelRatio(h),x=Math.round(ke(y)/v*h),C=Math.round(Fe(y)/v*h),w=i.extent&&pi(i.extent);w&&(y=Le(y,pi(i.extent)));var S=_*x/2/m,E=_*C/2/m,T=[a[0]-S,a[1]-E,a[0]+S,a[1]+E],b=d.getTileRangeForExtentAndZ(y,g),O={};O[g]={};var R=this.createLoadedTileFinder(c,o,O),P=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var M=l?Me(n.center,v,l,t.size):void 0,F=b.minX;F<=b.maxX;++F)for(var L=b.minY;L<=b.maxY;++L)if(!l||d.tileCoordIntersectsViewport([g,F,L],M)){var A=this.getTile(g,F,L,t);if(this.isDrawableTile(A)){var k=D(this);if(2==A.getState()&&(O[g][A.tileCoord.toString()]=A,(rt=A.inTransition(k))&&1!==i.opacity&&(A.endTransition(k),rt=!1),this.newTiles_||!rt&&-1!==this.renderedTiles.indexOf(A)||(this.newTiles_=!0)),1===A.getAlpha(k,t.time))continue}var j=d.getTileCoordChildTileRange(A.tileCoord,I,P),G=!1;j&&(G=R(g+1,j)),G||d.forEachTileCoordParentTileRange(A.tileCoord,R,I,P)}var z=_/s*h/m;Ii(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-C/2);var W=Fi(this.pixelTransform);this.useContainer(e,W,this.getBackground(t));var X=this.context,N=X.canvas;Mi(this.inversePixelTransform,this.pixelTransform),Ii(this.tempTransform,x/2,C/2,z,z,0,-x/2,-C/2),N.width!=x||N.height!=C?(N.width=x,N.height=C):this.containerReused||X.clearRect(0,0,x,C),w&&this.clipUnrotated(X,t,w),c.getInterpolate()||f(X,Co),this.preRender(X,t),this.renderedTiles.length=0;var Y,B,K,Z=Object.keys(O).map(Number);Z.sort(r),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(Y=[],B=[]):Z=Z.reverse();for(var V=Z.length-1;V>=0;--V){var U=Z[V],H=c.getTilePixelSize(U,h,o),q=d.getResolution(U)/_,J=H[0]*q*z,Q=H[1]*q*z,$=d.getTileCoordForCoordAndZ(Ae(T),U),tt=d.getTileCoordExtent($),et=Pi(this.tempTransform,[m*(tt[0]-T[0])/_,m*(T[3]-tt[3])/_]),it=m*c.getGutterForProjection(o),nt=O[U];for(var ot in nt){var rt,st=(A=nt[ot]).tileCoord,at=$[1]-st[1],lt=Math.round(et[0]-(at-1)*J),ht=$[2]-st[2],ut=Math.round(et[1]-(ht-1)*Q),ct=lt-(F=Math.round(et[0]-at*J)),pt=ut-(L=Math.round(et[1]-ht*Q)),ft=g===U,dt=!1;if(!(rt=ft&&1!==A.getAlpha(D(this),t.time)))if(Y){K=[F,L,F+ct,L,F+ct,L+pt,F,L+pt];for(var gt=0,_t=Y.length;gt<_t;++gt)if(g!==U&&Uc&&(this.instructions.push([br.CUSTOM,c,r,t,i,en]),this.hitDetectionInstructions.push([br.CUSTOM,c,r,t,n||i,en]));break;case"Point":o=t.getFlatCoordinates(),this.coordinates.push(o[0],o[1]),r=this.coordinates.length,this.instructions.push([br.CUSTOM,c,r,t,i]),this.hitDetectionInstructions.push([br.CUSTOM,c,r,t,n||i])}this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[br.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[br.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var i,n,o=e.length,r=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[br.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[br.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,o=t.lineDash,r=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||o!=t.currentLineDash&&!h(t.currentLineDash,o)||t.currentLineDashOffset!=r||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=o,t.currentLineDashOffset=r,t.currentLineJoin=s,t.currentLineWidth=a,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[br.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ce(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;ue(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Or),Ir=Pr,Mr=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Fr=function(t){function e(e,i,n,o){var r=t.call(this,e,i,n,o)||this;return r.hitDetectionImage_=null,r.image_=null,r.imagePixelRatio_=void 0,r.anchorX_=void 0,r.anchorY_=void 0,r.height_=void 0,r.opacity_=void 0,r.originX_=void 0,r.originY_=void 0,r.rotateWithView_=void 0,r.rotation_=void 0,r.scale_=void 0,r.width_=void 0,r.declutterMode_=void 0,r.declutterImageWithText_=void 0,r}return Mr(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([br.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([br.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([br.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([br.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),o=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e},e}(Ir),Lr=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ar=function(t){function e(e,i,n,o){return t.call(this,e,i,n,o)||this}return Lr(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var o=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),s=[br.MOVE_TO_LINE_TO,o,r];return this.instructions.push(s),this.hitDetectionInstructions.push(s),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,o=i.lineWidth;if(void 0!==n&&void 0!==o){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ko,0],Er);var r=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(r,0,r.length,s),this.hitDetectionInstructions.push(Sr),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,o=i.lineWidth;if(void 0!==n&&void 0!==o){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Er);for(var r=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),l=0,h=0,u=r.length;ht&&(y>_&&(_=y,d=v,g=r),y=0,v=r-o)),s=a,u=p,c=f),l=m,h=x}return(y+=a)>_?[v,r]:[d,g]}var zr=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wr={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Xr=function(t){function e(e,i,n,o){var r=t.call(this,e,i,n,o)||this;return r.labels_=null,r.text_="",r.textOffsetX_=0,r.textOffsetY_=0,r.textRotateWithView_=void 0,r.textRotation_=0,r.textFillState_=null,r.fillStates={},r.textStrokeState_=null,r.strokeStates={},r.textState_={},r.textStates={},r.textKey_="",r.fillKey_="",r.strokeKey_="",r.declutterImageWithText_=void 0,r}return zr(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,o=this.textState_;if(""!==this.text_&&o&&(i||n)){var r=this.coordinates,s=r.length,a=t.getType(),l=null,h=t.getStride();if("line"!==o.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){var u=o.overflow?null:[];switch(a){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),h=2;break;case"Polygon":l=t.getFlatInteriorPoint(),o.overflow||u.push(l[2]/this.resolution),h=3;break;case"MultiPolygon":var c=t.getFlatInteriorPoints();for(l=[],w=0,S=c.length;wR[2]}else T=x>b;var P,I=Math.PI,M=[],F=w+n===e;if(_=0,y=S,p=t[e=w],f=t[e+1],F){v(),P=Math.atan2(f-g,p-d),T&&(P+=P>0?-I:I);var L=(b+x)/2,A=(O+C)/2;return M[0]=[L,A,(E-r)/2,P,o],M}for(var D=0,k=(o=o.replace(/\n/g," ")).length;D0?-I:I),void 0!==P){var G=j-P;if(G+=G>I?-2*I:G<-I?2*I:0,Math.abs(G)>s)return null}P=j;for(var z=D,W=0;D0&&t.push("\n",""),t.push(e,""),t}var ts=function(){function t(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,i,n){var o=t+e+i+n;if(this.labels_[o])return this.labels_[o];var r=n?this.strokeStates[n]:null,s=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=Array.isArray(t),c=a.justify?Wr[a.justify]:Qr(Array.isArray(t)?t[0]:t,a.textAlign||Uo),p=n&&r.lineWidth?r.lineWidth:0,f=u?t:t.split("\n").reduce($r,[]),d=function(t,e){for(var i=[],n=[],o=[],r=0,s=0,a=0,l=0,h=0,u=e.length;h<=u;h+=2){var c=e[h];if("\n"!==c&&h!==u){var p=e[h+1]||t.font,f=rr(p,c);i.push(f),s+=f;var d=nr(p);n.push(d),l=Math.max(l,d)}else r=Math.max(r,s),o.push(s),s=0,a+=l}return{width:r,height:a,widths:i,heights:n,lineWidths:o}}(a,f),g=d.width,_=d.height,y=d.widths,v=d.heights,m=d.lineWidths,x=g+p,C=[],w=(x+2)*h[0],S=(_+p)*h[1],E={width:w<0?Math.floor(w):Math.ceil(w),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:C};1==h[0]&&1==h[1]||C.push("scale",h),n&&(C.push("strokeStyle",r.strokeStyle),C.push("lineWidth",p),C.push("lineCap",r.lineCap),C.push("lineJoin",r.lineJoin),C.push("miterLimit",r.miterLimit),(V?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D).prototype.setLineDash&&(C.push("setLineDash",[r.lineDash]),C.push("lineDashOffset",r.lineDashOffset))),i&&C.push("fillStyle",s.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");for(var T,b=.5-c,O=c*x+b*p,R=[],P=[],I=0,M=0,F=0,L=0,A=0,D=f.length;At?t-l:o,x=r+h>e?e-h:r,C=f[3]+m*c[0]+f[1],w=f[0]+x*c[1]+f[2],S=y-f[3],E=v-f[0];return(d||0!==u)&&(Zr[0]=S,Hr[0]=S,Zr[1]=E,Vr[1]=E,Vr[0]=S+C,Ur[0]=Vr[0],Ur[1]=E+w,Hr[1]=Ur[1]),0!==u?(Pi(_=Ii([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Zr),Pi(_,Vr),Pi(_,Ur),Pi(_,Hr),ye(Math.min(Zr[0],Vr[0],Ur[0],Hr[0]),Math.min(Zr[1],Vr[1],Ur[1],Hr[1]),Math.max(Zr[0],Vr[0],Ur[0],Hr[0]),Math.max(Zr[1],Vr[1],Ur[1],Hr[1]),Kr)):ye(Math.min(S,S+C),Math.min(E,E+w),Math.max(S,S+C),Math.max(E,E+w),Kr),p&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Kr[0],minY:Kr[1],maxX:Kr[2],maxY:Kr[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,i,n,o,r,s){var a=!(!r&&!s),l=n.declutterBox,h=t.canvas,u=s?s[2]*n.scale[0]/2:0;return l.minX-u<=h.width/e&&l.maxX+u>=0&&l.minY-u<=h.height/e&&l.maxY+u>=0&&(a&&this.replayTextBackground_(t,Zr,Vr,Ur,Hr,r,s),function(t,e,i,n,o,r,s,a,l,h,u){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){for(var i=t.contextInstructions,n=0,o=i.length;nz&&(this.fill_(t),M=0),F>z&&(t.stroke(),F=0),M||F||(t.beginPath(),g=NaN,_=NaN),++R;break;case br.CIRCLE:var X=l[I=W[1]],N=l[I+1],Y=l[I+2]-X,B=l[I+3]-N,K=Math.sqrt(Y*Y+B*B);t.moveTo(X+K,N),t.arc(X,N,K,0,2*Math.PI,!0),++R;break;case br.CLOSE_PATH:t.closePath(),++R;break;case br.CUSTOM:I=W[1],p=W[2];var Z=W[3],V=W[4],U=6==W.length?W[5]:void 0;G.geometry=Z,G.feature=E,R in D||(D[R]=[]);var H=D[R];U?U(l,I,p,2,H):(H[0]=l[I],H[1]=l[I+1],H.length=2),V(H,G),++R;break;case br.DRAW_IMAGE:I=W[1],p=W[2],m=W[3],f=W[4],d=W[5];var q=W[6],J=W[7],Q=W[8],$=W[9],tt=W[10],et=W[11],it=W[12],nt=W[13],ot=W[14],rt=W[15];if(!m&&W.length>=20){x=W[19],C=W[20],w=W[21],S=W[22];var st=this.drawLabelWithPointPlacement_(x,C,w,S);m=st.label,W[3]=m;var at=W[23];f=(st.anchorX-at)*this.pixelRatio,W[4]=f;var lt=W[24];d=(st.anchorY-lt)*this.pixelRatio,W[5]=d,q=m.height,W[6]=q,nt=m.width,W[13]=nt}var ht=void 0;W.length>25&&(ht=W[25]);var ut=void 0,ct=void 0,pt=void 0;W.length>17?(ut=W[16],ct=W[17],pt=W[18]):(ut=qo,ct=!1,pt=!1),tt&&j?et+=k:tt||j||(et-=k);for(var ft=0;Ii)break;var a=n[s];a||(a=[],n[s]=a),a.push(4*((t+o)*e+(t+r))+3),o>0&&a.push(4*((t-o)*e+(t+r))+3),r>0&&(a.push(4*((t+o)*e+(t-r))+3),o>0&&a.push(4*((t-o)*e+(t-r))+3))}for(var l=[],h=(o=0,n.length);o0){if(!s||"Image"!==p&&"Text"!==p||-1!==s.indexOf(t)){var h=(f[r]-3)/4,u=n-h%a,d=n-(h/a|0),g=o(t,e,u*u+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,_,y,v,m,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(r),g=x.length-1;g>=0;--g){var C=x[g].toString();for(y=this.executorsByZIndex_[C],_=is.length-1;_>=0;--_)if(void 0!==(v=y[p=is[_]])&&(m=v.executeHitDetection(c,l,i,d,u)))return m}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],o=e[2],r=e[3],s=[i,n,i,r,o,r,o,n];return Li(s,0,8,2,t,s),s},t.prototype.isEmpty=function(){return _(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,o,s,a){var l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(r),this.maxExtent_&&(t.save(),this.clip(t,i));var h,u,c,p,f,d,g=s||is;for(a&&l.reverse(),h=0,u=l.length;hthis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=gs(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var o=gs(t,e,i);this.cache_[o]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),ys=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),vs=null,ms=function(t){function e(e,i,n,o,r,s){var a=t.call(this)||this;return a.hitDetectionImage_=null,a.image_=e||new Image,null!==o&&(a.image_.crossOrigin=o),a.canvas_={},a.color_=s,a.unlisten_=null,a.imageState_=r,a.size_=n,a.src_=i,a.tainted_,a}return ys(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&2===this.imageState_){vs||(vs=q(1,1)),vs.drawImage(this.image_,0,0);try{vs.getImageData(0,0,1,1),this.tainted_=!1}catch(t){vs=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(x)},e.prototype.handleImageError_=function(){this.imageState_=3,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=2,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],i=q(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(0==this.imageState_){this.imageState_=1;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=_o(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]&&2===this.imageState_){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var i=e.getContext("2d");if(i.scale(t,t),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply","multiply"===i.globalCompositeOperation||this.isTainted_())i.fillStyle=to(this.color_),i.fillRect(0,0,e.width/t,e.height/t),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var n=i.getImageData(0,0,e.width,e.height),o=n.data,r=this.color_[0]/255,s=this.color_[1]/255,a=this.color_[2]/255,l=this.color_[3],h=0,u=o.length;h0,6);var u=void 0!==n.src?0:2;return i.color_=void 0!==n.color?io(n.color):null,i.iconImage_=function(t,e,i,n,o,r){var s=_s.get(e,n,r);return s||(s=new ms(t,e,i,n,o,r),_s.set(e,n,r,s)),s}(l,h,void 0!==i.imgSize_?i.imgSize_:null,i.crossOrigin_,u,i.color_),i.offset_=void 0!==n.offset?n.offset:[0,0],i.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:fs,i.origin_=null,i.size_=void 0!==n.size?n.size:null,i}return xs(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})},e.prototype.getAnchor=function(){var t=this.normalizedAnchor_;if(!t){t=this.anchor_;var e=this.getSize();if(this.anchorXUnits_==hs||this.anchorYUnits_==hs){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==hs&&(t[0]*=e[0]),this.anchorYUnits_==hs&&(t[1]*=e[1])}if(this.anchorOrigin_!=fs){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=ds&&this.anchorOrigin_!=ps||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=cs&&this.anchorOrigin_!=ps||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}var i=this.getDisplacement();return[t[0]-i[0],t[1]+i[1]]},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=fs){var e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),this.offsetOrigin_!=ds&&this.offsetOrigin_!=ps||(t[0]=i[0]-e[0]-t[0]),this.offsetOrigin_!=cs&&this.offsetOrigin_!=ps||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(x,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(x,t)},e}(Wo),ws=.5,Ss={Point:function(t,e,i,n,o){var r,s=i.getImage(),a=i.getText();if(s){if(2!=s.getImageState())return;var l=t;if(o){var h=s.getDeclutterMode();if("none"!==h)if(l=o,"obstacle"===h){var u=t.getBuilder(i.getZIndex(),"Image");u.setImageStyle(s,r),u.drawPoint(e,n)}else a&&a.getText()&&(r={})}var c=l.getBuilder(i.getZIndex(),"Image");c.setImageStyle(s,r),c.drawPoint(e,n)}if(a&&a.getText()){var p=t;o&&(p=o);var f=p.getBuilder(i.getZIndex(),"Text");f.setTextStyle(a,r),f.drawText(e,n)}},LineString:function(t,e,i,n,o){var r=i.getStroke();if(r){var s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(o||t).getBuilder(i.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n)}},Polygon:function(t,e,i,n,o){var r=i.getFill(),s=i.getStroke();if(r||s){var a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,s),a.drawPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(o||t).getBuilder(i.getZIndex(),"Text");h.setTextStyle(l),h.drawText(e,n)}},MultiPoint:function(t,e,i,n,o){var r,s=i.getImage(),a=i.getText();if(s){if(2!=s.getImageState())return;var l=t;if(o){var h=s.getDeclutterMode();if("none"!==h)if(l=o,"obstacle"===h){var u=t.getBuilder(i.getZIndex(),"Image");u.setImageStyle(s,r),u.drawMultiPoint(e,n)}else a&&a.getText()&&(r={})}var c=l.getBuilder(i.getZIndex(),"Image");c.setImageStyle(s,r),c.drawMultiPoint(e,n)}if(a&&a.getText()){var p=t;o&&(p=o);var f=p.getBuilder(i.getZIndex(),"Text");f.setTextStyle(a,r),f.drawText(e,n)}},MultiLineString:function(t,e,i,n,o){var r=i.getStroke();if(r){var s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawMultiLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(o||t).getBuilder(i.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n)}},MultiPolygon:function(t,e,i,n,o){var r=i.getFill(),s=i.getStroke();if(s||r){var a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,s),a.drawMultiPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(o||t).getBuilder(i.getZIndex(),"Text");h.setTextStyle(l),h.drawText(e,n)}},GeometryCollection:function(t,e,i,n,o){var r,s,a=e.getGeometriesArray();for(r=0,s=a.length;rd[2];)v=_*++y,u.push(this.getRenderTransform(n,o,s,ws,c,p,v).slice()),g-=_}this.hitDetectionImageData_=function(t,e,i,n,o,s,a){var l=q(t[0]*ws,t[1]*ws);l.imageSmoothingEnabled=!1;for(var h=l.canvas,u=new ls(l,ws,o,null,a),c=i.length,p=Math.floor(16777215/c),f={},d=1;d<=c;++d){var g=i[d-1],_=g.getStyleFunction()||n;if(n){var y=_(g,s);if(y){Array.isArray(y)||(y=[y]);for(var v="#"+("000000"+(d*p).toString(16)).slice(-6),m=0,x=y.length;mx[0]&&S[2]>x[2]&&m.push([S[0]-C,S[1],S[2]-C,S[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==f&&this.renderedRenderOrder_==g&&de(this.wrappedRenderedExtent_,y))return h(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;var E,T=new Yr(Ts(c,p),y,c,p);this.getLayer().getDeclutter()&&(E=new Yr(Ts(c,p),y,c,p));var b,O=li();if(O){for(var R=0,P=m.length;R0&&this.getCount()>this.highWaterMark},t.prototype.expireCache=function(t){for(;this.canExpireCache();)this.pop()},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return xt(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return xt(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.peek=function(t){if(this.containsKey(t))return this.entries_[t].value_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){xt(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function As(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Ds(t,e,i){return t+"/"+e+"/"+i}function ks(t){return Ds(t[0],t[1],t[2])}var js=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Gs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return js(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=this.peekFirstKey().split("/").map(Number)[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(ks(e.tileCoord)),e.release())}.bind(this))}},e}(Ls),zs=Gs,Ws=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Xs(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Ns=function(t){function e(e){var i=t.call(this)||this;i.projection=He(e.projection),i.attributions_=Xs(e.attributions),i.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,i.loading=!1,i.state_=void 0!==e.state?e.state:"ready",i.wrapX_=void 0!==e.wrapX&&e.wrapX,i.interpolate_=!!e.interpolate,i.viewResolver=null,i.viewRejector=null;var n=i;return i.viewPromise_=new Promise((function(t,e){n.viewResolver=t,n.viewRejector=e})),i}return Ws(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection},e.prototype.getResolutions=function(){return L()},e.prototype.getView=function(){return this.viewPromise_},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.getInterpolate=function(){return this.interpolate_},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=Xs(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(G),Ys=[0,0,0],Bs=function(){function t(t){var e,i,n;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,xt((e=this.resolutions_,!0,i=function(t,e){return e-t}||r,e.every((function(t,n){if(0===n)return!0;var o=i(e[n-1],t);return!(o>0||0===o)}))),17),!t.origins)for(var o=0,s=this.resolutions_.length-1;o=this.minZoom;){if(e(a,2===this.zoomFactor_?Io(o=Math.floor(o/2),o,r=Math.floor(r/2),r,i):this.getTileRangeForExtentAndZ(s,a,i)))return!0;--a}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/a[0],r/a[1]),h=o+1,u=new Array(h),c=0;ci||i>e.getMaxZoom())return!1;var r=e.getFullTileRange(i);return!r||r.containsXY(n,o)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},e.prototype.useTile=function(t,e,i,n){},e}(Ns),qs=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return Us(e,t),e}(t),Js=Hs;function Qs(t,e){var i=/\{z\}/g,n=/\{x\}/g,o=/\{y\}/g,r=/\{-y\}/g;return function(s,a,l){return s?t.replace(i,s[0].toString()).replace(n,s[1].toString()).replace(o,s[2].toString()).replace(r,(function(){var t=s[0],i=e.getFullTileRange(t);return xt(i,55),(i.getHeight()-s[2]-1).toString()})):void 0}}var $s=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ta=function(t){function e(i){var n=t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,opaque:i.opaque,projection:i.projection,state:i.state,tileGrid:i.tileGrid,tilePixelRatio:i.tilePixelRatio,wrapX:i.wrapX,transition:i.transition,interpolate:i.interpolate,key:i.key,attributionsCollapsible:i.attributionsCollapsible,zDirection:i.zDirection})||this;return n.generateTileUrlFunction_=n.tileUrlFunction===e.prototype.tileUrlFunction,n.tileLoadFunction=i.tileLoadFunction,i.tileUrlFunction&&(n.tileUrlFunction=i.tileUrlFunction),n.urls=null,i.urls?n.setUrls(i.urls):i.url&&n.setUrl(i.url),n.tileLoadingKeys_={},n}return $s(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,i=t.target,n=D(i),o=i.getState();1==o?(this.tileLoadingKeys_[n]=!0,e="tileloadstart"):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=3==o?"tileloaderror":2==o?"tileloadend":void 0),null!=e&&this.dispatchEvent(new qs(e,i))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=function(t){var e=[],i=/\{([a-z])-([a-z])\}/.exec(t);if(i){var n=i[1].charCodeAt(0),o=i[2].charCodeAt(0),r=void 0;for(r=n;r<=o;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t)){for(var s=parseInt(i[2],10),a=parseInt(i[1],10);a<=s;a++)e.push(t.replace(i[0],a.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){for(var i=t.length,n=new Array(i),o=0;oOpenStreetMap contributors.'];var r=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",s=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:i,attributionsCollapsible:!1,cacheSize:n.cacheSize,crossOrigin:r,interpolate:o,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,opaque:void 0===n.opaque||n.opaque,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,transition:n.transition,url:s,wrapX:n.wrapX,zDirection:n.zDirection})||this}return aa(e,t),e}(sa),ha="add",ua="remove",ca=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),pa="length",fa=function(t){function e(e,i,n){var o=t.call(this,e)||this;return o.element=i,o.index=n,o}return ca(e,t),e}(t),da=function(t){function e(e,i){var n=t.call(this)||this;n.on,n.once,n.un;var o=i||{};if(n.unique_=!!o.unique,n.array_=e||[],n.unique_)for(var r=0,s=n.array_.length;r0;)this.pop()},e.prototype.extend=function(t){for(var e=0,i=t.length;e=200&&a.status<300){var n=e.getType(),l=void 0;"json"==n||"text"==n?l=a.responseText:"xml"==n?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):"arraybuffer"==n&&(l=a.response),l?r(e.readFeatures(l,{extent:i,featureProjection:o}),e.readProjection(l)):s()}else s()},a.onerror=s,a.send()}(t,e,i,n,o,(function(t,e){a.addFeatures(t),void 0!==r&&r(t)}),s||p)}}var xa=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ca=function(t){function e(e,i,n){var o=t.call(this,e)||this;return o.feature=i,o.features=n,o}return xa(e,t),e}(t),wa=function(t){function i(e){var i=this,n=e||{};(i=t.call(this,{attributions:n.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===n.wrapX||n.wrapX})||this).on,i.once,i.un,i.loader_=p,i.format_=n.format,i.overlaps_=void 0===n.overlaps||n.overlaps,i.url_=n.url,void 0!==n.loader?i.loader_=n.loader:void 0!==i.url_&&(xt(i.format_,7),i.loader_=ma(i.url_,i.format_)),i.strategy_=void 0!==n.strategy?n.strategy:va;var o,r,s=void 0===n.useSpatialIndex||n.useSpatialIndex;return i.featuresRtree_=s?new ga:null,i.loadedExtentsRtree_=new ga,i.loadingExtentsCount_=0,i.nullGeometryFeatures_={},i.idIndex_={},i.uidIndex_={},i.featureChangeKeys_={},i.featuresCollection_=null,Array.isArray(n.features)?r=n.features:n.features&&(r=(o=n.features).getArray()),s||void 0!==o||(o=new da(r)),void 0!==r&&i.addFeaturesInternal(r),void 0!==o&&i.bindFeaturesCollection_(o),i}return xa(i,t),i.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},i.prototype.addFeatureInternal=function(t){var e=D(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ca(_a,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},i.prototype.setupChangeEvents_=function(t,i){this.featureChangeKeys_[t]=[O(i,x,this.handleFeatureChange_,this),O(i,e,this.handleFeatureChange_,this)]},i.prototype.addToIndex_=function(t,e){var i=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(xt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i},i.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},i.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],n=[],o=0,r=t.length;on)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}(t,e);return[].concat.apply([],n.map((function(t){return i.featuresRtree_.getInExtent(t)})))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},i.prototype.getClosestFeatureToCoordinate=function(t,e){var i=t[0],n=t[1],o=null,r=[NaN,NaN],s=1/0,a=[-1/0,-1/0,1/0,1/0],l=e||u;return this.featuresRtree_.forEachInExtent(a,(function(t){if(l(t)){var e=t.getGeometry(),h=s;if((s=e.closestPointXY(i,n,r,s))0},i.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),t.prototype.refresh.call(this)},i.prototype.removeLoadedExtent=function(t){var e,i=this.loadedExtentsRtree_;i.forEachInExtent(t,(function(i){if(xe(i.extent,t))return e=i,!0})),e&&i.remove(e)},i.prototype.removeFeature=function(t){if(t){var e=D(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}},i.prototype.removeFeatureInternal=function(t){var e=D(t),i=this.featureChangeKeys_[e];if(i){i.forEach(P),delete this.featureChangeKeys_[e];var n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Ca(ya,t)),t}},i.prototype.removeFromIdIndex_=function(t){var e=!1;for(var i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e},i.prototype.setLoader=function(t){this.loader_=t},i.prototype.setUrl=function(t){xt(this.format_,7),this.url_=t,this.setLoader(ma(t,this.format_))},i}(Ns),Sa=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Lo(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new cr({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getJustify=function(){return this.justify_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Lo(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setJustify=function(t){this.justify_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}(),Ea=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ta=function(t){function e(e){var i=t.call(this)||this;if(i.on,i.once,i.un,i.id_=void 0,i.geometryName_="geometry",i.style_=null,i.styleFunction_=void 0,i.geometryChangeKey_=null,i.addChangeListener(i.geometryName_,i.handleGeometryChanged_),e)if("function"==typeof e.getSimplifiedGeometry){var n=e;i.setGeometry(n)}else{var o=e;i.setProperties(o)}return i}return Ea(e,t),e.prototype.clone=function(){var t=new e(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());var i=this.getGeometry();i&&t.setGeometry(i.clone());var n=this.getStyle();return n&&t.setStyle(n),t},e.prototype.getGeometry=function(){return this.get(this.geometryName_)},e.prototype.getId=function(){return this.id_},e.prototype.getGeometryName=function(){return this.geometryName_},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.handleGeometryChange_=function(){this.changed()},e.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(P(this.geometryChangeKey_),this.geometryChangeKey_=null);var t=this.getGeometry();t&&(this.geometryChangeKey_=O(t,x,this.handleGeometryChange_,this)),this.changed()},e.prototype.setGeometry=function(t){this.set(this.geometryName_,t)},e.prototype.setStyle=function(t){var e,i;this.style_=t,this.styleFunction_=t?"function"==typeof(e=t)?e:(Array.isArray(e)?i=e:(xt("function"==typeof e.getZIndex,41),i=[e]),function(){return i}):void 0,this.changed()},e.prototype.setId=function(t){this.id_=t,this.changed()},e.prototype.setGeometryName=function(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},e}(G),ba=Ta,Oa=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ra=function(t){function e(e){var i=t.call(this)||this;return i.map_=e,i}return Oa(e,t),e.prototype.dispatchRenderEvent=function(t,e){L()},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Ii(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Mi(n,i)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,n,o,r,s,a){var l,h=e.viewState;function u(t,e,i,n){return o.call(r,e,t?i:null,n)}var c=h.projection,p=Ne(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){var d=ke(c.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,_=g.length,y=[],v=[],m=0;m=0;--x){var C=g[x],w=C.layer;if(w.hasRenderer()&&jt(C,h)&&s.call(a,w)){var S=w.getRenderer(),E=w.getSource();if(S&&E){var T=E.getWrapX()?p:t,b=u.bind(null,C.managed);v[0]=T[0]+f[m][0],v[1]=T[1]+f[m][1],l=S.forEachFeatureAtCoordinate(v,e,i,b,y)}if(l)return l}}if(0!==y.length){var O=1/y.length;return y.forEach((function(t,e){return t.distanceSq+=e*O})),y.sort((function(t,e){return t.distanceSq-e.distanceSq})),y.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},e.prototype.forEachLayerAtPixel=function(t,e,i,n,o){return L()},e.prototype.hasFeatureAtCoordinate=function(t,e,i,n,o,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,u,this,o,r)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){L()},e.prototype.scheduleExpireIconCache=function(t){_s.canExpireCache()&&t.postRenderFunctions.push(Pa)},e}(o);function Pa(t,e){_s.expire()}var Ia=Ra,Ma=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Fa=function(t){function i(i){var n=t.call(this,i)||this;n.fontChangeListenerKey_=O(Jo,e,i.redrawText.bind(i)),n.element_=document.createElement("div");var o=n.element_.style;o.position="absolute",o.width="100%",o.height="100%",o.zIndex="0",n.element_.className=nt+" ol-layers";var r=i.getViewport();return r.insertBefore(n.element_,r.firstChild||null),n.children_=[],n.renderedVisible_=!0,n}return Ma(i,t),i.prototype.dispatchRenderEvent=function(t,e){var i=this.getMap();if(i.hasListener(t)){var n=new Jn(t,void 0,e);i.dispatchEvent(n)}},i.prototype.disposeInternal=function(){P(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},i.prototype.renderFrame=function(t){if(t){this.calculateMatrices2D(t),this.dispatchRenderEvent(At,t);var e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;for(var n=[],o=null,r=0,s=e.length;r=0;--r)n[r].renderDeclutter(t);!function(t,e){for(var i=t.childNodes,n=0;;++n){var o=i[n],r=e[n];if(!o&&!r)break;o!==r&&(o?r?t.insertBefore(r,o):(t.removeChild(o),--n):t.appendChild(r))}}(this.element_,this.children_),this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},i.prototype.forEachLayerAtPixel=function(t,e,i,n,o){for(var r=e.viewState,s=e.layerStatesArray,a=s.length-1;a>=0;--a){var l=s[a],h=l.layer;if(h.hasRenderer()&&jt(l,r)&&o(h)){var u=h.getRenderer().getDataAtPixel(t,e,i);if(u){var c=n(h,u);if(c)return c}}}},i}(Ia),La=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Aa=function(t){function e(e,i){var n=t.call(this,e)||this;return n.layer=i,n}return La(e,t),e}(t),Da="layers",ka=function(t){function i(e){var i=this,n=e||{},o=f({},n);delete o.layers;var r=n.layers;return(i=t.call(this,o)||this).on,i.once,i.un,i.layersListenerKeys_=[],i.listenerKeys_={},i.addChangeListener(Da,i.handleLayersChanged_),r?Array.isArray(r)?r=new da(r.slice(),{unique:!0}):xt("function"==typeof r.getArray,43):r=new da(void 0,{unique:!0}),i.setLayers(r),i}return La(i,t),i.prototype.handleLayerChange_=function(){this.changed()},i.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(P),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(O(t,ha,this.handleLayersAdd_,this),O(t,ua,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(P);d(this.listenerKeys_);for(var i=t.getArray(),n=0,o=i.length;nthis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(P(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(T,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(P(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(P),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(m),Ba="layergroup",Ka="size",Za="target",Va="view",Ua=1/0,Ha=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,d(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(i);return delete this.queuedElements_[n],i},t.prototype.enqueue=function(t){xt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=Ua&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,n=e.length,o=e[t],r=i[t],s=t;t>1;){var a=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),h=lt;){var s=this.getParentIndex_(e);if(!(n[s]>r))break;i[e]=i[s],n[e]=n[s],e=s}i[e]=o,n[e]=r},t.prototype.reprioritize=function(){var t,e,i,n=this.priorityFunction_,o=this.elements_,r=this.priorities_,s=0,a=o.length;for(e=0;e0;)n=(i=this.dequeue()[0]).getKey(),0!==i.getState()||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++o,i.load())},e}(Ha),Qa={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function $a(t,e,i){return function(n,o,r,s,a){if(n){if(!o&&!e)return n;var l=e?0:r[0]*o,h=e?0:r[1]*o,u=a?a[0]:0,c=a?a[1]:0,p=t[0]+l/2+u,f=t[2]-l/2+u,d=t[1]+h/2+c,g=t[3]-h/2+c;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var _=Ct(n[0],p,f),y=Ct(n[1],d,g);if(s&&i&&o){var v=30*o;_+=-v*Math.log(1+Math.max(0,p-n[0])/v)+v*Math.log(1+Math.max(0,n[0]-f)/v),y+=-v*Math.log(1+Math.max(0,d-n[1])/v)+v*Math.log(1+Math.max(0,n[1]-g)/v)}return[_,y]}}}function tl(t){return t}function el(t,e,i,n){var o=ke(e)/i[0],r=Fe(e)/i[1];return n?Math.min(t,Math.max(o,r)):Math.min(t,Math.min(o,r))}function il(t,e,i){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Ct(n,i/2,2*e)}function nl(t,e,i,n,o){return function(r,s,a,l){if(void 0!==r){var h=n?el(t,n,a,o):t;return(void 0===i||i)&&l?il(r,h,e):Ct(r,e,h)}}}function ol(t){return void 0!==t?0:void 0}function rl(t){return void 0!==t?t:void 0}var sl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),al=function(t){function e(e){var i=t.call(this)||this;i.on,i.once,i.un;var n=f({},e);return i.hints_=[0,0],i.animations_=[],i.updateAnimationKey_,i.projection_=Qe(n.projection,"EPSG:3857"),i.viewportSize_=[100,100],i.targetCenter_=null,i.targetResolution_,i.targetRotation_,i.nextCenter_=null,i.nextResolution_,i.nextRotation_,i.cancelAnchor_=void 0,n.projection&&Ke(),n.center&&(n.center=ui(n.center,i.projection_)),n.extent&&(n.extent=pi(n.extent,i.projection_)),i.applyOptions_(n),i}return sl(e,t),e.prototype.applyOptions_=function(t){var e=f({},t);for(var i in Qa)delete e[i];this.setProperties(e,!0);var n=function(t){var e,i,n,o=void 0!==t.minZoom?t.minZoom:0,r=void 0!==t.maxZoom?t.maxZoom:28,a=void 0!==t.zoomFactor?t.zoomFactor:2,l=void 0!==t.multiWorld&&t.multiWorld,h=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,c=Qe(t.projection,"EPSG:3857"),p=c.getExtent(),f=t.constrainOnlyCenter,d=t.extent;if(l||d||!c.isGlobal()||(f=!1,d=p),void 0!==t.resolutions){var g=t.resolutions;i=g[o],n=void 0!==g[r]?g[r]:g[g.length-1],e=t.constrainResolution?function(t,e,i,n){return function(o,r,a,l){if(void 0!==o){var h=t[0],u=t[t.length-1],c=i?el(h,i,a,n):h;if(l)return void 0===e||e?il(o,c,u):Ct(o,u,c);var p=Math.min(c,o),f=Math.floor(s(t,p,r));return t[f]>c&&f1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);for(var n=0;n0},e.prototype.getInteracting=function(){return this.hints_[1]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(0,-this.hints_[0]);for(var e=0,i=this.animations_.length;e=0;--i){for(var n=this.animations_[i],o=!0,r=0,s=n.length;r0?l/a.duration:1;h>=1?(a.complete=!0,h=1):o=!1;var u=a.easing(h);if(a.sourceCenter){var c=a.sourceCenter[0],p=a.sourceCenter[1],f=a.targetCenter[0],d=a.targetCenter[1];this.nextCenter_=a.targetCenter;var g=c+u*(f-c),_=p+u*(d-p);this.targetCenter_=[g,_]}if(a.sourceResolution&&a.targetResolution){var y=1===u?a.targetResolution:a.sourceResolution+u*(a.targetResolution-a.sourceResolution);if(a.anchor){var v=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(y,0,v,!0);this.targetCenter_=this.calculateCenterZoom(m,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=y,this.applyTargetState_(!0)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var x=1===u?Ot(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+u*(a.targetRotation-a.sourceRotation);if(a.anchor){var C=this.constraints_.rotation(x,!0);this.targetCenter_=this.calculateCenterRotate(C,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=x}if(this.applyTargetState_(!0),e=!0,!a.complete)break}}if(o){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;var w=n[0].callback;w&&ll(w,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var i,n,o,r=this.getCenterInternal();return void 0!==r&&(Xe(i=[r[0]-e[0],r[1]-e[1]],t-this.getRotation()),o=e,(n=i)[0]+=+o[0],n[1]+=+o[1]),i},e.prototype.calculateCenterZoom=function(t,e){var i,n=this.getCenterInternal(),o=this.getResolution();return void 0!==n&&void 0!==o&&(i=[e[0]-t*(e[0]-n[0])/o,e[1]-t*(e[1]-n[1])/o]),i},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?hi(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Qa.CENTER)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.get("constrainResolution")},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return ci(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSizeMinusPadding_(),i=this.getCenterInternal();xt(i,1);var n=this.getResolution();xt(void 0!==n,2);var o=this.getRotation();return xt(void 0!==o,3),Ie(i,n,o,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(Qa.RESOLUTION)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(pi(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var i=e||this.getViewportSizeMinusPadding_(),n=ke(t)/i[0],o=Fe(t)/i[1];return Math.max(n,o)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,o=Math.log(i/n)/Math.log(e);return function(t){return i/Math.pow(e,t*o)}},e.prototype.getRotation=function(){return this.get(Qa.ROTATION)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,o=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/o}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),i=this.getRotation(),n=this.getCenterInternal(),o=this.padding_;if(o){var r=this.getViewportSizeMinusPadding_();n=ul(n,this.getViewportSize_(),[r[0]/2+o[3],r[1]/2+o[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,n=this.minZoom_||0;if(this.resolutions_){var o=s(this.resolutions_,t,1);n=o,e=this.resolutions_[o],i=o==this.resolutions_.length-1?2:e/this.resolutions_[o+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ct(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ct(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var i;if(xt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))xt(!Ge(t),25),i=Wn(n=pi(t,this.getProjection()));else if("Circle"===t.getType()){var n;(i=Wn(n=pi(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),Re(n))}else{var o=li();i=o?t.clone().transform(o,this.getProjection()):t}this.fitInternal(i,e)},e.prototype.rotatedExtentForGeometry=function(t){for(var e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),o=t.getFlatCoordinates(),r=t.getStride(),s=1/0,a=1/0,l=-1/0,h=-1/0,u=0,c=o.length;u=0;a--){var l=s[a];if(l.getMap()===this&&l.getActive()&&this.getTargetElement()&&(!l.handleEvent(t)||t.propagationStopped))break}}},i.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,n=i;if(t){var o=t.viewHints;if(o[0]||o[1]){var r=Date.now()-t.time>8;i=r?0:8,n=r?0:2}}e.getTilesLoading()0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:xi}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var i=e.viewState.rotation;if(i!=this.rotation_){var n="rotate("+i+"rad)";if(this.autoHide_){var o=this.element.classList.contains(it);o||0!==i?o&&0!==i&&this.element.classList.remove(it):this.element.classList.add(it)}this.label_.style.transform=n}this.rotation_=i}},e}(et),vl=yl,ml="active",xl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Cl(t,e,i,n){var o=t.getZoom();if(void 0!==o){var r=t.getConstrainedZoom(o+e),s=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:s,anchor:i,duration:void 0!==n?n:250,easing:xi})}}var wl=function(t){function e(e){var i=t.call(this)||this;return i.on,i.once,i.un,e&&e.handleEvent&&(i.handleEvent=e.handleEvent),i.map_=null,i.setActive(!0),i}return xl(e,t),e.prototype.getActive=function(){return this.get(ml)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(ml,t)},e.prototype.setMap=function(t){this.map_=t},e}(G),Sl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),El=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:250,i}return Sl(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Xa.DBLCLICK){var i=t.originalEvent,n=t.map,o=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;Cl(n.getView(),r,o,this.duration_),i.preventDefault(),e=!0}return!e},e}(wl),Tl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function bl(t){for(var e=t.length,i=0,n=0,o=0;o0}}else if(t.type==Xa.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Xa.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){t.activePointers&&(this.targetPointers=t.activePointers)},e}(wl);function Rl(t){var e=arguments;return function(t){for(var i=!0,n=0,o=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(Ol),Wl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Xl=function(t){function e(e){var i=this,n=e||{};return(i=t.call(this,{stopDown:c})||this).condition_=n.condition?n.condition:Pl,i.lastAngle_=void 0,i.duration_=void 0!==n.duration?n.duration:250,i}return Wl(e,t),e.prototype.handleDragEvent=function(t){if(kl(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==ol){var n=e.getSize(),o=t.pixel,r=Math.atan2(n[1]/2-o[1],o[0]-n[0]/2);if(void 0!==this.lastAngle_){var s=r-this.lastAngle_;i.adjustRotationInternal(-s)}this.lastAngle_=r}}},e.prototype.handleUpEvent=function(t){return!kl(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!(!kl(t)||!Fl(t)||!this.condition_(t)||(t.map.getView().beginInteraction(),this.lastAngle_=void 0,0))},e}(Ol),Nl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Yl=function(t){function e(e){var i=t.call(this)||this;return i.geometry_=null,i.element_=document.createElement("div"),i.element_.style.position="absolute",i.element_.style.pointerEvents="auto",i.element_.className="ol-box "+e,i.map_=null,i.startPixel_=null,i.endPixel_=null,i}return Nl(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new zn([i])},e.prototype.getGeometry=function(){return this.geometry_},e}(o),Bl=Yl,Kl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Zl=function(t){function e(e,i,n){var o=t.call(this,e)||this;return o.coordinate=i,o.mapBrowserEvent=n,o}return Kl(e,t),e}(t),Vl=function(t){function e(e){var i=t.call(this)||this;i.on,i.once,i.un;var n=e||{};return i.box_=new Bl(n.className||"ol-dragbox"),i.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(i.onBoxEnd=n.onBoxEnd),i.startPixel_=null,i.condition_=n.condition?n.condition:Fl,i.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:i.defaultBoxEndCondition,i}return Kl(e,t),e.prototype.defaultBoxEndCondition=function(t,e,i){var n=i[0]-e[0],o=i[1]-e[1];return n*n+o*o>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Zl("boxdrag",t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Zl(e?"boxend":"boxcancel",t.coordinate,t)),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Zl("boxstart",t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(Ol),Ul=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Hl=function(t){function e(e){var i=this,n=e||{},o=n.condition?n.condition:Al;return(i=t.call(this,{condition:o,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,i.out_=void 0!==n.out&&n.out,i}return Ul(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap().getView(),i=this.getGeometry();if(this.out_){var n=e.rotatedExtentForGeometry(i),o=e.getResolutionForExtentInternal(n),r=e.getResolution()/o;(i=i.clone()).scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:xi})},e}(Vl),ql=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Jl=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.defaultCondition_=function(t){return Ll(t)&&Dl(t)},i.condition_=void 0!==n.condition?n.condition:i.defaultCondition_,i.duration_=void 0!==n.duration?n.duration:100,i.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,i}return ql(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==S){var i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(40==n||37==n||39==n||38==n)){var o=t.map.getView(),r=o.getResolution()*this.pixelDelta_,s=0,a=0;40==n?a=-r:37==n?s=-r:39==n?s=r:a=r;var l=[s,a];Xe(l,o.getRotation()),function(t,e,i){var n=t.getCenterInternal();if(n){var o=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:wi,center:t.getConstrainedCenter(o)})}}(o,l,this.duration_),i.preventDefault(),e=!0}}return!e},e}(wl),Ql=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$l=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.condition_=n.condition?n.condition:Dl,i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:100,i}return Ql(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==S||t.type==E){var i=t.originalEvent,n=i.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var o=t.map,r=n=="+".charCodeAt(0)?this.delta_:-this.delta_;Cl(o.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e},e}(wl),th=function(){function t(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;var n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;var o=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,o),this.initialVelocity_=Math.sqrt(o*o+r*r)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),eh=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ih="trackpad",nh=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,n)||this).totalDelta_=0,i.lastDelta_=0,i.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,i.duration_=void 0!==n.duration?n.duration:250,i.timeout_=void 0!==n.timeout?n.timeout:80,i.useAnchor_=void 0===n.useAnchor||n.useAnchor,i.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var o=n.condition?n.condition:Ml;return i.condition_=n.onFocusOnly?Rl(Il,o):o,i.lastAnchor_=null,i.startTime_=void 0,i.timeoutId_,i.mode_=void 0,i.trackpadEventGap_=400,i.trackpadTimeoutId_,i.deltaPerZoom_=300,i}return eh(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0;var t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==b)return!0;var e,i=t.map,n=t.originalEvent;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==b&&(e=n.deltaY,Y&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Z),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?ih:"wheel");var r=i.getView();if(this.mode_===ih&&!r.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=e;var s=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),s),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var i=-Ct(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Cl(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(wl),oh=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),rh=function(t){function e(e){var i=this,n=e||{},o=n;return o.stopDown||(o.stopDown=c),(i=t.call(this,o)||this).anchor_=null,i.lastAngle_=void 0,i.rotating_=!1,i.rotationDelta_=0,i.threshold_=void 0!==n.threshold?n.threshold:.3,i.duration_=void 0!==n.duration?n.duration:250,i}return oh(e,t),e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],n=this.targetPointers[1],o=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){var r=o-this.lastAngle_;this.rotationDelta_+=r,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=r}this.lastAngle_=o;var s=t.map,a=s.getView();if(a.getConstraints().rotation!==ol){var l=s.getViewport().getBoundingClientRect(),h=bl(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=s.getCoordinateFromPixelInternal(h),this.rotating_&&(s.render(),a.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2&&(t.map.getView().endInteraction(this.duration_),1))},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(Ol),sh=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ah=function(t){function e(e){var i=this,n=e||{},o=n;return o.stopDown||(o.stopDown=c),(i=t.call(this,o)||this).anchor_=null,i.duration_=void 0!==n.duration?n.duration:400,i.lastDistance_=void 0,i.lastScaleDelta_=1,i}return sh(e,t),e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],n=this.targetPointers[1],o=i.clientX-n.clientX,r=i.clientY-n.clientY,s=Math.sqrt(o*o+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/s),this.lastDistance_=s;var a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e);var h=a.getViewport().getBoundingClientRect(),u=bl(this.targetPointers);u[0]-=h.left,u[1]-=h.top,this.anchor_=a.getCoordinateFromPixelInternal(u),a.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(Ol),lh=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),hh=function(t){function e(e){return(e=f({},e)).controls||(e.controls=function(t){var e={},i=new da;return(void 0===e.zoom||e.zoom)&&i.push(new Ti(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&i.push(new vl(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&i.push(new Wt(e.attributionOptions)),i}()),e.interactions||(e.interactions=function(t){var e={onFocusOnly:!0}||{},i=new da,n=new th(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&i.push(new Xl),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&i.push(new El({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&i.push(new zl({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&i.push(new rh),(void 0===e.pinchZoom||e.pinchZoom)&&i.push(new ah({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(i.push(new Jl),i.push(new $l({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&i.push(new nh({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&i.push(new Hl({duration:e.zoomDuration})),i}()),t.call(this,e)||this}return lh(e,t),e.prototype.createRenderer=function(){return new Fa(this)},e}(gl),uh={control:{Attribution:Wt,MousePosition:vi,Zoom:Ti},coordinate:{createStringXY:function(t){return function(e){return function(t,e){return function(t,e,i){return t?"{x}, {y}".replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}(t,0,e)}(e,t)}}},extent:{boundingExtent:he},geom:{LineString:_n,LinearRing:Cn,MultiLineString:En,MultiPoint:In,MultiPolygon:Yn,Point:On,Polygon:zn},layer:{Tile:Go,Vector:Fs},proj:{fromLonLat:function(t,e){return Ke(),ii(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")},get:He,transformExtent:ni},source:{OSM:la,Vector:wa},style:{Circle:ur,Fill:cr,Stroke:pr,Style:yr,Text:Sa},Feature:ba,Map:hh,View:cl}}(),n.default}()})); +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["ol"] = factory(); + else + root["ol"] = factory(); +})(self, function() { +return /******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 582: +/***/ (function(module) { + +!function(t,i){ true?module.exports=i():0}(this,function(){"use strict";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r}); + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +!function() { +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": function() { return /* binding */ src_ol; } +}); + +;// CONCATENATED MODULE: ./node_modules/ol/events/Event.js +/** + * @module ol/events/Event + */ +/** + * @classdesc + * Stripped down implementation of the W3C DOM Level 2 Event interface. + * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface. + * + * This implementation only provides `type` and `target` properties, and + * `stopPropagation` and `preventDefault` methods. It is meant as base class + * for higher level events defined in the library, and works with + * {@link module:ol/events/Target~Target}. + */ +var BaseEvent = /** @class */ (function () { + /** + * @param {string} type Type. + */ + function BaseEvent(type) { + /** + * @type {boolean} + */ + this.propagationStopped; + /** + * @type {boolean} + */ + this.defaultPrevented; + /** + * The event type. + * @type {string} + * @api + */ + this.type = type; + /** + * The event target. + * @type {Object} + * @api + */ + this.target = null; + } + /** + * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events + * will be fired. + * @api + */ + BaseEvent.prototype.preventDefault = function () { + this.defaultPrevented = true; + }; + /** + * Stop event propagation. + * @api + */ + BaseEvent.prototype.stopPropagation = function () { + this.propagationStopped = true; + }; + return BaseEvent; +}()); +/** + * @param {Event|import("./Event.js").default} evt Event + */ +function stopPropagation(evt) { + evt.stopPropagation(); +} +/** + * @param {Event|import("./Event.js").default} evt Event + */ +function preventDefault(evt) { + evt.preventDefault(); +} +/* harmony default export */ var Event = (BaseEvent); +//# sourceMappingURL=Event.js.map +;// CONCATENATED MODULE: ./node_modules/ol/ObjectEventType.js +/** + * @module ol/ObjectEventType + */ +/** + * @enum {string} + */ +/* harmony default export */ var ObjectEventType = ({ + /** + * Triggered when a property is changed. + * @event module:ol/Object.ObjectEvent#propertychange + * @api + */ + PROPERTYCHANGE: 'propertychange', +}); +/** + * @typedef {'propertychange'} Types + */ +//# sourceMappingURL=ObjectEventType.js.map +;// CONCATENATED MODULE: ./node_modules/ol/Disposable.js +/** + * @module ol/Disposable + */ +/** + * @classdesc + * Objects that need to clean up after themselves. + */ +var Disposable = /** @class */ (function () { + function Disposable() { + /** + * The object has already been disposed. + * @type {boolean} + * @protected + */ + this.disposed = false; + } + /** + * Clean up. + */ + Disposable.prototype.dispose = function () { + if (!this.disposed) { + this.disposed = true; + this.disposeInternal(); + } + }; + /** + * Extension point for disposable objects. + * @protected + */ + Disposable.prototype.disposeInternal = function () { }; + return Disposable; +}()); +/* harmony default export */ var ol_Disposable = (Disposable); +//# sourceMappingURL=Disposable.js.map +;// CONCATENATED MODULE: ./node_modules/ol/array.js +/** + * @module ol/array + */ +/** + * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1. + * https://github.com/darkskyapp/binary-search + * + * @param {Array<*>} haystack Items to search through. + * @param {*} needle The item to look for. + * @param {Function} [opt_comparator] Comparator function. + * @return {number} The index of the item if found, -1 if not. + */ +function binarySearch(haystack, needle, opt_comparator) { + var mid, cmp; + var comparator = opt_comparator || numberSafeCompareFunction; + var low = 0; + var high = haystack.length; + var found = false; + while (low < high) { + /* Note that "(low + high) >>> 1" may overflow, and results in a typecast + * to double (which gives the wrong results). */ + mid = low + ((high - low) >> 1); + cmp = +comparator(haystack[mid], needle); + if (cmp < 0.0) { + /* Too low. */ + low = mid + 1; + } + else { + /* Key found or too high */ + high = mid; + found = !cmp; + } + } + /* Key not found. */ + return found ? low : ~low; +} +/** + * Compare function for array sort that is safe for numbers. + * @param {*} a The first object to be compared. + * @param {*} b The second object to be compared. + * @return {number} A negative number, zero, or a positive number as the first + * argument is less than, equal to, or greater than the second. + */ +function numberSafeCompareFunction(a, b) { + return a > b ? 1 : a < b ? -1 : 0; +} +/** + * Whether the array contains the given object. + * @param {Array<*>} arr The array to test for the presence of the element. + * @param {*} obj The object for which to test. + * @return {boolean} The object is in the array. + */ +function includes(arr, obj) { + return arr.indexOf(obj) >= 0; +} +/** + * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function + * of this type to determine which nearest resolution to use. + * + * This function takes a `{number}` representing a value between two array entries, + * a `{number}` representing the value of the nearest higher entry and + * a `{number}` representing the value of the nearest lower entry + * as arguments and returns a `{number}`. If a negative number or zero is returned + * the lower value will be used, if a positive number is returned the higher value + * will be used. + * @typedef {function(number, number, number): number} NearestDirectionFunction + * @api + */ +/** + * @param {Array} arr Array in descending order. + * @param {number} target Target. + * @param {number|NearestDirectionFunction} direction + * 0 means return the nearest, + * > 0 means return the largest nearest, + * < 0 means return the smallest nearest. + * @return {number} Index. + */ +function linearFindNearest(arr, target, direction) { + var n = arr.length; + if (arr[0] <= target) { + return 0; + } + else if (target <= arr[n - 1]) { + return n - 1; + } + else { + var i = void 0; + if (direction > 0) { + for (i = 1; i < n; ++i) { + if (arr[i] < target) { + return i - 1; + } + } + } + else if (direction < 0) { + for (i = 1; i < n; ++i) { + if (arr[i] <= target) { + return i; + } + } + } + else { + for (i = 1; i < n; ++i) { + if (arr[i] == target) { + return i; + } + else if (arr[i] < target) { + if (typeof direction === 'function') { + if (direction(target, arr[i - 1], arr[i]) > 0) { + return i - 1; + } + else { + return i; + } + } + else if (arr[i - 1] - target < target - arr[i]) { + return i - 1; + } + else { + return i; + } + } + } + } + return n - 1; + } +} +/** + * @param {Array<*>} arr Array. + * @param {number} begin Begin index. + * @param {number} end End index. + */ +function reverseSubArray(arr, begin, end) { + while (begin < end) { + var tmp = arr[begin]; + arr[begin] = arr[end]; + arr[end] = tmp; + ++begin; + --end; + } +} +/** + * @param {Array} arr The array to modify. + * @param {!Array|VALUE} data The elements or arrays of elements to add to arr. + * @template VALUE + */ +function array_extend(arr, data) { + var extension = Array.isArray(data) ? data : [data]; + var length = extension.length; + for (var i = 0; i < length; i++) { + arr[arr.length] = extension[i]; + } +} +/** + * @param {Array} arr The array to modify. + * @param {VALUE} obj The element to remove. + * @template VALUE + * @return {boolean} If the element was removed. + */ +function remove(arr, obj) { + var i = arr.indexOf(obj); + var found = i > -1; + if (found) { + arr.splice(i, 1); + } + return found; +} +/** + * @param {Array} arr The array to search in. + * @param {function(VALUE, number, ?) : boolean} func The function to compare. + * @template VALUE + * @return {VALUE|null} The element found or null. + */ +function find(arr, func) { + var length = arr.length >>> 0; + var value; + for (var i = 0; i < length; i++) { + value = arr[i]; + if (func(value, i, arr)) { + return value; + } + } + return null; +} +/** + * @param {Array|Uint8ClampedArray} arr1 The first array to compare. + * @param {Array|Uint8ClampedArray} arr2 The second array to compare. + * @return {boolean} Whether the two arrays are equal. + */ +function equals(arr1, arr2) { + var len1 = arr1.length; + if (len1 !== arr2.length) { + return false; + } + for (var i = 0; i < len1; i++) { + if (arr1[i] !== arr2[i]) { + return false; + } + } + return true; +} +/** + * Sort the passed array such that the relative order of equal elements is preserved. + * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details. + * @param {Array<*>} arr The array to sort (modifies original). + * @param {!function(*, *): number} compareFnc Comparison function. + * @api + */ +function stableSort(arr, compareFnc) { + var length = arr.length; + var tmp = Array(arr.length); + var i; + for (i = 0; i < length; i++) { + tmp[i] = { index: i, value: arr[i] }; + } + tmp.sort(function (a, b) { + return compareFnc(a.value, b.value) || a.index - b.index; + }); + for (i = 0; i < arr.length; i++) { + arr[i] = tmp[i].value; + } +} +/** + * @param {Array<*>} arr The array to search in. + * @param {Function} func Comparison function. + * @return {number} Return index. + */ +function findIndex(arr, func) { + var index; + var found = !arr.every(function (el, idx) { + index = idx; + return !func(el, idx, arr); + }); + return found ? index : -1; +} +/** + * @param {Array<*>} arr The array to test. + * @param {Function} [opt_func] Comparison function. + * @param {boolean} [opt_strict] Strictly sorted (default false). + * @return {boolean} Return index. + */ +function isSorted(arr, opt_func, opt_strict) { + var compare = opt_func || numberSafeCompareFunction; + return arr.every(function (currentVal, index) { + if (index === 0) { + return true; + } + var res = compare(arr[index - 1], currentVal); + return !(res > 0 || (opt_strict && res === 0)); + }); +} +//# sourceMappingURL=array.js.map +;// CONCATENATED MODULE: ./node_modules/ol/functions.js +/** + * @module ol/functions + */ + +/** + * Always returns true. + * @return {boolean} true. + */ +function TRUE() { + return true; +} +/** + * Always returns false. + * @return {boolean} false. + */ +function functions_FALSE() { + return false; +} +/** + * A reusable function, used e.g. as a default for callbacks. + * + * @return {void} Nothing. + */ +function VOID() { } +/** + * Wrap a function in another function that remembers the last return. If the + * returned function is called twice in a row with the same arguments and the same + * this object, it will return the value from the first call in the second call. + * + * @param {function(...any): ReturnType} fn The function to memoize. + * @return {function(...any): ReturnType} The memoized function. + * @template ReturnType + */ +function memoizeOne(fn) { + var called = false; + /** @type {ReturnType} */ + var lastResult; + /** @type {Array} */ + var lastArgs; + var lastThis; + return function () { + var nextArgs = Array.prototype.slice.call(arguments); + if (!called || this !== lastThis || !equals(nextArgs, lastArgs)) { + called = true; + lastThis = this; + lastArgs = nextArgs; + lastResult = fn.apply(this, arguments); + } + return lastResult; + }; +} +/** + * @template T + * @param {function(): (T | Promise)} getter A function that returns a value or a promise for a value. + * @return {Promise} A promise for the value. + */ +function toPromise(getter) { + function promiseGetter() { + var value; + try { + value = getter(); + } + catch (err) { + return Promise.reject(err); + } + if (value instanceof Promise) { + return value; + } + return Promise.resolve(value); + } + return promiseGetter(); +} +//# sourceMappingURL=functions.js.map +;// CONCATENATED MODULE: ./node_modules/ol/obj.js +/** + * @module ol/obj + */ +/** + * Polyfill for Object.assign(). Assigns enumerable and own properties from + * one or more source objects to a target object. + * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign. + * + * @param {!Object} target The target object. + * @param {...Object} var_sources The source object(s). + * @return {!Object} The modified target object. + */ +var obj_assign = typeof Object.assign === 'function' + ? Object.assign + : function (target, var_sources) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var i = 1, ii = arguments.length; i < ii; ++i) { + var source = arguments[i]; + if (source !== undefined && source !== null) { + for (var key in source) { + if (source.hasOwnProperty(key)) { + output[key] = source[key]; + } + } + } + } + return output; + }; +/** + * Removes all properties from an object. + * @param {Object} object The object to clear. + */ +function clear(object) { + for (var property in object) { + delete object[property]; + } +} +/** + * Polyfill for Object.values(). Get an array of property values from an object. + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values + * + * @param {!Object} object The object from which to get the values. + * @return {!Array} The property values. + * @template K,V + */ +var getValues = typeof Object.values === 'function' + ? Object.values + : function (object) { + var values = []; + for (var property in object) { + values.push(object[property]); + } + return values; + }; +/** + * Determine if an object has any properties. + * @param {Object} object The object to check. + * @return {boolean} The object is empty. + */ +function obj_isEmpty(object) { + var property; + for (property in object) { + return false; + } + return !property; +} +//# sourceMappingURL=obj.js.map +;// CONCATENATED MODULE: ./node_modules/ol/events/Target.js +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/events/Target + */ + + + + +/** + * @typedef {EventTarget|Target} EventTargetLike + */ +/** + * @classdesc + * A simplified implementation of the W3C DOM Level 2 EventTarget interface. + * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget. + * + * There are two important simplifications compared to the specification: + * + * 1. The handling of `useCapture` in `addEventListener` and + * `removeEventListener`. There is no real capture model. + * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`. + * There is no event target hierarchy. When a listener calls + * `stopPropagation` or `preventDefault` on an event object, it means that no + * more listeners after this one will be called. Same as when the listener + * returns false. + */ +var Target = /** @class */ (function (_super) { + __extends(Target, _super); + /** + * @param {*} [opt_target] Default event target for dispatched events. + */ + function Target(opt_target) { + var _this = _super.call(this) || this; + /** + * @private + * @type {*} + */ + _this.eventTarget_ = opt_target; + /** + * @private + * @type {Object} + */ + _this.pendingRemovals_ = null; + /** + * @private + * @type {Object} + */ + _this.dispatching_ = null; + /** + * @private + * @type {Object>} + */ + _this.listeners_ = null; + return _this; + } + /** + * @param {string} type Type. + * @param {import("../events.js").Listener} listener Listener. + */ + Target.prototype.addEventListener = function (type, listener) { + if (!type || !listener) { + return; + } + var listeners = this.listeners_ || (this.listeners_ = {}); + var listenersForType = listeners[type] || (listeners[type] = []); + if (listenersForType.indexOf(listener) === -1) { + listenersForType.push(listener); + } + }; + /** + * Dispatches an event and calls all listeners listening for events + * of this type. The event parameter can either be a string or an + * Object with a `type` property. + * + * @param {import("./Event.js").default|string} event Event object. + * @return {boolean|undefined} `false` if anyone called preventDefault on the + * event object or if any of the listeners returned false. + * @api + */ + Target.prototype.dispatchEvent = function (event) { + var isString = typeof event === 'string'; + var type = isString ? event : event.type; + var listeners = this.listeners_ && this.listeners_[type]; + if (!listeners) { + return; + } + var evt = isString ? new Event(event) : /** @type {Event} */ (event); + if (!evt.target) { + evt.target = this.eventTarget_ || this; + } + var dispatching = this.dispatching_ || (this.dispatching_ = {}); + var pendingRemovals = this.pendingRemovals_ || (this.pendingRemovals_ = {}); + if (!(type in dispatching)) { + dispatching[type] = 0; + pendingRemovals[type] = 0; + } + ++dispatching[type]; + var propagate; + for (var i = 0, ii = listeners.length; i < ii; ++i) { + if ('handleEvent' in listeners[i]) { + propagate = /** @type {import("../events.js").ListenerObject} */ (listeners[i]).handleEvent(evt); + } + else { + propagate = /** @type {import("../events.js").ListenerFunction} */ (listeners[i]).call(this, evt); + } + if (propagate === false || evt.propagationStopped) { + propagate = false; + break; + } + } + if (--dispatching[type] === 0) { + var pr = pendingRemovals[type]; + delete pendingRemovals[type]; + while (pr--) { + this.removeEventListener(type, VOID); + } + delete dispatching[type]; + } + return propagate; + }; + /** + * Clean up. + */ + Target.prototype.disposeInternal = function () { + this.listeners_ && clear(this.listeners_); + }; + /** + * Get the listeners for a specified event type. Listeners are returned in the + * order that they will be called in. + * + * @param {string} type Type. + * @return {Array|undefined} Listeners. + */ + Target.prototype.getListeners = function (type) { + return (this.listeners_ && this.listeners_[type]) || undefined; + }; + /** + * @param {string} [opt_type] Type. If not provided, + * `true` will be returned if this event target has any listeners. + * @return {boolean} Has listeners. + */ + Target.prototype.hasListener = function (opt_type) { + if (!this.listeners_) { + return false; + } + return opt_type + ? opt_type in this.listeners_ + : Object.keys(this.listeners_).length > 0; + }; + /** + * @param {string} type Type. + * @param {import("../events.js").Listener} listener Listener. + */ + Target.prototype.removeEventListener = function (type, listener) { + var listeners = this.listeners_ && this.listeners_[type]; + if (listeners) { + var index = listeners.indexOf(listener); + if (index !== -1) { + if (this.pendingRemovals_ && type in this.pendingRemovals_) { + // make listener a no-op, and remove later in #dispatchEvent() + listeners[index] = VOID; + ++this.pendingRemovals_[type]; + } + else { + listeners.splice(index, 1); + if (listeners.length === 0) { + delete this.listeners_[type]; + } + } + } + } + }; + return Target; +}(ol_Disposable)); +/* harmony default export */ var events_Target = (Target); +//# sourceMappingURL=Target.js.map +;// CONCATENATED MODULE: ./node_modules/ol/events/EventType.js +/** + * @module ol/events/EventType + */ +/** + * @enum {string} + * @const + */ +/* harmony default export */ var EventType = ({ + /** + * Generic change event. Triggered when the revision counter is increased. + * @event module:ol/events/Event~BaseEvent#change + * @api + */ + CHANGE: 'change', + /** + * Generic error event. Triggered when an error occurs. + * @event module:ol/events/Event~BaseEvent#error + * @api + */ + ERROR: 'error', + BLUR: 'blur', + CLEAR: 'clear', + CONTEXTMENU: 'contextmenu', + CLICK: 'click', + DBLCLICK: 'dblclick', + DRAGENTER: 'dragenter', + DRAGOVER: 'dragover', + DROP: 'drop', + FOCUS: 'focus', + KEYDOWN: 'keydown', + KEYPRESS: 'keypress', + LOAD: 'load', + RESIZE: 'resize', + TOUCHMOVE: 'touchmove', + WHEEL: 'wheel', +}); +//# sourceMappingURL=EventType.js.map +;// CONCATENATED MODULE: ./node_modules/ol/events.js +/** + * @module ol/events + */ + +/** + * Key to use with {@link module:ol/Observable.unByKey}. + * @typedef {Object} EventsKey + * @property {ListenerFunction} listener Listener. + * @property {import("./events/Target.js").EventTargetLike} target Target. + * @property {string} type Type. + * @api + */ +/** + * Listener function. This function is called with an event object as argument. + * When the function returns `false`, event propagation will stop. + * + * @typedef {function((Event|import("./events/Event.js").default)): (void|boolean)} ListenerFunction + * @api + */ +/** + * @typedef {Object} ListenerObject + * @property {ListenerFunction} handleEvent HandleEvent listener function. + */ +/** + * @typedef {ListenerFunction|ListenerObject} Listener + */ +/** + * Registers an event listener on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * This function efficiently binds a `listener` to a `this` object, and returns + * a key for use with {@link module:ol/events.unlistenByKey}. + * + * @param {import("./events/Target.js").EventTargetLike} target Event target. + * @param {string} type Event type. + * @param {ListenerFunction} listener Listener. + * @param {Object} [opt_this] Object referenced by the `this` keyword in the + * listener. Default is the `target`. + * @param {boolean} [opt_once] If true, add the listener as one-off listener. + * @return {EventsKey} Unique key for the listener. + */ +function listen(target, type, listener, opt_this, opt_once) { + if (opt_this && opt_this !== target) { + listener = listener.bind(opt_this); + } + if (opt_once) { + var originalListener_1 = listener; + listener = function () { + target.removeEventListener(type, listener); + originalListener_1.apply(this, arguments); + }; + } + var eventsKey = { + target: target, + type: type, + listener: listener, + }; + target.addEventListener(type, listener); + return eventsKey; +} +/** + * Registers a one-off event listener on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * This function efficiently binds a `listener` as self-unregistering listener + * to a `this` object, and returns a key for use with + * {@link module:ol/events.unlistenByKey} in case the listener needs to be + * unregistered before it is called. + * + * When {@link module:ol/events.listen} is called with the same arguments after this + * function, the self-unregistering listener will be turned into a permanent + * listener. + * + * @param {import("./events/Target.js").EventTargetLike} target Event target. + * @param {string} type Event type. + * @param {ListenerFunction} listener Listener. + * @param {Object} [opt_this] Object referenced by the `this` keyword in the + * listener. Default is the `target`. + * @return {EventsKey} Key for unlistenByKey. + */ +function listenOnce(target, type, listener, opt_this) { + return listen(target, type, listener, opt_this, true); +} +/** + * Unregisters event listeners on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * The argument passed to this function is the key returned from + * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}. + * + * @param {EventsKey} key The key. + */ +function unlistenByKey(key) { + if (key && key.target) { + key.target.removeEventListener(key.type, key.listener); + clear(key); + } +} +//# sourceMappingURL=events.js.map +;// CONCATENATED MODULE: ./node_modules/ol/Observable.js +var Observable_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/Observable + */ + + + +/*** + * @template {string} Type + * @template {Event|import("./events/Event.js").default} EventClass + * @template Return + * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature + */ +/*** + * @template {string} Type + * @template Return + * @typedef {(type: Type[], listener: (event: Event|import("./events/Event").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature + */ +/** + * @typedef {'change'|'error'} EventTypes + */ +/*** + * @template Return + * @typedef {OnSignature & CombinedOnSignature} ObservableOnSignature + */ +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * An event target providing convenient methods for listener registration + * and unregistration. A generic `change` event is always available through + * {@link module:ol/Observable~Observable#changed}. + * + * @fires import("./events/Event.js").default + * @api + */ +var Observable = /** @class */ (function (_super) { + Observable_extends(Observable, _super); + function Observable() { + var _this = _super.call(this) || this; + _this.on = + /** @type {ObservableOnSignature} */ (_this.onInternal); + _this.once = + /** @type {ObservableOnSignature} */ (_this.onceInternal); + _this.un = /** @type {ObservableOnSignature} */ (_this.unInternal); + /** + * @private + * @type {number} + */ + _this.revision_ = 0; + return _this; + } + /** + * Increases the revision counter and dispatches a 'change' event. + * @api + */ + Observable.prototype.changed = function () { + ++this.revision_; + this.dispatchEvent(EventType.CHANGE); + }; + /** + * Get the version number for this object. Each time the object is modified, + * its version number will be incremented. + * @return {number} Revision. + * @api + */ + Observable.prototype.getRevision = function () { + return this.revision_; + }; + /** + * @param {string|Array} type Type. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. + * @return {import("./events.js").EventsKey|Array} Event key. + * @protected + */ + Observable.prototype.onInternal = function (type, listener) { + if (Array.isArray(type)) { + var len = type.length; + var keys = new Array(len); + for (var i = 0; i < len; ++i) { + keys[i] = listen(this, type[i], listener); + } + return keys; + } + else { + return listen(this, /** @type {string} */ (type), listener); + } + }; + /** + * @param {string|Array} type Type. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. + * @return {import("./events.js").EventsKey|Array} Event key. + * @protected + */ + Observable.prototype.onceInternal = function (type, listener) { + var key; + if (Array.isArray(type)) { + var len = type.length; + key = new Array(len); + for (var i = 0; i < len; ++i) { + key[i] = listenOnce(this, type[i], listener); + } + } + else { + key = listenOnce(this, /** @type {string} */ (type), listener); + } + /** @type {Object} */ (listener).ol_key = key; + return key; + }; + /** + * Unlisten for a certain type of event. + * @param {string|Array} type Type. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. + * @protected + */ + Observable.prototype.unInternal = function (type, listener) { + var key = /** @type {Object} */ (listener).ol_key; + if (key) { + unByKey(key); + } + else if (Array.isArray(type)) { + for (var i = 0, ii = type.length; i < ii; ++i) { + this.removeEventListener(type[i], listener); + } + } + else { + this.removeEventListener(type, listener); + } + }; + return Observable; +}(events_Target)); +/** + * Listen for a certain type of event. + * @function + * @param {string|Array} type The event type or array of event types. + * @param {function((Event|import("./events/Event").default)): ?} listener The listener function. + * @return {import("./events.js").EventsKey|Array} Unique key for the listener. If + * called with an array of event types as the first argument, the return + * will be an array of keys. + * @api + */ +Observable.prototype.on; +/** + * Listen once for a certain type of event. + * @function + * @param {string|Array} type The event type or array of event types. + * @param {function((Event|import("./events/Event").default)): ?} listener The listener function. + * @return {import("./events.js").EventsKey|Array} Unique key for the listener. If + * called with an array of event types as the first argument, the return + * will be an array of keys. + * @api + */ +Observable.prototype.once; +/** + * Unlisten for a certain type of event. + * @function + * @param {string|Array} type The event type or array of event types. + * @param {function((Event|import("./events/Event").default)): ?} listener The listener function. + * @api + */ +Observable.prototype.un; +/** + * Removes an event listener using the key returned by `on()` or `once()`. + * @param {import("./events.js").EventsKey|Array} key The key returned by `on()` + * or `once()` (or an array of keys). + * @api + */ +function unByKey(key) { + if (Array.isArray(key)) { + for (var i = 0, ii = key.length; i < ii; ++i) { + unlistenByKey(key[i]); + } + } + else { + unlistenByKey(/** @type {import("./events.js").EventsKey} */ (key)); + } +} +/* harmony default export */ var ol_Observable = (Observable); +//# sourceMappingURL=Observable.js.map +;// CONCATENATED MODULE: ./node_modules/ol/util.js +/** + * @module ol/util + */ +/** + * @return {?} Any return. + */ +function util_abstract() { + return /** @type {?} */ ((function () { + throw new Error('Unimplemented abstract method.'); + })()); +} +/** + * Counter for getUid. + * @type {number} + * @private + */ +var uidCounter_ = 0; +/** + * Gets a unique ID for an object. This mutates the object so that further calls + * with the same object as a parameter returns the same value. Unique IDs are generated + * as a strictly increasing sequence. Adapted from goog.getUid. + * + * @param {Object} obj The object to get the unique ID for. + * @return {string} The unique ID for the object. + * @api + */ +function getUid(obj) { + return obj.ol_uid || (obj.ol_uid = String(++uidCounter_)); +} +/** + * OpenLayers version. + * @type {string} + */ +var VERSION = '6.15.1'; +//# sourceMappingURL=util.js.map +;// CONCATENATED MODULE: ./node_modules/ol/Object.js +var Object_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/Object + */ + + + + + +/** + * @classdesc + * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type. + */ +var ObjectEvent = /** @class */ (function (_super) { + Object_extends(ObjectEvent, _super); + /** + * @param {string} type The event type. + * @param {string} key The property name. + * @param {*} oldValue The old value for `key`. + */ + function ObjectEvent(type, key, oldValue) { + var _this = _super.call(this, type) || this; + /** + * The name of the property whose value is changing. + * @type {string} + * @api + */ + _this.key = key; + /** + * The old value. To get the new value use `e.target.get(e.key)` where + * `e` is the event object. + * @type {*} + * @api + */ + _this.oldValue = oldValue; + return _this; + } + return ObjectEvent; +}(Event)); + +/*** + * @template Return + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} ObjectOnSignature + */ +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Most non-trivial classes inherit from this. + * + * This extends {@link module:ol/Observable~Observable} with observable + * properties, where each property is observable as well as the object as a + * whole. + * + * Classes that inherit from this have pre-defined properties, to which you can + * add your owns. The pre-defined properties are listed in this documentation as + * 'Observable Properties', and have their own accessors; for example, + * {@link module:ol/Map~Map} has a `target` property, accessed with + * `getTarget()` and changed with `setTarget()`. Not all properties are however + * settable. There are also general-purpose accessors `get()` and `set()`. For + * example, `get('target')` is equivalent to `getTarget()`. + * + * The `set` accessors trigger a change event, and you can monitor this by + * registering a listener. For example, {@link module:ol/View~View} has a + * `center` property, so `view.on('change:center', function(evt) {...});` would + * call the function whenever the value of the center property changes. Within + * the function, `evt.target` would be the view, so `evt.target.getCenter()` + * would return the new center. + * + * You can add your own observable properties with + * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`. + * You can listen for changes on that property value with + * `object.on('change:prop', listener)`. You can get a list of all + * properties with {@link module:ol/Object~BaseObject#getProperties}. + * + * Note that the observable properties are separate from standard JS properties. + * You can, for example, give your map object a title with + * `map.title='New title'` and with `map.set('title', 'Another title')`. The + * first will be a `hasOwnProperty`; the second will appear in + * `getProperties()`. Only the second is observable. + * + * Properties can be deleted by using the unset method. E.g. + * object.unset('foo'). + * + * @fires ObjectEvent + * @api + */ +var BaseObject = /** @class */ (function (_super) { + Object_extends(BaseObject, _super); + /** + * @param {Object} [opt_values] An object with key-value pairs. + */ + function BaseObject(opt_values) { + var _this = _super.call(this) || this; + /*** + * @type {ObjectOnSignature} + */ + _this.on; + /*** + * @type {ObjectOnSignature} + */ + _this.once; + /*** + * @type {ObjectOnSignature} + */ + _this.un; + // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is + // the same as the order in which they were created. This also helps to + // ensure that object properties are always added in the same order, which + // helps many JavaScript engines generate faster code. + getUid(_this); + /** + * @private + * @type {Object} + */ + _this.values_ = null; + if (opt_values !== undefined) { + _this.setProperties(opt_values); + } + return _this; + } + /** + * Gets a value. + * @param {string} key Key name. + * @return {*} Value. + * @api + */ + BaseObject.prototype.get = function (key) { + var value; + if (this.values_ && this.values_.hasOwnProperty(key)) { + value = this.values_[key]; + } + return value; + }; + /** + * Get a list of object property names. + * @return {Array} List of property names. + * @api + */ + BaseObject.prototype.getKeys = function () { + return (this.values_ && Object.keys(this.values_)) || []; + }; + /** + * Get an object of all property names and values. + * @return {Object} Object. + * @api + */ + BaseObject.prototype.getProperties = function () { + return (this.values_ && obj_assign({}, this.values_)) || {}; + }; + /** + * @return {boolean} The object has properties. + */ + BaseObject.prototype.hasProperties = function () { + return !!this.values_; + }; + /** + * @param {string} key Key name. + * @param {*} oldValue Old value. + */ + BaseObject.prototype.notify = function (key, oldValue) { + var eventType; + eventType = "change:".concat(key); + if (this.hasListener(eventType)) { + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); + } + eventType = ObjectEventType.PROPERTYCHANGE; + if (this.hasListener(eventType)) { + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); + } + }; + /** + * @param {string} key Key name. + * @param {import("./events.js").Listener} listener Listener. + */ + BaseObject.prototype.addChangeListener = function (key, listener) { + this.addEventListener("change:".concat(key), listener); + }; + /** + * @param {string} key Key name. + * @param {import("./events.js").Listener} listener Listener. + */ + BaseObject.prototype.removeChangeListener = function (key, listener) { + this.removeEventListener("change:".concat(key), listener); + }; + /** + * Sets a value. + * @param {string} key Key name. + * @param {*} value Value. + * @param {boolean} [opt_silent] Update without triggering an event. + * @api + */ + BaseObject.prototype.set = function (key, value, opt_silent) { + var values = this.values_ || (this.values_ = {}); + if (opt_silent) { + values[key] = value; + } + else { + var oldValue = values[key]; + values[key] = value; + if (oldValue !== value) { + this.notify(key, oldValue); + } + } + }; + /** + * Sets a collection of key-value pairs. Note that this changes any existing + * properties and adds new ones (it does not remove any existing properties). + * @param {Object} values Values. + * @param {boolean} [opt_silent] Update without triggering an event. + * @api + */ + BaseObject.prototype.setProperties = function (values, opt_silent) { + for (var key in values) { + this.set(key, values[key], opt_silent); + } + }; + /** + * Apply any properties from another object without triggering events. + * @param {BaseObject} source The source object. + * @protected + */ + BaseObject.prototype.applyProperties = function (source) { + if (!source.values_) { + return; + } + obj_assign(this.values_ || (this.values_ = {}), source.values_); + }; + /** + * Unsets a property. + * @param {string} key Key name. + * @param {boolean} [opt_silent] Unset without triggering an event. + * @api + */ + BaseObject.prototype.unset = function (key, opt_silent) { + if (this.values_ && key in this.values_) { + var oldValue = this.values_[key]; + delete this.values_[key]; + if (obj_isEmpty(this.values_)) { + this.values_ = null; + } + if (!opt_silent) { + this.notify(key, oldValue); + } + } + }; + return BaseObject; +}(ol_Observable)); +/* harmony default export */ var ol_Object = (BaseObject); +//# sourceMappingURL=Object.js.map +;// CONCATENATED MODULE: ./node_modules/ol/MapEventType.js +/** + * @module ol/MapEventType + */ +/** + * @enum {string} + */ +/* harmony default export */ var MapEventType = ({ + /** + * Triggered after a map frame is rendered. + * @event module:ol/MapEvent~MapEvent#postrender + * @api + */ + POSTRENDER: 'postrender', + /** + * Triggered when the map starts moving. + * @event module:ol/MapEvent~MapEvent#movestart + * @api + */ + MOVESTART: 'movestart', + /** + * Triggered after the map is moved. + * @event module:ol/MapEvent~MapEvent#moveend + * @api + */ + MOVEEND: 'moveend', + /** + * Triggered when loading of additional map data (tiles, images, features) starts. + * @event module:ol/MapEvent~MapEvent#loadstart + * @api + */ + LOADSTART: 'loadstart', + /** + * Triggered when loading of additional map data has completed. + * @event module:ol/MapEvent~MapEvent#loadend + * @api + */ + LOADEND: 'loadend', +}); +/*** + * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types + */ +//# sourceMappingURL=MapEventType.js.map +;// CONCATENATED MODULE: ./node_modules/ol/has.js +/** + * @module ol/has + */ +var ua = typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined' + ? navigator.userAgent.toLowerCase() + : ''; +/** + * User agent string says we are dealing with Firefox as browser. + * @type {boolean} + */ +var FIREFOX = ua.indexOf('firefox') !== -1; +/** + * User agent string says we are dealing with Safari as browser. + * @type {boolean} + */ +var SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1; +/** + * https://bugs.webkit.org/show_bug.cgi?id=237906 + * @type {boolean} + */ +var SAFARI_BUG_237906 = SAFARI && + !!(ua.indexOf('version/15.4') >= 0 || + ua.match(/cpu (os|iphone os) 15_4 like mac os x/)); +/** + * User agent string says we are dealing with a WebKit engine. + * @type {boolean} + */ +var WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1; +/** + * User agent string says we are dealing with a Mac as platform. + * @type {boolean} + */ +var has_MAC = ua.indexOf('macintosh') !== -1; +/** + * The ratio between physical pixels and device-independent pixels + * (dips) on the device (`window.devicePixelRatio`). + * @const + * @type {number} + * @api + */ +var DEVICE_PIXEL_RATIO = typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1; +/** + * The execution context is a worker with OffscreenCanvas available. + * @const + * @type {boolean} + */ +var WORKER_OFFSCREEN_CANVAS = typeof WorkerGlobalScope !== 'undefined' && + typeof OffscreenCanvas !== 'undefined' && + self instanceof WorkerGlobalScope; //eslint-disable-line +/** + * Image.prototype.decode() is supported. + * @type {boolean} + */ +var IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode; +/** + * @type {boolean} + */ +var PASSIVE_EVENT_LISTENERS = (function () { + var passive = false; + try { + var options = Object.defineProperty({}, 'passive', { + get: function () { + passive = true; + }, + }); + window.addEventListener('_', null, options); + window.removeEventListener('_', null, options); + } + catch (error) { + // passive not supported + } + return passive; +})(); +//# sourceMappingURL=has.js.map +;// CONCATENATED MODULE: ./node_modules/ol/dom.js + +/** + * @module ol/dom + */ +//FIXME Move this function to the canvas module +/** + * Create an html canvas element and returns its 2d context. + * @param {number} [opt_width] Canvas width. + * @param {number} [opt_height] Canvas height. + * @param {Array} [opt_canvasPool] Canvas pool to take existing canvas from. + * @param {CanvasRenderingContext2DSettings} [opt_Context2DSettings] CanvasRenderingContext2DSettings + * @return {CanvasRenderingContext2D} The context. + */ +function createCanvasContext2D(opt_width, opt_height, opt_canvasPool, opt_Context2DSettings) { + /** @type {HTMLCanvasElement|OffscreenCanvas} */ + var canvas; + if (opt_canvasPool && opt_canvasPool.length) { + canvas = opt_canvasPool.shift(); + } + else if (WORKER_OFFSCREEN_CANVAS) { + canvas = new OffscreenCanvas(opt_width || 300, opt_height || 300); + } + else { + canvas = document.createElement('canvas'); + } + if (opt_width) { + canvas.width = opt_width; + } + if (opt_height) { + canvas.height = opt_height; + } + //FIXME Allow OffscreenCanvasRenderingContext2D as return type + return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d', opt_Context2DSettings)); +} +/** + * Releases canvas memory to avoid exceeding memory limits in Safari. + * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/ + * @param {CanvasRenderingContext2D} context Context. + */ +function releaseCanvas(context) { + var canvas = context.canvas; + canvas.width = 1; + canvas.height = 1; + context.clearRect(0, 0, 1, 1); +} +/** + * Get the current computed width for the given element including margin, + * padding and border. + * Equivalent to jQuery's `$(el).outerWidth(true)`. + * @param {!HTMLElement} element Element. + * @return {number} The width. + */ +function dom_outerWidth(element) { + var width = element.offsetWidth; + var style = getComputedStyle(element); + width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); + return width; +} +/** + * Get the current computed height for the given element including margin, + * padding and border. + * Equivalent to jQuery's `$(el).outerHeight(true)`. + * @param {!HTMLElement} element Element. + * @return {number} The height. + */ +function dom_outerHeight(element) { + var height = element.offsetHeight; + var style = getComputedStyle(element); + height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); + return height; +} +/** + * @param {Node} newNode Node to replace old node + * @param {Node} oldNode The node to be replaced + */ +function replaceNode(newNode, oldNode) { + var parent = oldNode.parentNode; + if (parent) { + parent.replaceChild(newNode, oldNode); + } +} +/** + * @param {Node} node The node to remove. + * @return {Node|null} The node that was removed or null. + */ +function removeNode(node) { + return node && node.parentNode ? node.parentNode.removeChild(node) : null; +} +/** + * @param {Node} node The node to remove the children from. + */ +function removeChildren(node) { + while (node.lastChild) { + node.removeChild(node.lastChild); + } +} +/** + * Transform the children of a parent node so they match the + * provided list of children. This function aims to efficiently + * remove, add, and reorder child nodes while maintaining a simple + * implementation (it is not guaranteed to minimize DOM operations). + * @param {Node} node The parent node whose children need reworking. + * @param {Array} children The desired children. + */ +function replaceChildren(node, children) { + var oldChildren = node.childNodes; + for (var i = 0; true; ++i) { + var oldChild = oldChildren[i]; + var newChild = children[i]; + // check if our work is done + if (!oldChild && !newChild) { + break; + } + // check if children match + if (oldChild === newChild) { + continue; + } + // check if a new child needs to be added + if (!oldChild) { + node.appendChild(newChild); + continue; + } + // check if an old child needs to be removed + if (!newChild) { + node.removeChild(oldChild); + --i; + continue; + } + // reorder + node.insertBefore(newChild, oldChild); + } +} +//# sourceMappingURL=dom.js.map +;// CONCATENATED MODULE: ./node_modules/ol/control/Control.js +var Control_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/control/Control + */ + + + + + +/** + * @typedef {Object} Options + * @property {HTMLElement} [element] The element is the control's + * container element. This only needs to be specified if you're developing + * a custom control. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when + * the control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + * @property {HTMLElement|string} [target] Specify a target if you want + * the control to be rendered outside of the map's viewport. + */ +/** + * @classdesc + * A control is a visible widget with a DOM element in a fixed position on the + * screen. They can involve user input (buttons), or be informational only; + * the position is determined using CSS. By default these are placed in the + * container with CSS class name `ol-overlaycontainer-stopevent`, but can use + * any outside DOM element. + * + * This is the base class for controls. You can use it for simple custom + * controls by creating the element with listeners, creating an instance: + * ```js + * var myControl = new Control({element: myElement}); + * ``` + * and then adding this to the map. + * + * The main advantage of having this as a control rather than a simple separate + * DOM element is that preventing propagation is handled for you. Controls + * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods. + * + * You can also extend this base for your own control class. See + * examples/custom-controls for an example of how to do this. + * + * @api + */ +var Control = /** @class */ (function (_super) { + Control_extends(Control, _super); + /** + * @param {Options} options Control options. + */ + function Control(options) { + var _this = _super.call(this) || this; + var element = options.element; + if (element && !options.target && !element.style.pointerEvents) { + element.style.pointerEvents = 'auto'; + } + /** + * @protected + * @type {HTMLElement} + */ + _this.element = element ? element : null; + /** + * @private + * @type {HTMLElement} + */ + _this.target_ = null; + /** + * @private + * @type {import("../PluggableMap.js").default|null} + */ + _this.map_ = null; + /** + * @protected + * @type {!Array} + */ + _this.listenerKeys = []; + if (options.render) { + _this.render = options.render; + } + if (options.target) { + _this.setTarget(options.target); + } + return _this; + } + /** + * Clean up. + */ + Control.prototype.disposeInternal = function () { + removeNode(this.element); + _super.prototype.disposeInternal.call(this); + }; + /** + * Get the map associated with this control. + * @return {import("../PluggableMap.js").default|null} Map. + * @api + */ + Control.prototype.getMap = function () { + return this.map_; + }; + /** + * Remove the control from its current map and attach it to the new map. + * Pass `null` to just remove the control from the current map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default|null} map Map. + * @api + */ + Control.prototype.setMap = function (map) { + if (this.map_) { + removeNode(this.element); + } + for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) { + unlistenByKey(this.listenerKeys[i]); + } + this.listenerKeys.length = 0; + this.map_ = map; + if (map) { + var target = this.target_ + ? this.target_ + : map.getOverlayContainerStopEvent(); + target.appendChild(this.element); + if (this.render !== VOID) { + this.listenerKeys.push(listen(map, MapEventType.POSTRENDER, this.render, this)); + } + map.render(); + } + }; + /** + * Renders the control. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @api + */ + Control.prototype.render = function (mapEvent) { }; + /** + * This function is used to set a target element for the control. It has no + * effect if it is called after the control has been added to the map (i.e. + * after `setMap` is called on the control). If no `target` is set in the + * options passed to the control constructor and if `setTarget` is not called + * then the control is added to the map's overlay container. + * @param {HTMLElement|string} target Target. + * @api + */ + Control.prototype.setTarget = function (target) { + this.target_ = + typeof target === 'string' ? document.getElementById(target) : target; + }; + return Control; +}(ol_Object)); +/* harmony default export */ var control_Control = (Control); +//# sourceMappingURL=Control.js.map +;// CONCATENATED MODULE: ./node_modules/ol/css.js +/** + * @module ol/css + */ +/** + * @typedef {Object} FontParameters + * @property {string} style Style. + * @property {string} variant Variant. + * @property {string} weight Weight. + * @property {string} size Size. + * @property {string} lineHeight LineHeight. + * @property {string} family Family. + * @property {Array} families Families. + */ +/** + * The CSS class for hidden feature. + * + * @const + * @type {string} + */ +var CLASS_HIDDEN = 'ol-hidden'; +/** + * The CSS class that we'll give the DOM elements to have them selectable. + * + * @const + * @type {string} + */ +var CLASS_SELECTABLE = 'ol-selectable'; +/** + * The CSS class that we'll give the DOM elements to have them unselectable. + * + * @const + * @type {string} + */ +var CLASS_UNSELECTABLE = 'ol-unselectable'; +/** + * The CSS class for unsupported feature. + * + * @const + * @type {string} + */ +var CLASS_UNSUPPORTED = 'ol-unsupported'; +/** + * The CSS class for controls. + * + * @const + * @type {string} + */ +var CLASS_CONTROL = 'ol-control'; +/** + * The CSS class that we'll give the DOM elements that are collapsed, i.e. + * to those elements which usually can be expanded. + * + * @const + * @type {string} + */ +var CLASS_COLLAPSED = 'ol-collapsed'; +/** + * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font + * @type {RegExp} + */ +var fontRegEx = new RegExp([ + '^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)', + '(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)', + '(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)', + '(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?', + '(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))', + '(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))', + '?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$', +].join(''), 'i'); +var fontRegExMatchIndex = [ + 'style', + 'variant', + 'weight', + 'size', + 'lineHeight', + 'family', +]; +/** + * Get the list of font families from a font spec. Note that this doesn't work + * for font families that have commas in them. + * @param {string} fontSpec The CSS font property. + * @return {FontParameters|null} The font parameters (or null if the input spec is invalid). + */ +var getFontParameters = function (fontSpec) { + var match = fontSpec.match(fontRegEx); + if (!match) { + return null; + } + var style = /** @type {FontParameters} */ ({ + lineHeight: 'normal', + size: '1.2em', + style: 'normal', + weight: 'normal', + variant: 'normal', + }); + for (var i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) { + var value = match[i + 1]; + if (value !== undefined) { + style[fontRegExMatchIndex[i]] = value; + } + } + style.families = style.family.split(/,\s?/); + return style; +}; +//# sourceMappingURL=css.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/Property.js +/** + * @module ol/layer/Property + */ +/** + * @enum {string} + */ +/* harmony default export */ var Property = ({ + OPACITY: 'opacity', + VISIBLE: 'visible', + EXTENT: 'extent', + Z_INDEX: 'zIndex', + MAX_RESOLUTION: 'maxResolution', + MIN_RESOLUTION: 'minResolution', + MAX_ZOOM: 'maxZoom', + MIN_ZOOM: 'minZoom', + SOURCE: 'source', + MAP: 'map', +}); +//# sourceMappingURL=Property.js.map +;// CONCATENATED MODULE: ./node_modules/ol/AssertionError.js +var AssertionError_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/AssertionError + */ + +/** + * Error object thrown when an assertion failed. This is an ECMA-262 Error, + * extended with a `code` property. + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error. + */ +var AssertionError = /** @class */ (function (_super) { + AssertionError_extends(AssertionError, _super); + /** + * @param {number} code Error code. + */ + function AssertionError(code) { + var _this = this; + var path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0]; + var message = 'Assertion failed. See https://openlayers.org/en/' + + path + + '/doc/errors/#' + + code + + ' for details.'; + _this = _super.call(this, message) || this; + /** + * Error code. The meaning of the code can be found on + * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with + * the version found in the OpenLayers script's header comment if a version + * other than the latest is used). + * @type {number} + * @api + */ + _this.code = code; + /** + * @type {string} + */ + _this.name = 'AssertionError'; + // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40 + _this.message = message; + return _this; + } + return AssertionError; +}(Error)); +/* harmony default export */ var ol_AssertionError = (AssertionError); +//# sourceMappingURL=AssertionError.js.map +;// CONCATENATED MODULE: ./node_modules/ol/asserts.js +/** + * @module ol/asserts + */ + +/** + * @param {*} assertion Assertion we expected to be truthy. + * @param {number} errorCode Error code. + */ +function asserts_assert(assertion, errorCode) { + if (!assertion) { + throw new ol_AssertionError(errorCode); + } +} +//# sourceMappingURL=asserts.js.map +;// CONCATENATED MODULE: ./node_modules/ol/math.js +/** + * @module ol/math + */ +/** + * Takes a number and clamps it to within the provided bounds. + * @param {number} value The input number. + * @param {number} min The minimum value to return. + * @param {number} max The maximum value to return. + * @return {number} The input number if it is within bounds, or the nearest + * number within the bounds. + */ +function math_clamp(value, min, max) { + return Math.min(Math.max(value, min), max); +} +/** + * Return the hyperbolic cosine of a given number. The method will use the + * native `Math.cosh` function if it is available, otherwise the hyperbolic + * cosine will be calculated via the reference implementation of the Mozilla + * developer network. + * + * @param {number} x X. + * @return {number} Hyperbolic cosine of x. + */ +var cosh = (function () { + // Wrapped in a iife, to save the overhead of checking for the native + // implementation on every invocation. + var cosh; + if ('cosh' in Math) { + // The environment supports the native Math.cosh function, use it… + cosh = Math.cosh; + } + else { + // … else, use the reference implementation of MDN: + cosh = function (x) { + var y = /** @type {Math} */ (Math).exp(x); + return (y + 1 / y) / 2; + }; + } + return cosh; +})(); +/** + * Return the base 2 logarithm of a given number. The method will use the + * native `Math.log2` function if it is available, otherwise the base 2 + * logarithm will be calculated via the reference implementation of the + * Mozilla developer network. + * + * @param {number} x X. + * @return {number} Base 2 logarithm of x. + */ +var log2 = (function () { + // Wrapped in a iife, to save the overhead of checking for the native + // implementation on every invocation. + var log2; + if ('log2' in Math) { + // The environment supports the native Math.log2 function, use it… + log2 = Math.log2; + } + else { + // … else, use the reference implementation of MDN: + log2 = function (x) { + return Math.log(x) * Math.LOG2E; + }; + } + return log2; +})(); +/** + * Returns the square of the closest distance between the point (x, y) and the + * line segment (x1, y1) to (x2, y2). + * @param {number} x X. + * @param {number} y Y. + * @param {number} x1 X1. + * @param {number} y1 Y1. + * @param {number} x2 X2. + * @param {number} y2 Y2. + * @return {number} Squared distance. + */ +function squaredSegmentDistance(x, y, x1, y1, x2, y2) { + var dx = x2 - x1; + var dy = y2 - y1; + if (dx !== 0 || dy !== 0) { + var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); + if (t > 1) { + x1 = x2; + y1 = y2; + } + else if (t > 0) { + x1 += dx * t; + y1 += dy * t; + } + } + return math_squaredDistance(x, y, x1, y1); +} +/** + * Returns the square of the distance between the points (x1, y1) and (x2, y2). + * @param {number} x1 X1. + * @param {number} y1 Y1. + * @param {number} x2 X2. + * @param {number} y2 Y2. + * @return {number} Squared distance. + */ +function math_squaredDistance(x1, y1, x2, y2) { + var dx = x2 - x1; + var dy = y2 - y1; + return dx * dx + dy * dy; +} +/** + * Solves system of linear equations using Gaussian elimination method. + * + * @param {Array>} mat Augmented matrix (n x n + 1 column) + * in row-major order. + * @return {Array} The resulting vector. + */ +function solveLinearSystem(mat) { + var n = mat.length; + for (var i = 0; i < n; i++) { + // Find max in the i-th column (ignoring i - 1 first rows) + var maxRow = i; + var maxEl = Math.abs(mat[i][i]); + for (var r = i + 1; r < n; r++) { + var absValue = Math.abs(mat[r][i]); + if (absValue > maxEl) { + maxEl = absValue; + maxRow = r; + } + } + if (maxEl === 0) { + return null; // matrix is singular + } + // Swap max row with i-th (current) row + var tmp = mat[maxRow]; + mat[maxRow] = mat[i]; + mat[i] = tmp; + // Subtract the i-th row to make all the remaining rows 0 in the i-th column + for (var j = i + 1; j < n; j++) { + var coef = -mat[j][i] / mat[i][i]; + for (var k = i; k < n + 1; k++) { + if (i == k) { + mat[j][k] = 0; + } + else { + mat[j][k] += coef * mat[i][k]; + } + } + } + } + // Solve Ax=b for upper triangular matrix A (mat) + var x = new Array(n); + for (var l = n - 1; l >= 0; l--) { + x[l] = mat[l][n] / mat[l][l]; + for (var m = l - 1; m >= 0; m--) { + mat[m][n] -= mat[m][l] * x[l]; + } + } + return x; +} +/** + * Converts radians to to degrees. + * + * @param {number} angleInRadians Angle in radians. + * @return {number} Angle in degrees. + */ +function math_toDegrees(angleInRadians) { + return (angleInRadians * 180) / Math.PI; +} +/** + * Converts degrees to radians. + * + * @param {number} angleInDegrees Angle in degrees. + * @return {number} Angle in radians. + */ +function math_toRadians(angleInDegrees) { + return (angleInDegrees * Math.PI) / 180; +} +/** + * Returns the modulo of a / b, depending on the sign of b. + * + * @param {number} a Dividend. + * @param {number} b Divisor. + * @return {number} Modulo. + */ +function math_modulo(a, b) { + var r = a % b; + return r * b < 0 ? r + b : r; +} +/** + * Calculates the linearly interpolated value of x between a and b. + * + * @param {number} a Number + * @param {number} b Number + * @param {number} x Value to be interpolated. + * @return {number} Interpolated value. + */ +function lerp(a, b, x) { + return a + x * (b - a); +} +/** + * Returns a number with a limited number of decimal digits. + * @param {number} n The input number. + * @param {number} decimals The maximum number of decimal digits. + * @return {number} The input number with a limited number of decimal digits. + */ +function toFixed(n, decimals) { + var factor = Math.pow(10, decimals); + return Math.round(n * factor) / factor; +} +/** + * Rounds a number to the nearest integer value considering only the given number + * of decimal digits (with rounding on the final digit). + * @param {number} n The input number. + * @param {number} decimals The maximum number of decimal digits. + * @return {number} The nearest integer. + */ +function round(n, decimals) { + return Math.round(toFixed(n, decimals)); +} +/** + * Rounds a number to the next smaller integer considering only the given number + * of decimal digits (with rounding on the final digit). + * @param {number} n The input number. + * @param {number} decimals The maximum number of decimal digits. + * @return {number} The next smaller integer. + */ +function floor(n, decimals) { + return Math.floor(toFixed(n, decimals)); +} +/** + * Rounds a number to the next bigger integer considering only the given number + * of decimal digits (with rounding on the final digit). + * @param {number} n The input number. + * @param {number} decimals The maximum number of decimal digits. + * @return {number} The next bigger integer. + */ +function ceil(n, decimals) { + return Math.ceil(toFixed(n, decimals)); +} +//# sourceMappingURL=math.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/Base.js +var Base_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/layer/Base + */ + + + + + + +/** + * A css color, or a function called with a view resolution returning a css color. + * + * @typedef {string|function(number):string} BackgroundColor + * @api + */ +/** + * @typedef {import("../ObjectEventType").Types|'change:extent'|'change:maxResolution'|'change:maxZoom'| + * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes + */ +/*** + * @template Return + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} BaseLayerOnSignature + */ +/** + * @typedef {Object} Options + * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. + * @property {number} [opacity=1] Opacity (0, 1). + * @property {boolean} [visible=true] Visibility. + * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be + * rendered outside of this extent. + * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers + * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed + * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()` + * method was used. + * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be + * visible. + * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will + * be visible. + * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be + * visible. + * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will + * be visible. + * @property {BackgroundColor} [background] Background color for the layer. If not specified, no background + * will be rendered. + * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`. + */ +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Note that with {@link module:ol/layer/Base~BaseLayer} and all its subclasses, any property set in + * the options is set as a {@link module:ol/Object~BaseObject} property on the layer object, so + * is observable, and has get/set accessors. + * + * @api + */ +var BaseLayer = /** @class */ (function (_super) { + Base_extends(BaseLayer, _super); + /** + * @param {Options} options Layer options. + */ + function BaseLayer(options) { + var _this = _super.call(this) || this; + /*** + * @type {BaseLayerOnSignature} + */ + _this.on; + /*** + * @type {BaseLayerOnSignature} + */ + _this.once; + /*** + * @type {BaseLayerOnSignature} + */ + _this.un; + /** + * @type {BackgroundColor|false} + * @private + */ + _this.background_ = options.background; + /** + * @type {Object} + */ + var properties = obj_assign({}, options); + if (typeof options.properties === 'object') { + delete properties.properties; + obj_assign(properties, options.properties); + } + properties[Property.OPACITY] = + options.opacity !== undefined ? options.opacity : 1; + asserts_assert(typeof properties[Property.OPACITY] === 'number', 64); // Layer opacity must be a number + properties[Property.VISIBLE] = + options.visible !== undefined ? options.visible : true; + properties[Property.Z_INDEX] = options.zIndex; + properties[Property.MAX_RESOLUTION] = + options.maxResolution !== undefined ? options.maxResolution : Infinity; + properties[Property.MIN_RESOLUTION] = + options.minResolution !== undefined ? options.minResolution : 0; + properties[Property.MIN_ZOOM] = + options.minZoom !== undefined ? options.minZoom : -Infinity; + properties[Property.MAX_ZOOM] = + options.maxZoom !== undefined ? options.maxZoom : Infinity; + /** + * @type {string} + * @private + */ + _this.className_ = + properties.className !== undefined ? properties.className : 'ol-layer'; + delete properties.className; + _this.setProperties(properties); + /** + * @type {import("./Layer.js").State} + * @private + */ + _this.state_ = null; + return _this; + } + /** + * Get the background for this layer. + * @return {BackgroundColor|false} Layer background. + */ + BaseLayer.prototype.getBackground = function () { + return this.background_; + }; + /** + * @return {string} CSS class name. + */ + BaseLayer.prototype.getClassName = function () { + return this.className_; + }; + /** + * This method is not meant to be called by layers or layer renderers because the state + * is incorrect if the layer is included in a layer group. + * + * @param {boolean} [opt_managed] Layer is managed. + * @return {import("./Layer.js").State} Layer state. + */ + BaseLayer.prototype.getLayerState = function (opt_managed) { + /** @type {import("./Layer.js").State} */ + var state = this.state_ || + /** @type {?} */ ({ + layer: this, + managed: opt_managed === undefined ? true : opt_managed, + }); + var zIndex = this.getZIndex(); + state.opacity = math_clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1); + state.visible = this.getVisible(); + state.extent = this.getExtent(); + state.zIndex = zIndex === undefined && !state.managed ? Infinity : zIndex; + state.maxResolution = this.getMaxResolution(); + state.minResolution = Math.max(this.getMinResolution(), 0); + state.minZoom = this.getMinZoom(); + state.maxZoom = this.getMaxZoom(); + this.state_ = state; + return state; + }; + /** + * @abstract + * @param {Array} [opt_array] Array of layers (to be + * modified in place). + * @return {Array} Array of layers. + */ + BaseLayer.prototype.getLayersArray = function (opt_array) { + return util_abstract(); + }; + /** + * @abstract + * @param {Array} [opt_states] Optional list of layer + * states (to be modified in place). + * @return {Array} List of layer states. + */ + BaseLayer.prototype.getLayerStatesArray = function (opt_states) { + return util_abstract(); + }; + /** + * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it + * will be visible regardless of extent. + * @return {import("../extent.js").Extent|undefined} The layer extent. + * @observable + * @api + */ + BaseLayer.prototype.getExtent = function () { + return /** @type {import("../extent.js").Extent|undefined} */ (this.get(Property.EXTENT)); + }; + /** + * Return the maximum resolution of the layer. + * @return {number} The maximum resolution of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getMaxResolution = function () { + return /** @type {number} */ (this.get(Property.MAX_RESOLUTION)); + }; + /** + * Return the minimum resolution of the layer. + * @return {number} The minimum resolution of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getMinResolution = function () { + return /** @type {number} */ (this.get(Property.MIN_RESOLUTION)); + }; + /** + * Return the minimum zoom level of the layer. + * @return {number} The minimum zoom level of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getMinZoom = function () { + return /** @type {number} */ (this.get(Property.MIN_ZOOM)); + }; + /** + * Return the maximum zoom level of the layer. + * @return {number} The maximum zoom level of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getMaxZoom = function () { + return /** @type {number} */ (this.get(Property.MAX_ZOOM)); + }; + /** + * Return the opacity of the layer (between 0 and 1). + * @return {number} The opacity of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getOpacity = function () { + return /** @type {number} */ (this.get(Property.OPACITY)); + }; + /** + * @abstract + * @return {import("../source/Source.js").State} Source state. + */ + BaseLayer.prototype.getSourceState = function () { + return util_abstract(); + }; + /** + * Return the visibility of the layer (`true` or `false`). + * @return {boolean} The visibility of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getVisible = function () { + return /** @type {boolean} */ (this.get(Property.VISIBLE)); + }; + /** + * Return the Z-index of the layer, which is used to order layers before + * rendering. The default Z-index is 0. + * @return {number} The Z-index of the layer. + * @observable + * @api + */ + BaseLayer.prototype.getZIndex = function () { + return /** @type {number} */ (this.get(Property.Z_INDEX)); + }; + /** + * Sets the background color. + * @param {BackgroundColor} [opt_background] Background color. + */ + BaseLayer.prototype.setBackground = function (opt_background) { + this.background_ = opt_background; + this.changed(); + }; + /** + * Set the extent at which the layer is visible. If `undefined`, the layer + * will be visible at all extents. + * @param {import("../extent.js").Extent|undefined} extent The extent of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setExtent = function (extent) { + this.set(Property.EXTENT, extent); + }; + /** + * Set the maximum resolution at which the layer is visible. + * @param {number} maxResolution The maximum resolution of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setMaxResolution = function (maxResolution) { + this.set(Property.MAX_RESOLUTION, maxResolution); + }; + /** + * Set the minimum resolution at which the layer is visible. + * @param {number} minResolution The minimum resolution of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setMinResolution = function (minResolution) { + this.set(Property.MIN_RESOLUTION, minResolution); + }; + /** + * Set the maximum zoom (exclusive) at which the layer is visible. + * Note that the zoom levels for layer visibility are based on the + * view zoom level, which may be different from a tile source zoom level. + * @param {number} maxZoom The maximum zoom of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setMaxZoom = function (maxZoom) { + this.set(Property.MAX_ZOOM, maxZoom); + }; + /** + * Set the minimum zoom (inclusive) at which the layer is visible. + * Note that the zoom levels for layer visibility are based on the + * view zoom level, which may be different from a tile source zoom level. + * @param {number} minZoom The minimum zoom of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setMinZoom = function (minZoom) { + this.set(Property.MIN_ZOOM, minZoom); + }; + /** + * Set the opacity of the layer, allowed values range from 0 to 1. + * @param {number} opacity The opacity of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setOpacity = function (opacity) { + asserts_assert(typeof opacity === 'number', 64); // Layer opacity must be a number + this.set(Property.OPACITY, opacity); + }; + /** + * Set the visibility of the layer (`true` or `false`). + * @param {boolean} visible The visibility of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setVisible = function (visible) { + this.set(Property.VISIBLE, visible); + }; + /** + * Set Z-index of the layer, which is used to order layers before rendering. + * The default Z-index is 0. + * @param {number} zindex The z-index of the layer. + * @observable + * @api + */ + BaseLayer.prototype.setZIndex = function (zindex) { + this.set(Property.Z_INDEX, zindex); + }; + /** + * Clean up. + */ + BaseLayer.prototype.disposeInternal = function () { + if (this.state_) { + this.state_.layer = null; + this.state_ = null; + } + _super.prototype.disposeInternal.call(this); + }; + return BaseLayer; +}(ol_Object)); +/* harmony default export */ var Base = (BaseLayer); +//# sourceMappingURL=Base.js.map +;// CONCATENATED MODULE: ./node_modules/ol/render/EventType.js +/** + * @module ol/render/EventType + */ +/** + * @enum {string} + */ +/* harmony default export */ var render_EventType = ({ + /** + * Triggered before a layer is rendered. + * @event module:ol/render/Event~RenderEvent#prerender + * @api + */ + PRERENDER: 'prerender', + /** + * Triggered after a layer is rendered. + * @event module:ol/render/Event~RenderEvent#postrender + * @api + */ + POSTRENDER: 'postrender', + /** + * Triggered before layers are composed. When dispatched by the map, the event object will not have + * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only + * WebGL layers currently dispatch this event. + * @event module:ol/render/Event~RenderEvent#precompose + * @api + */ + PRECOMPOSE: 'precompose', + /** + * Triggered after layers are composed. When dispatched by the map, the event object will not have + * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only + * WebGL layers currently dispatch this event. + * @event module:ol/render/Event~RenderEvent#postcompose + * @api + */ + POSTCOMPOSE: 'postcompose', + /** + * Triggered when rendering is complete, i.e. all sources and tiles have + * finished loading for the current viewport, and all tiles are faded in. + * The event object will not have a `context` set. + * @event module:ol/render/Event~RenderEvent#rendercomplete + * @api + */ + RENDERCOMPLETE: 'rendercomplete', +}); +/** + * @typedef {'postrender'|'precompose'|'postcompose'|'rendercomplete'} MapRenderEventTypes + */ +/** + * @typedef {'postrender'|'prerender'} LayerRenderEventTypes + */ +//# sourceMappingURL=EventType.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/Layer.js +var Layer_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/layer/Layer + */ + + + + + + + +/** + * @typedef {function(import("../PluggableMap.js").FrameState):HTMLElement} RenderFunction + */ +/*** + * @template Return + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} LayerOnSignature + */ +/** + * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default] + * @typedef {Object} Options + * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. + * @property {number} [opacity=1] Opacity (0, 1). + * @property {boolean} [visible=true] Visibility. + * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be + * rendered outside of this extent. + * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers + * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed + * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()` + * method was used. + * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be + * visible. + * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will + * be visible. + * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be + * visible. + * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will + * be visible. + * @property {SourceType} [source] Source for this layer. If not provided to the constructor, + * the source can be set by calling {@link module:ol/layer/Layer~Layer#setSource layer.setSource(source)} after + * construction. + * @property {import("../PluggableMap.js").default|null} [map] Map. + * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an + * HTML element. Will overwrite the default rendering for the layer. + * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`. + */ +/** + * @typedef {Object} State + * @property {import("./Layer.js").default} layer Layer. + * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point. + * @property {boolean} visible Visible. + * @property {boolean} managed Managed. + * @property {import("../extent.js").Extent} [extent] Extent. + * @property {number} zIndex ZIndex. + * @property {number} maxResolution Maximum resolution. + * @property {number} minResolution Minimum resolution. + * @property {number} minZoom Minimum zoom. + * @property {number} maxZoom Maximum zoom. + */ +/** + * @classdesc + * Base class from which all layer types are derived. This should only be instantiated + * in the case where a custom layer is added to the map with a custom `render` function. + * Such a function can be specified in the `options` object, and is expected to return an HTML element. + * + * A visual representation of raster or vector map data. + * Layers group together those properties that pertain to how the data is to be + * displayed, irrespective of the source of that data. + * + * Layers are usually added to a map with {@link import("../PluggableMap.js").default#addLayer map.addLayer()}. Components + * like {@link module:ol/interaction/Draw~Draw} use unmanaged layers + * internally. These unmanaged layers are associated with the map using + * {@link module:ol/layer/Layer~Layer#setMap} instead. + * + * A generic `change` event is fired when the state of the source changes. + * + * Please note that for performance reasons several layers might get rendered to + * the same HTML element, which will cause {@link import("../PluggableMap.js").default#forEachLayerAtPixel map.forEachLayerAtPixel()} to + * give false positives. To avoid this, apply different `className` properties to the + * layers at creation time. + * + * @fires import("../render/Event.js").RenderEvent#prerender + * @fires import("../render/Event.js").RenderEvent#postrender + * + * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default] + * @template {import("../renderer/Layer.js").default} [RendererType=import("../renderer/Layer.js").default] + * @api + */ +var Layer = /** @class */ (function (_super) { + Layer_extends(Layer, _super); + /** + * @param {Options} options Layer options. + */ + function Layer(options) { + var _this = this; + var baseOptions = obj_assign({}, options); + delete baseOptions.source; + _this = _super.call(this, baseOptions) || this; + /*** + * @type {LayerOnSignature} + */ + _this.on; + /*** + * @type {LayerOnSignature} + */ + _this.once; + /*** + * @type {LayerOnSignature} + */ + _this.un; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.mapPrecomposeKey_ = null; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.mapRenderKey_ = null; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.sourceChangeKey_ = null; + /** + * @private + * @type {RendererType} + */ + _this.renderer_ = null; + /** + * @protected + * @type {boolean} + */ + _this.rendered = false; + // Overwrite default render method with a custom one + if (options.render) { + _this.render = options.render; + } + if (options.map) { + _this.setMap(options.map); + } + _this.addChangeListener(Property.SOURCE, _this.handleSourcePropertyChange_); + var source = options.source + ? /** @type {SourceType} */ (options.source) + : null; + _this.setSource(source); + return _this; + } + /** + * @param {Array} [opt_array] Array of layers (to be modified in place). + * @return {Array} Array of layers. + */ + Layer.prototype.getLayersArray = function (opt_array) { + var array = opt_array ? opt_array : []; + array.push(this); + return array; + }; + /** + * @param {Array} [opt_states] Optional list of layer states (to be modified in place). + * @return {Array} List of layer states. + */ + Layer.prototype.getLayerStatesArray = function (opt_states) { + var states = opt_states ? opt_states : []; + states.push(this.getLayerState()); + return states; + }; + /** + * Get the layer source. + * @return {SourceType|null} The layer source (or `null` if not yet set). + * @observable + * @api + */ + Layer.prototype.getSource = function () { + return /** @type {SourceType} */ (this.get(Property.SOURCE)) || null; + }; + /** + * @return {SourceType|null} The source being rendered. + */ + Layer.prototype.getRenderSource = function () { + return this.getSource(); + }; + /** + * @return {import("../source/Source.js").State} Source state. + */ + Layer.prototype.getSourceState = function () { + var source = this.getSource(); + return !source ? 'undefined' : source.getState(); + }; + /** + * @private + */ + Layer.prototype.handleSourceChange_ = function () { + this.changed(); + }; + /** + * @private + */ + Layer.prototype.handleSourcePropertyChange_ = function () { + if (this.sourceChangeKey_) { + unlistenByKey(this.sourceChangeKey_); + this.sourceChangeKey_ = null; + } + var source = this.getSource(); + if (source) { + this.sourceChangeKey_ = listen(source, EventType.CHANGE, this.handleSourceChange_, this); + } + this.changed(); + }; + /** + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with + * an array of features. + */ + Layer.prototype.getFeatures = function (pixel) { + if (!this.renderer_) { + return new Promise(function (resolve) { return resolve([]); }); + } + return this.renderer_.getFeatures(pixel); + }; + /** + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data. + */ + Layer.prototype.getData = function (pixel) { + if (!this.renderer_ || !this.rendered) { + return null; + } + return this.renderer_.getData(pixel); + }; + /** + * In charge to manage the rendering of the layer. One layer type is + * bounded with one layer renderer. + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target which the renderer may (but need not) use + * for rendering its content. + * @return {HTMLElement} The rendered element. + */ + Layer.prototype.render = function (frameState, target) { + var layerRenderer = this.getRenderer(); + if (layerRenderer.prepareFrame(frameState)) { + this.rendered = true; + return layerRenderer.renderFrame(frameState, target); + } + }; + /** + * Called when a layer is not visible during a map render. + */ + Layer.prototype.unrender = function () { + this.rendered = false; + }; + /** + * For use inside the library only. + * @param {import("../PluggableMap.js").default|null} map Map. + */ + Layer.prototype.setMapInternal = function (map) { + if (!map) { + this.unrender(); + } + this.set(Property.MAP, map); + }; + /** + * For use inside the library only. + * @return {import("../PluggableMap.js").default|null} Map. + */ + Layer.prototype.getMapInternal = function () { + return this.get(Property.MAP); + }; + /** + * Sets the layer to be rendered on top of other layers on a map. The map will + * not manage this layer in its layers collection, and the callback in + * {@link module:ol/Map~Map#forEachLayerAtPixel} will receive `null` as layer. This + * is useful for temporary layers. To remove an unmanaged layer from the map, + * use `#setMap(null)`. + * + * To add the layer to a map and have it managed by the map, use + * {@link module:ol/Map~Map#addLayer} instead. + * @param {import("../PluggableMap.js").default|null} map Map. + * @api + */ + Layer.prototype.setMap = function (map) { + if (this.mapPrecomposeKey_) { + unlistenByKey(this.mapPrecomposeKey_); + this.mapPrecomposeKey_ = null; + } + if (!map) { + this.changed(); + } + if (this.mapRenderKey_) { + unlistenByKey(this.mapRenderKey_); + this.mapRenderKey_ = null; + } + if (map) { + this.mapPrecomposeKey_ = listen(map, render_EventType.PRECOMPOSE, function (evt) { + var renderEvent = + /** @type {import("../render/Event.js").default} */ (evt); + var layerStatesArray = renderEvent.frameState.layerStatesArray; + var layerState = this.getLayerState(false); + // A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both. + asserts_assert(!layerStatesArray.some(function (arrayLayerState) { + return arrayLayerState.layer === layerState.layer; + }), 67); + layerStatesArray.push(layerState); + }, this); + this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map); + this.changed(); + } + }; + /** + * Set the layer source. + * @param {SourceType|null} source The layer source. + * @observable + * @api + */ + Layer.prototype.setSource = function (source) { + this.set(Property.SOURCE, source); + }; + /** + * Get the renderer for this layer. + * @return {RendererType|null} The layer renderer. + */ + Layer.prototype.getRenderer = function () { + if (!this.renderer_) { + this.renderer_ = this.createRenderer(); + } + return this.renderer_; + }; + /** + * @return {boolean} The layer has a renderer. + */ + Layer.prototype.hasRenderer = function () { + return !!this.renderer_; + }; + /** + * Create a renderer for this layer. + * @return {RendererType} A layer renderer. + * @protected + */ + Layer.prototype.createRenderer = function () { + return null; + }; + /** + * Clean up. + */ + Layer.prototype.disposeInternal = function () { + if (this.renderer_) { + this.renderer_.dispose(); + delete this.renderer_; + } + this.setSource(null); + _super.prototype.disposeInternal.call(this); + }; + return Layer; +}(Base)); +/** + * Return `true` if the layer is visible and if the provided view state + * has resolution and zoom levels that are in range of the layer's min/max. + * @param {State} layerState Layer state. + * @param {import("../View.js").State} viewState View state. + * @return {boolean} The layer is visible at the given view state. + */ +function inView(layerState, viewState) { + if (!layerState.visible) { + return false; + } + var resolution = viewState.resolution; + if (resolution < layerState.minResolution || + resolution >= layerState.maxResolution) { + return false; + } + var zoom = viewState.zoom; + return zoom > layerState.minZoom && zoom <= layerState.maxZoom; +} +/* harmony default export */ var layer_Layer = (Layer); +//# sourceMappingURL=Layer.js.map +;// CONCATENATED MODULE: ./node_modules/ol/control/Attribution.js +var Attribution_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/control/Attribution + */ + + + + + + +/** + * @typedef {Object} Options + * @property {string} [className='ol-attribution'] CSS class name. + * @property {HTMLElement|string} [target] Specify a target if you + * want the control to be rendered outside of the map's + * viewport. + * @property {boolean} [collapsible] Specify if attributions can + * be collapsed. If not specified, sources control this behavior with their + * `attributionsCollapsible` setting. + * @property {boolean} [collapsed=true] Specify if attributions should + * be collapsed at startup. + * @property {string} [tipLabel='Attributions'] Text label to use for the button tip. + * @property {string|HTMLElement} [label='i'] Text label to use for the + * collapsed attributions button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [expandClassName=className + '-expand'] CSS class name for the + * collapsed attributions button. + * @property {string|HTMLElement} [collapseLabel='›'] Text label to use + * for the expanded attributions button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the + * expanded attributions button. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when + * the control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + */ +/** + * @classdesc + * Control to show all the attributions associated with the layer sources + * in the map. This control is one of the default controls included in maps. + * By default it will show in the bottom right portion of the map, but this can + * be changed by using a css selector for `.ol-attribution`. + * + * @api + */ +var Attribution = /** @class */ (function (_super) { + Attribution_extends(Attribution, _super); + /** + * @param {Options} [opt_options] Attribution options. + */ + function Attribution(opt_options) { + var _this = this; + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render, + target: options.target, + }) || this; + /** + * @private + * @type {HTMLElement} + */ + _this.ulElement_ = document.createElement('ul'); + /** + * @private + * @type {boolean} + */ + _this.collapsed_ = + options.collapsed !== undefined ? options.collapsed : true; + /** + * @private + * @type {boolean} + */ + _this.userCollapsed_ = _this.collapsed_; + /** + * @private + * @type {boolean} + */ + _this.overrideCollapsible_ = options.collapsible !== undefined; + /** + * @private + * @type {boolean} + */ + _this.collapsible_ = + options.collapsible !== undefined ? options.collapsible : true; + if (!_this.collapsible_) { + _this.collapsed_ = false; + } + var className = options.className !== undefined ? options.className : 'ol-attribution'; + var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions'; + var expandClassName = options.expandClassName !== undefined + ? options.expandClassName + : className + '-expand'; + var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u203A'; + var collapseClassName = options.collapseClassName !== undefined + ? options.collapseClassName + : className + '-collapse'; + if (typeof collapseLabel === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.collapseLabel_ = document.createElement('span'); + _this.collapseLabel_.textContent = collapseLabel; + _this.collapseLabel_.className = collapseClassName; + } + else { + _this.collapseLabel_ = collapseLabel; + } + var label = options.label !== undefined ? options.label : 'i'; + if (typeof label === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.label_ = document.createElement('span'); + _this.label_.textContent = label; + _this.label_.className = expandClassName; + } + else { + _this.label_ = label; + } + var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_; + /** + * @private + * @type {HTMLElement} + */ + _this.toggleButton_ = document.createElement('button'); + _this.toggleButton_.setAttribute('type', 'button'); + _this.toggleButton_.setAttribute('aria-expanded', String(!_this.collapsed_)); + _this.toggleButton_.title = tipLabel; + _this.toggleButton_.appendChild(activeLabel); + _this.toggleButton_.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false); + var cssClasses = className + + ' ' + + CLASS_UNSELECTABLE + + ' ' + + CLASS_CONTROL + + (_this.collapsed_ && _this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') + + (_this.collapsible_ ? '' : ' ol-uncollapsible'); + var element = _this.element; + element.className = cssClasses; + element.appendChild(_this.toggleButton_); + element.appendChild(_this.ulElement_); + /** + * A list of currently rendered resolutions. + * @type {Array} + * @private + */ + _this.renderedAttributions_ = []; + /** + * @private + * @type {boolean} + */ + _this.renderedVisible_ = true; + return _this; + } + /** + * Collect a list of visible attributions and set the collapsible state. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @return {Array} Attributions. + * @private + */ + Attribution.prototype.collectSourceAttributions_ = function (frameState) { + /** + * Used to determine if an attribution already exists. + * @type {!Object} + */ + var lookup = {}; + /** + * A list of visible attributions. + * @type {Array} + */ + var visibleAttributions = []; + var collapsible = true; + var layerStatesArray = frameState.layerStatesArray; + for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { + var layerState = layerStatesArray[i]; + if (!inView(layerState, frameState.viewState)) { + continue; + } + var source = /** @type {import("../layer/Layer.js").default} */ (layerState.layer).getSource(); + if (!source) { + continue; + } + var attributionGetter = source.getAttributions(); + if (!attributionGetter) { + continue; + } + var attributions = attributionGetter(frameState); + if (!attributions) { + continue; + } + collapsible = + collapsible && source.getAttributionsCollapsible() !== false; + if (Array.isArray(attributions)) { + for (var j = 0, jj = attributions.length; j < jj; ++j) { + if (!(attributions[j] in lookup)) { + visibleAttributions.push(attributions[j]); + lookup[attributions[j]] = true; + } + } + } + else { + if (!(attributions in lookup)) { + visibleAttributions.push(attributions); + lookup[attributions] = true; + } + } + } + if (!this.overrideCollapsible_) { + this.setCollapsible(collapsible); + } + return visibleAttributions; + }; + /** + * @private + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + */ + Attribution.prototype.updateElement_ = function (frameState) { + if (!frameState) { + if (this.renderedVisible_) { + this.element.style.display = 'none'; + this.renderedVisible_ = false; + } + return; + } + var attributions = this.collectSourceAttributions_(frameState); + var visible = attributions.length > 0; + if (this.renderedVisible_ != visible) { + this.element.style.display = visible ? '' : 'none'; + this.renderedVisible_ = visible; + } + if (equals(attributions, this.renderedAttributions_)) { + return; + } + removeChildren(this.ulElement_); + // append the attributions + for (var i = 0, ii = attributions.length; i < ii; ++i) { + var element = document.createElement('li'); + element.innerHTML = attributions[i]; + this.ulElement_.appendChild(element); + } + this.renderedAttributions_ = attributions; + }; + /** + * @param {MouseEvent} event The event to handle + * @private + */ + Attribution.prototype.handleClick_ = function (event) { + event.preventDefault(); + this.handleToggle_(); + this.userCollapsed_ = this.collapsed_; + }; + /** + * @private + */ + Attribution.prototype.handleToggle_ = function () { + this.element.classList.toggle(CLASS_COLLAPSED); + if (this.collapsed_) { + replaceNode(this.collapseLabel_, this.label_); + } + else { + replaceNode(this.label_, this.collapseLabel_); + } + this.collapsed_ = !this.collapsed_; + this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_)); + }; + /** + * Return `true` if the attribution is collapsible, `false` otherwise. + * @return {boolean} True if the widget is collapsible. + * @api + */ + Attribution.prototype.getCollapsible = function () { + return this.collapsible_; + }; + /** + * Set whether the attribution should be collapsible. + * @param {boolean} collapsible True if the widget is collapsible. + * @api + */ + Attribution.prototype.setCollapsible = function (collapsible) { + if (this.collapsible_ === collapsible) { + return; + } + this.collapsible_ = collapsible; + this.element.classList.toggle('ol-uncollapsible'); + if (this.userCollapsed_) { + this.handleToggle_(); + } + }; + /** + * Collapse or expand the attribution according to the passed parameter. Will + * not do anything if the attribution isn't collapsible or if the current + * collapsed state is already the one requested. + * @param {boolean} collapsed True if the widget is collapsed. + * @api + */ + Attribution.prototype.setCollapsed = function (collapsed) { + this.userCollapsed_ = collapsed; + if (!this.collapsible_ || this.collapsed_ === collapsed) { + return; + } + this.handleToggle_(); + }; + /** + * Return `true` when the attribution is currently collapsed or `false` + * otherwise. + * @return {boolean} True if the widget is collapsed. + * @api + */ + Attribution.prototype.getCollapsed = function () { + return this.collapsed_; + }; + /** + * Update the attribution element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + Attribution.prototype.render = function (mapEvent) { + this.updateElement_(mapEvent.frameState); + }; + return Attribution; +}(control_Control)); +/* harmony default export */ var control_Attribution = (Attribution); +//# sourceMappingURL=Attribution.js.map +;// CONCATENATED MODULE: ./node_modules/ol/pointer/EventType.js +/** + * @module ol/pointer/EventType + */ +/** + * Constants for event names. + * @enum {string} + */ +/* harmony default export */ var pointer_EventType = ({ + POINTERMOVE: 'pointermove', + POINTERDOWN: 'pointerdown', + POINTERUP: 'pointerup', + POINTEROVER: 'pointerover', + POINTEROUT: 'pointerout', + POINTERENTER: 'pointerenter', + POINTERLEAVE: 'pointerleave', + POINTERCANCEL: 'pointercancel', +}); +//# sourceMappingURL=EventType.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/Units.js +/** + * @module ol/proj/Units + */ +/** + * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or + * `'us-ft'`. + * @enum {string} + */ +var Units = { + /** + * Radians + * @api + */ + RADIANS: 'radians', + /** + * Degrees + * @api + */ + DEGREES: 'degrees', + /** + * Feet + * @api + */ + FEET: 'ft', + /** + * Meters + * @api + */ + METERS: 'm', + /** + * Pixels + * @api + */ + PIXELS: 'pixels', + /** + * Tile Pixels + * @api + */ + TILE_PIXELS: 'tile-pixels', + /** + * US Feet + * @api + */ + USFEET: 'us-ft', +}; +/** + * See http://duff.ess.washington.edu/data/raster/drg/docs/geotiff.txt + * @type {Object} + */ +var unitByCode = { + '9001': Units.METERS, + '9002': Units.FEET, + '9003': Units.USFEET, + '9101': Units.RADIANS, + '9102': Units.DEGREES, +}; +/** + * @param {number} code Unit code. + * @return {Units} Units. + */ +function fromCode(code) { + return unitByCode[code]; +} +/** + * Meters per unit lookup table. + * @const + * @type {Object} + * @api + */ +var Units_METERS_PER_UNIT = {}; +// use the radius of the Normal sphere +Units_METERS_PER_UNIT[Units.RADIANS] = 6370997 / (2 * Math.PI); +Units_METERS_PER_UNIT[Units.DEGREES] = (2 * Math.PI * 6370997) / 360; +Units_METERS_PER_UNIT[Units.FEET] = 0.3048; +Units_METERS_PER_UNIT[Units.METERS] = 1; +Units_METERS_PER_UNIT[Units.USFEET] = 1200 / 3937; +/* harmony default export */ var proj_Units = (Units); +//# sourceMappingURL=Units.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/Projection.js +/** + * @module ol/proj/Projection + */ + +/** + * @typedef {Object} Options + * @property {string} code The SRS identifier code, e.g. `EPSG:4326`. + * @property {import("./Units.js").default|string} [units] Units. Required unless a + * proj4 projection is defined for `code`. + * @property {import("../extent.js").Extent} [extent] The validity extent for the SRS. + * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4. + * @property {boolean} [global=false] Whether the projection is valid for the whole globe. + * @property {number} [metersPerUnit] The meters per unit for the SRS. + * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT} + * lookup table. + * @property {import("../extent.js").Extent} [worldExtent] The world extent for the SRS. + * @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution] + * Function to determine resolution at a point. The function is called with a + * `number` view resolution and a {@link module:ol/coordinate~Coordinate Coordinate} as arguments, and returns + * the `number` resolution in projection units at the passed coordinate. If this is `undefined`, + * the default {@link module:ol/proj.getPointResolution getPointResolution()} function will be used. + */ +/** + * @classdesc + * Projection definition class. One of these is created for each projection + * supported in the application and stored in the {@link module:ol/proj} namespace. + * You can use these in applications, but this is not required, as API params + * and options use {@link module:ol/proj~ProjectionLike} which means the simple string + * code will suffice. + * + * You can use {@link module:ol/proj.get} to retrieve the object for a particular + * projection. + * + * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together + * with the following aliases: + * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, + * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84, + * http://www.opengis.net/gml/srs/epsg.xml#4326, + * urn:x-ogc:def:crs:EPSG:4326 + * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913, + * urn:ogc:def:crs:EPSG:6.18:3:3857, + * http://www.opengis.net/gml/srs/epsg.xml#3857 + * + * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can + * be added using `proj4.defs()`. After all required projection definitions are + * added, call the {@link module:ol/proj/proj4.register} function. + * + * @api + */ +var Projection = /** @class */ (function () { + /** + * @param {Options} options Projection options. + */ + function Projection(options) { + /** + * @private + * @type {string} + */ + this.code_ = options.code; + /** + * Units of projected coordinates. When set to `TILE_PIXELS`, a + * `this.extent_` and `this.worldExtent_` must be configured properly for each + * tile. + * @private + * @type {import("./Units.js").default} + */ + this.units_ = /** @type {import("./Units.js").default} */ (options.units); + /** + * Validity extent of the projection in projected coordinates. For projections + * with `TILE_PIXELS` units, this is the extent of the tile in + * tile pixel space. + * @private + * @type {import("../extent.js").Extent} + */ + this.extent_ = options.extent !== undefined ? options.extent : null; + /** + * Extent of the world in EPSG:4326. For projections with + * `TILE_PIXELS` units, this is the extent of the tile in + * projected coordinate space. + * @private + * @type {import("../extent.js").Extent} + */ + this.worldExtent_ = + options.worldExtent !== undefined ? options.worldExtent : null; + /** + * @private + * @type {string} + */ + this.axisOrientation_ = + options.axisOrientation !== undefined ? options.axisOrientation : 'enu'; + /** + * @private + * @type {boolean} + */ + this.global_ = options.global !== undefined ? options.global : false; + /** + * @private + * @type {boolean} + */ + this.canWrapX_ = !!(this.global_ && this.extent_); + /** + * @private + * @type {function(number, import("../coordinate.js").Coordinate):number|undefined} + */ + this.getPointResolutionFunc_ = options.getPointResolution; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + this.defaultTileGrid_ = null; + /** + * @private + * @type {number|undefined} + */ + this.metersPerUnit_ = options.metersPerUnit; + } + /** + * @return {boolean} The projection is suitable for wrapping the x-axis + */ + Projection.prototype.canWrapX = function () { + return this.canWrapX_; + }; + /** + * Get the code for this projection, e.g. 'EPSG:4326'. + * @return {string} Code. + * @api + */ + Projection.prototype.getCode = function () { + return this.code_; + }; + /** + * Get the validity extent for this projection. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + Projection.prototype.getExtent = function () { + return this.extent_; + }; + /** + * Get the units of this projection. + * @return {import("./Units.js").default} Units. + * @api + */ + Projection.prototype.getUnits = function () { + return this.units_; + }; + /** + * Get the amount of meters per unit of this projection. If the projection is + * not configured with `metersPerUnit` or a units identifier, the return is + * `undefined`. + * @return {number|undefined} Meters. + * @api + */ + Projection.prototype.getMetersPerUnit = function () { + return this.metersPerUnit_ || Units_METERS_PER_UNIT[this.units_]; + }; + /** + * Get the world extent for this projection. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + Projection.prototype.getWorldExtent = function () { + return this.worldExtent_; + }; + /** + * Get the axis orientation of this projection. + * Example values are: + * enu - the default easting, northing, elevation. + * neu - northing, easting, up - useful for "lat/long" geographic coordinates, + * or south orientated transverse mercator. + * wnu - westing, northing, up - some planetary coordinate systems have + * "west positive" coordinate systems + * @return {string} Axis orientation. + * @api + */ + Projection.prototype.getAxisOrientation = function () { + return this.axisOrientation_; + }; + /** + * Is this projection a global projection which spans the whole world? + * @return {boolean} Whether the projection is global. + * @api + */ + Projection.prototype.isGlobal = function () { + return this.global_; + }; + /** + * Set if the projection is a global projection which spans the whole world + * @param {boolean} global Whether the projection is global. + * @api + */ + Projection.prototype.setGlobal = function (global) { + this.global_ = global; + this.canWrapX_ = !!(global && this.extent_); + }; + /** + * @return {import("../tilegrid/TileGrid.js").default} The default tile grid. + */ + Projection.prototype.getDefaultTileGrid = function () { + return this.defaultTileGrid_; + }; + /** + * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid. + */ + Projection.prototype.setDefaultTileGrid = function (tileGrid) { + this.defaultTileGrid_ = tileGrid; + }; + /** + * Set the validity extent for this projection. + * @param {import("../extent.js").Extent} extent Extent. + * @api + */ + Projection.prototype.setExtent = function (extent) { + this.extent_ = extent; + this.canWrapX_ = !!(this.global_ && extent); + }; + /** + * Set the world extent for this projection. + * @param {import("../extent.js").Extent} worldExtent World extent + * [minlon, minlat, maxlon, maxlat]. + * @api + */ + Projection.prototype.setWorldExtent = function (worldExtent) { + this.worldExtent_ = worldExtent; + }; + /** + * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution} + * for this projection. + * @param {function(number, import("../coordinate.js").Coordinate):number} func Function + * @api + */ + Projection.prototype.setGetPointResolution = function (func) { + this.getPointResolutionFunc_ = func; + }; + /** + * Get the custom point resolution function for this projection (if set). + * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point + * resolution function (if set). + */ + Projection.prototype.getPointResolutionFunc = function () { + return this.getPointResolutionFunc_; + }; + return Projection; +}()); +/* harmony default export */ var proj_Projection = (Projection); +//# sourceMappingURL=Projection.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/epsg3857.js +var epsg3857_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/proj/epsg3857 + */ + + + +/** + * Radius of WGS84 sphere + * + * @const + * @type {number} + */ +var RADIUS = 6378137; +/** + * @const + * @type {number} + */ +var HALF_SIZE = Math.PI * RADIUS; +/** + * @const + * @type {import("../extent.js").Extent} + */ +var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE]; +/** + * @const + * @type {import("../extent.js").Extent} + */ +var WORLD_EXTENT = [-180, -85, 180, 85]; +/** + * Maximum safe value in y direction + * @const + * @type {number} + */ +var MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2)); +/** + * @classdesc + * Projection object for web/spherical Mercator (EPSG:3857). + */ +var EPSG3857Projection = /** @class */ (function (_super) { + epsg3857_extends(EPSG3857Projection, _super); + /** + * @param {string} code Code. + */ + function EPSG3857Projection(code) { + return _super.call(this, { + code: code, + units: proj_Units.METERS, + extent: EXTENT, + global: true, + worldExtent: WORLD_EXTENT, + getPointResolution: function (resolution, point) { + return resolution / cosh(point[1] / RADIUS); + }, + }) || this; + } + return EPSG3857Projection; +}(proj_Projection)); +/** + * Projections equal to EPSG:3857. + * + * @const + * @type {Array} + */ +var PROJECTIONS = [ + new EPSG3857Projection('EPSG:3857'), + new EPSG3857Projection('EPSG:102100'), + new EPSG3857Projection('EPSG:102113'), + new EPSG3857Projection('EPSG:900913'), + new EPSG3857Projection('http://www.opengis.net/def/crs/EPSG/0/3857'), + new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'), +]; +/** + * Transformation from EPSG:4326 to EPSG:3857. + * + * @param {Array} input Input array of coordinate values. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension (default is `2`). + * @return {Array} Output array of coordinate values. + */ +function fromEPSG4326(input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var output = opt_output; + if (output === undefined) { + if (dimension > 2) { + // preserve values beyond second dimension + output = input.slice(); + } + else { + output = new Array(length); + } + } + for (var i = 0; i < length; i += dimension) { + output[i] = (HALF_SIZE * input[i]) / 180; + var y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360)); + if (y > MAX_SAFE_Y) { + y = MAX_SAFE_Y; + } + else if (y < -MAX_SAFE_Y) { + y = -MAX_SAFE_Y; + } + output[i + 1] = y; + } + return output; +} +/** + * Transformation from EPSG:3857 to EPSG:4326. + * + * @param {Array} input Input array of coordinate values. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension (default is `2`). + * @return {Array} Output array of coordinate values. + */ +function toEPSG4326(input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var output = opt_output; + if (output === undefined) { + if (dimension > 2) { + // preserve values beyond second dimension + output = input.slice(); + } + else { + output = new Array(length); + } + } + for (var i = 0; i < length; i += dimension) { + output[i] = (180 * input[i]) / HALF_SIZE; + output[i + 1] = + (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90; + } + return output; +} +//# sourceMappingURL=epsg3857.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/epsg4326.js +var epsg4326_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/proj/epsg4326 + */ + + +/** + * Semi-major radius of the WGS84 ellipsoid. + * + * @const + * @type {number} + */ +var epsg4326_RADIUS = 6378137; +/** + * Extent of the EPSG:4326 projection which is the whole world. + * + * @const + * @type {import("../extent.js").Extent} + */ +var epsg4326_EXTENT = [-180, -90, 180, 90]; +/** + * @const + * @type {number} + */ +var epsg4326_METERS_PER_UNIT = (Math.PI * epsg4326_RADIUS) / 180; +/** + * @classdesc + * Projection object for WGS84 geographic coordinates (EPSG:4326). + * + * Note that OpenLayers does not strictly comply with the EPSG definition. + * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x). + * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates. + */ +var EPSG4326Projection = /** @class */ (function (_super) { + epsg4326_extends(EPSG4326Projection, _super); + /** + * @param {string} code Code. + * @param {string} [opt_axisOrientation] Axis orientation. + */ + function EPSG4326Projection(code, opt_axisOrientation) { + return _super.call(this, { + code: code, + units: proj_Units.DEGREES, + extent: epsg4326_EXTENT, + axisOrientation: opt_axisOrientation, + global: true, + metersPerUnit: epsg4326_METERS_PER_UNIT, + worldExtent: epsg4326_EXTENT, + }) || this; + } + return EPSG4326Projection; +}(proj_Projection)); +/** + * Projections equal to EPSG:4326. + * + * @const + * @type {Array} + */ +var epsg4326_PROJECTIONS = [ + new EPSG4326Projection('CRS:84'), + new EPSG4326Projection('EPSG:4326', 'neu'), + new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'), + new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'), + new EPSG4326Projection('http://www.opengis.net/def/crs/OGC/1.3/CRS84'), + new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), + new EPSG4326Projection('http://www.opengis.net/def/crs/EPSG/0/4326', 'neu'), +]; +//# sourceMappingURL=epsg4326.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/projections.js +/** + * @module ol/proj/projections + */ +/** + * @type {Object} + */ +var cache = {}; +/** + * Clear the projections cache. + */ +function projections_clear() { + cache = {}; +} +/** + * Get a cached projection by code. + * @param {string} code The code for the projection. + * @return {import("./Projection.js").default} The projection (if cached). + */ +function get(code) { + return (cache[code] || + cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, 'EPSG:$3')] || + null); +} +/** + * Add a projection to the cache. + * @param {string} code The projection code. + * @param {import("./Projection.js").default} projection The projection to cache. + */ +function add(code, projection) { + cache[code] = projection; +} +//# sourceMappingURL=projections.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj/transforms.js +/** + * @module ol/proj/transforms + */ + +/** + * @private + * @type {!Object>} + */ +var transforms = {}; +/** + * Clear the transform cache. + */ +function transforms_clear() { + transforms = {}; +} +/** + * Registers a conversion function to convert coordinates from the source + * projection to the destination projection. + * + * @param {import("./Projection.js").default} source Source. + * @param {import("./Projection.js").default} destination Destination. + * @param {import("../proj.js").TransformFunction} transformFn Transform. + */ +function transforms_add(source, destination, transformFn) { + var sourceCode = source.getCode(); + var destinationCode = destination.getCode(); + if (!(sourceCode in transforms)) { + transforms[sourceCode] = {}; + } + transforms[sourceCode][destinationCode] = transformFn; +} +/** + * Unregisters the conversion function to convert coordinates from the source + * projection to the destination projection. This method is used to clean up + * cached transforms during testing. + * + * @param {import("./Projection.js").default} source Source projection. + * @param {import("./Projection.js").default} destination Destination projection. + * @return {import("../proj.js").TransformFunction} transformFn The unregistered transform. + */ +function transforms_remove(source, destination) { + var sourceCode = source.getCode(); + var destinationCode = destination.getCode(); + var transform = transforms[sourceCode][destinationCode]; + delete transforms[sourceCode][destinationCode]; + if (isEmpty(transforms[sourceCode])) { + delete transforms[sourceCode]; + } + return transform; +} +/** + * Get a transform given a source code and a destination code. + * @param {string} sourceCode The code for the source projection. + * @param {string} destinationCode The code for the destination projection. + * @return {import("../proj.js").TransformFunction|undefined} The transform function (if found). + */ +function transforms_get(sourceCode, destinationCode) { + var transform; + if (sourceCode in transforms && destinationCode in transforms[sourceCode]) { + transform = transforms[sourceCode][destinationCode]; + } + return transform; +} +//# sourceMappingURL=transforms.js.map +;// CONCATENATED MODULE: ./node_modules/ol/extent/Relationship.js +/** + * @module ol/extent/Relationship + */ +/** + * Relationship to an extent. + * @enum {number} + */ +/* harmony default export */ var Relationship = ({ + UNKNOWN: 0, + INTERSECTING: 1, + ABOVE: 2, + RIGHT: 4, + BELOW: 8, + LEFT: 16, +}); +//# sourceMappingURL=Relationship.js.map +;// CONCATENATED MODULE: ./node_modules/ol/extent.js +/** + * @module ol/extent + */ + + +/** + * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. + * @typedef {Array} Extent + * @api + */ +/** + * Extent corner. + * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner + */ +/** + * Build an extent that includes all given coordinates. + * + * @param {Array} coordinates Coordinates. + * @return {Extent} Bounding extent. + * @api + */ +function boundingExtent(coordinates) { + var extent = createEmpty(); + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + extendCoordinate(extent, coordinates[i]); + } + return extent; +} +/** + * @param {Array} xs Xs. + * @param {Array} ys Ys. + * @param {Extent} [opt_extent] Destination extent. + * @private + * @return {Extent} Extent. + */ +function _boundingExtentXYs(xs, ys, opt_extent) { + var minX = Math.min.apply(null, xs); + var minY = Math.min.apply(null, ys); + var maxX = Math.max.apply(null, xs); + var maxY = Math.max.apply(null, ys); + return createOrUpdate(minX, minY, maxX, maxY, opt_extent); +} +/** + * Return extent increased by the provided value. + * @param {Extent} extent Extent. + * @param {number} value The amount by which the extent should be buffered. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + * @api + */ +function buffer(extent, value, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0] - value; + opt_extent[1] = extent[1] - value; + opt_extent[2] = extent[2] + value; + opt_extent[3] = extent[3] + value; + return opt_extent; + } + else { + return [ + extent[0] - value, + extent[1] - value, + extent[2] + value, + extent[3] + value, + ]; + } +} +/** + * Creates a clone of an extent. + * + * @param {Extent} extent Extent to clone. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} The clone. + */ +function clone(extent, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0]; + opt_extent[1] = extent[1]; + opt_extent[2] = extent[2]; + opt_extent[3] = extent[3]; + return opt_extent; + } + else { + return extent.slice(); + } +} +/** + * @param {Extent} extent Extent. + * @param {number} x X. + * @param {number} y Y. + * @return {number} Closest squared distance. + */ +function closestSquaredDistanceXY(extent, x, y) { + var dx, dy; + if (x < extent[0]) { + dx = extent[0] - x; + } + else if (extent[2] < x) { + dx = x - extent[2]; + } + else { + dx = 0; + } + if (y < extent[1]) { + dy = extent[1] - y; + } + else if (extent[3] < y) { + dy = y - extent[3]; + } + else { + dy = 0; + } + return dx * dx + dy * dy; +} +/** + * Check if the passed coordinate is contained or on the edge of the extent. + * + * @param {Extent} extent Extent. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} The coordinate is contained in the extent. + * @api + */ +function containsCoordinate(extent, coordinate) { + return containsXY(extent, coordinate[0], coordinate[1]); +} +/** + * Check if one extent contains another. + * + * An extent is deemed contained if it lies completely within the other extent, + * including if they share one or more edges. + * + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {boolean} The second extent is contained by or on the edge of the + * first. + * @api + */ +function containsExtent(extent1, extent2) { + return (extent1[0] <= extent2[0] && + extent2[2] <= extent1[2] && + extent1[1] <= extent2[1] && + extent2[3] <= extent1[3]); +} +/** + * Check if the passed coordinate is contained or on the edge of the extent. + * + * @param {Extent} extent Extent. + * @param {number} x X coordinate. + * @param {number} y Y coordinate. + * @return {boolean} The x, y values are contained in the extent. + * @api + */ +function containsXY(extent, x, y) { + return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3]; +} +/** + * Get the relationship between a coordinate and extent. + * @param {Extent} extent The extent. + * @param {import("./coordinate.js").Coordinate} coordinate The coordinate. + * @return {import("./extent/Relationship.js").default} The relationship (bitwise compare with + * import("./extent/Relationship.js").Relationship). + */ +function coordinateRelationship(extent, coordinate) { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var x = coordinate[0]; + var y = coordinate[1]; + var relationship = Relationship.UNKNOWN; + if (x < minX) { + relationship = relationship | Relationship.LEFT; + } + else if (x > maxX) { + relationship = relationship | Relationship.RIGHT; + } + if (y < minY) { + relationship = relationship | Relationship.BELOW; + } + else if (y > maxY) { + relationship = relationship | Relationship.ABOVE; + } + if (relationship === Relationship.UNKNOWN) { + relationship = Relationship.INTERSECTING; + } + return relationship; +} +/** + * Create an empty extent. + * @return {Extent} Empty extent. + * @api + */ +function createEmpty() { + return [Infinity, Infinity, -Infinity, -Infinity]; +} +/** + * Create a new extent or update the provided extent. + * @param {number} minX Minimum X. + * @param {number} minY Minimum Y. + * @param {number} maxX Maximum X. + * @param {number} maxY Maximum Y. + * @param {Extent} [opt_extent] Destination extent. + * @return {Extent} Extent. + */ +function createOrUpdate(minX, minY, maxX, maxY, opt_extent) { + if (opt_extent) { + opt_extent[0] = minX; + opt_extent[1] = minY; + opt_extent[2] = maxX; + opt_extent[3] = maxY; + return opt_extent; + } + else { + return [minX, minY, maxX, maxY]; + } +} +/** + * Create a new empty extent or make the provided one empty. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateEmpty(opt_extent) { + return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent); +} +/** + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromCoordinate(coordinate, opt_extent) { + var x = coordinate[0]; + var y = coordinate[1]; + return createOrUpdate(x, y, x, y, opt_extent); +} +/** + * @param {Array} coordinates Coordinates. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromCoordinates(coordinates, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendCoordinates(extent, coordinates); +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride); +} +/** + * @param {Array>} rings Rings. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromRings(rings, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendRings(extent, rings); +} +/** + * Determine if two extents are equivalent. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {boolean} The two extents are equivalent. + * @api + */ +function extent_equals(extent1, extent2) { + return (extent1[0] == extent2[0] && + extent1[2] == extent2[2] && + extent1[1] == extent2[1] && + extent1[3] == extent2[3]); +} +/** + * Determine if two extents are approximately equivalent. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @param {number} tolerance Tolerance in extent coordinate units. + * @return {boolean} The two extents differ by less than the tolerance. + */ +function approximatelyEquals(extent1, extent2, tolerance) { + return (Math.abs(extent1[0] - extent2[0]) < tolerance && + Math.abs(extent1[2] - extent2[2]) < tolerance && + Math.abs(extent1[1] - extent2[1]) < tolerance && + Math.abs(extent1[3] - extent2[3]) < tolerance); +} +/** + * Modify an extent to include another extent. + * @param {Extent} extent1 The extent to be modified. + * @param {Extent} extent2 The extent that will be included in the first. + * @return {Extent} A reference to the first (extended) extent. + * @api + */ +function extent_extend(extent1, extent2) { + if (extent2[0] < extent1[0]) { + extent1[0] = extent2[0]; + } + if (extent2[2] > extent1[2]) { + extent1[2] = extent2[2]; + } + if (extent2[1] < extent1[1]) { + extent1[1] = extent2[1]; + } + if (extent2[3] > extent1[3]) { + extent1[3] = extent2[3]; + } + return extent1; +} +/** + * @param {Extent} extent Extent. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + */ +function extendCoordinate(extent, coordinate) { + if (coordinate[0] < extent[0]) { + extent[0] = coordinate[0]; + } + if (coordinate[0] > extent[2]) { + extent[2] = coordinate[0]; + } + if (coordinate[1] < extent[1]) { + extent[1] = coordinate[1]; + } + if (coordinate[1] > extent[3]) { + extent[3] = coordinate[1]; + } +} +/** + * @param {Extent} extent Extent. + * @param {Array} coordinates Coordinates. + * @return {Extent} Extent. + */ +function extendCoordinates(extent, coordinates) { + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + extendCoordinate(extent, coordinates[i]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {Extent} Extent. + */ +function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) { + for (; offset < end; offset += stride) { + extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {Array>} rings Rings. + * @return {Extent} Extent. + */ +function extendRings(extent, rings) { + for (var i = 0, ii = rings.length; i < ii; ++i) { + extendCoordinates(extent, rings[i]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {number} x X. + * @param {number} y Y. + */ +function extendXY(extent, x, y) { + extent[0] = Math.min(extent[0], x); + extent[1] = Math.min(extent[1], y); + extent[2] = Math.max(extent[2], x); + extent[3] = Math.max(extent[3], y); +} +/** + * This function calls `callback` for each corner of the extent. If the + * callback returns a truthy value the function returns that value + * immediately. Otherwise the function returns `false`. + * @param {Extent} extent Extent. + * @param {function(import("./coordinate.js").Coordinate): S} callback Callback. + * @return {S|boolean} Value. + * @template S + */ +function forEachCorner(extent, callback) { + var val; + val = callback(getBottomLeft(extent)); + if (val) { + return val; + } + val = callback(getBottomRight(extent)); + if (val) { + return val; + } + val = callback(getTopRight(extent)); + if (val) { + return val; + } + val = callback(getTopLeft(extent)); + if (val) { + return val; + } + return false; +} +/** + * Get the size of an extent. + * @param {Extent} extent Extent. + * @return {number} Area. + * @api + */ +function getArea(extent) { + var area = 0; + if (!extent_isEmpty(extent)) { + area = extent_getWidth(extent) * getHeight(extent); + } + return area; +} +/** + * Get the bottom left coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Bottom left coordinate. + * @api + */ +function getBottomLeft(extent) { + return [extent[0], extent[1]]; +} +/** + * Get the bottom right coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Bottom right coordinate. + * @api + */ +function getBottomRight(extent) { + return [extent[2], extent[1]]; +} +/** + * Get the center coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Center. + * @api + */ +function getCenter(extent) { + return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2]; +} +/** + * Get a corner coordinate of an extent. + * @param {Extent} extent Extent. + * @param {Corner} corner Corner. + * @return {import("./coordinate.js").Coordinate} Corner coordinate. + */ +function getCorner(extent, corner) { + var coordinate; + if (corner === 'bottom-left') { + coordinate = getBottomLeft(extent); + } + else if (corner === 'bottom-right') { + coordinate = getBottomRight(extent); + } + else if (corner === 'top-left') { + coordinate = getTopLeft(extent); + } + else if (corner === 'top-right') { + coordinate = getTopRight(extent); + } + else { + asserts_assert(false, 13); // Invalid corner + } + return coordinate; +} +/** + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {number} Enlarged area. + */ +function getEnlargedArea(extent1, extent2) { + var minX = Math.min(extent1[0], extent2[0]); + var minY = Math.min(extent1[1], extent2[1]); + var maxX = Math.max(extent1[2], extent2[2]); + var maxY = Math.max(extent1[3], extent2[3]); + return (maxX - minX) * (maxY - minY); +} +/** + * @param {import("./coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {import("./size.js").Size} size Size. + * @param {Extent} [opt_extent] Destination extent. + * @return {Extent} Extent. + */ +function getForViewAndSize(center, resolution, rotation, size, opt_extent) { + var _a = getRotatedViewport(center, resolution, rotation, size), x0 = _a[0], y0 = _a[1], x1 = _a[2], y1 = _a[3], x2 = _a[4], y2 = _a[5], x3 = _a[6], y3 = _a[7]; + return createOrUpdate(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3), opt_extent); +} +/** + * @param {import("./coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {import("./size.js").Size} size Size. + * @return {Array} Linear ring representing the viewport. + */ +function getRotatedViewport(center, resolution, rotation, size) { + var dx = (resolution * size[0]) / 2; + var dy = (resolution * size[1]) / 2; + var cosRotation = Math.cos(rotation); + var sinRotation = Math.sin(rotation); + var xCos = dx * cosRotation; + var xSin = dx * sinRotation; + var yCos = dy * cosRotation; + var ySin = dy * sinRotation; + var x = center[0]; + var y = center[1]; + return [ + x - xCos + ySin, + y - xSin - yCos, + x - xCos - ySin, + y - xSin + yCos, + x + xCos - ySin, + y + xSin + yCos, + x + xCos + ySin, + y + xSin - yCos, + x - xCos + ySin, + y - xSin - yCos, + ]; +} +/** + * Get the height of an extent. + * @param {Extent} extent Extent. + * @return {number} Height. + * @api + */ +function getHeight(extent) { + return extent[3] - extent[1]; +} +/** + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {number} Intersection area. + */ +function getIntersectionArea(extent1, extent2) { + var intersection = getIntersection(extent1, extent2); + return getArea(intersection); +} +/** + * Get the intersection of two extents. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @param {Extent} [opt_extent] Optional extent to populate with intersection. + * @return {Extent} Intersecting extent. + * @api + */ +function getIntersection(extent1, extent2, opt_extent) { + var intersection = opt_extent ? opt_extent : createEmpty(); + if (intersects(extent1, extent2)) { + if (extent1[0] > extent2[0]) { + intersection[0] = extent1[0]; + } + else { + intersection[0] = extent2[0]; + } + if (extent1[1] > extent2[1]) { + intersection[1] = extent1[1]; + } + else { + intersection[1] = extent2[1]; + } + if (extent1[2] < extent2[2]) { + intersection[2] = extent1[2]; + } + else { + intersection[2] = extent2[2]; + } + if (extent1[3] < extent2[3]) { + intersection[3] = extent1[3]; + } + else { + intersection[3] = extent2[3]; + } + } + else { + createOrUpdateEmpty(intersection); + } + return intersection; +} +/** + * @param {Extent} extent Extent. + * @return {number} Margin. + */ +function getMargin(extent) { + return extent_getWidth(extent) + getHeight(extent); +} +/** + * Get the size (width, height) of an extent. + * @param {Extent} extent The extent. + * @return {import("./size.js").Size} The extent size. + * @api + */ +function getSize(extent) { + return [extent[2] - extent[0], extent[3] - extent[1]]; +} +/** + * Get the top left coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Top left coordinate. + * @api + */ +function getTopLeft(extent) { + return [extent[0], extent[3]]; +} +/** + * Get the top right coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Top right coordinate. + * @api + */ +function getTopRight(extent) { + return [extent[2], extent[3]]; +} +/** + * Get the width of an extent. + * @param {Extent} extent Extent. + * @return {number} Width. + * @api + */ +function extent_getWidth(extent) { + return extent[2] - extent[0]; +} +/** + * Determine if one extent intersects another. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent. + * @return {boolean} The two extents intersect. + * @api + */ +function intersects(extent1, extent2) { + return (extent1[0] <= extent2[2] && + extent1[2] >= extent2[0] && + extent1[1] <= extent2[3] && + extent1[3] >= extent2[1]); +} +/** + * Determine if an extent is empty. + * @param {Extent} extent Extent. + * @return {boolean} Is empty. + * @api + */ +function extent_isEmpty(extent) { + return extent[2] < extent[0] || extent[3] < extent[1]; +} +/** + * @param {Extent} extent Extent. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function returnOrUpdate(extent, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0]; + opt_extent[1] = extent[1]; + opt_extent[2] = extent[2]; + opt_extent[3] = extent[3]; + return opt_extent; + } + else { + return extent; + } +} +/** + * @param {Extent} extent Extent. + * @param {number} value Value. + */ +function scaleFromCenter(extent, value) { + var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1); + var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1); + extent[0] -= deltaX; + extent[2] += deltaX; + extent[1] -= deltaY; + extent[3] += deltaY; +} +/** + * Determine if the segment between two coordinates intersects (crosses, + * touches, or is contained by) the provided extent. + * @param {Extent} extent The extent. + * @param {import("./coordinate.js").Coordinate} start Segment start coordinate. + * @param {import("./coordinate.js").Coordinate} end Segment end coordinate. + * @return {boolean} The segment intersects the extent. + */ +function intersectsSegment(extent, start, end) { + var intersects = false; + var startRel = coordinateRelationship(extent, start); + var endRel = coordinateRelationship(extent, end); + if (startRel === Relationship.INTERSECTING || + endRel === Relationship.INTERSECTING) { + intersects = true; + } + else { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var startX = start[0]; + var startY = start[1]; + var endX = end[0]; + var endY = end[1]; + var slope = (endY - startY) / (endX - startX); + var x = void 0, y = void 0; + if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) { + // potentially intersects top + x = endX - (endY - maxY) / slope; + intersects = x >= minX && x <= maxX; + } + if (!intersects && + !!(endRel & Relationship.RIGHT) && + !(startRel & Relationship.RIGHT)) { + // potentially intersects right + y = endY - (endX - maxX) * slope; + intersects = y >= minY && y <= maxY; + } + if (!intersects && + !!(endRel & Relationship.BELOW) && + !(startRel & Relationship.BELOW)) { + // potentially intersects bottom + x = endX - (endY - minY) / slope; + intersects = x >= minX && x <= maxX; + } + if (!intersects && + !!(endRel & Relationship.LEFT) && + !(startRel & Relationship.LEFT)) { + // potentially intersects left + y = endY - (endX - minX) * slope; + intersects = y >= minY && y <= maxY; + } + } + return intersects; +} +/** + * Apply a transform function to the extent. + * @param {Extent} extent Extent. + * @param {import("./proj.js").TransformFunction} transformFn Transform function. + * Called with `[minX, minY, maxX, maxY]` extent coordinates. + * @param {Extent} [opt_extent] Destination extent. + * @param {number} [opt_stops] Number of stops per side used for the transform. + * By default only the corners are used. + * @return {Extent} Extent. + * @api + */ +function applyTransform(extent, transformFn, opt_extent, opt_stops) { + var coordinates = []; + if (opt_stops > 1) { + var width = extent[2] - extent[0]; + var height = extent[3] - extent[1]; + for (var i = 0; i < opt_stops; ++i) { + coordinates.push(extent[0] + (width * i) / opt_stops, extent[1], extent[2], extent[1] + (height * i) / opt_stops, extent[2] - (width * i) / opt_stops, extent[3], extent[0], extent[3] - (height * i) / opt_stops); + } + } + else { + coordinates = [ + extent[0], + extent[1], + extent[2], + extent[1], + extent[2], + extent[3], + extent[0], + extent[3], + ]; + } + transformFn(coordinates, coordinates, 2); + var xs = []; + var ys = []; + for (var i = 0, l = coordinates.length; i < l; i += 2) { + xs.push(coordinates[i]); + ys.push(coordinates[i + 1]); + } + return _boundingExtentXYs(xs, ys, opt_extent); +} +/** + * Modifies the provided extent in-place to be within the real world + * extent. + * + * @param {Extent} extent Extent. + * @param {import("./proj/Projection.js").default} projection Projection + * @return {Extent} The extent within the real world extent. + */ +function wrapX(extent, projection) { + var projectionExtent = projection.getExtent(); + var center = getCenter(extent); + if (projection.canWrapX() && + (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) { + var worldWidth = extent_getWidth(projectionExtent); + var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth); + var offset = worldsAway * worldWidth; + extent[0] -= offset; + extent[2] -= offset; + } + return extent; +} +/** + * Fits the extent to the real world + * + * If the extent does not cross the anti meridian, this will return the extent in an array + * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the + * real world + * + * + * @param {Extent} extent Extent. + * @param {import("./proj/Projection.js").default} projection Projection + * @return {Array} The extent within the real world extent. + */ +function wrapAndSliceX(extent, projection) { + if (projection.canWrapX()) { + var projectionExtent = projection.getExtent(); + if (!isFinite(extent[0]) || !isFinite(extent[2])) { + return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]]; + } + wrapX(extent, projection); + var worldWidth = extent_getWidth(projectionExtent); + if (extent_getWidth(extent) > worldWidth) { + // the extent wraps around on itself + return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]]; + } + else if (extent[0] < projectionExtent[0]) { + // the extent crosses the anti meridian, so it needs to be sliced + return [ + [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]], + [projectionExtent[0], extent[1], extent[2], extent[3]], + ]; + } + else if (extent[2] > projectionExtent[2]) { + // the extent crosses the anti meridian, so it needs to be sliced + return [ + [extent[0], extent[1], projectionExtent[2], extent[3]], + [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]], + ]; + } + } + return [extent]; +} +//# sourceMappingURL=extent.js.map +;// CONCATENATED MODULE: ./node_modules/ol/coordinate.js +/** + * @module ol/coordinate + */ + + + +/** + * An array of numbers representing an xy coordinate. Example: `[16, 48]`. + * @typedef {Array} Coordinate + * @api + */ +/** + * A function that takes a {@link module:ol/coordinate~Coordinate} and + * transforms it into a `{string}`. + * + * @typedef {function((Coordinate|undefined)): string} CoordinateFormat + * @api + */ +/** + * Add `delta` to `coordinate`. `coordinate` is modified in place and returned + * by the function. + * + * Example: + * + * import {add} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * add(coord, [-2, 4]); + * // coord is now [5.85, 51.983333] + * + * @param {Coordinate} coordinate Coordinate. + * @param {Coordinate} delta Delta. + * @return {Coordinate} The input coordinate adjusted by + * the given delta. + * @api + */ +function coordinate_add(coordinate, delta) { + coordinate[0] += +delta[0]; + coordinate[1] += +delta[1]; + return coordinate; +} +/** + * Calculates the point closest to the passed coordinate on the passed circle. + * + * @param {Coordinate} coordinate The coordinate. + * @param {import("./geom/Circle.js").default} circle The circle. + * @return {Coordinate} Closest point on the circumference. + */ +function closestOnCircle(coordinate, circle) { + var r = circle.getRadius(); + var center = circle.getCenter(); + var x0 = center[0]; + var y0 = center[1]; + var x1 = coordinate[0]; + var y1 = coordinate[1]; + var dx = x1 - x0; + var dy = y1 - y0; + if (dx === 0 && dy === 0) { + dx = 1; + } + var d = Math.sqrt(dx * dx + dy * dy); + var x = x0 + (r * dx) / d; + var y = y0 + (r * dy) / d; + return [x, y]; +} +/** + * Calculates the point closest to the passed coordinate on the passed segment. + * This is the foot of the perpendicular of the coordinate to the segment when + * the foot is on the segment, or the closest segment coordinate when the foot + * is outside the segment. + * + * @param {Coordinate} coordinate The coordinate. + * @param {Array} segment The two coordinates + * of the segment. + * @return {Coordinate} The foot of the perpendicular of + * the coordinate to the segment. + */ +function closestOnSegment(coordinate, segment) { + var x0 = coordinate[0]; + var y0 = coordinate[1]; + var start = segment[0]; + var end = segment[1]; + var x1 = start[0]; + var y1 = start[1]; + var x2 = end[0]; + var y2 = end[1]; + var dx = x2 - x1; + var dy = y2 - y1; + var along = dx === 0 && dy === 0 + ? 0 + : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0); + var x, y; + if (along <= 0) { + x = x1; + y = y1; + } + else if (along >= 1) { + x = x2; + y = y2; + } + else { + x = x1 + along * dx; + y = y1 + along * dy; + } + return [x, y]; +} +/** + * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be + * used to format + * a {Coordinate} to a string. + * + * Example without specifying the fractional digits: + * + * import {createStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var stringifyFunc = createStringXY(); + * var out = stringifyFunc(coord); + * // out is now '8, 48' + * + * Example with explicitly specifying 2 fractional digits: + * + * import {createStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var stringifyFunc = createStringXY(2); + * var out = stringifyFunc(coord); + * // out is now '7.85, 47.98' + * + * @param {number} [opt_fractionDigits] The number of digits to include + * after the decimal point. Default is `0`. + * @return {CoordinateFormat} Coordinate format. + * @api + */ +function createStringXY(opt_fractionDigits) { + return ( + /** + * @param {Coordinate} coordinate Coordinate. + * @return {string} String XY. + */ + function (coordinate) { + return toStringXY(coordinate, opt_fractionDigits); + }); +} +/** + * @param {string} hemispheres Hemispheres. + * @param {number} degrees Degrees. + * @param {number} [opt_fractionDigits] The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} String. + */ +function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) { + var normalizedDegrees = modulo(degrees + 180, 360) - 180; + var x = Math.abs(3600 * normalizedDegrees); + var dflPrecision = opt_fractionDigits || 0; + var precision = Math.pow(10, dflPrecision); + var deg = Math.floor(x / 3600); + var min = Math.floor((x - deg * 3600) / 60); + var sec = x - deg * 3600 - min * 60; + sec = Math.ceil(sec * precision) / precision; + if (sec >= 60) { + sec = 0; + min += 1; + } + if (min >= 60) { + min = 0; + deg += 1; + } + return (deg + + '\u00b0 ' + + padNumber(min, 2) + + '\u2032 ' + + padNumber(sec, 2, dflPrecision) + + '\u2033' + + (normalizedDegrees == 0 + ? '' + : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0))); +} +/** + * Transforms the given {@link module:ol/coordinate~Coordinate} to a string + * using the given string template. The strings `{x}` and `{y}` in the template + * will be replaced with the first and second coordinate values respectively. + * + * Example without specifying the fractional digits: + * + * import {format} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var template = 'Coordinate is ({x}|{y}).'; + * var out = format(coord, template); + * // out is now 'Coordinate is (8|48).' + * + * Example explicitly specifying the fractional digits: + * + * import {format} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var template = 'Coordinate is ({x}|{y}).'; + * var out = format(coord, template, 2); + * // out is now 'Coordinate is (7.85|47.98).' + * + * @param {Coordinate} coordinate Coordinate. + * @param {string} template A template string with `{x}` and `{y}` placeholders + * that will be replaced by first and second coordinate values. + * @param {number} [opt_fractionDigits] The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} Formatted coordinate. + * @api + */ +function format(coordinate, template, opt_fractionDigits) { + if (coordinate) { + return template + .replace('{x}', coordinate[0].toFixed(opt_fractionDigits)) + .replace('{y}', coordinate[1].toFixed(opt_fractionDigits)); + } + else { + return ''; + } +} +/** + * @param {Coordinate} coordinate1 First coordinate. + * @param {Coordinate} coordinate2 Second coordinate. + * @return {boolean} The two coordinates are equal. + */ +function coordinate_equals(coordinate1, coordinate2) { + var equals = true; + for (var i = coordinate1.length - 1; i >= 0; --i) { + if (coordinate1[i] != coordinate2[i]) { + equals = false; + break; + } + } + return equals; +} +/** + * Rotate `coordinate` by `angle`. `coordinate` is modified in place and + * returned by the function. + * + * Example: + * + * import {rotate} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var rotateRadians = Math.PI / 2; // 90 degrees + * rotate(coord, rotateRadians); + * // coord is now [-47.983333, 7.85] + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} angle Angle in radian. + * @return {Coordinate} Coordinate. + * @api + */ +function rotate(coordinate, angle) { + var cosAngle = Math.cos(angle); + var sinAngle = Math.sin(angle); + var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle; + var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle; + coordinate[0] = x; + coordinate[1] = y; + return coordinate; +} +/** + * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned + * by the function. + * + * Example: + * + * import {scale as scaleCoordinate} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var scale = 1.2; + * scaleCoordinate(coord, scale); + * // coord is now [9.42, 57.5799996] + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} scale Scale factor. + * @return {Coordinate} Coordinate. + */ +function scale(coordinate, scale) { + coordinate[0] *= scale; + coordinate[1] *= scale; + return coordinate; +} +/** + * @param {Coordinate} coord1 First coordinate. + * @param {Coordinate} coord2 Second coordinate. + * @return {number} Squared distance between coord1 and coord2. + */ +function coordinate_squaredDistance(coord1, coord2) { + var dx = coord1[0] - coord2[0]; + var dy = coord1[1] - coord2[1]; + return dx * dx + dy * dy; +} +/** + * @param {Coordinate} coord1 First coordinate. + * @param {Coordinate} coord2 Second coordinate. + * @return {number} Distance between coord1 and coord2. + */ +function distance(coord1, coord2) { + return Math.sqrt(coordinate_squaredDistance(coord1, coord2)); +} +/** + * Calculate the squared distance from a coordinate to a line segment. + * + * @param {Coordinate} coordinate Coordinate of the point. + * @param {Array} segment Line segment (2 + * coordinates). + * @return {number} Squared distance from the point to the line segment. + */ +function squaredDistanceToSegment(coordinate, segment) { + return coordinate_squaredDistance(coordinate, closestOnSegment(coordinate, segment)); +} +/** + * Format a geographic coordinate with the hemisphere, degrees, minutes, and + * seconds. + * + * Example without specifying fractional digits: + * + * import {toStringHDMS} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringHDMS(coord); + * // out is now '47° 58′ 60″ N 7° 50′ 60″ E' + * + * Example explicitly specifying 1 fractional digit: + * + * import {toStringHDMS} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringHDMS(coord, 1); + * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E' + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} [opt_fractionDigits] The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} Hemisphere, degrees, minutes and seconds. + * @api + */ +function toStringHDMS(coordinate, opt_fractionDigits) { + if (coordinate) { + return (degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + + ' ' + + degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits)); + } + else { + return ''; + } +} +/** + * Format a coordinate as a comma delimited string. + * + * Example without specifying fractional digits: + * + * import {toStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringXY(coord); + * // out is now '8, 48' + * + * Example explicitly specifying 1 fractional digit: + * + * import {toStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringXY(coord, 1); + * // out is now '7.8, 48.0' + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} [opt_fractionDigits] The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} XY. + * @api + */ +function toStringXY(coordinate, opt_fractionDigits) { + return format(coordinate, '{x}, {y}', opt_fractionDigits); +} +/** + * Modifies the provided coordinate in-place to be within the real world + * extent. The lower projection extent boundary is inclusive, the upper one + * exclusive. + * + * @param {Coordinate} coordinate Coordinate. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {Coordinate} The coordinate within the real world extent. + */ +function coordinate_wrapX(coordinate, projection) { + if (projection.canWrapX()) { + var worldWidth = extent_getWidth(projection.getExtent()); + var worldsAway = coordinate_getWorldsAway(coordinate, projection, worldWidth); + if (worldsAway) { + coordinate[0] -= worldsAway * worldWidth; + } + } + return coordinate; +} +/** + * @param {Coordinate} coordinate Coordinate. + * @param {import("./proj/Projection.js").default} projection Projection. + * @param {number} [opt_sourceExtentWidth] Width of the source extent. + * @return {number} Offset in world widths. + */ +function coordinate_getWorldsAway(coordinate, projection, opt_sourceExtentWidth) { + var projectionExtent = projection.getExtent(); + var worldsAway = 0; + if (projection.canWrapX() && + (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) { + var sourceExtentWidth = opt_sourceExtentWidth || extent_getWidth(projectionExtent); + worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / sourceExtentWidth); + } + return worldsAway; +} +//# sourceMappingURL=coordinate.js.map +;// CONCATENATED MODULE: ./node_modules/ol/sphere.js +/** + * @module ol/sphere + */ + +/** + * Object literal with options for the {@link getLength} or {@link getArea} + * functions. + * @typedef {Object} SphereMetricOptions + * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] + * Projection of the geometry. By default, the geometry is assumed to be in + * Web Mercator. + * @property {number} [radius=6371008.8] Sphere radius. By default, the + * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius) + * for the WGS84 ellipsoid is used. + */ +/** + * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid. + * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius + * @type {number} + */ +var DEFAULT_RADIUS = 6371008.8; +/** + * Get the great circle distance (in meters) between two geographic coordinates. + * @param {Array} c1 Starting coordinate. + * @param {Array} c2 Ending coordinate. + * @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's + * mean radius using the WGS84 ellipsoid. + * @return {number} The great circle distance between the points (in meters). + * @api + */ +function getDistance(c1, c2, opt_radius) { + var radius = opt_radius || DEFAULT_RADIUS; + var lat1 = math_toRadians(c1[1]); + var lat2 = math_toRadians(c2[1]); + var deltaLatBy2 = (lat2 - lat1) / 2; + var deltaLonBy2 = math_toRadians(c2[0] - c1[0]) / 2; + var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) + + Math.sin(deltaLonBy2) * + Math.sin(deltaLonBy2) * + Math.cos(lat1) * + Math.cos(lat2); + return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); +} +/** + * Get the cumulative great circle length of linestring coordinates (geographic). + * @param {Array} coordinates Linestring coordinates. + * @param {number} radius The sphere radius to use. + * @return {number} The length (in meters). + */ +function getLengthInternal(coordinates, radius) { + var length = 0; + for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) { + length += getDistance(coordinates[i], coordinates[i + 1], radius); + } + return length; +} +/** + * Get the spherical length of a geometry. This length is the sum of the + * great circle distances between coordinates. For polygons, the length is + * the sum of all rings. For points, the length is zero. For multi-part + * geometries, the length is the sum of the length of each part. + * @param {import("./geom/Geometry.js").default} geometry A geometry. + * @param {SphereMetricOptions} [opt_options] Options for the + * length calculation. By default, geometries are assumed to be in 'EPSG:3857'. + * You can change this by providing a `projection` option. + * @return {number} The spherical length (in meters). + * @api + */ +function getLength(geometry, opt_options) { + var options = opt_options || {}; + var radius = options.radius || DEFAULT_RADIUS; + var projection = options.projection || 'EPSG:3857'; + var type = geometry.getType(); + if (type !== 'GeometryCollection') { + geometry = geometry.clone().transform(projection, 'EPSG:4326'); + } + var length = 0; + var coordinates, coords, i, ii, j, jj; + switch (type) { + case 'Point': + case 'MultiPoint': { + break; + } + case 'LineString': + case 'LinearRing': { + coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates(); + length = getLengthInternal(coordinates, radius); + break; + } + case 'MultiLineString': + case 'Polygon': { + coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates(); + for (i = 0, ii = coordinates.length; i < ii; ++i) { + length += getLengthInternal(coordinates[i], radius); + } + break; + } + case 'MultiPolygon': { + coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates(); + for (i = 0, ii = coordinates.length; i < ii; ++i) { + coords = coordinates[i]; + for (j = 0, jj = coords.length; j < jj; ++j) { + length += getLengthInternal(coords[j], radius); + } + } + break; + } + case 'GeometryCollection': { + var geometries = + /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries(); + for (i = 0, ii = geometries.length; i < ii; ++i) { + length += getLength(geometries[i], opt_options); + } + break; + } + default: { + throw new Error('Unsupported geometry type: ' + type); + } + } + return length; +} +/** + * Returns the spherical area for a list of coordinates. + * + * [Reference](https://trs.jpl.nasa.gov/handle/2014/40409) + * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for + * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion + * Laboratory, Pasadena, CA, June 2007 + * + * @param {Array} coordinates List of coordinates of a linear + * ring. If the ring is oriented clockwise, the area will be positive, + * otherwise it will be negative. + * @param {number} radius The sphere radius. + * @return {number} Area (in square meters). + */ +function getAreaInternal(coordinates, radius) { + var area = 0; + var len = coordinates.length; + var x1 = coordinates[len - 1][0]; + var y1 = coordinates[len - 1][1]; + for (var i = 0; i < len; i++) { + var x2 = coordinates[i][0]; + var y2 = coordinates[i][1]; + area += + toRadians(x2 - x1) * + (2 + Math.sin(toRadians(y1)) + Math.sin(toRadians(y2))); + x1 = x2; + y1 = y2; + } + return (area * radius * radius) / 2.0; +} +/** + * Get the spherical area of a geometry. This is the area (in meters) assuming + * that polygon edges are segments of great circles on a sphere. + * @param {import("./geom/Geometry.js").default} geometry A geometry. + * @param {SphereMetricOptions} [opt_options] Options for the area + * calculation. By default, geometries are assumed to be in 'EPSG:3857'. + * You can change this by providing a `projection` option. + * @return {number} The spherical area (in square meters). + * @api + */ +function sphere_getArea(geometry, opt_options) { + var options = opt_options || {}; + var radius = options.radius || DEFAULT_RADIUS; + var projection = options.projection || 'EPSG:3857'; + var type = geometry.getType(); + if (type !== 'GeometryCollection') { + geometry = geometry.clone().transform(projection, 'EPSG:4326'); + } + var area = 0; + var coordinates, coords, i, ii, j, jj; + switch (type) { + case 'Point': + case 'MultiPoint': + case 'LineString': + case 'MultiLineString': + case 'LinearRing': { + break; + } + case 'Polygon': { + coordinates = /** @type {import("./geom/Polygon.js").default} */ (geometry).getCoordinates(); + area = Math.abs(getAreaInternal(coordinates[0], radius)); + for (i = 1, ii = coordinates.length; i < ii; ++i) { + area -= Math.abs(getAreaInternal(coordinates[i], radius)); + } + break; + } + case 'MultiPolygon': { + coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates(); + for (i = 0, ii = coordinates.length; i < ii; ++i) { + coords = coordinates[i]; + area += Math.abs(getAreaInternal(coords[0], radius)); + for (j = 1, jj = coords.length; j < jj; ++j) { + area -= Math.abs(getAreaInternal(coords[j], radius)); + } + } + break; + } + case 'GeometryCollection': { + var geometries = + /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries(); + for (i = 0, ii = geometries.length; i < ii; ++i) { + area += sphere_getArea(geometries[i], opt_options); + } + break; + } + default: { + throw new Error('Unsupported geometry type: ' + type); + } + } + return area; +} +/** + * Returns the coordinate at the given distance and bearing from `c1`. + * + * @param {import("./coordinate.js").Coordinate} c1 The origin point (`[lon, lat]` in degrees). + * @param {number} distance The great-circle distance between the origin + * point and the target point. + * @param {number} bearing The bearing (in radians). + * @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's + * mean radius using the WGS84 ellipsoid. + * @return {import("./coordinate.js").Coordinate} The target point. + */ +function offset(c1, distance, bearing, opt_radius) { + var radius = opt_radius || DEFAULT_RADIUS; + var lat1 = toRadians(c1[1]); + var lon1 = toRadians(c1[0]); + var dByR = distance / radius; + var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) + + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)); + var lon = lon1 + + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)); + return [toDegrees(lon), toDegrees(lat)]; +} +//# sourceMappingURL=sphere.js.map +;// CONCATENATED MODULE: ./node_modules/ol/proj.js +/** + * @module ol/proj + */ +/** + * The ol/proj module stores: + * * a list of {@link module:ol/proj/Projection~Projection} + * objects, one for each projection supported by the application + * * a list of transform functions needed to convert coordinates in one projection + * into another. + * + * The static functions are the methods used to maintain these. + * Each transform function can handle not only simple coordinate pairs, but also + * large arrays of coordinates such as vector geometries. + * + * When loaded, the library adds projection objects for EPSG:4326 (WGS84 + * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used + * for example by Bing Maps or OpenStreetMap), together with the relevant + * transform functions. + * + * Additional transforms may be added by using the http://proj4js.org/ + * library (version 2.2 or later). You can use the full build supplied by + * Proj4js, or create a custom build to support those projections you need; see + * the Proj4js website for how to do this. You also need the Proj4js definitions + * for the required projections. These definitions can be obtained from + * https://epsg.io/, and are a JS function, so can be loaded in a script + * tag (as in the examples) or pasted into your application. + * + * After all required projection definitions are added to proj4's registry (by + * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4` + * package. Existing transforms are not changed by this function. See + * examples/wms-image-custom-proj for an example of this. + * + * Additional projection definitions can be registered with `proj4.defs()` any + * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't + * know in advance what projections are needed, you can initially load minimal + * support and then load whichever are requested. + * + * Note that Proj4js does not support projection extents. If you want to add + * one for creating default tile grids, you can add it after the Projection + * object has been created with `setExtent`, for example, + * `get('EPSG:1234').setExtent(extent)`. + * + * In addition to Proj4js support, any transform functions can be added with + * {@link module:ol/proj.addCoordinateTransforms}. To use this, you must first create + * a {@link module:ol/proj/Projection~Projection} object for the new projection and add it with + * {@link module:ol/proj.addProjection}. You can then add the forward and inverse + * functions with {@link module:ol/proj.addCoordinateTransforms}. See + * examples/wms-custom-proj for an example of this. + * + * Note that if no transforms are needed and you only need to define the + * projection, just add a {@link module:ol/proj/Projection~Projection} with + * {@link module:ol/proj.addProjection}. See examples/wms-no-proj for an example of + * this. + */ + + + + + + + + + + +/** + * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier + * string or undefined. + * @typedef {Projection|string|undefined} ProjectionLike + * @api + */ +/** + * A transform function accepts an array of input coordinate values, an optional + * output array, and an optional dimension (default should be 2). The function + * transforms the input coordinate values, populates the output array, and + * returns the output array. + * + * @typedef {function(Array, Array=, number=): Array} TransformFunction + * @api + */ + + +var showCoordinateWarning = true; +/** + * @param {boolean} [opt_disable = true] Disable console info about `useGeographic()` + */ +function disableCoordinateWarning(opt_disable) { + var hide = opt_disable === undefined ? true : opt_disable; + showCoordinateWarning = !hide; +} +/** + * @param {Array} input Input coordinate array. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Output coordinate array (new array, same coordinate + * values). + */ +function cloneTransform(input, opt_output, opt_dimension) { + var output; + if (opt_output !== undefined) { + for (var i = 0, ii = input.length; i < ii; ++i) { + opt_output[i] = input[i]; + } + output = opt_output; + } + else { + output = input.slice(); + } + return output; +} +/** + * @param {Array} input Input coordinate array. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Input coordinate array (same array as input). + */ +function identityTransform(input, opt_output, opt_dimension) { + if (opt_output !== undefined && input !== opt_output) { + for (var i = 0, ii = input.length; i < ii; ++i) { + opt_output[i] = input[i]; + } + input = opt_output; + } + return input; +} +/** + * Add a Projection object to the list of supported projections that can be + * looked up by their code. + * + * @param {Projection} projection Projection instance. + * @api + */ +function addProjection(projection) { + add(projection.getCode(), projection); + transforms_add(projection, projection, cloneTransform); +} +/** + * @param {Array} projections Projections. + */ +function addProjections(projections) { + projections.forEach(addProjection); +} +/** + * Fetches a Projection object for the code specified. + * + * @param {ProjectionLike} projectionLike Either a code string which is + * a combination of authority and identifier such as "EPSG:4326", or an + * existing projection object, or undefined. + * @return {Projection|null} Projection object, or null if not in list. + * @api + */ +function proj_get(projectionLike) { + return typeof projectionLike === 'string' + ? get(/** @type {string} */ (projectionLike)) + : /** @type {Projection} */ (projectionLike) || null; +} +/** + * Get the resolution of the point in degrees or distance units. + * For projections with degrees as the unit this will simply return the + * provided resolution. For other projections the point resolution is + * by default estimated by transforming the `point` pixel to EPSG:4326, + * measuring its width and height on the normal sphere, + * and taking the average of the width and height. + * A custom function can be provided for a specific projection, either + * by setting the `getPointResolution` option in the + * {@link module:ol/proj/Projection~Projection} constructor or by using + * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing + * projection object. + * @param {ProjectionLike} projection The projection. + * @param {number} resolution Nominal resolution in projection units. + * @param {import("./coordinate.js").Coordinate} point Point to find adjusted resolution at. + * @param {import("./proj/Units.js").default} [opt_units] Units to get the point resolution in. + * Default is the projection's units. + * @return {number} Point resolution. + * @api + */ +function getPointResolution(projection, resolution, point, opt_units) { + projection = proj_get(projection); + var pointResolution; + var getter = projection.getPointResolutionFunc(); + if (getter) { + pointResolution = getter(resolution, point); + if (opt_units && opt_units !== projection.getUnits()) { + var metersPerUnit = projection.getMetersPerUnit(); + if (metersPerUnit) { + pointResolution = + (pointResolution * metersPerUnit) / Units_METERS_PER_UNIT[opt_units]; + } + } + } + else { + var units = projection.getUnits(); + if ((units == proj_Units.DEGREES && !opt_units) || opt_units == proj_Units.DEGREES) { + pointResolution = resolution; + } + else { + // Estimate point resolution by transforming the center pixel to EPSG:4326, + // measuring its width and height on the normal sphere, and taking the + // average of the width and height. + var toEPSG4326_1 = getTransformFromProjections(projection, proj_get('EPSG:4326')); + if (toEPSG4326_1 === identityTransform && units !== proj_Units.DEGREES) { + // no transform is available + pointResolution = resolution * projection.getMetersPerUnit(); + } + else { + var vertices = [ + point[0] - resolution / 2, + point[1], + point[0] + resolution / 2, + point[1], + point[0], + point[1] - resolution / 2, + point[0], + point[1] + resolution / 2, + ]; + vertices = toEPSG4326_1(vertices, vertices, 2); + var width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4)); + var height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8)); + pointResolution = (width + height) / 2; + } + var metersPerUnit = opt_units + ? Units_METERS_PER_UNIT[opt_units] + : projection.getMetersPerUnit(); + if (metersPerUnit !== undefined) { + pointResolution /= metersPerUnit; + } + } + } + return pointResolution; +} +/** + * Registers transformation functions that don't alter coordinates. Those allow + * to transform between projections with equal meaning. + * + * @param {Array} projections Projections. + * @api + */ +function addEquivalentProjections(projections) { + addProjections(projections); + projections.forEach(function (source) { + projections.forEach(function (destination) { + if (source !== destination) { + transforms_add(source, destination, cloneTransform); + } + }); + }); +} +/** + * Registers transformation functions to convert coordinates in any projection + * in projection1 to any projection in projection2. + * + * @param {Array} projections1 Projections with equal + * meaning. + * @param {Array} projections2 Projections with equal + * meaning. + * @param {TransformFunction} forwardTransform Transformation from any + * projection in projection1 to any projection in projection2. + * @param {TransformFunction} inverseTransform Transform from any projection + * in projection2 to any projection in projection1.. + */ +function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) { + projections1.forEach(function (projection1) { + projections2.forEach(function (projection2) { + transforms_add(projection1, projection2, forwardTransform); + transforms_add(projection2, projection1, inverseTransform); + }); + }); +} +/** + * Clear all cached projections and transforms. + */ +function clearAllProjections() { + clearProj(); + clearTransformFuncs(); +} +/** + * @param {Projection|string|undefined} projection Projection. + * @param {string} defaultCode Default code. + * @return {Projection} Projection. + */ +function createProjection(projection, defaultCode) { + if (!projection) { + return proj_get(defaultCode); + } + else if (typeof projection === 'string') { + return proj_get(projection); + } + else { + return /** @type {Projection} */ (projection); + } +} +/** + * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform + * function. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} coordTransform Coordinate + * transform. + * @return {TransformFunction} Transform function. + */ +function createTransformFromCoordinateTransform(coordTransform) { + return ( + /** + * @param {Array} input Input. + * @param {Array} [opt_output] Output. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Output. + */ + function (input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension !== undefined ? opt_dimension : 2; + var output = opt_output !== undefined ? opt_output : new Array(length); + for (var i = 0; i < length; i += dimension) { + var point = coordTransform(input.slice(i, i + dimension)); + var pointLength = point.length; + for (var j = 0, jj = dimension; j < jj; ++j) { + output[i + j] = j >= pointLength ? input[i + j] : point[j]; + } + } + return output; + }); +} +/** + * Registers coordinate transform functions to convert coordinates between the + * source projection and the destination projection. + * The forward and inverse functions convert coordinate pairs; this function + * converts these into the functions used internally which also handle + * extents and coordinate arrays. + * + * @param {ProjectionLike} source Source projection. + * @param {ProjectionLike} destination Destination projection. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} forward The forward transform + * function (that is, from the source projection to the destination + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} inverse The inverse transform + * function (that is, from the destination projection to the source + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. If the transform function can only + * transform less dimensions than the input coordinate, it is supposeed to return a coordinate + * with only the length it can transform. The other dimensions will be taken unchanged from the + * source. + * @api + */ +function addCoordinateTransforms(source, destination, forward, inverse) { + var sourceProj = proj_get(source); + var destProj = proj_get(destination); + addTransformFunc(sourceProj, destProj, createTransformFromCoordinateTransform(forward)); + addTransformFunc(destProj, sourceProj, createTransformFromCoordinateTransform(inverse)); +} +/** + * Transforms a coordinate from longitude/latitude to a different projection. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate as longitude and latitude, i.e. + * an array with longitude as 1st and latitude as 2nd element. + * @param {ProjectionLike} [opt_projection] Target projection. The + * default is Web Mercator, i.e. 'EPSG:3857'. + * @return {import("./coordinate.js").Coordinate} Coordinate projected to the target projection. + * @api + */ +function fromLonLat(coordinate, opt_projection) { + disableCoordinateWarning(); + return transform(coordinate, 'EPSG:4326', opt_projection !== undefined ? opt_projection : 'EPSG:3857'); +} +/** + * Transforms a coordinate to longitude/latitude. + * @param {import("./coordinate.js").Coordinate} coordinate Projected coordinate. + * @param {ProjectionLike} [opt_projection] Projection of the coordinate. + * The default is Web Mercator, i.e. 'EPSG:3857'. + * @return {import("./coordinate.js").Coordinate} Coordinate as longitude and latitude, i.e. an array + * with longitude as 1st and latitude as 2nd element. + * @api + */ +function toLonLat(coordinate, opt_projection) { + var lonLat = transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326'); + var lon = lonLat[0]; + if (lon < -180 || lon > 180) { + lonLat[0] = modulo(lon + 180, 360) - 180; + } + return lonLat; +} +/** + * Checks if two projections are the same, that is every coordinate in one + * projection does represent the same geographic point as the same coordinate in + * the other projection. + * + * @param {Projection} projection1 Projection 1. + * @param {Projection} projection2 Projection 2. + * @return {boolean} Equivalent. + * @api + */ +function equivalent(projection1, projection2) { + if (projection1 === projection2) { + return true; + } + var equalUnits = projection1.getUnits() === projection2.getUnits(); + if (projection1.getCode() === projection2.getCode()) { + return equalUnits; + } + else { + var transformFunc = getTransformFromProjections(projection1, projection2); + return transformFunc === cloneTransform && equalUnits; + } +} +/** + * Searches in the list of transform functions for the function for converting + * coordinates from the source projection to the destination projection. + * + * @param {Projection} sourceProjection Source Projection object. + * @param {Projection} destinationProjection Destination Projection + * object. + * @return {TransformFunction} Transform function. + */ +function getTransformFromProjections(sourceProjection, destinationProjection) { + var sourceCode = sourceProjection.getCode(); + var destinationCode = destinationProjection.getCode(); + var transformFunc = transforms_get(sourceCode, destinationCode); + if (!transformFunc) { + transformFunc = identityTransform; + } + return transformFunc; +} +/** + * Given the projection-like objects, searches for a transformation + * function to convert a coordinates array from the source projection to the + * destination projection. + * + * @param {ProjectionLike} source Source. + * @param {ProjectionLike} destination Destination. + * @return {TransformFunction} Transform function. + * @api + */ +function getTransform(source, destination) { + var sourceProjection = proj_get(source); + var destinationProjection = proj_get(destination); + return getTransformFromProjections(sourceProjection, destinationProjection); +} +/** + * Transforms a coordinate from source projection to destination projection. + * This returns a new coordinate (and does not modify the original). + * + * See {@link module:ol/proj.transformExtent} for extent transformation. + * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its + * subclasses for geometry transforms. + * + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {ProjectionLike} source Source projection-like. + * @param {ProjectionLike} destination Destination projection-like. + * @return {import("./coordinate.js").Coordinate} Coordinate. + * @api + */ +function transform(coordinate, source, destination) { + var transformFunc = getTransform(source, destination); + return transformFunc(coordinate, undefined, coordinate.length); +} +/** + * Transforms an extent from source projection to destination projection. This + * returns a new extent (and does not modify the original). + * + * @param {import("./extent.js").Extent} extent The extent to transform. + * @param {ProjectionLike} source Source projection-like. + * @param {ProjectionLike} destination Destination projection-like. + * @param {number} [opt_stops] Number of stops per side used for the transform. + * By default only the corners are used. + * @return {import("./extent.js").Extent} The transformed extent. + * @api + */ +function transformExtent(extent, source, destination, opt_stops) { + var transformFunc = getTransform(source, destination); + return applyTransform(extent, transformFunc, undefined, opt_stops); +} +/** + * Transforms the given point to the destination projection. + * + * @param {import("./coordinate.js").Coordinate} point Point. + * @param {Projection} sourceProjection Source projection. + * @param {Projection} destinationProjection Destination projection. + * @return {import("./coordinate.js").Coordinate} Point. + */ +function transformWithProjections(point, sourceProjection, destinationProjection) { + var transformFunc = getTransformFromProjections(sourceProjection, destinationProjection); + return transformFunc(point); +} +/** + * @type {Projection|null} + */ +var userProjection = null; +/** + * Set the projection for coordinates supplied from and returned by API methods. + * This includes all API methods except for those interacting with tile grids. + * @param {ProjectionLike} projection The user projection. + * @api + */ +function setUserProjection(projection) { + userProjection = proj_get(projection); +} +/** + * Clear the user projection if set. + * @api + */ +function clearUserProjection() { + userProjection = null; +} +/** + * Get the projection for coordinates supplied from and returned by API methods. + * Note that this method is not yet a part of the stable API. Support for user + * projections is not yet complete and should be considered experimental. + * @return {Projection|null} The user projection (or null if not set). + * @api + */ +function getUserProjection() { + return userProjection; +} +/** + * Use geographic coordinates (WGS-84 datum) in API methods. This includes all API + * methods except for those interacting with tile grids. + * @api + */ +function useGeographic() { + setUserProjection('EPSG:4326'); +} +/** + * Return a coordinate transformed into the user projection. If no user projection + * is set, the original coordinate is returned. + * @param {Array} coordinate Input coordinate. + * @param {ProjectionLike} sourceProjection The input coordinate projection. + * @return {Array} The input coordinate in the user projection. + */ +function toUserCoordinate(coordinate, sourceProjection) { + if (!userProjection) { + return coordinate; + } + return transform(coordinate, sourceProjection, userProjection); +} +/** + * Return a coordinate transformed from the user projection. If no user projection + * is set, the original coordinate is returned. + * @param {Array} coordinate Input coordinate. + * @param {ProjectionLike} destProjection The destination projection. + * @return {Array} The input coordinate transformed. + */ +function fromUserCoordinate(coordinate, destProjection) { + if (!userProjection) { + if (showCoordinateWarning && + !coordinate_equals(coordinate, [0, 0]) && + coordinate[0] >= -180 && + coordinate[0] <= 180 && + coordinate[1] >= -90 && + coordinate[1] <= 90) { + showCoordinateWarning = false; + // eslint-disable-next-line no-console + console.warn('Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.'); + } + return coordinate; + } + return transform(coordinate, userProjection, destProjection); +} +/** + * Return an extent transformed into the user projection. If no user projection + * is set, the original extent is returned. + * @param {import("./extent.js").Extent} extent Input extent. + * @param {ProjectionLike} sourceProjection The input extent projection. + * @return {import("./extent.js").Extent} The input extent in the user projection. + */ +function proj_toUserExtent(extent, sourceProjection) { + if (!userProjection) { + return extent; + } + return transformExtent(extent, sourceProjection, userProjection); +} +/** + * Return an extent transformed from the user projection. If no user projection + * is set, the original extent is returned. + * @param {import("./extent.js").Extent} extent Input extent. + * @param {ProjectionLike} destProjection The destination projection. + * @return {import("./extent.js").Extent} The input extent transformed. + */ +function proj_fromUserExtent(extent, destProjection) { + if (!userProjection) { + return extent; + } + return transformExtent(extent, userProjection, destProjection); +} +/** + * Return the resolution in user projection units per pixel. If no user projection + * is set, or source or user projection are missing units, the original resolution + * is returned. + * @param {number} resolution Resolution in input projection units per pixel. + * @param {ProjectionLike} sourceProjection The input projection. + * @return {number} Resolution in user projection units per pixel. + */ +function toUserResolution(resolution, sourceProjection) { + if (!userProjection) { + return resolution; + } + var sourceUnits = proj_get(sourceProjection).getUnits(); + var userUnits = userProjection.getUnits(); + return sourceUnits && userUnits + ? (resolution * Units_METERS_PER_UNIT[sourceUnits]) / Units_METERS_PER_UNIT[userUnits] + : resolution; +} +/** + * Return the resolution in user projection units per pixel. If no user projection + * is set, or source or user projection are missing units, the original resolution + * is returned. + * @param {number} resolution Resolution in user projection units per pixel. + * @param {ProjectionLike} destProjection The destination projection. + * @return {number} Resolution in destination projection units per pixel. + */ +function proj_fromUserResolution(resolution, destProjection) { + if (!userProjection) { + return resolution; + } + var sourceUnits = proj_get(destProjection).getUnits(); + var userUnits = userProjection.getUnits(); + return sourceUnits && userUnits + ? (resolution * METERS_PER_UNIT[userUnits]) / METERS_PER_UNIT[sourceUnits] + : resolution; +} +/** + * Creates a safe coordinate transform function from a coordinate transform function. + * "Safe" means that it can handle wrapping of x-coordinates for global projections, + * and that coordinates exceeding the source projection validity extent's range will be + * clamped to the validity range. + * @param {Projection} sourceProj Source projection. + * @param {Projection} destProj Destination projection. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} transform Transform function (source to destiation). + * @return {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} Safe transform function (source to destiation). + */ +function createSafeCoordinateTransform(sourceProj, destProj, transform) { + return function (coord) { + var transformed, worldsAway; + if (sourceProj.canWrapX()) { + var sourceExtent = sourceProj.getExtent(); + var sourceExtentWidth = getWidth(sourceExtent); + coord = coord.slice(0); + worldsAway = getWorldsAway(coord, sourceProj, sourceExtentWidth); + if (worldsAway) { + // Move x to the real world + coord[0] = coord[0] - worldsAway * sourceExtentWidth; + } + coord[0] = clamp(coord[0], sourceExtent[0], sourceExtent[2]); + coord[1] = clamp(coord[1], sourceExtent[1], sourceExtent[3]); + transformed = transform(coord); + } + else { + transformed = transform(coord); + } + if (worldsAway && destProj.canWrapX()) { + // Move transformed coordinate back to the offset world + transformed[0] += worldsAway * getWidth(destProj.getExtent()); + } + return transformed; + }; +} +/** + * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called + * by when this module is executed and should only need to be called again after + * `clearAllProjections()` is called (e.g. in tests). + */ +function addCommon() { + // Add transformations that don't alter coordinates to convert within set of + // projections with equal meaning. + addEquivalentProjections(PROJECTIONS); + addEquivalentProjections(epsg4326_PROJECTIONS); + // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like + // coordinates and back. + addEquivalentTransforms(epsg4326_PROJECTIONS, PROJECTIONS, fromEPSG4326, toEPSG4326); +} +addCommon(); +//# sourceMappingURL=proj.js.map +;// CONCATENATED MODULE: ./node_modules/ol/control/MousePosition.js +/** + * @module ol/control/MousePosition + */ +var MousePosition_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + + + +/** + * @type {string} + */ +var PROJECTION = 'projection'; +/** + * @type {string} + */ +var COORDINATE_FORMAT = 'coordinateFormat'; +/*** + * @template Return + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} MousePositionOnSignature + */ +/** + * @typedef {Object} Options + * @property {string} [className='ol-mouse-position'] CSS class name. + * @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format. + * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the + * control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + * @property {HTMLElement|string} [target] Specify a target if you want the + * control to be rendered outside of the map's viewport. + * @property {string|boolean} [placeholder] Markup to show when the mouse position is not + * available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space + * is rendered when the mouse leaves the viewport. To render something else, provide a string + * to be used as the text content (e.g. 'no position' or '' for an empty string). Set the placeholder + * to `false` to retain the last position when the mouse leaves the viewport. In a future release, this + * will be the default behavior. + * @property {string} [undefinedHTML=' '] This option is deprecated. Use the `placeholder` option instead. + */ +/** + * @classdesc + * A control to show the 2D coordinates of the mouse cursor. By default, these + * are in the view projection, but can be in any supported projection. + * By default the control is shown in the top right corner of the map, but this + * can be changed by using the css selector `.ol-mouse-position`. + * + * On touch devices, which usually do not have a mouse cursor, the coordinates + * of the currently touched position are shown. + * + * @api + */ +var MousePosition = /** @class */ (function (_super) { + MousePosition_extends(MousePosition, _super); + /** + * @param {Options} [opt_options] Mouse position options. + */ + function MousePosition(opt_options) { + var _this = this; + var options = opt_options ? opt_options : {}; + var element = document.createElement('div'); + element.className = + options.className !== undefined ? options.className : 'ol-mouse-position'; + _this = _super.call(this, { + element: element, + render: options.render, + target: options.target, + }) || this; + /*** + * @type {MousePositionOnSignature} + */ + _this.on; + /*** + * @type {MousePositionOnSignature} + */ + _this.once; + /*** + * @type {MousePositionOnSignature} + */ + _this.un; + _this.addChangeListener(PROJECTION, _this.handleProjectionChanged_); + if (options.coordinateFormat) { + _this.setCoordinateFormat(options.coordinateFormat); + } + if (options.projection) { + _this.setProjection(options.projection); + } + /** + * Change this to `false` when removing the deprecated `undefinedHTML` option. + * @type {boolean} + */ + var renderOnMouseOut = true; + /** + * @type {string} + */ + var placeholder = ' '; + if ('undefinedHTML' in options) { + // deprecated behavior + if (options.undefinedHTML !== undefined) { + placeholder = options.undefinedHTML; + } + renderOnMouseOut = !!placeholder; + } + else if ('placeholder' in options) { + if (options.placeholder === false) { + renderOnMouseOut = false; + } + else { + placeholder = String(options.placeholder); + } + } + /** + * @private + * @type {string} + */ + _this.placeholder_ = placeholder; + /** + * @private + * @type {boolean} + */ + _this.renderOnMouseOut_ = renderOnMouseOut; + /** + * @private + * @type {string} + */ + _this.renderedHTML_ = element.innerHTML; + /** + * @private + * @type {?import("../proj/Projection.js").default} + */ + _this.mapProjection_ = null; + /** + * @private + * @type {?import("../proj.js").TransformFunction} + */ + _this.transform_ = null; + return _this; + } + /** + * @private + */ + MousePosition.prototype.handleProjectionChanged_ = function () { + this.transform_ = null; + }; + /** + * Return the coordinate format type used to render the current position or + * undefined. + * @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current + * position in. + * @observable + * @api + */ + MousePosition.prototype.getCoordinateFormat = function () { + return /** @type {import("../coordinate.js").CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT)); + }; + /** + * Return the projection that is used to report the mouse position. + * @return {import("../proj/Projection.js").default|undefined} The projection to report mouse + * position in. + * @observable + * @api + */ + MousePosition.prototype.getProjection = function () { + return /** @type {import("../proj/Projection.js").default|undefined} */ (this.get(PROJECTION)); + }; + /** + * @param {MouseEvent} event Browser event. + * @protected + */ + MousePosition.prototype.handleMouseMove = function (event) { + var map = this.getMap(); + this.updateHTML_(map.getEventPixel(event)); + }; + /** + * @param {Event} event Browser event. + * @protected + */ + MousePosition.prototype.handleMouseOut = function (event) { + this.updateHTML_(null); + }; + /** + * Remove the control from its current map and attach it to the new map. + * Pass `null` to just remove the control from the current map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default|null} map Map. + * @api + */ + MousePosition.prototype.setMap = function (map) { + _super.prototype.setMap.call(this, map); + if (map) { + var viewport = map.getViewport(); + this.listenerKeys.push(listen(viewport, pointer_EventType.POINTERMOVE, this.handleMouseMove, this)); + if (this.renderOnMouseOut_) { + this.listenerKeys.push(listen(viewport, pointer_EventType.POINTEROUT, this.handleMouseOut, this)); + } + this.updateHTML_(null); + } + }; + /** + * Set the coordinate format type used to render the current position. + * @param {import("../coordinate.js").CoordinateFormat} format The format to render the current + * position in. + * @observable + * @api + */ + MousePosition.prototype.setCoordinateFormat = function (format) { + this.set(COORDINATE_FORMAT, format); + }; + /** + * Set the projection that is used to report the mouse position. + * @param {import("../proj.js").ProjectionLike} projection The projection to report mouse + * position in. + * @observable + * @api + */ + MousePosition.prototype.setProjection = function (projection) { + this.set(PROJECTION, proj_get(projection)); + }; + /** + * @param {?import("../pixel.js").Pixel} pixel Pixel. + * @private + */ + MousePosition.prototype.updateHTML_ = function (pixel) { + var html = this.placeholder_; + if (pixel && this.mapProjection_) { + if (!this.transform_) { + var projection = this.getProjection(); + if (projection) { + this.transform_ = getTransformFromProjections(this.mapProjection_, projection); + } + else { + this.transform_ = identityTransform; + } + } + var map = this.getMap(); + var coordinate = map.getCoordinateFromPixelInternal(pixel); + if (coordinate) { + var userProjection = getUserProjection(); + if (userProjection) { + this.transform_ = getTransformFromProjections(this.mapProjection_, userProjection); + } + this.transform_(coordinate, coordinate); + var coordinateFormat = this.getCoordinateFormat(); + if (coordinateFormat) { + html = coordinateFormat(coordinate); + } + else { + html = coordinate.toString(); + } + } + } + if (!this.renderedHTML_ || html !== this.renderedHTML_) { + this.element.innerHTML = html; + this.renderedHTML_ = html; + } + }; + /** + * Update the projection. Rendering of the coordinates is done in + * `handleMouseMove` and `handleMouseUp`. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + MousePosition.prototype.render = function (mapEvent) { + var frameState = mapEvent.frameState; + if (!frameState) { + this.mapProjection_ = null; + } + else { + if (this.mapProjection_ != frameState.viewState.projection) { + this.mapProjection_ = frameState.viewState.projection; + this.transform_ = null; + } + } + }; + return MousePosition; +}(control_Control)); +/* harmony default export */ var control_MousePosition = (MousePosition); +//# sourceMappingURL=MousePosition.js.map +;// CONCATENATED MODULE: ./node_modules/ol/easing.js +/** + * @module ol/easing + */ +/** + * Start slow and speed up. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function easeIn(t) { + return Math.pow(t, 3); +} +/** + * Start fast and slow down. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function easeOut(t) { + return 1 - easeIn(1 - t); +} +/** + * Start slow, speed up, and then slow down again. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function inAndOut(t) { + return 3 * t * t - 2 * t * t * t; +} +/** + * Maintain a constant speed over time. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function linear(t) { + return t; +} +/** + * Start slow, speed up, and at the very end slow down again. This has the + * same general behavior as {@link module:ol/easing.inAndOut}, but the final + * slowdown is delayed. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function upAndDown(t) { + if (t < 0.5) { + return inAndOut(2 * t); + } + else { + return 1 - inAndOut(2 * (t - 0.5)); + } +} +//# sourceMappingURL=easing.js.map +;// CONCATENATED MODULE: ./node_modules/ol/control/Zoom.js +var Zoom_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/control/Zoom + */ + + + + +/** + * @typedef {Object} Options + * @property {number} [duration=250] Animation duration in milliseconds. + * @property {string} [className='ol-zoom'] CSS class name. + * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button. + * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button. + * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in + * button. Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip. + * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip. + * @property {number} [delta=1] The zoom delta applied on each click. + * @property {HTMLElement|string} [target] Specify a target if you want the control to be + * rendered outside of the map's viewport. + */ +/** + * @classdesc + * A control with 2 buttons, one for zoom in and one for zoom out. + * This control is one of the default controls of a map. To style this control + * use css selectors `.ol-zoom-in` and `.ol-zoom-out`. + * + * @api + */ +var Zoom = /** @class */ (function (_super) { + Zoom_extends(Zoom, _super); + /** + * @param {Options} [opt_options] Zoom options. + */ + function Zoom(opt_options) { + var _this = this; + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + target: options.target, + }) || this; + var className = options.className !== undefined ? options.className : 'ol-zoom'; + var delta = options.delta !== undefined ? options.delta : 1; + var zoomInClassName = options.zoomInClassName !== undefined + ? options.zoomInClassName + : className + '-in'; + var zoomOutClassName = options.zoomOutClassName !== undefined + ? options.zoomOutClassName + : className + '-out'; + var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+'; + var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2013'; + var zoomInTipLabel = options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in'; + var zoomOutTipLabel = options.zoomOutTipLabel !== undefined + ? options.zoomOutTipLabel + : 'Zoom out'; + var inElement = document.createElement('button'); + inElement.className = zoomInClassName; + inElement.setAttribute('type', 'button'); + inElement.title = zoomInTipLabel; + inElement.appendChild(typeof zoomInLabel === 'string' + ? document.createTextNode(zoomInLabel) + : zoomInLabel); + inElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, delta), false); + var outElement = document.createElement('button'); + outElement.className = zoomOutClassName; + outElement.setAttribute('type', 'button'); + outElement.title = zoomOutTipLabel; + outElement.appendChild(typeof zoomOutLabel === 'string' + ? document.createTextNode(zoomOutLabel) + : zoomOutLabel); + outElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, -delta), false); + var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL; + var element = _this.element; + element.className = cssClasses; + element.appendChild(inElement); + element.appendChild(outElement); + /** + * @type {number} + * @private + */ + _this.duration_ = options.duration !== undefined ? options.duration : 250; + return _this; + } + /** + * @param {number} delta Zoom delta. + * @param {MouseEvent} event The event to handle + * @private + */ + Zoom.prototype.handleClick_ = function (delta, event) { + event.preventDefault(); + this.zoomByDelta_(delta); + }; + /** + * @param {number} delta Zoom delta. + * @private + */ + Zoom.prototype.zoomByDelta_ = function (delta) { + var map = this.getMap(); + var view = map.getView(); + if (!view) { + // the map does not have a view, so we can't act + // upon it + return; + } + var currentZoom = view.getZoom(); + if (currentZoom !== undefined) { + var newZoom = view.getConstrainedZoom(currentZoom + delta); + if (this.duration_ > 0) { + if (view.getAnimating()) { + view.cancelAnimations(); + } + view.animate({ + zoom: newZoom, + duration: this.duration_, + easing: easeOut, + }); + } + else { + view.setZoom(newZoom); + } + } + }; + return Zoom; +}(control_Control)); +/* harmony default export */ var control_Zoom = (Zoom); +//# sourceMappingURL=Zoom.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/GeometryLayout.js +/** + * @module ol/geom/GeometryLayout + */ +/** + * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z') + * or measure ('M') coordinate is available. Supported values are `'XY'`, + * `'XYZ'`, `'XYM'`, `'XYZM'`. + * @enum {string} + */ +/* harmony default export */ var geom_GeometryLayout = ({ + XY: 'XY', + XYZ: 'XYZ', + XYM: 'XYM', + XYZM: 'XYZM', +}); +//# sourceMappingURL=GeometryLayout.js.map +;// CONCATENATED MODULE: ./node_modules/ol/transform.js +/** + * @module ol/transform + */ + + +/** + * An array representing an affine 2d transformation for use with + * {@link module:ol/transform} functions. The array has 6 elements. + * @typedef {!Array} Transform + * @api + */ +/** + * Collection of affine 2d transformation functions. The functions work on an + * array of 6 elements. The element order is compatible with the [SVGMatrix + * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is + * a subset (elements a to f) of a 3×3 matrix: + * ``` + * [ a c e ] + * [ b d f ] + * [ 0 0 1 ] + * ``` + */ +/** + * @private + * @type {Transform} + */ +var tmp_ = new Array(6); +/** + * Create an identity transform. + * @return {!Transform} Identity transform. + */ +function create() { + return [1, 0, 0, 1, 0, 0]; +} +/** + * Resets the given transform to an identity transform. + * @param {!Transform} transform Transform. + * @return {!Transform} Transform. + */ +function transform_reset(transform) { + return set(transform, 1, 0, 0, 1, 0, 0); +} +/** + * Multiply the underlying matrices of two transforms and return the result in + * the first transform. + * @param {!Transform} transform1 Transform parameters of matrix 1. + * @param {!Transform} transform2 Transform parameters of matrix 2. + * @return {!Transform} transform1 multiplied with transform2. + */ +function multiply(transform1, transform2) { + var a1 = transform1[0]; + var b1 = transform1[1]; + var c1 = transform1[2]; + var d1 = transform1[3]; + var e1 = transform1[4]; + var f1 = transform1[5]; + var a2 = transform2[0]; + var b2 = transform2[1]; + var c2 = transform2[2]; + var d2 = transform2[3]; + var e2 = transform2[4]; + var f2 = transform2[5]; + transform1[0] = a1 * a2 + c1 * b2; + transform1[1] = b1 * a2 + d1 * b2; + transform1[2] = a1 * c2 + c1 * d2; + transform1[3] = b1 * c2 + d1 * d2; + transform1[4] = a1 * e2 + c1 * f2 + e1; + transform1[5] = b1 * e2 + d1 * f2 + f1; + return transform1; +} +/** + * Set the transform components a-f on a given transform. + * @param {!Transform} transform Transform. + * @param {number} a The a component of the transform. + * @param {number} b The b component of the transform. + * @param {number} c The c component of the transform. + * @param {number} d The d component of the transform. + * @param {number} e The e component of the transform. + * @param {number} f The f component of the transform. + * @return {!Transform} Matrix with transform applied. + */ +function set(transform, a, b, c, d, e, f) { + transform[0] = a; + transform[1] = b; + transform[2] = c; + transform[3] = d; + transform[4] = e; + transform[5] = f; + return transform; +} +/** + * Set transform on one matrix from another matrix. + * @param {!Transform} transform1 Matrix to set transform to. + * @param {!Transform} transform2 Matrix to set transform from. + * @return {!Transform} transform1 with transform from transform2 applied. + */ +function setFromArray(transform1, transform2) { + transform1[0] = transform2[0]; + transform1[1] = transform2[1]; + transform1[2] = transform2[2]; + transform1[3] = transform2[3]; + transform1[4] = transform2[4]; + transform1[5] = transform2[5]; + return transform1; +} +/** + * Transforms the given coordinate with the given transform returning the + * resulting, transformed coordinate. The coordinate will be modified in-place. + * + * @param {Transform} transform The transformation. + * @param {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} coordinate The coordinate to transform. + * @return {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} return coordinate so that operations can be + * chained together. + */ +function apply(transform, coordinate) { + var x = coordinate[0]; + var y = coordinate[1]; + coordinate[0] = transform[0] * x + transform[2] * y + transform[4]; + coordinate[1] = transform[1] * x + transform[3] * y + transform[5]; + return coordinate; +} +/** + * Applies rotation to the given transform. + * @param {!Transform} transform Transform. + * @param {number} angle Angle in radians. + * @return {!Transform} The rotated transform. + */ +function transform_rotate(transform, angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0)); +} +/** + * Applies scale to a given transform. + * @param {!Transform} transform Transform. + * @param {number} x Scale factor x. + * @param {number} y Scale factor y. + * @return {!Transform} The scaled transform. + */ +function transform_scale(transform, x, y) { + return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0)); +} +/** + * Creates a scale transform. + * @param {!Transform} target Transform to overwrite. + * @param {number} x Scale factor x. + * @param {number} y Scale factor y. + * @return {!Transform} The scale transform. + */ +function makeScale(target, x, y) { + return set(target, x, 0, 0, y, 0, 0); +} +/** + * Applies translation to the given transform. + * @param {!Transform} transform Transform. + * @param {number} dx Translation x. + * @param {number} dy Translation y. + * @return {!Transform} The translated transform. + */ +function translate(transform, dx, dy) { + return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy)); +} +/** + * Creates a composite transform given an initial translation, scale, rotation, and + * final translation (in that order only, not commutative). + * @param {!Transform} transform The transform (will be modified in place). + * @param {number} dx1 Initial translation x. + * @param {number} dy1 Initial translation y. + * @param {number} sx Scale factor x. + * @param {number} sy Scale factor y. + * @param {number} angle Rotation (in counter-clockwise radians). + * @param {number} dx2 Final translation x. + * @param {number} dy2 Final translation y. + * @return {!Transform} The composite transform. + */ +function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) { + var sin = Math.sin(angle); + var cos = Math.cos(angle); + transform[0] = sx * cos; + transform[1] = sy * sin; + transform[2] = -sx * sin; + transform[3] = sy * cos; + transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1; + transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1; + return transform; +} +/** + * Creates a composite transform given an initial translation, scale, rotation, and + * final translation (in that order only, not commutative). The resulting transform + * string can be applied as `transform` property of an HTMLElement's style. + * @param {number} dx1 Initial translation x. + * @param {number} dy1 Initial translation y. + * @param {number} sx Scale factor x. + * @param {number} sy Scale factor y. + * @param {number} angle Rotation (in counter-clockwise radians). + * @param {number} dx2 Final translation x. + * @param {number} dy2 Final translation y. + * @return {string} The composite css transform. + * @api + */ +function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) { + return transform_toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2)); +} +/** + * Invert the given transform. + * @param {!Transform} source The source transform to invert. + * @return {!Transform} The inverted (source) transform. + */ +function invert(source) { + return makeInverse(source, source); +} +/** + * Invert the given transform. + * @param {!Transform} target Transform to be set as the inverse of + * the source transform. + * @param {!Transform} source The source transform to invert. + * @return {!Transform} The inverted (target) transform. + */ +function makeInverse(target, source) { + var det = determinant(source); + asserts_assert(det !== 0, 32); // Transformation matrix cannot be inverted + var a = source[0]; + var b = source[1]; + var c = source[2]; + var d = source[3]; + var e = source[4]; + var f = source[5]; + target[0] = d / det; + target[1] = -b / det; + target[2] = -c / det; + target[3] = a / det; + target[4] = (c * f - d * e) / det; + target[5] = -(a * f - b * e) / det; + return target; +} +/** + * Returns the determinant of the given matrix. + * @param {!Transform} mat Matrix. + * @return {number} Determinant. + */ +function determinant(mat) { + return mat[0] * mat[3] - mat[1] * mat[2]; +} +/** + * @type {HTMLElement} + * @private + */ +var transformStringDiv; +/** + * A rounded string version of the transform. This can be used + * for CSS transforms. + * @param {!Transform} mat Matrix. + * @return {string} The transform as a string. + */ +function transform_toString(mat) { + var transformString = 'matrix(' + mat.join(', ') + ')'; + if (WORKER_OFFSCREEN_CANVAS) { + return transformString; + } + var node = transformStringDiv || (transformStringDiv = document.createElement('div')); + node.style.transform = transformString; + return node.style.transform; +} +//# sourceMappingURL=transform.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/transform.js +/** + * @module ol/geom/flat/transform + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {Array} [opt_dest] Destination. + * @return {Array} Transformed coordinates. + */ +function transform2D(flatCoordinates, offset, end, stride, transform, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var i = 0; + for (var j = offset; j < end; j += stride) { + var x = flatCoordinates[j]; + var y = flatCoordinates[j + 1]; + dest[i++] = transform[0] * x + transform[2] * y + transform[4]; + dest[i++] = transform[1] * x + transform[3] * y + transform[5]; + } + if (opt_dest && dest.length != i) { + dest.length = i; + } + return dest; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} angle Angle. + * @param {Array} anchor Rotation anchor point. + * @param {Array} [opt_dest] Destination. + * @return {Array} Transformed coordinates. + */ +function flat_transform_rotate(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var anchorX = anchor[0]; + var anchorY = anchor[1]; + var i = 0; + for (var j = offset; j < end; j += stride) { + var deltaX = flatCoordinates[j] - anchorX; + var deltaY = flatCoordinates[j + 1] - anchorY; + dest[i++] = anchorX + deltaX * cos - deltaY * sin; + dest[i++] = anchorY + deltaX * sin + deltaY * cos; + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + if (opt_dest && dest.length != i) { + dest.length = i; + } + return dest; +} +/** + * Scale the coordinates. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} sx Scale factor in the x-direction. + * @param {number} sy Scale factor in the y-direction. + * @param {Array} anchor Scale anchor point. + * @param {Array} [opt_dest] Destination. + * @return {Array} Transformed coordinates. + */ +function flat_transform_scale(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var anchorX = anchor[0]; + var anchorY = anchor[1]; + var i = 0; + for (var j = offset; j < end; j += stride) { + var deltaX = flatCoordinates[j] - anchorX; + var deltaY = flatCoordinates[j + 1] - anchorY; + dest[i++] = anchorX + sx * deltaX; + dest[i++] = anchorY + sy * deltaY; + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + if (opt_dest && dest.length != i) { + dest.length = i; + } + return dest; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @param {Array} [opt_dest] Destination. + * @return {Array} Transformed coordinates. + */ +function transform_translate(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var i = 0; + for (var j = offset; j < end; j += stride) { + dest[i++] = flatCoordinates[j] + deltaX; + dest[i++] = flatCoordinates[j + 1] + deltaY; + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + if (opt_dest && dest.length != i) { + dest.length = i; + } + return dest; +} +//# sourceMappingURL=transform.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/Geometry.js +var Geometry_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/Geometry + */ + + + + + + + + +/** + * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'} Type + * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`, + * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`, + * `'GeometryCollection'`, or `'Circle'`. + */ +/** + * @type {import("../transform.js").Transform} + */ +var tmpTransform = create(); +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Base class for vector geometries. + * + * To get notified of changes to the geometry, register a listener for the + * generic `change` event on your geometry instance. + * + * @abstract + * @api + */ +var Geometry = /** @class */ (function (_super) { + Geometry_extends(Geometry, _super); + function Geometry() { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../extent.js").Extent} + */ + _this.extent_ = createEmpty(); + /** + * @private + * @type {number} + */ + _this.extentRevision_ = -1; + /** + * @protected + * @type {number} + */ + _this.simplifiedGeometryMaxMinSquaredTolerance = 0; + /** + * @protected + * @type {number} + */ + _this.simplifiedGeometryRevision = 0; + /** + * Get a transformed and simplified version of the geometry. + * @abstract + * @param {number} revision The geometry revision. + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function. + * @return {Geometry} Simplified geometry. + */ + _this.simplifyTransformedInternal = memoizeOne(function (revision, squaredTolerance, opt_transform) { + if (!opt_transform) { + return this.getSimplifiedGeometry(squaredTolerance); + } + var clone = this.clone(); + clone.applyTransform(opt_transform); + return clone.getSimplifiedGeometry(squaredTolerance); + }); + return _this; + } + /** + * Get a transformed and simplified version of the geometry. + * @abstract + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function. + * @return {Geometry} Simplified geometry. + */ + Geometry.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) { + return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform); + }; + /** + * Make a complete copy of the geometry. + * @abstract + * @return {!Geometry} Clone. + */ + Geometry.prototype.clone = function () { + return util_abstract(); + }; + /** + * @abstract + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + Geometry.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + return util_abstract(); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + Geometry.prototype.containsXY = function (x, y) { + var coord = this.getClosestPoint([x, y]); + return coord[0] === x && coord[1] === y; + }; + /** + * Return the closest point of the geometry to the passed point as + * {@link module:ol/coordinate~Coordinate coordinate}. + * @param {import("../coordinate.js").Coordinate} point Point. + * @param {import("../coordinate.js").Coordinate} [opt_closestPoint] Closest point. + * @return {import("../coordinate.js").Coordinate} Closest point. + * @api + */ + Geometry.prototype.getClosestPoint = function (point, opt_closestPoint) { + var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN]; + this.closestPointXY(point[0], point[1], closestPoint, Infinity); + return closestPoint; + }; + /** + * Returns true if this geometry includes the specified coordinate. If the + * coordinate is on the boundary of the geometry, returns false. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} Contains coordinate. + * @api + */ + Geometry.prototype.intersectsCoordinate = function (coordinate) { + return this.containsXY(coordinate[0], coordinate[1]); + }; + /** + * @abstract + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + Geometry.prototype.computeExtent = function (extent) { + return util_abstract(); + }; + /** + * Get the extent of the geometry. + * @param {import("../extent.js").Extent} [opt_extent] Extent. + * @return {import("../extent.js").Extent} extent Extent. + * @api + */ + Geometry.prototype.getExtent = function (opt_extent) { + if (this.extentRevision_ != this.getRevision()) { + var extent = this.computeExtent(this.extent_); + if (isNaN(extent[0]) || isNaN(extent[1])) { + createOrUpdateEmpty(extent); + } + this.extentRevision_ = this.getRevision(); + } + return returnOrUpdate(this.extent_, opt_extent); + }; + /** + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @abstract + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. + * @api + */ + Geometry.prototype.rotate = function (angle, anchor) { + util_abstract(); + }; + /** + * Scale the geometry (with an optional origin). This modifies the geometry + * coordinates in place. + * @abstract + * @param {number} sx The scaling factor in the x-direction. + * @param {number} [opt_sy] The scaling factor in the y-direction (defaults to sx). + * @param {import("../coordinate.js").Coordinate} [opt_anchor] The scale origin (defaults to the center + * of the geometry extent). + * @api + */ + Geometry.prototype.scale = function (sx, opt_sy, opt_anchor) { + util_abstract(); + }; + /** + * Create a simplified version of this geometry. For linestrings, this uses + * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm) + * algorithm. For polygons, a quantization-based + * simplification is used to preserve topology. + * @param {number} tolerance The tolerance distance for simplification. + * @return {Geometry} A new, simplified version of the original geometry. + * @api + */ + Geometry.prototype.simplify = function (tolerance) { + return this.getSimplifiedGeometry(tolerance * tolerance); + }; + /** + * Create a simplified version of this geometry using the Douglas Peucker + * algorithm. + * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm. + * @abstract + * @param {number} squaredTolerance Squared tolerance. + * @return {Geometry} Simplified geometry. + */ + Geometry.prototype.getSimplifiedGeometry = function (squaredTolerance) { + return util_abstract(); + }; + /** + * Get the type of this geometry. + * @abstract + * @return {Type} Geometry type. + */ + Geometry.prototype.getType = function () { + return util_abstract(); + }; + /** + * Apply a transform function to the coordinates of the geometry. + * The geometry is modified in place. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * @abstract + * @param {import("../proj.js").TransformFunction} transformFn Transform function. + * Called with a flat array of geometry coordinates. + */ + Geometry.prototype.applyTransform = function (transformFn) { + util_abstract(); + }; + /** + * Test if the geometry and the passed extent intersect. + * @abstract + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + */ + Geometry.prototype.intersectsExtent = function (extent) { + return util_abstract(); + }; + /** + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @abstract + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @api + */ + Geometry.prototype.translate = function (deltaX, deltaY) { + util_abstract(); + }; + /** + * Transform each coordinate of the geometry from one coordinate reference + * system to another. The geometry is modified in place. + * For example, a line will be transformed to a line and a circle to a circle. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * + * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @return {Geometry} This geometry. Note that original geometry is + * modified in place. + * @api + */ + Geometry.prototype.transform = function (source, destination) { + /** @type {import("../proj/Projection.js").default} */ + var sourceProj = proj_get(source); + var transformFn = sourceProj.getUnits() == proj_Units.TILE_PIXELS + ? function (inCoordinates, outCoordinates, stride) { + var pixelExtent = sourceProj.getExtent(); + var projectedExtent = sourceProj.getWorldExtent(); + var scale = getHeight(projectedExtent) / getHeight(pixelExtent); + compose(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0); + transform2D(inCoordinates, 0, inCoordinates.length, stride, tmpTransform, outCoordinates); + return getTransform(sourceProj, destination)(inCoordinates, outCoordinates, stride); + } + : getTransform(sourceProj, destination); + this.applyTransform(transformFn); + return this; + }; + return Geometry; +}(ol_Object)); +/* harmony default export */ var geom_Geometry = (Geometry); +//# sourceMappingURL=Geometry.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/SimpleGeometry.js +var SimpleGeometry_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/SimpleGeometry + */ + + + + + +/** + * @classdesc + * Abstract base class; only used for creating subclasses; do not instantiate + * in apps, as cannot be rendered. + * + * @abstract + * @api + */ +var SimpleGeometry = /** @class */ (function (_super) { + SimpleGeometry_extends(SimpleGeometry, _super); + function SimpleGeometry() { + var _this = _super.call(this) || this; + /** + * @protected + * @type {import("./GeometryLayout.js").default} + */ + _this.layout = geom_GeometryLayout.XY; + /** + * @protected + * @type {number} + */ + _this.stride = 2; + /** + * @protected + * @type {Array} + */ + _this.flatCoordinates = null; + return _this; + } + /** + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + SimpleGeometry.prototype.computeExtent = function (extent) { + return createOrUpdateFromFlatCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent); + }; + /** + * @abstract + * @return {Array<*> | null} Coordinates. + */ + SimpleGeometry.prototype.getCoordinates = function () { + return util_abstract(); + }; + /** + * Return the first coordinate of the geometry. + * @return {import("../coordinate.js").Coordinate} First coordinate. + * @api + */ + SimpleGeometry.prototype.getFirstCoordinate = function () { + return this.flatCoordinates.slice(0, this.stride); + }; + /** + * @return {Array} Flat coordinates. + */ + SimpleGeometry.prototype.getFlatCoordinates = function () { + return this.flatCoordinates; + }; + /** + * Return the last coordinate of the geometry. + * @return {import("../coordinate.js").Coordinate} Last point. + * @api + */ + SimpleGeometry.prototype.getLastCoordinate = function () { + return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride); + }; + /** + * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry. + * @return {import("./GeometryLayout.js").default} Layout. + * @api + */ + SimpleGeometry.prototype.getLayout = function () { + return this.layout; + }; + /** + * Create a simplified version of this geometry using the Douglas Peucker algorithm. + * @param {number} squaredTolerance Squared tolerance. + * @return {SimpleGeometry} Simplified geometry. + */ + SimpleGeometry.prototype.getSimplifiedGeometry = function (squaredTolerance) { + if (this.simplifiedGeometryRevision !== this.getRevision()) { + this.simplifiedGeometryMaxMinSquaredTolerance = 0; + this.simplifiedGeometryRevision = this.getRevision(); + } + // If squaredTolerance is negative or if we know that simplification will not + // have any effect then just return this. + if (squaredTolerance < 0 || + (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && + squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)) { + return this; + } + var simplifiedGeometry = this.getSimplifiedGeometryInternal(squaredTolerance); + var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates(); + if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) { + return simplifiedGeometry; + } + else { + // Simplification did not actually remove any coordinates. We now know + // that any calls to getSimplifiedGeometry with a squaredTolerance less + // than or equal to the current squaredTolerance will also not have any + // effect. This allows us to short circuit simplification (saving CPU + // cycles) and prevents the cache of simplified geometries from filling + // up with useless identical copies of this geometry (saving memory). + this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance; + return this; + } + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {SimpleGeometry} Simplified geometry. + * @protected + */ + SimpleGeometry.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + return this; + }; + /** + * @return {number} Stride. + */ + SimpleGeometry.prototype.getStride = function () { + return this.stride; + }; + /** + * @param {import("./GeometryLayout.js").default} layout Layout. + * @param {Array} flatCoordinates Flat coordinates. + */ + SimpleGeometry.prototype.setFlatCoordinates = function (layout, flatCoordinates) { + this.stride = getStrideForLayout(layout); + this.layout = layout; + this.flatCoordinates = flatCoordinates; + }; + /** + * @abstract + * @param {!Array<*>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + SimpleGeometry.prototype.setCoordinates = function (coordinates, opt_layout) { + util_abstract(); + }; + /** + * @param {import("./GeometryLayout.js").default|undefined} layout Layout. + * @param {Array<*>} coordinates Coordinates. + * @param {number} nesting Nesting. + * @protected + */ + SimpleGeometry.prototype.setLayout = function (layout, coordinates, nesting) { + /** @type {number} */ + var stride; + if (layout) { + stride = getStrideForLayout(layout); + } + else { + for (var i = 0; i < nesting; ++i) { + if (coordinates.length === 0) { + this.layout = geom_GeometryLayout.XY; + this.stride = 2; + return; + } + else { + coordinates = /** @type {Array} */ (coordinates[0]); + } + } + stride = coordinates.length; + layout = getLayoutForStride(stride); + } + this.layout = layout; + this.stride = stride; + }; + /** + * Apply a transform function to the coordinates of the geometry. + * The geometry is modified in place. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * @param {import("../proj.js").TransformFunction} transformFn Transform function. + * Called with a flat array of geometry coordinates. + * @api + */ + SimpleGeometry.prototype.applyTransform = function (transformFn) { + if (this.flatCoordinates) { + transformFn(this.flatCoordinates, this.flatCoordinates, this.stride); + this.changed(); + } + }; + /** + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @param {number} angle Rotation angle in counter-clockwise radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. + * @api + */ + SimpleGeometry.prototype.rotate = function (angle, anchor) { + var flatCoordinates = this.getFlatCoordinates(); + if (flatCoordinates) { + var stride = this.getStride(); + flat_transform_rotate(flatCoordinates, 0, flatCoordinates.length, stride, angle, anchor, flatCoordinates); + this.changed(); + } + }; + /** + * Scale the geometry (with an optional origin). This modifies the geometry + * coordinates in place. + * @param {number} sx The scaling factor in the x-direction. + * @param {number} [opt_sy] The scaling factor in the y-direction (defaults to sx). + * @param {import("../coordinate.js").Coordinate} [opt_anchor] The scale origin (defaults to the center + * of the geometry extent). + * @api + */ + SimpleGeometry.prototype.scale = function (sx, opt_sy, opt_anchor) { + var sy = opt_sy; + if (sy === undefined) { + sy = sx; + } + var anchor = opt_anchor; + if (!anchor) { + anchor = getCenter(this.getExtent()); + } + var flatCoordinates = this.getFlatCoordinates(); + if (flatCoordinates) { + var stride = this.getStride(); + flat_transform_scale(flatCoordinates, 0, flatCoordinates.length, stride, sx, sy, anchor, flatCoordinates); + this.changed(); + } + }; + /** + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @api + */ + SimpleGeometry.prototype.translate = function (deltaX, deltaY) { + var flatCoordinates = this.getFlatCoordinates(); + if (flatCoordinates) { + var stride = this.getStride(); + transform_translate(flatCoordinates, 0, flatCoordinates.length, stride, deltaX, deltaY, flatCoordinates); + this.changed(); + } + }; + return SimpleGeometry; +}(geom_Geometry)); +/** + * @param {number} stride Stride. + * @return {import("./GeometryLayout.js").default} layout Layout. + */ +function getLayoutForStride(stride) { + var layout; + if (stride == 2) { + layout = geom_GeometryLayout.XY; + } + else if (stride == 3) { + layout = geom_GeometryLayout.XYZ; + } + else if (stride == 4) { + layout = geom_GeometryLayout.XYZM; + } + return /** @type {import("./GeometryLayout.js").default} */ (layout); +} +/** + * @param {import("./GeometryLayout.js").default} layout Layout. + * @return {number} Stride. + */ +function getStrideForLayout(layout) { + var stride; + if (layout == geom_GeometryLayout.XY) { + stride = 2; + } + else if (layout == geom_GeometryLayout.XYZ || layout == geom_GeometryLayout.XYM) { + stride = 3; + } + else if (layout == geom_GeometryLayout.XYZM) { + stride = 4; + } + return /** @type {number} */ (stride); +} +/** + * @param {SimpleGeometry} simpleGeometry Simple geometry. + * @param {import("../transform.js").Transform} transform Transform. + * @param {Array} [opt_dest] Destination. + * @return {Array} Transformed flat coordinates. + */ +function transformGeom2D(simpleGeometry, transform, opt_dest) { + var flatCoordinates = simpleGeometry.getFlatCoordinates(); + if (!flatCoordinates) { + return null; + } + else { + var stride = simpleGeometry.getStride(); + return transform2D(flatCoordinates, 0, flatCoordinates.length, stride, transform, opt_dest); + } +} +/* harmony default export */ var geom_SimpleGeometry = (SimpleGeometry); +//# sourceMappingURL=SimpleGeometry.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/closest.js +/** + * @module ol/geom/flat/closest + */ + +/** + * Returns the point on the 2D line segment flatCoordinates[offset1] to + * flatCoordinates[offset2] that is closest to the point (x, y). Extra + * dimensions are linearly interpolated. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset1 Offset 1. + * @param {number} offset2 Offset 2. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @param {Array} closestPoint Closest point. + */ +function assignClosest(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) { + var x1 = flatCoordinates[offset1]; + var y1 = flatCoordinates[offset1 + 1]; + var dx = flatCoordinates[offset2] - x1; + var dy = flatCoordinates[offset2 + 1] - y1; + var offset; + if (dx === 0 && dy === 0) { + offset = offset1; + } + else { + var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); + if (t > 1) { + offset = offset2; + } + else if (t > 0) { + for (var i = 0; i < stride; ++i) { + closestPoint[i] = lerp(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t); + } + closestPoint.length = stride; + return; + } + else { + offset = offset1; + } + } + for (var i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[offset + i]; + } + closestPoint.length = stride; +} +/** + * Return the squared of the largest distance between any pair of consecutive + * coordinates. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ +function maxSquaredDelta(flatCoordinates, offset, end, stride, max) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + for (offset += stride; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + var squaredDelta = math_squaredDistance(x1, y1, x2, y2); + if (squaredDelta > max) { + max = squaredDelta; + } + x1 = x2; + y1 = y2; + } + return max; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ +function arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + max = maxSquaredDelta(flatCoordinates, offset, end, stride, max); + offset = end; + } + return max; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ +function multiArrayMaxSquaredDelta(flatCoordinates, offset, endss, stride, max) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max); + offset = ends[ends.length - 1]; + } + return max; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array} [opt_tmpPoint] Temporary point object. + * @return {number} Minimum squared distance. + */ +function assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + if (offset == end) { + return minSquaredDistance; + } + var i, squaredDistance; + if (maxDelta === 0) { + // All points are identical, so just test the first point. + squaredDistance = math_squaredDistance(x, y, flatCoordinates[offset], flatCoordinates[offset + 1]); + if (squaredDistance < minSquaredDistance) { + for (i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[offset + i]; + } + closestPoint.length = stride; + return squaredDistance; + } + else { + return minSquaredDistance; + } + } + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + var index = offset + stride; + while (index < end) { + assignClosest(flatCoordinates, index - stride, index, stride, x, y, tmpPoint); + squaredDistance = math_squaredDistance(x, y, tmpPoint[0], tmpPoint[1]); + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + for (i = 0; i < stride; ++i) { + closestPoint[i] = tmpPoint[i]; + } + closestPoint.length = stride; + index += stride; + } + else { + // Skip ahead multiple points, because we know that all the skipped + // points cannot be any closer than the closest point we have found so + // far. We know this because we know how close the current point is, how + // close the closest point we have found so far is, and the maximum + // distance between consecutive points. For example, if we're currently + // at distance 10, the best we've found so far is 3, and that the maximum + // distance between consecutive points is 2, then we'll need to skip at + // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of + // finding a closer point. We use Math.max(..., 1) to ensure that we + // always advance at least one point, to avoid an infinite loop. + index += + stride * + Math.max(((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) / + maxDelta) | + 0, 1); + } + } + if (isRing) { + // Check the closing segment. + assignClosest(flatCoordinates, end - stride, offset, stride, x, y, tmpPoint); + squaredDistance = math_squaredDistance(x, y, tmpPoint[0], tmpPoint[1]); + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + for (i = 0; i < stride; ++i) { + closestPoint[i] = tmpPoint[i]; + } + closestPoint.length = stride; + } + } + return minSquaredDistance; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array} [opt_tmpPoint] Temporary point object. + * @return {number} Minimum squared distance. + */ +function assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + minSquaredDistance = assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); + offset = end; + } + return minSquaredDistance; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array} [opt_tmpPoint] Temporary point object. + * @return {number} Minimum squared distance. + */ +function assignClosestMultiArrayPoint(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + minSquaredDistance = assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); + offset = ends[ends.length - 1]; + } + return minSquaredDistance; +} +//# sourceMappingURL=closest.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/deflate.js +/** + * @module ol/geom/flat/deflate + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {number} stride Stride. + * @return {number} offset Offset. + */ +function deflateCoordinate(flatCoordinates, offset, coordinate, stride) { + for (var i = 0, ii = coordinate.length; i < ii; ++i) { + flatCoordinates[offset++] = coordinate[i]; + } + return offset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} coordinates Coordinates. + * @param {number} stride Stride. + * @return {number} offset Offset. + */ +function deflateCoordinates(flatCoordinates, offset, coordinates, stride) { + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + var coordinate = coordinates[i]; + for (var j = 0; j < stride; ++j) { + flatCoordinates[offset++] = coordinate[j]; + } + } + return offset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} coordinatess Coordinatess. + * @param {number} stride Stride. + * @param {Array} [opt_ends] Ends. + * @return {Array} Ends. + */ +function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, stride, opt_ends) { + var ends = opt_ends ? opt_ends : []; + var i = 0; + for (var j = 0, jj = coordinatess.length; j < jj; ++j) { + var end = deflateCoordinates(flatCoordinates, offset, coordinatess[j], stride); + ends[i++] = end; + offset = end; + } + ends.length = i; + return ends; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>>} coordinatesss Coordinatesss. + * @param {number} stride Stride. + * @param {Array>} [opt_endss] Endss. + * @return {Array>} Endss. + */ +function deflateMultiCoordinatesArray(flatCoordinates, offset, coordinatesss, stride, opt_endss) { + var endss = opt_endss ? opt_endss : []; + var i = 0; + for (var j = 0, jj = coordinatesss.length; j < jj; ++j) { + var ends = deflateCoordinatesArray(flatCoordinates, offset, coordinatesss[j], stride, endss[i]); + endss[i++] = ends; + offset = ends[ends.length - 1]; + } + endss.length = i; + return endss; +} +//# sourceMappingURL=deflate.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/simplify.js +/** + * @module ol/geom/flat/simplify + */ +// Based on simplify-js https://github.com/mourner/simplify-js +// Copyright (c) 2012, Vladimir Agafonkin +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {boolean} highQuality Highest quality. + * @param {Array} [opt_simplifiedFlatCoordinates] Simplified flat + * coordinates. + * @return {Array} Simplified line string. + */ +function simplifyLineString(flatCoordinates, offset, end, stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) { + var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined + ? opt_simplifiedFlatCoordinates + : []; + if (!highQuality) { + end = radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0); + flatCoordinates = simplifiedFlatCoordinates; + offset = 0; + stride = 2; + } + simplifiedFlatCoordinates.length = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return simplifiedFlatCoordinates; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { + var n = (end - offset) / stride; + if (n < 3) { + for (; offset < end; offset += stride) { + simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + 1]; + } + return simplifiedOffset; + } + /** @type {Array} */ + var markers = new Array(n); + markers[0] = 1; + markers[n - 1] = 1; + /** @type {Array} */ + var stack = [offset, end - stride]; + var index = 0; + while (stack.length > 0) { + var last = stack.pop(); + var first = stack.pop(); + var maxSquaredDistance = 0; + var x1 = flatCoordinates[first]; + var y1 = flatCoordinates[first + 1]; + var x2 = flatCoordinates[last]; + var y2 = flatCoordinates[last + 1]; + for (var i = first + stride; i < last; i += stride) { + var x = flatCoordinates[i]; + var y = flatCoordinates[i + 1]; + var squaredDistance_1 = squaredSegmentDistance(x, y, x1, y1, x2, y2); + if (squaredDistance_1 > maxSquaredDistance) { + index = i; + maxSquaredDistance = squaredDistance_1; + } + } + if (maxSquaredDistance > squaredTolerance) { + markers[(index - offset) / stride] = 1; + if (first + stride < index) { + stack.push(first, index); + } + if (index + stride < last) { + stack.push(index, last); + } + } + } + for (var i = 0; i < n; ++i) { + if (markers[i]) { + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + i * stride]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + i * stride + 1]; + } + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array} simplifiedEnds Simplified ends. + * @return {number} Simplified offset. + */ +function douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + simplifiedOffset = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset); + simplifiedEnds.push(simplifiedOffset); + offset = end; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array>} simplifiedEndss Simplified endss. + * @return {number} Simplified offset. + */ +function douglasPeuckerMultiArray(flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + var simplifiedEnds = []; + simplifiedOffset = douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); + simplifiedEndss.push(simplifiedEnds); + offset = ends[ends.length - 1]; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { + if (end <= offset + stride) { + // zero or one point, no simplification possible, so copy and return + for (; offset < end; offset += stride) { + simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + 1]; + } + return simplifiedOffset; + } + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + // copy first point + simplifiedFlatCoordinates[simplifiedOffset++] = x1; + simplifiedFlatCoordinates[simplifiedOffset++] = y1; + var x2 = x1; + var y2 = y1; + for (offset += stride; offset < end; offset += stride) { + x2 = flatCoordinates[offset]; + y2 = flatCoordinates[offset + 1]; + if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) { + // copy point at offset + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + x1 = x2; + y1 = y2; + } + } + if (x2 != x1 || y2 != y1) { + // copy last point + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + } + return simplifiedOffset; +} +/** + * @param {number} value Value. + * @param {number} tolerance Tolerance. + * @return {number} Rounded value. + */ +function snap(value, tolerance) { + return tolerance * Math.round(value / tolerance); +} +/** + * Simplifies a line string using an algorithm designed by Tim Schaub. + * Coordinates are snapped to the nearest value in a virtual grid and + * consecutive duplicate coordinates are discarded. This effectively preserves + * topology as the simplification of any subsection of a line string is + * independent of the rest of the line string. This means that, for examples, + * the common edge between two polygons will be simplified to the same line + * string independently in both polygons. This implementation uses a single + * pass over the coordinates and eliminates intermediate collinear points. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset) { + // do nothing if the line is empty + if (offset == end) { + return simplifiedOffset; + } + // snap the first coordinate (P1) + var x1 = snap(flatCoordinates[offset], tolerance); + var y1 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + // add the first coordinate to the output + simplifiedFlatCoordinates[simplifiedOffset++] = x1; + simplifiedFlatCoordinates[simplifiedOffset++] = y1; + // find the next coordinate that does not snap to the same value as the first + // coordinate (P2) + var x2, y2; + do { + x2 = snap(flatCoordinates[offset], tolerance); + y2 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + if (offset == end) { + // all coordinates snap to the same value, the line collapses to a point + // push the last snapped value anyway to ensure that the output contains + // at least two points + // FIXME should we really return at least two points anyway? + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + return simplifiedOffset; + } + } while (x2 == x1 && y2 == y1); + while (offset < end) { + // snap the next coordinate (P3) + var x3 = snap(flatCoordinates[offset], tolerance); + var y3 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + // skip P3 if it is equal to P2 + if (x3 == x2 && y3 == y2) { + continue; + } + // calculate the delta between P1 and P2 + var dx1 = x2 - x1; + var dy1 = y2 - y1; + // calculate the delta between P3 and P1 + var dx2 = x3 - x1; + var dy2 = y3 - y1; + // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from + // P1 in the same direction then P2 is on the straight line between P1 and + // P3 + if (dx1 * dy2 == dy1 * dx2 && + ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) && + ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) { + // discard P2 and set P2 = P3 + x2 = x3; + y2 = y3; + continue; + } + // either P1, P2, and P3 are not colinear, or they are colinear but P3 is + // between P3 and P1 or on the opposite half of the line to P2. add P2, + // and continue with P1 = P2 and P2 = P3 + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + x1 = x2; + y1 = y2; + x2 = x3; + y2 = y3; + } + // add the last point (P2) + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array} simplifiedEnds Simplified ends. + * @return {number} Simplified offset. + */ +function quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + simplifiedOffset = quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset); + simplifiedEnds.push(simplifiedOffset); + offset = end; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array>} simplifiedEndss Simplified endss. + * @return {number} Simplified offset. + */ +function quantizeMultiArray(flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + var simplifiedEnds = []; + simplifiedOffset = quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); + simplifiedEndss.push(simplifiedEnds); + offset = ends[ends.length - 1]; + } + return simplifiedOffset; +} +//# sourceMappingURL=simplify.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/segments.js +/** + * @module ol/geom/flat/segments + */ +/** + * This function calls `callback` for each segment of the flat coordinates + * array. If the callback returns a truthy value the function returns that + * value immediately. Otherwise the function returns `false`. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function + * called for each segment. + * @return {T|boolean} Value. + * @template T + */ +function forEach(flatCoordinates, offset, end, stride, callback) { + var ret; + offset += stride; + for (; offset < end; offset += stride) { + ret = callback(flatCoordinates.slice(offset - stride, offset), flatCoordinates.slice(offset, offset + stride)); + if (ret) { + return ret; + } + } + return false; +} +//# sourceMappingURL=segments.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/inflate.js +/** + * @module ol/geom/flat/inflate + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {Array} [opt_coordinates] Coordinates. + * @return {Array} Coordinates. + */ +function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) { + var coordinates = opt_coordinates !== undefined ? opt_coordinates : []; + var i = 0; + for (var j = offset; j < end; j += stride) { + coordinates[i++] = flatCoordinates.slice(j, j + stride); + } + coordinates.length = i; + return coordinates; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {Array>} [opt_coordinatess] Coordinatess. + * @return {Array>} Coordinatess. + */ +function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) { + var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; + var i = 0; + for (var j = 0, jj = ends.length; j < jj; ++j) { + var end = ends[j]; + coordinatess[i++] = inflateCoordinates(flatCoordinates, offset, end, stride, coordinatess[i]); + offset = end; + } + coordinatess.length = i; + return coordinatess; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {Array>>} [opt_coordinatesss] + * Coordinatesss. + * @return {Array>>} Coordinatesss. + */ +function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) { + var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; + var i = 0; + for (var j = 0, jj = endss.length; j < jj; ++j) { + var ends = endss[j]; + coordinatesss[i++] = inflateCoordinatesArray(flatCoordinates, offset, ends, stride, coordinatesss[i]); + offset = ends[ends.length - 1]; + } + coordinatesss.length = i; + return coordinatesss; +} +//# sourceMappingURL=inflate.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/interpolate.js +/** + * @module ol/geom/flat/interpolate + */ + + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} fraction Fraction. + * @param {Array} [opt_dest] Destination. + * @param {number} [opt_dimension] Destination dimension (default is `2`) + * @return {Array} Destination. + */ +function interpolatePoint(flatCoordinates, offset, end, stride, fraction, opt_dest, opt_dimension) { + var o, t; + var n = (end - offset) / stride; + if (n === 1) { + o = offset; + } + else if (n === 2) { + o = offset; + t = fraction; + } + else if (n !== 0) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + var length_1 = 0; + var cumulativeLengths = [0]; + for (var i = offset + stride; i < end; i += stride) { + var x2 = flatCoordinates[i]; + var y2 = flatCoordinates[i + 1]; + length_1 += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + cumulativeLengths.push(length_1); + x1 = x2; + y1 = y2; + } + var target = fraction * length_1; + var index = binarySearch(cumulativeLengths, target); + if (index < 0) { + t = + (target - cumulativeLengths[-index - 2]) / + (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]); + o = offset + (-index - 2) * stride; + } + else { + o = offset + index * stride; + } + } + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var dest = opt_dest ? opt_dest : new Array(dimension); + for (var i = 0; i < dimension; ++i) { + dest[i] = + o === undefined + ? NaN + : t === undefined + ? flatCoordinates[o + i] + : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t); + } + return dest; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} m M. + * @param {boolean} extrapolate Extrapolate. + * @return {import("../../coordinate.js").Coordinate|null} Coordinate. + */ +function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, extrapolate) { + if (end == offset) { + return null; + } + var coordinate; + if (m < flatCoordinates[offset + stride - 1]) { + if (extrapolate) { + coordinate = flatCoordinates.slice(offset, offset + stride); + coordinate[stride - 1] = m; + return coordinate; + } + else { + return null; + } + } + else if (flatCoordinates[end - 1] < m) { + if (extrapolate) { + coordinate = flatCoordinates.slice(end - stride, end); + coordinate[stride - 1] = m; + return coordinate; + } + else { + return null; + } + } + // FIXME use O(1) search + if (m == flatCoordinates[offset + stride - 1]) { + return flatCoordinates.slice(offset, offset + stride); + } + var lo = offset / stride; + var hi = end / stride; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (m < flatCoordinates[(mid + 1) * stride - 1]) { + hi = mid; + } + else { + lo = mid + 1; + } + } + var m0 = flatCoordinates[lo * stride - 1]; + if (m == m0) { + return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride); + } + var m1 = flatCoordinates[(lo + 1) * stride - 1]; + var t = (m - m0) / (m1 - m0); + coordinate = []; + for (var i = 0; i < stride - 1; ++i) { + coordinate.push(lerp(flatCoordinates[(lo - 1) * stride + i], flatCoordinates[lo * stride + i], t)); + } + coordinate.push(m); + return coordinate; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} m M. + * @param {boolean} extrapolate Extrapolate. + * @param {boolean} interpolate Interpolate. + * @return {import("../../coordinate.js").Coordinate|null} Coordinate. + */ +function lineStringsCoordinateAtM(flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) { + if (interpolate) { + return lineStringCoordinateAtM(flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate); + } + var coordinate; + if (m < flatCoordinates[stride - 1]) { + if (extrapolate) { + coordinate = flatCoordinates.slice(0, stride); + coordinate[stride - 1] = m; + return coordinate; + } + else { + return null; + } + } + if (flatCoordinates[flatCoordinates.length - 1] < m) { + if (extrapolate) { + coordinate = flatCoordinates.slice(flatCoordinates.length - stride); + coordinate[stride - 1] = m; + return coordinate; + } + else { + return null; + } + } + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + if (offset == end) { + continue; + } + if (m < flatCoordinates[offset + stride - 1]) { + return null; + } + else if (m <= flatCoordinates[end - 1]) { + return lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, false); + } + offset = end; + } + return null; +} +//# sourceMappingURL=interpolate.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/contains.js +/** + * @module ol/geom/flat/contains + */ + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} Contains extent. + */ +function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) { + var outside = forEachCorner(extent, + /** + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} Contains (x, y). + */ + function (coordinate) { + return !linearRingContainsXY(flatCoordinates, offset, end, stride, coordinate[0], coordinate[1]); + }); + return !outside; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingContainsXY(flatCoordinates, offset, end, stride, x, y) { + // https://geomalgorithms.com/a03-_inclusion.html + // Copyright 2000 softSurfer, 2012 Dan Sunday + // This code may be freely used and modified for any purpose + // providing that this copyright notice is included with it. + // SoftSurfer makes no warranty for this code, and cannot be held + // liable for any real or imagined damage resulting from its use. + // Users of this code must verify correctness for their application. + var wn = 0; + var x1 = flatCoordinates[end - stride]; + var y1 = flatCoordinates[end - stride + 1]; + for (; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + if (y1 <= y) { + if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) { + wn++; + } + } + else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) { + wn--; + } + x1 = x2; + y1 = y2; + } + return wn !== 0; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y) { + if (ends.length === 0) { + return false; + } + if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) { + return false; + } + for (var i = 1, ii = ends.length; i < ii; ++i) { + if (linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)) { + return false; + } + } + return true; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingssContainsXY(flatCoordinates, offset, endss, stride, x, y) { + if (endss.length === 0) { + return false; + } + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) { + return true; + } + offset = ends[ends.length - 1]; + } + return false; +} +//# sourceMappingURL=contains.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/intersectsextent.js +/** + * @module ol/geom/flat/intersectsextent + */ + + + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLineString(flatCoordinates, offset, end, stride, extent) { + var coordinatesExtent = extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride); + if (!intersects(extent, coordinatesExtent)) { + return false; + } + if (containsExtent(extent, coordinatesExtent)) { + return true; + } + if (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) { + return true; + } + if (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3]) { + return true; + } + return forEach(flatCoordinates, offset, end, stride, + /** + * @param {import("../../coordinate.js").Coordinate} point1 Start point. + * @param {import("../../coordinate.js").Coordinate} point2 End point. + * @return {boolean} `true` if the segment and the extent intersect, + * `false` otherwise. + */ + function (point1, point2) { + return intersectsSegment(extent, point1, point2); + }); +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + if (intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)) { + return true; + } + offset = ends[i]; + } + return false; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) { + if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) { + return true; + } + if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[1])) { + return true; + } + if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[3])) { + return true; + } + if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[1])) { + return true; + } + if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[3])) { + return true; + } + return false; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) { + if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) { + return false; + } + if (ends.length === 1) { + return true; + } + for (var i = 1, ii = ends.length; i < ii; ++i) { + if (linearRingContainsExtent(flatCoordinates, ends[i - 1], ends[i], stride, extent)) { + if (!intersectsLineString(flatCoordinates, ends[i - 1], ends[i], stride, extent)) { + return false; + } + } + } + return true; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + if (intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)) { + return true; + } + offset = ends[ends.length - 1]; + } + return false; +} +//# sourceMappingURL=intersectsextent.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/length.js +/** + * @module ol/geom/flat/length + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Length. + */ +function lineStringLength(flatCoordinates, offset, end, stride) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + var length = 0; + for (var i = offset + stride; i < end; i += stride) { + var x2 = flatCoordinates[i]; + var y2 = flatCoordinates[i + 1]; + length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + x1 = x2; + y1 = y2; + } + return length; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Perimeter. + */ +function linearRingLength(flatCoordinates, offset, end, stride) { + var perimeter = lineStringLength(flatCoordinates, offset, end, stride); + var dx = flatCoordinates[end - stride] - flatCoordinates[offset]; + var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1]; + perimeter += Math.sqrt(dx * dx + dy * dy); + return perimeter; +} +//# sourceMappingURL=length.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/LineString.js +var LineString_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/LineString + */ + + + + + + + + + + + + +/** + * @classdesc + * Linestring geometry. + * + * @api + */ +var LineString = /** @class */ (function (_super) { + LineString_extends(LineString, _super); + /** + * @param {Array|Array} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + function LineString(coordinates, opt_layout) { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + _this.flatMidpoint_ = null; + /** + * @private + * @type {number} + */ + _this.flatMidpointRevision_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + if (opt_layout !== undefined && !Array.isArray(coordinates[0])) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + } + else { + _this.setCoordinates( + /** @type {Array} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Append the passed coordinate to the coordinates of the linestring. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @api + */ + LineString.prototype.appendCoordinate = function (coordinate) { + if (!this.flatCoordinates) { + this.flatCoordinates = coordinate.slice(); + } + else { + array_extend(this.flatCoordinates, coordinate); + } + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!LineString} Clone. + * @api + */ + LineString.prototype.clone = function () { + var lineString = new LineString(this.flatCoordinates.slice(), this.layout); + lineString.applyProperties(this); + return lineString; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + LineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(maxSquaredDelta(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return assignClosestPoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); + }; + /** + * Iterate over each segment, calling the provided callback. + * If the callback returns a truthy value the function returns that + * value immediately. Otherwise the function returns `false`. + * + * @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function + * called for each segment. The function will receive two arguments, the start and end coordinates of the segment. + * @return {T|boolean} Value. + * @template T,S + * @api + */ + LineString.prototype.forEachSegment = function (callback) { + return forEach(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, callback); + }; + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `opt_extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * @param {number} m M. + * @param {boolean} [opt_extrapolate] Extrapolate. Default is `false`. + * @return {import("../coordinate.js").Coordinate|null} Coordinate. + * @api + */ + LineString.prototype.getCoordinateAtM = function (m, opt_extrapolate) { + if (this.layout != geom_GeometryLayout.XYM && + this.layout != geom_GeometryLayout.XYZM) { + return null; + } + var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; + return lineStringCoordinateAtM(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, m, extrapolate); + }; + /** + * Return the coordinates of the linestring. + * @return {Array} Coordinates. + * @api + */ + LineString.prototype.getCoordinates = function () { + return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the coordinate at the provided fraction along the linestring. + * The `fraction` is a number between 0 and 1, where 0 is the start of the + * linestring and 1 is the end. + * @param {number} fraction Fraction. + * @param {import("../coordinate.js").Coordinate} [opt_dest] Optional coordinate whose values will + * be modified. If not provided, a new coordinate will be returned. + * @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point. + * @api + */ + LineString.prototype.getCoordinateAt = function (fraction, opt_dest) { + return interpolatePoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, fraction, opt_dest, this.stride); + }; + /** + * Return the length of the linestring on projected plane. + * @return {number} Length (on projected plane). + * @api + */ + LineString.prototype.getLength = function () { + return lineStringLength(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * @return {Array} Flat midpoint. + */ + LineString.prototype.getFlatMidpoint = function () { + if (this.flatMidpointRevision_ != this.getRevision()) { + this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_); + this.flatMidpointRevision_ = this.getRevision(); + } + return this.flatMidpoint_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {LineString} Simplified LineString. + * @protected + */ + LineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + simplifiedFlatCoordinates.length = douglasPeucker(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return new LineString(simplifiedFlatCoordinates, geom_GeometryLayout.XY); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + LineString.prototype.getType = function () { + return 'LineString'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + LineString.prototype.intersectsExtent = function (extent) { + return intersectsLineString(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent); + }; + /** + * Set the coordinates of the linestring. + * @param {!Array} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + LineString.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + return LineString; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_LineString = (LineString); +//# sourceMappingURL=LineString.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/area.js +/** + * @module ol/geom/flat/area + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Area. + */ +function linearRing(flatCoordinates, offset, end, stride) { + var twiceArea = 0; + var x1 = flatCoordinates[end - stride]; + var y1 = flatCoordinates[end - stride + 1]; + for (; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + twiceArea += y1 * x2 - x1 * y2; + x1 = x2; + y1 = y2; + } + return twiceArea / 2; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @return {number} Area. + */ +function linearRings(flatCoordinates, offset, ends, stride) { + var area = 0; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + area += linearRing(flatCoordinates, offset, end, stride); + offset = end; + } + return area; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @return {number} Area. + */ +function linearRingss(flatCoordinates, offset, endss, stride) { + var area = 0; + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + area += linearRings(flatCoordinates, offset, ends, stride); + offset = ends[ends.length - 1]; + } + return area; +} +//# sourceMappingURL=area.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/LinearRing.js +var LinearRing_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/LinearRing + */ + + + + + + + + +/** + * @classdesc + * Linear ring geometry. Only used as part of polygon; cannot be rendered + * on its own. + * + * @api + */ +var LinearRing = /** @class */ (function (_super) { + LinearRing_extends(LinearRing, _super); + /** + * @param {Array|Array} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + function LinearRing(coordinates, opt_layout) { + var _this = _super.call(this) || this; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + if (opt_layout !== undefined && !Array.isArray(coordinates[0])) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + } + else { + _this.setCoordinates( + /** @type {Array} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Make a complete copy of the geometry. + * @return {!LinearRing} Clone. + * @api + */ + LinearRing.prototype.clone = function () { + return new LinearRing(this.flatCoordinates.slice(), this.layout); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + LinearRing.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(maxSquaredDelta(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return assignClosestPoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * Return the area of the linear ring on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + LinearRing.prototype.getArea = function () { + return linearRing(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the coordinates of the linear ring. + * @return {Array} Coordinates. + * @api + */ + LinearRing.prototype.getCoordinates = function () { + return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {LinearRing} Simplified LinearRing. + * @protected + */ + LinearRing.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + simplifiedFlatCoordinates.length = douglasPeucker(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return new LinearRing(simplifiedFlatCoordinates, geom_GeometryLayout.XY); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + LinearRing.prototype.getType = function () { + return 'LinearRing'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + LinearRing.prototype.intersectsExtent = function (extent) { + return false; + }; + /** + * Set the coordinates of the linear ring. + * @param {!Array} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + LinearRing.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + return LinearRing; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_LinearRing = (LinearRing); +//# sourceMappingURL=LinearRing.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/MultiLineString.js +var MultiLineString_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/MultiLineString + */ + + + + + + + + + + + +/** + * @classdesc + * Multi-linestring geometry. + * + * @api + */ +var MultiLineString = /** @class */ (function (_super) { + MultiLineString_extends(MultiLineString, _super); + /** + * @param {Array|LineString>|Array} coordinates + * Coordinates or LineString geometries. (For internal use, flat coordinates in + * combination with `opt_layout` and `opt_ends` are also accepted.) + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @param {Array} [opt_ends] Flat coordinate ends for internal use. + */ + function MultiLineString(coordinates, opt_layout, opt_ends) { + var _this = _super.call(this) || this; + /** + * @type {Array} + * @private + */ + _this.ends_ = []; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + if (Array.isArray(coordinates[0])) { + _this.setCoordinates( + /** @type {Array>} */ (coordinates), opt_layout); + } + else if (opt_layout !== undefined && opt_ends) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + _this.ends_ = opt_ends; + } + else { + var layout = _this.getLayout(); + var lineStrings = /** @type {Array} */ (coordinates); + var flatCoordinates = []; + var ends = []; + for (var i = 0, ii = lineStrings.length; i < ii; ++i) { + var lineString = lineStrings[i]; + if (i === 0) { + layout = lineString.getLayout(); + } + array_extend(flatCoordinates, lineString.getFlatCoordinates()); + ends.push(flatCoordinates.length); + } + _this.setFlatCoordinates(layout, flatCoordinates); + _this.ends_ = ends; + } + return _this; + } + /** + * Append the passed linestring to the multilinestring. + * @param {LineString} lineString LineString. + * @api + */ + MultiLineString.prototype.appendLineString = function (lineString) { + if (!this.flatCoordinates) { + this.flatCoordinates = lineString.getFlatCoordinates().slice(); + } + else { + array_extend(this.flatCoordinates, lineString.getFlatCoordinates().slice()); + } + this.ends_.push(this.flatCoordinates.length); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiLineString} Clone. + * @api + */ + MultiLineString.prototype.clone = function () { + var multiLineString = new MultiLineString(this.flatCoordinates.slice(), this.layout, this.ends_.slice()); + multiLineString.applyProperties(this); + return multiLineString; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + MultiLineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates, 0, this.ends_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return assignClosestArrayPoint(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); + }; + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `opt_extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * `opt_interpolate` controls interpolation between consecutive LineStrings + * within the MultiLineString. If `opt_interpolate` is `true` the coordinates + * will be linearly interpolated between the last coordinate of one LineString + * and the first coordinate of the next LineString. If `opt_interpolate` is + * `false` then the function will return `null` for Ms falling between + * LineStrings. + * + * @param {number} m M. + * @param {boolean} [opt_extrapolate] Extrapolate. Default is `false`. + * @param {boolean} [opt_interpolate] Interpolate. Default is `false`. + * @return {import("../coordinate.js").Coordinate|null} Coordinate. + * @api + */ + MultiLineString.prototype.getCoordinateAtM = function (m, opt_extrapolate, opt_interpolate) { + if ((this.layout != geom_GeometryLayout.XYM && + this.layout != geom_GeometryLayout.XYZM) || + this.flatCoordinates.length === 0) { + return null; + } + var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; + var interpolate = opt_interpolate !== undefined ? opt_interpolate : false; + return lineStringsCoordinateAtM(this.flatCoordinates, 0, this.ends_, this.stride, m, extrapolate, interpolate); + }; + /** + * Return the coordinates of the multilinestring. + * @return {Array>} Coordinates. + * @api + */ + MultiLineString.prototype.getCoordinates = function () { + return inflateCoordinatesArray(this.flatCoordinates, 0, this.ends_, this.stride); + }; + /** + * @return {Array} Ends. + */ + MultiLineString.prototype.getEnds = function () { + return this.ends_; + }; + /** + * Return the linestring at the specified index. + * @param {number} index Index. + * @return {LineString} LineString. + * @api + */ + MultiLineString.prototype.getLineString = function (index) { + if (index < 0 || this.ends_.length <= index) { + return null; + } + return new geom_LineString(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout); + }; + /** + * Return the linestrings of this multilinestring. + * @return {Array} LineStrings. + * @api + */ + MultiLineString.prototype.getLineStrings = function () { + var flatCoordinates = this.flatCoordinates; + var ends = this.ends_; + var layout = this.layout; + /** @type {Array} */ + var lineStrings = []; + var offset = 0; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var lineString = new geom_LineString(flatCoordinates.slice(offset, end), layout); + lineStrings.push(lineString); + offset = end; + } + return lineStrings; + }; + /** + * @return {Array} Flat midpoints. + */ + MultiLineString.prototype.getFlatMidpoints = function () { + var midpoints = []; + var flatCoordinates = this.flatCoordinates; + var offset = 0; + var ends = this.ends_; + var stride = this.stride; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var midpoint = interpolatePoint(flatCoordinates, offset, end, stride, 0.5); + array_extend(midpoints, midpoint); + offset = end; + } + return midpoints; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiLineString} Simplified MultiLineString. + * @protected + */ + MultiLineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEnds = []; + simplifiedFlatCoordinates.length = douglasPeuckerArray(this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0, simplifiedEnds); + return new MultiLineString(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEnds); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + MultiLineString.prototype.getType = function () { + return 'MultiLineString'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + MultiLineString.prototype.intersectsExtent = function (extent) { + return intersectsLineStringArray(this.flatCoordinates, 0, this.ends_, this.stride, extent); + }; + /** + * Set the coordinates of the multilinestring. + * @param {!Array>} coordinates Coordinates. + * @param {GeometryLayout} [opt_layout] Layout. + * @api + */ + MultiLineString.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 2); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + var ends = deflateCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.ends_); + this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; + this.changed(); + }; + return MultiLineString; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_MultiLineString = (MultiLineString); +//# sourceMappingURL=MultiLineString.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/Point.js +var Point_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/Point + */ + + + + +/** + * @classdesc + * Point geometry. + * + * @api + */ +var Point = /** @class */ (function (_super) { + Point_extends(Point, _super); + /** + * @param {import("../coordinate.js").Coordinate} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + function Point(coordinates, opt_layout) { + var _this = _super.call(this) || this; + _this.setCoordinates(coordinates, opt_layout); + return _this; + } + /** + * Make a complete copy of the geometry. + * @return {!Point} Clone. + * @api + */ + Point.prototype.clone = function () { + var point = new Point(this.flatCoordinates.slice(), this.layout); + point.applyProperties(this); + return point; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + Point.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + var flatCoordinates = this.flatCoordinates; + var squaredDistance = math_squaredDistance(x, y, flatCoordinates[0], flatCoordinates[1]); + if (squaredDistance < minSquaredDistance) { + var stride = this.stride; + for (var i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[i]; + } + closestPoint.length = stride; + return squaredDistance; + } + else { + return minSquaredDistance; + } + }; + /** + * Return the coordinate of the point. + * @return {import("../coordinate.js").Coordinate} Coordinates. + * @api + */ + Point.prototype.getCoordinates = function () { + return !this.flatCoordinates ? [] : this.flatCoordinates.slice(); + }; + /** + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + Point.prototype.computeExtent = function (extent) { + return createOrUpdateFromCoordinate(this.flatCoordinates, extent); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + Point.prototype.getType = function () { + return 'Point'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + Point.prototype.intersectsExtent = function (extent) { + return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]); + }; + /** + * @param {!Array<*>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + Point.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 0); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + this.flatCoordinates.length = deflateCoordinate(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + return Point; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_Point = (Point); +//# sourceMappingURL=Point.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/MultiPoint.js +var MultiPoint_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/MultiPoint + */ + + + + + + + +/** + * @classdesc + * Multi-point geometry. + * + * @api + */ +var MultiPoint = /** @class */ (function (_super) { + MultiPoint_extends(MultiPoint, _super); + /** + * @param {Array|Array} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + function MultiPoint(coordinates, opt_layout) { + var _this = _super.call(this) || this; + if (opt_layout && !Array.isArray(coordinates[0])) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + } + else { + _this.setCoordinates( + /** @type {Array} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Append the passed point to this multipoint. + * @param {Point} point Point. + * @api + */ + MultiPoint.prototype.appendPoint = function (point) { + if (!this.flatCoordinates) { + this.flatCoordinates = point.getFlatCoordinates().slice(); + } + else { + array_extend(this.flatCoordinates, point.getFlatCoordinates()); + } + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiPoint} Clone. + * @api + */ + MultiPoint.prototype.clone = function () { + var multiPoint = new MultiPoint(this.flatCoordinates.slice(), this.layout); + multiPoint.applyProperties(this); + return multiPoint; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + MultiPoint.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + var flatCoordinates = this.flatCoordinates; + var stride = this.stride; + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var squaredDistance = math_squaredDistance(x, y, flatCoordinates[i], flatCoordinates[i + 1]); + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + for (var j = 0; j < stride; ++j) { + closestPoint[j] = flatCoordinates[i + j]; + } + closestPoint.length = stride; + } + } + return minSquaredDistance; + }; + /** + * Return the coordinates of the multipoint. + * @return {Array} Coordinates. + * @api + */ + MultiPoint.prototype.getCoordinates = function () { + return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the point at the specified index. + * @param {number} index Index. + * @return {Point} Point. + * @api + */ + MultiPoint.prototype.getPoint = function (index) { + var n = !this.flatCoordinates + ? 0 + : this.flatCoordinates.length / this.stride; + if (index < 0 || n <= index) { + return null; + } + return new geom_Point(this.flatCoordinates.slice(index * this.stride, (index + 1) * this.stride), this.layout); + }; + /** + * Return the points of this multipoint. + * @return {Array} Points. + * @api + */ + MultiPoint.prototype.getPoints = function () { + var flatCoordinates = this.flatCoordinates; + var layout = this.layout; + var stride = this.stride; + /** @type {Array} */ + var points = []; + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var point = new geom_Point(flatCoordinates.slice(i, i + stride), layout); + points.push(point); + } + return points; + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + MultiPoint.prototype.getType = function () { + return 'MultiPoint'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + MultiPoint.prototype.intersectsExtent = function (extent) { + var flatCoordinates = this.flatCoordinates; + var stride = this.stride; + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var x = flatCoordinates[i]; + var y = flatCoordinates[i + 1]; + if (containsXY(extent, x, y)) { + return true; + } + } + return false; + }; + /** + * Set the coordinates of the multipoint. + * @param {!Array} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + MultiPoint.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + return MultiPoint; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_MultiPoint = (MultiPoint); +//# sourceMappingURL=MultiPoint.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/interiorpoint.js +/** + * @module ol/geom/flat/interiorpoint + */ + + +/** + * Calculates a point that is likely to lie in the interior of the linear rings. + * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {Array} flatCenters Flat centers. + * @param {number} flatCentersOffset Flat center offset. + * @param {Array} [opt_dest] Destination. + * @return {Array} Destination point as XYM coordinate, where M is the + * length of the horizontal intersection that the point belongs to. + */ +function getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, flatCentersOffset, opt_dest) { + var i, ii, x, x1, x2, y1, y2; + var y = flatCenters[flatCentersOffset + 1]; + /** @type {Array} */ + var intersections = []; + // Calculate intersections with the horizontal line + for (var r = 0, rr = ends.length; r < rr; ++r) { + var end = ends[r]; + x1 = flatCoordinates[end - stride]; + y1 = flatCoordinates[end - stride + 1]; + for (i = offset; i < end; i += stride) { + x2 = flatCoordinates[i]; + y2 = flatCoordinates[i + 1]; + if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) { + x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1; + intersections.push(x); + } + x1 = x2; + y1 = y2; + } + } + // Find the longest segment of the horizontal line that has its center point + // inside the linear ring. + var pointX = NaN; + var maxSegmentLength = -Infinity; + intersections.sort(numberSafeCompareFunction); + x1 = intersections[0]; + for (i = 1, ii = intersections.length; i < ii; ++i) { + x2 = intersections[i]; + var segmentLength = Math.abs(x2 - x1); + if (segmentLength > maxSegmentLength) { + x = (x1 + x2) / 2; + if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) { + pointX = x; + maxSegmentLength = segmentLength; + } + } + x1 = x2; + } + if (isNaN(pointX)) { + // There is no horizontal line that has its center point inside the linear + // ring. Use the center of the the linear ring's extent. + pointX = flatCenters[flatCentersOffset]; + } + if (opt_dest) { + opt_dest.push(pointX, y, maxSegmentLength); + return opt_dest; + } + else { + return [pointX, y, maxSegmentLength]; + } +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {Array} flatCenters Flat centers. + * @return {Array} Interior points as XYM coordinates, where M is the + * length of the horizontal intersection that the point belongs to. + */ +function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) { + var interiorPoints = []; + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + interiorPoints = getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints); + offset = ends[ends.length - 1]; + } + return interiorPoints; +} +//# sourceMappingURL=interiorpoint.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/reverse.js +/** + * @module ol/geom/flat/reverse + */ +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + */ +function coordinates(flatCoordinates, offset, end, stride) { + while (offset < end - stride) { + for (var i = 0; i < stride; ++i) { + var tmp = flatCoordinates[offset + i]; + flatCoordinates[offset + i] = flatCoordinates[end - stride + i]; + flatCoordinates[end - stride + i] = tmp; + } + offset += stride; + end -= stride; + } +} +//# sourceMappingURL=reverse.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/orient.js +/** + * @module ol/geom/flat/orient + */ + +/** + * Is the linear ring oriented clockwise in a coordinate system with a bottom-left + * coordinate origin? For a coordinate system with a top-left coordinate origin, + * the ring's orientation is clockwise when this function returns false. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {boolean} Is clockwise. + */ +function linearRingIsClockwise(flatCoordinates, offset, end, stride) { + // https://stackoverflow.com/q/1165647/clockwise-method#1165943 + // https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrlinearring.cpp + var edge = 0; + var x1 = flatCoordinates[end - stride]; + var y1 = flatCoordinates[end - stride + 1]; + for (; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + edge += (x2 - x1) * (y2 + y1); + x1 = x2; + y1 = y2; + } + return edge === 0 ? undefined : edge > 0; +} +/** + * Determines if linear rings are oriented. By default, left-hand orientation + * is tested (first ring must be clockwise, remaining rings counter-clockwise). + * To test for right-hand orientation, use the `opt_right` argument. + * + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Array of end indexes. + * @param {number} stride Stride. + * @param {boolean} [opt_right] Test for right-hand orientation + * (counter-clockwise exterior ring and clockwise interior rings). + * @return {boolean} Rings are correctly oriented. + */ +function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) { + var right = opt_right !== undefined ? opt_right : false; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride); + if (i === 0) { + if ((right && isClockwise) || (!right && !isClockwise)) { + return false; + } + } + else { + if ((right && !isClockwise) || (!right && isClockwise)) { + return false; + } + } + offset = end; + } + return true; +} +/** + * Determines if linear rings are oriented. By default, left-hand orientation + * is tested (first ring must be clockwise, remaining rings counter-clockwise). + * To test for right-hand orientation, use the `opt_right` argument. + * + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Array of array of end indexes. + * @param {number} stride Stride. + * @param {boolean} [opt_right] Test for right-hand orientation + * (counter-clockwise exterior ring and clockwise interior rings). + * @return {boolean} Rings are correctly oriented. + */ +function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)) { + return false; + } + if (ends.length) { + offset = ends[ends.length - 1]; + } + } + return true; +} +/** + * Orient coordinates in a flat array of linear rings. By default, rings + * are oriented following the left-hand rule (clockwise for exterior and + * counter-clockwise for interior rings). To orient according to the + * right-hand rule, use the `opt_right` argument. + * + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {boolean} [opt_right] Follow the right-hand rule for orientation. + * @return {number} End. + */ +function orientLinearRings(flatCoordinates, offset, ends, stride, opt_right) { + var right = opt_right !== undefined ? opt_right : false; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride); + var reverse = i === 0 + ? (right && isClockwise) || (!right && !isClockwise) + : (right && !isClockwise) || (!right && isClockwise); + if (reverse) { + coordinates(flatCoordinates, offset, end, stride); + } + offset = end; + } + return offset; +} +/** + * Orient coordinates in a flat array of linear rings. By default, rings + * are oriented following the left-hand rule (clockwise for exterior and + * counter-clockwise for interior rings). To orient according to the + * right-hand rule, use the `opt_right` argument. + * + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Array of array of end indexes. + * @param {number} stride Stride. + * @param {boolean} [opt_right] Follow the right-hand rule for orientation. + * @return {number} End. + */ +function orientLinearRingsArray(flatCoordinates, offset, endss, stride, opt_right) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + offset = orientLinearRings(flatCoordinates, offset, endss[i], stride, opt_right); + } + return offset; +} +/** + * Return a two-dimensional endss + * @param {Array} flatCoordinates Flat coordinates + * @param {Array} ends Linear ring end indexes + * @return {Array>} Two dimensional endss array that can + * be used to contruct a MultiPolygon + */ +function inflateEnds(flatCoordinates, ends) { + var endss = []; + var offset = 0; + var prevEndIndex = 0; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + // classifies an array of rings into polygons with outer rings and holes + if (!linearRingIsClockwise(flatCoordinates, offset, end, 2)) { + endss.push(ends.slice(prevEndIndex, i + 1)); + } + else { + if (endss.length === 0) { + continue; + } + endss[endss.length - 1].push(ends[prevEndIndex]); + } + prevEndIndex = i + 1; + offset = end; + } + return endss; +} +//# sourceMappingURL=orient.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/Polygon.js +var Polygon_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/Polygon + */ + + + + + + + + + + + + + + + + + +/** + * @classdesc + * Polygon geometry. + * + * @api + */ +var Polygon = /** @class */ (function (_super) { + Polygon_extends(Polygon, _super); + /** + * @param {!Array>|!Array} coordinates + * Array of linear rings that define the polygon. The first linear ring of the + * array defines the outer-boundary or surface of the polygon. Each subsequent + * linear ring defines a hole in the surface of the polygon. A linear ring is + * an array of vertices' coordinates where the first coordinate and the last are + * equivalent. (For internal use, flat coordinates in combination with + * `opt_layout` and `opt_ends` are also accepted.) + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @param {Array} [opt_ends] Ends (for internal use with flat coordinates). + */ + function Polygon(coordinates, opt_layout, opt_ends) { + var _this = _super.call(this) || this; + /** + * @type {Array} + * @private + */ + _this.ends_ = []; + /** + * @private + * @type {number} + */ + _this.flatInteriorPointRevision_ = -1; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + _this.flatInteriorPoint_ = null; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + /** + * @private + * @type {number} + */ + _this.orientedRevision_ = -1; + /** + * @private + * @type {Array} + */ + _this.orientedFlatCoordinates_ = null; + if (opt_layout !== undefined && opt_ends) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + _this.ends_ = opt_ends; + } + else { + _this.setCoordinates( + /** @type {Array>} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Append the passed linear ring to this polygon. + * @param {LinearRing} linearRing Linear ring. + * @api + */ + Polygon.prototype.appendLinearRing = function (linearRing) { + if (!this.flatCoordinates) { + this.flatCoordinates = linearRing.getFlatCoordinates().slice(); + } + else { + array_extend(this.flatCoordinates, linearRing.getFlatCoordinates()); + } + this.ends_.push(this.flatCoordinates.length); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!Polygon} Clone. + * @api + */ + Polygon.prototype.clone = function () { + var polygon = new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice()); + polygon.applyProperties(this); + return polygon; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + Polygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates, 0, this.ends_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return assignClosestArrayPoint(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + Polygon.prototype.containsXY = function (x, y) { + return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y); + }; + /** + * Return the area of the polygon on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + Polygon.prototype.getArea = function () { + return linearRings(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride); + }; + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for polygons. + * + * @param {boolean} [opt_right] Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @return {Array>} Coordinates. + * @api + */ + Polygon.prototype.getCoordinates = function (opt_right) { + var flatCoordinates; + if (opt_right !== undefined) { + flatCoordinates = this.getOrientedFlatCoordinates().slice(); + orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, opt_right); + } + else { + flatCoordinates = this.flatCoordinates; + } + return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride); + }; + /** + * @return {Array} Ends. + */ + Polygon.prototype.getEnds = function () { + return this.ends_; + }; + /** + * @return {Array} Interior point. + */ + Polygon.prototype.getFlatInteriorPoint = function () { + if (this.flatInteriorPointRevision_ != this.getRevision()) { + var flatCenter = getCenter(this.getExtent()); + this.flatInteriorPoint_ = getInteriorPointOfArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, flatCenter, 0); + this.flatInteriorPointRevision_ = this.getRevision(); + } + return this.flatInteriorPoint_; + }; + /** + * Return an interior point of the polygon. + * @return {Point} Interior point as XYM coordinate, where M is the + * length of the horizontal intersection that the point belongs to. + * @api + */ + Polygon.prototype.getInteriorPoint = function () { + return new geom_Point(this.getFlatInteriorPoint(), geom_GeometryLayout.XYM); + }; + /** + * Return the number of rings of the polygon, this includes the exterior + * ring and any interior rings. + * + * @return {number} Number of rings. + * @api + */ + Polygon.prototype.getLinearRingCount = function () { + return this.ends_.length; + }; + /** + * Return the Nth linear ring of the polygon geometry. Return `null` if the + * given index is out of range. + * The exterior linear ring is available at index `0` and the interior rings + * at index `1` and beyond. + * + * @param {number} index Index. + * @return {LinearRing|null} Linear ring. + * @api + */ + Polygon.prototype.getLinearRing = function (index) { + if (index < 0 || this.ends_.length <= index) { + return null; + } + return new geom_LinearRing(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout); + }; + /** + * Return the linear rings of the polygon. + * @return {Array} Linear rings. + * @api + */ + Polygon.prototype.getLinearRings = function () { + var layout = this.layout; + var flatCoordinates = this.flatCoordinates; + var ends = this.ends_; + var linearRings = []; + var offset = 0; + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var linearRing = new geom_LinearRing(flatCoordinates.slice(offset, end), layout); + linearRings.push(linearRing); + offset = end; + } + return linearRings; + }; + /** + * @return {Array} Oriented flat coordinates. + */ + Polygon.prototype.getOrientedFlatCoordinates = function () { + if (this.orientedRevision_ != this.getRevision()) { + var flatCoordinates = this.flatCoordinates; + if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) { + this.orientedFlatCoordinates_ = flatCoordinates; + } + else { + this.orientedFlatCoordinates_ = flatCoordinates.slice(); + this.orientedFlatCoordinates_.length = orientLinearRings(this.orientedFlatCoordinates_, 0, this.ends_, this.stride); + } + this.orientedRevision_ = this.getRevision(); + } + return this.orientedFlatCoordinates_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {Polygon} Simplified Polygon. + * @protected + */ + Polygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEnds = []; + simplifiedFlatCoordinates.length = quantizeArray(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEnds); + return new Polygon(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEnds); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + Polygon.prototype.getType = function () { + return 'Polygon'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + Polygon.prototype.intersectsExtent = function (extent) { + return intersectsLinearRingArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent); + }; + /** + * Set the coordinates of the polygon. + * @param {!Array>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + Polygon.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 2); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + var ends = deflateCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.ends_); + this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; + this.changed(); + }; + return Polygon; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_Polygon = (Polygon); +/** + * Create an approximation of a circle on the surface of a sphere. + * @param {import("../coordinate.js").Coordinate} center Center (`[lon, lat]` in degrees). + * @param {number} radius The great-circle distance from the center to + * the polygon vertices in meters. + * @param {number} [opt_n] Optional number of vertices for the resulting + * polygon. Default is `32`. + * @param {number} [opt_sphereRadius] Optional radius for the sphere (defaults to + * the Earth's mean radius using the WGS84 ellipsoid). + * @return {Polygon} The "circular" polygon. + * @api + */ +function circular(center, radius, opt_n, opt_sphereRadius) { + var n = opt_n ? opt_n : 32; + /** @type {Array} */ + var flatCoordinates = []; + for (var i = 0; i < n; ++i) { + extend(flatCoordinates, sphereOffset(center, radius, (2 * Math.PI * i) / n, opt_sphereRadius)); + } + flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]); + return new Polygon(flatCoordinates, GeometryLayout.XY, [ + flatCoordinates.length, + ]); +} +/** + * Create a polygon from an extent. The layout used is `XY`. + * @param {import("../extent.js").Extent} extent The extent. + * @return {Polygon} The polygon. + * @api + */ +function fromExtent(extent) { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var flatCoordinates = [ + minX, + minY, + minX, + maxY, + maxX, + maxY, + maxX, + minY, + minX, + minY, + ]; + return new Polygon(flatCoordinates, geom_GeometryLayout.XY, [ + flatCoordinates.length, + ]); +} +/** + * Create a regular polygon from a circle. + * @param {import("./Circle.js").default} circle Circle geometry. + * @param {number} [opt_sides] Number of sides of the polygon. Default is 32. + * @param {number} [opt_angle] Start angle for the first vertex of the polygon in + * counter-clockwise radians. 0 means East. Default is 0. + * @return {Polygon} Polygon geometry. + * @api + */ +function fromCircle(circle, opt_sides, opt_angle) { + var sides = opt_sides ? opt_sides : 32; + var stride = circle.getStride(); + var layout = circle.getLayout(); + var center = circle.getCenter(); + var arrayLength = stride * (sides + 1); + var flatCoordinates = new Array(arrayLength); + for (var i = 0; i < arrayLength; i += stride) { + flatCoordinates[i] = 0; + flatCoordinates[i + 1] = 0; + for (var j = 2; j < stride; j++) { + flatCoordinates[i + j] = center[j]; + } + } + var ends = [flatCoordinates.length]; + var polygon = new Polygon(flatCoordinates, layout, ends); + makeRegular(polygon, center, circle.getRadius(), opt_angle); + return polygon; +} +/** + * Modify the coordinates of a polygon to make it a regular polygon. + * @param {Polygon} polygon Polygon geometry. + * @param {import("../coordinate.js").Coordinate} center Center of the regular polygon. + * @param {number} radius Radius of the regular polygon. + * @param {number} [opt_angle] Start angle for the first vertex of the polygon in + * counter-clockwise radians. 0 means East. Default is 0. + */ +function makeRegular(polygon, center, radius, opt_angle) { + var flatCoordinates = polygon.getFlatCoordinates(); + var stride = polygon.getStride(); + var sides = flatCoordinates.length / stride - 1; + var startAngle = opt_angle ? opt_angle : 0; + for (var i = 0; i <= sides; ++i) { + var offset = i * stride; + var angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides; + flatCoordinates[offset] = center[0] + radius * Math.cos(angle); + flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle); + } + polygon.changed(); +} +//# sourceMappingURL=Polygon.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/flat/center.js +/** + * @module ol/geom/flat/center + */ + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @return {Array} Flat centers. + */ +function center_linearRingss(flatCoordinates, offset, endss, stride) { + var flatCenters = []; + var extent = createEmpty(); + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + extent = createOrUpdateFromFlatCoordinates(flatCoordinates, offset, ends[0], stride); + flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2); + offset = ends[ends.length - 1]; + } + return flatCenters; +} +//# sourceMappingURL=center.js.map +;// CONCATENATED MODULE: ./node_modules/ol/geom/MultiPolygon.js +var MultiPolygon_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/geom/MultiPolygon + */ + + + + + + + + + + + + + + + + +/** + * @classdesc + * Multi-polygon geometry. + * + * @api + */ +var MultiPolygon = /** @class */ (function (_super) { + MultiPolygon_extends(MultiPolygon, _super); + /** + * @param {Array>|Polygon>|Array} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @param {Array>} [opt_endss] Array of ends for internal use with flat coordinates. + */ + function MultiPolygon(coordinates, opt_layout, opt_endss) { + var _this = _super.call(this) || this; + /** + * @type {Array>} + * @private + */ + _this.endss_ = []; + /** + * @private + * @type {number} + */ + _this.flatInteriorPointsRevision_ = -1; + /** + * @private + * @type {Array} + */ + _this.flatInteriorPoints_ = null; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + /** + * @private + * @type {number} + */ + _this.orientedRevision_ = -1; + /** + * @private + * @type {Array} + */ + _this.orientedFlatCoordinates_ = null; + if (!opt_endss && !Array.isArray(coordinates[0])) { + var layout = _this.getLayout(); + var polygons = /** @type {Array} */ (coordinates); + var flatCoordinates = []; + var endss = []; + for (var i = 0, ii = polygons.length; i < ii; ++i) { + var polygon = polygons[i]; + if (i === 0) { + layout = polygon.getLayout(); + } + var offset = flatCoordinates.length; + var ends = polygon.getEnds(); + for (var j = 0, jj = ends.length; j < jj; ++j) { + ends[j] += offset; + } + array_extend(flatCoordinates, polygon.getFlatCoordinates()); + endss.push(ends); + } + opt_layout = layout; + coordinates = flatCoordinates; + opt_endss = endss; + } + if (opt_layout !== undefined && opt_endss) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + _this.endss_ = opt_endss; + } + else { + _this.setCoordinates( + /** @type {Array>>} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Append the passed polygon to this multipolygon. + * @param {Polygon} polygon Polygon. + * @api + */ + MultiPolygon.prototype.appendPolygon = function (polygon) { + /** @type {Array} */ + var ends; + if (!this.flatCoordinates) { + this.flatCoordinates = polygon.getFlatCoordinates().slice(); + ends = polygon.getEnds().slice(); + this.endss_.push(); + } + else { + var offset = this.flatCoordinates.length; + array_extend(this.flatCoordinates, polygon.getFlatCoordinates()); + ends = polygon.getEnds().slice(); + for (var i = 0, ii = ends.length; i < ii; ++i) { + ends[i] += offset; + } + } + this.endss_.push(ends); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiPolygon} Clone. + * @api + */ + MultiPolygon.prototype.clone = function () { + var len = this.endss_.length; + var newEndss = new Array(len); + for (var i = 0; i < len; ++i) { + newEndss[i] = this.endss_[i].slice(); + } + var multiPolygon = new MultiPolygon(this.flatCoordinates.slice(), this.layout, newEndss); + multiPolygon.applyProperties(this); + return multiPolygon; + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + MultiPolygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(multiArrayMaxSquaredDelta(this.flatCoordinates, 0, this.endss_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return assignClosestMultiArrayPoint(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + MultiPolygon.prototype.containsXY = function (x, y) { + return linearRingssContainsXY(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y); + }; + /** + * Return the area of the multipolygon on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + MultiPolygon.prototype.getArea = function () { + return linearRingss(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride); + }; + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for multi-polygons. + * + * @param {boolean} [opt_right] Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @return {Array>>} Coordinates. + * @api + */ + MultiPolygon.prototype.getCoordinates = function (opt_right) { + var flatCoordinates; + if (opt_right !== undefined) { + flatCoordinates = this.getOrientedFlatCoordinates().slice(); + orientLinearRingsArray(flatCoordinates, 0, this.endss_, this.stride, opt_right); + } + else { + flatCoordinates = this.flatCoordinates; + } + return inflateMultiCoordinatesArray(flatCoordinates, 0, this.endss_, this.stride); + }; + /** + * @return {Array>} Endss. + */ + MultiPolygon.prototype.getEndss = function () { + return this.endss_; + }; + /** + * @return {Array} Flat interior points. + */ + MultiPolygon.prototype.getFlatInteriorPoints = function () { + if (this.flatInteriorPointsRevision_ != this.getRevision()) { + var flatCenters = center_linearRingss(this.flatCoordinates, 0, this.endss_, this.stride); + this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, flatCenters); + this.flatInteriorPointsRevision_ = this.getRevision(); + } + return this.flatInteriorPoints_; + }; + /** + * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}. + * @return {MultiPoint} Interior points as XYM coordinates, where M is + * the length of the horizontal intersection that the point belongs to. + * @api + */ + MultiPolygon.prototype.getInteriorPoints = function () { + return new geom_MultiPoint(this.getFlatInteriorPoints().slice(), geom_GeometryLayout.XYM); + }; + /** + * @return {Array} Oriented flat coordinates. + */ + MultiPolygon.prototype.getOrientedFlatCoordinates = function () { + if (this.orientedRevision_ != this.getRevision()) { + var flatCoordinates = this.flatCoordinates; + if (linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)) { + this.orientedFlatCoordinates_ = flatCoordinates; + } + else { + this.orientedFlatCoordinates_ = flatCoordinates.slice(); + this.orientedFlatCoordinates_.length = orientLinearRingsArray(this.orientedFlatCoordinates_, 0, this.endss_, this.stride); + } + this.orientedRevision_ = this.getRevision(); + } + return this.orientedFlatCoordinates_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiPolygon} Simplified MultiPolygon. + * @protected + */ + MultiPolygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEndss = []; + simplifiedFlatCoordinates.length = quantizeMultiArray(this.flatCoordinates, 0, this.endss_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEndss); + return new MultiPolygon(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEndss); + }; + /** + * Return the polygon at the specified index. + * @param {number} index Index. + * @return {Polygon} Polygon. + * @api + */ + MultiPolygon.prototype.getPolygon = function (index) { + if (index < 0 || this.endss_.length <= index) { + return null; + } + var offset; + if (index === 0) { + offset = 0; + } + else { + var prevEnds = this.endss_[index - 1]; + offset = prevEnds[prevEnds.length - 1]; + } + var ends = this.endss_[index].slice(); + var end = ends[ends.length - 1]; + if (offset !== 0) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + ends[i] -= offset; + } + } + return new geom_Polygon(this.flatCoordinates.slice(offset, end), this.layout, ends); + }; + /** + * Return the polygons of this multipolygon. + * @return {Array} Polygons. + * @api + */ + MultiPolygon.prototype.getPolygons = function () { + var layout = this.layout; + var flatCoordinates = this.flatCoordinates; + var endss = this.endss_; + var polygons = []; + var offset = 0; + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i].slice(); + var end = ends[ends.length - 1]; + if (offset !== 0) { + for (var j = 0, jj = ends.length; j < jj; ++j) { + ends[j] -= offset; + } + } + var polygon = new geom_Polygon(flatCoordinates.slice(offset, end), layout, ends); + polygons.push(polygon); + offset = end; + } + return polygons; + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + MultiPolygon.prototype.getType = function () { + return 'MultiPolygon'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + MultiPolygon.prototype.intersectsExtent = function (extent) { + return intersectsLinearRingMultiArray(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent); + }; + /** + * Set the coordinates of the multipolygon. + * @param {!Array>>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + MultiPolygon.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 3); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + var endss = deflateMultiCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.endss_); + if (endss.length === 0) { + this.flatCoordinates.length = 0; + } + else { + var lastEnds = endss[endss.length - 1]; + this.flatCoordinates.length = + lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1]; + } + this.changed(); + }; + return MultiPolygon; +}(geom_SimpleGeometry)); +/* harmony default export */ var geom_MultiPolygon = (MultiPolygon); +//# sourceMappingURL=MultiPolygon.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/TileProperty.js +/** + * @module ol/layer/TileProperty + */ +/** + * @enum {string} + */ +/* harmony default export */ var TileProperty = ({ + PRELOAD: 'preload', + USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError', +}); +//# sourceMappingURL=TileProperty.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/BaseTile.js +var BaseTile_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/layer/BaseTile + */ + + + +/*** + * @template Return + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} BaseTileLayerOnSignature + */ +/** + * @template {import("../source/Tile.js").default} TileSourceType + * @typedef {Object} Options + * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. + * @property {number} [opacity=1] Opacity (0, 1). + * @property {boolean} [visible=true] Visibility. + * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be + * rendered outside of this extent. + * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers + * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed + * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()` + * method was used. + * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be + * visible. + * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will + * be visible. + * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be + * visible. + * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will + * be visible. + * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0` + * means no preloading. + * @property {TileSourceType} [source] Source for this layer. + * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage + * this layer in its layers collection, and the layer will be rendered on top. This is useful for + * temporary layers. The standard way to add a layer to a map and have it managed by the map is to + * use {@link import("../PluggableMap.js").default#addLayer map.addLayer()}. + * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error. + * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`. + */ +/** + * @classdesc + * For layer sources that provide pre-rendered, tiled images in grids that are + * organized by zoom levels for specific resolutions. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @template {import("../source/Tile.js").default} TileSourceType + * @template {import("../renderer/Layer.js").default} RendererType + * @extends {Layer} + * @api + */ +var BaseTileLayer = /** @class */ (function (_super) { + BaseTile_extends(BaseTileLayer, _super); + /** + * @param {Options} [opt_options] Tile layer options. + */ + function BaseTileLayer(opt_options) { + var _this = this; + var options = opt_options ? opt_options : {}; + var baseOptions = obj_assign({}, options); + delete baseOptions.preload; + delete baseOptions.useInterimTilesOnError; + _this = _super.call(this, baseOptions) || this; + /*** + * @type {BaseTileLayerOnSignature} + */ + _this.on; + /*** + * @type {BaseTileLayerOnSignature} + */ + _this.once; + /*** + * @type {BaseTileLayerOnSignature} + */ + _this.un; + _this.setPreload(options.preload !== undefined ? options.preload : 0); + _this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined + ? options.useInterimTilesOnError + : true); + return _this; + } + /** + * Return the level as number to which we will preload tiles up to. + * @return {number} The level to preload tiles up to. + * @observable + * @api + */ + BaseTileLayer.prototype.getPreload = function () { + return /** @type {number} */ (this.get(TileProperty.PRELOAD)); + }; + /** + * Set the level as number to which we will preload tiles up to. + * @param {number} preload The level to preload tiles up to. + * @observable + * @api + */ + BaseTileLayer.prototype.setPreload = function (preload) { + this.set(TileProperty.PRELOAD, preload); + }; + /** + * Whether we use interim tiles on error. + * @return {boolean} Use interim tiles on error. + * @observable + * @api + */ + BaseTileLayer.prototype.getUseInterimTilesOnError = function () { + return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR)); + }; + /** + * Set whether we use interim tiles on error. + * @param {boolean} useInterimTilesOnError Use interim tiles on error. + * @observable + * @api + */ + BaseTileLayer.prototype.setUseInterimTilesOnError = function (useInterimTilesOnError) { + this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); + }; + /** + * Get data for a pixel location. The return type depends on the source data. For image tiles, + * a four element RGBA array will be returned. For data tiles, the array length will match the + * number of bands in the dataset. For requests outside the layer extent, `null` will be returned. + * Data for a image tiles can only be retrieved if the source's `crossOrigin` property is set. + * + * ```js + * // display layer data on every pointer move + * map.on('pointermove', (event) => { + * console.log(layer.getData(event.pixel)); + * }); + * ``` + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data. + * @api + */ + BaseTileLayer.prototype.getData = function (pixel) { + return _super.prototype.getData.call(this, pixel); + }; + return BaseTileLayer; +}(layer_Layer)); +/* harmony default export */ var BaseTile = (BaseTileLayer); +//# sourceMappingURL=BaseTile.js.map +;// CONCATENATED MODULE: ./node_modules/ol/ImageState.js +/** + * @module ol/ImageState + */ +/** + * @enum {number} + */ +/* harmony default export */ var ImageState = ({ + IDLE: 0, + LOADING: 1, + LOADED: 2, + ERROR: 3, + EMPTY: 4, +}); +//# sourceMappingURL=ImageState.js.map +;// CONCATENATED MODULE: ./node_modules/ol/renderer/Layer.js +var renderer_Layer_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/renderer/Layer + */ + + + + +/** + * @template {import("../layer/Layer.js").default} LayerType + */ +var LayerRenderer = /** @class */ (function (_super) { + renderer_Layer_extends(LayerRenderer, _super); + /** + * @param {LayerType} layer Layer. + */ + function LayerRenderer(layer) { + var _this = _super.call(this) || this; + /** + * The renderer is initialized and ready to render. + * @type {boolean} + */ + _this.ready = true; + /** @private */ + _this.boundHandleImageChange_ = _this.handleImageChange_.bind(_this); + /** + * @protected + * @type {LayerType} + */ + _this.layer_ = layer; + /** + * @type {import("../render/canvas/ExecutorGroup").default} + */ + _this.declutterExecutorGroup = null; + return _this; + } + /** + * Asynchronous layer level hit detection. + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with + * an array of features. + */ + LayerRenderer.prototype.getFeatures = function (pixel) { + return util_abstract(); + }; + /** + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data. + */ + LayerRenderer.prototype.getData = function (pixel) { + return null; + }; + /** + * Determine whether render should be called. + * @abstract + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. + */ + LayerRenderer.prototype.prepareFrame = function (frameState) { + return util_abstract(); + }; + /** + * Render the layer. + * @abstract + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. + */ + LayerRenderer.prototype.renderFrame = function (frameState, target) { + return util_abstract(); + }; + /** + * @param {Object>} tiles Lookup of loaded tiles by zoom level. + * @param {number} zoom Zoom level. + * @param {import("../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. + */ + LayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) { + if (!tiles[zoom]) { + tiles[zoom] = {}; + } + tiles[zoom][tile.tileCoord.toString()] = tile; + return undefined; + }; + /** + * Create a function that adds loaded tiles to the tile lookup. + * @param {import("../source/Tile.js").default} source Tile source. + * @param {import("../proj/Projection.js").default} projection Projection of the tiles. + * @param {Object>} tiles Lookup of loaded tiles by zoom level. + * @return {function(number, import("../TileRange.js").default):boolean} A function that can be + * called with a zoom level and a tile range to add loaded tiles to the lookup. + * @protected + */ + LayerRenderer.prototype.createLoadedTileFinder = function (source, projection, tiles) { + return ( + /** + * @param {number} zoom Zoom level. + * @param {import("../TileRange.js").default} tileRange Tile range. + * @return {boolean} The tile range is fully loaded. + * @this {LayerRenderer} + */ + function (zoom, tileRange) { + var callback = this.loadedTileCallback.bind(this, tiles, zoom); + return source.forEachLoadedTile(projection, zoom, tileRange, callback); + }.bind(this)); + }; + /** + * @abstract + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {import("./vector.js").FeatureCallback} callback Feature callback. + * @param {Array>} matches The hit detected matches with tolerance. + * @return {T|undefined} Callback result. + * @template T + */ + LayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, matches) { + return undefined; + }; + /** + * @abstract + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel + * location, null will be returned. If there is data, but pixel values cannot be + * returned, and empty array will be returned. + */ + LayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) { + return null; + }; + /** + * @return {LayerType} Layer. + */ + LayerRenderer.prototype.getLayer = function () { + return this.layer_; + }; + /** + * Perform action necessary to get the layer rendered after new fonts have loaded + * @abstract + */ + LayerRenderer.prototype.handleFontsChanged = function () { }; + /** + * Handle changes in image state. + * @param {import("../events/Event.js").default} event Image change event. + * @private + */ + LayerRenderer.prototype.handleImageChange_ = function (event) { + var image = /** @type {import("../Image.js").default} */ (event.target); + if (image.getState() === ImageState.LOADED) { + this.renderIfReadyAndVisible(); + } + }; + /** + * Load the image if not already loaded, and register the image change + * listener if needed. + * @param {import("../ImageBase.js").default} image Image. + * @return {boolean} `true` if the image is already loaded, `false` otherwise. + * @protected + */ + LayerRenderer.prototype.loadImage = function (image) { + var imageState = image.getState(); + if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) { + image.addEventListener(EventType.CHANGE, this.boundHandleImageChange_); + } + if (imageState == ImageState.IDLE) { + image.load(); + imageState = image.getState(); + } + return imageState == ImageState.LOADED; + }; + /** + * @protected + */ + LayerRenderer.prototype.renderIfReadyAndVisible = function () { + var layer = this.getLayer(); + if (layer && layer.getVisible() && layer.getSourceState() === 'ready') { + layer.changed(); + } + }; + /** + * Clean up. + */ + LayerRenderer.prototype.disposeInternal = function () { + delete this.layer_; + _super.prototype.disposeInternal.call(this); + }; + return LayerRenderer; +}(ol_Observable)); +/* harmony default export */ var renderer_Layer = (LayerRenderer); +//# sourceMappingURL=Layer.js.map +;// CONCATENATED MODULE: ./node_modules/ol/render/Event.js +/** + * @module ol/render/Event + */ +var Event_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + +var RenderEvent = /** @class */ (function (_super) { + Event_extends(RenderEvent, _super); + /** + * @param {import("./EventType.js").default} type Type. + * @param {import("../transform.js").Transform} [opt_inversePixelTransform] Transform for + * CSS pixels to rendered pixels. + * @param {import("../PluggableMap.js").FrameState} [opt_frameState] Frame state. + * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [opt_context] Context. + */ + function RenderEvent(type, opt_inversePixelTransform, opt_frameState, opt_context) { + var _this = _super.call(this, type) || this; + /** + * Transform from CSS pixels (relative to the top-left corner of the map viewport) + * to rendered pixels on this event's `context`. Only available when a Canvas renderer is used, null otherwise. + * @type {import("../transform.js").Transform|undefined} + * @api + */ + _this.inversePixelTransform = opt_inversePixelTransform; + /** + * An object representing the current render frame state. + * @type {import("../PluggableMap.js").FrameState|undefined} + * @api + */ + _this.frameState = opt_frameState; + /** + * Canvas context. Not available when the event is dispatched by the map. For Canvas 2D layers, + * the context will be the 2D rendering context. For WebGL layers, the context will be the WebGL + * context. + * @type {CanvasRenderingContext2D|WebGLRenderingContext|undefined} + * @api + */ + _this.context = opt_context; + return _this; + } + return RenderEvent; +}(Event)); +/* harmony default export */ var render_Event = (RenderEvent); +//# sourceMappingURL=Event.js.map +;// CONCATENATED MODULE: ./node_modules/ol/color.js +/** + * @module ol/color + */ + + +/** + * A color represented as a short array [red, green, blue, alpha]. + * red, green, and blue should be integers in the range 0..255 inclusive. + * alpha should be a float in the range 0..1 inclusive. If no alpha value is + * given then `1` will be used. + * @typedef {Array} Color + * @api + */ +/** + * This RegExp matches # followed by 3, 4, 6, or 8 hex digits. + * @const + * @type {RegExp} + * @private + */ +var HEX_COLOR_RE_ = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i; +/** + * Regular expression for matching potential named color style strings. + * @const + * @type {RegExp} + * @private + */ +var NAMED_COLOR_RE_ = /^([a-z]*)$|^hsla?\(.*\)$/i; +/** + * Return the color as an rgba string. + * @param {Color|string} color Color. + * @return {string} Rgba string. + * @api + */ +function asString(color) { + if (typeof color === 'string') { + return color; + } + else { + return color_toString(color); + } +} +/** + * Return named color as an rgba string. + * @param {string} color Named color. + * @return {string} Rgb string. + */ +function fromNamed(color) { + var el = document.createElement('div'); + el.style.color = color; + if (el.style.color !== '') { + document.body.appendChild(el); + var rgb = getComputedStyle(el).color; + document.body.removeChild(el); + return rgb; + } + else { + return ''; + } +} +/** + * @param {string} s String. + * @return {Color} Color. + */ +var fromString = (function () { + // We maintain a small cache of parsed strings. To provide cheap LRU-like + // semantics, whenever the cache grows too large we simply delete an + // arbitrary 25% of the entries. + /** + * @const + * @type {number} + */ + var MAX_CACHE_SIZE = 1024; + /** + * @type {Object} + */ + var cache = {}; + /** + * @type {number} + */ + var cacheSize = 0; + return ( + /** + * @param {string} s String. + * @return {Color} Color. + */ + function (s) { + var color; + if (cache.hasOwnProperty(s)) { + color = cache[s]; + } + else { + if (cacheSize >= MAX_CACHE_SIZE) { + var i = 0; + for (var key in cache) { + if ((i++ & 3) === 0) { + delete cache[key]; + --cacheSize; + } + } + } + color = fromStringInternal_(s); + cache[s] = color; + ++cacheSize; + } + return color; + }); +})(); +/** + * Return the color as an array. This function maintains a cache of calculated + * arrays which means the result should not be modified. + * @param {Color|string} color Color. + * @return {Color} Color. + * @api + */ +function asArray(color) { + if (Array.isArray(color)) { + return color; + } + else { + return fromString(color); + } +} +/** + * @param {string} s String. + * @private + * @return {Color} Color. + */ +function fromStringInternal_(s) { + var r, g, b, a, color; + if (NAMED_COLOR_RE_.exec(s)) { + s = fromNamed(s); + } + if (HEX_COLOR_RE_.exec(s)) { + // hex + var n = s.length - 1; // number of hex digits + var d = // number of digits per channel + void 0; // number of digits per channel + if (n <= 4) { + d = 1; + } + else { + d = 2; + } + var hasAlpha = n === 4 || n === 8; + r = parseInt(s.substr(1 + 0 * d, d), 16); + g = parseInt(s.substr(1 + 1 * d, d), 16); + b = parseInt(s.substr(1 + 2 * d, d), 16); + if (hasAlpha) { + a = parseInt(s.substr(1 + 3 * d, d), 16); + } + else { + a = 255; + } + if (d == 1) { + r = (r << 4) + r; + g = (g << 4) + g; + b = (b << 4) + b; + if (hasAlpha) { + a = (a << 4) + a; + } + } + color = [r, g, b, a / 255]; + } + else if (s.indexOf('rgba(') == 0) { + // rgba() + color = s.slice(5, -1).split(',').map(Number); + normalize(color); + } + else if (s.indexOf('rgb(') == 0) { + // rgb() + color = s.slice(4, -1).split(',').map(Number); + color.push(1); + normalize(color); + } + else { + asserts_assert(false, 14); // Invalid color + } + return color; +} +/** + * TODO this function is only used in the test, we probably shouldn't export it + * @param {Color} color Color. + * @return {Color} Clamped color. + */ +function normalize(color) { + color[0] = math_clamp((color[0] + 0.5) | 0, 0, 255); + color[1] = math_clamp((color[1] + 0.5) | 0, 0, 255); + color[2] = math_clamp((color[2] + 0.5) | 0, 0, 255); + color[3] = math_clamp(color[3], 0, 1); + return color; +} +/** + * @param {Color} color Color. + * @return {string} String. + */ +function color_toString(color) { + var r = color[0]; + if (r != (r | 0)) { + r = (r + 0.5) | 0; + } + var g = color[1]; + if (g != (g | 0)) { + g = (g + 0.5) | 0; + } + var b = color[2]; + if (b != (b | 0)) { + b = (b + 0.5) | 0; + } + var a = color[3] === undefined ? 1 : Math.round(color[3] * 100) / 100; + return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; +} +/** + * @param {string} s String. + * @return {boolean} Whether the string is actually a valid color + */ +function isStringColor(s) { + if (NAMED_COLOR_RE_.test(s)) { + s = fromNamed(s); + } + return (HEX_COLOR_RE_.test(s) || s.indexOf('rgba(') === 0 || s.indexOf('rgb(') === 0); +} +//# sourceMappingURL=color.js.map +;// CONCATENATED MODULE: ./node_modules/ol/renderer/canvas/Layer.js +var canvas_Layer_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/renderer/canvas/Layer + */ + + + + + + + + +/** + * @type {Array} + */ +var canvasPool = []; +/** + * @type {CanvasRenderingContext2D} + */ +var pixelContext = null; +function createPixelContext() { + var canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 1; + pixelContext = canvas.getContext('2d'); +} +/** + * @abstract + * @template {import("../../layer/Layer.js").default} LayerType + * @extends {LayerRenderer} + */ +var CanvasLayerRenderer = /** @class */ (function (_super) { + canvas_Layer_extends(CanvasLayerRenderer, _super); + /** + * @param {LayerType} layer Layer. + */ + function CanvasLayerRenderer(layer) { + var _this = _super.call(this, layer) || this; + /** + * @protected + * @type {HTMLElement} + */ + _this.container = null; + /** + * @protected + * @type {number} + */ + _this.renderedResolution; + /** + * A temporary transform. The values in this transform should only be used in a + * function that sets the values. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.tempTransform = create(); + /** + * The transform for rendered pixels to viewport CSS pixels. This transform must + * be set when rendering a frame and may be used by other functions after rendering. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.pixelTransform = create(); + /** + * The transform for viewport CSS pixels to rendered pixels. This transform must + * be set when rendering a frame and may be used by other functions after rendering. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.inversePixelTransform = create(); + /** + * @type {CanvasRenderingContext2D} + */ + _this.context = null; + /** + * @type {boolean} + */ + _this.containerReused = false; + /** + * @private + * @type {CanvasRenderingContext2D} + */ + _this.pixelContext_ = null; + /** + * @protected + * @type {import("../../PluggableMap.js").FrameState|null} + */ + _this.frameState = null; + return _this; + } + /** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. + * @param {number} col The column index. + * @param {number} row The row index. + * @return {Uint8ClampedArray|null} The image data. + */ + CanvasLayerRenderer.prototype.getImageData = function (image, col, row) { + if (!pixelContext) { + createPixelContext(); + } + pixelContext.clearRect(0, 0, 1, 1); + var data; + try { + pixelContext.drawImage(image, col, row, 1, 1, 0, 0, 1, 1); + data = pixelContext.getImageData(0, 0, 1, 1).data; + } + catch (err) { + pixelContext = null; + return null; + } + return data; + }; + /** + * @param {import('../../PluggableMap.js').FrameState} frameState Frame state. + * @return {string} Background color. + */ + CanvasLayerRenderer.prototype.getBackground = function (frameState) { + var layer = this.getLayer(); + var background = layer.getBackground(); + if (typeof background === 'function') { + background = background(frameState.viewState.resolution); + } + return background || undefined; + }; + /** + * Get a rendering container from an existing target, if compatible. + * @param {HTMLElement} target Potential render target. + * @param {string} transform CSS Transform. + * @param {string} [opt_backgroundColor] Background color. + */ + CanvasLayerRenderer.prototype.useContainer = function (target, transform, opt_backgroundColor) { + var layerClassName = this.getLayer().getClassName(); + var container, context; + if (target && + target.className === layerClassName && + (!opt_backgroundColor || + (target && + target.style.backgroundColor && + equals(asArray(target.style.backgroundColor), asArray(opt_backgroundColor))))) { + var canvas = target.firstElementChild; + if (canvas instanceof HTMLCanvasElement) { + context = canvas.getContext('2d'); + } + } + if (context && context.canvas.style.transform === transform) { + // Container of the previous layer renderer can be used. + this.container = target; + this.context = context; + this.containerReused = true; + } + else if (this.containerReused) { + // Previously reused container cannot be used any more. + this.container = null; + this.context = null; + this.containerReused = false; + } + if (!this.container) { + container = document.createElement('div'); + container.className = layerClassName; + var style = container.style; + style.position = 'absolute'; + style.width = '100%'; + style.height = '100%'; + context = createCanvasContext2D(); + var canvas = context.canvas; + container.appendChild(canvas); + style = canvas.style; + style.position = 'absolute'; + style.left = '0'; + style.transformOrigin = 'top left'; + this.container = container; + this.context = context; + } + if (!this.containerReused && + opt_backgroundColor && + !this.container.style.backgroundColor) { + this.container.style.backgroundColor = opt_backgroundColor; + } + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../extent.js").Extent} extent Clip extent. + * @protected + */ + CanvasLayerRenderer.prototype.clipUnrotated = function (context, frameState, extent) { + var topLeft = getTopLeft(extent); + var topRight = getTopRight(extent); + var bottomRight = getBottomRight(extent); + var bottomLeft = getBottomLeft(extent); + apply(frameState.coordinateToPixelTransform, topLeft); + apply(frameState.coordinateToPixelTransform, topRight); + apply(frameState.coordinateToPixelTransform, bottomRight); + apply(frameState.coordinateToPixelTransform, bottomLeft); + var inverted = this.inversePixelTransform; + apply(inverted, topLeft); + apply(inverted, topRight); + apply(inverted, bottomRight); + apply(inverted, bottomLeft); + context.save(); + context.beginPath(); + context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1])); + context.lineTo(Math.round(topRight[0]), Math.round(topRight[1])); + context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1])); + context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1])); + context.clip(); + }; + /** + * @param {import("../../render/EventType.js").default} type Event type. + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @private + */ + CanvasLayerRenderer.prototype.dispatchRenderEvent_ = function (type, context, frameState) { + var layer = this.getLayer(); + if (layer.hasListener(type)) { + var event_1 = new render_Event(type, this.inversePixelTransform, frameState, context); + layer.dispatchEvent(event_1); + } + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + CanvasLayerRenderer.prototype.preRender = function (context, frameState) { + this.frameState = frameState; + this.dispatchRenderEvent_(render_EventType.PRERENDER, context, frameState); + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + CanvasLayerRenderer.prototype.postRender = function (context, frameState) { + this.dispatchRenderEvent_(render_EventType.POSTRENDER, context, frameState); + }; + /** + * Creates a transform for rendering to an element that will be rotated after rendering. + * @param {import("../../coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {number} pixelRatio Pixel ratio. + * @param {number} width Width of the rendered element (in pixels). + * @param {number} height Height of the rendered element (in pixels). + * @param {number} offsetX Offset on the x-axis in view coordinates. + * @protected + * @return {!import("../../transform.js").Transform} Transform. + */ + CanvasLayerRenderer.prototype.getRenderTransform = function (center, resolution, rotation, pixelRatio, width, height, offsetX) { + var dx1 = width / 2; + var dy1 = height / 2; + var sx = pixelRatio / resolution; + var sy = -sx; + var dx2 = -center[0] + offsetX; + var dy2 = -center[1]; + return compose(this.tempTransform, dx1, dy1, sx, sy, -rotation, dx2, dy2); + }; + /** + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @param {import("../../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel + * location, null will be returned. If there is data, but pixel values cannot be + * returned, and empty array will be returned. + */ + CanvasLayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) { + var renderPixel = apply(this.inversePixelTransform, pixel.slice()); + var context = this.context; + var layer = this.getLayer(); + var layerExtent = layer.getExtent(); + if (layerExtent) { + var renderCoordinate = apply(frameState.pixelToCoordinateTransform, pixel.slice()); + /** get only data inside of the layer extent */ + if (!containsCoordinate(layerExtent, renderCoordinate)) { + return null; + } + } + var x = Math.round(renderPixel[0]); + var y = Math.round(renderPixel[1]); + var pixelContext = this.pixelContext_; + if (!pixelContext) { + var pixelCanvas = document.createElement('canvas'); + pixelCanvas.width = 1; + pixelCanvas.height = 1; + pixelContext = pixelCanvas.getContext('2d'); + this.pixelContext_ = pixelContext; + } + pixelContext.clearRect(0, 0, 1, 1); + var data; + try { + pixelContext.drawImage(context.canvas, x, y, 1, 1, 0, 0, 1, 1); + data = pixelContext.getImageData(0, 0, 1, 1).data; + } + catch (err) { + if (err.name === 'SecurityError') { + // tainted canvas, we assume there is data at the given pixel (although there might not be) + this.pixelContext_ = null; + return new Uint8Array(); + } + return data; + } + if (data[3] === 0) { + return null; + } + return data; + }; + /** + * Clean up. + */ + CanvasLayerRenderer.prototype.disposeInternal = function () { + delete this.frameState; + _super.prototype.disposeInternal.call(this); + }; + return CanvasLayerRenderer; +}(renderer_Layer)); +/* harmony default export */ var canvas_Layer = (CanvasLayerRenderer); +//# sourceMappingURL=Layer.js.map +;// CONCATENATED MODULE: ./node_modules/ol/TileState.js +/** + * @module ol/TileState + */ +/** + * @enum {number} + */ +/* harmony default export */ var TileState = ({ + IDLE: 0, + LOADING: 1, + LOADED: 2, + /** + * Indicates that tile loading failed + * @type {number} + */ + ERROR: 3, + EMPTY: 4, +}); +//# sourceMappingURL=TileState.js.map +;// CONCATENATED MODULE: ./node_modules/ol/Tile.js +var Tile_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/Tile + */ + + + + + +/** + * A function that takes an {@link module:ol/Tile~Tile} for the tile and a + * `{string}` for the url as arguments. The default is + * ```js + * source.setTileLoadFunction(function(tile, src) { + * tile.getImage().src = src; + * }); + * ``` + * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve + * error handling: + * + * ```js + * import TileState from 'ol/TileState'; + * + * source.setTileLoadFunction(function(tile, src) { + * var xhr = new XMLHttpRequest(); + * xhr.responseType = 'blob'; + * xhr.addEventListener('loadend', function (evt) { + * var data = this.response; + * if (data !== undefined) { + * tile.getImage().src = URL.createObjectURL(data); + * } else { + * tile.setState(TileState.ERROR); + * } + * }); + * xhr.addEventListener('error', function () { + * tile.setState(TileState.ERROR); + * }); + * xhr.open('GET', src); + * xhr.send(); + * }); + * ``` + * + * @typedef {function(Tile, string): void} LoadFunction + * @api + */ +/** + * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get + * the url that provides a tile for a given tile coordinate. + * + * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile + * coordinate, a `{number}` representing the pixel ratio and a + * {@link module:ol/proj/Projection~Projection} for the projection as arguments + * and returns a `{string}` representing the tile URL, or undefined if no tile + * should be requested for the passed tile coordinate. + * + * @typedef {function(import("./tilecoord.js").TileCoord, number, + * import("./proj/Projection.js").default): (string|undefined)} UrlFunction + * @api + */ +/** + * @typedef {Object} Options + * @property {number} [transition=250] A duration for tile opacity + * transitions in milliseconds. A duration of 0 disables the opacity transition. + * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default, + * the nearest neighbor is used when resampling. + * @api + */ +/** + * @classdesc + * Base class for tiles. + * + * @abstract + */ +var Tile = /** @class */ (function (_super) { + Tile_extends(Tile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {Options} [opt_options] Tile options. + */ + function Tile(tileCoord, state, opt_options) { + var _this = _super.call(this) || this; + var options = opt_options ? opt_options : {}; + /** + * @type {import("./tilecoord.js").TileCoord} + */ + _this.tileCoord = tileCoord; + /** + * @protected + * @type {import("./TileState.js").default} + */ + _this.state = state; + /** + * An "interim" tile for this tile. The interim tile may be used while this + * one is loading, for "smooth" transitions when changing params/dimensions + * on the source. + * @type {Tile} + */ + _this.interimTile = null; + /** + * A key assigned to the tile. This is used by the tile source to determine + * if this tile can effectively be used, or if a new tile should be created + * and this one be used as an interim tile for this new tile. + * @type {string} + */ + _this.key = ''; + /** + * The duration for the opacity transition. + * @type {number} + */ + _this.transition_ = + options.transition === undefined ? 250 : options.transition; + /** + * Lookup of start times for rendering transitions. If the start time is + * equal to -1, the transition is complete. + * @type {Object} + */ + _this.transitionStarts_ = {}; + /** + * @type {boolean} + */ + _this.interpolate = !!options.interpolate; + return _this; + } + /** + * @protected + */ + Tile.prototype.changed = function () { + this.dispatchEvent(EventType.CHANGE); + }; + /** + * Called by the tile cache when the tile is removed from the cache due to expiry + */ + Tile.prototype.release = function () { }; + /** + * @return {string} Key. + */ + Tile.prototype.getKey = function () { + return this.key + '/' + this.tileCoord; + }; + /** + * Get the interim tile most suitable for rendering using the chain of interim + * tiles. This corresponds to the most recent tile that has been loaded, if no + * such tile exists, the original tile is returned. + * @return {!Tile} Best tile for rendering. + */ + Tile.prototype.getInterimTile = function () { + if (!this.interimTile) { + //empty chain + return this; + } + var tile = this.interimTile; + // find the first loaded tile and return it. Since the chain is sorted in + // decreasing order of creation time, there is no need to search the remainder + // of the list (all those tiles correspond to older requests and will be + // cleaned up by refreshInterimChain) + do { + if (tile.getState() == TileState.LOADED) { + // Show tile immediately instead of fading it in after loading, because + // the interim tile is in place already + this.transition_ = 0; + return tile; + } + tile = tile.interimTile; + } while (tile); + // we can not find a better tile + return this; + }; + /** + * Goes through the chain of interim tiles and discards sections of the chain + * that are no longer relevant. + */ + Tile.prototype.refreshInterimChain = function () { + if (!this.interimTile) { + return; + } + var tile = this.interimTile; + /** + * @type {Tile} + */ + var prev = this; + do { + if (tile.getState() == TileState.LOADED) { + //we have a loaded tile, we can discard the rest of the list + //we would could abort any LOADING tile request + //older than this tile (i.e. any LOADING tile following this entry in the chain) + tile.interimTile = null; + break; + } + else if (tile.getState() == TileState.LOADING) { + //keep this LOADING tile any loaded tiles later in the chain are + //older than this tile, so we're still interested in the request + prev = tile; + } + else if (tile.getState() == TileState.IDLE) { + //the head of the list is the most current tile, we don't need + //to start any other requests for this chain + prev.interimTile = tile.interimTile; + } + else { + prev = tile; + } + tile = prev.interimTile; + } while (tile); + }; + /** + * Get the tile coordinate for this tile. + * @return {import("./tilecoord.js").TileCoord} The tile coordinate. + * @api + */ + Tile.prototype.getTileCoord = function () { + return this.tileCoord; + }; + /** + * @return {import("./TileState.js").default} State. + */ + Tile.prototype.getState = function () { + return this.state; + }; + /** + * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} , + * it is important to set the state correctly to {@link module:ol/TileState~ERROR} + * when the tile cannot be loaded. Otherwise the tile cannot be removed from + * the tile queue and will block other requests. + * @param {import("./TileState.js").default} state State. + * @api + */ + Tile.prototype.setState = function (state) { + if (this.state !== TileState.ERROR && this.state > state) { + throw new Error('Tile load sequence violation'); + } + this.state = state; + this.changed(); + }; + /** + * Load the image or retry if loading previously failed. + * Loading is taken care of by the tile queue, and calling this method is + * only needed for preloading or for reloading in case of an error. + * @abstract + * @api + */ + Tile.prototype.load = function () { + util_abstract(); + }; + /** + * Get the alpha value for rendering. + * @param {string} id An id for the renderer. + * @param {number} time The render frame time. + * @return {number} A number between 0 and 1. + */ + Tile.prototype.getAlpha = function (id, time) { + if (!this.transition_) { + return 1; + } + var start = this.transitionStarts_[id]; + if (!start) { + start = time; + this.transitionStarts_[id] = start; + } + else if (start === -1) { + return 1; + } + var delta = time - start + 1000 / 60; // avoid rendering at 0 + if (delta >= this.transition_) { + return 1; + } + return easeIn(delta / this.transition_); + }; + /** + * Determine if a tile is in an alpha transition. A tile is considered in + * transition if tile.getAlpha() has not yet been called or has been called + * and returned 1. + * @param {string} id An id for the renderer. + * @return {boolean} The tile is in transition. + */ + Tile.prototype.inTransition = function (id) { + if (!this.transition_) { + return false; + } + return this.transitionStarts_[id] !== -1; + }; + /** + * Mark a transition as complete. + * @param {string} id An id for the renderer. + */ + Tile.prototype.endTransition = function (id) { + if (this.transition_) { + this.transitionStarts_[id] = -1; + } + }; + return Tile; +}(events_Target)); +/* harmony default export */ var ol_Tile = (Tile); +//# sourceMappingURL=Tile.js.map +;// CONCATENATED MODULE: ./node_modules/ol/ImageBase.js +var ImageBase_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/ImageBase + */ + + + +/** + * @abstract + */ +var ImageBase = /** @class */ (function (_super) { + ImageBase_extends(ImageBase, _super); + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number|undefined} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("./ImageState.js").default} state State. + */ + function ImageBase(extent, resolution, pixelRatio, state) { + var _this = _super.call(this) || this; + /** + * @protected + * @type {import("./extent.js").Extent} + */ + _this.extent = extent; + /** + * @private + * @type {number} + */ + _this.pixelRatio_ = pixelRatio; + /** + * @protected + * @type {number|undefined} + */ + _this.resolution = resolution; + /** + * @protected + * @type {import("./ImageState.js").default} + */ + _this.state = state; + return _this; + } + /** + * @protected + */ + ImageBase.prototype.changed = function () { + this.dispatchEvent(EventType.CHANGE); + }; + /** + * @return {import("./extent.js").Extent} Extent. + */ + ImageBase.prototype.getExtent = function () { + return this.extent; + }; + /** + * @abstract + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + */ + ImageBase.prototype.getImage = function () { + return util_abstract(); + }; + /** + * @return {number} PixelRatio. + */ + ImageBase.prototype.getPixelRatio = function () { + return this.pixelRatio_; + }; + /** + * @return {number} Resolution. + */ + ImageBase.prototype.getResolution = function () { + return /** @type {number} */ (this.resolution); + }; + /** + * @return {import("./ImageState.js").default} State. + */ + ImageBase.prototype.getState = function () { + return this.state; + }; + /** + * Load not yet loaded URI. + * @abstract + */ + ImageBase.prototype.load = function () { + util_abstract(); + }; + return ImageBase; +}(events_Target)); +/* harmony default export */ var ol_ImageBase = (ImageBase); +//# sourceMappingURL=ImageBase.js.map +;// CONCATENATED MODULE: ./node_modules/ol/Image.js +var Image_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/Image + */ + + + + + + +/** + * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a + * `{string}` for the src as arguments. It is supposed to make it so the + * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the + * content specified by the src. If not specified, the default is + * + * function(image, src) { + * image.getImage().src = src; + * } + * + * Providing a custom `imageLoadFunction` can be useful to load images with + * post requests or - in general - through XHR requests, where the src of the + * image element would be set to a data URI when the content is loaded. + * + * @typedef {function(ImageWrapper, string): void} LoadFunction + * @api + */ +var ImageWrapper = /** @class */ (function (_super) { + Image_extends(ImageWrapper, _super); + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number|undefined} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {string} src Image source URI. + * @param {?string} crossOrigin Cross origin. + * @param {LoadFunction} imageLoadFunction Image load function. + */ + function ImageWrapper(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { + var _this = _super.call(this, extent, resolution, pixelRatio, ImageState.IDLE) || this; + /** + * @private + * @type {string} + */ + _this.src_ = src; + /** + * @private + * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} + */ + _this.image_ = new Image(); + if (crossOrigin !== null) { + _this.image_.crossOrigin = crossOrigin; + } + /** + * @private + * @type {?function():void} + */ + _this.unlisten_ = null; + /** + * @protected + * @type {import("./ImageState.js").default} + */ + _this.state = ImageState.IDLE; + /** + * @private + * @type {LoadFunction} + */ + _this.imageLoadFunction_ = imageLoadFunction; + return _this; + } + /** + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @api + */ + ImageWrapper.prototype.getImage = function () { + return this.image_; + }; + /** + * Tracks loading or read errors. + * + * @private + */ + ImageWrapper.prototype.handleImageError_ = function () { + this.state = ImageState.ERROR; + this.unlistenImage_(); + this.changed(); + }; + /** + * Tracks successful image load. + * + * @private + */ + ImageWrapper.prototype.handleImageLoad_ = function () { + if (this.resolution === undefined) { + this.resolution = getHeight(this.extent) / this.image_.height; + } + this.state = ImageState.LOADED; + this.unlistenImage_(); + this.changed(); + }; + /** + * Load the image or retry if loading previously failed. + * Loading is taken care of by the tile queue, and calling this method is + * only needed for preloading or for reloading in case of an error. + * @api + */ + ImageWrapper.prototype.load = function () { + if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) { + this.state = ImageState.LOADING; + this.changed(); + this.imageLoadFunction_(this, this.src_); + this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this)); + } + }; + /** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. + */ + ImageWrapper.prototype.setImage = function (image) { + this.image_ = image; + this.resolution = getHeight(this.extent) / this.image_.height; + }; + /** + * Discards event handlers which listen for load completion or errors. + * + * @private + */ + ImageWrapper.prototype.unlistenImage_ = function () { + if (this.unlisten_) { + this.unlisten_(); + this.unlisten_ = null; + } + }; + return ImageWrapper; +}(ol_ImageBase)); +/** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image element. + * @param {function():any} loadHandler Load callback function. + * @param {function():any} errorHandler Error callback function. + * @return {function():void} Callback to stop listening. + */ +function listenImage(image, loadHandler, errorHandler) { + var img = /** @type {HTMLImageElement} */ (image); + var listening = true; + var decoding = false; + var loaded = false; + var listenerKeys = [ + listenOnce(img, EventType.LOAD, function () { + loaded = true; + if (!decoding) { + loadHandler(); + } + }), + ]; + if (img.src && IMAGE_DECODE) { + decoding = true; + img + .decode() + .then(function () { + if (listening) { + loadHandler(); + } + }) + .catch(function (error) { + if (listening) { + if (loaded) { + loadHandler(); + } + else { + errorHandler(); + } + } + }); + } + else { + listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler)); + } + return function unlisten() { + listening = false; + listenerKeys.forEach(unlistenByKey); + }; +} +/* harmony default export */ var ol_Image = ((/* unused pure expression or super */ null && (ImageWrapper))); +//# sourceMappingURL=Image.js.map +;// CONCATENATED MODULE: ./node_modules/ol/ImageTile.js +var ImageTile_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/ImageTile + */ + + + + +var ImageTile = /** @class */ (function (_super) { + ImageTile_extends(ImageTile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {string} src Image source URI. + * @param {?string} crossOrigin Cross origin. + * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function. + * @param {import("./Tile.js").Options} [opt_options] Tile options. + */ + function ImageTile(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { + var _this = _super.call(this, tileCoord, state, opt_options) || this; + /** + * @private + * @type {?string} + */ + _this.crossOrigin_ = crossOrigin; + /** + * Image URI + * + * @private + * @type {string} + */ + _this.src_ = src; + _this.key = src; + /** + * @private + * @type {HTMLImageElement|HTMLCanvasElement} + */ + _this.image_ = new Image(); + if (crossOrigin !== null) { + _this.image_.crossOrigin = crossOrigin; + } + /** + * @private + * @type {?function():void} + */ + _this.unlisten_ = null; + /** + * @private + * @type {import("./Tile.js").LoadFunction} + */ + _this.tileLoadFunction_ = tileLoadFunction; + return _this; + } + /** + * Get the HTML image element for this tile (may be a Canvas, Image, or Video). + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @api + */ + ImageTile.prototype.getImage = function () { + return this.image_; + }; + /** + * Sets an HTML image element for this tile (may be a Canvas or preloaded Image). + * @param {HTMLCanvasElement|HTMLImageElement} element Element. + */ + ImageTile.prototype.setImage = function (element) { + this.image_ = element; + this.state = TileState.LOADED; + this.unlistenImage_(); + this.changed(); + }; + /** + * Tracks loading or read errors. + * + * @private + */ + ImageTile.prototype.handleImageError_ = function () { + this.state = TileState.ERROR; + this.unlistenImage_(); + this.image_ = getBlankImage(); + this.changed(); + }; + /** + * Tracks successful image load. + * + * @private + */ + ImageTile.prototype.handleImageLoad_ = function () { + var image = /** @type {HTMLImageElement} */ (this.image_); + if (image.naturalWidth && image.naturalHeight) { + this.state = TileState.LOADED; + } + else { + this.state = TileState.EMPTY; + } + this.unlistenImage_(); + this.changed(); + }; + /** + * Load not yet loaded URI. + * @api + */ + ImageTile.prototype.load = function () { + if (this.state == TileState.ERROR) { + this.state = TileState.IDLE; + this.image_ = new Image(); + if (this.crossOrigin_ !== null) { + this.image_.crossOrigin = this.crossOrigin_; + } + } + if (this.state == TileState.IDLE) { + this.state = TileState.LOADING; + this.changed(); + this.tileLoadFunction_(this, this.src_); + this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this)); + } + }; + /** + * Discards event handlers which listen for load completion or errors. + * + * @private + */ + ImageTile.prototype.unlistenImage_ = function () { + if (this.unlisten_) { + this.unlisten_(); + this.unlisten_ = null; + } + }; + return ImageTile; +}(ol_Tile)); +/** + * Get a 1-pixel blank image. + * @return {HTMLCanvasElement} Blank image. + */ +function getBlankImage() { + var ctx = createCanvasContext2D(1, 1); + ctx.fillStyle = 'rgba(0,0,0,0)'; + ctx.fillRect(0, 0, 1, 1); + return ctx.canvas; +} +/* harmony default export */ var ol_ImageTile = (ImageTile); +//# sourceMappingURL=ImageTile.js.map +;// CONCATENATED MODULE: ./node_modules/ol/reproj/common.js +/** + * @module ol/reproj/common + */ +/** + * Default maximum allowed threshold (in pixels) for reprojection + * triangulation. + * @type {number} + */ +var ERROR_THRESHOLD = 0.5; +/** + * Enable automatic reprojection of raster sources. Default is `true`. + * TODO: decide if we want to expose this as a build flag or remove it + * @type {boolean} + */ +var ENABLE_RASTER_REPROJECTION = true; +//# sourceMappingURL=common.js.map +;// CONCATENATED MODULE: ./node_modules/ol/reproj/Triangulation.js +/** + * @module ol/reproj/Triangulation + */ + + + +/** + * Single triangle; consists of 3 source points and 3 target points. + * @typedef {Object} Triangle + * @property {Array} source Source. + * @property {Array} target Target. + */ +/** + * Maximum number of subdivision steps during raster reprojection triangulation. + * Prevents high memory usage and large number of proj4 calls (for certain + * transformations and areas). At most `2*(2^this)` triangles are created for + * each triangulated extent (tile/image). + * @type {number} + */ +var MAX_SUBDIVISION = 10; +/** + * Maximum allowed size of triangle relative to world width. When transforming + * corners of world extent between certain projections, the resulting + * triangulation seems to have zero error and no subdivision is performed. If + * the triangle width is more than this (relative to world width; 0-1), + * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`. + * @type {number} + */ +var MAX_TRIANGLE_WIDTH = 0.25; +/** + * @classdesc + * Class containing triangulation of the given target extent. + * Used for determining source data and the reprojection itself. + */ +var Triangulation = /** @class */ (function () { + /** + * @param {import("../proj/Projection.js").default} sourceProj Source projection. + * @param {import("../proj/Projection.js").default} targetProj Target projection. + * @param {import("../extent.js").Extent} targetExtent Target extent to triangulate. + * @param {import("../extent.js").Extent} maxSourceExtent Maximal source extent that can be used. + * @param {number} errorThreshold Acceptable error (in source units). + * @param {?number} opt_destinationResolution The (optional) resolution of the destination. + */ + function Triangulation(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold, opt_destinationResolution) { + /** + * @type {import("../proj/Projection.js").default} + * @private + */ + this.sourceProj_ = sourceProj; + /** + * @type {import("../proj/Projection.js").default} + * @private + */ + this.targetProj_ = targetProj; + /** @type {!Object} */ + var transformInvCache = {}; + var transformInv = getTransform(this.targetProj_, this.sourceProj_); + /** + * @param {import("../coordinate.js").Coordinate} c A coordinate. + * @return {import("../coordinate.js").Coordinate} Transformed coordinate. + * @private + */ + this.transformInv_ = function (c) { + var key = c[0] + '/' + c[1]; + if (!transformInvCache[key]) { + transformInvCache[key] = transformInv(c); + } + return transformInvCache[key]; + }; + /** + * @type {import("../extent.js").Extent} + * @private + */ + this.maxSourceExtent_ = maxSourceExtent; + /** + * @type {number} + * @private + */ + this.errorThresholdSquared_ = errorThreshold * errorThreshold; + /** + * @type {Array} + * @private + */ + this.triangles_ = []; + /** + * Indicates that the triangulation crosses edge of the source projection. + * @type {boolean} + * @private + */ + this.wrapsXInSource_ = false; + /** + * @type {boolean} + * @private + */ + this.canWrapXInSource_ = + this.sourceProj_.canWrapX() && + !!maxSourceExtent && + !!this.sourceProj_.getExtent() && + extent_getWidth(maxSourceExtent) == extent_getWidth(this.sourceProj_.getExtent()); + /** + * @type {?number} + * @private + */ + this.sourceWorldWidth_ = this.sourceProj_.getExtent() + ? extent_getWidth(this.sourceProj_.getExtent()) + : null; + /** + * @type {?number} + * @private + */ + this.targetWorldWidth_ = this.targetProj_.getExtent() + ? extent_getWidth(this.targetProj_.getExtent()) + : null; + var destinationTopLeft = getTopLeft(targetExtent); + var destinationTopRight = getTopRight(targetExtent); + var destinationBottomRight = getBottomRight(targetExtent); + var destinationBottomLeft = getBottomLeft(targetExtent); + var sourceTopLeft = this.transformInv_(destinationTopLeft); + var sourceTopRight = this.transformInv_(destinationTopRight); + var sourceBottomRight = this.transformInv_(destinationBottomRight); + var sourceBottomLeft = this.transformInv_(destinationBottomLeft); + /* + * The maxSubdivision controls how many splittings of the target area can + * be done. The idea here is to do a linear mapping of the target areas + * but the actual overal reprojection (can be) extremely non-linear. The + * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256 + * tile size. However this function is also called to remap canvas rendered + * layers which can be much larger. This calculation increases the maxSubdivision + * value by the right factor so that each 256x256 pixel area has + * MAX_SUBDIVISION divisions. + */ + var maxSubdivision = MAX_SUBDIVISION + + (opt_destinationResolution + ? Math.max(0, Math.ceil(log2(getArea(targetExtent) / + (opt_destinationResolution * + opt_destinationResolution * + 256 * + 256)))) + : 0); + this.addQuad_(destinationTopLeft, destinationTopRight, destinationBottomRight, destinationBottomLeft, sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, maxSubdivision); + if (this.wrapsXInSource_) { + var leftBound_1 = Infinity; + this.triangles_.forEach(function (triangle, i, arr) { + leftBound_1 = Math.min(leftBound_1, triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]); + }); + // Shift triangles to be as close to `leftBound` as possible + // (if the distance is more than `worldWidth / 2` it can be closer. + this.triangles_.forEach(function (triangle) { + if (Math.max(triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]) - + leftBound_1 > + this.sourceWorldWidth_ / 2) { + var newTriangle = [ + [triangle.source[0][0], triangle.source[0][1]], + [triangle.source[1][0], triangle.source[1][1]], + [triangle.source[2][0], triangle.source[2][1]], + ]; + if (newTriangle[0][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[0][0] -= this.sourceWorldWidth_; + } + if (newTriangle[1][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[1][0] -= this.sourceWorldWidth_; + } + if (newTriangle[2][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[2][0] -= this.sourceWorldWidth_; + } + // Rarely (if the extent contains both the dateline and prime meridian) + // the shift can in turn break some triangles. + // Detect this here and don't shift in such cases. + var minX = Math.min(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); + var maxX = Math.max(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); + if (maxX - minX < this.sourceWorldWidth_ / 2) { + triangle.source = newTriangle; + } + } + }.bind(this)); + } + transformInvCache = {}; + } + /** + * Adds triangle to the triangulation. + * @param {import("../coordinate.js").Coordinate} a The target a coordinate. + * @param {import("../coordinate.js").Coordinate} b The target b coordinate. + * @param {import("../coordinate.js").Coordinate} c The target c coordinate. + * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate. + * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate. + * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate. + * @private + */ + Triangulation.prototype.addTriangle_ = function (a, b, c, aSrc, bSrc, cSrc) { + this.triangles_.push({ + source: [aSrc, bSrc, cSrc], + target: [a, b, c], + }); + }; + /** + * Adds quad (points in clock-wise order) to the triangulation + * (and reprojects the vertices) if valid. + * Performs quad subdivision if needed to increase precision. + * + * @param {import("../coordinate.js").Coordinate} a The target a coordinate. + * @param {import("../coordinate.js").Coordinate} b The target b coordinate. + * @param {import("../coordinate.js").Coordinate} c The target c coordinate. + * @param {import("../coordinate.js").Coordinate} d The target d coordinate. + * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate. + * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate. + * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate. + * @param {import("../coordinate.js").Coordinate} dSrc The source d coordinate. + * @param {number} maxSubdivision Maximal allowed subdivision of the quad. + * @private + */ + Triangulation.prototype.addQuad_ = function (a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) { + var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]); + var sourceCoverageX = this.sourceWorldWidth_ + ? extent_getWidth(sourceQuadExtent) / this.sourceWorldWidth_ + : null; + var sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_); + // when the quad is wrapped in the source projection + // it covers most of the projection extent, but not fully + var wrapsX = this.sourceProj_.canWrapX() && + sourceCoverageX > 0.5 && + sourceCoverageX < 1; + var needsSubdivision = false; + if (maxSubdivision > 0) { + if (this.targetProj_.isGlobal() && this.targetWorldWidth_) { + var targetQuadExtent = boundingExtent([a, b, c, d]); + var targetCoverageX = extent_getWidth(targetQuadExtent) / this.targetWorldWidth_; + needsSubdivision = + targetCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision; + } + if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) { + needsSubdivision = + sourceCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision; + } + } + if (!needsSubdivision && this.maxSourceExtent_) { + if (isFinite(sourceQuadExtent[0]) && + isFinite(sourceQuadExtent[1]) && + isFinite(sourceQuadExtent[2]) && + isFinite(sourceQuadExtent[3])) { + if (!intersects(sourceQuadExtent, this.maxSourceExtent_)) { + // whole quad outside source projection extent -> ignore + return; + } + } + } + var isNotFinite = 0; + if (!needsSubdivision) { + if (!isFinite(aSrc[0]) || + !isFinite(aSrc[1]) || + !isFinite(bSrc[0]) || + !isFinite(bSrc[1]) || + !isFinite(cSrc[0]) || + !isFinite(cSrc[1]) || + !isFinite(dSrc[0]) || + !isFinite(dSrc[1])) { + if (maxSubdivision > 0) { + needsSubdivision = true; + } + else { + // It might be the case that only 1 of the points is infinite. In this case + // we can draw a single triangle with the other three points + isNotFinite = + (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ? 8 : 0) + + (!isFinite(bSrc[0]) || !isFinite(bSrc[1]) ? 4 : 0) + + (!isFinite(cSrc[0]) || !isFinite(cSrc[1]) ? 2 : 0) + + (!isFinite(dSrc[0]) || !isFinite(dSrc[1]) ? 1 : 0); + if (isNotFinite != 1 && + isNotFinite != 2 && + isNotFinite != 4 && + isNotFinite != 8) { + return; + } + } + } + } + if (maxSubdivision > 0) { + if (!needsSubdivision) { + var center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2]; + var centerSrc = this.transformInv_(center); + var dx = void 0; + if (wrapsX) { + var centerSrcEstimX = (math_modulo(aSrc[0], sourceWorldWidth) + + math_modulo(cSrc[0], sourceWorldWidth)) / + 2; + dx = centerSrcEstimX - math_modulo(centerSrc[0], sourceWorldWidth); + } + else { + dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0]; + } + var dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1]; + var centerSrcErrorSquared = dx * dx + dy * dy; + needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_; + } + if (needsSubdivision) { + if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) { + // split horizontally (top & bottom) + var bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2]; + var bcSrc = this.transformInv_(bc); + var da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2]; + var daSrc = this.transformInv_(da); + this.addQuad_(a, b, bc, da, aSrc, bSrc, bcSrc, daSrc, maxSubdivision - 1); + this.addQuad_(da, bc, c, d, daSrc, bcSrc, cSrc, dSrc, maxSubdivision - 1); + } + else { + // split vertically (left & right) + var ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]; + var abSrc = this.transformInv_(ab); + var cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2]; + var cdSrc = this.transformInv_(cd); + this.addQuad_(a, ab, cd, d, aSrc, abSrc, cdSrc, dSrc, maxSubdivision - 1); + this.addQuad_(ab, b, c, cd, abSrc, bSrc, cSrc, cdSrc, maxSubdivision - 1); + } + return; + } + } + if (wrapsX) { + if (!this.canWrapXInSource_) { + return; + } + this.wrapsXInSource_ = true; + } + // Exactly zero or one of *Src is not finite + // The triangles must have the diagonal line as the first side + // This is to allow easy code in reproj.s to make it straight for broken + // browsers that can't handle diagonal clipping + if ((isNotFinite & 0xb) == 0) { + this.addTriangle_(a, c, d, aSrc, cSrc, dSrc); + } + if ((isNotFinite & 0xe) == 0) { + this.addTriangle_(a, c, b, aSrc, cSrc, bSrc); + } + if (isNotFinite) { + // Try the other two triangles + if ((isNotFinite & 0xd) == 0) { + this.addTriangle_(b, d, a, bSrc, dSrc, aSrc); + } + if ((isNotFinite & 0x7) == 0) { + this.addTriangle_(b, d, c, bSrc, dSrc, cSrc); + } + } + }; + /** + * Calculates extent of the `source` coordinates from all the triangles. + * + * @return {import("../extent.js").Extent} Calculated extent. + */ + Triangulation.prototype.calculateSourceExtent = function () { + var extent = createEmpty(); + this.triangles_.forEach(function (triangle, i, arr) { + var src = triangle.source; + extendCoordinate(extent, src[0]); + extendCoordinate(extent, src[1]); + extendCoordinate(extent, src[2]); + }); + return extent; + }; + /** + * @return {Array} Array of the calculated triangles. + */ + Triangulation.prototype.getTriangles = function () { + return this.triangles_; + }; + return Triangulation; +}()); +/* harmony default export */ var reproj_Triangulation = (Triangulation); +//# sourceMappingURL=Triangulation.js.map +;// CONCATENATED MODULE: ./node_modules/ol/renderer/canvas/common.js +/** + * @module ol/renderer/canvas/common + */ +/** + * Context options to disable image smoothing. + * @type {Object} + */ +var IMAGE_SMOOTHING_DISABLED = { + imageSmoothingEnabled: false, + msImageSmoothingEnabled: false, +}; +/** + * Context options to enable image smoothing. + * @type {Object} + */ +var IMAGE_SMOOTHING_ENABLED = { + imageSmoothingEnabled: true, + msImageSmoothingEnabled: true, +}; +//# sourceMappingURL=common.js.map +;// CONCATENATED MODULE: ./node_modules/ol/reproj.js +/** + * @module ol/reproj + */ + + + + + + +var brokenDiagonalRendering_; +/** + * @type {Array} + */ +var reproj_canvasPool = []; +/** + * This draws a small triangle into a canvas by setting the triangle as the clip region + * and then drawing a (too large) rectangle + * + * @param {CanvasRenderingContext2D} ctx The context in which to draw the triangle + * @param {number} u1 The x-coordinate of the second point. The first point is 0,0. + * @param {number} v1 The y-coordinate of the second point. + * @param {number} u2 The x-coordinate of the third point. + * @param {number} v2 The y-coordinate of the third point. + */ +function drawTestTriangle(ctx, u1, v1, u2, v2) { + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(u1, v1); + ctx.lineTo(u2, v2); + ctx.closePath(); + ctx.save(); + ctx.clip(); + ctx.fillRect(0, 0, Math.max(u1, u2) + 1, Math.max(v1, v2)); + ctx.restore(); +} +/** + * Given the data from getImageData, see if the right values appear at the provided offset. + * Returns true if either the color or transparency is off + * + * @param {Uint8ClampedArray} data The data returned from getImageData + * @param {number} offset The pixel offset from the start of data. + * @return {boolean} true if the diagonal rendering is broken + */ +function verifyBrokenDiagonalRendering(data, offset) { + // the values ought to be close to the rgba(210, 0, 0, 0.75) + return (Math.abs(data[offset * 4] - 210) > 2 || + Math.abs(data[offset * 4 + 3] - 0.75 * 255) > 2); +} +/** + * Determines if the current browser configuration can render triangular clip regions correctly. + * This value is cached so the function is only expensive the first time called. + * Firefox on Windows (as of now) does not if HWA is enabled. See https://bugzilla.mozilla.org/show_bug.cgi?id=1606976 + * IE also doesn't. Chrome works, and everything seems to work on OSX and Android. This function caches the + * result. I suppose that it is conceivably possible that a browser might flip modes while the app is + * running, but lets hope not. + * + * @return {boolean} true if the Diagonal Rendering is broken. + */ +function isBrokenDiagonalRendering() { + if (brokenDiagonalRendering_ === undefined) { + var ctx = document.createElement('canvas').getContext('2d'); + ctx.globalCompositeOperation = 'lighter'; + ctx.fillStyle = 'rgba(210, 0, 0, 0.75)'; + drawTestTriangle(ctx, 4, 5, 4, 0); + drawTestTriangle(ctx, 4, 5, 0, 5); + var data = ctx.getImageData(0, 0, 3, 3).data; + brokenDiagonalRendering_ = + verifyBrokenDiagonalRendering(data, 0) || + verifyBrokenDiagonalRendering(data, 4) || + verifyBrokenDiagonalRendering(data, 8); + } + return brokenDiagonalRendering_; +} +/** + * Calculates ideal resolution to use from the source in order to achieve + * pixel mapping as close as possible to 1:1 during reprojection. + * The resolution is calculated regardless of what resolutions + * are actually available in the dataset (TileGrid, Image, ...). + * + * @param {import("./proj/Projection.js").default} sourceProj Source projection. + * @param {import("./proj/Projection.js").default} targetProj Target projection. + * @param {import("./coordinate.js").Coordinate} targetCenter Target center. + * @param {number} targetResolution Target resolution. + * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. + */ +function calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution) { + var sourceCenter = transform(targetCenter, targetProj, sourceProj); + // calculate the ideal resolution of the source data + var sourceResolution = getPointResolution(targetProj, targetResolution, targetCenter); + var targetMetersPerUnit = targetProj.getMetersPerUnit(); + if (targetMetersPerUnit !== undefined) { + sourceResolution *= targetMetersPerUnit; + } + var sourceMetersPerUnit = sourceProj.getMetersPerUnit(); + if (sourceMetersPerUnit !== undefined) { + sourceResolution /= sourceMetersPerUnit; + } + // Based on the projection properties, the point resolution at the specified + // coordinates may be slightly different. We need to reverse-compensate this + // in order to achieve optimal results. + var sourceExtent = sourceProj.getExtent(); + if (!sourceExtent || containsCoordinate(sourceExtent, sourceCenter)) { + var compensationFactor = getPointResolution(sourceProj, sourceResolution, sourceCenter) / + sourceResolution; + if (isFinite(compensationFactor) && compensationFactor > 0) { + sourceResolution /= compensationFactor; + } + } + return sourceResolution; +} +/** + * Calculates ideal resolution to use from the source in order to achieve + * pixel mapping as close as possible to 1:1 during reprojection. + * The resolution is calculated regardless of what resolutions + * are actually available in the dataset (TileGrid, Image, ...). + * + * @param {import("./proj/Projection.js").default} sourceProj Source projection. + * @param {import("./proj/Projection.js").default} targetProj Target projection. + * @param {import("./extent.js").Extent} targetExtent Target extent + * @param {number} targetResolution Target resolution. + * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. + */ +function calculateSourceExtentResolution(sourceProj, targetProj, targetExtent, targetResolution) { + var targetCenter = getCenter(targetExtent); + var sourceResolution = calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution); + if (!isFinite(sourceResolution) || sourceResolution <= 0) { + forEachCorner(targetExtent, function (corner) { + sourceResolution = calculateSourceResolution(sourceProj, targetProj, corner, targetResolution); + return isFinite(sourceResolution) && sourceResolution > 0; + }); + } + return sourceResolution; +} +/** + * @typedef {Object} ImageExtent + * @property {import("./extent.js").Extent} extent Extent. + * @property {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. + */ +/** + * Renders the source data into new canvas based on the triangulation. + * + * @param {number} width Width of the canvas. + * @param {number} height Height of the canvas. + * @param {number} pixelRatio Pixel ratio. + * @param {number} sourceResolution Source resolution. + * @param {import("./extent.js").Extent} sourceExtent Extent of the data source. + * @param {number} targetResolution Target resolution. + * @param {import("./extent.js").Extent} targetExtent Target extent. + * @param {import("./reproj/Triangulation.js").default} triangulation Calculated triangulation. + * @param {Array} sources Array of sources. + * @param {number} gutter Gutter of the sources. + * @param {boolean} [opt_renderEdges] Render reprojection edges. + * @param {boolean} [opt_interpolate] Use linear interpolation when resampling. + * @return {HTMLCanvasElement} Canvas with reprojected data. + */ +function render(width, height, pixelRatio, sourceResolution, sourceExtent, targetResolution, targetExtent, triangulation, sources, gutter, opt_renderEdges, opt_interpolate) { + var context = createCanvasContext2D(Math.round(pixelRatio * width), Math.round(pixelRatio * height), reproj_canvasPool); + if (!opt_interpolate) { + obj_assign(context, IMAGE_SMOOTHING_DISABLED); + } + if (sources.length === 0) { + return context.canvas; + } + context.scale(pixelRatio, pixelRatio); + function pixelRound(value) { + return Math.round(value * pixelRatio) / pixelRatio; + } + context.globalCompositeOperation = 'lighter'; + var sourceDataExtent = createEmpty(); + sources.forEach(function (src, i, arr) { + extent_extend(sourceDataExtent, src.extent); + }); + var canvasWidthInUnits = extent_getWidth(sourceDataExtent); + var canvasHeightInUnits = getHeight(sourceDataExtent); + var stitchContext = createCanvasContext2D(Math.round((pixelRatio * canvasWidthInUnits) / sourceResolution), Math.round((pixelRatio * canvasHeightInUnits) / sourceResolution)); + if (!opt_interpolate) { + obj_assign(stitchContext, IMAGE_SMOOTHING_DISABLED); + } + var stitchScale = pixelRatio / sourceResolution; + sources.forEach(function (src, i, arr) { + var xPos = src.extent[0] - sourceDataExtent[0]; + var yPos = -(src.extent[3] - sourceDataExtent[3]); + var srcWidth = extent_getWidth(src.extent); + var srcHeight = getHeight(src.extent); + // This test should never fail -- but it does. Need to find a fix the upstream condition + if (src.image.width > 0 && src.image.height > 0) { + stitchContext.drawImage(src.image, gutter, gutter, src.image.width - 2 * gutter, src.image.height - 2 * gutter, xPos * stitchScale, yPos * stitchScale, srcWidth * stitchScale, srcHeight * stitchScale); + } + }); + var targetTopLeft = getTopLeft(targetExtent); + triangulation.getTriangles().forEach(function (triangle, i, arr) { + /* Calculate affine transform (src -> dst) + * Resulting matrix can be used to transform coordinate + * from `sourceProjection` to destination pixels. + * + * To optimize number of context calls and increase numerical stability, + * we also do the following operations: + * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1) + * here before solving the linear system so [ui, vi] are pixel coordinates. + * + * Src points: xi, yi + * Dst points: ui, vi + * Affine coefficients: aij + * + * | x0 y0 1 0 0 0 | |a00| |u0| + * | x1 y1 1 0 0 0 | |a01| |u1| + * | x2 y2 1 0 0 0 | x |a02| = |u2| + * | 0 0 0 x0 y0 1 | |a10| |v0| + * | 0 0 0 x1 y1 1 | |a11| |v1| + * | 0 0 0 x2 y2 1 | |a12| |v2| + */ + var source = triangle.source; + var target = triangle.target; + var x0 = source[0][0], y0 = source[0][1]; + var x1 = source[1][0], y1 = source[1][1]; + var x2 = source[2][0], y2 = source[2][1]; + // Make sure that everything is on pixel boundaries + var u0 = pixelRound((target[0][0] - targetTopLeft[0]) / targetResolution); + var v0 = pixelRound(-(target[0][1] - targetTopLeft[1]) / targetResolution); + var u1 = pixelRound((target[1][0] - targetTopLeft[0]) / targetResolution); + var v1 = pixelRound(-(target[1][1] - targetTopLeft[1]) / targetResolution); + var u2 = pixelRound((target[2][0] - targetTopLeft[0]) / targetResolution); + var v2 = pixelRound(-(target[2][1] - targetTopLeft[1]) / targetResolution); + // Shift all the source points to improve numerical stability + // of all the subsequent calculations. The [x0, y0] is used here. + // This is also used to simplify the linear system. + var sourceNumericalShiftX = x0; + var sourceNumericalShiftY = y0; + x0 = 0; + y0 = 0; + x1 -= sourceNumericalShiftX; + y1 -= sourceNumericalShiftY; + x2 -= sourceNumericalShiftX; + y2 -= sourceNumericalShiftY; + var augmentedMatrix = [ + [x1, y1, 0, 0, u1 - u0], + [x2, y2, 0, 0, u2 - u0], + [0, 0, x1, y1, v1 - v0], + [0, 0, x2, y2, v2 - v0], + ]; + var affineCoefs = solveLinearSystem(augmentedMatrix); + if (!affineCoefs) { + return; + } + context.save(); + context.beginPath(); + if (isBrokenDiagonalRendering() || !opt_interpolate) { + // Make sure that all lines are horizontal or vertical + context.moveTo(u1, v1); + // This is the diagonal line. Do it in 4 steps + var steps = 4; + var ud = u0 - u1; + var vd = v0 - v1; + for (var step = 0; step < steps; step++) { + // Go horizontally + context.lineTo(u1 + pixelRound(((step + 1) * ud) / steps), v1 + pixelRound((step * vd) / (steps - 1))); + // Go vertically + if (step != steps - 1) { + context.lineTo(u1 + pixelRound(((step + 1) * ud) / steps), v1 + pixelRound(((step + 1) * vd) / (steps - 1))); + } + } + // We are almost at u0r, v0r + context.lineTo(u2, v2); + } + else { + context.moveTo(u1, v1); + context.lineTo(u0, v0); + context.lineTo(u2, v2); + } + context.clip(); + context.transform(affineCoefs[0], affineCoefs[2], affineCoefs[1], affineCoefs[3], u0, v0); + context.translate(sourceDataExtent[0] - sourceNumericalShiftX, sourceDataExtent[3] - sourceNumericalShiftY); + context.scale(sourceResolution / pixelRatio, -sourceResolution / pixelRatio); + context.drawImage(stitchContext.canvas, 0, 0); + context.restore(); + }); + if (opt_renderEdges) { + context.save(); + context.globalCompositeOperation = 'source-over'; + context.strokeStyle = 'black'; + context.lineWidth = 1; + triangulation.getTriangles().forEach(function (triangle, i, arr) { + var target = triangle.target; + var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution; + var v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution; + var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution; + var v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution; + var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution; + var v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution; + context.beginPath(); + context.moveTo(u1, v1); + context.lineTo(u0, v0); + context.lineTo(u2, v2); + context.closePath(); + context.stroke(); + }); + context.restore(); + } + return context.canvas; +} +//# sourceMappingURL=reproj.js.map +;// CONCATENATED MODULE: ./node_modules/ol/reproj/Tile.js +var reproj_Tile_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/reproj/Tile + */ + + + + + + + + + + +/** + * @typedef {function(number, number, number, number) : import("../Tile.js").default} FunctionType + */ +/** + * @classdesc + * Class encapsulating single reprojected tile. + * See {@link module:ol/source/TileImage~TileImage}. + * + */ +var ReprojTile = /** @class */ (function (_super) { + reproj_Tile_extends(ReprojTile, _super); + /** + * @param {import("../proj/Projection.js").default} sourceProj Source projection. + * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid. + * @param {import("../proj/Projection.js").default} targetProj Target projection. + * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid. + * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile. + * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X. + * @param {number} pixelRatio Pixel ratio. + * @param {number} gutter Gutter of the source tiles. + * @param {FunctionType} getTileFunction + * Function returning source tiles (z, x, y, pixelRatio). + * @param {number} [opt_errorThreshold] Acceptable reprojection error (in px). + * @param {boolean} [opt_renderEdges] Render reprojection edges. + * @param {boolean} [opt_interpolate] Use linear interpolation when resampling. + */ + function ReprojTile(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges, opt_interpolate) { + var _this = _super.call(this, tileCoord, TileState.IDLE, { interpolate: !!opt_interpolate }) || this; + /** + * @private + * @type {boolean} + */ + _this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false; + /** + * @private + * @type {number} + */ + _this.pixelRatio_ = pixelRatio; + /** + * @private + * @type {number} + */ + _this.gutter_ = gutter; + /** + * @private + * @type {HTMLCanvasElement} + */ + _this.canvas_ = null; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + _this.sourceTileGrid_ = sourceTileGrid; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + _this.targetTileGrid_ = targetTileGrid; + /** + * @private + * @type {import("../tilecoord.js").TileCoord} + */ + _this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord; + /** + * @private + * @type {!Array} + */ + _this.sourceTiles_ = []; + /** + * @private + * @type {?Array} + */ + _this.sourcesListenerKeys_ = null; + /** + * @private + * @type {number} + */ + _this.sourceZ_ = 0; + var targetExtent = targetTileGrid.getTileCoordExtent(_this.wrappedTileCoord_); + var maxTargetExtent = _this.targetTileGrid_.getExtent(); + var maxSourceExtent = _this.sourceTileGrid_.getExtent(); + var limitedTargetExtent = maxTargetExtent + ? getIntersection(targetExtent, maxTargetExtent) + : targetExtent; + if (getArea(limitedTargetExtent) === 0) { + // Tile is completely outside range -> EMPTY + // TODO: is it actually correct that the source even creates the tile ? + _this.state = TileState.EMPTY; + return _this; + } + var sourceProjExtent = sourceProj.getExtent(); + if (sourceProjExtent) { + if (!maxSourceExtent) { + maxSourceExtent = sourceProjExtent; + } + else { + maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent); + } + } + var targetResolution = targetTileGrid.getResolution(_this.wrappedTileCoord_[0]); + var sourceResolution = calculateSourceExtentResolution(sourceProj, targetProj, limitedTargetExtent, targetResolution); + if (!isFinite(sourceResolution) || sourceResolution <= 0) { + // invalid sourceResolution -> EMPTY + // probably edges of the projections when no extent is defined + _this.state = TileState.EMPTY; + return _this; + } + var errorThresholdInPixels = opt_errorThreshold !== undefined ? opt_errorThreshold : ERROR_THRESHOLD; + /** + * @private + * @type {!import("./Triangulation.js").default} + */ + _this.triangulation_ = new reproj_Triangulation(sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels, targetResolution); + if (_this.triangulation_.getTriangles().length === 0) { + // no valid triangles -> EMPTY + _this.state = TileState.EMPTY; + return _this; + } + _this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution); + var sourceExtent = _this.triangulation_.calculateSourceExtent(); + if (maxSourceExtent) { + if (sourceProj.canWrapX()) { + sourceExtent[1] = math_clamp(sourceExtent[1], maxSourceExtent[1], maxSourceExtent[3]); + sourceExtent[3] = math_clamp(sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]); + } + else { + sourceExtent = getIntersection(sourceExtent, maxSourceExtent); + } + } + if (!getArea(sourceExtent)) { + _this.state = TileState.EMPTY; + } + else { + var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(sourceExtent, _this.sourceZ_); + for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) { + for (var srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) { + var tile = getTileFunction(_this.sourceZ_, srcX, srcY, pixelRatio); + if (tile) { + _this.sourceTiles_.push(tile); + } + } + } + if (_this.sourceTiles_.length === 0) { + _this.state = TileState.EMPTY; + } + } + return _this; + } + /** + * Get the HTML Canvas element for this tile. + * @return {HTMLCanvasElement} Canvas. + */ + ReprojTile.prototype.getImage = function () { + return this.canvas_; + }; + /** + * @private + */ + ReprojTile.prototype.reproject_ = function () { + var sources = []; + this.sourceTiles_.forEach(function (tile, i, arr) { + if (tile && tile.getState() == TileState.LOADED) { + sources.push({ + extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord), + image: tile.getImage(), + }); + } + }.bind(this)); + this.sourceTiles_.length = 0; + if (sources.length === 0) { + this.state = TileState.ERROR; + } + else { + var z = this.wrappedTileCoord_[0]; + var size = this.targetTileGrid_.getTileSize(z); + var width = typeof size === 'number' ? size : size[0]; + var height = typeof size === 'number' ? size : size[1]; + var targetResolution = this.targetTileGrid_.getResolution(z); + var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_); + var targetExtent = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_); + this.canvas_ = render(width, height, this.pixelRatio_, sourceResolution, this.sourceTileGrid_.getExtent(), targetResolution, targetExtent, this.triangulation_, sources, this.gutter_, this.renderEdges_, this.interpolate); + this.state = TileState.LOADED; + } + this.changed(); + }; + /** + * Load not yet loaded URI. + */ + ReprojTile.prototype.load = function () { + if (this.state == TileState.IDLE) { + this.state = TileState.LOADING; + this.changed(); + var leftToLoad_1 = 0; + this.sourcesListenerKeys_ = []; + this.sourceTiles_.forEach(function (tile, i, arr) { + var state = tile.getState(); + if (state == TileState.IDLE || state == TileState.LOADING) { + leftToLoad_1++; + var sourceListenKey_1 = listen(tile, EventType.CHANGE, function (e) { + var state = tile.getState(); + if (state == TileState.LOADED || + state == TileState.ERROR || + state == TileState.EMPTY) { + unlistenByKey(sourceListenKey_1); + leftToLoad_1--; + if (leftToLoad_1 === 0) { + this.unlistenSources_(); + this.reproject_(); + } + } + }, this); + this.sourcesListenerKeys_.push(sourceListenKey_1); + } + }.bind(this)); + if (leftToLoad_1 === 0) { + setTimeout(this.reproject_.bind(this), 0); + } + else { + this.sourceTiles_.forEach(function (tile, i, arr) { + var state = tile.getState(); + if (state == TileState.IDLE) { + tile.load(); + } + }); + } + } + }; + /** + * @private + */ + ReprojTile.prototype.unlistenSources_ = function () { + this.sourcesListenerKeys_.forEach(unlistenByKey); + this.sourcesListenerKeys_ = null; + }; + /** + * Remove from the cache due to expiry + */ + ReprojTile.prototype.release = function () { + if (this.canvas_) { + releaseCanvas(this.canvas_.getContext('2d')); + reproj_canvasPool.push(this.canvas_); + this.canvas_ = null; + } + _super.prototype.release.call(this); + }; + return ReprojTile; +}(ol_Tile)); +/* harmony default export */ var reproj_Tile = (ReprojTile); +//# sourceMappingURL=Tile.js.map +;// CONCATENATED MODULE: ./node_modules/ol/TileRange.js +/** + * @module ol/TileRange + */ +/** + * A representation of a contiguous block of tiles. A tile range is specified + * by its min/max tile coordinates and is inclusive of coordinates. + */ +var TileRange = /** @class */ (function () { + /** + * @param {number} minX Minimum X. + * @param {number} maxX Maximum X. + * @param {number} minY Minimum Y. + * @param {number} maxY Maximum Y. + */ + function TileRange(minX, maxX, minY, maxY) { + /** + * @type {number} + */ + this.minX = minX; + /** + * @type {number} + */ + this.maxX = maxX; + /** + * @type {number} + */ + this.minY = minY; + /** + * @type {number} + */ + this.maxY = maxY; + } + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @return {boolean} Contains tile coordinate. + */ + TileRange.prototype.contains = function (tileCoord) { + return this.containsXY(tileCoord[1], tileCoord[2]); + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Contains. + */ + TileRange.prototype.containsTileRange = function (tileRange) { + return (this.minX <= tileRange.minX && + tileRange.maxX <= this.maxX && + this.minY <= tileRange.minY && + tileRange.maxY <= this.maxY); + }; + /** + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @return {boolean} Contains coordinate. + */ + TileRange.prototype.containsXY = function (x, y) { + return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY; + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Equals. + */ + TileRange.prototype.equals = function (tileRange) { + return (this.minX == tileRange.minX && + this.minY == tileRange.minY && + this.maxX == tileRange.maxX && + this.maxY == tileRange.maxY); + }; + /** + * @param {TileRange} tileRange Tile range. + */ + TileRange.prototype.extend = function (tileRange) { + if (tileRange.minX < this.minX) { + this.minX = tileRange.minX; + } + if (tileRange.maxX > this.maxX) { + this.maxX = tileRange.maxX; + } + if (tileRange.minY < this.minY) { + this.minY = tileRange.minY; + } + if (tileRange.maxY > this.maxY) { + this.maxY = tileRange.maxY; + } + }; + /** + * @return {number} Height. + */ + TileRange.prototype.getHeight = function () { + return this.maxY - this.minY + 1; + }; + /** + * @return {import("./size.js").Size} Size. + */ + TileRange.prototype.getSize = function () { + return [this.getWidth(), this.getHeight()]; + }; + /** + * @return {number} Width. + */ + TileRange.prototype.getWidth = function () { + return this.maxX - this.minX + 1; + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Intersects. + */ + TileRange.prototype.intersects = function (tileRange) { + return (this.minX <= tileRange.maxX && + this.maxX >= tileRange.minX && + this.minY <= tileRange.maxY && + this.maxY >= tileRange.minY); + }; + return TileRange; +}()); +/** + * @param {number} minX Minimum X. + * @param {number} maxX Maximum X. + * @param {number} minY Minimum Y. + * @param {number} maxY Maximum Y. + * @param {TileRange} [tileRange] TileRange. + * @return {TileRange} Tile range. + */ +function TileRange_createOrUpdate(minX, maxX, minY, maxY, tileRange) { + if (tileRange !== undefined) { + tileRange.minX = minX; + tileRange.maxX = maxX; + tileRange.minY = minY; + tileRange.maxY = maxY; + return tileRange; + } + else { + return new TileRange(minX, maxX, minY, maxY); + } +} +/* harmony default export */ var ol_TileRange = (TileRange); +//# sourceMappingURL=TileRange.js.map +;// CONCATENATED MODULE: ./node_modules/ol/size.js +/** + * @module ol/size + */ +/** + * An array of numbers representing a size: `[width, height]`. + * @typedef {Array} Size + * @api + */ +/** + * Returns a buffered size. + * @param {Size} size Size. + * @param {number} num The amount by which to buffer. + * @param {Size} [opt_size] Optional reusable size array. + * @return {Size} The buffered size. + */ +function size_buffer(size, num, opt_size) { + if (opt_size === undefined) { + opt_size = [0, 0]; + } + opt_size[0] = size[0] + 2 * num; + opt_size[1] = size[1] + 2 * num; + return opt_size; +} +/** + * Determines if a size has a positive area. + * @param {Size} size The size to test. + * @return {boolean} The size has a positive area. + */ +function hasArea(size) { + return size[0] > 0 && size[1] > 0; +} +/** + * Returns a size scaled by a ratio. The result will be an array of integers. + * @param {Size} size Size. + * @param {number} ratio Ratio. + * @param {Size} [opt_size] Optional reusable size array. + * @return {Size} The scaled size. + */ +function size_scale(size, ratio, opt_size) { + if (opt_size === undefined) { + opt_size = [0, 0]; + } + opt_size[0] = (size[0] * ratio + 0.5) | 0; + opt_size[1] = (size[1] * ratio + 0.5) | 0; + return opt_size; +} +/** + * Returns an `Size` array for the passed in number (meaning: square) or + * `Size` array. + * (meaning: non-square), + * @param {number|Size} size Width and height. + * @param {Size} [opt_size] Optional reusable size array. + * @return {Size} Size. + * @api + */ +function toSize(size, opt_size) { + if (Array.isArray(size)) { + return size; + } + else { + if (opt_size === undefined) { + opt_size = [size, size]; + } + else { + opt_size[0] = size; + opt_size[1] = size; + } + return opt_size; + } +} +//# sourceMappingURL=size.js.map +;// CONCATENATED MODULE: ./node_modules/ol/renderer/canvas/TileLayer.js +var TileLayer_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/renderer/canvas/TileLayer + */ + + + + + + + + + + + + + +/** + * @classdesc + * Canvas renderer for tile layers. + * @api + * @template {import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default} [LayerType=import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default] + * @extends {CanvasLayerRenderer} + */ +var CanvasTileLayerRenderer = /** @class */ (function (_super) { + TileLayer_extends(CanvasTileLayerRenderer, _super); + /** + * @param {LayerType} tileLayer Tile layer. + */ + function CanvasTileLayerRenderer(tileLayer) { + var _this = _super.call(this, tileLayer) || this; + /** + * Rendered extent has changed since the previous `renderFrame()` call + * @type {boolean} + */ + _this.extentChanged = true; + /** + * @private + * @type {?import("../../extent.js").Extent} + */ + _this.renderedExtent_ = null; + /** + * @protected + * @type {number} + */ + _this.renderedPixelRatio; + /** + * @protected + * @type {import("../../proj/Projection.js").default} + */ + _this.renderedProjection = null; + /** + * @protected + * @type {number} + */ + _this.renderedRevision; + /** + * @protected + * @type {!Array} + */ + _this.renderedTiles = []; + /** + * @private + * @type {boolean} + */ + _this.newTiles_ = false; + /** + * @protected + * @type {import("../../extent.js").Extent} + */ + _this.tmpExtent = createEmpty(); + /** + * @private + * @type {import("../../TileRange.js").default} + */ + _this.tmpTileRange_ = new ol_TileRange(0, 0, 0, 0); + return _this; + } + /** + * @protected + * @param {import("../../Tile.js").default} tile Tile. + * @return {boolean} Tile is drawable. + */ + CanvasTileLayerRenderer.prototype.isDrawableTile = function (tile) { + var tileLayer = this.getLayer(); + var tileState = tile.getState(); + var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError(); + return (tileState == TileState.LOADED || + tileState == TileState.EMPTY || + (tileState == TileState.ERROR && !useInterimTilesOnError)); + }; + /** + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {!import("../../Tile.js").default} Tile. + */ + CanvasTileLayerRenderer.prototype.getTile = function (z, x, y, frameState) { + var pixelRatio = frameState.pixelRatio; + var projection = frameState.viewState.projection; + var tileLayer = this.getLayer(); + var tileSource = tileLayer.getSource(); + var tile = tileSource.getTile(z, x, y, pixelRatio, projection); + if (tile.getState() == TileState.ERROR) { + if (!tileLayer.getUseInterimTilesOnError()) { + // When useInterimTilesOnError is false, we consider the error tile as loaded. + tile.setState(TileState.LOADED); + } + else if (tileLayer.getPreload() > 0) { + // Preloaded tiles for lower resolutions might have finished loading. + this.newTiles_ = true; + } + } + if (!this.isDrawableTile(tile)) { + tile = tile.getInterimTile(); + } + return tile; + }; + /** + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @return {Uint8ClampedArray} Data at the pixel location. + */ + CanvasTileLayerRenderer.prototype.getData = function (pixel) { + var frameState = this.frameState; + if (!frameState) { + return null; + } + var layer = this.getLayer(); + var coordinate = apply(frameState.pixelToCoordinateTransform, pixel.slice()); + var layerExtent = layer.getExtent(); + if (layerExtent) { + if (!containsCoordinate(layerExtent, coordinate)) { + return null; + } + } + var pixelRatio = frameState.pixelRatio; + var projection = frameState.viewState.projection; + var viewState = frameState.viewState; + var source = layer.getRenderSource(); + var tileGrid = source.getTileGridForProjection(viewState.projection); + var tilePixelRatio = source.getTilePixelRatio(frameState.pixelRatio); + for (var z = tileGrid.getZForResolution(viewState.resolution); z >= tileGrid.getMinZoom(); --z) { + var tileCoord = tileGrid.getTileCoordForCoordAndZ(coordinate, z); + var tile = source.getTile(z, tileCoord[1], tileCoord[2], pixelRatio, projection); + if (!(tile instanceof ol_ImageTile || tile instanceof reproj_Tile)) { + return null; + } + if (tile.getState() !== TileState.LOADED) { + continue; + } + var tileOrigin = tileGrid.getOrigin(z); + var tileSize = toSize(tileGrid.getTileSize(z)); + var tileResolution = tileGrid.getResolution(z); + var col = Math.floor(tilePixelRatio * + ((coordinate[0] - tileOrigin[0]) / tileResolution - + tileCoord[1] * tileSize[0])); + var row = Math.floor(tilePixelRatio * + ((tileOrigin[1] - coordinate[1]) / tileResolution - + tileCoord[2] * tileSize[1])); + var gutter = Math.round(tilePixelRatio * source.getGutterForProjection(viewState.projection)); + return this.getImageData(tile.getImage(), col + gutter, row + gutter); + } + return null; + }; + /** + * @param {Object>} tiles Lookup of loaded tiles by zoom level. + * @param {number} zoom Zoom level. + * @param {import("../../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. + */ + CanvasTileLayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) { + if (this.isDrawableTile(tile)) { + return _super.prototype.loadedTileCallback.call(this, tiles, zoom, tile); + } + return false; + }; + /** + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. + */ + CanvasTileLayerRenderer.prototype.prepareFrame = function (frameState) { + return !!this.getLayer().getSource(); + }; + /** + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. + */ + CanvasTileLayerRenderer.prototype.renderFrame = function (frameState, target) { + var layerState = frameState.layerStatesArray[frameState.layerIndex]; + var viewState = frameState.viewState; + var projection = viewState.projection; + var viewResolution = viewState.resolution; + var viewCenter = viewState.center; + var rotation = viewState.rotation; + var pixelRatio = frameState.pixelRatio; + var tileLayer = this.getLayer(); + var tileSource = tileLayer.getSource(); + var sourceRevision = tileSource.getRevision(); + var tileGrid = tileSource.getTileGridForProjection(projection); + var z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection); + var tileResolution = tileGrid.getResolution(z); + var extent = frameState.extent; + var resolution = frameState.viewState.resolution; + var tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio); + // desired dimensions of the canvas in pixels + var width = Math.round((extent_getWidth(extent) / resolution) * pixelRatio); + var height = Math.round((getHeight(extent) / resolution) * pixelRatio); + var layerExtent = layerState.extent && proj_fromUserExtent(layerState.extent, projection); + if (layerExtent) { + extent = getIntersection(extent, proj_fromUserExtent(layerState.extent, projection)); + } + var dx = (tileResolution * width) / 2 / tilePixelRatio; + var dy = (tileResolution * height) / 2 / tilePixelRatio; + var canvasExtent = [ + viewCenter[0] - dx, + viewCenter[1] - dy, + viewCenter[0] + dx, + viewCenter[1] + dy, + ]; + var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); + /** + * @type {Object>} + */ + var tilesToDrawByZ = {}; + tilesToDrawByZ[z] = {}; + var findLoadedTiles = this.createLoadedTileFinder(tileSource, projection, tilesToDrawByZ); + var tmpExtent = this.tmpExtent; + var tmpTileRange = this.tmpTileRange_; + this.newTiles_ = false; + var viewport = rotation + ? getRotatedViewport(viewState.center, resolution, rotation, frameState.size) + : undefined; + for (var x = tileRange.minX; x <= tileRange.maxX; ++x) { + for (var y = tileRange.minY; y <= tileRange.maxY; ++y) { + if (rotation && + !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)) { + continue; + } + var tile = this.getTile(z, x, y, frameState); + if (this.isDrawableTile(tile)) { + var uid = getUid(this); + if (tile.getState() == TileState.LOADED) { + tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; + var inTransition = tile.inTransition(uid); + if (inTransition && layerState.opacity !== 1) { + // Skipping transition when layer is not fully opaque avoids visual artifacts. + tile.endTransition(uid); + inTransition = false; + } + if (!this.newTiles_ && + (inTransition || this.renderedTiles.indexOf(tile) === -1)) { + this.newTiles_ = true; + } + } + if (tile.getAlpha(uid, frameState.time) === 1) { + // don't look for alt tiles if alpha is 1 + continue; + } + } + var childTileRange = tileGrid.getTileCoordChildTileRange(tile.tileCoord, tmpTileRange, tmpExtent); + var covered = false; + if (childTileRange) { + covered = findLoadedTiles(z + 1, childTileRange); + } + if (!covered) { + tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, tmpTileRange, tmpExtent); + } + } + } + var canvasScale = ((tileResolution / viewResolution) * pixelRatio) / tilePixelRatio; + // set forward and inverse pixel transforms + compose(this.pixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / pixelRatio, 1 / pixelRatio, rotation, -width / 2, -height / 2); + var canvasTransform = transform_toString(this.pixelTransform); + this.useContainer(target, canvasTransform, this.getBackground(frameState)); + var context = this.context; + var canvas = context.canvas; + makeInverse(this.inversePixelTransform, this.pixelTransform); + // set scale transform for calculating tile positions on the canvas + compose(this.tempTransform, width / 2, height / 2, canvasScale, canvasScale, 0, -width / 2, -height / 2); + if (canvas.width != width || canvas.height != height) { + canvas.width = width; + canvas.height = height; + } + else if (!this.containerReused) { + context.clearRect(0, 0, width, height); + } + if (layerExtent) { + this.clipUnrotated(context, frameState, layerExtent); + } + if (!tileSource.getInterpolate()) { + obj_assign(context, IMAGE_SMOOTHING_DISABLED); + } + this.preRender(context, frameState); + this.renderedTiles.length = 0; + /** @type {Array} */ + var zs = Object.keys(tilesToDrawByZ).map(Number); + zs.sort(numberSafeCompareFunction); + var clips, clipZs, currentClip; + if (layerState.opacity === 1 && + (!this.containerReused || + tileSource.getOpaque(frameState.viewState.projection))) { + zs = zs.reverse(); + } + else { + clips = []; + clipZs = []; + } + for (var i = zs.length - 1; i >= 0; --i) { + var currentZ = zs[i]; + var currentTilePixelSize = tileSource.getTilePixelSize(currentZ, pixelRatio, projection); + var currentResolution = tileGrid.getResolution(currentZ); + var currentScale = currentResolution / tileResolution; + var dx_1 = currentTilePixelSize[0] * currentScale * canvasScale; + var dy_1 = currentTilePixelSize[1] * currentScale * canvasScale; + var originTileCoord = tileGrid.getTileCoordForCoordAndZ(getTopLeft(canvasExtent), currentZ); + var originTileExtent = tileGrid.getTileCoordExtent(originTileCoord); + var origin_1 = apply(this.tempTransform, [ + (tilePixelRatio * (originTileExtent[0] - canvasExtent[0])) / + tileResolution, + (tilePixelRatio * (canvasExtent[3] - originTileExtent[3])) / + tileResolution, + ]); + var tileGutter = tilePixelRatio * tileSource.getGutterForProjection(projection); + var tilesToDraw = tilesToDrawByZ[currentZ]; + for (var tileCoordKey in tilesToDraw) { + var tile = /** @type {import("../../ImageTile.js").default} */ (tilesToDraw[tileCoordKey]); + var tileCoord = tile.tileCoord; + // Calculate integer positions and sizes so that tiles align + var xIndex = originTileCoord[1] - tileCoord[1]; + var nextX = Math.round(origin_1[0] - (xIndex - 1) * dx_1); + var yIndex = originTileCoord[2] - tileCoord[2]; + var nextY = Math.round(origin_1[1] - (yIndex - 1) * dy_1); + var x = Math.round(origin_1[0] - xIndex * dx_1); + var y = Math.round(origin_1[1] - yIndex * dy_1); + var w = nextX - x; + var h = nextY - y; + var transition = z === currentZ; + var inTransition = transition && tile.getAlpha(getUid(this), frameState.time) !== 1; + var contextSaved = false; + if (!inTransition) { + if (clips) { + // Clip mask for regions in this tile that already filled by a higher z tile + currentClip = [x, y, x + w, y, x + w, y + h, x, y + h]; + for (var i_1 = 0, ii = clips.length; i_1 < ii; ++i_1) { + if (z !== currentZ && currentZ < clipZs[i_1]) { + var clip = clips[i_1]; + if (intersects([x, y, x + w, y + h], [clip[0], clip[3], clip[4], clip[7]])) { + if (!contextSaved) { + context.save(); + contextSaved = true; + } + context.beginPath(); + // counter-clockwise (outer ring) for current tile + context.moveTo(currentClip[0], currentClip[1]); + context.lineTo(currentClip[2], currentClip[3]); + context.lineTo(currentClip[4], currentClip[5]); + context.lineTo(currentClip[6], currentClip[7]); + // clockwise (inner ring) for higher z tile + context.moveTo(clip[6], clip[7]); + context.lineTo(clip[4], clip[5]); + context.lineTo(clip[2], clip[3]); + context.lineTo(clip[0], clip[1]); + context.clip(); + } + } + } + clips.push(currentClip); + clipZs.push(currentZ); + } + else { + context.clearRect(x, y, w, h); + } + } + this.drawTileImage(tile, frameState, x, y, w, h, tileGutter, transition); + if (clips && !inTransition) { + if (contextSaved) { + context.restore(); + } + this.renderedTiles.unshift(tile); + } + else { + this.renderedTiles.push(tile); + } + this.updateUsedTiles(frameState.usedTiles, tileSource, tile); + } + } + this.renderedRevision = sourceRevision; + this.renderedResolution = tileResolution; + this.extentChanged = + !this.renderedExtent_ || !extent_equals(this.renderedExtent_, canvasExtent); + this.renderedExtent_ = canvasExtent; + this.renderedPixelRatio = pixelRatio; + this.renderedProjection = projection; + this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, projection, extent, z, tileLayer.getPreload()); + this.scheduleExpireCache(frameState, tileSource); + this.postRender(context, frameState); + if (layerState.extent) { + context.restore(); + } + obj_assign(context, IMAGE_SMOOTHING_ENABLED); + if (canvasTransform !== canvas.style.transform) { + canvas.style.transform = canvasTransform; + } + return this.container; + }; + /** + * @param {import("../../ImageTile.js").default} tile Tile. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} x Left of the tile. + * @param {number} y Top of the tile. + * @param {number} w Width of the tile. + * @param {number} h Height of the tile. + * @param {number} gutter Tile gutter. + * @param {boolean} transition Apply an alpha transition. + */ + CanvasTileLayerRenderer.prototype.drawTileImage = function (tile, frameState, x, y, w, h, gutter, transition) { + var image = this.getTileImage(tile); + if (!image) { + return; + } + var uid = getUid(this); + var layerState = frameState.layerStatesArray[frameState.layerIndex]; + var alpha = layerState.opacity * + (transition ? tile.getAlpha(uid, frameState.time) : 1); + var alphaChanged = alpha !== this.context.globalAlpha; + if (alphaChanged) { + this.context.save(); + this.context.globalAlpha = alpha; + } + this.context.drawImage(image, gutter, gutter, image.width - 2 * gutter, image.height - 2 * gutter, x, y, w, h); + if (alphaChanged) { + this.context.restore(); + } + if (alpha !== layerState.opacity) { + frameState.animate = true; + } + else if (transition) { + tile.endTransition(uid); + } + }; + /** + * @return {HTMLCanvasElement} Image + */ + CanvasTileLayerRenderer.prototype.getImage = function () { + var context = this.context; + return context ? context.canvas : null; + }; + /** + * Get the image from a tile. + * @param {import("../../ImageTile.js").default} tile Tile. + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @protected + */ + CanvasTileLayerRenderer.prototype.getTileImage = function (tile) { + return tile.getImage(); + }; + /** + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @protected + */ + CanvasTileLayerRenderer.prototype.scheduleExpireCache = function (frameState, tileSource) { + if (tileSource.canExpireCache()) { + /** + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import("../../PluggableMap.js").default} map Map. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + */ + var postRenderFunction = function (tileSource, map, frameState) { + var tileSourceKey = getUid(tileSource); + if (tileSourceKey in frameState.usedTiles) { + tileSource.expireCache(frameState.viewState.projection, frameState.usedTiles[tileSourceKey]); + } + }.bind(null, tileSource); + frameState.postRenderFunctions.push( + /** @type {import("../../PluggableMap.js").PostRenderFunction} */ (postRenderFunction)); + } + }; + /** + * @param {!Object>} usedTiles Used tiles. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import('../../Tile.js').default} tile Tile. + * @protected + */ + CanvasTileLayerRenderer.prototype.updateUsedTiles = function (usedTiles, tileSource, tile) { + // FIXME should we use tilesToDrawByZ instead? + var tileSourceKey = getUid(tileSource); + if (!(tileSourceKey in usedTiles)) { + usedTiles[tileSourceKey] = {}; + } + usedTiles[tileSourceKey][tile.getKey()] = true; + }; + /** + * Manage tile pyramid. + * This function performs a number of functions related to the tiles at the + * current zoom and lower zoom levels: + * - registers idle tiles in frameState.wantedTiles so that they are not + * discarded by the tile queue + * - enqueues missing tiles + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import("../../tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../../proj/Projection.js").default} projection Projection. + * @param {import("../../extent.js").Extent} extent Extent. + * @param {number} currentZ Current Z. + * @param {number} preload Load low resolution tiles up to `preload` levels. + * @param {function(import("../../Tile.js").default):void} [opt_tileCallback] Tile callback. + * @protected + */ + CanvasTileLayerRenderer.prototype.manageTilePyramid = function (frameState, tileSource, tileGrid, pixelRatio, projection, extent, currentZ, preload, opt_tileCallback) { + var tileSourceKey = getUid(tileSource); + if (!(tileSourceKey in frameState.wantedTiles)) { + frameState.wantedTiles[tileSourceKey] = {}; + } + var wantedTiles = frameState.wantedTiles[tileSourceKey]; + var tileQueue = frameState.tileQueue; + var minZoom = tileGrid.getMinZoom(); + var rotation = frameState.viewState.rotation; + var viewport = rotation + ? getRotatedViewport(frameState.viewState.center, frameState.viewState.resolution, rotation, frameState.size) + : undefined; + var tileCount = 0; + var tile, tileRange, tileResolution, x, y, z; + for (z = minZoom; z <= currentZ; ++z) { + tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange); + tileResolution = tileGrid.getResolution(z); + for (x = tileRange.minX; x <= tileRange.maxX; ++x) { + for (y = tileRange.minY; y <= tileRange.maxY; ++y) { + if (rotation && + !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)) { + continue; + } + if (currentZ - z <= preload) { + ++tileCount; + tile = tileSource.getTile(z, x, y, pixelRatio, projection); + if (tile.getState() == TileState.IDLE) { + wantedTiles[tile.getKey()] = true; + if (!tileQueue.isKeyQueued(tile.getKey())) { + tileQueue.enqueue([ + tile, + tileSourceKey, + tileGrid.getTileCoordCenter(tile.tileCoord), + tileResolution, + ]); + } + } + if (opt_tileCallback !== undefined) { + opt_tileCallback(tile); + } + } + else { + tileSource.useTile(z, x, y, projection); + } + } + } + } + tileSource.updateCacheSize(tileCount, projection); + }; + return CanvasTileLayerRenderer; +}(canvas_Layer)); +/* harmony default export */ var canvas_TileLayer = (CanvasTileLayerRenderer); +//# sourceMappingURL=TileLayer.js.map +;// CONCATENATED MODULE: ./node_modules/ol/layer/Tile.js +var layer_Tile_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @module ol/layer/Tile + */ + + +/** + * @classdesc + * For layer sources that provide pre-rendered, tiled images in grids that are + * organized by zoom levels for specific resolutions. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @template {import("../source/Tile.js").default} TileSourceType + * @extends BaseTileLayer + * @api + */ +var TileLayer = /** @class */ (function (_super) { + layer_Tile_extends(TileLayer, _super); + /** + * @param {import("./BaseTile.js").Options} [opt_options] Tile layer options. + */ + function TileLayer(opt_options) { + return _super.call(this, opt_options) || this; + } + TileLayer.prototype.createRenderer = function () { + return new canvas_TileLayer(this); + }; + return TileLayer; +}(BaseTile)); +/* harmony default export */ var layer_Tile = (TileLayer); +//# sourceMappingURL=Tile.js.map +// EXTERNAL MODULE: ./node_modules/rbush/rbush.min.js +var rbush_min = __webpack_require__(582); +;// CONCATENATED MODULE: ./node_modules/ol/style/Image.js +/** + * @module ol/style/Image + */ + + +/** + * @typedef {Object} Options + * @property {number} opacity Opacity. + * @property {boolean} rotateWithView If the image should get rotated with the view. + * @property {number} rotation Rotation. + * @property {number|import("../size.js").Size} scale Scale. + * @property {Array} displacement Displacement. + * @property {"declutter"|"obstacle"|"none"|undefined} declutterMode Declutter mode: `declutter`, `obstacle`, 'none */ +/** + * @classdesc + * A base class used for creating subclasses and not instantiated in + * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and + * {@link module:ol/style/RegularShape~RegularShape}. + * @abstract + * @api + */ +var ImageStyle = /** @class */ (function () { + /** + * @param {Options} options Options. + */ + function ImageStyle(options) { + /** + * @private + * @type {number} + */ + this.opacity_ = options.opacity; + /** + * @private + * @type {boolean} + */ + this.rotateWithView_ = options.rotateWithView; + /** + * @private + * @type {number} + */ + this.rotation_ = options.rotation; + /** + * @private + * @type {number|import("../size.js").Size} + */ + this.scale_ = options.scale; + /** + * @private + * @type {import("../size.js").Size} + */ + this.scaleArray_ = toSize(options.scale); + /** + * @private + * @type {Array} + */ + this.displacement_ = options.displacement; + /** + * @private + * @type {"declutter"|"obstacle"|"none"|undefined} + */ + this.declutterMode_ = options.declutterMode; + } + /** + * Clones the style. + * @return {ImageStyle} The cloned style. + * @api + */ + ImageStyle.prototype.clone = function () { + var scale = this.getScale(); + return new ImageStyle({ + opacity: this.getOpacity(), + scale: Array.isArray(scale) ? scale.slice() : scale, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + displacement: this.getDisplacement().slice(), + declutterMode: this.getDeclutterMode(), + }); + }; + /** + * Get the symbolizer opacity. + * @return {number} Opacity. + * @api + */ + ImageStyle.prototype.getOpacity = function () { + return this.opacity_; + }; + /** + * Determine whether the symbolizer rotates with the map. + * @return {boolean} Rotate with map. + * @api + */ + ImageStyle.prototype.getRotateWithView = function () { + return this.rotateWithView_; + }; + /** + * Get the symoblizer rotation. + * @return {number} Rotation. + * @api + */ + ImageStyle.prototype.getRotation = function () { + return this.rotation_; + }; + /** + * Get the symbolizer scale. + * @return {number|import("../size.js").Size} Scale. + * @api + */ + ImageStyle.prototype.getScale = function () { + return this.scale_; + }; + /** + * Get the symbolizer scale array. + * @return {import("../size.js").Size} Scale array. + */ + ImageStyle.prototype.getScaleArray = function () { + return this.scaleArray_; + }; + /** + * Get the displacement of the shape + * @return {Array} Shape's center displacement + * @api + */ + ImageStyle.prototype.getDisplacement = function () { + return this.displacement_; + }; + /** + * Get the declutter mode of the shape + * @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode + * @api + */ + ImageStyle.prototype.getDeclutterMode = function () { + return this.declutterMode_; + }; + /** + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @abstract + * @return {Array} Anchor. + */ + ImageStyle.prototype.getAnchor = function () { + return util_abstract(); + }; + /** + * Get the image element for the symbolizer. + * @abstract + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element. + */ + ImageStyle.prototype.getImage = function (pixelRatio) { + return util_abstract(); + }; + /** + * @abstract + * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element. + */ + ImageStyle.prototype.getHitDetectionImage = function () { + return util_abstract(); + }; + /** + * Get the image pixel ratio. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Pixel ratio. + */ + ImageStyle.prototype.getPixelRatio = function (pixelRatio) { + return 1; + }; + /** + * @abstract + * @return {import("../ImageState.js").default} Image state. + */ + ImageStyle.prototype.getImageState = function () { + return util_abstract(); + }; + /** + * @abstract + * @return {import("../size.js").Size} Image size. + */ + ImageStyle.prototype.getImageSize = function () { + return util_abstract(); + }; + /** + * Get the origin of the symbolizer. + * @abstract + * @return {Array} Origin. + */ + ImageStyle.prototype.getOrigin = function () { + return util_abstract(); + }; + /** + * Get the size of the symbolizer (in pixels). + * @abstract + * @return {import("../size.js").Size} Size. + */ + ImageStyle.prototype.getSize = function () { + return util_abstract(); + }; + /** + * Set the displacement. + * + * @param {Array} displacement Displacement. + * @api + */ + ImageStyle.prototype.setDisplacement = function (displacement) { + this.displacement_ = displacement; + }; + /** + * Set the opacity. + * + * @param {number} opacity Opacity. + * @api + */ + ImageStyle.prototype.setOpacity = function (opacity) { + this.opacity_ = opacity; + }; + /** + * Set whether to rotate the style with the view. + * + * @param {boolean} rotateWithView Rotate with map. + * @api + */ + ImageStyle.prototype.setRotateWithView = function (rotateWithView) { + this.rotateWithView_ = rotateWithView; + }; + /** + * Set the rotation. + * + * @param {number} rotation Rotation. + * @api + */ + ImageStyle.prototype.setRotation = function (rotation) { + this.rotation_ = rotation; + }; + /** + * Set the scale. + * + * @param {number|import("../size.js").Size} scale Scale. + * @api + */ + ImageStyle.prototype.setScale = function (scale) { + this.scale_ = scale; + this.scaleArray_ = toSize(scale); + }; + /** + * @abstract + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + ImageStyle.prototype.listenImageChange = function (listener) { + util_abstract(); + }; + /** + * Load not yet loaded URI. + * @abstract + */ + ImageStyle.prototype.load = function () { + util_abstract(); + }; + /** + * @abstract + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + ImageStyle.prototype.unlistenImageChange = function (listener) { + util_abstract(); + }; + return ImageStyle; +}()); +/* harmony default export */ var style_Image = (ImageStyle); +//# sourceMappingURL=Image.js.map +;// CONCATENATED MODULE: ./node_modules/ol/colorlike.js +/** + * @module ol/colorlike + */ + +/** + * A type accepted by CanvasRenderingContext2D.fillStyle + * or CanvasRenderingContext2D.strokeStyle. + * Represents a color, pattern, or gradient. The origin for patterns and + * gradients as fill style is an increment of 512 css pixels from map coordinate + * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image + * must be a factor of two (2, 4, 8, ..., 512). + * + * @typedef {string|CanvasPattern|CanvasGradient} ColorLike + * @api + */ +/** + * @param {import("./color.js").Color|ColorLike} color Color. + * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}. + * @api + */ +function asColorLike(color) { + if (Array.isArray(color)) { + return color_toString(color); + } + else { + return color; + } +} +//# sourceMappingURL=colorlike.js.map +;// CONCATENATED MODULE: ./node_modules/ol/render/canvas.js +/** + * @module ol/render/canvas + */ + + + + + + +/** + * @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType + */ +/** + * @typedef {Object} FillState + * @property {import("../colorlike.js").ColorLike} fillStyle FillStyle. + */ +/** + * @typedef Label + * @property {number} width Width. + * @property {number} height Height. + * @property {Array} contextInstructions ContextInstructions. + */ +/** + * @typedef {Object} FillStrokeState + * @property {import("../colorlike.js").ColorLike} [currentFillStyle] Current FillStyle. + * @property {import("../colorlike.js").ColorLike} [currentStrokeStyle] Current StrokeStyle. + * @property {CanvasLineCap} [currentLineCap] Current LineCap. + * @property {Array} currentLineDash Current LineDash. + * @property {number} [currentLineDashOffset] Current LineDashOffset. + * @property {CanvasLineJoin} [currentLineJoin] Current LineJoin. + * @property {number} [currentLineWidth] Current LineWidth. + * @property {number} [currentMiterLimit] Current MiterLimit. + * @property {number} [lastStroke] Last stroke. + * @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle. + * @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle. + * @property {CanvasLineCap} [lineCap] LineCap. + * @property {Array} lineDash LineDash. + * @property {number} [lineDashOffset] LineDashOffset. + * @property {CanvasLineJoin} [lineJoin] LineJoin. + * @property {number} [lineWidth] LineWidth. + * @property {number} [miterLimit] MiterLimit. + */ +/** + * @typedef {Object} StrokeState + * @property {CanvasLineCap} lineCap LineCap. + * @property {Array} lineDash LineDash. + * @property {number} lineDashOffset LineDashOffset. + * @property {CanvasLineJoin} lineJoin LineJoin. + * @property {number} lineWidth LineWidth. + * @property {number} miterLimit MiterLimit. + * @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle. + */ +/** + * @typedef {Object} TextState + * @property {string} font Font. + * @property {string} [textAlign] TextAlign. + * @property {string} [justify] Justify. + * @property {string} textBaseline TextBaseline. + * @property {string} [placement] Placement. + * @property {number} [maxAngle] MaxAngle. + * @property {boolean} [overflow] Overflow. + * @property {import("../style/Fill.js").default} [backgroundFill] BackgroundFill. + * @property {import("../style/Stroke.js").default} [backgroundStroke] BackgroundStroke. + * @property {import("../size.js").Size} [scale] Scale. + * @property {Array} [padding] Padding. + */ +/** + * @typedef {Object} SerializableInstructions + * @property {Array<*>} instructions The rendering instructions. + * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions. + * @property {Array} coordinates The array of all coordinates. + * @property {!Object} [textStates] The text states (decluttering). + * @property {!Object} [fillStates] The fill states (decluttering). + * @property {!Object} [strokeStates] The stroke states (decluttering). + */ +/** + * @typedef {Object} DeclutterImageWithText + */ +/** + * @const + * @type {string} + */ +var defaultFont = '10px sans-serif'; +/** + * @const + * @type {import("../colorlike.js").ColorLike} + */ +var defaultFillStyle = '#000'; +/** + * @const + * @type {CanvasLineCap} + */ +var defaultLineCap = 'round'; +/** + * @const + * @type {Array} + */ +var defaultLineDash = []; +/** + * @const + * @type {number} + */ +var defaultLineDashOffset = 0; +/** + * @const + * @type {CanvasLineJoin} + */ +var defaultLineJoin = 'round'; +/** + * @const + * @type {number} + */ +var defaultMiterLimit = 10; +/** + * @const + * @type {import("../colorlike.js").ColorLike} + */ +var defaultStrokeStyle = '#000'; +/** + * @const + * @type {string} + */ +var defaultTextAlign = 'center'; +/** + * @const + * @type {string} + */ +var defaultTextBaseline = 'middle'; +/** + * @const + * @type {Array} + */ +var defaultPadding = [0, 0, 0, 0]; +/** + * @const + * @type {number} + */ +var defaultLineWidth = 1; +/** + * @type {BaseObject} + */ +var checkedFonts = new ol_Object(); +/** + * The label cache for text rendering. To change the default cache size of 2048 + * entries, use {@link module:ol/structs/LRUCache~LRUCache#setSize cache.setSize()}. + * Deprecated - there is no label cache any more. + * @type {?} + * @api + * @deprecated + */ +var labelCache = new events_Target(); +labelCache.setSize = function () { + console.warn('labelCache is deprecated.'); //eslint-disable-line +}; +/** + * @type {CanvasRenderingContext2D} + */ +var measureContext = null; +/** + * @type {string} + */ +var measureFont; +/** + * @type {!Object} + */ +var textHeights = {}; +/** + * Clears the label cache when a font becomes available. + * @param {string} fontSpec CSS font spec. + */ +var registerFont = (function () { + var retries = 100; + var size = '32px '; + var referenceFonts = ['monospace', 'serif']; + var len = referenceFonts.length; + var text = 'wmytzilWMYTZIL@#/&?$%10\uF013'; + var interval, referenceWidth; + /** + * @param {string} fontStyle Css font-style + * @param {string} fontWeight Css font-weight + * @param {*} fontFamily Css font-family + * @return {boolean} Font with style and weight is available + */ + function isAvailable(fontStyle, fontWeight, fontFamily) { + var available = true; + for (var i = 0; i < len; ++i) { + var referenceFont = referenceFonts[i]; + referenceWidth = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + referenceFont, text); + if (fontFamily != referenceFont) { + var width = measureTextWidth(fontStyle + + ' ' + + fontWeight + + ' ' + + size + + fontFamily + + ',' + + referenceFont, text); + // If width and referenceWidth are the same, then the fallback was used + // instead of the font we wanted, so the font is not available. + available = available && width != referenceWidth; + } + } + if (available) { + return true; + } + return false; + } + function check() { + var done = true; + var fonts = checkedFonts.getKeys(); + for (var i = 0, ii = fonts.length; i < ii; ++i) { + var font = fonts[i]; + if (checkedFonts.get(font) < retries) { + if (isAvailable.apply(this, font.split('\n'))) { + clear(textHeights); + // Make sure that loaded fonts are picked up by Safari + measureContext = null; + measureFont = undefined; + checkedFonts.set(font, retries); + } + else { + checkedFonts.set(font, checkedFonts.get(font) + 1, true); + done = false; + } + } + } + if (done) { + clearInterval(interval); + interval = undefined; + } + } + return function (fontSpec) { + var font = getFontParameters(fontSpec); + if (!font) { + return; + } + var families = font.families; + for (var i = 0, ii = families.length; i < ii; ++i) { + var family = families[i]; + var key = font.style + '\n' + font.weight + '\n' + family; + if (checkedFonts.get(key) === undefined) { + checkedFonts.set(key, retries, true); + if (!isAvailable(font.style, font.weight, family)) { + checkedFonts.set(key, 0, true); + if (interval === undefined) { + interval = setInterval(check, 32); + } + } + } + } + }; +})(); +/** + * @param {string} font Font to use for measuring. + * @return {import("../size.js").Size} Measurement. + */ +var measureTextHeight = (function () { + /** + * @type {HTMLDivElement} + */ + var measureElement; + return function (fontSpec) { + var height = textHeights[fontSpec]; + if (height == undefined) { + if (WORKER_OFFSCREEN_CANVAS) { + var font = getFontParameters(fontSpec); + var metrics = measureText(fontSpec, 'Žg'); + var lineHeight = isNaN(Number(font.lineHeight)) + ? 1.2 + : Number(font.lineHeight); + height = + lineHeight * + (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent); + } + else { + if (!measureElement) { + measureElement = document.createElement('div'); + measureElement.innerHTML = 'M'; + measureElement.style.minHeight = '0'; + measureElement.style.maxHeight = 'none'; + measureElement.style.height = 'auto'; + measureElement.style.padding = '0'; + measureElement.style.border = 'none'; + measureElement.style.position = 'absolute'; + measureElement.style.display = 'block'; + measureElement.style.left = '-99999px'; + } + measureElement.style.font = fontSpec; + document.body.appendChild(measureElement); + height = measureElement.offsetHeight; + document.body.removeChild(measureElement); + } + textHeights[fontSpec] = height; + } + return height; + }; +})(); +/** + * @param {string} font Font. + * @param {string} text Text. + * @return {TextMetrics} Text metrics. + */ +function measureText(font, text) { + if (!measureContext) { + measureContext = createCanvasContext2D(1, 1); + } + if (font != measureFont) { + measureContext.font = font; + measureFont = measureContext.font; + } + return measureContext.measureText(text); +} +/** + * @param {string} font Font. + * @param {string} text Text. + * @return {number} Width. + */ +function measureTextWidth(font, text) { + return measureText(font, text).width; +} +/** + * Measure text width using a cache. + * @param {string} font The font. + * @param {string} text The text to measure. + * @param {Object} cache A lookup of cached widths by text. + * @return {number} The text width. + */ +function measureAndCacheTextWidth(font, text, cache) { + if (text in cache) { + return cache[text]; + } + var width = text + .split('\n') + .reduce(function (prev, curr) { return Math.max(prev, measureTextWidth(font, curr)); }, 0); + cache[text] = width; + return width; +} +/** + * @param {TextState} baseStyle Base style. + * @param {Array} chunks Text chunks to measure. + * @return {{width: number, height: number, widths: Array, heights: Array, lineWidths: Array}}} Text metrics. + */ +function getTextDimensions(baseStyle, chunks) { + var widths = []; + var heights = []; + var lineWidths = []; + var width = 0; + var lineWidth = 0; + var height = 0; + var lineHeight = 0; + for (var i = 0, ii = chunks.length; i <= ii; i += 2) { + var text = chunks[i]; + if (text === '\n' || i === ii) { + width = Math.max(width, lineWidth); + lineWidths.push(lineWidth); + lineWidth = 0; + height += lineHeight; + continue; + } + var font = chunks[i + 1] || baseStyle.font; + var currentWidth = measureTextWidth(font, text); + widths.push(currentWidth); + lineWidth += currentWidth; + var currentHeight = measureTextHeight(font); + heights.push(currentHeight); + lineHeight = Math.max(lineHeight, currentHeight); + } + return { width: width, height: height, widths: widths, heights: heights, lineWidths: lineWidths }; +} +/** + * @param {CanvasRenderingContext2D} context Context. + * @param {number} rotation Rotation. + * @param {number} offsetX X offset. + * @param {number} offsetY Y offset. + */ +function rotateAtOffset(context, rotation, offsetX, offsetY) { + if (rotation !== 0) { + context.translate(offsetX, offsetY); + context.rotate(rotation); + context.translate(-offsetX, -offsetY); + } +} +/** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../transform.js").Transform|null} transform Transform. + * @param {number} opacity Opacity. + * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label. + * @param {number} originX Origin X. + * @param {number} originY Origin Y. + * @param {number} w Width. + * @param {number} h Height. + * @param {number} x X. + * @param {number} y Y. + * @param {import("../size.js").Size} scale Scale. + */ +function drawImageOrLabel(context, transform, opacity, labelOrImage, originX, originY, w, h, x, y, scale) { + context.save(); + if (opacity !== 1) { + context.globalAlpha *= opacity; + } + if (transform) { + context.setTransform.apply(context, transform); + } + if ( /** @type {*} */(labelOrImage).contextInstructions) { + // label + context.translate(x, y); + context.scale(scale[0], scale[1]); + executeLabelInstructions(/** @type {Label} */ (labelOrImage), context); + } + else if (scale[0] < 0 || scale[1] < 0) { + // flipped image + context.translate(x, y); + context.scale(scale[0], scale[1]); + context.drawImage( + /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, 0, 0, w, h); + } + else { + // if image not flipped translate and scale can be avoided + context.drawImage( + /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, x, y, w * scale[0], h * scale[1]); + } + context.restore(); +} +/** + * @param {Label} label Label. + * @param {CanvasRenderingContext2D} context Context. + */ +function executeLabelInstructions(label, context) { + var contextInstructions = label.contextInstructions; + for (var i = 0, ii = contextInstructions.length; i < ii; i += 2) { + if (Array.isArray(contextInstructions[i + 1])) { + context[contextInstructions[i]].apply(context, contextInstructions[i + 1]); + } + else { + context[contextInstructions[i]] = contextInstructions[i + 1]; + } + } +} +//# sourceMappingURL=canvas.js.map +;// CONCATENATED MODULE: ./node_modules/ol/style/RegularShape.js +/** + * @module ol/style/RegularShape + */ +var RegularShape_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + + + + + +/** + * Specify radius for regular polygons, or radius1 and radius2 for stars. + * @typedef {Object} Options + * @property {import("./Fill.js").default} [fill] Fill style. + * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points + * is the number of sides. + * @property {number} [radius] Radius of a regular polygon. + * @property {number} [radius1] First radius of a star. Ignored if radius is set. + * @property {number} [radius2] Second radius of a star. + * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up. + * @property {Array} [displacement=[0,0]] Displacement of the shape + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). + * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view. + * @property {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better + * result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`. + * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode + */ +/** + * @typedef {Object} RenderOptions + * @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle. + * @property {number} strokeWidth StrokeWidth. + * @property {number} size Size. + * @property {Array} lineDash LineDash. + * @property {number} lineDashOffset LineDashOffset. + * @property {CanvasLineJoin} lineJoin LineJoin. + * @property {number} miterLimit MiterLimit. + */ +/** + * @classdesc + * Set regular shape style for vector features. The resulting shape will be + * a regular polygon when `radius` is provided, or a star when `radius1` and + * `radius2` are provided. + * @api + */ +var RegularShape = /** @class */ (function (_super) { + RegularShape_extends(RegularShape, _super); + /** + * @param {Options} options Options. + */ + function RegularShape(options) { + var _this = this; + /** + * @type {boolean} + */ + var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; + _this = _super.call(this, { + opacity: 1, + rotateWithView: rotateWithView, + rotation: options.rotation !== undefined ? options.rotation : 0, + scale: options.scale !== undefined ? options.scale : 1, + displacement: options.displacement !== undefined ? options.displacement : [0, 0], + declutterMode: options.declutterMode, + }) || this; + /** + * @private + * @type {Object} + */ + _this.canvas_ = undefined; + /** + * @private + * @type {HTMLCanvasElement} + */ + _this.hitDetectionCanvas_ = null; + /** + * @private + * @type {import("./Fill.js").default} + */ + _this.fill_ = options.fill !== undefined ? options.fill : null; + /** + * @private + * @type {Array} + */ + _this.origin_ = [0, 0]; + /** + * @private + * @type {number} + */ + _this.points_ = options.points; + /** + * @protected + * @type {number} + */ + _this.radius_ = + options.radius !== undefined ? options.radius : options.radius1; + /** + * @private + * @type {number|undefined} + */ + _this.radius2_ = options.radius2; + /** + * @private + * @type {number} + */ + _this.angle_ = options.angle !== undefined ? options.angle : 0; + /** + * @private + * @type {import("./Stroke.js").default} + */ + _this.stroke_ = options.stroke !== undefined ? options.stroke : null; + /** + * @private + * @type {import("../size.js").Size} + */ + _this.size_ = null; + /** + * @private + * @type {RenderOptions} + */ + _this.renderOptions_ = null; + _this.render(); + return _this; + } + /** + * Clones the style. + * @return {RegularShape} The cloned style. + * @api + */ + RegularShape.prototype.clone = function () { + var scale = this.getScale(); + var style = new RegularShape({ + fill: this.getFill() ? this.getFill().clone() : undefined, + points: this.getPoints(), + radius: this.getRadius(), + radius2: this.getRadius2(), + angle: this.getAngle(), + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + scale: Array.isArray(scale) ? scale.slice() : scale, + displacement: this.getDisplacement().slice(), + declutterMode: this.getDeclutterMode(), + }); + style.setOpacity(this.getOpacity()); + return style; + }; + /** + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @return {Array} Anchor. + * @api + */ + RegularShape.prototype.getAnchor = function () { + var size = this.size_; + if (!size) { + return null; + } + var displacement = this.getDisplacement(); + return [size[0] / 2 - displacement[0], size[1] / 2 + displacement[1]]; + }; + /** + * Get the angle used in generating the shape. + * @return {number} Shape's rotation in radians. + * @api + */ + RegularShape.prototype.getAngle = function () { + return this.angle_; + }; + /** + * Get the fill style for the shape. + * @return {import("./Fill.js").default} Fill style. + * @api + */ + RegularShape.prototype.getFill = function () { + return this.fill_; + }; + /** + * Set the fill style. + * @param {import("./Fill.js").default} fill Fill style. + * @api + */ + RegularShape.prototype.setFill = function (fill) { + this.fill_ = fill; + this.render(); + }; + /** + * @return {HTMLCanvasElement} Image element. + */ + RegularShape.prototype.getHitDetectionImage = function () { + if (!this.hitDetectionCanvas_) { + this.createHitDetectionCanvas_(this.renderOptions_); + } + return this.hitDetectionCanvas_; + }; + /** + * Get the image icon. + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLCanvasElement} Image or Canvas element. + * @api + */ + RegularShape.prototype.getImage = function (pixelRatio) { + var image = this.canvas_[pixelRatio]; + if (!image) { + var renderOptions = this.renderOptions_; + var context = createCanvasContext2D(renderOptions.size * pixelRatio, renderOptions.size * pixelRatio); + this.draw_(renderOptions, context, pixelRatio); + image = context.canvas; + this.canvas_[pixelRatio] = image; + } + return image; + }; + /** + * Get the image pixel ratio. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Pixel ratio. + */ + RegularShape.prototype.getPixelRatio = function (pixelRatio) { + return pixelRatio; + }; + /** + * @return {import("../size.js").Size} Image size. + */ + RegularShape.prototype.getImageSize = function () { + return this.size_; + }; + /** + * @return {import("../ImageState.js").default} Image state. + */ + RegularShape.prototype.getImageState = function () { + return ImageState.LOADED; + }; + /** + * Get the origin of the symbolizer. + * @return {Array} Origin. + * @api + */ + RegularShape.prototype.getOrigin = function () { + return this.origin_; + }; + /** + * Get the number of points for generating the shape. + * @return {number} Number of points for stars and regular polygons. + * @api + */ + RegularShape.prototype.getPoints = function () { + return this.points_; + }; + /** + * Get the (primary) radius for the shape. + * @return {number} Radius. + * @api + */ + RegularShape.prototype.getRadius = function () { + return this.radius_; + }; + /** + * Get the secondary radius for the shape. + * @return {number|undefined} Radius2. + * @api + */ + RegularShape.prototype.getRadius2 = function () { + return this.radius2_; + }; + /** + * Get the size of the symbolizer (in pixels). + * @return {import("../size.js").Size} Size. + * @api + */ + RegularShape.prototype.getSize = function () { + return this.size_; + }; + /** + * Get the stroke style for the shape. + * @return {import("./Stroke.js").default} Stroke style. + * @api + */ + RegularShape.prototype.getStroke = function () { + return this.stroke_; + }; + /** + * Set the stroke style. + * @param {import("./Stroke.js").default} stroke Stroke style. + * @api + */ + RegularShape.prototype.setStroke = function (stroke) { + this.stroke_ = stroke; + this.render(); + }; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + RegularShape.prototype.listenImageChange = function (listener) { }; + /** + * Load not yet loaded URI. + */ + RegularShape.prototype.load = function () { }; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + RegularShape.prototype.unlistenImageChange = function (listener) { }; + /** + * Calculate additional canvas size needed for the miter. + * @param {string} lineJoin Line join + * @param {number} strokeWidth Stroke width + * @param {number} miterLimit Miter limit + * @return {number} Additional canvas size needed + * @private + */ + RegularShape.prototype.calculateLineJoinSize_ = function (lineJoin, strokeWidth, miterLimit) { + if (strokeWidth === 0 || + this.points_ === Infinity || + (lineJoin !== 'bevel' && lineJoin !== 'miter')) { + return strokeWidth; + } + // m | ^ + // i | |\ . + // t >| #\ + // e | |\ \ . + // r \s\ + // | \t\ . . + // \r\ . . + // | \o\ . . . . . + // e \k\ . . . . + // | \e\ . . . . . + // d \ \ . . . . + // | _ _a_ _\# . . . + // r1 / ` . . + // | . . + // b / . . + // | . . + // / r2 . . + // | . . + // / . . + // |α . . + // / . . + // ° center + var r1 = this.radius_; + var r2 = this.radius2_ === undefined ? r1 : this.radius2_; + if (r1 < r2) { + var tmp = r1; + r1 = r2; + r2 = tmp; + } + var points = this.radius2_ === undefined ? this.points_ : this.points_ * 2; + var alpha = (2 * Math.PI) / points; + var a = r2 * Math.sin(alpha); + var b = Math.sqrt(r2 * r2 - a * a); + var d = r1 - b; + var e = Math.sqrt(a * a + d * d); + var miterRatio = e / a; + if (lineJoin === 'miter' && miterRatio <= miterLimit) { + return miterRatio * strokeWidth; + } + // Calculate the distnce from center to the stroke corner where + // it was cut short because of the miter limit. + // l + // ----+---- <= distance from center to here is maxr + // /####|k ##\ + // /#####^#####\ + // /#### /+\# s #\ + // /### h/+++\# t #\ + // /### t/+++++\# r #\ + // /### a/+++++++\# o #\ + // /### p/++ fill +\# k #\ + ///#### /+++++^+++++\# e #\ + //#####/+++++/+\+++++\#####\ + var k = strokeWidth / 2 / miterRatio; + var l = (strokeWidth / 2) * (d / e); + var maxr = Math.sqrt((r1 + k) * (r1 + k) + l * l); + var bevelAdd = maxr - r1; + if (this.radius2_ === undefined || lineJoin === 'bevel') { + return bevelAdd * 2; + } + // If outer miter is over the miter limit the inner miter may reach through the + // center and be longer than the bevel, same calculation as above but swap r1 / r2. + var aa = r1 * Math.sin(alpha); + var bb = Math.sqrt(r1 * r1 - aa * aa); + var dd = r2 - bb; + var ee = Math.sqrt(aa * aa + dd * dd); + var innerMiterRatio = ee / aa; + if (innerMiterRatio <= miterLimit) { + var innerLength = (innerMiterRatio * strokeWidth) / 2 - r2 - r1; + return 2 * Math.max(bevelAdd, innerLength); + } + return bevelAdd * 2; + }; + /** + * @return {RenderOptions} The render options + * @protected + */ + RegularShape.prototype.createRenderOptions = function () { + var lineJoin = defaultLineJoin; + var miterLimit = 0; + var lineDash = null; + var lineDashOffset = 0; + var strokeStyle; + var strokeWidth = 0; + if (this.stroke_) { + strokeStyle = this.stroke_.getColor(); + if (strokeStyle === null) { + strokeStyle = defaultStrokeStyle; + } + strokeStyle = asColorLike(strokeStyle); + strokeWidth = this.stroke_.getWidth(); + if (strokeWidth === undefined) { + strokeWidth = defaultLineWidth; + } + lineDash = this.stroke_.getLineDash(); + lineDashOffset = this.stroke_.getLineDashOffset(); + lineJoin = this.stroke_.getLineJoin(); + if (lineJoin === undefined) { + lineJoin = defaultLineJoin; + } + miterLimit = this.stroke_.getMiterLimit(); + if (miterLimit === undefined) { + miterLimit = defaultMiterLimit; + } + } + var add = this.calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit); + var maxRadius = Math.max(this.radius_, this.radius2_ || 0); + var size = Math.ceil(2 * maxRadius + add); + return { + strokeStyle: strokeStyle, + strokeWidth: strokeWidth, + size: size, + lineDash: lineDash, + lineDashOffset: lineDashOffset, + lineJoin: lineJoin, + miterLimit: miterLimit, + }; + }; + /** + * @protected + */ + RegularShape.prototype.render = function () { + this.renderOptions_ = this.createRenderOptions(); + var size = this.renderOptions_.size; + this.canvas_ = {}; + this.size_ = [size, size]; + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + * @param {CanvasRenderingContext2D} context The rendering context. + * @param {number} pixelRatio The pixel ratio. + */ + RegularShape.prototype.draw_ = function (renderOptions, context, pixelRatio) { + context.scale(pixelRatio, pixelRatio); + // set origin to canvas center + context.translate(renderOptions.size / 2, renderOptions.size / 2); + this.createPath_(context); + if (this.fill_) { + var color = this.fill_.getColor(); + if (color === null) { + color = defaultFillStyle; + } + context.fillStyle = asColorLike(color); + context.fill(); + } + if (this.stroke_) { + context.strokeStyle = renderOptions.strokeStyle; + context.lineWidth = renderOptions.strokeWidth; + if (context.setLineDash && renderOptions.lineDash) { + context.setLineDash(renderOptions.lineDash); + context.lineDashOffset = renderOptions.lineDashOffset; + } + context.lineJoin = renderOptions.lineJoin; + context.miterLimit = renderOptions.miterLimit; + context.stroke(); + } + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + */ + RegularShape.prototype.createHitDetectionCanvas_ = function (renderOptions) { + if (this.fill_) { + var color = this.fill_.getColor(); + // determine if fill is transparent (or pattern or gradient) + var opacity = 0; + if (typeof color === 'string') { + color = asArray(color); + } + if (color === null) { + opacity = 1; + } + else if (Array.isArray(color)) { + opacity = color.length === 4 ? color[3] : 1; + } + if (opacity === 0) { + // if a transparent fill style is set, create an extra hit-detection image + // with a default fill style + var context = createCanvasContext2D(renderOptions.size, renderOptions.size); + this.hitDetectionCanvas_ = context.canvas; + this.drawHitDetectionCanvas_(renderOptions, context); + } + } + if (!this.hitDetectionCanvas_) { + this.hitDetectionCanvas_ = this.getImage(1); + } + }; + /** + * @private + * @param {CanvasRenderingContext2D} context The context to draw in. + */ + RegularShape.prototype.createPath_ = function (context) { + var points = this.points_; + var radius = this.radius_; + if (points === Infinity) { + context.arc(0, 0, radius, 0, 2 * Math.PI); + } + else { + var radius2 = this.radius2_ === undefined ? radius : this.radius2_; + if (this.radius2_ !== undefined) { + points *= 2; + } + var startAngle = this.angle_ - Math.PI / 2; + var step = (2 * Math.PI) / points; + for (var i = 0; i < points; i++) { + var angle0 = startAngle + i * step; + var radiusC = i % 2 === 0 ? radius : radius2; + context.lineTo(radiusC * Math.cos(angle0), radiusC * Math.sin(angle0)); + } + context.closePath(); + } + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + * @param {CanvasRenderingContext2D} context The context. + */ + RegularShape.prototype.drawHitDetectionCanvas_ = function (renderOptions, context) { + // set origin to canvas center + context.translate(renderOptions.size / 2, renderOptions.size / 2); + this.createPath_(context); + context.fillStyle = defaultFillStyle; + context.fill(); + if (this.stroke_) { + context.strokeStyle = renderOptions.strokeStyle; + context.lineWidth = renderOptions.strokeWidth; + if (renderOptions.lineDash) { + context.setLineDash(renderOptions.lineDash); + context.lineDashOffset = renderOptions.lineDashOffset; + } + context.lineJoin = renderOptions.lineJoin; + context.miterLimit = renderOptions.miterLimit; + context.stroke(); + } + }; + return RegularShape; +}(style_Image)); +/* harmony default export */ var style_RegularShape = (RegularShape); +//# sourceMappingURL=RegularShape.js.map +;// CONCATENATED MODULE: ./node_modules/ol/style/Circle.js +/** + * @module ol/style/Circle + */ +var Circle_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + +/** + * @typedef {Object} Options + * @property {import("./Fill.js").default} [fill] Fill style. + * @property {number} radius Circle radius. + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {Array} [displacement=[0,0]] displacement + * @property {number|import("../size.js").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse. + * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`. + * @property {number} [rotation=0] Rotation in radians + * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale). + * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view + * (meaningful only when used in conjunction with a two dimensional scale). + * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode + */ +/** + * @classdesc + * Set circle style for vector features. + * @api + */ +var Circle_CircleStyle = /** @class */ (function (_super) { + Circle_extends(CircleStyle, _super); + /** + * @param {Options} [opt_options] Options. + */ + function CircleStyle(opt_options) { + var options = opt_options ? opt_options : {}; + return _super.call(this, { + points: Infinity, + fill: options.fill, + radius: options.radius, + stroke: options.stroke, + scale: options.scale !== undefined ? options.scale : 1, + rotation: options.rotation !== undefined ? options.rotation : 0, + rotateWithView: options.rotateWithView !== undefined ? options.rotateWithView : false, + displacement: options.displacement !== undefined ? options.displacement : [0, 0], + declutterMode: options.declutterMode, + }) || this; + } + /** + * Clones the style. + * @return {CircleStyle} The cloned style. + * @api + */ + CircleStyle.prototype.clone = function () { + var scale = this.getScale(); + var style = new CircleStyle({ + fill: this.getFill() ? this.getFill().clone() : undefined, + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + radius: this.getRadius(), + scale: Array.isArray(scale) ? scale.slice() : scale, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + displacement: this.getDisplacement().slice(), + declutterMode: this.getDeclutterMode(), + }); + style.setOpacity(this.getOpacity()); + return style; + }; + /** + * Set the circle radius. + * + * @param {number} radius Circle radius. + * @api + */ + CircleStyle.prototype.setRadius = function (radius) { + this.radius_ = radius; + this.render(); + }; + return CircleStyle; +}(style_RegularShape)); +/* harmony default export */ var Circle = (Circle_CircleStyle); +//# sourceMappingURL=Circle.js.map +;// CONCATENATED MODULE: ./node_modules/ol/style/Fill.js +/** + * @module ol/style/Fill + */ +/** + * @typedef {Object} Options + * @property {import("../color.js").Color|import("../colorlike.js").ColorLike|null} [color=null] A color, gradient or pattern. + * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. + * Default null; if null, the Canvas/renderer default black will be used. + */ +/** + * @classdesc + * Set fill style for vector features. + * @api + */ +var Fill_Fill = /** @class */ (function () { + /** + * @param {Options} [opt_options] Options. + */ + function Fill(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {import("../color.js").Color|import("../colorlike.js").ColorLike|null} + */ + this.color_ = options.color !== undefined ? options.color : null; + } + /** + * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}. + * @return {Fill} The cloned style. + * @api + */ + Fill.prototype.clone = function () { + var color = this.getColor(); + return new Fill({ + color: Array.isArray(color) ? color.slice() : color || undefined, + }); + }; + /** + * Get the fill color. + * @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color. + * @api + */ + Fill.prototype.getColor = function () { + return this.color_; + }; + /** + * Set the color. + * + * @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color. + * @api + */ + Fill.prototype.setColor = function (color) { + this.color_ = color; + }; + return Fill; +}()); +/* harmony default export */ var style_Fill = (Fill_Fill); +//# sourceMappingURL=Fill.js.map +;// CONCATENATED MODULE: ./node_modules/ol/style/Stroke.js +/** + * @module ol/style/Stroke + */ +/** + * @typedef {Object} Options + * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern. + * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. + * Default null; if null, the Canvas/renderer default black will be used. + * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`. + * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`. + * @property {Array} [lineDash] Line dash pattern. Default is `null` (no dash). + * Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on + * the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers. + * @property {number} [lineDashOffset=0] Line dash offset. + * @property {number} [miterLimit=10] Miter limit. + * @property {number} [width] Width. + */ +/** + * @classdesc + * Set stroke style for vector features. + * Note that the defaults given are the Canvas defaults, which will be used if + * option is not defined. The `get` functions return whatever was entered in + * the options; they will not return the default. + * @api + */ +var Stroke_Stroke = /** @class */ (function () { + /** + * @param {Options} [opt_options] Options. + */ + function Stroke(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {import("../color.js").Color|import("../colorlike.js").ColorLike} + */ + this.color_ = options.color !== undefined ? options.color : null; + /** + * @private + * @type {CanvasLineCap|undefined} + */ + this.lineCap_ = options.lineCap; + /** + * @private + * @type {Array} + */ + this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null; + /** + * @private + * @type {number|undefined} + */ + this.lineDashOffset_ = options.lineDashOffset; + /** + * @private + * @type {CanvasLineJoin|undefined} + */ + this.lineJoin_ = options.lineJoin; + /** + * @private + * @type {number|undefined} + */ + this.miterLimit_ = options.miterLimit; + /** + * @private + * @type {number|undefined} + */ + this.width_ = options.width; + } + /** + * Clones the style. + * @return {Stroke} The cloned style. + * @api + */ + Stroke.prototype.clone = function () { + var color = this.getColor(); + return new Stroke({ + color: Array.isArray(color) ? color.slice() : color || undefined, + lineCap: this.getLineCap(), + lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined, + lineDashOffset: this.getLineDashOffset(), + lineJoin: this.getLineJoin(), + miterLimit: this.getMiterLimit(), + width: this.getWidth(), + }); + }; + /** + * Get the stroke color. + * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color. + * @api + */ + Stroke.prototype.getColor = function () { + return this.color_; + }; + /** + * Get the line cap type for the stroke. + * @return {CanvasLineCap|undefined} Line cap. + * @api + */ + Stroke.prototype.getLineCap = function () { + return this.lineCap_; + }; + /** + * Get the line dash style for the stroke. + * @return {Array} Line dash. + * @api + */ + Stroke.prototype.getLineDash = function () { + return this.lineDash_; + }; + /** + * Get the line dash offset for the stroke. + * @return {number|undefined} Line dash offset. + * @api + */ + Stroke.prototype.getLineDashOffset = function () { + return this.lineDashOffset_; + }; + /** + * Get the line join type for the stroke. + * @return {CanvasLineJoin|undefined} Line join. + * @api + */ + Stroke.prototype.getLineJoin = function () { + return this.lineJoin_; + }; + /** + * Get the miter limit for the stroke. + * @return {number|undefined} Miter limit. + * @api + */ + Stroke.prototype.getMiterLimit = function () { + return this.miterLimit_; + }; + /** + * Get the stroke width. + * @return {number|undefined} Width. + * @api + */ + Stroke.prototype.getWidth = function () { + return this.width_; + }; + /** + * Set the color. + * + * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color. + * @api + */ + Stroke.prototype.setColor = function (color) { + this.color_ = color; + }; + /** + * Set the line cap. + * + * @param {CanvasLineCap|undefined} lineCap Line cap. + * @api + */ + Stroke.prototype.setLineCap = function (lineCap) { + this.lineCap_ = lineCap; + }; + /** + * Set the line dash. + * + * Please note that Internet Explorer 10 and lower [do not support][mdn] the + * `setLineDash` method on the `CanvasRenderingContext2D` and therefore this + * property will have no visual effect in these browsers. + * + * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility + * + * @param {Array} lineDash Line dash. + * @api + */ + Stroke.prototype.setLineDash = function (lineDash) { + this.lineDash_ = lineDash; + }; + /** + * Set the line dash offset. + * + * @param {number|undefined} lineDashOffset Line dash offset. + * @api + */ + Stroke.prototype.setLineDashOffset = function (lineDashOffset) { + this.lineDashOffset_ = lineDashOffset; + }; + /** + * Set the line join. + * + * @param {CanvasLineJoin|undefined} lineJoin Line join. + * @api + */ + Stroke.prototype.setLineJoin = function (lineJoin) { + this.lineJoin_ = lineJoin; + }; + /** + * Set the miter limit. + * + * @param {number|undefined} miterLimit Miter limit. + * @api + */ + Stroke.prototype.setMiterLimit = function (miterLimit) { + this.miterLimit_ = miterLimit; + }; + /** + * Set the width. + * + * @param {number|undefined} width Width. + * @api + */ + Stroke.prototype.setWidth = function (width) { + this.width_ = width; + }; + return Stroke; +}()); +/* harmony default export */ var style_Stroke = (Stroke_Stroke); +//# sourceMappingURL=Stroke.js.map +;// CONCATENATED MODULE: ./node_modules/ol/style/Style.js +/** + * @module ol/style/Style + */ + + + + +/** + * A function that takes an {@link module:ol/Feature~Feature} and a `{number}` + * representing the view's resolution. The function should return a + * {@link module:ol/style/Style~Style} or an array of them. This way e.g. a + * vector layer can be styled. If the function returns `undefined`, the + * feature will not be rendered. + * + * @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array