@kalisio/kdk 2.5.3 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (545) hide show
  1. package/.github/workflows/main.yaml +35 -6
  2. package/client.globe.js +8 -0
  3. package/client.js +8 -0
  4. package/client.map.js +8 -0
  5. package/core/api/hooks/hooks.push.js +3 -2
  6. package/core/api/hooks/hooks.tags.js +56 -0
  7. package/core/api/models/tags.model.mongodb.js +8 -0
  8. package/core/api/services/index.js +33 -2
  9. package/core/api/services/tags/tags.hooks.js +47 -0
  10. package/core/client/api.js +5 -5
  11. package/core/client/components/KActivity.vue +3 -2
  12. package/core/client/components/KChip.vue +2 -2
  13. package/core/client/components/KEditor.vue +3 -1
  14. package/core/client/components/KFollower.vue +4 -4
  15. package/core/client/components/KStore.vue +1 -1
  16. package/core/client/components/KTab.vue +20 -7
  17. package/core/client/components/account/KProfile.vue +9 -25
  18. package/core/client/components/action/KAction.vue +10 -10
  19. package/core/client/components/action/KToggleFullscreenAction.vue +2 -11
  20. package/core/client/components/app/KHome.vue +3 -2
  21. package/core/client/components/collection/KFilter.vue +5 -4
  22. package/core/client/components/collection/KGrid.vue +5 -1
  23. package/core/client/components/collection/KItemsFilter.vue +47 -0
  24. package/core/client/components/collection/KItemsSorter.vue +42 -0
  25. package/core/client/components/collection/KScrollDown.vue +2 -2
  26. package/core/client/components/collection/KSearchFilterControl.vue +3 -2
  27. package/core/client/components/collection/KSorter.vue +33 -37
  28. package/core/client/components/collection/KTagsFilterControl.vue +14 -40
  29. package/core/client/components/collection/KTagsFilterView.vue +10 -45
  30. package/core/client/components/collection/KTimeFilterControl.vue +6 -7
  31. package/core/client/components/collection/KTimeFilterView.vue +13 -22
  32. package/core/client/components/collection/KTimeLine.vue +18 -9
  33. package/core/client/components/form/KColorField.vue +13 -6
  34. package/core/client/components/form/KColorScaleField.vue +7 -12
  35. package/core/client/components/form/KFileField.vue +118 -89
  36. package/core/client/components/form/KForm.vue +30 -18
  37. package/core/client/components/form/KIconField.vue +4 -1
  38. package/core/client/components/form/KNumberField.vue +9 -2
  39. package/core/client/components/form/KSelectField.vue +1 -4
  40. package/core/client/components/form/KTagField.vue +229 -0
  41. package/core/client/components/form/KTextField.vue +4 -0
  42. package/core/client/components/form/KTextareaField.vue +3 -1
  43. package/core/client/components/input/KShapePicker.vue +3 -3
  44. package/core/client/components/layout/KFab.vue +32 -20
  45. package/core/client/components/layout/KPage.vue +11 -6
  46. package/core/client/components/layout/KWindow.vue +5 -0
  47. package/core/client/components/media/index.js +2 -6
  48. package/core/client/components/menu/KMenu.vue +12 -10
  49. package/core/client/components/menu/KSubMenu.vue +12 -12
  50. package/core/client/components/messages/KMessageCard.vue +13 -12
  51. package/core/client/components/messages/KMessageComposer.vue +13 -9
  52. package/core/client/components/messages/KMessagesTimeLine.vue +16 -8
  53. package/core/client/components/tags/KTagFilter.vue +99 -0
  54. package/core/client/components/tags/KTagItem.vue +65 -0
  55. package/core/client/components/tags/KTagManager.vue +198 -0
  56. package/core/client/components/tags/KTagSelection.vue +82 -0
  57. package/core/client/components/time/KDate.vue +3 -17
  58. package/core/client/components/time/KDateTime.vue +1 -1
  59. package/core/client/components/time/KTime.vue +0 -4
  60. package/core/client/composables/collection-filter.js +41 -2
  61. package/core/client/composables/collection.js +3 -3
  62. package/core/client/composables/index.js +1 -0
  63. package/core/client/composables/pwa.js +13 -0
  64. package/core/client/composables/session.js +7 -8
  65. package/core/client/composables/user.js +36 -0
  66. package/core/client/directives/index.js +1 -0
  67. package/core/client/directives/v-drop-file.js +174 -0
  68. package/core/client/document.js +2 -1
  69. package/core/client/exporter.js +17 -3
  70. package/core/client/i18n/core_en.json +34 -7
  71. package/core/client/i18n/core_fr.json +36 -9
  72. package/core/client/i18n.js +26 -11
  73. package/core/client/layout.js +5 -5
  74. package/core/client/mixins/mixin.base-activity.js +8 -5
  75. package/core/client/mixins/mixin.base-editor.js +2 -1
  76. package/core/client/mixins/mixin.base-field.js +3 -2
  77. package/core/client/mixins/mixin.base-item.js +12 -10
  78. package/core/client/mixins/mixin.service.js +3 -1
  79. package/core/client/platform.js +0 -3
  80. package/core/client/readers/reader.json.js +2 -2
  81. package/core/client/utils/index.js +2 -0
  82. package/core/client/utils/utils.collection.js +6 -6
  83. package/core/client/utils/utils.colors.js +46 -19
  84. package/core/client/utils/utils.files.js +19 -0
  85. package/core/client/utils/utils.locale.js +13 -17
  86. package/core/client/utils/utils.services.js +27 -0
  87. package/core/client/utils/utils.shapes.js +2 -2
  88. package/core/client/utils/utils.tags.js +17 -0
  89. package/core/client/utils/utils.tours.js +31 -0
  90. package/core/common/permissions.js +3 -0
  91. package/core/common/schemas/tags.update.json +35 -0
  92. package/core/common/schemas/users.update-profile.json +1 -1
  93. package/core/common/utils.js +5 -5
  94. package/extras/configs/panes.top.js +11 -0
  95. package/extras/configs/stickies.js +1 -1
  96. package/extras/configs/widgets.left.js +13 -1
  97. package/extras/libs/jsts.min.js +8 -0
  98. package/{test/client/core/account.js → extras/tests/core/account.mjs} +4 -4
  99. package/extras/tests/core/api.mjs +114 -0
  100. package/{test/client/core/collection.js → extras/tests/core/collection.mjs} +8 -8
  101. package/{test/client/core/dialogs.js → extras/tests/core/dialogs.mjs} +1 -1
  102. package/extras/tests/core/index.mjs +9 -0
  103. package/{test/client/core/layout.js → extras/tests/core/layout.mjs} +7 -3
  104. package/{test/client/core/runner.js → extras/tests/core/runner.mjs} +3 -3
  105. package/{test/client/core/screens.js → extras/tests/core/screens.mjs} +1 -1
  106. package/{test/client/core/utils.js → extras/tests/core/utils.mjs} +79 -26
  107. package/extras/tests/index.mjs +4 -0
  108. package/{test/client/map/api.js → extras/tests/map/api.mjs} +1 -1
  109. package/{test/client/map/catalog.js → extras/tests/map/catalog.mjs} +18 -18
  110. package/{test/client/map/controls.js → extras/tests/map/controls.mjs} +3 -3
  111. package/extras/tests/map/index.mjs +5 -0
  112. package/{test/client/map/time.js → extras/tests/map/time.mjs} +3 -3
  113. package/{test/client/map/utils.js → extras/tests/map/utils.mjs} +6 -5
  114. package/extras/tours/fab.js +36 -0
  115. package/extras/tours/layout.js +49 -0
  116. package/extras/tours/pane.left.js +78 -0
  117. package/extras/tours/pane.right.js +145 -0
  118. package/extras/tours/pane.top.js +239 -0
  119. package/map/api/config/layers.cjs +28 -13
  120. package/map/api/hooks/hooks.query.js +12 -7
  121. package/map/api/models/catalog.model.mongodb.js +17 -6
  122. package/map/api/services/catalog/catalog.hooks.js +1 -1
  123. package/map/api/services/index.js +18 -1
  124. package/map/client/cesium/utils/utils.cesium.js +25 -65
  125. package/map/client/cesium/utils/utils.features.js +1 -0
  126. package/map/client/cesium/utils/utils.geojson.js +1 -0
  127. package/map/client/cesium/utils/utils.style.js +7 -6
  128. package/map/client/components/KFeatureEditor.vue +3 -3
  129. package/map/client/components/KFeaturesChart.vue +4 -4
  130. package/map/client/components/KFeaturesFilterEditor.vue +19 -13
  131. package/map/client/components/KFeaturesFilterManager.vue +7 -4
  132. package/map/client/components/KFeaturesTable.vue +2 -2
  133. package/map/client/components/KLayerEditor.vue +6 -6
  134. package/map/client/components/KMeasureTool.vue +2 -1
  135. package/map/client/components/catalog/KBaseLayersSelector.vue +1 -1
  136. package/map/client/components/catalog/KCategoryItem.vue +15 -1
  137. package/map/client/components/catalog/KConnectLayer.vue +2 -2
  138. package/map/client/components/catalog/KCreateView.vue +3 -2
  139. package/map/client/components/catalog/KFilteredLayerItem.vue +26 -6
  140. package/map/client/components/catalog/KImportLayer.vue +6 -3
  141. package/map/client/components/catalog/KLayerCategories.vue +6 -6
  142. package/map/client/components/catalog/KLayerItem.vue +12 -2
  143. package/map/client/components/catalog/KLayersList.vue +180 -0
  144. package/map/client/components/catalog/KLayersPanel.vue +146 -36
  145. package/map/client/components/catalog/KLayersSelector.vue +96 -48
  146. package/map/client/components/catalog/KProjectEditor.vue +0 -9
  147. package/map/client/components/catalog/KProjectSelector.vue +3 -2
  148. package/map/client/components/catalog/KProjectsPanel.vue +23 -8
  149. package/map/client/components/catalog/KViewsPanel.vue +18 -8
  150. package/map/client/components/catalog/KWeatherLayersSelector.vue +3 -3
  151. package/map/client/components/form/KDirectionField.vue +3 -6
  152. package/map/client/components/form/KLayerCategoryField.vue +2 -2
  153. package/map/client/components/form/KOwsServiceField.vue +25 -24
  154. package/map/client/components/form/KSelectLayersField.vue +4 -4
  155. package/map/client/components/form/KSelectViewsField.vue +4 -4
  156. package/map/client/components/legend/KLayerLegend.vue +11 -2
  157. package/map/client/components/legend/KLegend.vue +44 -51
  158. package/map/client/components/location/KLocationCardSection.vue +6 -7
  159. package/map/client/components/location/KLocationMap.vue +23 -13
  160. package/map/client/components/stickies/KPosition.vue +5 -0
  161. package/map/client/components/styles/KLayerStyleAction.vue +59 -12
  162. package/map/client/components/styles/KStyleEditor.vue +71 -8
  163. package/map/client/components/styles/KStyleEditorSection.vue +82 -33
  164. package/map/client/components/styles/KStyleManager.vue +119 -59
  165. package/map/client/components/styles/KStylePreview.vue +9 -25
  166. package/map/client/components/styles/KStylePreviewItem.vue +22 -1
  167. package/map/client/components/tools/KSearchTool.vue +1 -1
  168. package/map/client/components/widget/KElevationProfile.vue +20 -17
  169. package/map/client/components/widget/KInformationBox.vue +5 -5
  170. package/map/client/components/widget/KMapillaryViewer.vue +2 -1
  171. package/map/client/components/widget/KTimeSeries.vue +11 -9
  172. package/map/client/globe.js +2 -0
  173. package/map/client/i18n/map_en.json +29 -7
  174. package/map/client/i18n/map_fr.json +29 -7
  175. package/map/client/leaflet/GradientPath.js +61 -24
  176. package/map/client/leaflet/ShapeMarker.js +12 -5
  177. package/map/client/leaflet/TiledMeshLayer.js +3 -3
  178. package/map/client/leaflet/utils/utils.geojson.js +66 -8
  179. package/map/client/leaflet/utils/utils.style.js +14 -15
  180. package/map/client/mixins/globe/mixin.base-globe.js +181 -34
  181. package/map/client/mixins/globe/mixin.file-layers.js +3 -0
  182. package/map/client/mixins/globe/mixin.geojson-layers.js +179 -31
  183. package/map/client/mixins/globe/mixin.opendap-layers.js +2 -1
  184. package/map/client/mixins/globe/mixin.style.js +23 -1
  185. package/map/client/mixins/globe/mixin.tooltip.js +14 -2
  186. package/map/client/mixins/map/mixin.base-map.js +146 -58
  187. package/map/client/mixins/map/mixin.edit-layers.js +18 -15
  188. package/map/client/mixins/map/mixin.geojson-layers.js +181 -106
  189. package/map/client/mixins/map/mixin.heatmap-layers.js +3 -2
  190. package/map/client/mixins/map/mixin.map-activity.js +6 -1
  191. package/map/client/mixins/map/mixin.mapillary-layers.js +2 -1
  192. package/map/client/mixins/map/mixin.pmtiles-layers.js +3 -3
  193. package/map/client/mixins/map/mixin.tiled-mesh-layers.js +3 -2
  194. package/map/client/mixins/map/mixin.tiled-wind-layers.js +3 -2
  195. package/map/client/mixins/mixin.activity.js +197 -51
  196. package/map/client/mixins/mixin.context.js +11 -11
  197. package/map/client/mixins/mixin.feature-service.js +11 -9
  198. package/map/client/mixins/mixin.weacast.js +5 -3
  199. package/map/client/readers/reader.geojson.js +3 -1
  200. package/map/client/utils/utils.capture.js +3 -3
  201. package/map/client/utils/utils.catalog.js +9 -5
  202. package/map/client/utils/utils.features.js +120 -54
  203. package/map/client/utils/utils.js +25 -10
  204. package/map/client/utils/utils.layers.js +148 -24
  205. package/map/client/utils/utils.location.js +26 -9
  206. package/map/client/utils/utils.schema.js +2 -1
  207. package/map/client/utils/utils.style.js +53 -9
  208. package/map/common/geotiff-grid-source.js +1 -3
  209. package/map/common/opendap-utils.js +0 -1
  210. package/map/common/tms-utils.js +0 -1
  211. package/map/common/wcs-utils.js +0 -1
  212. package/map/common/wfs-utils.js +0 -1
  213. package/map/common/wms-utils.js +7 -1
  214. package/map/common/wmts-utils.js +0 -1
  215. package/package.json +12 -12
  216. package/scripts/init_runner.sh +3 -3
  217. package/scripts/kash/CHANGELOG.md +27 -0
  218. package/scripts/kash/kash.sh +556 -237
  219. package/scripts/kash/scripts/run_tests.sh +44 -5
  220. package/scripts/setup_workspace.sh +23 -13
  221. package/test/api/core/config/default.cjs +2 -1
  222. package/test/api/core/tags.test.js +62 -0
  223. package/test/api/map/config/default.cjs +2 -1
  224. package/test/api/map/config/layers.json +9 -0
  225. package/test/api/map/data/openradiation.json +13811 -0
  226. package/test/api/map/grid-sources.test.js +1 -3
  227. package/test/api/map/index.test.js +60 -1
  228. package/test/api/map/style.test.js +30 -1
  229. package/test.api.js +1 -1
  230. package/vite/App.vue +18 -0
  231. package/vite/AppWithGlobe.vue +84 -0
  232. package/vite/GlobeActivity.vue +58 -0
  233. package/vite/MapActivity.vue +63 -0
  234. package/vite/MapActivityWithGlobe.vue +63 -0
  235. package/vite/README.md +169 -0
  236. package/vite/config.js +221 -0
  237. package/vite/index_with_globe.html +50 -0
  238. package/vite/index_with_map.html +50 -0
  239. package/vite/package.json +173 -0
  240. package/vite/quasar.variables.scss +17 -0
  241. package/vite/vite.config.js +166 -0
  242. package/vite/yarn.lock +11641 -0
  243. package/core/client/components/media/KImageViewer.vue +0 -68
  244. package/core/client/components/media/KMarkdownViewer.vue +0 -55
  245. package/core/client/components/media/KMediaBrowser.vue +0 -301
  246. package/coverage/base.css +0 -224
  247. package/coverage/block-navigation.js +0 -87
  248. package/coverage/core/api/application.js.html +0 -1870
  249. package/coverage/core/api/authentication.js.html +0 -874
  250. package/coverage/core/api/db.js.html +0 -793
  251. package/coverage/core/api/hooks/hooks.authentication.js.html +0 -139
  252. package/coverage/core/api/hooks/hooks.authorisations.js.html +0 -958
  253. package/coverage/core/api/hooks/hooks.groups.js.html +0 -229
  254. package/coverage/core/api/hooks/hooks.logger.js.html +0 -163
  255. package/coverage/core/api/hooks/hooks.model.js.html +0 -967
  256. package/coverage/core/api/hooks/hooks.organisations.js.html +0 -541
  257. package/coverage/core/api/hooks/hooks.push.js.html +0 -265
  258. package/coverage/core/api/hooks/hooks.query.js.html +0 -862
  259. package/coverage/core/api/hooks/hooks.schemas.js.html +0 -298
  260. package/coverage/core/api/hooks/hooks.service.js.html +0 -319
  261. package/coverage/core/api/hooks/hooks.storage.js.html +0 -193
  262. package/coverage/core/api/hooks/hooks.users.js.html +0 -595
  263. package/coverage/core/api/hooks/index.html +0 -266
  264. package/coverage/core/api/hooks/index.js.html +0 -115
  265. package/coverage/core/api/index.html +0 -176
  266. package/coverage/core/api/index.js.html +0 -148
  267. package/coverage/core/api/marshall.js.html +0 -448
  268. package/coverage/core/api/models/groups.model.mongodb.js.html +0 -109
  269. package/coverage/core/api/models/index.html +0 -131
  270. package/coverage/core/api/models/messages.model.mongodb.js.html +0 -121
  271. package/coverage/core/api/models/organisations.model.mongodb.js.html +0 -94
  272. package/coverage/core/api/models/tags.model.mongodb.js.html +0 -115
  273. package/coverage/core/api/models/users.model.mongodb.js.html +0 -115
  274. package/coverage/core/api/services/account/account.hooks.js.html +0 -208
  275. package/coverage/core/api/services/account/account.service.js.html +0 -436
  276. package/coverage/core/api/services/account/index.html +0 -131
  277. package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +0 -184
  278. package/coverage/core/api/services/authorisations/authorisations.service.js.html +0 -520
  279. package/coverage/core/api/services/authorisations/index.html +0 -131
  280. package/coverage/core/api/services/databases/databases.hooks.js.html +0 -193
  281. package/coverage/core/api/services/databases/databases.service.js.html +0 -100
  282. package/coverage/core/api/services/databases/index.html +0 -131
  283. package/coverage/core/api/services/groups/groups.hooks.js.html +0 -178
  284. package/coverage/core/api/services/groups/index.html +0 -116
  285. package/coverage/core/api/services/import-export/import-export.hooks.js.html +0 -184
  286. package/coverage/core/api/services/import-export/import-export.service.js.html +0 -118
  287. package/coverage/core/api/services/import-export/index.html +0 -131
  288. package/coverage/core/api/services/index.html +0 -116
  289. package/coverage/core/api/services/index.js.html +0 -532
  290. package/coverage/core/api/services/mailer/index.html +0 -131
  291. package/coverage/core/api/services/mailer/mailer.hooks.js.html +0 -190
  292. package/coverage/core/api/services/mailer/mailer.service.js.html +0 -118
  293. package/coverage/core/api/services/messages/index.html +0 -116
  294. package/coverage/core/api/services/messages/messages.hooks.js.html +0 -202
  295. package/coverage/core/api/services/organisations/index.html +0 -131
  296. package/coverage/core/api/services/organisations/organisations.hooks.js.html +0 -178
  297. package/coverage/core/api/services/organisations/organisations.service.js.html +0 -343
  298. package/coverage/core/api/services/push/index.html +0 -131
  299. package/coverage/core/api/services/push/push.hooks.js.html +0 -190
  300. package/coverage/core/api/services/push/push.service.js.html +0 -121
  301. package/coverage/core/api/services/storage/index.html +0 -131
  302. package/coverage/core/api/services/storage/storage.hooks.js.html +0 -190
  303. package/coverage/core/api/services/storage/storage.service.js.html +0 -172
  304. package/coverage/core/api/services/tags/index.html +0 -116
  305. package/coverage/core/api/services/tags/tags.hooks.js.html +0 -178
  306. package/coverage/core/api/services/users/index.html +0 -131
  307. package/coverage/core/api/services/users/users.hooks.js.html +0 -310
  308. package/coverage/core/api/services/users/users.service.js.html +0 -100
  309. package/coverage/core/api/utils.js.html +0 -118
  310. package/coverage/core/common/errors.js.html +0 -88
  311. package/coverage/core/common/index.html +0 -191
  312. package/coverage/core/common/index.js.html +0 -115
  313. package/coverage/core/common/permissions.js.html +0 -733
  314. package/coverage/core/common/schema.js.html +0 -190
  315. package/coverage/core/common/utils.js.html +0 -226
  316. package/coverage/core/common/utils.offline.js.html +0 -199
  317. package/coverage/favicon.png +0 -0
  318. package/coverage/index.html +0 -476
  319. package/coverage/lcov-report/base.css +0 -224
  320. package/coverage/lcov-report/block-navigation.js +0 -87
  321. package/coverage/lcov-report/core/api/application.js.html +0 -1870
  322. package/coverage/lcov-report/core/api/authentication.js.html +0 -874
  323. package/coverage/lcov-report/core/api/db.js.html +0 -793
  324. package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +0 -139
  325. package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +0 -958
  326. package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +0 -229
  327. package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +0 -163
  328. package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +0 -967
  329. package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +0 -541
  330. package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +0 -265
  331. package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +0 -862
  332. package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +0 -298
  333. package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +0 -319
  334. package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +0 -193
  335. package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +0 -595
  336. package/coverage/lcov-report/core/api/hooks/index.html +0 -266
  337. package/coverage/lcov-report/core/api/hooks/index.js.html +0 -115
  338. package/coverage/lcov-report/core/api/index.html +0 -176
  339. package/coverage/lcov-report/core/api/index.js.html +0 -148
  340. package/coverage/lcov-report/core/api/marshall.js.html +0 -448
  341. package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +0 -109
  342. package/coverage/lcov-report/core/api/models/index.html +0 -131
  343. package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +0 -121
  344. package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +0 -94
  345. package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +0 -115
  346. package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +0 -115
  347. package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +0 -208
  348. package/coverage/lcov-report/core/api/services/account/account.service.js.html +0 -436
  349. package/coverage/lcov-report/core/api/services/account/index.html +0 -131
  350. package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +0 -184
  351. package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +0 -520
  352. package/coverage/lcov-report/core/api/services/authorisations/index.html +0 -131
  353. package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +0 -193
  354. package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +0 -100
  355. package/coverage/lcov-report/core/api/services/databases/index.html +0 -131
  356. package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +0 -178
  357. package/coverage/lcov-report/core/api/services/groups/index.html +0 -116
  358. package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +0 -184
  359. package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +0 -118
  360. package/coverage/lcov-report/core/api/services/import-export/index.html +0 -131
  361. package/coverage/lcov-report/core/api/services/index.html +0 -116
  362. package/coverage/lcov-report/core/api/services/index.js.html +0 -532
  363. package/coverage/lcov-report/core/api/services/mailer/index.html +0 -131
  364. package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +0 -190
  365. package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +0 -118
  366. package/coverage/lcov-report/core/api/services/messages/index.html +0 -116
  367. package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +0 -202
  368. package/coverage/lcov-report/core/api/services/organisations/index.html +0 -131
  369. package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +0 -178
  370. package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +0 -343
  371. package/coverage/lcov-report/core/api/services/push/index.html +0 -131
  372. package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +0 -190
  373. package/coverage/lcov-report/core/api/services/push/push.service.js.html +0 -121
  374. package/coverage/lcov-report/core/api/services/storage/index.html +0 -131
  375. package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +0 -190
  376. package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +0 -172
  377. package/coverage/lcov-report/core/api/services/tags/index.html +0 -116
  378. package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +0 -178
  379. package/coverage/lcov-report/core/api/services/users/index.html +0 -131
  380. package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +0 -310
  381. package/coverage/lcov-report/core/api/services/users/users.service.js.html +0 -100
  382. package/coverage/lcov-report/core/api/utils.js.html +0 -118
  383. package/coverage/lcov-report/core/common/errors.js.html +0 -88
  384. package/coverage/lcov-report/core/common/index.html +0 -191
  385. package/coverage/lcov-report/core/common/index.js.html +0 -115
  386. package/coverage/lcov-report/core/common/permissions.js.html +0 -733
  387. package/coverage/lcov-report/core/common/schema.js.html +0 -190
  388. package/coverage/lcov-report/core/common/utils.js.html +0 -226
  389. package/coverage/lcov-report/core/common/utils.offline.js.html +0 -199
  390. package/coverage/lcov-report/favicon.png +0 -0
  391. package/coverage/lcov-report/index.html +0 -476
  392. package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +0 -553
  393. package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +0 -397
  394. package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +0 -1294
  395. package/coverage/lcov-report/map/api/hooks/index.html +0 -161
  396. package/coverage/lcov-report/map/api/hooks/index.js.html +0 -94
  397. package/coverage/lcov-report/map/api/index.html +0 -131
  398. package/coverage/lcov-report/map/api/index.js.html +0 -139
  399. package/coverage/lcov-report/map/api/marshall.js.html +0 -178
  400. package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +0 -106
  401. package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +0 -169
  402. package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +0 -196
  403. package/coverage/lcov-report/map/api/models/index.html +0 -176
  404. package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +0 -109
  405. package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +0 -112
  406. package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +0 -274
  407. package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +0 -610
  408. package/coverage/lcov-report/map/api/services/alerts/index.html +0 -131
  409. package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +0 -328
  410. package/coverage/lcov-report/map/api/services/catalog/index.html +0 -116
  411. package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +0 -1510
  412. package/coverage/lcov-report/map/api/services/daptiles/index.html +0 -116
  413. package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +0 -310
  414. package/coverage/lcov-report/map/api/services/features/features.service.js.html +0 -544
  415. package/coverage/lcov-report/map/api/services/features/index.html +0 -131
  416. package/coverage/lcov-report/map/api/services/index.html +0 -116
  417. package/coverage/lcov-report/map/api/services/index.js.html +0 -1054
  418. package/coverage/lcov-report/map/api/services/projects/index.html +0 -116
  419. package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +0 -439
  420. package/coverage/lcov-report/map/api/services/styles/index.html +0 -116
  421. package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +0 -196
  422. package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +0 -466
  423. package/coverage/lcov-report/map/common/errors.js.html +0 -94
  424. package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +0 -544
  425. package/coverage/lcov-report/map/common/grid.js.html +0 -1612
  426. package/coverage/lcov-report/map/common/index.html +0 -371
  427. package/coverage/lcov-report/map/common/index.js.html +0 -172
  428. package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +0 -556
  429. package/coverage/lcov-report/map/common/moment-utils.js.html +0 -157
  430. package/coverage/lcov-report/map/common/opendap-grid-source.js.html +0 -868
  431. package/coverage/lcov-report/map/common/opendap-utils.js.html +0 -826
  432. package/coverage/lcov-report/map/common/permissions.js.html +0 -130
  433. package/coverage/lcov-report/map/common/time-based-grid-source.js.html +0 -418
  434. package/coverage/lcov-report/map/common/tms-utils.js.html +0 -274
  435. package/coverage/lcov-report/map/common/wcs-grid-source.js.html +0 -364
  436. package/coverage/lcov-report/map/common/wcs-utils.js.html +0 -586
  437. package/coverage/lcov-report/map/common/weacast-grid-source.js.html +0 -1033
  438. package/coverage/lcov-report/map/common/wfs-utils.js.html +0 -574
  439. package/coverage/lcov-report/map/common/wms-utils.js.html +0 -451
  440. package/coverage/lcov-report/map/common/wmts-utils.js.html +0 -547
  441. package/coverage/lcov-report/prettify.css +0 -1
  442. package/coverage/lcov-report/prettify.js +0 -2
  443. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  444. package/coverage/lcov-report/sorter.js +0 -196
  445. package/coverage/lcov.info +0 -11520
  446. package/coverage/map/api/hooks/hooks.catalog.js.html +0 -553
  447. package/coverage/map/api/hooks/hooks.features.js.html +0 -397
  448. package/coverage/map/api/hooks/hooks.query.js.html +0 -1294
  449. package/coverage/map/api/hooks/index.html +0 -161
  450. package/coverage/map/api/hooks/index.js.html +0 -94
  451. package/coverage/map/api/index.html +0 -131
  452. package/coverage/map/api/index.js.html +0 -139
  453. package/coverage/map/api/marshall.js.html +0 -178
  454. package/coverage/map/api/models/alerts.model.mongodb.js.html +0 -106
  455. package/coverage/map/api/models/catalog.model.mongodb.js.html +0 -169
  456. package/coverage/map/api/models/features.model.mongodb.js.html +0 -196
  457. package/coverage/map/api/models/index.html +0 -176
  458. package/coverage/map/api/models/projects.model.mongodb.js.html +0 -109
  459. package/coverage/map/api/models/styles.model.mongodb.js.html +0 -112
  460. package/coverage/map/api/services/alerts/alerts.hooks.js.html +0 -274
  461. package/coverage/map/api/services/alerts/alerts.service.js.html +0 -610
  462. package/coverage/map/api/services/alerts/index.html +0 -131
  463. package/coverage/map/api/services/catalog/catalog.hooks.js.html +0 -328
  464. package/coverage/map/api/services/catalog/index.html +0 -116
  465. package/coverage/map/api/services/daptiles/daptiles.service.js.html +0 -1510
  466. package/coverage/map/api/services/daptiles/index.html +0 -116
  467. package/coverage/map/api/services/features/features.hooks.js.html +0 -310
  468. package/coverage/map/api/services/features/features.service.js.html +0 -544
  469. package/coverage/map/api/services/features/index.html +0 -131
  470. package/coverage/map/api/services/index.html +0 -116
  471. package/coverage/map/api/services/index.js.html +0 -1054
  472. package/coverage/map/api/services/projects/index.html +0 -116
  473. package/coverage/map/api/services/projects/projects.hooks.js.html +0 -439
  474. package/coverage/map/api/services/styles/index.html +0 -116
  475. package/coverage/map/api/services/styles/styles.hooks.js.html +0 -196
  476. package/coverage/map/common/dynamic-grid-source.js.html +0 -466
  477. package/coverage/map/common/errors.js.html +0 -94
  478. package/coverage/map/common/geotiff-grid-source.js.html +0 -544
  479. package/coverage/map/common/grid.js.html +0 -1612
  480. package/coverage/map/common/index.html +0 -371
  481. package/coverage/map/common/index.js.html +0 -172
  482. package/coverage/map/common/meteo-model-grid-source.js.html +0 -556
  483. package/coverage/map/common/moment-utils.js.html +0 -157
  484. package/coverage/map/common/opendap-grid-source.js.html +0 -868
  485. package/coverage/map/common/opendap-utils.js.html +0 -826
  486. package/coverage/map/common/permissions.js.html +0 -130
  487. package/coverage/map/common/time-based-grid-source.js.html +0 -418
  488. package/coverage/map/common/tms-utils.js.html +0 -274
  489. package/coverage/map/common/wcs-grid-source.js.html +0 -364
  490. package/coverage/map/common/wcs-utils.js.html +0 -586
  491. package/coverage/map/common/weacast-grid-source.js.html +0 -1033
  492. package/coverage/map/common/wfs-utils.js.html +0 -574
  493. package/coverage/map/common/wms-utils.js.html +0 -451
  494. package/coverage/map/common/wmts-utils.js.html +0 -547
  495. package/coverage/prettify.css +0 -1
  496. package/coverage/prettify.js +0 -2
  497. package/coverage/sort-arrow-sprite.png +0 -0
  498. package/coverage/sorter.js +0 -196
  499. package/coverage/tmp/coverage-151198-1753351220086-0.json +0 -1
  500. package/coverage/tmp/coverage-151210-1753351220070-0.json +0 -1
  501. package/coverage/tmp/coverage-151221-1753351129816-0.json +0 -1
  502. package/coverage/tmp/coverage-151233-1753351129803-0.json +0 -1
  503. package/coverage/tmp/coverage-151240-1753351129770-0.json +0 -1
  504. package/coverage/tmp/coverage-151307-1753351220058-0.json +0 -1
  505. package/coverage/tmp/coverage-151319-1753351220044-0.json +0 -1
  506. package/coverage/tmp/coverage-151326-1753351220010-0.json +0 -1
  507. package/extras/tours/core/account-profile.js +0 -32
  508. package/extras/tours/core/account.js +0 -143
  509. package/extras/tours/core/add-member.js +0 -75
  510. package/extras/tours/core/add-tag.js +0 -13
  511. package/extras/tours/core/create-group.js +0 -19
  512. package/extras/tours/core/create-organisation.js +0 -19
  513. package/extras/tours/core/create-tag.js +0 -26
  514. package/extras/tours/core/edit-member-role.js +0 -13
  515. package/extras/tours/core/groups.js +0 -65
  516. package/extras/tours/core/join-group.js +0 -13
  517. package/extras/tours/core/login.js +0 -41
  518. package/extras/tours/core/members.js +0 -108
  519. package/extras/tours/core/register.js +0 -61
  520. package/extras/tours/core/send-reset-password.js +0 -14
  521. package/extras/tours/core/tags.js +0 -65
  522. package/extras/tours/map/catalog-panel.js +0 -112
  523. package/extras/tours/map/fab.js +0 -26
  524. package/extras/tours/map/navigation-bar.js +0 -187
  525. package/extras/tours/map/side-nav.js +0 -36
  526. package/test/api/core/test-log-2025-02-05.log +0 -23
  527. package/test/api/core/test-log-2025-05-21.log +0 -15
  528. package/test/api/core/test-log-2025-06-25.log +0 -9
  529. package/test/api/core/test-log-2025-07-24.log +0 -44
  530. package/test/api/map/test-log-2025-05-27.log +0 -13
  531. package/test/api/map/test-log-2025-06-23.log +0 -7
  532. package/test/api/map/test-log-2025-07-24.log +0 -11
  533. package/test/client/core/api.js +0 -361
  534. package/test/client/core/index.js +0 -9
  535. package/test/client/index.js +0 -4
  536. package/test/client/map/index.js +0 -5
  537. package/test.client.js +0 -1
  538. /package/{test/client/core/time.js → extras/tests/core/time.mjs} +0 -0
  539. /package/extras/tours/{map/add-layer.js → add-layer.js} +0 -0
  540. /package/extras/tours/{map/catalog-categories.js → catalog-categories.js} +0 -0
  541. /package/extras/tours/{map/connect-layer.js → connect-layer.js} +0 -0
  542. /package/extras/tours/{map/create-layer.js → create-layer.js} +0 -0
  543. /package/extras/tours/{map/create-view.js → create-view.js} +0 -0
  544. /package/extras/tours/{map/import-layer.js → import-layer.js} +0 -0
  545. /package/extras/tours/{map/timeline.js → pane.bottom.js} +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * JSTS. See https://github.com/bjornharrtell/jsts
3
+ * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EDLv1.txt
4
+ * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EPLv1.txt
5
+ * @license
6
+ */
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jsts={})}(this,(function(t){"use strict";class e{static equalsWithTolerance(t,e,s){return Math.abs(t-e)<=s}}class s extends Error{constructor(t){super(t),this.name=Object.keys({Exception:s})[0]}toString(){return this.message}}class n extends s{constructor(t){super(t),this.name=Object.keys({IllegalArgumentException:n})[0]}}class i{constructor(t,e){this.low=e||0,this.high=t||0}static toBinaryString(t){let e,s="";for(e=2147483648;e>0;e>>>=1)s+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)s+=(t.low&e)===e?"1":"0";return s}}function r(){}function o(){}function l(){}r.NaN=NaN,r.isNaN=t=>Number.isNaN(t),r.isInfinite=t=>!Number.isFinite(t),r.MAX_VALUE=Number.MAX_VALUE,r.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,r.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,"function"==typeof Float64Array&&"function"==typeof Int32Array?function(){const t=2146435072,e=new Float64Array(1),s=new Int32Array(e.buffer);r.doubleToLongBits=function(n){e[0]=n;let r=0|s[0],o=0|s[1];return(o&t)===t&&1048575&o&&0!==r&&(r=0,o=2146959360),new i(o,r)},r.longBitsToDouble=function(t){return s[0]=t.low,s[1]=t.high,e[0]}}():function(){const t=1023,e=Math.log2,s=Math.floor,n=Math.pow,o=function(){for(let t=53;t>0;t--){const i=n(2,t)-1;if(s(e(i))+1===t)return i}return 0}();r.doubleToLongBits=function(r){let l,a,c,h,u,g,d,_,p;if(r<0||1/r===Number.NEGATIVE_INFINITY?(g=1<<31,r=-r):g=0,0===r)return p=0,_=g,new i(_,p);if(r===1/0)return p=0,_=2146435072|g,new i(_,p);if(r!=r)return p=0,_=2146959360,new i(_,p);if(h=0,p=0,l=s(r),l>1)if(l<=o)h=s(e(l)),h<=20?(p=0,_=l<<20-h&1048575):(c=h-20,a=n(2,c),p=l%a<<32-c,_=l/a&1048575);else for(c=l,p=0;a=c/2,c=s(a),0!==c;)h++,p>>>=1,p|=(1&_)<<31,_>>>=1,a!==c&&(_|=524288);if(d=h+t,u=0===l,l=r-l,h<52&&0!==l)for(c=0;;){if(a=2*l,a>=1?(l=a-1,u?(d--,u=!1):(c<<=1,c|=1,h++)):(l=a,u?0==--d&&(h++,u=!1):(c<<=1,h++)),20===h)_|=c,c=0;else if(52===h){p|=c;break}if(1===a){h<20?_|=c<<20-h:h<52&&(p|=c<<52-h);break}}return _|=d<<20,_|=g,new i(_,p)},r.longBitsToDouble=function(e){let s,i,r,o;const l=e.high,a=e.low,c=l&1<<31?-1:1;for(r=((2146435072&l)>>20)-t,o=0,i=1<<19,s=1;s<=20;s++)l&i&&(o+=n(2,-s)),i>>>=1;for(i=1<<31,s=21;s<=52;s++)a&i&&(o+=n(2,-s)),i>>>=1;if(-1023===r){if(0===o)return 0*c;r=-1022}else{if(1024===r)return 0===o?c/0:NaN;o+=1}return c*o*n(2,r)}}();class a extends s{constructor(t){super(t),this.name=Object.keys({RuntimeException:a})[0]}}class c extends a{constructor(){super(),c.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)a.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];a.constructor_.call(this,t)}}}class h{static isTrue(){if(1===arguments.length){const t=arguments[0];h.isTrue(t,null)}else if(2===arguments.length){const t=arguments[1];if(!arguments[0])throw null===t?new c:new c(t)}}static shouldNeverReachHere(){if(0===arguments.length)h.shouldNeverReachHere(null);else if(1===arguments.length){const t=arguments[0];throw new c("Should never reach here"+(null!==t?": "+t:""))}}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];h.equals(t,e,null)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(!e.equals(t))throw new c("Expected "+t+" but encountered "+e+(null!==s?": "+s:""))}}}function u(){}function g(){}const d=new ArrayBuffer(8),_=new Float64Array(d),p=new Int32Array(d);class m{constructor(){m.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)m.constructor_.call(this,0,0);else if(1===arguments.length){const t=arguments[0];m.constructor_.call(this,t.x,t.y,t.getZ())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];m.constructor_.call(this,t,e,m.NULL_ORDINATE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.x=t,this.y=e,this.z=s}}static hashCode(t){return _[0]=t,p[0]^p[1]}equals2D(){if(1===arguments.length){const t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){const t=arguments[0],s=arguments[1];return!!e.equalsWithTolerance(this.x,t.x,s)&&!!e.equalsWithTolerance(this.y,t.y,s)}}setM(t){throw new n("Invalid ordinate index: "+m.M)}equals3D(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||r.isNaN(this.getZ())&&r.isNaN(t.getZ()))}setX(t){this.x=t}compareTo(t){const e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}getX(){return this.x}copy(){return new m(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}distance3D(t){const e=this.x-t.x,s=this.y-t.y,n=this.getZ()-t.getZ();return Math.sqrt(e*e+s*s+n*n)}getY(){return this.y}getM(){return r.NaN}setOrdinate(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.setZ(e);break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return this.z}getOrdinate(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.getZ()}throw new n("Invalid ordinate index: "+t)}equals(t){return t instanceof m&&this.equals2D(t)}equalInZ(t,s){return e.equalsWithTolerance(this.getZ(),t.getZ(),s)}setZ(t){this.z=t}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return h.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}setY(t){this.y=t}distance(t){const e=this.x-t.x,s=this.y-t.y;return Math.sqrt(e*e+s*s)}hashCode(){let t=17;return t=37*t+m.hashCode(this.x),t=37*t+m.hashCode(this.y),t}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}get interfaces_(){return[o,u,l]}}class f{constructor(){f.constructor_.apply(this,arguments)}static constructor_(){if(this._dimensionsToTest=2,0===arguments.length)f.constructor_.call(this,2);else if(1===arguments.length){const t=arguments[0];if(2!==t&&3!==t)throw new n("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}static compare(t,e){return t<e?-1:t>e?1:r.isNaN(t)?r.isNaN(e)?0:-1:r.isNaN(e)?1:0}compare(t,e){const s=f.compare(t.x,e.x);if(0!==s)return s;const n=f.compare(t.y,e.y);if(0!==n)return n;if(this._dimensionsToTest<=2)return 0;return f.compare(t.getZ(),e.getZ())}get interfaces_(){return[g]}}m.DimensionalComparator=f,m.NULL_ORDINATE=r.NaN,m.X=0,m.Y=1,m.Z=2,m.M=3;class y extends m{constructor(){super(),y.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)m.constructor_.call(this);else if(1===arguments.length){if(arguments[0]instanceof y){const t=arguments[0];m.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t.x,t.y)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];m.constructor_.call(this,t,e,m.NULL_ORDINATE)}}setOrdinate(t,e){switch(t){case y.X:this.x=e;break;case y.Y:this.y=e;break;default:throw new n("Invalid ordinate index: "+t)}}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new y(this)}toString(){return"("+this.x+", "+this.y+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}getZ(){return m.NULL_ORDINATE}getOrdinate(t){switch(t){case y.X:return this.x;case y.Y:return this.y}throw new n("Invalid ordinate index: "+t)}}y.X=0,y.Y=1,y.Z=-1,y.M=-1;class x extends m{constructor(){super(),x.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)m.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof x){const t=arguments[0];m.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t.x,t.y),this._m=this.getM()}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];m.constructor_.call(this,t,e,m.NULL_ORDINATE),this._m=s}}setM(t){this._m=t}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new x(this)}toString(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}getM(){return this._m}setOrdinate(t,e){switch(t){case x.X:this.x=e;break;case x.Y:this.y=e;break;case x.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return m.NULL_ORDINATE}getOrdinate(t){switch(t){case x.X:return this.x;case x.Y:return this.y;case x.M:return this._m}throw new n("Invalid ordinate index: "+t)}}x.X=0,x.Y=1,x.Z=-1,x.M=2;class E extends m{constructor(){super(),E.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)m.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof E){const t=arguments[0];m.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t),this._m=this.getM()}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];m.constructor_.call(this,t,e,s),this._m=n}}setM(t){this._m=t}getOrdinate(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.getZ();case m.M:return this.getM()}throw new n("Invalid ordinate index: "+t)}copy(){return new E(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}getM(){return this._m}setOrdinate(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.z=e;break;case m.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}}function I(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}class N{add(){}addAll(){}isEmpty(){}iterator(){}size(){}toArray(){}remove(){}}class w extends s{constructor(t){super(t),this.name=Object.keys({IndexOutOfBoundsException:w})[0]}}class C extends N{get(){}set(){}isEmpty(){}}class S extends s{constructor(t){super(t),this.name=Object.keys({NoSuchElementException:S})[0]}}class L extends C{constructor(t){super(),this.array=[],t instanceof N&&this.addAll(t)}get interfaces_(){return[C,N]}ensureCapacity(){}add(t){return 1===arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}clear(){this.array=[]}addAll(t){for(const e of t)this.array.push(e)}set(t,e){const s=this.array[t];return this.array[t]=e,s}iterator(){return new T(this)}get(t){if(t<0||t>=this.size())throw new w;return this.array[t]}isEmpty(){return 0===this.array.length}sort(t){t?this.array.sort(((e,s)=>t.compare(e,s))):this.array.sort()}size(){return this.array.length}toArray(){return this.array.slice()}remove(t){for(let e=0,s=this.array.length;e<s;e++)if(this.array[e]===t)return!!this.array.splice(e,1);return!1}[Symbol.iterator](){return this.array.values()}}let T=class{constructor(t){this.arrayList=t,this.position=0}next(){if(this.position===this.arrayList.size())throw new S;return this.arrayList.get(this.position++)}hasNext(){return this.position<this.arrayList.size()}set(t){return this.arrayList.set(this.position-1,t)}remove(){this.arrayList.remove(this.arrayList.get(this.position))}};class R extends L{constructor(){super(),R.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.ensureCapacity(t.length),this.add(t,e)}}getCoordinate(t){return this.get(t)}addAll(){if(2===arguments.length&&"boolean"==typeof arguments[1]&&I(arguments[0],N)){const t=arguments[1];let e=!1;for(let s=arguments[0].iterator();s.hasNext();)this.add(s.next(),t),e=!0;return e}return super.addAll.apply(this,arguments)}clone(){const t=super.clone.call(this);for(let e=0;e<this.size();e++)t.add(e,this.get(e).clone());return t}closeRing(){if(this.size()>0){const t=this.get(0).copy();this.add(t,!1)}}toCoordinateArray(){if(0===arguments.length)return this.toArray(R.coordArrayType);if(1===arguments.length){if(arguments[0])return this.toArray(R.coordArrayType);const t=this.size(),e=new Array(t).fill(null);for(let s=0;s<t;s++)e[s]=this.get(t-s-1);return e}}add(){if(1===arguments.length){const t=arguments[0];return super.add.call(this,t)}if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e,!0),!0}if(arguments[0]instanceof m&&"boolean"==typeof arguments[1]){const t=arguments[0];if(!arguments[1]&&this.size()>=1){if(this.get(this.size()-1).equals2D(t))return null}super.add.call(this,t)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(arguments[2])for(let s=0;s<t.length;s++)this.add(t[s],e);else for(let s=t.length-1;s>=0;s--)this.add(t[s],e);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];if(!arguments[2]){const s=this.size();if(s>0){if(t>0){if(this.get(t-1).equals2D(e))return null}if(t<s){if(this.get(t).equals2D(e))return null}}}super.add.call(this,t,e)}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];let i=1;s>n&&(i=-1);for(let r=s;r!==n;r+=i)this.add(t[r],e);return!0}}}R.coordArrayType=new Array(0).fill(null);class P{filter(t,e){}isGeometryChanged(){}isDone(){}}class O{constructor(){O.constructor_.apply(this,arguments)}static constructor_(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];this.init(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this.init(t,e,s,n)}}static intersects(){if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return s.x>=(t.x<e.x?t.x:e.x)&&s.x<=(t.x>e.x?t.x:e.x)&&s.y>=(t.y<e.y?t.y:e.y)&&s.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];let i=Math.min(s.x,n.x),r=Math.max(s.x,n.x),o=Math.min(t.x,e.x),l=Math.max(t.x,e.x);return!(o>r)&&(!(l<i)&&(i=Math.min(s.y,n.y),r=Math.max(s.y,n.y),o=Math.min(t.y,e.y),l=Math.max(t.y,e.y),!(o>r)&&!(l<i)))}}getArea(){return this.getWidth()*this.getHeight()}getMinX(){return this._minx}expandToInclude(){if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];if(t.isNull())return null;this.isNull()?(this._minx=t.getMinX(),this._maxx=t.getMaxX(),this._miny=t.getMinY(),this._maxy=t.getMaxY()):(t._minx<this._minx&&(this._minx=t._minx),t._maxx>this._maxx&&(this._maxx=t._maxx),t._miny<this._miny&&(this._miny=t._miny),t._maxy>this._maxy&&(this._maxy=t._maxy))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.isNull()?(this._minx=t,this._maxx=t,this._miny=e,this._maxy=e):(t<this._minx&&(this._minx=t),t>this._maxx&&(this._maxx=t),e<this._miny&&(this._miny=e),e>this._maxy&&(this._maxy=e))}}compareTo(t){const e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}translate(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}copy(){return new O(this)}expandBy(){if(1===arguments.length){const t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}contains(){if(1===arguments.length){if(arguments[0]instanceof O){const t=arguments[0];return this.covers(t)}if(arguments[0]instanceof m){const t=arguments[0];return this.covers(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.covers(t,e)}}hashCode(){let t=17;return t=37*t+m.hashCode(this._minx),t=37*t+m.hashCode(this._maxx),t=37*t+m.hashCode(this._miny),t=37*t+m.hashCode(this._maxy),t}equals(t){if(!(t instanceof O))return!1;const e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}intersection(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new O;const e=this._minx>t._minx?this._minx:t._minx,s=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new O(e,n,s,i)}isNull(){return this._maxx<this._minx}getMaxX(){return this._maxx}covers(){if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof O){const t=arguments[0];return!this.isNull()&&!t.isNull()&&(t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return!this.isNull()&&(t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy)}}intersects(){if(1===arguments.length){if(arguments[0]instanceof O){const t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof m){const t=arguments[0];return this.intersects(t.x,t.y)}}else if(2===arguments.length){if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];if(this.isNull())return!1;if((t.x<e.x?t.x:e.x)>this._maxx)return!1;if((t.x>e.x?t.x:e.x)<this._minx)return!1;if((t.y<e.y?t.y:e.y)>this._maxy)return!1;return!((t.y>e.y?t.y:e.y)<this._miny)}if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return!this.isNull()&&!(t>this._maxx||t<this._minx||e>this._maxy||e<this._miny)}}}getMinY(){return this._miny}getDiameter(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}minExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return t<e?t:e}getWidth(){return this.isNull()?0:this._maxx-this._minx}toString(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}setToNull(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}disjoint(t){return!(!this.isNull()&&!t.isNull())||(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}getHeight(){return this.isNull()?0:this._maxy-this._miny}maxExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return t>e?t:e}centre(){return this.isNull()?null:new m((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}init(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];t<e?(this._minx=t,this._maxx=e):(this._minx=e,this._maxx=t),s<n?(this._miny=s,this._maxy=n):(this._miny=n,this._maxy=s)}}getMaxY(){return this._maxy}distance(t){if(this.intersects(t))return 0;let e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);let s=0;return this._maxy<t._miny?s=t._miny-this._maxy:this._miny>t._maxy&&(s=this._miny-t._maxy),0===e?s:0===s?e:Math.sqrt(e*e+s*s)}get interfaces_(){return[o,l]}}class v{constructor(t){this.str=t}append(t){this.str+=t}setCharAt(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}toString(){return this.str}}class M{constructor(t){this.value=t}intValue(){return this.value}compareTo(t){return this.value<t?-1:this.value>t?1:0}static compare(t,e){return t<e?-1:t>e?1:0}static isNan(t){return Number.isNaN(t)}static valueOf(t){return new M(t)}}class b{static isWhitespace(t){return t<=32&&t>=0||127===t}static toUpperCase(t){return t.toUpperCase()}}class D extends s{constructor(t){super(t),this.name=Object.keys({IllegalStateException:D})[0]}}class A{constructor(){A.constructor_.apply(this,arguments)}static constructor_(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this.init(t)}else if(arguments[0]instanceof A){const t=arguments[0];this.init(t)}else if("string"==typeof arguments[0]){const t=arguments[0];A.constructor_.call(this,A.parse(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t,e)}}static determinant(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];return A.determinant(A.valueOf(t),A.valueOf(e),A.valueOf(s),A.valueOf(n))}if(arguments[3]instanceof A&&arguments[2]instanceof A&&arguments[0]instanceof A&&arguments[1]instanceof A){const t=arguments[1],e=arguments[2],s=arguments[3];return arguments[0].multiply(s).selfSubtract(t.multiply(e))}}static sqr(t){return A.valueOf(t).selfMultiply(t)}static valueOf(){if("string"==typeof arguments[0]){const t=arguments[0];return A.parse(t)}if("number"==typeof arguments[0]){return new A(arguments[0])}}static sqrt(t){return A.valueOf(t).sqrt()}static parse(t){let e=0;const s=t.length;for(;b.isWhitespace(t.charAt(e));)e++;let n=!1;if(e<s){const s=t.charAt(e);"-"!==s&&"+"!==s||(e++,"-"===s&&(n=!0))}const i=new A;let r=0,o=0,l=0,a=!1;for(;!(e>=s);){const s=t.charAt(e);if(e++,b.isDigit(s)){const t=s-"0";i.selfMultiply(A.TEN),i.selfAdd(t),r++}else{if("."!==s){if("e"===s||"E"===s){const s=t.substring(e);try{l=M.parseInt(s)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+s+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+s+"' at position "+e+" in string "+t)}o=r,a=!0}}let c=i;a||(o=r);const h=r-o-l;if(0===h)c=i;else if(h>0){const t=A.TEN.pow(h);c=i.divide(t)}else if(h<0){const t=A.TEN.pow(-h);c=i.multiply(t)}return n?c.negate():c}static createNaN(){return new A(r.NaN,r.NaN)}static copy(t){return new A(t)}static magnitude(t){const e=Math.abs(t),s=Math.log(e)/Math.log(10);let n=Math.trunc(Math.floor(s));return 10*Math.pow(10,n)<=e&&(n+=1),n}static stringOfChar(t,e){const s=new v;for(let n=0;n<e;n++)s.append(t);return s.toString()}le(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}extractSignificantDigits(t,e){let s=this.abs(),n=A.magnitude(s._hi);const i=A.TEN.pow(n);s=s.divide(i),s.gt(A.TEN)?(s=s.divide(A.TEN),n+=1):s.lt(A.ONE)&&(s=s.multiply(A.TEN),n-=1);const r=n+1,o=new v,l=A.MAX_PRINT_DIGITS-1;for(let e=0;e<=l;e++){t&&e===r&&o.append(".");const n=Math.trunc(s._hi);if(n<0)break;let i=!1,a=0;n>9?(i=!0,a="9"):a="0"+n,o.append(a),s=s.subtract(A.valueOf(n)).multiply(A.TEN),i&&s.selfAdd(A.TEN);let c=!0;const h=A.magnitude(s._hi);if(h<0&&Math.abs(h)>=l-e&&(c=!1),!c)break}return e[0]=n,o.toString()}sqr(){return this.multiply(this)}getSpecialNumberString(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}setValue(){if(arguments[0]instanceof A){const t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){const t=arguments[0];return this.init(t),this}}multiply(){if(arguments[0]instanceof A){const t=arguments[0];return t.isNaN()?A.createNaN():A.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){const t=arguments[0];return r.isNaN(t)?A.createNaN():A.copy(this).selfMultiply(t,0)}}isNaN(){return r.isNaN(this._hi)}reciprocal(){let t=null,e=null,s=null,n=null,i=null,r=null,o=null,l=null;i=1/this._hi,r=A.SPLIT*i,t=r-i,l=A.SPLIT*this._hi,t=r-t,e=i-t,s=l-this._hi,o=i*this._hi,s=l-s,n=this._hi-s,l=t*s-o+t*n+e*s+e*n,r=(1-o-l-i*this._lo)/this._hi;const a=i+r;return new A(a,i-a+r)}doubleValue(){return this._hi+this._lo}subtract(){if(arguments[0]instanceof A){const t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){const t=arguments[0];return this.add(-t)}}equals(){if(1===arguments.length&&arguments[0]instanceof A){const t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}isZero(){return 0===this._hi&&0===this._lo}selfSubtract(){if(arguments[0]instanceof A){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}min(t){return this.le(t)?this:t}selfDivide(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfDivide(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null,a=null,c=null;return o=this._hi/t,l=A.SPLIT*o,s=l-o,c=A.SPLIT*t,s=l-s,n=o-s,i=c-t,a=o*t,i=c-i,r=t-i,c=s*i-a+s*r+n*i+n*r,l=(this._hi-a-c+this._lo-o*e)/t,c=o+l,this._hi=c,this._lo=o-c+l,this}}dump(){return"DD<"+this._hi+", "+this._lo+">"}divide(){if(arguments[0]instanceof A){const t=arguments[0];let e=null,s=null,n=null,i=null,r=null,o=null,l=null,a=null;r=this._hi/t._hi,o=A.SPLIT*r,e=o-r,a=A.SPLIT*t._hi,e=o-e,s=r-e,n=a-t._hi,l=r*t._hi,n=a-n,i=t._hi-n,a=e*n-l+e*i+s*n+s*i,o=(this._hi-l-a+this._lo-r*t._lo)/t._hi,a=r+o;return new A(a,r-a+o)}if("number"==typeof arguments[0]){const t=arguments[0];return r.isNaN(t)?A.createNaN():A.copy(this).selfDivide(t,0)}}ge(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}pow(t){if(0===t)return A.valueOf(1);let e=new A(this),s=A.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&s.selfMultiply(e),n/=2,n>0&&(e=e.sqr());else s=e;return t<0?s.reciprocal():s}ceil(){if(this.isNaN())return A.NaN;const t=Math.ceil(this._hi);let e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new A(t,e)}compareTo(t){const e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}rint(){if(this.isNaN())return this;return this.add(.5).floor()}max(t){return this.ge(t)?this:t}sqrt(){if(this.isZero())return A.valueOf(0);if(this.isNegative())return A.NaN;const t=1/Math.sqrt(this._hi),e=this._hi*t,s=A.valueOf(e),n=this.subtract(s.sqr())._hi*(.5*t);return s.add(n)}selfAdd(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];let e=null,s=null,n=null,i=null,r=null,o=null;return n=this._hi+t,r=n-this._hi,i=n-r,i=t-r+(this._hi-i),o=i+this._lo,e=n+o,s=o+(n-e),this._hi=e+s,this._lo=s+(e-this._hi),this}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null,a=null,c=null;o=this._hi+t,i=this._lo+e,a=o-this._hi,c=i-this._lo,l=o-a,r=i-c,l=t-a+(this._hi-l),r=e-c+(this._lo-r),a=l+i,s=o+a,n=a+(o-s),a=r+n;const h=s+a,u=a+(s-h);return this._hi=h,this._lo=u,this}}selfMultiply(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfMultiply(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null;o=A.SPLIT*this._hi,s=o-this._hi,l=A.SPLIT*t,s=o-s,n=this._hi-s,i=l-t,o=this._hi*t,i=l-i,r=t-i,l=s*i-o+s*r+n*i+n*r+(this._hi*e+this._lo*t);const a=o+l;s=o-a;const c=l+s;return this._hi=a,this._lo=c,this}}selfSqr(){return this.selfMultiply(this)}floor(){if(this.isNaN())return A.NaN;const t=Math.floor(this._hi);let e=0;return t===this._hi&&(e=Math.floor(this._lo)),new A(t,e)}negate(){return this.isNaN()?this:new A(-this._hi,-this._lo)}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}intValue(){return Math.trunc(this._hi)}toString(){const t=A.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}toStandardNotation(){const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),s=this.extractSignificantDigits(!0,e),n=e[0]+1;let i=s;if("."===s.charAt(0))i="0"+s;else if(n<0)i="0."+A.stringOfChar("0",-n)+s;else if(-1===s.indexOf(".")){const t=n-s.length;i=s+A.stringOfChar("0",t)+".0"}return this.isNegative()?"-"+i:i}toSciNotation(){if(this.isZero())return A.SCI_NOT_ZERO;const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),s=this.extractSignificantDigits(!1,e),n=A.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===s.charAt(0))throw new D("Found leading zero: "+s);let i="";s.length>1&&(i=s.substring(1));const r=s.charAt(0)+"."+i;return this.isNegative()?"-"+r+n:r+n}abs(){return this.isNaN()?A.NaN:this.isNegative()?this.negate():new A(this)}isPositive(){return this._hi>0||0===this._hi&&this._lo>0}lt(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}add(){if(arguments[0]instanceof A){const t=arguments[0];return A.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){const t=arguments[0];return A.copy(this).selfAdd(t)}}init(){if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof A){const t=arguments[0];this._hi=t._hi,this._lo=t._lo}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._hi=t,this._lo=e}}gt(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}isNegative(){return this._hi<0||0===this._hi&&this._lo<0}trunc(){return this.isNaN()?A.NaN:this.isPositive()?this.floor():this.ceil()}signum(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}get interfaces_(){return[l,o,u]}}A.PI=new A(3.141592653589793,12246467991473532e-32),A.TWO_PI=new A(6.283185307179586,24492935982947064e-32),A.PI_2=new A(1.5707963267948966,6123233995736766e-32),A.E=new A(2.718281828459045,14456468917292502e-32),A.NaN=new A(r.NaN,r.NaN),A.EPS=123259516440783e-46,A.SPLIT=134217729,A.MAX_PRINT_DIGITS=32,A.TEN=A.valueOf(10),A.ONE=A.valueOf(1),A.SCI_NOT_EXPONENT_CHAR="E",A.SCI_NOT_ZERO="0.0E0";class F{static orientationIndex(t,e,s){const n=F.orientationIndexFilter(t,e,s);if(n<=1)return n;const i=A.valueOf(e.x).selfAdd(-t.x),r=A.valueOf(e.y).selfAdd(-t.y),o=A.valueOf(s.x).selfAdd(-e.x),l=A.valueOf(s.y).selfAdd(-e.y);return i.selfMultiply(l).selfSubtract(r.selfMultiply(o)).signum()}static signOfDet2x2(){if(arguments[3]instanceof A&&arguments[2]instanceof A&&arguments[0]instanceof A&&arguments[1]instanceof A){const t=arguments[1],e=arguments[2],s=arguments[3];return arguments[0].multiply(s).selfSubtract(t.multiply(e)).signum()}if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=A.valueOf(t),r=A.valueOf(e),o=A.valueOf(s),l=A.valueOf(n);return i.multiply(l).selfSubtract(r.multiply(o)).signum()}}static intersection(t,e,s,n){const i=new A(t.y).selfSubtract(e.y),o=new A(e.x).selfSubtract(t.x),l=new A(t.x).selfMultiply(e.y).selfSubtract(new A(e.x).selfMultiply(t.y)),a=new A(s.y).selfSubtract(n.y),c=new A(n.x).selfSubtract(s.x),h=new A(s.x).selfMultiply(n.y).selfSubtract(new A(n.x).selfMultiply(s.y)),u=o.multiply(h).selfSubtract(c.multiply(l)),g=a.multiply(l).selfSubtract(i.multiply(h)),d=i.multiply(c).selfSubtract(a.multiply(o)),_=u.selfDivide(d).doubleValue(),p=g.selfDivide(d).doubleValue();return r.isNaN(_)||r.isInfinite(_)||r.isNaN(p)||r.isInfinite(p)?null:new m(_,p)}static orientationIndexFilter(t,e,s){let n=null;const i=(t.x-s.x)*(e.y-s.y),r=(t.y-s.y)*(e.x-s.x),o=i-r;if(i>0){if(r<=0)return F.signum(o);n=i+r}else{if(!(i<0))return F.signum(o);if(r>=0)return F.signum(o);n=-i-r}const l=F.DP_SAFE_EPSILON*n;return o>=l||-o>=l?F.signum(o):2}static signum(t){return t>0?1:t<0?-1:0}}F.DP_SAFE_EPSILON=1e-15;class G{getCoordinate(){}getCoordinateCopy(t){}createCoordinate(){}getDimension(){}hasM(){return this.getMeasures()>0}getX(t){}hasZ(){return this.getDimension()-this.getMeasures()>2}getMeasures(){return 0}expandEnvelope(t){}copy(){}getY(t){}toCoordinateArray(){}getM(t){if(this.hasM()){const e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return r.NaN}setOrdinate(t,e,s){}getZ(t){return this.hasZ()?this.getOrdinate(t,2):r.NaN}size(){}getOrdinate(t,e){}get interfaces_(){return[u]}}G.X=0,G.Y=1,G.Z=2,G.M=3;class q{static isCCW(){if(arguments[0]instanceof Array){const t=arguments[0],e=t.length-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let s=t[0],i=0;for(let n=1;n<=e;n++){const e=t[n];e.y>s.y&&(s=e,i=n)}let r=i;do{r-=1,r<0&&(r=e)}while(t[r].equals2D(s)&&r!==i);let o=i;do{o=(o+1)%e}while(t[o].equals2D(s)&&o!==i);const l=t[r],a=t[o];if(l.equals2D(s)||a.equals2D(s)||l.equals2D(a))return!1;const c=q.index(l,s,a);let h=null;return h=0===c?l.x>a.x:c>0,h}if(I(arguments[0],G)){const t=arguments[0],e=t.size()-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let s=t.getCoordinate(0),i=0;for(let n=1;n<=e;n++){const e=t.getCoordinate(n);e.y>s.y&&(s=e,i=n)}let r=null,o=i;do{o-=1,o<0&&(o=e),r=t.getCoordinate(o)}while(r.equals2D(s)&&o!==i);let l=null,a=i;do{a=(a+1)%e,l=t.getCoordinate(a)}while(l.equals2D(s)&&a!==i);if(r.equals2D(s)||l.equals2D(s)||r.equals2D(l))return!1;const c=q.index(r,s,l);let h=null;return h=0===c?r.x>l.x:c>0,h}}static index(t,e,s){return F.orientationIndex(t,e,s)}}q.CLOCKWISE=-1,q.RIGHT=q.CLOCKWISE,q.COUNTERCLOCKWISE=1,q.LEFT=q.COUNTERCLOCKWISE,q.COLLINEAR=0,q.STRAIGHT=q.COLLINEAR;class B{static intersection(t,e,s,n){const i=t.x<e.x?t.x:e.x,o=t.y<e.y?t.y:e.y,l=t.x>e.x?t.x:e.x,a=t.y>e.y?t.y:e.y,c=s.x<n.x?s.x:n.x,h=s.y<n.y?s.y:n.y,u=s.x>n.x?s.x:n.x,g=s.y>n.y?s.y:n.y,d=((i>c?i:c)+(l<u?l:u))/2,_=((o>h?o:h)+(a<g?a:g))/2,p=t.x-d,f=t.y-_,y=e.x-d,x=e.y-_,E=s.x-d,I=s.y-_,N=n.x-d,w=n.y-_,C=f-x,S=y-p,L=p*x-y*f,T=I-w,R=N-E,P=E*w-N*I,O=C*R-T*S,v=(S*P-R*L)/O,M=(T*L-C*P)/O;return r.isNaN(v)||r.isInfinite(v)||r.isNaN(M)||r.isInfinite(M)?null:new m(v+d,M+_)}}class Y{static arraycopy(t,e,s,n,i){let r=0;for(let o=e;o<e+i;o++)s[n+r]=t[o],r++}static getProperty(t){return{"line.separator":"\n"}[t]}}class z{static log10(t){const e=Math.log(t);return r.isInfinite(e)||r.isNaN(e)?e:e/z.LOG_10}static min(t,e,s,n){let i=t;return e<i&&(i=e),s<i&&(i=s),n<i&&(i=n),i}static clamp(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2];return t<e?e:t>s?s:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];return t<e?e:t>s?s:t}}static average(t,e){return(t+e)/2}static wrap(t,e){return t<0?e- -t%e:t%e}static max(){if(3===arguments.length){const t=arguments[1],e=arguments[2];let s=arguments[0];return t>s&&(s=t),e>s&&(s=e),s}if(4===arguments.length){const t=arguments[1],e=arguments[2],s=arguments[3];let n=arguments[0];return t>n&&(n=t),e>n&&(n=e),s>n&&(n=s),n}}}z.LOG_10=Math.log(10);class V{static pointToSegmentString(t,e){if(0===e.length)throw new n("Line array must contain at least one vertex");let s=t.distance(e[0]);for(let n=0;n<e.length-1;n++){const i=V.pointToSegment(t,e[n],e[n+1]);i<s&&(s=i)}return s}static segmentToSegment(t,e,s,n){if(t.equals(e))return V.pointToSegment(t,s,n);if(s.equals(n))return V.pointToSegment(n,t,e);let i=!1;if(O.intersects(t,e,s,n)){const r=(e.x-t.x)*(n.y-s.y)-(e.y-t.y)*(n.x-s.x);if(0===r)i=!0;else{const o=(t.y-s.y)*(n.x-s.x)-(t.x-s.x)*(n.y-s.y),l=((t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y))/r,a=o/r;(a<0||a>1||l<0||l>1)&&(i=!0)}}else i=!0;return i?z.min(V.pointToSegment(t,s,n),V.pointToSegment(e,s,n),V.pointToSegment(s,t,e),V.pointToSegment(n,t,e)):0}static pointToLinePerpendicular(t,e,s){const n=(s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y),i=((e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)}static pointToSegment(t,e,s){if(e.x===s.x&&e.y===s.y)return t.distance(e);const n=(s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y),i=((t.x-e.x)*(s.x-e.x)+(t.y-e.y)*(s.y-e.y))/n;if(i<=0)return t.distance(e);if(i>=1)return t.distance(s);const r=((e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y))/n;return Math.abs(r)*Math.sqrt(n)}}class k{static ofLine(t){const e=t.size();if(e<=1)return 0;let s=0;const n=new m;t.getCoordinate(0,n);let i=n.x,r=n.y;for(let o=1;o<e;o++){t.getCoordinate(o,n);const e=n.x,l=n.y,a=e-i,c=l-r;s+=Math.sqrt(a*a+c*c),i=e,r=l}return s}}class X{filter(t){}}class U extends s{constructor(t){super(t),this.name=Object.keys({UnsupportedOperationException:U})[0]}}class H{static measures(t){return t instanceof y?0:t instanceof x||t instanceof E?1:0}static create(){if(1===arguments.length){const t=arguments[0];return H.create(t,0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return 2===t?new y:3===t&&0===e?new m:3===t&&1===e?new x:4===t&&1===e?new E:new m}}static dimension(t){return t instanceof y?2:t instanceof x?3:t instanceof E?4:3}}class W{static scroll(t,e){const s=W.indexOf(e,t);if(s<0)return null;const n=new Array(t.length).fill(null);Y.arraycopy(t,s,n,0,t.length-s),Y.arraycopy(t,0,n,t.length-s,s),Y.arraycopy(n,0,t,0,t.length)}static removeRepeatedPoints(t){if(!W.hasRepeatedPoints(t))return t;return new R(t,!1).toCoordinateArray()}static reverse(t){const e=t.length-1,s=Math.trunc(e/2);for(let n=0;n<=s;n++){const s=t[n];t[n]=t[e-n],t[e-n]=s}}static removeNull(t){let e=0;for(let s=0;s<t.length;s++)null!==t[s]&&e++;const s=new Array(e).fill(null);if(0===e)return s;let n=0;for(let e=0;e<t.length;e++)null!==t[e]&&(s[n++]=t[e]);return s}static copyDeep(){if(1===arguments.length){const t=arguments[0],e=new Array(t.length).fill(null);for(let s=0;s<t.length;s++)e[s]=t[s].copy();return e}if(5===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4];for(let r=0;r<i;r++)s[n+r]=t[e+r].copy()}}static isEqualReversed(t,e){for(let s=0;s<t.length;s++){const n=t[s],i=e[t.length-s-1];if(0!==n.compareTo(i))return!1}return!0}static envelope(t){const e=new O;for(let s=0;s<t.length;s++)e.expandToInclude(t[s]);return e}static extract(t,e,s){e=z.clamp(e,0,t.length);let n=(s=z.clamp(s,-1,t.length))-e+1;s<0&&(n=0),e>=t.length&&(n=0),s<e&&(n=0);const i=new Array(n).fill(null);if(0===n)return i;let r=0;for(let n=e;n<=s;n++)i[r++]=t[n];return i}static isRing(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}static ptNotInList(t,e){for(let s=0;s<t.length;s++){const n=t[s];if(W.indexOf(n,e)<0)return n}return null}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].equals(e[s]))return!1;return!0}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(0!==s.compare(t[n],e[n]))return!1;return!0}}static intersection(t,e){const s=new R;for(let n=0;n<t.length;n++)e.intersects(t[n])&&s.add(t[n],!0);return s.toCoordinateArray()}static measures(t){if(null===t||0===t.length)return 0;let e=0;for(const s of t)e=Math.max(e,H.measures(s));return e}static hasRepeatedPoints(t){for(let e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}static toCoordinateArray(t){return t.toArray(W.coordArrayType)}static dimension(t){if(null===t||0===t.length)return 3;let e=0;for(const s of t)e=Math.max(e,H.dimension(s));return e}static atLeastNCoordinatesOrNothing(t,e){return e.length>=t?e:[]}static indexOf(t,e){for(let s=0;s<e.length;s++)if(t.equals(e[s]))return s;return-1}static increasingDirection(t){for(let e=0;e<Math.trunc(t.length/2);e++){const s=t.length-1-e,n=t[e].compareTo(t[s]);if(0!==n)return n}return 1}static compare(t,e){let s=0;for(;s<t.length&&s<e.length;){const n=t[s].compareTo(e[s]);if(0!==n)return n;s++}return s<e.length?-1:s<t.length?1:0}static minCoordinate(t){let e=null;for(let s=0;s<t.length;s++)(null===e||e.compareTo(t[s])>0)&&(e=t[s]);return e}}W.ForwardComparator=class{compare(t,e){const s=t,n=e;return W.compare(s,n)}get interfaces_(){return[g]}},W.BidirectionalComparator=class{compare(t,e){const s=t,n=e;if(s.length<n.length)return-1;if(s.length>n.length)return 1;if(0===s.length)return 0;const i=W.compare(s,n);return W.isEqualReversed(s,n)?0:i}OLDcompare(t,e){const s=t,n=e;if(s.length<n.length)return-1;if(s.length>n.length)return 1;if(0===s.length)return 0;const i=W.increasingDirection(s),r=W.increasingDirection(n);let o=i>0?0:s.length-1,l=r>0?0:s.length-1;for(let t=0;t<s.length;t++){const t=s[o].compareTo(n[l]);if(0!==t)return t;o+=i,l+=r}return 0}get interfaces_(){return[g]}},W.coordArrayType=new Array(0).fill(null);class Z{static toDimensionSymbol(t){switch(t){case Z.FALSE:return Z.SYM_FALSE;case Z.TRUE:return Z.SYM_TRUE;case Z.DONTCARE:return Z.SYM_DONTCARE;case Z.P:return Z.SYM_P;case Z.L:return Z.SYM_L;case Z.A:return Z.SYM_A}throw new n("Unknown dimension value: "+t)}static toDimensionValue(t){switch(b.toUpperCase(t)){case Z.SYM_FALSE:return Z.FALSE;case Z.SYM_TRUE:return Z.TRUE;case Z.SYM_DONTCARE:return Z.DONTCARE;case Z.SYM_P:return Z.P;case Z.SYM_L:return Z.L;case Z.SYM_A:return Z.A}throw new n("Unknown dimension symbol: "+t)}}Z.P=0,Z.L=1,Z.A=2,Z.FALSE=-1,Z.TRUE=-2,Z.DONTCARE=-3,Z.SYM_FALSE="F",Z.SYM_TRUE="T",Z.SYM_DONTCARE="*",Z.SYM_P="0",Z.SYM_L="1",Z.SYM_A="2";class j{constructor(){j.constructor_.apply(this,arguments)}isGeometryCollection(){return this.getTypeCode()===j.TYPECODE_GEOMETRYCOLLECTION}getFactory(){return this._factory}getGeometryN(t){return this}getArea(){return 0}isRectangle(){return!1}equalsExact(t){return this===t||this.equalsExact(t,0)}geometryChanged(){this.apply(j.geometryChangedFilter)}geometryChangedAction(){this._envelope=null}equalsNorm(t){return null!==t&&this.norm().equalsExact(t.norm())}getLength(){return 0}getNumGeometries(){return 1}compareTo(){let t;if(1===arguments.length){const e=arguments[0];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)}if(2===arguments.length){const e=arguments[0],s=arguments[1];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e,s)}}getUserData(){return this._userData}getSRID(){return this._SRID}getEnvelope(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}static checkNotGeometryCollection(t){if(t.getTypeCode()===j.TYPECODE_GEOMETRYCOLLECTION)throw new n("This method does not support GeometryCollection arguments")}equal(t,e,s){return 0===s?t.equals(e):t.distance(e)<=s}norm(){const t=this.copy();return t.normalize(),t}reverse(){const t=this.reverseInternal();return null!=this.envelope&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}copy(){const t=this.copyInternal();return t.envelope=null==this._envelope?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}getPrecisionModel(){return this._factory.getPrecisionModel()}getEnvelopeInternal(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new O(this._envelope)}setSRID(t){this._SRID=t}setUserData(t){this._userData=t}compare(t,e){const s=t.iterator(),n=e.iterator();for(;s.hasNext()&&n.hasNext();){const t=s.next(),e=n.next(),i=t.compareTo(e);if(0!==i)return i}return s.hasNext()?1:n.hasNext()?-1:0}hashCode(){return this.getEnvelopeInternal().hashCode()}isEquivalentClass(t){return this.getTypeCode()==t.getTypeCode()}get interfaces_(){return[u,o,l]}getClass(){return j}static hasNonEmptyElements(t){for(let e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}static hasNullElements(t){for(let e=0;e<t.length;e++)if(null===t[e])return!0;return!1}}j.constructor_=function(t){t&&(this._envelope=null,this._userData=null,this._factory=t,this._SRID=t.getSRID())},j.TYPECODE_POINT=0,j.TYPECODE_MULTIPOINT=1,j.TYPECODE_LINESTRING=2,j.TYPECODE_LINEARRING=3,j.TYPECODE_MULTILINESTRING=4,j.TYPECODE_POLYGON=5,j.TYPECODE_MULTIPOLYGON=6,j.TYPECODE_GEOMETRYCOLLECTION=7,j.TYPENAME_POINT="Point",j.TYPENAME_MULTIPOINT="MultiPoint",j.TYPENAME_LINESTRING="LineString",j.TYPENAME_LINEARRING="LinearRing",j.TYPENAME_MULTILINESTRING="MultiLineString",j.TYPENAME_POLYGON="Polygon",j.TYPENAME_MULTIPOLYGON="MultiPolygon",j.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",j.geometryChangedFilter={get interfaces_(){return[X]},filter(t){t.geometryChangedAction()}};class K{filter(t){}}class Q{}class J{static scroll(){if(2===arguments.length){if(I(arguments[0],G)&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1];J.scroll(t,e,J.isRing(t))}else if(I(arguments[0],G)&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=J.indexOf(e,t);if(s<=0)return null;J.scroll(t,s)}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(e<=0)return null;const n=t.copy(),i=s?t.size()-1:t.size();for(let s=0;s<i;s++)for(let r=0;r<t.getDimension();r++)t.setOrdinate(s,r,n.getOrdinate((e+s)%i,r));if(s)for(let e=0;e<t.getDimension();e++)t.setOrdinate(i,e,t.getOrdinate(0,e))}}static isEqual(t,e){const s=t.size();if(s!==e.size())return!1;const n=Math.min(t.getDimension(),e.getDimension());for(let i=0;i<s;i++)for(let s=0;s<n;s++){const n=t.getOrdinate(i,s),o=e.getOrdinate(i,s);if(t.getOrdinate(i,s)!==e.getOrdinate(i,s)&&(!r.isNaN(n)||!r.isNaN(o)))return!1}return!0}static minCoordinateIndex(){if(1===arguments.length){const t=arguments[0];return J.minCoordinateIndex(t,0,t.size()-1)}if(3===arguments.length){const t=arguments[0],e=arguments[2];let s=-1,n=null;for(let i=arguments[1];i<=e;i++){const e=t.getCoordinate(i);(null===n||n.compareTo(e)>0)&&(n=e,s=i)}return s}}static extend(t,e,s){const n=t.create(s,e.getDimension()),i=e.size();if(J.copy(e,0,n,0,i),i>0)for(let t=i;t<s;t++)J.copy(e,i-1,n,t,1);return n}static reverse(t){const e=t.size()-1,s=Math.trunc(e/2);for(let n=0;n<=s;n++)J.swap(t,n,e-n)}static ensureValidRing(t,e){const s=e.size();if(0===s)return e;if(s<=3)return J.createClosedRing(t,e,4);return e.getOrdinate(0,G.X)===e.getOrdinate(s-1,G.X)&&e.getOrdinate(0,G.Y)===e.getOrdinate(s-1,G.Y)?e:J.createClosedRing(t,e,s+1)}static minCoordinate(t){let e=null;for(let s=0;s<t.size();s++){const n=t.getCoordinate(s);(null===e||e.compareTo(n)>0)&&(e=n)}return e}static copyCoord(t,e,s,n){const i=Math.min(t.getDimension(),s.getDimension());for(let r=0;r<i;r++)s.setOrdinate(n,r,t.getOrdinate(e,r))}static isRing(t){const e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,G.X)===t.getOrdinate(e-1,G.X)&&t.getOrdinate(0,G.Y)===t.getOrdinate(e-1,G.Y))}static swap(t,e,s){if(e===s)return null;for(let n=0;n<t.getDimension();n++){const i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(s,n)),t.setOrdinate(s,n,i)}}static copy(t,e,s,n,i){for(let r=0;r<i;r++)J.copyCoord(t,e+r,s,n+r)}static indexOf(t,e){for(let s=0;s<e.size();s++)if(t.x===e.getOrdinate(s,G.X)&&t.y===e.getOrdinate(s,G.Y))return s;return-1}static createClosedRing(t,e,s){const n=t.create(s,e.getDimension()),i=e.size();J.copy(e,0,n,0,i);for(let t=i;t<s;t++)J.copy(e,0,n,t,1);return n}}class ${filter(t){}}class tt extends j{constructor(){super(),tt.constructor_.apply(this,arguments)}static constructor_(){if(this._points=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];j.constructor_.call(this,e),this.init(t)}}computeEnvelopeInternal(){return this.isEmpty()?new O:this._points.expandEnvelope(new O)}isRing(){return this.isClosed()&&W.isRing(this.getCoordinates())}getCoordinates(){return this._points.toCoordinateArray()}copyInternal(){return new tt(this._points.copy(),this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const s=t;if(this._points.size()!==s._points.size())return!1;for(let t=0;t<this._points.size();t++)if(!this.equal(this._points.getCoordinate(t),s._points.getCoordinate(t),e))return!1;return!0}return super.equalsExact.apply(this,arguments)}isClosed(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}reverseInternal(){const t=this._points.copy();return J.reverse(t),this.getFactory().createLineString(t)}getEndPoint(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}getTypeCode(){return j.TYPECODE_LINESTRING}getDimension(){return 1}getBoundary(){throw new U}isEquivalentClass(t){return t instanceof tt}getCoordinateSequence(){return this._points}getPointN(t){return this.getFactory().createPoint(this._points.getCoordinate(t))}normalize(){for(let t=0;t<Math.trunc(this._points.size()/2);t++){const e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e))){if(this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0){const t=this._points.copy();J.reverse(t),this._points=t}return null}}}getCoordinate(){return this.isEmpty()?null:this._points.getCoordinate(0)}getBoundaryDimension(){return this.isClosed()?Z.FALSE:0}getLength(){return k.ofLine(this._points)}getNumPoints(){return this._points.size()}compareToSameClass(){if(1===arguments.length){const t=arguments[0];let e=0,s=0;for(;e<this._points.size()&&s<t._points.size();){const n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(s));if(0!==n)return n;e++,s++}return e<this._points.size()?1:s<t._points.size()?-1:0}if(2===arguments.length){const t=arguments[0];return arguments[1].compare(this._points,t._points)}}apply(){if(I(arguments[0],K)){const t=arguments[0];for(let e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e))}else if(I(arguments[0],P)){const t=arguments[0];if(0===this._points.size())return null;for(let e=0;e<this._points.size()&&(t.filter(this._points,e),!t.isDone());e++);t.isGeometryChanged()&&this.geometryChanged()}else if(I(arguments[0],$)){arguments[0].filter(this)}else if(I(arguments[0],X)){arguments[0].filter(this)}}getCoordinateN(t){return this._points.getCoordinate(t)}getGeometryType(){return j.TYPENAME_LINESTRING}isEmpty(){return 0===this._points.size()}init(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new n("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t}isCoordinate(t){for(let e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1}getStartPoint(){return this.isEmpty()?null:this.getPointN(0)}get interfaces_(){return[Q]}}class et extends tt{constructor(){super(),et.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];tt.constructor_.call(this,t,e),this.validateConstruction()}copyInternal(){return new et(this._points.copy(),this._factory)}getBoundaryDimension(){return Z.FALSE}isClosed(){return!!this.isEmpty()||super.isClosed.call(this)}reverseInternal(){const t=this._points.copy();return J.reverse(t),this.getFactory().createLinearRing(t)}getTypeCode(){return j.TYPECODE_LINEARRING}validateConstruction(){if(!this.isEmpty()&&!super.isClosed.call(this))throw new n("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<et.MINIMUM_VALID_SIZE)throw new n("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}getGeometryType(){return j.TYPENAME_LINEARRING}}et.MINIMUM_VALID_SIZE=4;class st{create(){if(1===arguments.length)arguments[0]instanceof Array||I(arguments[0],G);else if(2===arguments.length);else if(3===arguments.length){const t=arguments[0],e=arguments[1];return this.create(t,e)}}}class nt{constructor(t){this.str=t}append(t){this.str+=t}setCharAt(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}toString(){return this.str}}class it{constructor(){it.constructor_.apply(this,arguments)}static constructor_(){if(this._dimension=3,this._measures=0,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];it.constructor_.call(this,t,W.dimension(t),W.measures(t))}else if(Number.isInteger(arguments[0])){const t=arguments[0];this._coordinates=new Array(t).fill(null);for(let e=0;e<t;e++)this._coordinates[e]=new m}else if(I(arguments[0],G)){const t=arguments[0];if(null===t)return this._coordinates=new Array(0).fill(null),null;this._dimension=t.getDimension(),this._measures=t.getMeasures(),this._coordinates=new Array(t.size()).fill(null);for(let e=0;e<this._coordinates.length;e++)this._coordinates[e]=t.getCoordinateCopy(e)}}else if(2===arguments.length){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1];it.constructor_.call(this,t,e,W.measures(t))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1];this._coordinates=new Array(t).fill(null),this._dimension=e;for(let s=0;s<t;s++)this._coordinates[s]=H.create(e)}}else if(3===arguments.length)if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];this._dimension=e,this._measures=s,this._coordinates=null===t?new Array(0).fill(null):t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];this._coordinates=new Array(t).fill(null),this._dimension=e,this._measures=s;for(let e=0;e<t;e++)this._coordinates[e]=this.createCoordinate()}}getCoordinate(){if(1===arguments.length){const t=arguments[0];return this._coordinates[t]}if(2===arguments.length){const t=arguments[0];arguments[1].setCoordinate(this._coordinates[t])}}getCoordinateCopy(t){const e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}createCoordinate(){return H.create(this.getDimension(),this.getMeasures())}getDimension(){return this._dimension}getX(t){return this._coordinates[t].x}getMeasures(){return this._measures}expandEnvelope(t){for(let e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}copy(){const t=new Array(this.size()).fill(null);for(let e=0;e<this._coordinates.length;e++){const s=this.createCoordinate();s.setCoordinate(this._coordinates[e]),t[e]=s}return new it(t,this._dimension,this._measures)}toString(){if(this._coordinates.length>0){const t=new nt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(let e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}getY(t){return this._coordinates[t].y}toCoordinateArray(){return this._coordinates}getM(t){return this.hasM()?this._coordinates[t].getM():r.NaN}setOrdinate(t,e,s){switch(e){case G.X:this._coordinates[t].x=s;break;case G.Y:this._coordinates[t].y=s;break;default:this._coordinates[t].setOrdinate(e,s)}}getZ(t){return this.hasZ()?this._coordinates[t].getZ():r.NaN}size(){return this._coordinates.length}getOrdinate(t,e){switch(e){case G.X:return this._coordinates[t].x;case G.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}get interfaces_(){return[G,l]}}class rt{static instance(){return rt.instanceObject}readResolve(){return rt.instance()}create(){if(1===arguments.length){if(arguments[0]instanceof Array){return new it(arguments[0])}if(I(arguments[0],G)){return new it(arguments[0])}}else{if(2===arguments.length){let t=arguments[1];return t>3&&(t=3),t<2&&(t=2),new it(arguments[0],t)}if(3===arguments.length){let t=arguments[2],e=arguments[1]-t;return t>1&&(t=1),e>3&&(e=3),e<2&&(e=2),new it(arguments[0],e+t,t)}}}get interfaces_(){return[st,l]}}rt.instanceObject=new rt;class ot extends N{contains(){}}class lt extends ot{}class at extends lt{constructor(t){super(),this.array=[],t instanceof N&&this.addAll(t)}contains(t){for(const e of this.array)if(0===e.compareTo(t))return!0;return!1}add(t){if(this.contains(t))return!1;for(let e=0,s=this.array.length;e<s;e++){if(1===this.array[e].compareTo(t))return!!this.array.splice(e,0,t)}return this.array.push(t),!0}addAll(t){for(const e of t)this.add(e);return!0}remove(){throw new U}size(){return this.array.length}isEmpty(){return 0===this.array.length}toArray(){return this.array.slice()}iterator(){return new ct(this.array)}}let ct=class{constructor(t){this.array=t,this.position=0}next(){if(this.position===this.array.length)throw new S;return this.array[this.position++]}hasNext(){return this.position<this.array.length}remove(){throw new U}};class ht{static sort(){const t=arguments[0];if(1===arguments.length)t.sort(((t,e)=>t.compareTo(e)));else if(2===arguments.length)t.sort(((t,e)=>arguments[1].compare(t,e)));else if(3===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort();const s=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of s)t.push(e)}else if(4===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort(((t,e)=>arguments[3].compare(t,e)));const s=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of s)t.push(e)}}static asList(t){const e=new L;for(const s of t)e.add(s);return e}static copyOf(t,e){return t.slice(0,e)}}class ut extends j{constructor(){super(),ut.constructor_.apply(this,arguments)}static constructor_(){if(this._geometries=null,0===arguments.length);else if(2===arguments.length){let t=arguments[0],e=arguments[1];if(j.constructor_.call(this,e),null===t&&(t=[]),j.hasNullElements(t))throw new n("geometries must not contain null elements");this._geometries=t}}computeEnvelopeInternal(){const t=new O;for(let e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t}getGeometryN(t){return this._geometries[t]}getCoordinates(){const t=new Array(this.getNumPoints()).fill(null);let e=-1;for(let s=0;s<this._geometries.length;s++){const n=this._geometries[s].getCoordinates();for(let s=0;s<n.length;s++)e++,t[e]=n[s]}return t}getArea(){let t=0;for(let e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new ut(t,this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const s=t;if(this._geometries.length!==s._geometries.length)return!1;for(let t=0;t<this._geometries.length;t++)if(!this._geometries[t].equalsExact(s._geometries[t],e))return!1;return!0}return super.equalsExact.apply(this,arguments)}reverseInternal(){const t=this._geometries.length,e=new L(t);for(let s=0;s<t;s++)e.add(this._geometries[s].reverse());return this.getFactory().buildGeometry(e)}getTypeCode(){return j.TYPECODE_GEOMETRYCOLLECTION}getDimension(){let t=Z.FALSE;for(let e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t}getNumGeometries(){return this._geometries.length}getBoundary(){return j.checkNotGeometryCollection(this),h.shouldNeverReachHere(),null}getGeometryType(){return j.TYPENAME_GEOMETRYCOLLECTION}isEmpty(){for(let t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0}normalize(){for(let t=0;t<this._geometries.length;t++)this._geometries[t].normalize();ht.sort(this._geometries)}getCoordinate(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}getBoundaryDimension(){let t=Z.FALSE;for(let e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t}getLength(){let t=0;for(let e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t}getNumPoints(){let t=0;for(let e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t}compareToSameClass(){if(1===arguments.length){const t=arguments[0],e=new at(ht.asList(this._geometries)),s=new at(ht.asList(t._geometries));return this.compare(e,s)}if(2===arguments.length){const t=arguments[1],e=arguments[0],s=this.getNumGeometries(),n=e.getNumGeometries();let i=0;for(;i<s&&i<n;){const s=this.getGeometryN(i),n=e.getGeometryN(i),r=s.compareToSameClass(n,t);if(0!==r)return r;i++}return i<s?1:i<n?-1:0}}apply(){if(I(arguments[0],K)){const t=arguments[0];for(let e=0;e<this._geometries.length;e++)this._geometries[e].apply(t)}else if(I(arguments[0],P)){const t=arguments[0];if(0===this._geometries.length)return null;for(let e=0;e<this._geometries.length&&(this._geometries[e].apply(t),!t.isDone());e++);t.isGeometryChanged()&&this.geometryChanged()}else if(I(arguments[0],$)){const t=arguments[0];t.filter(this);for(let e=0;e<this._geometries.length;e++)this._geometries[e].apply(t)}else if(I(arguments[0],X)){const t=arguments[0];t.filter(this);for(let e=0;e<this._geometries.length;e++)this._geometries[e].apply(t)}}}class gt{}class dt extends ut{constructor(){super(),dt.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ut.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new dt(t,this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&super.equalsExact.call(this,t,e)}return super.equalsExact.apply(this,arguments)}getBoundaryDimension(){return 1}getTypeCode(){return j.TYPECODE_MULTIPOLYGON}getDimension(){return 2}getBoundary(){if(this.isEmpty())return this.getFactory().createMultiLineString();const t=new L;for(let e=0;e<this._geometries.length;e++){const s=this._geometries[e].getBoundary();for(let e=0;e<s.getNumGeometries();e++)t.add(s.getGeometryN(e))}const e=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(e))}getGeometryType(){return j.TYPENAME_MULTIPOLYGON}get interfaces_(){return[gt]}}let _t=class{get(){}put(){}size(){}values(){}entrySet(){}};class pt extends ot{constructor(t){super(),this.map=new Map,t instanceof N&&this.addAll(t)}contains(t){const e=t.hashCode?t.hashCode():t;return!!this.map.has(e)}add(t){const e=t.hashCode?t.hashCode():t;return!this.map.has(e)&&!!this.map.set(e,t)}addAll(t){for(const e of t)this.add(e);return!0}remove(){throw new U}size(){return this.map.size}isEmpty(){return 0===this.map.size}toArray(){return Array.from(this.map.values())}iterator(){return new mt(this.map)}[Symbol.iterator](){return this.map}}let mt=class{constructor(t){this.iterator=t.values();const{done:e,value:s}=this.iterator.next();this.done=e,this.value=s}next(){if(this.done)throw new S;const t=this.value,{done:e,value:s}=this.iterator.next();return this.done=e,this.value=s,t}hasNext(){return!this.done}remove(){throw new U}};class ft extends _t{constructor(){super(),this.map=new Map}get(t){return this.map.get(t)||null}put(t,e){return this.map.set(t,e),e}values(){const t=new L,e=this.map.values();let s=e.next();for(;!s.done;)t.add(s.value),s=e.next();return t}entrySet(){const t=new pt;return this.map.entries().forEach((e=>t.add(e))),t}size(){return this.map.size()}}class yt{constructor(){yt.constructor_.apply(this,arguments)}static constructor_(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=yt.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof xt){const t=arguments[0];this._modelType=t,t===yt.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){const t=arguments[0];this._modelType=yt.FIXED,this.setScale(t)}else if(arguments[0]instanceof yt){const t=arguments[0];this._modelType=t._modelType,this._scale=t._scale}}static mostPrecise(t,e){return t.compareTo(e)>=0?t:e}equals(t){if(!(t instanceof yt))return!1;const e=t;return this._modelType===e._modelType&&this._scale===e._scale}compareTo(t){const e=t,s=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return M.compare(s,n)}getType(){return this._modelType}toString(){let t="UNKNOWN";return this._modelType===yt.FLOATING?t="Floating":this._modelType===yt.FLOATING_SINGLE?t="Floating-Single":this._modelType===yt.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}makePrecise(){if("number"==typeof arguments[0]){const t=arguments[0];if(r.isNaN(t))return t;if(this._modelType===yt.FLOATING_SINGLE){return t}return this._modelType===yt.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof m){const t=arguments[0];if(this._modelType===yt.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}getMaximumSignificantDigits(){let t=16;return this._modelType===yt.FLOATING?t=16:this._modelType===yt.FLOATING_SINGLE?t=6:this._modelType===yt.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}setScale(t){this._scale=Math.abs(t)}getScale(){return this._scale}isFloating(){return this._modelType===yt.FLOATING||this._modelType===yt.FLOATING_SINGLE}get interfaces_(){return[l,o]}}class xt{constructor(){xt.constructor_.apply(this,arguments)}static constructor_(){this._name=null;const t=arguments[0];this._name=t,xt.nameToTypeMap.put(t,this)}readResolve(){return xt.nameToTypeMap.get(this._name)}toString(){return this._name}get interfaces_(){return[l]}}xt.nameToTypeMap=new ft,yt.Type=xt,yt.FIXED=new xt("FIXED"),yt.FLOATING=new xt("FLOATING"),yt.FLOATING_SINGLE=new xt("FLOATING SINGLE"),yt.maximumPreciseValue=9007199254740992;class Et extends ut{constructor(){super(),Et.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ut.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new Et(t,this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&super.equalsExact.call(this,t,e)}return super.equalsExact.apply(this,arguments)}getBoundaryDimension(){return this.isClosed()?Z.FALSE:0}isClosed(){if(this.isEmpty())return!1;for(let t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0}getTypeCode(){return j.TYPECODE_MULTILINESTRING}getDimension(){return 1}getBoundary(){throw new U}getGeometryType(){return j.TYPENAME_MULTILINESTRING}get interfaces_(){return[Q]}}class It{}class Nt extends j{constructor(){super(),Nt.constructor_.apply(this,arguments)}static constructor_(){this._coordinates=null;const t=arguments[0],e=arguments[1];j.constructor_.call(this,e),this.init(t)}computeEnvelopeInternal(){if(this.isEmpty())return new O;const t=new O;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t}getCoordinates(){return this.isEmpty()?[]:[this.getCoordinate()]}copyInternal(){return new Nt(this._coordinates.copy(),this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))}return super.equalsExact.apply(this,arguments)}reverseInternal(){return this.getFactory().createPoint(this._coordinates.copy())}getTypeCode(){return j.TYPECODE_POINT}getDimension(){return 0}getNumPoints(){return this.isEmpty()?0:1}getX(){if(null===this.getCoordinate())throw new D("getX called on empty Point");return this.getCoordinate().x}getBoundary(){return this.getFactory().createGeometryCollection()}getGeometryType(){return j.TYPENAME_POINT}getCoordinateSequence(){return this._coordinates}getY(){if(null===this.getCoordinate())throw new D("getY called on empty Point");return this.getCoordinate().y}isSimple(){return!0}normalize(){}getCoordinate(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null}getBoundaryDimension(){return Z.FALSE}compareToSameClass(){if(1===arguments.length){const t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){const t=arguments[0];return arguments[1].compare(this._coordinates,t._coordinates)}}apply(){if(I(arguments[0],K)){const t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(I(arguments[0],P)){const t=arguments[0];if(this.isEmpty())return null;t.filter(this._coordinates,0),t.isGeometryChanged()&&this.geometryChanged()}else if(I(arguments[0],$)){arguments[0].filter(this)}else if(I(arguments[0],X)){arguments[0].filter(this)}}isEmpty(){return 0===this._coordinates.size()}init(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),h.isTrue(t.size()<=1),this._coordinates=t}get interfaces_(){return[It]}}class wt{static ofRingSigned(){if(arguments[0]instanceof Array){const t=arguments[0];if(t.length<3)return 0;let e=0;const s=t[0].x;for(let n=1;n<t.length-1;n++){const i=t[n].x-s,r=t[n+1].y;e+=i*(t[n-1].y-r)}return e/2}if(I(arguments[0],G)){const t=arguments[0],e=t.size();if(e<3)return 0;const s=new m,n=new m,i=new m;t.getCoordinate(0,n),t.getCoordinate(1,i);const r=n.x;i.x-=r;let o=0;for(let l=1;l<e-1;l++)s.y=n.y,n.x=i.x,n.y=i.y,t.getCoordinate(l+1,i),i.x-=r,o+=n.x*(s.y-i.y);return o/2}}static ofRing(){if(arguments[0]instanceof Array){const t=arguments[0];return Math.abs(wt.ofRingSigned(t))}if(I(arguments[0],G)){const t=arguments[0];return Math.abs(wt.ofRingSigned(t))}}}class Ct extends j{constructor(){super(),Ct.constructor_.apply(this,arguments)}static constructor_(){this._shell=null,this._holes=null;let t=arguments[0],e=arguments[1],s=arguments[2];if(j.constructor_.call(this,s),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),j.hasNullElements(e))throw new n("holes must not contain null elements");if(t.isEmpty()&&j.hasNonEmptyElements(e))throw new n("shell is empty but holes are not");this._shell=t,this._holes=e}computeEnvelopeInternal(){return this._shell.getEnvelopeInternal()}getCoordinates(){if(this.isEmpty())return[];const t=new Array(this.getNumPoints()).fill(null);let e=-1;const s=this._shell.getCoordinates();for(let n=0;n<s.length;n++)e++,t[e]=s[n];for(let s=0;s<this._holes.length;s++){const n=this._holes[s].getCoordinates();for(let s=0;s<n.length;s++)e++,t[e]=n[s]}return t}getArea(){let t=0;t+=wt.ofRing(this._shell.getCoordinateSequence());for(let e=0;e<this._holes.length;e++)t-=wt.ofRing(this._holes[e].getCoordinateSequence());return t}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const s=t,n=this._shell,i=s._shell;if(!n.equalsExact(i,e))return!1;if(this._holes.length!==s._holes.length)return!1;for(let t=0;t<this._holes.length;t++)if(!this._holes[t].equalsExact(s._holes[t],e))return!1;return!0}return super.equalsExact.apply(this,arguments)}reverseInternal(){const t=this.getExteriorRing().reverse(),e=new Array(this.getNumInteriorRing()).fill(null);for(let t=0;t<e.length;t++)e[t]=this.getInteriorRingN(t).reverse();return this.getFactory().createPolygon(t,e)}getTypeCode(){return j.TYPECODE_POLYGON}getDimension(){return 2}getBoundary(){if(this.isEmpty())return this.getFactory().createMultiLineString();const t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(let e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)}getGeometryType(){return j.TYPENAME_POLYGON}getExteriorRing(){return this._shell}copyInternal(){const t=this._shell.copy(),e=new Array(this._holes.length).fill(null);for(let t=0;t<this._holes.length;t++)e[t]=this._holes[t].copy();return new Ct(t,e,this._factory)}isRectangle(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;const t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal();for(let s=0;s<5;s++){const n=t.getX(s);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;const i=t.getY(s);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}let s=t.getX(0),n=t.getY(0);for(let e=1;e<=4;e++){const i=t.getX(e),r=t.getY(e);if(i!==s===(r!==n))return!1;s=i,n=r}return!0}normalize(){if(0===arguments.length){this._shell=this.normalized(this._shell,!0);for(let t=0;t<this._holes.length;t++)this._holes[t]=this.normalized(this._holes[t],!1);ht.sort(this._holes)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(t.isEmpty())return null;const s=t.getCoordinateSequence(),n=J.minCoordinateIndex(s,0,s.size()-2);J.scroll(s,n,!0),q.isCCW(s)===e&&J.reverse(s)}}getCoordinate(){return this._shell.getCoordinate()}getNumInteriorRing(){return this._holes.length}getBoundaryDimension(){return 1}getLength(){let t=0;t+=this._shell.getLength();for(let e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t}getNumPoints(){let t=this._shell.getNumPoints();for(let e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t}convexHull(){return this.getExteriorRing().convexHull()}normalized(t,e){const s=t.copy();return this.normalize(s,e),s}compareToSameClass(){if(1===arguments.length){const t=arguments[0],e=this._shell,s=t._shell;return e.compareToSameClass(s)}if(2===arguments.length){const t=arguments[1],e=arguments[0],s=this._shell,n=e._shell,i=s.compareToSameClass(n,t);if(0!==i)return i;const r=this.getNumInteriorRing(),o=e.getNumInteriorRing();let l=0;for(;l<r&&l<o;){const s=this.getInteriorRingN(l),n=e.getInteriorRingN(l),i=s.compareToSameClass(n,t);if(0!==i)return i;l++}return l<r?1:l<o?-1:0}}apply(){if(I(arguments[0],K)){const t=arguments[0];this._shell.apply(t);for(let e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(I(arguments[0],P)){const t=arguments[0];if(this._shell.apply(t),!t.isDone())for(let e=0;e<this._holes.length&&(this._holes[e].apply(t),!t.isDone());e++);t.isGeometryChanged()&&this.geometryChanged()}else if(I(arguments[0],$)){arguments[0].filter(this)}else if(I(arguments[0],X)){const t=arguments[0];t.filter(this),this._shell.apply(t);for(let e=0;e<this._holes.length;e++)this._holes[e].apply(t)}}isEmpty(){return this._shell.isEmpty()}getInteriorRingN(t){return this._holes[t]}get interfaces_(){return[gt]}}class St extends ut{constructor(){super(),St.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ut.constructor_.call(this,t,e)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&super.equalsExact.call(this,t,e)}return super.equalsExact.apply(this,arguments)}getTypeCode(){return j.TYPECODE_MULTIPOINT}getDimension(){return 0}getBoundary(){return this.getFactory().createGeometryCollection()}getGeometryType(){return j.TYPENAME_MULTIPOINT}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new St(t,this._factory)}isValid(){return!0}getCoordinate(){if(1===arguments.length&&Number.isInteger(arguments[0])){const t=arguments[0];return this._geometries[t].getCoordinate()}return super.getCoordinate.apply(this,arguments)}getBoundaryDimension(){return Z.FALSE}get interfaces_(){return[It]}}class Lt{constructor(){Lt.constructor_.apply(this,arguments)}static constructor_(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,0===arguments.length)Lt.constructor_.call(this,new yt,0);else if(1===arguments.length){if(I(arguments[0],st)){const t=arguments[0];Lt.constructor_.call(this,new yt,0,t)}else if(arguments[0]instanceof yt){const t=arguments[0];Lt.constructor_.call(this,t,0,Lt.getDefaultCoordinateSequenceFactory())}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];Lt.constructor_.call(this,t,e,Lt.getDefaultCoordinateSequenceFactory())}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._precisionModel=t,this._coordinateSequenceFactory=s,this._SRID=e}}static toMultiPolygonArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toGeometryArray(t){if(null===t)return null;const e=new Array(t.size()).fill(null);return t.toArray(e)}static getDefaultCoordinateSequenceFactory(){return rt.instance()}static toMultiLineStringArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toLineStringArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toMultiPointArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toLinearRingArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toPointArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static toPolygonArray(t){const e=new Array(t.size()).fill(null);return t.toArray(e)}static createPointFromInternalCoord(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}createEmpty(t){switch(t){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new n("Invalid dimension: "+t)}}toGeometry(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new m(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new m(t.getMinX(),t.getMinY()),new m(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new m(t.getMinX(),t.getMinY()),new m(t.getMinX(),t.getMaxY()),new m(t.getMaxX(),t.getMaxY()),new m(t.getMaxX(),t.getMinY()),new m(t.getMinX(),t.getMinY())]),null)}createLineString(){if(0===arguments.length)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];return this.createLineString(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(I(arguments[0],G)){return new tt(arguments[0],this)}}}createMultiLineString(){if(0===arguments.length)return new Et(null,this);if(1===arguments.length){return new Et(arguments[0],this)}}createPolygon(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(I(arguments[0],G)){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof et){const t=arguments[0];return this.createPolygon(t,null)}}else if(2===arguments.length){return new Ct(arguments[0],arguments[1],this)}}getSRID(){return this._SRID}createGeometryCollection(){if(0===arguments.length)return new ut(null,this);if(1===arguments.length){return new ut(arguments[0],this)}}getPrecisionModel(){return this._precisionModel}createLinearRing(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(I(arguments[0],G)){return new et(arguments[0],this)}}}createMultiPolygon(){if(0===arguments.length)return new dt(null,this);if(1===arguments.length){return new dt(arguments[0],this)}}createMultiPoint(){if(0===arguments.length)return new St(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){return new St(arguments[0],this)}if(I(arguments[0],G)){const t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));const e=new Array(t.size()).fill(null);for(let s=0;s<t.size();s++){const n=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());J.copy(t,s,n,0,1),e[s]=this.createPoint(n)}return this.createMultiPoint(e)}}}buildGeometry(t){let e=null,s=!1,n=!1;for(let i=t.iterator();i.hasNext();){const t=i.next(),r=t.getTypeCode();null===e&&(e=r),r!==e&&(s=!0),t instanceof ut&&(n=!0)}if(null===e)return this.createGeometryCollection();if(s||n)return this.createGeometryCollection(Lt.toGeometryArray(t));const i=t.iterator().next();if(t.size()>1){if(i instanceof Ct)return this.createMultiPolygon(Lt.toPolygonArray(t));if(i instanceof tt)return this.createMultiLineString(Lt.toLineStringArray(t));if(i instanceof Nt)return this.createMultiPoint(Lt.toPointArray(t));h.shouldNeverReachHere("Unhandled geometry type: "+i.getGeometryType())}return i}createMultiPointFromCoords(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}createPoint(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(I(arguments[0],G)){return new Nt(arguments[0],this)}}}getCoordinateSequenceFactory(){return this._coordinateSequenceFactory}get interfaces_(){return[l]}}const Tt="XY",Rt="XYZ",Pt="XYM",Ot="XYZM",vt={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},Mt="EMPTY",bt=1,Dt=2,At=3,Ft=4,Gt=5,qt=6;for(const t in vt)vt[t].toUpperCase();class Bt{constructor(t){this.wkt=t,this.index_=-1}isAlpha_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let s,n=t;if("("==t)s=Dt;else if(","==t)s=Gt;else if(")"==t)s=At;else if(this.isNumeric_(t)||"-"==t)s=Ft,n=this.readNumber_();else if(this.isAlpha_(t))s=bt,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);s=qt}return{position:e,value:n,type:s}}readNumber_(){let t;const e=this.index_;let s=!1,n=!1;do{"."==t?s=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,s)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class Yt{constructor(t,e){this.lexer_=t,this.token_,this.layout_=Tt,this.factory=e}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){this.consume_();return this.parseGeometry_()}parseGeometryLayout_(){let t=Tt;const e=this.token_;if(this.isTokenType(bt)){const s=e.value;"Z"===s?t=Rt:"M"===s?t=Pt:"ZM"===s&&(t=Ot),t!==Tt&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(Dt)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(Gt));if(this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(Dt)){const t=this.parsePoint_();if(this.match(At))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(Dt)){const t=this.parsePointList_();if(this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(Dt)){const t=this.parseLineStringTextList_();if(this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(Dt)){let t;if(t=this.token_.type==Dt?this.parsePointTextList_():this.parsePointList_(),this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(Dt)){const t=this.parseLineStringTextList_();if(this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(Dt)){const t=this.parsePolygonTextList_();if(this.match(At))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let s=0;s<e;++s){const e=this.token_;if(!this.match(Ft))break;t.push(e.value)}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())}parsePointList_(){const t=[this.parsePoint_()];for(;this.match(Gt);)t.push(this.parsePoint_());return t}parsePointTextList_(){const t=[this.parsePointText_()];for(;this.match(Gt);)t.push(this.parsePointText_());return t}parseLineStringTextList_(){const t=[this.parseLineStringText_()];for(;this.match(Gt);)t.push(this.parseLineStringText_());return t}parsePolygonTextList_(){const t=[this.parsePolygonText_()];for(;this.match(Gt);)t.push(this.parsePolygonText_());return t}isEmptyGeometry_(){const t=this.isTokenType(bt)&&this.token_.value==Mt;return t&&this.consume_(),t}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const t=this.factory,e=t=>t?new m(...t):new m,s=s=>{const n=s.map((s=>t.createLinearRing(s.map(e))));return n.length>1?t.createPolygon(n[0],n.slice(1)):1===n.length?t.createPolygon(n[0]):t.createPolygon()},n=this.token_;if(this.match(bt)){const i=n.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==i){const e=this.parseGeometryCollectionText_();return t.createGeometryCollection(e)}switch(i){case"POINT":{const e=this.parsePointText_();return e?t.createPoint(new m(...e)):t.createPoint()}case"LINESTRING":{const s=this.parseLineStringText_().map(e);return t.createLineString(s)}case"LINEARRING":{const s=this.parseLineStringText_().map(e);return t.createLinearRing(s)}case"POLYGON":{const e=this.parsePolygonText_();return e&&0!==e.length?s(e):t.createPolygon()}case"MULTIPOINT":{const s=this.parseMultiPointText_();if(!s||0===s.length)return t.createMultiPoint();const n=s.map(e).map((e=>t.createPoint(e)));return t.createMultiPoint(n)}case"MULTILINESTRING":{const s=this.parseMultiLineStringText_().map((s=>t.createLineString(s.map(e))));return t.createMultiLineString(s)}case"MULTIPOLYGON":{const e=this.parseMultiPolygonText_();if(!e||0===e.length)return t.createMultiPolygon();const n=e.map(s);return t.createMultiPolygon(n)}default:throw new Error("Invalid geometry type: "+i)}}throw new Error(this.formatErrorMessage_())}}function zt(t){if(t.isEmpty())return"";const e=t.getCoordinate(),s=[e.x,e.y];return void 0===e.z||Number.isNaN(e.z)||s.push(e.z),void 0===e.m||Number.isNaN(e.m)||s.push(e.m),s.join(" ")}function Vt(t){const e=t.getCoordinates().map((t=>{const e=[t.x,t.y];return void 0===t.z||Number.isNaN(t.z)||e.push(t.z),void 0===t.m||Number.isNaN(t.m)||e.push(t.m),e})),s=[];for(let t=0,n=e.length;t<n;++t)s.push(e[t].join(" "));return s.join(", ")}function kt(t){const e=[];e.push("("+Vt(t.getExteriorRing())+")");for(let s=0,n=t.getNumInteriorRing();s<n;++s)e.push("("+Vt(t.getInteriorRingN(s))+")");return e.join(", ")}const Xt={Point:zt,LineString:Vt,LinearRing:Vt,Polygon:kt,MultiPoint:function(t){const e=[];for(let s=0,n=t.getNumGeometries();s<n;++s)e.push("("+zt(t.getGeometryN(s))+")");return e.join(", ")},MultiLineString:function(t){const e=[];for(let s=0,n=t.getNumGeometries();s<n;++s)e.push("("+Vt(t.getGeometryN(s))+")");return e.join(", ")},MultiPolygon:function(t){const e=[];for(let s=0,n=t.getNumGeometries();s<n;++s)e.push("("+kt(t.getGeometryN(s))+")");return e.join(", ")},GeometryCollection:function(t){const e=[];for(let s=0,n=t.getNumGeometries();s<n;++s)e.push(Ut(t.getGeometryN(s)));return e.join(", ")}};function Ut(t){let e=t.getGeometryType();const s=Xt[e];e=e.toUpperCase();const n=function(t){let e="";if(t.isEmpty())return e;const s=t.getCoordinate();return void 0===s.z||Number.isNaN(s.z)||(e+="Z"),void 0===s.m||Number.isNaN(s.m)||(e+="M"),e}(t);if(n.length>0&&(e+=" "+n),t.isEmpty())return e+" "+Mt;return e+" ("+s(t)+")"}class Ht{constructor(t){this.geometryFactory=t||new Lt,this.precisionModel=this.geometryFactory.getPrecisionModel()}read(t){const e=new Bt(t);return new Yt(e,this.geometryFactory).parse()}write(t){return Ut(t)}}class Wt{constructor(t){this.parser=new Ht(t)}write(t){return this.parser.write(t)}static toLineString(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}class Zt{constructor(){Zt.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._inputLines=Array(2).fill().map((()=>Array(2))),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new m,this._intPt[1]=new m,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}static nonRobustComputeEdgeDistance(t,e,s){const n=t.x-e.x,i=t.y-e.y,r=Math.sqrt(n*n+i*i);return h.isTrue(!(0===r&&!t.equals(e)),"Invalid distance calculation"),r}static computeEdgeDistance(t,e,s){const n=Math.abs(s.x-e.x),i=Math.abs(s.y-e.y);let r=-1;if(t.equals(e))r=0;else if(t.equals(s))r=n>i?n:i;else{const s=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);r=n>i?s:o,0!==r||t.equals(e)||(r=Math.max(s,o))}return h.isTrue(!(0===r&&!t.equals(e)),"Bad distance calculation"),r}computeIntersection(t,e,s,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=s,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,s,n)}getIntersectionNum(){return this._result}computeIntLineIndex(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((()=>Array(2))),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){const t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}isInteriorIntersection(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){const t=arguments[0];for(let e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}}getIntersection(t){return this._intPt[t]}getEdgeDistance(t,e){return Zt.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}isCollinear(){return this._result===Zt.COLLINEAR_INTERSECTION}toString(){return Wt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Wt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}getEndpoint(t,e){return this._inputLines[t][e]}getIndexAlongSegment(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}getTopologySummary(){const t=new nt;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}isProper(){return this.hasIntersection()&&this._isProper}setPrecisionModel(t){this._precisionModel=t}isEndPoint(){return this.hasIntersection()&&!this._isProper}hasIntersection(){return this._result!==Zt.NO_INTERSECTION}isIntersection(t){for(let e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}getIntersectionAlongSegment(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}Zt.DONT_INTERSECT=0,Zt.DO_INTERSECT=1,Zt.COLLINEAR=2,Zt.NO_INTERSECTION=0,Zt.POINT_INTERSECTION=1,Zt.COLLINEAR_INTERSECTION=2;class jt extends Zt{constructor(){super()}static nearestEndpoint(t,e,s,n){let i=t,r=V.pointToSegment(t,s,n),o=V.pointToSegment(e,s,n);return o<r&&(r=o,i=e),o=V.pointToSegment(s,t,e),o<r&&(r=o,i=s),o=V.pointToSegment(n,t,e),o<r&&(r=o,i=n),i}isInSegmentEnvelopes(t){const e=new O(this._inputLines[0][0],this._inputLines[0][1]),s=new O(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&s.contains(t)}computeIntersection(){if(3!==arguments.length)return super.computeIntersection.apply(this,arguments);{const t=arguments[0],e=arguments[1],s=arguments[2];if(this._isProper=!1,O.intersects(e,s,t)&&0===q.index(e,s,t)&&0===q.index(s,e,t))return this._isProper=!0,(t.equals(e)||t.equals(s))&&(this._isProper=!1),this._result=Zt.POINT_INTERSECTION,null;this._result=Zt.NO_INTERSECTION}}intersection(t,e,s,n){let i=this.intersectionSafe(t,e,s,n);return this.isInSegmentEnvelopes(i)||(i=new m(jt.nearestEndpoint(t,e,s,n))),null!==this._precisionModel&&this._precisionModel.makePrecise(i),i}checkDD(t,e,s,n,i){const r=F.intersection(t,e,s,n),o=this.isInSegmentEnvelopes(r);Y.out.println("DD in env = "+o+" --------------------- "+r),i.distance(r)>1e-4&&Y.out.println("Distance = "+i.distance(r))}intersectionSafe(t,e,s,n){let i=B.intersection(t,e,s,n);return null===i&&(i=jt.nearestEndpoint(t,e,s,n)),i}computeCollinearIntersection(t,e,s,n){const i=O.intersects(t,e,s),r=O.intersects(t,e,n),o=O.intersects(s,n,t),l=O.intersects(s,n,e);return i&&r?(this._intPt[0]=s,this._intPt[1]=n,Zt.COLLINEAR_INTERSECTION):o&&l?(this._intPt[0]=t,this._intPt[1]=e,Zt.COLLINEAR_INTERSECTION):i&&o?(this._intPt[0]=s,this._intPt[1]=t,!s.equals(t)||r||l?Zt.COLLINEAR_INTERSECTION:Zt.POINT_INTERSECTION):i&&l?(this._intPt[0]=s,this._intPt[1]=e,!s.equals(e)||r||o?Zt.COLLINEAR_INTERSECTION:Zt.POINT_INTERSECTION):r&&o?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||i||l?Zt.COLLINEAR_INTERSECTION:Zt.POINT_INTERSECTION):r&&l?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||i||o?Zt.COLLINEAR_INTERSECTION:Zt.POINT_INTERSECTION):Zt.NO_INTERSECTION}computeIntersect(t,e,s,n){if(this._isProper=!1,!O.intersects(t,e,s,n))return Zt.NO_INTERSECTION;const i=q.index(t,e,s),r=q.index(t,e,n);if(i>0&&r>0||i<0&&r<0)return Zt.NO_INTERSECTION;const o=q.index(s,n,t),l=q.index(s,n,e);if(o>0&&l>0||o<0&&l<0)return Zt.NO_INTERSECTION;return 0===i&&0===r&&0===o&&0===l?this.computeCollinearIntersection(t,e,s,n):(0===i||0===r||0===o||0===l?(this._isProper=!1,t.equals2D(s)||t.equals2D(n)?this._intPt[0]=t:e.equals2D(s)||e.equals2D(n)?this._intPt[0]=e:0===i?this._intPt[0]=new m(s):0===r?this._intPt[0]=new m(n):0===o?this._intPt[0]=new m(t):0===l&&(this._intPt[0]=new m(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,s,n)),Zt.POINT_INTERSECTION)}}class Kt{constructor(){Kt.constructor_.apply(this,arguments)}static constructor_(){if(this.p0=null,this.p1=null,0===arguments.length)Kt.constructor_.call(this,new m,new m);else if(1===arguments.length){const t=arguments[0];Kt.constructor_.call(this,t.p0,t.p1)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.p0=t,this.p1=e}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];Kt.constructor_.call(this,new m(t,e),new m(s,n))}}static midPoint(t,e){return new m((t.x+e.x)/2,(t.y+e.y)/2)}minX(){return Math.min(this.p0.x,this.p1.x)}orientationIndex(){if(arguments[0]instanceof Kt){const t=arguments[0],e=q.index(this.p0,this.p1,t.p0),s=q.index(this.p0,this.p1,t.p1);return e>=0&&s>=0||e<=0&&s<=0?Math.max(e,s):0}if(arguments[0]instanceof m){const t=arguments[0];return q.index(this.p0,this.p1,t)}}toGeometry(t){return t.createLineString([this.p0,this.p1])}isVertical(){return this.p0.x===this.p1.x}minY(){return Math.min(this.p0.y,this.p1.y)}midPoint(){return Kt.midPoint(this.p0,this.p1)}maxY(){return Math.max(this.p0.y,this.p1.y)}pointAlongOffset(t,e){const s=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,o=Math.sqrt(i*i+r*r);let l=0,a=0;if(0!==e){if(o<=0)throw new D("Cannot compute offset from zero-length line segment");l=e*i/o,a=e*r/o}return new m(s-a,n+l)}setCoordinates(){if(1===arguments.length){const t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.p0.x=t.x,this.p0.y=t.y,this.p1.x=e.x,this.p1.y=e.y}}segmentFraction(t){let e=this.projectionFactor(t);return e<0?e=0:(e>1||r.isNaN(e))&&(e=1),e}toString(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}distance(){if(arguments[0]instanceof Kt){const t=arguments[0];return V.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof m){const t=arguments[0];return V.pointToSegment(t,this.p0,this.p1)}}equals(t){if(!(t instanceof Kt))return!1;const e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}intersection(t){const e=new jt;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}project(){if(arguments[0]instanceof m){const t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new m(t);const e=this.projectionFactor(t),s=new m;return s.x=this.p0.x+e*(this.p1.x-this.p0.x),s.y=this.p0.y+e*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Kt){const t=arguments[0],e=this.projectionFactor(t.p0),s=this.projectionFactor(t.p1);if(e>=1&&s>=1)return null;if(e<=0&&s<=0)return null;let n=this.project(t.p0);e<0&&(n=this.p0),e>1&&(n=this.p1);let i=this.project(t.p1);return s<0&&(i=this.p0),s>1&&(i=this.p1),new Kt(n,i)}}normalize(){this.p1.compareTo(this.p0)<0&&this.reverse()}angle(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}getCoordinate(t){return 0===t?this.p0:this.p1}distancePerpendicular(t){return V.pointToLinePerpendicular(t,this.p0,this.p1)}closestPoint(t){const e=this.projectionFactor(t);if(e>0&&e<1)return this.project(t);return this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}projectionFactor(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;const e=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,n=e*e+s*s;if(n<=0)return r.NaN;return((t.x-this.p0.x)*e+(t.y-this.p0.y)*s)/n}closestPoints(t){const e=this.intersection(t);if(null!==e)return[e,e];const s=new Array(2).fill(null);let n=r.MAX_VALUE,i=null;const o=this.closestPoint(t.p0);n=o.distance(t.p0),s[0]=o,s[1]=t.p0;const l=this.closestPoint(t.p1);i=l.distance(t.p1),i<n&&(n=i,s[0]=l,s[1]=t.p1);const a=t.closestPoint(this.p0);i=a.distance(this.p0),i<n&&(n=i,s[0]=this.p0,s[1]=a);const c=t.closestPoint(this.p1);return i=c.distance(this.p1),i<n&&(n=i,s[0]=this.p1,s[1]=c),s}maxX(){return Math.max(this.p0.x,this.p1.x)}getLength(){return this.p0.distance(this.p1)}compareTo(t){const e=t,s=this.p0.compareTo(e.p0);return 0!==s?s:this.p1.compareTo(e.p1)}reverse(){const t=this.p0;this.p0=this.p1,this.p1=t}equalsTopo(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}lineIntersection(t){return B.intersection(this.p0,this.p1,t.p0,t.p1)}isHorizontal(){return this.p0.y===this.p1.y}reflect(t){const e=this.p1.getY()-this.p0.getY(),s=this.p0.getX()-this.p1.getX(),n=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),i=e*e+s*s,r=e*e-s*s,o=t.getX(),l=t.getY();return new m((-r*o-2*e*s*l-2*e*n)/i,(r*l-2*e*s*o-2*s*n)/i)}pointAlong(t){const e=new m;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}hashCode(){let t=r.doubleToLongBits(this.p0.x);t^=31*r.doubleToLongBits(this.p0.y);const e=Math.trunc(t)^Math.trunc(t>>32);let s=r.doubleToLongBits(this.p1.x);s^=31*r.doubleToLongBits(this.p1.y);return e^(Math.trunc(s)^Math.trunc(s>>32))}get interfaces_(){return[o,l]}}class Qt{static toLocationSymbol(t){switch(t){case Qt.EXTERIOR:return"e";case Qt.BOUNDARY:return"b";case Qt.INTERIOR:return"i";case Qt.NONE:return"-"}throw new n("Unknown location value: "+t)}}Qt.INTERIOR=0,Qt.BOUNDARY=1,Qt.EXTERIOR=2,Qt.NONE=-1;class Jt{constructor(){Jt.constructor_.apply(this,arguments)}static constructor_(){if(this._matrix=null,0===arguments.length)this._matrix=Array(3).fill().map((()=>Array(3))),this.setAll(Z.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){const t=arguments[0];Jt.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof Jt){const t=arguments[0];Jt.constructor_.call(this),this._matrix[Qt.INTERIOR][Qt.INTERIOR]=t._matrix[Qt.INTERIOR][Qt.INTERIOR],this._matrix[Qt.INTERIOR][Qt.BOUNDARY]=t._matrix[Qt.INTERIOR][Qt.BOUNDARY],this._matrix[Qt.INTERIOR][Qt.EXTERIOR]=t._matrix[Qt.INTERIOR][Qt.EXTERIOR],this._matrix[Qt.BOUNDARY][Qt.INTERIOR]=t._matrix[Qt.BOUNDARY][Qt.INTERIOR],this._matrix[Qt.BOUNDARY][Qt.BOUNDARY]=t._matrix[Qt.BOUNDARY][Qt.BOUNDARY],this._matrix[Qt.BOUNDARY][Qt.EXTERIOR]=t._matrix[Qt.BOUNDARY][Qt.EXTERIOR],this._matrix[Qt.EXTERIOR][Qt.INTERIOR]=t._matrix[Qt.EXTERIOR][Qt.INTERIOR],this._matrix[Qt.EXTERIOR][Qt.BOUNDARY]=t._matrix[Qt.EXTERIOR][Qt.BOUNDARY],this._matrix[Qt.EXTERIOR][Qt.EXTERIOR]=t._matrix[Qt.EXTERIOR][Qt.EXTERIOR]}}static isTrue(t){return t>=0||t===Z.TRUE}static matches(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return e===Z.SYM_DONTCARE||(e===Z.SYM_TRUE&&(t>=0||t===Z.TRUE)||(e===Z.SYM_FALSE&&t===Z.FALSE||(e===Z.SYM_P&&t===Z.P||(e===Z.SYM_L&&t===Z.L||e===Z.SYM_A&&t===Z.A))))}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){const t=arguments[1];return new Jt(arguments[0]).matches(t)}}isIntersects(){return!this.isDisjoint()}set(){if(1===arguments.length){const t=arguments[0];for(let e=0;e<t.length;e++){const s=Math.trunc(e/3),n=e%3;this._matrix[s][n]=Z.toDimensionValue(t.charAt(e))}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._matrix[t][e]=s}}isContains(){return Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&this._matrix[Qt.EXTERIOR][Qt.INTERIOR]===Z.FALSE&&this._matrix[Qt.EXTERIOR][Qt.BOUNDARY]===Z.FALSE}isWithin(){return Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&this._matrix[Qt.INTERIOR][Qt.EXTERIOR]===Z.FALSE&&this._matrix[Qt.BOUNDARY][Qt.EXTERIOR]===Z.FALSE}isTouches(t,e){return t>e?this.isTouches(e,t):(t===Z.A&&e===Z.A||t===Z.L&&e===Z.L||t===Z.L&&e===Z.A||t===Z.P&&e===Z.A||t===Z.P&&e===Z.L)&&(this._matrix[Qt.INTERIOR][Qt.INTERIOR]===Z.FALSE&&(Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.BOUNDARY])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.INTERIOR])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.BOUNDARY])))}isOverlaps(t,e){return t===Z.P&&e===Z.P||t===Z.A&&e===Z.A?Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.EXTERIOR])&&Jt.isTrue(this._matrix[Qt.EXTERIOR][Qt.INTERIOR]):t===Z.L&&e===Z.L&&(1===this._matrix[Qt.INTERIOR][Qt.INTERIOR]&&Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.EXTERIOR])&&Jt.isTrue(this._matrix[Qt.EXTERIOR][Qt.INTERIOR]))}isEquals(t,e){return t===e&&(Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&this._matrix[Qt.INTERIOR][Qt.EXTERIOR]===Z.FALSE&&this._matrix[Qt.BOUNDARY][Qt.EXTERIOR]===Z.FALSE&&this._matrix[Qt.EXTERIOR][Qt.INTERIOR]===Z.FALSE&&this._matrix[Qt.EXTERIOR][Qt.BOUNDARY]===Z.FALSE)}matches(t){if(9!==t.length)throw new n("Should be length 9: "+t);for(let e=0;e<3;e++)for(let s=0;s<3;s++)if(!Jt.matches(this._matrix[e][s],t.charAt(3*e+s)))return!1;return!0}add(t){for(let e=0;e<3;e++)for(let s=0;s<3;s++)this.setAtLeast(e,s,t.get(e,s))}isDisjoint(){return this._matrix[Qt.INTERIOR][Qt.INTERIOR]===Z.FALSE&&this._matrix[Qt.INTERIOR][Qt.BOUNDARY]===Z.FALSE&&this._matrix[Qt.BOUNDARY][Qt.INTERIOR]===Z.FALSE&&this._matrix[Qt.BOUNDARY][Qt.BOUNDARY]===Z.FALSE}isCrosses(t,e){return t===Z.P&&e===Z.L||t===Z.P&&e===Z.A||t===Z.L&&e===Z.A?Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.EXTERIOR]):t===Z.L&&e===Z.P||t===Z.A&&e===Z.P||t===Z.A&&e===Z.L?Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])&&Jt.isTrue(this._matrix[Qt.EXTERIOR][Qt.INTERIOR]):t===Z.L&&e===Z.L&&0===this._matrix[Qt.INTERIOR][Qt.INTERIOR]}isCovers(){return(Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])||Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.BOUNDARY])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.INTERIOR])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.BOUNDARY]))&&this._matrix[Qt.EXTERIOR][Qt.INTERIOR]===Z.FALSE&&this._matrix[Qt.EXTERIOR][Qt.BOUNDARY]===Z.FALSE}isCoveredBy(){return(Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.INTERIOR])||Jt.isTrue(this._matrix[Qt.INTERIOR][Qt.BOUNDARY])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.INTERIOR])||Jt.isTrue(this._matrix[Qt.BOUNDARY][Qt.BOUNDARY]))&&this._matrix[Qt.INTERIOR][Qt.EXTERIOR]===Z.FALSE&&this._matrix[Qt.BOUNDARY][Qt.EXTERIOR]===Z.FALSE}setAtLeast(){if(1===arguments.length){const t=arguments[0];for(let e=0;e<t.length;e++){const s=Math.trunc(e/3),n=e%3;this.setAtLeast(s,n,Z.toDimensionValue(t.charAt(e)))}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._matrix[t][e]<s&&(this._matrix[t][e]=s)}}setAtLeastIfValid(t,e,s){t>=0&&e>=0&&this.setAtLeast(t,e,s)}toString(){const t=new nt("123456789");for(let e=0;e<3;e++)for(let s=0;s<3;s++)t.setCharAt(3*e+s,Z.toDimensionSymbol(this._matrix[e][s]));return t.toString()}setAll(t){for(let e=0;e<3;e++)for(let s=0;s<3;s++)this._matrix[e][s]=t}get(t,e){return this._matrix[t][e]}transpose(){let t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}get interfaces_(){return[u]}}class $t{static toDegrees(t){return 180*t/Math.PI}static isAcute(t,e,s){const n=t.x-e.x,i=t.y-e.y;return n*(s.x-e.x)+i*(s.y-e.y)>0}static isObtuse(t,e,s){const n=t.x-e.x,i=t.y-e.y;return n*(s.x-e.x)+i*(s.y-e.y)<0}static interiorAngle(t,e,s){const n=$t.angle(e,t),i=$t.angle(e,s);return Math.abs(i-n)}static normalizePositive(t){if(t<0){for(;t<0;)t+=$t.PI_TIMES_2;t>=$t.PI_TIMES_2&&(t=0)}else{for(;t>=$t.PI_TIMES_2;)t-=$t.PI_TIMES_2;t<0&&(t=0)}return t}static angleBetween(t,e,s){const n=$t.angle(e,t),i=$t.angle(e,s);return $t.diff(n,i)}static diff(t,e){let s=null;return s=t<e?e-t:t-e,s>Math.PI&&(s=2*Math.PI-s),s}static toRadians(t){return t*Math.PI/180}static normalize(t){for(;t>Math.PI;)t-=$t.PI_TIMES_2;for(;t<=-Math.PI;)t+=$t.PI_TIMES_2;return t}static angle(){if(1===arguments.length){const t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=e.x-t.x,n=e.y-t.y;return Math.atan2(n,s)}}static getTurn(t,e){const s=Math.sin(e-t);return s>0?$t.COUNTERCLOCKWISE:s<0?$t.CLOCKWISE:$t.NONE}static angleBetweenOriented(t,e,s){const n=$t.angle(e,t),i=$t.angle(e,s)-n;return i<=-Math.PI?i+$t.PI_TIMES_2:i>Math.PI?i-$t.PI_TIMES_2:i}}$t.PI_TIMES_2=2*Math.PI,$t.PI_OVER_2=Math.PI/2,$t.PI_OVER_4=Math.PI/4,$t.COUNTERCLOCKWISE=q.COUNTERCLOCKWISE,$t.CLOCKWISE=q.CLOCKWISE,$t.NONE=q.COLLINEAR;class te extends s{constructor(){super(),te.constructor_.apply(this,arguments)}static constructor_(){s.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}class ee{constructor(){ee.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){const t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];this.x=t,this.y=e,this.w=1}else if(arguments[0]instanceof ee&&arguments[1]instanceof ee){const t=arguments[0],e=arguments[1];this.x=t.y*e.w-e.y*t.w,this.y=e.x*t.w-t.x*e.w,this.w=t.x*e.y-e.x*t.y}else if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];this.x=t.y-e.y,this.y=e.x-t.x,this.w=t.x*e.y-e.x*t.y}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.x=t,this.y=e,this.w=s}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=t.y-e.y,r=e.x-t.x,o=t.x*e.y-e.x*t.y,l=s.y-n.y,a=n.x-s.x,c=s.x*n.y-n.x*s.y;this.x=r*c-a*o,this.y=l*o-i*c,this.w=i*a-l*r}}getCoordinate(){const t=new m;return t.x=this.getX(),t.y=this.getY(),t}getX(){const t=this.x/this.w;if(r.isNaN(t)||r.isInfinite(t))throw new te;return t}getY(){const t=this.y/this.w;if(r.isNaN(t)||r.isInfinite(t))throw new te;return t}}class se{constructor(){se.constructor_.apply(this,arguments)}static constructor_(){this.p0=null,this.p1=null,this.p2=null;const t=arguments[0],e=arguments[1],s=arguments[2];this.p0=t,this.p1=e,this.p2=s}static isAcute(t,e,s){return!!$t.isAcute(t,e,s)&&(!!$t.isAcute(e,s,t)&&!!$t.isAcute(s,t,e))}static circumcentre(t,e,s){const n=s.x,i=s.y,r=t.x-n,o=t.y-i,l=e.x-n,a=e.y-i,c=2*se.det(r,o,l,a),h=se.det(o,r*r+o*o,a,l*l+a*a),u=se.det(r,r*r+o*o,l,l*l+a*a);return new m(n-h/c,i+u/c)}static perpendicularBisector(t,e){const s=e.x-t.x,n=e.y-t.y,i=new ee(t.x+s/2,t.y+n/2,1),r=new ee(t.x-n+s/2,t.y+s+n/2,1);return new ee(i,r)}static angleBisector(t,e,s){const n=e.distance(t),i=n/(n+e.distance(s)),r=s.x-t.x,o=s.y-t.y;return new m(t.x+i*r,t.y+i*o)}static inCentre(t,e,s){const n=e.distance(s),i=t.distance(s),r=t.distance(e),o=n+i+r,l=(n*t.x+i*e.x+r*s.x)/o,a=(n*t.y+i*e.y+r*s.y)/o;return new m(l,a)}static area(t,e,s){return Math.abs(((s.x-t.x)*(e.y-t.y)-(e.x-t.x)*(s.y-t.y))/2)}static signedArea(t,e,s){return((s.x-t.x)*(e.y-t.y)-(e.x-t.x)*(s.y-t.y))/2}static det(t,e,s,n){return t*n-e*s}static interpolateZ(t,e,s,n){const i=e.x,r=e.y,o=s.x-i,l=n.x-i,a=s.y-r,c=n.y-r,h=o*c-l*a,u=t.x-i,g=t.y-r,d=(c*u-l*g)/h,_=(-a*u+o*g)/h;return e.getZ()+d*(s.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}static longestSideLength(t,e,s){const n=t.distance(e),i=e.distance(s),r=s.distance(t);let o=n;return i>o&&(o=i),r>o&&(o=r),o}static circumcentreDD(t,e,s){const n=A.valueOf(t.x).subtract(s.x),i=A.valueOf(t.y).subtract(s.y),r=A.valueOf(e.x).subtract(s.x),o=A.valueOf(e.y).subtract(s.y),l=A.determinant(n,i,r,o).multiply(2),a=n.sqr().add(i.sqr()),c=r.sqr().add(o.sqr()),h=A.determinant(i,a,o,c),u=A.determinant(n,a,r,c),g=A.valueOf(s.x).subtract(h.divide(l)).doubleValue(),d=A.valueOf(s.y).add(u.divide(l)).doubleValue();return new m(g,d)}static area3D(t,e,s){const n=e.x-t.x,i=e.y-t.y,r=e.getZ()-t.getZ(),o=s.x-t.x,l=s.y-t.y,a=s.getZ()-t.getZ(),c=i*a-r*l,h=r*o-n*a,u=n*l-i*o,g=c*c+h*h+u*u;return Math.sqrt(g)/2}static centroid(t,e,s){const n=(t.x+e.x+s.x)/3,i=(t.y+e.y+s.y)/3;return new m(n,i)}interpolateZ(t){if(null===t)throw new n("Supplied point is null.");return se.interpolateZ(t,this.p0,this.p1,this.p2)}longestSideLength(){return se.longestSideLength(this.p0,this.p1,this.p2)}isAcute(){return se.isAcute(this.p0,this.p1,this.p2)}circumcentre(){return se.circumcentre(this.p0,this.p1,this.p2)}inCentre(){return se.inCentre(this.p0,this.p1,this.p2)}area(){return se.area(this.p0,this.p1,this.p2)}signedArea(){return se.signedArea(this.p0,this.p1,this.p2)}area3D(){return se.area3D(this.p0,this.p1,this.p2)}centroid(){return se.centroid(this.p0,this.p1,this.p2)}}class ne extends s{constructor(){super(),ne.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)s.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];s.constructor_.call(this,t)}}}class ie{constructor(){ie.constructor_.apply(this,arguments)}static constructor_(){if(this._m00=null,this._m01=null,this._m02=null,this._m10=null,this._m11=null,this._m12=null,0===arguments.length)this.setToIdentity();else if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];this._m00=t[0],this._m01=t[1],this._m02=t[2],this._m10=t[3],this._m11=t[4],this._m12=t[5]}else if(arguments[0]instanceof ie){const t=arguments[0];this.setTransformation(t)}}else if(6===arguments.length&&"number"==typeof arguments[5]&&"number"==typeof arguments[4]&&"number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];this.setTransformation(t,e,s,n,i,r)}}static translationInstance(t,e){const s=new ie;return s.setToTranslation(t,e),s}static shearInstance(t,e){const s=new ie;return s.setToShear(t,e),s}static reflectionInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new ie;return s.setToReflection(t,e),s}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=new ie;return i.setToReflection(t,e,s,n),i}}static rotationInstance(){if(1===arguments.length){const t=arguments[0];return ie.rotationInstance(Math.sin(t),Math.cos(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new ie;return s.setToRotation(t,e),s}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return ie.rotationInstance(Math.sin(t),Math.cos(t),e,s)}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=new ie;return i.setToRotation(t,e,s,n),i}}static scaleInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new ie;return s.setToScale(t,e),s}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=new ie;return i.translate(-s,-n),i.scale(t,e),i.translate(s,n),i}}setToReflectionBasic(t,e,s,i){if(t===s&&e===i)throw new n("Reflection line points must be distinct");const r=s-t,o=i-e,l=Math.sqrt(r*r+o*o),a=o/l,c=r/l,h=2*a*c,u=c*c-a*a;return this._m00=u,this._m01=h,this._m02=0,this._m10=h,this._m11=-u,this._m12=0,this}setToRotation(){if(1===arguments.length){const t=arguments[0];return this.setToRotation(Math.sin(t),Math.cos(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._m00=e,this._m01=-t,this._m02=0,this._m10=t,this._m11=e,this._m12=0,this}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return this.setToRotation(Math.sin(t),Math.cos(t),e,s),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];return this._m00=e,this._m01=-t,this._m02=s-s*e+n*t,this._m10=t,this._m11=e,this._m12=n-s*t-n*e,this}}getMatrixEntries(){return[this._m00,this._m01,this._m02,this._m10,this._m11,this._m12]}filter(t,e){this.transform(t,e)}composeBefore(t){const e=this._m00*t._m00+this._m01*t._m10,s=this._m00*t._m01+this._m01*t._m11,n=this._m00*t._m02+this._m01*t._m12+this._m02,i=this._m10*t._m00+this._m11*t._m10,r=this._m10*t._m01+this._m11*t._m11,o=this._m10*t._m02+this._m11*t._m12+this._m12;return this._m00=e,this._m01=s,this._m02=n,this._m10=i,this._m11=r,this._m12=o,this}clone(){try{return null}catch(t){if(!(t instanceof s))throw t;h.shouldNeverReachHere()}return null}translate(t,e){return this.compose(ie.translationInstance(t,e)),this}setToReflection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Reflection vector must be non-zero");if(t===e)return this._m00=0,this._m01=1,this._m02=0,this._m10=1,this._m11=0,this._m12=0,this;const s=Math.sqrt(t*t+e*e),i=e/s,r=t/s;return this.rotate(-i,r),this.scale(1,-1),this.rotate(i,r),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],i=arguments[3];if(t===s&&e===i)throw new n("Reflection line points must be distinct");this.setToTranslation(-t,-e);const r=s-t,o=i-e,l=Math.sqrt(r*r+o*o),a=o/l,c=r/l;return this.rotate(-a,c),this.scale(1,-1),this.rotate(a,c),this.translate(t,e),this}}shear(t,e){return this.compose(ie.shearInstance(t,e)),this}getInverse(){const t=this.getDeterminant();if(0===t)throw new ne("Transformation is non-invertible");const e=this._m11/t,s=-this._m10/t,n=-this._m01/t,i=this._m00/t,r=(this._m01*this._m12-this._m02*this._m11)/t,o=(-this._m00*this._m12+this._m10*this._m02)/t;return new ie(e,n,r,s,i,o)}compose(t){const e=t._m00*this._m00+t._m01*this._m10,s=t._m00*this._m01+t._m01*this._m11,n=t._m00*this._m02+t._m01*this._m12+t._m02,i=t._m10*this._m00+t._m11*this._m10,r=t._m10*this._m01+t._m11*this._m11,o=t._m10*this._m02+t._m11*this._m12+t._m12;return this._m00=e,this._m01=s,this._m02=n,this._m10=i,this._m11=r,this._m12=o,this}equals(t){if(null===t)return!1;if(!(t instanceof ie))return!1;const e=t;return this._m00===e._m00&&this._m01===e._m01&&this._m02===e._m02&&this._m10===e._m10&&this._m11===e._m11&&this._m12===e._m12}setToScale(t,e){return this._m00=t,this._m01=0,this._m02=0,this._m10=0,this._m11=e,this._m12=0,this}isIdentity(){return 1===this._m00&&0===this._m01&&0===this._m02&&0===this._m10&&1===this._m11&&0===this._m12}scale(t,e){return this.compose(ie.scaleInstance(t,e)),this}setToIdentity(){return this._m00=1,this._m01=0,this._m02=0,this._m10=0,this._m11=1,this._m12=0,this}isGeometryChanged(){return!0}setTransformation(){if(1===arguments.length){const t=arguments[0];return this._m00=t._m00,this._m01=t._m01,this._m02=t._m02,this._m10=t._m10,this._m11=t._m11,this._m12=t._m12,this}if(6===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];return this._m00=t,this._m01=e,this._m02=s,this._m10=n,this._m11=i,this._m12=r,this}}rotate(){if(1===arguments.length){const t=arguments[0];return this.compose(ie.rotationInstance(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(ie.rotationInstance(t,e)),this}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return this.compose(ie.rotationInstance(t,e,s)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];return this.compose(ie.rotationInstance(t,e,s,n)),this}}getDeterminant(){return this._m00*this._m11-this._m01*this._m10}setToShear(t,e){return this._m00=1,this._m01=t,this._m02=0,this._m10=e,this._m11=1,this._m12=0,this}isDone(){return!1}toString(){return"AffineTransformation[["+this._m00+", "+this._m01+", "+this._m02+"], ["+this._m10+", "+this._m11+", "+this._m12+"]]"}setToTranslation(t,e){return this._m00=1,this._m01=0,this._m02=t,this._m10=0,this._m11=1,this._m12=e,this}transform(){if(1===arguments.length){const t=arguments[0].copy();return t.apply(this),t}if(2===arguments.length){if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=this._m00*t.x+this._m01*t.y+this._m02,n=this._m10*t.x+this._m11*t.y+this._m12;return e.x=s,e.y=n,e}if(I(arguments[0],G)&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=this._m00*t.getOrdinate(e,0)+this._m01*t.getOrdinate(e,1)+this._m02,n=this._m10*t.getOrdinate(e,0)+this._m11*t.getOrdinate(e,1)+this._m12;t.setOrdinate(e,0,s),t.setOrdinate(e,1,n)}}}reflect(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(ie.reflectionInstance(t,e)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];return this.compose(ie.reflectionInstance(t,e,s,n)),this}}get interfaces_(){return[u,P]}}class re{static solve(t,e){const s=e.length;if(t.length!==s||t[0].length!==s)throw new n("Matrix A is incorrectly sized");for(let n=0;n<s;n++){let i=n;for(let e=n+1;e<s;e++)Math.abs(t[e][n])>Math.abs(t[i][n])&&(i=e);if(0===t[i][n])return null;re.swapRows(t,n,i),re.swapRows(e,n,i);for(let i=n+1;i<s;i++){const r=t[i][n]/t[n][n];for(let e=s-1;e>=n;e--)t[i][e]-=t[n][e]*r;e[i]-=e[n]*r}}const i=new Array(s).fill(null);for(let n=s-1;n>=0;n--){let r=0;for(let e=n+1;e<s;e++)r+=t[n][e]*i[e];i[n]=(e[n]-r)/t[n][n]}return i}static swapRows(){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];if(e===s)return null;for(let n=0;n<t[0].length;n++){const i=t[e][n];t[e][n]=t[s][n],t[s][n]=i}}else if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];if(e===s)return null;const n=t[e];t[e]=t[s],t[s]=n}}}class oe{constructor(){oe.constructor_.apply(this,arguments)}static constructor_(){this._src0=null,this._src1=null,this._src2=null,this._dest0=null,this._dest1=null,this._dest2=null,this._m00=null,this._m01=null,this._m02=null,this._m10=null,this._m11=null,this._m12=null;const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];this._src0=t,this._src1=e,this._src2=s,this._dest0=n,this._dest1=i,this._dest2=r}compute(){const t=[this._dest0.x,this._dest1.x,this._dest2.x],e=this.solve(t);if(null===e)return!1;this._m00=e[0],this._m01=e[1],this._m02=e[2];const s=[this._dest0.y,this._dest1.y,this._dest2.y],n=this.solve(s);return null!==n&&(this._m10=n[0],this._m11=n[1],this._m12=n[2],!0)}getTransformation(){return this.compute()?new ie(this._m00,this._m01,this._m02,this._m10,this._m11,this._m12):null}solve(t){const e=[[this._src0.x,this._src0.y,1],[this._src1.x,this._src1.y,1],[this._src2.x,this._src2.y,1]];return re.solve(e,t)}}class le{static createFromBaseLines(t,e,s,n){const i=new m(t.x+n.x-s.x,t.y+n.y-s.y),r=$t.angleBetweenOriented(e,t,i),o=e.distance(t),l=n.distance(s);if(0===o)return new ie;const a=l/o,c=ie.translationInstance(-t.x,-t.y);return c.rotate(r),c.scale(a,a),c.translate(s.x,s.y),c}static createFromControlVectors(){if(2===arguments.length){if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=e.x-t.x,n=e.y-t.y;return ie.translationInstance(s,n)}if(arguments[0]instanceof Array&&arguments[1]instanceof Array){const t=arguments[0],e=arguments[1];if(t.length!==e.length)throw new n("Src and Dest arrays are not the same length");if(t.length<=0)throw new n("Too few control points");if(t.length>3)throw new n("Too many control points");return 1===t.length?le.createFromControlVectors(t[0],e[0]):2===t.length?le.createFromControlVectors(t[0],t[1],e[0],e[1]):le.createFromControlVectors(t[0],t[1],t[2],e[0],e[1],e[2])}}else{if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=new m(n.x-s.x,n.y-s.y),r=$t.angleBetweenOriented(e,t,i),o=e.distance(t),l=n.distance(s);if(0===o)return null;const a=l/o,c=ie.translationInstance(-t.x,-t.y);return c.rotate(r),c.scale(a,a),c.translate(s.x,s.y),c}if(6===arguments.length){return new oe(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]).getTransformation()}}}}class ae{constructor(){ae.constructor_.apply(this,arguments)}static constructor_(){this._coords=null;const t=arguments[0];this._coords=t}static getCoordinates(t){const e=new L;return t.apply(new ae(e)),e}filter(t){(t instanceof tt||t instanceof Nt)&&this._coords.add(t.getCoordinate())}get interfaces_(){return[X]}}class ce{constructor(){ce.constructor_.apply(this,arguments)}static constructor_(){this._mapOp=null;const t=arguments[0];this._mapOp=t}static map(t,e){return new ce(e).map(t)}map(t){const e=new L;for(let s=0;s<t.getNumGeometries();s++){const n=this._mapOp.map(t.getGeometryN(s));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(Lt.toGeometryArray(e))}}class he{constructor(){he.constructor_.apply(this,arguments)}static constructor_(){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null;const t=arguments[0];this._geomFactory=he.extractFactory(t),this._inputGeoms=t}static extractFactory(t){return t.isEmpty()?null:t.iterator().next().getFactory()}static createList(){if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new L;return s.add(t),s.add(e),s}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=new L;return n.add(t),n.add(e),n.add(s),n}}static combine(){if(1===arguments.length){return new he(arguments[0]).combine()}if(2===arguments.length){const t=arguments[0],e=arguments[1];return new he(he.createList(t,e)).combine()}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return new he(he.createList(t,e,s)).combine()}}extractElements(t,e){if(null===t)return null;for(let s=0;s<t.getNumGeometries();s++){const n=t.getGeometryN(s);this._skipEmpty&&n.isEmpty()||e.add(n)}}combine(){const t=new L;for(let e=this._inputGeoms.iterator();e.hasNext();){const s=e.next();this.extractElements(s,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection():null:this._geomFactory.buildGeometry(t)}}class ue{constructor(){ue.constructor_.apply(this,arguments)}static constructor_(){if(this._factory=null,this._isUserDataCopied=!1,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._factory=t}}setCopyUserData(t){this._isUserDataCopied=t}edit(t,e){if(null===t)return null;const s=this.editInternal(t,e);return this._isUserDataCopied&&s.setUserData(t.getUserData()),s}editInternal(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof ut?this.editGeometryCollection(t,e):t instanceof Ct?this.editPolygon(t,e):t instanceof Nt||t instanceof tt?e.edit(t,this._factory):(h.shouldNeverReachHere("Unsupported Geometry type: "+t.getGeometryType()),null)}editGeometryCollection(t,e){const s=e.edit(t,this._factory),n=new L;for(let t=0;t<s.getNumGeometries();t++){const i=this.edit(s.getGeometryN(t),e);null===i||i.isEmpty()||n.add(i)}return s.getGeometryType()===j.TYPENAME_MULTIPOINT?this._factory.createMultiPoint(n.toArray([])):s.getGeometryType()===j.TYPENAME_MULTILINESTRING?this._factory.createMultiLineString(n.toArray([])):s.getGeometryType()===j.TYPENAME_MULTIPOLYGON?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))}editPolygon(t,e){let s=e.edit(t,this._factory);if(null===s&&(s=this._factory.createPolygon()),s.isEmpty())return s;const n=this.edit(s.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();const i=new L;for(let t=0;t<s.getNumInteriorRing();t++){const n=this.edit(s.getInteriorRingN(t),e);null===n||n.isEmpty()||i.add(n)}return this._factory.createPolygon(n,i.toArray([]))}}function ge(){}ue.GeometryEditorOperation=ge;ue.NoOpGeometryOperation=class{edit(t,e){return t}get interfaces_(){return[ge]}},ue.CoordinateOperation=class{edit(t,e){const s=this.edit(t.getCoordinates(),t);return t instanceof et?null===s?e.createLinearRing():e.createLinearRing(s):t instanceof tt?null===s?e.createLineString():e.createLineString(s):t instanceof Nt?null===s||0===s.length?e.createPoint():e.createPoint(s[0]):t}get interfaces_(){return[ge]}},ue.CoordinateSequenceOperation=class{edit(t,e){return t instanceof et?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof tt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Nt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t}get interfaces_(){return[ge]}};class de{constructor(){de.constructor_.apply(this,arguments)}static constructor_(){this._geometryType=null,this._comps=null;const t=arguments[0],e=arguments[1];this._geometryType=t,this._comps=e}static extract(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return de.extract(t,e,new L)}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return t.getGeometryType()===e?s.add(t):t instanceof ut&&t.apply(new de(e,s)),s}}static isOfType(t,e){return t.getGeometryType()===e||e===j.TYPENAME_LINESTRING&&t.getGeometryType()===j.TYPENAME_LINEARRING}filter(t){(null===this._geometryType||de.isOfType(t,this._geometryType))&&this._comps.add(t)}get interfaces_(){return[$]}}class _e{static map(){if(arguments[0]instanceof j&&I(arguments[1],pe)){const t=arguments[0],e=arguments[1],s=new L;for(let n=0;n<t.getNumGeometries();n++){const i=e.map(t.getGeometryN(n));null!==i&&s.add(i)}return t.getFactory().buildGeometry(s)}if(I(arguments[0],N)&&I(arguments[1],pe)){const t=arguments[0],e=arguments[1],s=new L;for(let n=t.iterator();n.hasNext();){const t=n.next(),i=e.map(t);null!==i&&s.add(i)}return s}}}function pe(){}_e.MapOp=pe;class me{constructor(){me.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}transformPoint(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))}transformPolygon(t,e){let s=!0;const n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof et&&!n.isEmpty()||(s=!1);const i=new L;for(let e=0;e<t.getNumInteriorRing();e++){const n=this.transformLinearRing(t.getInteriorRingN(e),t);null===n||n.isEmpty()||(n instanceof et||(s=!1),i.add(n))}if(s)return this._factory.createPolygon(n,i.toArray([]));{const t=new L;return null!==n&&t.add(n),t.addAll(i),this._factory.buildGeometry(t)}}createCoordinateSequence(t){return this._factory.getCoordinateSequenceFactory().create(t)}getInputGeometry(){return this._inputGeom}transformMultiLineString(t,e){const s=new L;for(let e=0;e<t.getNumGeometries();e++){const n=this.transformLineString(t.getGeometryN(e),t);null!==n&&(n.isEmpty()||s.add(n))}return this._factory.buildGeometry(s)}transformCoordinates(t,e){return this.copy(t)}transformLineString(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))}transformMultiPoint(t,e){const s=new L;for(let e=0;e<t.getNumGeometries();e++){const n=this.transformPoint(t.getGeometryN(e),t);null!==n&&(n.isEmpty()||s.add(n))}return this._factory.buildGeometry(s)}transformMultiPolygon(t,e){const s=new L;for(let e=0;e<t.getNumGeometries();e++){const n=this.transformPolygon(t.getGeometryN(e),t);null!==n&&(n.isEmpty()||s.add(n))}return this._factory.buildGeometry(s)}copy(t){return t.copy()}transformLinearRing(t,e){const s=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===s)return this._factory.createLinearRing(null);const n=s.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)}transformGeometryCollection(t,e){const s=new L;for(let e=0;e<t.getNumGeometries();e++){const n=this.transform(t.getGeometryN(e));null!==n&&(this._pruneEmptyGeometry&&n.isEmpty()||s.add(n))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Lt.toGeometryArray(s)):this._factory.buildGeometry(s)}transform(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Nt)return this.transformPoint(t,null);if(t instanceof St)return this.transformMultiPoint(t,null);if(t instanceof et)return this.transformLinearRing(t,null);if(t instanceof tt)return this.transformLineString(t,null);if(t instanceof Et)return this.transformMultiLineString(t,null);if(t instanceof Ct)return this.transformPolygon(t,null);if(t instanceof dt)return this.transformMultiPolygon(t,null);if(t instanceof ut)return this.transformGeometryCollection(t,null);throw new n("Unknown Geometry subtype: "+t.getGeometryType())}}class fe{constructor(){fe.constructor_.apply(this,arguments)}static constructor_(){this._comps=null;const t=arguments[0];this._comps=t}static getLines(){if(1===arguments.length){const t=arguments[0];return fe.getLines(t,new L)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t instanceof tt?e.add(t):t instanceof ut&&t.apply(new fe(e)),e}}static getGeometry(t){return t.getFactory().buildGeometry(fe.getLines(t))}filter(t){t instanceof tt&&this._comps.add(t)}get interfaces_(){return[$]}}class ye{constructor(){ye.constructor_.apply(this,arguments)}static constructor_(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){const t=arguments[0];this._lines=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._lines=t,this._isForcedToLineString=e}}static getLines(){if(1===arguments.length){const t=arguments[0];return ye.getLines(t,!1)}if(2===arguments.length){if(I(arguments[0],N)&&I(arguments[1],N)){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();){const s=e.next();ye.getLines(s,t)}return t}if(arguments[0]instanceof j&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=new L;return t.apply(new ye(s,e)),s}if(arguments[0]instanceof j&&I(arguments[1],N)){const t=arguments[0],e=arguments[1];return t instanceof tt?e.add(t):t.apply(new ye(e)),e}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&I(arguments[0],N)&&I(arguments[1],N)){const t=arguments[1],e=arguments[2];for(let s=arguments[0].iterator();s.hasNext();){const n=s.next();ye.getLines(n,t,e)}return t}if("boolean"==typeof arguments[2]&&arguments[0]instanceof j&&I(arguments[1],N)){const t=arguments[1],e=arguments[2];return arguments[0].apply(new ye(t,e)),t}}}static getGeometry(){if(1===arguments.length){const t=arguments[0];return t.getFactory().buildGeometry(ye.getLines(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t.getFactory().buildGeometry(ye.getLines(t,e))}}filter(t){if(this._isForcedToLineString&&t instanceof et){const e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof tt&&this._lines.add(t)}setForceToLineString(t){this._isForcedToLineString=t}get interfaces_(){return[X]}}const xe={reverseOrder:function(){return{compare:(t,e)=>e.compareTo(t)}},min:function(t){return xe.sort(t),t.get(0)},sort:function(t,e){const s=t.toArray();e?ht.sort(s,e):ht.sort(s);const n=t.iterator();for(let t=0,e=s.length;t<e;t++)n.next(),n.set(s[t])},singletonList:function(t){const e=new L;return e.add(t),e}};class Ee{constructor(){Ee.constructor_.apply(this,arguments)}static constructor_(){this._pts=null;const t=arguments[0];this._pts=t}static getPoints(){if(1===arguments.length){const t=arguments[0];return t instanceof Nt?xe.singletonList(t):Ee.getPoints(t,new L)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t instanceof Nt?e.add(t):t instanceof ut&&t.apply(new Ee(e)),e}}filter(t){t instanceof Nt&&this._pts.add(t)}get interfaces_(){return[$]}}class Ie{constructor(){Ie.constructor_.apply(this,arguments)}static constructor_(){this._comps=null;const t=arguments[0];this._comps=t}static getPolygons(){if(1===arguments.length){const t=arguments[0];return Ie.getPolygons(t,new L)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t instanceof Ct?e.add(t):t instanceof ut&&t.apply(new Ie(e)),e}}filter(t){t instanceof Ct&&this._comps.add(t)}get interfaces_(){return[$]}}class Ne{constructor(){Ne.constructor_.apply(this,arguments)}static constructor_(){this._isDone=!1}applyTo(t){for(let e=0;e<t.getNumGeometries()&&!this._isDone;e++){const s=t.getGeometryN(e);if(s instanceof ut)this.applyTo(s);else if(this.visit(s),this.isDone())return this._isDone=!0,null}}}class we{constructor(){we.constructor_.apply(this,arguments)}static constructor_(){if(this._geomFact=null,this._precModel=null,this._dim=new Ce,this._nPts=100,this._rotationAngle=0,0===arguments.length)we.constructor_.call(this,new Lt);else if(1===arguments.length){const t=arguments[0];this._geomFact=t,this._precModel=t.getPrecisionModel()}}setBase(t){this._dim.setBase(t)}setRotation(t){this._rotationAngle=t}setWidth(t){this._dim.setWidth(t)}createEllipse(){const t=this._dim.getEnvelope(),e=t.getWidth()/2,s=t.getHeight()/2,n=t.getMinX()+e,i=t.getMinY()+s,r=new Array(this._nPts+1).fill(null);let o=0;for(let t=0;t<this._nPts;t++){const l=t*(2*Math.PI/this._nPts),a=e*Math.cos(l)+n,c=s*Math.sin(l)+i;r[o++]=this.coord(a,c)}r[o]=new m(r[0]);const l=this._geomFact.createLinearRing(r),a=this._geomFact.createPolygon(l);return this.rotate(a)}createArc(t,e){const s=this._dim.getEnvelope(),n=s.getWidth()/2,i=s.getHeight()/2,r=s.getMinX()+n,o=s.getMinY()+i;let l=e;(l<=0||l>2*Math.PI)&&(l=2*Math.PI);const a=l/(this._nPts-1),c=new Array(this._nPts).fill(null);let h=0;for(let e=0;e<this._nPts;e++){const s=t+e*a,l=n*Math.cos(s)+r,u=i*Math.sin(s)+o;c[h++]=this.coord(l,u)}const u=this._geomFact.createLineString(c);return this.rotate(u)}rotate(t){if(0!==this._rotationAngle){const e=ie.rotationInstance(this._rotationAngle,this._dim.getCentre().x,this._dim.getCentre().y);t.apply(e)}return t}coord(t,e){const s=new m(t,e);return this._precModel.makePrecise(s),s}createArcPolygon(t,e){const s=this._dim.getEnvelope(),n=s.getWidth()/2,i=s.getHeight()/2,r=s.getMinX()+n,o=s.getMinY()+i;let l=e;(l<=0||l>2*Math.PI)&&(l=2*Math.PI);const a=l/(this._nPts-1),c=new Array(this._nPts+2).fill(null);let h=0;c[h++]=this.coord(r,o);for(let e=0;e<this._nPts;e++){const s=t+a*e,l=n*Math.cos(s)+r,u=i*Math.sin(s)+o;c[h++]=this.coord(l,u)}c[h++]=this.coord(r,o);const u=this._geomFact.createLinearRing(c),g=this._geomFact.createPolygon(u);return this.rotate(g)}createRectangle(){let t=null,e=0,s=Math.trunc(this._nPts/4);s<1&&(s=1);const n=this._dim.getEnvelope().getWidth()/s,i=this._dim.getEnvelope().getHeight()/s,r=new Array(4*s+1).fill(null),o=this._dim.getEnvelope();for(t=0;t<s;t++){const s=o.getMinX()+t*n,i=o.getMinY();r[e++]=this.coord(s,i)}for(t=0;t<s;t++){const s=o.getMaxX(),n=o.getMinY()+t*i;r[e++]=this.coord(s,n)}for(t=0;t<s;t++){const s=o.getMaxX()-t*n,i=o.getMaxY();r[e++]=this.coord(s,i)}for(t=0;t<s;t++){const s=o.getMinX(),n=o.getMaxY()-t*i;r[e++]=this.coord(s,n)}r[e++]=new m(r[0]);const l=this._geomFact.createLinearRing(r),a=this._geomFact.createPolygon(l);return this.rotate(a)}createCircle(){return this.createEllipse()}setHeight(t){this._dim.setHeight(t)}setSize(t){this._dim.setSize(t)}createSupercircle(t){const e=1/t,s=this._dim.getMinSize()/2,n=this._dim.getCentre(),i=Math.pow(s,t),r=s,o=Math.pow(i/2,e),l=Math.trunc(this._nPts/8),a=new Array(8*l+1).fill(null),c=o/l;for(let s=0;s<=l;s++){let o=0,h=r;if(0!==s){o=c*s;const n=Math.pow(o,t);h=Math.pow(i-n,e)}a[s]=this.coordTrans(o,h,n),a[2*l-s]=this.coordTrans(h,o,n),a[2*l+s]=this.coordTrans(h,-o,n),a[4*l-s]=this.coordTrans(o,-h,n),a[4*l+s]=this.coordTrans(-o,-h,n),a[6*l-s]=this.coordTrans(-h,-o,n),a[6*l+s]=this.coordTrans(-h,o,n),a[8*l-s]=this.coordTrans(-o,h,n)}a[a.length-1]=new m(a[0]);const h=this._geomFact.createLinearRing(a),u=this._geomFact.createPolygon(h);return this.rotate(u)}setNumPoints(t){this._nPts=t}coordTrans(t,e,s){return this.coord(t+s.x,e+s.y)}createSquircle(){return this.createSupercircle(4)}setEnvelope(t){this._dim.setEnvelope(t)}setCentre(t){this._dim.setCentre(t)}}class Ce{constructor(){Ce.constructor_.apply(this,arguments)}static constructor_(){this.base=null,this.centre=null,this.width=null,this.height=null}setBase(t){this.base=t}setWidth(t){this.width=t}getBase(){return this.base}getWidth(){return this.width}getEnvelope(){return null!==this.base?new O(this.base.x,this.base.x+this.width,this.base.y,this.base.y+this.height):null!==this.centre?new O(this.centre.x-this.width/2,this.centre.x+this.width/2,this.centre.y-this.height/2,this.centre.y+this.height/2):new O(0,this.width,0,this.height)}getCentre(){return null===this.centre&&(this.centre=new m(this.base.x+this.width/2,this.base.y+this.height/2)),this.centre}getHeight(){return this.height}setHeight(t){this.height=t}setSize(t){this.height=t,this.width=t}setEnvelope(t){this.width=t.getWidth(),this.height=t.getHeight(),this.base=new m(t.getMinX(),t.getMinY()),this.centre=new m(t.centre())}setCentre(t){this.centre=t}getMinSize(){return Math.min(this.width,this.height)}}we.Dimensions=Ce;class Se extends we{constructor(){super(),Se.constructor_.apply(this,arguments)}static constructor_(){if(this._numArms=8,this._armLengthRatio=.5,0===arguments.length)we.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];we.constructor_.call(this,t)}}static create(t,e,s,n,i){const r=new Se;r.setCentre(t),r.setSize(e),r.setNumPoints(s),r.setArmLengthRatio(i),r.setNumArms(n);return r.createSineStar()}setArmLengthRatio(t){this._armLengthRatio=t}createSineStar(){const t=this._dim.getEnvelope(),e=t.getWidth()/2;let s=this._armLengthRatio;s<0&&(s=0),s>1&&(s=1);const n=s*e,i=(1-s)*e,r=t.getMinX()+e,o=t.getMinY()+e,l=new Array(this._nPts+1).fill(null);let a=0;for(let t=0;t<this._nPts;t++){const e=t/this._nPts*this._numArms,s=e-Math.floor(e),c=2*Math.PI*s,h=i+n*((Math.cos(c)+1)/2),u=t*(2*Math.PI/this._nPts),g=h*Math.cos(u)+r,d=h*Math.sin(u)+o;l[a++]=this.coord(g,d)}l[a]=new m(l[0]);const c=this._geomFact.createLinearRing(l);return this._geomFact.createPolygon(c)}setNumArms(t){this._numArms=t}}var Le=Object.freeze({__proto__:null,AffineTransformation:ie,AffineTransformationBuilder:oe,AffineTransformationFactory:le,ComponentCoordinateExtracter:ae,GeometryCollectionMapper:ce,GeometryCombiner:he,GeometryEditor:ue,GeometryExtracter:de,GeometryMapper:_e,GeometryTransformer:me,LineStringExtracter:fe,LinearComponentExtracter:ye,PointExtracter:Ee,PolygonExtracter:Ie,ShortCircuitedGeometryVisitor:Ne,SineStarFactory:Se}),Te=Object.freeze({__proto__:null,Coordinate:m,CoordinateList:R,CoordinateSequenceFilter:P,CoordinateXY:y,CoordinateXYM:x,CoordinateXYZM:E,Dimension:Z,Envelope:O,Geometry:j,GeometryCollection:ut,GeometryFactory:Lt,IntersectionMatrix:Jt,LineSegment:Kt,LineString:tt,LinearRing:et,Location:Qt,MultiLineString:Et,MultiPoint:St,MultiPolygon:dt,Point:Nt,Polygon:Ct,PrecisionModel:yt,Triangle:se,util:Le});class Re{constructor(){Re.constructor_.apply(this,arguments)}static constructor_(){this._pt=[new m,new m],this._distance=r.NaN,this._isNull=!0}getCoordinates(){return this._pt}getCoordinate(t){return this._pt[t]}setMinimum(){if(1===arguments.length){const t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;const s=t.distance(e);s<this._distance&&this.initialize(t,e,s)}}initialize(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=s,this._isNull=!1}}toString(){return Wt.toLineString(this._pt[0],this._pt[1])}getDistance(){return this._distance}setMaximum(){if(1===arguments.length){const t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;const s=t.distance(e);s>this._distance&&this.initialize(t,e,s)}}}class Pe{static computeDistance(){if(arguments[2]instanceof Re&&arguments[0]instanceof tt&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=arguments[2],n=new Kt,i=t.getCoordinates();for(let t=0;t<i.length-1;t++){n.setCoordinates(i[t],i[t+1]);const r=n.closestPoint(e);s.setMinimum(r,e)}}else if(arguments[2]instanceof Re&&arguments[0]instanceof Ct&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=arguments[2];Pe.computeDistance(t.getExteriorRing(),e,s);for(let n=0;n<t.getNumInteriorRing();n++)Pe.computeDistance(t.getInteriorRingN(n),e,s)}else if(arguments[2]instanceof Re&&arguments[0]instanceof j&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=arguments[2];if(t instanceof tt)Pe.computeDistance(t,e,s);else if(t instanceof Ct)Pe.computeDistance(t,e,s);else if(t instanceof ut){const n=t;for(let t=0;t<n.getNumGeometries();t++){const i=n.getGeometryN(t);Pe.computeDistance(i,e,s)}}else s.setMinimum(t.getCoordinate(),e)}else if(arguments[2]instanceof Re&&arguments[0]instanceof Kt&&arguments[1]instanceof m){const t=arguments[1],e=arguments[2],s=arguments[0].closestPoint(t);e.setMinimum(s,t)}}}class Oe{constructor(){Oe.constructor_.apply(this,arguments)}static constructor_(){this._g0=null,this._g1=null,this._ptDist=new Re,this._densifyFrac=0;const t=arguments[0],e=arguments[1];this._g0=t,this._g1=e}static distance(){if(2===arguments.length){return new Oe(arguments[0],arguments[1]).distance()}if(3===arguments.length){const t=arguments[2],e=new Oe(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}}getCoordinates(){return this._ptDist.getCoordinates()}setDensifyFraction(t){if(t>1||t<=0)throw new n("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t}compute(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)}distance(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()}computeOrientedDistance(t,e,s){const n=new ve(e);if(t.apply(n),s.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){const n=new Me(e,this._densifyFrac);t.apply(n),s.setMaximum(n.getMaxPointDistance())}}orientedDistance(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()}}class ve{constructor(){ve.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new Re,this._minPtDist=new Re,this._euclideanDist=new Pe,this._geom=null;const t=arguments[0];this._geom=t}filter(t){this._minPtDist.initialize(),Pe.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}getMaxPointDistance(){return this._maxPtDist}get interfaces_(){return[K]}}class Me{constructor(){Me.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new Re,this._minPtDist=new Re,this._geom=null,this._numSubSegs=0;const t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}filter(t,e){if(0===e)return null;const s=t.getCoordinate(e-1),n=t.getCoordinate(e),i=(n.x-s.x)/this._numSubSegs,r=(n.y-s.y)/this._numSubSegs;for(let t=0;t<this._numSubSegs;t++){const e=s.x+t*i,n=s.y+t*r,o=new m(e,n);this._minPtDist.initialize(),Pe.computeDistance(this._geom,o,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}}isGeometryChanged(){return!1}getMaxPointDistance(){return this._maxPtDist}isDone(){return!1}get interfaces_(){return[P]}}Oe.MaxPointDistanceFilter=ve,Oe.MaxDensifiedByFractionDistanceFilter=Me;var be=Object.freeze({__proto__:null,DiscreteHausdorffDistance:Oe,DistanceToPoint:Pe,PointPairDistance:Re});class De{visitItem(t){}}class Ae{locate(t){}}class Fe{constructor(){Fe.constructor_.apply(this,arguments)}static constructor_(){this._min=r.POSITIVE_INFINITY,this._max=r.NEGATIVE_INFINITY}getMin(){return this._min}intersects(t,e){return!(this._min>e||this._max<t)}getMax(){return this._max}toString(){return Wt.toLineString(new m(this._min,0),new m(this._max,0))}}Fe.NodeComparator=class{compare(t,e){const s=t,n=e,i=(s._min+s._max)/2,r=(n._min+n._max)/2;return i<r?-1:i>r?1:0}get interfaces_(){return[g]}};class Ge extends Fe{constructor(){super(),Ge.constructor_.apply(this,arguments)}static constructor_(){this._item=null;const t=arguments[0],e=arguments[1],s=arguments[2];this._min=t,this._max=e,this._item=s}query(t,e,s){if(!this.intersects(t,e))return null;s.visitItem(this._item)}}class qe extends Fe{constructor(){super(),qe.constructor_.apply(this,arguments)}static constructor_(){this._node1=null,this._node2=null;const t=arguments[0],e=arguments[1];this._node1=t,this._node2=e,this.buildExtent(this._node1,this._node2)}buildExtent(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)}query(t,e,s){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,s),null!==this._node2&&this._node2.query(t,e,s)}}class Be{constructor(){Be.constructor_.apply(this,arguments)}static constructor_(){this._leaves=new L,this._root=null,this._level=0}buildTree(){xe.sort(this._leaves,new Fe.NodeComparator);let t=this._leaves,e=null,s=new L;for(;;){if(this.buildLevel(t,s),1===s.size())return s.get(0);e=t,t=s,s=e}}insert(t,e,s){if(null!==this._root)throw new D("Index cannot be added to once it has been queried");this._leaves.add(new Ge(t,e,s))}query(t,e,s){if(this.init(),null===this._root)return null;this._root.query(t,e,s)}buildRoot(){if(null!==this._root)return null;this._root=this.buildTree()}printNode(t){Y.out.println(Wt.toLineString(new m(t._min,this._level),new m(t._max,this._level)))}init(){return null!==this._root||0===this._leaves.size()?null:void this.buildRoot()}buildLevel(t,e){this._level++,e.clear();for(let s=0;s<t.size();s+=2){const n=t.get(s);if(null===(s+1<t.size()?t.get(s):null))e.add(n);else{const n=new qe(t.get(s),t.get(s+1));e.add(n)}}}}class Ye{constructor(){Ye.constructor_.apply(this,arguments)}static constructor_(){this._items=new L}getItems(){return this._items}visitItem(t){this._items.add(t)}get interfaces_(){return[De]}}class ze{constructor(){ze.constructor_.apply(this,arguments)}static constructor_(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;const t=arguments[0];this._p=t}static locatePointInRing(){if(arguments[0]instanceof m&&I(arguments[1],G)){const t=arguments[1],e=new ze(arguments[0]),s=new m,n=new m;for(let i=1;i<t.size();i++)if(t.getCoordinate(i,s),t.getCoordinate(i-1,n),e.countSegment(s,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof m&&arguments[1]instanceof Array){const t=arguments[1],e=new ze(arguments[0]);for(let s=1;s<t.length;s++){const n=t[s],i=t[s-1];if(e.countSegment(n,i),e.isOnSegment())return e.getLocation()}return e.getLocation()}}getLocation(){return this._isPointOnSegment?Qt.BOUNDARY:this._crossingCount%2==1?Qt.INTERIOR:Qt.EXTERIOR}isPointInPolygon(){return this.getLocation()!==Qt.EXTERIOR}isOnSegment(){return this._isPointOnSegment}countSegment(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){let s=t.x,n=e.x;return s>n&&(s=e.x,n=t.x),this._p.x>=s&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){let s=q.index(t,e,this._p);if(s===q.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(s=-s),s===q.LEFT&&this._crossingCount++}}}class Ve{constructor(){Ve.constructor_.apply(this,arguments)}static constructor_(){this._geom=null,this._index=null;const t=arguments[0];if(!(I(t,gt)||t instanceof et))throw new n("Argument must be Polygonal or LinearRing");this._geom=t}locate(t){null===this._index&&(this._index=new Xe(this._geom),this._geom=null);const e=new ze(t),s=new ke(e);return this._index.query(t.y,t.y,s),e.getLocation()}get interfaces_(){return[Ae]}}class ke{constructor(){ke.constructor_.apply(this,arguments)}static constructor_(){this._counter=null;const t=arguments[0];this._counter=t}visitItem(t){const e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))}get interfaces_(){return[De]}}class Xe{constructor(){Xe.constructor_.apply(this,arguments)}static constructor_(){this._isEmpty=!1,this._index=new Be;const t=arguments[0];t.isEmpty()?this._isEmpty=!0:this.init(t)}init(t){for(let e=ye.getLines(t).iterator();e.hasNext();){const t=e.next().getCoordinates();this.addLine(t)}}addLine(t){for(let e=1;e<t.length;e++){const s=new Kt(t[e-1],t[e]),n=Math.min(s.p0.y,s.p1.y),i=Math.max(s.p0.y,s.p1.y);this._index.insert(n,i,s)}}query(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this._isEmpty)return new L;const s=new Ye;return this._index.query(t,e,s),s.getItems()}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(this._isEmpty)return null;this._index.query(t,e,s)}}}Ve.SegmentVisitor=ke,Ve.IntervalIndexedGeometry=Xe;class Ue{static isInRing(t,e){return Ue.locateInRing(t,e)!==Qt.EXTERIOR}static locateInRing(t,e){return ze.locatePointInRing(t,e)}static isOnLine(){if(arguments[0]instanceof m&&I(arguments[1],G)){const t=arguments[0],e=arguments[1],s=new jt,n=new m,i=new m,r=e.size();for(let o=1;o<r;o++)if(e.getCoordinate(o-1,n),e.getCoordinate(o,i),s.computeIntersection(t,n,i),s.hasIntersection())return!0;return!1}if(arguments[0]instanceof m&&arguments[1]instanceof Array){const t=arguments[0],e=arguments[1],s=new jt;for(let n=1;n<e.length;n++){const i=e[n-1],r=e[n];if(s.computeIntersection(t,i,r),s.hasIntersection())return!0}return!1}}}class He{hasNext(){}next(){}remove(){}}class We{constructor(){We.constructor_.apply(this,arguments)}static constructor_(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;const t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}static isAtomic(t){return!(t instanceof ut)}next(){if(this._atStart)return this._atStart=!1,We.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new S;const t=this._parent.getGeometryN(this._index++);return t instanceof ut?(this._subcollectionIterator=new We(t),this._subcollectionIterator.next()):t}hasNext(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}remove(){throw new U(this.getClass().getName())}get interfaces_(){return[He]}}class Ze{constructor(){Ze.constructor_.apply(this,arguments)}static constructor_(){this._geom=null;const t=arguments[0];this._geom=t}static locatePointInPolygon(t,e){if(e.isEmpty())return Qt.EXTERIOR;const s=e.getExteriorRing(),n=Ze.locatePointInRing(t,s);if(n!==Qt.INTERIOR)return n;for(let s=0;s<e.getNumInteriorRing();s++){const n=e.getInteriorRingN(s),i=Ze.locatePointInRing(t,n);if(i===Qt.BOUNDARY)return Qt.BOUNDARY;if(i===Qt.INTERIOR)return Qt.EXTERIOR}return Qt.INTERIOR}static locatePointInRing(t,e){return e.getEnvelopeInternal().intersects(t)?Ue.locateInRing(t,e.getCoordinates()):Qt.EXTERIOR}static isContained(t,e){return Qt.EXTERIOR!==Ze.locate(t,e)}static locate(t,e){return e.isEmpty()?Qt.EXTERIOR:e.getEnvelopeInternal().intersects(t)?Ze.locateInGeometry(t,e):Qt.EXTERIOR}static containsPointInPolygon(t,e){return Qt.EXTERIOR!==Ze.locatePointInPolygon(t,e)}static locateInGeometry(t,e){if(e instanceof Ct)return Ze.locatePointInPolygon(t,e);if(e instanceof ut){const s=new We(e);for(;s.hasNext();){const n=s.next();if(n!==e){const e=Ze.locateInGeometry(t,n);if(e!==Qt.EXTERIOR)return e}}}return Qt.EXTERIOR}locate(t){return Ze.locate(t,this._geom)}get interfaces_(){return[Ae]}}var je=Object.freeze({__proto__:null,IndexedPointInAreaLocator:Ve,PointOnGeometryLocator:Ae,SimplePointInAreaLocator:Ze});class Ke{measure(t,e){}}class Qe{constructor(){Qe.constructor_.apply(this,arguments)}static constructor_(){if(this._quadrantSegments=Qe.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=Qe.CAP_ROUND,this._joinStyle=Qe.JOIN_ROUND,this._mitreLimit=Qe.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=Qe.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.setQuadrantSegments(t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.setQuadrantSegments(t),this.setEndCapStyle(e)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this.setQuadrantSegments(t),this.setEndCapStyle(e),this.setJoinStyle(s),this.setMitreLimit(n)}}static bufferDistanceError(t){const e=Math.PI/2/t;return 1-Math.cos(e/2)}getEndCapStyle(){return this._endCapStyle}isSingleSided(){return this._isSingleSided}setQuadrantSegments(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Qe.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Qe.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Qe.JOIN_ROUND&&(this._quadrantSegments=Qe.DEFAULT_QUADRANT_SEGMENTS)}getJoinStyle(){return this._joinStyle}setJoinStyle(t){this._joinStyle=t}setSimplifyFactor(t){this._simplifyFactor=t<0?0:t}getSimplifyFactor(){return this._simplifyFactor}getQuadrantSegments(){return this._quadrantSegments}setEndCapStyle(t){this._endCapStyle=t}getMitreLimit(){return this._mitreLimit}setMitreLimit(t){this._mitreLimit=t}setSingleSided(t){this._isSingleSided=t}}Qe.CAP_ROUND=1,Qe.CAP_FLAT=2,Qe.CAP_SQUARE=3,Qe.JOIN_ROUND=1,Qe.JOIN_MITRE=2,Qe.JOIN_BEVEL=3,Qe.DEFAULT_QUADRANT_SEGMENTS=8,Qe.DEFAULT_MITRE_LIMIT=5,Qe.DEFAULT_SIMPLIFY_FACTOR=.01;class Je{static relativeSign(t,e){return t<e?-1:t>e?1:0}static compareValue(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}static compare(t,e,s){if(e.equals2D(s))return 0;const n=Je.relativeSign(e.x,s.x),i=Je.relativeSign(e.y,s.y);switch(t){case 0:return Je.compareValue(n,i);case 1:return Je.compareValue(i,n);case 2:return Je.compareValue(i,-n);case 3:return Je.compareValue(-n,i);case 4:return Je.compareValue(-n,-i);case 5:return Je.compareValue(-i,-n);case 6:return Je.compareValue(-i,n);case 7:return Je.compareValue(n,-i)}return h.shouldNeverReachHere("invalid octant value"),0}}class $e{constructor(){$e.constructor_.apply(this,arguments)}static constructor_(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this._segString=t,this.coord=new m(e),this.segmentIndex=s,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(s))}getCoordinate(){return this.coord}print(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}compareTo(t){const e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:this._isInterior?e._isInterior?Je.compare(this._segmentOctant,this.coord,e.coord):1:-1}isEndPoint(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t}toString(){return this.segmentIndex+":"+this.coord.toString()}isInterior(){return this._isInterior}get interfaces_(){return[o]}}class ts extends _t{}function es(t){return null==t?0:t.color}function ss(t){return null==t?null:t.parent}function ns(t,e){null!==t&&(t.color=e)}function is(t){return null==t?null:t.left}function rs(t){return null==t?null:t.right}class os extends ts{constructor(){super(),this.root_=null,this.size_=0}get(t){let e=this.root_;for(;null!==e;){const s=t.compareTo(e.key);if(s<0)e=e.left;else{if(!(s>0))return e.value;e=e.right}}return null}put(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue(){return this.value},getKey(){return this.key}},this.size_=1,null;let s,n,i=this.root_;do{if(s=i,n=t.compareTo(i.key),n<0)i=i.left;else{if(!(n>0)){const t=i.value;return i.value=e,t}i=i.right}}while(null!==i);const r={key:t,left:null,right:null,value:e,parent:s,color:0,getValue(){return this.value},getKey(){return this.key}};return n<0?s.left=r:s.right=r,this.fixAfterInsertion(r),this.size_++,null}fixAfterInsertion(t){let e;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)ss(t)===is(ss(ss(t)))?(e=rs(ss(ss(t))),1===es(e)?(ns(ss(t),0),ns(e,0),ns(ss(ss(t)),1),t=ss(ss(t))):(t===rs(ss(t))&&(t=ss(t),this.rotateLeft(t)),ns(ss(t),0),ns(ss(ss(t)),1),this.rotateRight(ss(ss(t))))):(e=is(ss(ss(t))),1===es(e)?(ns(ss(t),0),ns(e,0),ns(ss(ss(t)),1),t=ss(ss(t))):(t===is(ss(t))&&(t=ss(t),this.rotateRight(t)),ns(ss(t),0),ns(ss(ss(t)),1),this.rotateLeft(ss(ss(t)))));this.root_.color=0}values(){const t=new L;let e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=os.successor(e));)t.add(e.value);return t}entrySet(){const t=new pt;let e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=os.successor(e));)t.add(e);return t}rotateLeft(t){if(null!=t){const e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}}rotateRight(t){if(null!=t){const e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}}getFirstEntry(){let t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t}static successor(t){let e;if(null===t)return null;if(null!==t.right){for(e=t.right;null!==e.left;)e=e.left;return e}{e=t.parent;let s=t;for(;null!==e&&s===e.right;)s=e,e=e.parent;return e}}size(){return this.size_}containsKey(t){let e=this.root_;for(;null!==e;){const s=t.compareTo(e.key);if(s<0)e=e.left;else{if(!(s>0))return!0;e=e.right}}return!1}}class ls{constructor(){ls.constructor_.apply(this,arguments)}static constructor_(){this._nodeMap=new os,this._edge=null;const t=arguments[0];this._edge=t}getSplitCoordinates(){const t=new R;this.addEndpoints();const e=this.iterator();let s=e.next();for(;e.hasNext();){const n=e.next();this.addEdgeCoordinates(s,n,t),s=n}return t.toCoordinateArray()}print(t){t.println("Intersections:");for(let e=this.iterator();e.hasNext();){e.next().print(t)}}findCollapsesFromExistingVertices(t){for(let e=0;e<this._edge.size()-2;e++){const s=this._edge.getCoordinate(e);this._edge.getCoordinate(e+1);const n=this._edge.getCoordinate(e+2);s.equals2D(n)&&t.add(M.valueOf(e+1))}}addEdgeCoordinates(t,e,s){const n=this.createSplitEdgePts(t,e);s.add(n,!1)}findCollapseIndex(t,e,s){if(!t.coord.equals2D(e.coord))return!1;let n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(s[0]=t.segmentIndex+1,!0)}findCollapsesFromInsertedNodes(t){const e=new Array(1).fill(null),s=this.iterator();let n=s.next();for(;s.hasNext();){const i=s.next();this.findCollapseIndex(n,i,e)&&t.add(M.valueOf(e[0])),n=i}}getEdge(){return this._edge}addEndpoints(){const t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)}createSplitEdge(t,e){const s=this.createSplitEdgePts(t,e);return new us(s,this._edge.getData())}add(t,e){const s=new $e(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(s);return null!==n?(h.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(s,s),s)}checkSplitEdgesCorrectness(t){const e=this._edge.getCoordinates(),s=t.get(0).getCoordinate(0);if(!s.equals2D(e[0]))throw new a("bad split edge start point at "+s);const n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new a("bad split edge end point at "+i)}addCollapsedNodes(){const t=new L;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(let e=t.iterator();e.hasNext();){const t=e.next().intValue();this.add(this._edge.getCoordinate(t),t)}}createSplitEdgePts(t,e){let s=e.segmentIndex-t.segmentIndex+2;if(2===s)return[new m(t.coord),new m(e.coord)];const n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||s--;const r=new Array(s).fill(null);let o=0;r[o++]=new m(t.coord);for(let s=t.segmentIndex+1;s<=e.segmentIndex;s++)r[o++]=this._edge.getCoordinate(s);return i&&(r[o]=new m(e.coord)),r}iterator(){return this._nodeMap.values().iterator()}addSplitEdges(t){this.addEndpoints(),this.addCollapsedNodes();const e=this.iterator();let s=e.next();for(;e.hasNext();){const n=e.next(),i=this.createSplitEdge(s,n);t.add(i),s=n}}}class as{static octant(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the octant for point ( "+t+", "+e+" )");const s=Math.abs(t),i=Math.abs(e);return t>=0?e>=0?s>=i?0:1:s>=i?7:6:e>=0?s>=i?3:2:s>=i?4:5}if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=e.x-t.x,i=e.y-t.y;if(0===s&&0===i)throw new n("Cannot compute the octant for two identical points "+t);return as.octant(s,i)}}}class cs{getCoordinates(){}size(){}getCoordinate(t){}isClosed(){}setData(t){}getData(){}}class hs{addIntersection(t,e){}get interfaces_(){return[cs]}}class us{constructor(){us.constructor_.apply(this,arguments)}static constructor_(){this._nodeList=new ls(this),this._pts=null,this._data=null;const t=arguments[0],e=arguments[1];this._pts=t,this._data=e}static getNodedSubstrings(){if(1===arguments.length){const t=arguments[0],e=new L;return us.getNodedSubstrings(t,e),e}if(2===arguments.length){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();){e.next().getNodeList().addSplitEdges(t)}}}getCoordinates(){return this._pts}size(){return this._pts.length}getCoordinate(t){return this._pts[t]}isClosed(){return this._pts[0].equals(this._pts[this._pts.length-1])}getSegmentOctant(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}toString(){return Wt.toLineString(new it(this._pts))}getNodeList(){return this._nodeList}addIntersectionNode(t,e){let s=e;const n=s+1;if(n<this._pts.length){const e=this._pts[n];t.equals2D(e)&&(s=n)}return this._nodeList.add(t,s)}addIntersections(t,e,s){for(let n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,s,n)}setData(t){this._data=t}safeOctant(t,e){return t.equals2D(e)?0:as.octant(t,e)}getData(){return this._data}addIntersection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){const t=arguments[1],e=arguments[3],s=new m(arguments[0].getIntersection(e));this.addIntersection(s,t)}}get interfaces_(){return[hs]}}class gs{getNodedSubstrings(){}computeNodes(t){}}class ds{constructor(){ds.constructor_.apply(this,arguments)}static constructor_(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){const t=arguments[0],e=arguments[1];ds.constructor_.call(this,t,e,0,0)}else if(4===arguments.length){const t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._isScaled=!this.isIntegerPrecision()}}rescale(){if(I(arguments[0],N)){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.rescale(e.getCoordinates())}}else if(arguments[0]instanceof Array){const t=arguments[0];for(let e=0;e<t.length;e++)t[e].x=t[e].x/this._scaleFactor+this._offsetX,t[e].y=t[e].y/this._scaleFactor+this._offsetY;2===t.length&&t[0].equals2D(t[1])&&Y.out.println(t)}}scale(){if(I(arguments[0],N)){const t=arguments[0],e=new L(t.size());for(let s=t.iterator();s.hasNext();){const t=s.next();e.add(new us(this.scale(t.getCoordinates()),t.getData()))}return e}if(arguments[0]instanceof Array){const t=arguments[0],e=new Array(t.length).fill(null);for(let s=0;s<t.length;s++)e[s]=new m(Math.round((t[s].x-this._offsetX)*this._scaleFactor),Math.round((t[s].y-this._offsetY)*this._scaleFactor),t[s].getZ());return W.removeRepeatedPoints(e)}}isIntegerPrecision(){return 1===this._scaleFactor}getNodedSubstrings(){const t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}computeNodes(t){let e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}get interfaces_(){return[gs]}}class _s extends a{constructor(t,e){super(e?t+" [ "+e+" ]":t),this.pt=e?new m(e):void 0,this.name=Object.keys({TopologyException:_s})[0]}getCoordinate(){return this.pt}}class ps{constructor(){ps.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._segStrings=null;const t=arguments[0];this._segStrings=t}checkEndPtVertexIntersections(){if(0===arguments.length)for(let t=this._segStrings.iterator();t.hasNext();){const e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2===arguments.length){const t=arguments[0];for(let e=arguments[1].iterator();e.hasNext();){const s=e.next().getCoordinates();for(let e=1;e<s.length-1;e++)if(s[e].equals(t))throw new a("found endpt/interior pt intersection at index "+e+" :pt "+t)}}}checkInteriorIntersections(){if(0===arguments.length)for(let t=this._segStrings.iterator();t.hasNext();){const e=t.next();for(let t=this._segStrings.iterator();t.hasNext();){const s=t.next();this.checkInteriorIntersections(e,s)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1],s=t.getCoordinates(),n=e.getCoordinates();for(let i=0;i<s.length-1;i++)for(let s=0;s<n.length-1;s++)this.checkInteriorIntersections(t,i,e,s)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];if(t===s&&e===n)return null;const i=t.getCoordinates()[e],r=t.getCoordinates()[e+1],o=s.getCoordinates()[n],l=s.getCoordinates()[n+1];if(this._li.computeIntersection(i,r,o,l),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,i,r)||this.hasInteriorIntersection(this._li,o,l)))throw new a("found non-noded intersection at "+i+"-"+r+" and "+o+"-"+l)}}checkValid(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}checkCollapses(){if(0===arguments.length)for(let t=this._segStrings.iterator();t.hasNext();){const e=t.next();this.checkCollapses(e)}else if(1===arguments.length){const t=arguments[0].getCoordinates();for(let e=0;e<t.length-2;e++)this.checkCollapse(t[e],t[e+1],t[e+2])}}hasInteriorIntersection(t,e,s){for(let n=0;n<t.getIntersectionNum();n++){const i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(s))return!0}return!1}checkCollapse(t,e,s){if(t.equals(s))throw new a("found non-noded collapse at "+ps.fact.createLineString([t,e,s]))}}ps.fact=new Lt;class ms{getBounds(){}}class fs{constructor(){fs.constructor_.apply(this,arguments)}static constructor_(){this._bounds=null,this._item=null;const t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}getItem(){return this._item}getBounds(){return this._bounds}get interfaces_(){return[ms,l]}}function ys(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xs,Es;var Is=function(){if(Es)return xs;Es=1;var t=function(t,e){return t<e};function e(s){if(!(this instanceof e))return new e(s);this.array=[],this.size=0,this.compare=s||t}return e.prototype.clone=function(){var t=new e(this.compare);return t.size=this.size,t.array=this.array.slice(0,this.size),t},e.prototype.add=function(t){var e,s,n=this.size;for(this.array[this.size]=t,this.size+=1;n>0&&(e=n-1>>1,s=this.array[e],this.compare(t,s));)this.array[n]=s,n=e;this.array[n]=t},e.prototype.heapify=function(t){var e;for(this.array=t,this.size=t.length,e=this.size>>1;e>=0;e--)this._percolateDown(e)},e.prototype._percolateUp=function(t,e){for(var s,n,i=this.array[t];t>0&&(s=t-1>>1,n=this.array[s],e||this.compare(i,n));)this.array[t]=n,t=s;this.array[t]=i},e.prototype._percolateDown=function(t){for(var e,s,n,i=this.size,r=this.size>>>1,o=this.array[t];t<r&&(s=(e=1+(t<<1))+1,n=this.array[e],s<i&&this.compare(this.array[s],n)&&(e=s,n=this.array[s]),this.compare(n,o));)this.array[t]=n,t=e;this.array[t]=o},e.prototype._removeAt=function(t){if(!(t>this.size-1||t<0))return this._percolateUp(t,!0),this.poll()},e.prototype.remove=function(t){for(var e=0;e<this.size;e++)if(!this.compare(this.array[e],t)&&!this.compare(t,this.array[e]))return this._removeAt(e),!0;return!1},e.prototype.removeOne=function(t){if("function"==typeof t)for(var e=0;e<this.size;e++)if(t(this.array[e]))return this._removeAt(e)},e.prototype.removeMany=function(t,e){if("function"!=typeof t||this.size<1)return[];e=e?Math.min(e,this.size):this.size;for(var s=0,n=new Array(e),i=0,r=new Array(this.size);s<e&&!this.isEmpty();){var o=this.poll();t(o)?n[s++]=o:r[i++]=o}n.length=s;for(var l=0;l<i;)this.add(r[l++]);return n},e.prototype.peek=function(){if(0!=this.size)return this.array[0]},e.prototype.poll=function(){if(0!=this.size){var t=this.array[0];return this.size>1?(this.array[0]=this.array[--this.size],this._percolateDown(0)):this.size-=1,t}},e.prototype.replaceTop=function(t){if(0!=this.size){var e=this.array[0];return this.array[0]=t,this._percolateDown(0),e}},e.prototype.trim=function(){this.array=this.array.slice(0,this.size)},e.prototype.isEmpty=function(){return 0===this.size},e.prototype.forEach=function(t){if(!this.isEmpty()&&"function"==typeof t)for(var e=0,s=this.clone();!s.isEmpty();)t(s.poll(),e++)},e.prototype.kSmallest=function(t){if(0==this.size||t<=0)return[];t=Math.min(this.size,t);const s=Math.min(this.size,2**(t-1)+1);if(s<2)return[this.peek()];const n=new e(this.compare);n.size=s,n.array=this.array.slice(0,s);const i=new Array(t);for(let e=0;e<t;e++)i[e]=n.poll();return i},xs=e}(),Ns=ys(Is);let ws=class{constructor(){this._fpQueue=new Ns(((t,e)=>t.compareTo(e)<0))}poll(){return this._fpQueue.poll()}size(){return this._fpQueue.size}clear(){this._fpQueue=new Ns}peek(){return this._fpQueue.peek()}remove(){return this._fpQueue.poll()}isEmpty(){return this._fpQueue.isEmpty()}add(t){this._fpQueue.add(t)}};class Cs{query(){}insert(t,e){}remove(t,e){}}class Ss{constructor(){Ss.constructor_.apply(this,arguments)}static constructor_(){if(this._childBoundables=new L,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._level=t}}getLevel(){return this._level}addChildBoundable(t){h.isTrue(null===this._bounds),this._childBoundables.add(t)}isEmpty(){return this._childBoundables.isEmpty()}getBounds(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds}size(){return this._childBoundables.size()}getChildBoundables(){return this._childBoundables}get interfaces_(){return[ms,l]}}class Ls{static distance(t,e,s,n){const i=s-t,r=n-e;return Math.sqrt(i*i+r*r)}static maximumDistance(t,e){const s=Math.min(t.getMinX(),e.getMinX()),n=Math.min(t.getMinY(),e.getMinY()),i=Math.max(t.getMaxX(),e.getMaxX()),r=Math.max(t.getMaxY(),e.getMaxY());return Ls.distance(s,n,i,r)}static minMaxDistance(t,e){const s=t.getMinX(),n=t.getMinY(),i=t.getMaxX(),r=t.getMaxY(),o=e.getMinX(),l=e.getMinY(),a=e.getMaxX(),c=e.getMaxY();let h=Ls.maxDistance(s,n,s,r,o,l,o,c);return h=Math.min(h,Ls.maxDistance(s,n,s,r,o,l,a,l)),h=Math.min(h,Ls.maxDistance(s,n,s,r,a,c,o,c)),h=Math.min(h,Ls.maxDistance(s,n,s,r,a,c,a,l)),h=Math.min(h,Ls.maxDistance(s,n,i,n,o,l,o,c)),h=Math.min(h,Ls.maxDistance(s,n,i,n,o,l,a,l)),h=Math.min(h,Ls.maxDistance(s,n,i,n,a,c,o,c)),h=Math.min(h,Ls.maxDistance(s,n,i,n,a,c,a,l)),h=Math.min(h,Ls.maxDistance(i,r,s,r,o,l,o,c)),h=Math.min(h,Ls.maxDistance(i,r,s,r,o,l,a,l)),h=Math.min(h,Ls.maxDistance(i,r,s,r,a,c,o,c)),h=Math.min(h,Ls.maxDistance(i,r,s,r,a,c,a,l)),h=Math.min(h,Ls.maxDistance(i,r,i,n,o,l,o,c)),h=Math.min(h,Ls.maxDistance(i,r,i,n,o,l,a,l)),h=Math.min(h,Ls.maxDistance(i,r,i,n,a,c,o,c)),h=Math.min(h,Ls.maxDistance(i,r,i,n,a,c,a,l)),h}static maxDistance(t,e,s,n,i,r,o,l){let a=Ls.distance(t,e,i,r);return a=Math.max(a,Ls.distance(t,e,o,l)),a=Math.max(a,Ls.distance(s,n,i,r)),a=Math.max(a,Ls.distance(s,n,o,l)),a}}class Ts{constructor(){Ts.constructor_.apply(this,arguments)}static constructor_(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;const t=arguments[0],e=arguments[1],s=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=s,this._distance=this.distance()}static area(t){return t.getBounds().getArea()}static isComposite(t){return t instanceof Ss}maximumDistance(){return Ls.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}expandToQueue(t,e){const s=Ts.isComposite(this._boundable1),i=Ts.isComposite(this._boundable2);if(s&&i)return Ts.area(this._boundable1)>Ts.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(s)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new n("neither boundable is composite")}isLeaves(){return!(Ts.isComposite(this._boundable1)||Ts.isComposite(this._boundable2))}getBoundable(t){return 0===t?this._boundable1:this._boundable2}getDistance(){return this._distance}distance(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}compareTo(t){const e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}expand(t,e,s,n,i){for(let r=t.getChildBoundables().iterator();r.hasNext();){const t=r.next();let o=null;o=s?new Ts(e,t,this._itemDistance):new Ts(t,e,this._itemDistance),o.getDistance()<i&&n.add(o)}}get interfaces_(){return[o]}}class Rs{constructor(){Rs.constructor_.apply(this,arguments)}static constructor_(){if(this._root=null,this._built=!1,this._itemBoundables=new L,this._nodeCapacity=null,0===arguments.length)Rs.constructor_.call(this,Rs.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){const t=arguments[0];h.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}static compareDoubles(t,e){return t>e?1:t<e?-1:0}queryInternal(){if(I(arguments[2],De)&&arguments[0]instanceof Object&&arguments[1]instanceof Ss){const t=arguments[0],e=arguments[2],s=arguments[1].getChildBoundables();for(let n=0;n<s.size();n++){const i=s.get(n);this.getIntersectsOp().intersects(i.getBounds(),t)&&(i instanceof Ss?this.queryInternal(t,i,e):i instanceof fs?e.visitItem(i.getItem()):h.shouldNeverReachHere())}}else if(I(arguments[2],C)&&arguments[0]instanceof Object&&arguments[1]instanceof Ss){const t=arguments[0],e=arguments[2],s=arguments[1].getChildBoundables();for(let n=0;n<s.size();n++){const i=s.get(n);this.getIntersectsOp().intersects(i.getBounds(),t)&&(i instanceof Ss?this.queryInternal(t,i,e):i instanceof fs?e.add(i.getItem()):h.shouldNeverReachHere())}}}insert(t,e){h.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new fs(t,e))}boundablesAtLevel(){if(1===arguments.length){const t=arguments[0],e=new L;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(h.isTrue(t>-2),e.getLevel()===t)return s.add(e),null;for(let n=e.getChildBoundables().iterator();n.hasNext();){const e=n.next();e instanceof Ss?this.boundablesAtLevel(t,e,s):(h.isTrue(e instanceof fs),-1===t&&s.add(e))}return null}}getRoot(){return this.build(),this._root}remove(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];let n=this.removeItem(e,s);if(n)return!0;let i=null;for(let r=e.getChildBoundables().iterator();r.hasNext();){const e=r.next();if(this.getIntersectsOp().intersects(e.getBounds(),t)&&(e instanceof Ss&&(n=this.remove(t,e,s),n))){i=e;break}}return null!==i&&i.getChildBoundables().isEmpty()&&e.getChildBoundables().remove(i),n}}createHigherLevels(t,e){h.isTrue(!t.isEmpty());const s=this.createParentBoundables(t,e+1);return 1===s.size()?s.get(0):this.createHigherLevels(s,e+1)}depth(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){let t=0;for(let e=arguments[0].getChildBoundables().iterator();e.hasNext();){const s=e.next();if(s instanceof Ss){const e=this.depth(s);e>t&&(t=e)}}return t+1}}createParentBoundables(t,e){h.isTrue(!t.isEmpty());const s=new L;s.add(this.createNode(e));const n=new L(t);xe.sort(n,this.getComparator());for(let t=n.iterator();t.hasNext();){const n=t.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(e)),this.lastNode(s).addChildBoundable(n)}return s}isEmpty(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}getNodeCapacity(){return this._nodeCapacity}lastNode(t){return t.get(t.size()-1)}size(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){let t=0;for(let e=arguments[0].getChildBoundables().iterator();e.hasNext();){const s=e.next();s instanceof Ss?t+=this.size(s):s instanceof fs&&(t+=1)}return t}}removeItem(t,e){let s=null;for(let n=t.getChildBoundables().iterator();n.hasNext();){const t=n.next();t instanceof fs&&t.getItem()===e&&(s=t)}return null!==s&&(t.getChildBoundables().remove(s),!0)}itemsTree(){if(0===arguments.length){this.build();const t=this.itemsTree(this._root);return null===t?new L:t}if(1===arguments.length){const t=arguments[0],e=new L;for(let s=t.getChildBoundables().iterator();s.hasNext();){const t=s.next();if(t instanceof Ss){const s=this.itemsTree(t);null!==s&&e.add(s)}else t instanceof fs?e.add(t.getItem()):h.shouldNeverReachHere()}return e.size()<=0?null:e}}query(){if(1===arguments.length){const t=arguments[0];this.build();const e=new L;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e)}}build(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}get interfaces_(){return[l]}}Rs.IntersectsOp=function(){},Rs.DEFAULT_NODE_CAPACITY=10;class Ps{distance(t,e){}}class Os extends Rs{constructor(){super(),Os.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)Os.constructor_.call(this,Os.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){const t=arguments[0];Rs.constructor_.call(this,t)}}static getItems(t){const e=new Array(t.size()).fill(null);let s=0;for(;!t.isEmpty();){const n=t.poll();e[s]=n.getBoundable(0).getItem(),s++}return e}static avg(t,e){return(t+e)/2}static centreY(t){return Os.avg(t.getMinY(),t.getMaxY())}static centreX(t){return Os.avg(t.getMinX(),t.getMaxX())}size(){return 0===arguments.length?super.size.call(this):super.size.apply(this,arguments)}insert(){if(!(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof O))return super.insert.apply(this,arguments);{const t=arguments[0],e=arguments[1];if(t.isNull())return null;super.insert.call(this,t,e)}}getIntersectsOp(){return Os.intersectsOp}verticalSlices(t,e){const s=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator();for(let t=0;t<e;t++){n[t]=new L;let e=0;for(;i.hasNext()&&e<s;){const s=i.next();n[t].add(s),e++}}return n}query(){if(1===arguments.length){const t=arguments[0];return super.query.call(this,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];super.query.call(this,t,e)}}getComparator(){return Os.yComparator}createParentBoundablesFromVerticalSlice(t,e){return super.createParentBoundables.call(this,t,e)}remove(){if(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof O){const t=arguments[0],e=arguments[1];return super.remove.call(this,t,e)}return super.remove.apply(this,arguments)}depth(){return 0===arguments.length?super.depth.call(this):super.depth.apply(this,arguments)}createParentBoundables(t,e){h.isTrue(!t.isEmpty());const s=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),n=new L(t);xe.sort(n,Os.xComparator);const i=this.verticalSlices(n,Math.trunc(Math.ceil(Math.sqrt(s))));return this.createParentBoundablesFromVerticalSlices(i,e)}nearestNeighbour(){if(1===arguments.length){if(I(arguments[0],Ps)){const t=arguments[0];if(this.isEmpty())return null;const e=new Ts(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof Ts){const t=arguments[0];let e=r.POSITIVE_INFINITY,s=null;const n=new ws;for(n.add(t);!n.isEmpty()&&e>0;){const t=n.poll(),i=t.getDistance();if(i>=e)break;t.isLeaves()?(e=i,s=t):t.expandToQueue(n,e)}return null===s?null:[s.getBoundable(0).getItem(),s.getBoundable(1).getItem()]}}else{if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isEmpty()||t.isEmpty())return null;const s=new Ts(this.getRoot(),t.getRoot(),e);return this.nearestNeighbour(s)}if(3===arguments.length){const t=arguments[2],e=new fs(arguments[0],arguments[1]),s=new Ts(this.getRoot(),e,t);return this.nearestNeighbour(s)[0]}if(4===arguments.length){const t=arguments[2],e=arguments[3],s=new fs(arguments[0],arguments[1]),n=new Ts(this.getRoot(),s,t);return this.nearestNeighbourK(n,e)}}}isWithinDistance(){if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=r.POSITIVE_INFINITY;const n=new ws;for(n.add(t);!n.isEmpty();){const t=n.poll(),i=t.getDistance();if(i>e)return!1;if(t.maximumDistance()<=e)return!0;if(t.isLeaves()){if(s=i,s<=e)return!0}else t.expandToQueue(n,s)}return!1}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=new Ts(this.getRoot(),t.getRoot(),e);return this.isWithinDistance(n,s)}}createParentBoundablesFromVerticalSlices(t,e){h.isTrue(t.length>0);const s=new L;for(let n=0;n<t.length;n++)s.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return s}nearestNeighbourK(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.nearestNeighbourK(t,r.POSITIVE_INFINITY,e)}if(3===arguments.length){const t=arguments[0],e=arguments[2];let s=arguments[1];const n=new ws;n.add(t);const i=new ws;for(;!n.isEmpty()&&s>=0;){const t=n.poll(),r=t.getDistance();if(r>=s)break;if(t.isLeaves())if(i.size()<e)i.add(t);else{i.peek().getDistance()>r&&(i.poll(),i.add(t));s=i.peek().getDistance()}else t.expandToQueue(n,s)}return Os.getItems(i)}}createNode(t){return new vs(t)}get interfaces_(){return[Cs,l]}}class vs extends Ss{constructor(){super(),vs.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0];Ss.constructor_.call(this,t)}computeBounds(){let t=null;for(let e=this.getChildBoundables().iterator();e.hasNext();){const s=e.next();null===t?t=new O(s.getBounds()):t.expandToInclude(s.getBounds())}return t}}Os.STRtreeNode=vs,Os.xComparator=new class{get interfaces_(){return[g]}compare(t,e){return Rs.compareDoubles(Os.centreX(t.getBounds()),Os.centreX(e.getBounds()))}},Os.yComparator=new class{get interfaces_(){return[g]}compare(t,e){return Rs.compareDoubles(Os.centreY(t.getBounds()),Os.centreY(e.getBounds()))}},Os.intersectsOp=new class{get interfaces_(){return[IntersectsOp]}intersects(t,e){return t.intersects(e)}},Os.DEFAULT_NODE_CAPACITY=10;class Ms{constructor(){Ms.constructor_.apply(this,arguments)}static constructor_(){this._overlapSeg1=new Kt,this._overlapSeg2=new Kt}overlap(){if(2===arguments.length);else if(4===arguments.length){const t=arguments[1],e=arguments[2],s=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}let bs=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=s,this._context=n}computeOverlaps(){if(2===arguments.length){const t=arguments[0],e=arguments[1];this.computeOverlaps(this._start,this._end,t,t._start,t._end,e)}else if(6===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];if(e-t==1&&i-n==1)return r.overlap(this,t,s,n),null;if(!this.overlaps(t,e,s,n,i))return null;const o=Math.trunc((t+e)/2),l=Math.trunc((n+i)/2);t<o&&(n<l&&this.computeOverlaps(t,o,s,n,l,r),l<i&&this.computeOverlaps(t,o,s,l,i,r)),o<e&&(n<l&&this.computeOverlaps(o,e,s,n,l,r),l<i&&this.computeOverlaps(o,e,s,l,i,r))}}setId(t){this._id=t}select(t,e){this.computeSelect(t,this._start,this._end,e)}getEnvelope(){if(null===this._env){const t=this._pts[this._start],e=this._pts[this._end];this._env=new O(t,e)}return this._env}overlaps(t,e,s,n,i){return O.intersects(this._pts[t],this._pts[e],s._pts[n],s._pts[i])}getEndIndex(){return this._end}getStartIndex(){return this._start}getContext(){return this._context}getId(){return this._id}getLineSegment(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]}computeSelect(t,e,s,n){const i=this._pts[e],r=this._pts[s];if(s-e==1)return n.select(this,e),null;if(!t.intersects(i,r))return null;const o=Math.trunc((e+s)/2);e<o&&this.computeSelect(t,e,o,n),o<s&&this.computeSelect(t,o,s,n)}getCoordinates(){const t=new Array(this._end-this._start+1).fill(null);let e=0;for(let s=this._start;s<=this._end;s++)t[e++]=this._pts[s];return t}};class Ds{static isNorthern(t){return t===Ds.NE||t===Ds.NW}static isOpposite(t,e){if(t===e)return!1;return 2===(t-e+4)%4}static commonHalfPlane(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;const s=t<e?t:e;return 0===s&&3===(t>e?t:e)?3:s}static isInHalfPlane(t,e){return e===Ds.SE?t===Ds.SE||t===Ds.SW:t===e||t===e+1}static quadrant(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Ds.NE:Ds.SE:e>=0?Ds.NW:Ds.SW}if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];if(e.x===t.x&&e.y===t.y)throw new n("Cannot compute the quadrant for two identical points "+t);return e.x>=t.x?e.y>=t.y?Ds.NE:Ds.SE:e.y>=t.y?Ds.NW:Ds.SW}}}Ds.NE=0,Ds.NW=1,Ds.SW=2,Ds.SE=3;class As{static findChainEnd(t,e){let s=e;for(;s<t.length-1&&t[s].equals2D(t[s+1]);)s++;if(s>=t.length-1)return t.length-1;const n=Ds.quadrant(t[s],t[s+1]);let i=e+1;for(;i<t.length;){if(!t[i-1].equals2D(t[i])){if(Ds.quadrant(t[i-1],t[i])!==n)break}i++}return i-1}static getChains(){if(1===arguments.length){const t=arguments[0];return As.getChains(t,null)}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new L;let n=0;do{const i=As.findChainEnd(t,n),r=new bs(t,n,i,e);s.add(r),n=i}while(n<t.length-1);return s}}}class Fs{constructor(){Fs.constructor_.apply(this,arguments)}static constructor_(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.setSegmentIntersector(t)}}setSegmentIntersector(t){this._segInt=t}get interfaces_(){return[gs]}}class Gs extends Fs{constructor(){super(),Gs.constructor_.apply(this,arguments)}static constructor_(){if(this._monoChains=new L,this._index=new Os,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];Fs.constructor_.call(this,t)}}getMonotoneChains(){return this._monoChains}getNodedSubstrings(){return us.getNodedSubstrings(this._nodedSegStrings)}getIndex(){return this._index}add(t){for(let e=As.getChains(t.getCoordinates(),t).iterator();e.hasNext();){const t=e.next();t.setId(this._idCounter++),this._index.insert(t.getEnvelope(),t),this._monoChains.add(t)}}computeNodes(t){this._nodedSegStrings=t;for(let e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()}intersectChains(){const t=new qs(this._segInt);for(let e=this._monoChains.iterator();e.hasNext();){const s=e.next();for(let e=this._index.query(s.getEnvelope()).iterator();e.hasNext();){const n=e.next();if(n.getId()>s.getId()&&(s.computeOverlaps(n,t),this._nOverlaps++),this._segInt.isDone())return null}}}}class qs extends Ms{constructor(){super(),qs.constructor_.apply(this,arguments)}static constructor_(){this._si=null;const t=arguments[0];this._si=t}overlap(){if(4!==arguments.length)return super.overlap.apply(this,arguments);{const t=arguments[1],e=arguments[2],s=arguments[3],n=arguments[0].getContext(),i=e.getContext();this._si.processIntersections(n,t,i,s)}}}Gs.SegmentOverlapAction=qs;class Bs{constructor(){Bs.constructor_.apply(this,arguments)}static constructor_(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;const t=arguments[0],e=arguments[1],s=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=s,e<=0)throw new n("Scale factor must be non-zero");1!==e&&(this._pt=new m(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new m,this._p1Scaled=new m),this.initCorners(this._pt)}intersectsScaled(t,e){const s=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),r=Math.max(t.y,e.y),o=this._maxx<s||this._minx>n||this._maxy<i||this._miny>r;if(o)return!1;const l=this.intersectsToleranceSquare(t,e);return h.isTrue(!(o&&l),"Found bad envelope test"),l}copyScaled(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}getSafeEnvelope(){if(null===this._safeEnv){const t=Bs.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new O(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}intersectsPixelClosure(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}intersectsToleranceSquare(t,e){let s=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!s||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))}addSnappedNode(t,e){const s=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(s,n)&&(t.addIntersection(this.getCoordinate(),e),!0)}initCorners(t){const e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new m(this._maxx,this._maxy),this._corner[1]=new m(this._minx,this._maxy),this._corner[2]=new m(this._minx,this._miny),this._corner[3]=new m(this._maxx,this._miny)}intersects(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}scale(t){return Math.round(t*this._scaleFactor)}getCoordinate(){return this._originalPt}}Bs.SAFE_ENV_EXPANSION_FACTOR=.75;class Ys{constructor(){Ys.constructor_.apply(this,arguments)}static constructor_(){this.selectedSegment=new Kt}select(){if(1===arguments.length);else if(2===arguments.length){const t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}class zs{constructor(){zs.constructor_.apply(this,arguments)}static constructor_(){this._index=null;const t=arguments[0];this._index=t}snap(){if(1===arguments.length){const t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=t.getSafeEnvelope(),i=new Vs(t,e,s);return this._index.query(n,new class{get interfaces_(){return[De]}visitItem(t){t.select(n,i)}}),i.isNodeAdded()}}}class Vs extends Ys{constructor(){super(),Vs.constructor_.apply(this,arguments)}static constructor_(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;const t=arguments[0],e=arguments[1],s=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=s}select(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof bs))return super.select.apply(this,arguments);{const t=arguments[1],e=arguments[0].getContext();if(this._parentEdge===e&&(t===this._hotPixelVertexIndex||t+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(e,t)}}isNodeAdded(){return this._isNodeAdded}}zs.HotPixelSnapAction=Vs;let ks=class{isDone(){}processIntersections(t,e,s,n){}};class Xs{constructor(){Xs.constructor_.apply(this,arguments)}static constructor_(){this._li=null,this._interiorIntersections=null;const t=arguments[0];this._li=t,this._interiorIntersections=new L}isDone(){return!1}processIntersections(t,e,s,n){if(t===s&&e===n)return null;const i=t.getCoordinates()[e],r=t.getCoordinates()[e+1],o=s.getCoordinates()[n],l=s.getCoordinates()[n+1];if(this._li.computeIntersection(i,r,o,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(let t=0;t<this._li.getIntersectionNum();t++)this._interiorIntersections.add(this._li.getIntersection(t));t.addIntersections(this._li,e,0),s.addIntersections(this._li,n,1)}}getInteriorIntersections(){return this._interiorIntersections}get interfaces_(){return[ks]}}class Us{constructor(){Us.constructor_.apply(this,arguments)}static constructor_(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;const t=arguments[0];this._pm=t,this._li=new jt,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}checkCorrectness(t){const e=us.getNodedSubstrings(t),n=new ps(e);try{n.checkValid()}catch(t){if(!(t instanceof s))throw t;t.printStackTrace()}}getNodedSubstrings(){return us.getNodedSubstrings(this._nodedSegStrings)}snapRound(t,e){const s=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(s),this.computeVertexSnaps(t)}findInteriorIntersections(t,e){const s=new Xs(e);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(t),s.getInteriorIntersections()}computeVertexSnaps(){if(I(arguments[0],N)){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.computeVertexSnaps(e)}}else if(arguments[0]instanceof us){const t=arguments[0],e=t.getCoordinates();for(let s=0;s<e.length;s++){const n=new Bs(e[s],this._scaleFactor,this._li);this._pointSnapper.snap(n,t,s)&&t.addIntersection(e[s],s)}}}computeNodes(t){this._nodedSegStrings=t,this._noder=new Gs,this._pointSnapper=new zs(this._noder.getIndex()),this.snapRound(t,this._li)}computeIntersectionSnaps(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),s=new Bs(t,this._scaleFactor,this._li);this._pointSnapper.snap(s)}}get interfaces_(){return[gs]}}class Hs{static opposite(t){return t===Hs.LEFT?Hs.RIGHT:t===Hs.RIGHT?Hs.LEFT:t}}Hs.ON=0,Hs.LEFT=1,Hs.RIGHT=2;class Ws extends s{constructor(t){super(t),this.name=Object.keys({EmptyStackException:Ws})[0]}}class Zs extends C{constructor(){super(),this.array=[]}add(t){return this.array.push(t),!0}get(t){if(t<0||t>=this.size())throw new w;return this.array[t]}push(t){return this.array.push(t),t}pop(){if(0===this.array.length)throw new Ws;return this.array.pop()}peek(){if(0===this.array.length)throw new Ws;return this.array[this.array.length-1]}empty(){return 0===this.array.length}isEmpty(){return this.empty()}search(t){return this.array.indexOf(t)}size(){return this.array.length}toArray(){return this.array.slice()}}class js{constructor(){js.constructor_.apply(this,arguments)}static constructor_(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}getCoordinate(){return this._minCoord}getRightmostSide(t,e){let s=this.getRightmostSideOfSegment(t,e);return s<0&&(s=this.getRightmostSideOfSegment(t,e-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),s}findRightmostEdgeAtVertex(){const t=this._minDe.getEdge().getCoordinates();h.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");const e=t[this._minIndex-1],s=t[this._minIndex+1],n=q.index(this._minCoord,s,e);let i=!1;(e.y<this._minCoord.y&&s.y<this._minCoord.y&&n===q.COUNTERCLOCKWISE||e.y>this._minCoord.y&&s.y>this._minCoord.y&&n===q.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)}getRightmostSideOfSegment(t,e){const s=t.getEdge().getCoordinates();if(e<0||e+1>=s.length)return-1;if(s[e].y===s[e+1].y)return-1;let n=Hs.LEFT;return s[e].y<s[e+1].y&&(n=Hs.RIGHT),n}getEdge(){return this._orientedDe}checkForRightmostCoordinate(t){const e=t.getEdge().getCoordinates();for(let s=0;s<e.length-1;s++)(null===this._minCoord||e[s].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=s,this._minCoord=e[s])}findRightmostEdgeAtNode(){const t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}findEdge(t){for(let e=t.iterator();e.hasNext();){const t=e.next();t.isForward()&&this.checkForRightmostCoordinate(t)}h.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;this.getRightmostSide(this._minDe,this._minIndex)===Hs.LEFT&&(this._orientedDe=this._minDe.getSym())}}class Ks{constructor(){this.array=[]}addLast(t){this.array.push(t)}removeFirst(){return this.array.shift()}isEmpty(){return 0===this.array.length}}class Qs{constructor(){Qs.constructor_.apply(this,arguments)}static constructor_(){this._finder=null,this._dirEdgeList=new L,this._nodes=new L,this._rightMostCoord=null,this._env=null,this._finder=new js}clearVisitedEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}}compareTo(t){const e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0}getEnvelope(){if(null===this._env){const t=new O;for(let e=this._dirEdgeList.iterator();e.hasNext();){const s=e.next().getEdge().getCoordinates();for(let e=0;e<s.length-1;e++)t.expandToInclude(s[e])}this._env=t}return this._env}addReachable(t){const e=new Zs;for(e.add(t);!e.empty();){const t=e.pop();this.add(t,e)}}copySymDepths(t){const e=t.getSym();e.setDepth(Hs.LEFT,t.getDepth(Hs.RIGHT)),e.setDepth(Hs.RIGHT,t.getDepth(Hs.LEFT))}add(t,e){t.setVisited(!0),this._nodes.add(t);for(let s=t.getEdges().iterator();s.hasNext();){const t=s.next();this._dirEdgeList.add(t);const n=t.getSym().getNode();n.isVisited()||e.push(n)}}getRightmostCoordinate(){return this._rightMostCoord}computeNodeDepth(t){let e=null;for(let s=t.getEdges().iterator();s.hasNext();){const t=s.next();if(t.isVisited()||t.getSym().isVisited()){e=t;break}}if(null===e)throw new _s("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(let e=t.getEdges().iterator();e.hasNext();){const t=e.next();t.setVisited(!0),this.copySymDepths(t)}}computeDepth(t){this.clearVisitedEdges();const e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(Hs.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)}create(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}findResultEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();){const e=t.next();e.getDepth(Hs.RIGHT)>=1&&e.getDepth(Hs.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}computeDepths(t){const e=new pt,s=new Ks,n=t.getNode();for(s.addLast(n),e.add(n),t.setVisited(!0);!s.isEmpty();){const t=s.removeFirst();e.add(t),this.computeNodeDepth(t);for(let n=t.getEdges().iterator();n.hasNext();){const t=n.next().getSym();if(t.isVisited())continue;const i=t.getNode();e.contains(i)||(s.addLast(i),e.add(i))}}}getNodes(){return this._nodes}getDirectedEdges(){return this._dirEdgeList}get interfaces_(){return[o]}}class Js{constructor(){Js.constructor_.apply(this,arguments)}static constructor_(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=q.COUNTERCLOCKWISE;const t=arguments[0];this._inputLine=t}static simplify(t,e){return new Js(t).simplify(e)}isDeletable(t,e,s,n){const i=this._inputLine[t],r=this._inputLine[e],o=this._inputLine[s];return!!this.isConcave(i,r,o)&&(!!this.isShallow(i,r,o,n)&&this.isShallowSampled(i,r,t,s,n))}deleteShallowConcavities(){let t=1,e=this.findNextNonDeletedIndex(t),s=this.findNextNonDeletedIndex(e),n=!1;for(;s<this._inputLine.length;){let i=!1;this.isDeletable(t,e,s,this._distanceTol)&&(this._isDeleted[e]=Js.DELETE,i=!0,n=!0),t=i?s:e,e=this.findNextNonDeletedIndex(t),s=this.findNextNonDeletedIndex(e)}return n}isShallowConcavity(t,e,s,n){if(!(q.index(t,e,s)===this._angleOrientation))return!1;return V.pointToSegment(e,t,s)<n}isShallowSampled(t,e,s,n,i){let r=Math.trunc((n-s)/Js.NUM_PTS_TO_CHECK);r<=0&&(r=1);for(let o=s;o<n;o+=r)if(!this.isShallow(t,e,this._inputLine[o],i))return!1;return!0}isConcave(t,e,s){return q.index(t,e,s)===this._angleOrientation}simplify(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=q.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);let e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()}findNextNonDeletedIndex(t){let e=t+1;for(;e<this._inputLine.length&&this._isDeleted[e]===Js.DELETE;)e++;return e}isShallow(t,e,s,n){return V.pointToSegment(e,t,s)<n}collapseLine(){const t=new R;for(let e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Js.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}Js.INIT=0,Js.DELETE=1,Js.KEEP=1,Js.NUM_PTS_TO_CHECK=10;class $s{constructor(){$s.constructor_.apply(this,arguments)}static constructor_(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new L}getCoordinates(){return this._ptList.toArray($s.COORDINATE_ARRAY_TYPE)}setPrecisionModel(t){this._precisionModel=t}addPt(t){const e=new m(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}reverse(){}addPts(t,e){if(e)for(let e=0;e<t.length;e++)this.addPt(t[e]);else for(let e=t.length-1;e>=0;e--)this.addPt(t[e])}isRedundant(t){if(this._ptList.size()<1)return!1;const e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}toString(){return(new Lt).createLineString(this.getCoordinates()).toString()}closeRing(){if(this._ptList.size()<1)return null;const t=new m(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}setMinimumVertexDistance(t){this._minimimVertexDistance=t}}$s.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);class tn{constructor(){tn.constructor_.apply(this,arguments)}static constructor_(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Kt,this._seg1=new Kt,this._offset0=new Kt,this._offset1=new Kt,this._side=0,this._hasNarrowConcaveAngle=!1;const t=arguments[0],e=arguments[1],s=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new jt,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===Qe.JOIN_ROUND&&(this._closingSegLengthFactor=tn.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)}getCoordinates(){return this._segList.getCoordinates()}addMitreJoin(t,e,s,n){const i=B.intersection(e.p0,e.p1,s.p0,s.p1);if(null!==i){if((n<=0?1:i.distance(t)/Math.abs(n))<=this._bufParams.getMitreLimit())return this._segList.addPt(i),null}this.addLimitedMitreJoin(e,s,n,this._bufParams.getMitreLimit())}addLastSegment(){this._segList.addPt(this._offset1.p1)}initSideSegments(t,e,s){this._s1=t,this._s2=e,this._side=s,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)}addLimitedMitreJoin(t,e,s,n){const i=this._seg0.p1,r=$t.angle(i,this._seg0.p0),o=$t.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,l=$t.normalize(r+o),a=$t.normalize(l+Math.PI),c=n*s,h=s-c*Math.abs(Math.sin(o)),u=i.x+c*Math.cos(a),g=i.y+c*Math.sin(a),d=new m(u,g),_=new Kt(i,d),p=_.pointAlongOffset(1,h),f=_.pointAlongOffset(1,-h);this._side===Hs.LEFT?(this._segList.addPt(p),this._segList.addPt(f)):(this._segList.addPt(f),this._segList.addPt(p))}addDirectedFillet(t,e,s,n,i){const r=n===q.CLOCKWISE?-1:1,o=Math.abs(e-s),l=Math.trunc(o/this._filletAngleQuantum+.5);if(l<1)return null;const a=o/l,c=new m;for(let s=0;s<l;s++){const n=e+r*s*a;c.x=t.x+i*Math.cos(n),c.y=t.y+i*Math.sin(n),this._segList.addPt(c)}}computeOffsetSegment(t,e,s,n){const i=e===Hs.LEFT?1:-1,r=t.p1.x-t.p0.x,o=t.p1.y-t.p0.y,l=Math.sqrt(r*r+o*o),a=i*s*r/l,c=i*s*o/l;n.p0.x=t.p0.x-c,n.p0.y=t.p0.y+a,n.p1.x=t.p1.x-c,n.p1.y=t.p1.y+a}addInsideTurn(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*tn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){const t=new m((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(t);const e=new m((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(e)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}createCircle(t){const e=new m(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}addBevelJoin(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}init(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new $s,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*tn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}addCollinear(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Qe.JOIN_BEVEL||this._bufParams.getJoinStyle()===Qe.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,q.CLOCKWISE,this._distance))}addNextSegment(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;const s=q.index(this._s0,this._s1,this._s2),n=s===q.CLOCKWISE&&this._side===Hs.LEFT||s===q.COUNTERCLOCKWISE&&this._side===Hs.RIGHT;0===s?this.addCollinear(e):n?this.addOutsideTurn(s,e):this.addInsideTurn(s,e)}addLineEndCap(t,e){const s=new Kt(t,e),n=new Kt;this.computeOffsetSegment(s,Hs.LEFT,this._distance,n);const i=new Kt;this.computeOffsetSegment(s,Hs.RIGHT,this._distance,i);const r=e.x-t.x,o=e.y-t.y,l=Math.atan2(o,r);switch(this._bufParams.getEndCapStyle()){case Qe.CAP_ROUND:this._segList.addPt(n.p1),this.addDirectedFillet(e,l+Math.PI/2,l-Math.PI/2,q.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Qe.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case Qe.CAP_SQUARE:const t=new m;t.x=Math.abs(this._distance)*Math.cos(l),t.y=Math.abs(this._distance)*Math.sin(l);const s=new m(n.p1.x+t.x,n.p1.y+t.y),r=new m(i.p1.x+t.x,i.p1.y+t.y);this._segList.addPt(s),this._segList.addPt(r)}}addOutsideTurn(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*tn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Qe.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Qe.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))}createSquare(t){this._segList.addPt(new m(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new m(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new m(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new m(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}addSegments(t,e){this._segList.addPts(t,e)}addFirstSegment(){this._segList.addPt(this._offset1.p0)}addCornerFillet(t,e,s,n,i){const r=e.x-t.x,o=e.y-t.y;let l=Math.atan2(o,r);const a=s.x-t.x,c=s.y-t.y,h=Math.atan2(c,a);n===q.CLOCKWISE?l<=h&&(l+=2*Math.PI):l>=h&&(l-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,l,h,n,i),this._segList.addPt(s)}closeRing(){this._segList.closeRing()}hasNarrowConcaveAngle(){return this._hasNarrowConcaveAngle}}tn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,tn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,tn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,tn.MAX_CLOSING_SEG_LEN_FACTOR=80;class en{constructor(){en.constructor_.apply(this,arguments)}static constructor_(){this._distance=0,this._precisionModel=null,this._bufParams=null;const t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}static copyCoordinates(t){const e=new Array(t.length).fill(null);for(let s=0;s<e.length;s++)e[s]=new m(t[s]);return e}getOffsetCurve(t,e){if(this._distance=e,0===e)return null;const s=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,s,i);const r=i.getCoordinates();return s&&W.reverse(r),r}computeSingleSidedBufferCurve(t,e,s){const n=this.simplifyTolerance(this._distance);if(e){s.addSegments(t,!0);const e=Js.simplify(t,-n),i=e.length-1;s.initSideSegments(e[i],e[i-1],Hs.LEFT),s.addFirstSegment();for(let t=i-2;t>=0;t--)s.addNextSegment(e[t],!0)}else{s.addSegments(t,!1);const e=Js.simplify(t,n),i=e.length-1;s.initSideSegments(e[0],e[1],Hs.LEFT),s.addFirstSegment();for(let t=2;t<=i;t++)s.addNextSegment(e[t],!0)}s.addLastSegment(),s.closeRing()}computeRingBufferCurve(t,e,s){let n=this.simplifyTolerance(this._distance);e===Hs.RIGHT&&(n=-n);const i=Js.simplify(t,n),r=i.length-1;s.initSideSegments(i[r-1],i[0],e);for(let t=1;t<=r;t++){const e=1!==t;s.addNextSegment(i[t],e)}s.closeRing()}computeLineBufferCurve(t,e){const s=this.simplifyTolerance(this._distance),n=Js.simplify(t,s),i=n.length-1;e.initSideSegments(n[0],n[1],Hs.LEFT);for(let t=2;t<=i;t++)e.addNextSegment(n[t],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);const r=Js.simplify(t,-s),o=r.length-1;e.initSideSegments(r[o],r[o-1],Hs.LEFT);for(let t=o-2;t>=0;t--)e.addNextSegment(r[t],!0);e.addLastSegment(),e.addLineEndCap(r[1],r[0]),e.closeRing()}computePointCurve(t,e){switch(this._bufParams.getEndCapStyle()){case Qe.CAP_ROUND:e.createCircle(t);break;case Qe.CAP_SQUARE:e.createSquare(t)}}getLineCurve(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;const s=Math.abs(e),n=this.getSegGen(s);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){const s=e<0;this.computeSingleSidedBufferCurve(t,s,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()}getBufferParameters(){return this._bufParams}simplifyTolerance(t){return t*this._bufParams.getSimplifyFactor()}getRingCurve(t,e,s){if(this._distance=s,t.length<=2)return this.getLineCurve(t,s);if(0===s)return en.copyCoordinates(t);const n=this.getSegGen(s);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()}computeOffsetCurve(t,e,s){const n=this.simplifyTolerance(this._distance);if(e){const e=Js.simplify(t,-n),i=e.length-1;s.initSideSegments(e[i],e[i-1],Hs.LEFT),s.addFirstSegment();for(let t=i-2;t>=0;t--)s.addNextSegment(e[t],!0)}else{const e=Js.simplify(t,n),i=e.length-1;s.initSideSegments(e[0],e[1],Hs.LEFT),s.addFirstSegment();for(let t=2;t<=i;t++)s.addNextSegment(e[t],!0)}s.addLastSegment()}isLineOffsetEmpty(t){return 0===t||t<0&&!this._bufParams.isSingleSided()}getSegGen(t){return new tn(this._precisionModel,this._bufParams,t)}}class sn{constructor(){sn.constructor_.apply(this,arguments)}static constructor_(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){const t=arguments[0];this.init(1),this.location[Hs.ON]=t}else if(arguments[0]instanceof sn){const t=arguments[0];if(this.init(t.location.length),null!==t)for(let e=0;e<this.location.length;e++)this.location[e]=t.location[e]}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.init(3),this.location[Hs.ON]=t,this.location[Hs.LEFT]=e,this.location[Hs.RIGHT]=s}}setAllLocations(t){for(let e=0;e<this.location.length;e++)this.location[e]=t}isNull(){for(let t=0;t<this.location.length;t++)if(this.location[t]!==Qt.NONE)return!1;return!0}setAllLocationsIfNull(t){for(let e=0;e<this.location.length;e++)this.location[e]===Qt.NONE&&(this.location[e]=t)}isLine(){return 1===this.location.length}merge(t){if(t.location.length>this.location.length){const t=new Array(3).fill(null);t[Hs.ON]=this.location[Hs.ON],t[Hs.LEFT]=Qt.NONE,t[Hs.RIGHT]=Qt.NONE,this.location=t}for(let e=0;e<this.location.length;e++)this.location[e]===Qt.NONE&&e<t.location.length&&(this.location[e]=t.location[e])}getLocations(){return this.location}flip(){if(this.location.length<=1)return null;const t=this.location[Hs.LEFT];this.location[Hs.LEFT]=this.location[Hs.RIGHT],this.location[Hs.RIGHT]=t}get(t){return t<this.location.length?this.location[t]:Qt.NONE}isEqualOnSide(t,e){return this.location[e]===t.location[e]}allPositionsEqual(t){for(let e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}toString(){const t=new v;return this.location.length>1&&t.append(Qt.toLocationSymbol(this.location[Hs.LEFT])),t.append(Qt.toLocationSymbol(this.location[Hs.ON])),this.location.length>1&&t.append(Qt.toLocationSymbol(this.location[Hs.RIGHT])),t.toString()}setLocations(t,e,s){this.location[Hs.ON]=t,this.location[Hs.LEFT]=e,this.location[Hs.RIGHT]=s}isArea(){return this.location.length>1}isAnyNull(){for(let t=0;t<this.location.length;t++)if(this.location[t]===Qt.NONE)return!0;return!1}setLocation(){if(1===arguments.length){const t=arguments[0];this.setLocation(Hs.ON,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.location[t]=e}}init(t){this.location=new Array(t).fill(null),this.setAllLocations(Qt.NONE)}}class nn{constructor(){nn.constructor_.apply(this,arguments)}static constructor_(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){const t=arguments[0];this.elt[0]=new sn(t),this.elt[1]=new sn(t)}else if(arguments[0]instanceof nn){const t=arguments[0];this.elt[0]=new sn(t.elt[0]),this.elt[1]=new sn(t.elt[1])}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.elt[0]=new sn(Qt.NONE),this.elt[1]=new sn(Qt.NONE),this.elt[t].setLocation(e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.elt[0]=new sn(t,e,s),this.elt[1]=new sn(t,e,s)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this.elt[0]=new sn(Qt.NONE,Qt.NONE,Qt.NONE),this.elt[1]=new sn(Qt.NONE,Qt.NONE,Qt.NONE),this.elt[t].setLocations(e,s,n)}}static toLineLabel(t){const e=new nn(Qt.NONE);for(let s=0;s<2;s++)e.setLocation(s,t.getLocation(s));return e}getGeometryCount(){let t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}setAllLocations(t,e){this.elt[t].setAllLocations(e)}isNull(t){return this.elt[t].isNull()}setAllLocationsIfNull(){if(1===arguments.length){const t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.elt[t].setAllLocationsIfNull(e)}}isLine(t){return this.elt[t].isLine()}merge(t){for(let e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new sn(t.elt[e]):this.elt[e].merge(t.elt[e])}flip(){this.elt[0].flip(),this.elt[1].flip()}getLocation(){if(1===arguments.length){const t=arguments[0];return this.elt[t].get(Hs.ON)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.elt[t].get(e)}}toString(){const t=new v;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}setLocation(){if(2===arguments.length){const t=arguments[0],e=arguments[1];this.elt[t].setLocation(Hs.ON,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.elt[t].setLocation(e,s)}}isEqualOnSide(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}allPositionsEqual(t,e){return this.elt[t].allPositionsEqual(e)}toLine(t){this.elt[t].isArea()&&(this.elt[t]=new sn(this.elt[t].location[0]))}isArea(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){const t=arguments[0];return this.elt[t].isArea()}}isAnyNull(t){return this.elt[t].isAnyNull()}}let rn=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._label=t}}setVisited(t){this._isVisited=t}setInResult(t){this._isInResult=t}setLabel(t){this._label=t}getLabel(){return this._label}setCovered(t){this._isCovered=t,this._isCoveredSet=!0}updateIM(t){h.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)}isCovered(){return this._isCovered}isCoveredSet(){return this._isCoveredSet}isInResult(){return this._isInResult}isVisited(){return this._isVisited}},on=class t extends rn{constructor(){super(),t.constructor_.apply(this,arguments)}static constructor_(){this._coord=null,this._edges=null;const t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new nn(0,Qt.NONE)}isIncidentEdgeInResult(){for(let t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1}isIsolated(){return 1===this._label.getGeometryCount()}getCoordinate(){return this._coord}computeMergedLocation(t,e){let s=Qt.NONE;if(s=this._label.getLocation(e),!t.isNull(e)){const n=t.getLocation(e);s!==Qt.BOUNDARY&&(s=n)}return s}setLabel(){if(2!==arguments.length||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return super.setLabel.apply(this,arguments);{const t=arguments[0],e=arguments[1];null===this._label?this._label=new nn(t,e):this._label.setLocation(t,e)}}getEdges(){return this._edges}mergeLabel(){if(arguments[0]instanceof t){const t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof nn){const t=arguments[0];for(let e=0;e<2;e++){const s=this.computeMergedLocation(t,e);this._label.getLocation(e)===Qt.NONE&&this._label.setLocation(e,s)}}}add(t){this._edges.insert(t),t.setNode(this)}setLabelBoundary(t){if(null===this._label)return null;let e=Qt.NONE;null!==this._label&&(e=this._label.getLocation(t));let s=null;switch(e){case Qt.BOUNDARY:s=Qt.INTERIOR;break;case Qt.INTERIOR:default:s=Qt.BOUNDARY}this._label.setLocation(t,s)}print(t){t.println("node "+this._coord+" lbl: "+this._label)}computeIM(t){}},ln=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){this.nodeMap=new os,this.nodeFact=null;const t=arguments[0];this.nodeFact=t}print(t){for(let e=this.iterator();e.hasNext();){e.next().print(t)}}iterator(){return this.nodeMap.values().iterator()}values(){return this.nodeMap.values()}getBoundaryNodes(t){const e=new L;for(let s=this.iterator();s.hasNext();){const n=s.next();n.getLabel().getLocation(t)===Qt.BOUNDARY&&e.add(n)}return e}add(t){const e=t.getCoordinate();this.addNode(e).add(t)}find(t){return this.nodeMap.get(t)}addNode(){if(arguments[0]instanceof m){const t=arguments[0];let e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof on){const t=arguments[0],e=this.nodeMap.get(t.getCoordinate());return null===e?(this.nodeMap.put(t.getCoordinate(),t),t):(e.mergeLabel(t),e)}}};class an{createNode(t){return new on(t,null)}}class cn{constructor(){cn.constructor_.apply(this,arguments)}static constructor_(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){const t=arguments[0];this._edge=t}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];cn.constructor_.call(this,t,e,s,null)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];cn.constructor_.call(this,t),this.init(e,s),this._label=n}}compareDirection(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:q.index(t._p0,t._p1,this._p1)}getDy(){return this._dy}print(t){const e=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),n=s.lastIndexOf("."),i=s.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}getLabel(){return this._label}getEdge(){return this._edge}toString(){const t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),s=e.lastIndexOf(".");return" "+e.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label}computeLabel(t){}init(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Ds.quadrant(this._dx,this._dy),h.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")}getCoordinate(){return this._p0}setNode(t){this._node=t}compareTo(t){const e=t;return this.compareDirection(e)}getDirectedCoordinate(){return this._p1}getDx(){return this._dx}getQuadrant(){return this._quadrant}getNode(){return this._node}get interfaces_(){return[o]}}let hn=class t extends cn{constructor(){super(),t.constructor_.apply(this,arguments)}static constructor_(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];const t=arguments[0],e=arguments[1];if(cn.constructor_.call(this,t),this._isForward=e,e)this.init(t.getCoordinate(0),t.getCoordinate(1));else{const e=t.getNumPoints()-1;this.init(t.getCoordinate(e),t.getCoordinate(e-1))}this.computeDirectedLabel()}static depthFactor(t,e){return t===Qt.EXTERIOR&&e===Qt.INTERIOR?1:t===Qt.INTERIOR&&e===Qt.EXTERIOR?-1:0}setVisited(t){this._isVisited=t}setDepth(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new _s("assigned depths do not match",this.getCoordinate());this._depth[t]=e}isInteriorAreaEdge(){let t=!0;for(let e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,Hs.LEFT)===Qt.INTERIOR&&this._label.getLocation(e,Hs.RIGHT)===Qt.INTERIOR||(t=!1);return t}setNextMin(t){this._nextMin=t}print(t){super.print.call(this,t),t.print(" "+this._depth[Hs.LEFT]+"/"+this._depth[Hs.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")}setMinEdgeRing(t){this._minEdgeRing=t}getSym(){return this._sym}isForward(){return this._isForward}setSym(t){this._sym=t}setVisitedEdge(t){this.setVisited(t),this._sym.setVisited(t)}getNextMin(){return this._nextMin}getDepth(t){return this._depth[t]}computeDirectedLabel(){this._label=new nn(this._edge.getLabel()),this._isForward||this._label.flip()}getNext(){return this._next}isLineEdge(){const t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,Qt.EXTERIOR),s=!this._label.isArea(1)||this._label.allPositionsEqual(1,Qt.EXTERIOR);return t&&e&&s}setEdgeRing(t){this._edgeRing=t}getMinEdgeRing(){return this._minEdgeRing}getDepthDelta(){let t=this._edge.getDepthDelta();return this._isForward||(t=-t),t}setInResult(t){this._isInResult=t}getEdge(){return this._edge}printEdge(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)}setEdgeDepths(t,e){let s=this.getEdge().getDepthDelta();this._isForward||(s=-s);let n=1;t===Hs.LEFT&&(n=-1);const i=Hs.opposite(t),r=e+s*n;this.setDepth(t,e),this.setDepth(i,r)}getEdgeRing(){return this._edgeRing}isInResult(){return this._isInResult}setNext(t){this._next=t}isVisited(){return this._isVisited}},un=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){if(this._edges=new L,this._nodes=null,this._edgeEndList=new L,0===arguments.length)this._nodes=new ln(new an);else if(1===arguments.length){const t=arguments[0];this._nodes=new ln(t)}}static linkResultDirectedEdges(t){for(let e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}}printEdges(t){t.println("Edges:");for(let e=0;e<this._edges.size();e++){t.println("edge "+e+":");const s=this._edges.get(e);s.print(t),s.eiList.print(t)}}debugPrintln(t){Y.out.println(t)}isBoundaryNode(t,e){const s=this._nodes.find(e);if(null===s)return!1;const n=s.getLabel();return null!==n&&n.getLocation(t)===Qt.BOUNDARY}linkAllDirectedEdges(){for(let t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}}debugPrint(t){Y.out.print(t)}findEdgeEnd(t){for(let e=this.getEdgeEnds().iterator();e.hasNext();){const s=e.next();if(s.getEdge()===t)return s}return null}getNodes(){return this._nodes.values()}findEdge(t,e){for(let s=0;s<this._edges.size();s++){const n=this._edges.get(s),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null}find(t){return this._nodes.find(t)}addNode(){if(arguments[0]instanceof on){const t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof m){const t=arguments[0];return this._nodes.addNode(t)}}getNodeIterator(){return this._nodes.iterator()}linkResultDirectedEdges(){for(let t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}}matchInSameDirection(t,e,s,n){return!!t.equals(s)&&(q.index(t,e,n)===q.COLLINEAR&&Ds.quadrant(t,e)===Ds.quadrant(s,n))}getEdgeEnds(){return this._edgeEndList}getEdgeIterator(){return this._edges.iterator()}findEdgeInSameDirection(t,e){for(let s=0;s<this._edges.size();s++){const n=this._edges.get(s),i=n.getCoordinates();if(this.matchInSameDirection(t,e,i[0],i[1]))return n;if(this.matchInSameDirection(t,e,i[i.length-1],i[i.length-2]))return n}return null}insertEdge(t){this._edges.add(t)}addEdges(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._edges.add(t);const s=new hn(t,!0),n=new hn(t,!1);s.setSym(n),n.setSym(s),this.add(s),this.add(n)}}add(t){this._nodes.add(t),this._edgeEndList.add(t)}},gn=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new L,this._pts=new L,this._label=new nn(Qt.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new L,this._geometryFactory=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()}}computeRing(){if(null!==this._ring)return null;const t=new Array(this._pts.size()).fill(null);for(let e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=q.isCCW(this._ring.getCoordinates())}isIsolated(){return 1===this._label.getGeometryCount()}computePoints(t){this._startDe=t;let e=t,s=!0;do{if(null===e)throw new _s("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new _s("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);const t=e.getLabel();h.isTrue(t.isArea()),this.mergeLabel(t),this.addPoints(e.getEdge(),e.isForward(),s),s=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)}getLinearRing(){return this._ring}getCoordinate(t){return this._pts.get(t)}computeMaxNodeDegree(){this._maxNodeDegree=0;let t=this._startDe;do{const e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}addPoints(t,e,s){const n=t.getCoordinates();if(e){let t=1;s&&(t=0);for(let e=t;e<n.length;e++)this._pts.add(n[e])}else{let t=n.length-2;s&&(t=n.length-1);for(let e=t;e>=0;e--)this._pts.add(n[e])}}containsPoint(t){const e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Ue.isInRing(t,e.getCoordinates()))return!1;for(let e=this._holes.iterator();e.hasNext();){if(e.next().containsPoint(t))return!1}return!0}getMaxNodeDegree(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}setShell(t){this._shell=t,null!==t&&t.addHole(this)}toPolygon(t){const e=new Array(this._holes.size()).fill(null);for(let t=0;t<this._holes.size();t++)e[t]=this._holes.get(t).getLinearRing();return t.createPolygon(this.getLinearRing(),e)}isHole(){return this._isHole}setInResult(){let t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)}addHole(t){this._holes.add(t)}isShell(){return null===this._shell}getLabel(){return this._label}getEdges(){return this._edges}getShell(){return this._shell}mergeLabel(){if(1===arguments.length){const t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){const t=arguments[1],e=arguments[0].getLocation(t,Hs.RIGHT);if(e===Qt.NONE)return null;if(this._label.getLocation(t)===Qt.NONE)return this._label.setLocation(t,e),null}}};class dn extends gn{constructor(){super(),dn.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];gn.constructor_.call(this,t,e)}getNext(t){return t.getNextMin()}setEdgeRing(t,e){t.setMinEdgeRing(e)}}class _n extends gn{constructor(){super(),_n.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];gn.constructor_.call(this,t,e)}linkDirectedEdgesForMinimalEdgeRings(){let t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)}buildMinimalRings(){const t=new L;let e=this._startDe;do{if(null===e.getMinEdgeRing()){const s=new dn(e,this._geometryFactory);t.add(s)}e=e.getNext()}while(e!==this._startDe);return t}getNext(t){return t.getNext()}setEdgeRing(t,e){t.setEdgeRing(e)}}class pn{constructor(){pn.constructor_.apply(this,arguments)}static constructor_(){this._geometryFactory=null,this._shellList=new L;const t=arguments[0];this._geometryFactory=t}static findEdgeRingContaining(t,e){const s=t.getLinearRing(),n=s.getEnvelopeInternal();let i=s.getCoordinateN(0),r=null,o=null;for(let t=e.iterator();t.hasNext();){const e=t.next(),l=e.getLinearRing(),a=l.getEnvelopeInternal();if(a.equals(n))continue;if(!a.contains(n))continue;i=W.ptNotInList(s.getCoordinates(),l.getCoordinates());let c=!1;Ue.isInRing(i,l.getCoordinates())&&(c=!0),c&&(null===r||o.contains(a))&&(r=e,o=r.getLinearRing().getEnvelopeInternal())}return r}sortShellsAndHoles(t,e,s){for(let n=t.iterator();n.hasNext();){const t=n.next();t.isHole()?s.add(t):e.add(t)}}computePolygons(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next().toPolygon(this._geometryFactory);e.add(t)}return e}placeFreeHoles(t,e){for(let s=e.iterator();s.hasNext();){const e=s.next();if(null===e.getShell()){const s=pn.findEdgeRingContaining(e,t);if(null===s)throw new _s("unable to assign hole to a shell",e.getCoordinate(0));e.setShell(s)}}}buildMinimalEdgeRings(t,e,s){const n=new L;for(let i=t.iterator();i.hasNext();){const t=i.next();if(t.getMaxNodeDegree()>2){t.linkDirectedEdgesForMinimalEdgeRings();const n=t.buildMinimalRings(),i=this.findShell(n);null!==i?(this.placePolygonHoles(i,n),e.add(i)):s.addAll(n)}else n.add(t)}return n}buildMaximalEdgeRings(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();if(t.isInResult()&&t.getLabel().isArea()&&null===t.getEdgeRing()){const s=new _n(t,this._geometryFactory);e.add(s),s.setInResult()}}return e}placePolygonHoles(t,e){for(let s=e.iterator();s.hasNext();){const e=s.next();e.isHole()&&e.setShell(t)}}getPolygons(){return this.computePolygons(this._shellList)}findShell(t){let e=0,s=null;for(let n=t.iterator();n.hasNext();){const t=n.next();t.isHole()||(s=t,e++)}return h.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),s}add(){if(1===arguments.length){const t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];un.linkResultDirectedEdges(e);const s=this.buildMaximalEdgeRings(t),n=new L,i=this.buildMinimalEdgeRings(s,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}}}class mn{constructor(){mn.constructor_.apply(this,arguments)}static constructor_(){this._subgraphs=null,this._seg=new Kt;const t=arguments[0];this._subgraphs=t}findStabbedSegments(){if(1===arguments.length){const t=arguments[0],e=new L;for(let s=this._subgraphs.iterator();s.hasNext();){const n=s.next(),i=n.getEnvelope();t.y<i.getMinY()||t.y>i.getMaxY()||this.findStabbedSegments(t,n.getDirectedEdges(),e)}return e}if(3===arguments.length)if(I(arguments[2],C)&&arguments[0]instanceof m&&arguments[1]instanceof hn){const t=arguments[0],e=arguments[1],s=arguments[2],n=e.getEdge().getCoordinates();for(let i=0;i<n.length-1;i++){this._seg.p0=n[i],this._seg.p1=n[i+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse();if(Math.max(this._seg.p0.x,this._seg.p1.x)<t.x)continue;if(this._seg.isHorizontal())continue;if(t.y<this._seg.p0.y||t.y>this._seg.p1.y)continue;if(q.index(this._seg.p0,this._seg.p1,t)===q.RIGHT)continue;let r=e.getDepth(Hs.LEFT);this._seg.p0.equals(n[i])||(r=e.getDepth(Hs.RIGHT));const o=new fn(this._seg,r);s.add(o)}}else if(I(arguments[2],C)&&arguments[0]instanceof m&&I(arguments[1],C)){const t=arguments[0],e=arguments[2];for(let s=arguments[1].iterator();s.hasNext();){const n=s.next();n.isForward()&&this.findStabbedSegments(t,n,e)}}}getDepth(t){const e=this.findStabbedSegments(t);if(0===e.size())return 0;return xe.min(e)._leftDepth}}class fn{constructor(){fn.constructor_.apply(this,arguments)}static constructor_(){this._upwardSeg=null,this._leftDepth=null;const t=arguments[0],e=arguments[1];this._upwardSeg=new Kt(t),this._leftDepth=e}compareX(t,e){const s=t.p0.compareTo(e.p0);return 0!==s?s:t.p1.compareTo(e.p1)}toString(){return this._upwardSeg.toString()}compareTo(t){const e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;let s=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==s?s:(s=-1*e._upwardSeg.orientationIndex(this._upwardSeg),0!==s?s:this._upwardSeg.compareTo(e._upwardSeg))}get interfaces_(){return[o]}}mn.DepthSegment=fn;class yn{constructor(){yn.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new L;const t=arguments[0],e=arguments[1],s=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=s}addRingSide(t,e,s,n,i){if(0===e&&t.length<et.MINIMUM_VALID_SIZE)return null;let r=n,o=i;t.length>=et.MINIMUM_VALID_SIZE&&q.isCCW(t)&&(r=i,o=n,s=Hs.opposite(s));const l=this._curveBuilder.getRingCurve(t,s,e);this.addCurve(l,r,o)}addRingBothSides(t,e){this.addRingSide(t,e,Hs.LEFT,Qt.EXTERIOR,Qt.INTERIOR),this.addRingSide(t,e,Hs.RIGHT,Qt.INTERIOR,Qt.EXTERIOR)}addPoint(t){if(this._distance<=0)return null;const e=t.getCoordinates(),s=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(s,Qt.EXTERIOR,Qt.INTERIOR)}addPolygon(t){let e=this._distance,s=Hs.LEFT;this._distance<0&&(e=-this._distance,s=Hs.RIGHT);const n=t.getExteriorRing(),i=W.removeRepeatedPoints(n.getCoordinates());if(this._distance<0&&this.isErodedCompletely(n,this._distance))return null;if(this._distance<=0&&i.length<3)return null;this.addRingSide(i,e,s,Qt.EXTERIOR,Qt.INTERIOR);for(let n=0;n<t.getNumInteriorRing();n++){const i=t.getInteriorRingN(n),r=W.removeRepeatedPoints(i.getCoordinates());this._distance>0&&this.isErodedCompletely(i,-this._distance)||this.addRingSide(r,e,Hs.opposite(s),Qt.INTERIOR,Qt.EXTERIOR)}}isTriangleErodedCompletely(t,e){const s=new se(t[0],t[1],t[2]),n=s.inCentre();return V.pointToSegment(n,s.p0,s.p1)<Math.abs(e)}addLineString(t){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;const e=W.removeRepeatedPoints(t.getCoordinates());if(W.isRing(e)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(e,this._distance);else{const t=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(t,Qt.EXTERIOR,Qt.INTERIOR)}}add(t){if(t.isEmpty())return null;if(t instanceof Ct)this.addPolygon(t);else if(t instanceof tt)this.addLineString(t);else if(t instanceof Nt)this.addPoint(t);else if(t instanceof St)this.addCollection(t);else if(t instanceof Et)this.addCollection(t);else if(t instanceof dt)this.addCollection(t);else{if(!(t instanceof ut))throw new U(t.getGeometryType());this.addCollection(t)}}addCurve(t,e,s){if(null===t||t.length<2)return null;const n=new us(t,new nn(0,Qt.BOUNDARY,e,s));this._curveList.add(n)}getCurves(){return this.add(this._inputGeom),this._curveList}isErodedCompletely(t,e){const s=t.getCoordinates();if(s.length<4)return e<0;if(4===s.length)return this.isTriangleErodedCompletely(s,e);const n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i}addCollection(t){for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);this.add(s)}}}class xn{constructor(){xn.constructor_.apply(this,arguments)}static constructor_(){this._edgeMap=new os,this._edgeList=null,this._ptInAreaLocation=[Qt.NONE,Qt.NONE]}getNextCW(t){this.getEdges();const e=this._edgeList.indexOf(t);let s=e-1;return 0===e&&(s=this._edgeList.size()-1),this._edgeList.get(s)}propagateSideLabels(t){let e=Qt.NONE;for(let s=this.iterator();s.hasNext();){const n=s.next().getLabel();n.isArea(t)&&n.getLocation(t,Hs.LEFT)!==Qt.NONE&&(e=n.getLocation(t,Hs.LEFT))}if(e===Qt.NONE)return null;let s=e;for(let e=this.iterator();e.hasNext();){const n=e.next(),i=n.getLabel();if(i.getLocation(t,Hs.ON)===Qt.NONE&&i.setLocation(t,Hs.ON,s),i.isArea(t)){const e=i.getLocation(t,Hs.LEFT),r=i.getLocation(t,Hs.RIGHT);if(r!==Qt.NONE){if(r!==s)throw new _s("side location conflict",n.getCoordinate());e===Qt.NONE&&h.shouldNeverReachHere("found single null side (at "+n.getCoordinate()+")"),s=e}else h.isTrue(i.getLocation(t,Hs.LEFT)===Qt.NONE,"found single null side"),i.setLocation(t,Hs.RIGHT,s),i.setLocation(t,Hs.LEFT,s)}}}getCoordinate(){const t=this.iterator();if(!t.hasNext())return null;return t.next().getCoordinate()}checkAreaLabelsConsistent(t){const e=this.getEdges();if(e.size()<=0)return!0;const s=e.size()-1,n=e.get(s).getLabel().getLocation(t,Hs.LEFT);h.isTrue(n!==Qt.NONE,"Found unlabelled area edge");let i=n;for(let e=this.iterator();e.hasNext();){const s=e.next().getLabel();h.isTrue(s.isArea(t),"Found non-area edge");const n=s.getLocation(t,Hs.LEFT),r=s.getLocation(t,Hs.RIGHT);if(n===r)return!1;if(r!==i)return!1;i=n}return!0}findIndex(t){this.iterator();for(let e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1}iterator(){return this.getEdges().iterator()}getEdges(){return null===this._edgeList&&(this._edgeList=new L(this._edgeMap.values())),this._edgeList}getLocation(t,e,s){return this._ptInAreaLocation[t]===Qt.NONE&&(this._ptInAreaLocation[t]=Ze.locate(e,s[t].getGeometry())),this._ptInAreaLocation[t]}toString(){const t=new v;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(let e=this.iterator();e.hasNext();){const s=e.next();t.append(s),t.append("\n")}return t.toString()}computeEdgeEndLabels(t){for(let e=this.iterator();e.hasNext();){e.next().computeLabel(t)}}computeLabelling(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);const e=[!1,!1];for(let t=this.iterator();t.hasNext();){const s=t.next().getLabel();for(let t=0;t<2;t++)s.isLine(t)&&s.getLocation(t)===Qt.BOUNDARY&&(e[t]=!0)}for(let s=this.iterator();s.hasNext();){const n=s.next(),i=n.getLabel();for(let s=0;s<2;s++)if(i.isAnyNull(s)){let r=Qt.NONE;if(e[s])r=Qt.EXTERIOR;else{const e=n.getCoordinate();r=this.getLocation(s,e,t)}i.setAllLocationsIfNull(s,r)}}}getDegree(){return this._edgeMap.size()}insertEdgeEnd(t,e){this._edgeMap.put(t,e),this._edgeList=null}print(t){Y.out.println("EdgeEndStar: "+this.getCoordinate());for(let e=this.iterator();e.hasNext();){e.next().print(t)}}isAreaLabelsConsistent(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}}let En=class t extends xn{constructor(){super(),t.constructor_.apply(this,arguments)}static constructor_(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}linkResultDirectedEdges(){this.getResultAreaEdges();let t=null,e=null,s=this._SCANNING_FOR_INCOMING;for(let n=0;n<this._resultAreaEdgeList.size();n++){const i=this._resultAreaEdgeList.get(n),r=i.getSym();if(i.getLabel().isArea())switch(null===t&&i.isInResult()&&(t=i),s){case this._SCANNING_FOR_INCOMING:if(!r.isInResult())continue;e=r,s=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!i.isInResult())continue;e.setNext(i),s=this._SCANNING_FOR_INCOMING}}if(s===this._LINKING_TO_OUTGOING){if(null===t)throw new _s("no outgoing dirEdge found",this.getCoordinate());h.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}}insert(t){const e=t;this.insertEdgeEnd(e,e)}getRightmostEdge(){const t=this.getEdges(),e=t.size();if(e<1)return null;const s=t.get(0);if(1===e)return s;const n=t.get(e-1),i=s.getQuadrant(),r=n.getQuadrant();return Ds.isNorthern(i)&&Ds.isNorthern(r)?s:Ds.isNorthern(i)||Ds.isNorthern(r)?0!==s.getDy()?s:0!==n.getDy()?n:(h.shouldNeverReachHere("found two horizontal edges incident on node"),null):n}updateLabelling(t){for(let e=this.iterator();e.hasNext();){const s=e.next().getLabel();s.setAllLocationsIfNull(0,t.getLocation(0)),s.setAllLocationsIfNull(1,t.getLocation(1))}}linkAllDirectedEdges(){this.getEdges();let t=null,e=null;for(let s=this._edgeList.size()-1;s>=0;s--){const n=this._edgeList.get(s),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)}computeDepths(){if(1===arguments.length){const t=arguments[0],e=this.findIndex(t),s=t.getDepth(Hs.LEFT),n=t.getDepth(Hs.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),s);if(this.computeDepths(0,e,i)!==n)throw new _s("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){const t=arguments[1];let e=arguments[2];for(let s=arguments[0];s<t;s++){const t=this._edgeList.get(s);t.setEdgeDepths(Hs.RIGHT,e),e=t.getDepth(Hs.LEFT)}return e}}mergeSymLabels(){for(let t=this.iterator();t.hasNext();){const e=t.next();e.getLabel().merge(e.getSym().getLabel())}}linkMinimalDirectedEdges(t){let e=null,s=null,n=this._SCANNING_FOR_INCOMING;for(let i=this._resultAreaEdgeList.size()-1;i>=0;i--){const r=this._resultAreaEdgeList.get(i),o=r.getSym();switch(null===e&&r.getEdgeRing()===t&&(e=r),n){case this._SCANNING_FOR_INCOMING:if(o.getEdgeRing()!==t)continue;s=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(r.getEdgeRing()!==t)continue;s.setNextMin(r),n=this._SCANNING_FOR_INCOMING}}n===this._LINKING_TO_OUTGOING&&(h.isTrue(null!==e,"found null for first outgoing dirEdge"),h.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),s.setNextMin(e))}getOutgoingDegree(){if(0===arguments.length){let t=0;for(let e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){const t=arguments[0];let e=0;for(let s=this.iterator();s.hasNext();){s.next().getEdgeRing()===t&&e++}return e}}getLabel(){return this._label}findCoveredLineEdges(){let t=Qt.NONE;for(let e=this.iterator();e.hasNext();){const s=e.next(),n=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){t=Qt.INTERIOR;break}if(n.isInResult()){t=Qt.EXTERIOR;break}}}if(t===Qt.NONE)return null;let e=t;for(let t=this.iterator();t.hasNext();){const s=t.next(),n=s.getSym();s.isLineEdge()?s.getEdge().setCovered(e===Qt.INTERIOR):(s.isInResult()&&(e=Qt.EXTERIOR),n.isInResult()&&(e=Qt.INTERIOR))}}computeLabelling(t){super.computeLabelling.call(this,t),this._label=new nn(Qt.NONE);for(let t=this.iterator();t.hasNext();){const e=t.next().getEdge().getLabel();for(let t=0;t<2;t++){const s=e.getLocation(t);s!==Qt.INTERIOR&&s!==Qt.BOUNDARY||this._label.setLocation(t,Qt.INTERIOR)}}}print(t){Y.out.println("DirectedEdgeStar: "+this.getCoordinate());for(let e=this.iterator();e.hasNext();){const s=e.next();t.print("out "),s.print(t),t.println(),t.print("in "),s.getSym().print(t),t.println()}}getResultAreaEdges(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new L;for(let t=this.iterator();t.hasNext();){const e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList}};class In extends an{constructor(){super()}createNode(t){return new on(t,new En)}}class Nn{constructor(){Nn.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._orientation=null;const t=arguments[0];this._pts=t,this._orientation=Nn.orientation(t)}static orientation(t){return 1===W.increasingDirection(t)}static compareOriented(t,e,s,n){const i=e?1:-1,r=n?1:-1,o=e?t.length:-1,l=n?s.length:-1;let a=e?0:t.length-1,c=n?0:s.length-1;for(;;){const e=t[a].compareTo(s[c]);if(0!==e)return e;a+=i,c+=r;const n=a===o,h=c===l;if(n&&!h)return-1;if(!n&&h)return 1;if(n&&h)return 0}}compareTo(t){const e=t;return Nn.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}get interfaces_(){return[o]}}class wn{constructor(){wn.constructor_.apply(this,arguments)}static constructor_(){this._edges=new L,this._ocaMap=new os}print(t){t.print("MULTILINESTRING ( ");for(let e=0;e<this._edges.size();e++){const s=this._edges.get(e);e>0&&t.print(","),t.print("(");const n=s.getCoordinates();for(let e=0;e<n.length;e++)e>0&&t.print(","),t.print(n[e].x+" "+n[e].y);t.println(")")}t.print(") ")}addAll(t){for(let e=t.iterator();e.hasNext();)this.add(e.next())}findEdgeIndex(t){for(let e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1}iterator(){return this._edges.iterator()}getEdges(){return this._edges}get(t){return this._edges.get(t)}findEqualEdge(t){const e=new Nn(t.getCoordinates());return this._ocaMap.get(e)}add(t){this._edges.add(t);const e=new Nn(t.getCoordinates());this._ocaMap.put(e,t)}}class Cn{constructor(){Cn.constructor_.apply(this,arguments)}static constructor_(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;const t=arguments[0];this._li=t}static isAdjacentSegments(t,e){return 1===Math.abs(t-e)}isTrivialIntersection(t,e,s,n){if(t===s&&1===this._li.getIntersectionNum()){if(Cn.isAdjacentSegments(e,n))return!0;if(t.isClosed()){const s=t.size()-1;if(0===e&&n===s||0===n&&e===s)return!0}}return!1}getProperIntersectionPoint(){return this._properIntersectionPoint}hasProperInteriorIntersection(){return this._hasProperInterior}getLineIntersector(){return this._li}hasProperIntersection(){return this._hasProper}processIntersections(t,e,s,n){if(t===s&&e===n)return null;this.numTests++;const i=t.getCoordinates()[e],r=t.getCoordinates()[e+1],o=s.getCoordinates()[n],l=s.getCoordinates()[n+1];this._li.computeIntersection(i,r,o,l),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,s,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),s.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}hasIntersection(){return this._hasIntersection}isDone(){return!1}hasInteriorIntersection(){return this._hasInterior}get interfaces_(){return[ks]}}class Sn{constructor(){Sn.constructor_.apply(this,arguments)}static constructor_(){this.coord=null,this.segmentIndex=null,this.dist=null;const t=arguments[0],e=arguments[1],s=arguments[2];this.coord=new m(t),this.segmentIndex=e,this.dist=s}getSegmentIndex(){return this.segmentIndex}getCoordinate(){return this.coord}print(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)}compareTo(t){const e=t;return this.compare(e.segmentIndex,e.dist)}isEndPoint(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t}toString(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}getDistance(){return this.dist}compare(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0}get interfaces_(){return[o]}}class Ln{constructor(){Ln.constructor_.apply(this,arguments)}static constructor_(){this._nodeMap=new os,this.edge=null;const t=arguments[0];this.edge=t}print(t){t.println("Intersections:");for(let e=this.iterator();e.hasNext();){e.next().print(t)}}addEndpoints(){const t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)}createSplitEdge(t,e){let s=e.segmentIndex-t.segmentIndex+2;const n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||s--;const r=new Array(s).fill(null);let o=0;r[o++]=new m(t.coord);for(let s=t.segmentIndex+1;s<=e.segmentIndex;s++)r[o++]=this.edge.pts[s];return i&&(r[o]=e.coord),new vn(r,new nn(this.edge._label))}add(t,e,s){const n=new Sn(t,e,s),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)}isIntersection(t){for(let e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1}iterator(){return this._nodeMap.values().iterator()}addSplitEdges(t){this.addEndpoints();const e=this.iterator();let s=e.next();for(;e.hasNext();){const n=e.next(),i=this.createSplitEdge(s,n);t.add(i),s=n}}}class Tn{constructor(){Tn.constructor_.apply(this,arguments)}static constructor_(){this._depth=Array(2).fill().map((()=>Array(3)));for(let t=0;t<2;t++)for(let e=0;e<3;e++)this._depth[t][e]=Tn.NULL_VALUE}static depthAtLocation(t){return t===Qt.EXTERIOR?0:t===Qt.INTERIOR?1:Tn.NULL_VALUE}getDepth(t,e){return this._depth[t][e]}setDepth(t,e,s){this._depth[t][e]=s}isNull(){if(0===arguments.length){for(let t=0;t<2;t++)for(let e=0;e<3;e++)if(this._depth[t][e]!==Tn.NULL_VALUE)return!1;return!0}if(1===arguments.length){const t=arguments[0];return this._depth[t][1]===Tn.NULL_VALUE}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._depth[t][e]===Tn.NULL_VALUE}}normalize(){for(let t=0;t<2;t++)if(!this.isNull(t)){let e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(let s=1;s<3;s++){let n=0;this._depth[t][s]>e&&(n=1),this._depth[t][s]=n}}}getDelta(t){return this._depth[t][Hs.RIGHT]-this._depth[t][Hs.LEFT]}getLocation(t,e){return this._depth[t][e]<=0?Qt.EXTERIOR:Qt.INTERIOR}toString(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}add(){if(1===arguments.length){const t=arguments[0];for(let e=0;e<2;e++)for(let s=1;s<3;s++){const n=t.getLocation(e,s);n!==Qt.EXTERIOR&&n!==Qt.INTERIOR||(this.isNull(e,s)?this._depth[e][s]=Tn.depthAtLocation(n):this._depth[e][s]+=Tn.depthAtLocation(n))}}else if(3===arguments.length){const t=arguments[0],e=arguments[1];arguments[2]===Qt.INTERIOR&&this._depth[t][e]++}}}Tn.NULL_VALUE=-1;class Rn{constructor(){Rn.constructor_.apply(this,arguments)}static constructor_(){if(this._data=null,this._size=0,0===arguments.length)Rn.constructor_.call(this,10);else if(1===arguments.length){const t=arguments[0];this._data=new Array(t).fill(null)}}size(){return this._size}addAll(t){return null===t||0===t.length?null:(this.ensureCapacity(this._size+t.length),Y.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}ensureCapacity(t){if(t<=this._data.length)return null;const e=Math.max(t,2*this._data.length);this._data=ht.copyOf(this._data,e)}toArray(){const t=new Array(this._size).fill(null);return Y.arraycopy(this._data,0,t,0,this._size),t}add(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}class Pn{static toIntArray(t){const e=new Array(t.size()).fill(null);for(let s=0;s<e.length;s++)e[s]=t.get(s).intValue();return e}findChainEnd(t,e){const s=Ds.quadrant(t[e],t[e+1]);let n=e+1;for(;n<t.length;){if(Ds.quadrant(t[n-1],t[n])!==s)break;n++}return n-1}OLDgetChainStartIndices(t){let e=0;const s=new L;s.add(e);do{const n=this.findChainEnd(t,e);s.add(n),e=n}while(e<t.length-1);return Pn.toIntArray(s)}getChainStartIndices(t){let e=0;const s=new Rn(Math.trunc(t.length/2));s.add(e);do{const n=this.findChainEnd(t,e);s.add(n),e=n}while(e<t.length-1);return s.toArray()}}class On{constructor(){On.constructor_.apply(this,arguments)}static constructor_(){this.e=null,this.pts=null,this.startIndex=null;const t=arguments[0];this.e=t,this.pts=t.getCoordinates();const e=new Pn;this.startIndex=e.getChainStartIndices(this.pts)}getCoordinates(){return this.pts}getMaxX(t){const e=this.pts[this.startIndex[t]].x,s=this.pts[this.startIndex[t+1]].x;return e>s?e:s}getMinX(t){const e=this.pts[this.startIndex[t]].x,s=this.pts[this.startIndex[t+1]].x;return e<s?e:s}computeIntersectsForChain(){if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[s],e.startIndex[s+1],n)}else if(6===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];if(e-t==1&&i-n==1)return r.addIntersections(this.e,t,s.e,n),null;if(!this.overlaps(t,e,s,n,i))return null;const o=Math.trunc((t+e)/2),l=Math.trunc((n+i)/2);t<o&&(n<l&&this.computeIntersectsForChain(t,o,s,n,l,r),l<i&&this.computeIntersectsForChain(t,o,s,l,i,r)),o<e&&(n<l&&this.computeIntersectsForChain(o,e,s,n,l,r),l<i&&this.computeIntersectsForChain(o,e,s,l,i,r))}}overlaps(t,e,s,n,i){return O.intersects(this.pts[t],this.pts[e],s.pts[n],s.pts[i])}getStartIndexes(){return this.startIndex}computeIntersects(t,e){for(let s=0;s<this.startIndex.length-1;s++)for(let n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(s,t,n,e)}}let vn=class t extends rn{constructor(){super(),t.constructor_.apply(this,arguments)}static constructor_(){if(this.pts=null,this._env=null,this.eiList=new Ln(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Tn,this._depthDelta=0,1===arguments.length){const e=arguments[0];t.constructor_.call(this,e,null)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.pts=t,this._label=e}}static updateIM(){if(!(2===arguments.length&&arguments[1]instanceof Jt&&arguments[0]instanceof nn))return super.updateIM.apply(this,arguments);{const t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,Hs.ON),t.getLocation(1,Hs.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,Hs.LEFT),t.getLocation(1,Hs.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,Hs.RIGHT),t.getLocation(1,Hs.RIGHT),2))}}getDepth(){return this._depth}getCollapsedEdge(){const e=new Array(2).fill(null);e[0]=this.pts[0],e[1]=this.pts[1];return new t(e,nn.toLineLabel(this._label))}setIsolated(t){this._isIsolated=t}setName(t){this._name=t}equals(e){if(!(e instanceof t))return!1;const s=e;if(this.pts.length!==s.pts.length)return!1;let n=!0,i=!0,r=this.pts.length;for(let t=0;t<this.pts.length;t++)if(this.pts[t].equals2D(s.pts[t])||(n=!1),this.pts[t].equals2D(s.pts[--r])||(i=!1),!n&&!i)return!1;return!0}getCoordinate(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){const t=arguments[0];return this.pts[t]}}isClosed(){return this.pts[0].equals(this.pts[this.pts.length-1])}getMaximumSegmentIndex(){return this.pts.length-1}setDepthDelta(t){this._depthDelta=t}getEdgeIntersectionList(){return this.eiList}addIntersections(t,e,s){for(let n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,s,n)}isIsolated(){return this._isIsolated}getCoordinates(){return this.pts}print(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(let e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)}computeIM(e){t.updateIM(this._label,e)}isCollapsed(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))}getDepthDelta(){return this._depthDelta}getNumPoints(){return this.pts.length}printReverse(t){t.print("edge "+this._name+": ");for(let e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")}getMonotoneChainEdge(){return null===this._mce&&(this._mce=new On(this)),this._mce}getEnvelope(){if(null===this._env){this._env=new O;for(let t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env}addIntersection(t,e,s,n){const i=new m(t.getIntersection(n));let r=e,o=t.getEdgeDistance(s,n);const l=r+1;if(l<this.pts.length){const t=this.pts[l];i.equals2D(t)&&(r=l,o=0)}this.eiList.add(i,r,o)}toString(){const t=new nt;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(let e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()}isPointwiseEqual(t){if(this.pts.length!==t.pts.length)return!1;for(let e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0}};class Mn{constructor(){Mn.constructor_.apply(this,arguments)}static constructor_(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new wn;const t=arguments[0];this._bufParams=t}static convertSegStrings(t){const e=new Lt,s=new L;for(;t.hasNext();){const n=t.next(),i=e.createLineString(n.getCoordinates());s.add(i)}return e.buildGeometry(s)}static depthDelta(t){const e=t.getLocation(0,Hs.LEFT),s=t.getLocation(0,Hs.RIGHT);return e===Qt.INTERIOR&&s===Qt.EXTERIOR?1:e===Qt.EXTERIOR&&s===Qt.INTERIOR?-1:0}createEmptyResultGeometry(){return this._geomFact.createPolygon()}getNoder(t){if(null!==this._workingNoder)return this._workingNoder;const e=new Gs,s=new jt;return s.setPrecisionModel(t),e.setSegmentIntersector(new Cn(s)),e}buffer(t,e){let s=this._workingPrecisionModel;null===s&&(s=t.getPrecisionModel()),this._geomFact=t.getFactory();const n=new en(s,this._bufParams),i=new yn(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,s),this._graph=new un(new In),this._graph.addEdges(this._edgeList.getEdges());const r=this.createSubgraphs(this._graph),o=new pn(this._geomFact);this.buildSubgraphs(r,o);const l=o.getPolygons();if(l.size()<=0)return this.createEmptyResultGeometry();return this._geomFact.buildGeometry(l)}computeNodedEdges(t,e){const s=this.getNoder(e);s.computeNodes(t);for(let t=s.getNodedSubstrings().iterator();t.hasNext();){const e=t.next(),s=e.getCoordinates();if(2===s.length&&s[0].equals2D(s[1]))continue;const n=e.getData(),i=new vn(e.getCoordinates(),new nn(n));this.insertUniqueEdge(i)}}setNoder(t){this._workingNoder=t}setWorkingPrecisionModel(t){this._workingPrecisionModel=t}insertUniqueEdge(t){const e=this._edgeList.findEqualEdge(t);if(null!==e){const s=e.getLabel();let n=t.getLabel();e.isPointwiseEqual(t)||(n=new nn(t.getLabel()),n.flip()),s.merge(n);const i=Mn.depthDelta(n),r=e.getDepthDelta()+i;e.setDepthDelta(r)}else this._edgeList.add(t),t.setDepthDelta(Mn.depthDelta(t.getLabel()))}buildSubgraphs(t,e){const s=new L;for(let n=t.iterator();n.hasNext();){const t=n.next(),i=t.getRightmostCoordinate(),r=new mn(s).getDepth(i);t.computeDepth(r),t.findResultEdges(),s.add(t),e.add(t.getDirectedEdges(),t.getNodes())}}createSubgraphs(t){const e=new L;for(let s=t.getNodes().iterator();s.hasNext();){const t=s.next();if(!t.isVisited()){const s=new Qs;s.create(t),e.add(s)}}return xe.sort(e,xe.reverseOrder()),e}}class bn{constructor(){bn.constructor_.apply(this,arguments)}static constructor_(){if(this._argGeom=null,this._distance=null,this._bufParams=new Qe,this._resultGeometry=null,this._saveException=null,1===arguments.length){const t=arguments[0];this._argGeom=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._argGeom=t,this._bufParams=e}}static bufferOp(){if(2===arguments.length){const t=arguments[1];return new bn(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof j&&"number"==typeof arguments[1]){const t=arguments[1],e=arguments[2],s=new bn(arguments[0]);s.setQuadrantSegments(e);return s.getResultGeometry(t)}if(arguments[2]instanceof Qe&&arguments[0]instanceof j&&"number"==typeof arguments[1]){const t=arguments[1];return new bn(arguments[0],arguments[2]).getResultGeometry(t)}}else if(4===arguments.length){const t=arguments[1],e=arguments[2],s=arguments[3],n=new bn(arguments[0]);n.setQuadrantSegments(e),n.setEndCapStyle(s);return n.getResultGeometry(t)}}static precisionScaleFactor(t,e,s){const n=t.getEnvelopeInternal(),i=z.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),r=s-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,r)}bufferFixedPrecision(t){const e=new ds(new Us(new yt(1)),t.getScale()),s=new Mn(this._bufParams);s.setWorkingPrecisionModel(t),s.setNoder(e),this._resultGeometry=s.buffer(this._argGeom,this._distance)}bufferReducedPrecision(){if(0===arguments.length){for(let t=bn.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof _s))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){const t=arguments[0],e=bn.precisionScaleFactor(this._argGeom,this._distance,t),s=new yt(e);this.bufferFixedPrecision(s)}}bufferOriginalPrecision(){try{const t=new Mn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof a))throw t;this._saveException=t}}getResultGeometry(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}setEndCapStyle(t){this._bufParams.setEndCapStyle(t)}computeGeometry(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;const t=this._argGeom.getFactory().getPrecisionModel();t.getType()===yt.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}setQuadrantSegments(t){this._bufParams.setQuadrantSegments(t)}}bn.CAP_ROUND=Qe.CAP_ROUND,bn.CAP_BUTT=Qe.CAP_FLAT,bn.CAP_FLAT=Qe.CAP_FLAT,bn.CAP_SQUARE=Qe.CAP_SQUARE,bn.MAX_PRECISION_DIGITS=12;class Dn{constructor(){Dn.constructor_.apply(this,arguments)}static constructor_(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Kt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof tt&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];Dn.constructor_.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];this._srcPts=t,this._isClosed=Dn.isClosed(t),this._snapTolerance=e}}static isClosed(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])}snapVertices(t,e){const s=this._isClosed?t.size()-1:t.size();for(let n=0;n<s;n++){const s=t.get(n),i=this.findSnapForVertex(s,e);null!==i&&(t.set(n,new m(i)),0===n&&this._isClosed&&t.set(t.size()-1,new m(i)))}}findSnapForVertex(t,e){for(let s=0;s<e.length;s++){if(t.equals2D(e[s]))return null;if(t.distance(e[s])<this._snapTolerance)return e[s]}return null}snapTo(t){const e=new R(this._srcPts);this.snapVertices(e,t),this.snapSegments(e,t);return e.toCoordinateArray()}snapSegments(t,e){if(0===e.length)return null;let s=e.length;e[0].equals2D(e[e.length-1])&&(s=e.length-1);for(let n=0;n<s;n++){const s=e[n],i=this.findSegmentIndexToSnap(s,t);i>=0&&t.add(i+1,new m(s),!1)}}findSegmentIndexToSnap(t,e){let s=r.MAX_VALUE,n=-1;for(let i=0;i<e.size()-1;i++){if(this._seg.p0=e.get(i),this._seg.p1=e.get(i+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}const r=this._seg.distance(t);r<this._snapTolerance&&r<s&&(s=r,n=i)}return n}setAllowSnappingToSourceVertices(t){this._allowSnappingToSourceVertices=t}}class An{constructor(){An.constructor_.apply(this,arguments)}static constructor_(){this._srcGeom=null;const t=arguments[0];this._srcGeom=t}static computeSizeBasedSnapTolerance(t){const e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*An.SNAP_PRECISION_FACTOR}static computeOverlaySnapTolerance(){if(1===arguments.length){const t=arguments[0];let e=An.computeSizeBasedSnapTolerance(t);const s=t.getPrecisionModel();if(s.getType()===yt.FIXED){const t=1/s.getScale()*2/1.415;t>e&&(e=t)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Math.min(An.computeOverlaySnapTolerance(t),An.computeOverlaySnapTolerance(e))}}static snapToSelf(t,e,s){return new An(t).snapToSelf(e,s)}static snap(t,e,s){const n=new Array(2).fill(null),i=new An(t);n[0]=i.snapTo(e,s);const r=new An(e);return n[1]=r.snapTo(n[0],s),n}computeSnapTolerance(t){return this.computeMinimumSegmentLength(t)/10}snapTo(t,e){const s=this.extractTargetCoordinates(t);return new Fn(e,s).transform(this._srcGeom)}snapToSelf(t,e){const s=this.extractTargetCoordinates(this._srcGeom),n=new Fn(t,s,!0).transform(this._srcGeom);let i=n;return e&&I(i,gt)&&(i=bn.bufferOp(n,0)),i}extractTargetCoordinates(t){const e=new at,s=t.getCoordinates();for(let t=0;t<s.length;t++)e.add(s[t]);return e.toArray(new Array(0).fill(null))}computeMinimumSegmentLength(t){let e=r.MAX_VALUE;for(let s=0;s<t.length-1;s++){const n=t[s].distance(t[s+1]);n<e&&(e=n)}return e}}An.SNAP_PRECISION_FACTOR=1e-9;class Fn extends me{constructor(){super(),Fn.constructor_.apply(this,arguments)}static constructor_(){if(this._snapTolerance=null,this._snapPts=null,this._isSelfSnap=!1,2===arguments.length){const t=arguments[0],e=arguments[1];this._snapTolerance=t,this._snapPts=e}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._snapTolerance=t,this._snapPts=e,this._isSelfSnap=s}}transformCoordinates(t,e){const s=t.toCoordinateArray(),n=this.snapLine(s,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)}snapLine(t,e){const s=new Dn(t,this._snapTolerance);return s.setAllowSnappingToSourceVertices(this._isSelfSnap),s.snapTo(e)}}class Gn{constructor(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=new i,this._commonSignExp=null}getCommon(){return r.longBitsToDouble(this._commonBits)}add(t){const e=r.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Gn.signExpBits(this._commonBits),this._isFirst=!1,null;if(Gn.signExpBits(e)!==this._commonSignExp)return this._commonBits.high=0,this._commonBits.low=0,null;this._commonMantissaBitsCount=Gn.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Gn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))}toString(){if(1===arguments.length){const t=arguments[0],e=r.longBitsToDouble(t),s="0000000000000000000000000000000000000000000000000000000000000000"+i.toBinaryString(t),n=s.substring(s.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}}getClass(){return Gn}get interfaces_(){return[]}static getBit(t,e){const s=1<<e%32;return e<32?t.low&s?1:0:t.high&s?1:0}static signExpBits(t){return t.high>>>20}static zeroLowerBits(t,e){let s="low";if(e>32&&(t.low=0,e%=32,s="high"),e>0){const n=e<32?~((1<<e)-1):0;t[s]&=n}return t}static numCommonMostSigMantissaBits(t,e){let s=0;for(let n=52;n>=0;n--){if(Gn.getBit(t,n)!==Gn.getBit(e,n))return s;s++}return 52}}class qn{constructor(){qn.constructor_.apply(this,arguments)}static constructor_(){this._commonCoord=null,this._ccFilter=new Bn}add(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()}removeCommonBits(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;const e=new m(this._commonCoord);e.x=-e.x,e.y=-e.y;const s=new Yn(e);return t.apply(s),t.geometryChanged(),t}addCommonBits(t){const e=new Yn(this._commonCoord);t.apply(e),t.geometryChanged()}getCommonCoordinate(){return this._commonCoord}}class Bn{constructor(){Bn.constructor_.apply(this,arguments)}static constructor_(){this._commonBitsX=new Gn,this._commonBitsY=new Gn}filter(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)}getCommonCoordinate(){return new m(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())}get interfaces_(){return[K]}}class Yn{constructor(){Yn.constructor_.apply(this,arguments)}static constructor_(){this.trans=null;const t=arguments[0];this.trans=t}filter(t,e){const s=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,s),t.setOrdinate(e,1,n)}isGeometryChanged(){return!0}isDone(){return!1}get interfaces_(){return[P]}}qn.CommonCoordinateFilter=Bn,qn.Translater=Yn;class zn{constructor(){zn.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new L,this._resultLineList=new L;const t=arguments[0],e=arguments[1],s=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=s}collectLines(t){for(let e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){const s=e.next();this.collectLineEdge(s,t,this._lineEdgesList),this.collectBoundaryTouchEdge(s,t,this._lineEdgesList)}}labelIsolatedLine(t,e){const s=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,s)}build(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList}collectLineEdge(t,e,s){const n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!oi.isResultOfOp(n,e)||i.isCovered()||(s.add(i),t.setVisitedEdge(!0)))}findCoveredLineEdges(){for(let t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(let t=this._op.getGraph().getEdgeEnds().iterator();t.hasNext();){const e=t.next(),s=e.getEdge();if(e.isLineEdge()&&!s.isCoveredSet()){const t=this._op.isCoveredByA(e.getCoordinate());s.setCovered(t)}}}labelIsolatedLines(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),s=t.getLabel();t.isIsolated()&&(s.isNull(0)?this.labelIsolatedLine(t,0):this.labelIsolatedLine(t,1))}}buildLines(t){for(let t=this._lineEdgesList.iterator();t.hasNext();){const e=t.next(),s=this._geometryFactory.createLineString(e.getCoordinates());this._resultLineList.add(s),e.setInResult(!0)}}collectBoundaryTouchEdge(t,e,s){const n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(h.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(oi.isResultOfOp(n,e)&&e===oi.INTERSECTION&&(s.add(t.getEdge()),t.setVisitedEdge(!0))))}}class Vn{constructor(){Vn.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._resultPointList=new L;const t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e}build(t){return this.extractNonCoveredResultNodes(t),this._resultPointList}extractNonCoveredResultNodes(t){for(let e=this._op.getGraph().getNodes().iterator();e.hasNext();){const s=e.next();if(!s.isInResult()&&(!s.isIncidentEdgeInResult()&&(0===s.getEdges().getDegree()||t===oi.INTERSECTION))){const e=s.getLabel();oi.isResultOfOp(e,t)&&this.filterCoveredNodeToPoint(s)}}}filterCoveredNodeToPoint(t){const e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){const t=this._geometryFactory.createPoint(e);this._resultPointList.add(t)}}}class kn{isInBoundary(t){}}class Xn{isInBoundary(t){return t%2==1}get interfaces_(){return[kn]}}class Un{isInBoundary(t){return t>0}get interfaces_(){return[kn]}}class Hn{isInBoundary(t){return t>1}get interfaces_(){return[kn]}}class Wn{isInBoundary(t){return 1===t}get interfaces_(){return[kn]}}kn.Mod2BoundaryNodeRule=Xn,kn.EndPointBoundaryNodeRule=Un,kn.MultiValentEndPointBoundaryNodeRule=Hn,kn.MonoValentEndPointBoundaryNodeRule=Wn,kn.MOD2_BOUNDARY_RULE=new Xn,kn.ENDPOINT_BOUNDARY_RULE=new Un,kn.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new Hn,kn.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new Wn,kn.OGC_SFS_BOUNDARY_RULE=kn.MOD2_BOUNDARY_RULE;class Zn{constructor(){Zn.constructor_.apply(this,arguments)}static constructor_(){if(this._boundaryRule=kn.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];if(null===t)throw new n("Rule must be non-null");this._boundaryRule=t}}locateInPolygonRing(t,e){return e.getEnvelopeInternal().intersects(t)?Ue.locateInRing(t,e.getCoordinates()):Qt.EXTERIOR}intersects(t,e){return this.locate(t,e)!==Qt.EXTERIOR}updateLocationInfo(t){t===Qt.INTERIOR&&(this._isIn=!0),t===Qt.BOUNDARY&&this._numBoundaries++}computeLocation(t,e){if(e instanceof Nt&&this.updateLocationInfo(this.locateOnPoint(t,e)),e instanceof tt)this.updateLocationInfo(this.locateOnLineString(t,e));else if(e instanceof Ct)this.updateLocationInfo(this.locateInPolygon(t,e));else if(e instanceof Et){const s=e;for(let e=0;e<s.getNumGeometries();e++){const n=s.getGeometryN(e);this.updateLocationInfo(this.locateOnLineString(t,n))}}else if(e instanceof dt){const s=e;for(let e=0;e<s.getNumGeometries();e++){const n=s.getGeometryN(e);this.updateLocationInfo(this.locateInPolygon(t,n))}}else if(e instanceof ut){const s=new We(e);for(;s.hasNext();){const n=s.next();n!==e&&this.computeLocation(t,n)}}}locateOnPoint(t,e){return e.getCoordinate().equals2D(t)?Qt.INTERIOR:Qt.EXTERIOR}locateOnLineString(t,e){if(!e.getEnvelopeInternal().intersects(t))return Qt.EXTERIOR;const s=e.getCoordinateSequence();return e.isClosed()||!t.equals(s.getCoordinate(0))&&!t.equals(s.getCoordinate(s.size()-1))?Ue.isOnLine(t,s)?Qt.INTERIOR:Qt.EXTERIOR:Qt.BOUNDARY}locateInPolygon(t,e){if(e.isEmpty())return Qt.EXTERIOR;const s=e.getExteriorRing(),n=this.locateInPolygonRing(t,s);if(n===Qt.EXTERIOR)return Qt.EXTERIOR;if(n===Qt.BOUNDARY)return Qt.BOUNDARY;for(let s=0;s<e.getNumInteriorRing();s++){const n=e.getInteriorRingN(s),i=this.locateInPolygonRing(t,n);if(i===Qt.INTERIOR)return Qt.EXTERIOR;if(i===Qt.BOUNDARY)return Qt.BOUNDARY}return Qt.INTERIOR}locate(t,e){return e.isEmpty()?Qt.EXTERIOR:e instanceof tt?this.locateOnLineString(t,e):e instanceof Ct?this.locateInPolygon(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?Qt.BOUNDARY:this._numBoundaries>0||this._isIn?Qt.INTERIOR:Qt.EXTERIOR)}}class jn{constructor(){jn.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._data=null;const t=arguments[0],e=arguments[1];this._pts=t,this._data=e}getCoordinates(){return this._pts}size(){return this._pts.length}getCoordinate(t){return this._pts[t]}isClosed(){return this._pts[0].equals(this._pts[this._pts.length-1])}getSegmentOctant(t){return t===this._pts.length-1?-1:as.octant(this.getCoordinate(t),this.getCoordinate(t+1))}setData(t){this._data=t}getData(){return this._data}toString(){return Wt.toLineString(new it(this._pts))}get interfaces_(){return[cs]}}class Kn{constructor(){Kn.constructor_.apply(this,arguments)}static constructor_(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._keepIntersections=!0,this._isInteriorIntersectionsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new L,this._intersectionCount=0;const t=arguments[0];this._li=t,this._interiorIntersection=null}static createAllIntersectionsFinder(t){const e=new Kn(t);return e.setFindAllIntersections(!0),e}static isInteriorVertexIntersection(){if(4===arguments.length){const t=arguments[1];return(!arguments[2]||!arguments[3])&&!!arguments[0].equals2D(t)}if(8===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5],o=arguments[6],l=arguments[7];return!!Kn.isInteriorVertexIntersection(t,s,i,o)||(!!Kn.isInteriorVertexIntersection(t,n,i,l)||(!!Kn.isInteriorVertexIntersection(e,s,r,o)||!!Kn.isInteriorVertexIntersection(e,n,r,l)))}}static createInteriorIntersectionCounter(t){const e=new Kn(t);return e.setInteriorIntersectionsOnly(!0),e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e}static createIntersectionCounter(t){const e=new Kn(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e}static isEndSegment(t,e){return 0===e||e>=t.size()-2}static createAnyIntersectionFinder(t){return new Kn(t)}static createInteriorIntersectionsFinder(t){const e=new Kn(t);return e.setFindAllIntersections(!0),e.setInteriorIntersectionsOnly(!0),e}count(){return this._intersectionCount}getIntersections(){return this._intersections}setFindAllIntersections(t){this._findAllIntersections=t}setKeepIntersections(t){this._keepIntersections=t}getIntersection(){return this._interiorIntersection}processIntersections(t,e,s,n){if(!this._findAllIntersections&&this.hasIntersection())return null;const i=t===s;if(i&&e===n)return null;if(this._isCheckEndSegmentsOnly){if(!(Kn.isEndSegment(t,e)||Kn.isEndSegment(s,n)))return null}const r=t.getCoordinate(e),o=t.getCoordinate(e+1),l=s.getCoordinate(n),a=s.getCoordinate(n+1),c=0===e,h=e+2===t.size(),u=0===n,g=n+2===s.size();this._li.computeIntersection(r,o,l,a);const d=this._li.hasIntersection()&&this._li.isInteriorIntersection();let _=!1;if(!this._isInteriorIntersectionsOnly){_=!(i&&Math.abs(n-e)<=1)&&Kn.isInteriorVertexIntersection(r,o,l,a,c,h,u,g)}(d||_)&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=r,this._intSegments[1]=o,this._intSegments[2]=l,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)}hasIntersection(){return null!==this._interiorIntersection}isDone(){return!this._findAllIntersections&&null!==this._interiorIntersection}setInteriorIntersectionsOnly(t){this._isInteriorIntersectionsOnly=t}setCheckEndSegmentsOnly(t){this._isCheckEndSegmentsOnly=t}getIntersectionSegments(){return this._intSegments}get interfaces_(){return[ks]}}class Qn{constructor(){Qn.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;const t=arguments[0];this._segStrings=t}static computeIntersections(t){const e=new Qn(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()}isValid(){return this.execute(),this._isValid}setFindAllIntersections(t){this._findAllIntersections=t}checkInteriorIntersections(){this._isValid=!0,this._segInt=new Kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);const t=new Gs;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null}checkValid(){if(this.execute(),!this._isValid)throw new _s(this.getErrorMessage(),this._segInt.getIntersection())}getErrorMessage(){if(this._isValid)return"no intersections found";const t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Wt.toLineString(t[0],t[1])+" and "+Wt.toLineString(t[2],t[3])}execute(){if(null!==this._segInt)return null;this.checkInteriorIntersections()}getIntersections(){return this._segInt.getIntersections()}}class Jn{constructor(){Jn.constructor_.apply(this,arguments)}static constructor_(){this._nv=null;const t=arguments[0];this._nv=new Qn(Jn.toSegmentStrings(t))}static toSegmentStrings(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();e.add(new jn(t.getCoordinates(),t))}return e}static checkValid(t){new Jn(t).checkValid()}checkValid(){this._nv.checkValid()}}class $n{}class ti{constructor(){ti.constructor_.apply(this,arguments)}static constructor_(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;const t=arguments[0],e=arguments[1],s=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=s}static isAdjacentSegments(t,e){return 1===Math.abs(t-e)}isTrivialIntersection(t,e,s,n){if(t===s&&1===this._li.getIntersectionNum()){if(ti.isAdjacentSegments(e,n))return!0;if(t.isClosed()){const s=t.getNumPoints()-1;if(0===e&&n===s||0===n&&e===s)return!0}}return!1}hasProperInteriorIntersection(){return this._hasProperInterior}isBoundaryPointInternal(t,e){for(let s=e.iterator();s.hasNext();){const e=s.next().getCoordinate();if(t.isIntersection(e))return!0}return!1}hasProperIntersection(){return this._hasProper}hasIntersection(){return this._hasIntersection}isDone(){return this._isDone}isBoundaryPoint(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))}setBoundaryNodes(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e}addIntersections(t,e,s,n){if(t===s&&e===n)return null;this.numTests++;const i=t.getCoordinates()[e],r=t.getCoordinates()[e+1],o=s.getCoordinates()[n],l=s.getCoordinates()[n+1];this._li.computeIntersection(i,r,o,l),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,s,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),s.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))}getProperIntersectionPoint(){return this._properIntersectionPoint}setIsDoneIfProperInt(t){this._isDoneWhenProperInt=t}}class ei{constructor(){ei.constructor_.apply(this,arguments)}static constructor_(){this.mce=null,this.chainIndex=null;const t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e}computeIntersections(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)}}class si{constructor(){si.constructor_.apply(this,arguments)}static constructor_(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._eventType=si.DELETE,this._xValue=t,this._insertEvent=e}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._eventType=si.INSERT,this._label=t,this._xValue=e,this._obj=s}}getObject(){return this._obj}getDeleteEventIndex(){return this._deleteEventIndex}isDelete(){return this._eventType===si.DELETE}setDeleteEventIndex(t){this._deleteEventIndex=t}compareTo(t){const e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0}getInsertEvent(){return this._insertEvent}isInsert(){return this._eventType===si.INSERT}isSameLabel(t){return null!==this._label&&this._label===t._label}get interfaces_(){return[o]}}si.INSERT=1,si.DELETE=2;class ni extends $n{constructor(){super(),ni.constructor_.apply(this,arguments)}static constructor_(){this.events=new L,this.nOverlaps=null}prepareEvents(){xe.sort(this.events);for(let t=0;t<this.events.size();t++){const e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}}computeIntersections(){if(1===arguments.length){const t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(let e=0;e<this.events.size();e++){const s=this.events.get(e);if(s.isInsert()&&this.processOverlaps(e,s.getDeleteEventIndex(),s,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof ti&&I(arguments[0],C)&&I(arguments[1],C)){const t=arguments[0],e=arguments[1],s=arguments[2];this.addEdges(t,t),this.addEdges(e,e),this.computeIntersections(s)}else if("boolean"==typeof arguments[2]&&I(arguments[0],C)&&arguments[1]instanceof ti){const t=arguments[0],e=arguments[1];arguments[2]?this.addEdges(t,null):this.addEdges(t),this.computeIntersections(e)}}addEdge(t,e){const s=t.getMonotoneChainEdge(),n=s.getStartIndexes();for(let t=0;t<n.length-1;t++){const n=new ei(s,t),i=new si(e,s.getMinX(t),n);this.events.add(i),this.events.add(new si(s.getMaxX(t),i))}}processOverlaps(t,e,s,n){const i=s.getObject();for(let r=t;r<e;r++){const t=this.events.get(r);if(t.isInsert()){const e=t.getObject();s.isSameLabel(t)||(i.computeIntersections(e,n),this.nOverlaps++)}}}addEdges(){if(1===arguments.length){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.addEdge(e,e)}}else if(2===arguments.length){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();){const s=e.next();this.addEdge(s,t)}}}}class ii extends un{constructor(){super(),ii.constructor_.apply(this,arguments)}static constructor_(){if(this._parentGeom=null,this._lineEdgeMap=new ft,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Zn,2===arguments.length){const t=arguments[0],e=arguments[1];ii.constructor_.call(this,t,e,kn.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._argIndex=t,this._parentGeom=e,this._boundaryNodeRule=s,null!==e&&this.add(e)}}static determineBoundary(t,e){return t.isInBoundary(e)?Qt.BOUNDARY:Qt.INTERIOR}insertBoundaryPoint(t,e){const s=this._nodes.addNode(e).getLabel();let n=1,i=Qt.NONE;i=s.getLocation(t,Hs.ON),i===Qt.BOUNDARY&&n++;const r=ii.determineBoundary(this._boundaryNodeRule,n);s.setLocation(t,r)}computeSelfNodes(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){const t=arguments[1],e=arguments[2],s=new ti(arguments[0],!0,!1);s.setIsDoneIfProperInt(e);const n=this.createEdgeSetIntersector(),i=this._parentGeom instanceof et||this._parentGeom instanceof Ct||this._parentGeom instanceof dt,r=t||!i;return n.computeIntersections(this._edges,s,r),this.addSelfIntersectionNodes(this._argIndex),s}}addPolygon(t){this.addPolygonRing(t.getExteriorRing(),Qt.EXTERIOR,Qt.INTERIOR);for(let e=0;e<t.getNumInteriorRing();e++){const s=t.getInteriorRingN(e);this.addPolygonRing(s,Qt.INTERIOR,Qt.EXTERIOR)}}addEdge(t){this.insertEdge(t);const e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],Qt.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],Qt.BOUNDARY)}addLineString(t){const e=W.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;const s=new vn(e,new nn(this._argIndex,Qt.INTERIOR));this._lineEdgeMap.put(t,s),this.insertEdge(s),h.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])}getInvalidPoint(){return this._invalidPoint}getBoundaryPoints(){const t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null);let s=0;for(let n=t.iterator();n.hasNext();){const t=n.next();e[s++]=t.getCoordinate().copy()}return e}addSelfIntersectionNodes(t){for(let e=this._edges.iterator();e.hasNext();){const s=e.next(),n=s.getLabel().getLocation(t);for(let e=s.eiList.iterator();e.hasNext();){const s=e.next();this.addSelfIntersectionNode(t,s.coord,n)}}}add(){if(!(1===arguments.length&&arguments[0]instanceof j))return super.add.apply(this,arguments);{const t=arguments[0];if(t.isEmpty())return null;if(t instanceof dt&&(this._useBoundaryDeterminationRule=!1),t instanceof Ct)this.addPolygon(t);else if(t instanceof tt)this.addLineString(t);else if(t instanceof Nt)this.addPoint(t);else if(t instanceof St)this.addCollection(t);else if(t instanceof Et)this.addCollection(t);else if(t instanceof dt)this.addCollection(t);else{if(!(t instanceof ut))throw new U(t.getGeometryType());this.addCollection(t)}}}addCollection(t){for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);this.add(s)}}locate(t){return I(this._parentGeom,gt)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new Ve(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)}findEdge(){if(1===arguments.length&&arguments[0]instanceof tt){const t=arguments[0];return this._lineEdgeMap.get(t)}return super.findEdge.apply(this,arguments)}computeSplitEdges(t){for(let e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}}computeEdgeIntersections(t,e,s){const n=new ti(e,s,!0);n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes());return this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n}getGeometry(){return this._parentGeom}getBoundaryNodeRule(){return this._boundaryNodeRule}hasTooFewPoints(){return this._hasTooFewPoints}addPoint(){if(arguments[0]instanceof Nt){const t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,Qt.INTERIOR)}else if(arguments[0]instanceof m){const t=arguments[0];this.insertPoint(this._argIndex,t,Qt.INTERIOR)}}getBoundaryNodes(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes}addSelfIntersectionNode(t,e,s){if(this.isBoundaryNode(t,e))return null;s===Qt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,s)}addPolygonRing(t,e,s){if(t.isEmpty())return null;const n=W.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;let i=e,r=s;q.isCCW(n)&&(i=s,r=e);const o=new vn(n,new nn(this._argIndex,Qt.BOUNDARY,i,r));this._lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this._argIndex,n[0],Qt.BOUNDARY)}insertPoint(t,e,s){const n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new nn(t,s):i.setLocation(t,s)}createEdgeSetIntersector(){return new ni}}class ri{constructor(){ri.constructor_.apply(this,arguments)}static constructor_(){if(this._li=new jt,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){const t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ii(0,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];ri.constructor_.call(this,t,e,kn.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];t.getPrecisionModel().compareTo(e.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ii(0,t,s),this._arg[1]=new ii(1,e,s)}}setComputationPrecision(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)}getArgGeometry(t){return this._arg[t].getGeometry()}}class oi extends ri{constructor(){super(),oi.constructor_.apply(this,arguments)}static constructor_(){this._ptLocator=new Zn,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new wn,this._resultPolyList=new L,this._resultLineList=new L,this._resultPointList=new L;const t=arguments[0],e=arguments[1];ri.constructor_.call(this,t,e),this._graph=new un(new In),this._geomFact=t.getFactory()}static overlayOp(t,e,s){return new oi(t,e).getResultGeometry(s)}static union(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return oi.createEmptyResult(oi.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return ai.overlayOp(t,e,oi.UNION)}static intersection(t,e){if(t.isEmpty()||e.isEmpty())return oi.createEmptyResult(oi.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){const s=e;return ce.map(t,new class{get interfaces_(){return[MapOp]}map(t){return oi.intersection(t,s)}})}return ai.overlayOp(t,e,oi.INTERSECTION)}static symDifference(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return oi.createEmptyResult(oi.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return ai.overlayOp(t,e,oi.SYMDIFFERENCE)}static resultDimension(t,e,s){const n=e.getDimension(),i=s.getDimension();let r=-1;switch(t){case oi.INTERSECTION:r=Math.min(n,i);break;case oi.UNION:r=Math.max(n,i);break;case oi.DIFFERENCE:r=n;break;case oi.SYMDIFFERENCE:r=Math.max(n,i)}return r}static createEmptyResult(t,e,s,n){const i=oi.resultDimension(t,e,s);return n.createEmpty(i)}static difference(t,e){if(t.isEmpty())return oi.createEmptyResult(oi.DIFFERENCE,t,e,t.getFactory());if(e.isEmpty())return t.copy();if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return ai.overlayOp(t,e,oi.DIFFERENCE)}static isResultOfOp(){if(2===arguments.length){const t=arguments[0],e=arguments[1],s=t.getLocation(0),n=t.getLocation(1);return oi.isResultOfOp(s,n,e)}if(3===arguments.length){let t=arguments[0],e=arguments[1],s=arguments[2];switch(t===Qt.BOUNDARY&&(t=Qt.INTERIOR),e===Qt.BOUNDARY&&(e=Qt.INTERIOR),s){case oi.INTERSECTION:return t===Qt.INTERIOR&&e===Qt.INTERIOR;case oi.UNION:return t===Qt.INTERIOR||e===Qt.INTERIOR;case oi.DIFFERENCE:return t===Qt.INTERIOR&&e!==Qt.INTERIOR;case oi.SYMDIFFERENCE:return t===Qt.INTERIOR&&e!==Qt.INTERIOR||t!==Qt.INTERIOR&&e===Qt.INTERIOR}return!1}}insertUniqueEdge(t){const e=this._edgeList.findEqualEdge(t);if(null!==e){const s=e.getLabel();let n=t.getLabel();e.isPointwiseEqual(t)||(n=new nn(t.getLabel()),n.flip());const i=e.getDepth();i.isNull()&&i.add(s),i.add(n),s.merge(n)}else this._edgeList.add(t)}getGraph(){return this._graph}cancelDuplicateResultEdges(){for(let t=this._graph.getEdgeEnds().iterator();t.hasNext();){const e=t.next(),s=e.getSym();e.isInResult()&&s.isInResult()&&(e.setInResult(!1),s.setInResult(!1))}}mergeSymLabels(){for(let t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}}computeOverlay(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);const e=new L;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Jn.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();const s=new pn(this._geomFact);s.add(this._graph),this._resultPolyList=s.getPolygons();const n=new zn(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);const i=new Vn(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)}findResultAreaEdges(t){for(let e=this._graph.getEdgeEnds().iterator();e.hasNext();){const s=e.next(),n=s.getLabel();n.isArea()&&!s.isInteriorAreaEdge()&&oi.isResultOfOp(n.getLocation(0,Hs.RIGHT),n.getLocation(1,Hs.RIGHT),t)&&s.setInResult(!0)}}computeLabelsFromDepths(){for(let t=this._edgeList.iterator();t.hasNext();){const e=t.next(),s=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(let t=0;t<2;t++)s.isNull(t)||!s.isArea()||n.isNull(t)||(0===n.getDelta(t)?s.toLine(t):(h.isTrue(!n.isNull(t,Hs.LEFT),"depth of LEFT side has not been initialized"),s.setLocation(t,Hs.LEFT,n.getLocation(t,Hs.LEFT)),h.isTrue(!n.isNull(t,Hs.RIGHT),"depth of RIGHT side has not been initialized"),s.setLocation(t,Hs.RIGHT,n.getLocation(t,Hs.RIGHT))))}}}isCoveredByA(t){return!!this.isCovered(t,this._resultPolyList)}isCoveredByLA(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)}computeGeometry(t,e,s,n){const i=new L;return i.addAll(t),i.addAll(e),i.addAll(s),i.isEmpty()?oi.createEmptyResult(n,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(i)}isCovered(t,e){for(let s=e.iterator();s.hasNext();){const e=s.next();if(this._ptLocator.locate(t,e)!==Qt.EXTERIOR)return!0}return!1}replaceCollapsedEdges(){const t=new L;for(let e=this._edgeList.iterator();e.hasNext();){const s=e.next();s.isCollapsed()&&(e.remove(),t.add(s.getCollapsedEdge()))}this._edgeList.addAll(t)}updateNodeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),s=e.getEdges().getLabel();e.getLabel().merge(s)}}getResultGeometry(t){return this.computeOverlay(t),this._resultGeom}insertUniqueEdges(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertUniqueEdge(t)}}labelIncompleteNode(t,e){const s=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,s)}copyPoints(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const s=e.next();this._graph.addNode(s.getCoordinate()).setLabel(t,s.getLabel().getLocation(t))}}computeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()}labelIncompleteNodes(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),s=e.getLabel();e.isIsolated()&&(s.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(s)}}}oi.INTERSECTION=1,oi.UNION=2,oi.DIFFERENCE=3,oi.SYMDIFFERENCE=4;class li{constructor(){li.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null;const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()}static overlayOp(t,e,s){return new li(t,e).getResultGeometry(s)}static union(t,e){return li.overlayOp(t,e,oi.UNION)}static intersection(t,e){return li.overlayOp(t,e,oi.INTERSECTION)}static symDifference(t,e){return li.overlayOp(t,e,oi.SYMDIFFERENCE)}static difference(t,e){return li.overlayOp(t,e,oi.DIFFERENCE)}selfSnap(t){return new An(t).snapTo(t,this._snapTolerance)}removeCommonBits(t){this._cbr=new qn,this._cbr.add(t[0]),this._cbr.add(t[1]);const e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e}prepareResult(t){return this._cbr.addCommonBits(t),t}getResultGeometry(t){const e=this.snap(this._geom),s=oi.overlayOp(e[0],e[1],t);return this.prepareResult(s)}checkValid(t){t.isValid()||Y.out.println("Snapped geometry is invalid")}computeSnapTolerance(){this._snapTolerance=An.computeOverlaySnapTolerance(this._geom[0],this._geom[1])}snap(t){const e=this.removeCommonBits(t);return An.snap(e[0],e[1],this._snapTolerance)}}class ai{constructor(){ai.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null);const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e}static overlayOp(t,e,s){return new ai(t,e).getResultGeometry(s)}static union(t,e){return ai.overlayOp(t,e,oi.UNION)}static intersection(t,e){return ai.overlayOp(t,e,oi.INTERSECTION)}static symDifference(t,e){return ai.overlayOp(t,e,oi.SYMDIFFERENCE)}static difference(t,e){return ai.overlayOp(t,e,oi.DIFFERENCE)}getResultGeometry(t){let e=null,s=!1,n=null;try{e=oi.overlayOp(this._geom[0],this._geom[1],t);!0&&(s=!0)}catch(t){if(!(t instanceof a))throw t;n=t}if(!s)try{e=li.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof a?n:t}return e}}class ci{static union(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return oi.createEmptyResult(oi.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return j.checkNotGeometryCollection(t),j.checkNotGeometryCollection(e),ai.overlayOp(t,e,oi.UNION)}}class hi{static diagonalSize(t){if(t.isNull())return 0;const e=t.getWidth(),s=t.getHeight();return Math.sqrt(e*e+s*s)}measure(t,e){const s=Oe.distance(t,e,hi.DENSIFY_FRACTION),n=new O(t.getEnvelopeInternal());n.expandToInclude(e.getEnvelopeInternal());return 1-s/hi.diagonalSize(n)}get interfaces_(){return[Ke]}}hi.DENSIFY_FRACTION=.25;var ui=Object.freeze({__proto__:null,AreaSimilarityMeasure:class{measure(t,e){return oi.intersection(t,e).getArea()/ci.union(t,e).getArea()}get interfaces_(){return[Ke]}},HausdorffSimilarityMeasure:hi,SimilarityMeasure:Ke,SimilarityMeasureCombiner:class{static combine(t,e){return Math.min(t,e)}}});class gi{constructor(){gi.constructor_.apply(this,arguments)}static constructor_(){this._areaBasePt=null,this._triangleCent3=new m,this._areasum2=0,this._cg3=new m,this._lineCentSum=new m,this._totalLength=0,this._ptCount=0,this._ptCentSum=new m;const t=arguments[0];this._areaBasePt=null,this.add(t)}static centroid3(t,e,s,n){return n.x=t.x+e.x+s.x,n.y=t.y+e.y+s.y,null}static getCentroid(t){return new gi(t).getCentroid()}static area2(t,e,s){return(e.x-t.x)*(s.y-t.y)-(s.x-t.x)*(e.y-t.y)}setAreaBasePoint(t){this._areaBasePt=t}addPoint(t){this._ptCount+=1,this._ptCentSum.x+=t.x,this._ptCentSum.y+=t.y}addLineSegments(t){let e=0;for(let s=0;s<t.length-1;s++){const n=t[s].distance(t[s+1]);if(0===n)continue;e+=n;const i=(t[s].x+t[s+1].x)/2;this._lineCentSum.x+=n*i;const r=(t[s].y+t[s+1].y)/2;this._lineCentSum.y+=n*r}this._totalLength+=e,0===e&&t.length>0&&this.addPoint(t[0])}addHole(t){const e=q.isCCW(t);for(let s=0;s<t.length-1;s++)this.addTriangle(this._areaBasePt,t[s],t[s+1],e);this.addLineSegments(t)}getCentroid(){const t=new m;if(Math.abs(this._areasum2)>0)t.x=this._cg3.x/3/this._areasum2,t.y=this._cg3.y/3/this._areasum2;else if(this._totalLength>0)t.x=this._lineCentSum.x/this._totalLength,t.y=this._lineCentSum.y/this._totalLength;else{if(!(this._ptCount>0))return null;t.x=this._ptCentSum.x/this._ptCount,t.y=this._ptCentSum.y/this._ptCount}return t}add(){if(arguments[0]instanceof Ct){const t=arguments[0];this.addShell(t.getExteriorRing().getCoordinates());for(let e=0;e<t.getNumInteriorRing();e++)this.addHole(t.getInteriorRingN(e).getCoordinates())}else if(arguments[0]instanceof j){const t=arguments[0];if(t.isEmpty())return null;if(t instanceof Nt)this.addPoint(t.getCoordinate());else if(t instanceof tt)this.addLineSegments(t.getCoordinates());else if(t instanceof Ct){const e=t;this.add(e)}else if(t instanceof ut){const e=t;for(let t=0;t<e.getNumGeometries();t++)this.add(e.getGeometryN(t))}}}addShell(t){t.length>0&&this.setAreaBasePoint(t[0]);const e=!q.isCCW(t);for(let s=0;s<t.length-1;s++)this.addTriangle(this._areaBasePt,t[s],t[s+1],e);this.addLineSegments(t)}addTriangle(t,e,s,n){const i=n?1:-1;gi.centroid3(t,e,s,this._triangleCent3);const r=gi.area2(t,e,s);this._cg3.x+=i*r*this._triangleCent3.x,this._cg3.y+=i*r*this._triangleCent3.y,this._areasum2+=i*r}}class di{constructor(){di.constructor_.apply(this,arguments)}static constructor_(){this._coordSet=new pt,this._list=new L}static filterCoordinates(t){const e=new di;for(let s=0;s<t.length;s++)e.filter(t[s]);return e.getCoordinates()}filter(t){this._coordSet.add(t)&&this._list.add(t)}getCoordinates(){const t=new Array(this._list.size()).fill(null);return this._list.toArray(t)}get interfaces_(){return[K]}}class _i{constructor(){_i.constructor_.apply(this,arguments)}static constructor_(){if(this._geomFactory=null,this._inputPts=null,1===arguments.length){const t=arguments[0];_i.constructor_.call(this,_i.extractCoordinates(t),t.getFactory())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._inputPts=di.filterCoordinates(t),this._geomFactory=e}}static extractCoordinates(t){const e=new di;return t.apply(e),e.getCoordinates()}lineOrPolygon(t){if(3===(t=this.cleanRing(t)).length)return this._geomFactory.createLineString([t[0],t[1]]);const e=this._geomFactory.createLinearRing(t);return this._geomFactory.createPolygon(e)}cleanRing(t){h.equals(t[0],t[t.length-1]);const e=new L;let s=null;for(let n=0;n<=t.length-2;n++){const i=t[n],r=t[n+1];i.equals(r)||(null!==s&&this.isBetween(s,i,r)||(e.add(i),s=i))}e.add(t[t.length-1]);const n=new Array(e.size()).fill(null);return e.toArray(n)}isBetween(t,e,s){if(0!==q.index(t,e,s))return!1;if(t.x!==s.x){if(t.x<=e.x&&e.x<=s.x)return!0;if(s.x<=e.x&&e.x<=t.x)return!0}if(t.y!==s.y){if(t.y<=e.y&&e.y<=s.y)return!0;if(s.y<=e.y&&e.y<=t.y)return!0}return!1}reduce(t){const e=this.computeOctRing(t);if(null===e)return t;const s=new at;for(let t=0;t<e.length;t++)s.add(e[t]);for(let n=0;n<t.length;n++)Ue.isInRing(t[n],e)||s.add(t[n]);const n=W.toCoordinateArray(s);return n.length<3?this.padArray3(n):n}getConvexHull(){if(0===this._inputPts.length)return this._geomFactory.createGeometryCollection();if(1===this._inputPts.length)return this._geomFactory.createPoint(this._inputPts[0]);if(2===this._inputPts.length)return this._geomFactory.createLineString(this._inputPts);let t=this._inputPts;this._inputPts.length>50&&(t=this.reduce(this._inputPts));const e=this.preSort(t),s=this.grahamScan(e),n=this.toCoordinateArray(s);return this.lineOrPolygon(n)}padArray3(t){const e=new Array(3).fill(null);for(let s=0;s<e.length;s++)s<t.length?e[s]=t[s]:e[s]=t[0];return e}computeOctPts(t){const e=new Array(8).fill(null);for(let s=0;s<e.length;s++)e[s]=t[0];for(let s=1;s<t.length;s++)t[s].x<e[0].x&&(e[0]=t[s]),t[s].x-t[s].y<e[1].x-e[1].y&&(e[1]=t[s]),t[s].y>e[2].y&&(e[2]=t[s]),t[s].x+t[s].y>e[3].x+e[3].y&&(e[3]=t[s]),t[s].x>e[4].x&&(e[4]=t[s]),t[s].x-t[s].y>e[5].x-e[5].y&&(e[5]=t[s]),t[s].y<e[6].y&&(e[6]=t[s]),t[s].x+t[s].y<e[7].x+e[7].y&&(e[7]=t[s]);return e}toCoordinateArray(t){const e=new Array(t.size()).fill(null);for(let s=0;s<t.size();s++){const n=t.get(s);e[s]=n}return e}grahamScan(t){let e=null;const s=new Zs;s.push(t[0]),s.push(t[1]),s.push(t[2]);for(let n=3;n<t.length;n++){for(e=s.pop();!s.empty()&&q.index(s.peek(),e,t[n])>0;)e=s.pop();s.push(e),s.push(t[n])}return s.push(t[0]),s}preSort(t){let e=null;for(let s=1;s<t.length;s++)(t[s].y<t[0].y||t[s].y===t[0].y&&t[s].x<t[0].x)&&(e=t[0],t[0]=t[s],t[s]=e);return ht.sort(t,1,t.length,new pi(t[0])),t}computeOctRing(t){const e=this.computeOctPts(t),s=new R;return s.add(e,!1),s.size()<3?null:(s.closeRing(),s.toCoordinateArray())}}class pi{constructor(){pi.constructor_.apply(this,arguments)}static constructor_(){this._origin=null;const t=arguments[0];this._origin=t}static polarCompare(t,e,s){const n=e.x-t.x,i=e.y-t.y,r=s.x-t.x,o=s.y-t.y,l=q.index(t,e,s);if(l===q.COUNTERCLOCKWISE)return 1;if(l===q.CLOCKWISE)return-1;const a=n*n+i*i,c=r*r+o*o;return a<c?-1:a>c?1:0}compare(t,e){const s=t,n=e;return pi.polarCompare(this._origin,s,n)}get interfaces_(){return[g]}}_i.RadialComparator=pi;class mi{constructor(){mi.constructor_.apply(this,arguments)}static constructor_(){this._interiorPoint=null,this._maxWidth=-1;const t=arguments[0];this.process(t)}static avg(t,e){return(t+e)/2}static getInteriorPoint(t){return new mi(t).getInteriorPoint()}process(t){if(t.isEmpty())return null;if(t instanceof Ct)this.processPolygon(t);else if(t instanceof ut){const e=t;for(let t=0;t<e.getNumGeometries();t++)this.process(e.getGeometryN(t))}}getInteriorPoint(){return this._interiorPoint}processPolygon(t){const e=new fi(t);e.process();const s=e.getWidth();s>this._maxWidth&&(this._maxWidth=s,this._interiorPoint=e.getInteriorPoint())}}class fi{constructor(){fi.constructor_.apply(this,arguments)}static constructor_(){this._polygon=null,this._interiorPointY=null,this._interiorSectionWidth=0,this._interiorPoint=null;const t=arguments[0];this._polygon=t,this._interiorPointY=xi.getScanLineY(t)}static isEdgeCrossingCounted(t,e,s){const n=t.getY(),i=e.getY();return n!==i&&(!(n===s&&i<s)&&!(i===s&&n<s))}static intersectsHorizontalLine(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return!(e<t.getMinY())&&!(e>t.getMaxY())}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return!(t.getY()>s&&e.getY()>s)&&!(t.getY()<s&&e.getY()<s)}}static intersection(t,e,s){const n=t.getX(),i=e.getX();if(n===i)return n;const r=i-n,o=(e.getY()-t.getY())/r;return n+(s-t.getY())/o}findBestMidpoint(t){if(0===t.size())return null;h.isTrue(0==t.size()%2,"Interior Point robustness failure: odd number of scanline crossings"),t.sort(new yi);for(let e=0;e<t.size();e+=2){const s=t.get(e),n=t.get(e+1),i=n-s;if(i>this._interiorSectionWidth){this._interiorSectionWidth=i;const t=mi.avg(s,n);this._interiorPoint=new m(t,this._interiorPointY)}}}getWidth(){return this._interiorSectionWidth}getInteriorPoint(){return this._interiorPoint}addEdgeCrossing(t,e,s,n){if(!fi.intersectsHorizontalLine(t,e,s))return null;if(!fi.isEdgeCrossingCounted(t,e,s))return null;const i=fi.intersection(t,e,s);n.add(i)}process(){if(this._polygon.isEmpty())return null;this._interiorPoint=new m(this._polygon.getCoordinate());const t=new L;this.scanRing(this._polygon.getExteriorRing(),t);for(let e=0;e<this._polygon.getNumInteriorRing();e++)this.scanRing(this._polygon.getInteriorRingN(e),t);this.findBestMidpoint(t)}scanRing(t,e){if(!fi.intersectsHorizontalLine(t.getEnvelopeInternal(),this._interiorPointY))return null;const s=t.getCoordinateSequence();for(let t=1;t<s.size();t++){const n=s.getCoordinate(t-1),i=s.getCoordinate(t);this.addEdgeCrossing(n,i,this._interiorPointY,e)}}}class yi{compare(t,e){return t<e?-1:t>e?1:0}get interfaces_(){return[g]}}fi.DoubleComparator=yi;class xi{constructor(){xi.constructor_.apply(this,arguments)}static constructor_(){this._poly=null,this._centreY=null,this._hiY=r.MAX_VALUE,this._loY=-r.MAX_VALUE;const t=arguments[0];this._poly=t,this._hiY=t.getEnvelopeInternal().getMaxY(),this._loY=t.getEnvelopeInternal().getMinY(),this._centreY=mi.avg(this._loY,this._hiY)}static getScanLineY(t){return new xi(t).getScanLineY()}process(t){const e=t.getCoordinateSequence();for(let t=0;t<e.size();t++){const s=e.getY(t);this.updateInterval(s)}}getScanLineY(){this.process(this._poly.getExteriorRing());for(let t=0;t<this._poly.getNumInteriorRing();t++)this.process(this._poly.getInteriorRingN(t));return mi.avg(this._hiY,this._loY)}updateInterval(t){t<=this._centreY?t>this._loY&&(this._loY=t):t>this._centreY&&t<this._hiY&&(this._hiY=t)}}mi.InteriorPointPolygon=fi,mi.ScanLineYOrdinateFinder=xi;class Ei{constructor(){Ei.constructor_.apply(this,arguments)}static constructor_(){this._centroid=null,this._minDistance=r.MAX_VALUE,this._interiorPoint=null;const t=arguments[0];t.isEmpty()?this._centroid=null:(this._centroid=gi.getCentroid(t),t.getPrecisionModel().makePrecise(this._centroid)),this.addInterior(t),null===this._interiorPoint&&this.addEndpoints(t)}static getInteriorPoint(t){return new Ei(t).getInteriorPoint()}add(t){const e=t.distance(this._centroid);e<this._minDistance&&(this._interiorPoint=new m(t),this._minDistance=e)}getInteriorPoint(){return this._interiorPoint}addEndpoints(){if(arguments[0]instanceof j){const t=arguments[0];if(t instanceof tt)this.addEndpoints(t.getCoordinates());else if(t instanceof ut){const e=t;for(let t=0;t<e.getNumGeometries();t++)this.addEndpoints(e.getGeometryN(t))}}else if(arguments[0]instanceof Array){const t=arguments[0];this.add(t[0]),this.add(t[t.length-1])}}addInterior(){if(arguments[0]instanceof j){const t=arguments[0];if(t instanceof tt)this.addInterior(t.getCoordinates());else if(t instanceof ut){const e=t;for(let t=0;t<e.getNumGeometries();t++)this.addInterior(e.getGeometryN(t))}}else if(arguments[0]instanceof Array){const t=arguments[0];for(let e=1;e<t.length-1;e++)this.add(t[e])}}}class Ii{constructor(){Ii.constructor_.apply(this,arguments)}static constructor_(){this._centroid=null,this._minDistance=r.MAX_VALUE,this._interiorPoint=null;const t=arguments[0];this._centroid=gi.getCentroid(t),this.add(t)}static getInteriorPoint(t){return new Ii(t).getInteriorPoint()}add(){if(arguments[0]instanceof j){const t=arguments[0];if(t instanceof Nt)this.add(t.getCoordinate());else if(t instanceof ut){const e=t;for(let t=0;t<e.getNumGeometries();t++)this.add(e.getGeometryN(t))}}else if(arguments[0]instanceof m){const t=arguments[0],e=t.distance(this._centroid);e<this._minDistance&&(this._interiorPoint=new m(t),this._minDistance=e)}}getInteriorPoint(){return this._interiorPoint}}class Ni{constructor(){Ni.constructor_.apply(this,arguments)}static constructor_(){this._input=null,this._extremalPts=null,this._centre=null,this._radius=0;const t=arguments[0];this._input=t}static pointWithMinAngleWithSegment(t,e,s){let n=r.MAX_VALUE,i=null;for(let r=0;r<t.length;r++){const o=t[r];if(o===e)continue;if(o===s)continue;const l=$t.angleBetween(e,o,s);l<n&&(n=l,i=o)}return i}static pointWitMinAngleWithX(t,e){let s=r.MAX_VALUE,n=null;for(let i=0;i<t.length;i++){const r=t[i];if(r===e)continue;const o=r.x-e.x;let l=r.y-e.y;l<0&&(l=-l);const a=l/Math.sqrt(o*o+l*l);a<s&&(s=a,n=r)}return n}static lowestPoint(t){let e=t[0];for(let s=1;s<t.length;s++)t[s].y<e.y&&(e=t[s]);return e}static farthestPoints(t){const e=t[0].distance(t[1]),s=t[1].distance(t[2]),n=t[2].distance(t[0]);return e>=s&&e>=n?[t[0],t[1]]:s>=e&&s>=n?[t[1],t[2]]:[t[2],t[0]]}getRadius(){return this.compute(),this._radius}getDiameter(){switch(this.compute(),this._extremalPts.length){case 0:return this._input.getFactory().createLineString();case 1:return this._input.getFactory().createPoint(this._centre)}const t=this._extremalPts[0],e=this._extremalPts[1];return this._input.getFactory().createLineString([t,e])}getExtremalPoints(){return this.compute(),this._extremalPts}computeCirclePoints(){if(this._input.isEmpty())return this._extremalPts=new Array(0).fill(null),null;if(1===this._input.getNumPoints()){const t=this._input.getCoordinates();return this._extremalPts=[new m(t[0])],null}const t=this._input.convexHull().getCoordinates();let e=t;if(t[0].equals2D(t[t.length-1])&&(e=new Array(t.length-1).fill(null),W.copyDeep(t,0,e,0,t.length-1)),e.length<=2)return this._extremalPts=W.copyDeep(e),null;let s=Ni.lowestPoint(e),n=Ni.pointWitMinAngleWithX(e,s);for(let t=0;t<e.length;t++){const t=Ni.pointWithMinAngleWithSegment(e,s,n);if($t.isObtuse(s,t,n))return this._extremalPts=[new m(s),new m(n)],null;if($t.isObtuse(t,s,n))s=t;else{if(!$t.isObtuse(t,n,s))return this._extremalPts=[new m(s),new m(n),new m(t)],null;n=t}}h.shouldNeverReachHere("Logic failure in Minimum Bounding Circle algorithm!")}compute(){if(null!==this._extremalPts)return null;this.computeCirclePoints(),this.computeCentre(),null!==this._centre&&(this._radius=this._centre.distance(this._extremalPts[0]))}getCircle(){if(this.compute(),null===this._centre)return this._input.getFactory().createPolygon();const t=this._input.getFactory().createPoint(this._centre);return 0===this._radius?t:bn.bufferOp(t,this._radius)}getCentre(){return this.compute(),this._centre}getMaximumDiameter(){switch(this.compute(),this._extremalPts.length){case 0:return this._input.getFactory().createLineString();case 1:return this._input.getFactory().createPoint(this._centre);case 2:return this._input.getFactory().createLineString([this._extremalPts[0],this._extremalPts[1]]);default:const t=Ni.farthestPoints(this._extremalPts);return this._input.getFactory().createLineString(t)}}computeCentre(){switch(this._extremalPts.length){case 0:this._centre=null;break;case 1:this._centre=this._extremalPts[0];break;case 2:this._centre=new m((this._extremalPts[0].x+this._extremalPts[1].x)/2,(this._extremalPts[0].y+this._extremalPts[1].y)/2);break;case 3:this._centre=se.circumcentre(this._extremalPts[0],this._extremalPts[1],this._extremalPts[2])}}}class wi{constructor(){wi.constructor_.apply(this,arguments)}static constructor_(){if(this._inputGeom=null,this._isConvex=null,this._convexHullPts=null,this._minBaseSeg=new Kt,this._minWidthPt=null,this._minPtIndex=null,this._minWidth=0,1===arguments.length){const t=arguments[0];wi.constructor_.call(this,t,!1)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._inputGeom=t,this._isConvex=e}}static nextIndex(t,e){return++e>=t.length&&(e=0),e}static computeC(t,e,s){return t*s.y-e*s.x}static getMinimumDiameter(t){return new wi(t).getDiameter()}static getMinimumRectangle(t){return new wi(t).getMinimumRectangle()}static computeSegmentForLine(t,e,s){let n=null,i=null;return Math.abs(e)>Math.abs(t)?(n=new m(0,s/e),i=new m(1,s/e-t/e)):(n=new m(s/t,0),i=new m(s/t-e/t,1)),new Kt(n,i)}getWidthCoordinate(){return this.computeMinimumDiameter(),this._minWidthPt}getSupportingSegment(){return this.computeMinimumDiameter(),this._inputGeom.getFactory().createLineString([this._minBaseSeg.p0,this._minBaseSeg.p1])}getDiameter(){if(this.computeMinimumDiameter(),null===this._minWidthPt)return this._inputGeom.getFactory().createLineString();const t=this._minBaseSeg.project(this._minWidthPt);return this._inputGeom.getFactory().createLineString([t,this._minWidthPt])}computeWidthConvex(t){this._convexHullPts=t instanceof Ct?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=null,this._minBaseSeg=null):1===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[0]):2===this._convexHullPts.length||3===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[1]):this.computeConvexRingMinDiameter(this._convexHullPts)}computeConvexRingMinDiameter(t){this._minWidth=r.MAX_VALUE;let e=1;const s=new Kt;for(let n=0;n<t.length-1;n++)s.p0=t[n],s.p1=t[n+1],e=this.findMaxPerpDistance(t,s,e)}findMaxPerpDistance(t,e,s){let n=e.distancePerpendicular(t[s]),i=n,r=s,o=r;for(;i>=n;)n=i,r=o,o=wi.nextIndex(t,r),i=e.distancePerpendicular(t[o]);return n<this._minWidth&&(this._minPtIndex=r,this._minWidth=n,this._minWidthPt=t[this._minPtIndex],this._minBaseSeg=new Kt(e)),r}getMinimumRectangle(){if(this.computeMinimumDiameter(),0===this._minWidth)return this._minBaseSeg.p0.equals2D(this._minBaseSeg.p1)?this._inputGeom.getFactory().createPoint(this._minBaseSeg.p0):this._minBaseSeg.toGeometry(this._inputGeom.getFactory());const t=this._minBaseSeg.p1.x-this._minBaseSeg.p0.x,e=this._minBaseSeg.p1.y-this._minBaseSeg.p0.y;let s=r.MAX_VALUE,n=-r.MAX_VALUE,i=r.MAX_VALUE,o=-r.MAX_VALUE;for(let r=0;r<this._convexHullPts.length;r++){const l=wi.computeC(t,e,this._convexHullPts[r]);l>n&&(n=l),l<s&&(s=l);const a=wi.computeC(-e,t,this._convexHullPts[r]);a>o&&(o=a),a<i&&(i=a)}const l=wi.computeSegmentForLine(-t,-e,o),a=wi.computeSegmentForLine(-t,-e,i),c=wi.computeSegmentForLine(-e,t,n),h=wi.computeSegmentForLine(-e,t,s),u=c.lineIntersection(l),g=h.lineIntersection(l),d=h.lineIntersection(a),_=c.lineIntersection(a),p=this._inputGeom.getFactory().createLinearRing([u,g,d,_,u]);return this._inputGeom.getFactory().createPolygon(p)}computeMinimumDiameter(){if(null!==this._minWidthPt)return null;if(this._isConvex)this.computeWidthConvex(this._inputGeom);else{const t=new _i(this._inputGeom).getConvexHull();this.computeWidthConvex(t)}}getLength(){return this.computeMinimumDiameter(),this._minWidth}}var Ci=Object.freeze({__proto__:null,Angle:$t,Area:wt,Centroid:gi,ConvexHull:_i,Distance:V,InteriorPointArea:mi,InteriorPointLine:Ei,InteriorPointPoint:Ii,Length:k,MinimumBoundingCircle:Ni,MinimumDiameter:wi,Orientation:q,PointLocation:Ue,PointLocator:Zn,RobustLineIntersector:jt,distance:be,locate:je,match:ui});class Si{constructor(){Si.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distanceTolerance=null;const t=arguments[0];this._inputGeom=t}static densify(t,e){const s=new Si(t);return s.setDistanceTolerance(e),s.getResultGeometry()}static densifyPoints(t,e,s){const n=new Kt,i=new R;for(let r=0;r<t.length-1;r++){n.p0=t[r],n.p1=t[r+1],i.add(n.p0,!1);const o=n.getLength(),l=Math.trunc(o/e)+1;if(l>1){const t=o/l;for(let e=1;e<l;e++){const r=e*t/o,l=n.pointAlong(r);s.makePrecise(l),i.add(l,!1)}}}return i.add(t[t.length-1],!1),i.toCoordinateArray()}setDistanceTolerance(t){if(t<=0)throw new n("Tolerance must be positive");this._distanceTolerance=t}getResultGeometry(){return new Li(this._distanceTolerance).transform(this._inputGeom)}}class Li extends me{constructor(){super(),Li.constructor_.apply(this,arguments)}static constructor_(){this.distanceTolerance=null;const t=arguments[0];this.distanceTolerance=t}transformCoordinates(t,e){const s=t.toCoordinateArray();let n=Si.densifyPoints(s,this.distanceTolerance,e.getPrecisionModel());return e instanceof tt&&1===n.length&&(n=new Array(0).fill(null)),this._factory.getCoordinateSequenceFactory().create(n)}transformPolygon(t,e){const s=super.transformPolygon.call(this,t,e);return e instanceof dt?s:this.createValidArea(s)}createValidArea(t){return bn.bufferOp(t,0)}transformMultiPolygon(t,e){const s=super.transformMultiPolygon.call(this,t,e);return this.createValidArea(s)}}Si.DensifyTransformer=Li;var Ti=Object.freeze({__proto__:null,Densifier:Si});class Ri{constructor(){Ri.constructor_.apply(this,arguments)}static constructor_(){this._orig=null,this._sym=null,this._next=null;const t=arguments[0];this._orig=t}static create(t,e){const s=new Ri(t),n=new Ri(e);return s.link(n),s}oNext(){return this._sym._next}directionY(){return this.directionPt().getY()-this._orig.getY()}equals(){if(2===arguments.length&&arguments[1]instanceof m&&arguments[0]instanceof m){const t=arguments[0],e=arguments[1];return this._orig.equals2D(t)&&this._sym._orig.equals(e)}}findLowest(){let t=this,e=this.oNext();do{e.compareTo(t)<0&&(t=e),e=e.oNext()}while(e!==this);return t}compareTo(t){const e=t;return this.compareAngularDirection(e)}toStringNode(){const t=this.orig();this.dest();const e=new nt;e.append("Node( "+Wt.format(t)+" )\n");let s=this;do{e.append(" -> "+s),e.append("\n"),s=s.oNext()}while(s!==this);return e.toString()}link(t){this.setSym(t),t.setSym(this),this.setNext(t),t.setNext(this)}orig(){return this._orig}setNext(t){this._next=t}find(t){let e=this;do{if(null===e)return null;if(e.dest().equals2D(t))return e;e=e.oNext()}while(e!==this);return null}dest(){return this._sym._orig}isEdgesSorted(){const t=this.findLowest();let e=t;do{const s=e.oNext();if(s===t)break;if(!(s.compareTo(e)>0))return!1;e=s}while(e!==t);return!0}insert(t){if(this.oNext()===this)return this.insertAfter(t),null;this.insertionEdge(t).insertAfter(t)}insertAfter(t){h.equals(this._orig,t.orig());const e=this.oNext();this._sym.setNext(t),t.sym().setNext(e)}degree(){let t=0,e=this;do{t++,e=e.oNext()}while(e!==this);return t}directionPt(){return this.dest()}sym(){return this._sym}prev(){return this._sym.next()._sym}compareAngularDirection(t){const e=this.directionX(),s=this.directionY(),n=t.directionX(),i=t.directionY();if(e===n&&s===i)return 0;const r=Ds.quadrant(e,s),o=Ds.quadrant(n,i);if(r>o)return 1;if(r<o)return-1;const l=this.directionPt(),a=t.directionPt();return q.index(t._orig,a,l)}prevNode(){let t=this;for(;2===t.degree();)if(t=t.prev(),t===this)return null;return t}directionX(){return this.directionPt().getX()-this._orig.getX()}insertionEdge(t){let e=this;do{const s=e.oNext();if(s.compareTo(e)>0&&t.compareTo(e)>=0&&t.compareTo(s)<=0)return e;if(s.compareTo(e)<=0&&(t.compareTo(s)<=0||t.compareTo(e)>=0))return e;e=s}while(e!==this);return h.shouldNeverReachHere(),null}next(){return this._next}setSym(t){this._sym=t}toString(){return"HE("+this._orig.x+" "+this._orig.y+", "+this._sym._orig.x+" "+this._sym._orig.y+")"}toStringNodeEdge(){return" -> ("+Wt.format(this.dest())}}class Pi extends Ri{constructor(){super(),Pi.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1;const t=arguments[0];Ri.constructor_.call(this,t)}static setMarkBoth(t,e){t.setMark(e),t.sym().setMark(e)}static isMarked(t){return t.isMarked()}static setMark(t,e){t.setMark(e)}static markBoth(t){t.mark(),t.sym().mark()}static mark(t){t.mark()}setMark(t){this._isMarked=t}mark(){this._isMarked=!0}isMarked(){return this._isMarked}}class Oi{constructor(){Oi.constructor_.apply(this,arguments)}static constructor_(){this._vertexMap=new ft}static isValidEdge(t,e){return 0!==e.compareTo(t)}insert(t,e,s){const n=this.create(t,e);null!==s?s.insert(n):this._vertexMap.put(t,n);const i=this._vertexMap.get(e);return null!==i?i.insert(n.sym()):this._vertexMap.put(e,n.sym()),n}create(t,e){const s=this.createEdge(t),n=this.createEdge(e);return s.link(n),s}createEdge(t){return new Ri(t)}addEdge(t,e){if(!Oi.isValidEdge(t,e))return null;const s=this._vertexMap.get(t);let n=null;if(null!==s&&(n=s.find(e)),null!==n)return n;return this.insert(t,e,s)}getVertexEdges(){return this._vertexMap.values()}findEdge(t,e){const s=this._vertexMap.get(t);return null===s?null:s.find(e)}}class vi extends Pi{constructor(){super(),vi.constructor_.apply(this,arguments)}static constructor_(){this._isStart=!1;const t=arguments[0];Pi.constructor_.call(this,t)}setStart(){this._isStart=!0}isStart(){return this._isStart}}class Mi extends Oi{constructor(){super()}createEdge(t){return new vi(t)}}class bi{constructor(){bi.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._factory=null,this._graph=null,this._lines=new L,this._nodeEdgeStack=new Zs,this._ringStartEdge=null,this._graph=new Mi}static dissolve(t){const e=new bi;return e.add(t),e.getResult()}addLine(t){this._lines.add(this._factory.createLineString(t.toCoordinateArray()))}updateRingStartEdge(t){return t.isStart()||(t=t.sym()).isStart()?null===this._ringStartEdge?(this._ringStartEdge=t,null):void(t.orig().compareTo(this._ringStartEdge.orig())<0&&(this._ringStartEdge=t)):null}getResult(){return null===this._result&&this.computeResult(),this._result}process(t){let e=t.prevNode();null===e&&(e=t),this.stackEdges(e),this.buildLines()}stackEdges(t){let e=t;do{Pi.isMarked(e)||this._nodeEdgeStack.add(e),e=e.oNext()}while(e!==t)}computeResult(){for(let t=this._graph.getVertexEdges().iterator();t.hasNext();){const e=t.next();Pi.isMarked(e)||this.process(e)}this._result=this._factory.buildGeometry(this._lines)}buildLines(){for(;!this._nodeEdgeStack.empty();){const t=this._nodeEdgeStack.pop();Pi.isMarked(t)||this.buildLine(t)}}add(){if(arguments[0]instanceof j){arguments[0].apply(new class{get interfaces_(){return[X]}filter(t){t instanceof tt&&this.add(t)}})}else if(I(arguments[0],N)){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}}else if(arguments[0]instanceof tt){const t=arguments[0];null===this._factory&&(this._factory=t.getFactory());const e=t.getCoordinateSequence();let s=!1;for(let t=1;t<e.size();t++){const n=this._graph.addEdge(e.getCoordinate(t-1),e.getCoordinate(t));null!==n&&(s||(n.setStart(),s=!0))}}}buildRing(t){const e=new R;let s=t;for(e.add(s.orig().copy(),!1);2===s.sym().degree();){const n=s.next();if(n===t)break;e.add(n.orig().copy(),!1),s=n}e.add(s.dest().copy(),!1),this.addLine(e)}buildLine(t){const e=new R;let s=t;for(this._ringStartEdge=null,Pi.markBoth(s),e.add(s.orig().copy(),!1);2===s.sym().degree();){this.updateRingStartEdge(s);const n=s.next();if(n===t)return this.buildRing(this._ringStartEdge),null;e.add(n.orig().copy(),!1),s=n,Pi.markBoth(s)}e.add(s.dest().clone(),!1),this.stackEdges(s.sym()),this.addLine(e)}}var Di=Object.freeze({__proto__:null,LineDissolver:bi}),Ai=Object.freeze({__proto__:null,GeometryGraph:ii});class Fi{visit(t){}}class Gi{constructor(){Gi.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,this._data=null,this._left=null,this._right=null,this._count=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new m(t),this._left=null,this._right=null,this._count=1,this._data=e}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._p=new m(t,e),this._left=null,this._right=null,this._count=1,this._data=s}}isRepeated(){return this._count>1}getRight(){return this._right}getCoordinate(){return this._p}setLeft(t){this._left=t}getX(){return this._p.x}getData(){return this._data}getCount(){return this._count}increment(){this._count=this._count+1}setRight(t){this._right=t}getLeft(){return this._left}getY(){return this._p.y}}class qi{constructor(){qi.constructor_.apply(this,arguments)}static constructor_(){if(this._root=null,this._numberOfNodes=null,this._tolerance=null,0===arguments.length)qi.constructor_.call(this,0);else if(1===arguments.length){const t=arguments[0];this._tolerance=t}}static toCoordinates(){if(1===arguments.length){const t=arguments[0];return qi.toCoordinates(t,!1)}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=new R;for(let n=t.iterator();n.hasNext();){const t=n.next(),i=e?t.getCount():1;for(let e=0;e<i;e++)s.add(t.getCoordinate(),!0)}return s.toCoordinateArray()}}insert(){if(1===arguments.length){const t=arguments[0];return this.insert(t,null)}if(2===arguments.length){const t=arguments[0],e=arguments[1];if(null===this._root)return this._root=new Gi(t,e),this._root;if(this._tolerance>0){const e=this.findBestMatchNode(t);if(null!==e)return e.increment(),e}return this.insertExact(t,e)}}query(){if(1===arguments.length){const t=arguments[0],e=new L;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof O&&I(arguments[1],C)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,new class{get interfaces_(){return[Fi]}visit(t){e.add(t)}})}else if(arguments[0]instanceof O&&I(arguments[1],Fi)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,e)}}queryNode(t,e,s,n){if(null===t)return null;let i=null,r=null,o=null;s?(i=e.getMinX(),r=e.getMaxX(),o=t.getX()):(i=e.getMinY(),r=e.getMaxY(),o=t.getY());const l=o<=r;i<o&&this.queryNode(t.getLeft(),e,!s,n),e.contains(t.getCoordinate())&&n.visit(t),l&&this.queryNode(t.getRight(),e,!s,n)}findBestMatchNode(t){const e=new Bi(t,this._tolerance);return this.query(e.queryEnvelope(),e),e.getNode()}isEmpty(){return null===this._root}insertExact(t,e){let s=this._root,n=this._root,i=!0,r=!0;for(;null!==s;){if(null!==s){if(t.distance(s.getCoordinate())<=this._tolerance)return s.increment(),s}r=i?t.x<s.getX():t.y<s.getY(),n=s,s=r?s.getLeft():s.getRight(),i=!i}this._numberOfNodes=this._numberOfNodes+1;const o=new Gi(t,e);return r?n.setLeft(o):n.setRight(o),o}}class Bi{constructor(){Bi.constructor_.apply(this,arguments)}static constructor_(){this._tolerance=null,this._matchNode=null,this._matchDist=0,this._p=null;const t=arguments[0],e=arguments[1];this._p=t,this._tolerance=e}queryEnvelope(){const t=new O(this._p);return t.expandBy(this._tolerance),t}getNode(){return this._matchNode}visit(t){const e=this._p.distance(t.getCoordinate());if(!(e<=this._tolerance))return null;let s=!1;(null===this._matchNode||e<this._matchDist||null!==this._matchNode&&e===this._matchDist&&t.getCoordinate().compareTo(this._matchNode.getCoordinate())<1)&&(s=!0),s&&(this._matchNode=t,this._matchDist=e)}get interfaces_(){return[Fi]}}qi.BestMatchVisitor=Bi;var Yi=Object.freeze({__proto__:null,KdTree:qi});class zi{constructor(){zi.constructor_.apply(this,arguments)}static constructor_(){this._items=new L,this._subnode=new Array(4).fill(null)}static getSubnodeIndex(t,e,s){let n=-1;return t.getMinX()>=e&&(t.getMinY()>=s&&(n=3),t.getMaxY()<=s&&(n=1)),t.getMaxX()<=e&&(t.getMinY()>=s&&(n=2),t.getMaxY()<=s&&(n=0)),n}size(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+this._items.size()}addAllItemsFromOverlapping(t,e){if(!this.isSearchMatch(t))return null;e.addAll(this._items);for(let s=0;s<4;s++)null!==this._subnode[s]&&this._subnode[s].addAllItemsFromOverlapping(t,e)}visitItems(t,e){for(let t=this._items.iterator();t.hasNext();)e.visitItem(t.next())}hasItems(){return!this._items.isEmpty()}remove(t,e){if(!this.isSearchMatch(t))return!1;let s=!1;for(let n=0;n<4;n++)if(null!==this._subnode[n]&&(s=this._subnode[n].remove(t,e),s)){this._subnode[n].isPrunable()&&(this._subnode[n]=null);break}return s||(s=this._items.remove(e),s)}visit(t,e){if(!this.isSearchMatch(t))return null;this.visitItems(t,e);for(let s=0;s<4;s++)null!==this._subnode[s]&&this._subnode[s].visit(t,e)}getItems(){return this._items}depth(){let t=0;for(let e=0;e<4;e++)if(null!==this._subnode[e]){const s=this._subnode[e].depth();s>t&&(t=s)}return t+1}hasChildren(){for(let t=0;t<4;t++)if(null!==this._subnode[t])return!0;return!1}isPrunable(){return!(this.hasChildren()||this.hasItems())}addAllItems(t){t.addAll(this._items);for(let e=0;e<4;e++)null!==this._subnode[e]&&this._subnode[e].addAllItems(t);return t}getNodeCount(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+1}isEmpty(){let t=!0;if(this._items.isEmpty()){for(let e=0;e<4;e++)if(null!==this._subnode[e]&&!this._subnode[e].isEmpty()){t=!1;break}}else t=!1;return t}add(t){this._items.add(t)}get interfaces_(){return[l]}}function Vi(){}Vi.exponent=function(t){return function(t,e){let s,n,i,r;const o={64:{d:32752,c:0,b:0,a:0}},l={64:11}[t];r||(s=e<0||1/e<0,isFinite(e)||(r=o[t],s&&(r.d+=1<<t/4-1),n=Math.pow(2,l)-1,i=0));if(!r){for(n={64:1023}[t],i=Math.abs(e);i>=2;)n++,i/=2;for(;i<1&&n>0;)n--,i*=2;n<=0&&(i/=2)}return n}(64,t)-1023},Vi.powerOf2=function(t){return Math.pow(2,t)};class ki{constructor(){ki.constructor_.apply(this,arguments)}static constructor_(){this._pt=new m,this._level=0,this._env=null;const t=arguments[0];this.computeKey(t)}static computeQuadLevel(t){const e=t.getWidth(),s=t.getHeight(),n=e>s?e:s;return Vi.exponent(n)+1}getLevel(){return this._level}computeKey(){if(1===arguments.length){const t=arguments[0];for(this._level=ki.computeQuadLevel(t),this._env=new O,this.computeKey(this._level,t);!this._env.contains(t);)this._level+=1,this.computeKey(this._level,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],s=Vi.powerOf2(t);this._pt.x=Math.floor(e.getMinX()/s)*s,this._pt.y=Math.floor(e.getMinY()/s)*s,this._env.init(this._pt.x,this._pt.x+s,this._pt.y,this._pt.y+s)}}getEnvelope(){return this._env}getCentre(){return new m((this._env.getMinX()+this._env.getMaxX())/2,(this._env.getMinY()+this._env.getMaxY())/2)}getPoint(){return this._pt}}let Xi=class t extends zi{constructor(){super(),t.constructor_.apply(this,arguments)}static constructor_(){this._env=null,this._centrex=null,this._centrey=null,this._level=null;const t=arguments[0],e=arguments[1];this._env=t,this._level=e,this._centrex=(t.getMinX()+t.getMaxX())/2,this._centrey=(t.getMinY()+t.getMaxY())/2}static createNode(e){const s=new ki(e);return new t(s.getEnvelope(),s.getLevel())}static createExpanded(e,s){const n=new O(s);null!==e&&n.expandToInclude(e._env);const i=t.createNode(n);return null!==e&&i.insertNode(e),i}find(t){const e=zi.getSubnodeIndex(t,this._centrex,this._centrey);if(-1===e)return this;if(null!==this._subnode[e]){return this._subnode[e].find(t)}return this}isSearchMatch(t){return null!==t&&this._env.intersects(t)}getSubnode(t){return null===this._subnode[t]&&(this._subnode[t]=this.createSubnode(t)),this._subnode[t]}getEnvelope(){return this._env}getNode(t){const e=zi.getSubnodeIndex(t,this._centrex,this._centrey);if(-1!==e){return this.getSubnode(e).getNode(t)}return this}createSubnode(e){let s=0,n=0,i=0,r=0;switch(e){case 0:s=this._env.getMinX(),n=this._centrex,i=this._env.getMinY(),r=this._centrey;break;case 1:s=this._centrex,n=this._env.getMaxX(),i=this._env.getMinY(),r=this._centrey;break;case 2:s=this._env.getMinX(),n=this._centrex,i=this._centrey,r=this._env.getMaxY();break;case 3:s=this._centrex,n=this._env.getMaxX(),i=this._centrey,r=this._env.getMaxY()}const o=new O(s,n,i,r);return new t(o,this._level-1)}insertNode(t){h.isTrue(null===this._env||this._env.contains(t._env));const e=zi.getSubnodeIndex(t._env,this._centrex,this._centrey);if(t._level===this._level-1)this._subnode[e]=t;else{const s=this.createSubnode(e);s.insertNode(t),this._subnode[e]=s}}};class Ui{static isZeroWidth(t,e){const s=e-t;if(0===s)return!0;const n=s/Math.max(Math.abs(t),Math.abs(e));return Vi.exponent(n)<=Ui.MIN_BINARY_EXPONENT}}Ui.MIN_BINARY_EXPONENT=-50;class Hi extends zi{constructor(){super()}insertContained(t,e,s){h.isTrue(t.getEnvelope().contains(e));const n=Ui.isZeroWidth(e.getMinX(),e.getMaxX()),i=Ui.isZeroWidth(e.getMinY(),e.getMaxY());let r=null;r=n||i?t.find(e):t.getNode(e),r.add(s)}isSearchMatch(t){return!0}insert(t,e){const s=zi.getSubnodeIndex(t,Hi.origin.x,Hi.origin.y);if(-1===s)return this.add(e),null;const n=this._subnode[s];if(null===n||!n.getEnvelope().contains(t)){const e=Xi.createExpanded(n,t);this._subnode[s]=e}this.insertContained(this._subnode[s],t,e)}}Hi.origin=new m(0,0);class Wi{constructor(){Wi.constructor_.apply(this,arguments)}static constructor_(){this._root=null,this._minExtent=1,this._root=new Hi}static ensureExtent(t,e){let s=t.getMinX(),n=t.getMaxX(),i=t.getMinY(),r=t.getMaxY();return s!==n&&i!==r?t:(s===n&&(s-=e/2,n+=e/2),i===r&&(i-=e/2,r+=e/2),new O(s,n,i,r))}size(){return null!==this._root?this._root.size():0}insert(t,e){this.collectStats(t);const s=Wi.ensureExtent(t,this._minExtent);this._root.insert(s,e)}query(){if(1===arguments.length){const t=arguments[0],e=new Ye;return this.query(t,e),e.getItems()}if(2===arguments.length){const t=arguments[0],e=arguments[1];this._root.visit(t,e)}}queryAll(){const t=new L;return this._root.addAllItems(t),t}remove(t,e){const s=Wi.ensureExtent(t,this._minExtent);return this._root.remove(s,e)}collectStats(t){const e=t.getWidth();e<this._minExtent&&e>0&&(this._minExtent=e);const s=t.getHeight();s<this._minExtent&&s>0&&(this._minExtent=s)}depth(){return null!==this._root?this._root.depth():0}isEmpty(){return null===this._root||this._root.isEmpty()}get interfaces_(){return[Cs,l]}}var Zi=Object.freeze({__proto__:null,Quadtree:Wi}),ji=Object.freeze({__proto__:null,STRtree:Os}),Ki=Object.freeze({__proto__:null,kdtree:Yi,quadtree:Zi,strtree:ji});const Qi=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];class Ji{constructor(t){this.geometryFactory=t||new Lt}read(t){let e;e="string"==typeof t?JSON.parse(t):t;const s=e.type;if(!$i[s])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Qi.indexOf(s)?$i[s].call(this,e.coordinates):"GeometryCollection"===s?$i[s].call(this,e.geometries):$i[s].call(this,e)}write(t){const e=t.getGeometryType();if(!tr[e])throw new Error("Geometry is not supported");return tr[e].call(this,t)}}const $i={Feature:function(t){const e={};for(const s in t)e[s]=t[s];if(t.geometry){const s=t.geometry.type;if(!$i[s])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=$i.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){const e={};if(t.features){e.features=[];for(let s=0;s<t.features.length;++s)e.features.push(this.read(t.features[s]))}return t.bbox&&(e.bbox=this.parse.bbox.call(this,t.bbox)),e},coordinates:function(t){const e=[];for(let s=0;s<t.length;++s){const n=t[s];e.push(new m(...n))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new m(t[0],t[1]),new m(t[2],t[1]),new m(t[2],t[3]),new m(t[0],t[3]),new m(t[0],t[1])])},Point:function(t){const e=new m(...t);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){const e=[];for(let s=0;s<t.length;++s)e.push($i.Point.call(this,t[s]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){const e=$i.coordinates.call(this,t);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){const e=[];for(let s=0;s<t.length;++s)e.push($i.LineString.call(this,t[s]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){const e=$i.coordinates.call(this,t[0]),s=this.geometryFactory.createLinearRing(e),n=[];for(let e=1;e<t.length;++e){const s=t[e],i=$i.coordinates.call(this,s),r=this.geometryFactory.createLinearRing(i);n.push(r)}return this.geometryFactory.createPolygon(s,n)},MultiPolygon:function(t){const e=[];for(let s=0;s<t.length;++s){const n=t[s];e.push($i.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){const e=[];for(let s=0;s<t.length;++s){const n=t[s];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},tr={coordinate:function(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e},Point:function(t){return{type:"Point",coordinates:tr.coordinate.call(this,t.getCoordinate())}},MultiPoint:function(t){const e=[];for(let s=0;s<t._geometries.length;++s){const n=t._geometries[s],i=tr.Point.call(this,n);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){const e=[],s=t.getCoordinates();for(let t=0;t<s.length;++t){const n=s[t];e.push(tr.coordinate.call(this,n))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){const e=[];for(let s=0;s<t._geometries.length;++s){const n=t._geometries[s],i=tr.LineString.call(this,n);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){const e=[],s=tr.LineString.call(this,t._shell);e.push(s.coordinates);for(let s=0;s<t._holes.length;++s){const n=t._holes[s],i=tr.LineString.call(this,n);e.push(i.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){const e=[];for(let s=0;s<t._geometries.length;++s){const n=t._geometries[s],i=tr.Polygon.call(this,n);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){const e=[];for(let s=0;s<t._geometries.length;++s){const n=t._geometries[s],i=n.getGeometryType();e.push(tr[i].call(this,n))}return{type:"GeometryCollection",geometries:e}}};function er(t){return[t.x,t.y]}var sr=Object.freeze({__proto__:null,GeoJSONReader:class{constructor(t){this.parser=new Ji(t||new Lt)}read(t){return this.parser.read(t)}},GeoJSONWriter:class{constructor(){this.parser=new Ji(this.geometryFactory)}write(t){return this.parser.write(t)}},OL3Parser:class{constructor(t,e){this.geometryFactory=t||new Lt,this.ol=e||"undefined"!=typeof ol&&ol}inject(t,e,s,n,i,r,o,l){this.ol={geom:{Point:t,LineString:e,LinearRing:s,Polygon:n,MultiPoint:i,MultiLineString:r,MultiPolygon:o,GeometryCollection:l}}}read(t){const e=this.ol;return t instanceof e.geom.Point?this.convertFromPoint(t):t instanceof e.geom.LineString?this.convertFromLineString(t):t instanceof e.geom.LinearRing?this.convertFromLinearRing(t):t instanceof e.geom.Polygon?this.convertFromPolygon(t):t instanceof e.geom.MultiPoint?this.convertFromMultiPoint(t):t instanceof e.geom.MultiLineString?this.convertFromMultiLineString(t):t instanceof e.geom.MultiPolygon?this.convertFromMultiPolygon(t):t instanceof e.geom.GeometryCollection?this.convertFromCollection(t):void 0}convertFromPoint(t){const e=t.getCoordinates();return this.geometryFactory.createPoint(new m(e[0],e[1]))}convertFromLineString(t){return this.geometryFactory.createLineString(t.getCoordinates().map((function(t){return new m(t[0],t[1])})))}convertFromLinearRing(t){return this.geometryFactory.createLinearRing(t.getCoordinates().map((function(t){return new m(t[0],t[1])})))}convertFromPolygon(t){const e=t.getLinearRings();let s=null;const n=[];for(let t=0;t<e.length;t++){const i=this.convertFromLinearRing(e[t]);0===t?s=i:n.push(i)}return this.geometryFactory.createPolygon(s,n)}convertFromMultiPoint(t){const e=t.getPoints().map((function(t){return this.convertFromPoint(t)}),this);return this.geometryFactory.createMultiPoint(e)}convertFromMultiLineString(t){const e=t.getLineStrings().map((function(t){return this.convertFromLineString(t)}),this);return this.geometryFactory.createMultiLineString(e)}convertFromMultiPolygon(t){const e=t.getPolygons().map((function(t){return this.convertFromPolygon(t)}),this);return this.geometryFactory.createMultiPolygon(e)}convertFromCollection(t){const e=t.getGeometries().map((function(t){return this.read(t)}),this);return this.geometryFactory.createGeometryCollection(e)}write(t){return"Point"===t.getGeometryType()?this.convertToPoint(t.getCoordinate()):"LineString"===t.getGeometryType()?this.convertToLineString(t):"LinearRing"===t.getGeometryType()?this.convertToLinearRing(t):"Polygon"===t.getGeometryType()?this.convertToPolygon(t):"MultiPoint"===t.getGeometryType()?this.convertToMultiPoint(t):"MultiLineString"===t.getGeometryType()?this.convertToMultiLineString(t):"MultiPolygon"===t.getGeometryType()?this.convertToMultiPolygon(t):"GeometryCollection"===t.getGeometryType()?this.convertToCollection(t):void 0}convertToPoint(t){return new this.ol.geom.Point([t.x,t.y])}convertToLineString(t){const e=t._points._coordinates.map(er);return new this.ol.geom.LineString(e)}convertToLinearRing(t){const e=t._points._coordinates.map(er);return new this.ol.geom.LinearRing(e)}convertToPolygon(t){const e=[t._shell._points._coordinates.map(er)];for(let s=0;s<t._holes.length;s++)e.push(t._holes[s]._points._coordinates.map(er));return new this.ol.geom.Polygon(e)}convertToMultiPoint(t){return new this.ol.geom.MultiPoint(t.getCoordinates().map(er))}convertToMultiLineString(t){const e=[];for(let s=0;s<t._geometries.length;s++)e.push(this.convertToLineString(t._geometries[s]).getCoordinates());return new this.ol.geom.MultiLineString(e)}convertToMultiPolygon(t){const e=[];for(let s=0;s<t._geometries.length;s++)e.push(this.convertToPolygon(t._geometries[s]).getCoordinates());return new this.ol.geom.MultiPolygon(e)}convertToCollection(t){const e=[];for(let s=0;s<t._geometries.length;s++){const n=t._geometries[s];e.push(this.write(n))}return new this.ol.geom.GeometryCollection(e)}},WKTReader:class{constructor(t){this.parser=new Ht(t||new Lt)}read(t){return this.parser.read(t)}},WKTWriter:Wt}),nr=Object.freeze({__proto__:null,MCIndexNoder:Gs,ScaledNoder:ds,SegmentString:cs});class ir{constructor(){ir.constructor_.apply(this,arguments)}static constructor_(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){const t=arguments[0];ir.constructor_.call(this,t,kn.MOD2_BOUNDARY_RULE)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}}static getBoundary(){if(1===arguments.length){return new ir(arguments[0]).getBoundary()}if(2===arguments.length){return new ir(arguments[0],arguments[1]).getBoundary()}}boundaryMultiLineString(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();const e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)}getBoundary(){return this._geom instanceof tt?this.boundaryLineString(this._geom):this._geom instanceof Et?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()}boundaryLineString(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();if(t.isClosed()){return this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint()}return this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])}getEmptyMultiPoint(){return this._geomFact.createMultiPoint()}computeBoundaryCoordinates(t){const e=new L;this._endpointMap=new os;for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);0!==s.getNumPoints()&&(this.addEndpoint(s.getCoordinateN(0)),this.addEndpoint(s.getCoordinateN(s.getNumPoints()-1)))}for(let t=this._endpointMap.entrySet().iterator();t.hasNext();){const s=t.next(),n=s.getValue().count;this._bnRule.isInBoundary(n)&&e.add(s.getKey())}return W.toCoordinateArray(e)}addEndpoint(t){let e=this._endpointMap.get(t);null===e&&(e=new rr,this._endpointMap.put(t,e)),e.count++}}let rr=class t{constructor(){t.constructor_.apply(this,arguments)}static constructor_(){this.count=null}};class or{constructor(){or.constructor_.apply(this,arguments)}static constructor_(){if(this._inputGeom=null,this._isClosedEndpointsInInterior=!0,this._nonSimpleLocation=null,1===arguments.length){const t=arguments[0];this._inputGeom=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._inputGeom=t,this._isClosedEndpointsInInterior=!e.isInBoundary(2)}}static isSimple(){if(1===arguments.length){return new or(arguments[0]).isSimple()}if(2===arguments.length){return new or(arguments[0],arguments[1]).isSimple()}}isSimpleMultiPoint(t){if(t.isEmpty())return!0;const e=new at;for(let s=0;s<t.getNumGeometries();s++){const n=t.getGeometryN(s).getCoordinate();if(e.contains(n))return this._nonSimpleLocation=n,!1;e.add(n)}return!0}isSimplePolygonal(t){for(let e=ye.getLines(t).iterator();e.hasNext();){const t=e.next();if(!this.isSimpleLinearGeometry(t))return!1}return!0}hasClosedEndpointIntersection(t){const e=new os;for(let s=t.getEdgeIterator();s.hasNext();){const t=s.next(),n=t.isClosed(),i=t.getCoordinate(0);this.addEndpoint(e,i,n);const r=t.getCoordinate(t.getNumPoints()-1);this.addEndpoint(e,r,n)}for(let t=e.values().iterator();t.hasNext();){const e=t.next();if(e.isClosed&&2!==e.degree)return this._nonSimpleLocation=e.getCoordinate(),!0}return!1}getNonSimpleLocation(){return this._nonSimpleLocation}isSimpleLinearGeometry(t){if(t.isEmpty())return!0;const e=new ii(0,t),s=new jt,n=e.computeSelfNodes(s,!0);return!n.hasIntersection()||(n.hasProperIntersection()?(this._nonSimpleLocation=n.getProperIntersectionPoint(),!1):!this.hasNonEndpointIntersection(e)&&(!this._isClosedEndpointsInInterior||!this.hasClosedEndpointIntersection(e)))}hasNonEndpointIntersection(t){for(let e=t.getEdgeIterator();e.hasNext();){const t=e.next(),s=t.getMaximumSegmentIndex();for(let e=t.getEdgeIntersectionList().iterator();e.hasNext();){const t=e.next();if(!t.isEndPoint(s))return this._nonSimpleLocation=t.getCoordinate(),!0}}return!1}addEndpoint(t,e,s){let n=t.get(e);null===n&&(n=new lr(e),t.put(e,n)),n.addEndpoint(s)}computeSimple(t){return this._nonSimpleLocation=null,!!t.isEmpty()||(t instanceof tt||t instanceof Et?this.isSimpleLinearGeometry(t):t instanceof St?this.isSimpleMultiPoint(t):I(t,gt)?this.isSimplePolygonal(t):!(t instanceof ut)||this.isSimpleGeometryCollection(t))}isSimple(){return this._nonSimpleLocation=null,this.computeSimple(this._inputGeom)}isSimpleGeometryCollection(t){for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);if(!this.computeSimple(s))return!1}return!0}}class lr{constructor(){lr.constructor_.apply(this,arguments)}static constructor_(){this.pt=null,this.isClosed=null,this.degree=null;const t=arguments[0];this.pt=t,this.isClosed=!1,this.degree=0}getCoordinate(){return this.pt}addEndpoint(t){this.degree++,this.isClosed|=t}}or.EndpointInfo=lr;var ar=Object.freeze({__proto__:null,BufferOp:bn,BufferParameters:Qe});class cr{constructor(){cr.constructor_.apply(this,arguments)}static constructor_(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){const t=arguments[0],e=arguments[1];cr.constructor_.call(this,t,cr.INSIDE_AREA,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._component=t,this._segIndex=e,this._pt=s}}getSegmentIndex(){return this._segIndex}getCoordinate(){return this._pt}isInsideArea(){return this._segIndex===cr.INSIDE_AREA}toString(){return this._component.getGeometryType()+"["+this._segIndex+"]-"+Wt.toPoint(this._pt)}getGeometryComponent(){return this._component}}cr.INSIDE_AREA=-1;class hr{constructor(){hr.constructor_.apply(this,arguments)}static constructor_(){this._locations=null;const t=arguments[0];this._locations=t}static getLocations(t){const e=new L;return t.apply(new hr(e)),e}filter(t){if(t.isEmpty())return null;(t instanceof Nt||t instanceof tt||t instanceof Ct)&&this._locations.add(new cr(t,0,t.getCoordinate()))}get interfaces_(){return[$]}}class ur{constructor(){ur.constructor_.apply(this,arguments)}static constructor_(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Zn,this._minDistanceLocation=null,this._minDistance=r.MAX_VALUE,2===arguments.length){const t=arguments[0],e=arguments[1];ur.constructor_.call(this,t,e,0)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e,this._terminateDistance=s}}static distance(t,e){return new ur(t,e).distance()}static isWithinDistance(t,e,s){if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>s)return!1;return new ur(t,e,s).distance()<=s}static nearestPoints(t,e){return new ur(t,e).nearestPoints()}computeContainmentDistance(){if(0===arguments.length){const t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],s=this._geom[t];if(s.getDimension()<2)return null;const n=1-t,i=Ie.getPolygons(s);if(i.size()>0){const s=hr.getLocations(this._geom[n]);if(this.computeContainmentDistance(s,i,e),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[n]=e[0],this._minDistanceLocation[t]=e[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&I(arguments[0],C)&&I(arguments[1],C)){const t=arguments[0],e=arguments[1],s=arguments[2];for(let n=0;n<t.size();n++){const i=t.get(n);for(let t=0;t<e.size();t++)if(this.computeContainmentDistance(i,e.get(t),s),this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof cr&&arguments[1]instanceof Ct){const t=arguments[0],e=arguments[1],s=arguments[2],n=t.getCoordinate();if(Qt.EXTERIOR!==this._ptLocator.locate(n,e))return this._minDistance=0,s[0]=t,s[1]=new cr(e,n),null}}computeMinDistanceLinesPoints(t,e,s){for(let n=0;n<t.size();n++){const i=t.get(n);for(let t=0;t<e.size();t++){const n=e.get(t);if(this.computeMinDistance(i,n,s),this._minDistance<=this._terminateDistance)return null}}}computeFacetDistance(){const t=new Array(2).fill(null),e=ye.getLines(this._geom[0]),s=ye.getLines(this._geom[1]),n=Ee.getPoints(this._geom[0]),i=Ee.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,s,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(s,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))}nearestLocations(){return this.computeMinDistance(),this._minDistanceLocation}updateMinDistance(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])}nearestPoints(){this.computeMinDistance();return[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]}computeMinDistance(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof tt&&arguments[1]instanceof Nt){const t=arguments[0],e=arguments[1],s=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;const n=t.getCoordinates(),i=e.getCoordinate();for(let r=0;r<n.length-1;r++){const o=V.pointToSegment(i,n[r],n[r+1]);if(o<this._minDistance){this._minDistance=o;const l=new Kt(n[r],n[r+1]).closestPoint(i);s[0]=new cr(t,r,l),s[1]=new cr(e,0,i)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof tt&&arguments[1]instanceof tt){const t=arguments[0],e=arguments[1],s=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;const n=t.getCoordinates(),i=e.getCoordinates();for(let r=0;r<n.length-1;r++){const o=new O(n[r],n[r+1]);if(!(o.distance(e.getEnvelopeInternal())>this._minDistance))for(let l=0;l<i.length-1;l++){const a=new O(i[l],i[l+1]);if(o.distance(a)>this._minDistance)continue;const c=V.segmentToSegment(n[r],n[r+1],i[l],i[l+1]);if(c<this._minDistance){this._minDistance=c;const o=new Kt(n[r],n[r+1]),a=new Kt(i[l],i[l+1]),h=o.closestPoints(a);s[0]=new cr(t,r,h[0]),s[1]=new cr(e,l,h[1])}if(this._minDistance<=this._terminateDistance)return null}}}}computeMinDistancePoints(t,e,s){for(let n=0;n<t.size();n++){const i=t.get(n);for(let t=0;t<e.size();t++){const n=e.get(t),r=i.getCoordinate().distance(n.getCoordinate());if(r<this._minDistance&&(this._minDistance=r,s[0]=new cr(i,0,i.getCoordinate()),s[1]=new cr(n,0,n.getCoordinate())),this._minDistance<=this._terminateDistance)return null}}}distance(){if(null===this._geom[0]||null===this._geom[1])throw new n("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)}computeMinDistanceLines(t,e,s){for(let n=0;n<t.size();n++){const i=t.get(n);for(let t=0;t<e.size();t++){const n=e.get(t);if(this.computeMinDistance(i,n,s),this._minDistance<=this._terminateDistance)return null}}}}var gr=Object.freeze({__proto__:null,DistanceOp:ur});class dr{constructor(){dr.constructor_.apply(this,arguments)}static constructor_(){this._factory=null,this._directedEdges=new L,this._coordinates=null;const t=arguments[0];this._factory=t}add(t){this._directedEdges.add(t)}toLineString(){return this._factory.createLineString(this.getCoordinates())}getCoordinates(){if(null===this._coordinates){let t=0,e=0;const s=new R;for(let n=this._directedEdges.iterator();n.hasNext();){const i=n.next();i.getEdgeDirection()?t++:e++,s.add(i.getEdge().getLine().getCoordinates(),!1,i.getEdgeDirection())}this._coordinates=s.toCoordinateArray(),e>t&&W.reverse(this._coordinates)}return this._coordinates}}class _r{constructor(){_r.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1,this._isVisited=!1,this._data=null}static setMarked(t,e){for(;t.hasNext();){t.next().setMarked(e)}}static setVisited(t,e){for(;t.hasNext();){t.next().setVisited(e)}}static getComponentWithVisitedState(t,e){for(;t.hasNext();){const s=t.next();if(s.isVisited()===e)return s}return null}setVisited(t){this._isVisited=t}isMarked(){return this._isMarked}setData(t){this._data=t}getData(){return this._data}setMarked(t){this._isMarked=t}getContext(){return this._data}isVisited(){return this._isVisited}setContext(t){this._data=t}}class pr extends _r{constructor(){super(),pr.constructor_.apply(this,arguments)}static constructor_(){if(this._parentEdge=null,this._from=null,this._to=null,this._p0=null,this._p1=null,this._sym=null,this._edgeDirection=null,this._quadrant=null,this._angle=null,0===arguments.length);else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this._from=t,this._to=e,this._edgeDirection=n,this._p0=t.getCoordinate(),this._p1=s;const i=this._p1.x-this._p0.x,r=this._p1.y-this._p0.y;this._quadrant=Ds.quadrant(i,r),this._angle=Math.atan2(r,i)}}static toEdges(t){const e=new L;for(let s=t.iterator();s.hasNext();)e.add(s.next()._parentEdge);return e}isRemoved(){return null===this._parentEdge}compareDirection(t){return this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:q.index(t._p0,t._p1,this._p1)}getCoordinate(){return this._from.getCoordinate()}print(t){const e=this.getClass().getName(),s=e.lastIndexOf("."),n=e.substring(s+1);t.print(" "+n+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+this._angle)}getDirectionPt(){return this._p1}getAngle(){return this._angle}getSym(){return this._sym}getEdge(){return this._parentEdge}getToNode(){return this._to}getEdgeDirection(){return this._edgeDirection}compareTo(t){const e=t;return this.compareDirection(e)}getFromNode(){return this._from}setEdge(t){this._parentEdge=t}remove(){this._sym=null,this._parentEdge=null}getQuadrant(){return this._quadrant}setSym(t){this._sym=t}get interfaces_(){return[o]}}class mr extends pr{constructor(){super(),mr.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];pr.constructor_.call(this,t,e,s,n)}getNext(){return 2!==this.getToNode().getDegree()?null:this.getToNode().getOutEdges().getEdges().get(0)===this.getSym()?this.getToNode().getOutEdges().getEdges().get(1):(h.isTrue(this.getToNode().getOutEdges().getEdges().get(1)===this.getSym()),this.getToNode().getOutEdges().getEdges().get(0))}}class fr extends _r{constructor(){super(),fr.constructor_.apply(this,arguments)}static constructor_(){if(this._dirEdge=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.setDirectedEdges(t,e)}}isRemoved(){return null===this._dirEdge}setDirectedEdges(t,e){this._dirEdge=[t,e],t.setEdge(this),e.setEdge(this),t.setSym(e),e.setSym(t),t.getFromNode().addOutEdge(t),e.getFromNode().addOutEdge(e)}getDirEdge(){if(Number.isInteger(arguments[0])){const t=arguments[0];return this._dirEdge[t]}if(arguments[0]instanceof xr){const t=arguments[0];return this._dirEdge[0].getFromNode()===t?this._dirEdge[0]:this._dirEdge[1].getFromNode()===t?this._dirEdge[1]:null}}remove(){this._dirEdge=null}getOppositeNode(t){return this._dirEdge[0].getFromNode()===t?this._dirEdge[0].getToNode():this._dirEdge[1].getFromNode()===t?this._dirEdge[1].getToNode():null}}class yr{constructor(){yr.constructor_.apply(this,arguments)}static constructor_(){this._outEdges=new L,this._sorted=!1}getNextEdge(t){const e=this.getIndex(t);return this._outEdges.get(this.getIndex(e+1))}getCoordinate(){const t=this.iterator();if(!t.hasNext())return null;return t.next().getCoordinate()}iterator(){return this.sortEdges(),this._outEdges.iterator()}sortEdges(){this._sorted||(xe.sort(this._outEdges),this._sorted=!0)}remove(t){this._outEdges.remove(t)}getEdges(){return this.sortEdges(),this._outEdges}getNextCWEdge(t){const e=this.getIndex(t);return this._outEdges.get(this.getIndex(e-1))}getIndex(){if(arguments[0]instanceof fr){const t=arguments[0];this.sortEdges();for(let e=0;e<this._outEdges.size();e++){if(this._outEdges.get(e).getEdge()===t)return e}return-1}if(arguments[0]instanceof pr){const t=arguments[0];this.sortEdges();for(let e=0;e<this._outEdges.size();e++){if(this._outEdges.get(e)===t)return e}return-1}if(Number.isInteger(arguments[0])){let t=arguments[0]%this._outEdges.size();return t<0&&(t+=this._outEdges.size()),t}}add(t){this._outEdges.add(t),this._sorted=!1}getDegree(){return this._outEdges.size()}}class xr extends _r{constructor(){super(),xr.constructor_.apply(this,arguments)}static constructor_(){if(this._pt=null,this._deStar=null,1===arguments.length){const t=arguments[0];xr.constructor_.call(this,t,new yr)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._pt=t,this._deStar=e}}static getEdgesBetween(t,e){const s=pr.toEdges(t.getOutEdges().getEdges()),n=new pt(s),i=pr.toEdges(e.getOutEdges().getEdges());return n.retainAll(i),n}isRemoved(){return null===this._pt}addOutEdge(t){this._deStar.add(t)}getCoordinate(){return this._pt}getOutEdges(){return this._deStar}remove(){if(0===arguments.length)this._pt=null;else if(1===arguments.length){const t=arguments[0];this._deStar.remove(t)}}getIndex(t){return this._deStar.getIndex(t)}getDegree(){return this._deStar.getDegree()}}class Er extends fr{constructor(){super(),Er.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}getLine(){return this._line}}class Ir{constructor(){Ir.constructor_.apply(this,arguments)}static constructor_(){this._nodeMap=new os}find(t){return this._nodeMap.get(t)}iterator(){return this._nodeMap.values().iterator()}remove(t){return this._nodeMap.remove(t)}values(){return this._nodeMap.values()}add(t){return this._nodeMap.put(t.getCoordinate(),t),t}}class Nr{constructor(){Nr.constructor_.apply(this,arguments)}static constructor_(){this._edges=new pt,this._dirEdges=new pt,this._nodeMap=new Ir}findNodesOfDegree(t){const e=new L;for(let s=this.nodeIterator();s.hasNext();){const n=s.next();n.getDegree()===t&&e.add(n)}return e}dirEdgeIterator(){return this._dirEdges.iterator()}edgeIterator(){return this._edges.iterator()}getEdges(){return this._edges}nodeIterator(){return this._nodeMap.iterator()}contains(){if(arguments[0]instanceof fr){const t=arguments[0];return this._edges.contains(t)}if(arguments[0]instanceof pr){const t=arguments[0];return this._dirEdges.contains(t)}}add(){if(arguments[0]instanceof xr){const t=arguments[0];this._nodeMap.add(t)}else if(arguments[0]instanceof fr){const t=arguments[0];this._edges.add(t),this.add(t.getDirEdge(0)),this.add(t.getDirEdge(1))}else if(arguments[0]instanceof pr){const t=arguments[0];this._dirEdges.add(t)}}getNodes(){return this._nodeMap.values()}remove(){if(arguments[0]instanceof fr){const t=arguments[0];this.remove(t.getDirEdge(0)),this.remove(t.getDirEdge(1)),this._edges.remove(t),t.remove()}else if(arguments[0]instanceof pr){const t=arguments[0],e=t.getSym();null!==e&&e.setSym(null),t.getFromNode().remove(t),t.remove(),this._dirEdges.remove(t)}else if(arguments[0]instanceof xr){const t=arguments[0];for(let e=t.getOutEdges().getEdges().iterator();e.hasNext();){const t=e.next(),s=t.getSym();null!==s&&this.remove(s),this._dirEdges.remove(t);const n=t.getEdge();null!==n&&this._edges.remove(n)}this._nodeMap.remove(t.getCoordinate()),t.remove()}}findNode(t){return this._nodeMap.find(t)}}class wr extends Nr{constructor(){super()}getNode(t){let e=this.findNode(t);return null===e&&(e=new xr(t),this.add(e)),e}addEdge(t){if(t.isEmpty())return null;const e=W.removeRepeatedPoints(t.getCoordinates());if(e.length<=1)return null;const s=e[0],n=e[e.length-1],i=this.getNode(s),r=this.getNode(n),o=new mr(i,r,e[1],!0),l=new mr(r,i,e[e.length-2],!1),a=new Er(t);a.setDirectedEdges(o,l),this.add(a)}}class Cr{constructor(){Cr.constructor_.apply(this,arguments)}static constructor_(){this._graph=new wr,this._mergedLineStrings=null,this._factory=null,this._edgeStrings=null}buildEdgeStringsForUnprocessedNodes(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next();e.isMarked()||(h.isTrue(2===e.getDegree()),this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}}buildEdgeStringsForNonDegree2Nodes(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next();2!==e.getDegree()&&(this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}}buildEdgeStringsStartingAt(t){for(let e=t.getOutEdges().iterator();e.hasNext();){const t=e.next();t.getEdge().isMarked()||this._edgeStrings.add(this.buildEdgeStringStartingWith(t))}}merge(){if(null!==this._mergedLineStrings)return null;_r.setMarked(this._graph.nodeIterator(),!1),_r.setMarked(this._graph.edgeIterator(),!1),this._edgeStrings=new L,this.buildEdgeStringsForObviousStartNodes(),this.buildEdgeStringsForIsolatedLoops(),this._mergedLineStrings=new L;for(let t=this._edgeStrings.iterator();t.hasNext();){const e=t.next();this._mergedLineStrings.add(e.toLineString())}}addLineString(t){null===this._factory&&(this._factory=t.getFactory()),this._graph.addEdge(t)}buildEdgeStringStartingWith(t){const e=new dr(this._factory);let s=t;do{e.add(s),s.getEdge().setMarked(!0),s=s.getNext()}while(null!==s&&s!==t);return e}add(){if(arguments[0]instanceof j){const t=arguments[0];for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);s instanceof tt&&this.addLineString(s)}}else if(I(arguments[0],N)){const t=arguments[0];this._mergedLineStrings=null;for(let e=t.iterator();e.hasNext();){const t=e.next();this.add(t)}}}buildEdgeStringsForIsolatedLoops(){this.buildEdgeStringsForUnprocessedNodes()}buildEdgeStringsForObviousStartNodes(){this.buildEdgeStringsForNonDegree2Nodes()}getMergedLineStrings(){return this.merge(),this._mergedLineStrings}}class Sr{constructor(){Sr.constructor_.apply(this,arguments)}static constructor_(){this._parentGraph=null,this._edges=new pt,this._dirEdges=new L,this._nodeMap=new Ir;const t=arguments[0];this._parentGraph=t}dirEdgeIterator(){return this._dirEdges.iterator()}edgeIterator(){return this._edges.iterator()}getParent(){return this._parentGraph}nodeIterator(){return this._nodeMap.iterator()}contains(t){return this._edges.contains(t)}add(t){if(this._edges.contains(t))return null;this._edges.add(t),this._dirEdges.add(t.getDirEdge(0)),this._dirEdges.add(t.getDirEdge(1)),this._nodeMap.add(t.getDirEdge(0).getFromNode()),this._nodeMap.add(t.getDirEdge(1).getFromNode())}}class Lr{constructor(){Lr.constructor_.apply(this,arguments)}static constructor_(){this._graph=null;const t=arguments[0];this._graph=t}findSubgraph(t){const e=new Sr(this._graph);return this.addReachable(t,e),e}addEdges(t,e,s){t.setVisited(!0);for(let n=t.getOutEdges().iterator();n.hasNext();){const t=n.next();s.add(t.getEdge());const i=t.getToNode();i.isVisited()||e.push(i)}}addReachable(t,e){const s=new Zs;for(s.add(t);!s.empty();){const t=s.pop();this.addEdges(t,s,e)}}getConnectedSubgraphs(){const t=new L;_r.setVisited(this._graph.nodeIterator(),!1);for(let e=this._graph.edgeIterator();e.hasNext();){const s=e.next().getDirEdge(0).getFromNode();s.isVisited()||t.add(this.findSubgraph(s))}return t}}class Tr{constructor(){Tr.constructor_.apply(this,arguments)}static constructor_(){this._graph=new wr,this._factory=new Lt,this._lineCount=0,this._isRun=!1,this._sequencedGeometry=null,this._isSequenceable=!1}static findUnvisitedBestOrientedDE(t){let e=null,s=null;for(let n=t.getOutEdges().iterator();n.hasNext();){const t=n.next();t.getEdge().isVisited()||(s=t,t.getEdgeDirection()&&(e=t))}return null!==e?e:s}static findLowestDegreeNode(t){let e=M.MAX_VALUE,s=null;for(let n=t.nodeIterator();n.hasNext();){const t=n.next();(null===s||t.getDegree()<e)&&(e=t.getDegree(),s=t)}return s}static isSequenced(t){if(!(t instanceof Et))return!0;const e=t,s=new at;let n=null;const i=new L;for(let t=0;t<e.getNumGeometries();t++){const r=e.getGeometryN(t),o=r.getCoordinateN(0),l=r.getCoordinateN(r.getNumPoints()-1);if(s.contains(o))return!1;if(s.contains(l))return!1;null!==n&&(o.equals(n)||(s.addAll(i),i.clear())),i.add(o),i.add(l),n=l}return!0}static reverse(t){const e=t.getCoordinates(),s=new Array(e.length).fill(null),n=e.length;for(let t=0;t<n;t++)s[n-1-t]=new m(e[t]);return t.getFactory().createLineString(s)}static sequence(t){const e=new Tr;return e.add(t),e.getSequencedLineStrings()}computeSequence(){if(this._isRun)return null;this._isRun=!0;const t=this.findSequences();if(null===t)return null;this._sequencedGeometry=this.buildSequencedGeometry(t),this._isSequenceable=!0;const e=this._sequencedGeometry.getNumGeometries();h.isTrue(this._lineCount===e,"Lines were missing from result"),h.isTrue(this._sequencedGeometry instanceof tt||this._sequencedGeometry instanceof Et,"Result is not lineal")}findSequences(){const t=new L;for(let e=new Lr(this._graph).getConnectedSubgraphs().iterator();e.hasNext();){const s=e.next();if(!this.hasSequence(s))return null;{const e=this.findSequence(s);t.add(e)}}return t}addReverseSubpath(t,e,s){const n=t.getToNode();let i=null;for(;;){e.add(t.getSym()),t.getEdge().setVisited(!0),i=t.getFromNode();const s=Tr.findUnvisitedBestOrientedDE(i);if(null===s)break;t=s.getSym()}s&&h.isTrue(i===n,"path not contiguous")}findSequence(t){_r.setVisited(t.edgeIterator(),!1);const e=Tr.findLowestDegreeNode(t).getOutEdges().iterator().next().getSym(),s=new Ks,n=s.listIterator();for(this.addReverseSubpath(e,n,!1);n.hasPrevious();){const t=n.previous(),e=Tr.findUnvisitedBestOrientedDE(t.getFromNode());null!==e&&this.addReverseSubpath(e.getSym(),n,!0)}return this.orient(s)}reverse(t){const e=new Ks;for(let s=t.iterator();s.hasNext();){const t=s.next();e.addFirst(t.getSym())}return e}add(){if(I(arguments[0],N)){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}}else if(arguments[0]instanceof j){arguments[0].apply(new class{get interfaces_(){return[X]}filter(t){t instanceof tt&&this.addLine(t)}})}}addLine(t){null===this._factory&&(this._factory=t.getFactory()),this._graph.addEdge(t),this._lineCount++}hasSequence(t){let e=0;for(let s=t.nodeIterator();s.hasNext();){s.next().getDegree()%2==1&&e++}return e<=2}orient(t){const e=t.get(0),s=t.get(t.size()-1),n=e.getFromNode(),i=s.getToNode();let r=!1;if(1===n.getDegree()||1===i.getDegree()){let t=!1;1===s.getToNode().getDegree()&&!1===s.getEdgeDirection()&&(t=!0,r=!0),1===e.getFromNode().getDegree()&&!0===e.getEdgeDirection()&&(t=!0,r=!1),t||1===e.getFromNode().getDegree()&&(r=!0)}return r?this.reverse(t):t}buildSequencedGeometry(t){const e=new L;for(let s=t.iterator();s.hasNext();){for(let t=s.next().iterator();t.hasNext();){const s=t.next(),n=s.getEdge().getLine();let i=n;s.getEdgeDirection()||n.isClosed()||(i=Tr.reverse(n)),e.add(i)}}return 0===e.size()?this._factory.createMultiLineString(new Array(0).fill(null)):this._factory.buildGeometry(e)}getSequencedLineStrings(){return this.computeSequence(),this._sequencedGeometry}isSequenceable(){return this.computeSequence(),this._isSequenceable}}var Rr=Object.freeze({__proto__:null,LineMerger:Cr,LineSequencer:Tr}),Pr=Object.freeze({__proto__:null,GeometrySnapper:An,LineStringSnapper:Dn}),Or=Object.freeze({__proto__:null,OverlayOp:oi,snap:Pr});class vr{constructor(){vr.constructor_.apply(this,arguments)}static constructor_(){this._geometryFactory=new Lt,this._geomGraph=null,this._disconnectedRingcoord=null;const t=arguments[0];this._geomGraph=t}static findDifferentPoint(t,e){for(let s=0;s<t.length;s++)if(!t[s].equals(e))return t[s];return null}visitInteriorRing(t,e){if(t.isEmpty())return null;const s=t.getCoordinates(),n=s[0],i=vr.findDifferentPoint(s,n),r=e.findEdgeInSameDirection(n,i),o=e.findEdgeEnd(r);let l=null;o.getLabel().getLocation(0,Hs.RIGHT)===Qt.INTERIOR?l=o:o.getSym().getLabel().getLocation(0,Hs.RIGHT)===Qt.INTERIOR&&(l=o.getSym()),h.isTrue(null!==l,"unable to find dirEdge with Interior on RHS"),this.visitLinkedDirectedEdges(l)}visitShellInteriors(t,e){if(t instanceof Ct){const s=t;this.visitInteriorRing(s.getExteriorRing(),e)}if(t instanceof dt){const s=t;for(let t=0;t<s.getNumGeometries();t++){const n=s.getGeometryN(t);this.visitInteriorRing(n.getExteriorRing(),e)}}}getCoordinate(){return this._disconnectedRingcoord}setInteriorEdgesInResult(t){for(let e=t.getEdgeEnds().iterator();e.hasNext();){const t=e.next();t.getLabel().getLocation(0,Hs.RIGHT)===Qt.INTERIOR&&t.setInResult(!0)}}visitLinkedDirectedEdges(t){const e=t;let s=t;do{h.isTrue(null!==s,"found null Directed Edge"),s.setVisited(!0),s=s.getNext()}while(s!==e)}buildEdgeRings(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();if(t.isInResult()&&null===t.getEdgeRing()){const s=new _n(t,this._geometryFactory);s.linkDirectedEdgesForMinimalEdgeRings();const n=s.buildMinimalRings();e.addAll(n)}}return e}hasUnvisitedShellEdge(t){for(let e=0;e<t.size();e++){const s=t.get(e);if(s.isHole())continue;const n=s.getEdges();let i=n.get(0);if(i.getLabel().getLocation(0,Hs.RIGHT)===Qt.INTERIOR)for(let t=0;t<n.size();t++)if(i=n.get(t),!i.isVisited())return this._disconnectedRingcoord=i.getCoordinate(),!0}return!1}isInteriorsConnected(){const t=new L;this._geomGraph.computeSplitEdges(t);const e=new un(new In);e.addEdges(t),this.setInteriorEdgesInResult(e),e.linkResultDirectedEdges();const s=this.buildEdgeRings(e.getEdgeEnds());return this.visitShellInteriors(this._geomGraph.getGeometry(),e),!this.hasUnvisitedShellEdge(s)}}class Mr{computeEdgeEnds(){if(1===arguments.length){const t=arguments[0],e=new L;for(let s=t;s.hasNext();){const t=s.next();this.computeEdgeEnds(t,e)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=t.getEdgeIntersectionList();s.addEndpoints();const n=s.iterator();let i=null,r=null;if(!n.hasNext())return null;let o=n.next();do{i=r,r=o,o=null,n.hasNext()&&(o=n.next()),null!==r&&(this.createEdgeEndForPrev(t,e,r,i),this.createEdgeEndForNext(t,e,r,o))}while(null!==r)}}createEdgeEndForNext(t,e,s,n){const i=s.segmentIndex+1;if(i>=t.getNumPoints()&&null===n)return null;let r=t.getCoordinate(i);null!==n&&n.segmentIndex===s.segmentIndex&&(r=n.coord);const o=new cn(t,s.coord,r,new nn(t.getLabel()));e.add(o)}createEdgeEndForPrev(t,e,s,n){let i=s.segmentIndex;if(0===s.dist){if(0===i)return null;i--}let r=t.getCoordinate(i);null!==n&&n.segmentIndex>=i&&(r=n.coord);const o=new nn(t.getLabel());o.flip();const l=new cn(t,s.coord,r,o);e.add(l)}}class br extends cn{constructor(){super(),br.constructor_.apply(this,arguments)}static constructor_(){if(this._edgeEnds=new L,1===arguments.length){const t=arguments[0];br.constructor_.call(this,null,t)}else if(2===arguments.length){const t=arguments[1];cn.constructor_.call(this,t.getEdge(),t.getCoordinate(),t.getDirectedCoordinate(),new nn(t.getLabel())),this.insert(t)}}insert(t){this._edgeEnds.add(t)}print(t){t.println("EdgeEndBundle--\x3e Label: "+this._label);for(let e=this.iterator();e.hasNext();){e.next().print(t),t.println()}}iterator(){return this._edgeEnds.iterator()}getEdgeEnds(){return this._edgeEnds}computeLabelOn(t,e){let s=0,n=!1;for(let e=this.iterator();e.hasNext();){const i=e.next().getLabel().getLocation(t);i===Qt.BOUNDARY&&s++,i===Qt.INTERIOR&&(n=!0)}let i=Qt.NONE;n&&(i=Qt.INTERIOR),s>0&&(i=ii.determineBoundary(e,s)),this._label.setLocation(t,i)}computeLabelSide(t,e){for(let s=this.iterator();s.hasNext();){const n=s.next();if(n.getLabel().isArea()){const s=n.getLabel().getLocation(t,e);if(s===Qt.INTERIOR)return this._label.setLocation(t,e,Qt.INTERIOR),null;s===Qt.EXTERIOR&&this._label.setLocation(t,e,Qt.EXTERIOR)}}}getLabel(){return this._label}computeLabelSides(t){this.computeLabelSide(t,Hs.LEFT),this.computeLabelSide(t,Hs.RIGHT)}updateIM(t){vn.updateIM(this._label,t)}computeLabel(t){let e=!1;for(let t=this.iterator();t.hasNext();){t.next().getLabel().isArea()&&(e=!0)}this._label=e?new nn(Qt.NONE,Qt.NONE,Qt.NONE):new nn(Qt.NONE);for(let s=0;s<2;s++)this.computeLabelOn(s,t),e&&this.computeLabelSides(s)}}class Dr extends xn{constructor(){super()}updateIM(t){for(let e=this.iterator();e.hasNext();){e.next().updateIM(t)}}insert(t){let e=this._edgeMap.get(t);null===e?(e=new br(t),this.insertEdgeEnd(t,e)):e.insert(t)}}class Ar extends on{constructor(){super(),Ar.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];on.constructor_.call(this,t,e)}computeIM(t){t.setAtLeastIfValid(this._label.getLocation(0),this._label.getLocation(1),0)}updateIMFromEdges(t){this._edges.updateIM(t)}}class Fr extends an{constructor(){super()}createNode(t){return new Ar(t,new Dr)}}class Gr{constructor(){Gr.constructor_.apply(this,arguments)}static constructor_(){this._nodes=new ln(new Fr)}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}getNodeIterator(){return this._nodes.iterator()}copyNodesAndLabels(t,e){for(let s=t.getNodeIterator();s.hasNext();){const t=s.next();this._nodes.addNode(t.getCoordinate()).setLabel(e,t.getLabel().getLocation(e))}}build(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);const e=(new Mr).computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(e)}computeIntersectionNodes(t,e){for(let s=t.getEdgeIterator();s.hasNext();){const t=s.next(),n=t.getLabel().getLocation(e);for(let s=t.getEdgeIntersectionList().iterator();s.hasNext();){const t=s.next(),i=this._nodes.addNode(t.coord);n===Qt.BOUNDARY?i.setLabelBoundary(e):i.getLabel().isNull(e)&&i.setLabel(e,Qt.INTERIOR)}}}}class qr{constructor(){qr.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._geomGraph=null,this._nodeGraph=new Gr,this._invalidPoint=null;const t=arguments[0];this._geomGraph=t}isNodeEdgeAreaLabelsConsistent(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();){const e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this._geomGraph))return this._invalidPoint=e.getCoordinate().copy(),!1}return!0}hasDuplicateRings(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();){for(let e=t.next().getEdges().iterator();e.hasNext();){const t=e.next();if(t.getEdgeEnds().size()>1)return this._invalidPoint=t.getEdge().getCoordinate(0),!0}}return!1}isNodeConsistentArea(){const t=this._geomGraph.computeSelfNodes(this._li,!0,!0);return t.hasProperIntersection()?(this._invalidPoint=t.getProperIntersectionPoint(),!1):(this._nodeGraph.build(this._geomGraph),this.isNodeEdgeAreaLabelsConsistent())}getInvalidPoint(){return this._invalidPoint}}class Br{constructor(){Br.constructor_.apply(this,arguments)}static constructor_(){this._graph=null,this._rings=new L,this._totalEnv=new O,this._index=null,this._nestedPt=null;const t=arguments[0];this._graph=t}add(t){this._rings.add(t),this._totalEnv.expandToInclude(t.getEnvelopeInternal())}getNestedPoint(){return this._nestedPt}buildIndex(){this._index=new Os;for(let t=0;t<this._rings.size();t++){const e=this._rings.get(t),s=e.getEnvelopeInternal();this._index.insert(s,e)}}isNonNested(){this.buildIndex();for(let t=0;t<this._rings.size();t++){const e=this._rings.get(t),s=e.getCoordinates(),n=this._index.query(e.getEnvelopeInternal());for(let t=0;t<n.size();t++){const i=n.get(t),r=i.getCoordinates();if(e===i)continue;if(!e.getEnvelopeInternal().intersects(i.getEnvelopeInternal()))continue;const o=zr.findPtNotNode(s,i,this._graph);if(null===o)continue;if(Ue.isInRing(o,r))return this._nestedPt=o,!1}}return!0}}class Yr{constructor(){Yr.constructor_.apply(this,arguments)}static constructor_(){if(this._errorType=null,this._pt=null,1===arguments.length){const t=arguments[0];Yr.constructor_.call(this,t,null)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._errorType=t,null!==e&&(this._pt=e.copy())}}getCoordinate(){return this._pt}getMessage(){return Yr.errMsg[this._errorType]}toString(){let t="";return null!==this._pt&&(t=" at or near point "+this._pt),this.getMessage()+t}getErrorType(){return this._errorType}}Yr.ERROR=0,Yr.REPEATED_POINT=1,Yr.HOLE_OUTSIDE_SHELL=2,Yr.NESTED_HOLES=3,Yr.DISCONNECTED_INTERIOR=4,Yr.SELF_INTERSECTION=5,Yr.RING_SELF_INTERSECTION=6,Yr.NESTED_SHELLS=7,Yr.DUPLICATE_RINGS=8,Yr.TOO_FEW_POINTS=9,Yr.INVALID_COORDINATE=10,Yr.RING_NOT_CLOSED=11,Yr.errMsg=["Topology Validation Error","Repeated Point","Hole lies outside shell","Holes are nested","Interior is disconnected","Self-intersection","Ring Self-intersection","Nested shells","Duplicate Rings","Too few distinct points in geometry component","Invalid Coordinate","Ring is not closed"];class zr{constructor(){zr.constructor_.apply(this,arguments)}static constructor_(){this._parentGeometry=null,this._isSelfTouchingRingFormingHoleValid=!1,this._validErr=null;const t=arguments[0];this._parentGeometry=t}static findPtNotNode(t,e,s){const n=s.findEdge(e).getEdgeIntersectionList();for(let e=0;e<t.length;e++){const s=t[e];if(!n.isIntersection(s))return s}return null}static isValid(){if(arguments[0]instanceof j){return new zr(arguments[0]).isValid()}if(arguments[0]instanceof m){const t=arguments[0];return!r.isNaN(t.x)&&(!r.isInfinite(t.x)&&(!r.isNaN(t.y)&&!r.isInfinite(t.y)))}}checkInvalidCoordinates(){if(arguments[0]instanceof Array){const t=arguments[0];for(let e=0;e<t.length;e++)if(!zr.isValid(t[e]))return this._validErr=new Yr(Yr.INVALID_COORDINATE,t[e]),null}else if(arguments[0]instanceof Ct){const t=arguments[0];if(this.checkInvalidCoordinates(t.getExteriorRing().getCoordinates()),null!==this._validErr)return null;for(let e=0;e<t.getNumInteriorRing();e++)if(this.checkInvalidCoordinates(t.getInteriorRingN(e).getCoordinates()),null!==this._validErr)return null}}checkHolesNotNested(t,e){if(t.getNumInteriorRing()<=0)return null;const s=new Br(e);for(let e=0;e<t.getNumInteriorRing();e++){const n=t.getInteriorRingN(e);n.isEmpty()||s.add(n)}s.isNonNested()||(this._validErr=new Yr(Yr.NESTED_HOLES,s.getNestedPoint()))}checkConsistentArea(t){const e=new qr(t);if(!e.isNodeConsistentArea())return this._validErr=new Yr(Yr.SELF_INTERSECTION,e.getInvalidPoint()),null;e.hasDuplicateRings()&&(this._validErr=new Yr(Yr.DUPLICATE_RINGS,e.getInvalidPoint()))}isValid(){return this.checkValid(this._parentGeometry),null===this._validErr}checkShellInsideHole(t,e,s){const n=t.getCoordinates(),i=e.getCoordinates(),r=zr.findPtNotNode(n,e,s);if(null!==r){if(!Ue.isInRing(r,i))return r}const o=zr.findPtNotNode(i,t,s);if(null!==o){return Ue.isInRing(o,n)?o:null}return h.shouldNeverReachHere("points in shell and hole appear to be equal"),null}checkNoSelfIntersectingRings(t){for(let e=t.getEdgeIterator();e.hasNext();){const t=e.next();if(this.checkNoSelfIntersectingRing(t.getEdgeIntersectionList()),null!==this._validErr)return null}}checkHolesInShell(t,e){if(t.getNumInteriorRing()<=0)return null;const s=t.getExteriorRing(),n=s.isEmpty(),i=new Ve(s);for(let r=0;r<t.getNumInteriorRing();r++){const o=t.getInteriorRingN(r);let l=null;if(o.isEmpty())continue;if(l=zr.findPtNotNode(o.getCoordinates(),s,e),null===l)return null;if(n||Qt.EXTERIOR===i.locate(l))return this._validErr=new Yr(Yr.HOLE_OUTSIDE_SHELL,l),null}}checkShellNotNested(t,e,s){const n=t.getCoordinates(),i=e.getExteriorRing();if(i.isEmpty())return null;const r=i.getCoordinates(),o=zr.findPtNotNode(n,i,s);if(null===o)return null;if(!Ue.isInRing(o,r))return null;if(e.getNumInteriorRing()<=0)return this._validErr=new Yr(Yr.NESTED_SHELLS,o),null;let l=null;for(let n=0;n<e.getNumInteriorRing();n++){const i=e.getInteriorRingN(n);if(l=this.checkShellInsideHole(t,i,s),null===l)return null}this._validErr=new Yr(Yr.NESTED_SHELLS,l)}checkClosedRings(t){if(this.checkClosedRing(t.getExteriorRing()),null!==this._validErr)return null;for(let e=0;e<t.getNumInteriorRing();e++)if(this.checkClosedRing(t.getInteriorRingN(e)),null!==this._validErr)return null}checkConnectedInteriors(t){const e=new vr(t);e.isInteriorsConnected()||(this._validErr=new Yr(Yr.DISCONNECTED_INTERIOR,e.getCoordinate()))}checkNoSelfIntersectingRing(t){const e=new at;let s=!0;for(let n=t.iterator();n.hasNext();){const t=n.next();if(s)s=!1;else{if(e.contains(t.coord))return this._validErr=new Yr(Yr.RING_SELF_INTERSECTION,t.coord),null;e.add(t.coord)}}}checkTooFewPoints(t){if(t.hasTooFewPoints())return this._validErr=new Yr(Yr.TOO_FEW_POINTS,t.getInvalidPoint()),null}getValidationError(){return this.checkValid(this._parentGeometry),this._validErr}checkValid(){if(arguments[0]instanceof Nt){const t=arguments[0];this.checkInvalidCoordinates(t.getCoordinates())}else if(arguments[0]instanceof St){const t=arguments[0];this.checkInvalidCoordinates(t.getCoordinates())}else if(arguments[0]instanceof et){const t=arguments[0];if(this.checkInvalidCoordinates(t.getCoordinates()),null!==this._validErr)return null;if(this.checkClosedRing(t),null!==this._validErr)return null;const e=new ii(0,t);if(this.checkTooFewPoints(e),null!==this._validErr)return null;const s=new jt;e.computeSelfNodes(s,!0,!0),this.checkNoSelfIntersectingRings(e)}else if(arguments[0]instanceof tt){const t=arguments[0];if(this.checkInvalidCoordinates(t.getCoordinates()),null!==this._validErr)return null;const e=new ii(0,t);this.checkTooFewPoints(e)}else if(arguments[0]instanceof Ct){const t=arguments[0];if(this.checkInvalidCoordinates(t),null!==this._validErr)return null;if(this.checkClosedRings(t),null!==this._validErr)return null;const e=new ii(0,t);if(this.checkTooFewPoints(e),null!==this._validErr)return null;if(this.checkConsistentArea(e),null!==this._validErr)return null;if(!this._isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(e),null!==this._validErr))return null;if(this.checkHolesInShell(t,e),null!==this._validErr)return null;if(this.checkHolesNotNested(t,e),null!==this._validErr)return null;this.checkConnectedInteriors(e)}else if(arguments[0]instanceof dt){const t=arguments[0];for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);if(this.checkInvalidCoordinates(s),null!==this._validErr)return null;if(this.checkClosedRings(s),null!==this._validErr)return null}const e=new ii(0,t);if(this.checkTooFewPoints(e),null!==this._validErr)return null;if(this.checkConsistentArea(e),null!==this._validErr)return null;if(!this._isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(e),null!==this._validErr))return null;for(let s=0;s<t.getNumGeometries();s++){const n=t.getGeometryN(s);if(this.checkHolesInShell(n,e),null!==this._validErr)return null}for(let s=0;s<t.getNumGeometries();s++){const n=t.getGeometryN(s);if(this.checkHolesNotNested(n,e),null!==this._validErr)return null}if(this.checkShellsNotNested(t,e),null!==this._validErr)return null;this.checkConnectedInteriors(e)}else if(arguments[0]instanceof ut){const t=arguments[0];for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);if(this.checkValid(s),null!==this._validErr)return null}}else if(arguments[0]instanceof j){const t=arguments[0];if(this._validErr=null,t.isEmpty())return null;if(t instanceof Nt)this.checkValid(t);else if(t instanceof St)this.checkValid(t);else if(t instanceof et)this.checkValid(t);else if(t instanceof tt)this.checkValid(t);else if(t instanceof Ct)this.checkValid(t);else if(t instanceof dt)this.checkValid(t);else{if(!(t instanceof ut))throw new U(t.getGeometryType());this.checkValid(t)}}}setSelfTouchingRingFormingHoleValid(t){this._isSelfTouchingRingFormingHoleValid=t}checkClosedRing(t){if(t.isEmpty())return null;if(!t.isClosed()){let e=null;t.getNumPoints()>=1&&(e=t.getCoordinateN(0)),this._validErr=new Yr(Yr.RING_NOT_CLOSED,e)}}checkShellsNotNested(t,e){for(let s=0;s<t.getNumGeometries();s++){const n=t.getGeometryN(s).getExteriorRing();for(let i=0;i<t.getNumGeometries();i++){if(s===i)continue;const r=t.getGeometryN(i);if(this.checkShellNotNested(n,r,e),null!==this._validErr)return null}}}}class Vr{constructor(){Vr.constructor_.apply(this,arguments)}static constructor_(){this._factory=null,this._deList=new L,this._lowestEdge=null,this._ring=null,this._locator=null,this._ringPts=null,this._holes=null,this._shell=null,this._isHole=null,this._isProcessed=!1,this._isIncludedSet=!1,this._isIncluded=!1;const t=arguments[0];this._factory=t}static findEdgeRingContaining(t,e){const s=t.getRing(),n=s.getEnvelopeInternal();let i=s.getCoordinateN(0),r=null,o=null;for(let t=e.iterator();t.hasNext();){const e=t.next(),l=e.getRing().getEnvelopeInternal();if(l.equals(n))continue;if(!l.contains(n))continue;i=W.ptNotInList(s.getCoordinates(),e.getCoordinates());e.isInRing(i)&&(null===r||o.contains(l))&&(r=e,o=r.getRing().getEnvelopeInternal())}return r}static addEdge(t,e,s){if(e)for(let e=0;e<t.length;e++)s.add(t[e],!1);else for(let e=t.length-1;e>=0;e--)s.add(t[e],!1)}static findDirEdgesInRing(t){let e=t;const s=new L;do{s.add(e),e=e.getNext(),h.isTrue(null!==e,"found null DE in ring"),h.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t);return s}isIncluded(){return this._isIncluded}getCoordinates(){if(null===this._ringPts){const t=new R;for(let e=this._deList.iterator();e.hasNext();){const s=e.next(),n=s.getEdge();Vr.addEdge(n.getLine().getCoordinates(),s.getEdgeDirection(),t)}this._ringPts=t.toCoordinateArray()}return this._ringPts}build(t){let e=t;do{this.add(e),e.setRing(this),e=e.getNext(),h.isTrue(null!==e,"found null DE in ring"),h.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t)}isInRing(t){return Qt.EXTERIOR!==this.getLocator().locate(t)}addHole(){if(arguments[0]instanceof et){const t=arguments[0];null===this._holes&&(this._holes=new L),this._holes.add(t)}else if(arguments[0]instanceof Vr){const t=arguments[0];t.setShell(this);const e=t.getRing();null===this._holes&&(this._holes=new L),this._holes.add(e)}}computeHole(){const t=this.getRing();this._isHole=q.isCCW(t.getCoordinates())}getLocator(){return null===this._locator&&(this._locator=new Ve(this.getRing())),this._locator}getShell(){return this.isHole()?this._shell:this}updateIncluded(){if(this.isHole())return null;for(let t=0;t<this._deList.size();t++){const e=this._deList.get(t).getSym().getRing().getShell();if(null!==e&&e.isIncludedSet())return this.setIncluded(!e.isIncluded()),null}}setShell(t){this._shell=t}setProcessed(t){this._isProcessed=t}isIncludedSet(){return this._isIncludedSet}isValid(){return this.getCoordinates(),!(this._ringPts.length<=3)&&(this.getRing(),zr.isValid(this._ring))}isOuterHole(){return!!this._isHole&&!this.hasShell()}getPolygon(){let t=null;if(null!==this._holes){t=new Array(this._holes.size()).fill(null);for(let e=0;e<this._holes.size();e++)t[e]=this._holes.get(e)}return this._factory.createPolygon(this._ring,t)}isHole(){return this._isHole}isProcessed(){return this._isProcessed}setIncluded(t){this._isIncluded=t,this._isIncludedSet=!0}getOuterHole(){if(this.isHole())return null;for(let t=0;t<this._deList.size();t++){const e=this._deList.get(t).getSym().getRing();if(e.isOuterHole())return e}return null}hasShell(){return null!==this._shell}isOuterShell(){return null!==this.getOuterHole()}getLineString(){return this.getCoordinates(),this._factory.createLineString(this._ringPts)}toString(){return Wt.toLineString(new it(this.getCoordinates()))}add(t){this._deList.add(t)}getRing(){if(null!==this._ring)return this._ring;this.getCoordinates(),this._ringPts.length<3&&Y.out.println(this._ringPts);try{this._ring=this._factory.createLinearRing(this._ringPts)}catch(t){if(!(t instanceof s))throw t;Y.out.println(this._ringPts)}return this._ring}}Vr.EnvelopeComparator=class{compare(t,e){const s=e;return t.getRing().getEnvelope().compareTo(s.getRing().getEnvelope())}get interfaces_(){return[g]}};class kr{constructor(){kr.constructor_.apply(this,arguments)}static constructor_(){this._shells=null,this._shellIndex=null;const t=arguments[0];this._shells=t,this.buildIndex()}static assignHolesToShells(t,e){new kr(e).assignHolesToShells(t)}assignHolesToShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.assignHoleToShell(t)}}buildIndex(){this._shellIndex=new Os;for(const t of this._shells)this._shellIndex.insert(t.getRing().getEnvelopeInternal(),t)}queryOverlappingShells(t){return this._shellIndex.query(t)}findShellContaining(t){const e=t.getRing().getEnvelopeInternal(),s=this.queryOverlappingShells(e);return Vr.findEdgeRingContaining(t,s)}assignHoleToShell(t){const e=this.findShellContaining(t);null!==e&&e.addHole(t)}}class Xr extends pr{constructor(){super(),Xr.constructor_.apply(this,arguments)}static constructor_(){this._edgeRing=null,this._next=null,this._label=-1;const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];pr.constructor_.call(this,t,e,s,n)}getNext(){return this._next}isInRing(){return null!==this._edgeRing}setRing(t){this._edgeRing=t}setLabel(t){this._label=t}getLabel(){return this._label}setNext(t){this._next=t}getRing(){return this._edgeRing}}class Ur extends fr{constructor(){super(),Ur.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}getLine(){return this._line}}class Hr extends Nr{constructor(){super(),Hr.constructor_.apply(this,arguments)}static constructor_(){this._factory=null;const t=arguments[0];this._factory=t}static findLabeledEdgeRings(t){const e=new L;let s=1;for(let n=t.iterator();n.hasNext();){const t=n.next();if(t.isMarked())continue;if(t.getLabel()>=0)continue;e.add(t);const i=Vr.findDirEdgesInRing(t);Hr.label(i,s),s++}return e}static getDegreeNonDeleted(t){let e=0;for(let s=t.getOutEdges().getEdges().iterator();s.hasNext();){s.next().isMarked()||e++}return e}static deleteAllEdges(t){for(let e=t.getOutEdges().getEdges().iterator();e.hasNext();){const t=e.next();t.setMarked(!0);const s=t.getSym();null!==s&&s.setMarked(!0)}}static label(t,e){for(let s=t.iterator();s.hasNext();){s.next().setLabel(e)}}static computeNextCWEdges(t){let e=null,s=null;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();if(!t.isMarked()){if(null===e&&(e=t),null!==s){s.getSym().setNext(t)}s=t}}if(null!==s){s.getSym().setNext(e)}}static computeNextCCWEdges(t,e){let s=null,n=null;const i=t.getOutEdges().getEdges();for(let t=i.size()-1;t>=0;t--){const r=i.get(t),o=r.getSym();let l=null;r.getLabel()===e&&(l=r);let a=null;o.getLabel()===e&&(a=o),null===l&&null===a||(null!==a&&(n=a),null!==l&&(null!==n&&(n.setNext(l),n=null),null===s&&(s=l)))}null!==n&&(h.isTrue(null!==s),n.setNext(s))}static getDegree(t,e){let s=0;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){n.next().getLabel()===e&&s++}return s}static findIntersectionNodes(t,e){let s=t,n=null;do{const i=s.getFromNode();Hr.getDegree(i,e)>1&&(null===n&&(n=new L),n.add(i)),s=s.getNext(),h.isTrue(null!==s,"found null DE in ring"),h.isTrue(s===t||!s.isInRing(),"found DE already in ring")}while(s!==t);return n}findEdgeRing(t){const e=new Vr(this._factory);return e.build(t),e}computeDepthParity(){if(0===arguments.length)for(;;)return null}computeNextCWEdges(){for(let t=this.nodeIterator();t.hasNext();){const e=t.next();Hr.computeNextCWEdges(e)}}addEdge(t){if(t.isEmpty())return null;const e=W.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return null;const s=e[0],n=e[e.length-1],i=this.getNode(s),r=this.getNode(n),o=new Xr(i,r,e[1],!0),l=new Xr(r,i,e[e.length-2],!1),a=new Ur(t);a.setDirectedEdges(o,l),this.add(a)}deleteCutEdges(){this.computeNextCWEdges(),Hr.findLabeledEdgeRings(this._dirEdges);const t=new L;for(let e=this._dirEdges.iterator();e.hasNext();){const s=e.next();if(s.isMarked())continue;const n=s.getSym();if(s.getLabel()===n.getLabel()){s.setMarked(!0),n.setMarked(!0);const e=s.getEdge();t.add(e.getLine())}}return t}getEdgeRings(){this.computeNextCWEdges(),Hr.label(this._dirEdges,-1);const t=Hr.findLabeledEdgeRings(this._dirEdges);this.convertMaximalToMinimalEdgeRings(t);const e=new L;for(let t=this._dirEdges.iterator();t.hasNext();){const s=t.next();if(s.isMarked())continue;if(s.isInRing())continue;const n=this.findEdgeRing(s);e.add(n)}return e}getNode(t){let e=this.findNode(t);return null===e&&(e=new xr(t),this.add(e)),e}convertMaximalToMinimalEdgeRings(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),s=t.getLabel(),n=Hr.findIntersectionNodes(t,s);if(null!==n)for(let t=n.iterator();t.hasNext();){const e=t.next();Hr.computeNextCCWEdges(e,s)}}}deleteDangles(){const t=this.findNodesOfDegree(1),e=new pt,s=new Zs;for(let e=t.iterator();e.hasNext();)s.push(e.next());for(;!s.isEmpty();){const t=s.pop();Hr.deleteAllEdges(t);for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();t.setMarked(!0);const i=t.getSym();null!==i&&i.setMarked(!0);const r=t.getEdge();e.add(r.getLine());const o=t.getToNode();1===Hr.getDegreeNonDeleted(o)&&s.push(o)}}return e}}class Wr{constructor(){Wr.constructor_.apply(this,arguments)}static constructor_(){if(this._lineStringAdder=new Zr(this),this._graph=null,this._dangles=new L,this._cutEdges=new L,this._invalidRingLines=new L,this._holeList=null,this._shellList=null,this._polyList=null,this._isCheckingRingsValid=!0,this._extractOnlyPolygonal=null,this._geomFactory=null,0===arguments.length)Wr.constructor_.call(this,!1);else if(1===arguments.length){const t=arguments[0];this._extractOnlyPolygonal=t}}static findOuterShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),s=t.getOuterHole();null===s||s.isProcessed()||(t.setIncluded(!0),s.setProcessed(!0))}}static extractPolygons(t,e){const s=new L;for(let n=t.iterator();n.hasNext();){const t=n.next();(e||t.isIncluded())&&s.add(t.getPolygon())}return s}static findDisjointShells(t){Wr.findOuterShells(t);let e=null;do{e=!1;for(let s=t.iterator();s.hasNext();){const t=s.next();t.isIncludedSet()||(t.updateIncluded(),t.isIncludedSet()||(e=!0))}}while(e)}getGeometry(){return null===this._geomFactory&&(this._geomFactory=new Lt),this.polygonize(),this._extractOnlyPolygonal?this._geomFactory.buildGeometry(this._polyList):this._geomFactory.createGeometryCollection(Lt.toGeometryArray(this._polyList))}getInvalidRingLines(){return this.polygonize(),this._invalidRingLines}findValidRings(t,e,s){for(let n=t.iterator();n.hasNext();){const t=n.next();t.isValid()?e.add(t):s.add(t.getLineString())}}polygonize(){if(null!==this._polyList)return null;if(this._polyList=new L,null===this._graph)return null;this._dangles=this._graph.deleteDangles(),this._cutEdges=this._graph.deleteCutEdges();const t=this._graph.getEdgeRings();let e=new L;this._invalidRingLines=new L,this._isCheckingRingsValid?this.findValidRings(t,e,this._invalidRingLines):e=t,this.findShellsAndHoles(e),kr.assignHolesToShells(this._holeList,this._shellList),xe.sort(this._shellList,new Vr.EnvelopeComparator);let s=!0;this._extractOnlyPolygonal&&(Wr.findDisjointShells(this._shellList),s=!1),this._polyList=Wr.extractPolygons(this._shellList,s)}getDangles(){return this.polygonize(),this._dangles}add(){if(I(arguments[0],N)){for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}}else if(arguments[0]instanceof tt){const t=arguments[0];this._geomFactory=t.getFactory(),null===this._graph&&(this._graph=new Hr(this._geomFactory)),this._graph.addEdge(t)}else if(arguments[0]instanceof j){arguments[0].apply(this._lineStringAdder)}}setCheckRingsValid(t){this._isCheckingRingsValid=t}findShellsAndHoles(t){this._holeList=new L,this._shellList=new L;for(let e=t.iterator();e.hasNext();){const t=e.next();t.computeHole(),t.isHole()?this._holeList.add(t):this._shellList.add(t)}}getCutEdges(){return this.polygonize(),this._cutEdges}getPolygons(){return this.polygonize(),this._polyList}}class Zr{constructor(){Zr.constructor_.apply(this,arguments)}static constructor_(){this.p=null;const t=arguments[0];this.p=t}filter(t){t instanceof tt&&this.p.add(t)}get interfaces_(){return[X]}}Wr.LineStringAdder=Zr;var jr=Object.freeze({__proto__:null,Polygonizer:Wr});class Kr{constructor(){Kr.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._ptLocator=new Zn,this._arg=null,this._nodes=new ln(new Fr),this._im=null,this._isolatedEdges=new L,this._invalidPoint=null;const t=arguments[0];this._arg=t}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}computeProperIntersectionIM(t,e){const s=this._arg[0].getGeometry().getDimension(),n=this._arg[1].getGeometry().getDimension(),i=t.hasProperIntersection(),r=t.hasProperInteriorIntersection();2===s&&2===n?i&&e.setAtLeast("212101212"):2===s&&1===n?(i&&e.setAtLeast("FFF0FFFF2"),r&&e.setAtLeast("1FFFFF1FF")):1===s&&2===n?(i&&e.setAtLeast("F0FFFFFF2"),r&&e.setAtLeast("1F1FFFFFF")):1===s&&1===n&&r&&e.setAtLeast("0FFFFFFFF")}labelIsolatedEdges(t,e){for(let s=this._arg[t].getEdgeIterator();s.hasNext();){const t=s.next();t.isIsolated()&&(this.labelIsolatedEdge(t,e,this._arg[e].getGeometry()),this._isolatedEdges.add(t))}}labelIsolatedEdge(t,e,s){if(s.getDimension()>0){const n=this._ptLocator.locate(t.getCoordinate(),s);t.getLabel().setAllLocations(e,n)}else t.getLabel().setAllLocations(e,Qt.EXTERIOR)}computeIM(){const t=new Jt;if(t.set(Qt.EXTERIOR,Qt.EXTERIOR,2),!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(t),t;this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1);const e=this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(e,t);const s=new Mr,n=s.computeEdgeEnds(this._arg[0].getEdgeIterator());this.insertEdgeEnds(n);const i=s.computeEdgeEnds(this._arg[1].getEdgeIterator());return this.insertEdgeEnds(i),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(t),t}labelNodeEdges(){for(let t=this._nodes.iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}}copyNodesAndLabels(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const s=e.next();this._nodes.addNode(s.getCoordinate()).setLabel(t,s.getLabel().getLocation(t))}}labelIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const s=e.next(),n=s.getLabel().getLocation(t);for(let e=s.getEdgeIntersectionList().iterator();e.hasNext();){const s=e.next(),i=this._nodes.find(s.coord);i.getLabel().isNull(t)&&(n===Qt.BOUNDARY?i.setLabelBoundary(t):i.setLabel(t,Qt.INTERIOR))}}}labelIsolatedNode(t,e){const s=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setAllLocations(e,s)}computeIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const s=e.next(),n=s.getLabel().getLocation(t);for(let e=s.getEdgeIntersectionList().iterator();e.hasNext();){const s=e.next(),i=this._nodes.addNode(s.coord);n===Qt.BOUNDARY?i.setLabelBoundary(t):i.getLabel().isNull(t)&&i.setLabel(t,Qt.INTERIOR)}}}labelIsolatedNodes(){for(let t=this._nodes.iterator();t.hasNext();){const e=t.next(),s=e.getLabel();h.isTrue(s.getGeometryCount()>0,"node with empty label found"),e.isIsolated()&&(s.isNull(0)?this.labelIsolatedNode(e,0):this.labelIsolatedNode(e,1))}}updateIM(t){for(let e=this._isolatedEdges.iterator();e.hasNext();){e.next().updateIM(t)}for(let e=this._nodes.iterator();e.hasNext();){const s=e.next();s.updateIM(t),s.updateIMFromEdges(t)}}computeDisjointIM(t){const e=this._arg[0].getGeometry();e.isEmpty()||(t.set(Qt.INTERIOR,Qt.EXTERIOR,e.getDimension()),t.set(Qt.BOUNDARY,Qt.EXTERIOR,e.getBoundaryDimension()));const s=this._arg[1].getGeometry();s.isEmpty()||(t.set(Qt.EXTERIOR,Qt.INTERIOR,s.getDimension()),t.set(Qt.EXTERIOR,Qt.BOUNDARY,s.getBoundaryDimension()))}}class Qr{constructor(){Qr.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal()}static contains(t,e){return new Qr(t).contains(e)}isContainedInBoundary(t){if(t instanceof Ct)return!1;if(t instanceof Nt)return this.isPointContainedInBoundary(t);if(t instanceof tt)return this.isLineStringContainedInBoundary(t);for(let e=0;e<t.getNumGeometries();e++){const s=t.getGeometryN(e);if(!this.isContainedInBoundary(s))return!1}return!0}isLineSegmentContainedInBoundary(t,e){if(t.equals(e))return this.isPointContainedInBoundary(t);if(t.x===e.x){if(t.x===this._rectEnv.getMinX()||t.x===this._rectEnv.getMaxX())return!0}else if(t.y===e.y&&(t.y===this._rectEnv.getMinY()||t.y===this._rectEnv.getMaxY()))return!0;return!1}isLineStringContainedInBoundary(t){const e=t.getCoordinateSequence(),s=new m,n=new m;for(let t=0;t<e.size()-1;t++)if(e.getCoordinate(t,s),e.getCoordinate(t+1,n),!this.isLineSegmentContainedInBoundary(s,n))return!1;return!0}isPointContainedInBoundary(){if(arguments[0]instanceof Nt){const t=arguments[0];return this.isPointContainedInBoundary(t.getCoordinate())}if(arguments[0]instanceof m){const t=arguments[0];return t.x===this._rectEnv.getMinX()||t.x===this._rectEnv.getMaxX()||t.y===this._rectEnv.getMinY()||t.y===this._rectEnv.getMaxY()}}contains(t){return!!this._rectEnv.contains(t.getEnvelopeInternal())&&!this.isContainedInBoundary(t)}}class Jr{constructor(){Jr.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._rectEnv=null,this._diagUp0=null,this._diagUp1=null,this._diagDown0=null,this._diagDown1=null;const t=arguments[0];this._rectEnv=t,this._diagUp0=new m(t.getMinX(),t.getMinY()),this._diagUp1=new m(t.getMaxX(),t.getMaxY()),this._diagDown0=new m(t.getMinX(),t.getMaxY()),this._diagDown1=new m(t.getMaxX(),t.getMinY())}intersects(t,e){const s=new O(t,e);if(!this._rectEnv.intersects(s))return!1;if(this._rectEnv.intersects(t))return!0;if(this._rectEnv.intersects(e))return!0;if(t.compareTo(e)>0){const s=t;t=e,e=s}let n=!1;return e.y>t.y&&(n=!0),n?this._li.computeIntersection(t,e,this._diagDown0,this._diagDown1):this._li.computeIntersection(t,e,this._diagUp0,this._diagUp1),!!this._li.hasIntersection()}}class $r{constructor(){$r.constructor_.apply(this,arguments)}static constructor_(){this._rectangle=null,this._rectEnv=null;const t=arguments[0];this._rectangle=t,this._rectEnv=t.getEnvelopeInternal()}static intersects(t,e){return new $r(t).intersects(e)}intersects(t){if(!this._rectEnv.intersects(t.getEnvelopeInternal()))return!1;const e=new to(this._rectEnv);if(e.applyTo(t),e.intersects())return!0;const s=new eo(this._rectangle);if(s.applyTo(t),s.containsPoint())return!0;const n=new so(this._rectangle);return n.applyTo(t),!!n.intersects()}}class to extends Ne{constructor(){super(),to.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._intersects=!1;const t=arguments[0];this._rectEnv=t}intersects(){return this._intersects}visit(t){const e=t.getEnvelopeInternal();return this._rectEnv.intersects(e)?this._rectEnv.contains(e)||e.getMinX()>=this._rectEnv.getMinX()&&e.getMaxX()<=this._rectEnv.getMaxX()||e.getMinY()>=this._rectEnv.getMinY()&&e.getMaxY()<=this._rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null}isDone(){return!0===this._intersects}}class eo extends Ne{constructor(){super(),eo.constructor_.apply(this,arguments)}static constructor_(){this._rectSeq=null,this._rectEnv=null,this._containsPoint=!1;const t=arguments[0];this._rectSeq=t.getExteriorRing().getCoordinateSequence(),this._rectEnv=t.getEnvelopeInternal()}visit(t){if(!(t instanceof Ct))return null;const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const s=new m;for(let n=0;n<4;n++)if(this._rectSeq.getCoordinate(n,s),e.contains(s)&&Ze.containsPointInPolygon(s,t))return this._containsPoint=!0,null}containsPoint(){return this._containsPoint}isDone(){return!0===this._containsPoint}}class so extends Ne{constructor(){super(),so.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._rectIntersector=null,this._hasIntersection=!1,this._p0=new m,this._p1=new m;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal(),this._rectIntersector=new Jr(this._rectEnv)}intersects(){return this._hasIntersection}isDone(){return!0===this._hasIntersection}visit(t){const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const s=ye.getLines(t);this.checkIntersectionWithLineStrings(s)}checkIntersectionWithLineStrings(t){for(let e=t.iterator();e.hasNext();){const t=e.next();if(this.checkIntersectionWithSegments(t),this._hasIntersection)return null}}checkIntersectionWithSegments(t){const e=t.getCoordinateSequence();for(let t=1;t<e.size();t++)if(e.getCoordinate(t-1,this._p0),e.getCoordinate(t,this._p1),this._rectIntersector.intersects(this._p0,this._p1))return this._hasIntersection=!0,null}}class no extends ri{constructor(){super(),no.constructor_.apply(this,arguments)}static constructor_(){if(this._relate=null,2===arguments.length){const t=arguments[0],e=arguments[1];ri.constructor_.call(this,t,e),this._relate=new Kr(this._arg)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];ri.constructor_.call(this,t,e,s),this._relate=new Kr(this._arg)}}static equalsTopo(t,e){return!!t.getEnvelopeInternal().equals(e.getEnvelopeInternal())&&no.relate(t,e).isEquals(t.getDimension(),e.getDimension())}static relate(){if(2===arguments.length){return new no(arguments[0],arguments[1]).getIntersectionMatrix()}if(3===arguments.length){return new no(arguments[0],arguments[1],arguments[2]).getIntersectionMatrix()}}static overlaps(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new no(t,e).getIntersectionMatrix().isOverlaps(t.getDimension(),e.getDimension())}static disjoint(t,e){return!no.intersects(t,e)}static covers(t,e){return!(2===e.getDimension()&&t.getDimension()<2)&&(!(1===e.getDimension()&&t.getDimension()<1&&e.getLength()>0)&&(!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||new no(t,e).getIntersectionMatrix().isCovers())))}static intersects(t,e){if(!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal()))return!1;if(t.isRectangle())return $r.intersects(t,e);if(e.isRectangle())return $r.intersects(e,t);if(t.isGeometryCollection()||e.isGeometryCollection()){for(let s=0;s<t.getNumGeometries();s++)for(let n=0;n<e.getNumGeometries();n++)if(no.intersects(t.getGeometryN(s),e.getGeometryN(n)))return!0;return!1}return new no(t,e).getIntersectionMatrix().isIntersects()}static touches(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new no(t,e).getIntersectionMatrix().isTouches(t.getDimension(),e.getDimension())}static crosses(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new no(t,e).getIntersectionMatrix().isCrosses(t.getDimension(),e.getDimension())}static contains(t,e){return!(2===e.getDimension()&&t.getDimension()<2)&&(!(1===e.getDimension()&&t.getDimension()<1&&e.getLength()>0)&&(!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Qr.contains(t,e):new no(t,e).getIntersectionMatrix().isContains())))}getIntersectionMatrix(){return this._relate.computeIM()}}var io=Object.freeze({__proto__:null,RelateOp:no});class ro{constructor(){ro.constructor_.apply(this,arguments)}static constructor_(){this._geomFactory=null,this._polygons=new L,this._lines=new L,this._points=new L,this._dimension=Z.FALSE}static extract(){if(I(arguments[0],N)){const t=arguments[0],e=new ro;return e.add(t),e}if(arguments[0]instanceof j){const t=arguments[0],e=new ro;return e.add(t),e}}getFactory(){return this._geomFactory}filter(t){return this.recordDimension(t.getDimension()),t instanceof ut||t.isEmpty()?null:t instanceof Ct?(this._polygons.add(t),null):t instanceof tt?(this._lines.add(t),null):t instanceof Nt?(this._points.add(t),null):void h.shouldNeverReachHere("Unhandled geometry type: "+t.getGeometryType())}getExtract(t){switch(t){case 0:return this._points;case 1:return this._lines;case 2:return this._polygons}return h.shouldNeverReachHere("Invalid dimension: "+t),null}recordDimension(t){t>this._dimension&&(this._dimension=t)}getDimension(){return this._dimension}isEmpty(){return this._polygons.isEmpty()&&this._lines.isEmpty()&&this._points.isEmpty()}add(){if(I(arguments[0],N)){const t=arguments[0];for(const e of t)this.add(e)}else if(arguments[0]instanceof j){const t=arguments[0];null===this._geomFactory&&(this._geomFactory=t.getFactory()),t.apply(this)}}get interfaces_(){return[$]}}class oo{constructor(){oo.constructor_.apply(this,arguments)}static constructor_(){this._pointGeom=null,this._otherGeom=null,this._geomFact=null;const t=arguments[0],e=arguments[1];this._pointGeom=t,this._otherGeom=e,this._geomFact=e.getFactory()}static union(t,e){return new oo(t,e).union()}union(){const t=new Zn,e=new at;for(let s=0;s<this._pointGeom.getNumGeometries();s++){const n=this._pointGeom.getGeometryN(s).getCoordinate();t.locate(n,this._otherGeom)===Qt.EXTERIOR&&e.add(n)}if(0===e.size())return this._otherGeom;let s=null;const n=W.toCoordinateArray(e);return s=1===n.length?this._geomFact.createPoint(n[0]):this._geomFact.createMultiPointFromCoords(n),he.combine(s,this._otherGeom)}}class lo{constructor(){lo.constructor_.apply(this,arguments)}static constructor_(){this._geomFactory=null,this._g0=null,this._g1=null,this._isUnionSafe=null;const t=arguments[0],e=arguments[1];this._g0=t,this._g1=e,this._geomFactory=t.getFactory()}static containsProperly(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return!t.isNull()&&(e.getX()>t.getMinX()&&e.getX()<t.getMaxX()&&e.getY()>t.getMinY()&&e.getY()<t.getMaxY())}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return lo.containsProperly(t,e)&&lo.containsProperly(t,s)}}static union(t,e){return new lo(t,e).union()}static intersects(t,e,s){return t.intersects(e)||t.intersects(s)}static overlapEnvelope(t,e){const s=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();return s.intersection(n)}static extractBorderSegments(t,e,s){t.apply(new class{get interfaces_(){return[P]}filter(t,n){if(n<=0)return null;const i=t.getCoordinate(n-1),r=t.getCoordinate(n);if(lo.intersects(e,i,r)&&!lo.containsProperly(e,i,r)){const t=new Kt(i,r);s.add(t)}}isDone(){return!1}isGeometryChanged(){return!1}})}static unionBuffer(t,e){const s=t.getFactory().createGeometryCollection([t,e]);return bn.bufferOp(s,0)}isBorderSegmentsSame(t,e){const s=this.extractBorderSegments(this._g0,this._g1,e),n=new L;return lo.extractBorderSegments(t,e,n),this.isEqual(s,n)}union(){const t=lo.overlapEnvelope(this._g0,this._g1);if(t.isNull()){const t=this._g0.copy(),e=this._g1.copy();return he.combine(t,e)}const e=new L,s=this.extractByEnvelope(t,this._g0,e),n=this.extractByEnvelope(t,this._g1,e),i=this.unionFull(s,n);let r=null;return this._isUnionSafe=this.isBorderSegmentsSame(i,t),r=this._isUnionSafe?this.combine(i,e):this.unionFull(this._g0,this._g1),r}extractBorderSegments(t,e,s){const n=new L;return lo.extractBorderSegments(t,s,n),null!==e&&lo.extractBorderSegments(e,s,n),n}isUnionOptimized(){return this._isUnionSafe}extractByEnvelope(t,e,s){const n=new L;for(let i=0;i<e.getNumGeometries();i++){const r=e.getGeometryN(i);if(r.getEnvelopeInternal().intersects(t))n.add(r);else{const t=r.copy();s.add(t)}}return this._geomFactory.buildGeometry(n)}isEqual(t,e){if(t.size()!==e.size())return!1;const s=new pt(t);for(const t of e)if(!s.contains(t))return!1;return!0}combine(t,e){if(e.size()<=0)return t;e.add(t);return he.combine(e)}unionFull(t,e){try{return ci.union(t,e)}catch(s){if(s instanceof _s)return lo.unionBuffer(t,e);throw s}}}class ao{constructor(){ao.constructor_.apply(this,arguments)}static constructor_(){this._inputPolys=null,this._geomFactory=null;const t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new L)}static getGeometry(t,e){return e>=t.size()?null:t.get(e)}static union(t){return new ao(t).union()}static restrictToPolygons(t){if(I(t,gt))return t;const e=Ie.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Lt.toPolygonArray(e))}reduceToGeometries(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();let n=null;I(t,C)?n=this.unionTree(t):t instanceof j&&(n=t),e.add(n)}return e}union(){if(null===this._inputPolys)throw new D("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();const t=new Os(ao.STRTREE_NODE_CAPACITY);for(let e=this._inputPolys.iterator();e.hasNext();){const s=e.next();t.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;const e=t.itemsTree();return this.unionTree(e)}binaryUnion(){if(1===arguments.length){const t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(s-e<=1){const s=ao.getGeometry(t,e);return this.unionSafe(s,null)}if(s-e==2)return this.unionSafe(ao.getGeometry(t,e),ao.getGeometry(t,e+1));{const n=Math.trunc((s+e)/2),i=this.binaryUnion(t,e,n),r=this.binaryUnion(t,n,s);return this.unionSafe(i,r)}}}unionSafe(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionActual(t,e)}unionActual(t,e){const s=lo.union(t,e);return ao.restrictToPolygons(s)}unionTree(t){const e=this.reduceToGeometries(t);return this.binaryUnion(e)}}ao.STRTREE_NODE_CAPACITY=4;class co{constructor(){co.constructor_.apply(this,arguments)}static constructor_(){if(this._geomFact=null,this._extracter=null,1===arguments.length){if(I(arguments[0],N)){const t=arguments[0];this.extract(t)}else if(arguments[0]instanceof j){const t=arguments[0];this.extract(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._geomFact=e,this.extract(t)}}static union(){if(1===arguments.length){if(I(arguments[0],N)){return new co(arguments[0]).union()}if(arguments[0]instanceof j){return new co(arguments[0]).union()}}else if(2===arguments.length){return new co(arguments[0],arguments[1]).union()}}extract(){if(I(arguments[0],N)){const t=arguments[0];this._extracter=ro.extract(t)}else if(arguments[0]instanceof j){const t=arguments[0];this._extracter=ro.extract(t)}}unionWithNull(t,e){return null===t&&null===e?null:null===e?t:null===t?e:oi.union(t,e)}unionNoOpt(t){const e=this._geomFact.createPoint();return ai.overlayOp(t,e,oi.UNION)}union(){if(null===this._geomFact&&(this._geomFact=this._extracter.getFactory()),null===this._geomFact)return null;if(this._extracter.isEmpty())return this._geomFact.createEmpty(this._extracter.getDimension());const t=this._extracter.getExtract(0),e=this._extracter.getExtract(1),s=this._extracter.getExtract(2);let n=null;if(t.size()>0){const e=this._geomFact.buildGeometry(t);n=this.unionNoOpt(e)}let i=null;if(e.size()>0){const t=this._geomFact.buildGeometry(e);i=this.unionNoOpt(t)}let r=null;s.size()>0&&(r=ao.union(s));const o=this.unionWithNull(i,r);let l=null;return l=null===n?o:null===o?n:oo.union(n,o),null===l?this._geomFact.createGeometryCollection():l}}var ho=Object.freeze({__proto__:null,UnaryUnionOp:co}),uo=Object.freeze({__proto__:null,ConsistentAreaTester:qr,IsValidOp:zr}),go=Object.freeze({__proto__:null,BoundaryOp:ir,IsSimpleOp:or,buffer:ar,distance:gr,linemerge:Rr,overlay:Or,polygonize:jr,relate:io,union:ho,valid:uo});class _o{constructor(){_o.constructor_.apply(this,arguments)}static constructor_(){if(this._returnToOriginalPrecision=!0,this._cbr=null,0===arguments.length)_o.constructor_.call(this,!0);else if(1===arguments.length){const t=arguments[0];this._returnToOriginalPrecision=t}}computeResultPrecision(t){return this._returnToOriginalPrecision&&this._cbr.addCommonBits(t),t}union(t,e){const s=this.removeCommonBits(t,e);return this.computeResultPrecision(ci.union(s[0],s[1]))}intersection(t,e){const s=this.removeCommonBits(t,e);return this.computeResultPrecision(oi.intersection(s[0],s[1]))}removeCommonBits(){if(1===arguments.length){const t=arguments[0];this._cbr=new qn,this._cbr.add(t);return this._cbr.removeCommonBits(t.copy())}if(2===arguments.length){const t=arguments[0],e=arguments[1];this._cbr=new qn,this._cbr.add(t),this._cbr.add(e);const s=new Array(2).fill(null);return s[0]=this._cbr.removeCommonBits(t.copy()),s[1]=this._cbr.removeCommonBits(e.copy()),s}}buffer(t,e){const s=this.removeCommonBits(t);return this.computeResultPrecision(bn.bufferOp(s,e))}symDifference(t,e){const s=this.removeCommonBits(t,e);return this.computeResultPrecision(oi.symDifference(s[0],s[1]))}difference(t,e){const s=this.removeCommonBits(t,e);return this.computeResultPrecision(oi.difference(s[0],s[1]))}}class po extends ue.CoordinateOperation{constructor(){super(),po.constructor_.apply(this,arguments)}static constructor_(){this._targetPM=null,this._removeCollapsed=!0;const t=arguments[0],e=arguments[1];this._targetPM=t,this._removeCollapsed=e}edit(){if(2===arguments.length&&arguments[1]instanceof j&&arguments[0]instanceof Array){const t=arguments[0],e=arguments[1];if(0===t.length)return null;const s=new Array(t.length).fill(null);for(let e=0;e<t.length;e++){const n=new m(t[e]);this._targetPM.makePrecise(n),s[e]=n}const n=new R(s,!1).toCoordinateArray();let i=0;e instanceof tt&&(i=2),e instanceof et&&(i=4);let r=s;return this._removeCollapsed&&(r=null),n.length<i?r:n}return super.edit.apply(this,arguments)}}class mo{constructor(){mo.constructor_.apply(this,arguments)}static constructor_(){this._targetPM=null,this._removeCollapsed=!0,this._changePrecisionModel=!1,this._isPointwise=!1;const t=arguments[0];this._targetPM=t}static reduce(t,e){return new mo(e).reduce(t)}static reducePointwise(t,e){const s=new mo(e);return s.setPointwise(!0),s.reduce(t)}fixPolygonalTopology(t){let e=t;this._changePrecisionModel||(e=this.changePM(t,this._targetPM));return bn.bufferOp(e,0)}reducePointwise(t){let e=null;if(this._changePrecisionModel){const s=this.createFactory(t.getFactory(),this._targetPM);e=new ue(s)}else e=new ue;let s=this._removeCollapsed;t.getDimension()>=2&&(s=!0);return e.edit(t,new po(this._targetPM,s))}changePM(t,e){return this.createEditor(t.getFactory(),e).edit(t,new ue.NoOpGeometryOperation)}setRemoveCollapsedComponents(t){this._removeCollapsed=t}createFactory(t,e){return new Lt(e,t.getSRID(),t.getCoordinateSequenceFactory())}setChangePrecisionModel(t){this._changePrecisionModel=t}reduce(t){const e=this.reducePointwise(t);return this._isPointwise?e:I(e,gt)?zr.isValid(e)?e:this.fixPolygonalTopology(e):e}setPointwise(t){this._isPointwise=t}createEditor(t,e){if(t.getPrecisionModel()===e)return new ue;const s=this.createFactory(t,e);return new ue(s)}}class fo{constructor(){fo.constructor_.apply(this,arguments)}static constructor_(){if(this._geom=null,this._pts=null,this._start=null,this._end=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._pts=t,this._start=e,this._end=e+1}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._pts=t,this._start=e,this._end=s}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this._geom=t,this._pts=e,this._start=s,this._end=n}}size(){return this._end-this._start}getCoordinate(t){return this._pts.getCoordinate(this._start+t)}updateNearestLocationsLineLine(t,e,s,n,i,r,o,l){const a=new Kt(e,s),c=new Kt(r,o),h=a.closestPoints(c);l[0]=new cr(this._geom,t,new m(h[0])),l[1]=new cr(n._geom,i,new m(h[1]))}toString(){const t=new v;t.append("LINESTRING ( ");const e=new m;for(let s=this._start;s<this._end;s++)s>this._start&&t.append(", "),this._pts.getCoordinate(s,e),t.append(e.x+" "+e.y);return t.append(" )"),t.toString()}computeDistancePointLine(t,e,s){let n=r.MAX_VALUE;for(let i=e._start;i<e._end-1;i++){const r=e._pts.getCoordinate(i),o=e._pts.getCoordinate(i+1),l=V.pointToSegment(t,r,o);if(l<n&&(n=l,null!==s&&this.updateNearestLocationsPointLine(t,e,i,r,o,s),n<=0))return n}return n}isPoint(){return this._end-this._start==1}distance(t){const e=this.isPoint(),s=t.isPoint();let n=null;if(e&&s){const e=this._pts.getCoordinate(this._start),s=t._pts.getCoordinate(t._start);n=e.distance(s)}else if(e){const e=this._pts.getCoordinate(this._start);n=this.computeDistancePointLine(e,t,null)}else if(s){const e=t._pts.getCoordinate(t._start);n=this.computeDistancePointLine(e,this,null)}else n=this.computeDistanceLineLine(t,null);return n}computeDistanceLineLine(t,e){let s=r.MAX_VALUE;for(let n=this._start;n<this._end-1;n++){const i=this._pts.getCoordinate(n),r=this._pts.getCoordinate(n+1);for(let o=t._start;o<t._end-1;o++){const l=t._pts.getCoordinate(o),a=t._pts.getCoordinate(o+1),c=V.segmentToSegment(i,r,l,a);if(c<s&&(s=c,null!==e&&this.updateNearestLocationsLineLine(n,i,r,t,o,l,a,e),s<=0))return s}}return s}updateNearestLocationsPointLine(t,e,s,n,i,r){r[0]=new cr(this._geom,this._start,new m(t));const o=new Kt(n,i).closestPoint(t);r[1]=new cr(e._geom,s,new m(o))}nearestLocations(t){const e=this.isPoint(),s=t.isPoint(),n=new Array(2).fill(null);if(e&&s){const e=this._pts.getCoordinate(this._start),s=t._pts.getCoordinate(t._start);n[0]=new cr(this._geom,this._start,new m(e)),n[1]=new cr(t._geom,t._start,new m(s))}else if(e){const e=this._pts.getCoordinate(this._start);this.computeDistancePointLine(e,t,n)}else if(s){const e=t._pts.getCoordinate(t._start);this.computeDistancePointLine(e,this,n);const s=n[0];n[0]=n[1],n[1]=s}else this.computeDistanceLineLine(t,n);return n}getEnvelope(){const t=new O;for(let e=this._start;e<this._end;e++)t.expandToInclude(this._pts.getX(e),this._pts.getY(e));return t}}class yo{static addFacetSequences(t,e,s){let n=0;const i=e.size();for(;n<=i-1;){let r=n+yo.FACET_SEQUENCE_SIZE+1;r>=i-1&&(r=i);const o=new fo(t,e,n,r);s.add(o),n+=yo.FACET_SEQUENCE_SIZE}}static build(t){const e=new Os(yo.STR_TREE_NODE_CAPACITY);for(let s=yo.computeFacetSequences(t).iterator();s.hasNext();){const t=s.next();e.insert(t.getEnvelope(),t)}return e.build(),e}static computeFacetSequences(t){const e=new L;return t.apply(new class{get interfaces_(){return[X]}filter(t){let s=null;(t instanceof tt||t instanceof Nt)&&(s=t.getCoordinateSequence(),yo.addFacetSequences(t,s,e))}}),e}}yo.FACET_SEQUENCE_SIZE=6,yo.STR_TREE_NODE_CAPACITY=4;class xo{constructor(){xo.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._minClearance=null,this._minClearancePts=null;const t=arguments[0];this._inputGeom=t}static getDistance(t){return new xo(t).getDistance()}static getLine(t){return new xo(t).getLine()}getDistance(){return this.compute(),this._minClearance}compute(){if(null!==this._minClearancePts)return null;if(this._minClearancePts=new Array(2).fill(null),this._minClearance=r.MAX_VALUE,this._inputGeom.isEmpty())return null;const t=yo.build(this._inputGeom).nearestNeighbour(new Eo),e=new Eo;this._minClearance=e.distance(t[0],t[1]),this._minClearancePts=e.getCoordinates()}getLine(){return this.compute(),null===this._minClearancePts||null===this._minClearancePts[0]?this._inputGeom.getFactory().createLineString():this._inputGeom.getFactory().createLineString(this._minClearancePts)}}class Eo{constructor(){Eo.constructor_.apply(this,arguments)}static constructor_(){this._minDist=r.MAX_VALUE,this._minPts=new Array(2).fill(null)}vertexDistance(t,e){for(let s=0;s<t.size();s++)for(let n=0;n<e.size();n++){const i=t.getCoordinate(s),r=e.getCoordinate(n);if(!i.equals2D(r)){const t=i.distance(r);if(t<this._minDist&&(this._minDist=t,this._minPts[0]=i,this._minPts[1]=r,0===t))return t}}return this._minDist}getCoordinates(){return this._minPts}segmentDistance(t,e){for(let s=0;s<t.size();s++)for(let n=1;n<e.size();n++){const i=t.getCoordinate(s),r=e.getCoordinate(n-1),o=e.getCoordinate(n);if(!i.equals2D(r)&&!i.equals2D(o)){const t=V.pointToSegment(i,r,o);if(t<this._minDist&&(this._minDist=t,this.updatePts(i,r,o),0===t))return t}}return this._minDist}distance(){if(arguments[0]instanceof fs&&arguments[1]instanceof fs){const t=arguments[1],e=arguments[0].getItem(),s=t.getItem();return this._minDist=r.MAX_VALUE,this.distance(e,s)}if(arguments[0]instanceof fo&&arguments[1]instanceof fo){const t=arguments[0],e=arguments[1];return this.vertexDistance(t,e),1===t.size()&&1===e.size()?this._minDist:this._minDist<=0?this._minDist:(this.segmentDistance(t,e),this._minDist<=0||this.segmentDistance(e,t),this._minDist)}}updatePts(t,e,s){this._minPts[0]=t;const n=new Kt(e,s);this._minPts[1]=new m(n.closestPoint(t))}get interfaces_(){return[Ps]}}xo.MinClearanceDistance=Eo;class Io{constructor(){Io.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._minClearance=null,this._minClearancePts=null;const t=arguments[0];this._inputGeom=t}static getDistance(t){return new Io(t).getDistance()}static getLine(t){return new Io(t).getLine()}getDistance(){return this.compute(),this._minClearance}compute(){if(null!==this._minClearancePts)return null;this._minClearancePts=new Array(2).fill(null),this._minClearance=r.MAX_VALUE,this._inputGeom.apply(new No(this))}updateClearance(){if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];t<this._minClearance&&(this._minClearance=t,this._minClearancePts[0]=new m(e),this._minClearancePts[1]=new m(s))}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];if(t<this._minClearance){this._minClearance=t,this._minClearancePts[0]=new m(e);const i=new Kt(s,n);this._minClearancePts[1]=new m(i.closestPoint(e))}}}getLine(){return this.compute(),this._inputGeom.getFactory().createLineString(this._minClearancePts)}}class No{constructor(){No.constructor_.apply(this,arguments)}static constructor_(){this.smc=null;const t=arguments[0];this.smc=t}filter(t){this.smc._inputGeom.apply(new wo(this.smc,t))}get interfaces_(){return[K]}}class wo{constructor(){wo.constructor_.apply(this,arguments)}static constructor_(){this.smc=null,this._queryPt=null;const t=arguments[0],e=arguments[1];this.smc=t,this._queryPt=e}filter(t,e){this.checkVertexDistance(t.getCoordinate(e)),e>0&&this.checkSegmentDistance(t.getCoordinate(e-1),t.getCoordinate(e))}checkSegmentDistance(t,e){if(this._queryPt.equals2D(t)||this._queryPt.equals2D(e))return null;const s=V.pointToSegment(this._queryPt,e,t);s>0&&this.smc.updateClearance(s,this._queryPt,e,t)}isDone(){return!1}isGeometryChanged(){return!1}checkVertexDistance(t){const e=t.distance(this._queryPt);e>0&&this.smc.updateClearance(e,this._queryPt,t)}get interfaces_(){return[P]}}Io.VertexCoordinateFilter=No,Io.ComputeMCCoordinateSequenceFilter=wo;var Co=Object.freeze({__proto__:null,CommonBits:Gn,CommonBitsOp:_o,CommonBitsRemover:qn,EnhancedPrecisionOp:class{static union(t,e){let s=null;try{return ci.union(t,e)}catch(t){if(!(t instanceof a))throw t;s=t}try{const n=new _o(!0).union(t,e);if(!n.isValid())throw s;return n}catch(t){throw t instanceof a?s:t}}static intersection(t,e){let s=null;try{return oi.intersection(t,e)}catch(t){if(!(t instanceof a))throw t;s=t}try{const n=new _o(!0).intersection(t,e);if(!n.isValid())throw s;return n}catch(t){throw t instanceof a?s:t}}static buffer(t,e){let s=null;try{return bn.bufferOp(t,e)}catch(t){if(!(t instanceof a))throw t;s=t}try{const n=new _o(!0).buffer(t,e);if(!n.isValid())throw s;return n}catch(t){throw t instanceof a?s:t}}static symDifference(t,e){let s=null;try{return oi.symDifference(t,e)}catch(t){if(!(t instanceof a))throw t;s=t}try{const n=new _o(!0).symDifference(t,e);if(!n.isValid())throw s;return n}catch(t){throw t instanceof a?s:t}}static difference(t,e){let s=null;try{return oi.difference(t,e)}catch(t){if(!(t instanceof a))throw t;s=t}try{const n=new _o(!0).difference(t,e);if(!n.isValid())throw s;return n}catch(t){throw t instanceof a?s:t}}},GeometryPrecisionReducer:mo,MinimumClearance:xo,SimpleMinimumClearance:Io});class So{constructor(){So.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._usePt=null,this._distanceTolerance=null,this._seg=new Kt;const t=arguments[0];this._pts=t}static simplify(t,e){const s=new So(t);return s.setDistanceTolerance(e),s.simplify()}setDistanceTolerance(t){this._distanceTolerance=t}simplifySection(t,e){if(t+1===e)return null;this._seg.p0=this._pts[t],this._seg.p1=this._pts[e];let s=-1,n=t;for(let i=t+1;i<e;i++){const t=this._seg.distance(this._pts[i]);t>s&&(s=t,n=i)}if(s<=this._distanceTolerance)for(let s=t+1;s<e;s++)this._usePt[s]=!1;else this.simplifySection(t,n),this.simplifySection(n,e)}simplify(){this._usePt=new Array(this._pts.length).fill(null);for(let t=0;t<this._pts.length;t++)this._usePt[t]=!0;this.simplifySection(0,this._pts.length-1);const t=new R;for(let e=0;e<this._pts.length;e++)this._usePt[e]&&t.add(new m(this._pts[e]));return t.toCoordinateArray()}}class Lo{constructor(){Lo.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distanceTolerance=null,this._isEnsureValidTopology=!0;const t=arguments[0];this._inputGeom=t}static simplify(t,e){const s=new Lo(t);return s.setDistanceTolerance(e),s.getResultGeometry()}setDistanceTolerance(t){if(t<0)throw new n("Tolerance must be non-negative");this._distanceTolerance=t}getResultGeometry(){return this._inputGeom.isEmpty()?this._inputGeom.copy():new To(this._isEnsureValidTopology,this._distanceTolerance).transform(this._inputGeom)}setEnsureValid(t){this._isEnsureValidTopology=t}}class To extends me{constructor(){super(),To.constructor_.apply(this,arguments)}static constructor_(){this._isEnsureValidTopology=!0,this._distanceTolerance=null;const t=arguments[0],e=arguments[1];this._isEnsureValidTopology=t,this._distanceTolerance=e}transformPolygon(t,e){if(t.isEmpty())return null;const s=super.transformPolygon.call(this,t,e);return e instanceof dt?s:this.createValidArea(s)}createValidArea(t){return this._isEnsureValidTopology?bn.bufferOp(t,0):t}transformCoordinates(t,e){const s=t.toCoordinateArray();let n=null;return n=0===s.length?new Array(0).fill(null):So.simplify(s,this._distanceTolerance),this._factory.getCoordinateSequenceFactory().create(n)}transformMultiPolygon(t,e){const s=super.transformMultiPolygon.call(this,t,e);return this.createValidArea(s)}transformLinearRing(t,e){const s=e instanceof Ct,n=super.transformLinearRing.call(this,t,e);return!s||n instanceof et?n:null}}Lo.DPTransformer=To;class Ro extends Kt{constructor(){super(),Ro.constructor_.apply(this,arguments)}static constructor_(){if(this._parent=null,this._index=null,2===arguments.length){const t=arguments[0],e=arguments[1];Ro.constructor_.call(this,t,e,null,-1)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];Kt.constructor_.call(this,t,e),this._parent=s,this._index=n}}getParent(){return this._parent}getIndex(){return this._index}}class Po{constructor(){Po.constructor_.apply(this,arguments)}static constructor_(){if(this._parentLine=null,this._segs=null,this._resultSegs=new L,this._minimumSize=null,1===arguments.length){const t=arguments[0];Po.constructor_.call(this,t,2)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._parentLine=t,this._minimumSize=e,this.init()}}static extractCoordinates(t){const e=new Array(t.size()+1).fill(null);let s=null;for(let n=0;n<t.size();n++)s=t.get(n),e[n]=s.p0;return e[e.length-1]=s.p1,e}addToResult(t){this._resultSegs.add(t)}asLineString(){return this._parentLine.getFactory().createLineString(Po.extractCoordinates(this._resultSegs))}getResultSize(){const t=this._resultSegs.size();return 0===t?0:t+1}getParentCoordinates(){return this._parentLine.getCoordinates()}getMinimumSize(){return this._minimumSize}asLinearRing(){return this._parentLine.getFactory().createLinearRing(Po.extractCoordinates(this._resultSegs))}getSegments(){return this._segs}init(){const t=this._parentLine.getCoordinates();this._segs=new Array(t.length-1).fill(null);for(let e=0;e<t.length-1;e++){const s=new Ro(t[e],t[e+1],this._parentLine,e);this._segs[e]=s}}getResultCoordinates(){return Po.extractCoordinates(this._resultSegs)}getParent(){return this._parentLine}getSegment(t){return this._segs[t]}}class Oo{constructor(){Oo.constructor_.apply(this,arguments)}static constructor_(){this._index=new Wi}add(){if(arguments[0]instanceof Po){const t=arguments[0].getSegments();for(let e=0;e<t.length;e++){const s=t[e];this.add(s)}}else if(arguments[0]instanceof Kt){const t=arguments[0];this._index.insert(new O(t.p0,t.p1),t)}}query(t){const e=new O(t.p0,t.p1),s=new vo(t);this._index.query(e,s);return s.getItems()}remove(t){this._index.remove(new O(t.p0,t.p1),t)}}class vo{constructor(){vo.constructor_.apply(this,arguments)}static constructor_(){this._querySeg=null,this._items=new L;const t=arguments[0];this._querySeg=t}getItems(){return this._items}visitItem(t){const e=t;O.intersects(e.p0,e.p1,this._querySeg.p0,this._querySeg.p1)&&this._items.add(t)}get interfaces_(){return[De]}}class Mo{constructor(){Mo.constructor_.apply(this,arguments)}static constructor_(){this._li=new jt,this._inputIndex=new Oo,this._outputIndex=new Oo,this._line=null,this._linePts=null,this._distanceTolerance=0;const t=arguments[0],e=arguments[1];this._inputIndex=t,this._outputIndex=e}static isInLineSection(t,e,s){if(s.getParent()!==t.getParent())return!1;const n=s.getIndex();return n>=e[0]&&n<e[1]}flatten(t,e){const s=this._linePts[t],n=this._linePts[e],i=new Kt(s,n);return this.remove(this._line,t,e),this._outputIndex.add(i),i}hasBadIntersection(t,e,s){return!!this.hasBadOutputIntersection(s)||!!this.hasBadInputIntersection(t,e,s)}setDistanceTolerance(t){this._distanceTolerance=t}simplifySection(t,e,s){s+=1;const n=new Array(2).fill(null);if(t+1===e){const e=this._line.getSegment(t);return this._line.addToResult(e),null}let i=!0;if(this._line.getResultSize()<this._line.getMinimumSize()){s+1<this._line.getMinimumSize()&&(i=!1)}const r=new Array(1).fill(null),o=this.findFurthestPoint(this._linePts,t,e,r);r[0]>this._distanceTolerance&&(i=!1);const l=new Kt;if(l.p0=this._linePts[t],l.p1=this._linePts[e],n[0]=t,n[1]=e,this.hasBadIntersection(this._line,n,l)&&(i=!1),i){const s=this.flatten(t,e);return this._line.addToResult(s),null}this.simplifySection(t,o,s),this.simplifySection(o,e,s)}hasBadOutputIntersection(t){for(let e=this._outputIndex.query(t).iterator();e.hasNext();){const s=e.next();if(this.hasInteriorIntersection(s,t))return!0}return!1}hasInteriorIntersection(t,e){return this._li.computeIntersection(t.p0,t.p1,e.p0,e.p1),this._li.isInteriorIntersection()}hasBadInputIntersection(t,e,s){for(let n=this._inputIndex.query(s).iterator();n.hasNext();){const i=n.next();if(this.hasInteriorIntersection(i,s)){if(Mo.isInLineSection(t,e,i))continue;return!0}}return!1}findFurthestPoint(t,e,s,n){const i=new Kt;i.p0=t[e],i.p1=t[s];let r=-1,o=e;for(let n=e+1;n<s;n++){const e=t[n],s=i.distance(e);s>r&&(r=s,o=n)}return n[0]=r,o}simplify(t){this._line=t,this._linePts=t.getParentCoordinates(),this.simplifySection(0,this._linePts.length-1,0)}remove(t,e,s){for(let n=e;n<s;n++){const e=t.getSegment(n);this._inputIndex.remove(e)}}}class bo{constructor(){bo.constructor_.apply(this,arguments)}static constructor_(){this._inputIndex=new Oo,this._outputIndex=new Oo,this._distanceTolerance=0}setDistanceTolerance(t){this._distanceTolerance=t}simplify(t){for(let e=t.iterator();e.hasNext();)this._inputIndex.add(e.next());for(let e=t.iterator();e.hasNext();){const t=new Mo(this._inputIndex,this._outputIndex);t.setDistanceTolerance(this._distanceTolerance),t.simplify(e.next())}}}class Do{constructor(){Do.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._lineSimplifier=new bo,this._linestringMap=null;const t=arguments[0];this._inputGeom=t}static simplify(t,e){const s=new Do(t);return s.setDistanceTolerance(e),s.getResultGeometry()}setDistanceTolerance(t){if(t<0)throw new n("Tolerance must be non-negative");this._lineSimplifier.setDistanceTolerance(t)}getResultGeometry(){if(this._inputGeom.isEmpty())return this._inputGeom.copy();this._linestringMap=new ft,this._inputGeom.apply(new Fo(this)),this._lineSimplifier.simplify(this._linestringMap.values());return new Ao(this._linestringMap).transform(this._inputGeom)}}class Ao extends me{constructor(){super(),Ao.constructor_.apply(this,arguments)}static constructor_(){this._linestringMap=null;const t=arguments[0];this._linestringMap=t}transformCoordinates(t,e){if(0===t.size())return null;if(e instanceof tt){const t=this._linestringMap.get(e);return this.createCoordinateSequence(t.getResultCoordinates())}return super.transformCoordinates.call(this,t,e)}}class Fo{constructor(){Fo.constructor_.apply(this,arguments)}static constructor_(){this.tps=null;const t=arguments[0];this.tps=t}filter(t){if(t instanceof tt){const e=t;if(e.isEmpty())return null;const s=e.isClosed()?4:2,n=new Po(e,s);this.tps._linestringMap.put(e,n)}}get interfaces_(){return[X]}}Do.LineStringTransformer=Ao,Do.LineStringMapBuilderFilter=Fo;class Go{constructor(){Go.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._tolerance=null;const t=arguments[0],e=arguments[1];this._pts=t,this._tolerance=e*e}static simplify(t,e){return new Go(t,e).simplify()}simplifyVertex(t){let e=t,s=e.getArea(),n=null;for(;null!==e;){const t=e.getArea();t<s&&(s=t,n=e),e=e._next}return null!==n&&s<this._tolerance&&n.remove(),t.isLive()?s:-1}simplify(){const t=qo.buildLine(this._pts);let e=this._tolerance;do{e=this.simplifyVertex(t)}while(e<this._tolerance);const s=t.getCoordinates();return s.length<2?[s[0],new m(s[0])]:s}}class qo{constructor(){qo.constructor_.apply(this,arguments)}static constructor_(){this._pt=null,this._prev=null,this._next=null,this._area=qo.MAX_AREA,this._isLive=!0;const t=arguments[0];this._pt=t}static buildLine(t){let e=null,s=null;for(let n=0;n<t.length;n++){const i=new qo(t[n]);null===e&&(e=i),i.setPrev(s),null!==s&&(s.setNext(i),s.updateArea()),s=i}return e}getCoordinates(){const t=new R;let e=this;do{t.add(e._pt,!1),e=e._next}while(null!==e);return t.toCoordinateArray()}getArea(){return this._area}updateArea(){if(null===this._prev||null===this._next)return this._area=qo.MAX_AREA,null;this._area=Math.abs(se.area(this._prev._pt,this._pt,this._next._pt))}remove(){const t=this._prev,e=this._next;let s=null;return null!==this._prev&&(this._prev.setNext(e),this._prev.updateArea(),s=this._prev),null!==this._next&&(this._next.setPrev(t),this._next.updateArea(),null===s&&(s=this._next)),this._isLive=!1,s}isLive(){return this._isLive}setPrev(t){this._prev=t}setNext(t){this._next=t}}qo.MAX_AREA=r.MAX_VALUE,Go.VWVertex=qo;class Bo{constructor(){Bo.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distanceTolerance=null,this._isEnsureValidTopology=!0;const t=arguments[0];this._inputGeom=t}static simplify(t,e){const s=new Bo(t);return s.setDistanceTolerance(e),s.getResultGeometry()}setDistanceTolerance(t){if(t<0)throw new n("Tolerance must be non-negative");this._distanceTolerance=t}getResultGeometry(){return this._inputGeom.isEmpty()?this._inputGeom.copy():new Yo(this._isEnsureValidTopology,this._distanceTolerance).transform(this._inputGeom)}setEnsureValid(t){this._isEnsureValidTopology=t}}class Yo extends me{constructor(){super(),Yo.constructor_.apply(this,arguments)}static constructor_(){this._isEnsureValidTopology=!0,this._distanceTolerance=null;const t=arguments[0],e=arguments[1];this._isEnsureValidTopology=t,this._distanceTolerance=e}transformPolygon(t,e){if(t.isEmpty())return null;const s=super.transformPolygon.call(this,t,e);return e instanceof dt?s:this.createValidArea(s)}createValidArea(t){return this._isEnsureValidTopology?bn.bufferOp(t,0):t}transformCoordinates(t,e){const s=t.toCoordinateArray();let n=null;return n=0===s.length?new Array(0).fill(null):Go.simplify(s,this._distanceTolerance),this._factory.getCoordinateSequenceFactory().create(n)}transformMultiPolygon(t,e){const s=super.transformMultiPolygon.call(this,t,e);return this.createValidArea(s)}transformLinearRing(t,e){const s=e instanceof Ct,n=super.transformLinearRing.call(this,t,e);return!s||n instanceof et?n:null}}Bo.VWTransformer=Yo;var zo=Object.freeze({__proto__:null,DouglasPeuckerSimplifier:Lo,TopologyPreservingSimplifier:Do,VWSimplifier:Bo});class Vo{locate(t){}}class ko{constructor(){ko.constructor_.apply(this,arguments)}static constructor_(){this._subdiv=null,this._lastEdge=null;const t=arguments[0];this._subdiv=t,this.init()}init(){this._lastEdge=this.findEdge()}locate(t){this._lastEdge.isLive()||this.init();const e=this._subdiv.locateFromEdge(t,this._lastEdge);return this._lastEdge=e,e}findEdge(){return this._subdiv.getEdges().iterator().next()}get interfaces_(){return[Vo]}}class Xo{constructor(){Xo.constructor_.apply(this,arguments)}static constructor_(){if(this._ls=null,this._data=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._ls=new Kt(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._ls=new Kt(t,e),this._data=s}else if(6===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5];Xo.constructor_.call(this,new m(t,e,s),new m(n,i,r))}else if(7===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4],r=arguments[5],o=arguments[6];Xo.constructor_.call(this,new m(t,e,s),new m(n,i,r),o)}}getStartZ(){return this._ls.getCoordinate(0).getZ()}intersection(t){return this._ls.intersection(t.getLineSegment())}getStart(){return this._ls.getCoordinate(0)}getEnd(){return this._ls.getCoordinate(1)}getEndY(){return this._ls.getCoordinate(1).y}getStartX(){return this._ls.getCoordinate(0).x}setData(t){this._data=t}getData(){return this._data}getEndX(){return this._ls.getCoordinate(1).x}toString(){return this._ls.toString()}getLineSegment(){return this._ls}getEndZ(){return this._ls.getCoordinate(1).getZ()}equalsTopo(t){return this._ls.equalsTopo(t.getLineSegment())}getStartY(){return this._ls.getCoordinate(0).y}}class Uo{constructor(){Uo.constructor_.apply(this,arguments)}static constructor_(){this._seg=null,this._segLen=null,this._splitPt=null,this._minimumLen=0;const t=arguments[0];this._seg=t,this._segLen=t.getLength()}static pointAlongReverse(t,e){const s=new m;return s.x=t.p1.x-e*(t.p1.x-t.p0.x),s.y=t.p1.y-e*(t.p1.y-t.p0.y),s}splitAt(){if(1===arguments.length){const t=arguments[0],e=this._minimumLen/this._segLen;if(t.distance(this._seg.p0)<this._minimumLen)return this._splitPt=this._seg.pointAlong(e),null;if(t.distance(this._seg.p1)<this._minimumLen)return this._splitPt=Uo.pointAlongReverse(this._seg,e),null;this._splitPt=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1],s=this.getConstrainedLength(t)/this._segLen;e.equals2D(this._seg.p0)?this._splitPt=this._seg.pointAlong(s):this._splitPt=Uo.pointAlongReverse(this._seg,s)}}getSplitPoint(){return this._splitPt}getConstrainedLength(t){return t<this._minimumLen?this._minimumLen:t}setMinimumLength(t){this._minimumLen=t}}class Ho{findSplitPoint(t,e){}}class Wo{static projectedSplitPoint(t,e){return t.getLineSegment().project(e)}findSplitPoint(t,e){const s=t.getLineSegment(),n=s.getLength()/2,i=new Uo(s),r=Wo.projectedSplitPoint(t,e);let o=2*r.distance(e)*.8;return o>n&&(o=n),i.setMinimumLength(o),i.splitAt(r),i.getSplitPoint()}get interfaces_(){return[Ho]}}class Zo{static checkRobustInCircle(t,e,s,n){const i=Zo.isInCircleNonRobust(t,e,s,n),r=Zo.isInCircleDDSlow(t,e,s,n),o=Zo.isInCircleCC(t,e,s,n),l=se.circumcentre(t,e,s);Y.out.println("p radius diff a = "+Math.abs(n.distance(l)-t.distance(l))/t.distance(l)),i===r&&i===o||(Y.out.println("inCircle robustness failure (double result = "+i+", DD result = "+r+", CC result = "+o+")"),Y.out.println(Wt.toLineString(new it([t,e,s,n]))),Y.out.println("Circumcentre = "+Wt.toPoint(l)+" radius = "+t.distance(l)),Y.out.println("p radius diff a = "+Math.abs(n.distance(l)/t.distance(l)-1)),Y.out.println("p radius diff b = "+Math.abs(n.distance(l)/e.distance(l)-1)),Y.out.println("p radius diff c = "+Math.abs(n.distance(l)/s.distance(l)-1)),Y.out.println())}static isInCircleDDFast(t,e,s,n){const i=A.sqr(t.x).selfAdd(A.sqr(t.y)).selfMultiply(Zo.triAreaDDFast(e,s,n)),r=A.sqr(e.x).selfAdd(A.sqr(e.y)).selfMultiply(Zo.triAreaDDFast(t,s,n)),o=A.sqr(s.x).selfAdd(A.sqr(s.y)).selfMultiply(Zo.triAreaDDFast(t,e,n)),l=A.sqr(n.x).selfAdd(A.sqr(n.y)).selfMultiply(Zo.triAreaDDFast(t,e,s));return i.selfSubtract(r).selfAdd(o).selfSubtract(l).doubleValue()>0}static isInCircleCC(t,e,s,n){const i=se.circumcentre(t,e,s),r=t.distance(i);return n.distance(i)-r<=0}static isInCircleNormalized(t,e,s,n){const i=t.x-n.x,r=t.y-n.y,o=e.x-n.x,l=e.y-n.y,a=s.x-n.x,c=s.y-n.y;return(i*i+r*r)*(o*c-a*l)+(o*o+l*l)*(a*r-i*c)+(a*a+c*c)*(i*l-o*r)>0}static isInCircleDDSlow(t,e,s,n){const i=A.valueOf(n.x),r=A.valueOf(n.y),o=A.valueOf(t.x),l=A.valueOf(t.y),a=A.valueOf(e.x),c=A.valueOf(e.y),h=A.valueOf(s.x),u=A.valueOf(s.y),g=o.multiply(o).add(l.multiply(l)).multiply(Zo.triAreaDDSlow(a,c,h,u,i,r)),d=a.multiply(a).add(c.multiply(c)).multiply(Zo.triAreaDDSlow(o,l,h,u,i,r)),_=h.multiply(h).add(u.multiply(u)).multiply(Zo.triAreaDDSlow(o,l,a,c,i,r)),p=i.multiply(i).add(r.multiply(r)).multiply(Zo.triAreaDDSlow(o,l,a,c,h,u));return g.subtract(d).add(_).subtract(p).doubleValue()>0}static isInCircleNonRobust(t,e,s,n){return(t.x*t.x+t.y*t.y)*Zo.triArea(e,s,n)-(e.x*e.x+e.y*e.y)*Zo.triArea(t,s,n)+(s.x*s.x+s.y*s.y)*Zo.triArea(t,e,n)-(n.x*n.x+n.y*n.y)*Zo.triArea(t,e,s)>0}static isInCircleRobust(t,e,s,n){return Zo.isInCircleNormalized(t,e,s,n)}static triAreaDDSlow(t,e,s,n,i,r){return s.subtract(t).multiply(r.subtract(e)).subtract(n.subtract(e).multiply(i.subtract(t)))}static triAreaDDFast(t,e,s){const n=A.valueOf(e.x).selfSubtract(t.x).selfMultiply(A.valueOf(s.y).selfSubtract(t.y)),i=A.valueOf(e.y).selfSubtract(t.y).selfMultiply(A.valueOf(s.x).selfSubtract(t.x));return n.selfSubtract(i)}static triArea(t,e,s){return(e.x-t.x)*(s.y-t.y)-(e.y-t.y)*(s.x-t.x)}static isInCircleDDNormalized(t,e,s,n){const i=A.valueOf(t.x).selfSubtract(n.x),r=A.valueOf(t.y).selfSubtract(n.y),o=A.valueOf(e.x).selfSubtract(n.x),l=A.valueOf(e.y).selfSubtract(n.y),a=A.valueOf(s.x).selfSubtract(n.x),c=A.valueOf(s.y).selfSubtract(n.y),h=i.multiply(l).selfSubtract(o.multiply(r)),u=o.multiply(c).selfSubtract(a.multiply(l)),g=a.multiply(r).selfSubtract(i.multiply(c)),d=i.multiply(i).selfAdd(r.multiply(r)),_=o.multiply(o).selfAdd(l.multiply(l)),p=a.multiply(a).selfAdd(c.multiply(c));return d.selfMultiply(u).selfAdd(_.selfMultiply(g)).selfAdd(p.selfMultiply(h)).doubleValue()>0}}class jo{constructor(){jo.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,1===arguments.length){const t=arguments[0];this._p=new m(t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new m(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._p=new m(t,e,s)}}static interpolateZ(){if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=e.distance(s),i=t.distance(e),r=s.getZ()-e.getZ();return e.getZ()+r*(i/n)}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=e.x,r=e.y,o=s.x-i,l=n.x-i,a=s.y-r,c=n.y-r,h=o*c-l*a,u=t.x-i,g=t.y-r,d=(c*u-l*g)/h,_=(-a*u+o*g)/h;return e.getZ()+d*(s.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}}magn(){return Math.sqrt(this._p.x*this._p.x+this._p.y*this._p.y)}equals(){if(1===arguments.length){const t=arguments[0];return this._p.x===t.getX()&&this._p.y===t.getY()}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._p.distance(t.getCoordinate())<e}}rightOf(t){return this.isCCW(t.dest(),t.orig())}isCCW(t,e){return(t._p.x-this._p.x)*(e._p.y-this._p.y)-(t._p.y-this._p.y)*(e._p.x-this._p.x)>0}getX(){return this._p.x}crossProduct(t){return this._p.x*t.getY()-this._p.y*t.getX()}setZ(t){this._p.setZ(t)}times(t){return new jo(t*this._p.x,t*this._p.y)}cross(){return new jo(this._p.y,-this._p.x)}leftOf(t){return this.isCCW(t.orig(),t.dest())}getY(){return this._p.y}classify(t,e){const s=this,n=e.sub(t),i=s.sub(t),r=n.crossProduct(i);return r>0?jo.LEFT:r<0?jo.RIGHT:n.getX()*i.getX()<0||n.getY()*i.getY()<0?jo.BEHIND:n.magn()<i.magn()?jo.BEYOND:t.equals(s)?jo.ORIGIN:e.equals(s)?jo.DESTINATION:jo.BETWEEN}circumRadiusRatio(t,e){const s=this.circleCenter(t,e),n=this.distance(s,t);let i=this.distance(this,t),r=this.distance(t,e);return r<i&&(i=r),r=this.distance(e,this),r<i&&(i=r),n/i}circleCenter(t,e){const s=new jo(this.getX(),this.getY()),n=this.bisector(s,t),i=this.bisector(t,e),r=new ee(n,i);let o=null;try{o=new jo(r.getX(),r.getY())}catch(n){if(!(n instanceof te))throw n;Y.err.println("a: "+s+" b: "+t+" c: "+e),Y.err.println(n)}return o}dot(t){return this._p.x*t.getX()+this._p.y*t.getY()}getZ(){return this._p.getZ()}bisector(t,e){const s=e.getX()-t.getX(),n=e.getY()-t.getY(),i=new ee(t.getX()+s/2,t.getY()+n/2,1),r=new ee(t.getX()-n+s/2,t.getY()+s+n/2,1);return new ee(i,r)}getCoordinate(){return this._p}isInCircle(t,e,s){return Zo.isInCircleRobust(t._p,e._p,s._p,this._p)}interpolateZValue(t,e,s){const n=t.getX(),i=t.getY(),r=e.getX()-n,o=s.getX()-n,l=e.getY()-i,a=s.getY()-i,c=r*a-o*l,h=this.getX()-n,u=this.getY()-i,g=(a*h-o*u)/c,d=(-l*h+r*u)/c;return t.getZ()+g*(e.getZ()-t.getZ())+d*(s.getZ()-t.getZ())}midPoint(t){const e=(this._p.x+t.getX())/2,s=(this._p.y+t.getY())/2,n=(this._p.getZ()+t.getZ())/2;return new jo(e,s,n)}toString(){return"POINT ("+this._p.x+" "+this._p.y+")"}sub(t){return new jo(this._p.x-t.getX(),this._p.y-t.getY())}sum(t){return new jo(this._p.x+t.getX(),this._p.y+t.getY())}distance(t,e){return Math.sqrt(Math.pow(e.getX()-t.getX(),2)+Math.pow(e.getY()-t.getY(),2))}}jo.LEFT=0,jo.RIGHT=1,jo.BEYOND=2,jo.BEHIND=3,jo.BETWEEN=4,jo.ORIGIN=5,jo.DESTINATION=6;class Ko extends jo{constructor(){super(),Ko.constructor_.apply(this,arguments)}static constructor_(){this._isOnConstraint=null,this._constraint=null;const t=arguments[0];jo.constructor_.call(this,t)}getConstraint(){return this._constraint}setOnConstraint(t){this._isOnConstraint=t}setConstraint(t){this._isOnConstraint=!0,this._constraint=t}merge(t){t._isOnConstraint&&(this._isOnConstraint=!0,this._constraint=t._constraint)}isOnConstraint(){return this._isOnConstraint}}class Qo{constructor(){Qo.constructor_.apply(this,arguments)}static constructor_(){this._rot=null,this._vertex=null,this._next=null,this._data=null}static swap(t){const e=t.oPrev(),s=t.sym().oPrev();Qo.splice(t,e),Qo.splice(t.sym(),s),Qo.splice(t,e.lNext()),Qo.splice(t.sym(),s.lNext()),t.setOrig(e.dest()),t.setDest(s.dest())}static splice(t,e){const s=t.oNext().rot(),n=e.oNext().rot(),i=e.oNext(),r=t.oNext(),o=n.oNext(),l=s.oNext();t.setNext(i),e.setNext(r),s.setNext(o),n.setNext(l)}static makeEdge(t,e){const s=new Qo,n=new Qo,i=new Qo,r=new Qo;s._rot=n,n._rot=i,i._rot=r,r._rot=s,s.setNext(s),n.setNext(r),i.setNext(i),r.setNext(n);const o=s;return o.setOrig(t),o.setDest(e),o}static connect(t,e){const s=Qo.makeEdge(t.dest(),e.orig());return Qo.splice(s,t.lNext()),Qo.splice(s.sym(),e),s}equalsNonOriented(t){return!!this.equalsOriented(t)||!!this.equalsOriented(t.sym())}oNext(){return this._next}equalsOriented(t){return!(!this.orig().getCoordinate().equals2D(t.orig().getCoordinate())||!this.dest().getCoordinate().equals2D(t.dest().getCoordinate()))}dNext(){return this.sym().oNext().sym()}lPrev(){return this._next.sym()}rPrev(){return this.sym().oNext()}rot(){return this._rot}oPrev(){return this._rot._next._rot}sym(){return this._rot._rot}setOrig(t){this._vertex=t}lNext(){return this.invRot().oNext().rot()}getLength(){return this.orig().getCoordinate().distance(this.dest().getCoordinate())}setData(t){this._data=t}getData(){return this._data}delete(){this._rot=null}toString(){const t=this._vertex.getCoordinate(),e=this.dest().getCoordinate();return Wt.toLineString(t,e)}isLive(){return null!==this._rot}getPrimary(){return this.orig().getCoordinate().compareTo(this.dest().getCoordinate())<=0?this:this.sym()}toLineSegment(){return new Kt(this._vertex.getCoordinate(),this.dest().getCoordinate())}dest(){return this.sym().orig()}invRot(){return this._rot.sym()}setDest(t){this.sym().setOrig(t)}orig(){return this._vertex}rNext(){return this._rot._next.invRot()}dPrev(){return this.invRot().oNext().invRot()}setNext(t){this._next=t}}class Jo{constructor(){Jo.constructor_.apply(this,arguments)}static constructor_(){this._subdiv=null,this._isUsingTolerance=!1;const t=arguments[0];this._subdiv=t,this._isUsingTolerance=t.getTolerance()>0}insertSite(t){let e=this._subdiv.locate(t);if(this._subdiv.isVertexOfEdge(e,t))return e;this._subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this._subdiv.delete(e.oNext()));let s=this._subdiv.makeEdge(e.orig(),t);Qo.splice(s,e);const n=s;do{s=this._subdiv.connect(e,s.sym()),e=s.oPrev()}while(e.lNext()!==n);for(;;){const i=e.oPrev();if(i.dest().rightOf(e)&&t.isInCircle(e.orig(),i.dest(),e.dest()))Qo.swap(e),e=e.oPrev();else{if(e.oNext()===n)return s;e=e.oNext().lPrev()}}}insertSites(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertSite(t)}}}class $o extends a{constructor(){super(),$o.constructor_.apply(this,arguments)}static constructor_(){if(this._seg=null,1===arguments.length){if("string"==typeof arguments[0]){const t=arguments[0];a.constructor_.call(this,t)}else if(arguments[0]instanceof Kt){const t=arguments[0];a.constructor_.call(this,"Locate failed to converge (at edge: "+t+"). Possible causes include invalid Subdivision topology or very close sites"),this._seg=new Kt(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];a.constructor_.call(this,$o.msgWithSpatial(t,e)),this._seg=new Kt(e)}}static msgWithSpatial(t,e){return null!==e?t+" [ "+e+" ]":t}getSegment(){return this._seg}}class tl{visit(t){}}class el{constructor(){el.constructor_.apply(this,arguments)}static constructor_(){this._visitedKey=0,this._quadEdges=new L,this._startingEdge=null,this._tolerance=null,this._edgeCoincidenceTolerance=null,this._frameVertex=new Array(3).fill(null),this._frameEnv=null,this._locator=null,this._seg=new Kt,this._triEdges=new Array(3).fill(null);const t=arguments[0],e=arguments[1];this._tolerance=e,this._edgeCoincidenceTolerance=e/el.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this._startingEdge=this.initSubdiv(),this._locator=new ko(this)}static getTriangleEdges(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!==e[0])throw new n("Edges do not form a triangle")}getTriangleVertices(t){const e=new il;return this.visitTriangles(e,t),e.getTriangleVertices()}isFrameVertex(t){return!!t.equals(this._frameVertex[0])||(!!t.equals(this._frameVertex[1])||!!t.equals(this._frameVertex[2]))}isVertexOfEdge(t,e){return!(!e.equals(t.orig(),this._tolerance)&&!e.equals(t.dest(),this._tolerance))}connect(t,e){const s=Qo.connect(t,e);return this._quadEdges.add(s),s}visitTriangles(t,e){this._visitedKey++;const s=new Zs;s.push(this._startingEdge);const n=new pt;for(;!s.empty();){const i=s.pop();if(!n.contains(i)){const r=this.fetchTriangleToVisit(i,s,e,n);null!==r&&t.visit(r)}}}isFrameEdge(t){return!(!this.isFrameVertex(t.orig())&&!this.isFrameVertex(t.dest()))}isOnEdge(t,e){this._seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate());return this._seg.distance(e)<this._edgeCoincidenceTolerance}getEnvelope(){return new O(this._frameEnv)}getVertexUniqueEdges(t){const e=new L,s=new pt;for(let n=this._quadEdges.iterator();n.hasNext();){const i=n.next(),r=i.orig();s.contains(r)||(s.add(r),!t&&this.isFrameVertex(r)||e.add(i));const o=i.sym(),l=o.orig();s.contains(l)||(s.add(l),!t&&this.isFrameVertex(l)||e.add(o))}return e}locateFromEdge(t,e){let s=0;const n=this._quadEdges.size();let i=e;for(;;){if(s++,s>n)throw new $o(i.toLineSegment());if(t.equals(i.orig())||t.equals(i.dest()))break;if(t.rightOf(i))i=i.sym();else if(t.rightOf(i.oNext())){if(t.rightOf(i.dPrev()))break;i=i.dPrev()}else i=i.oNext()}return i}getVoronoiDiagram(t){const e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(Lt.toGeometryArray(e))}getTriangles(t){const e=this.getTriangleCoordinates(!1),s=new Array(e.size()).fill(null);let n=0;for(let i=e.iterator();i.hasNext();){const e=i.next();s[n++]=t.createPolygon(t.createLinearRing(e))}return t.createGeometryCollection(s)}getVoronoiCellPolygon(t,e){const s=new L,n=t;do{const e=t.rot().orig().getCoordinate();s.add(e),t=t.oPrev()}while(t!==n);const i=new R;i.addAll(s,!1),i.closeRing(),i.size()<4&&(Y.out.println(i),i.add(i.get(i.size()-1),!0));const r=i.toCoordinateArray(),o=e.createPolygon(e.createLinearRing(r)),l=n.orig();return o.setUserData(l.getCoordinate()),o}setLocator(t){this._locator=t}initSubdiv(){const t=this.makeEdge(this._frameVertex[0],this._frameVertex[1]),e=this.makeEdge(this._frameVertex[1],this._frameVertex[2]);Qo.splice(t.sym(),e);const s=this.makeEdge(this._frameVertex[2],this._frameVertex[0]);return Qo.splice(e.sym(),s),Qo.splice(s.sym(),t),t}isFrameBorderEdge(t){const e=new Array(3).fill(null);el.getTriangleEdges(t,e);const s=new Array(3).fill(null);el.getTriangleEdges(t.sym(),s);const n=t.lNext().dest();if(this.isFrameVertex(n))return!0;const i=t.sym().lNext().dest();return!!this.isFrameVertex(i)}makeEdge(t,e){const s=Qo.makeEdge(t,e);return this._quadEdges.add(s),s}createFrame(t){const e=t.getWidth(),s=t.getHeight();let n=0;n=e>s?10*e:10*s,this._frameVertex[0]=new jo((t.getMaxX()+t.getMinX())/2,t.getMaxY()+n),this._frameVertex[1]=new jo(t.getMinX()-n,t.getMinY()-n),this._frameVertex[2]=new jo(t.getMaxX()+n,t.getMinY()-n),this._frameEnv=new O(this._frameVertex[0].getCoordinate(),this._frameVertex[1].getCoordinate()),this._frameEnv.expandToInclude(this._frameVertex[2].getCoordinate())}getTriangleCoordinates(t){const e=new rl;return this.visitTriangles(e,t),e.getTriangles()}getVertices(t){const e=new pt;for(let s=this._quadEdges.iterator();s.hasNext();){const n=s.next(),i=n.orig();!t&&this.isFrameVertex(i)||e.add(i);const r=n.dest();!t&&this.isFrameVertex(r)||e.add(r)}return e}fetchTriangleToVisit(t,e,s,n){let i=t,r=0,o=!1;do{this._triEdges[r]=i,this.isFrameEdge(i)&&(o=!0);const t=i.sym();n.contains(t)||e.push(t),n.add(i),r++,i=i.lNext()}while(i!==t);return o&&!s?null:this._triEdges}getEdges(){if(0===arguments.length)return this._quadEdges;if(1===arguments.length){const t=arguments[0],e=this.getPrimaryEdges(!1),s=new Array(e.size()).fill(null);let n=0;for(let i=e.iterator();i.hasNext();){const e=i.next();s[n++]=t.createLineString([e.orig().getCoordinate(),e.dest().getCoordinate()])}return t.createMultiLineString(s)}}getTriangleEdges(t){const e=new nl;return this.visitTriangles(e,t),e.getTriangleEdges()}getPrimaryEdges(t){this._visitedKey++;const e=new L,s=new Zs;s.push(this._startingEdge);const n=new pt;for(;!s.empty();){const i=s.pop();if(!n.contains(i)){const r=i.getPrimary();!t&&this.isFrameEdge(r)||e.add(r),s.push(i.oNext()),s.push(i.sym().oNext()),n.add(i),n.add(i.sym())}}return e}delete(t){Qo.splice(t,t.oPrev()),Qo.splice(t.sym(),t.sym().oPrev());const e=t.sym(),s=t.rot(),n=t.rot().sym();this._quadEdges.remove(t),this._quadEdges.remove(e),this._quadEdges.remove(s),this._quadEdges.remove(n),t.delete(),e.delete(),s.delete(),n.delete()}getTolerance(){return this._tolerance}getVoronoiCellPolygons(t){this.visitTriangles(new sl,!0);const e=new L;for(let s=this.getVertexUniqueEdges(!1).iterator();s.hasNext();){const n=s.next();e.add(this.getVoronoiCellPolygon(n,t))}return e}insertSite(t){let e=this.locate(t);if(t.equals(e.orig(),this._tolerance)||t.equals(e.dest(),this._tolerance))return e;let s=this.makeEdge(e.orig(),t);Qo.splice(s,e);const n=s;do{s=this.connect(e,s.sym()),e=s.oPrev()}while(e.lNext()!==n);return n}locate(){if(1===arguments.length){if(arguments[0]instanceof jo){const t=arguments[0];return this._locator.locate(t)}if(arguments[0]instanceof m){const t=arguments[0];return this._locator.locate(new jo(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1],s=this._locator.locate(new jo(t));if(null===s)return null;let n=s;s.dest().getCoordinate().equals2D(t)&&(n=s.sym());let i=n;do{if(i.dest().getCoordinate().equals2D(e))return i;i=i.oNext()}while(i!==n);return null}}}class sl{visit(t){const e=t[0].orig().getCoordinate(),s=t[1].orig().getCoordinate(),n=t[2].orig().getCoordinate(),i=se.circumcentreDD(e,s,n),r=new jo(i);for(let e=0;e<3;e++)t[e].rot().setOrig(r)}get interfaces_(){return[tl]}}class nl{constructor(){nl.constructor_.apply(this,arguments)}static constructor_(){this._triList=new L}getTriangleEdges(){return this._triList}visit(t){this._triList.add(t)}get interfaces_(){return[tl]}}class il{constructor(){il.constructor_.apply(this,arguments)}static constructor_(){this._triList=new L}getTriangleVertices(){return this._triList}visit(t){this._triList.add([t[0].orig(),t[1].orig(),t[2].orig()])}get interfaces_(){return[tl]}}class rl{constructor(){rl.constructor_.apply(this,arguments)}static constructor_(){this._coordList=new R,this._triCoords=new L}checkTriangleSize(t){t.length>=2?Wt.toLineString(t[0],t[1]):t.length>=1&&Wt.toPoint(t[0])}visit(t){this._coordList.clear();for(let e=0;e<3;e++){const s=t[e].orig();this._coordList.add(s.getCoordinate())}if(this._coordList.size()>0){this._coordList.closeRing();const t=this._coordList.toCoordinateArray();if(4!==t.length)return null;this._triCoords.add(t)}}getTriangles(){return this._triCoords}get interfaces_(){return[tl]}}el.TriangleCircumcentreVisitor=sl,el.TriangleEdgesListVisitor=nl,el.TriangleVertexListVisitor=il,el.TriangleCoordinatesVisitor=rl,el.EDGE_COINCIDENCE_TOL_FACTOR=1e3;class ll extends a{constructor(){super(),ll.constructor_.apply(this,arguments)}static constructor_(){if(this._pt=null,1===arguments.length){const t=arguments[0];a.constructor_.call(this,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];a.constructor_.call(this,ll.msgWithCoord(t,e)),this._pt=new m(e)}}static msgWithCoord(t,e){return null!==e?t+" [ "+Wt.toPoint(e)+" ]":t}getCoordinate(){return this._pt}}class al{constructor(){al.constructor_.apply(this,arguments)}static constructor_(){this._initialVertices=null,this._segVertices=null,this._segments=new L,this._subdiv=null,this._incDel=null,this._convexHull=null,this._splitFinder=new Wo,this._kdt=null,this._vertexFactory=null,this._computeAreaEnv=null,this._splitPt=null,this._tolerance=null;const t=arguments[0],e=arguments[1];this._initialVertices=new L(t),this._tolerance=e,this._kdt=new qi(e)}static computeVertexEnvelope(t){const e=new O;for(let s=t.iterator();s.hasNext();){const t=s.next();e.expandToInclude(t.getCoordinate())}return e}getInitialVertices(){return this._initialVertices}getKDT(){return this._kdt}setConstraints(t,e){this._segments=t,this._segVertices=e}computeConvexHull(){const t=new Lt,e=this.getPointArray(),s=new _i(e,t);this._convexHull=s.getConvexHull()}addConstraintVertices(){this.computeConvexHull(),this.insertSites(this._segVertices)}getTolerance(){return this._tolerance}setVertexFactory(t){this._vertexFactory=t}formInitialDelaunay(){this.computeBoundingBox(),this._subdiv=new el(this._computeAreaEnv,this._tolerance),this._subdiv.setLocator(new ko(this._subdiv)),this._incDel=new Jo(this._subdiv),this.insertSites(this._initialVertices)}insertSite(){if(arguments[0]instanceof Ko){const t=arguments[0],e=this._kdt.insert(t.getCoordinate(),t);if(e.isRepeated()){const s=e.getData();return s.merge(t),s}return this._incDel.insertSite(t),t}if(arguments[0]instanceof m){const t=arguments[0];this.insertSite(this.createVertex(t))}}enforceConstraints(){this.addConstraintVertices();let t=0,e=0;do{e=this.enforceGabriel(this._segments),t++}while(e>0&&t<al.MAX_SPLIT_ITER);if(t===al.MAX_SPLIT_ITER)throw new ll("Too many splitting iterations while enforcing constraints. Last split point was at: ",this._splitPt)}insertSites(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertSite(t)}}getVertexFactory(){return this._vertexFactory}getPointArray(){const t=new Array(this._initialVertices.size()+this._segVertices.size()).fill(null);let e=0;for(let s=this._initialVertices.iterator();s.hasNext();){const n=s.next();t[e++]=n.getCoordinate()}for(let s=this._segVertices.iterator();s.hasNext();){const n=s.next();t[e++]=n.getCoordinate()}return t}findNonGabrielPoint(t){const e=t.getStart(),s=t.getEnd(),n=new m((e.x+s.x)/2,(e.y+s.y)/2),i=e.distance(n),o=new O(n);o.expandBy(i);const l=this._kdt.query(o);let a=null,c=r.MAX_VALUE;for(let t=l.iterator();t.hasNext();){const r=t.next().getCoordinate();if(r.equals2D(e)||r.equals2D(s))continue;const o=n.distance(r);if(o<i){(null===a||o<c)&&(a=r,c=o)}}return a}getConstraintSegments(){return this._segments}setSplitPointFinder(t){this._splitFinder=t}getConvexHull(){return this._convexHull}enforceGabriel(t){const e=new L;let s=0;const n=new L;for(let i=t.iterator();i.hasNext();){const t=i.next(),r=this.findNonGabrielPoint(t);if(null===r)continue;this._splitPt=this._splitFinder.findSplitPoint(t,r);const o=this.createVertex(this._splitPt,t);this.insertSite(o).getCoordinate().equals2D(this._splitPt);const l=new Xo(t.getStartX(),t.getStartY(),t.getStartZ(),o.getX(),o.getY(),o.getZ(),t.getData()),a=new Xo(o.getX(),o.getY(),o.getZ(),t.getEndX(),t.getEndY(),t.getEndZ(),t.getData());e.add(l),e.add(a),n.add(t),s+=1}return t.removeAll(n),t.addAll(e),s}createVertex(){if(1===arguments.length){const t=arguments[0];let e=null;return e=null!==this._vertexFactory?this._vertexFactory.createVertex(t,null):new Ko(t),e}if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null;return s=null!==this._vertexFactory?this._vertexFactory.createVertex(t,e):new Ko(t),s.setOnConstraint(!0),s}}getSubdivision(){return this._subdiv}computeBoundingBox(){const t=al.computeVertexEnvelope(this._initialVertices),e=al.computeVertexEnvelope(this._segVertices),s=new O(t);s.expandToInclude(e);const n=.2*s.getWidth(),i=.2*s.getHeight(),r=Math.max(n,i);this._computeAreaEnv=new O(s),this._computeAreaEnv.expandBy(r)}}al.MAX_SPLIT_ITER=99;class cl{constructor(){cl.constructor_.apply(this,arguments)}static constructor_(){this._siteCoords=null,this._tolerance=0,this._subdiv=null}static envelope(t){const e=new O;for(let s=t.iterator();s.hasNext();){const t=s.next();e.expandToInclude(t)}return e}static unique(t){const e=W.copyDeep(t);ht.sort(e);return new R(e,!1)}static extractUniqueCoordinates(t){if(null===t)return new R;const e=t.getCoordinates();return cl.unique(e)}static toVertices(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();e.add(new jo(t))}return e}create(){if(null!==this._subdiv)return null;const t=cl.envelope(this._siteCoords),e=cl.toVertices(this._siteCoords);this._subdiv=new el(t,this._tolerance);new Jo(this._subdiv).insertSites(e)}setTolerance(t){this._tolerance=t}setSites(){if(arguments[0]instanceof j){const t=arguments[0];this._siteCoords=cl.extractUniqueCoordinates(t)}else if(I(arguments[0],N)){const t=arguments[0];this._siteCoords=cl.unique(W.toCoordinateArray(t))}}getEdges(t){return this.create(),this._subdiv.getEdges(t)}getSubdivision(){return this.create(),this._subdiv}getTriangles(t){return this.create(),this._subdiv.getTriangles(t)}}class hl{constructor(){hl.constructor_.apply(this,arguments)}static constructor_(){this._siteCoords=null,this._constraintLines=null,this._tolerance=0,this._subdiv=null,this._constraintVertexMap=new os}static createConstraintSegments(){if(1===arguments.length){const t=arguments[0],e=ye.getLines(t),s=new L;for(let t=e.iterator();t.hasNext();){const e=t.next();hl.createConstraintSegments(e,s)}return s}if(2===arguments.length){const t=arguments[1],e=arguments[0].getCoordinates();for(let s=1;s<e.length;s++)t.add(new Xo(e[s-1],e[s]))}}createSiteVertices(t){const e=new L;for(let s=t.iterator();s.hasNext();){const t=s.next();this._constraintVertexMap.containsKey(t)||e.add(new Ko(t))}return e}create(){if(null!==this._subdiv)return null;const t=cl.envelope(this._siteCoords);let e=new L;null!==this._constraintLines&&(t.expandToInclude(this._constraintLines.getEnvelopeInternal()),this.createVertices(this._constraintLines),e=hl.createConstraintSegments(this._constraintLines));const s=this.createSiteVertices(this._siteCoords),n=new al(s,this._tolerance);n.setConstraints(e,new L(this._constraintVertexMap.values())),n.formInitialDelaunay(),n.enforceConstraints(),this._subdiv=n.getSubdivision()}setTolerance(t){this._tolerance=t}setConstraints(t){this._constraintLines=t}setSites(t){this._siteCoords=cl.extractUniqueCoordinates(t)}getEdges(t){return this.create(),this._subdiv.getEdges(t)}getSubdivision(){return this.create(),this._subdiv}getTriangles(t){return this.create(),this._subdiv.getTriangles(t)}createVertices(t){const e=t.getCoordinates();for(let t=0;t<e.length;t++){const s=new Ko(e[t]);this._constraintVertexMap.put(e[t],s)}}}class ul{constructor(){ul.constructor_.apply(this,arguments)}static constructor_(){this._siteCoords=null,this._tolerance=0,this._subdiv=null,this._clipEnv=null,this._diagramEnv=null}static clipGeometryCollection(t,e){const s=t.getFactory().toGeometry(e),n=new L;for(let i=0;i<t.getNumGeometries();i++){const r=t.getGeometryN(i);let o=null;e.contains(r.getEnvelopeInternal())?o=r:e.intersects(r.getEnvelopeInternal())&&(o=oi.intersection(s,r),o.setUserData(r.getUserData())),null===o||o.isEmpty()||n.add(o)}return t.getFactory().createGeometryCollection(Lt.toGeometryArray(n))}create(){if(null!==this._subdiv)return null;const t=cl.envelope(this._siteCoords);if(this._diagramEnv=this._clipEnv,null===this._diagramEnv){this._diagramEnv=t;const e=this._diagramEnv.getDiameter();this._diagramEnv.expandBy(e)}const e=cl.toVertices(this._siteCoords);this._subdiv=new el(t,this._tolerance);new Jo(this._subdiv).insertSites(e)}setSites(){if(arguments[0]instanceof j){const t=arguments[0];this._siteCoords=cl.extractUniqueCoordinates(t)}else if(I(arguments[0],N)){const t=arguments[0];this._siteCoords=cl.unique(W.toCoordinateArray(t))}}setClipEnvelope(t){this._clipEnv=t}getSubdivision(){return this.create(),this._subdiv}getDiagram(t){this.create();const e=this._subdiv.getVoronoiDiagram(t);return ul.clipGeometryCollection(e,this._diagramEnv)}setTolerance(t){this._tolerance=t}}var gl=Object.freeze({__proto__:null,Vertex:jo}),dl=Object.freeze({__proto__:null,ConformingDelaunayTriangulationBuilder:hl,DelaunayTriangulationBuilder:cl,VoronoiDiagramBuilder:ul,quadedge:gl});class _l{constructor(){_l.constructor_.apply(this,arguments)}static constructor_(){if(this._linearGeom=null,this._numLines=null,this._currentLine=null,this._componentIndex=0,this._vertexIndex=0,1===arguments.length){const t=arguments[0];_l.constructor_.call(this,t,0,0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];_l.constructor_.call(this,t,e.getComponentIndex(),_l.segmentEndVertexIndex(e))}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(!I(t,Q))throw new n("Lineal geometry is required");this._linearGeom=t,this._numLines=t.getNumGeometries(),this._componentIndex=e,this._vertexIndex=s,this.loadCurrentLine()}}static segmentEndVertexIndex(t){return t.getSegmentFraction()>0?t.getSegmentIndex()+1:t.getSegmentIndex()}getComponentIndex(){return this._componentIndex}getLine(){return this._currentLine}getVertexIndex(){return this._vertexIndex}getSegmentEnd(){return this._vertexIndex<this.getLine().getNumPoints()-1?this._currentLine.getCoordinateN(this._vertexIndex+1):null}next(){if(!this.hasNext())return null;this._vertexIndex++,this._vertexIndex>=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)}loadCurrentLine(){if(this._componentIndex>=this._numLines)return this._currentLine=null,null;this._currentLine=this._linearGeom.getGeometryN(this._componentIndex)}getSegmentStart(){return this._currentLine.getCoordinateN(this._vertexIndex)}isEndOfLine(){return!(this._componentIndex>=this._numLines)&&!(this._vertexIndex<this._currentLine.getNumPoints()-1)}hasNext(){return!(this._componentIndex>=this._numLines)&&!(this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())}}class pl{constructor(){pl.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new pl(t).indexOf(e)}static indexOfAfter(t,e,s){return new pl(t).indexOfAfter(e,s)}segmentNearestMeasure(t,e,s){const n=t.projectionFactor(e);return n<=0?s:n<=1?s+n*t.getLength():s+t.getLength()}indexOfFromStart(t,e){let s=r.MAX_VALUE,n=e,i=0;const o=new Kt,l=new _l(this._linearGeom);for(;l.hasNext();){if(!l.isEndOfLine()){o.p0=l.getSegmentStart(),o.p1=l.getSegmentEnd();const r=o.distance(t),a=this.segmentNearestMeasure(o,t,i);r<s&&a>e&&(n=a,s=r),i+=o.getLength()}l.next()}return n}indexOf(t){return this.indexOfFromStart(t,-1)}indexOfAfter(t,e){if(e<0)return this.indexOf(t);const s=this._linearGeom.getLength();if(s<e)return s;const n=this.indexOfFromStart(t,e);return h.isTrue(n>=e,"computed index is before specified minimum index"),n}}class ml{constructor(){ml.constructor_.apply(this,arguments)}static constructor_(){this._geomFact=null,this._lines=new L,this._coordList=null,this._ignoreInvalidLines=!1,this._fixInvalidLines=!1,this._lastPt=null;const t=arguments[0];this._geomFact=t}getGeometry(){return this.endLine(),this._geomFact.buildGeometry(this._lines)}getLastCoordinate(){return this._lastPt}endLine(){if(null===this._coordList)return null;if(this._ignoreInvalidLines&&this._coordList.size()<2)return this._coordList=null,null;const t=this._coordList.toCoordinateArray();let e=t;this._fixInvalidLines&&(e=this.validCoordinateSequence(t)),this._coordList=null;let s=null;try{s=this._geomFact.createLineString(e)}catch(t){if(!(t instanceof n))throw t;if(!this._ignoreInvalidLines)throw t}null!==s&&this._lines.add(s)}setFixInvalidLines(t){this._fixInvalidLines=t}add(){if(1===arguments.length){const t=arguments[0];this.add(t,!0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];null===this._coordList&&(this._coordList=new R),this._coordList.add(t,e),this._lastPt=t}}setIgnoreInvalidLines(t){this._ignoreInvalidLines=t}validCoordinateSequence(t){if(t.length>=2)return t;return[t[0],t[0]]}}class fl{constructor(){fl.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}static extract(t,e,s){return new fl(t).extract(e,s)}extract(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)}computeLine(t,e){const s=this._line.getCoordinates(),n=new R;let i=t.getSegmentIndex();t.getSegmentFraction()>0&&(i+=1);let r=e.getSegmentIndex();1===e.getSegmentFraction()&&(r+=1),r>=s.length&&(r=s.length-1),t.isVertex()||n.add(t.getCoordinate(this._line));for(let t=i;t<=r;t++)n.add(s[t]);e.isVertex()||n.add(e.getCoordinate(this._line)),n.size()<=0&&n.add(t.getCoordinate(this._line));let o=n.toCoordinateArray();return o.length<=1&&(o=[o[0],o[0]]),this._line.getFactory().createLineString(o)}reverse(t){return I(t,Q)?t.reverse():(h.shouldNeverReachHere("non-linear geometry encountered"),null)}computeLinear(t,e){const s=new ml(this._line.getFactory());s.setFixInvalidLines(!0),t.isVertex()||s.add(t.getCoordinate(this._line));for(let n=new _l(this._line,t);n.hasNext()&&!(e.compareLocationValues(n.getComponentIndex(),n.getVertexIndex(),0)<0);n.next()){const t=n.getSegmentStart();s.add(t),n.isEndOfLine()&&s.endLine()}return e.isVertex()||s.add(e.getCoordinate(this._line)),s.getGeometry()}}class yl{constructor(){yl.constructor_.apply(this,arguments)}static constructor_(){if(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._componentIndex=t._componentIndex,this._segmentIndex=t._segmentIndex,this._segmentFraction=t._segmentFraction}else if(2===arguments.length){const t=arguments[0],e=arguments[1];yl.constructor_.call(this,0,t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=s,this.normalize()}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=s,n&&this.normalize()}}static numSegments(t){const e=t.getNumPoints();return e<=1?0:e-1}static compareLocationValues(t,e,s,n,i,r){return t<n?-1:t>n?1:e<i?-1:e>i?1:s<r?-1:s>r?1:0}static pointAlongSegmentByFraction(t,e,s){if(s<=0)return t;if(s>=1)return e;const n=(e.x-t.x)*s+t.x,i=(e.y-t.y)*s+t.y,r=(e.getZ()-t.getZ())*s+t.getZ();return new m(n,i,r)}static getEndLocation(t){const e=new yl;return e.setToEnd(t),e}getSegmentIndex(){return this._segmentIndex}getComponentIndex(){return this._componentIndex}getSegmentFraction(){return this._segmentFraction}setToEnd(t){this._componentIndex=t.getNumGeometries()-1;const e=t.getGeometryN(this._componentIndex);this._segmentIndex=yl.numSegments(e),this._segmentFraction=0}compareTo(t){const e=t;return this._componentIndex<e._componentIndex?-1:this._componentIndex>e._componentIndex?1:this._segmentIndex<e._segmentIndex?-1:this._segmentIndex>e._segmentIndex?1:this._segmentFraction<e._segmentFraction?-1:this._segmentFraction>e._segmentFraction?1:0}copy(){return new yl(this._componentIndex,this._segmentIndex,this._segmentFraction)}toString(){return"LinearLoc["+this._componentIndex+", "+this._segmentIndex+", "+this._segmentFraction+"]"}compareLocationValues(t,e,s){return this._componentIndex<t?-1:this._componentIndex>t?1:this._segmentIndex<e?-1:this._segmentIndex>e?1:this._segmentFraction<s?-1:this._segmentFraction>s?1:0}getSegmentLength(t){const e=t.getGeometryN(this._componentIndex);let s=this._segmentIndex;this._segmentIndex>=yl.numSegments(e)&&(s=e.getNumPoints()-2);const n=e.getCoordinateN(s),i=e.getCoordinateN(s+1);return n.distance(i)}isVertex(){return this._segmentFraction<=0||this._segmentFraction>=1}isEndpoint(t){const e=t.getGeometryN(this._componentIndex),s=yl.numSegments(e);return this._segmentIndex>=s||this._segmentIndex===s-1&&this._segmentFraction>=1}isValid(t){if(this._componentIndex<0||this._componentIndex>=t.getNumGeometries())return!1;const e=t.getGeometryN(this._componentIndex);return!(this._segmentIndex<0||this._segmentIndex>e.getNumPoints())&&((this._segmentIndex!==e.getNumPoints()||0===this._segmentFraction)&&!(this._segmentFraction<0||this._segmentFraction>1))}normalize(){this._segmentFraction<0&&(this._segmentFraction=0),this._segmentFraction>1&&(this._segmentFraction=1),this._componentIndex<0&&(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0),this._segmentIndex<0&&(this._segmentIndex=0,this._segmentFraction=0),1===this._segmentFraction&&(this._segmentFraction=0,this._segmentIndex+=1)}toLowest(t){const e=t.getGeometryN(this._componentIndex),s=yl.numSegments(e);return this._segmentIndex<s?this:new yl(this._componentIndex,s-1,1,!1)}getCoordinate(t){const e=t.getGeometryN(this._componentIndex),s=e.getCoordinateN(this._segmentIndex);if(this._segmentIndex>=yl.numSegments(e))return s;const n=e.getCoordinateN(this._segmentIndex+1);return yl.pointAlongSegmentByFraction(s,n,this._segmentFraction)}getSegment(t){const e=t.getGeometryN(this._componentIndex),s=e.getCoordinateN(this._segmentIndex);if(this._segmentIndex>=yl.numSegments(e)){const t=e.getCoordinateN(e.getNumPoints()-2);return new Kt(t,s)}const n=e.getCoordinateN(this._segmentIndex+1);return new Kt(s,n)}clamp(t){if(this._componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this._segmentIndex>=t.getNumPoints()){const e=t.getGeometryN(this._componentIndex);this._segmentIndex=yl.numSegments(e),this._segmentFraction=1}}isOnSameSegment(t){return this._componentIndex===t._componentIndex&&(this._segmentIndex===t._segmentIndex||(t._segmentIndex-this._segmentIndex==1&&0===t._segmentFraction||this._segmentIndex-t._segmentIndex==1&&0===this._segmentFraction))}snapToVertex(t,e){if(this._segmentFraction<=0||this._segmentFraction>=1)return null;const s=this.getSegmentLength(t),n=this._segmentFraction*s,i=s-n;n<=i&&n<e?this._segmentFraction=0:i<=n&&i<e&&(this._segmentFraction=1)}get interfaces_(){return[o]}}class xl{constructor(){xl.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new xl(t).indexOf(e)}static indexOfAfter(t,e,s){return new xl(t).indexOfAfter(e,s)}indexOfFromStart(t,e){let s=r.MAX_VALUE,n=0,i=0,o=-1;const l=new Kt;for(let r=new _l(this._linearGeom);r.hasNext();r.next())if(!r.isEndOfLine()){l.p0=r.getSegmentStart(),l.p1=r.getSegmentEnd();const a=l.distance(t),c=l.segmentFraction(t),h=r.getComponentIndex(),u=r.getVertexIndex();a<s&&(null===e||e.compareLocationValues(h,u,c)<0)&&(n=h,i=u,o=c,s=a)}if(s===r.MAX_VALUE)return new yl(e);return new yl(n,i,o)}indexOf(t){return this.indexOfFromStart(t,null)}indexOfAfter(t,e){if(null===e)return this.indexOf(t);const s=yl.getEndLocation(this._linearGeom);if(s.compareTo(e)<=0)return s;const n=this.indexOfFromStart(t,e);return h.isTrue(n.compareTo(e)>=0,"computed location is before specified minimum location"),n}}class El{constructor(){El.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indicesOf(t,e){return new El(t).indicesOf(e)}indicesOf(t){const e=t.getGeometryN(0).getCoordinateN(0),s=t.getGeometryN(t.getNumGeometries()-1),n=s.getCoordinateN(s.getNumPoints()-1),i=new xl(this._linearGeom),r=new Array(2).fill(null);return r[0]=i.indexOf(e),0===t.getLength()?r[1]=r[0].copy():r[1]=i.indexOfAfter(n,r[0]),r}}class Il{constructor(){Il.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static getLocation(){if(2===arguments.length){const t=arguments[1];return new Il(arguments[0]).getLocation(t)}if(3===arguments.length){const t=arguments[1],e=arguments[2];return new Il(arguments[0]).getLocation(t,e)}}static getLength(t,e){return new Il(t).getLength(e)}getLocation(){if(1===arguments.length){const t=arguments[0];return this.getLocation(t,!0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=t;if(t<0){s=this._linearGeom.getLength()+t}const n=this.getLocationForward(s);return e?n:this.resolveHigher(n)}}getLocationForward(t){if(t<=0)return new yl;let e=0;const s=new _l(this._linearGeom);for(;s.hasNext();){if(s.isEndOfLine()){if(e===t){const t=s.getComponentIndex(),e=s.getVertexIndex();return new yl(t,e,0)}}else{const n=s.getSegmentStart(),i=s.getSegmentEnd().distance(n);if(e+i>t){const n=(t-e)/i,r=s.getComponentIndex(),o=s.getVertexIndex();return new yl(r,o,n)}e+=i}s.next()}return yl.getEndLocation(this._linearGeom)}getLength(t){let e=0;const s=new _l(this._linearGeom);for(;s.hasNext();){if(!s.isEndOfLine()){const n=s.getSegmentStart(),i=s.getSegmentEnd().distance(n);if(t.getComponentIndex()===s.getComponentIndex()&&t.getSegmentIndex()===s.getVertexIndex())return e+i*t.getSegmentFraction();e+=i}s.next()}return e}resolveHigher(t){if(!t.isEndpoint(this._linearGeom))return t;let e=t.getComponentIndex();if(e>=this._linearGeom.getNumGeometries()-1)return t;do{e++}while(e<this._linearGeom.getNumGeometries()-1&&0===this._linearGeom.getGeometryN(e).getLength());return new yl(e,0,0)}}class Nl{constructor(){Nl.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}clampIndex(t){const e=this.positiveIndex(t),s=this.getStartIndex();if(e<s)return s;const n=this.getEndIndex();return e>n?n:e}locationOf(){if(1===arguments.length){const t=arguments[0];return Il.getLocation(this._linearGeom,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Il.getLocation(this._linearGeom,t,e)}}project(t){return pl.indexOf(this._linearGeom,t)}positiveIndex(t){return t>=0?t:this._linearGeom.getLength()+t}extractPoint(){if(1===arguments.length){const t=arguments[0];return Il.getLocation(this._linearGeom,t).getCoordinate(this._linearGeom)}if(2===arguments.length){const t=arguments[0],e=arguments[1],s=Il.getLocation(this._linearGeom,t).toLowest(this._linearGeom);return s.getSegment(this._linearGeom).pointAlongOffset(s.getSegmentFraction(),e)}}getStartIndex(){return 0}indexOfAfter(t,e){return pl.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){const s=this.clampIndex(t),n=this.clampIndex(e),i=s===n,r=this.locationOf(s,i),o=this.locationOf(n);return fl.extract(this._linearGeom,r,o)}isValidIndex(t){return t>=this.getStartIndex()&&t<=this.getEndIndex()}getEndIndex(){return this._linearGeom.getLength()}indexOf(t){return pl.indexOf(this._linearGeom,t)}indicesOf(t){const e=El.indicesOf(this._linearGeom,t);return[Il.getLength(this._linearGeom,e[0]),Il.getLength(this._linearGeom,e[1])]}}class wl{constructor(){wl.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t,this.checkGeometryType()}clampIndex(t){const e=t.copy();return e.clamp(this._linearGeom),e}project(t){return xl.indexOf(this._linearGeom,t)}checkGeometryType(){if(!(this._linearGeom instanceof tt||this._linearGeom instanceof Et))throw new n("Input geometry must be linear")}extractPoint(){if(1===arguments.length){return arguments[0].getCoordinate(this._linearGeom)}if(2===arguments.length){const t=arguments[1],e=arguments[0].toLowest(this._linearGeom);return e.getSegment(this._linearGeom).pointAlongOffset(e.getSegmentFraction(),t)}}getStartIndex(){return new yl}indexOfAfter(t,e){return xl.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){return fl.extract(this._linearGeom,t,e)}isValidIndex(t){return t.isValid(this._linearGeom)}getEndIndex(){return yl.getEndLocation(this._linearGeom)}indexOf(t){return xl.indexOf(this._linearGeom,t)}indicesOf(t){return El.indicesOf(this._linearGeom,t)}}var Cl=Object.freeze({__proto__:null,LengthIndexedLine:Nl,LengthLocationMap:Il,LinearGeometryBuilder:ml,LinearIterator:_l,LinearLocation:yl,LocationIndexedLine:wl});class Sl{static transform(t,e){const s=new L;for(let n=t.iterator();n.hasNext();)s.add(e.execute(n.next()));return s}static select(t,e){const s=new L;for(let n=t.iterator();n.hasNext();){const t=n.next();Boolean.TRUE.equals(e.execute(t))&&s.add(t)}return s}static apply(t,e){for(let s=t.iterator();s.hasNext();)e.execute(s.next())}}Sl.Function=function(){};class Ll{constructor(){Ll.constructor_.apply(this,arguments)}static constructor_(){this.pts=null,this.n=0;const t=arguments[0];this.pts=new Array(t).fill(null)}filter(t){this.pts[this.n++]=t}getCoordinates(){return this.pts}get interfaces_(){return[K]}}class Tl{constructor(){Tl.constructor_.apply(this,arguments)}static constructor_(){this._n=0}filter(t){this._n++}getCount(){return this._n}get interfaces_(){return[K]}}class Rl{constructor(){Rl.constructor_.apply(this,arguments)}static constructor_(){this._counts=new ft}add(t){const e=this._counts.get(t);null===e?this._counts.put(t,new Pl(1)):e.increment()}count(t){const e=this._counts.get(t);return null===e?0:e.count()}}class Pl{constructor(){Pl.constructor_.apply(this,arguments)}static constructor_(){if(this.count=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.count=t}}count(){return this.count}increment(){this.count++}}Rl.Counter=Pl;class Ol{constructor(){Ol.constructor_.apply(this,arguments)}static constructor_(){this._size=null,this._items=null,this._size=0,this._items=new L,this._items.add(null)}poll(){if(this.isEmpty())return null;const t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t}size(){return this._size}reorder(t){let e=null;const s=this._items.get(t);for(;2*t<=this._size&&(e=2*t,e!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(s)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,s)}clear(){this._size=0,this._items.clear()}peek(){if(this.isEmpty())return null;return this._items.get(1)}isEmpty(){return 0===this._size}add(t){this._items.add(null),this._size+=1;let e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)}}function vl(){}function Ml(){}function bl(){}function Dl(){}class Al extends s{}class Fl{static split(t,e){const s=e.length,n=new L;let i=""+t,r=i.indexOf(e);for(;r>=0;){const t=i.substring(0,r);n.add(t),i=i.substring(r+s),r=i.indexOf(e)}i.length>0&&n.add(i);const o=new Array(n.size()).fill(null);for(let t=0;t<o.length;t++)o[t]=n.get(t);return o}static getStackTrace(){if(1===arguments.length){const t=arguments[0],e=new Dl,s=new vl;return t.printStackTrace(s),e.toString()}if(2===arguments.length){const t=arguments[0],e=arguments[1];let s="";new Ml(Fl.getStackTrace(t));const n=new bl;for(let t=0;t<e;t++)try{s+=n.readLine()+Fl.NEWLINE}catch(t){if(!(t instanceof Al))throw t;h.shouldNeverReachHere()}return s}}static spaces(t){return Fl.chars(" ",t)}static chars(t,e){const s=new Array(e).fill(null);for(let n=0;n<e;n++)s[n]=t;return new String(s)}}Fl.NEWLINE=Y.getProperty("line.separator");var Gl=Object.freeze({__proto__:null,CollectionUtil:Sl,CoordinateArrayFilter:Ll,CoordinateCountFilter:Tl,GeometricShapeFactory:we,NumberUtil:e,ObjectCounter:Rl,PriorityQueue:Ol,StringUtil:Fl,UniqueCoordinateArrayFilter:di});tt.prototype.getBoundary=function(){return ir.getBoundary(this)},Et.prototype.getBoundary=function(){return ir.getBoundary(this)},j.prototype.equalsTopo=function(t){return no.equalsTopo(this,t)},j.prototype.equals=function(t){return null!==t&&no.equalsTopo(this,t)},j.prototype.union=function(){if(0===arguments.length)return co.union(this);if(1===arguments.length){const t=arguments[0];return ci.union(this,t)}},j.prototype.isValid=function(){return zr.isValid(this)},j.prototype.intersection=function(t){return oi.intersection(this,t)},j.prototype.covers=function(t){return no.covers(this,t)},j.prototype.coveredBy=function(t){return no.covers(t,this)},j.prototype.touches=function(t){return no.touches(this,t)},j.prototype.intersects=function(t){return no.intersects(this,t)},j.prototype.within=function(t){return no.contains(t,this)},j.prototype.overlaps=function(t){return no.overlaps(this,t)},j.prototype.disjoint=function(t){return no.disjoint(this,t)},j.prototype.crosses=function(t){return no.crosses(this,t)},j.prototype.buffer=function(){if(1===arguments.length){const t=arguments[0];return bn.bufferOp(this,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return bn.bufferOp(this,t,e)}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return bn.bufferOp(this,t,e,s)}},j.prototype.convexHull=function(){return new _i(this).getConvexHull()},j.prototype.relate=function(){if(1===arguments.length){const t=arguments[0];return no.relate(this,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return no.relate(this,t).matches(e)}},j.prototype.getCentroid=function(){if(this.isEmpty())return this._factory.createPoint();const t=gi.getCentroid(this);return this.createPointFromInternalCoord(t,this)},j.prototype.getInteriorPoint=function(){if(this.isEmpty())return this._factory.createPoint();let t=null;const e=this.getDimension();t=0===e?new Ii(this):1===e?new Ei(this):new mi(this);const s=t.getInteriorPoint();return this.createPointFromInternalCoord(s,this)},j.prototype.symDifference=function(t){return oi.symDifference(this,t)},j.prototype.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},j.prototype.toText=function(){return(new Wt).write(this)},j.prototype.toString=function(){return this.toText()},j.prototype.contains=function(t){return no.contains(this,t)},j.prototype.difference=function(t){return oi.difference(this,t)},j.prototype.isSimple=function(){return new or(this).isSimple()},j.prototype.isWithinDistance=function(t,e){return!(this.getEnvelopeInternal().distance(t.getEnvelopeInternal())>e)&&ur.isWithinDistance(this,t,e)},j.prototype.distance=function(t){return ur.distance(this,t)};t.algorithm=Ci,t.densify=Ti,t.dissolve=Di,t.geom=Te,t.geomgraph=Ai,t.index=Ki,t.io=sr,t.linearref=Cl,t.noding=nr,t.operation=go,t.precision=Co,t.simplify=zo,t.triangulate=dl,t.util=Gl,t.version="2.12.1"}));
8
+ //# sourceMappingURL=jsts.min.js.map