@element-editor/ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/AGENTS.md +65 -0
  2. package/LICENSE +21 -0
  3. package/README.md +46 -2
  4. package/dist/BooleanOperations-WXcmW9Vy.cjs +1 -0
  5. package/dist/BooleanOperations-oF0WybQP.js +111 -0
  6. package/dist/DataTable-CNfB01y2.cjs +2 -0
  7. package/dist/DataTable-DNmjUwka.js +510 -0
  8. package/dist/DataTablePanel-BknCxC1K.cjs +1 -0
  9. package/dist/DataTablePanel-rWdaQubk.js +208 -0
  10. package/dist/EditToolbarBtn-SZIsnIn3.js +378 -0
  11. package/dist/EditToolbarBtn-dpCmKnzk.cjs +3 -0
  12. package/dist/FeatureEditModal-BF-fGhVD.js +77 -0
  13. package/dist/FeatureEditModal-CM6BObUO.cjs +1 -0
  14. package/dist/FeatureList-CQb2kTrV.js +520 -0
  15. package/dist/FeatureList-Csr-anLA.cjs +1 -0
  16. package/dist/FeatureRowContextMenu-BLt7VlUU.js +130 -0
  17. package/dist/FeatureRowContextMenu-Gwq3OMEA.cjs +1 -0
  18. package/dist/GeoJSONModal-BPFWeaLZ.js +886 -0
  19. package/dist/GeoJSONModal-iwUcvrg7.cjs +9 -0
  20. package/dist/SchemaEditor-BEsKUe2p.js +293 -0
  21. package/dist/SchemaEditor-qkoYMg0C.cjs +1 -0
  22. package/dist/SchemaModal-9nNrgorr.js +95 -0
  23. package/dist/SchemaModal-GrtgA7cH.cjs +1 -0
  24. package/dist/SettingsModal-6_qmRyCi.cjs +1 -0
  25. package/dist/SettingsModal-DTP0Xx_Z.js +237 -0
  26. package/dist/ShortcutsModal-CdyQlrqK.cjs +1 -0
  27. package/dist/ShortcutsModal-DwxZu71W.js +299 -0
  28. package/dist/components/ActiveDrawingToolbar.d.cts +1 -0
  29. package/dist/components/ActiveDrawingToolbar.d.ts +1 -0
  30. package/dist/components/BasemapPicker.d.cts +26 -0
  31. package/dist/components/BasemapPicker.d.ts +26 -0
  32. package/dist/components/BooleanOperations.d.cts +1 -0
  33. package/dist/components/BooleanOperations.d.ts +1 -0
  34. package/dist/components/BufferPanel.d.cts +1 -0
  35. package/dist/components/BufferPanel.d.ts +1 -0
  36. package/dist/components/DataTable.d.cts +9 -0
  37. package/dist/components/DataTable.d.ts +9 -0
  38. package/dist/components/DataTablePanel.d.cts +10 -0
  39. package/dist/components/DataTablePanel.d.ts +10 -0
  40. package/dist/components/EditingToolbar.d.cts +1 -0
  41. package/dist/components/EditingToolbar.d.ts +1 -0
  42. package/dist/components/ElementEditorErrorBoundary.d.cts +28 -0
  43. package/dist/components/ElementEditorErrorBoundary.d.ts +28 -0
  44. package/dist/components/ElementEditorUIProvider.d.cts +50 -0
  45. package/dist/components/ElementEditorUIProvider.d.ts +50 -0
  46. package/dist/components/FeatureMapContextMenu.d.cts +23 -0
  47. package/dist/components/FeatureMapContextMenu.d.ts +23 -0
  48. package/dist/components/FitBoundsButton.d.cts +6 -0
  49. package/dist/components/FitBoundsButton.d.ts +6 -0
  50. package/dist/components/FloatingToolbar.d.cts +3 -0
  51. package/dist/components/FloatingToolbar.d.ts +3 -0
  52. package/dist/components/LocateButton.d.cts +11 -0
  53. package/dist/components/LocateButton.d.ts +11 -0
  54. package/dist/components/ReadonlyBanner.d.cts +1 -0
  55. package/dist/components/ReadonlyBanner.d.ts +1 -0
  56. package/dist/components/ShortcutsModal.d.cts +1 -0
  57. package/dist/components/ShortcutsModal.d.ts +1 -0
  58. package/dist/components/SimplifyPanel.d.cts +1 -0
  59. package/dist/components/SimplifyPanel.d.ts +1 -0
  60. package/dist/components/SmoothPanel.d.cts +1 -0
  61. package/dist/components/SmoothPanel.d.ts +1 -0
  62. package/dist/components/UndoRedoToolbar.d.cts +20 -0
  63. package/dist/components/UndoRedoToolbar.d.ts +20 -0
  64. package/dist/components/VertexSelectionBar.d.cts +12 -0
  65. package/dist/components/VertexSelectionBar.d.ts +12 -0
  66. package/dist/components/ZoomIndicator.d.cts +15 -0
  67. package/dist/components/ZoomIndicator.d.ts +15 -0
  68. package/dist/components/dialogs/DynamicFieldRenderer.d.cts +11 -0
  69. package/dist/components/dialogs/DynamicFieldRenderer.d.ts +11 -0
  70. package/dist/components/dialogs/SettingsModal.d.cts +1 -0
  71. package/dist/components/dialogs/SettingsModal.d.ts +1 -0
  72. package/dist/components/lazyParts.d.cts +12 -0
  73. package/dist/components/lazyParts.d.ts +12 -0
  74. package/dist/components/sidebar/FeatureEditModal.d.cts +6 -0
  75. package/dist/components/sidebar/FeatureEditModal.d.ts +6 -0
  76. package/dist/components/sidebar/FeatureList.d.cts +4 -0
  77. package/dist/components/sidebar/FeatureList.d.ts +4 -0
  78. package/dist/components/sidebar/FeatureRow.d.cts +38 -0
  79. package/dist/components/sidebar/FeatureRow.d.ts +38 -0
  80. package/dist/components/sidebar/FeatureRowContextMenu.d.cts +12 -0
  81. package/dist/components/sidebar/FeatureRowContextMenu.d.ts +12 -0
  82. package/dist/components/sidebar/FeatureSidePanel.d.cts +8 -0
  83. package/dist/components/sidebar/FeatureSidePanel.d.ts +8 -0
  84. package/dist/components/sidebar/GeoJSONModal.d.cts +5 -0
  85. package/dist/components/sidebar/GeoJSONModal.d.ts +5 -0
  86. package/dist/components/sidebar/GroupRow.d.cts +21 -0
  87. package/dist/components/sidebar/GroupRow.d.ts +21 -0
  88. package/dist/components/sidebar/HideLayersToggle.d.cts +2 -0
  89. package/dist/components/sidebar/HideLayersToggle.d.ts +2 -0
  90. package/dist/components/sidebar/LayersPanel.d.cts +5 -0
  91. package/dist/components/sidebar/LayersPanel.d.ts +5 -0
  92. package/dist/components/sidebar/PartSubRow.d.cts +9 -0
  93. package/dist/components/sidebar/PartSubRow.d.ts +9 -0
  94. package/dist/components/sidebar/SchemaEditor.d.cts +4 -0
  95. package/dist/components/sidebar/SchemaEditor.d.ts +4 -0
  96. package/dist/components/sidebar/SchemaModal.d.cts +5 -0
  97. package/dist/components/sidebar/SchemaModal.d.ts +5 -0
  98. package/dist/components/sidebar/codeDock.d.cts +21 -0
  99. package/dist/components/sidebar/codeDock.d.ts +21 -0
  100. package/dist/components/ui/Button.d.cts +9 -0
  101. package/dist/components/ui/Button.d.ts +9 -0
  102. package/dist/components/ui/CloseButton.d.cts +6 -0
  103. package/dist/components/ui/CloseButton.d.ts +6 -0
  104. package/dist/components/ui/ContextMenu.d.cts +28 -0
  105. package/dist/components/ui/ContextMenu.d.ts +28 -0
  106. package/dist/components/ui/EditToolbarBtn.d.cts +13 -0
  107. package/dist/components/ui/EditToolbarBtn.d.ts +13 -0
  108. package/dist/components/ui/ElementToaster.d.cts +3 -0
  109. package/dist/components/ui/ElementToaster.d.ts +3 -0
  110. package/dist/components/ui/GeometryTypeIcon.d.cts +7 -0
  111. package/dist/components/ui/GeometryTypeIcon.d.ts +7 -0
  112. package/dist/components/ui/IconButton.d.cts +28 -0
  113. package/dist/components/ui/IconButton.d.ts +28 -0
  114. package/dist/components/ui/Input.d.cts +14 -0
  115. package/dist/components/ui/Input.d.ts +14 -0
  116. package/dist/components/ui/JsonCode.d.cts +4 -0
  117. package/dist/components/ui/JsonCode.d.ts +4 -0
  118. package/dist/components/ui/Kbd.d.cts +16 -0
  119. package/dist/components/ui/Kbd.d.ts +16 -0
  120. package/dist/components/ui/NoFeaturesEmptyState.d.cts +1 -0
  121. package/dist/components/ui/NoFeaturesEmptyState.d.ts +1 -0
  122. package/dist/components/ui/SearchDropdown.d.cts +28 -0
  123. package/dist/components/ui/SearchDropdown.d.ts +28 -0
  124. package/dist/components/ui/ToolButton.d.cts +19 -0
  125. package/dist/components/ui/ToolButton.d.ts +19 -0
  126. package/dist/components/ui/Tooltip.d.cts +12 -0
  127. package/dist/components/ui/Tooltip.d.ts +12 -0
  128. package/dist/components/ui/panelHeader.d.cts +2 -0
  129. package/dist/components/ui/panelHeader.d.ts +2 -0
  130. package/dist/components/ui/resizeEdge.d.cts +4 -0
  131. package/dist/components/ui/resizeEdge.d.ts +4 -0
  132. package/dist/contexts/ElementEditorConfigContext.d.cts +351 -0
  133. package/dist/contexts/ElementEditorConfigContext.d.ts +351 -0
  134. package/dist/contexts/EventContext.d.cts +69 -0
  135. package/dist/contexts/EventContext.d.ts +69 -0
  136. package/dist/contexts/MapControllerContext.d.cts +24 -0
  137. package/dist/contexts/MapControllerContext.d.ts +24 -0
  138. package/dist/contexts/ShortcutConfigContext.d.cts +16 -0
  139. package/dist/contexts/ShortcutConfigContext.d.ts +16 -0
  140. package/dist/contexts/ThemeContext.d.cts +12 -0
  141. package/dist/contexts/ThemeContext.d.ts +12 -0
  142. package/dist/element-editor-ui.cjs +1 -0
  143. package/dist/element-editor-ui.es.js +102 -0
  144. package/dist/geometryWorker-CCwg4tNC.cjs +1 -0
  145. package/dist/geometryWorker-DgQCFSmD.js +25 -0
  146. package/dist/hooks/dragShield.d.cts +7 -0
  147. package/dist/hooks/dragShield.d.ts +7 -0
  148. package/dist/hooks/themeInputs.d.cts +14 -0
  149. package/dist/hooks/themeInputs.d.ts +14 -0
  150. package/dist/hooks/useAccentPalette.d.cts +15 -0
  151. package/dist/hooks/useAccentPalette.d.ts +15 -0
  152. package/dist/hooks/useAccentStyle.d.cts +39 -0
  153. package/dist/hooks/useAccentStyle.d.ts +39 -0
  154. package/dist/hooks/useAdapterControls.d.cts +280 -0
  155. package/dist/hooks/useAdapterControls.d.ts +280 -0
  156. package/dist/hooks/useBalancedWrap.d.cts +8 -0
  157. package/dist/hooks/useBalancedWrap.d.ts +8 -0
  158. package/dist/hooks/useContextMenu.d.cts +11 -0
  159. package/dist/hooks/useContextMenu.d.ts +11 -0
  160. package/dist/hooks/useDataChangeSubscription.d.cts +9 -0
  161. package/dist/hooks/useDataChangeSubscription.d.ts +9 -0
  162. package/dist/hooks/useDragWindow.d.cts +9 -0
  163. package/dist/hooks/useDragWindow.d.ts +9 -0
  164. package/dist/hooks/useFocusTrap.d.cts +7 -0
  165. package/dist/hooks/useFocusTrap.d.ts +7 -0
  166. package/dist/hooks/useGeoJSONDrop.d.cts +40 -0
  167. package/dist/hooks/useGeoJSONDrop.d.ts +40 -0
  168. package/dist/hooks/useGeoJSONExport.d.cts +69 -0
  169. package/dist/hooks/useGeoJSONExport.d.ts +69 -0
  170. package/dist/hooks/useGeoJSONFileImport.d.cts +24 -0
  171. package/dist/hooks/useGeoJSONFileImport.d.ts +24 -0
  172. package/dist/hooks/useInlineRename.d.cts +26 -0
  173. package/dist/hooks/useInlineRename.d.ts +26 -0
  174. package/dist/hooks/useJumpToFeature.d.cts +3 -0
  175. package/dist/hooks/useJumpToFeature.d.ts +3 -0
  176. package/dist/hooks/useKeyboardShortcuts.d.cts +9 -0
  177. package/dist/hooks/useKeyboardShortcuts.d.ts +9 -0
  178. package/dist/hooks/useNominatim.d.cts +24 -0
  179. package/dist/hooks/useNominatim.d.ts +24 -0
  180. package/dist/hooks/usePanelOffset.d.cts +14 -0
  181. package/dist/hooks/usePanelOffset.d.ts +14 -0
  182. package/dist/hooks/useResizablePanel.d.cts +4 -0
  183. package/dist/hooks/useResizablePanel.d.ts +4 -0
  184. package/dist/hooks/useRootTokens.d.cts +27 -0
  185. package/dist/hooks/useRootTokens.d.ts +27 -0
  186. package/dist/hooks/useSearchState.d.cts +23 -0
  187. package/dist/hooks/useSearchState.d.ts +23 -0
  188. package/dist/hooks/useServiceAttribution.d.cts +13 -0
  189. package/dist/hooks/useServiceAttribution.d.ts +13 -0
  190. package/dist/hooks/useWindowEscape.d.cts +25 -0
  191. package/dist/hooks/useWindowEscape.d.ts +25 -0
  192. package/dist/hooks/useWindowFocus.d.cts +4 -0
  193. package/dist/hooks/useWindowFocus.d.ts +4 -0
  194. package/dist/hooks/useWorkerGeometryPreview.d.cts +22 -0
  195. package/dist/hooks/useWorkerGeometryPreview.d.ts +22 -0
  196. package/dist/index-BKdDZ4Y9.cjs +1 -0
  197. package/dist/index-CtZterPc.js +3165 -0
  198. package/dist/index.d.cts +89 -0
  199. package/dist/index.d.ts +89 -0
  200. package/dist/internal.cjs +1 -0
  201. package/dist/internal.d.cts +16 -0
  202. package/dist/internal.d.ts +16 -0
  203. package/dist/internal.es.js +42 -0
  204. package/dist/primitives.cjs +1 -0
  205. package/dist/primitives.d.cts +19 -0
  206. package/dist/primitives.d.ts +19 -0
  207. package/dist/primitives.es.js +17 -0
  208. package/dist/store/StoreContext.d.cts +17 -0
  209. package/dist/store/StoreContext.d.ts +17 -0
  210. package/dist/types/events.d.cts +95 -0
  211. package/dist/types/events.d.ts +95 -0
  212. package/dist/useAccentStyle-CPo2XqAn.js +412 -0
  213. package/dist/useAccentStyle-hsGvyHZc.cjs +1 -0
  214. package/dist/useAdapterControls-BBObhzVX.cjs +1 -0
  215. package/dist/useAdapterControls-DVjkwRZ_.js +691 -0
  216. package/dist/useContextMenu-DJ2Cti85.js +10 -0
  217. package/dist/useContextMenu-DbxMvb1s.cjs +1 -0
  218. package/dist/useFocusTrap-BBjPCfDR.cjs +1 -0
  219. package/dist/useFocusTrap-CKxKT8De.js +25 -0
  220. package/dist/useJumpToFeature-Bdz2hqOC.js +16 -0
  221. package/dist/useJumpToFeature-LwjxGzfy.cjs +1 -0
  222. package/dist/useWindowFocus-D-_yEm_V.cjs +1 -0
  223. package/dist/useWindowFocus-DGAWA1au.js +80 -0
  224. package/dist/utils/booleanValue.d.cts +4 -0
  225. package/dist/utils/booleanValue.d.ts +4 -0
  226. package/dist/utils/clipboardError.d.cts +3 -0
  227. package/dist/utils/clipboardError.d.ts +3 -0
  228. package/dist/utils/download.d.cts +42 -0
  229. package/dist/utils/download.d.ts +42 -0
  230. package/dist/utils/geojsonDocument.d.cts +168 -0
  231. package/dist/utils/geojsonDocument.d.ts +168 -0
  232. package/dist/utils/geometryWorkerClient.d.cts +6 -0
  233. package/dist/utils/geometryWorkerClient.d.ts +6 -0
  234. package/dist/utils/layerOrder.d.cts +9 -0
  235. package/dist/utils/layerOrder.d.ts +9 -0
  236. package/dist/utils/lazyWithPreload.d.cts +24 -0
  237. package/dist/utils/lazyWithPreload.d.ts +24 -0
  238. package/dist/utils/lineSmooth.d.cts +7 -0
  239. package/dist/utils/lineSmooth.d.ts +7 -0
  240. package/dist/utils/platform.d.cts +2 -0
  241. package/dist/utils/platform.d.ts +2 -0
  242. package/dist/workers/geometryWorker.d.cts +1 -0
  243. package/dist/workers/geometryWorker.d.ts +1 -0
  244. package/package.json +133 -3
@@ -0,0 +1,25 @@
1
+ const r = 'var ro=Object.defineProperty;var so=(Ct,ne,Qt)=>ne in Ct?ro(Ct,ne,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):Ct[ne]=Qt;var rt=(Ct,ne,Qt)=>so(Ct,typeof ne!="symbol"?ne+"":ne,Qt);(function(){"use strict";var br,Pr;var Ct=63710088e-1,ne={centimeters:Ct*100,centimetres:Ct*100,degrees:360/(2*Math.PI),feet:Ct*3.28084,inches:Ct*39.37,kilometers:Ct/1e3,kilometres:Ct/1e3,meters:Ct,metres:Ct,miles:Ct/1609.344,millimeters:Ct*1e3,millimetres:Ct*1e3,nauticalmiles:Ct/1852,radians:1,yards:Ct*1.0936};function Qt(a,u,l={}){const h={type:"Feature"};return(l.id===0||l.id)&&(h.id=l.id),l.bbox&&(h.bbox=l.bbox),h.properties=u||{},h.geometry=a,h}function Cs(a,u,l={}){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");if(a.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Mi(a[0])||!Mi(a[1]))throw new Error("coordinates must contain numbers");return Qt({type:"Point",coordinates:a},u,l)}function Me(a,u,l={}){for(const o of a){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let y=0;y<o[o.length-1].length;y++)if(o[o.length-1][y]!==o[0][y])throw new Error("First and last Position are not equivalent.")}return Qt({type:"Polygon",coordinates:a},u,l)}function Zn(a,u,l={}){if(a.length<2)throw new Error("coordinates must be an array of two or more positions");return Qt({type:"LineString",coordinates:a},u,l)}function Xe(a,u={}){const l={type:"FeatureCollection"};return u.id&&(l.id=u.id),u.bbox&&(l.bbox=u.bbox),l.features=a,l}function Ve(a,u,l={}){return Qt({type:"MultiPolygon",coordinates:a},u,l)}function Os(a,u="kilometers"){const l=ne[u];if(!l)throw new Error(u+" units is invalid");return a*l}function Ms(a,u="kilometers"){const l=ne[u];if(!l)throw new Error(u+" units is invalid");return a/l}function Mi(a){return!isNaN(a)&&a!==null&&!Array.isArray(a)}function bs(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function gn(a,u,l){if(a!==null)for(var h,o,y,d,g,N,x,w=0,I=0,F,B=a.type,G=B==="FeatureCollection",et=B==="Feature",K=G?a.features.length:1,ut=0;ut<K;ut++){x=G?a.features[ut].geometry:et?a.geometry:a,F=x?x.type==="GeometryCollection":!1,g=F?x.geometries.length:1;for(var q=0;q<g;q++){var H=0,it=0;if(d=F?x.geometries[q]:x,d!==null){N=d.coordinates;var W=d.type;switch(w=l&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(u(N,I,ut,H,it)===!1)return!1;I++,H++;break;case"LineString":case"MultiPoint":for(h=0;h<N.length;h++){if(u(N[h],I,ut,H,it)===!1)return!1;I++,W==="MultiPoint"&&H++}W==="LineString"&&H++;break;case"Polygon":case"MultiLineString":for(h=0;h<N.length;h++){for(o=0;o<N[h].length-w;o++){if(u(N[h][o],I,ut,H,it)===!1)return!1;I++}W==="MultiLineString"&&H++,W==="Polygon"&&it++}W==="Polygon"&&H++;break;case"MultiPolygon":for(h=0;h<N.length;h++){for(it=0,o=0;o<N[h].length;o++){for(y=0;y<N[h][o].length-w;y++){if(u(N[h][o][y],I,ut,H,it)===!1)return!1;I++}it++}H++}break;case"GeometryCollection":for(h=0;h<d.geometries.length;h++)if(gn(d.geometries[h],u,l)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function bi(a,u){if(a.type==="Feature")u(a,0);else if(a.type==="FeatureCollection")for(var l=0;l<a.features.length&&u(a.features[l],l)!==!1;l++);}function xe(a,u){var l,h,o,y,d,g,N,x,w,I,F=0,B=a.type==="FeatureCollection",G=a.type==="Feature",et=B?a.features.length:1;for(l=0;l<et;l++){for(g=B?a.features[l].geometry:G?a.geometry:a,x=B?a.features[l].properties:G?a.properties:{},w=B?a.features[l].bbox:G?a.bbox:void 0,I=B?a.features[l].id:G?a.id:void 0,N=g?g.type==="GeometryCollection":!1,d=N?g.geometries.length:1,o=0;o<d;o++){if(y=N?g.geometries[o]:g,y===null){if(u(null,F,x,w,I)===!1)return!1;continue}switch(y.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(u(y,F,x,w,I)===!1)return!1;break}case"GeometryCollection":{for(h=0;h<y.geometries.length;h++)if(u(y.geometries[h],F,x,w,I)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}F++}}function Ps(a,u={}){if(a.bbox!=null&&u.recompute!==!0)return a.bbox;const l=[1/0,1/0,-1/0,-1/0];return gn(a,h=>{l[0]>h[0]&&(l[0]=h[0]),l[1]>h[1]&&(l[1]=h[1]),l[2]<h[0]&&(l[2]=h[0]),l[3]<h[1]&&(l[3]=h[1])}),l}function As(a,u={}){const l=Ps(a),h=(l[0]+l[2])/2,o=(l[1]+l[3])/2;return Cs([h,o],u.properties,u)}function Ds(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var yn={exports:{}},Fs=yn.exports,Pi;function Gs(){return Pi||(Pi=1,(function(a,u){(function(l,h){a.exports=h()})(Fs,(function(){function l(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,n=Array(t);e<t;e++)n[e]=i[e];return n}function h(i,t,e){return t=w(t),(function(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(s){if(s===void 0)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return s})(n)})(i,F()?Reflect.construct(t,e||[],w(i).constructor):t.apply(i,e))}function o(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function y(i,t,e){if(F())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var r=new(i.bind.apply(i,n));return e&&B(r,e.prototype),r}function d(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,K(n.key),n)}}function g(i,t,e){return t&&d(i.prototype,t),e&&d(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function N(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=ut(i))||t){e&&(i=e);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(m){throw m},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,c=!0,f=!1;return{s:function(){e=e.call(i)},n:function(){var m=e.next();return c=m.done,m},e:function(m){f=!0,s=m},f:function(){try{c||e.return==null||e.return()}finally{if(f)throw s}}}}function x(){return x=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,t,e){var n=(function(s,c){for(;!{}.hasOwnProperty.call(s,c)&&(s=w(s))!==null;);return s})(i,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?i:e):r.value}},x.apply(null,arguments)}function w(i){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(i)}function I(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),t&&B(i,t)}function F(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(F=function(){return!!i})()}function B(i,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},B(i,t)}function G(i,t,e,n){var r=x(w(1&n?i.prototype:i),t,e);return 2&n&&typeof r=="function"?function(s){return r.apply(e,s)}:r}function et(i){return(function(t){if(Array.isArray(t))return l(t)})(i)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(i)||ut(i)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function K(i){var t=(function(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,n);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)})(i,"string");return typeof t=="symbol"?t:t+""}function ut(i,t){if(i){if(typeof i=="string")return l(i,t);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?l(i,t):void 0}}function q(i){var t=typeof Map=="function"?new Map:void 0;return q=function(e){if(e===null||!(function(r){try{return Function.toString.call(r).indexOf("[native code]")!==-1}catch{return typeof r=="function"}})(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return y(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),B(n,e)},q(i)}var H=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=i.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=i.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==i.JOIN_ROUND&&(this._quadrantSegments=i.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=i.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=i.CAP_ROUND,this._joinStyle=i.JOIN_ROUND,this._mitreLimit=i.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=i.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(s),this.setJoinStyle(c),this.setMitreLimit(f)}}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}])})();H.CAP_ROUND=1,H.CAP_FLAT=2,H.CAP_SQUARE=3,H.JOIN_ROUND=1,H.JOIN_MITRE=2,H.JOIN_BEVEL=3,H.DEFAULT_QUADRANT_SEGMENTS=8,H.DEFAULT_MITRE_LIMIT=5,H.DEFAULT_SIMPLIFY_FACTOR=.01;var it=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({Exception:t})[0],n}return I(t,i),g(t,[{key:"toString",value:function(){return this.message}}])})(q(Error)),W=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({IllegalArgumentException:t})[0],n}return I(t,i),g(t)})(it),J=(function(){return g((function i(){o(this,i)}),[{key:"filter",value:function(i){}}])})();function $(){}function v(){}function p(){}var E,M,L,O,T,S,R,P,b=(function(){return g((function i(){o(this,i)}),null,[{key:"equalsWithTolerance",value:function(i,t,e){return Math.abs(i-t)<=e}}])})(),Y=(function(){return g((function i(t,e){o(this,i),this.low=e||0,this.high=t||0}),null,[{key:"toBinaryString",value:function(i){var t,e="";for(t=2147483648;t>0;t>>>=1)e+=(i.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)e+=(i.low&t)===t?"1":"0";return e}}])})();function z(){}function j(){}z.NaN=NaN,z.isNaN=function(i){return Number.isNaN(i)},z.isInfinite=function(i){return!Number.isFinite(i)},z.MAX_VALUE=Number.MAX_VALUE,z.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,z.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(S=2146435072,R=new Float64Array(1),P=new Int32Array(R.buffer),z.doubleToLongBits=function(i){R[0]=i;var t=0|P[0],e=0|P[1];return(e&S)===S&&1048575&e&&t!==0&&(t=0,e=2146959360),new Y(e,t)},z.longBitsToDouble=function(i){return P[0]=i.low,P[1]=i.high,R[0]}):(E=1023,M=Math.log2,L=Math.floor,O=Math.pow,T=(function(){for(var i=53;i>0;i--){var t=O(2,i)-1;if(L(M(t))+1===i)return t}return 0})(),z.doubleToLongBits=function(i){var t,e,n,r,s,c,f,m,_;if(i<0||1/i===Number.NEGATIVE_INFINITY?(c=1<<31,i=-i):c=0,i===0)return new Y(m=c,_=0);if(i===1/0)return new Y(m=2146435072|c,_=0);if(i!=i)return new Y(m=2146959360,_=0);if(r=0,_=0,(t=L(i))>1)if(t<=T)(r=L(M(t)))<=20?(_=0,m=t<<20-r&1048575):(_=t%(e=O(2,n=r-20))<<32-n,m=t/e&1048575);else for(n=t,_=0;(n=L(e=n/2))!==0;)r++,_>>>=1,_|=(1&m)<<31,m>>>=1,e!==n&&(m|=524288);if(f=r+E,s=t===0,t=i-t,r<52&&t!==0)for(n=0;;){if((e=2*t)>=1?(t=e-1,s?(f--,s=!1):(n<<=1,n|=1,r++)):(t=e,s?--f==0&&(r++,s=!1):(n<<=1,r++)),r===20)m|=n,n=0;else if(r===52){_|=n;break}if(e===1){r<20?m|=n<<20-r:r<52&&(_|=n<<52-r);break}}return m|=f<<20,new Y(m|=c,_)},z.longBitsToDouble=function(i){var t,e,n,r,s=i.high,c=i.low,f=s&1<<31?-1:1;for(n=((2146435072&s)>>20)-E,r=0,e=1<<19,t=1;t<=20;t++)s&e&&(r+=O(2,-t)),e>>>=1;for(e=1<<31,t=21;t<=52;t++)c&e&&(r+=O(2,-t)),e>>>=1;if(n===-1023){if(r===0)return 0*f;n=-1022}else{if(n===1024)return r===0?f/0:NaN;r+=1}return f*r*O(2,n)});var at=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({RuntimeException:t})[0],n}return I(t,i),g(t)})(it),yt=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)at.constructor_.call(this);else if(arguments.length===1){var e=arguments[0];at.constructor_.call(this,e)}}}])})(at),nt=(function(){function i(){o(this,i)}return g(i,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)i.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new yt("Should never reach here"+(t!==null?": "+t:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var t=arguments[0];i.isTrue(t,null)}else if(arguments.length===2){var e=arguments[1];if(!arguments[0])throw e===null?new yt:new yt(e)}}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];i.equals(t,e,null)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];if(!r.equals(n))throw new yt("Expected "+n+" but encountered "+r+(s!==null?": "+s:""))}}}])})(),ft=new ArrayBuffer(8),kt=new Float64Array(ft),Mt=new Int32Array(ft),A=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getM",value:function(){return z.NaN}},{key:"setOrdinate",value:function(t,e){switch(t){case i.X:this.x=e;break;case i.Y:this.y=e;break;case i.Z:this.setZ(e);break;default:throw new W("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],n=arguments[1];return!!b.equalsWithTolerance(this.x,e.x,n)&&!!b.equalsWithTolerance(this.y,e.y,n)}}},{key:"setM",value:function(t){throw new W("Invalid ordinate index: "+i.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case i.X:return this.x;case i.Y:return this.y;case i.Z:return this.getZ()}throw new W("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||z.isNaN(this.getZ())&&z.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof i&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return b.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return nt.shouldNeverReachHere("this shouldn\'t happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new i(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.getZ()-t.getZ();return Math.sqrt(e*e+n*n+r*r)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*t+i.hashCode(this.x))+i.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[$,v,p]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)i.constructor_.call(this,0,0);else if(arguments.length===1){var t=arguments[0];i.constructor_.call(this,t.x,t.y,t.getZ())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];i.constructor_.call(this,e,n,i.NULL_ORDINATE)}else if(arguments.length===3){var r=arguments[0],s=arguments[1],c=arguments[2];this.x=r,this.y=s,this.z=c}}},{key:"hashCode",value:function(t){return kt[0]=t,Mt[0]^Mt[1]}}])})(),tn=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"compare",value:function(t,e){var n=i.compare(t.x,e.x);if(n!==0)return n;var r=i.compare(t.y,e.y);return r!==0?r:this._dimensionsToTest<=2?0:i.compare(t.getZ(),e.getZ())}},{key:"interfaces_",get:function(){return[j]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)i.constructor_.call(this,2);else if(arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new W("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:z.isNaN(t)?z.isNaN(e)?0:-1:z.isNaN(e)?1:0}}])})();A.DimensionalComparator=tn,A.NULL_ORDINATE=z.NaN,A.X=0,A.Y=1,A.Z=2,A.M=3;var Et=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof i))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new i;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny;return new i(e,this._maxx<t._maxx?this._maxx:t._maxx,n,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof A){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof i){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var 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 A){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){if(arguments[0]instanceof A&&arguments[1]instanceof A){var n=arguments[0],r=arguments[1];return!this.isNull()&&!((n.x<r.x?n.x:r.x)>this._maxx)&&!((n.x>r.x?n.x:r.x)<this._minx)&&!((n.y<r.y?n.y:r.y)>this._maxy)&&!((n.y>r.y?n.y:r.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],c=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||c>this._maxy||c<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof A){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(t){var 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}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new i(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e}},{key:"expandBy",value:function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof A){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}}},{key:"centre",value:function(){return this.isNull()?null:new A((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof A){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var s=arguments[0],c=arguments[1],f=arguments[2],m=arguments[3];s<c?(this._minx=s,this._maxx=c):(this._minx=c,this._maxx=s),f<m?(this._miny=f,this._maxy=m):(this._miny=m,this._maxy=f)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+A.hashCode(this._minx))+A.hashCode(this._maxx))+A.hashCode(this._miny))+A.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[$,p]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof A){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var s=arguments[0],c=arguments[1],f=arguments[2],m=arguments[3];this.init(s,c,f,m)}}},{key:"intersects",value:function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(arguments.length===4){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3],m=Math.min(c.x,f.x),_=Math.max(c.x,f.x),C=Math.min(r.x,s.x),D=Math.max(r.x,s.x);return!(C>_)&&!(D<m)&&(m=Math.min(c.y,f.y),_=Math.max(c.y,f.y),C=Math.min(r.y,s.y),D=Math.max(r.y,s.y),!(C>_)&&!(D<m))}}}])})(),Q=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===i.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(t){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(t){return this===t||this.equalsExact(t,0)}},{key:"geometryChanged",value:function(){this.apply(i.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return t!==null&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(arguments.length===1){var 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(arguments.length===2){var n=arguments[0],r=arguments[1];return t=n,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(n,r)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(t){if(t.getTypeCode()===i.TYPECODE_GEOMETRYCOLLECTION)throw new W("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,n){return n===0?t.equals(e):t.distance(e)<=n}},{key:"norm",value:function(){var t=this.copy();return t.normalize(),t}},{key:"reverse",value:function(){var t=this.reverseInternal();return this.envelope!=null&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=this._envelope==null?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Et(this._envelope)}},{key:"setSRID",value:function(t){this._SRID=t}},{key:"setUserData",value:function(t){this._userData=t}},{key:"compare",value:function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var s=n.next(),c=r.next(),f=s.compareTo(c);if(f!==0)return f}return n.hasNext()?1:r.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(t){return this.getClass()===t.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===i.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===i.TYPECODE_MULTIPOINT||this.getTypeCode()===i.TYPECODE_MULTILINESTRING||this.getTypeCode()===i.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[v,$,p]}},{key:"getClass",value:function(){return i}}],[{key:"hasNonEmptyElements",value:function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1}}])})();Q.constructor_=function(i){i&&(this._envelope=null,this._userData=null,this._factory=i,this._SRID=i.getSRID())},Q.TYPECODE_POINT=0,Q.TYPECODE_MULTIPOINT=1,Q.TYPECODE_LINESTRING=2,Q.TYPECODE_LINEARRING=3,Q.TYPECODE_MULTILINESTRING=4,Q.TYPECODE_POLYGON=5,Q.TYPECODE_MULTIPOLYGON=6,Q.TYPECODE_GEOMETRYCOLLECTION=7,Q.TYPENAME_POINT="Point",Q.TYPENAME_MULTIPOINT="MultiPoint",Q.TYPENAME_LINESTRING="LineString",Q.TYPENAME_LINEARRING="LinearRing",Q.TYPENAME_MULTILINESTRING="MultiLineString",Q.TYPENAME_POLYGON="Polygon",Q.TYPENAME_MULTIPOLYGON="MultiPolygon",Q.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",Q.geometryChangedFilter={get interfaces_(){return[J]},filter:function(i){i.geometryChangedAction()}};var k=(function(){function i(){o(this,i)}return g(i,null,[{key:"toLocationSymbol",value:function(t){switch(t){case i.EXTERIOR:return"e";case i.BOUNDARY:return"b";case i.INTERIOR:return"i";case i.NONE:return"-"}throw new W("Unknown location value: "+t)}}])})();k.INTERIOR=0,k.BOUNDARY=1,k.EXTERIOR=2,k.NONE=-1;var Rt=(function(){return g((function i(){o(this,i)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),Ot=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({NoSuchElementException:t})[0],n}return I(t,i),g(t)})(it),_t=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({UnsupportedOperationException:t})[0],n}return I(t,i),g(t)})(it),Ar=(function(i){function t(){return o(this,t),h(this,t,arguments)}return I(t,i),g(t,[{key:"contains",value:function(){}}])})(Rt),hi=(function(i){function t(e){var n;return o(this,t),(n=h(this,t)).map=new Map,e instanceof Rt&&n.addAll(e),n}return I(t,i),g(t,[{key:"contains",value:function(e){var n=e.hashCode?e.hashCode():e;return!!this.map.has(n)}},{key:"add",value:function(e){var n=e.hashCode?e.hashCode():e;return!this.map.has(n)&&!!this.map.set(n,e)}},{key:"addAll",value:function(e){var n,r=N(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.add(s)}}catch(c){r.e(c)}finally{r.f()}return!0}},{key:"remove",value:function(){throw new _t}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new Qa(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(Ar),Qa=(function(){return g((function i(t){o(this,i),this.iterator=t.values();var e=this.iterator.next(),n=e.done,r=e.value;this.done=n,this.value=r}),[{key:"next",value:function(){if(this.done)throw new Ot;var i=this.value,t=this.iterator.next(),e=t.done,n=t.value;return this.done=e,this.value=n,i}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new _t}}])})(),X=(function(){function i(){o(this,i)}return g(i,null,[{key:"opposite",value:function(t){return t===i.LEFT?i.RIGHT:t===i.RIGHT?i.LEFT:t}}])})();X.ON=0,X.LEFT=1,X.RIGHT=2;var Dr=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({EmptyStackException:t})[0],n}return I(t,i),g(t)})(it),Fr=(function(i){function t(e){var n;return o(this,t),(n=h(this,t,[e])).name=Object.keys({IndexOutOfBoundsException:t})[0],n}return I(t,i),g(t)})(it),Ne=(function(i){function t(){return o(this,t),h(this,t,arguments)}return I(t,i),g(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Rt),$a=(function(i){function t(){var e;return o(this,t),(e=h(this,t)).array=[],e}return I(t,i),g(t,[{key:"add",value:function(e){return this.array.push(e),!0}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new Fr;return this.array[e]}},{key:"push",value:function(e){return this.array.push(e),e}},{key:"pop",value:function(){if(this.array.length===0)throw new Dr;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Dr;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(e){return this.array.indexOf(e)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(Ne);function gt(i,t){return i.interfaces_&&i.interfaces_.indexOf(t)>-1}var en=(function(){return g((function i(t){o(this,i),this.str=t}),[{key:"append",value:function(i){this.str+=i}},{key:"setCharAt",value:function(i,t){this.str=this.str.substr(0,i)+t+this.str.substr(i+1)}},{key:"toString",value:function(){return this.str}}])})(),An=(function(){function i(t){o(this,i),this.value=t}return g(i,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.value<t?-1:this.value>t?1:0}}],[{key:"compare",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new i(t)}}])})(),ci=(function(){return g((function i(){o(this,i)}),null,[{key:"isWhitespace",value:function(i){return i<=32&&i>=0||i===127}},{key:"toUpperCase",value:function(i){return i.toUpperCase()}}])})(),lt=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,e){var n=this.abs(),r=i.magnitude(n._hi),s=i.TEN.pow(r);(n=n.divide(s)).gt(i.TEN)?(n=n.divide(i.TEN),r+=1):n.lt(i.ONE)&&(n=n.multiply(i.TEN),r-=1);for(var c=r+1,f=new en,m=i.MAX_PRINT_DIGITS-1,_=0;_<=m;_++){t&&_===c&&f.append(".");var C=Math.trunc(n._hi);if(C<0)break;var D=!1,U=0;C>9?(D=!0,U="9"):U="0"+C,f.append(U),n=n.subtract(i.valueOf(C)).multiply(i.TEN),D&&n.selfAdd(i.TEN);var Z=!0,tt=i.magnitude(n._hi);if(tt<0&&Math.abs(tt)>=m-_&&(Z=!1),!Z)break}return e[0]=r,f.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof i){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n,r,s,c,f=arguments[0],m=arguments[1],_=null,C=null,D=null,U=null;return s=this._hi/f,U=(_=(D=i.SPLIT*s)-(_=D-s))*(C=(U=i.SPLIT*f)-(C=U-f))-(c=s*f)+_*(r=f-C)+(n=s-_)*C+n*r,U=s+(D=(this._hi-c-U+this._lo-s*m)/f),this._hi=U,this._lo=s-U+D,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof i){var t,e,n,r,s=arguments[0],c=null,f=null,m=null,_=null;return t=(n=this._hi/s._hi)-(c=(m=i.SPLIT*n)-(c=m-n)),_=c*(f=(_=i.SPLIT*s._hi)-(f=_-s._hi))-(r=n*s._hi)+c*(e=s._hi-f)+t*f+t*e,new i(_=n+(m=(this._hi-r-_+this._lo-n*s._lo)/s._hi),n-_+m)}if(typeof arguments[0]=="number"){var C=arguments[0];return z.isNaN(C)?i.createNaN():i.copy(this).selfDivide(C,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(t===0)return i.valueOf(1);var e=new i(this),n=i.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return i.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new i(t,e)}},{key:"compareTo",value:function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return i.valueOf(0);if(this.isNegative())return i.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=i.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e,n,r,s,c,f=arguments[0],m=null;return m=(r=this._hi+f)-(s=r-this._hi),n=(c=(m=f-s+(this._hi-m))+this._lo)+(r-(e=r+c)),this._hi=e+n,this._lo=n+(e-this._hi),this}}else if(arguments.length===2){var _,C,D,U,Z=arguments[0],tt=arguments[1],st=null,dt=null,mt=null;D=this._hi+Z,C=this._lo+tt,dt=D-(mt=D-this._hi),st=C-(U=C-this._lo);var It=(_=D+(mt=(dt=Z-mt+(this._hi-dt))+C))+(mt=(st=tt-U+(this._lo-st))+(mt+(D-_))),Dt=mt+(_-It);return this._hi=It,this._lo=Dt,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n,r,s=arguments[0],c=arguments[1],f=null,m=null,_=null,C=null;f=(_=i.SPLIT*this._hi)-this._hi,C=i.SPLIT*s,f=_-f,n=this._hi-f,m=C-s;var D=(_=this._hi*s)+(C=f*(m=C-m)-_+f*(r=s-m)+n*m+n*r+(this._hi*c+this._lo*s)),U=C+(f=_-D);return this._hi=D,this._lo=U,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return i.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new i(t,e)}},{key:"negate",value:function(){return this.isNaN()?this:new i(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return t.isNaN()?i.createNaN():i.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return z.isNaN(e)?i.createNaN():i.copy(this).selfMultiply(e,0)}}},{key:"isNaN",value:function(){return z.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=i.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,s=n;if(n.charAt(0)===".")s="0"+n;else if(r<0)s="0."+i.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var c=r-n.length;s=n+i.stringOfChar("0",c)+".0"}return this.isNegative()?"-"+s:s}},{key:"reciprocal",value:function(){var t,e,n,r,s=null,c=null,f=null,m=null;t=(n=1/this._hi)-(s=(f=i.SPLIT*n)-(s=f-n)),c=(m=i.SPLIT*this._hi)-this._hi;var _=n+(f=(1-(r=n*this._hi)-(m=s*(c=m-c)-r+s*(e=this._hi-c)+t*c+t*e)-n*this._lo)/this._hi);return new i(_,n-_+f)}},{key:"toSciNotation",value:function(){if(this.isZero())return i.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=i.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+n);var s="";n.length>1&&(s=n.substring(1));var c=n.charAt(0)+"."+s;return this.isNegative()?"-"+c+r:c+r}},{key:"abs",value:function(){return this.isNaN()?i.NaN:this.isNegative()?this.negate():new i(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}},{key:"add",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return i.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return i.copy(this).selfAdd(e)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof i){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}}},{key:"gt",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?i.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[p,$,v]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof i){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var n=arguments[0];i.constructor_.call(this,i.parse(n))}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r,s)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];return i.determinant(i.valueOf(t),i.valueOf(e),i.valueOf(n),i.valueOf(r))}if(arguments[3]instanceof i&&arguments[2]instanceof i&&arguments[0]instanceof i&&arguments[1]instanceof i){var s=arguments[1],c=arguments[2],f=arguments[3];return arguments[0].multiply(f).selfSubtract(s.multiply(c))}}},{key:"sqr",value:function(t){return i.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var t=arguments[0];return i.parse(t)}if(typeof arguments[0]=="number")return new i(arguments[0])}},{key:"sqrt",value:function(t){return i.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var e=0,n=t.length;ci.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var s=t.charAt(e);s!=="-"&&s!=="+"||(e++,s==="-"&&(r=!0))}for(var c=new i,f=0,m=0,_=0,C=!1;!(e>=n);){var D=t.charAt(e);if(e++,ci.isDigit(D)){var U=D-"0";c.selfMultiply(i.TEN),c.selfAdd(U),f++}else{if(D!=="."){if(D==="e"||D==="E"){var Z=t.substring(e);try{_=An.parseInt(Z)}catch(It){throw It instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+Z+" in string "+t):It}break}throw new NumberFormatException("Unexpected character \'"+D+"\' at position "+e+" in string "+t)}m=f,C=!0}}var tt=c;C||(m=f);var st=f-m-_;if(st===0)tt=c;else if(st>0){var dt=i.TEN.pow(st);tt=c.divide(dt)}else if(st<0){var mt=i.TEN.pow(-st);tt=c.multiply(mt)}return r?tt.negate():tt}},{key:"createNaN",value:function(){return new i(z.NaN,z.NaN)}},{key:"copy",value:function(t){return new i(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r}},{key:"stringOfChar",value:function(t,e){for(var n=new en,r=0;r<e;r++)n.append(t);return n.toString()}}])})();lt.PI=new lt(3.141592653589793,12246467991473532e-32),lt.TWO_PI=new lt(6.283185307179586,24492935982947064e-32),lt.PI_2=new lt(1.5707963267948966,6123233995736766e-32),lt.E=new lt(2.718281828459045,14456468917292502e-32),lt.NaN=new lt(z.NaN,z.NaN),lt.EPS=123259516440783e-46,lt.SPLIT=134217729,lt.MAX_PRINT_DIGITS=32,lt.TEN=lt.valueOf(10),lt.ONE=lt.valueOf(1),lt.SCI_NOT_EXPONENT_CHAR="E",lt.SCI_NOT_ZERO="0.0E0";var fi=(function(){function i(){o(this,i)}return g(i,null,[{key:"orientationIndex",value:function(t,e,n){var r=i.orientationIndexFilter(t,e,n);if(r<=1)return r;var s=lt.valueOf(e.x).selfAdd(-t.x),c=lt.valueOf(e.y).selfAdd(-t.y),f=lt.valueOf(n.x).selfAdd(-e.x),m=lt.valueOf(n.y).selfAdd(-e.y);return s.selfMultiply(m).selfSubtract(c.selfMultiply(f)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof lt&&arguments[2]instanceof lt&&arguments[0]instanceof lt&&arguments[1]instanceof lt){var t=arguments[1],e=arguments[2],n=arguments[3];return arguments[0].multiply(n).selfSubtract(t.multiply(e)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3],m=lt.valueOf(r),_=lt.valueOf(s),C=lt.valueOf(c),D=lt.valueOf(f);return m.multiply(D).selfSubtract(_.multiply(C)).signum()}}},{key:"intersection",value:function(t,e,n,r){var s=new lt(t.y).selfSubtract(e.y),c=new lt(e.x).selfSubtract(t.x),f=new lt(t.x).selfMultiply(e.y).selfSubtract(new lt(e.x).selfMultiply(t.y)),m=new lt(n.y).selfSubtract(r.y),_=new lt(r.x).selfSubtract(n.x),C=new lt(n.x).selfMultiply(r.y).selfSubtract(new lt(r.x).selfMultiply(n.y)),D=c.multiply(C).selfSubtract(_.multiply(f)),U=m.multiply(f).selfSubtract(s.multiply(C)),Z=s.multiply(_).selfSubtract(m.multiply(c)),tt=D.selfDivide(Z).doubleValue(),st=U.selfDivide(Z).doubleValue();return z.isNaN(tt)||z.isInfinite(tt)||z.isNaN(st)||z.isInfinite(st)?null:new A(tt,st)}},{key:"orientationIndexFilter",value:function(t,e,n){var r=null,s=(t.x-n.x)*(e.y-n.y),c=(t.y-n.y)*(e.x-n.x),f=s-c;if(s>0){if(c<=0)return i.signum(f);r=s+c}else{if(!(s<0)||c>=0)return i.signum(f);r=-s-c}var m=i.DP_SAFE_EPSILON*r;return f>=m||-f>=m?i.signum(f):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}])})();fi.DP_SAFE_EPSILON=1e-15;var vt=(function(){return g((function i(){o(this,i)}),[{key:"getM",value:function(i){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(i,t)}return z.NaN}},{key:"setOrdinate",value:function(i,t,e){}},{key:"getZ",value:function(i){return this.hasZ()?this.getOrdinate(i,2):z.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(i,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(i){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(i){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(i){}},{key:"copy",value:function(){}},{key:"getY",value:function(i){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[v]}}])})();vt.X=0,vt.Y=1,vt.Z=2,vt.M=3;var ht=(function(){function i(){o(this,i)}return g(i,null,[{key:"index",value:function(t,e,n){return fi.orientationIndex(t,e,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],e=t.length-1;if(e<3)throw new W("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,s=1;s<=e;s++){var c=t[s];c.y>n.y&&(n=c,r=s)}var f=r;do(f-=1)<0&&(f=e);while(t[f].equals2D(n)&&f!==r);var m=r;do m=(m+1)%e;while(t[m].equals2D(n)&&m!==r);var _=t[f],C=t[m];if(_.equals2D(n)||C.equals2D(n)||_.equals2D(C))return!1;var D=i.index(_,n,C);return D===0?_.x>C.x:D>0}if(gt(arguments[0],vt)){var U=arguments[0],Z=U.size()-1;if(Z<3)throw new W("Ring has fewer than 4 points, so orientation cannot be determined");for(var tt=U.getCoordinate(0),st=0,dt=1;dt<=Z;dt++){var mt=U.getCoordinate(dt);mt.y>tt.y&&(tt=mt,st=dt)}var It=null,Dt=st;do(Dt-=1)<0&&(Dt=Z),It=U.getCoordinate(Dt);while(It.equals2D(tt)&&Dt!==st);var Ft=null,Oe=st;do Oe=(Oe+1)%Z,Ft=U.getCoordinate(Oe);while(Ft.equals2D(tt)&&Oe!==st);if(It.equals2D(tt)||Ft.equals2D(tt)||It.equals2D(Ft))return!1;var cn=i.index(It,tt,Ft);return cn===0?It.x>Ft.x:cn>0}}}])})();ht.CLOCKWISE=-1,ht.RIGHT=ht.CLOCKWISE,ht.COUNTERCLOCKWISE=1,ht.LEFT=ht.COUNTERCLOCKWISE,ht.COLLINEAR=0,ht.STRAIGHT=ht.COLLINEAR;var tu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(i,t){var e=this.getRightmostSideOfSegment(i,t);return e<0&&(e=this.getRightmostSideOfSegment(i,t-1)),e<0&&(this._minCoord=null,this.checkForRightmostCoordinate(i)),e}},{key:"findRightmostEdgeAtVertex",value:function(){var i=this._minDe.getEdge().getCoordinates();nt.isTrue(this._minIndex>0&&this._minIndex<i.length,"rightmost point expected to be interior vertex of edge");var t=i[this._minIndex-1],e=i[this._minIndex+1],n=ht.index(this._minCoord,e,t),r=!1;(t.y<this._minCoord.y&&e.y<this._minCoord.y&&n===ht.COUNTERCLOCKWISE||t.y>this._minCoord.y&&e.y>this._minCoord.y&&n===ht.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(i,t){var e=i.getEdge().getCoordinates();if(t<0||t+1>=e.length||e[t].y===e[t+1].y)return-1;var n=X.LEFT;return e[t].y<e[t+1].y&&(n=X.RIGHT),n}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(i){for(var t=i.getEdge().getCoordinates(),e=0;e<t.length-1;e++)(this._minCoord===null||t[e].x>this._minCoord.x)&&(this._minDe=i,this._minIndex=e,this._minCoord=t[e])}},{key:"findRightmostEdgeAtNode",value:function(){var i=this._minDe.getNode().getEdges();this._minDe=i.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next();e.isForward()&&this.checkForRightmostCoordinate(e)}nt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===X.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),ge=(function(i){function t(e,n){var r;return o(this,t),(r=h(this,t,[n?e+" [ "+n+" ]":e])).pt=n?new A(n):void 0,r.name=Object.keys({TopologyException:t})[0],r}return I(t,i),g(t,[{key:"getCoordinate",value:function(){return this.pt}}])})(at),eu=(function(){return g((function i(){o(this,i),this.array=[]}),[{key:"addLast",value:function(i){this.array.push(i)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),ot=(function(i){function t(e){var n;return o(this,t),(n=h(this,t)).array=[],e instanceof Rt&&n.addAll(e),n}return I(t,i),g(t,[{key:"interfaces_",get:function(){return[Ne,Rt]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(e){return arguments.length===1?this.array.push(e):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(e){var n,r=N(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.array.push(s)}}catch(c){r.e(c)}finally{r.f()}}},{key:"set",value:function(e,n){var r=this.array[e];return this.array[e]=n,r}},{key:"iterator",value:function(){return new nu(this)}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new Fr;return this.array[e]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(e){e?this.array.sort((function(n,r){return e.compare(n,r)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(e){for(var n=0,r=this.array.length;n<r;n++)if(this.array[n]===e)return!!this.array.splice(n,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(Ne),nu=(function(){return g((function i(t){o(this,i),this.arrayList=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Ot;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(i){return this.arrayList.set(this.position-1,i)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),iu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var i=this._dirEdgeList.iterator();i.hasNext();)i.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(i){for(var t=null,e=i.getEdges().iterator();e.hasNext();){var n=e.next();if(n.isVisited()||n.getSym().isVisited()){t=n;break}}if(t===null)throw new ge("unable to find edge to compute depths at "+i.getCoordinate());i.getEdges().computeDepths(t);for(var r=i.getEdges().iterator();r.hasNext();){var s=r.next();s.setVisited(!0),this.copySymDepths(s)}}},{key:"computeDepth",value:function(i){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(X.RIGHT,i),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(i){this.addReachable(i),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var i=this._dirEdgeList.iterator();i.hasNext();){var t=i.next();t.getDepth(X.RIGHT)>=1&&t.getDepth(X.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(i){var t=new hi,e=new eu,n=i.getNode();for(e.addLast(n),t.add(n),i.setVisited(!0);!e.isEmpty();){var r=e.removeFirst();t.add(r),this.computeNodeDepth(r);for(var s=r.getEdges().iterator();s.hasNext();){var c=s.next().getSym();if(!c.isVisited()){var f=c.getNode();t.contains(f)||(e.addLast(f),t.add(f))}}}}},{key:"compareTo",value:function(i){var t=i;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var i=new Et,t=this._dirEdgeList.iterator();t.hasNext();)for(var e=t.next().getEdge().getCoordinates(),n=0;n<e.length-1;n++)i.expandToInclude(e[n]);this._env=i}return this._env}},{key:"addReachable",value:function(i){var t=new $a;for(t.add(i);!t.empty();){var e=t.pop();this.add(e,t)}}},{key:"copySymDepths",value:function(i){var t=i.getSym();t.setDepth(X.LEFT,i.getDepth(X.RIGHT)),t.setDepth(X.RIGHT,i.getDepth(X.LEFT))}},{key:"add",value:function(i,t){i.setVisited(!0),this._nodes.add(i);for(var e=i.getEdges().iterator();e.hasNext();){var n=e.next();this._dirEdgeList.add(n);var r=n.getSym().getNode();r.isVisited()||t.push(r)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new ot,this._nodes=new ot,this._rightMostCoord=null,this._env=null,this._finder=new tu}}])})(),gi=(function(){return g((function i(){o(this,i)}),null,[{key:"intersection",value:function(i,t,e,n){var r=i.x<t.x?i.x:t.x,s=i.y<t.y?i.y:t.y,c=i.x>t.x?i.x:t.x,f=i.y>t.y?i.y:t.y,m=e.x<n.x?e.x:n.x,_=e.y<n.y?e.y:n.y,C=e.x>n.x?e.x:n.x,D=e.y>n.y?e.y:n.y,U=((r>m?r:m)+(c<C?c:C))/2,Z=((s>_?s:_)+(f<D?f:D))/2,tt=i.x-U,st=i.y-Z,dt=t.x-U,mt=t.y-Z,It=e.x-U,Dt=e.y-Z,Ft=n.x-U,Oe=n.y-Z,cn=st-mt,Is=dt-tt,Ns=tt*mt-dt*st,ws=Dt-Oe,Ss=Ft-It,Ts=It*Oe-Ft*Dt,Ls=cn*Ss-ws*Is,Ri=(Is*Ts-Ss*Ns)/Ls,Ci=(ws*Ns-cn*Ts)/Ls;return z.isNaN(Ri)||z.isInfinite(Ri)||z.isNaN(Ci)||z.isInfinite(Ci)?null:new A(Ri+U,Ci+Z)}}])})(),Zt=(function(){return g((function i(){o(this,i)}),null,[{key:"arraycopy",value:function(i,t,e,n,r){for(var s=0,c=t;c<t+r;c++)e[n+s]=i[c],s++}},{key:"getProperty",value:function(i){return{"line.separator":`\n`}[i]}}])})(),nn=(function(){function i(){o(this,i)}return g(i,null,[{key:"log10",value:function(t){var e=Math.log(t);return z.isInfinite(e)||z.isNaN(e)?e:e/i.LOG_10}},{key:"min",value:function(t,e,n,r){var s=t;return e<s&&(s=e),n<s&&(s=n),r<s&&(s=r),s}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],s=arguments[1],c=arguments[2];return r<s?s:r>c?c:r}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(arguments.length===3){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(arguments.length===4){var r=arguments[1],s=arguments[2],c=arguments[3],f=arguments[0];return r>f&&(f=r),s>f&&(f=s),c>f&&(f=c),f}}},{key:"average",value:function(t,e){return(t+e)/2}}])})();nn.LOG_10=Math.log(10);var ue=(function(){function i(){o(this,i)}return g(i,null,[{key:"segmentToSegment",value:function(t,e,n,r){if(t.equals(e))return i.pointToSegment(t,n,r);if(n.equals(r))return i.pointToSegment(r,t,e);var s=!1;if(Et.intersects(t,e,n,r)){var c=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(c===0)s=!0;else{var f=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),m=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/c,_=f/c;(_<0||_>1||m<0||m>1)&&(s=!0)}}else s=!0;return s?nn.min(i.pointToSegment(t,n,r),i.pointToSegment(e,n,r),i.pointToSegment(n,t,e),i.pointToSegment(r,t,e)):0}},{key:"pointToSegment",value:function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;if(s<=0)return t.distance(e);if(s>=1)return t.distance(n);var c=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(c)*Math.sqrt(r)}},{key:"pointToLinePerpendicular",value:function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(s)*Math.sqrt(r)}},{key:"pointToSegmentString",value:function(t,e){if(e.length===0)throw new W("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var s=i.pointToSegment(t,e[r],e[r+1]);s<n&&(n=s)}return n}}])})(),Gr=(function(){return g((function i(){o(this,i)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||gt(arguments[0],vt);else if(arguments.length!==2){if(arguments.length===3){var i=arguments[0],t=arguments[1];return this.create(i,t)}}}}])})(),Dn=(function(){return g((function i(){o(this,i)}),[{key:"filter",value:function(i){}}])})(),ru=(function(){return g((function i(){o(this,i)}),null,[{key:"ofLine",value:function(i){var t=i.size();if(t<=1)return 0;var e=0,n=new A;i.getCoordinate(0,n);for(var r=n.x,s=n.y,c=1;c<t;c++){i.getCoordinate(c,n);var f=n.x,m=n.y,_=f-r,C=m-s;e+=Math.sqrt(_*_+C*C),r=f,s=m}return e}}])})(),qr=g((function i(){o(this,i)})),we=(function(){function i(){o(this,i)}return g(i,null,[{key:"copyCoord",value:function(t,e,n,r){for(var s=Math.min(t.getDimension(),n.getDimension()),c=0;c<s;c++)n.setOrdinate(r,c,t.getOrdinate(e,c))}},{key:"isRing",value:function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,vt.X)===t.getOrdinate(e-1,vt.X)&&t.getOrdinate(0,vt.Y)===t.getOrdinate(e-1,vt.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(gt(arguments[0],vt)&&Number.isInteger(arguments[1])){var t=arguments[0],e=arguments[1];i.scroll(t,e,i.isRing(t))}else if(gt(arguments[0],vt)&&arguments[1]instanceof A){var n=arguments[0],r=arguments[1],s=i.indexOf(r,n);if(s<=0)return null;i.scroll(n,s)}}else if(arguments.length===3){var c=arguments[0],f=arguments[1],m=arguments[2];if(f<=0)return null;for(var _=c.copy(),C=m?c.size()-1:c.size(),D=0;D<C;D++)for(var U=0;U<c.getDimension();U++)c.setOrdinate(D,U,_.getOrdinate((f+D)%C,U));if(m)for(var Z=0;Z<c.getDimension();Z++)c.setOrdinate(C,Z,c.getOrdinate(0,Z))}}},{key:"isEqual",value:function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),s=0;s<n;s++)for(var c=0;c<r;c++){var f=t.getOrdinate(s,c),m=e.getOrdinate(s,c);if(t.getOrdinate(s,c)!==e.getOrdinate(s,c)&&(!z.isNaN(f)||!z.isNaN(m)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var t=arguments[0];return i.minCoordinateIndex(t,0,t.size()-1)}if(arguments.length===3){for(var e=arguments[0],n=arguments[2],r=-1,s=null,c=arguments[1];c<=n;c++){var f=e.getCoordinate(c);(s===null||s.compareTo(f)>0)&&(s=f,r=c)}return r}}},{key:"extend",value:function(t,e,n){var r=t.create(n,e.getDimension()),s=e.size();if(i.copy(e,0,r,0,s),s>0)for(var c=s;c<n;c++)i.copy(e,s-1,r,c,1);return r}},{key:"reverse",value:function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)i.swap(t,r,e-r)}},{key:"swap",value:function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var s=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,s)}}},{key:"copy",value:function(t,e,n,r,s){for(var c=0;c<s;c++)i.copyCoord(t,e+c,n,r+c)}},{key:"ensureValidRing",value:function(t,e){var n=e.size();return n===0?e:n<=3?i.createClosedRing(t,e,4):e.getOrdinate(0,vt.X)===e.getOrdinate(n-1,vt.X)&&e.getOrdinate(0,vt.Y)===e.getOrdinate(n-1,vt.Y)?e:i.createClosedRing(t,e,n+1)}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.size();n++)if(t.x===e.getOrdinate(n,vt.X)&&t.y===e.getOrdinate(n,vt.Y))return n;return-1}},{key:"createClosedRing",value:function(t,e,n){var r=t.create(n,e.getDimension()),s=e.size();i.copy(e,0,r,0,s);for(var c=s;c<n;c++)i.copy(e,0,r,c,1);return r}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.size();n++){var r=t.getCoordinate(n);(e===null||e.compareTo(r)>0)&&(e=r)}return e}}])})(),V=(function(){function i(){o(this,i)}return g(i,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case i.FALSE:return i.SYM_FALSE;case i.TRUE:return i.SYM_TRUE;case i.DONTCARE:return i.SYM_DONTCARE;case i.P:return i.SYM_P;case i.L:return i.SYM_L;case i.A:return i.SYM_A}throw new W("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(ci.toUpperCase(t)){case i.SYM_FALSE:return i.FALSE;case i.SYM_TRUE:return i.TRUE;case i.SYM_DONTCARE:return i.DONTCARE;case i.SYM_P:return i.P;case i.SYM_L:return i.L;case i.SYM_A:return i.A}throw new W("Unknown dimension symbol: "+t)}}])})();V.P=0,V.L=1,V.A=2,V.FALSE=-1,V.TRUE=-2,V.DONTCARE=-3,V.SYM_FALSE="F",V.SYM_TRUE="T",V.SYM_DONTCARE="*",V.SYM_P="0",V.SYM_L="1",V.SYM_A="2";var Fn=(function(){return g((function i(){o(this,i)}),[{key:"filter",value:function(i){}}])})(),Gn=(function(){return g((function i(){o(this,i)}),[{key:"filter",value:function(i,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),rn=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new Et:this._points.expandEnvelope(new Et)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var s=0;s<this._points.size();s++)if(!this.equal(this._points.getCoordinate(s),r._points.getCoordinate(s),n))return!1;return!0}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<Math.trunc(this._points.size()/2);e++){var n=this._points.size()-1-e;if(!this._points.getCoordinate(e).equals(this._points.getCoordinate(n))){if(this._points.getCoordinate(e).compareTo(this._points.getCoordinate(n))>0){var r=this._points.copy();we.reverse(r),this._points=r}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?V.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var e=this._points.copy();return we.reverse(e),this.getFactory().createLineString(e)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return Q.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return ru.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var e=arguments[0],n=0,r=0;n<this._points.size()&&r<e._points.size();){var s=this._points.getCoordinate(n).compareTo(e._points.getCoordinate(r));if(s!==0)return s;n++,r++}return n<this._points.size()?1:r<e._points.size()?-1:0}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._points,c._points)}}},{key:"apply",value:function(){if(gt(arguments[0],Dn))for(var e=arguments[0],n=0;n<this._points.size();n++)e.filter(this._points.getCoordinate(n));else if(gt(arguments[0],Gn)){var r=arguments[0];if(this._points.size()===0)return null;for(var s=0;s<this._points.size()&&(r.filter(this._points,s),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else gt(arguments[0],Fn)?arguments[0].filter(this):gt(arguments[0],J)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new _t}},{key:"isEquivalentClass",value:function(e){return e instanceof t}},{key:"getCoordinateN",value:function(e){return this._points.getCoordinate(e)}},{key:"getGeometryType",value:function(){return Q.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(e){if(e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),e.size()===1)throw new W("Invalid number of points in LineString (found "+e.size()+" - must be 0 or >= 2)");this._points=e}},{key:"isCoordinate",value:function(e){for(var n=0;n<this._points.size();n++)if(this._points.getCoordinate(n).equals(e))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(e){return this.getFactory().createPoint(this._points.getCoordinate(e))}},{key:"interfaces_",get:function(){return[qr]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],n=arguments[1];Q.constructor_.call(this,n),this.init(e)}}}}])})(Q),Br=g((function i(){o(this,i)})),yi=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new Et;var e=new Et;return e.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),e}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return V.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return Q.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0];return this.getCoordinate().compareTo(e.getCoordinate())}if(arguments.length===2){var n=arguments[0];return arguments[1].compare(this._coordinates,n._coordinates)}}},{key:"apply",value:function(){if(gt(arguments[0],Dn)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this.getCoordinate())}else if(gt(arguments[0],Gn)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this._coordinates,0),n.isGeometryChanged()&&this.geometryChanged()}else gt(arguments[0],Fn)?arguments[0].filter(this):gt(arguments[0],J)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return Q.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(e){e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),nt.isTrue(e.size()<=1),this._coordinates=e}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Br]}}],[{key:"constructor_",value:function(){this._coordinates=null;var e=arguments[0],n=arguments[1];Q.constructor_.call(this,n),this.init(e)}}])})(Q),Yr=(function(){function i(){o(this,i)}return g(i,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(i.ofRingSigned(t))}if(gt(arguments[0],vt)){var e=arguments[0];return Math.abs(i.ofRingSigned(e))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var s=t[r].x-n,c=t[r+1].y;e+=s*(t[r-1].y-c)}return e/2}if(gt(arguments[0],vt)){var f=arguments[0],m=f.size();if(m<3)return 0;var _=new A,C=new A,D=new A;f.getCoordinate(0,C),f.getCoordinate(1,D);var U=C.x;D.x-=U;for(var Z=0,tt=1;tt<m-1;tt++)_.y=C.y,C.x=D.x,C.y=D.y,f.getCoordinate(tt+1,D),D.x-=U,Z+=C.x*(_.y-D.y);return Z/2}}}])})(),Se=(function(){return g((function i(){o(this,i)}),null,[{key:"sort",value:function(){var i=arguments,t=arguments[0];if(arguments.length===1)t.sort((function(U,Z){return U.compareTo(Z)}));else if(arguments.length===2)t.sort((function(U,Z){return i[1].compare(U,Z)}));else if(arguments.length===3){var e=t.slice(arguments[1],arguments[2]);e.sort();var n=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);var r,s=N(n);try{for(s.s();!(r=s.n()).done;){var c=r.value;t.push(c)}}catch(U){s.e(U)}finally{s.f()}}else if(arguments.length===4){var f=t.slice(arguments[1],arguments[2]);f.sort((function(U,Z){return i[3].compare(U,Z)}));var m=t.slice(0,arguments[1]).concat(f,t.slice(arguments[2],t.length));t.splice(0,t.length);var _,C=N(m);try{for(C.s();!(_=C.n()).done;){var D=_.value;t.push(D)}}catch(U){C.e(U)}finally{C.f()}}}},{key:"asList",value:function(i){var t,e=new ot,n=N(i);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.add(r)}}catch(s){n.e(s)}finally{n.f()}return e}},{key:"copyOf",value:function(i,t){return i.slice(0,t)}}])})(),zr=g((function i(){o(this,i)})),qn=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var e=new Array(this.getNumPoints()).fill(null),n=-1,r=this._shell.getCoordinates(),s=0;s<r.length;s++)e[++n]=r[s];for(var c=0;c<this._holes.length;c++)for(var f=this._holes[c].getCoordinates(),m=0;m<f.length;m++)e[++n]=f[m];return e}},{key:"getArea",value:function(){var e=0;e+=Yr.ofRing(this._shell.getCoordinateSequence());for(var n=0;n<this._holes.length;n++)e-=Yr.ofRing(this._holes[n].getCoordinateSequence());return e}},{key:"copyInternal",value:function(){for(var e=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<this._holes.length;r++)n[r]=this._holes[r].copy();return new t(e,n,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var e=this._shell.getCoordinateSequence(),n=this.getEnvelopeInternal(),r=0;r<5;r++){var s=e.getX(r);if(s!==n.getMinX()&&s!==n.getMaxX())return!1;var c=e.getY(r);if(c!==n.getMinY()&&c!==n.getMaxY())return!1}for(var f=e.getX(0),m=e.getY(0),_=1;_<=4;_++){var C=e.getX(_),D=e.getY(_);if(C!==f==(D!==m))return!1;f=C,m=D}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,s=this._shell,c=r._shell;if(!s.equalsExact(c,n)||this._holes.length!==r._holes.length)return!1;for(var f=0;f<this._holes.length;f++)if(!this._holes[f].equalsExact(r._holes[f],n))return!1;return!0}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var e=0;e<this._holes.length;e++)this._holes[e]=this.normalized(this._holes[e],!1);Se.sort(this._holes)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(n.isEmpty())return null;var s=n.getCoordinateSequence(),c=we.minCoordinateIndex(s,0,s.size()-2);we.scroll(s,c,!0),ht.isCCW(s)===r&&we.reverse(s)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var e=this.getExteriorRing().reverse(),n=new Array(this.getNumInteriorRing()).fill(null),r=0;r<n.length;r++)n[r]=this.getInteriorRingN(r).reverse();return this.getFactory().createPolygon(e,n)}},{key:"getTypeCode",value:function(){return Q.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var e=0;e+=this._shell.getLength();for(var n=0;n<this._holes.length;n++)e+=this._holes[n].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=this._shell.getNumPoints(),n=0;n<this._holes.length;n++)e+=this._holes[n].getNumPoints();return e}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(e,n){var r=e.copy();return this.normalize(r,n),r}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],n=this._shell,r=e._shell;return n.compareToSameClass(r)}if(arguments.length===2){var s=arguments[1],c=arguments[0],f=this._shell,m=c._shell,_=f.compareToSameClass(m,s);if(_!==0)return _;for(var C=this.getNumInteriorRing(),D=c.getNumInteriorRing(),U=0;U<C&&U<D;){var Z=this.getInteriorRingN(U),tt=c.getInteriorRingN(U),st=Z.compareToSameClass(tt,s);if(st!==0)return st;U++}return U<C?1:U<D?-1:0}}},{key:"apply",value:function(){if(gt(arguments[0],Dn)){var e=arguments[0];this._shell.apply(e);for(var n=0;n<this._holes.length;n++)this._holes[n].apply(e)}else if(gt(arguments[0],Gn)){var r=arguments[0];if(this._shell.apply(r),!r.isDone())for(var s=0;s<this._holes.length&&(this._holes[s].apply(r),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else if(gt(arguments[0],Fn))arguments[0].filter(this);else if(gt(arguments[0],J)){var c=arguments[0];c.filter(this),this._shell.apply(c);for(var f=0;f<this._holes.length;f++)this._holes[f].apply(c)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var e=new Array(this._holes.length+1).fill(null);e[0]=this._shell;for(var n=0;n<this._holes.length;n++)e[n+1]=this._holes[n];return e.length<=1?this.getFactory().createLinearRing(e[0].getCoordinateSequence()):this.getFactory().createMultiLineString(e)}},{key:"getGeometryType",value:function(){return Q.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(e){return this._holes[e]}},{key:"interfaces_",get:function(){return[zr]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var e=arguments[0],n=arguments[1],r=arguments[2];if(Q.constructor_.call(this,r),e===null&&(e=this.getFactory().createLinearRing()),n===null&&(n=[]),Q.hasNullElements(n))throw new W("holes must not contain null elements");if(e.isEmpty()&&Q.hasNonEmptyElements(n))throw new W("shell is empty but holes are not");this._shell=e,this._holes=n}}])})(Q),su=(function(i){function t(){return o(this,t),h(this,t,arguments)}return I(t,i),g(t)})(Ar),Ur=(function(i){function t(e){var n;return o(this,t),(n=h(this,t)).array=[],e instanceof Rt&&n.addAll(e),n}return I(t,i),g(t,[{key:"contains",value:function(e){var n,r=N(this.array);try{for(r.s();!(n=r.n()).done;)if(n.value.compareTo(e)===0)return!0}catch(s){r.e(s)}finally{r.f()}return!1}},{key:"add",value:function(e){if(this.contains(e))return!1;for(var n=0,r=this.array.length;n<r;n++)if(this.array[n].compareTo(e)===1)return!!this.array.splice(n,0,e);return this.array.push(e),!0}},{key:"addAll",value:function(e){var n,r=N(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.add(s)}}catch(c){r.e(c)}finally{r.f()}return!0}},{key:"remove",value:function(){throw new _t}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new au(this.array)}}])})(su),au=(function(){return g((function i(t){o(this,i),this.array=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new Ot;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new _t}}])})(),Bt=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){for(var e=new Et,n=0;n<this._geometries.length;n++)e.expandToInclude(this._geometries[n].getEnvelopeInternal());return e}},{key:"getGeometryN",value:function(e){return this._geometries[e]}},{key:"getCoordinates",value:function(){for(var e=new Array(this.getNumPoints()).fill(null),n=-1,r=0;r<this._geometries.length;r++)for(var s=this._geometries[r].getCoordinates(),c=0;c<s.length;c++)e[++n]=s[c];return e}},{key:"getArea",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getArea();return e}},{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].equalsExact(r._geometries[s],n))return!1;return!0}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<this._geometries.length;e++)this._geometries[e].normalize();Se.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var e=V.FALSE,n=0;n<this._geometries.length;n++)e=Math.max(e,this._geometries[n].getBoundaryDimension());return e}},{key:"reverseInternal",value:function(){for(var e=this._geometries.length,n=new ot(e),r=0;r<e;r++)n.add(this._geometries[r].reverse());return this.getFactory().buildGeometry(n)}},{key:"getTypeCode",value:function(){return Q.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var e=V.FALSE,n=0;n<this._geometries.length;n++)e=Math.max(e,this._geometries[n].getDimension());return e}},{key:"getLength",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getNumPoints();return e}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],n=new Ur(Se.asList(this._geometries)),r=new Ur(Se.asList(e._geometries));return this.compare(n,r)}if(arguments.length===2){for(var s=arguments[1],c=arguments[0],f=this.getNumGeometries(),m=c.getNumGeometries(),_=0;_<f&&_<m;){var C=this.getGeometryN(_),D=c.getGeometryN(_),U=C.compareToSameClass(D,s);if(U!==0)return U;_++}return _<f?1:_<m?-1:0}}},{key:"apply",value:function(){if(gt(arguments[0],Dn))for(var e=arguments[0],n=0;n<this._geometries.length;n++)this._geometries[n].apply(e);else if(gt(arguments[0],Gn)){var r=arguments[0];if(this._geometries.length===0)return null;for(var s=0;s<this._geometries.length&&(this._geometries[s].apply(r),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else if(gt(arguments[0],Fn)){var c=arguments[0];c.filter(this);for(var f=0;f<this._geometries.length;f++)this._geometries[f].apply(c)}else if(gt(arguments[0],J)){var m=arguments[0];m.filter(this);for(var _=0;_<this._geometries.length;_++)this._geometries[_].apply(m)}}},{key:"getBoundary",value:function(){return Q.checkNotGeometryCollection(this),nt.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return Q.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],n=arguments[1];if(Q.constructor_.call(this,n),e===null&&(e=[]),Q.hasNullElements(e))throw new W("geometries must not contain null elements");this._geometries=e}}}}])})(Q),mi=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&G(t,"equalsExact",this,1).call(this,e,n)}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var e=arguments[0];return this._geometries[e].getCoordinate()}return G(t,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return V.FALSE}},{key:"getTypeCode",value:function(){return Q.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return Q.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Br]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Bt.constructor_.call(this,e,n)}}])})(Bt),sn=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return V.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||G(t,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var e=this._points.copy();return we.reverse(e),this.getFactory().createLinearRing(e)}},{key:"getTypeCode",value:function(){return Q.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!G(t,"isClosed",this,1).call(this))throw new W("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new W("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return Q.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];rn.constructor_.call(this,e,n),this.validateConstruction()}}])})(rn);sn.MINIMUM_VALID_SIZE=4;var Te=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"setOrdinate",value:function(e,n){switch(e){case t.X:this.x=n;break;case t.Y:this.y=n;break;default:throw new W("Invalid ordinate index: "+e)}}},{key:"getZ",value:function(){return A.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y}throw new W("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new W("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)A.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];A.constructor_.call(this,e.x,e.y)}else if(arguments[0]instanceof A){var n=arguments[0];A.constructor_.call(this,n.x,n.y)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];A.constructor_.call(this,r,s,A.NULL_ORDINATE)}}}])})(A);Te.X=0,Te.Y=1,Te.Z=-1,Te.M=-1;var Le=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,n){switch(e){case t.X:this.x=n;break;case t.Y:this.y=n;break;case t.M:this._m=n;break;default:throw new W("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getZ",value:function(){return A.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new W("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new W("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)A.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];A.constructor_.call(this,e.x,e.y),this._m=e._m}else if(arguments[0]instanceof A){var n=arguments[0];A.constructor_.call(this,n.x,n.y),this._m=this.getM()}}else if(arguments.length===3){var r=arguments[0],s=arguments[1],c=arguments[2];A.constructor_.call(this,r,s,A.NULL_ORDINATE),this._m=c}}}])})(A);Le.X=0,Le.Y=1,Le.Z=-1,Le.M=2;var vi=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,n){switch(e){case A.X:this.x=n;break;case A.Y:this.y=n;break;case A.Z:this.z=n;break;case A.M:this._m=n;break;default:throw new W("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getOrdinate",value:function(e){switch(e){case A.X:return this.x;case A.Y:return this.y;case A.Z:return this.getZ();case A.M:return this.getM()}throw new W("Invalid ordinate index: "+e)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)A.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];A.constructor_.call(this,e),this._m=e._m}else if(arguments[0]instanceof A){var n=arguments[0];A.constructor_.call(this,n),this._m=this.getM()}}else if(arguments.length===4){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3];A.constructor_.call(this,r,s,c),this._m=f}}}])})(A),Bn=(function(){function i(){o(this,i)}return g(i,null,[{key:"measures",value:function(t){return t instanceof Te?0:t instanceof Le||t instanceof vi?1:0}},{key:"dimension",value:function(t){return t instanceof Te?2:t instanceof Le?3:t instanceof vi?4:3}},{key:"create",value:function(){if(arguments.length===1){var t=arguments[0];return i.create(t,0)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e===2?new Te:e===3&&n===0?new A:e===3&&n===1?new Le:e===4&&n===1?new vi:new A}}}])})(),an=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getCoordinate",value:function(e){return this.get(e)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&gt(arguments[0],Rt)){for(var e=arguments[1],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return G(t,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var e=G(t,"clone",this,1).call(this),n=0;n<this.size();n++)e.add(n,this.get(n).clone());return e}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(t.coordArrayType);for(var e=this.size(),n=new Array(e).fill(null),r=0;r<e;r++)n[r]=this.get(e-r-1);return n}}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];return G(t,"add",this,1).call(this,e)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var n=arguments[0],r=arguments[1];return this.add(n,r,!0),!0}if(arguments[0]instanceof A&&typeof arguments[1]=="boolean"){var s=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(s))return null;G(t,"add",this,1).call(this,s)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var c=arguments[0],f=arguments[1];return this.add(c,f),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var m=arguments[0],_=arguments[1];if(arguments[2])for(var C=0;C<m.length;C++)this.add(m[C],_);else for(var D=m.length-1;D>=0;D--)this.add(m[D],_);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof A){var U=arguments[0],Z=arguments[1];if(!arguments[2]){var tt=this.size();if(tt>0&&(U>0&&this.get(U-1).equals2D(Z)||U<tt&&this.get(U).equals2D(Z)))return null}G(t,"add",this,1).call(this,U,Z)}}else if(arguments.length===4){var st=arguments[0],dt=arguments[1],mt=arguments[2],It=arguments[3],Dt=1;mt>It&&(Dt=-1);for(var Ft=mt;Ft!==It;Ft+=Dt)this.add(st[Ft],dt);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var e=this.get(0).copy();this.add(e,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}}}])})(ot);an.coordArrayType=new Array(0).fill(null);var bt=(function(){function i(){o(this,i)}return g(i,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(i.indexOf(r,e)<0)return r}return null}},{key:"scroll",value:function(t,e){var n=i.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);Zt.arraycopy(t,n,r,0,t.length-n),Zt.arraycopy(t,0,r,t.length-n,n),Zt.arraycopy(r,0,t,0,t.length)}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(arguments.length===3){var r=arguments[0],s=arguments[1],c=arguments[2];if(r===s)return!0;if(r===null||s===null||r.length!==s.length)return!1;for(var f=0;f<r.length;f++)if(c.compare(r[f],s[f])!==0)return!1;return!0}}},{key:"intersection",value:function(t,e){for(var n=new an,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()}},{key:"measures",value:function(t){if(t===null||t.length===0)return 0;var e,n=0,r=N(t);try{for(r.s();!(e=r.n()).done;){var s=e.value;n=Math.max(n,Bn.measures(s))}}catch(c){r.e(c)}finally{r.f()}return n}},{key:"hasRepeatedPoints",value:function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(t){return i.hasRepeatedPoints(t)?new an(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var s=t[r];t[r]=t[e-r],t[e-r]=s}}},{key:"removeNull",value:function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var r=new Array(e).fill(null);if(e===0)return r;for(var s=0,c=0;c<t.length;c++)t[c]!==null&&(r[s++]=t[c]);return r}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=t[n].copy();return e}if(arguments.length===5)for(var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3],m=arguments[4],_=0;_<m;_++)c[f+_]=r[s+_].copy()}},{key:"isEqualReversed",value:function(t,e){for(var n=0;n<t.length;n++){var r=t[n],s=e[t.length-n-1];if(r.compareTo(s)!==0)return!1}return!0}},{key:"envelope",value:function(t){for(var e=new Et,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(i.coordArrayType)}},{key:"dimension",value:function(t){if(t===null||t.length===0)return 3;var e,n=0,r=N(t);try{for(r.s();!(e=r.n()).done;){var s=e.value;n=Math.max(n,Bn.dimension(s))}}catch(c){r.e(c)}finally{r.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(t,e){return e.length>=t?e:[]}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1}},{key:"increasingDirection",value:function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(r!==0)return r}return 1}},{key:"compare",value:function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(r!==0)return r;n++}return n<e.length?-1:n<t.length?1:0}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.length;n++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e}},{key:"extract",value:function(t,e,n){e=nn.clamp(e,0,t.length);var r=(n=nn.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var s=new Array(r).fill(null);if(r===0)return s;for(var c=0,f=e;f<=n;f++)s[c++]=t[f];return s}}])})(),uu=(function(){return g((function i(){o(this,i)}),[{key:"compare",value:function(i,t){var e=i,n=t;return bt.compare(e,n)}},{key:"interfaces_",get:function(){return[j]}}])})(),ou=(function(){return g((function i(){o(this,i)}),[{key:"compare",value:function(i,t){var e=i,n=t;if(e.length<n.length)return-1;if(e.length>n.length)return 1;if(e.length===0)return 0;var r=bt.compare(e,n);return bt.isEqualReversed(e,n)?0:r}},{key:"OLDcompare",value:function(i,t){var e=i,n=t;if(e.length<n.length)return-1;if(e.length>n.length)return 1;if(e.length===0)return 0;for(var r=bt.increasingDirection(e),s=bt.increasingDirection(n),c=r>0?0:e.length-1,f=s>0?0:e.length-1,m=0;m<e.length;m++){var _=e[c].compareTo(n[f]);if(_!==0)return _;c+=r,f+=s}return 0}},{key:"interfaces_",get:function(){return[j]}}])})();bt.ForwardComparator=uu,bt.BidirectionalComparator=ou,bt.coordArrayType=new Array(0).fill(null);var Yn=(function(){return g((function i(t){o(this,i),this.str=t}),[{key:"append",value:function(i){this.str+=i}},{key:"setCharAt",value:function(i,t){this.str=this.str.substr(0,i)+t+this.str.substr(i+1)}},{key:"toString",value:function(){return this.str}}])})(),un=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():z.NaN}},{key:"setOrdinate",value:function(t,e,n){switch(e){case vt.X:this._coordinates[t].x=n;break;case vt.Y:this._coordinates[t].y=n;break;default:this._coordinates[t].setOrdinate(e,n)}}},{key:"getZ",value:function(t){return this.hasZ()?this._coordinates[t].getZ():z.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case vt.X:return this._coordinates[t].x;case vt.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0];arguments[1].setCoordinate(this._coordinates[e])}}},{key:"getCoordinateCopy",value:function(t){var e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}},{key:"createCoordinate",value:function(){return Bn.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(t){return this._coordinates[t].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}},{key:"copy",value:function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[e]),t[e]=n}return new i(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new Yn(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}},{key:"getY",value:function(t){return this._coordinates[t].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[vt,p]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];i.constructor_.call(this,t,bt.dimension(t),bt.measures(t))}else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)this._coordinates[n]=new A}else if(gt(arguments[0],vt)){var r=arguments[0];if(r===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._measures=r.getMeasures(),this._coordinates=new Array(r.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=r.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],f=arguments[1];i.constructor_.call(this,c,f,bt.measures(c))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var m=arguments[0],_=arguments[1];this._coordinates=new Array(m).fill(null),this._dimension=_;for(var C=0;C<m;C++)this._coordinates[C]=Bn.create(_)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var D=arguments[0],U=arguments[1],Z=arguments[2];this._dimension=U,this._measures=Z,this._coordinates=D===null?new Array(0).fill(null):D}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var tt=arguments[0],st=arguments[1],dt=arguments[2];this._coordinates=new Array(tt).fill(null),this._dimension=st,this._measures=dt;for(var mt=0;mt<tt;mt++)this._coordinates[mt]=this.createCoordinate()}}}}])})(),di=(function(){function i(){o(this,i)}return g(i,[{key:"readResolve",value:function(){return i.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new un(arguments[0]);if(gt(arguments[0],vt))return new un(arguments[0])}else{if(arguments.length===2){var t=arguments[1];return t>3&&(t=3),t<2&&(t=2),new un(arguments[0],t)}if(arguments.length===3){var e=arguments[2],n=arguments[1]-e;return e>1&&(e=1),n>3&&(n=3),n<2&&(n=2),new un(arguments[0],n+e,e)}}}},{key:"interfaces_",get:function(){return[Gr,p]}}],[{key:"instance",value:function(){return i.instanceObject}}])})();di.instanceObject=new di;var pi=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&G(t,"equalsExact",this,1).call(this,e,n)}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return Q.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var e=new ot,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getBoundary(),s=0;s<r.getNumGeometries();s++)e.add(r.getGeometryN(s));var c=new Array(e.size()).fill(null);return this.getFactory().createMultiLineString(e.toArray(c))}},{key:"getGeometryType",value:function(){return Q.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[zr]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Bt.constructor_.call(this,e,n)}}])})(Bt),Xr=(function(){return g((function i(){o(this,i)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),lu=(function(i){function t(){var e;return o(this,t),(e=h(this,t)).map=new Map,e}return I(t,i),g(t,[{key:"get",value:function(e){return this.map.get(e)||null}},{key:"put",value:function(e,n){return this.map.set(e,n),n}},{key:"values",value:function(){for(var e=new ot,n=this.map.values(),r=n.next();!r.done;)e.add(r.value),r=n.next();return e}},{key:"entrySet",value:function(){var e=new hi;return this.map.entries().forEach((function(n){return e.add(n)})),e}},{key:"size",value:function(){return this.map.size()}}])})(Xr),te=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"equals",value:function(t){if(!(t instanceof i))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale}},{key:"compareTo",value:function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return An.compare(n,r)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===i.FLOATING||this._modelType===i.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===i.FLOATING?t="Floating":this._modelType===i.FLOATING_SINGLE?t="Floating-Single":this._modelType===i.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var t=arguments[0];return z.isNaN(t)||this._modelType===i.FLOATING_SINGLE?t:this._modelType===i.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof A){var e=arguments[0];if(this._modelType===i.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===i.FLOATING?t=16:this._modelType===i.FLOATING_SINGLE?t=6:this._modelType===i.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}},{key:"setScale",value:function(t){this._scale=Math.abs(t)}},{key:"interfaces_",get:function(){return[p,$]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=i.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Fe){var t=arguments[0];this._modelType=t,t===i.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=i.FIXED,this.setScale(e)}else if(arguments[0]instanceof i){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}])})(),Fe=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"readResolve",value:function(){return i.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[p]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,i.nameToTypeMap.put(t,this)}}])})();Fe.nameToTypeMap=new lu,te.Type=Fe,te.FIXED=new Fe("FIXED"),te.FLOATING=new Fe("FLOATING"),te.FLOATING_SINGLE=new Fe("FLOATING SINGLE"),te.maximumPreciseValue=9007199254740992;var _i=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof Q){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&G(t,"equalsExact",this,1).call(this,e,n)}return G(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?V.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return Q.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new _t}},{key:"getGeometryType",value:function(){return Q.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[qr]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Bt.constructor_.call(this,e,n)}}])})(Bt),Ge=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"createEmpty",value:function(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 W("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new A(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new A(t.getMinX(),t.getMinY()),new A(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new A(t.getMinX(),t.getMinY()),new A(t.getMinX(),t.getMaxY()),new A(t.getMaxX(),t.getMaxY()),new A(t.getMaxX(),t.getMinY()),new A(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(gt(arguments[0],vt))return new rn(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new _i(null,this):arguments.length===1?new _i(arguments[0],this):void 0}},{key:"buildGeometry",value:function(t){for(var e=null,n=!1,r=!1,s=t.iterator();s.hasNext();){var c=s.next(),f=c.getTypeCode();e===null&&(e=f),f!==e&&(n=!0),c instanceof Bt&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(i.toGeometryArray(t));var m=t.iterator().next();if(t.size()>1){if(m instanceof qn)return this.createMultiPolygon(i.toPolygonArray(t));if(m instanceof rn)return this.createMultiLineString(i.toLineStringArray(t));if(m instanceof yi)return this.createMultiPoint(i.toPointArray(t));nt.shouldNeverReachHere("Unhandled geometry type: "+m.getGeometryType())}return m}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof A){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(gt(arguments[0],vt))return new yi(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(gt(arguments[0],vt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof sn){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2)return new qn(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new Bt(null,this):arguments.length===1?new Bt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(gt(arguments[0],vt))return new sn(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new pi(null,this):arguments.length===1?new pi(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new mi(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new mi(arguments[0],this);if(gt(arguments[0],vt)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),n=0;n<t.size();n++){var r=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());we.copy(t,n,r,0,1),e[n]=this.createPoint(r)}return this.createMultiPoint(e)}}}},{key:"interfaces_",get:function(){return[p]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)i.constructor_.call(this,new te,0);else if(arguments.length===1){if(gt(arguments[0],Gr)){var t=arguments[0];i.constructor_.call(this,new te,0,t)}else if(arguments[0]instanceof te){var e=arguments[0];i.constructor_.call(this,e,0,i.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];i.constructor_.call(this,n,r,i.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var s=arguments[0],c=arguments[1],f=arguments[2];this._precisionModel=s,this._coordinateSequenceFactory=f,this._SRID=c}}},{key:"toMultiPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return di.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}])})(),xi="XY",hu="XYZ",cu="XYM",fu="XYZM",Vr={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"},Hr="EMPTY",zn=1,ye=2,_e=3,Zr=4,qe=5,gu=6;for(var yu in Vr)Vr[yu].toUpperCase();var mu=(function(){return g((function i(t){o(this,i),this.wkt=t,this.index_=-1}),[{key:"isAlpha_",value:function(i){return i>="a"&&i<="z"||i>="A"&&i<="Z"}},{key:"isNumeric_",value:function(i,t){return i>="0"&&i<="9"||i=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(i){return i==" "||i==" "||i=="\\r"||i==`\n`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var i,t=this.nextChar_(),e=this.index_,n=t;if(t=="(")i=ye;else if(t==",")i=qe;else if(t==")")i=_e;else if(this.isNumeric_(t)||t=="-")i=Zr,n=this.readNumber_();else if(this.isAlpha_(t))i=zn,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);i=gu}return{position:e,value:n,type:i}}},{key:"readNumber_",value:function(){var i,t=this.index_,e=!1,n=!1;do i=="."?e=!0:i!="e"&&i!="E"||(n=!0),i=this.nextChar_();while(this.isNumeric_(i,e)||!n&&(i=="e"||i=="E")||n&&(i=="-"||i=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var i,t=this.index_;do i=this.nextChar_();while(this.isAlpha_(i));return this.wkt.substring(t,this.index_--).toUpperCase()}}])})(),vu=(function(){return g((function i(t,e){o(this,i),this.lexer_=t,this.token_,this.layout_=xi,this.factory=e}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(i){return this.token_.type==i}},{key:"match",value:function(i){var t=this.isTokenType(i);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var i=xi,t=this.token_;if(this.isTokenType(zn)){var e=t.value;e==="Z"?i=hu:e==="M"?i=cu:e==="ZM"&&(i=fu),i!==xi&&this.consume_()}return i}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(ye)){var i=[];do i.push(this.parseGeometry_());while(this.match(qe));if(this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(ye)){var i=this.parsePoint_();if(this.match(_e))return i}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(ye)){var i=this.parsePointList_();if(this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(ye)){var i=this.parseLineStringTextList_();if(this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var i;if(this.match(ye)){if(i=this.token_.type==ye?this.parsePointTextList_():this.parsePointList_(),this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(ye)){var i=this.parseLineStringTextList_();if(this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(ye)){var i=this.parsePolygonTextList_();if(this.match(_e))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var i=[],t=this.layout_.length,e=0;e<t;++e){var n=this.token_;if(!this.match(Zr))break;i.push(n.value)}if(i.length==t)return i;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var i=[this.parsePoint_()];this.match(qe);)i.push(this.parsePoint_());return i}},{key:"parsePointTextList_",value:function(){for(var i=[this.parsePointText_()];this.match(qe);)i.push(this.parsePointText_());return i}},{key:"parseLineStringTextList_",value:function(){for(var i=[this.parseLineStringText_()];this.match(qe);)i.push(this.parseLineStringText_());return i}},{key:"parsePolygonTextList_",value:function(){for(var i=[this.parsePolygonText_()];this.match(qe);)i.push(this.parsePolygonText_());return i}},{key:"isEmptyGeometry_",value:function(){var i=this.isTokenType(zn)&&this.token_.value==Hr;return i&&this.consume_(),i}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var i=this.factory,t=function(st){return y(A,et(st))},e=function(st){var dt=st.map((function(mt){return i.createLinearRing(mt.map(t))}));return dt.length>1?i.createPolygon(dt[0],dt.slice(1)):i.createPolygon(dt[0])},n=this.token_;if(this.match(zn)){var r=n.value;if(this.layout_=this.parseGeometryLayout_(),r=="GEOMETRYCOLLECTION"){var s=this.parseGeometryCollectionText_();return i.createGeometryCollection(s)}switch(r){case"POINT":var c=this.parsePointText_();return c?i.createPoint(y(A,et(c))):i.createPoint();case"LINESTRING":var f=this.parseLineStringText_().map(t);return i.createLineString(f);case"LINEARRING":var m=this.parseLineStringText_().map(t);return i.createLinearRing(m);case"POLYGON":var _=this.parsePolygonText_();return _&&_.length!==0?e(_):i.createPolygon();case"MULTIPOINT":var C=this.parseMultiPointText_();if(!C||C.length===0)return i.createMultiPoint();var D=C.map(t).map((function(st){return i.createPoint(st)}));return i.createMultiPoint(D);case"MULTILINESTRING":var U=this.parseMultiLineStringText_().map((function(st){return i.createLineString(st.map(t))}));return i.createMultiLineString(U);case"MULTIPOLYGON":var Z=this.parseMultiPolygonText_();if(!Z||Z.length===0)return i.createMultiPolygon();var tt=Z.map(e);return i.createMultiPolygon(tt);default:throw new Error("Invalid geometry type: "+r)}}throw new Error(this.formatErrorMessage_())}}])})();function Wr(i){if(i.isEmpty())return"";var t=i.getCoordinate(),e=[t.x,t.y];return t.z===void 0||Number.isNaN(t.z)||e.push(t.z),t.m===void 0||Number.isNaN(t.m)||e.push(t.m),e.join(" ")}function on(i){for(var t=i.getCoordinates().map((function(s){var c=[s.x,s.y];return s.z===void 0||Number.isNaN(s.z)||c.push(s.z),s.m===void 0||Number.isNaN(s.m)||c.push(s.m),c})),e=[],n=0,r=t.length;n<r;++n)e.push(t[n].join(" "));return e.join(", ")}function Kr(i){var t=[];t.push("("+on(i.getExteriorRing())+")");for(var e=0,n=i.getNumInteriorRing();e<n;++e)t.push("("+on(i.getInteriorRingN(e))+")");return t.join(", ")}var du={Point:Wr,LineString:on,LinearRing:on,Polygon:Kr,MultiPoint:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+Wr(i.getGeometryN(e))+")");return t.join(", ")},MultiLineString:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+on(i.getGeometryN(e))+")");return t.join(", ")},MultiPolygon:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+Kr(i.getGeometryN(e))+")");return t.join(", ")},GeometryCollection:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push(Jr(i.getGeometryN(e)));return t.join(", ")}};function Jr(i){var t=i.getGeometryType(),e=du[t];t=t.toUpperCase();var n=(function(r){var s="";if(r.isEmpty())return s;var c=r.getCoordinate();return c.z===void 0||Number.isNaN(c.z)||(s+="Z"),c.m===void 0||Number.isNaN(c.m)||(s+="M"),s})(i);return n.length>0&&(t+=" "+n),i.isEmpty()?t+" "+Hr:t+" ("+e(i)+")"}var pu=(function(){return g((function i(t){o(this,i),this.geometryFactory=t||new Ge,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(i){var t=new mu(i);return new vu(t,this.geometryFactory).parse()}},{key:"write",value:function(i){return Jr(i)}}])})(),ki=(function(){return g((function i(t){o(this,i),this.parser=new pu(t)}),[{key:"write",value:function(i){return this.parser.write(i)}}],[{key:"toLineString",value:function(i,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+i.x+" "+i.y+", "+t.x+" "+t.y+" )"}}])})(),wt=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new Yn;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var 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)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],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}}},{key:"getIntersection",value:function(t){return this._intPt[t]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==i.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,e){return i.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===i.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return ki.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+ki.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(t,e){return this._inputLines[t][e]}},{key:"isIntersection",value:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return 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 A,this._intPt[1]=new A,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,n){var r=Math.abs(n.x-e.x),s=Math.abs(n.y-e.y),c=-1;if(t.equals(e))c=0;else if(t.equals(n))c=r>s?r:s;else{var f=Math.abs(t.x-e.x),m=Math.abs(t.y-e.y);(c=r>s?f:m)!==0||t.equals(e)||(c=Math.max(f,m))}return nt.isTrue(!(c===0&&!t.equals(e)),"Bad distance calculation"),c}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y,c=Math.sqrt(r*r+s*s);return nt.isTrue(!(c===0&&!t.equals(e)),"Invalid distance calculation"),c}}])})();wt.DONT_INTERSECT=0,wt.DO_INTERSECT=1,wt.COLLINEAR=2,wt.NO_INTERSECTION=0,wt.POINT_INTERSECTION=1,wt.COLLINEAR_INTERSECTION=2;var Re=(function(i){function t(){return o(this,t),h(this,t)}return I(t,i),g(t,[{key:"isInSegmentEnvelopes",value:function(e){var n=new Et(this._inputLines[0][0],this._inputLines[0][1]),r=new Et(this._inputLines[1][0],this._inputLines[1][1]);return n.contains(e)&&r.contains(e)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return G(t,"computeIntersection",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,Et.intersects(n,r,e)&&ht.index(n,r,e)===0&&ht.index(r,n,e)===0)return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=wt.POINT_INTERSECTION,null;this._result=wt.NO_INTERSECTION}},{key:"intersection",value:function(e,n,r,s){var c=this.intersectionSafe(e,n,r,s);return this.isInSegmentEnvelopes(c)||(c=new A(t.nearestEndpoint(e,n,r,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c}},{key:"checkDD",value:function(e,n,r,s,c){var f=fi.intersection(e,n,r,s),m=this.isInSegmentEnvelopes(f);Zt.out.println("DD in env = "+m+" --------------------- "+f),c.distance(f)>1e-4&&Zt.out.println("Distance = "+c.distance(f))}},{key:"intersectionSafe",value:function(e,n,r,s){var c=gi.intersection(e,n,r,s);return c===null&&(c=t.nearestEndpoint(e,n,r,s)),c}},{key:"computeCollinearIntersection",value:function(e,n,r,s){var c=Et.intersects(e,n,r),f=Et.intersects(e,n,s),m=Et.intersects(r,s,e),_=Et.intersects(r,s,n);return c&&f?(this._intPt[0]=r,this._intPt[1]=s,wt.COLLINEAR_INTERSECTION):m&&_?(this._intPt[0]=e,this._intPt[1]=n,wt.COLLINEAR_INTERSECTION):c&&m?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||f||_?wt.COLLINEAR_INTERSECTION:wt.POINT_INTERSECTION):c&&_?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||f||m?wt.COLLINEAR_INTERSECTION:wt.POINT_INTERSECTION):f&&m?(this._intPt[0]=s,this._intPt[1]=e,!s.equals(e)||c||_?wt.COLLINEAR_INTERSECTION:wt.POINT_INTERSECTION):f&&_?(this._intPt[0]=s,this._intPt[1]=n,!s.equals(n)||c||m?wt.COLLINEAR_INTERSECTION:wt.POINT_INTERSECTION):wt.NO_INTERSECTION}},{key:"computeIntersect",value:function(e,n,r,s){if(this._isProper=!1,!Et.intersects(e,n,r,s))return wt.NO_INTERSECTION;var c=ht.index(e,n,r),f=ht.index(e,n,s);if(c>0&&f>0||c<0&&f<0)return wt.NO_INTERSECTION;var m=ht.index(r,s,e),_=ht.index(r,s,n);return m>0&&_>0||m<0&&_<0?wt.NO_INTERSECTION:c===0&&f===0&&m===0&&_===0?this.computeCollinearIntersection(e,n,r,s):(c===0||f===0||m===0||_===0?(this._isProper=!1,e.equals2D(r)||e.equals2D(s)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(s)?this._intPt[0]=n:c===0?this._intPt[0]=new A(r):f===0?this._intPt[0]=new A(s):m===0?this._intPt[0]=new A(e):_===0&&(this._intPt[0]=new A(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,s)),wt.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(e,n,r,s){var c=e,f=ue.pointToSegment(e,r,s),m=ue.pointToSegment(n,r,s);return m<f&&(f=m,c=n),(m=ue.pointToSegment(r,e,n))<f&&(f=m,c=r),(m=ue.pointToSegment(s,e,n))<f&&(f=m,c=s),c}}])})(wt),_u=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"countSegment",value:function(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){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(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){var s=ht.index(t,e,this._p);if(s===ht.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(s=-s),s===ht.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==k.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof A&&gt(arguments[1],vt)){for(var t=arguments[1],e=new i(arguments[0]),n=new A,r=new A,s=1;s<t.size();s++)if(t.getCoordinate(s,n),t.getCoordinate(s-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof A&&arguments[1]instanceof Array){for(var c=arguments[1],f=new i(arguments[0]),m=1;m<c.length;m++){var _=c[m],C=c[m-1];if(f.countSegment(_,C),f.isOnSegment())return f.getLocation()}return f.getLocation()}}}])})(),Ei=(function(){function i(){o(this,i)}return g(i,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof A&&gt(arguments[1],vt)){for(var t=arguments[0],e=arguments[1],n=new Re,r=new A,s=new A,c=e.size(),f=1;f<c;f++)if(e.getCoordinate(f-1,r),e.getCoordinate(f,s),n.computeIntersection(t,r,s),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof A&&arguments[1]instanceof Array){for(var m=arguments[0],_=arguments[1],C=new Re,D=1;D<_.length;D++){var U=_[D-1],Z=_[D];if(C.computeIntersection(m,U,Z),C.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return _u.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,e){return i.locateInRing(t,e)!==k.EXTERIOR}}])})(),Wt=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"setAllLocations",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t}},{key:"isNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==k.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===k.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[X.ON]=this.location[X.ON],e[X.LEFT]=k.NONE,e[X.RIGHT]=k.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===k.NONE&&n<t.location.length&&(this.location[n]=t.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var t=this.location[X.LEFT];this.location[X.LEFT]=this.location[X.RIGHT],this.location[X.RIGHT]=t}},{key:"toString",value:function(){var t=new en;return this.location.length>1&&t.append(k.toLocationSymbol(this.location[X.LEFT])),t.append(k.toLocationSymbol(this.location[X.ON])),this.location.length>1&&t.append(k.toLocationSymbol(this.location[X.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,n){this.location[X.ON]=t,this.location[X.LEFT]=e,this.location[X.RIGHT]=n}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:k.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===k.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var t=arguments[0];this.setLocation(X.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}}},{key:"init",value:function(t){this.location=new Array(t).fill(null),this.setAllLocations(k.NONE)}},{key:"isEqualOnSide",value:function(t,e){return this.location[e]===t.location[e]}},{key:"allPositionsEqual",value:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[X.ON]=e}else if(arguments[0]instanceof i){var n=arguments[0];if(this.init(n.location.length),n!==null)for(var r=0;r<this.location.length;r++)this.location[r]=n.location[r]}}else if(arguments.length===3){var s=arguments[0],c=arguments[1],f=arguments[2];this.init(3),this.location[X.ON]=s,this.location[X.LEFT]=c,this.location[X.RIGHT]=f}}}])})(),Kt=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getGeometryCount",value:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}},{key:"setAllLocations",value:function(t,e){this.elt[t].setAllLocations(e)}},{key:"isNull",value:function(t){return this.elt[t].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(t){return this.elt[t].isLine()}},{key:"merge",value:function(t){for(var e=0;e<2;e++)this.elt[e]===null&&t.elt[e]!==null?this.elt[e]=new Wt(t.elt[e]):this.elt[e].merge(t.elt[e])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(X.ON)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}}},{key:"toString",value:function(){var t=new en;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(X.ON,e)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];this.elt[n].setLocation(r,s)}}},{key:"isEqualOnSide",value:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}},{key:"allPositionsEqual",value:function(t,e){return this.elt[t].allPositionsEqual(e)}},{key:"toLine",value:function(t){this.elt[t].isArea()&&(this.elt[t]=new Wt(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Wt(t),this.elt[1]=new Wt(t)}else if(arguments[0]instanceof i){var e=arguments[0];this.elt[0]=new Wt(e.elt[0]),this.elt[1]=new Wt(e.elt[1])}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.elt[0]=new Wt(k.NONE),this.elt[1]=new Wt(k.NONE),this.elt[n].setLocation(r)}else if(arguments.length===3){var s=arguments[0],c=arguments[1],f=arguments[2];this.elt[0]=new Wt(s,c,f),this.elt[1]=new Wt(s,c,f)}else if(arguments.length===4){var m=arguments[0],_=arguments[1],C=arguments[2],D=arguments[3];this.elt[0]=new Wt(k.NONE,k.NONE,k.NONE),this.elt[1]=new Wt(k.NONE,k.NONE,k.NONE),this.elt[m].setLocations(_,C,D)}}},{key:"toLineLabel",value:function(t){for(var e=new i(k.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e}}])})(),Un=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var i=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)i[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(i),this._isHole=ht.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(i){this._startDe=i;var t=i,e=!0;do{if(t===null)throw new ge("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new ge("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var n=t.getLabel();nt.isTrue(n.isArea()),this.mergeLabel(n),this.addPoints(t.getEdge(),t.isForward(),e),e=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(i){return this._pts.get(i)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var i=this._startDe;do{var t=i.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),i=this.getNext(i)}while(i!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(i,t,e){var n=i.getCoordinates();if(t){var r=1;e&&(r=0);for(var s=r;s<n.length;s++)this._pts.add(n[s])}else{var c=n.length-2;e&&(c=n.length-1);for(var f=c;f>=0;f--)this._pts.add(n[f])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var i=this._startDe;do i.getEdge().setInResult(!0),i=i.getNext();while(i!==this._startDe)}},{key:"containsPoint",value:function(i){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(i)||!Ei.isInRing(i,t.getCoordinates()))return!1;for(var e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(i))return!1;return!0}},{key:"addHole",value:function(i){this._holes.add(i)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var i=arguments[0];this.mergeLabel(i,0),this.mergeLabel(i,1)}else if(arguments.length===2){var t=arguments[1],e=arguments[0].getLocation(t,X.RIGHT);if(e===k.NONE)return null;if(this._label.getLocation(t)===k.NONE)return this._label.setLocation(t,e),null}}},{key:"setShell",value:function(i){this._shell=i,i!==null&&i.addHole(this)}},{key:"toPolygon",value:function(i){for(var t=new Array(this._holes.size()).fill(null),e=0;e<this._holes.size();e++)t[e]=this._holes.get(e).getLinearRing();return i.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new ot,this._pts=new ot,this._label=new Kt(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new ot,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var i=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(i),this.computeRing()}}}}])})(),xu=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"setEdgeRing",value:function(e,n){e.setMinEdgeRing(n)}},{key:"getNext",value:function(e){return e.getNextMin()}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Un.constructor_.call(this,e,n)}}])})(Un),ku=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"buildMinimalRings",value:function(){var e=new ot,n=this._startDe;do{if(n.getMinEdgeRing()===null){var r=new xu(n,this._geometryFactory);e.add(r)}n=n.getNext()}while(n!==this._startDe);return e}},{key:"setEdgeRing",value:function(e,n){e.setEdgeRing(n)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var e=this._startDe;do e.getNode().getEdges().linkMinimalDirectedEdges(this),e=e.getNext();while(e!==this._startDe)}},{key:"getNext",value:function(e){return e.getNext()}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Un.constructor_.call(this,e,n)}}])})(Un),jr=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(i){this._isVisited=i}},{key:"setInResult",value:function(i){this._isInResult=i}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(i){this._label=i}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(i){this._isCovered=i,this._isCoveredSet=!0}},{key:"updateIM",value:function(i){nt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(i)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this._label=i}}}}])})(),Xn=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"isIncidentEdgeInResult",value:function(){for(var e=this.getEdges().getEdges().iterator();e.hasNext();)if(e.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(e){e.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(e){}},{key:"computeMergedLocation",value:function(e,n){var r=k.NONE;if(r=this._label.getLocation(n),!e.isNull(n)){var s=e.getLocation(n);r!==k.BOUNDARY&&(r=s)}return r}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return G(t,"setLabel",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1];this._label===null?this._label=new Kt(e,n):this._label.setLocation(e,n)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var e=arguments[0];this.mergeLabel(e._label)}else if(arguments[0]instanceof Kt)for(var n=arguments[0],r=0;r<2;r++){var s=this.computeMergedLocation(n,r);this._label.getLocation(r)===k.NONE&&this._label.setLocation(r,s)}}},{key:"add",value:function(e){this._edges.insert(e),e.setNode(this)}},{key:"setLabelBoundary",value:function(e){if(this._label===null)return null;var n=k.NONE;this._label!==null&&(n=this._label.getLocation(e));var r=null;switch(n){case k.BOUNDARY:r=k.INTERIOR;break;case k.INTERIOR:default:r=k.BOUNDARY}this._label.setLocation(e,r)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new Kt(0,k.NONE)}}])})(jr),Eu=(function(i){function t(){return o(this,t),h(this,t,arguments)}return I(t,i),g(t)})(Xr);function Qr(i){return i==null?0:i.color}function xt(i){return i==null?null:i.parent}function oe(i,t){i!==null&&(i.color=t)}function Ii(i){return i==null?null:i.left}function $r(i){return i==null?null:i.right}var ln=(function(i){function t(){var e;return o(this,t),(e=h(this,t)).root_=null,e.size_=0,e}return I(t,i),g(t,[{key:"get",value:function(e){for(var n=this.root_;n!==null;){var r=e.compareTo(n.key);if(r<0)n=n.left;else{if(!(r>0))return n.value;n=n.right}}return null}},{key:"put",value:function(e,n){if(this.root_===null)return this.root_={key:e,value:n,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,s,c=this.root_;do if(r=c,(s=e.compareTo(c.key))<0)c=c.left;else{if(!(s>0)){var f=c.value;return c.value=n,f}c=c.right}while(c!==null);var m={key:e,left:null,right:null,value:n,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return s<0?r.left=m:r.right=m,this.fixAfterInsertion(m),this.size_++,null}},{key:"fixAfterInsertion",value:function(e){var n;for(e.color=1;e!=null&&e!==this.root_&&e.parent.color===1;)xt(e)===Ii(xt(xt(e)))?Qr(n=$r(xt(xt(e))))===1?(oe(xt(e),0),oe(n,0),oe(xt(xt(e)),1),e=xt(xt(e))):(e===$r(xt(e))&&(e=xt(e),this.rotateLeft(e)),oe(xt(e),0),oe(xt(xt(e)),1),this.rotateRight(xt(xt(e)))):Qr(n=Ii(xt(xt(e))))===1?(oe(xt(e),0),oe(n,0),oe(xt(xt(e)),1),e=xt(xt(e))):(e===Ii(xt(e))&&(e=xt(e),this.rotateRight(e)),oe(xt(e),0),oe(xt(xt(e)),1),this.rotateLeft(xt(xt(e))));this.root_.color=0}},{key:"values",value:function(){var e=new ot,n=this.getFirstEntry();if(n!==null)for(e.add(n.value);(n=t.successor(n))!==null;)e.add(n.value);return e}},{key:"entrySet",value:function(){var e=new hi,n=this.getFirstEntry();if(n!==null)for(e.add(n);(n=t.successor(n))!==null;)e.add(n);return e}},{key:"rotateLeft",value:function(e){if(e!=null){var n=e.right;e.right=n.left,n.left!=null&&(n.left.parent=e),n.parent=e.parent,e.parent==null?this.root_=n:e.parent.left===e?e.parent.left=n:e.parent.right=n,n.left=e,e.parent=n}}},{key:"rotateRight",value:function(e){if(e!=null){var n=e.left;e.left=n.right,n.right!=null&&(n.right.parent=e),n.parent=e.parent,e.parent==null?this.root_=n:e.parent.right===e?e.parent.right=n:e.parent.left=n,n.right=e,e.parent=n}}},{key:"getFirstEntry",value:function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(e){for(var n=this.root_;n!==null;){var r=e.compareTo(n.key);if(r<0)n=n.left;else{if(!(r>0))return!0;n=n.right}}return!1}}],[{key:"successor",value:function(e){var n;if(e===null)return null;if(e.right!==null){for(n=e.right;n.left!==null;)n=n.left;return n}n=e.parent;for(var r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}}])})(Eu),ts=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"find",value:function(i){return this.nodeMap.get(i)}},{key:"addNode",value:function(){if(arguments[0]instanceof A){var i=arguments[0],t=this.nodeMap.get(i);return t===null&&(t=this.nodeFact.createNode(i),this.nodeMap.put(i,t)),t}if(arguments[0]instanceof Xn){var e=arguments[0],n=this.nodeMap.get(e.getCoordinate());return n===null?(this.nodeMap.put(e.getCoordinate(),e),e):(n.mergeLabel(e),n)}}},{key:"print",value:function(i){for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(i){for(var t=new ot,e=this.iterator();e.hasNext();){var n=e.next();n.getLabel().getLocation(i)===k.BOUNDARY&&t.add(n)}return t}},{key:"add",value:function(i){var t=i.getCoordinate();this.addNode(t).add(i)}}],[{key:"constructor_",value:function(){this.nodeMap=new ln,this.nodeFact=null;var i=arguments[0];this.nodeFact=i}}])})(),Gt=(function(){function i(){o(this,i)}return g(i,null,[{key:"isNorthern",value:function(t){return t===i.NE||t===i.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&(t-e+4)%4===2}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var n=t<e?t:e;return n===0&&(t>e?t:e)===3?3:n}},{key:"isInHalfPlane",value:function(t,e){return e===i.SE?t===i.SE||t===i.SW:t===e||t===e+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new W("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?i.NE:i.SE:e>=0?i.NW:i.SW}if(arguments[0]instanceof A&&arguments[1]instanceof A){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new W("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?i.NE:i.SE:r.y>=n.y?i.NW:i.SW}}}])})();Gt.NE=0,Gt.NW=1,Gt.SW=2,Gt.SE=3;var es=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:ht.index(t._p0,t._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(t){this._node=t}},{key:"print",value:function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),s=n.substring(r+1);t.print(" "+s+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}},{key:"compareTo",value:function(t){var e=t;return this.compareDirection(e)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label}},{key:"computeLabel",value:function(t){}},{key:"init",value:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Gt.quadrant(this._dx,this._dy),nt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){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,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2];i.constructor_.call(this,e,n,r,null)}else if(arguments.length===4){var s=arguments[0],c=arguments[1],f=arguments[2],m=arguments[3];i.constructor_.call(this,s),this.init(c,f),this._label=m}}}])})(),Ni=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(e){return this._depth[e]}},{key:"setVisited",value:function(e){this._isVisited=e}},{key:"computeDirectedLabel",value:function(){this._label=new Kt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(e,n){if(this._depth[e]!==-999&&this._depth[e]!==n)throw new ge("assigned depths do not match",this.getCoordinate());this._depth[e]=n}},{key:"isInteriorAreaEdge",value:function(){for(var e=!0,n=0;n<2;n++)this._label.isArea(n)&&this._label.getLocation(n,X.LEFT)===k.INTERIOR&&this._label.getLocation(n,X.RIGHT)===k.INTERIOR||(e=!1);return e}},{key:"setNextMin",value:function(e){this._nextMin=e}},{key:"print",value:function(e){G(t,"print",this,1).call(this,e),e.print(" "+this._depth[X.LEFT]+"/"+this._depth[X.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")}},{key:"setMinEdgeRing",value:function(e){this._minEdgeRing=e}},{key:"isLineEdge",value:function(){var e=this._label.isLine(0)||this._label.isLine(1),n=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return e&&n&&r}},{key:"setEdgeRing",value:function(e){this._edgeRing=e}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var e=this._edge.getDepthDelta();return this._isForward||(e=-e),e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(e){this.print(e),e.print(" "),this._isForward?this._edge.print(e):this._edge.printReverse(e)}},{key:"setSym",value:function(e){this._sym=e}},{key:"setVisitedEdge",value:function(e){this.setVisited(e),this._sym.setVisited(e)}},{key:"setEdgeDepths",value:function(e,n){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var s=1;e===X.LEFT&&(s=-1);var c=X.opposite(e),f=n+r*s;this.setDepth(e,n),this.setDepth(c,f)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(e){this._next=e}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){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];var e=arguments[0],n=arguments[1];if(es.constructor_.call(this,e),this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(e,n){return e===k.EXTERIOR&&n===k.INTERIOR?1:e===k.INTERIOR&&n===k.EXTERIOR?-1:0}}])})(es),ns=(function(){return g((function i(){o(this,i)}),[{key:"createNode",value:function(i){return new Xn(i,null)}}])})(),is=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(i){i.println("Edges:");for(var t=0;t<this._edges.size();t++){i.println("edge "+t+":");var e=this._edges.get(t);e.print(i),e.eiList.print(i)}}},{key:"find",value:function(i){return this._nodes.find(i)}},{key:"addNode",value:function(){if(arguments[0]instanceof Xn){var i=arguments[0];return this._nodes.addNode(i)}if(arguments[0]instanceof A){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var i=this._nodes.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(i){Zt.out.println(i)}},{key:"isBoundaryNode",value:function(i,t){var e=this._nodes.find(t);if(e===null)return!1;var n=e.getLabel();return n!==null&&n.getLocation(i)===k.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var i=this._nodes.iterator();i.hasNext();)i.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(i,t,e,n){return!!i.equals(e)&&ht.index(i,t,n)===ht.COLLINEAR&&Gt.quadrant(i,t)===Gt.quadrant(e,n)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(i){Zt.out.print(i)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(i,t){for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e),r=n.getCoordinates();if(this.matchInSameDirection(i,t,r[0],r[1])||this.matchInSameDirection(i,t,r[r.length-1],r[r.length-2]))return n}return null}},{key:"insertEdge",value:function(i){this._edges.add(i)}},{key:"findEdgeEnd",value:function(i){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var e=t.next();if(e.getEdge()===i)return e}return null}},{key:"addEdges",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next();this._edges.add(e);var n=new Ni(e,!0),r=new Ni(e,!1);n.setSym(r),r.setSym(n),this.add(n),this.add(r)}}},{key:"add",value:function(i){this._nodes.add(i),this._edgeEndList.add(i)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(i,t){for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e),r=n.getCoordinates();if(i.equals(r[0])&&t.equals(r[1]))return n}return null}}],[{key:"constructor_",value:function(){if(this._edges=new ot,this._nodes=null,this._edgeEndList=new ot,arguments.length===0)this._nodes=new ts(new ns);else if(arguments.length===1){var i=arguments[0];this._nodes=new ts(i)}}},{key:"linkResultDirectedEdges",value:function(i){for(var t=i.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}])})(),Iu=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"sortShellsAndHoles",value:function(t,e,n){for(var r=t.iterator();r.hasNext();){var s=r.next();s.isHole()?n.add(s):e.add(s)}}},{key:"computePolygons",value:function(t){for(var e=new ot,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e}},{key:"placeFreeHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(r.getShell()===null){var s=i.findEdgeRingContaining(r,t);if(s===null)throw new ge("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(s)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,n){for(var r=new ot,s=t.iterator();s.hasNext();){var c=s.next();if(c.getMaxNodeDegree()>2){c.linkDirectedEdgesForMinimalEdgeRings();var f=c.buildMinimalRings(),m=this.findShell(f);m!==null?(this.placePolygonHoles(m,f),e.add(m)):n.addAll(f)}else r.add(c)}return r}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new ot,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var s=new ku(r,this._geometryFactory);e.add(s),s.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var s=r.next();s.isHole()||(n=s,e++)}return nt.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];is.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),s=new ot,c=this.buildMinimalEdgeRings(r,this._shellList,s);this.sortShellsAndHoles(c,this._shellList,s),this.placeFreeHoles(this._shellList,s)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new ot;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),s=n.getCoordinateN(0),c=null,f=null,m=e.iterator();m.hasNext();){var _=m.next(),C=_.getLinearRing(),D=C.getEnvelopeInternal();if(!D.equals(r)&&D.contains(r)){s=bt.ptNotInList(n.getCoordinates(),C.getCoordinates());var U=!1;Ei.isInRing(s,C.getCoordinates())&&(U=!0),U&&(c===null||f.contains(D))&&(f=(c=_).getLinearRing().getEnvelopeInternal())}}return c}}])})(),rs=(function(){return g((function i(){o(this,i)}),[{key:"getBounds",value:function(){}}])})(),me=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[rs,p]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var i=arguments[0],t=arguments[1];this._bounds=i,this._item=t}}])})(),Vn=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var i=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),i}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(i){for(var t=null,e=this._items.get(i);2*i<=this._size&&((t=2*i)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(e)<0);i=t)this._items.set(i,this._items.get(t));this._items.set(i,e)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(i){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,i);i.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,i)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new ot,this._items.add(null)}}])})(),Nu=(function(){return g((function i(){o(this,i)}),[{key:"insert",value:function(i,t){}},{key:"remove",value:function(i,t){}},{key:"query",value:function(){}}])})(),Jt=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(i){nt.isTrue(this._bounds===null),this._childBoundables.add(i)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[rs,p]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new ot,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this._level=i}}}}])})(),Be={reverseOrder:function(){return{compare:function(i,t){return t.compareTo(i)}}},min:function(i){return Be.sort(i),i.get(0)},sort:function(i,t){var e=i.toArray();t?Se.sort(e,t):Se.sort(e);for(var n=i.iterator(),r=0,s=e.length;r<s;r++)n.next(),n.set(e[r])},singletonList:function(i){var t=new ot;return t.add(i),t}},wu=(function(){function i(){o(this,i)}return g(i,null,[{key:"maxDistance",value:function(t,e,n,r,s,c,f,m){var _=i.distance(t,e,s,c);return _=Math.max(_,i.distance(t,e,f,m)),_=Math.max(_,i.distance(n,r,s,c)),_=Math.max(_,i.distance(n,r,f,m))}},{key:"distance",value:function(t,e,n,r){var s=n-t,c=r-e;return Math.sqrt(s*s+c*c)}},{key:"maximumDistance",value:function(t,e){var n=Math.min(t.getMinX(),e.getMinX()),r=Math.min(t.getMinY(),e.getMinY()),s=Math.max(t.getMaxX(),e.getMaxX()),c=Math.max(t.getMaxY(),e.getMaxY());return i.distance(n,r,s,c)}},{key:"minMaxDistance",value:function(t,e){var n=t.getMinX(),r=t.getMinY(),s=t.getMaxX(),c=t.getMaxY(),f=e.getMinX(),m=e.getMinY(),_=e.getMaxX(),C=e.getMaxY(),D=i.maxDistance(n,r,n,c,f,m,f,C);return D=Math.min(D,i.maxDistance(n,r,n,c,f,m,_,m)),D=Math.min(D,i.maxDistance(n,r,n,c,_,C,f,C)),D=Math.min(D,i.maxDistance(n,r,n,c,_,C,_,m)),D=Math.min(D,i.maxDistance(n,r,s,r,f,m,f,C)),D=Math.min(D,i.maxDistance(n,r,s,r,f,m,_,m)),D=Math.min(D,i.maxDistance(n,r,s,r,_,C,f,C)),D=Math.min(D,i.maxDistance(n,r,s,r,_,C,_,m)),D=Math.min(D,i.maxDistance(s,c,n,c,f,m,f,C)),D=Math.min(D,i.maxDistance(s,c,n,c,f,m,_,m)),D=Math.min(D,i.maxDistance(s,c,n,c,_,C,f,C)),D=Math.min(D,i.maxDistance(s,c,n,c,_,C,_,m)),D=Math.min(D,i.maxDistance(s,c,s,r,f,m,f,C)),D=Math.min(D,i.maxDistance(s,c,s,r,f,m,_,m)),D=Math.min(D,i.maxDistance(s,c,s,r,_,C,f,C)),D=Math.min(D,i.maxDistance(s,c,s,r,_,C,_,m))}}])})(),Ye=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"maximumDistance",value:function(){return wu.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,e){var n=i.isComposite(this._boundable1),r=i.isComposite(this._boundable2);if(n&&r)return i.area(this._boundable1)>i.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new W("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(i.isComposite(this._boundable1)||i.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}},{key:"expand",value:function(t,e,n,r,s){for(var c=t.getChildBoundables().iterator();c.hasNext();){var f=c.next(),m=null;(m=n?new i(e,f,this._itemDistance):new i(f,e,this._itemDistance)).getDistance()<s&&r.add(m)}}},{key:"getBoundable",value:function(t){return t===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(t){return t.getBounds().getArea()}},{key:"isComposite",value:function(t){return t instanceof Jt}}])})(),ss=(function(){return g((function i(){o(this,i)}),[{key:"visitItem",value:function(i){}}])})(),ze=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"queryInternal",value:function(){if(gt(arguments[2],ss)&&arguments[0]instanceof Object&&arguments[1]instanceof Jt)for(var t=arguments[0],e=arguments[2],n=arguments[1].getChildBoundables(),r=0;r<n.size();r++){var s=n.get(r);this.getIntersectsOp().intersects(s.getBounds(),t)&&(s instanceof Jt?this.queryInternal(t,s,e):s instanceof me?e.visitItem(s.getItem()):nt.shouldNeverReachHere())}else if(gt(arguments[2],Ne)&&arguments[0]instanceof Object&&arguments[1]instanceof Jt)for(var c=arguments[0],f=arguments[2],m=arguments[1].getChildBoundables(),_=0;_<m.size();_++){var C=m.get(_);this.getIntersectsOp().intersects(C.getBounds(),c)&&(C instanceof Jt?this.queryInternal(c,C,f):C instanceof me?f.add(C.getItem()):nt.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Jt?t+=this.size(n):n instanceof me&&(t+=1)}return t}}},{key:"removeItem",value:function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var s=r.next();s instanceof me&&s.getItem()===e&&(n=s)}return n!==null&&(t.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new ot:t}if(arguments.length===1){for(var e=arguments[0],n=new ot,r=e.getChildBoundables().iterator();r.hasNext();){var s=r.next();if(s instanceof Jt){var c=this.itemsTree(s);c!==null&&n.add(c)}else s instanceof me?n.add(s.getItem()):nt.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(t,e){nt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new me(t,e))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var t=arguments[0],e=new ot;return this.boundablesAtLevel(t,this._root,e),e}if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];if(nt.isTrue(n>-2),r.getLevel()===n)return s.add(r),null;for(var c=r.getChildBoundables().iterator();c.hasNext();){var f=c.next();f instanceof Jt?this.boundablesAtLevel(n,f,s):(nt.isTrue(f instanceof me),n===-1&&s.add(f))}return null}}},{key:"query",value:function(){if(arguments.length===1){var t=arguments[0];this.build();var e=new ot;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2],c=this.removeItem(r,s);if(c)return!0;for(var f=null,m=r.getChildBoundables().iterator();m.hasNext();){var _=m.next();if(this.getIntersectsOp().intersects(_.getBounds(),n)&&_ instanceof Jt&&(c=this.remove(n,_,s))){f=_;break}}return f!==null&&f.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(f),c}}},{key:"createHigherLevels",value:function(t,e){nt.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof Jt){var r=this.depth(n);r>t&&(t=r)}}return t+1}}},{key:"createParentBoundables",value:function(t,e){nt.isTrue(!t.isEmpty());var n=new ot;n.add(this.createNode(e));var r=new ot(t);Be.sort(r,this.getComparator());for(var s=r.iterator();s.hasNext();){var c=s.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(c)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[p]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new ot,this._nodeCapacity=null,arguments.length===0)i.constructor_.call(this,i.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var t=arguments[0];nt.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t<e?-1:0}}])})();ze.IntersectsOp=function(){},ze.DEFAULT_NODE_CAPACITY=10;var Su=(function(){return g((function i(){o(this,i)}),[{key:"distance",value:function(i,t){}}])})(),le=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(e,n){nt.isTrue(e.length>0);for(var r=new ot,s=0;s<e.length;s++)r.addAll(this.createParentBoundablesFromVerticalSlice(e[s],n));return r}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.nearestNeighbourK(e,z.POSITIVE_INFINITY,n)}if(arguments.length===3){var r=arguments[0],s=arguments[2],c=arguments[1],f=new Vn;f.add(r);for(var m=new Vn;!f.isEmpty()&&c>=0;){var _=f.poll(),C=_.getDistance();if(C>=c)break;_.isLeaves()?m.size()<s?m.add(_):(m.peek().getDistance()>C&&(m.poll(),m.add(_)),c=m.peek().getDistance()):_.expandToQueue(f,c)}return t.getItems(m)}}},{key:"createNode",value:function(e){return new as(e)}},{key:"size",value:function(){return arguments.length===0?G(t,"size",this,1).call(this):G(t,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Et))return G(t,"insert",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;G(t,"insert",this,1).call(this,e,n)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(e,n){for(var r=Math.trunc(Math.ceil(e.size()/n)),s=new Array(n).fill(null),c=e.iterator(),f=0;f<n;f++){s[f]=new ot;for(var m=0;c.hasNext()&&m<r;){var _=c.next();s[f].add(_),m++}}return s}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];return G(t,"query",this,1).call(this,e)}if(arguments.length===2){var n=arguments[0],r=arguments[1];G(t,"query",this,1).call(this,n,r)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(e,n){return G(t,"createParentBoundables",this,1).call(this,e,n)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Et){var e=arguments[0],n=arguments[1];return G(t,"remove",this,1).call(this,e,n)}return G(t,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?G(t,"depth",this,1).call(this):G(t,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(e,n){nt.isTrue(!e.isEmpty());var r=Math.trunc(Math.ceil(e.size()/this.getNodeCapacity())),s=new ot(e);Be.sort(s,t.xComparator);var c=this.verticalSlices(s,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(c,n)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(gt(arguments[0],Su)){var e=arguments[0];if(this.isEmpty())return null;var n=new Ye(this.getRoot(),this.getRoot(),e);return this.nearestNeighbour(n)}if(arguments[0]instanceof Ye){var r=arguments[0],s=z.POSITIVE_INFINITY,c=null,f=new Vn;for(f.add(r);!f.isEmpty()&&s>0;){var m=f.poll(),_=m.getDistance();if(_>=s)break;m.isLeaves()?(s=_,c=m):m.expandToQueue(f,s)}return c===null?null:[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else{if(arguments.length===2){var C=arguments[0],D=arguments[1];if(this.isEmpty()||C.isEmpty())return null;var U=new Ye(this.getRoot(),C.getRoot(),D);return this.nearestNeighbour(U)}if(arguments.length===3){var Z=arguments[2],tt=new me(arguments[0],arguments[1]),st=new Ye(this.getRoot(),tt,Z);return this.nearestNeighbour(st)[0]}if(arguments.length===4){var dt=arguments[2],mt=arguments[3],It=new me(arguments[0],arguments[1]),Dt=new Ye(this.getRoot(),It,dt);return this.nearestNeighbourK(Dt,mt)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=z.POSITIVE_INFINITY,s=new Vn;for(s.add(e);!s.isEmpty();){var c=s.poll(),f=c.getDistance();if(f>n)return!1;if(c.maximumDistance()<=n)return!0;if(c.isLeaves()){if((r=f)<=n)return!0}else c.expandToQueue(s,r)}return!1}if(arguments.length===3){var m=arguments[0],_=arguments[1],C=arguments[2],D=new Ye(this.getRoot(),m.getRoot(),_);return this.isWithinDistance(D,C)}}},{key:"interfaces_",get:function(){return[Nu,p]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];ze.constructor_.call(this,e)}}},{key:"centreX",value:function(e){return t.avg(e.getMinX(),e.getMaxX())}},{key:"avg",value:function(e,n){return(e+n)/2}},{key:"getItems",value:function(e){for(var n=new Array(e.size()).fill(null),r=0;!e.isEmpty();){var s=e.poll();n[r]=s.getBoundable(0).getItem(),r++}return n}},{key:"centreY",value:function(e){return t.avg(e.getMinY(),e.getMaxY())}}])})(ze),as=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"computeBounds",value:function(){for(var e=null,n=this.getChildBoundables().iterator();n.hasNext();){var r=n.next();e===null?e=new Et(r.getBounds()):e.expandToInclude(r.getBounds())}return e}}],[{key:"constructor_",value:function(){var e=arguments[0];Jt.constructor_.call(this,e)}}])})(Jt);le.STRtreeNode=as,le.xComparator=new((function(){return g((function i(){o(this,i)}),[{key:"interfaces_",get:function(){return[j]}},{key:"compare",value:function(i,t){return ze.compareDoubles(le.centreX(i.getBounds()),le.centreX(t.getBounds()))}}])})()),le.yComparator=new((function(){return g((function i(){o(this,i)}),[{key:"interfaces_",get:function(){return[j]}},{key:"compare",value:function(i,t){return ze.compareDoubles(le.centreY(i.getBounds()),le.centreY(t.getBounds()))}}])})()),le.intersectsOp=new((function(){return g((function i(){o(this,i)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(i,t){return i.intersects(t)}}])})()),le.DEFAULT_NODE_CAPACITY=10;var Tu=(function(){function i(){o(this,i)}return g(i,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,e,n){if(e.equals2D(n))return 0;var r=i.relativeSign(e.x,n.x),s=i.relativeSign(e.y,n.y);switch(t){case 0:return i.compareValue(r,s);case 1:return i.compareValue(s,r);case 2:return i.compareValue(s,-r);case 3:return i.compareValue(-r,s);case 4:return i.compareValue(-r,-s);case 5:return i.compareValue(-s,-r);case 6:return i.compareValue(-s,r);case 7:return i.compareValue(r,-s)}return nt.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}])})(),Lu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(i){i.print(this.coord),i.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(i){var t=i;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?Tu.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(i){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===i}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this._segString=i,this.coord=new A(t),this.segmentIndex=e,this._segmentOctant=n,this._isInterior=!t.equals2D(i.getCoordinate(e))}}])})(),Ru=(function(){return g((function i(){o(this,i)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),Cu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var i=new an;this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next();this.addEdgeCoordinates(e,n,i),e=n}return i.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var i=new ot;this.findCollapsesFromInsertedNodes(i),this.findCollapsesFromExistingVertices(i);for(var t=i.iterator();t.hasNext();){var e=t.next().intValue();this.add(this._edge.getCoordinate(e),e)}}},{key:"createSplitEdgePts",value:function(i,t){var e=t.segmentIndex-i.segmentIndex+2;if(e===2)return[new A(i.coord),new A(t.coord)];var n=this._edge.getCoordinate(t.segmentIndex),r=t.isInterior()||!t.coord.equals2D(n);r||e--;var s=new Array(e).fill(null),c=0;s[c++]=new A(i.coord);for(var f=i.segmentIndex+1;f<=t.segmentIndex;f++)s[c++]=this._edge.getCoordinate(f);return r&&(s[c]=new A(t.coord)),s}},{key:"print",value:function(i){i.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"findCollapsesFromExistingVertices",value:function(i){for(var t=0;t<this._edge.size()-2;t++){var e=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var n=this._edge.getCoordinate(t+2);e.equals2D(n)&&i.add(An.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(i,t,e){var n=this.createSplitEdgePts(i,t);e.add(n,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(i){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next(),r=this.createSplitEdge(e,n);i.add(r),e=n}}},{key:"findCollapseIndex",value:function(i,t,e){if(!i.coord.equals2D(t.coord))return!1;var n=t.segmentIndex-i.segmentIndex;return t.isInterior()||n--,n===1&&(e[0]=i.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(i){for(var t=new Array(1).fill(null),e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.findCollapseIndex(n,r,t)&&i.add(An.valueOf(t[0])),n=r}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var i=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(i),i)}},{key:"createSplitEdge",value:function(i,t){var e=this.createSplitEdgePts(i,t);return new Ce(e,this._edge.getData())}},{key:"add",value:function(i,t){var e=new Lu(this._edge,i,t,this._edge.getSegmentOctant(t)),n=this._nodeMap.get(e);return n!==null?(nt.isTrue(n.coord.equals2D(i),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(e,e),e)}},{key:"checkSplitEdgesCorrectness",value:function(i){var t=this._edge.getCoordinates(),e=i.get(0).getCoordinate(0);if(!e.equals2D(t[0]))throw new at("bad split edge start point at "+e);var n=i.get(i.size()-1).getCoordinates(),r=n[n.length-1];if(!r.equals2D(t[t.length-1]))throw new at("bad split edge end point at "+r)}}],[{key:"constructor_",value:function(){this._nodeMap=new ln,this._edge=null;var i=arguments[0];this._edge=i}}])})(),Ou=(function(){function i(){o(this,i)}return g(i,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new W("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof A&&arguments[1]instanceof A){var s=arguments[0],c=arguments[1],f=c.x-s.x,m=c.y-s.y;if(f===0&&m===0)throw new W("Cannot compute the octant for two identical points "+s);return i.octant(f,m)}}}])})(),Mu=(function(){return g((function i(){o(this,i)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(i){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(i){}},{key:"getData",value:function(){}}])})(),bu=(function(){return g((function i(){o(this,i)}),[{key:"addIntersection",value:function(i,t){}},{key:"interfaces_",get:function(){return[Mu]}}])})(),Ce=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:Ou.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[1],r=arguments[3],s=new A(arguments[0].getIntersection(r));this.addIntersection(s,n)}}},{key:"toString",value:function(){return ki.toLineString(new un(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var n=e,r=n+1;if(r<this._pts.length){var s=this._pts[r];t.equals2D(s)&&(n=r)}return this._nodeList.add(t,n)}},{key:"addIntersections",value:function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)}},{key:"interfaces_",get:function(){return[bu]}}],[{key:"constructor_",value:function(){this._nodeList=new Cu(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var t=arguments[0],e=new ot;return i.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(n)}}])})(),Yt=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof i){var t=arguments[0],e=ht.index(this.p0,this.p1,t.p0),n=ht.index(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof A){var r=arguments[0];return ht.index(this.p0,this.p1,r)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){if(!(t instanceof i))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}},{key:"intersection",value:function(t){var e=new Re;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof A){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new A(t);var e=this.projectionFactor(t),n=new A;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof i){var r=arguments[0],s=this.projectionFactor(r.p0),c=this.projectionFactor(r.p1);if(s>=1&&c>=1||s<=0&&c<=0)return null;var f=this.project(r.p0);s<0&&(f=this.p0),s>1&&(f=this.p1);var m=this.project(r.p1);return c<0&&(m=this.p0),c>1&&(m=this.p1),new i(f,m)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return t===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return ue.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return i.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?z.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=z.MAX_VALUE,s=null,c=this.closestPoint(t.p0);r=c.distance(t.p0),n[0]=c,n[1]=t.p0;var f=this.closestPoint(t.p1);(s=f.distance(t.p1))<r&&(r=s,n[0]=f,n[1]=t.p1);var m=t.closestPoint(this.p0);(s=m.distance(this.p0))<r&&(r=s,n[0]=this.p0,n[1]=m);var _=t.closestPoint(this.p1);return(s=_.distance(this.p1))<r&&(r=s,n[0]=this.p1,n[1]=_),n}},{key:"closestPoint",value:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(t){var e=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.p1)}},{key:"reverse",value:function(){var t=this.p0;this.p0=this.p1,this.p1=t}},{key:"equalsTopo",value:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}},{key:"lineIntersection",value:function(t){return gi.intersection(this.p0,this.p1,t.p0,t.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),s=this.p1.x-this.p0.x,c=this.p1.y-this.p0.y,f=Math.sqrt(s*s+c*c),m=0,_=0;if(e!==0){if(f<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");m=e*s/f,_=e*c/f}return new A(n-_,r+m)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||z.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),r=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),s=e*e+n*n,c=e*e-n*n,f=t.getX(),m=t.getY();return new A((-c*f-2*e*n*m-2*e*r)/s,(c*m-2*e*n*f-2*n*r)/s)}},{key:"distance",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return ue.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof A){var e=arguments[0];return ue.pointToSegment(e,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new A;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}},{key:"hashCode",value:function(){var t=z.doubleToLongBits(this.p0.x);t^=31*z.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=z.doubleToLongBits(this.p1.x);return n^=31*z.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))}},{key:"interfaces_",get:function(){return[$,p]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)i.constructor_.call(this,new A,new A);else if(arguments.length===1){var t=arguments[0];i.constructor_.call(this,t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0=e,this.p1=n}else if(arguments.length===4){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3];i.constructor_.call(this,new A(r,s),new A(c,f))}}},{key:"midPoint",value:function(t,e){return new A((t.x+e.x)/2,(t.y+e.y)/2)}}])})(),Pu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var i=arguments[1],t=arguments[2],e=arguments[3];arguments[0].getLineSegment(i,this._overlapSeg1),t.getLineSegment(e,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Yt,this._overlapSeg2=new Yt}}])})(),us=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(i,t){t.p0=this._pts[i],t.p1=this._pts[i+1]}},{key:"computeSelect",value:function(i,t,e,n){var r=this._pts[t],s=this._pts[e];if(e-t==1)return n.select(this,t),null;if(!i.intersects(r,s))return null;var c=Math.trunc((t+e)/2);t<c&&this.computeSelect(i,t,c,n),c<e&&this.computeSelect(i,c,e,n)}},{key:"getCoordinates",value:function(){for(var i=new Array(this._end-this._start+1).fill(null),t=0,e=this._start;e<=this._end;e++)i[t++]=this._pts[e];return i}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var i=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,i,i._start,i._end,t)}else if(arguments.length===6){var e=arguments[0],n=arguments[1],r=arguments[2],s=arguments[3],c=arguments[4],f=arguments[5];if(n-e==1&&c-s==1)return f.overlap(this,e,r,s),null;if(!this.overlaps(e,n,r,s,c))return null;var m=Math.trunc((e+n)/2),_=Math.trunc((s+c)/2);e<m&&(s<_&&this.computeOverlaps(e,m,r,s,_,f),_<c&&this.computeOverlaps(e,m,r,_,c,f)),m<n&&(s<_&&this.computeOverlaps(m,n,r,s,_,f),_<c&&this.computeOverlaps(m,n,r,_,c,f))}}},{key:"setId",value:function(i){this._id=i}},{key:"select",value:function(i,t){this.computeSelect(i,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var i=this._pts[this._start],t=this._pts[this._end];this._env=new Et(i,t)}return this._env}},{key:"overlaps",value:function(i,t,e,n,r){return Et.intersects(this._pts[i],this._pts[t],e._pts[n],e._pts[r])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this._pts=i,this._start=t,this._end=e,this._context=n}}])})(),Au=(function(){function i(){o(this,i)}return g(i,null,[{key:"findChainEnd",value:function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=Gt.quadrant(t[n],t[n+1]),s=e+1;s<t.length&&!(!t[s-1].equals2D(t[s])&&Gt.quadrant(t[s-1],t[s])!==r);)s++;return s-1}},{key:"getChains",value:function(){if(arguments.length===1){var t=arguments[0];return i.getChains(t,null)}if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new ot,s=0;do{var c=i.findChainEnd(e,s),f=new us(e,s,c,n);r.add(f),s=c}while(s<e.length-1);return r}}}])})(),wi=(function(){return g((function i(){o(this,i)}),[{key:"computeNodes",value:function(i){}},{key:"getNodedSubstrings",value:function(){}}])})(),os=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(i){this._segInt=i}},{key:"interfaces_",get:function(){return[wi]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setSegmentIntersector(i)}}}}])})(),Si=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Ce.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(e){for(var n=Au.getChains(e.getCoordinates(),e).iterator();n.hasNext();){var r=n.next();r.setId(this._idCounter++),this._index.insert(r.getEnvelope(),r),this._monoChains.add(r)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e;for(var n=e.iterator();n.hasNext();)this.add(n.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var e=new ls(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),s=this._index.query(r.getEnvelope()).iterator();s.hasNext();){var c=s.next();if(c.getId()>r.getId()&&(r.computeOverlaps(c,e),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new ot,this._index=new le,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var e=arguments[0];os.constructor_.call(this,e)}}}}])})(os),ls=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"overlap",value:function(){if(arguments.length!==4)return G(t,"overlap",this,1).apply(this,arguments);var e=arguments[1],n=arguments[2],r=arguments[3],s=arguments[0].getContext(),c=n.getContext();this._si.processIntersections(s,e,c,r)}}],[{key:"constructor_",value:function(){this._si=null;var e=arguments[0];this._si=e}}])})(Pu);Si.SegmentOverlapAction=ls;var ee=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isDeletable",value:function(t,e,n,r){var s=this._inputLine[t],c=this._inputLine[e],f=this._inputLine[n];return!!this.isConcave(s,c,f)&&!!this.isShallow(s,c,f,r)&&this.isShallowSampled(s,c,t,n,r)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),r=!1;n<this._inputLine.length;){var s=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=i.DELETE,s=!0,r=!0),t=s?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r}},{key:"isShallowConcavity",value:function(t,e,n,r){return ht.index(t,e,n)===this._angleOrientation&&ue.pointToSegment(e,t,n)<r}},{key:"isShallowSampled",value:function(t,e,n,r,s){var c=Math.trunc((r-n)/i.NUM_PTS_TO_CHECK);c<=0&&(c=1);for(var f=n;f<r;f+=c)if(!this.isShallow(t,e,this._inputLine[f],s))return!1;return!0}},{key:"isConcave",value:function(t,e,n){var r=ht.index(t,e,n)===this._angleOrientation;return r}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=ht.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===i.DELETE;)e++;return e}},{key:"isShallow",value:function(t,e,n,r){return ue.pointToSegment(e,t,n)<r}},{key:"collapseLine",value:function(){for(var t=new an,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==i.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ht.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,e){return new i(t).simplify(e)}}])})();ee.INIT=0,ee.DELETE=1,ee.KEEP=1,ee.NUM_PTS_TO_CHECK=10;var hs=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getCoordinates",value:function(){return this._ptList.toArray(i.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new A(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new Ge().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var t=new A(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}},{key:"setMinimumVertexDistance",value:function(t){this._minimimVertexDistance=t}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new ot}}])})();hs.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var zt=(function(){function i(){o(this,i)}return g(i,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=i.PI_TIMES_2;for(;t<=-Math.PI;)t+=i.PI_TIMES_2;return t}},{key:"angle",value:function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,s=n.y-e.y;return Math.atan2(s,r)}}},{key:"isAcute",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y;return r*(n.x-e.x)+s*(n.y-e.y)>0}},{key:"isObtuse",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y;return r*(n.x-e.x)+s*(n.y-e.y)<0}},{key:"interiorAngle",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n);return Math.abs(s-r)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=i.PI_TIMES_2;t>=i.PI_TIMES_2&&(t=0)}else{for(;t>=i.PI_TIMES_2;)t-=i.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n);return i.diff(r,s)}},{key:"diff",value:function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,e){var n=Math.sin(e-t);return n>0?i.COUNTERCLOCKWISE:n<0?i.CLOCKWISE:i.NONE}},{key:"angleBetweenOriented",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n)-r;return s<=-Math.PI?s+i.PI_TIMES_2:s>Math.PI?s-i.PI_TIMES_2:s}}])})();zt.PI_TIMES_2=2*Math.PI,zt.PI_OVER_2=Math.PI/2,zt.PI_OVER_4=Math.PI/4,zt.COUNTERCLOCKWISE=ht.COUNTERCLOCKWISE,zt.CLOCKWISE=ht.CLOCKWISE,zt.NONE=ht.COLLINEAR;var hn=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"addNextSegment",value:function(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;var n=ht.index(this._s0,this._s1,this._s2),r=n===ht.CLOCKWISE&&this._side===X.LEFT||n===ht.COUNTERCLOCKWISE&&this._side===X.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},{key:"addLineEndCap",value:function(t,e){var n=new Yt(t,e),r=new Yt;this.computeOffsetSegment(n,X.LEFT,this._distance,r);var s=new Yt;this.computeOffsetSegment(n,X.RIGHT,this._distance,s);var c=e.x-t.x,f=e.y-t.y,m=Math.atan2(f,c);switch(this._bufParams.getEndCapStyle()){case H.CAP_ROUND:this._segList.addPt(r.p1),this.addDirectedFillet(e,m+Math.PI/2,m-Math.PI/2,ht.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case H.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(s.p1);break;case H.CAP_SQUARE:var _=new A;_.x=Math.abs(this._distance)*Math.cos(m),_.y=Math.abs(this._distance)*Math.sin(m);var C=new A(r.p1.x+_.x,r.p1.y+_.y),D=new A(s.p1.x+_.x,s.p1.y+_.y);this._segList.addPt(C),this._segList.addPt(D)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,n,r){var s=gi.intersection(e.p0,e.p1,n.p0,n.p1);if(s!==null&&(r<=0?1:s.distance(t)/Math.abs(r))<=this._bufParams.getMitreLimit())return this._segList.addPt(s),null;this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*i.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===H.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===H.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))}},{key:"createSquare",value:function(t){this._segList.addPt(new A(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new A(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new A(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new A(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(t,e){this._segList.addPts(t,e)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(t,e,n,r,s){var c=e.x-t.x,f=e.y-t.y,m=Math.atan2(f,c),_=n.x-t.x,C=n.y-t.y,D=Math.atan2(C,_);r===ht.CLOCKWISE?m<=D&&(m+=2*Math.PI):m>=D&&(m-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,m,D,r,s),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(t,e,n,r){var s=this._seg0.p1,c=zt.angle(s,this._seg0.p0),f=zt.angleBetweenOriented(this._seg0.p0,s,this._seg1.p1)/2,m=zt.normalize(c+f),_=zt.normalize(m+Math.PI),C=r*n,D=n-C*Math.abs(Math.sin(f)),U=s.x+C*Math.cos(_),Z=s.y+C*Math.sin(_),tt=new A(U,Z),st=new Yt(s,tt),dt=st.pointAlongOffset(1,D),mt=st.pointAlongOffset(1,-D);this._side===X.LEFT?(this._segList.addPt(dt),this._segList.addPt(mt)):(this._segList.addPt(mt),this._segList.addPt(dt))}},{key:"addDirectedFillet",value:function(t,e,n,r,s){var c=r===ht.CLOCKWISE?-1:1,f=Math.abs(e-n),m=Math.trunc(f/this._filletAngleQuantum+.5);if(m<1)return null;for(var _=f/m,C=new A,D=0;D<m;D++){var U=e+c*D*_;C.x=t.x+s*Math.cos(U),C.y=t.y+s*Math.sin(U),this._segList.addPt(C)}}},{key:"computeOffsetSegment",value:function(t,e,n,r){var s=e===X.LEFT?1:-1,c=t.p1.x-t.p0.x,f=t.p1.y-t.p0.y,m=Math.sqrt(c*c+f*f),_=s*n*c/m,C=s*n*f/m;r.p0.x=t.p0.x-C,r.p0.y=t.p0.y+_,r.p1.x=t.p1.x-C,r.p1.y=t.p1.y+_}},{key:"addInsideTurn",value:function(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*i.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new A((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(n);var r=new A((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new A(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new hs,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*i.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===H.JOIN_BEVEL||this._bufParams.getJoinStyle()===H.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,ht.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){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 Yt,this._seg1=new Yt,this._offset0=new Yt,this._offset1=new Yt,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new Re,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===H.JOIN_ROUND&&(this._closingSegLengthFactor=i.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}])})();hn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,hn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,hn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,hn.MAX_CLOSING_SEG_LEN_FACTOR=80;var Du=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),s=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,n,s);var c=s.getCoordinates();return n&&bt.reverse(c),c}},{key:"computeSingleSidedBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var s=ee.simplify(t,-r),c=s.length-1;n.initSideSegments(s[c],s[c-1],X.LEFT),n.addFirstSegment();for(var f=c-2;f>=0;f--)n.addNextSegment(s[f],!0)}else{n.addSegments(t,!1);var m=ee.simplify(t,r),_=m.length-1;n.initSideSegments(m[0],m[1],X.LEFT),n.addFirstSegment();for(var C=2;C<=_;C++)n.addNextSegment(m[C],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);e===X.RIGHT&&(r=-r);var s=ee.simplify(t,r),c=s.length-1;n.initSideSegments(s[c-1],s[0],e);for(var f=1;f<=c;f++){var m=f!==1;n.addNextSegment(s[f],m)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var n=this.simplifyTolerance(this._distance),r=ee.simplify(t,n),s=r.length-1;e.initSideSegments(r[0],r[1],X.LEFT);for(var c=2;c<=s;c++)e.addNextSegment(r[c],!0);e.addLastSegment(),e.addLineEndCap(r[s-1],r[s]);var f=ee.simplify(t,-n),m=f.length-1;e.initSideSegments(f[m],f[m-1],X.LEFT);for(var _=m-2;_>=0;_--)e.addNextSegment(f[_],!0);e.addLastSegment(),e.addLineEndCap(f[1],f[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case H.CAP_ROUND:e.createCircle(t);break;case H.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var s=e<0;this.computeSingleSidedBufferCurve(t,s,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return i.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var s=ee.simplify(t,-r),c=s.length-1;n.initSideSegments(s[c],s[c-1],X.LEFT),n.addFirstSegment();for(var f=c-2;f>=0;f--)n.addNextSegment(s[f],!0)}else{var m=ee.simplify(t,r),_=m.length-1;n.initSideSegments(m[0],m[1],X.LEFT),n.addFirstSegment();for(var C=2;C<=_;C++)n.addNextSegment(m[C],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return t===0||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new hn(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new A(t[n]);return e}}])})(),cs=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var i=arguments[0],t=new ot,e=this._subgraphs.iterator();e.hasNext();){var n=e.next(),r=n.getEnvelope();i.y<r.getMinY()||i.y>r.getMaxY()||this.findStabbedSegments(i,n.getDirectedEdges(),t)}return t}if(arguments.length===3){if(gt(arguments[2],Ne)&&arguments[0]instanceof A&&arguments[1]instanceof Ni){for(var s=arguments[0],c=arguments[1],f=arguments[2],m=c.getEdge().getCoordinates(),_=0;_<m.length-1;_++)if(this._seg.p0=m[_],this._seg.p1=m[_+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<s.x||this._seg.isHorizontal()||s.y<this._seg.p0.y||s.y>this._seg.p1.y||ht.index(this._seg.p0,this._seg.p1,s)===ht.RIGHT)){var C=c.getDepth(X.LEFT);this._seg.p0.equals(m[_])||(C=c.getDepth(X.RIGHT));var D=new fs(this._seg,C);f.add(D)}}else if(gt(arguments[2],Ne)&&arguments[0]instanceof A&&gt(arguments[1],Ne))for(var U=arguments[0],Z=arguments[2],tt=arguments[1].iterator();tt.hasNext();){var st=tt.next();st.isForward()&&this.findStabbedSegments(U,st,Z)}}}},{key:"getDepth",value:function(i){var t=this.findStabbedSegments(i);return t.size()===0?0:Be.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Yt;var i=arguments[0];this._subgraphs=i}}])})(),fs=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(i){var t=i;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var e=this._upwardSeg.orientationIndex(t._upwardSeg);return e!==0||(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?e:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(i,t){var e=i.p0.compareTo(t.p0);return e!==0?e:i.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var i=arguments[0],t=arguments[1];this._upwardSeg=new Yt(i),this._leftDepth=t}}])})();cs.DepthSegment=fs;var gs=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,null,[{key:"constructor_",value:function(){it.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(it),Ti=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getY",value:function(){var t=this.y/this.w;if(z.isNaN(t)||z.isInfinite(t))throw new gs;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(z.isNaN(t)||z.isInfinite(t))throw new gs;return t}},{key:"getCoordinate",value:function(){var t=new A;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof i&&arguments[1]instanceof i){var r=arguments[0],s=arguments[1];this.x=r.y*s.w-s.y*r.w,this.y=s.x*r.w-r.x*s.w,this.w=r.x*s.y-s.x*r.y}else if(arguments[0]instanceof A&&arguments[1]instanceof A){var c=arguments[0],f=arguments[1];this.x=c.y-f.y,this.y=f.x-c.x,this.w=c.x*f.y-f.x*c.y}}else if(arguments.length===3){var m=arguments[0],_=arguments[1],C=arguments[2];this.x=m,this.y=_,this.w=C}else if(arguments.length===4){var D=arguments[0],U=arguments[1],Z=arguments[2],tt=arguments[3],st=D.y-U.y,dt=U.x-D.x,mt=D.x*U.y-U.x*D.y,It=Z.y-tt.y,Dt=tt.x-Z.x,Ft=Z.x*tt.y-tt.x*Z.y;this.x=dt*Ft-Dt*mt,this.y=It*mt-st*Ft,this.w=st*Dt-It*dt}}}])})(),Fu=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"area",value:function(){return i.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return i.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(t===null)throw new W("Supplied point is null.");return i.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return i.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return i.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return i.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return i.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return i.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return i.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}},{key:"area",value:function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)}},{key:"signedArea",value:function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2}},{key:"det",value:function(t,e,n,r){return t*r-e*n}},{key:"interpolateZ",value:function(t,e,n,r){var s=e.x,c=e.y,f=n.x-s,m=r.x-s,_=n.y-c,C=r.y-c,D=f*C-m*_,U=t.x-s,Z=t.y-c,tt=(C*U-m*Z)/D,st=(-_*U+f*Z)/D;return e.getZ()+tt*(n.getZ()-e.getZ())+st*(r.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,n){var r=t.distance(e),s=e.distance(n),c=n.distance(t),f=r;return s>f&&(f=s),c>f&&(f=c),f}},{key:"circumcentreDD",value:function(t,e,n){var r=lt.valueOf(t.x).subtract(n.x),s=lt.valueOf(t.y).subtract(n.y),c=lt.valueOf(e.x).subtract(n.x),f=lt.valueOf(e.y).subtract(n.y),m=lt.determinant(r,s,c,f).multiply(2),_=r.sqr().add(s.sqr()),C=c.sqr().add(f.sqr()),D=lt.determinant(s,_,f,C),U=lt.determinant(r,_,c,C),Z=lt.valueOf(n.x).subtract(D.divide(m)).doubleValue(),tt=lt.valueOf(n.y).add(U.divide(m)).doubleValue();return new A(Z,tt)}},{key:"isAcute",value:function(t,e,n){return!!zt.isAcute(t,e,n)&&!!zt.isAcute(e,n,t)&&!!zt.isAcute(n,t,e)}},{key:"circumcentre",value:function(t,e,n){var r=n.x,s=n.y,c=t.x-r,f=t.y-s,m=e.x-r,_=e.y-s,C=2*i.det(c,f,m,_),D=i.det(f,c*c+f*f,_,m*m+_*_),U=i.det(c,c*c+f*f,m,m*m+_*_);return new A(r-D/C,s+U/C)}},{key:"perpendicularBisector",value:function(t,e){var n=e.x-t.x,r=e.y-t.y,s=new Ti(t.x+n/2,t.y+r/2,1),c=new Ti(t.x-r+n/2,t.y+n+r/2,1);return new Ti(s,c)}},{key:"angleBisector",value:function(t,e,n){var r=e.distance(t),s=r/(r+e.distance(n)),c=n.x-t.x,f=n.y-t.y;return new A(t.x+s*c,t.y+s*f)}},{key:"area3D",value:function(t,e,n){var r=e.x-t.x,s=e.y-t.y,c=e.getZ()-t.getZ(),f=n.x-t.x,m=n.y-t.y,_=n.getZ()-t.getZ(),C=s*_-c*m,D=c*f-r*_,U=r*m-s*f,Z=C*C+D*D+U*U,tt=Math.sqrt(Z)/2;return tt}},{key:"centroid",value:function(t,e,n){var r=(t.x+e.x+n.x)/3,s=(t.y+e.y+n.y)/3;return new A(r,s)}},{key:"inCentre",value:function(t,e,n){var r=e.distance(n),s=t.distance(n),c=t.distance(e),f=r+s+c,m=(r*t.x+s*e.x+c*n.x)/f,_=(r*t.y+s*e.y+c*n.y)/f;return new A(m,_)}}])})(),Gu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(i,t,e,n,r){if(t===0&&i.length<sn.MINIMUM_VALID_SIZE)return null;var s=n,c=r;i.length>=sn.MINIMUM_VALID_SIZE&&ht.isCCW(i)&&(s=r,c=n,e=X.opposite(e));var f=this._curveBuilder.getRingCurve(i,e,t);this.addCurve(f,s,c)}},{key:"addRingBothSides",value:function(i,t){this.addRingSide(i,t,X.LEFT,k.EXTERIOR,k.INTERIOR),this.addRingSide(i,t,X.RIGHT,k.INTERIOR,k.EXTERIOR)}},{key:"addPoint",value:function(i){if(this._distance<=0)return null;var t=i.getCoordinates(),e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,k.EXTERIOR,k.INTERIOR)}},{key:"addPolygon",value:function(i){var t=this._distance,e=X.LEFT;this._distance<0&&(t=-this._distance,e=X.RIGHT);var n=i.getExteriorRing(),r=bt.removeRepeatedPoints(n.getCoordinates());if(this._distance<0&&this.isErodedCompletely(n,this._distance)||this._distance<=0&&r.length<3)return null;this.addRingSide(r,t,e,k.EXTERIOR,k.INTERIOR);for(var s=0;s<i.getNumInteriorRing();s++){var c=i.getInteriorRingN(s),f=bt.removeRepeatedPoints(c.getCoordinates());this._distance>0&&this.isErodedCompletely(c,-this._distance)||this.addRingSide(f,t,X.opposite(e),k.INTERIOR,k.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(i,t){var e=new Fu(i[0],i[1],i[2]),n=e.inCentre();return ue.pointToSegment(n,e.p0,e.p1)<Math.abs(t)}},{key:"addLineString",value:function(i){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=bt.removeRepeatedPoints(i.getCoordinates());if(bt.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,k.EXTERIOR,k.INTERIOR)}}},{key:"addCurve",value:function(i,t,e){if(i===null||i.length<2)return null;var n=new Ce(i,new Kt(0,k.BOUNDARY,t,e));this._curveList.add(n)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(i){if(i.isEmpty())return null;if(i instanceof qn)this.addPolygon(i);else if(i instanceof rn)this.addLineString(i);else if(i instanceof yi)this.addPoint(i);else if(i instanceof mi)this.addCollection(i);else if(i instanceof _i)this.addCollection(i);else if(i instanceof pi)this.addCollection(i);else{if(!(i instanceof Bt))throw new _t(i.getGeometryType());this.addCollection(i)}}},{key:"isErodedCompletely",value:function(i,t){var e=i.getCoordinates();if(e.length<4)return t<0;if(e.length===4)return this.isTriangleErodedCompletely(e,t);var n=i.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth());return t<0&&2*Math.abs(t)>r}},{key:"addCollection",value:function(i){for(var t=0;t<i.getNumGeometries();t++){var e=i.getGeometryN(t);this.add(e)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ot;var i=arguments[0],t=arguments[1],e=arguments[2];this._inputGeom=i,this._distance=t,this._curveBuilder=e}}])})(),qu=(function(){return g((function i(){o(this,i)}),[{key:"locate",value:function(i){}}])})(),Bu=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,i.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Ot;var t=this._parent.getGeometryN(this._index++);return t instanceof Bt?(this._subcollectionIterator=new i(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new _t(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Ru]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof Bt)}}])})(),Yu=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"locate",value:function(t){return i.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[qu]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,e){if(e.isEmpty())return k.EXTERIOR;var n=e.getExteriorRing(),r=i.locatePointInRing(t,n);if(r!==k.INTERIOR)return r;for(var s=0;s<e.getNumInteriorRing();s++){var c=e.getInteriorRingN(s),f=i.locatePointInRing(t,c);if(f===k.BOUNDARY)return k.BOUNDARY;if(f===k.INTERIOR)return k.EXTERIOR}return k.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?Ei.locateInRing(t,e.getCoordinates()):k.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,e){return k.EXTERIOR!==i.locatePointInPolygon(t,e)}},{key:"locateInGeometry",value:function(t,e){if(e instanceof qn)return i.locatePointInPolygon(t,e);if(e instanceof Bt)for(var n=new Bu(e);n.hasNext();){var r=n.next();if(r!==e){var s=i.locateInGeometry(t,r);if(s!==k.EXTERIOR)return s}}return k.EXTERIOR}},{key:"isContained",value:function(t,e){return k.EXTERIOR!==i.locate(t,e)}},{key:"locate",value:function(t,e){return e.isEmpty()?k.EXTERIOR:e.getEnvelopeInternal().intersects(t)?i.locateInGeometry(t,e):k.EXTERIOR}}])})(),zu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(i){this.getEdges();var t=this._edgeList.indexOf(i),e=t-1;return t===0&&(e=this._edgeList.size()-1),this._edgeList.get(e)}},{key:"propagateSideLabels",value:function(i){for(var t=k.NONE,e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.isArea(i)&&n.getLocation(i,X.LEFT)!==k.NONE&&(t=n.getLocation(i,X.LEFT))}if(t===k.NONE)return null;for(var r=t,s=this.iterator();s.hasNext();){var c=s.next(),f=c.getLabel();if(f.getLocation(i,X.ON)===k.NONE&&f.setLocation(i,X.ON,r),f.isArea(i)){var m=f.getLocation(i,X.LEFT),_=f.getLocation(i,X.RIGHT);if(_!==k.NONE){if(_!==r)throw new ge("side location conflict",c.getCoordinate());m===k.NONE&&nt.shouldNeverReachHere("found single null side (at "+c.getCoordinate()+")"),r=m}else nt.isTrue(f.getLocation(i,X.LEFT)===k.NONE,"found single null side"),f.setLocation(i,X.RIGHT,r),f.setLocation(i,X.LEFT,r)}}}},{key:"getCoordinate",value:function(){var i=this.iterator();return i.hasNext()?i.next().getCoordinate():null}},{key:"print",value:function(i){Zt.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"isAreaLabelsConsistent",value:function(i){return this.computeEdgeEndLabels(i.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(i){var t=this.getEdges();if(t.size()<=0)return!0;var e=t.size()-1,n=t.get(e).getLabel().getLocation(i,X.LEFT);nt.isTrue(n!==k.NONE,"Found unlabelled area edge");for(var r=n,s=this.iterator();s.hasNext();){var c=s.next().getLabel();nt.isTrue(c.isArea(i),"Found non-area edge");var f=c.getLocation(i,X.LEFT),m=c.getLocation(i,X.RIGHT);if(f===m||m!==r)return!1;r=f}return!0}},{key:"findIndex",value:function(i){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===i)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new ot(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(i,t,e){return this._ptInAreaLocation[i]===k.NONE&&(this._ptInAreaLocation[i]=Yu.locate(t,e[i].getGeometry())),this._ptInAreaLocation[i]}},{key:"toString",value:function(){var i=new en;i.append("EdgeEndStar: "+this.getCoordinate()),i.append(`\n`);for(var t=this.iterator();t.hasNext();){var e=t.next();i.append(e),i.append(`\n`)}return i.toString()}},{key:"computeEdgeEndLabels",value:function(i){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(i)}},{key:"computeLabelling",value:function(i){this.computeEdgeEndLabels(i[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],e=this.iterator();e.hasNext();)for(var n=e.next().getLabel(),r=0;r<2;r++)n.isLine(r)&&n.getLocation(r)===k.BOUNDARY&&(t[r]=!0);for(var s=this.iterator();s.hasNext();)for(var c=s.next(),f=c.getLabel(),m=0;m<2;m++)if(f.isAnyNull(m)){var _=k.NONE;if(t[m])_=k.EXTERIOR;else{var C=c.getCoordinate();_=this.getLocation(m,C,i)}f.setAllLocationsIfNull(m,_)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(i,t){this._edgeMap.put(i,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new ln,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]}}])})(),Uu=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,s=0;s<this._resultAreaEdgeList.size();s++){var c=this._resultAreaEdgeList.get(s),f=c.getSym();if(c.getLabel().isArea())switch(e===null&&c.isInResult()&&(e=c),r){case this._SCANNING_FOR_INCOMING:if(!f.isInResult())continue;n=f,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!c.isInResult())continue;n.setNext(c),r=this._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(e===null)throw new ge("no outgoing dirEdge found",this.getCoordinate());nt.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.setNext(e)}}},{key:"insert",value:function(e){var n=e;this.insertEdgeEnd(n,n)}},{key:"getRightmostEdge",value:function(){var e=this.getEdges(),n=e.size();if(n<1)return null;var r=e.get(0);if(n===1)return r;var s=e.get(n-1),c=r.getQuadrant(),f=s.getQuadrant();return Gt.isNorthern(c)&&Gt.isNorthern(f)?r:Gt.isNorthern(c)||Gt.isNorthern(f)?r.getDy()!==0?r:s.getDy()!==0?s:(nt.shouldNeverReachHere("found two horizontal edges incident on node"),null):s}},{key:"print",value:function(e){Zt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();){var r=n.next();e.print("out "),r.print(e),e.println(),e.print("in "),r.getSym().print(e),e.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new ot;for(var e=this.iterator();e.hasNext();){var n=e.next();(n.isInResult()||n.getSym().isInResult())&&this._resultAreaEdgeList.add(n)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(e){for(var n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.setAllLocationsIfNull(0,e.getLocation(0)),r.setAllLocationsIfNull(1,e.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var e=null,n=null,r=this._edgeList.size()-1;r>=0;r--){var s=this._edgeList.get(r),c=s.getSym();n===null&&(n=c),e!==null&&c.setNext(e),e=s}n.setNext(e)}},{key:"computeDepths",value:function(){if(arguments.length===1){var e=arguments[0],n=this.findIndex(e),r=e.getDepth(X.LEFT),s=e.getDepth(X.RIGHT),c=this.computeDepths(n+1,this._edgeList.size(),r);if(this.computeDepths(0,n,c)!==s)throw new ge("depth mismatch at "+e.getCoordinate())}else if(arguments.length===3){for(var f=arguments[1],m=arguments[2],_=arguments[0];_<f;_++){var C=this._edgeList.get(_);C.setEdgeDepths(X.RIGHT,m),m=C.getDepth(X.LEFT)}return m}}},{key:"mergeSymLabels",value:function(){for(var e=this.iterator();e.hasNext();){var n=e.next();n.getLabel().merge(n.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(e){for(var n=null,r=null,s=this._SCANNING_FOR_INCOMING,c=this._resultAreaEdgeList.size()-1;c>=0;c--){var f=this._resultAreaEdgeList.get(c),m=f.getSym();switch(n===null&&f.getEdgeRing()===e&&(n=f),s){case this._SCANNING_FOR_INCOMING:if(m.getEdgeRing()!==e)continue;r=m,s=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(f.getEdgeRing()!==e)continue;r.setNextMin(f),s=this._SCANNING_FOR_INCOMING}}s===this._LINKING_TO_OUTGOING&&(nt.isTrue(n!==null,"found null for first outgoing dirEdge"),nt.isTrue(n.getEdgeRing()===e,"unable to link last incoming dirEdge"),r.setNextMin(n))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var e=0,n=this.iterator();n.hasNext();)n.next().isInResult()&&e++;return e}if(arguments.length===1){for(var r=arguments[0],s=0,c=this.iterator();c.hasNext();)c.next().getEdgeRing()===r&&s++;return s}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var e=k.NONE,n=this.iterator();n.hasNext();){var r=n.next(),s=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){e=k.INTERIOR;break}if(s.isInResult()){e=k.EXTERIOR;break}}}if(e===k.NONE)return null;for(var c=e,f=this.iterator();f.hasNext();){var m=f.next(),_=m.getSym();m.isLineEdge()?m.getEdge().setCovered(c===k.INTERIOR):(m.isInResult()&&(c=k.EXTERIOR),_.isInResult()&&(c=k.INTERIOR))}}},{key:"computeLabelling",value:function(e){G(t,"computeLabelling",this,1).call(this,e),this._label=new Kt(k.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),s=0;s<2;s++){var c=r.getLocation(s);c!==k.INTERIOR&&c!==k.BOUNDARY||this._label.setLocation(s,k.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(zu),Xu=(function(i){function t(){return o(this,t),h(this,t)}return I(t,i),g(t,[{key:"createNode",value:function(e){return new Xn(e,new Uu)}}])})(ns),ys=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"compareTo",value:function(t){var e=t;return i.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=i.orientation(t)}},{key:"orientation",value:function(t){return bt.increasingDirection(t)===1}},{key:"compareOriented",value:function(t,e,n,r){for(var s=e?1:-1,c=r?1:-1,f=e?t.length:-1,m=r?n.length:-1,_=e?0:t.length-1,C=r?0:n.length-1;;){var D=t[_].compareTo(n[C]);if(D!==0)return D;var U=(_+=s)===f,Z=(C+=c)===m;if(U&&!Z)return-1;if(!U&&Z)return 1;if(U&&Z)return 0}}}])})(),Vu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"print",value:function(i){i.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var e=this._edges.get(t);t>0&&i.print(","),i.print("(");for(var n=e.getCoordinates(),r=0;r<n.length;r++)r>0&&i.print(","),i.print(n[r].x+" "+n[r].y);i.println(")")}i.print(") ")}},{key:"addAll",value:function(i){for(var t=i.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(i){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(i))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(i){return this._edges.get(i)}},{key:"findEqualEdge",value:function(i){var t=new ys(i.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(i){this._edges.add(i);var t=new ys(i.getCoordinates());this._ocaMap.put(t,i)}}],[{key:"constructor_",value:function(){this._edges=new ot,this._ocaMap=new ln}}])})(),ms=(function(){return g((function i(){o(this,i)}),[{key:"processIntersections",value:function(i,t,e,n){}},{key:"isDone",value:function(){}}])})(),Hu=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isTrivialIntersection",value:function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(i.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var s=t.size()-1;if(e===0&&r===s||r===0&&e===s)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var s=t.getCoordinates()[e],c=t.getCoordinates()[e+1],f=n.getCoordinates()[r],m=n.getCoordinates()[r+1];this._li.computeIntersection(s,c,f,m),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[ms]}}],[{key:"constructor_",value:function(){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;var t=arguments[0];this._li=t}},{key:"isAdjacentSegments",value:function(t,e){return Math.abs(t-e)===1}}])})(),Zu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(i){i.print(this.coord),i.print(" seg # = "+this.segmentIndex),i.println(" dist = "+this.dist)}},{key:"compareTo",value:function(i){var t=i;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(i){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===i}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(i,t){return this.segmentIndex<i?-1:this.segmentIndex>i?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var i=arguments[0],t=arguments[1],e=arguments[2];this.coord=new A(i),this.segmentIndex=t,this.dist=e}}])})(),Wu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"print",value:function(i){i.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(i){this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next(),r=this.createSplitEdge(e,n);i.add(r),e=n}}},{key:"addEndpoints",value:function(){var i=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[i],i,0)}},{key:"createSplitEdge",value:function(i,t){var e=t.segmentIndex-i.segmentIndex+2,n=this.edge.pts[t.segmentIndex],r=t.dist>0||!t.coord.equals2D(n);r||e--;var s=new Array(e).fill(null),c=0;s[c++]=new A(i.coord);for(var f=i.segmentIndex+1;f<=t.segmentIndex;f++)s[c++]=this.edge.pts[f];return r&&(s[c]=t.coord),new ds(s,new Kt(this.edge._label))}},{key:"add",value:function(i,t,e){var n=new Zu(i,t,e),r=this._nodeMap.get(n);return r!==null?r:(this._nodeMap.put(n,n),n)}},{key:"isIntersection",value:function(i){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(i))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new ln,this.edge=null;var i=arguments[0];this.edge=i}}])})(),Ku=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])||i.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||i.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||i.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))&&this._matrix[k.EXTERIOR][k.INTERIOR]===V.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===V.FALSE}},{key:"isCoveredBy",value:function(){return(i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])||i.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||i.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||i.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))&&this._matrix[k.INTERIOR][k.EXTERIOR]===V.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===V.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),r=e%3;this._matrix[n][r]=V.toDimensionValue(t.charAt(e))}else if(arguments.length===3){var s=arguments[0],c=arguments[1],f=arguments[2];this._matrix[s][c]=f}}},{key:"isContains",value:function(){return i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.EXTERIOR][k.INTERIOR]===V.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===V.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),r=e%3;this.setAtLeast(n,r,V.toDimensionValue(t.charAt(e)))}else if(arguments.length===3){var s=arguments[0],c=arguments[1],f=arguments[2];this._matrix[s][c]<f&&(this._matrix[s][c]=f)}}},{key:"setAtLeastIfValid",value:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)}},{key:"isWithin",value:function(){return i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.INTERIOR][k.EXTERIOR]===V.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===V.FALSE}},{key:"isTouches",value:function(t,e){return t>e?this.isTouches(e,t):(t===V.A&&e===V.A||t===V.L&&e===V.L||t===V.L&&e===V.A||t===V.P&&e===V.A||t===V.P&&e===V.L)&&this._matrix[k.INTERIOR][k.INTERIOR]===V.FALSE&&(i.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||i.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||i.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))}},{key:"isOverlaps",value:function(t,e){return t===V.P&&e===V.P||t===V.A&&e===V.A?i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&i.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR])&&i.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR]):t===V.L&&e===V.L&&this._matrix[k.INTERIOR][k.INTERIOR]===1&&i.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR])&&i.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR])}},{key:"isEquals",value:function(t,e){return t===e&&i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.INTERIOR][k.EXTERIOR]===V.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===V.FALSE&&this._matrix[k.EXTERIOR][k.INTERIOR]===V.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===V.FALSE}},{key:"toString",value:function(){for(var t=new Yn("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,V.toDimensionSymbol(this._matrix[e][n]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this._matrix[e][n]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value:function(){var 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}},{key:"matches",value:function(t){if(t.length!==9)throw new W("Should be length 9: "+t);for(var e=0;e<3;e++)for(var n=0;n<3;n++)if(!i.matches(this._matrix[e][n],t.charAt(3*e+n)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))}},{key:"isDisjoint",value:function(){return this._matrix[k.INTERIOR][k.INTERIOR]===V.FALSE&&this._matrix[k.INTERIOR][k.BOUNDARY]===V.FALSE&&this._matrix[k.BOUNDARY][k.INTERIOR]===V.FALSE&&this._matrix[k.BOUNDARY][k.BOUNDARY]===V.FALSE}},{key:"isCrosses",value:function(t,e){return t===V.P&&e===V.L||t===V.P&&e===V.A||t===V.L&&e===V.A?i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&i.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR]):t===V.L&&e===V.P||t===V.A&&e===V.P||t===V.A&&e===V.L?i.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&i.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR]):t===V.L&&e===V.L&&this._matrix[k.INTERIOR][k.INTERIOR]===0}},{key:"interfaces_",get:function(){return[v]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(V.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var t=arguments[0];i.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof i){var e=arguments[0];i.constructor_.call(this),this._matrix[k.INTERIOR][k.INTERIOR]=e._matrix[k.INTERIOR][k.INTERIOR],this._matrix[k.INTERIOR][k.BOUNDARY]=e._matrix[k.INTERIOR][k.BOUNDARY],this._matrix[k.INTERIOR][k.EXTERIOR]=e._matrix[k.INTERIOR][k.EXTERIOR],this._matrix[k.BOUNDARY][k.INTERIOR]=e._matrix[k.BOUNDARY][k.INTERIOR],this._matrix[k.BOUNDARY][k.BOUNDARY]=e._matrix[k.BOUNDARY][k.BOUNDARY],this._matrix[k.BOUNDARY][k.EXTERIOR]=e._matrix[k.BOUNDARY][k.EXTERIOR],this._matrix[k.EXTERIOR][k.INTERIOR]=e._matrix[k.EXTERIOR][k.INTERIOR],this._matrix[k.EXTERIOR][k.BOUNDARY]=e._matrix[k.EXTERIOR][k.BOUNDARY],this._matrix[k.EXTERIOR][k.EXTERIOR]=e._matrix[k.EXTERIOR][k.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var t=arguments[0],e=arguments[1];return e===V.SYM_DONTCARE||e===V.SYM_TRUE&&(t>=0||t===V.TRUE)||e===V.SYM_FALSE&&t===V.FALSE||e===V.SYM_P&&t===V.P||e===V.SYM_L&&t===V.L||e===V.SYM_A&&t===V.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var n=arguments[1];return new i(arguments[0]).matches(n)}}},{key:"isTrue",value:function(t){return t>=0||t===V.TRUE}}])})(),Ju=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return t===null||t.length===0?null:(this.ensureCapacity(this._size+t.length),Zt.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=Se.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return Zt.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)i.constructor_.call(this,10);else if(arguments.length===1){var t=arguments[0];this._data=new Array(t).fill(null)}}}])})(),ju=(function(){function i(){o(this,i)}return g(i,[{key:"getChainStartIndices",value:function(t){var e=0,n=new Ju(Math.trunc(t.length/2));n.add(e);do{var r=this.findChainEnd(t,e);n.add(r),e=r}while(e<t.length-1);return n.toArray()}},{key:"findChainEnd",value:function(t,e){for(var n=Gt.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&Gt.quadrant(t[r-1],t[r])===n;)r++;return r-1}},{key:"OLDgetChainStartIndices",value:function(t){var e=0,n=new ot;n.add(e);do{var r=this.findChainEnd(t,e);n.add(r),e=r}while(e<t.length-1);return i.toIntArray(n)}}],[{key:"toIntArray",value:function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e}}])})(),Qu=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(i){var t=this.pts[this.startIndex[i]].x,e=this.pts[this.startIndex[i+1]].x;return t>e?t:e}},{key:"getMinX",value:function(i){var t=this.pts[this.startIndex[i]].x,e=this.pts[this.startIndex[i+1]].x;return t<e?t:e}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[i],this.startIndex[i+1],t,t.startIndex[e],t.startIndex[e+1],n)}else if(arguments.length===6){var r=arguments[0],s=arguments[1],c=arguments[2],f=arguments[3],m=arguments[4],_=arguments[5];if(s-r==1&&m-f==1)return _.addIntersections(this.e,r,c.e,f),null;if(!this.overlaps(r,s,c,f,m))return null;var C=Math.trunc((r+s)/2),D=Math.trunc((f+m)/2);r<C&&(f<D&&this.computeIntersectsForChain(r,C,c,f,D,_),D<m&&this.computeIntersectsForChain(r,C,c,D,m,_)),C<s&&(f<D&&this.computeIntersectsForChain(C,s,c,f,D,_),D<m&&this.computeIntersectsForChain(C,s,c,D,m,_))}}},{key:"overlaps",value:function(i,t,e,n,r){return Et.intersects(this.pts[i],this.pts[t],e.pts[n],e.pts[r])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(i,t){for(var e=0;e<this.startIndex.length-1;e++)for(var n=0;n<i.startIndex.length-1;n++)this.computeIntersectsForChain(e,i,n,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var i=arguments[0];this.e=i,this.pts=i.getCoordinates();var t=new ju;this.startIndex=t.getChainStartIndices(this.pts)}}])})(),vs=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getDepth",value:function(t,e){return this._depth[t][e]}},{key:"setDepth",value:function(t,e,n){this._depth[t][e]=n}},{key:"isNull",value:function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==i.NULL_VALUE)return!1;return!0}if(arguments.length===1){var n=arguments[0];return this._depth[n][1]===i.NULL_VALUE}if(arguments.length===2){var r=arguments[0],s=arguments[1];return this._depth[r][s]===i.NULL_VALUE}}},{key:"normalize",value:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}}},{key:"getDelta",value:function(t){return this._depth[t][X.RIGHT]-this._depth[t][X.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?k.EXTERIOR:k.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==k.EXTERIOR&&r!==k.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=i.depthAtLocation(r):this._depth[e][n]+=i.depthAtLocation(r))}else if(arguments.length===3){var s=arguments[0],c=arguments[1];arguments[2]===k.INTERIOR&&this._depth[s][c]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=i.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===k.EXTERIOR?0:t===k.INTERIOR?1:i.NULL_VALUE}}])})();vs.NULL_VALUE=-1;var ds=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var e=new Array(2).fill(null);return e[0]=this.pts[0],e[1]=this.pts[1],new t(e,Kt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(e){this._isIsolated=e}},{key:"setName",value:function(e){this._name=e}},{key:"equals",value:function(e){if(!(e instanceof t))return!1;var n=e;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,s=!0,c=this.pts.length,f=0;f<this.pts.length;f++)if(this.pts[f].equals2D(n.pts[f])||(r=!1),this.pts[f].equals2D(n.pts[--c])||(s=!1),!r&&!s)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var e=arguments[0];return this.pts[e]}}},{key:"print",value:function(e){e.print("edge "+this._name+": "),e.print("LINESTRING (");for(var n=0;n<this.pts.length;n++)n>0&&e.print(","),e.print(this.pts[n].x+" "+this.pts[n].y);e.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(e){t.updateIM(this._label,e)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(e){e.print("edge "+this._name+": ");for(var n=this.pts.length-1;n>=0;n--)e.print(this.pts[n]+" ");e.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Qu(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new Et;for(var e=0;e<this.pts.length;e++)this._env.expandToInclude(this.pts[e])}return this._env}},{key:"addIntersection",value:function(e,n,r,s){var c=new A(e.getIntersection(s)),f=n,m=e.getEdgeDistance(r,s),_=f+1;if(_<this.pts.length){var C=this.pts[_];c.equals2D(C)&&(f=_,m=0)}this.eiList.add(c,f,m)}},{key:"toString",value:function(){var e=new Yn;e.append("edge "+this._name+": "),e.append("LINESTRING (");for(var n=0;n<this.pts.length;n++)n>0&&e.append(","),e.append(this.pts[n].x+" "+this.pts[n].y);return e.append(") "+this._label+" "+this._depthDelta),e.toString()}},{key:"isPointwiseEqual",value:function(e){if(this.pts.length!==e.pts.length)return!1;for(var n=0;n<this.pts.length;n++)if(!this.pts[n].equals2D(e.pts[n]))return!1;return!0}},{key:"setDepthDelta",value:function(e){this._depthDelta=e}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(e,n,r){for(var s=0;s<e.getIntersectionNum();s++)this.addIntersection(e,n,r,s)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new Wu(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new vs,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.constructor_.call(this,e,null)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.pts=n,this._label=r}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Ku&&arguments[0]instanceof Kt))return G(t,"updateIM",this).apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,X.ON),e.getLocation(1,X.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,X.LEFT),e.getLocation(1,X.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,X.RIGHT),e.getLocation(1,X.RIGHT),2))}}])})(jr),ps=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new Kt(t.getLabel())).flip(),n.merge(r);var s=i.depthDelta(r),c=e.getDepthDelta()+s;e.setDepthDelta(c)}else this._edgeList.add(t),t.setDepthDelta(i.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var n=new ot,r=t.iterator();r.hasNext();){var s=r.next(),c=s.getRightmostCoordinate(),f=new cs(n).getDepth(c);s.computeDepth(f),s.findResultEdges(),n.add(s),e.add(s.getDirectedEdges(),s.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new ot,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var s=new iu;s.create(r),e.add(s)}}return Be.sort(e,Be.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Si,n=new Re;return n.setPrecisionModel(t),e.setSegmentIntersector(new Hu(n)),e}},{key:"buffer",value:function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new Du(n,this._bufParams),s=new Gu(t,e,r).getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this._graph=new is(new Xu),this._graph.addEdges(this._edgeList.getEdges());var c=this.createSubgraphs(this._graph),f=new Iu(this._geomFact);this.buildSubgraphs(c,f);var m=f.getPolygons();return m.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(m)}},{key:"computeNodedEdges",value:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var s=r.next(),c=s.getCoordinates();if(c.length!==2||!c[0].equals2D(c[1])){var f=s.getData(),m=new ds(s.getCoordinates(),new Kt(f));this.insertUniqueEdge(m)}}}},{key:"setNoder",value:function(t){this._workingNoder=t}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Vu;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,X.LEFT),n=t.getLocation(0,X.RIGHT);return e===k.INTERIOR&&n===k.EXTERIOR?1:e===k.EXTERIOR&&n===k.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new Ge,n=new ot;t.hasNext();){var r=t.next(),s=e.createLineString(r.getCoordinates());n.add(s)}return e.buildGeometry(n)}}])})(),$u=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"rescale",value:function(){if(gt(arguments[0],Rt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],r=0;r<n.length;r++)n[r].x=n[r].x/this._scaleFactor+this._offsetX,n[r].y=n[r].y/this._scaleFactor+this._offsetY;n.length===2&&n[0].equals2D(n[1])&&Zt.out.println(n)}}},{key:"scale",value:function(){if(gt(arguments[0],Rt)){for(var t=arguments[0],e=new ot(t.size()),n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ce(this.scale(r.getCoordinates()),r.getData()))}return e}if(arguments[0]instanceof Array){for(var s=arguments[0],c=new Array(s.length).fill(null),f=0;f<s.length;f++)c[f]=new A(Math.round((s[f].x-this._offsetX)*this._scaleFactor),Math.round((s[f].y-this._offsetY)*this._scaleFactor),s[f].getZ());return bt.removeRepeatedPoints(c)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}},{key:"computeNodes",value:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}},{key:"interfaces_",get:function(){return[wi]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];i.constructor_.call(this,t,e,0,0)}else if(arguments.length===4){var n=arguments[0],r=arguments[1];this._noder=n,this._scaleFactor=r,this._isScaled=!this.isIntegerPrecision()}}}])})(),_s=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(arguments.length===2){for(var n=arguments[0],r=arguments[1].iterator();r.hasNext();)for(var s=r.next().getCoordinates(),c=1;c<s.length-1;c++)if(s[c].equals(n))throw new at("found endpt/interior pt intersection at index "+c+" :pt "+n)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(arguments.length===2)for(var s=arguments[0],c=arguments[1],f=s.getCoordinates(),m=c.getCoordinates(),_=0;_<f.length-1;_++)for(var C=0;C<m.length-1;C++)this.checkInteriorIntersections(s,_,c,C);else if(arguments.length===4){var D=arguments[0],U=arguments[1],Z=arguments[2],tt=arguments[3];if(D===Z&&U===tt)return null;var st=D.getCoordinates()[U],dt=D.getCoordinates()[U+1],mt=Z.getCoordinates()[tt],It=Z.getCoordinates()[tt+1];if(this._li.computeIntersection(st,dt,mt,It),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,st,dt)||this.hasInteriorIntersection(this._li,mt,It)))throw new at("found non-noded intersection at "+st+"-"+dt+" and "+mt+"-"+It)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(arguments.length===1)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])}},{key:"hasInteriorIntersection",value:function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var s=t.getIntersection(r);if(!s.equals(e)&&!s.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(t,e,n){if(t.equals(n))throw new at("found non-noded collapse at "+i.fact.createLineString([t,e,n]))}}],[{key:"constructor_",value:function(){this._li=new Re,this._segStrings=null;var t=arguments[0];this._segStrings=t}}])})();_s.fact=new Ge;var Li=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"intersectsScaled",value:function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),c=Math.max(t.y,e.y),f=this._maxx<n||this._minx>r||this._maxy<s||this._miny>c;if(f)return!1;var m=this.intersectsToleranceSquare(t,e);return nt.isTrue(!(f&&m),"Found bad envelope test"),m}},{key:"initCorners",value:function(t){var 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 A(this._maxx,this._maxy),this._corner[1]=new A(this._minx,this._maxy),this._corner[2]=new A(this._minx,this._miny),this._corner[3]=new A(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var t=i.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Et(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(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())))}},{key:"intersectsToleranceSquare",value:function(t,e){var n=!1,r=!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()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!r)||!!t.equals(this._pt)||!!e.equals(this._pt))))}},{key:"addSnappedNode",value:function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){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;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new W("Scale factor must be non-zero");e!==1&&(this._pt=new A(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new A,this._p1Scaled=new A),this.initCorners(this._pt)}}])})();Li.SAFE_ENV_EXPANSION_FACTOR=.75;var to=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var i=arguments[1];arguments[0].getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Yt}}])})(),xs=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var i=arguments[0];return this.snap(i,null,-1)}if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getSafeEnvelope(),s=new ks(t,e,n);return this._index.query(r,new((function(){return g((function c(){o(this,c)}),[{key:"interfaces_",get:function(){return[ss]}},{key:"visitItem",value:function(c){c.select(r,s)}}])})())),s.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var i=arguments[0];this._index=i}}])})(),ks=(function(i){function t(){var e;return o(this,t),e=h(this,t),t.constructor_.apply(e,arguments),e}return I(t,i),g(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof us))return G(t,"select",this,1).apply(this,arguments);var e=arguments[1],n=arguments[0].getContext();if(this._parentEdge===n&&(e===this._hotPixelVertexIndex||e+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(n,e)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}}])})(to);xs.HotPixelSnapAction=ks;var eo=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(i,t,e,n){if(i===e&&t===n)return null;var r=i.getCoordinates()[t],s=i.getCoordinates()[t+1],c=e.getCoordinates()[n],f=e.getCoordinates()[n+1];if(this._li.computeIntersection(r,s,c,f),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var m=0;m<this._li.getIntersectionNum();m++)this._interiorIntersections.add(this._li.getIntersection(m));i.addIntersections(this._li,t,0),e.addIntersections(this._li,n,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[ms]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var i=arguments[0];this._li=i,this._interiorIntersections=new ot}}])})(),no=(function(){return g((function i(){o(this,i),i.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(i){var t=Ce.getNodedSubstrings(i),e=new _s(t);try{e.checkValid()}catch(n){if(!(n instanceof it))throw n;n.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Ce.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(i,t){var e=this.findInteriorIntersections(i,t);this.computeIntersectionSnaps(e),this.computeVertexSnaps(i)}},{key:"findInteriorIntersections",value:function(i,t){var e=new eo(t);return this._noder.setSegmentIntersector(e),this._noder.computeNodes(i),e.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(gt(arguments[0],Rt))for(var i=arguments[0].iterator();i.hasNext();){var t=i.next();this.computeVertexSnaps(t)}else if(arguments[0]instanceof Ce)for(var e=arguments[0],n=e.getCoordinates(),r=0;r<n.length;r++){var s=new Li(n[r],this._scaleFactor,this._li);this._pointSnapper.snap(s,e,r)&&e.addIntersection(n[r],r)}}},{key:"computeNodes",value:function(i){this._nodedSegStrings=i,this._noder=new Si,this._pointSnapper=new xs(this._noder.getIndex()),this.snapRound(i,this._li)}},{key:"computeIntersectionSnaps",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next(),n=new Li(e,this._scaleFactor,this._li);this._pointSnapper.snap(n)}}},{key:"interfaces_",get:function(){return[wi]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var i=arguments[0];this._pm=i,this._li=new Re,this._li.setPrecisionModel(i),this._scaleFactor=i.getScale()}}])})(),Ue=(function(){function i(){o(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"bufferFixedPrecision",value:function(t){var e=new $u(new no(new te(1)),t.getScale()),n=new ps(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var t=i.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(s){if(!(s instanceof ge))throw s;this._saveException=s}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var e=arguments[0],n=i.precisionScaleFactor(this._argGeom,this._distance,e),r=new te(n);this.bufferFixedPrecision(r)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===te.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new ps(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof at))throw e;this._saveException=e}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new H,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var t=arguments[1];return new i(arguments[0]).getResultGeometry(t)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var e=arguments[1],n=arguments[2],r=new i(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof H&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var s=arguments[1];return new i(arguments[0],arguments[2]).getResultGeometry(s)}}else if(arguments.length===4){var c=arguments[1],f=arguments[2],m=arguments[3],_=new i(arguments[0]);return _.setQuadrantSegments(f),_.setEndCapStyle(m),_.getResultGeometry(c)}}},{key:"precisionScaleFactor",value:function(t,e,n){var r=t.getEnvelopeInternal(),s=nn.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),c=n-Math.trunc(Math.log(s)/Math.log(10)+1);return Math.pow(10,c)}}])})();Ue.CAP_ROUND=H.CAP_ROUND,Ue.CAP_BUTT=H.CAP_FLAT,Ue.CAP_FLAT=H.CAP_FLAT,Ue.CAP_SQUARE=H.CAP_SQUARE,Ue.MAX_PRECISION_DIGITS=12;var io=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Es=(function(){return g((function i(t){o(this,i),this.geometryFactory=t||new Ge}),[{key:"read",value:function(i){var t,e=(t=typeof i=="string"?JSON.parse(i):i).type;if(!jt[e])throw new Error("Unknown GeoJSON type: "+t.type);return io.indexOf(e)!==-1?jt[e].call(this,t.coordinates):e==="GeometryCollection"?jt[e].call(this,t.geometries):jt[e].call(this,t)}},{key:"write",value:function(i){var t=i.getGeometryType();if(!he[t])throw new Error("Geometry is not supported");return he[t].call(this,i)}}])})(),jt={Feature:function(i){var t={};for(var e in i)t[e]=i[e];if(i.geometry){var n=i.geometry.type;if(!jt[n])throw new Error("Unknown GeoJSON type: "+i.type);t.geometry=this.read(i.geometry)}return i.bbox&&(t.bbox=jt.bbox.call(this,i.bbox)),t},FeatureCollection:function(i){var t={};if(i.features){t.features=[];for(var e=0;e<i.features.length;++e)t.features.push(this.read(i.features[e]))}return i.bbox&&(t.bbox=this.parse.bbox.call(this,i.bbox)),t},coordinates:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(y(A,et(n)))}return t},bbox:function(i){return this.geometryFactory.createLinearRing([new A(i[0],i[1]),new A(i[2],i[1]),new A(i[2],i[3]),new A(i[0],i[3]),new A(i[0],i[1])])},Point:function(i){var t=y(A,et(i));return this.geometryFactory.createPoint(t)},MultiPoint:function(i){for(var t=[],e=0;e<i.length;++e)t.push(jt.Point.call(this,i[e]));return this.geometryFactory.createMultiPoint(t)},LineString:function(i){var t=jt.coordinates.call(this,i);return this.geometryFactory.createLineString(t)},MultiLineString:function(i){for(var t=[],e=0;e<i.length;++e)t.push(jt.LineString.call(this,i[e]));return this.geometryFactory.createMultiLineString(t)},Polygon:function(i){for(var t=jt.coordinates.call(this,i[0]),e=this.geometryFactory.createLinearRing(t),n=[],r=1;r<i.length;++r){var s=i[r],c=jt.coordinates.call(this,s),f=this.geometryFactory.createLinearRing(c);n.push(f)}return this.geometryFactory.createPolygon(e,n)},MultiPolygon:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(jt.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(t)},GeometryCollection:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(this.read(n))}return this.geometryFactory.createGeometryCollection(t)}},he={coordinate:function(i){var t=[i.x,i.y];return i.z&&t.push(i.z),i.m&&t.push(i.m),t},Point:function(i){return{type:"Point",coordinates:he.coordinate.call(this,i.getCoordinate())}},MultiPoint:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=he.Point.call(this,n);t.push(r.coordinates)}return{type:"MultiPoint",coordinates:t}},LineString:function(i){for(var t=[],e=i.getCoordinates(),n=0;n<e.length;++n){var r=e[n];t.push(he.coordinate.call(this,r))}return{type:"LineString",coordinates:t}},MultiLineString:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=he.LineString.call(this,n);t.push(r.coordinates)}return{type:"MultiLineString",coordinates:t}},Polygon:function(i){var t=[],e=he.LineString.call(this,i._shell);t.push(e.coordinates);for(var n=0;n<i._holes.length;++n){var r=i._holes[n],s=he.LineString.call(this,r);t.push(s.coordinates)}return{type:"Polygon",coordinates:t}},MultiPolygon:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=he.Polygon.call(this,n);t.push(r.coordinates)}return{type:"MultiPolygon",coordinates:t}},GeometryCollection:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=n.getGeometryType();t.push(he[r].call(this,n))}return{type:"GeometryCollection",geometries:t}}};return{BufferOp:Ue,GeoJSONReader:(function(){return g((function i(t){o(this,i),this.parser=new Es(t||new Ge)}),[{key:"read",value:function(i){return this.parser.read(i)}}])})(),GeoJSONWriter:(function(){return g((function i(){o(this,i),this.parser=new Es(this.geometryFactory)}),[{key:"write",value:function(i){return this.parser.write(i)}}])})()}}))})(yn)),yn.exports}var qs=Gs(),Bs=Ds(qs);function ve(){return new mn}function mn(){this.reset()}mn.prototype={constructor:mn,reset:function(){this.s=this.t=0},add:function(a){Ai(vn,a,this.t),Ai(this,vn.s,this.s),this.s?this.t+=vn.t:this.s=vn.t},valueOf:function(){return this.s}};var vn=new mn;function Ai(a,u,l){var h=a.s=u+l,o=h-u,y=h-o;a.t=u-y+(l-o)}var Nt=1e-6,pt=Math.PI,ie=pt/2,Di=pt/4,re=pt*2,de=180/pt,Ut=pt/180,Pt=Math.abs,Ys=Math.atan,be=Math.atan2,St=Math.cos,Tt=Math.sin,Pe=Math.sqrt;function Fi(a){return a>1?0:a<-1?pt:Math.acos(a)}function ke(a){return a>1?ie:a<-1?-ie:Math.asin(a)}function He(){}function dn(a,u){a&&qi.hasOwnProperty(a.type)&&qi[a.type](a,u)}var Gi={Feature:function(a,u){dn(a.geometry,u)},FeatureCollection:function(a,u){for(var l=a.features,h=-1,o=l.length;++h<o;)dn(l[h].geometry,u)}},qi={Sphere:function(a,u){u.sphere()},Point:function(a,u){a=a.coordinates,u.point(a[0],a[1],a[2])},MultiPoint:function(a,u){for(var l=a.coordinates,h=-1,o=l.length;++h<o;)a=l[h],u.point(a[0],a[1],a[2])},LineString:function(a,u){Wn(a.coordinates,u,0)},MultiLineString:function(a,u){for(var l=a.coordinates,h=-1,o=l.length;++h<o;)Wn(l[h],u,0)},Polygon:function(a,u){Bi(a.coordinates,u)},MultiPolygon:function(a,u){for(var l=a.coordinates,h=-1,o=l.length;++h<o;)Bi(l[h],u)},GeometryCollection:function(a,u){for(var l=a.geometries,h=-1,o=l.length;++h<o;)dn(l[h],u)}};function Wn(a,u,l){var h=-1,o=a.length-l,y;for(u.lineStart();++h<o;)y=a[h],u.point(y[0],y[1],y[2]);u.lineEnd()}function Bi(a,u){var l=-1,h=a.length;for(u.polygonStart();++l<h;)Wn(a[l],u,1);u.polygonEnd()}function zs(a,u){a&&Gi.hasOwnProperty(a.type)?Gi[a.type](a,u):dn(a,u)}ve(),ve();function Kn(a){return[be(a[1],a[0]),ke(a[2])]}function Ae(a){var u=a[0],l=a[1],h=St(l);return[h*St(u),h*Tt(u),Tt(l)]}function pn(a,u){return a[0]*u[0]+a[1]*u[1]+a[2]*u[2]}function _n(a,u){return[a[1]*u[2]-a[2]*u[1],a[2]*u[0]-a[0]*u[2],a[0]*u[1]-a[1]*u[0]]}function Jn(a,u){a[0]+=u[0],a[1]+=u[1],a[2]+=u[2]}function xn(a,u){return[a[0]*u,a[1]*u,a[2]*u]}function jn(a){var u=Pe(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=u,a[1]/=u,a[2]/=u}ve();function Yi(a,u){function l(h,o){return h=a(h,o),u(h[0],h[1])}return a.invert&&u.invert&&(l.invert=function(h,o){return h=u.invert(h,o),h&&a.invert(h[0],h[1])}),l}function Qn(a,u){return[a>pt?a-re:a<-pt?a+re:a,u]}Qn.invert=Qn;function Us(a,u,l){return(a%=re)?u||l?Yi(Ui(a),Xi(u,l)):Ui(a):u||l?Xi(u,l):Qn}function zi(a){return function(u,l){return u+=a,[u>pt?u-re:u<-pt?u+re:u,l]}}function Ui(a){var u=zi(a);return u.invert=zi(-a),u}function Xi(a,u){var l=St(a),h=Tt(a),o=St(u),y=Tt(u);function d(g,N){var x=St(N),w=St(g)*x,I=Tt(g)*x,F=Tt(N),B=F*l+w*h;return[be(I*o-B*y,w*l-F*h),ke(B*o+I*y)]}return d.invert=function(g,N){var x=St(N),w=St(g)*x,I=Tt(g)*x,F=Tt(N),B=F*o-I*y;return[be(I*o+F*y,w*l+B*h),ke(B*l-w*h)]},d}function Xs(a,u,l,h,o,y){if(l){var d=St(u),g=Tt(u),N=h*l;o==null?(o=u+h*re,y=u-N/2):(o=Vi(d,o),y=Vi(d,y),(h>0?o<y:o>y)&&(o+=h*re));for(var x,w=o;h>0?w>y:w<y;w-=N)x=Kn([d,-g*St(w),-g*Tt(w)]),a.point(x[0],x[1])}}function Vi(a,u){u=Ae(u),u[0]-=a,jn(u);var l=Fi(-u[1]);return((-u[2]<0?-l:l)+re-Nt)%re}function Hi(){var a=[],u;return{point:function(l,h){u.push([l,h])},lineStart:function(){a.push(u=[])},lineEnd:He,rejoin:function(){a.length>1&&a.push(a.pop().concat(a.shift()))},result:function(){var l=a;return a=[],u=null,l}}}function Vs(a,u,l,h,o,y){var d=a[0],g=a[1],N=u[0],x=u[1],w=0,I=1,F=N-d,B=x-g,G;if(G=l-d,!(!F&&G>0)){if(G/=F,F<0){if(G<w)return;G<I&&(I=G)}else if(F>0){if(G>I)return;G>w&&(w=G)}if(G=o-d,!(!F&&G<0)){if(G/=F,F<0){if(G>I)return;G>w&&(w=G)}else if(F>0){if(G<w)return;G<I&&(I=G)}if(G=h-g,!(!B&&G>0)){if(G/=B,B<0){if(G<w)return;G<I&&(I=G)}else if(B>0){if(G>I)return;G>w&&(w=G)}if(G=y-g,!(!B&&G<0)){if(G/=B,B<0){if(G>I)return;G>w&&(w=G)}else if(B>0){if(G<w)return;G<I&&(I=G)}return w>0&&(a[0]=d+w*F,a[1]=g+w*B),I<1&&(u[0]=d+I*F,u[1]=g+I*B),!0}}}}}function kn(a,u){return Pt(a[0]-u[0])<Nt&&Pt(a[1]-u[1])<Nt}function En(a,u,l,h){this.x=a,this.z=u,this.o=l,this.e=h,this.v=!1,this.n=this.p=null}function Zi(a,u,l,h,o){var y=[],d=[],g,N;if(a.forEach(function(G){if(!((et=G.length-1)<=0)){var et,K=G[0],ut=G[et],q;if(kn(K,ut)){for(o.lineStart(),g=0;g<et;++g)o.point((K=G[g])[0],K[1]);o.lineEnd();return}y.push(q=new En(K,G,null,!0)),d.push(q.o=new En(K,null,q,!1)),y.push(q=new En(ut,G,null,!1)),d.push(q.o=new En(ut,null,q,!0))}}),!!y.length){for(d.sort(u),Wi(y),Wi(d),g=0,N=d.length;g<N;++g)d[g].e=l=!l;for(var x=y[0],w,I;;){for(var F=x,B=!0;F.v;)if((F=F.n)===x)return;w=F.z,o.lineStart();do{if(F.v=F.o.v=!0,F.e){if(B)for(g=0,N=w.length;g<N;++g)o.point((I=w[g])[0],I[1]);else h(F.x,F.n.x,1,o);F=F.n}else{if(B)for(w=F.p.z,g=w.length-1;g>=0;--g)o.point((I=w[g])[0],I[1]);else h(F.x,F.p.x,-1,o);F=F.p}F=F.o,w=F.z,B=!B}while(!F.v);o.lineEnd()}}}function Wi(a){if(u=a.length){for(var u,l=0,h=a[0],o;++l<u;)h.n=o=a[l],o.p=h,h=o;h.n=o=a[0],o.p=h}}function Ki(a,u){return a<u?-1:a>u?1:a>=u?0:NaN}function Hs(a){return a.length===1&&(a=Zs(a)),{left:function(u,l,h,o){for(h==null&&(h=0),o==null&&(o=u.length);h<o;){var y=h+o>>>1;a(u[y],l)<0?h=y+1:o=y}return h},right:function(u,l,h,o){for(h==null&&(h=0),o==null&&(o=u.length);h<o;){var y=h+o>>>1;a(u[y],l)>0?o=y:h=y+1}return h}}}function Zs(a){return function(u,l){return Ki(a(u),l)}}Hs(Ki);function Ji(a){for(var u=a.length,l,h=-1,o=0,y,d;++h<u;)o+=a[h].length;for(y=new Array(o);--u>=0;)for(d=a[u],l=d.length;--l>=0;)y[--o]=d[l];return y}var Ze=1e9,In=-Ze;function Ws(a,u,l,h){function o(x,w){return a<=x&&x<=l&&u<=w&&w<=h}function y(x,w,I,F){var B=0,G=0;if(x==null||(B=d(x,I))!==(G=d(w,I))||N(x,w)<0^I>0)do F.point(B===0||B===3?a:l,B>1?h:u);while((B=(B+I+4)%4)!==G);else F.point(w[0],w[1])}function d(x,w){return Pt(x[0]-a)<Nt?w>0?0:3:Pt(x[0]-l)<Nt?w>0?2:1:Pt(x[1]-u)<Nt?w>0?1:0:w>0?3:2}function g(x,w){return N(x.x,w.x)}function N(x,w){var I=d(x,1),F=d(w,1);return I!==F?I-F:I===0?w[1]-x[1]:I===1?x[0]-w[0]:I===2?x[1]-w[1]:w[0]-x[0]}return function(x){var w=x,I=Hi(),F,B,G,et,K,ut,q,H,it,W,J,$={point:v,lineStart:L,lineEnd:O,polygonStart:E,polygonEnd:M};function v(S,R){o(S,R)&&w.point(S,R)}function p(){for(var S=0,R=0,P=B.length;R<P;++R)for(var b=B[R],Y=1,z=b.length,j=b[0],at,yt,nt=j[0],ft=j[1];Y<z;++Y)at=nt,yt=ft,j=b[Y],nt=j[0],ft=j[1],yt<=h?ft>h&&(nt-at)*(h-yt)>(ft-yt)*(a-at)&&++S:ft<=h&&(nt-at)*(h-yt)<(ft-yt)*(a-at)&&--S;return S}function E(){w=I,F=[],B=[],J=!0}function M(){var S=p(),R=J&&S,P=(F=Ji(F)).length;(R||P)&&(x.polygonStart(),R&&(x.lineStart(),y(null,null,1,x),x.lineEnd()),P&&Zi(F,g,S,y,x),x.polygonEnd()),w=x,F=B=G=null}function L(){$.point=T,B&&B.push(G=[]),W=!0,it=!1,q=H=NaN}function O(){F&&(T(et,K),ut&&it&&I.rejoin(),F.push(I.result())),$.point=v,it&&w.lineEnd()}function T(S,R){var P=o(S,R);if(B&&G.push([S,R]),W)et=S,K=R,ut=P,W=!1,P&&(w.lineStart(),w.point(S,R));else if(P&&it)w.point(S,R);else{var b=[q=Math.max(In,Math.min(Ze,q)),H=Math.max(In,Math.min(Ze,H))],Y=[S=Math.max(In,Math.min(Ze,S)),R=Math.max(In,Math.min(Ze,R))];Vs(b,Y,a,u,l,h)?(it||(w.lineStart(),w.point(b[0],b[1])),w.point(Y[0],Y[1]),P||w.lineEnd(),J=!1):P&&(w.lineStart(),w.point(S,R),J=!1)}q=S,H=R,it=P}return $}}var $n=ve();function Ks(a,u){var l=u[0],h=u[1],o=[Tt(l),-St(l),0],y=0,d=0;$n.reset();for(var g=0,N=a.length;g<N;++g)if(w=(x=a[g]).length)for(var x,w,I=x[w-1],F=I[0],B=I[1]/2+Di,G=Tt(B),et=St(B),K=0;K<w;++K,F=q,G=it,et=W,I=ut){var ut=x[K],q=ut[0],H=ut[1]/2+Di,it=Tt(H),W=St(H),J=q-F,$=J>=0?1:-1,v=$*J,p=v>pt,E=G*it;if($n.add(be(E*$*Tt(v),et*W+E*St(v))),y+=p?J+$*re:J,p^F>=l^q>=l){var M=_n(Ae(I),Ae(ut));jn(M);var L=_n(o,M);jn(L);var O=(p^J>=0?-1:1)*ke(L[2]);(h>O||h===O&&(M[0]||M[1]))&&(d+=p^J>=0?1:-1)}}return(y<-Nt||y<Nt&&$n<-Nt)^d&1}ve();function ji(a){return a}ve(),ve();var De=1/0,Nn=De,We=-De,wn=We,Qi={point:Js,lineStart:He,lineEnd:He,polygonStart:He,polygonEnd:He,result:function(){var a=[[De,Nn],[We,wn]];return We=wn=-(Nn=De=1/0),a}};function Js(a,u){a<De&&(De=a),a>We&&(We=a),u<Nn&&(Nn=u),u>wn&&(wn=u)}ve();function $i(a,u,l,h){return function(o,y){var d=u(y),g=o.invert(h[0],h[1]),N=Hi(),x=u(N),w=!1,I,F,B,G={point:et,lineStart:ut,lineEnd:q,polygonStart:function(){G.point=H,G.lineStart=it,G.lineEnd=W,F=[],I=[]},polygonEnd:function(){G.point=et,G.lineStart=ut,G.lineEnd=q,F=Ji(F);var J=Ks(I,g);F.length?(w||(y.polygonStart(),w=!0),Zi(F,Qs,J,l,y)):J&&(w||(y.polygonStart(),w=!0),y.lineStart(),l(null,null,1,y),y.lineEnd()),w&&(y.polygonEnd(),w=!1),F=I=null},sphere:function(){y.polygonStart(),y.lineStart(),l(null,null,1,y),y.lineEnd(),y.polygonEnd()}};function et(J,$){var v=o(J,$);a(J=v[0],$=v[1])&&y.point(J,$)}function K(J,$){var v=o(J,$);d.point(v[0],v[1])}function ut(){G.point=K,d.lineStart()}function q(){G.point=et,d.lineEnd()}function H(J,$){B.push([J,$]);var v=o(J,$);x.point(v[0],v[1])}function it(){x.lineStart(),B=[]}function W(){H(B[0][0],B[0][1]),x.lineEnd();var J=x.clean(),$=N.result(),v,p=$.length,E,M,L;if(B.pop(),I.push(B),B=null,!!p){if(J&1){if(M=$[0],(E=M.length-1)>0){for(w||(y.polygonStart(),w=!0),y.lineStart(),v=0;v<E;++v)y.point((L=M[v])[0],L[1]);y.lineEnd()}return}p>1&&J&2&&$.push($.pop().concat($.shift())),F.push($.filter(js))}}return G}}function js(a){return a.length>1}function Qs(a,u){return((a=a.x)[0]<0?a[1]-ie-Nt:ie-a[1])-((u=u.x)[0]<0?u[1]-ie-Nt:ie-u[1])}var tr=$i(function(){return!0},$s,ea,[-pt,-ie]);function $s(a){var u=NaN,l=NaN,h=NaN,o;return{lineStart:function(){a.lineStart(),o=1},point:function(y,d){var g=y>0?pt:-pt,N=Pt(y-u);Pt(N-pt)<Nt?(a.point(u,l=(l+d)/2>0?ie:-ie),a.point(h,l),a.lineEnd(),a.lineStart(),a.point(g,l),a.point(y,l),o=0):h!==g&&N>=pt&&(Pt(u-h)<Nt&&(u-=h*Nt),Pt(y-g)<Nt&&(y-=g*Nt),l=ta(u,l,y,d),a.point(h,l),a.lineEnd(),a.lineStart(),a.point(g,l),o=0),a.point(u=y,l=d),h=g},lineEnd:function(){a.lineEnd(),u=l=NaN},clean:function(){return 2-o}}}function ta(a,u,l,h){var o,y,d=Tt(a-l);return Pt(d)>Nt?Ys((Tt(u)*(y=St(h))*Tt(l)-Tt(h)*(o=St(u))*Tt(a))/(o*y*d)):(u+h)/2}function ea(a,u,l,h){var o;if(a==null)o=l*ie,h.point(-pt,o),h.point(0,o),h.point(pt,o),h.point(pt,0),h.point(pt,-o),h.point(0,-o),h.point(-pt,-o),h.point(-pt,0),h.point(-pt,o);else if(Pt(a[0]-u[0])>Nt){var y=a[0]<u[0]?pt:-pt;o=l*y/2,h.point(-y,o),h.point(0,o),h.point(y,o)}else h.point(u[0],u[1])}function na(a,u){var l=St(a),h=l>0,o=Pt(l)>Nt;function y(w,I,F,B){Xs(B,a,u,F,w,I)}function d(w,I){return St(w)*St(I)>l}function g(w){var I,F,B,G,et;return{lineStart:function(){G=B=!1,et=1},point:function(K,ut){var q=[K,ut],H,it=d(K,ut),W=h?it?0:x(K,ut):it?x(K+(K<0?pt:-pt),ut):0;if(!I&&(G=B=it)&&w.lineStart(),it!==B&&(H=N(I,q),(!H||kn(I,H)||kn(q,H))&&(q[0]+=Nt,q[1]+=Nt,it=d(q[0],q[1]))),it!==B)et=0,it?(w.lineStart(),H=N(q,I),w.point(H[0],H[1])):(H=N(I,q),w.point(H[0],H[1]),w.lineEnd()),I=H;else if(o&&I&&h^it){var J;!(W&F)&&(J=N(q,I,!0))&&(et=0,h?(w.lineStart(),w.point(J[0][0],J[0][1]),w.point(J[1][0],J[1][1]),w.lineEnd()):(w.point(J[1][0],J[1][1]),w.lineEnd(),w.lineStart(),w.point(J[0][0],J[0][1])))}it&&(!I||!kn(I,q))&&w.point(q[0],q[1]),I=q,B=it,F=W},lineEnd:function(){B&&w.lineEnd(),I=null},clean:function(){return et|(G&&B)<<1}}}function N(w,I,F){var B=Ae(w),G=Ae(I),et=[1,0,0],K=_n(B,G),ut=pn(K,K),q=K[0],H=ut-q*q;if(!H)return!F&&w;var it=l*ut/H,W=-l*q/H,J=_n(et,K),$=xn(et,it),v=xn(K,W);Jn($,v);var p=J,E=pn($,p),M=pn(p,p),L=E*E-M*(pn($,$)-1);if(!(L<0)){var O=Pe(L),T=xn(p,(-E-O)/M);if(Jn(T,$),T=Kn(T),!F)return T;var S=w[0],R=I[0],P=w[1],b=I[1],Y;R<S&&(Y=S,S=R,R=Y);var z=R-S,j=Pt(z-pt)<Nt,at=j||z<Nt;if(!j&&b<P&&(Y=P,P=b,b=Y),at?j?P+b>0^T[1]<(Pt(T[0]-S)<Nt?P:b):P<=T[1]&&T[1]<=b:z>pt^(S<=T[0]&&T[0]<=R)){var yt=xn(p,(-E+O)/M);return Jn(yt,$),[T,Kn(yt)]}}}function x(w,I){var F=h?a:pt-a,B=0;return w<-F?B|=1:w>F&&(B|=2),I<-F?B|=4:I>F&&(B|=8),B}return $i(d,g,y,h?[0,-a]:[-pt,a-pt])}function er(a){return function(u){var l=new ti;for(var h in a)l[h]=a[h];return l.stream=u,l}}function ti(){}ti.prototype={constructor:ti,point:function(a,u){this.stream.point(a,u)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function nr(a,u,l){var h=u[1][0]-u[0][0],o=u[1][1]-u[0][1],y=a.clipExtent&&a.clipExtent();a.scale(150).translate([0,0]),y!=null&&a.clipExtent(null),zs(l,a.stream(Qi));var d=Qi.result(),g=Math.min(h/(d[1][0]-d[0][0]),o/(d[1][1]-d[0][1])),N=+u[0][0]+(h-g*(d[1][0]+d[0][0]))/2,x=+u[0][1]+(o-g*(d[1][1]+d[0][1]))/2;return y!=null&&a.clipExtent(y),a.scale(g*150).translate([N,x])}function ia(a,u,l){return nr(a,[[0,0],u],l)}var ir=16,ra=St(30*Ut);function rr(a,u){return+u?aa(a,u):sa(a)}function sa(a){return er({point:function(u,l){u=a(u,l),this.stream.point(u[0],u[1])}})}function aa(a,u){function l(h,o,y,d,g,N,x,w,I,F,B,G,et,K){var ut=x-h,q=w-o,H=ut*ut+q*q;if(H>4*u&&et--){var it=d+F,W=g+B,J=N+G,$=Pe(it*it+W*W+J*J),v=ke(J/=$),p=Pt(Pt(J)-1)<Nt||Pt(y-I)<Nt?(y+I)/2:be(W,it),E=a(p,v),M=E[0],L=E[1],O=M-h,T=L-o,S=q*O-ut*T;(S*S/H>u||Pt((ut*O+q*T)/H-.5)>.3||d*F+g*B+N*G<ra)&&(l(h,o,y,d,g,N,M,L,p,it/=$,W/=$,J,et,K),K.point(M,L),l(M,L,p,it,W,J,x,w,I,F,B,G,et,K))}}return function(h){var o,y,d,g,N,x,w,I,F,B,G,et,K={point:ut,lineStart:q,lineEnd:it,polygonStart:function(){h.polygonStart(),K.lineStart=W},polygonEnd:function(){h.polygonEnd(),K.lineStart=q}};function ut(v,p){v=a(v,p),h.point(v[0],v[1])}function q(){I=NaN,K.point=H,h.lineStart()}function H(v,p){var E=Ae([v,p]),M=a(v,p);l(I,F,w,B,G,et,I=M[0],F=M[1],w=v,B=E[0],G=E[1],et=E[2],ir,h),h.point(I,F)}function it(){K.point=ut,h.lineEnd()}function W(){q(),K.point=J,K.lineEnd=$}function J(v,p){H(o=v,p),y=I,d=F,g=B,N=G,x=et,K.point=H}function $(){l(I,F,w,B,G,et,y,d,o,g,N,x,ir,h),K.lineEnd=it,it()}return K}}var ua=er({point:function(a,u){this.stream.point(a*Ut,u*Ut)}});function oa(a){return la(function(){return a})()}function la(a){var u,l=150,h=480,o=250,y,d,g=0,N=0,x=0,w=0,I=0,F,B,G=null,et=tr,K=null,ut,q,H,it=ji,W=.5,J=rr(M,W),$,v;function p(T){return T=B(T[0]*Ut,T[1]*Ut),[T[0]*l+y,d-T[1]*l]}function E(T){return T=B.invert((T[0]-y)/l,(d-T[1])/l),T&&[T[0]*de,T[1]*de]}function M(T,S){return T=u(T,S),[T[0]*l+y,d-T[1]*l]}p.stream=function(T){return $&&v===T?$:$=ua(et(F,J(it(v=T))))},p.clipAngle=function(T){return arguments.length?(et=+T?na(G=T*Ut,6*Ut):(G=null,tr),O()):G*de},p.clipExtent=function(T){return arguments.length?(it=T==null?(K=ut=q=H=null,ji):Ws(K=+T[0][0],ut=+T[0][1],q=+T[1][0],H=+T[1][1]),O()):K==null?null:[[K,ut],[q,H]]},p.scale=function(T){return arguments.length?(l=+T,L()):l},p.translate=function(T){return arguments.length?(h=+T[0],o=+T[1],L()):[h,o]},p.center=function(T){return arguments.length?(g=T[0]%360*Ut,N=T[1]%360*Ut,L()):[g*de,N*de]},p.rotate=function(T){return arguments.length?(x=T[0]%360*Ut,w=T[1]%360*Ut,I=T.length>2?T[2]%360*Ut:0,L()):[x*de,w*de,I*de]},p.precision=function(T){return arguments.length?(J=rr(M,W=T*T),O()):Pe(W)},p.fitExtent=function(T,S){return nr(p,T,S)},p.fitSize=function(T,S){return ia(p,T,S)};function L(){B=Yi(F=Us(x,w,I),u);var T=u(g,N);return y=h-T[0]*l,d=o+T[1]*l,O()}function O(){return $=v=null,p}return function(){return u=a.apply(this,arguments),p.invert=u.invert&&E,L()}}function sr(a){return function(u,l){var h=St(u),o=St(l),y=a(h*o);return[y*o*Tt(u),y*Tt(l)]}}function ar(a){return function(u,l){var h=Pe(u*u+l*l),o=a(h),y=Tt(o),d=St(o);return[be(u*y,h*d),ke(h&&l*y/h)]}}var ha=sr(function(a){return Pe(2/(1+a))});ha.invert=ar(function(a){return 2*ke(a/2)});var ur=sr(function(a){return(a=Fi(a))&&a/Tt(a)});ur.invert=ar(function(a){return a});function ca(){return oa(ur).scale(79.4188).clipAngle(180-.001)}function or(a,u){return[a,u]}or.invert=or;var{BufferOp:fa,GeoJSONReader:ga,GeoJSONWriter:ya}=Bs;function lr(a,u,l){l=l||{};var h=l.units||"kilometers",o=l.steps||8;if(!a)throw new Error("geojson is required");if(typeof l!="object")throw new Error("options must be an object");if(typeof o!="number")throw new Error("steps must be an number");if(u===void 0)throw new Error("radius is required");if(o<=0)throw new Error("steps must be greater than 0");var y=[];switch(a.type){case"GeometryCollection":return xe(a,function(d){var g=Sn(d,u,h,o);g&&y.push(g)}),Xe(y);case"FeatureCollection":return bi(a,function(d){var g=Sn(d,u,h,o);g&&bi(g,function(N){N&&y.push(N)})}),Xe(y)}return Sn(a,u,h,o)}function Sn(a,u,l,h){var o=a.properties||{},y=a.type==="Feature"?a.geometry:a;if(y.type==="GeometryCollection"){var d=[];return xe(a,function(et){var K=Sn(et,u,l,h);K&&d.push(K)}),Xe(d)}var g=ma(y),N={type:y.type,coordinates:cr(y.coordinates,g)},x=new ga,w=x.read(N),I=Os(Ms(u,l),"meters"),F=fa.bufferOp(w,I,h),B=new ya;if(F=B.write(F),!hr(F.coordinates)){var G={type:F.type,coordinates:fr(F.coordinates,g)};return Qt(G,o)}}function hr(a){return Array.isArray(a[0])?hr(a[0]):isNaN(a[0])}function cr(a,u){return typeof a[0]!="object"?u(a):a.map(function(l){return cr(l,u)})}function fr(a,u){return typeof a[0]!="object"?u.invert(a):a.map(function(l){return fr(l,u)})}function ma(a){var u=As(a).geometry.coordinates,l=[-u[0],-u[1]];return ca().rotate(l).scale(Ct)}var va=/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i,ei=Math.ceil,Xt=Math.floor,qt="[BigNumber Error] ",gr=qt+"Number primitive has more than 15 significant digits: ",$t=1e14,ct=14,ni=9007199254740991,ii=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],pe=1e7,At=1e9;function yr(a){var u,l,h,o=q.prototype={constructor:q,toString:null,valueOf:null},y=new q(1),d=20,g=4,N=-7,x=21,w=-1e7,I=1e7,F=!1,B=1,G=0,et={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",ut=!0;function q(v,p){var E,M,L,O,T,S,R,P,b=this;if(!(b instanceof q))return new q(v,p);if(p==null){if(v&&v._isBigNumber===!0){b.s=v.s,!v.c||v.e>I?b.c=b.e=null:v.e<w?b.c=[b.e=0]:(b.e=v.e,b.c=v.c.slice());return}if((S=typeof v=="number")&&v*0==0){if(b.s=1/v<0?(v=-v,-1):1,v===~~v){for(O=0,T=v;T>=10;T/=10,O++);O>I?b.c=b.e=null:(b.e=O,b.c=[v]);return}P=String(v)}else{if(!va.test(P=String(v)))return h(b,P,S);b.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(O=P.indexOf("."))>-1&&(P=P.replace(".","")),(T=P.search(/e/i))>0?(O<0&&(O=T),O+=+P.slice(T+1),P=P.substring(0,T)):O<0&&(O=P.length)}else{if(Lt(p,2,K.length,"Base"),p==10&&ut)return b=new q(v),J(b,d+b.e+1,g);if(P=String(v),S=typeof v=="number"){if(v*0!=0)return h(b,P,S,p);if(b.s=1/v<0?(P=P.slice(1),-1):1,q.DEBUG&&P.replace(/^0\\.0*|\\./,"").length>15)throw Error(gr+v)}else b.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(E=K.slice(0,p),O=T=0,R=P.length;T<R;T++)if(E.indexOf(M=P.charAt(T))<0){if(M=="."){if(T>O){O=R;continue}}else if(!L&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){L=!0,T=-1,O=0;continue}return h(b,String(v),S,p)}S=!1,P=l(P,p,10,b.s),(O=P.indexOf("."))>-1?P=P.replace(".",""):O=P.length}for(T=0;P.charCodeAt(T)===48;T++);for(R=P.length;P.charCodeAt(--R)===48;);if(P=P.slice(T,++R)){if(R-=T,S&&q.DEBUG&&R>15&&(v>ni||v!==Xt(v)))throw Error(gr+b.s*v);if((O=O-T-1)>I)b.c=b.e=null;else if(O<w)b.c=[b.e=0];else{if(b.e=O,b.c=[],T=(O+1)%ct,O<0&&(T+=ct),T<R){for(T&&b.c.push(+P.slice(0,T)),R-=ct;T<R;)b.c.push(+P.slice(T,T+=ct));T=ct-(P=P.slice(T)).length}else T-=R;for(;T--;P+="0");b.c.push(+P)}}else b.c=[b.e=0]}q.clone=yr,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=function(v){var p,E;if(v!=null)if(typeof v=="object"){if(v.hasOwnProperty(p="DECIMAL_PLACES")&&(E=v[p],Lt(E,0,At,p),d=E),v.hasOwnProperty(p="ROUNDING_MODE")&&(E=v[p],Lt(E,0,8,p),g=E),v.hasOwnProperty(p="EXPONENTIAL_AT")&&(E=v[p],E&&E.pop?(Lt(E[0],-At,0,p),Lt(E[1],0,At,p),N=E[0],x=E[1]):(Lt(E,-At,At,p),N=-(x=E<0?-E:E))),v.hasOwnProperty(p="RANGE"))if(E=v[p],E&&E.pop)Lt(E[0],-At,-1,p),Lt(E[1],1,At,p),w=E[0],I=E[1];else if(Lt(E,-At,At,p),E)w=-(I=E<0?-E:E);else throw Error(qt+p+" cannot be zero: "+E);if(v.hasOwnProperty(p="CRYPTO"))if(E=v[p],E===!!E)if(E)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))F=E;else throw F=!E,Error(qt+"crypto unavailable");else F=E;else throw Error(qt+p+" not true or false: "+E);if(v.hasOwnProperty(p="MODULO_MODE")&&(E=v[p],Lt(E,0,9,p),B=E),v.hasOwnProperty(p="POW_PRECISION")&&(E=v[p],Lt(E,0,At,p),G=E),v.hasOwnProperty(p="FORMAT"))if(E=v[p],typeof E=="object")et=E;else throw Error(qt+p+" not an object: "+E);if(v.hasOwnProperty(p="ALPHABET"))if(E=v[p],typeof E=="string"&&!/^.?$|[+\\-.\\s]|(.).*\\1/.test(E))ut=E.slice(0,10)=="0123456789",K=E;else throw Error(qt+p+" invalid: "+E)}else throw Error(qt+"Object expected: "+v);return{DECIMAL_PLACES:d,ROUNDING_MODE:g,EXPONENTIAL_AT:[N,x],RANGE:[w,I],CRYPTO:F,MODULO_MODE:B,POW_PRECISION:G,FORMAT:et,ALPHABET:K}},q.isBigNumber=function(v){if(!v||v._isBigNumber!==!0)return!1;if(!q.DEBUG)return!0;var p,E,M=v.c,L=v.e,O=v.s;t:if({}.toString.call(M)=="[object Array]"){if((O===1||O===-1)&&L>=-At&&L<=At&&L===Xt(L)){if(M[0]===0){if(L===0&&M.length===1)return!0;break t}if(p=(L+1)%ct,p<1&&(p+=ct),String(M[0]).length==p){for(p=0;p<M.length;p++)if(E=M[p],E<0||E>=$t||E!==Xt(E))break t;if(E!==0)return!0}}}else if(M===null&&L===null&&(O===null||O===1||O===-1))return!0;throw Error(qt+"Invalid BigNumber: "+v)},q.maximum=q.max=function(){return it(arguments,-1)},q.minimum=q.min=function(){return it(arguments,1)},q.random=(function(){var v=9007199254740992,p=Math.random()*v&2097151?function(){return Xt(Math.random()*v)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var M,L,O,T,S,R=0,P=[],b=new q(y);if(E==null?E=d:Lt(E,0,At),T=ei(E/ct),F)if(crypto.getRandomValues){for(M=crypto.getRandomValues(new Uint32Array(T*=2));R<T;)S=M[R]*131072+(M[R+1]>>>11),S>=9e15?(L=crypto.getRandomValues(new Uint32Array(2)),M[R]=L[0],M[R+1]=L[1]):(P.push(S%1e14),R+=2);R=T/2}else if(crypto.randomBytes){for(M=crypto.randomBytes(T*=7);R<T;)S=(M[R]&31)*281474976710656+M[R+1]*1099511627776+M[R+2]*4294967296+M[R+3]*16777216+(M[R+4]<<16)+(M[R+5]<<8)+M[R+6],S>=9e15?crypto.randomBytes(7).copy(M,R):(P.push(S%1e14),R+=7);R=T/7}else throw F=!1,Error(qt+"crypto unavailable");if(!F)for(;R<T;)S=p(),S<9e15&&(P[R++]=S%1e14);for(T=P[--R],E%=ct,T&&E&&(S=ii[ct-E],P[R]=Xt(T/S)*S);P[R]===0;P.pop(),R--);if(R<0)P=[O=0];else{for(O=-1;P[0]===0;P.splice(0,1),O-=ct);for(R=1,S=P[0];S>=10;S/=10,R++);R<ct&&(O-=ct-R)}return b.e=O,b.c=P,b}})(),q.sum=function(){for(var v=1,p=arguments,E=new q(p[0]);v<p.length;)E=E.plus(p[v++]);return E},l=(function(){var v="0123456789";function p(E,M,L,O){for(var T,S=[0],R,P=0,b=E.length;P<b;){for(R=S.length;R--;S[R]*=M);for(S[0]+=O.indexOf(E.charAt(P++)),T=0;T<S.length;T++)S[T]>L-1&&(S[T+1]==null&&(S[T+1]=0),S[T+1]+=S[T]/L|0,S[T]%=L)}return S.reverse()}return function(E,M,L,O,T){var S,R,P,b,Y,z,j,at,yt=E.indexOf("."),nt=d,ft=g;for(yt>=0&&(b=G,G=0,E=E.replace(".",""),at=new q(M),z=at.pow(E.length-yt),G=b,at.c=p(ce(Ht(z.c),z.e,"0"),10,L,v),at.e=at.c.length),j=p(E,M,L,T?(S=K,v):(S=v,K)),P=b=j.length;j[--b]==0;j.pop());if(!j[0])return S.charAt(0);if(yt<0?--P:(z.c=j,z.e=P,z.s=O,z=u(z,at,nt,ft,L),j=z.c,Y=z.r,P=z.e),R=P+nt+1,yt=j[R],b=L/2,Y=Y||R<0||j[R+1]!=null,Y=ft<4?(yt!=null||Y)&&(ft==0||ft==(z.s<0?3:2)):yt>b||yt==b&&(ft==4||Y||ft==6&&j[R-1]&1||ft==(z.s<0?8:7)),R<1||!j[0])E=Y?ce(S.charAt(1),-nt,S.charAt(0)):S.charAt(0);else{if(j.length=R,Y)for(--L;++j[--R]>L;)j[R]=0,R||(++P,j=[1].concat(j));for(b=j.length;!j[--b];);for(yt=0,E="";yt<=b;E+=S.charAt(j[yt++]));E=ce(E,P,S.charAt(0))}return E}})(),u=(function(){function v(M,L,O){var T,S,R,P,b=0,Y=M.length,z=L%pe,j=L/pe|0;for(M=M.slice();Y--;)R=M[Y]%pe,P=M[Y]/pe|0,T=j*R+P*z,S=z*R+T%pe*pe+b,b=(S/O|0)+(T/pe|0)+j*P,M[Y]=S%O;return b&&(M=[b].concat(M)),M}function p(M,L,O,T){var S,R;if(O!=T)R=O>T?1:-1;else for(S=R=0;S<O;S++)if(M[S]!=L[S]){R=M[S]>L[S]?1:-1;break}return R}function E(M,L,O,T){for(var S=0;O--;)M[O]-=S,S=M[O]<L[O]?1:0,M[O]=S*T+M[O]-L[O];for(;!M[0]&&M.length>1;M.splice(0,1));}return function(M,L,O,T,S){var R,P,b,Y,z,j,at,yt,nt,ft,kt,Mt,A,tn,Et,Q,k,Rt=M.s==L.s?1:-1,Ot=M.c,_t=L.c;if(!Ot||!Ot[0]||!_t||!_t[0])return new q(!M.s||!L.s||(Ot?_t&&Ot[0]==_t[0]:!_t)?NaN:Ot&&Ot[0]==0||!_t?Rt*0:Rt/0);for(yt=new q(Rt),nt=yt.c=[],P=M.e-L.e,Rt=O+P+1,S||(S=$t,P=Vt(M.e/ct)-Vt(L.e/ct),Rt=Rt/ct|0),b=0;_t[b]==(Ot[b]||0);b++);if(_t[b]>(Ot[b]||0)&&P--,Rt<0)nt.push(1),Y=!0;else{for(tn=Ot.length,Q=_t.length,b=0,Rt+=2,z=Xt(S/(_t[0]+1)),z>1&&(_t=v(_t,z,S),Ot=v(Ot,z,S),Q=_t.length,tn=Ot.length),A=Q,ft=Ot.slice(0,Q),kt=ft.length;kt<Q;ft[kt++]=0);k=_t.slice(),k=[0].concat(k),Et=_t[0],_t[1]>=S/2&&Et++;do{if(z=0,R=p(_t,ft,Q,kt),R<0){if(Mt=ft[0],Q!=kt&&(Mt=Mt*S+(ft[1]||0)),z=Xt(Mt/Et),z>1)for(z>=S&&(z=S-1),j=v(_t,z,S),at=j.length,kt=ft.length;p(j,ft,at,kt)==1;)z--,E(j,Q<at?k:_t,at,S),at=j.length,R=1;else z==0&&(R=z=1),j=_t.slice(),at=j.length;if(at<kt&&(j=[0].concat(j)),E(ft,j,kt,S),kt=ft.length,R==-1)for(;p(_t,ft,Q,kt)<1;)z++,E(ft,Q<kt?k:_t,kt,S),kt=ft.length}else R===0&&(z++,ft=[0]);nt[b++]=z,ft[0]?ft[kt++]=Ot[A]||0:(ft=[Ot[A]],kt=1)}while((A++<tn||ft[0]!=null)&&Rt--);Y=ft[0]!=null,nt[0]||nt.splice(0,1)}if(S==$t){for(b=1,Rt=nt[0];Rt>=10;Rt/=10,b++);J(yt,O+(yt.e=b+P*ct-1)+1,T,Y)}else yt.e=P,yt.r=+Y;return yt}})();function H(v,p,E,M){var L,O,T,S,R;if(E==null?E=g:Lt(E,0,8),!v.c)return v.toString();if(L=v.c[0],T=v.e,p==null)R=Ht(v.c),R=M==1||M==2&&(T<=N||T>=x)?Ln(R,T):ce(R,T,"0");else if(v=J(new q(v),p,E),O=v.e,R=Ht(v.c),S=R.length,M==1||M==2&&(p<=O||O<=N)){for(;S<p;R+="0",S++);R=Ln(R,O)}else if(p-=T+(M===2&&O>T),R=ce(R,O,"0"),O+1>S){if(--p>0)for(R+=".";p--;R+="0");}else if(p+=O-S,p>0)for(O+1==S&&(R+=".");p--;R+="0");return v.s<0&&L?"-"+R:R}function it(v,p){for(var E,M,L=1,O=new q(v[0]);L<v.length;L++)M=new q(v[L]),(!M.s||(E=Ee(O,M))===p||E===0&&O.s===p)&&(O=M);return O}function W(v,p,E){for(var M=1,L=p.length;!p[--L];p.pop());for(L=p[0];L>=10;L/=10,M++);return(E=M+E*ct-1)>I?v.c=v.e=null:E<w?v.c=[v.e=0]:(v.e=E,v.c=p),v}h=(function(){var v=/^(-?)0([xbo])(?=\\w[\\w.]*$)/i,p=/^([^.]+)\\.$/,E=/^\\.([^.]+)$/,M=/^-?(Infinity|NaN)$/,L=/^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;return function(O,T,S,R){var P,b=S?T:T.replace(L,"");if(M.test(b))O.s=isNaN(b)?null:b<0?-1:1;else{if(!S&&(b=b.replace(v,function(Y,z,j){return P=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!R||R==P?z:Y}),R&&(P=R,b=b.replace(p,"$1").replace(E,"0.$1")),T!=b))return new q(b,P);if(q.DEBUG)throw Error(qt+"Not a"+(R?" base "+R:"")+" number: "+T);O.s=null}O.c=O.e=null}})();function J(v,p,E,M){var L,O,T,S,R,P,b,Y=v.c,z=ii;if(Y){t:{for(L=1,S=Y[0];S>=10;S/=10,L++);if(O=p-L,O<0)O+=ct,T=p,R=Y[P=0],b=Xt(R/z[L-T-1]%10);else if(P=ei((O+1)/ct),P>=Y.length)if(M){for(;Y.length<=P;Y.push(0));R=b=0,L=1,O%=ct,T=O-ct+1}else break t;else{for(R=S=Y[P],L=1;S>=10;S/=10,L++);O%=ct,T=O-ct+L,b=T<0?0:Xt(R/z[L-T-1]%10)}if(M=M||p<0||Y[P+1]!=null||(T<0?R:R%z[L-T-1]),M=E<4?(b||M)&&(E==0||E==(v.s<0?3:2)):b>5||b==5&&(E==4||M||E==6&&(O>0?T>0?R/z[L-T]:0:Y[P-1])%10&1||E==(v.s<0?8:7)),p<1||!Y[0])return Y.length=0,M?(p-=v.e+1,Y[0]=z[(ct-p%ct)%ct],v.e=-p||0):Y[0]=v.e=0,v;if(O==0?(Y.length=P,S=1,P--):(Y.length=P+1,S=z[ct-O],Y[P]=T>0?Xt(R/z[L-T]%z[T])*S:0),M)for(;;)if(P==0){for(O=1,T=Y[0];T>=10;T/=10,O++);for(T=Y[0]+=S,S=1;T>=10;T/=10,S++);O!=S&&(v.e++,Y[0]==$t&&(Y[0]=1));break}else{if(Y[P]+=S,Y[P]!=$t)break;Y[P--]=0,S=1}for(O=Y.length;Y[--O]===0;Y.pop());}v.e>I?v.c=v.e=null:v.e<w&&(v.c=[v.e=0])}return v}function $(v){var p,E=v.e;return E===null?v.toString():(p=Ht(v.c),p=E<=N||E>=x?Ln(p,E):ce(p,E,"0"),v.s<0?"-"+p:p)}return o.absoluteValue=o.abs=function(){var v=new q(this);return v.s<0&&(v.s=1),v},o.comparedTo=function(v,p){return Ee(this,new q(v,p))},o.decimalPlaces=o.dp=function(v,p){var E,M,L,O=this;if(v!=null)return Lt(v,0,At),p==null?p=g:Lt(p,0,8),J(new q(O),v+O.e+1,p);if(!(E=O.c))return null;if(M=((L=E.length-1)-Vt(this.e/ct))*ct,L=E[L])for(;L%10==0;L/=10,M--);return M<0&&(M=0),M},o.dividedBy=o.div=function(v,p){return u(this,new q(v,p),d,g)},o.dividedToIntegerBy=o.idiv=function(v,p){return u(this,new q(v,p),0,1)},o.exponentiatedBy=o.pow=function(v,p){var E,M,L,O,T,S,R,P,b,Y=this;if(v=new q(v),v.c&&!v.isInteger())throw Error(qt+"Exponent not an integer: "+$(v));if(p!=null&&(p=new q(p)),S=v.e>14,!Y.c||!Y.c[0]||Y.c[0]==1&&!Y.e&&Y.c.length==1||!v.c||!v.c[0])return b=new q(Math.pow(+$(Y),S?v.s*(2-Tn(v)):+$(v))),p?b.mod(p):b;if(R=v.s<0,p){if(p.c?!p.c[0]:!p.s)return new q(NaN);M=!R&&Y.isInteger()&&p.isInteger(),M&&(Y=Y.mod(p))}else{if(v.e>9&&(Y.e>0||Y.e<-1||(Y.e==0?Y.c[0]>1||S&&Y.c[1]>=24e7:Y.c[0]<8e13||S&&Y.c[0]<=9999975e7)))return O=Y.s<0&&Tn(v)?-0:0,Y.e>-1&&(O=1/O),new q(R?1/O:O);G&&(O=ei(G/ct+2))}for(S?(E=new q(.5),R&&(v.s=1),P=Tn(v)):(L=Math.abs(+$(v)),P=L%2),b=new q(y);;){if(P){if(b=b.times(Y),!b.c)break;O?b.c.length>O&&(b.c.length=O):M&&(b=b.mod(p))}if(L){if(L=Xt(L/2),L===0)break;P=L%2}else if(v=v.times(E),J(v,v.e+1,1),v.e>14)P=Tn(v);else{if(L=+$(v),L===0)break;P=L%2}Y=Y.times(Y),O?Y.c&&Y.c.length>O&&(Y.c.length=O):M&&(Y=Y.mod(p))}return M?b:(R&&(b=y.div(b)),p?b.mod(p):O?J(b,G,g,T):b)},o.integerValue=function(v){var p=new q(this);return v==null?v=g:Lt(v,0,8),J(p,p.e+1,v)},o.isEqualTo=o.eq=function(v,p){return Ee(this,new q(v,p))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(v,p){return Ee(this,new q(v,p))>0},o.isGreaterThanOrEqualTo=o.gte=function(v,p){return(p=Ee(this,new q(v,p)))===1||p===0},o.isInteger=function(){return!!this.c&&Vt(this.e/ct)>this.c.length-2},o.isLessThan=o.lt=function(v,p){return Ee(this,new q(v,p))<0},o.isLessThanOrEqualTo=o.lte=function(v,p){return(p=Ee(this,new q(v,p)))===-1||p===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(v,p){var E,M,L,O,T=this,S=T.s;if(v=new q(v,p),p=v.s,!S||!p)return new q(NaN);if(S!=p)return v.s=-p,T.plus(v);var R=T.e/ct,P=v.e/ct,b=T.c,Y=v.c;if(!R||!P){if(!b||!Y)return b?(v.s=-p,v):new q(Y?T:NaN);if(!b[0]||!Y[0])return Y[0]?(v.s=-p,v):new q(b[0]?T:g==3?-0:0)}if(R=Vt(R),P=Vt(P),b=b.slice(),S=R-P){for((O=S<0)?(S=-S,L=b):(P=R,L=Y),L.reverse(),p=S;p--;L.push(0));L.reverse()}else for(M=(O=(S=b.length)<(p=Y.length))?S:p,S=p=0;p<M;p++)if(b[p]!=Y[p]){O=b[p]<Y[p];break}if(O&&(L=b,b=Y,Y=L,v.s=-v.s),p=(M=Y.length)-(E=b.length),p>0)for(;p--;b[E++]=0);for(p=$t-1;M>S;){if(b[--M]<Y[M]){for(E=M;E&&!b[--E];b[E]=p);--b[E],b[M]+=$t}b[M]-=Y[M]}for(;b[0]==0;b.splice(0,1),--P);return b[0]?W(v,b,P):(v.s=g==3?-1:1,v.c=[v.e=0],v)},o.modulo=o.mod=function(v,p){var E,M,L=this;return v=new q(v,p),!L.c||!v.s||v.c&&!v.c[0]?new q(NaN):!v.c||L.c&&!L.c[0]?new q(L):(B==9?(M=v.s,v.s=1,E=u(L,v,0,3),v.s=M,E.s*=M):E=u(L,v,0,B),v=L.minus(E.times(v)),!v.c[0]&&B==1&&(v.s=L.s),v)},o.multipliedBy=o.times=function(v,p){var E,M,L,O,T,S,R,P,b,Y,z,j,at,yt,nt,ft=this,kt=ft.c,Mt=(v=new q(v,p)).c;if(!kt||!Mt||!kt[0]||!Mt[0])return!ft.s||!v.s||kt&&!kt[0]&&!Mt||Mt&&!Mt[0]&&!kt?v.c=v.e=v.s=null:(v.s*=ft.s,!kt||!Mt?v.c=v.e=null:(v.c=[0],v.e=0)),v;for(M=Vt(ft.e/ct)+Vt(v.e/ct),v.s*=ft.s,R=kt.length,Y=Mt.length,R<Y&&(at=kt,kt=Mt,Mt=at,L=R,R=Y,Y=L),L=R+Y,at=[];L--;at.push(0));for(yt=$t,nt=pe,L=Y;--L>=0;){for(E=0,z=Mt[L]%nt,j=Mt[L]/nt|0,T=R,O=L+T;O>L;)P=kt[--T]%nt,b=kt[T]/nt|0,S=j*P+b*z,P=z*P+S%nt*nt+at[O]+E,E=(P/yt|0)+(S/nt|0)+j*b,at[O--]=P%yt;at[O]=E}return E?++M:at.splice(0,1),W(v,at,M)},o.negated=function(){var v=new q(this);return v.s=-v.s||null,v},o.plus=function(v,p){var E,M=this,L=M.s;if(v=new q(v,p),p=v.s,!L||!p)return new q(NaN);if(L!=p)return v.s=-p,M.minus(v);var O=M.e/ct,T=v.e/ct,S=M.c,R=v.c;if(!O||!T){if(!S||!R)return new q(L/0);if(!S[0]||!R[0])return R[0]?v:new q(S[0]?M:L*0)}if(O=Vt(O),T=Vt(T),S=S.slice(),L=O-T){for(L>0?(T=O,E=R):(L=-L,E=S),E.reverse();L--;E.push(0));E.reverse()}for(L=S.length,p=R.length,L-p<0&&(E=R,R=S,S=E,p=L),L=0;p;)L=(S[--p]=S[p]+R[p]+L)/$t|0,S[p]=$t===S[p]?0:S[p]%$t;return L&&(S=[L].concat(S),++T),W(v,S,T)},o.precision=o.sd=function(v,p){var E,M,L,O=this;if(v!=null&&v!==!!v)return Lt(v,1,At),p==null?p=g:Lt(p,0,8),J(new q(O),v,p);if(!(E=O.c))return null;if(L=E.length-1,M=L*ct+1,L=E[L]){for(;L%10==0;L/=10,M--);for(L=E[0];L>=10;L/=10,M++);}return v&&O.e+1>M&&(M=O.e+1),M},o.shiftedBy=function(v){return Lt(v,-ni,ni),this.times("1e"+v)},o.squareRoot=o.sqrt=function(){var v,p,E,M,L,O=this,T=O.c,S=O.s,R=O.e,P=d+4,b=new q("0.5");if(S!==1||!T||!T[0])return new q(!S||S<0&&(!T||T[0])?NaN:T?O:1/0);if(S=Math.sqrt(+$(O)),S==0||S==1/0?(p=Ht(T),(p.length+R)%2==0&&(p+="0"),S=Math.sqrt(+p),R=Vt((R+1)/2)-(R<0||R%2),S==1/0?p="5e"+R:(p=S.toExponential(),p=p.slice(0,p.indexOf("e")+1)+R),E=new q(p)):E=new q(S+""),E.c[0]){for(R=E.e,S=R+P,S<3&&(S=0);;)if(L=E,E=b.times(L.plus(u(O,L,P,1))),Ht(L.c).slice(0,S)===(p=Ht(E.c)).slice(0,S))if(E.e<R&&--S,p=p.slice(S-3,S+1),p=="9999"||!M&&p=="4999"){if(!M&&(J(L,L.e+d+2,0),L.times(L).eq(O))){E=L;break}P+=4,S+=4,M=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(J(E,E.e+d+2,1),v=!E.times(E).eq(O));break}}return J(E,E.e+d+1,g,v)},o.toExponential=function(v,p){return v!=null&&(Lt(v,0,At),v++),H(this,v,p,1)},o.toFixed=function(v,p){return v!=null&&(Lt(v,0,At),v=v+this.e+1),H(this,v,p)},o.toFormat=function(v,p,E){var M,L=this;if(E==null)v!=null&&p&&typeof p=="object"?(E=p,p=null):v&&typeof v=="object"?(E=v,v=p=null):E=et;else if(typeof E!="object")throw Error(qt+"Argument not an object: "+E);if(M=L.toFixed(v,p),L.c){var O,T=M.split("."),S=+E.groupSize,R=+E.secondaryGroupSize,P=E.groupSeparator||"",b=T[0],Y=T[1],z=L.s<0,j=z?b.slice(1):b,at=j.length;if(R&&(O=S,S=R,R=O,at-=O),S>0&&at>0){for(O=at%S||S,b=j.substr(0,O);O<at;O+=S)b+=P+j.substr(O,S);R>0&&(b+=P+j.slice(O)),z&&(b="-"+b)}M=Y?b+(E.decimalSeparator||"")+((R=+E.fractionGroupSize)?Y.replace(new RegExp("\\\\d{"+R+"}\\\\B","g"),"$&"+(E.fractionGroupSeparator||"")):Y):b}return(E.prefix||"")+M+(E.suffix||"")},o.toFraction=function(v){var p,E,M,L,O,T,S,R,P,b,Y,z,j=this,at=j.c;if(v!=null&&(S=new q(v),!S.isInteger()&&(S.c||S.s!==1)||S.lt(y)))throw Error(qt+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+$(S));if(!at)return new q(j);for(p=new q(y),P=E=new q(y),M=R=new q(y),z=Ht(at),O=p.e=z.length-j.e-1,p.c[0]=ii[(T=O%ct)<0?ct+T:T],v=!v||S.comparedTo(p)>0?O>0?p:P:S,T=I,I=1/0,S=new q(z),R.c[0]=0;b=u(S,p,0,1),L=E.plus(b.times(M)),L.comparedTo(v)!=1;)E=M,M=L,P=R.plus(b.times(L=P)),R=L,p=S.minus(b.times(L=p)),S=L;return L=u(v.minus(E),M,0,1),R=R.plus(L.times(P)),E=E.plus(L.times(M)),R.s=P.s=j.s,O=O*2,Y=u(P,M,O,g).minus(j).abs().comparedTo(u(R,E,O,g).minus(j).abs())<1?[P,M]:[R,E],I=T,Y},o.toNumber=function(){return+$(this)},o.toPrecision=function(v,p){return v!=null&&Lt(v,1,At),H(this,v,p,2)},o.toString=function(v){var p,E=this,M=E.s,L=E.e;return L===null?M?(p="Infinity",M<0&&(p="-"+p)):p="NaN":(v==null?p=L<=N||L>=x?Ln(Ht(E.c),L):ce(Ht(E.c),L,"0"):v===10&&ut?(E=J(new q(E),d+L+1,g),p=ce(Ht(E.c),E.e,"0")):(Lt(v,2,K.length,"Base"),p=l(ce(Ht(E.c),L,"0"),10,v,M,!0)),M<0&&E.c[0]&&(p="-"+p)),p},o.valueOf=o.toJSON=function(){return $(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,a!=null&&q.set(a),q}function Vt(a){var u=a|0;return a>0||a===u?u:u-1}function Ht(a){for(var u,l,h=1,o=a.length,y=a[0]+"";h<o;){for(u=a[h++]+"",l=ct-u.length;l--;u="0"+u);y+=u}for(o=y.length;y.charCodeAt(--o)===48;);return y.slice(0,o+1||1)}function Ee(a,u){var l,h,o=a.c,y=u.c,d=a.s,g=u.s,N=a.e,x=u.e;if(!d||!g)return null;if(l=o&&!o[0],h=y&&!y[0],l||h)return l?h?0:-g:d;if(d!=g)return d;if(l=d<0,h=N==x,!o||!y)return h?0:!o^l?1:-1;if(!h)return N>x^l?1:-1;for(g=(N=o.length)<(x=y.length)?N:x,d=0;d<g;d++)if(o[d]!=y[d])return o[d]>y[d]^l?1:-1;return N==x?0:N>x^l?1:-1}function Lt(a,u,l,h){if(a<u||a>l||a!==Xt(a))throw Error(qt+(h||"Argument")+(typeof a=="number"?a<u||a>l?" out of range: ":" not an integer: ":" not a primitive number: ")+String(a))}function Tn(a){var u=a.c.length-1;return Vt(a.e/ct)==u&&a.c[u]%2!=0}function Ln(a,u){return(a.length>1?a.charAt(0)+"."+a.slice(1):a)+(u<0?"e":"e+")+u}function ce(a,u,l){var h,o;if(u<0){for(o=l+".";++u;o+=l);a=o+a}else if(h=a.length,++u>h){for(o=l,u-=h;--u;o+=l);a+=o}else u<h&&(a=a.slice(0,u)+"."+a.slice(u));return a}var se=yr(),da=class{constructor(a){rt(this,"key");rt(this,"left",null);rt(this,"right",null);this.key=a}},Ke=class extends da{constructor(a){super(a)}},pa=class{constructor(){rt(this,"size",0);rt(this,"modificationCount",0);rt(this,"splayCount",0)}splay(a){const u=this.root;if(u==null)return this.compare(a,a),-1;let l=null,h=null,o=null,y=null,d=u;const g=this.compare;let N;for(;;)if(N=g(d.key,a),N>0){let x=d.left;if(x==null||(N=g(x.key,a),N>0&&(d.left=x.right,x.right=d,d=x,x=d.left,x==null)))break;l==null?h=d:l.left=d,l=d,d=x}else if(N<0){let x=d.right;if(x==null||(N=g(x.key,a),N<0&&(d.right=x.left,x.left=d,d=x,x=d.right,x==null)))break;o==null?y=d:o.right=d,o=d,d=x}else break;return o!=null&&(o.right=d.left,d.left=y),l!=null&&(l.left=d.right,d.right=h),this.root!==d&&(this.root=d,this.splayCount++),N}splayMin(a){let u=a,l=u.left;for(;l!=null;){const h=l;u.left=h.right,h.right=u,u=h,l=u.left}return u}splayMax(a){let u=a,l=u.right;for(;l!=null;){const h=l;u.right=h.left,h.left=u,u=h,l=u.right}return u}_delete(a){if(this.root==null||this.splay(a)!=0)return null;let l=this.root;const h=l,o=l.left;if(this.size--,o==null)this.root=l.right;else{const y=l.right;l=this.splayMax(o),l.right=y,this.root=l}return this.modificationCount++,h}addNewRoot(a,u){this.size++,this.modificationCount++;const l=this.root;if(l==null){this.root=a;return}u<0?(a.left=l,a.right=l.right,l.right=null):(a.right=l,a.left=l.left,l.left=null),this.root=a}_first(){const a=this.root;return a==null?null:(this.root=this.splayMin(a),this.root)}_last(){const a=this.root;return a==null?null:(this.root=this.splayMax(a),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(a){return this.validKey(a)&&this.splay(a)==0}defaultCompare(){return(a,u)=>a<u?-1:a>u?1:0}wrap(){return{getRoot:()=>this.root,setRoot:a=>{this.root=a},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:a=>{this.splayCount=a},splay:a=>this.splay(a),has:a=>this.has(a)}}},Rn=class fn extends pa{constructor(l,h){super();rt(this,"root",null);rt(this,"compare");rt(this,"validKey");rt(this,br,"[object Set]");this.compare=l??this.defaultCompare(),this.validKey=h??(o=>o!=null&&o!=null)}delete(l){return this.validKey(l)?this._delete(l)!=null:!1}deleteAll(l){for(const h of l)this.delete(h)}forEach(l){const h=this[Symbol.iterator]();let o;for(;o=h.next(),!o.done;)l(o.value,o.value,this)}add(l){const h=this.splay(l);return h!=0&&this.addNewRoot(new Ke(l),h),this}addAndReturn(l){const h=this.splay(l);return h!=0&&this.addNewRoot(new Ke(l),h),this.root.key}addAll(l){for(const h of l)this.add(h)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(l){if(l==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(l)<0)return this.root.key;let o=this.root.left;if(o==null)return null;let y=o.right;for(;y!=null;)o=y,y=o.right;return o.key}firstAfter(l){if(l==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(l)>0)return this.root.key;let o=this.root.right;if(o==null)return null;let y=o.left;for(;y!=null;)o=y,y=o.left;return o.key}retainAll(l){const h=new fn(this.compare,this.validKey),o=this.modificationCount;for(const y of l){if(o!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(y)&&this.splay(y)==0&&h.add(this.root.key)}h.size!=this.size&&(this.root=h.root,this.size=h.size,this.modificationCount++)}lookup(l){return!this.validKey(l)||this.splay(l)!=0?null:this.root.key}intersection(l){const h=new fn(this.compare,this.validKey);for(const o of this)l.has(o)&&h.add(o);return h}difference(l){const h=new fn(this.compare,this.validKey);for(const o of this)l.has(o)||h.add(o);return h}union(l){const h=this.clone();return h.addAll(l),h}clone(){const l=new fn(this.compare,this.validKey);return l.size=this.size,l.root=this.copyNode(this.root),l}copyNode(l){if(l==null)return null;function h(y,d){let g,N;do{if(g=y.left,N=y.right,g!=null){const x=new Ke(g.key);d.left=x,h(g,x)}if(N!=null){const x=new Ke(N.key);d.right=x,y=N,d=x}}while(N!=null)}const o=new Ke(l.key);return h(l,o),o}toSet(){return this.clone()}entries(){return new xa(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(Pr=Symbol.iterator,br=Symbol.toStringTag,Pr)](){return new _a(this.wrap())}},mr=class{constructor(a){rt(this,"tree");rt(this,"path",new Array);rt(this,"modificationCount",null);rt(this,"splayCount");this.tree=a,this.splayCount=a.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const a=this.path[this.path.length-1];return this.getValue(a)}rebuildPath(a){this.path.splice(0,this.path.length),this.tree.splay(a),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(a){for(;a!=null;)this.path.push(a),a=a.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let l=this.tree.getRoot();for(;l!=null;)this.path.push(l),l=l.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let a=this.path[this.path.length-1],u=a.right;if(u!=null){for(;u!=null;)this.path.push(u),u=u.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===a;)a=this.path.pop();return this.path.length>0}},_a=class extends mr{getValue(a){return a.key}},xa=class extends mr{getValue(a){return[a.key,a.key]}},vr=a=>()=>a,ri=a=>{const u=a?(l,h)=>h.minus(l).abs().isLessThanOrEqualTo(a):vr(!1);return(l,h)=>u(l,h)?0:l.comparedTo(h)};function ka(a){const u=a?(l,h,o,y,d)=>l.exponentiatedBy(2).isLessThanOrEqualTo(y.minus(h).exponentiatedBy(2).plus(d.minus(o).exponentiatedBy(2)).times(a)):vr(!1);return(l,h,o)=>{const y=l.x,d=l.y,g=o.x,N=o.y,x=d.minus(N).times(h.x.minus(g)).minus(y.minus(g).times(h.y.minus(N)));return u(x,y,d,g,N)?0:x.comparedTo(0)}}var Ea=a=>a,Ia=a=>{if(a){const u=new Rn(ri(a)),l=new Rn(ri(a)),h=(y,d)=>d.addAndReturn(y),o=y=>({x:h(y.x,u),y:h(y.y,l)});return o({x:new se(0),y:new se(0)}),o}return Ea},si=a=>({set:u=>{fe=si(u)},reset:()=>si(a),compare:ri(a),snap:Ia(a),orient:ka(a)}),fe=si(),Je=(a,u)=>a.ll.x.isLessThanOrEqualTo(u.x)&&u.x.isLessThanOrEqualTo(a.ur.x)&&a.ll.y.isLessThanOrEqualTo(u.y)&&u.y.isLessThanOrEqualTo(a.ur.y),ai=(a,u)=>{if(u.ur.x.isLessThan(a.ll.x)||a.ur.x.isLessThan(u.ll.x)||u.ur.y.isLessThan(a.ll.y)||a.ur.y.isLessThan(u.ll.y))return null;const l=a.ll.x.isLessThan(u.ll.x)?u.ll.x:a.ll.x,h=a.ur.x.isLessThan(u.ur.x)?a.ur.x:u.ur.x,o=a.ll.y.isLessThan(u.ll.y)?u.ll.y:a.ll.y,y=a.ur.y.isLessThan(u.ur.y)?a.ur.y:u.ur.y;return{ll:{x:l,y:o},ur:{x:h,y}}},Cn=(a,u)=>a.x.times(u.y).minus(a.y.times(u.x)),dr=(a,u)=>a.x.times(u.x).plus(a.y.times(u.y)),On=a=>dr(a,a).sqrt(),Na=(a,u,l)=>{const h={x:u.x.minus(a.x),y:u.y.minus(a.y)},o={x:l.x.minus(a.x),y:l.y.minus(a.y)};return Cn(o,h).div(On(o)).div(On(h))},wa=(a,u,l)=>{const h={x:u.x.minus(a.x),y:u.y.minus(a.y)},o={x:l.x.minus(a.x),y:l.y.minus(a.y)};return dr(o,h).div(On(o)).div(On(h))},pr=(a,u,l)=>u.y.isZero()?null:{x:a.x.plus(u.x.div(u.y).times(l.minus(a.y))),y:l},_r=(a,u,l)=>u.x.isZero()?null:{x:l,y:a.y.plus(u.y.div(u.x).times(l.minus(a.x)))},Sa=(a,u,l,h)=>{if(u.x.isZero())return _r(l,h,a.x);if(h.x.isZero())return _r(a,u,l.x);if(u.y.isZero())return pr(l,h,a.y);if(h.y.isZero())return pr(a,u,l.y);const o=Cn(u,h);if(o.isZero())return null;const y={x:l.x.minus(a.x),y:l.y.minus(a.y)},d=Cn(y,u).div(o),g=Cn(y,h).div(o),N=a.x.plus(g.times(u.x)),x=l.x.plus(d.times(h.x)),w=a.y.plus(g.times(u.y)),I=l.y.plus(d.times(h.y)),F=N.plus(x).div(2),B=w.plus(I).div(2);return{x:F,y:B}},ae=class Rs{constructor(u,l){rt(this,"point");rt(this,"isLeft");rt(this,"segment");rt(this,"otherSE");rt(this,"consumedBy");u.events===void 0?u.events=[this]:u.events.push(this),this.point=u,this.isLeft=l}static compare(u,l){const h=Rs.comparePoints(u.point,l.point);return h!==0?h:(u.point!==l.point&&u.link(l),u.isLeft!==l.isLeft?u.isLeft?1:-1:Mn.compare(u.segment,l.segment))}static comparePoints(u,l){return u.x.isLessThan(l.x)?-1:u.x.isGreaterThan(l.x)?1:u.y.isLessThan(l.y)?-1:u.y.isGreaterThan(l.y)?1:0}link(u){if(u.point===this.point)throw new Error("Tried to link already linked events");const l=u.point.events;for(let h=0,o=l.length;h<o;h++){const y=l[h];this.point.events.push(y),y.point=this.point}this.checkForConsuming()}checkForConsuming(){const u=this.point.events.length;for(let l=0;l<u;l++){const h=this.point.events[l];if(h.segment.consumedBy===void 0)for(let o=l+1;o<u;o++){const y=this.point.events[o];y.consumedBy===void 0&&h.otherSE.point.events===y.otherSE.point.events&&h.segment.consume(y.segment)}}}getAvailableLinkedEvents(){const u=[];for(let l=0,h=this.point.events.length;l<h;l++){const o=this.point.events[l];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&u.push(o)}return u}getLeftmostComparator(u){const l=new Map,h=o=>{const y=o.otherSE;l.set(o,{sine:Na(this.point,u.point,y.point),cosine:wa(this.point,u.point,y.point)})};return(o,y)=>{l.has(o)||h(o),l.has(y)||h(y);const{sine:d,cosine:g}=l.get(o),{sine:N,cosine:x}=l.get(y);return d.isGreaterThanOrEqualTo(0)&&N.isGreaterThanOrEqualTo(0)?g.isLessThan(x)?1:g.isGreaterThan(x)?-1:0:d.isLessThan(0)&&N.isLessThan(0)?g.isLessThan(x)?-1:g.isGreaterThan(x)?1:0:N.isLessThan(d)?-1:N.isGreaterThan(d)?1:0}}},Ta=class Oi{constructor(u){rt(this,"events");rt(this,"poly");rt(this,"_isExteriorRing");rt(this,"_enclosingRing");this.events=u;for(let l=0,h=u.length;l<h;l++)u[l].segment.ringOut=this;this.poly=null}static factory(u){const l=[];for(let h=0,o=u.length;h<o;h++){const y=u[h];if(!y.isInResult()||y.ringOut)continue;let d=null,g=y.leftSE,N=y.rightSE;const x=[g],w=g.point,I=[];for(;d=g,g=N,x.push(g),g.point!==w;)for(;;){const F=g.getAvailableLinkedEvents();if(F.length===0){const et=x[0].point,K=x[x.length-1].point;throw new Error(`Unable to complete output ring starting at [${et.x}, ${et.y}]. Last matching segment found ends at [${K.x}, ${K.y}].`)}if(F.length===1){N=F[0].otherSE;break}let B=null;for(let et=0,K=I.length;et<K;et++)if(I[et].point===g.point){B=et;break}if(B!==null){const et=I.splice(B)[0],K=x.splice(et.index);K.unshift(K[0].otherSE),l.push(new Oi(K.reverse()));continue}I.push({index:x.length,point:g.point});const G=g.getLeftmostComparator(d);N=F.sort(G)[0].otherSE;break}l.push(new Oi(x))}return l}getGeom(){let u=this.events[0].point;const l=[u];for(let x=1,w=this.events.length-1;x<w;x++){const I=this.events[x].point,F=this.events[x+1].point;fe.orient(I,u,F)!==0&&(l.push(I),u=I)}if(l.length===1)return null;const h=l[0],o=l[1];fe.orient(h,u,o)===0&&l.shift(),l.push(l[0]);const y=this.isExteriorRing()?1:-1,d=this.isExteriorRing()?0:l.length-1,g=this.isExteriorRing()?l.length:-1,N=[];for(let x=d;x!=g;x+=y)N.push([l[x].x.toNumber(),l[x].y.toNumber()]);return N}isExteriorRing(){if(this._isExteriorRing===void 0){const u=this.enclosingRing();this._isExteriorRing=u?!u.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){var o,y;let u=this.events[0];for(let d=1,g=this.events.length;d<g;d++){const N=this.events[d];ae.compare(u,N)>0&&(u=N)}let l=u.segment.prevInResult(),h=l?l.prevInResult():null;for(;;){if(!l)return null;if(!h)return l.ringOut;if(h.ringOut!==l.ringOut)return((o=h.ringOut)==null?void 0:o.enclosingRing())!==l.ringOut?l.ringOut:(y=l.ringOut)==null?void 0:y.enclosingRing();l=h.prevInResult(),h=l?l.prevInResult():null}}},xr=class{constructor(a){rt(this,"exteriorRing");rt(this,"interiorRings");this.exteriorRing=a,a.poly=this,this.interiorRings=[]}addInterior(a){this.interiorRings.push(a),a.poly=this}getGeom(){const a=this.exteriorRing.getGeom();if(a===null)return null;const u=[a];for(let l=0,h=this.interiorRings.length;l<h;l++){const o=this.interiorRings[l].getGeom();o!==null&&u.push(o)}return u}},La=class{constructor(a){rt(this,"rings");rt(this,"polys");this.rings=a,this.polys=this._composePolys(a)}getGeom(){const a=[];for(let u=0,l=this.polys.length;u<l;u++){const h=this.polys[u].getGeom();h!==null&&a.push(h)}return a}_composePolys(a){var l;const u=[];for(let h=0,o=a.length;h<o;h++){const y=a[h];if(!y.poly)if(y.isExteriorRing())u.push(new xr(y));else{const d=y.enclosingRing();d!=null&&d.poly||u.push(new xr(d)),(l=d==null?void 0:d.poly)==null||l.addInterior(y)}}return u}},Ra=class{constructor(a,u=Mn.compare){rt(this,"queue");rt(this,"tree");rt(this,"segments");this.queue=a,this.tree=new Rn(u),this.segments=[]}process(a){const u=a.segment,l=[];if(a.consumedBy)return a.isLeft?this.queue.delete(a.otherSE):this.tree.delete(u),l;a.isLeft&&this.tree.add(u);let h=u,o=u;do h=this.tree.lastBefore(h);while(h!=null&&h.consumedBy!=null);do o=this.tree.firstAfter(o);while(o!=null&&o.consumedBy!=null);if(a.isLeft){let y=null;if(h){const g=h.getIntersection(u);if(g!==null&&(u.isAnEndpoint(g)||(y=g),!h.isAnEndpoint(g))){const N=this._splitSafely(h,g);for(let x=0,w=N.length;x<w;x++)l.push(N[x])}}let d=null;if(o){const g=o.getIntersection(u);if(g!==null&&(u.isAnEndpoint(g)||(d=g),!o.isAnEndpoint(g))){const N=this._splitSafely(o,g);for(let x=0,w=N.length;x<w;x++)l.push(N[x])}}if(y!==null||d!==null){let g=null;y===null?g=d:d===null?g=y:g=ae.comparePoints(y,d)<=0?y:d,this.queue.delete(u.rightSE),l.push(u.rightSE);const N=u.split(g);for(let x=0,w=N.length;x<w;x++)l.push(N[x])}l.length>0?(this.tree.delete(u),l.push(a)):(this.segments.push(u),u.prev=h)}else{if(h&&o){const y=h.getIntersection(o);if(y!==null){if(!h.isAnEndpoint(y)){const d=this._splitSafely(h,y);for(let g=0,N=d.length;g<N;g++)l.push(d[g])}if(!o.isAnEndpoint(y)){const d=this._splitSafely(o,y);for(let g=0,N=d.length;g<N;g++)l.push(d[g])}}}this.tree.delete(u)}return l}_splitSafely(a,u){this.tree.delete(a);const l=a.rightSE;this.queue.delete(l);const h=a.split(u);return h.push(l),a.consumedBy===void 0&&this.tree.add(a),h}},Ca=class{constructor(){rt(this,"type");rt(this,"numMultiPolys")}run(a,u,l){je.type=a;const h=[new Er(u,!0)];for(let x=0,w=l.length;x<w;x++)h.push(new Er(l[x],!1));if(je.numMultiPolys=h.length,je.type==="difference"){const x=h[0];let w=1;for(;w<h.length;)ai(h[w].bbox,x.bbox)!==null?w++:h.splice(w,1)}if(je.type==="intersection")for(let x=0,w=h.length;x<w;x++){const I=h[x];for(let F=x+1,B=h.length;F<B;F++)if(ai(I.bbox,h[F].bbox)===null)return[]}const o=new Rn(ae.compare);for(let x=0,w=h.length;x<w;x++){const I=h[x].getSweepEvents();for(let F=0,B=I.length;F<B;F++)o.add(I[F])}const y=new Ra(o);let d=null;for(o.size!=0&&(d=o.first(),o.delete(d));d;){const x=y.process(d);for(let w=0,I=x.length;w<I;w++){const F=x[w];F.consumedBy===void 0&&o.add(F)}o.size!=0?(d=o.first(),o.delete(d)):d=null}fe.reset();const g=Ta.factory(y.segments);return new La(g).getGeom()}},je=new Ca,Qe=je,Oa=0,Mn=class Hn{constructor(u,l,h,o){rt(this,"id");rt(this,"leftSE");rt(this,"rightSE");rt(this,"rings");rt(this,"windings");rt(this,"ringOut");rt(this,"consumedBy");rt(this,"prev");rt(this,"_prevInResult");rt(this,"_beforeState");rt(this,"_afterState");rt(this,"_isInResult");this.id=++Oa,this.leftSE=u,u.segment=this,u.otherSE=l,this.rightSE=l,l.segment=this,l.otherSE=u,this.rings=h,this.windings=o}static compare(u,l){const h=u.leftSE.point.x,o=l.leftSE.point.x,y=u.rightSE.point.x,d=l.rightSE.point.x;if(d.isLessThan(h))return 1;if(y.isLessThan(o))return-1;const g=u.leftSE.point.y,N=l.leftSE.point.y,x=u.rightSE.point.y,w=l.rightSE.point.y;if(h.isLessThan(o)){if(N.isLessThan(g)&&N.isLessThan(x))return 1;if(N.isGreaterThan(g)&&N.isGreaterThan(x))return-1;const I=u.comparePoint(l.leftSE.point);if(I<0)return 1;if(I>0)return-1;const F=l.comparePoint(u.rightSE.point);return F!==0?F:-1}if(h.isGreaterThan(o)){if(g.isLessThan(N)&&g.isLessThan(w))return-1;if(g.isGreaterThan(N)&&g.isGreaterThan(w))return 1;const I=l.comparePoint(u.leftSE.point);if(I!==0)return I;const F=u.comparePoint(l.rightSE.point);return F<0?1:F>0?-1:1}if(g.isLessThan(N))return-1;if(g.isGreaterThan(N))return 1;if(y.isLessThan(d)){const I=l.comparePoint(u.rightSE.point);if(I!==0)return I}if(y.isGreaterThan(d)){const I=u.comparePoint(l.rightSE.point);if(I<0)return 1;if(I>0)return-1}if(!y.eq(d)){const I=x.minus(g),F=y.minus(h),B=w.minus(N),G=d.minus(o);if(I.isGreaterThan(F)&&B.isLessThan(G))return 1;if(I.isLessThan(F)&&B.isGreaterThan(G))return-1}return y.isGreaterThan(d)?1:y.isLessThan(d)||x.isLessThan(w)?-1:x.isGreaterThan(w)?1:u.id<l.id?-1:u.id>l.id?1:0}static fromRing(u,l,h){let o,y,d;const g=ae.comparePoints(u,l);if(g<0)o=u,y=l,d=1;else if(g>0)o=l,y=u,d=-1;else throw new Error(`Tried to create degenerate segment at [${u.x}, ${u.y}]`);const N=new ae(o,!0),x=new ae(y,!1);return new Hn(N,x,[h],[d])}replaceRightSE(u){this.rightSE=u,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const u=this.leftSE.point.y,l=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:u.isLessThan(l)?u:l},ur:{x:this.rightSE.point.x,y:u.isGreaterThan(l)?u:l}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(u){return u.x.eq(this.leftSE.point.x)&&u.y.eq(this.leftSE.point.y)||u.x.eq(this.rightSE.point.x)&&u.y.eq(this.rightSE.point.y)}comparePoint(u){return fe.orient(this.leftSE.point,u,this.rightSE.point)}getIntersection(u){const l=this.bbox(),h=u.bbox(),o=ai(l,h);if(o===null)return null;const y=this.leftSE.point,d=this.rightSE.point,g=u.leftSE.point,N=u.rightSE.point,x=Je(l,g)&&this.comparePoint(g)===0,w=Je(h,y)&&u.comparePoint(y)===0,I=Je(l,N)&&this.comparePoint(N)===0,F=Je(h,d)&&u.comparePoint(d)===0;if(w&&x)return F&&!I?d:!F&&I?N:null;if(w)return I&&y.x.eq(N.x)&&y.y.eq(N.y)?null:y;if(x)return F&&d.x.eq(g.x)&&d.y.eq(g.y)?null:g;if(F&&I)return null;if(F)return d;if(I)return N;const B=Sa(y,this.vector(),g,u.vector());return B===null||!Je(o,B)?null:fe.snap(B)}split(u){const l=[],h=u.events!==void 0,o=new ae(u,!0),y=new ae(u,!1),d=this.rightSE;this.replaceRightSE(y),l.push(y),l.push(o);const g=new Hn(o,d,this.rings.slice(),this.windings.slice());return ae.comparePoints(g.leftSE.point,g.rightSE.point)>0&&g.swapEvents(),ae.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),h&&(o.checkForConsuming(),y.checkForConsuming()),l}swapEvents(){const u=this.rightSE;this.rightSE=this.leftSE,this.leftSE=u,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let l=0,h=this.windings.length;l<h;l++)this.windings[l]*=-1}consume(u){let l=this,h=u;for(;l.consumedBy;)l=l.consumedBy;for(;h.consumedBy;)h=h.consumedBy;const o=Hn.compare(l,h);if(o!==0){if(o>0){const y=l;l=h,h=y}if(l.prev===h){const y=l;l=h,h=y}for(let y=0,d=h.rings.length;y<d;y++){const g=h.rings[y],N=h.windings[y],x=l.rings.indexOf(g);x===-1?(l.rings.push(g),l.windings.push(N)):l.windings[x]+=N}h.rings=null,h.windings=null,h.consumedBy=l,h.leftSE.consumedBy=l.leftSE,h.rightSE.consumedBy=l.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const u=this.prev.consumedBy||this.prev;this._beforeState=u.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const u=this.beforeState();this._afterState={rings:u.rings.slice(0),windings:u.windings.slice(0),multiPolys:[]};const l=this._afterState.rings,h=this._afterState.windings,o=this._afterState.multiPolys;for(let g=0,N=this.rings.length;g<N;g++){const x=this.rings[g],w=this.windings[g],I=l.indexOf(x);I===-1?(l.push(x),h.push(w)):h[I]+=w}const y=[],d=[];for(let g=0,N=l.length;g<N;g++){if(h[g]===0)continue;const x=l[g],w=x.poly;if(d.indexOf(w)===-1)if(x.isExterior)y.push(w);else{d.indexOf(w)===-1&&d.push(w);const I=y.indexOf(x.poly);I!==-1&&y.splice(I,1)}}for(let g=0,N=y.length;g<N;g++){const x=y[g].multiPoly;o.indexOf(x)===-1&&o.push(x)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const u=this.beforeState().multiPolys,l=this.afterState().multiPolys;switch(Qe.type){case"union":{const h=u.length===0,o=l.length===0;this._isInResult=h!==o;break}case"intersection":{let h,o;u.length<l.length?(h=u.length,o=l.length):(h=l.length,o=u.length),this._isInResult=o===Qe.numMultiPolys&&h<o;break}case"xor":{const h=Math.abs(u.length-l.length);this._isInResult=h%2===1;break}case"difference":{const h=o=>o.length===1&&o[0].isSubject;this._isInResult=h(u)!==h(l);break}}return this._isInResult}},kr=class{constructor(a,u,l){rt(this,"poly");rt(this,"isExterior");rt(this,"segments");rt(this,"bbox");if(!Array.isArray(a)||a.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=u,this.isExterior=l,this.segments=[],typeof a[0][0]!="number"||typeof a[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const h=fe.snap({x:new se(a[0][0]),y:new se(a[0][1])});this.bbox={ll:{x:h.x,y:h.y},ur:{x:h.x,y:h.y}};let o=h;for(let y=1,d=a.length;y<d;y++){if(typeof a[y][0]!="number"||typeof a[y][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const g=fe.snap({x:new se(a[y][0]),y:new se(a[y][1])});g.x.eq(o.x)&&g.y.eq(o.y)||(this.segments.push(Mn.fromRing(o,g,this)),g.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=g.x),g.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=g.y),g.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=g.x),g.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=g.y),o=g)}(!h.x.eq(o.x)||!h.y.eq(o.y))&&this.segments.push(Mn.fromRing(o,h,this))}getSweepEvents(){const a=[];for(let u=0,l=this.segments.length;u<l;u++){const h=this.segments[u];a.push(h.leftSE),a.push(h.rightSE)}return a}},Ma=class{constructor(a,u){rt(this,"multiPoly");rt(this,"exteriorRing");rt(this,"interiorRings");rt(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new kr(a[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let l=1,h=a.length;l<h;l++){const o=new kr(a[l],this,!1);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=u}getSweepEvents(){const a=this.exteriorRing.getSweepEvents();for(let u=0,l=this.interiorRings.length;u<l;u++){const h=this.interiorRings[u].getSweepEvents();for(let o=0,y=h.length;o<y;o++)a.push(h[o])}return a}},Er=class{constructor(a,u){rt(this,"isSubject");rt(this,"polys");rt(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof a[0][0][0]=="number"&&(a=[a])}catch{}this.polys=[],this.bbox={ll:{x:new se(Number.POSITIVE_INFINITY),y:new se(Number.POSITIVE_INFINITY)},ur:{x:new se(Number.NEGATIVE_INFINITY),y:new se(Number.NEGATIVE_INFINITY)}};for(let l=0,h=a.length;l<h;l++){const o=new Ma(a[l],this);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=u}getSweepEvents(){const a=[];for(let u=0,l=this.polys.length;u<l;u++){const h=this.polys[u].getSweepEvents();for(let o=0,y=h.length;o<y;o++)a.push(h[o])}return a}},ba=(a,...u)=>Qe.run("union",a,u),Pa=(a,...u)=>Qe.run("intersection",a,u),Aa=(a,...u)=>Qe.run("difference",a,u);fe.set;function bn(a){const u=[];if(xe(a,o=>{u.push(o.coordinates)}),u.length<2)throw new Error("Must have at least two features");const l=a.features[0].properties||{},h=Aa(u[0],...u.slice(1));return h.length===0?null:h.length===1?Me(h[0],l):Ve(h,l)}function Ir(a,u={}){const l=[];if(xe(a,o=>{l.push(o.coordinates)}),l.length<2)throw new Error("Must specify at least 2 geometries");const h=Pa(l[0],...l.slice(1));return h.length===0?null:h.length===1?Me(h[0],u.properties):Ve(h,u.properties)}function Nr(a,u={}){const l=[];if(xe(a,o=>{l.push(o.coordinates)}),l.length<2)throw new Error("Must have at least 2 geometries");const h=ba(l[0],...l.slice(1));return h.length===0?null:h.length===1?Me(h[0],u.properties):Ve(h,u.properties)}function Da(a){if(!a)throw new Error("coord is required");if(!Array.isArray(a)){if(a.type==="Feature"&&a.geometry!==null&&a.geometry.type==="Point")return[...a.geometry.coordinates];if(a.type==="Point")return[...a.coordinates]}if(Array.isArray(a)&&a.length>=2&&!Array.isArray(a[0])&&!Array.isArray(a[1]))return[...a];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $e(a){if(Array.isArray(a))return a;if(a.type==="Feature"){if(a.geometry!==null)return a.geometry.coordinates}else if(a.coordinates)return a.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Fa(a,u){return a.type==="FeatureCollection"?"FeatureCollection":a.type==="GeometryCollection"?"GeometryCollection":a.type==="Feature"&&a.geometry!==null?a.geometry.type:a.type}function wr(a,u,l={}){const h=Da(a),o=$e(u);for(let y=0;y<o.length-1;y++){let d=!1;if(l.ignoreEndVertices&&(y===0&&(d="start"),y===o.length-2&&(d="end"),y===0&&y+1===o.length-1&&(d="both")),Ga(o[y],o[y+1],h,d,typeof l.epsilon>"u"?null:l.epsilon))return!0}return!1}function Ga(a,u,l,h,o){const y=l[0],d=l[1],g=a[0],N=a[1],x=u[0],w=u[1],I=l[0]-g,F=l[1]-N,B=x-g,G=w-N,et=I*G-F*B;if(o!==null){if(Math.abs(et)>o)return!1}else if(et!==0)return!1;if(Math.abs(B)===Math.abs(G)&&Math.abs(B)===0)return h?!1:l[0]===a[0]&&l[1]===a[1];if(h){if(h==="start")return Math.abs(B)>=Math.abs(G)?B>0?g<y&&y<=x:x<=y&&y<g:G>0?N<d&&d<=w:w<=d&&d<N;if(h==="end")return Math.abs(B)>=Math.abs(G)?B>0?g<=y&&y<x:x<y&&y<=g:G>0?N<=d&&d<w:w<d&&d<=N;if(h==="both")return Math.abs(B)>=Math.abs(G)?B>0?g<y&&y<x:x<y&&y<g:G>0?N<d&&d<w:w<d&&d<N}else return Math.abs(B)>=Math.abs(G)?B>0?g<=y&&y<=x:x<=y&&y<=g:G>0?N<=d&&d<=w:w<=d&&d<=N;return!1}function qa(a,u={}){var l=typeof u=="object"?u.mutate:u;if(!a)throw new Error("geojson is required");var h=Fa(a),o=[];switch(h){case"LineString":o=ui(a,h);break;case"MultiLineString":case"Polygon":$e(a).forEach(function(d){o.push(ui(d,h))});break;case"MultiPolygon":$e(a).forEach(function(d){var g=[];d.forEach(function(N){g.push(ui(N,h))}),o.push(g)});break;case"Point":return a;case"MultiPoint":var y={};$e(a).forEach(function(d){var g=d.join("-");Object.prototype.hasOwnProperty.call(y,g)||(o.push(d),y[g]=!0)});break;default:throw new Error(h+" geometry not supported")}return a.coordinates?l===!0?(a.coordinates=o,a):{type:h,coordinates:o}:l===!0?(a.geometry.coordinates=o,a):Qt({type:h,coordinates:o},a.properties,{bbox:a.bbox,id:a.id})}function ui(a,u){const l=$e(a);if(l.length===2&&!Sr(l[0],l[1]))return l;const h=[];let o=0,y=1,d=2;for(h.push(l[o]);d<l.length;)wr(l[y],Zn([l[o],l[d]]))?y=d:(h.push(l[y]),o=y,y++,d=y),d++;if(h.push(l[y]),u==="Polygon"||u==="MultiPolygon"){if(wr(h[0],Zn([h[1],h[h.length-2]]))&&(h.shift(),h.pop(),h.push(h[0])),h.length<4)throw new Error("invalid polygon, fewer than 4 points");if(!Sr(h[0],h[h.length-1]))throw new Error("invalid polygon, first and last points not equal")}return h}function Sr(a,u){return a[0]===u[0]&&a[1]===u[1]}function Ba(a){if(!a)throw new Error("geojson is required");switch(a.type){case"Feature":return Tr(a);case"FeatureCollection":return Ya(a);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return oi(a);default:throw new Error("unknown GeoJSON type")}}function Tr(a){const u={type:"Feature"};return Object.keys(a).forEach(l=>{switch(l){case"type":case"properties":case"geometry":return;default:u[l]=a[l]}}),u.properties=Lr(a.properties),a.geometry==null?u.geometry=null:u.geometry=oi(a.geometry),u}function Lr(a){const u={};return a&&Object.keys(a).forEach(l=>{const h=a[l];typeof h=="object"?h===null?u[l]=null:Array.isArray(h)?u[l]=h.map(o=>o):u[l]=Lr(h):u[l]=h}),u}function Ya(a){const u={type:"FeatureCollection"};return Object.keys(a).forEach(l=>{switch(l){case"type":case"features":return;default:u[l]=a[l]}}),u.features=a.features.map(l=>Tr(l)),u}function oi(a){const u={type:a.type};return a.bbox&&(u.bbox=a.bbox),a.type==="GeometryCollection"?(u.geometries=a.geometries.map(l=>oi(l)),u):(u.coordinates=Rr(a.coordinates),u)}function Rr(a){const u=a;return typeof u[0]!="object"?u.slice():u.map(l=>Rr(l))}function za(a,u){var l=a[0]-u[0],h=a[1]-u[1];return l*l+h*h}function Ua(a,u,l){var h=u[0],o=u[1],y=l[0]-h,d=l[1]-o;if(y!==0||d!==0){var g=((a[0]-h)*y+(a[1]-o)*d)/(y*y+d*d);g>1?(h=l[0],o=l[1]):g>0&&(h+=y*g,o+=d*g)}return y=a[0]-h,d=a[1]-o,y*y+d*d}function Xa(a,u){for(var l=a[0],h=[l],o,y=1,d=a.length;y<d;y++)o=a[y],za(o,l)>u&&(h.push(o),l=o);return l!==o&&h.push(o),h}function li(a,u,l,h,o){for(var y=h,d,g=u+1;g<l;g++){var N=Ua(a[g],a[u],a[l]);N>y&&(d=g,y=N)}y>h&&(d-u>1&&li(a,u,d,h,o),o.push(a[d]),l-d>1&&li(a,d,l,h,o))}function Va(a,u){var l=a.length-1,h=[a[0]];return li(a,0,l,u,h),h.push(a[l]),h}function Pn(a,u,l){if(a.length<=2)return a;var h=u!==void 0?u*u:1;return a=l?a:Xa(a,h),a=Va(a,h),a}function Ha(a,u={}){var l,h,o;if(u=u??{},!bs(u))throw new Error("options is invalid");const y=(l=u.tolerance)!=null?l:1,d=(h=u.highQuality)!=null?h:!1,g=(o=u.mutate)!=null?o:!1;if(!a)throw new Error("geojson is required");if(y&&y<0)throw new Error("invalid tolerance");return g!==!0&&(a=Ba(a)),xe(a,function(N){Za(N,y,d)}),a}function Za(a,u,l){const h=a.type;if(h==="Point"||h==="MultiPoint")return a;if(qa(a,{mutate:!0}),h!=="GeometryCollection")switch(h){case"LineString":a.coordinates=Pn(a.coordinates,u,l);break;case"MultiLineString":a.coordinates=a.coordinates.map(o=>Pn(o,u,l));break;case"Polygon":a.coordinates=Cr(a.coordinates,u,l);break;case"MultiPolygon":a.coordinates=a.coordinates.map(o=>Cr(o,u,l))}return a}function Cr(a,u,l){return a.map(function(h){if(h.length<4)throw new Error("invalid polygon");let o=u,y=Pn(h,o,l);for(;!Or(y)&&o>=Number.EPSILON;)o-=o*.01,y=Pn(h,o,l);return Or(y)?((y[y.length-1][0]!==y[0][0]||y[y.length-1][1]!==y[0][1])&&y.push(y[0]),y):h})}function Or(a){return a.length<3?!1:!(a.length===3&&a[2][0]===a[0][0]&&a[2][1]===a[0][1])}function Wa(a,u){u=u||{},u.iterations=u.iterations||1;const{iterations:l}=u,h=[];if(!a)throw new Error("inputPolys is required");return xe(a,function(o,y,d){if(o.type==="Polygon"){let g=[[]];for(let N=0;N<l;N++){let x=[],w=o;N>0&&(w=Me(g).geometry),Ka(w,x),g=x.slice(0)}h.push(Me(g,d))}else if(o.type==="MultiPolygon"){let g=[[[]]];for(let N=0;N<l;N++){let x=[],w=o;N>0&&(w=Ve(g).geometry),Ja(w,x),g=x.slice(0)}h.push(Ve(g,d))}else throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}),Xe(h)}function Ka(a,u){var l,h;gn(a,function(o,y,d,g,N){if(h!==N)u.push([]);else{var x=l[0],w=l[1],I=o[0],F=o[1];u[N].push([.75*x+.25*I,.75*w+.25*F]),u[N].push([.25*x+.75*I,.25*w+.75*F])}l=o,h=N},!1),u.forEach(function(o){o.push(o[0])})}function Ja(a,u){let l,h,o;gn(a,function(y,d,g,N,x){if(h!==N)u.push([[]]);else if(o!==x)u[N].push([]);else{var w=l[0],I=l[1],F=y[0],B=y[1];u[N][x].push([.75*w+.25*F,.75*I+.25*B]),u[N][x].push([.25*w+.75*F,.25*I+.75*B])}l=y,h=N,o=x},!1),u.forEach(function(y){y.forEach(function(d){d.push(d[0])})})}function Mr(a,u){let l=a;for(let h=0;h<u;h++){if(l.length<3)return l;const o=[l[0]];for(let y=0;y<l.length-1;y++){const d=l[y],g=l[y+1],N=Math.min(d.length,g.length),x=[],w=[];for(let I=0;I<N;I++)x.push(.75*d[I]+.25*g[I]),w.push(.25*d[I]+.75*g[I]);o.push(x,w)}o.push(l[l.length-1]),l=o}return l}const Ie=a=>Xe(a);function ja(a,u){if(!a&&!u)return null;if(!a)return u;if(!u)return a;const l=Ie([a,u]),h=Nr(l),o=Ir(l);return!o||!h?h:bn(Ie([h,o]))}self.onmessage=a=>{var h,o;const{id:u,payload:l}=a.data;try{if(l.type==="boolean"){const{op:d,features:g}=l;let N=null;if(d==="union"?N=Nr(Ie(g)):d==="intersect"?N=Ir(Ie(g)):d==="subtract"?N=bn(Ie(g)):d==="exclude"&&(N=g.reduce((w,I)=>ja(w,I),null)),!(N!=null&&N.geometry)){const I={id:u,ok:!1,error:{type:"error",message:d==="intersect"?"No overlap found between the selected shapes.":d==="subtract"?"Subtraction resulted in an empty shape.":"Operation failed to produce a valid shape.",code:"EMPTY_RESULT"}};self.postMessage(I);return}const x={id:u,ok:!0,result:{type:"boolean",geometry:N.geometry}};self.postMessage(x);return}if(l.type==="cut-hole"){const d=Me([l.ring]),g=bn(Ie([l.target,d]));if(!(g!=null&&g.geometry)){const x={id:u,ok:!1,error:{type:"error",message:"Failed to cut hole: resulting shape is empty or invalid.",code:"EMPTY_RESULT"}};self.postMessage(x);return}const N={id:u,ok:!0,result:{type:"cut-hole",geometry:g.geometry}};self.postMessage(N);return}if(l.type==="slice-shape"){const d=Zn(l.line),g=lr(d,.01,{units:"meters",steps:1}),N=bn(Ie([l.target,g]));if(!(N!=null&&N.geometry)){const w={id:u,ok:!1,error:{type:"error",message:"Failed to slice shape: result is empty",code:"EMPTY_RESULT"}};self.postMessage(w);return}const x={id:u,ok:!0,result:{type:"slice-shape",geometry:N.geometry}};self.postMessage(x);return}if(l.type==="buffer"||l.type==="simplify"||l.type==="smooth"){const d={type:"Feature",geometry:l.geometry,properties:{}};let g;l.type==="buffer"?g=(h=lr(d,l.distance,{units:"meters"}))==null?void 0:h.geometry:l.type==="simplify"?g=l.tolerance===0?l.geometry:Ha(d,{tolerance:l.tolerance,highQuality:!1,mutate:!0}).geometry:l.geometry.type==="LineString"?g={type:"LineString",coordinates:Mr(l.geometry.coordinates,l.iterations)}:l.geometry.type==="MultiLineString"?g={type:"MultiLineString",coordinates:l.geometry.coordinates.map(x=>Mr(x,l.iterations))}:g=(o=Wa(d,{iterations:l.iterations}).features[0])==null?void 0:o.geometry;const N=g?{id:u,ok:!0,result:{type:l.type,geometry:g}}:{id:u,ok:!1,error:{type:"error",message:"Operation produced an empty shape.",code:"EMPTY_RESULT"}};self.postMessage(N);return}const y={id:u,ok:!1,error:{type:"error",message:"Unknown geometry operation",code:"UNKNOWN_OP"}};self.postMessage(y)}catch(y){const d={id:u,ok:!1,error:{type:"error",message:y instanceof Error?y.message:"Geometry operation failed",code:"EXCEPTION"}};self.postMessage(d)}}})();\n', i = typeof self < "u" && self.Blob && new Blob([r], { type: "text/javascript;charset=utf-8" });
2
+ function s(t) {
3
+ let e;
4
+ try {
5
+ if (e = i && (self.URL || self.webkitURL).createObjectURL(i), !e) throw "";
6
+ const n = new Worker(e, {
7
+ name: t == null ? void 0 : t.name
8
+ });
9
+ return n.addEventListener("error", () => {
10
+ (self.URL || self.webkitURL).revokeObjectURL(e);
11
+ }), n;
12
+ } catch {
13
+ return new Worker(
14
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(r),
15
+ {
16
+ name: t == null ? void 0 : t.name
17
+ }
18
+ );
19
+ } finally {
20
+ e && (self.URL || self.webkitURL).revokeObjectURL(e);
21
+ }
22
+ }
23
+ export {
24
+ s as default
25
+ };